@warp-drive/core-types 0.0.0-alpha.40 → 0.0.0-alpha.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon/request.js.map +1 -1
- package/addon/symbols.js +10 -1
- package/addon/symbols.js.map +1 -1
- package/package.json +3 -3
- package/unstable-preview-types/index.d.ts +10 -9
- package/unstable-preview-types/record.d.ts +47 -0
- package/unstable-preview-types/record.d.ts.map +1 -1
- package/unstable-preview-types/record.type-test.d.ts +4 -0
- package/unstable-preview-types/record.type-test.d.ts.map +1 -0
- package/unstable-preview-types/request.d.ts +34 -25
- package/unstable-preview-types/request.d.ts.map +1 -1
- package/unstable-preview-types/symbols.d.ts +8 -0
- package/unstable-preview-types/symbols.d.ts.map +1 -1
package/addon/request.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sources":["../src/request.ts"],"sourcesContent":["import type { StableRecordIdentifier } from './identifier';\nimport type { QueryParamsSerializationOptions } from './params';\nimport type { ResourceIdentifierObject } from './spec/raw';\n\ntype Store = unknown;\n\nexport const SkipCache = Symbol.for('wd:skip-cache');\nexport const EnableHydration = Symbol.for('wd:enable-hydration');\nexport const IS_FUTURE = Symbol('IS_FUTURE');\nexport const STRUCTURED = Symbol('DOC');\n\nexport type HTTPMethod = 'GET' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';\n\n/**\n * Use these options to adjust CacheHandler behavior for a request.\n *\n * @typedoc\n */\nexport type CacheOptions = {\n /**\n * A key that uniquely identifies this request. If not present, the url wil be used\n * as the key for any GET request, while all other requests will not be cached.\n *\n * @typedoc\n */\n key?: string;\n /**\n * If true, the request will be made even if a cached response is present\n * and not expired.\n *\n * @typedoc\n */\n reload?: boolean;\n /**\n * If true, and a cached response is present and not expired, the request\n * will be made in the background and the cached response will be returned.\n *\n * @typedoc\n */\n backgroundReload?: boolean;\n /**\n * Useful for metadata around when to invalidate the cache. Typically used\n * by strategies that invalidate requests by resource type when a new resource\n * of that type has been created. See the LifetimesService implementation\n * provided by `@ember-data/request-utils` for an example.\n *\n * It is recommended to only use this for query/queryRecord requests where\n * new records created later would affect the results, though using it for\n * findRecord requests is also supported if desired where it may be useful\n * when a create may affect the result of a sideloaded relationship.\n *\n * Generally it is better to patch the cache directly for relationship updates\n * than to invalidate findRecord requests for one.\n *\n * @typedoc\n */\n types?: string[];\n\n /**\n * If true, the request will never be handled by the cache-manager and thus\n * will never resolve from cache nor update the cache.\n *\n * Generally this is only used for legacy request that manage resource cache\n * updates in a non-standard way via the LegacyNetworkHandler.\n *\n * @typedoc\n */\n [SkipCache]?: true;\n};\nexport type FindRecordRequestOptions = {\n url: string;\n method: 'GET';\n headers: Headers;\n cacheOptions: CacheOptions;\n op: 'findRecord';\n records: [ResourceIdentifierObject];\n};\n\nexport type QueryRequestOptions = {\n url: string;\n method: 'GET';\n headers: Headers;\n cacheOptions: CacheOptions;\n op: 'query';\n};\n\nexport type PostQueryRequestOptions = {\n url: string;\n method: 'POST' | 'QUERY';\n headers: Headers;\n body: string;\n cacheOptions: CacheOptions & { key: string };\n op: 'query';\n};\n\nexport type DeleteRequestOptions = {\n url: string;\n method: 'DELETE';\n headers: Headers;\n op: 'deleteRecord';\n data: {\n record: StableRecordIdentifier;\n };\n records: [ResourceIdentifierObject];\n};\n\ntype ImmutableRequest<T> = Readonly<T> & {\n readonly headers: ImmutableHeaders;\n readonly records: [StableRecordIdentifier];\n};\n\nexport type UpdateRequestOptions = {\n url: string;\n method: 'PATCH' | 'PUT';\n headers: Headers;\n op: 'updateRecord';\n data: {\n record: StableRecordIdentifier;\n };\n records: [ResourceIdentifierObject];\n};\n\nexport type CreateRequestOptions = {\n url: string;\n method: 'POST';\n headers: Headers;\n op: 'createRecord';\n data: {\n record: StableRecordIdentifier;\n };\n records: [ResourceIdentifierObject];\n};\n\nexport type ImmutableDeleteRequestOptions = ImmutableRequest<DeleteRequestOptions>;\nexport type ImmutableUpdateRequestOptions = ImmutableRequest<UpdateRequestOptions>;\nexport type ImmutableCreateRequestOptions = ImmutableRequest<CreateRequestOptions>;\n\nexport type RemotelyAccessibleIdentifier = {\n id: string;\n type: string;\n lid?: string;\n};\n\nexport type ConstrainedRequestOptions = {\n reload?: boolean;\n backgroundReload?: boolean;\n host?: string;\n namespace?: string;\n resourcePath?: string;\n urlParamsSettings?: QueryParamsSerializationOptions;\n};\n\nexport type FindRecordOptions = ConstrainedRequestOptions & {\n include?: string | string[];\n};\n\nexport interface StructuredDataDocument<T> {\n [STRUCTURED]?: true;\n /**\n * @see {@link ImmutableRequestInfo}\n * @typedoc\n */\n request: ImmutableRequestInfo;\n response: Response | ResponseInfo | null;\n content: T;\n}\nexport interface StructuredErrorDocument<T = unknown> extends Error {\n [STRUCTURED]?: true;\n request: ImmutableRequestInfo;\n response: Response | ResponseInfo | null;\n error: string | object;\n content?: T;\n}\nexport type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument<T>;\n\n/**\n * JavaScript's native Request class.\n *\n * EmberData provides our own typings due to incompleteness in the native typings.\n *\n * @typedoc\n */\ntype Request = {\n /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.\n * @typedoc\n */\n cache?: RequestCache;\n /** Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL.\n * @typedoc\n */\n credentials?: RequestCredentials;\n /** Returns the kind of resource requested by request, e.g., \"document\" or \"script\".\n * @typedoc\n */\n destination?: RequestDestination;\n /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the \"Host\" header.\n * @typedoc\n */\n headers?: Headers;\n /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI]\n * @typedoc\n */\n integrity?: string;\n /** Returns a boolean indicating whether or not request can outlive the global in which it was created.\n * @typedoc\n */\n keepalive?: boolean;\n /** Returns request's HTTP method, which is \"GET\" by default.\n * @typedoc\n */\n method?: HTTPMethod;\n /** Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs.\n * @typedoc\n */\n mode?: RequestMode;\n /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.\n * @typedoc\n */\n redirect?: RequestRedirect;\n /** Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and \"about:client\" when defaulting to the global's default. This is used during fetching to determine the value of the `Referer` header of the request being made.\n * @typedoc\n */\n referrer?: string;\n /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer.\n * @typedoc\n */\n referrerPolicy?: ReferrerPolicy;\n /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.\n * @typedoc\n */\n signal?: AbortSignal;\n /** Returns the URL of request as a string.\n * @typedoc\n */\n url?: string;\n /** Any body that you want to add to your request. Note that a GET or HEAD request may not have a body.\n * @typedoc\n */\n body?: BodyInit | null;\n};\n\nexport type ImmutableHeaders = Headers & { clone?(): Headers; toJSON(): [string, string][] };\n\n/**\n * Extends JavaScript's native {@link Request} object with additional\n * properties specific to the RequestManager's capabilities.\n *\n * @typedoc\n */\nexport type RequestInfo = Request & {\n /**\n * If provided, used instead of the AbortController auto-configured for each request by the RequestManager\n *\n * @typedoc\n */\n controller?: AbortController;\n\n /**\n * @see {@link CacheOptions}\n * @typedoc\n */\n cacheOptions?: CacheOptions;\n store?: Store;\n\n op?: string;\n\n /**\n * The identifiers of the primary resources involved in the request\n * (if any). This may be used by handlers to perform transactional\n * operations on the store.\n *\n * @typedoc\n */\n records?: StableRecordIdentifier[];\n\n disableTestWaiter?: boolean;\n /**\n * data that a handler should convert into\n * the query (GET) or body (POST).\n *\n * Note: It is recommended that builders set query params\n * and body directly in most scenarios.\n *\n * @typedoc\n */\n data?: Record<string, unknown>;\n /**\n * options specifically intended for handlers\n * to utilize to process the request\n *\n * @typedoc\n */\n options?: Record<string, unknown>;\n};\n\n/**\n * Immutable version of {@link RequestInfo}. This is what is passed to handlers.\n *\n * @typedoc\n */\nexport type ImmutableRequestInfo = Readonly<Omit<RequestInfo, 'controller'>> & {\n readonly cacheOptions?: Readonly<CacheOptions>;\n readonly headers?: ImmutableHeaders;\n readonly data?: Readonly<Record<string, unknown>>;\n readonly options?: Readonly<Record<string, unknown>>;\n\n /** Whether the request body has been read.\n * @typedoc\n */\n readonly bodyUsed?: boolean;\n};\n\nexport interface ResponseInfo {\n readonly headers: ImmutableHeaders; // to do, maybe not this?\n readonly ok: boolean;\n readonly redirected: boolean;\n readonly status: number;\n readonly statusText: string;\n readonly type: string;\n readonly url: string;\n}\n\nexport interface RequestContext {\n /**\n * @see {@link ImmutableRequestInfo}\n * @typedoc\n */\n request: ImmutableRequestInfo;\n id: number;\n\n setStream(stream: ReadableStream | Promise<ReadableStream | null>): void;\n setResponse(response: Response | ResponseInfo): void;\n}\n"],"names":["SkipCache","Symbol","for","EnableHydration","IS_FUTURE","STRUCTURED"],"mappings":"AAMO,MAAMA,SAAS,GAAGC,MAAM,CAACC,GAAG,CAAC,eAAe,EAAC;AAC7C,MAAMC,eAAe,GAAGF,MAAM,CAACC,GAAG,CAAC,qBAAqB,EAAC;MACnDE,SAAS,GAAGH,MAAM,CAAC,WAAW,EAAC;MAC/BI,UAAU,GAAGJ,MAAM,CAAC,KAAK,EAAC;;AAIvC;AACA;AACA;AACA;AACA;;AA8JA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8DA;AACA;AACA;AACA;AACA;AACA;;AA+CA;AACA;AACA;AACA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"request.js","sources":["../src/request.ts"],"sourcesContent":["import type { StableRecordIdentifier } from './identifier';\nimport type { QueryParamsSerializationOptions } from './params';\nimport type { ExtractSuggestedCacheTypes, Includes, TypedRecordInstance, TypeFromInstanceOrString } from './record';\nimport type { ResourceIdentifierObject } from './spec/raw';\nimport type { RequestSignature } from './symbols';\n\ntype Store = unknown;\n\nexport const SkipCache = Symbol.for('wd:skip-cache');\nexport const EnableHydration = Symbol.for('wd:enable-hydration');\nexport const IS_FUTURE = Symbol('IS_FUTURE');\nexport const STRUCTURED = Symbol('DOC');\n\nexport type HTTPMethod = 'GET' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';\n\n/**\n * Use these options to adjust CacheHandler behavior for a request.\n *\n * @typedoc\n */\nexport type CacheOptions<T = unknown> = {\n /**\n * A key that uniquely identifies this request. If not present, the url wil be used\n * as the key for any GET request, while all other requests will not be cached.\n *\n * @typedoc\n */\n key?: string;\n /**\n * If true, the request will be made even if a cached response is present\n * and not expired.\n *\n * @typedoc\n */\n reload?: boolean;\n /**\n * If true, and a cached response is present and not expired, the request\n * will be made in the background and the cached response will be returned.\n *\n * @typedoc\n */\n backgroundReload?: boolean;\n /**\n * Useful for metadata around when to invalidate the cache. Typically used\n * by strategies that invalidate requests by resource type when a new resource\n * of that type has been created. See the LifetimesService implementation\n * provided by `@ember-data/request-utils` for an example.\n *\n * It is recommended to only use this for query/queryRecord requests where\n * new records created later would affect the results, though using it for\n * findRecord requests is also supported if desired where it may be useful\n * when a create may affect the result of a sideloaded relationship.\n *\n * Generally it is better to patch the cache directly for relationship updates\n * than to invalidate findRecord requests for one.\n *\n * @typedoc\n */\n types?: T extends TypedRecordInstance ? ExtractSuggestedCacheTypes<T>[] : string[];\n\n /**\n * If true, the request will never be handled by the cache-manager and thus\n * will never resolve from cache nor update the cache.\n *\n * Generally this is only used for legacy request that manage resource cache\n * updates in a non-standard way via the LegacyNetworkHandler.\n *\n * @typedoc\n */\n [SkipCache]?: true;\n};\nexport type FindRecordRequestOptions<T = unknown, RT = unknown> = {\n url: string;\n method: 'GET';\n headers: Headers;\n cacheOptions: CacheOptions<T>;\n op: 'findRecord';\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n [RequestSignature]?: RT;\n};\n\nexport type QueryRequestOptions<T = unknown, RT = unknown> = {\n url: string;\n method: 'GET';\n headers: Headers;\n cacheOptions: CacheOptions<T>;\n op: 'query';\n [RequestSignature]?: RT;\n};\n\nexport type PostQueryRequestOptions<T = unknown, RT = unknown> = {\n url: string;\n method: 'POST' | 'QUERY';\n headers: Headers;\n body: string;\n cacheOptions: CacheOptions<T> & { key: string };\n op: 'query';\n [RequestSignature]?: RT;\n};\n\nexport type DeleteRequestOptions<T = unknown, RT = unknown> = {\n url: string;\n method: 'DELETE';\n headers: Headers;\n op: 'deleteRecord';\n data: {\n record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;\n };\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n [RequestSignature]?: RT;\n};\n\ntype ImmutableRequest<T> = Readonly<T> & {\n readonly headers: ImmutableHeaders;\n readonly records: [StableRecordIdentifier];\n};\n\nexport type UpdateRequestOptions<T = unknown, RT = unknown> = {\n url: string;\n method: 'PATCH' | 'PUT';\n headers: Headers;\n op: 'updateRecord';\n data: {\n record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;\n };\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n [RequestSignature]?: RT;\n};\n\nexport type CreateRequestOptions<T = unknown, RT = unknown> = {\n url: string;\n method: 'POST';\n headers: Headers;\n op: 'createRecord';\n data: {\n record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;\n };\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n [RequestSignature]?: RT;\n};\n\nexport type ImmutableDeleteRequestOptions = ImmutableRequest<DeleteRequestOptions>;\nexport type ImmutableUpdateRequestOptions = ImmutableRequest<UpdateRequestOptions>;\nexport type ImmutableCreateRequestOptions = ImmutableRequest<CreateRequestOptions>;\n\nexport type RemotelyAccessibleIdentifier<T extends string = string> = {\n id: string;\n type: T;\n lid?: string;\n};\n\nexport type ConstrainedRequestOptions = {\n reload?: boolean;\n backgroundReload?: boolean;\n host?: string;\n namespace?: string;\n resourcePath?: string;\n urlParamsSettings?: QueryParamsSerializationOptions;\n};\n\nexport type FindRecordOptions<T = unknown> = ConstrainedRequestOptions & {\n include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];\n};\n\nexport interface StructuredDataDocument<T> {\n [STRUCTURED]?: true;\n /**\n * @see {@link ImmutableRequestInfo}\n * @typedoc\n */\n request: ImmutableRequestInfo;\n response: Response | ResponseInfo | null;\n content: T;\n}\nexport interface StructuredErrorDocument<T = unknown> extends Error {\n [STRUCTURED]?: true;\n request: ImmutableRequestInfo;\n response: Response | ResponseInfo | null;\n error: string | object;\n content?: T;\n}\nexport type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument<T>;\n\n/**\n * JavaScript's native Request class.\n *\n * EmberData provides our own typings due to incompleteness in the native typings.\n *\n * @typedoc\n */\ntype Request = {\n /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.\n * @typedoc\n */\n cache?: RequestCache;\n /** Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL.\n * @typedoc\n */\n credentials?: RequestCredentials;\n /** Returns the kind of resource requested by request, e.g., \"document\" or \"script\".\n * @typedoc\n */\n destination?: RequestDestination;\n /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the \"Host\" header.\n * @typedoc\n */\n headers?: Headers;\n /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI]\n * @typedoc\n */\n integrity?: string;\n /** Returns a boolean indicating whether or not request can outlive the global in which it was created.\n * @typedoc\n */\n keepalive?: boolean;\n /** Returns request's HTTP method, which is \"GET\" by default.\n * @typedoc\n */\n method?: HTTPMethod;\n /** Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs.\n * @typedoc\n */\n mode?: RequestMode;\n /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.\n * @typedoc\n */\n redirect?: RequestRedirect;\n /** Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and \"about:client\" when defaulting to the global's default. This is used during fetching to determine the value of the `Referer` header of the request being made.\n * @typedoc\n */\n referrer?: string;\n /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer.\n * @typedoc\n */\n referrerPolicy?: ReferrerPolicy;\n /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.\n * @typedoc\n */\n signal?: AbortSignal;\n /** Returns the URL of request as a string.\n * @typedoc\n */\n url?: string;\n /** Any body that you want to add to your request. Note that a GET or HEAD request may not have a body.\n * @typedoc\n */\n body?: BodyInit | null;\n};\n\nexport type ImmutableHeaders = Headers & { clone?(): Headers; toJSON(): [string, string][] };\n\n/**\n * Extends JavaScript's native {@link Request} object with additional\n * properties specific to the RequestManager's capabilities.\n *\n * @typedoc\n */\nexport type RequestInfo<T = unknown> = Request & {\n /**\n * If provided, used instead of the AbortController auto-configured for each request by the RequestManager\n *\n * @typedoc\n */\n controller?: AbortController;\n\n /**\n * @see {@link CacheOptions}\n * @typedoc\n */\n cacheOptions?: CacheOptions<T>;\n store?: Store;\n\n op?: string;\n\n /**\n * The identifiers of the primary resources involved in the request\n * (if any). This may be used by handlers to perform transactional\n * operations on the store.\n *\n * @typedoc\n */\n records?: StableRecordIdentifier[];\n\n disableTestWaiter?: boolean;\n /**\n * data that a handler should convert into\n * the query (GET) or body (POST).\n *\n * Note: It is recommended that builders set query params\n * and body directly in most scenarios.\n *\n * @typedoc\n */\n data?: Record<string, unknown>;\n /**\n * options specifically intended for handlers\n * to utilize to process the request\n *\n * @typedoc\n */\n options?: Record<string, unknown>;\n};\n\n/**\n * Immutable version of {@link RequestInfo}. This is what is passed to handlers.\n *\n * @typedoc\n */\nexport type ImmutableRequestInfo<T = unknown> = Readonly<Omit<RequestInfo, 'controller'>> & {\n readonly cacheOptions?: Readonly<CacheOptions>;\n readonly headers?: ImmutableHeaders;\n readonly data?: Readonly<Record<string, unknown>>;\n readonly options?: Readonly<Record<string, unknown>>;\n\n /** Whether the request body has been read.\n * @typedoc\n */\n readonly bodyUsed?: boolean;\n [RequestSignature]?: T;\n};\n\nexport interface ResponseInfo {\n readonly headers: ImmutableHeaders; // to do, maybe not this?\n readonly ok: boolean;\n readonly redirected: boolean;\n readonly status: number;\n readonly statusText: string;\n readonly type: string;\n readonly url: string;\n}\n\nexport interface RequestContext {\n /**\n * @see {@link ImmutableRequestInfo}\n * @typedoc\n */\n request: ImmutableRequestInfo;\n id: number;\n\n setStream(stream: ReadableStream | Promise<ReadableStream | null>): void;\n setResponse(response: Response | ResponseInfo): void;\n}\n"],"names":["SkipCache","Symbol","for","EnableHydration","IS_FUTURE","STRUCTURED"],"mappings":"AAQO,MAAMA,SAAS,GAAGC,MAAM,CAACC,GAAG,CAAC,eAAe,EAAC;AAC7C,MAAMC,eAAe,GAAGF,MAAM,CAACC,GAAG,CAAC,qBAAqB,EAAC;MACnDE,SAAS,GAAGH,MAAM,CAAC,WAAW,EAAC;MAC/BI,UAAU,GAAGJ,MAAM,CAAC,KAAK,EAAC;;AAIvC;AACA;AACA;AACA;AACA;;AAoKA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8DA;AACA;AACA;AACA;AACA;AACA;;AA+CA;AACA;AACA;AACA;AACA;;;;"}
|
package/addon/symbols.js
CHANGED
|
@@ -37,4 +37,13 @@ const ResourceType = Symbol('$type');
|
|
|
37
37
|
* @typedoc
|
|
38
38
|
*/
|
|
39
39
|
const TransformName = Symbol('$TransformName');
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Symbol for use by builders to indicate the return type
|
|
43
|
+
* generic to use for store.request()
|
|
44
|
+
*
|
|
45
|
+
* @type {Symbol}
|
|
46
|
+
* @typedoc
|
|
47
|
+
*/
|
|
48
|
+
const RequestSignature = Symbol('RequestSignature');
|
|
49
|
+
export { RecordStore, RequestSignature, ResourceType, TransformName };
|
package/addon/symbols.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols.js","sources":["../src/symbols.ts"],"sourcesContent":["/*\n * @module @warp-drive/core-types\n */\nexport const RecordStore = Symbol('Store');\n\n/**\n * Symbol for the type of a resource.\n *\n * This is an optional feature that can be used by\n * record implementations to provide a typescript\n * hint for the type of the resource.\n *\n * When used, EmberData and WarpDrive APIs can\n * take advantage of this to provide better type\n * safety and intellisense.\n *\n * @type {Symbol}\n * @typedoc\n */\nexport const ResourceType = Symbol('$type');\n\n/**\n * Symbol for the name of a transform.\n *\n * This is an optional feature that can be used by\n * transform implementations to provide a typescript\n * hint for the name of the transform.\n *\n * If not used, `attr<Transform>('name')` will\n * allow any string name. `attr('name')` will always\n * allow any string name.\n *\n * If used, `attr<Transform>('name')` will enforce\n * that the name is the same as the transform name.\n *\n * @type {Symbol}\n * @typedoc\n */\nexport const TransformName = Symbol('$TransformName');\n"],"names":["RecordStore","Symbol","ResourceType","TransformName"],"mappings":"AAAA;AACA;AACA;MACaA,WAAW,GAAGC,MAAM,CAAC,OAAO,EAAC;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACaC,YAAY,GAAGD,MAAM,CAAC,OAAO,EAAC;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACaE,aAAa,GAAGF,MAAM,CAAC,gBAAgB;;;;"}
|
|
1
|
+
{"version":3,"file":"symbols.js","sources":["../src/symbols.ts"],"sourcesContent":["/*\n * @module @warp-drive/core-types\n */\nexport const RecordStore = Symbol('Store');\n\n/**\n * Symbol for the type of a resource.\n *\n * This is an optional feature that can be used by\n * record implementations to provide a typescript\n * hint for the type of the resource.\n *\n * When used, EmberData and WarpDrive APIs can\n * take advantage of this to provide better type\n * safety and intellisense.\n *\n * @type {Symbol}\n * @typedoc\n */\nexport const ResourceType = Symbol('$type');\n\n/**\n * Symbol for the name of a transform.\n *\n * This is an optional feature that can be used by\n * transform implementations to provide a typescript\n * hint for the name of the transform.\n *\n * If not used, `attr<Transform>('name')` will\n * allow any string name. `attr('name')` will always\n * allow any string name.\n *\n * If used, `attr<Transform>('name')` will enforce\n * that the name is the same as the transform name.\n *\n * @type {Symbol}\n * @typedoc\n */\nexport const TransformName = Symbol('$TransformName');\n\n/**\n * Symbol for use by builders to indicate the return type\n * generic to use for store.request()\n *\n * @type {Symbol}\n * @typedoc\n */\nexport const RequestSignature = Symbol('RequestSignature');\n"],"names":["RecordStore","Symbol","ResourceType","TransformName","RequestSignature"],"mappings":"AAAA;AACA;AACA;MACaA,WAAW,GAAGC,MAAM,CAAC,OAAO,EAAC;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACaC,YAAY,GAAGD,MAAM,CAAC,OAAO,EAAC;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACaE,aAAa,GAAGF,MAAM,CAAC,gBAAgB,EAAC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;MACaG,gBAAgB,GAAGH,MAAM,CAAC,kBAAkB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/core-types",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.42",
|
|
4
4
|
"description": "Provides core logic, utils and types for WarpDrive and EmberData",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"NCC-1701-a-blue.svg"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ember-data/private-build-infra": "5.4.0-alpha.
|
|
32
|
+
"@ember-data/private-build-infra": "5.4.0-alpha.56",
|
|
33
33
|
"ember-cli-babel": "^8.2.0"
|
|
34
34
|
},
|
|
35
35
|
"dependenciesMeta": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@glimmer/component": "^1.1.2",
|
|
53
53
|
"@rollup/plugin-babel": "^6.0.4",
|
|
54
54
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
55
|
-
"@warp-drive/internal-config": "5.4.0-alpha.
|
|
55
|
+
"@warp-drive/internal-config": "5.4.0-alpha.56",
|
|
56
56
|
"ember-source": "~5.7.0",
|
|
57
57
|
"rollup": "^4.14.1",
|
|
58
58
|
"typescript": "^5.4.5",
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
/// <reference path="./graph.d.ts" />
|
|
2
1
|
/// <reference path="./cache.d.ts" />
|
|
2
|
+
/// <reference path="./identifier.d.ts" />
|
|
3
3
|
/// <reference path="./symbols.d.ts" />
|
|
4
|
+
/// <reference path="./graph.d.ts" />
|
|
5
|
+
/// <reference path="./record.type-test.d.ts" />
|
|
6
|
+
/// <reference path="./request.d.ts" />
|
|
4
7
|
/// <reference path="./params.d.ts" />
|
|
5
8
|
/// <reference path="./schema.d.ts" />
|
|
6
|
-
/// <reference path="./request.d.ts" />
|
|
7
|
-
/// <reference path="./identifier.d.ts" />
|
|
8
9
|
/// <reference path="./record.d.ts" />
|
|
10
|
+
/// <reference path="./spec/raw.d.ts" />
|
|
11
|
+
/// <reference path="./spec/error.d.ts" />
|
|
12
|
+
/// <reference path="./spec/document.d.ts" />
|
|
9
13
|
/// <reference path="./json/raw.d.ts" />
|
|
10
|
-
/// <reference path="./cache/aliases.d.ts" />
|
|
11
|
-
/// <reference path="./cache/change.d.ts" />
|
|
12
14
|
/// <reference path="./cache/relationship.d.ts" />
|
|
13
|
-
/// <reference path="./cache/operations.d.ts" />
|
|
14
15
|
/// <reference path="./cache/mutations.d.ts" />
|
|
15
|
-
/// <reference path="./
|
|
16
|
-
/// <reference path="./
|
|
17
|
-
/// <reference path="./
|
|
16
|
+
/// <reference path="./cache/aliases.d.ts" />
|
|
17
|
+
/// <reference path="./cache/operations.d.ts" />
|
|
18
|
+
/// <reference path="./cache/change.d.ts" />
|
|
18
19
|
declare module '@warp-drive/core-types' {
|
|
19
20
|
export type { StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
20
21
|
}
|
|
@@ -44,5 +44,52 @@ declare module '@warp-drive/core-types/record' {
|
|
|
44
44
|
* @typedoc
|
|
45
45
|
*/
|
|
46
46
|
export type TypeFromInstanceOrString<T> = T extends TypedRecordInstance ? T[typeof ResourceType] : string;
|
|
47
|
+
type Unpacked<T> = T extends (infer U)[] ? U : T;
|
|
48
|
+
type NONE = {
|
|
49
|
+
__NONE: never;
|
|
50
|
+
};
|
|
51
|
+
type __InternalExtract<T extends TypedRecordInstance, V extends TypedRecordInstance, IncludePrefix extends boolean, Ignore, Pre extends string> = V extends T ? IncludePrefix extends false ? V[typeof ResourceType] : Pre : V extends Ignore ? IncludePrefix extends false ? V[typeof ResourceType] : Pre : ExtractUnion<V, IncludePrefix, Ignore | T, Pre>;
|
|
52
|
+
type __ExtractIfRecord<T extends TypedRecordInstance, V, IncludePrefix extends boolean, Ignore, Pre extends string> = V extends TypedRecordInstance ? __InternalExtract<T, V, IncludePrefix, Ignore, Pre> : never;
|
|
53
|
+
type _ExtractUnion<T extends TypedRecordInstance, IncludePrefix extends boolean, Ignore, Pre> = {
|
|
54
|
+
[K in keyof T]: K extends string ? __ExtractIfRecord<T, Unpacked<Awaited<T[K]>>, IncludePrefix, Ignore, Pre extends string ? `${Pre}.${K}` : K> : never;
|
|
55
|
+
}[keyof T];
|
|
56
|
+
/**
|
|
57
|
+
* A Utility that extracts either resource types or resource paths from a TypedRecordInstance.
|
|
58
|
+
*
|
|
59
|
+
* Its limitations are mostly around its intentional non-recursiveness. It presumes that APIs which
|
|
60
|
+
* implement includes will not allow cyclical include paths, and will collapse includes by type.
|
|
61
|
+
*
|
|
62
|
+
* This follows closer to the JSON:API fields spec than to the includes spec in nature, but in
|
|
63
|
+
* practice it is so impracticle for an API to allow z-algo include paths that this is probably
|
|
64
|
+
* reasonable.
|
|
65
|
+
*
|
|
66
|
+
* We may need to revisit this in the future, opting to either make this restriction optional or
|
|
67
|
+
* to allow for other strategies.
|
|
68
|
+
*
|
|
69
|
+
* There's a 90% chance this particular implementation belongs being in the JSON:API package instead
|
|
70
|
+
* of core-types, but it's here for now.
|
|
71
|
+
*
|
|
72
|
+
* @typedoc
|
|
73
|
+
*/
|
|
74
|
+
type ExtractUnion<T extends TypedRecordInstance, IncludePrefix extends boolean = false, Ignore = NONE, Pre = NONE> = Exclude<IncludePrefix extends true ? // if we want to include prefix, we union with the prefix. Outer Exclude will filter any "NONE" types
|
|
75
|
+
_ExtractUnion<T, IncludePrefix, Ignore, Pre> | Pre : // Else we just union the types.
|
|
76
|
+
_ExtractUnion<T, IncludePrefix, Ignore, Pre> | T[typeof ResourceType], NONE>;
|
|
77
|
+
/**
|
|
78
|
+
* A utility that provides the union of all ResourceName for all potential
|
|
79
|
+
* includes for the given TypedRecordInstance.
|
|
80
|
+
*
|
|
81
|
+
* @typedoc
|
|
82
|
+
*/
|
|
83
|
+
export type ExtractSuggestedCacheTypes<T extends TypedRecordInstance> = ExtractUnion<T>;
|
|
84
|
+
/**
|
|
85
|
+
* A utility that provides the union type of all valid include paths for the given
|
|
86
|
+
* TypedRecordInstance.
|
|
87
|
+
*
|
|
88
|
+
* Cyclical paths are filtered out.
|
|
89
|
+
*
|
|
90
|
+
* @typedoc
|
|
91
|
+
*/
|
|
92
|
+
export type Includes<T extends TypedRecordInstance> = ExtractUnion<T, true>;
|
|
93
|
+
export {};
|
|
47
94
|
}
|
|
48
95
|
//# sourceMappingURL=record.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,MAA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a,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,YAAY,CAAC,EACzE,IAAI,CACL,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,CAAC,CAAC,SAAS,mBAAmB,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AAExF;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,mBAAmB,IAAI,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.type-test.d.ts","sourceRoot":"","sources":["../src/record.type-test.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
declare module '@warp-drive/core-types/request' {
|
|
2
2
|
import type { StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
3
3
|
import type { QueryParamsSerializationOptions } from '@warp-drive/core-types/params';
|
|
4
|
+
import type { ExtractSuggestedCacheTypes, Includes, TypedRecordInstance, TypeFromInstanceOrString } from '@warp-drive/core-types/record';
|
|
4
5
|
import type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/raw';
|
|
6
|
+
import type { RequestSignature } from '@warp-drive/core-types/symbols';
|
|
5
7
|
type Store = unknown;
|
|
6
8
|
export const SkipCache: unique symbol;
|
|
7
9
|
export const EnableHydration: unique symbol;
|
|
@@ -13,7 +15,7 @@ declare module '@warp-drive/core-types/request' {
|
|
|
13
15
|
*
|
|
14
16
|
* @typedoc
|
|
15
17
|
*/
|
|
16
|
-
export type CacheOptions = {
|
|
18
|
+
export type CacheOptions<T = unknown> = {
|
|
17
19
|
/**
|
|
18
20
|
* A key that uniquely identifies this request. If not present, the url wil be used
|
|
19
21
|
* as the key for any GET request, while all other requests will not be cached.
|
|
@@ -51,7 +53,7 @@ declare module '@warp-drive/core-types/request' {
|
|
|
51
53
|
*
|
|
52
54
|
* @typedoc
|
|
53
55
|
*/
|
|
54
|
-
types?: string[];
|
|
56
|
+
types?: T extends TypedRecordInstance ? ExtractSuggestedCacheTypes<T>[] : string[];
|
|
55
57
|
/**
|
|
56
58
|
* If true, the request will never be handled by the cache-manager and thus
|
|
57
59
|
* will never resolve from cache nor update the cache.
|
|
@@ -63,71 +65,77 @@ declare module '@warp-drive/core-types/request' {
|
|
|
63
65
|
*/
|
|
64
66
|
[SkipCache]?: true;
|
|
65
67
|
};
|
|
66
|
-
export type FindRecordRequestOptions = {
|
|
68
|
+
export type FindRecordRequestOptions<T = unknown, RT = unknown> = {
|
|
67
69
|
url: string;
|
|
68
70
|
method: 'GET';
|
|
69
71
|
headers: Headers;
|
|
70
|
-
cacheOptions: CacheOptions
|
|
72
|
+
cacheOptions: CacheOptions<T>;
|
|
71
73
|
op: 'findRecord';
|
|
72
|
-
records: [ResourceIdentifierObject];
|
|
74
|
+
records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];
|
|
75
|
+
[RequestSignature]?: RT;
|
|
73
76
|
};
|
|
74
|
-
export type QueryRequestOptions = {
|
|
77
|
+
export type QueryRequestOptions<T = unknown, RT = unknown> = {
|
|
75
78
|
url: string;
|
|
76
79
|
method: 'GET';
|
|
77
80
|
headers: Headers;
|
|
78
|
-
cacheOptions: CacheOptions
|
|
81
|
+
cacheOptions: CacheOptions<T>;
|
|
79
82
|
op: 'query';
|
|
83
|
+
[RequestSignature]?: RT;
|
|
80
84
|
};
|
|
81
|
-
export type PostQueryRequestOptions = {
|
|
85
|
+
export type PostQueryRequestOptions<T = unknown, RT = unknown> = {
|
|
82
86
|
url: string;
|
|
83
87
|
method: 'POST' | 'QUERY';
|
|
84
88
|
headers: Headers;
|
|
85
89
|
body: string;
|
|
86
|
-
cacheOptions: CacheOptions & {
|
|
90
|
+
cacheOptions: CacheOptions<T> & {
|
|
87
91
|
key: string;
|
|
88
92
|
};
|
|
89
93
|
op: 'query';
|
|
94
|
+
[RequestSignature]?: RT;
|
|
90
95
|
};
|
|
91
|
-
export type DeleteRequestOptions = {
|
|
96
|
+
export type DeleteRequestOptions<T = unknown, RT = unknown> = {
|
|
92
97
|
url: string;
|
|
93
98
|
method: 'DELETE';
|
|
94
99
|
headers: Headers;
|
|
95
100
|
op: 'deleteRecord';
|
|
96
101
|
data: {
|
|
97
|
-
record: StableRecordIdentifier
|
|
102
|
+
record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;
|
|
98
103
|
};
|
|
99
|
-
records: [ResourceIdentifierObject];
|
|
104
|
+
records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];
|
|
105
|
+
[RequestSignature]?: RT;
|
|
100
106
|
};
|
|
101
107
|
type ImmutableRequest<T> = Readonly<T> & {
|
|
102
108
|
readonly headers: ImmutableHeaders;
|
|
103
109
|
readonly records: [StableRecordIdentifier];
|
|
104
110
|
};
|
|
105
|
-
export type UpdateRequestOptions = {
|
|
111
|
+
export type UpdateRequestOptions<T = unknown, RT = unknown> = {
|
|
106
112
|
url: string;
|
|
107
113
|
method: 'PATCH' | 'PUT';
|
|
108
114
|
headers: Headers;
|
|
109
115
|
op: 'updateRecord';
|
|
110
116
|
data: {
|
|
111
|
-
record: StableRecordIdentifier
|
|
117
|
+
record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;
|
|
112
118
|
};
|
|
113
|
-
records: [ResourceIdentifierObject];
|
|
119
|
+
records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];
|
|
120
|
+
[RequestSignature]?: RT;
|
|
114
121
|
};
|
|
115
|
-
export type CreateRequestOptions = {
|
|
122
|
+
export type CreateRequestOptions<T = unknown, RT = unknown> = {
|
|
116
123
|
url: string;
|
|
117
124
|
method: 'POST';
|
|
118
125
|
headers: Headers;
|
|
119
126
|
op: 'createRecord';
|
|
120
127
|
data: {
|
|
121
|
-
record: StableRecordIdentifier
|
|
128
|
+
record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;
|
|
122
129
|
};
|
|
123
|
-
records: [ResourceIdentifierObject];
|
|
130
|
+
records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];
|
|
131
|
+
[RequestSignature]?: RT;
|
|
124
132
|
};
|
|
125
133
|
export type ImmutableDeleteRequestOptions = ImmutableRequest<DeleteRequestOptions>;
|
|
126
134
|
export type ImmutableUpdateRequestOptions = ImmutableRequest<UpdateRequestOptions>;
|
|
127
135
|
export type ImmutableCreateRequestOptions = ImmutableRequest<CreateRequestOptions>;
|
|
128
|
-
export type RemotelyAccessibleIdentifier = {
|
|
136
|
+
export type RemotelyAccessibleIdentifier<T extends string = string> = {
|
|
129
137
|
id: string;
|
|
130
|
-
type:
|
|
138
|
+
type: T;
|
|
131
139
|
lid?: string;
|
|
132
140
|
};
|
|
133
141
|
export type ConstrainedRequestOptions = {
|
|
@@ -138,8 +146,8 @@ declare module '@warp-drive/core-types/request' {
|
|
|
138
146
|
resourcePath?: string;
|
|
139
147
|
urlParamsSettings?: QueryParamsSerializationOptions;
|
|
140
148
|
};
|
|
141
|
-
export type FindRecordOptions = ConstrainedRequestOptions & {
|
|
142
|
-
include?: string | string[];
|
|
149
|
+
export type FindRecordOptions<T = unknown> = ConstrainedRequestOptions & {
|
|
150
|
+
include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
|
|
143
151
|
};
|
|
144
152
|
export interface StructuredDataDocument<T> {
|
|
145
153
|
[STRUCTURED]?: true;
|
|
@@ -234,7 +242,7 @@ declare module '@warp-drive/core-types/request' {
|
|
|
234
242
|
*
|
|
235
243
|
* @typedoc
|
|
236
244
|
*/
|
|
237
|
-
export type RequestInfo = Request & {
|
|
245
|
+
export type RequestInfo<T = unknown> = Request & {
|
|
238
246
|
/**
|
|
239
247
|
* If provided, used instead of the AbortController auto-configured for each request by the RequestManager
|
|
240
248
|
*
|
|
@@ -245,7 +253,7 @@ declare module '@warp-drive/core-types/request' {
|
|
|
245
253
|
* @see {@link CacheOptions}
|
|
246
254
|
* @typedoc
|
|
247
255
|
*/
|
|
248
|
-
cacheOptions?: CacheOptions
|
|
256
|
+
cacheOptions?: CacheOptions<T>;
|
|
249
257
|
store?: Store;
|
|
250
258
|
op?: string;
|
|
251
259
|
/**
|
|
@@ -280,7 +288,7 @@ declare module '@warp-drive/core-types/request' {
|
|
|
280
288
|
*
|
|
281
289
|
* @typedoc
|
|
282
290
|
*/
|
|
283
|
-
export type ImmutableRequestInfo = Readonly<Omit<RequestInfo, 'controller'>> & {
|
|
291
|
+
export type ImmutableRequestInfo<T = unknown> = Readonly<Omit<RequestInfo, 'controller'>> & {
|
|
284
292
|
readonly cacheOptions?: Readonly<CacheOptions>;
|
|
285
293
|
readonly headers?: ImmutableHeaders;
|
|
286
294
|
readonly data?: Readonly<Record<string, unknown>>;
|
|
@@ -289,6 +297,7 @@ declare module '@warp-drive/core-types/request' {
|
|
|
289
297
|
* @typedoc
|
|
290
298
|
*/
|
|
291
299
|
readonly bodyUsed?: boolean;
|
|
300
|
+
[RequestSignature]?: T;
|
|
292
301
|
};
|
|
293
302
|
export interface ResponseInfo {
|
|
294
303
|
readonly headers: ImmutableHeaders;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,QAAQ,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CA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MAAM,CAAC;IAEX,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACzE,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,GAAG,IAAI,CAAC;CACtD"}
|
|
@@ -33,5 +33,13 @@ declare module '@warp-drive/core-types/symbols' {
|
|
|
33
33
|
* @typedoc
|
|
34
34
|
*/
|
|
35
35
|
export const TransformName: unique symbol;
|
|
36
|
+
/**
|
|
37
|
+
* Symbol for use by builders to indicate the return type
|
|
38
|
+
* generic to use for store.request()
|
|
39
|
+
*
|
|
40
|
+
* @type {Symbol}
|
|
41
|
+
* @typedoc
|
|
42
|
+
*/
|
|
43
|
+
export const RequestSignature: unique symbol;
|
|
36
44
|
}
|
|
37
45
|
//# sourceMappingURL=symbols.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,eAAkB,CAAC;AAE3C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,eAAkB,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,eAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,eAAkB,CAAC;AAE3C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,eAAkB,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,eAA2B,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,eAA6B,CAAC"}
|