@ember-data-mirror/rest 5.4.0-alpha.63 → 5.4.0-alpha.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/addon-main.cjs ADDED
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const { addonShim } = require('@warp-drive-mirror/build-config/addon-shim.cjs');
4
+
5
+ module.exports = addonShim(__dirname);
@@ -1,8 +1,8 @@
1
1
  import { camelize } from '@ember/string';
2
2
  import { pluralize } from 'ember-inflector';
3
3
  import { buildBaseURL, buildQueryParams } from '@ember-data-mirror/request-utils';
4
- import { assert } from '@ember/debug';
5
4
  import { recordIdentifierFor } from '@ember-data-mirror/store';
5
+ import { macroCondition, getGlobalConfig } from '@embroider/macros';
6
6
  function copyForwardUrlOptions(urlOptions, options) {
7
7
  if ('host' in options) {
8
8
  urlOptions.host = options.host;
@@ -67,9 +67,9 @@ function extractCacheOptions(options) {
67
67
  * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
68
68
  * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type
69
69
  * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
70
- * option will delegate to the store's lifetimes service, defaulting to `false` if none is configured.
70
+ * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
71
71
  * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
72
- * promise with the cached value, not supplying this option will delegate to the store's lifetimes service,
72
+ * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
73
73
  * defaulting to `false` if none is configured.
74
74
  * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
75
75
  *
@@ -149,9 +149,9 @@ function findRecord(arg1, arg2, arg3) {
149
149
  * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
150
150
  * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type
151
151
  * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
152
- * option will delegate to the store's lifetimes service, defaulting to `false` if none is configured.
152
+ * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
153
153
  * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
154
- * promise with the cached value, not supplying this option will delegate to the store's lifetimes service,
154
+ * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
155
155
  * defaulting to `false` if none is configured.
156
156
  * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
157
157
  *
@@ -225,9 +225,9 @@ function isExisting(identifier) {
225
225
  * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
226
226
  * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
227
227
  * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
228
- * option will delegate to the store's lifetimes service, defaulting to `false` if none is configured.
228
+ * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
229
229
  * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
230
- * promise with the cached value, not supplying this option will delegate to the store's lifetimes service,
230
+ * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
231
231
  * defaulting to `false` if none is configured.
232
232
  * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
233
233
  *
@@ -254,8 +254,16 @@ function isExisting(identifier) {
254
254
 
255
255
  function deleteRecord(record, options = {}) {
256
256
  const identifier = recordIdentifierFor(record);
257
- assert(`Expected to be given a record instance`, identifier);
258
- assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));
257
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
258
+ if (!test) {
259
+ throw new Error(`Expected to be given a record instance`);
260
+ }
261
+ })(identifier) : {};
262
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
263
+ if (!test) {
264
+ throw new Error(`Cannot delete a record that does not have an associated type and id.`);
265
+ }
266
+ })(isExisting(identifier)) : {};
259
267
  const urlOptions = {
260
268
  identifier: identifier,
261
269
  op: 'deleteRecord',
@@ -298,9 +306,9 @@ function deleteRecord(record, options = {}) {
298
306
  * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
299
307
  * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
300
308
  * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
301
- * option will delegate to the store's lifetimes service, defaulting to `false` if none is configured.
309
+ * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
302
310
  * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
303
- * promise with the cached value, not supplying this option will delegate to the store's lifetimes service,
311
+ * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
304
312
  * defaulting to `false` if none is configured.
305
313
  * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
306
314
  *
@@ -322,7 +330,11 @@ function deleteRecord(record, options = {}) {
322
330
 
323
331
  function createRecord(record, options = {}) {
324
332
  const identifier = recordIdentifierFor(record);
325
- assert(`Expected to be given a record instance`, identifier);
333
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
334
+ if (!test) {
335
+ throw new Error(`Expected to be given a record instance`);
336
+ }
337
+ })(identifier) : {};
326
338
  const urlOptions = {
327
339
  identifier: identifier,
328
340
  op: 'createRecord',
@@ -367,9 +379,9 @@ function createRecord(record, options = {}) {
367
379
  * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
368
380
  * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
369
381
  * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
370
- * option will delegate to the store's lifetimes service, defaulting to `false` if none is configured.
382
+ * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
371
383
  * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
372
- * promise with the cached value, not supplying this option will delegate to the store's lifetimes service,
384
+ * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
373
385
  * defaulting to `false` if none is configured.
374
386
  * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
375
387
  *
@@ -392,8 +404,16 @@ function createRecord(record, options = {}) {
392
404
 
393
405
  function updateRecord(record, options = {}) {
394
406
  const identifier = recordIdentifierFor(record);
395
- assert(`Expected to be given a record instance`, identifier);
396
- assert(`Cannot update a record that does not have an associated type and id.`, isExisting(identifier));
407
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
408
+ if (!test) {
409
+ throw new Error(`Expected to be given a record instance`);
410
+ }
411
+ })(identifier) : {};
412
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
413
+ if (!test) {
414
+ throw new Error(`Cannot update a record that does not have an associated type and id.`);
415
+ }
416
+ })(isExisting(identifier)) : {};
397
417
  const urlOptions = {
398
418
  identifier: identifier,
399
419
  op: 'updateRecord',
@@ -0,0 +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-mirror/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 { camelize } from '@ember/string';\n\nimport { pluralize } from 'ember-inflector';\n\nimport { buildBaseURL, buildQueryParams, type FindRecordUrlOptions } from '@ember-data-mirror/request-utils';\nimport type { TypeFromInstance } from '@warp-drive-mirror/core-types/record';\nimport type {\n FindRecordOptions,\n FindRecordRequestOptions,\n RemotelyAccessibleIdentifier,\n} from '@warp-drive-mirror/core-types/request';\nimport type { SingleResourceDataDocument } from '@warp-drive-mirror/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 { camelize } from '@ember/string';\n\nimport { pluralize } from 'ember-inflector';\n\nimport { buildBaseURL, buildQueryParams, type QueryUrlOptions } from '@ember-data-mirror/request-utils';\nimport type { QueryParamsSource } from '@warp-drive-mirror/core-types/params';\nimport type { TypeFromInstance } from '@warp-drive-mirror/core-types/record';\nimport type { ConstrainedRequestOptions, QueryRequestOptions } from '@warp-drive-mirror/core-types/request';\nimport type { CollectionResourceDataDocument } from '@warp-drive-mirror/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 { camelize } from '@ember/string';\n\nimport { pluralize } from 'ember-inflector';\n\nimport {\n buildBaseURL,\n type CreateRecordUrlOptions,\n type DeleteRecordUrlOptions,\n type UpdateRecordUrlOptions,\n} from '@ember-data-mirror/request-utils';\nimport { recordIdentifierFor } from '@ember-data-mirror/store';\nimport { assert } from '@warp-drive-mirror/build-config/macros';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive-mirror/core-types/identifier';\nimport type {\n ConstrainedRequestOptions,\n CreateRequestOptions,\n DeleteRequestOptions,\n UpdateRequestOptions,\n} from '@warp-drive-mirror/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,I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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.4.0-alpha.63",
4
+ "version": "5.4.0-alpha.70",
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.2"
16
+ "node": ">= 22.1.0"
17
17
  },
18
18
  "keywords": [
19
19
  "ember-addon"
@@ -22,63 +22,54 @@
22
22
  "extends": "../../../../../../package.json"
23
23
  },
24
24
  "dependencies": {
25
+ "@embroider/macros": "^1.16.1",
26
+ "@warp-drive-mirror/build-config": "0.0.0-alpha.7",
25
27
  "ember-cli-babel": "^8.2.0"
26
28
  },
27
29
  "peerDependencies": {
28
- "@ember-data-mirror/request-utils": "5.4.0-alpha.63",
30
+ "@ember-data-mirror/request-utils": "5.4.0-alpha.70",
29
31
  "@ember-data-mirror/store": "^4.12.0 || ^5.0.0",
30
32
  "@ember/string": "^3.1.1",
31
- "@warp-drive-mirror/core-types": "0.0.0-alpha.49",
33
+ "@warp-drive-mirror/core-types": "0.0.0-alpha.56",
32
34
  "ember-inflector": "^4.0.2"
33
35
  },
34
36
  "files": [
35
37
  "unstable-preview-types",
36
- "addon-main.js",
37
- "addon",
38
+ "addon-main.cjs",
39
+ "dist",
38
40
  "README.md",
39
41
  "LICENSE.md",
40
42
  "ember-data-mirror-logo-dark.svg",
41
43
  "ember-data-mirror-logo-light.svg"
42
44
  ],
43
45
  "scripts": {
44
- "lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs --report-unused-disable-directives",
45
- "build:types": "tsc --build",
46
- "build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
47
- "_build": "bun run build:client && bun run build:types",
48
- "_syncPnpm": "bun run sync-dependencies-meta-injected"
46
+ "lint": "eslint . --quiet --cache --cache-strategy=content --report-unused-disable-directives",
47
+ "build:pkg": "vite build;",
48
+ "sync-hardlinks": "bun run sync-dependencies-meta-injected"
49
49
  },
50
50
  "ember-addon": {
51
- "main": "addon-main.js",
51
+ "main": "addon-main.cjs",
52
52
  "type": "addon",
53
53
  "version": 1
54
54
  },
55
55
  "devDependencies": {
56
- "@babel/cli": "^7.24.1",
57
- "@babel/core": "^7.24.4",
58
- "@babel/plugin-proposal-decorators": "^7.24.1",
59
- "@babel/plugin-transform-class-properties": "^7.24.1",
60
- "@babel/plugin-transform-runtime": "^7.24.3",
61
- "@babel/plugin-transform-typescript": "^7.24.4",
62
- "@babel/preset-env": "^7.24.4",
56
+ "@babel/core": "^7.24.5",
57
+ "@babel/plugin-transform-typescript": "^7.24.5",
58
+ "@babel/preset-env": "^7.24.5",
63
59
  "@babel/preset-typescript": "^7.24.1",
64
- "@babel/runtime": "^7.24.4",
65
- "@ember-data-mirror/request": "5.4.0-alpha.63",
66
- "@ember-data-mirror/request-utils": "5.4.0-alpha.63",
67
- "@ember-data-mirror/store": "5.4.0-alpha.63",
68
- "@ember-data-mirror/tracking": "5.4.0-alpha.63",
60
+ "@ember-data-mirror/request": "5.4.0-alpha.70",
61
+ "@ember-data-mirror/request-utils": "5.4.0-alpha.70",
62
+ "@ember-data-mirror/store": "5.4.0-alpha.70",
63
+ "@ember-data-mirror/tracking": "5.4.0-alpha.70",
69
64
  "@ember/string": "^3.1.1",
70
- "@embroider/addon-dev": "^4.3.1",
71
65
  "@glimmer/component": "^1.1.2",
72
- "@rollup/plugin-babel": "^6.0.4",
73
- "@rollup/plugin-node-resolve": "^15.2.3",
74
- "@warp-drive-mirror/core-types": "0.0.0-alpha.49",
75
- "@warp-drive/internal-config": "5.4.0-alpha.63",
66
+ "@warp-drive-mirror/core-types": "0.0.0-alpha.56",
67
+ "@warp-drive/internal-config": "5.4.0-alpha.70",
76
68
  "ember-inflector": "^4.0.2",
77
- "ember-source": "~5.7.0",
78
- "pnpm-sync-dependencies-meta-injected": "0.0.10",
79
- "rollup": "^4.14.3",
69
+ "ember-source": "~5.8.0",
70
+ "pnpm-sync-dependencies-meta-injected": "0.0.14",
80
71
  "typescript": "^5.4.5",
81
- "walk-sync": "^3.0.0"
72
+ "vite": "^5.2.11"
82
73
  },
83
74
  "ember": {
84
75
  "edition": "octane"
@@ -104,6 +95,9 @@
104
95
  },
105
96
  "@ember-data-mirror/tracking": {
106
97
  "injected": true
98
+ },
99
+ "@warp-drive-mirror/build-config": {
100
+ "injected": true
107
101
  }
108
102
  }
109
103
  }
@@ -40,9 +40,9 @@ declare module '@ember-data-mirror/rest/-private/builders/find-record' {
40
40
  * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
41
41
  * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type
42
42
  * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
43
- * option will delegate to the store's lifetimes service, defaulting to `false` if none is configured.
43
+ * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
44
44
  * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
45
- * promise with the cached value, not supplying this option will delegate to the store's lifetimes service,
45
+ * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
46
46
  * defaulting to `false` if none is configured.
47
47
  * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
48
48
  *
@@ -32,9 +32,9 @@ declare module '@ember-data-mirror/rest/-private/builders/query' {
32
32
  * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
33
33
  * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type
34
34
  * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
35
- * option will delegate to the store's lifetimes service, defaulting to `false` if none is configured.
35
+ * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
36
36
  * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
37
- * promise with the cached value, not supplying this option will delegate to the store's lifetimes service,
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
  * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
40
40
  *
@@ -26,9 +26,9 @@ declare module '@ember-data-mirror/rest/-private/builders/save-record' {
26
26
  * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
27
27
  * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
28
28
  * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
29
- * option will delegate to the store's lifetimes service, defaulting to `false` if none is configured.
29
+ * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
30
30
  * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
31
- * promise with the cached value, not supplying this option will delegate to the store's lifetimes service,
31
+ * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
32
32
  * defaulting to `false` if none is configured.
33
33
  * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
34
34
  *
@@ -75,9 +75,9 @@ declare module '@ember-data-mirror/rest/-private/builders/save-record' {
75
75
  * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
76
76
  * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
77
77
  * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
78
- * option will delegate to the store's lifetimes service, defaulting to `false` if none is configured.
78
+ * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
79
79
  * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
80
- * promise with the cached value, not supplying this option will delegate to the store's lifetimes service,
80
+ * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
81
81
  * defaulting to `false` if none is configured.
82
82
  * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
83
83
  *
@@ -121,9 +121,9 @@ declare module '@ember-data-mirror/rest/-private/builders/save-record' {
121
121
  * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
122
122
  * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
123
123
  * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
124
- * option will delegate to the store's lifetimes service, defaulting to `false` if none is configured.
124
+ * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
125
125
  * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
126
- * promise with the cached value, not supplying this option will delegate to the store's lifetimes service,
126
+ * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
127
127
  * defaulting to `false` if none is configured.
128
128
  * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
129
129
  *
@@ -1,5 +1,5 @@
1
1
  /// <reference path="./request.d.ts" />
2
- /// <reference path="./-private/builders/save-record.d.ts" />
3
- /// <reference path="./-private/builders/query.d.ts" />
4
2
  /// <reference path="./-private/builders/-utils.d.ts" />
5
- /// <reference path="./-private/builders/find-record.d.ts" />
3
+ /// <reference path="./-private/builders/find-record.d.ts" />
4
+ /// <reference path="./-private/builders/query.d.ts" />
5
+ /// <reference path="./-private/builders/save-record.d.ts" />
@@ -1 +0,0 @@
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-mirror/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 { camelize } from '@ember/string';\n\nimport { pluralize } from 'ember-inflector';\n\nimport { buildBaseURL, buildQueryParams, type FindRecordUrlOptions } from '@ember-data-mirror/request-utils';\nimport type { TypeFromInstance } from '@warp-drive-mirror/core-types/record';\nimport type {\n FindRecordOptions,\n FindRecordRequestOptions,\n RemotelyAccessibleIdentifier,\n} from '@warp-drive-mirror/core-types/request';\nimport type { SingleResourceDataDocument } from '@warp-drive-mirror/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 lifetimes service, 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 lifetimes service,\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 { camelize } from '@ember/string';\n\nimport { pluralize } from 'ember-inflector';\n\nimport { buildBaseURL, buildQueryParams, type QueryUrlOptions } from '@ember-data-mirror/request-utils';\nimport type { QueryParamsSource } from '@warp-drive-mirror/core-types/params';\nimport type { TypeFromInstance } from '@warp-drive-mirror/core-types/record';\nimport type { ConstrainedRequestOptions, QueryRequestOptions } from '@warp-drive-mirror/core-types/request';\nimport type { CollectionResourceDataDocument } from '@warp-drive-mirror/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 lifetimes service, 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 lifetimes service,\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 { assert } from '@ember/debug';\nimport { camelize } from '@ember/string';\n\nimport { pluralize } from 'ember-inflector';\n\nimport {\n buildBaseURL,\n type CreateRecordUrlOptions,\n type DeleteRecordUrlOptions,\n type UpdateRecordUrlOptions,\n} from '@ember-data-mirror/request-utils';\nimport { recordIdentifierFor } from '@ember-data-mirror/store';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive-mirror/core-types/identifier';\nimport type {\n ConstrainedRequestOptions,\n CreateRequestOptions,\n DeleteRequestOptions,\n UpdateRequestOptions,\n} from '@warp-drive-mirror/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 lifetimes service, 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 lifetimes service,\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 lifetimes service, 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 lifetimes service,\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 lifetimes service, 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 lifetimes service,\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","assert","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,GAA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AAA,sCAAA,CAAuC,EAAEvB,UAAU,CAAC,CAAA;AAC5DuB,EAAAA,MAAM,CAAE,CAAqE,oEAAA,CAAA,EAAEJ,UAAU,CAACnB,UAAU,CAAC,CAAC,CAAA;AAEtG,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,CAACuC,KAAK,GAAG,OAAO,GAAG,KAAK;IACvCnB,OAAO;AACPL,IAAAA,EAAE,EAAE,cAAc;AAClBqB,IAAAA,IAAI,EAAE;AACJH,MAAAA,MAAM,EAAErB,UAAAA;KACT;IACDgB,OAAO,EAAE,CAAChB,UAAU,CAAA;GACrB,CAAA;AACH;;;;"}
package/addon-main.js DELETED
@@ -1,19 +0,0 @@
1
- module.exports = {
2
- name: require('./package.json').name,
3
-
4
- treeForVendor() {
5
- return;
6
- },
7
- treeForPublic() {
8
- return;
9
- },
10
- treeForStyles() {
11
- return;
12
- },
13
- treeForAddonStyles() {
14
- return;
15
- },
16
- treeForApp() {
17
- return;
18
- },
19
- };