-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Remove unneeded id pk from examples
- Loading branch information
Showing
17 changed files
with
62 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@data-client/endpoint': patch | ||
'@data-client/rest': patch | ||
'@data-client/graphql': patch | ||
--- | ||
|
||
Fix Entity types for TS 4.0 and below |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,45 @@ | ||
// we just removed instances of 'abstract new' | ||
import { AbstractInstanceType } from '../normal.js'; | ||
declare const Entity_base: import('./EntitySchema.js').IEntityClass< | ||
new (...args: any[]) => { | ||
pk( | ||
parent?: any, | ||
key?: string | undefined, | ||
args?: readonly any[] | undefined, | ||
): string | number | undefined; | ||
} | ||
> & | ||
(new (...args: any[]) => { | ||
pk( | ||
parent?: any, | ||
key?: string | undefined, | ||
args?: readonly any[] | undefined, | ||
): string | number | undefined; | ||
}); | ||
declare const Entity_base: import("./EntityTypes.js").IEntityClass<new (...args: any[]) => { | ||
pk(parent?: any, key?: string, args?: readonly any[]): string | number | undefined; | ||
}> & (new (...args: any[]) => { | ||
pk(parent?: any, key?: string, args?: readonly any[]): string | number | undefined; | ||
}); | ||
/** | ||
* Represents data that should be deduped by specifying a primary key. | ||
* @see https://dataclient.io/rest/api/Entity | ||
*/ | ||
export default abstract class Entity extends Entity_base { | ||
/** | ||
* A unique identifier for each Entity | ||
* | ||
* @param [parent] When normalizing, the object which included the entity | ||
* @param [key] When normalizing, the key where this entity was found | ||
* @param [args] ...args sent to Endpoint | ||
* @see https://dataclient.io/rest/api/Entity#pk | ||
*/ | ||
abstract pk( | ||
parent?: any, | ||
key?: string, | ||
args?: readonly any[], | ||
): string | number | undefined; | ||
|
||
/** Control how automatic schema validation is handled | ||
* | ||
* `undefined`: Defaults - throw error in worst offense | ||
* 'warn': only ever warn | ||
* 'silent': Don't bother with processing at all | ||
* | ||
* Note: this only applies to non-nested members. | ||
*/ | ||
protected static automaticValidation?: 'warn' | 'silent'; | ||
/** Factory method to convert from Plain JS Objects. | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
* @see https://dataclient.io/rest/api/Entity#fromJS | ||
*/ | ||
static fromJS: <T extends typeof Entity>( | ||
this: T, | ||
props?: Partial<AbstractInstanceType<T>>, | ||
) => AbstractInstanceType<T>; | ||
|
||
/** | ||
* A unique identifier for each Entity | ||
* | ||
* @param [value] POJO of the entity or subset used | ||
* @param [parent] When normalizing, the object which included the entity | ||
* @param [key] When normalizing, the key where this entity was found | ||
* @param [args] ...args sent to Endpoint | ||
*/ | ||
static pk: <T extends typeof Entity>( | ||
this: T, | ||
value: Partial<AbstractInstanceType<T>>, | ||
parent?: any, | ||
key?: string, | ||
args?: any[], | ||
) => string | number | undefined; | ||
|
||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://dataclient.io/rest/api/Entity#process | ||
*/ | ||
static process( | ||
input: any, | ||
parent: any, | ||
key: string | undefined, | ||
args: any[], | ||
): any; | ||
|
||
/** Returning a string indicates an error (the string is the message) | ||
* @see https://dataclient.io/rest/api/Entity#validate | ||
*/ | ||
static validate(processedEntity: any): string | undefined; | ||
static denormalize: <T extends typeof Entity>( | ||
this: T, | ||
input: any, | ||
args: readonly any[], | ||
unvisit: (schema: any, input: any) => any, | ||
) => AbstractInstanceType<T>; | ||
/** Control how automatic schema validation is handled | ||
* | ||
* `undefined`: Defaults - throw error in worst offense | ||
* 'warn': only ever warn | ||
* 'silent': Don't bother with processing at all | ||
* | ||
* Note: this only applies to non-nested members. | ||
*/ | ||
protected static automaticValidation?: 'warn' | 'silent'; | ||
/** Factory method to convert from Plain JS Objects. | ||
* | ||
* @see https://dataclient.io/rest/api/Entity#fromJS | ||
* @param [props] Plain Object of properties to assign. | ||
*/ | ||
static fromJS: <T extends typeof Entity>(this: T, props?: Partial<AbstractInstanceType<T>>) => AbstractInstanceType<T>; | ||
/** | ||
* A unique identifier for each Entity | ||
* | ||
* @see https://dataclient.io/rest/api/Entity#pk | ||
* @param [value] POJO of the entity or subset used | ||
* @param [parent] When normalizing, the object which included the entity | ||
* @param [key] When normalizing, the key where this entity was found | ||
* @param [args] ...args sent to Endpoint | ||
*/ | ||
static pk: <T extends typeof Entity>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string, args?: any[]) => string | number | undefined; | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://dataclient.io/rest/api/Entity#process | ||
*/ | ||
static process(input: any, parent: any, key: string | undefined, args: any[]): any; | ||
static denormalize: <T extends typeof Entity>(this: T, input: any, args: readonly any[], unvisit: (schema: any, input: any) => any) => AbstractInstanceType<T>; | ||
} | ||
export {}; |
Oops, something went wrong.