@ember-data/legacy-compat 5.4.0-beta.6 → 5.4.0-beta.7
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/dist/builders.js +1 -1
- package/dist/builders.js.map +1 -1
- package/package.json +16 -16
- package/unstable-preview-types/builders/find-all.d.ts +2 -2
- package/unstable-preview-types/builders/find-all.d.ts.map +1 -1
- package/unstable-preview-types/builders/find-record.d.ts +3 -3
- package/unstable-preview-types/builders/find-record.d.ts.map +1 -1
- package/unstable-preview-types/builders/query.d.ts +7 -7
- package/unstable-preview-types/builders/query.d.ts.map +1 -1
package/dist/builders.js
CHANGED
|
@@ -106,7 +106,7 @@ function findAllBuilder(type, options = {}) {
|
|
|
106
106
|
@public
|
|
107
107
|
@static
|
|
108
108
|
@for @ember-data/legacy-compat/builders
|
|
109
|
-
@param {string|object}
|
|
109
|
+
@param {string|object} resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record
|
|
110
110
|
@param {string|number|object} id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved
|
|
111
111
|
@param {FindRecordBuilderOptions} [options] - if the first param is a string this will be the optional options for the request. See examples for available options.
|
|
112
112
|
@return {FindRecordRequestInput} request config
|
package/dist/builders.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.js","sources":["../src/builders/utils.ts","../src/builders/find-all.ts","../src/builders/find-record.ts","../src/builders/query.ts","../src/builders/save-record.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { dasherize } from '@ember-data/request-utils/string';\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/build-config/deprecations';\nimport type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/json-api-raw';\n\nexport function isMaybeIdentifier(\n maybeIdentifier: string | ResourceIdentifierObject\n): maybeIdentifier is ResourceIdentifierObject {\n return Boolean(\n maybeIdentifier !== null &&\n typeof maybeIdentifier === 'object' &&\n (('id' in maybeIdentifier && 'type' in maybeIdentifier && maybeIdentifier.id && maybeIdentifier.type) ||\n maybeIdentifier.lid)\n );\n}\n\nexport function normalizeModelName(type: string): string {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = dasherize(type);\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '5.3',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport type { FindAllOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { normalizeModelName } from './utils';\n\ntype FindAllRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'findAll';\n data: {\n type: T;\n options: FindAllBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindAllBuilderOptions = FindAllOptions;\n\n/**\n This function builds a request config to perform a `findAll` request for the given type.\n When passed to `store.request`, this config will result in the same behavior as a `store.findAll` request.\n Additionally, it takes the same options as `store.findAll`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method findAll\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {FindAllBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.findAll\n @return {FindAllRequestInput} request config\n*/\nexport function findAllBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n options?: FindAllBuilderOptions\n): FindAllRequestInput<TypeFromInstance<T>, T[]>;\nexport function findAllBuilder(type: string, options?: FindAllBuilderOptions): FindAllRequestInput;\nexport function findAllBuilder(type: string, options: FindAllBuilderOptions = {}): FindAllRequestInput {\n assert(`You need to pass a model name to the findAll builder`, type);\n assert(\n `Model name passed to the findAll builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport { constructResource, ensureStringId } from '@ember-data/store/-private';\nimport type { BaseFinderOptions, FindRecordOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/json-api-raw';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { isMaybeIdentifier, normalizeModelName } from './utils';\n\ntype FindRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'findRecord';\n data: {\n record: ResourceIdentifierObject<T>;\n options: FindRecordBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindRecordBuilderOptions = Omit<FindRecordOptions, 'preload'>;\n\n/**\n This function builds a request config to find the record for a given identifier or type and id combination.\n When passed to `store.request`, this config will result in the same behavior as a `store.findRecord` request.\n Additionally, it takes the same options as `store.findRecord`, with the exception of `preload` (which is unsupported).\n\n **Example 1**\n\n ```ts\n import { findRecord } from '@ember-data/legacy-compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>('post', '1'));\n ```\n\n **Example 2**\n\n `findRecord` can be called with a single identifier argument instead of the combination\n of `type` (modelName) and `id` as separate arguments. You may recognize this combo as\n the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)\n\n ```ts\n import { findRecord } from '@ember-data/legacy-compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>({ type: 'post', id }));\n ```\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method findRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string|object} type - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record\n @param {string|number|object} id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved\n @param {FindRecordBuilderOptions} [options] - if the first param is a string this will be the optional options for the request. See examples for available options.\n @return {FindRecordRequestInput} request config\n*/\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n resource: TypeFromInstance<T>,\n id: string,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(\n resource: string,\n id: string,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput;\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n resource: ResourceIdentifierObject<TypeFromInstance<T>>,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(\n resource: ResourceIdentifierObject,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput;\nexport function findRecordBuilder(\n resource: string | ResourceIdentifierObject,\n idOrOptions?: string | FindRecordBuilderOptions,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = idOrOptions as BaseFinderOptions | undefined;\n } else {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder (passed ${resource})`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(idOrOptions as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n options = options || {};\n\n assert('findRecord builder does not support options.preload', !(options as FindRecordOptions).preload);\n\n return {\n op: 'findRecord' as const,\n data: {\n record: resource,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport type { QueryOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { normalizeModelName } from './utils';\n\ntype QueryRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'query';\n data: {\n type: T;\n query: Record<string, unknown>;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype QueryBuilderOptions = QueryOptions;\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.query` request.\n Additionally, it takes the same options as `store.query`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method query\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return {QueryRequestInput} request config\n*/\nexport function queryBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: Record<string, unknown>,\n options?: QueryBuilderOptions\n): QueryRequestInput<TypeFromInstance<T>, T[]>;\nexport function queryBuilder(\n type: string,\n query: Record<string, unknown>,\n options?: QueryBuilderOptions\n): QueryRequestInput;\nexport function queryBuilder(\n type: string,\n query: Record<string, unknown>,\n options: QueryBuilderOptions = {}\n): QueryRequestInput {\n assert(`You need to pass a model name to the query builder`, type);\n assert(`You need to pass a query hash to the query builder`, query);\n assert(\n `Model name passed to the query builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'query' as const,\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n\ntype QueryRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'queryRecord';\n data: {\n type: T;\n query: Record<string, unknown>;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.queryRecord` request.\n Additionally, it takes the same options as `store.queryRecord`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method queryRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return {QueryRecordRequestInput} request config\n*/\nexport function queryRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: Record<string, unknown>,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput<TypeFromInstance<T>, T | null>;\nexport function queryRecordBuilder(\n type: string,\n query: Record<string, unknown>,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput;\nexport function queryRecordBuilder(\n type: string,\n query: Record<string, unknown>,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput {\n assert(`You need to pass a model name to the queryRecord builder`, type);\n assert(`You need to pass a query hash to the queryRecord builder`, query);\n assert(\n `Model name passed to the queryRecord builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport { recordIdentifierFor, storeFor, type StoreRequestInput } from '@ember-data/store';\nimport type { InstanceCache } from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\ntype SaveRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'createRecord' | 'deleteRecord' | 'updateRecord';\n data: {\n record: StableRecordIdentifier<T>;\n options: SaveRecordBuilderOptions;\n };\n records: [StableRecordIdentifier<T>];\n [RequestSignature]?: RT;\n};\n\ntype SaveRecordBuilderOptions = Record<string, unknown>;\n\nfunction _resourceIsFullDeleted(identifier: StableRecordIdentifier, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nfunction resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/**\n This function builds a request config for saving the given record (e.g. creating, updating, or deleting the record).\n When passed to `store.request`, this config will result in the same behavior as a legacy `store.saveRecord` request.\n Additionally, it takes the same options as `store.saveRecord`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method saveRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {object} record a record to save\n @param {SaveRecordBuilderOptions} options optional, may include `adapterOptions` hash which will be passed to adapter.saveRecord\n @return {SaveRecordRequestInput} request config\n*/\nexport function saveRecordBuilder<T extends TypedRecordInstance>(\n record: T,\n options: Record<string, unknown> = {}\n): SaveRecordRequestInput<TypeFromInstance<T>, T> {\n const store = storeFor(record);\n assert(`Unable to initiate save for a record in a disconnected state`, store);\n const identifier = recordIdentifierFor<T>(record);\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we throw here to prevent bad things.\n throw new Error(`Record Is Disconnected`);\n }\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n store._instanceCache.recordIsLoaded(identifier)\n );\n if (resourceIsFullyDeleted(store._instanceCache, identifier)) {\n throw new Error('cannot build saveRecord request for deleted record');\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n const cache = store.cache;\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n return {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n}\n"],"names":["isMaybeIdentifier","maybeIdentifier","Boolean","id","type","lid","normalizeModelName","macroCondition","getGlobalConfig","WarpDrive","deprecations","DEPRECATE_NON_STRICT_TYPES","result","dasherize","deprecate","until","for","since","available","enabled","findAllBuilder","options","env","DEBUG","test","Error","op","data","cacheOptions","SkipCache","findRecordBuilder","resource","idOrOptions","normalizedId","ensureStringId","constructResource","preload","record","queryBuilder","query","queryRecordBuilder","_resourceIsFullDeleted","identifier","cache","isDeletionCommitted","isNew","isDeleted","resourceIsFullyDeleted","instanceCache","saveRecordBuilder","store","storeFor","recordIdentifierFor","_instanceCache","recordIsLoaded","operation","records"],"mappings":";;;;;;;AAMO,SAASA,iBAAiBA,CAC/BC,eAAkD,EACL;AAC7C,EAAA,OAAOC,OAAO,CACZD,eAAe,KAAK,IAAI,IACtB,OAAOA,eAAe,KAAK,QAAQ,KACjC,IAAI,IAAIA,eAAe,IAAI,MAAM,IAAIA,eAAe,IAAIA,eAAe,CAACE,EAAE,IAAIF,eAAe,CAACG,IAAI,IAClGH,eAAe,CAACI,GAAG,CACzB,CAAC,CAAA;AACH,CAAA;AAEO,SAASC,kBAAkBA,CAACF,IAAY,EAAU;EACvD,IAAAG,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,YAAA,CAAAC,0BAAA,CAAgC,EAAA;AAC9B,IAAA,MAAMC,MAAM,GAAGC,SAAS,CAACT,IAAI,CAAC,CAAA;AAE9BU,IAAAA,SAAS,CACN,CAAA,mBAAA,EAAqBV,IAAK,CAAA,0DAAA,EAA4DQ,MAAO,CAAA,cAAA,EAAgBR,IAAK,CAAA,EAAA,CAAG,EACtHQ,MAAM,KAAKR,IAAI,EACf;AACED,MAAAA,EAAE,EAAE,uCAAuC;AAC3CY,MAAAA,KAAK,EAAE,KAAK;AACZC,MAAAA,GAAG,EAAE,YAAY;AACjBC,MAAAA,KAAK,EAAE;AACLC,QAAAA,SAAS,EAAE,KAAK;AAChBC,QAAAA,OAAO,EAAE,KAAA;AACX,OAAA;AACF,KACF,CAAC,CAAA;AAED,IAAA,OAAOP,MAAM,CAAA;AACf,GAAA;AAEA,EAAA,OAAOR,IAAI,CAAA;AACb;;ACvCA;AACA;AACA;;AAqBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,SAASgB,cAAcA,CAAChB,IAAY,EAAEiB,OAA8B,GAAG,EAAE,EAAuB;EACrGd,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAa,G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ACnC,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"builders.js","sources":["../src/builders/utils.ts","../src/builders/find-all.ts","../src/builders/find-record.ts","../src/builders/query.ts","../src/builders/save-record.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { dasherize } from '@ember-data/request-utils/string';\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/build-config/deprecations';\nimport type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/json-api-raw';\n\nexport function isMaybeIdentifier(\n maybeIdentifier: string | ResourceIdentifierObject\n): maybeIdentifier is ResourceIdentifierObject {\n return Boolean(\n maybeIdentifier !== null &&\n typeof maybeIdentifier === 'object' &&\n (('id' in maybeIdentifier && 'type' in maybeIdentifier && maybeIdentifier.id && maybeIdentifier.type) ||\n maybeIdentifier.lid)\n );\n}\n\nexport function normalizeModelName(type: string): string {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = dasherize(type);\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '5.3',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport type { FindAllOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { normalizeModelName } from './utils';\n\ntype FindAllRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'findAll';\n data: {\n type: T;\n options: FindAllBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindAllBuilderOptions<T = unknown> = FindAllOptions<T>;\n\n/**\n This function builds a request config to perform a `findAll` request for the given type.\n When passed to `store.request`, this config will result in the same behavior as a `store.findAll` request.\n Additionally, it takes the same options as `store.findAll`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method findAll\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {FindAllBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.findAll\n @return {FindAllRequestInput} request config\n*/\nexport function findAllBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n options?: FindAllBuilderOptions<T>\n): FindAllRequestInput<TypeFromInstance<T>, T[]>;\nexport function findAllBuilder(type: string, options?: FindAllBuilderOptions): FindAllRequestInput;\nexport function findAllBuilder(type: string, options: FindAllBuilderOptions = {}): FindAllRequestInput {\n assert(`You need to pass a model name to the findAll builder`, type);\n assert(\n `Model name passed to the findAll builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport { constructResource, ensureStringId } from '@ember-data/store/-private';\nimport type { BaseFinderOptions, FindRecordOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/json-api-raw';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { isMaybeIdentifier, normalizeModelName } from './utils';\n\ntype FindRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'findRecord';\n data: {\n record: ResourceIdentifierObject<T>;\n options: FindRecordBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindRecordBuilderOptions = Omit<FindRecordOptions, 'preload'>;\n\n/**\n This function builds a request config to find the record for a given identifier or type and id combination.\n When passed to `store.request`, this config will result in the same behavior as a `store.findRecord` request.\n Additionally, it takes the same options as `store.findRecord`, with the exception of `preload` (which is unsupported).\n\n **Example 1**\n\n ```ts\n import { findRecord } from '@ember-data/legacy-compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>('post', '1'));\n ```\n\n **Example 2**\n\n `findRecord` can be called with a single identifier argument instead of the combination\n of `type` (modelName) and `id` as separate arguments. You may recognize this combo as\n the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)\n\n ```ts\n import { findRecord } from '@ember-data/legacy-compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>({ type: 'post', id }));\n ```\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method findRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string|object} resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record\n @param {string|number|object} id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved\n @param {FindRecordBuilderOptions} [options] - if the first param is a string this will be the optional options for the request. See examples for available options.\n @return {FindRecordRequestInput} request config\n*/\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n id: string,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(type: string, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput;\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n resource: ResourceIdentifierObject<TypeFromInstance<T>>,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(\n resource: ResourceIdentifierObject,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput;\nexport function findRecordBuilder(\n resource: string | ResourceIdentifierObject,\n idOrOptions?: string | FindRecordBuilderOptions,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = idOrOptions as BaseFinderOptions | undefined;\n } else {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder (passed ${resource})`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(idOrOptions as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n options = options || {};\n\n assert('findRecord builder does not support options.preload', !(options as FindRecordOptions).preload);\n\n return {\n op: 'findRecord' as const,\n data: {\n record: resource,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport type { LegacyResourceQuery, QueryOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { normalizeModelName } from './utils';\n\ntype QueryRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'query';\n data: {\n type: T;\n query: LegacyResourceQuery;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype QueryBuilderOptions = QueryOptions;\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.query` request.\n Additionally, it takes the same options as `store.query`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method query\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return {QueryRequestInput} request config\n*/\nexport function queryBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: LegacyResourceQuery<T>,\n options?: QueryBuilderOptions\n): QueryRequestInput<TypeFromInstance<T>, T[]>;\nexport function queryBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRequestInput;\nexport function queryBuilder(\n type: string,\n query: LegacyResourceQuery,\n options: QueryBuilderOptions = {}\n): QueryRequestInput {\n assert(`You need to pass a model name to the query builder`, type);\n assert(`You need to pass a query hash to the query builder`, query);\n assert(\n `Model name passed to the query builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'query' as const,\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n\ntype QueryRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'queryRecord';\n data: {\n type: T;\n query: LegacyResourceQuery;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.queryRecord` request.\n Additionally, it takes the same options as `store.queryRecord`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method queryRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return {QueryRecordRequestInput} request config\n*/\nexport function queryRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: LegacyResourceQuery<T>,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput<TypeFromInstance<T>, T | null>;\nexport function queryRecordBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput;\nexport function queryRecordBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput {\n assert(`You need to pass a model name to the queryRecord builder`, type);\n assert(`You need to pass a query hash to the queryRecord builder`, query);\n assert(\n `Model name passed to the queryRecord builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport { recordIdentifierFor, storeFor, type StoreRequestInput } from '@ember-data/store';\nimport type { InstanceCache } from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\ntype SaveRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'createRecord' | 'deleteRecord' | 'updateRecord';\n data: {\n record: StableRecordIdentifier<T>;\n options: SaveRecordBuilderOptions;\n };\n records: [StableRecordIdentifier<T>];\n [RequestSignature]?: RT;\n};\n\ntype SaveRecordBuilderOptions = Record<string, unknown>;\n\nfunction _resourceIsFullDeleted(identifier: StableRecordIdentifier, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nfunction resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/**\n This function builds a request config for saving the given record (e.g. creating, updating, or deleting the record).\n When passed to `store.request`, this config will result in the same behavior as a legacy `store.saveRecord` request.\n Additionally, it takes the same options as `store.saveRecord`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method saveRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {object} record a record to save\n @param {SaveRecordBuilderOptions} options optional, may include `adapterOptions` hash which will be passed to adapter.saveRecord\n @return {SaveRecordRequestInput} request config\n*/\nexport function saveRecordBuilder<T extends TypedRecordInstance>(\n record: T,\n options: Record<string, unknown> = {}\n): SaveRecordRequestInput<TypeFromInstance<T>, T> {\n const store = storeFor(record);\n assert(`Unable to initiate save for a record in a disconnected state`, store);\n const identifier = recordIdentifierFor<T>(record);\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we throw here to prevent bad things.\n throw new Error(`Record Is Disconnected`);\n }\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n store._instanceCache.recordIsLoaded(identifier)\n );\n if (resourceIsFullyDeleted(store._instanceCache, identifier)) {\n throw new Error('cannot build saveRecord request for deleted record');\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n const cache = store.cache;\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n return {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n}\n"],"names":["isMaybeIdentifier","maybeIdentifier","Boolean","id","type","lid","normalizeModelName","macroCondition","getGlobalConfig","WarpDrive","deprecations","DEPRECATE_NON_STRICT_TYPES","result","dasherize","deprecate","until","for","since","available","enabled","findAllBuilder","options","env","DEBUG","test","Error","op","data","cacheOptions","SkipCache","findRecordBuilder","resource","idOrOptions","normalizedId","ensureStringId","constructResource","preload","record","queryBuilder","query","queryRecordBuilder","_resourceIsFullDeleted","identifier","cache","isDeletionCommitted","isNew","isDeleted","resourceIsFullyDeleted","instanceCache","saveRecordBuilder","store","storeFor","recordIdentifierFor","_instanceCache","recordIsLoaded","operation","records"],"mappings":";;;;;;;AAMO,SAASA,iBAAiBA,CAC/BC,eAAkD,EACL;AAC7C,EAAA,OAAOC,OAAO,CACZD,eAAe,KAAK,IAAI,IACtB,OAAOA,eAAe,KAAK,QAAQ,KACjC,IAAI,IAAIA,eAAe,IAAI,MAAM,IAAIA,eAAe,IAAIA,eAAe,CAACE,EAAE,IAAIF,eAAe,CAACG,IAAI,IAClGH,eAAe,CAACI,GAAG,CACzB,CAAC,CAAA;AACH,CAAA;AAEO,SAASC,kBAAkBA,CAACF,IAAY,EAAU;EACvD,IAAAG,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,YAAA,CAAAC,0BAAA,CAAgC,EAAA;AAC9B,IAAA,MAAMC,MAAM,GAAGC,SAAS,CAACT,IAAI,CAAC,CAAA;AAE9BU,IAAAA,SAAS,CACN,CAAA,mBAAA,EAAqBV,IAAK,CAAA,0DAAA,EAA4DQ,MAAO,CAAA,cAAA,EAAgBR,IAAK,CAAA,EAAA,CAAG,EACtHQ,MAAM,KAAKR,IAAI,EACf;AACED,MAAAA,EAAE,EAAE,uCAAuC;AAC3CY,MAAAA,KAAK,EAAE,KAAK;AACZC,MAAAA,GAAG,EAAE,YAAY;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AAK,CAACE,KAAK,CAACH,UAAU,CAAC,EAAE;AAC3Ba,IAAAA,SAAS,GAAG,cAAc,CAAA;GAC3B,MAAM,IAAIZ,KAAK,CAACG,SAAS,CAACJ,UAAU,CAAC,EAAE;AACtCa,IAAAA,SAAS,GAAG,cAAc,CAAA;AAC5B,GAAA;EAEA,OAAO;AACL7B,IAAAA,EAAE,EAAE6B,SAAS;AACb5B,IAAAA,IAAI,EAAE;MACJN,OAAO;AACPgB,MAAAA,MAAM,EAAEK,UAAAA;KACT;IACDc,OAAO,EAAE,CAACd,UAAU,CAAC;AACrBd,IAAAA,YAAY,EAAE;AAAE,MAAA,CAACC,SAAS,GAAG,IAAA;AAAK,KAAA;GACnC,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/legacy-compat",
|
|
3
3
|
"description": "Compatibility Shims for Older EmberData",
|
|
4
|
-
"version": "5.4.0-beta.
|
|
4
|
+
"version": "5.4.0-beta.7",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Chris Thoburn <runspired@users.noreply.github.com>",
|
|
7
7
|
"repository": {
|
|
@@ -83,32 +83,32 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@embroider/macros": "^1.16.1",
|
|
86
|
-
"@warp-drive/build-config": "0.0.0-beta.
|
|
86
|
+
"@warp-drive/build-config": "0.0.0-beta.2"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@ember-data/graph": "5.4.0-beta.
|
|
90
|
-
"@ember-data/json-api": "5.4.0-beta.
|
|
91
|
-
"@ember-data/request": "5.4.0-beta.
|
|
92
|
-
"@ember-data/request-utils": "5.4.0-beta.
|
|
93
|
-
"@ember-data/store": "5.4.0-beta.
|
|
89
|
+
"@ember-data/graph": "5.4.0-beta.7",
|
|
90
|
+
"@ember-data/json-api": "5.4.0-beta.7",
|
|
91
|
+
"@ember-data/request": "5.4.0-beta.7",
|
|
92
|
+
"@ember-data/request-utils": "5.4.0-beta.7",
|
|
93
|
+
"@ember-data/store": "5.4.0-beta.7",
|
|
94
94
|
"@ember/test-waiters": "^3.1.0",
|
|
95
|
-
"@warp-drive/core-types": "0.0.0-beta.
|
|
95
|
+
"@warp-drive/core-types": "0.0.0-beta.7"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@babel/core": "^7.24.5",
|
|
99
99
|
"@babel/plugin-transform-typescript": "^7.24.5",
|
|
100
100
|
"@babel/preset-env": "^7.24.5",
|
|
101
101
|
"@babel/preset-typescript": "^7.24.1",
|
|
102
|
-
"@ember-data/graph": "5.4.0-beta.
|
|
103
|
-
"@ember-data/json-api": "5.4.0-beta.
|
|
104
|
-
"@ember-data/request": "5.4.0-beta.
|
|
105
|
-
"@ember-data/request-utils": "5.4.0-beta.
|
|
106
|
-
"@ember-data/store": "5.4.0-beta.
|
|
107
|
-
"@ember-data/tracking": "5.4.0-beta.
|
|
102
|
+
"@ember-data/graph": "5.4.0-beta.7",
|
|
103
|
+
"@ember-data/json-api": "5.4.0-beta.7",
|
|
104
|
+
"@ember-data/request": "5.4.0-beta.7",
|
|
105
|
+
"@ember-data/request-utils": "5.4.0-beta.7",
|
|
106
|
+
"@ember-data/store": "5.4.0-beta.7",
|
|
107
|
+
"@ember-data/tracking": "5.4.0-beta.7",
|
|
108
108
|
"@ember/test-waiters": "^3.1.0",
|
|
109
109
|
"@glimmer/component": "^1.1.2",
|
|
110
|
-
"@warp-drive/core-types": "0.0.0-beta.
|
|
111
|
-
"@warp-drive/internal-config": "5.4.0-beta.
|
|
110
|
+
"@warp-drive/core-types": "0.0.0-beta.7",
|
|
111
|
+
"@warp-drive/internal-config": "5.4.0-beta.7",
|
|
112
112
|
"ember-source": "~5.8.0",
|
|
113
113
|
"pnpm-sync-dependencies-meta-injected": "0.0.14",
|
|
114
114
|
"typescript": "^5.4.5",
|
|
@@ -14,7 +14,7 @@ declare module '@ember-data/legacy-compat/builders/find-all' {
|
|
|
14
14
|
};
|
|
15
15
|
[RequestSignature]?: RT;
|
|
16
16
|
};
|
|
17
|
-
type FindAllBuilderOptions = FindAllOptions
|
|
17
|
+
type FindAllBuilderOptions<T = unknown> = FindAllOptions<T>;
|
|
18
18
|
/**
|
|
19
19
|
This function builds a request config to perform a `findAll` request for the given type.
|
|
20
20
|
When passed to `store.request`, this config will result in the same behavior as a `store.findAll` request.
|
|
@@ -34,7 +34,7 @@ declare module '@ember-data/legacy-compat/builders/find-all' {
|
|
|
34
34
|
@param {FindAllBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.findAll
|
|
35
35
|
@return {FindAllRequestInput} request config
|
|
36
36
|
*/
|
|
37
|
-
export function findAllBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, options?: FindAllBuilderOptions): FindAllRequestInput<TypeFromInstance<T>, T[]>;
|
|
37
|
+
export function findAllBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, options?: FindAllBuilderOptions<T>): FindAllRequestInput<TypeFromInstance<T>, T[]>;
|
|
38
38
|
export function findAllBuilder(type: string, options?: FindAllBuilderOptions): FindAllRequestInput;
|
|
39
39
|
export {};
|
|
40
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-all.d.ts","sourceRoot":"","sources":["../../src/builders/find-all.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIvE,KAAK,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE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,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,mBAAmB,CAAC"}
|
|
@@ -48,13 +48,13 @@ declare module '@ember-data/legacy-compat/builders/find-record' {
|
|
|
48
48
|
@public
|
|
49
49
|
@static
|
|
50
50
|
@for @ember-data/legacy-compat/builders
|
|
51
|
-
@param {string|object}
|
|
51
|
+
@param {string|object} resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record
|
|
52
52
|
@param {string|number|object} id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved
|
|
53
53
|
@param {FindRecordBuilderOptions} [options] - if the first param is a string this will be the optional options for the request. See examples for available options.
|
|
54
54
|
@return {FindRecordRequestInput} request config
|
|
55
55
|
*/
|
|
56
|
-
export function findRecordBuilder<T extends TypedRecordInstance>(
|
|
57
|
-
export function findRecordBuilder(
|
|
56
|
+
export function findRecordBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput<TypeFromInstance<T>, T>;
|
|
57
|
+
export function findRecordBuilder(type: string, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput;
|
|
58
58
|
export function findRecordBuilder<T extends TypedRecordInstance>(resource: ResourceIdentifierObject<TypeFromInstance<T>>, options?: FindRecordBuilderOptions): FindRecordRequestInput<TypeFromInstance<T>, T>;
|
|
59
59
|
export function findRecordBuilder(resource: ResourceIdentifierObject, options?: FindRecordBuilderOptions): FindRecordRequestInput;
|
|
60
60
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-record.d.ts","sourceRoot":"","sources":["../../src/builders/find-record.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAqB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEpF,OAAO,KAA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MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;QACpC,OAAO,EAAE,wBAAwB,CAAC;KACnC,CAAC;IACF,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,wBAAwB,GAAG,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCE;AACF,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,EAC7D,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,wBAAwB,GACjC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAClD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,sBAAsB,CAAC;AACxH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,EAC7D,QAAQ,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EACvD,OAAO,CAAC,EAAE,wBAAwB,GACjC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAClD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,wBAAwB,EAClC,OAAO,CAAC,EAAE,wBAAwB,GACjC,sBAAsB,CAAC"}
|
|
@@ -3,14 +3,14 @@ declare module '@ember-data/legacy-compat/builders/query' {
|
|
|
3
3
|
* @module @ember-data/legacy-compat/builders
|
|
4
4
|
*/
|
|
5
5
|
import type { StoreRequestInput } from '@ember-data/store';
|
|
6
|
-
import type { QueryOptions } from '@ember-data/store/types';
|
|
6
|
+
import type { LegacyResourceQuery, QueryOptions } from '@ember-data/store/types';
|
|
7
7
|
import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
|
|
8
8
|
import type { RequestSignature } from '@warp-drive/core-types/symbols';
|
|
9
9
|
type QueryRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {
|
|
10
10
|
op: 'query';
|
|
11
11
|
data: {
|
|
12
12
|
type: T;
|
|
13
|
-
query:
|
|
13
|
+
query: LegacyResourceQuery;
|
|
14
14
|
options: QueryBuilderOptions;
|
|
15
15
|
};
|
|
16
16
|
[RequestSignature]?: RT;
|
|
@@ -35,13 +35,13 @@ declare module '@ember-data/legacy-compat/builders/query' {
|
|
|
35
35
|
@param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query
|
|
36
36
|
@return {QueryRequestInput} request config
|
|
37
37
|
*/
|
|
38
|
-
export function queryBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, query:
|
|
39
|
-
export function queryBuilder(type: string, query:
|
|
38
|
+
export function queryBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, query: LegacyResourceQuery<T>, options?: QueryBuilderOptions): QueryRequestInput<TypeFromInstance<T>, T[]>;
|
|
39
|
+
export function queryBuilder(type: string, query: LegacyResourceQuery, options?: QueryBuilderOptions): QueryRequestInput;
|
|
40
40
|
type QueryRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {
|
|
41
41
|
op: 'queryRecord';
|
|
42
42
|
data: {
|
|
43
43
|
type: T;
|
|
44
|
-
query:
|
|
44
|
+
query: LegacyResourceQuery;
|
|
45
45
|
options: QueryBuilderOptions;
|
|
46
46
|
};
|
|
47
47
|
[RequestSignature]?: RT;
|
|
@@ -65,8 +65,8 @@ declare module '@ember-data/legacy-compat/builders/query' {
|
|
|
65
65
|
@param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query
|
|
66
66
|
@return {QueryRecordRequestInput} request config
|
|
67
67
|
*/
|
|
68
|
-
export function queryRecordBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, query:
|
|
69
|
-
export function queryRecordBuilder(type: string, query:
|
|
68
|
+
export function queryRecordBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, query: LegacyResourceQuery<T>, options?: QueryBuilderOptions): QueryRecordRequestInput<TypeFromInstance<T>, T | null>;
|
|
69
|
+
export function queryRecordBuilder(type: string, query: LegacyResourceQuery, options?: QueryBuilderOptions): QueryRecordRequestInput;
|
|
70
70
|
export {};
|
|
71
71
|
}
|
|
72
72
|
//# sourceMappingURL=query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/builders/query.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/builders/query.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIvE,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,iBAAiB,GAAG;IACtF,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC,CAAC;QACR,KAAK,EAAE,mBAAmB,CAAC;QAC3B,OAAO,EAAE,mBAAmB,CAAC;KAC9B,CAAC;IACF,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,mBAAmB,GAAG,Y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