@ember-data-mirror/rest 5.3.8 → 5.3.9
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/request.js
CHANGED
|
@@ -152,7 +152,7 @@ function findRecord(arg1, arg2, arg3) {
|
|
|
152
152
|
* - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
|
|
153
153
|
* promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
|
|
154
154
|
* defaulting to `false` if none is configured.
|
|
155
|
-
* - `
|
|
155
|
+
* - `urlParamsSettings` - an object containing options for how to serialize the query params (see `buildQueryParams`)
|
|
156
156
|
*
|
|
157
157
|
* ```ts
|
|
158
158
|
* import { query } from '@ember-data-mirror/rest/request';
|
package/dist/request.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sources":["../src/-private/builders/-utils.ts","../src/-private/builders/find-record.ts","../src/-private/builders/query.ts","../src/-private/builders/save-record.ts"],"sourcesContent":["import type { UrlOptions } from '@ember-data-mirror/request-utils';\nimport type { CacheOptions, ConstrainedRequestOptions } from '@warp-drive/core-types/request';\n\nexport function copyForwardUrlOptions(urlOptions: UrlOptions, options: ConstrainedRequestOptions): void {\n if ('host' in options) {\n urlOptions.host = options.host;\n }\n if ('namespace' in options) {\n urlOptions.namespace = options.namespace;\n }\n if ('resourcePath' in options) {\n urlOptions.resourcePath = options.resourcePath;\n }\n}\n\nexport function extractCacheOptions(options: ConstrainedRequestOptions) {\n const cacheOptions: CacheOptions = {};\n if ('reload' in options) {\n cacheOptions.reload = options.reload;\n }\n if ('backgroundReload' in options) {\n cacheOptions.backgroundReload = options.backgroundReload;\n }\n return cacheOptions;\n}\n","/**\n * @module @ember-data-mirror/rest/request\n */\nimport { buildBaseURL, buildQueryParams, type FindRecordUrlOptions } from '@ember-data-mirror/request-utils';\nimport { camelize, pluralize } from '@ember-data-mirror/request-utils/string';\nimport type { TypeFromInstance } from '@warp-drive/core-types/record';\nimport type {\n FindRecordOptions,\n FindRecordRequestOptions,\n RemotelyAccessibleIdentifier,\n} from '@warp-drive/core-types/request';\nimport type { SingleResourceDataDocument } from '@warp-drive/core-types/spec/document';\n\nimport { copyForwardUrlOptions, extractCacheOptions } from './-utils';\n\n/**\n * Builds request options to fetch a single resource by a known id or identifier\n * configured for the url and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { findRecord } from '@ember-data-mirror/rest/request';\n *\n * const data = await store.request(findRecord('person', '1'));\n * ```\n *\n * **With Options**\n *\n * ```ts\n * import { findRecord } from '@ember-data-mirror/rest/request';\n *\n * const options = findRecord('person', '1', { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **With an Identifier**\n *\n * ```ts\n * import { findRecord } from '@ember-data-mirror/rest/request';\n *\n * const options = findRecord({ type: 'person', id: '1' }, { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { findRecord } from '@ember-data-mirror/rest/request';\n *\n * const options = findRecord('person', '1', { include: ['pets', 'friends'] }, { namespace: 'api/v2' });\n * const data = await store.request(options);\n * ```\n *\n * @method findRecord\n * @public\n * @static\n * @for @ember-data-mirror/rest/request\n * @param identifier\n * @param options\n */\nexport type FindRecordResultDocument<T> = Omit<SingleResourceDataDocument<T>, 'data'> & { data: T };\n\nexport function findRecord<T>(\n identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>>,\n options?: FindRecordOptions<T>\n): FindRecordRequestOptions<T, FindRecordResultDocument<T>>;\nexport function findRecord(\n identifier: RemotelyAccessibleIdentifier,\n options?: FindRecordOptions\n): FindRecordRequestOptions;\nexport function findRecord<T>(\n type: TypeFromInstance<T>,\n id: string,\n options?: FindRecordOptions<T>\n): FindRecordRequestOptions<T, FindRecordResultDocument<T>>;\nexport function findRecord(type: string, id: string, options?: FindRecordOptions): FindRecordRequestOptions;\nexport function findRecord<T>(\n arg1: TypeFromInstance<T> | RemotelyAccessibleIdentifier<TypeFromInstance<T>>,\n arg2: string | FindRecordOptions | undefined,\n arg3?: FindRecordOptions\n): FindRecordRequestOptions<T, FindRecordResultDocument<T>> {\n const identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>> =\n typeof arg1 === 'string' ? { type: arg1, id: arg2 as string } : arg1;\n const options: FindRecordOptions = (typeof arg1 === 'string' ? arg3 : (arg2 as FindRecordOptions)) || {};\n const cacheOptions = extractCacheOptions(options);\n const urlOptions: FindRecordUrlOptions = {\n identifier,\n op: 'findRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url: options.include?.length\n ? `${url}?${buildQueryParams({ include: options.include }, options.urlParamsSettings)}`\n : url,\n method: 'GET',\n headers,\n cacheOptions,\n op: 'findRecord',\n records: [identifier],\n };\n}\n","/**\n * @module @ember-data-mirror/rest/request\n */\nimport { buildBaseURL, buildQueryParams, type QueryUrlOptions } from '@ember-data-mirror/request-utils';\nimport { camelize, pluralize } from '@ember-data-mirror/request-utils/string';\nimport type { QueryParamsSource } from '@warp-drive/core-types/params';\nimport type { TypeFromInstance } from '@warp-drive/core-types/record';\nimport type { ConstrainedRequestOptions, QueryRequestOptions } from '@warp-drive/core-types/request';\nimport type { CollectionResourceDataDocument } from '@warp-drive/core-types/spec/document';\n\nimport { copyForwardUrlOptions, extractCacheOptions } from './-utils';\n\n/**\n * Builds request options to query for resources, usually by a primary\n * type, configured for the url and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { query } from '@ember-data-mirror/rest/request';\n *\n * const data = await store.request(query('person'));\n * ```\n *\n * **With Query Params**\n *\n * ```ts\n * import { query } from '@ember-data-mirror/rest/request';\n *\n * const options = query('person', { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { query } from '@ember-data-mirror/rest/request';\n *\n * const options = query('person', { include: ['pets', 'friends'] }, { reload: true });\n * const data = await store.request(options);\n * ```\n *\n * @method query\n * @public\n * @static\n * @for @ember-data-mirror/rest/request\n * @param identifier\n * @param query\n * @param options\n */\nexport function query<T>(\n type: TypeFromInstance<T>,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n query?: QueryParamsSource,\n options?: ConstrainedRequestOptions\n): QueryRequestOptions<T, CollectionResourceDataDocument<T>>;\nexport function query(\n type: string,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n query?: QueryParamsSource,\n options?: ConstrainedRequestOptions\n): QueryRequestOptions;\nexport function query(\n type: string,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n query: QueryParamsSource = {},\n options: ConstrainedRequestOptions = {}\n): QueryRequestOptions {\n const cacheOptions = extractCacheOptions(options);\n const urlOptions: QueryUrlOptions = {\n identifier: { type },\n op: 'query',\n resourcePath: pluralize(camelize(type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n const queryString = buildQueryParams(query, options.urlParamsSettings);\n\n return {\n url: queryString ? `${url}?${queryString}` : url,\n method: 'GET',\n headers,\n cacheOptions,\n op: 'query',\n };\n}\n","import {\n buildBaseURL,\n type CreateRecordUrlOptions,\n type DeleteRecordUrlOptions,\n type UpdateRecordUrlOptions,\n} from '@ember-data-mirror/request-utils';\nimport { camelize, pluralize } from '@ember-data-mirror/request-utils/string';\nimport { recordIdentifierFor } from '@ember-data-mirror/store';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';\nimport type {\n ConstrainedRequestOptions,\n CreateRequestOptions,\n DeleteRequestOptions,\n UpdateRequestOptions,\n} from '@warp-drive/core-types/request';\n\nimport { copyForwardUrlOptions } from './-utils';\n\nfunction isExisting(identifier: StableRecordIdentifier): identifier is StableExistingRecordIdentifier {\n return 'id' in identifier && identifier.id !== null && 'type' in identifier && identifier.type !== null;\n}\n\n/**\n * Builds request options to delete record for resources,\n * configured for the url, method and header expectations of REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { deleteRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.peekRecord('person', '1');\n *\n * // mark record as deleted\n * store.deleteRecord(person);\n *\n * // persist deletion\n * const data = await store.request(deleteRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { deleteRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.peekRecord('person', '1');\n *\n * // mark record as deleted\n * store.deleteRecord(person);\n *\n * // persist deletion\n * const options = deleteRecord(person, { namespace: 'api/v1' });\n * const data = await store.request(options);\n * ```\n *\n * @method deleteRecord\n * @public\n * @static\n * @for @ember-data-mirror/rest/request\n * @param record\n * @param options\n */\nexport function deleteRecord<T>(record: T, options?: ConstrainedRequestOptions): DeleteRequestOptions<T>;\nexport function deleteRecord(record: unknown, options?: ConstrainedRequestOptions): DeleteRequestOptions;\nexport function deleteRecord(record: unknown, options: ConstrainedRequestOptions = {}): DeleteRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));\n\n const urlOptions: DeleteRecordUrlOptions = {\n identifier: identifier,\n op: 'deleteRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url,\n method: 'DELETE',\n headers,\n op: 'deleteRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n\n/**\n * Builds request options to create new record for resources,\n * configured for the url, method and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { createRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.createRecord('person', { name: 'Ted' });\n * const data = await store.request(createRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { createRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.createRecord('person', { name: 'Ted' });\n * const options = createRecord(person, { namespace: 'api/v1' });\n * const data = await store.request(options);\n * ```\n *\n * @method createRecord\n * @public\n * @static\n * @for @ember-data-mirror/rest/request\n * @param record\n * @param options\n */\nexport function createRecord<T>(record: T, options?: ConstrainedRequestOptions): CreateRequestOptions<T>;\nexport function createRecord(record: unknown, options?: ConstrainedRequestOptions): CreateRequestOptions;\nexport function createRecord(record: unknown, options: ConstrainedRequestOptions = {}): CreateRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n\n const urlOptions: CreateRecordUrlOptions = {\n identifier: identifier,\n op: 'createRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url,\n method: 'POST',\n headers,\n op: 'createRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n\n/**\n * Builds request options to update existing record for resources,\n * configured for the url, method and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { updateRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.peekRecord('person', '1');\n * person.name = 'Chris';\n * const data = await store.request(updateRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `patch` - Allows caller to specify whether to use a PATCH request instead of a PUT request, defaults to `false`.\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { updateRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.peekRecord('person', '1');\n * person.name = 'Chris';\n * const options = updateRecord(person, { patch: true });\n * const data = await store.request(options);\n * ```\n *\n * @method updateRecord\n * @public\n * @static\n * @for @ember-data-mirror/rest/request\n * @param record\n * @param options\n */\nexport function updateRecord<T>(\n record: T,\n options?: ConstrainedRequestOptions & { patch?: boolean }\n): UpdateRequestOptions<T>;\nexport function updateRecord(\n record: unknown,\n options?: ConstrainedRequestOptions & { patch?: boolean }\n): UpdateRequestOptions;\nexport function updateRecord(\n record: unknown,\n options: ConstrainedRequestOptions & { patch?: boolean } = {}\n): UpdateRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n assert(`Cannot update a record that does not have an associated type and id.`, isExisting(identifier));\n\n const urlOptions: UpdateRecordUrlOptions = {\n identifier: identifier,\n op: 'updateRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url,\n method: options.patch ? 'PATCH' : 'PUT',\n headers,\n op: 'updateRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n"],"names":["copyForwardUrlOptions","urlOptions","options","host","namespace","resourcePath","extractCacheOptions","cacheOptions","reload","backgroundReload","findRecord","arg1","arg2","arg3","identifier","type","id","op","pluralize","camelize","url","buildBaseURL","headers","Headers","append","include","length","buildQueryParams","urlParamsSettings","method","records","query","queryString","isExisting","deleteRecord","record","recordIdentifierFor","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","data","createRecord","updateRecord","patch"],"mappings":";;;;;AAGO,SAASA,qBAAqBA,CAACC,UAAsB,EAAEC,OAAkC,EAAQ;EACtG,IAAI,MAAM,IAAIA,OAAO,EAAE;AACrBD,IAAAA,UAAU,CAACE,IAAI,GAAGD,OAAO,CAACC,IAAI,CAAA;AAChC,GAAA;EACA,IAAI,WAAW,IAAID,OAAO,EAAE;AAC1BD,IAAAA,UAAU,CAACG,SAAS,GAAGF,OAAO,CAACE,SAAS,CAAA;AAC1C,GAAA;EACA,IAAI,cAAc,IAAIF,OAAO,EAAE;AAC7BD,IAAAA,UAAU,CAACI,YAAY,GAAGH,OAAO,CAACG,YAAY,CAAA;AAChD,GAAA;AACF,CAAA;AAEO,SAASC,mBAAmBA,CAACJ,OAAkC,EAAE;EACtE,MAAMK,YAA0B,GAAG,EAAE,CAAA;EACrC,IAAI,QAAQ,IAAIL,OAAO,EAAE;AACvBK,IAAAA,YAAY,CAACC,MAAM,GAAGN,OAAO,CAACM,MAAM,CAAA;AACtC,GAAA;EACA,IAAI,kBAAkB,IAAIN,OAAO,EAAE;AACjCK,IAAAA,YAAY,CAACE,gBAAgB,GAAGP,OAAO,CAACO,gBAAgB,CAAA;AAC1D,GAAA;AACA,EAAA,OAAOF,YAAY,CAAA;AACrB;;ACxBA;AACA;AACA;;AAaA;AACA;AACA;A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E,CAAChB,UAAU,CAAA;GACrB,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"request.js","sources":["../src/-private/builders/-utils.ts","../src/-private/builders/find-record.ts","../src/-private/builders/query.ts","../src/-private/builders/save-record.ts"],"sourcesContent":["import type { UrlOptions } from '@ember-data-mirror/request-utils';\nimport type { CacheOptions, ConstrainedRequestOptions } from '@warp-drive/core-types/request';\n\nexport function copyForwardUrlOptions(urlOptions: UrlOptions, options: ConstrainedRequestOptions): void {\n if ('host' in options) {\n urlOptions.host = options.host;\n }\n if ('namespace' in options) {\n urlOptions.namespace = options.namespace;\n }\n if ('resourcePath' in options) {\n urlOptions.resourcePath = options.resourcePath;\n }\n}\n\nexport function extractCacheOptions(options: ConstrainedRequestOptions) {\n const cacheOptions: CacheOptions = {};\n if ('reload' in options) {\n cacheOptions.reload = options.reload;\n }\n if ('backgroundReload' in options) {\n cacheOptions.backgroundReload = options.backgroundReload;\n }\n return cacheOptions;\n}\n","/**\n * @module @ember-data-mirror/rest/request\n */\nimport { buildBaseURL, buildQueryParams, type FindRecordUrlOptions } from '@ember-data-mirror/request-utils';\nimport { camelize, pluralize } from '@ember-data-mirror/request-utils/string';\nimport type { TypeFromInstance } from '@warp-drive/core-types/record';\nimport type {\n FindRecordOptions,\n FindRecordRequestOptions,\n RemotelyAccessibleIdentifier,\n} from '@warp-drive/core-types/request';\nimport type { SingleResourceDataDocument } from '@warp-drive/core-types/spec/document';\n\nimport { copyForwardUrlOptions, extractCacheOptions } from './-utils';\n\n/**\n * Builds request options to fetch a single resource by a known id or identifier\n * configured for the url and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { findRecord } from '@ember-data-mirror/rest/request';\n *\n * const data = await store.request(findRecord('person', '1'));\n * ```\n *\n * **With Options**\n *\n * ```ts\n * import { findRecord } from '@ember-data-mirror/rest/request';\n *\n * const options = findRecord('person', '1', { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **With an Identifier**\n *\n * ```ts\n * import { findRecord } from '@ember-data-mirror/rest/request';\n *\n * const options = findRecord({ type: 'person', id: '1' }, { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { findRecord } from '@ember-data-mirror/rest/request';\n *\n * const options = findRecord('person', '1', { include: ['pets', 'friends'] }, { namespace: 'api/v2' });\n * const data = await store.request(options);\n * ```\n *\n * @method findRecord\n * @public\n * @static\n * @for @ember-data-mirror/rest/request\n * @param identifier\n * @param options\n */\nexport type FindRecordResultDocument<T> = Omit<SingleResourceDataDocument<T>, 'data'> & { data: T };\n\nexport function findRecord<T>(\n identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>>,\n options?: FindRecordOptions<T>\n): FindRecordRequestOptions<T, FindRecordResultDocument<T>>;\nexport function findRecord(\n identifier: RemotelyAccessibleIdentifier,\n options?: FindRecordOptions\n): FindRecordRequestOptions;\nexport function findRecord<T>(\n type: TypeFromInstance<T>,\n id: string,\n options?: FindRecordOptions<T>\n): FindRecordRequestOptions<T, FindRecordResultDocument<T>>;\nexport function findRecord(type: string, id: string, options?: FindRecordOptions): FindRecordRequestOptions;\nexport function findRecord<T>(\n arg1: TypeFromInstance<T> | RemotelyAccessibleIdentifier<TypeFromInstance<T>>,\n arg2: string | FindRecordOptions | undefined,\n arg3?: FindRecordOptions\n): FindRecordRequestOptions<T, FindRecordResultDocument<T>> {\n const identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>> =\n typeof arg1 === 'string' ? { type: arg1, id: arg2 as string } : arg1;\n const options: FindRecordOptions = (typeof arg1 === 'string' ? arg3 : (arg2 as FindRecordOptions)) || {};\n const cacheOptions = extractCacheOptions(options);\n const urlOptions: FindRecordUrlOptions = {\n identifier,\n op: 'findRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url: options.include?.length\n ? `${url}?${buildQueryParams({ include: options.include }, options.urlParamsSettings)}`\n : url,\n method: 'GET',\n headers,\n cacheOptions,\n op: 'findRecord',\n records: [identifier],\n };\n}\n","/**\n * @module @ember-data-mirror/rest/request\n */\nimport { buildBaseURL, buildQueryParams, type QueryUrlOptions } from '@ember-data-mirror/request-utils';\nimport { camelize, pluralize } from '@ember-data-mirror/request-utils/string';\nimport type { QueryParamsSource } from '@warp-drive/core-types/params';\nimport type { TypeFromInstance } from '@warp-drive/core-types/record';\nimport type { ConstrainedRequestOptions, QueryRequestOptions } from '@warp-drive/core-types/request';\nimport type { CollectionResourceDataDocument } from '@warp-drive/core-types/spec/document';\n\nimport { copyForwardUrlOptions, extractCacheOptions } from './-utils';\n\n/**\n * Builds request options to query for resources, usually by a primary\n * type, configured for the url and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { query } from '@ember-data-mirror/rest/request';\n *\n * const data = await store.request(query('person'));\n * ```\n *\n * **With Query Params**\n *\n * ```ts\n * import { query } from '@ember-data-mirror/rest/request';\n *\n * const options = query('person', { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSettings` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { query } from '@ember-data-mirror/rest/request';\n *\n * const options = query('person', { include: ['pets', 'friends'] }, { reload: true });\n * const data = await store.request(options);\n * ```\n *\n * @method query\n * @public\n * @static\n * @for @ember-data-mirror/rest/request\n * @param identifier\n * @param query\n * @param options\n */\nexport function query<T>(\n type: TypeFromInstance<T>,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n query?: QueryParamsSource,\n options?: ConstrainedRequestOptions\n): QueryRequestOptions<T, CollectionResourceDataDocument<T>>;\nexport function query(\n type: string,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n query?: QueryParamsSource,\n options?: ConstrainedRequestOptions\n): QueryRequestOptions;\nexport function query(\n type: string,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n query: QueryParamsSource = {},\n options: ConstrainedRequestOptions = {}\n): QueryRequestOptions {\n const cacheOptions = extractCacheOptions(options);\n const urlOptions: QueryUrlOptions = {\n identifier: { type },\n op: 'query',\n resourcePath: pluralize(camelize(type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n const queryString = buildQueryParams(query, options.urlParamsSettings);\n\n return {\n url: queryString ? `${url}?${queryString}` : url,\n method: 'GET',\n headers,\n cacheOptions,\n op: 'query',\n };\n}\n","import {\n buildBaseURL,\n type CreateRecordUrlOptions,\n type DeleteRecordUrlOptions,\n type UpdateRecordUrlOptions,\n} from '@ember-data-mirror/request-utils';\nimport { camelize, pluralize } from '@ember-data-mirror/request-utils/string';\nimport { recordIdentifierFor } from '@ember-data-mirror/store';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';\nimport type {\n ConstrainedRequestOptions,\n CreateRequestOptions,\n DeleteRequestOptions,\n UpdateRequestOptions,\n} from '@warp-drive/core-types/request';\n\nimport { copyForwardUrlOptions } from './-utils';\n\nfunction isExisting(identifier: StableRecordIdentifier): identifier is StableExistingRecordIdentifier {\n return 'id' in identifier && identifier.id !== null && 'type' in identifier && identifier.type !== null;\n}\n\n/**\n * Builds request options to delete record for resources,\n * configured for the url, method and header expectations of REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { deleteRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.peekRecord('person', '1');\n *\n * // mark record as deleted\n * store.deleteRecord(person);\n *\n * // persist deletion\n * const data = await store.request(deleteRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { deleteRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.peekRecord('person', '1');\n *\n * // mark record as deleted\n * store.deleteRecord(person);\n *\n * // persist deletion\n * const options = deleteRecord(person, { namespace: 'api/v1' });\n * const data = await store.request(options);\n * ```\n *\n * @method deleteRecord\n * @public\n * @static\n * @for @ember-data-mirror/rest/request\n * @param record\n * @param options\n */\nexport function deleteRecord<T>(record: T, options?: ConstrainedRequestOptions): DeleteRequestOptions<T>;\nexport function deleteRecord(record: unknown, options?: ConstrainedRequestOptions): DeleteRequestOptions;\nexport function deleteRecord(record: unknown, options: ConstrainedRequestOptions = {}): DeleteRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));\n\n const urlOptions: DeleteRecordUrlOptions = {\n identifier: identifier,\n op: 'deleteRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url,\n method: 'DELETE',\n headers,\n op: 'deleteRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n\n/**\n * Builds request options to create new record for resources,\n * configured for the url, method and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { createRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.createRecord('person', { name: 'Ted' });\n * const data = await store.request(createRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { createRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.createRecord('person', { name: 'Ted' });\n * const options = createRecord(person, { namespace: 'api/v1' });\n * const data = await store.request(options);\n * ```\n *\n * @method createRecord\n * @public\n * @static\n * @for @ember-data-mirror/rest/request\n * @param record\n * @param options\n */\nexport function createRecord<T>(record: T, options?: ConstrainedRequestOptions): CreateRequestOptions<T>;\nexport function createRecord(record: unknown, options?: ConstrainedRequestOptions): CreateRequestOptions;\nexport function createRecord(record: unknown, options: ConstrainedRequestOptions = {}): CreateRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n\n const urlOptions: CreateRecordUrlOptions = {\n identifier: identifier,\n op: 'createRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url,\n method: 'POST',\n headers,\n op: 'createRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n\n/**\n * Builds request options to update existing record for resources,\n * configured for the url, method and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { updateRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.peekRecord('person', '1');\n * person.name = 'Chris';\n * const data = await store.request(updateRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `patch` - Allows caller to specify whether to use a PATCH request instead of a PUT request, defaults to `false`.\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { updateRecord } from '@ember-data-mirror/rest/request';\n *\n * const person = store.peekRecord('person', '1');\n * person.name = 'Chris';\n * const options = updateRecord(person, { patch: true });\n * const data = await store.request(options);\n * ```\n *\n * @method updateRecord\n * @public\n * @static\n * @for @ember-data-mirror/rest/request\n * @param record\n * @param options\n */\nexport function updateRecord<T>(\n record: T,\n options?: ConstrainedRequestOptions & { patch?: boolean }\n): UpdateRequestOptions<T>;\nexport function updateRecord(\n record: unknown,\n options?: ConstrainedRequestOptions & { patch?: boolean }\n): UpdateRequestOptions;\nexport function updateRecord(\n record: unknown,\n options: ConstrainedRequestOptions & { patch?: boolean } = {}\n): UpdateRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n assert(`Cannot update a record that does not have an associated type and id.`, isExisting(identifier));\n\n const urlOptions: UpdateRecordUrlOptions = {\n identifier: identifier,\n op: 'updateRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url,\n method: options.patch ? 'PATCH' : 'PUT',\n headers,\n op: 'updateRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n"],"names":["copyForwardUrlOptions","urlOptions","options","host","namespace","resourcePath","extractCacheOptions","cacheOptions","reload","backgroundReload","findRecord","arg1","arg2","arg3","identifier","type","id","op","pluralize","camelize","url","buildBaseURL","headers","Headers","append","include","length","buildQueryParams","urlParamsSettings","method","records","query","queryString","isExisting","deleteRecord","record","recordIdentifierFor","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","data","createRecord","updateRecord","patch"],"mappings":";;;;;AAGO,SAASA,qBAAqBA,CAAC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A,CAAA,CAAA,CAAA;AAAA,KAAA;GAAEV,EAAAA,UAAU,CAACnB,UAAU,CAAC,CAAA,GAAA,EAAA,CAAA;AAErG,EAAA,MAAMb,UAAkC,GAAG;AACzCa,IAAAA,UAAU,EAAEA,UAAU;AACtBG,IAAAA,EAAE,EAAE,cAAc;IAClBZ,YAAY,EAAEa,SAAS,CAACC,QAAQ,CAACL,UAAU,CAACC,IAAI,CAAC,CAAA;GAClD,CAAA;AAEDf,EAAAA,qBAAqB,CAACC,UAAU,EAAEC,OAAO,CAAC,CAAA;AAE1C,EAAA,MAAMkB,GAAG,GAAGC,YAAY,CAACpB,UAAU,CAAC,CAAA;AACpC,EAAA,MAAMqB,OAAO,GAAG,IAAIC,OAAO,EAAE,CAAA;AAC7BD,EAAAA,OAAO,CAACE,MAAM,CAAC,QAAQ,EAAE,gCAAgC,CAAC,CAAA;EAE1D,OAAO;IACLJ,GAAG;AACHS,IAAAA,MAAM,EAAE3B,OAAO,CAAC6C,KAAK,GAAG,OAAO,GAAG,KAAK;IACvCzB,OAAO;AACPL,IAAAA,EAAE,EAAE,cAAc;AAClB2B,IAAAA,IAAI,EAAE;AACJT,MAAAA,MAAM,EAAErB,UAAAA;KACT;IACDgB,OAAO,EAAE,CAAChB,UAAU,CAAA;GACrB,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data-mirror/rest",
|
|
3
3
|
"description": "REST Format Support for EmberData",
|
|
4
|
-
"version": "5.3.
|
|
4
|
+
"version": "5.3.9",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Chris Thoburn <runspired@users.noreply.github.com>",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"homepage": "https://github.com/emberjs/data",
|
|
14
14
|
"bugs": "https://github.com/emberjs/data/issues",
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": ">= 18.20.
|
|
16
|
+
"node": ">= 18.20.4"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"ember-addon"
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"extends": "../../../../../../package.json"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@embroider/macros": "^1.16.
|
|
26
|
-
"@warp-drive/build-config": "0.0.0-beta.
|
|
25
|
+
"@embroider/macros": "^1.16.6",
|
|
26
|
+
"@warp-drive/build-config": "0.0.0-beta.7"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@ember-data-mirror/request-utils": "5.3.
|
|
29
|
+
"@ember-data-mirror/request-utils": "5.3.9",
|
|
30
30
|
"@ember-data-mirror/store": "^4.12.0 || ^5.0.0",
|
|
31
|
-
"@warp-drive/core-types": "0.0.0-beta.
|
|
31
|
+
"@warp-drive/core-types": "0.0.0-beta.12"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"unstable-preview-types",
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
"@babel/plugin-transform-typescript": "^7.24.5",
|
|
60
60
|
"@babel/preset-env": "^7.24.5",
|
|
61
61
|
"@babel/preset-typescript": "^7.24.1",
|
|
62
|
-
"@ember-data-mirror/request": "5.3.
|
|
63
|
-
"@ember-data-mirror/request-utils": "5.3.
|
|
64
|
-
"@ember-data-mirror/store": "5.3.
|
|
65
|
-
"@ember-data-mirror/tracking": "5.3.
|
|
62
|
+
"@ember-data-mirror/request": "5.3.9",
|
|
63
|
+
"@ember-data-mirror/request-utils": "5.3.9",
|
|
64
|
+
"@ember-data-mirror/store": "5.3.9",
|
|
65
|
+
"@ember-data-mirror/tracking": "5.3.9",
|
|
66
66
|
"@glimmer/component": "^1.1.2",
|
|
67
|
-
"@warp-drive/core-types": "0.0.0-beta.
|
|
68
|
-
"@warp-drive/internal-config": "5.3.
|
|
69
|
-
"ember-source": "~5.
|
|
67
|
+
"@warp-drive/core-types": "0.0.0-beta.12",
|
|
68
|
+
"@warp-drive/internal-config": "5.3.9",
|
|
69
|
+
"ember-source": "~5.12.0",
|
|
70
70
|
"pnpm-sync-dependencies-meta-injected": "0.0.14",
|
|
71
71
|
"typescript": "^5.4.5",
|
|
72
72
|
"vite": "^5.2.11"
|
|
@@ -36,7 +36,7 @@ declare module '@ember-data-mirror/rest/-private/builders/query' {
|
|
|
36
36
|
* - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
|
|
37
37
|
* promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
|
|
38
38
|
* defaulting to `false` if none is configured.
|
|
39
|
-
* - `
|
|
39
|
+
* - `urlParamsSettings` - an object containing options for how to serialize the query params (see `buildQueryParams`)
|
|
40
40
|
*
|
|
41
41
|
* ```ts
|
|
42
42
|
* import { query } from '@ember-data-mirror/rest/request';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./request.d.ts" />
|
|
2
|
-
/// <reference path="./-private/builders
|
|
2
|
+
/// <reference path="./-private/builders/find-record.d.ts" />
|
|
3
3
|
/// <reference path="./-private/builders/query.d.ts" />
|
|
4
4
|
/// <reference path="./-private/builders/save-record.d.ts" />
|
|
5
|
-
/// <reference path="./-private/builders
|
|
5
|
+
/// <reference path="./-private/builders/-utils.d.ts" />
|