ember-data-resources 5.2.3 → 5.3.1

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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/-private/resources/errors.js.map +1 -1
  3. package/dist/-private/resources/find-all.js +10 -12
  4. package/dist/-private/resources/find-all.js.map +1 -1
  5. package/dist/-private/resources/find-record.js +10 -12
  6. package/dist/-private/resources/find-record.js.map +1 -1
  7. package/dist/-private/resources/query-record.js +10 -12
  8. package/dist/-private/resources/query-record.js.map +1 -1
  9. package/dist/-private/resources/query.js +10 -12
  10. package/dist/-private/resources/query.js.map +1 -1
  11. package/dist/-private/resources/request.js +102 -8
  12. package/dist/-private/resources/request.js.map +1 -1
  13. package/dist/js-helpers.js.map +1 -1
  14. package/dist-types/-private/resources/errors.d.ts +3 -4
  15. package/dist-types/-private/resources/errors.d.ts.map +1 -1
  16. package/dist-types/-private/resources/find-all.d.ts +9 -10
  17. package/dist-types/-private/resources/find-all.d.ts.map +1 -1
  18. package/dist-types/-private/resources/find-record.d.ts +9 -9
  19. package/dist-types/-private/resources/find-record.d.ts.map +1 -1
  20. package/dist-types/-private/resources/query-record.d.ts +9 -9
  21. package/dist-types/-private/resources/query-record.d.ts.map +1 -1
  22. package/dist-types/-private/resources/query.d.ts +10 -11
  23. package/dist-types/-private/resources/query.d.ts.map +1 -1
  24. package/dist-types/-private/resources/request.d.ts +4 -5
  25. package/dist-types/-private/resources/types.d.ts +2 -2
  26. package/dist-types/index.d.ts +6 -5
  27. package/dist-types/index.d.ts.map +1 -1
  28. package/dist-types/js-helpers.d.ts +15 -10
  29. package/dist-types/js-helpers.d.ts.map +1 -1
  30. package/dist-types/loose-mode-compat/helpers/find-all.d.ts +3 -2
  31. package/dist-types/loose-mode-compat/helpers/find-all.d.ts.map +1 -1
  32. package/dist-types/loose-mode-compat/helpers/find-record.d.ts +3 -2
  33. package/dist-types/loose-mode-compat/helpers/find-record.d.ts.map +1 -1
  34. package/dist-types/loose-mode-compat/helpers/query-record.d.ts +3 -2
  35. package/dist-types/loose-mode-compat/helpers/query-record.d.ts.map +1 -1
  36. package/dist-types/loose-mode-compat/helpers/query.d.ts +3 -2
  37. package/dist-types/loose-mode-compat/helpers/query.d.ts.map +1 -1
  38. package/package.json +11 -13
  39. package/dist/request-D75_GC-a.js +0 -142
  40. package/dist/request-D75_GC-a.js.map +0 -1
  41. package/dist-types/defineProperty-d7617aac.d.ts +0 -2
  42. package/dist-types/request-D75_GC-a.d.ts +0 -9
  43. package/dist-types/toPropertyKey-d7617aac.d.ts +0 -4
package/README.md CHANGED
@@ -8,7 +8,7 @@ Resources for reactive data fetching with ember-data's `store` service.
8
8
  * ember-data v3.28 or above
9
9
  * ember-auto-import v2 or above
10
10
  * ember-resources v5.3 or above
11
- * typescript v4.8 or above
11
+ * typescript v5 or above
12
12
 
13
13
  ## Installation
14
14
 
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sources":["../../../src/-private/resources/errors.ts"],"sourcesContent":["export class IdRequiredError extends TypeError {\n constructor(modelName: string) {\n super(\n `While trying to request a resource from ${modelName}, the ID was either null or undefined, and the ID is required for fetching resources`,\n );\n }\n}\n\nexport class IdTypeError extends TypeError {\n constructor(modelName: string, id: unknown) {\n super(\n `While trying to request a resource from ${modelName}, the ID was of invalid type ${typeof id}: only string and number are supported`,\n );\n }\n}\n"],"names":["IdRequiredError","TypeError","constructor","modelName","IdTypeError","id"],"mappings":"AAAO,MAAMA,eAAe,SAASC,SAAS,CAAC;EAC7CC,WAAWA,CAACC,SAAiB,EAAE;AAC7B,IAAA,KAAK,CACF,CAAA,wCAAA,EAA0CA,SAAU,CAAA,oFAAA,CACvD,CAAC,CAAA;AACH,GAAA;AACF,CAAA;AAEO,MAAMC,WAAW,SAASH,SAAS,CAAC;AACzCC,EAAAA,WAAWA,CAACC,SAAiB,EAAEE,EAAW,EAAE;AAC1C,IAAA,KAAK,CACF,CAA0CF,wCAAAA,EAAAA,SAAU,gCAA+B,OAAOE,EAAG,wCAChG,CAAC,CAAA;AACH,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"errors.js","sources":["../../../src/-private/resources/errors.ts"],"sourcesContent":["export class IdRequiredError extends TypeError {\n constructor(modelName: string) {\n super(\n `While trying to request a resource from ${modelName}, the ID was either null or undefined, and the ID is required for fetching resources`,\n );\n }\n}\n\nexport class IdTypeError extends TypeError {\n constructor(modelName: string, id: unknown) {\n super(\n `While trying to request a resource from ${modelName}, the ID was of invalid type ${typeof id}: only string and number are supported`,\n );\n }\n}\n"],"names":["IdRequiredError","TypeError","constructor","modelName","IdTypeError","id"],"mappings":"AAAO,MAAMA,eAAe,SAASC,SAAS,CAAC;EAC7CC,WAAWA,CAACC,SAAiB,EAAE;AAC7B,IAAA,KAAK,CACF,CAAA,wCAAA,EAA0CA,SAAU,CAAA,oFAAA,CACvD,CAAC;AACH;AACF;AAEO,MAAMC,WAAW,SAASH,SAAS,CAAC;AACzCC,EAAAA,WAAWA,CAACC,SAAiB,EAAEE,EAAW,EAAE;AAC1C,IAAA,KAAK,CACF,CAA0CF,wCAAAA,EAAAA,SAAU,gCAA+B,OAAOE,EAAG,wCAChG,CAAC;AACH;AACF;;;;"}
@@ -1,14 +1,14 @@
1
- import { _ as _applyDecoratedDescriptor, R as Request, a as _initializerDefineProperty } from '../../request-D75_GC-a.js';
2
1
  import { tracked } from '@glimmer/tracking';
3
2
  import { isDestroyed, isDestroying } from '@ember/destroyable';
4
3
  import { action } from '@ember/object';
4
+ import { Request } from './request.js';
5
+ import { g, i, n } from 'decorator-transforms/runtime-esm';
5
6
 
6
- var _class, _descriptor;
7
- let FindAll = (_class = class FindAll extends Request {
8
- constructor(...args) {
9
- super(...args);
10
- _initializerDefineProperty(this, "_records", _descriptor, this);
7
+ class FindAll extends Request {
8
+ static {
9
+ g(this.prototype, "_records", [tracked]);
11
10
  }
11
+ #_records = (i(this, "_records"), void 0);
12
12
  async __WRAPPED_FUNCTION__([modelName], {
13
13
  options
14
14
  }) {
@@ -16,15 +16,13 @@ let FindAll = (_class = class FindAll extends Request {
16
16
  if (isDestroyed(this) || isDestroying(this)) return;
17
17
  this._records = records;
18
18
  }
19
+ static {
20
+ n(this.prototype, "__WRAPPED_FUNCTION__", [action]);
21
+ }
19
22
  get records() {
20
23
  return this._records;
21
24
  }
22
- }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "_records", [tracked], {
23
- configurable: true,
24
- enumerable: true,
25
- writable: true,
26
- initializer: null
27
- }), _applyDecoratedDescriptor(_class.prototype, "__WRAPPED_FUNCTION__", [action], Object.getOwnPropertyDescriptor(_class.prototype, "__WRAPPED_FUNCTION__"), _class.prototype)), _class);
25
+ }
28
26
 
29
27
  export { FindAll };
30
28
  //# sourceMappingURL=find-all.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-all.js","sources":["../../../src/-private/resources/find-all.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\n\nimport { Request } from './request';\n\nimport type ArrayProxy from '@ember/array/proxy';\nimport type Store from '@ember-data/store';\n\nexport type FindAllOptions = Parameters<Store['findAll']>[1];\n\ntype PositionalArgs = [string];\nexport interface NamedArgs {\n options: FindAllOptions;\n}\n\nexport interface Args {\n named: NamedArgs;\n positional: PositionalArgs;\n}\n\nexport class FindAll<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {\n @tracked private _records: ArrayProxy<Model> | undefined;\n\n @action\n async __WRAPPED_FUNCTION__([modelName]: PositionalArgs, { options }: NamedArgs): Promise<void> {\n const records = await this.store.findAll(modelName as never, options);\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this._records = records;\n }\n\n get records(): ArrayProxy<Model> | undefined {\n return this._records;\n }\n}\n"],"names":["FindAll","_class","Request","constructor","args","_initializerDefineProperty","_descriptor","__WRAPPED_FUNCTION__","modelName","options","records","store","findAll","isDestroyed","isDestroying","_records","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;AAqBaA,IAAAA,OAAO,IAAAC,MAAA,GAAb,MAAMD,OAAO,SAA+CE,OAAO,CAAY;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,mBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAGpF,EAAA,MACMC,oBAAoBA,CAAC,CAACC,SAAS,CAAiB,EAAE;AAAEC,IAAAA,OAAAA;AAAmB,GAAC,EAAiB;AAC7F,IAAA,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACC,KAAK,CAACC,OAAO,CAACJ,SAAS,EAAWC,OAAO,CAAC,CAAA;IAErE,IAAII,WAAW,CAAC,IAAI,CAAC,IAAIC,YAAY,CAAC,IAAI,CAAC,EAAE,OAAA;IAE7C,IAAI,CAACC,QAAQ,GAAGL,OAAO,CAAA;AACzB,GAAA;EAEA,IAAIA,OAAOA,GAAkC;IAC3C,OAAO,IAAI,CAACK,QAAQ,CAAA;AACtB,GAAA;AACF,CAAC,GAAAT,WAAA,GAAAU,yBAAA,CAAAf,MAAA,CAAAgB,SAAA,EAAA,UAAA,EAAA,CAdEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA,IAAA;AAAA,CAAAN,CAAAA,EAAAA,yBAAA,CAAAf,MAAA,CAAAgB,SAAA,EAEPM,sBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAxB,MAAA,CAAAgB,SAAA,EAAA,sBAAA,CAAA,EAAAhB,MAAA,CAAAgB,SAAA,IAAAhB,MAAA;;;;"}
1
+ {"version":3,"file":"find-all.js","sources":["../../../src/-private/resources/find-all.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\n\nimport { Request } from './request.ts';\n\nimport type ArrayProxy from '@ember/array/proxy';\nimport type Store from '@ember-data/store';\n\nexport type FindAllOptions = Parameters<Store['findAll']>[1];\n\ntype PositionalArgs = [string];\nexport interface NamedArgs {\n options: FindAllOptions;\n}\n\nexport interface Args {\n named: NamedArgs;\n positional: PositionalArgs;\n}\n\nexport class FindAll<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {\n @tracked private _records: ArrayProxy<Model> | undefined;\n\n @action\n async __WRAPPED_FUNCTION__([modelName]: PositionalArgs, { options }: NamedArgs): Promise<void> {\n const records = await this.store.findAll(modelName as never, options);\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this._records = records;\n }\n\n get records(): ArrayProxy<Model> | undefined {\n return this._records;\n }\n}\n"],"names":["FindAll","Request","g","prototype","tracked","i","void 0","__WRAPPED_FUNCTION__","modelName","options","records","store","findAll","isDestroyed","isDestroying","_records","n","action"],"mappings":";;;;;;AAqBO,MAAMA,OAAO,SAA+CC,OAAO,CAAY;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,UAAA,EAAA,CACnFC,OAAO,CAAA,CAAA;AAAA;AAAA,EAAA,SAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,UAAA,CAAA,EAAAC,MAAA;AAER,EAAA,MACMC,oBAAoBA,CAAC,CAACC,SAAS,CAAiB,EAAE;AAAEC,IAAAA;AAAmB,GAAC,EAAiB;AAC7F,IAAA,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACC,KAAK,CAACC,OAAO,CAACJ,SAAS,EAAWC,OAAO,CAAC;IAErE,IAAII,WAAW,CAAC,IAAI,CAAC,IAAIC,YAAY,CAAC,IAAI,CAAC,EAAE;IAE7C,IAAI,CAACC,QAAQ,GAAGL,OAAO;AACzB;AAAC,EAAA;IAAAM,CAAA,CAAA,IAAA,CAAAb,SAAA,EAAA,sBAAA,EAAA,CAPAc,MAAM,CAAA,CAAA;AAAA;EASP,IAAIP,OAAOA,GAAkC;IAC3C,OAAO,IAAI,CAACK,QAAQ;AACtB;AACF;;;;"}
@@ -1,16 +1,16 @@
1
- import { _ as _applyDecoratedDescriptor, R as Request, a as _initializerDefineProperty } from '../../request-D75_GC-a.js';
2
1
  import { tracked } from '@glimmer/tracking';
3
2
  import { isDestroyed, isDestroying } from '@ember/destroyable';
4
3
  import { action } from '@ember/object';
5
4
  import { waitFor } from '@ember/test-waiters';
6
5
  import { IdRequiredError, IdTypeError } from './errors.js';
6
+ import { Request } from './request.js';
7
+ import { g, i, n } from 'decorator-transforms/runtime-esm';
7
8
 
8
- var _class, _descriptor;
9
- let FindRecord = (_class = class FindRecord extends Request {
10
- constructor(...args) {
11
- super(...args);
12
- _initializerDefineProperty(this, "_record", _descriptor, this);
9
+ class FindRecord extends Request {
10
+ static {
11
+ g(this.prototype, "_record", [tracked]);
13
12
  }
13
+ #_record = (i(this, "_record"), void 0);
14
14
  async __WRAPPED_FUNCTION__([modelName, id], {
15
15
  options
16
16
  }) {
@@ -30,15 +30,13 @@ let FindRecord = (_class = class FindRecord extends Request {
30
30
  if (isDestroyed(this) || isDestroying(this)) return;
31
31
  this._record = record;
32
32
  }
33
+ static {
34
+ n(this.prototype, "__WRAPPED_FUNCTION__", [waitFor, action]);
35
+ }
33
36
  get record() {
34
37
  return this._record;
35
38
  }
36
- }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "_record", [tracked], {
37
- configurable: true,
38
- enumerable: true,
39
- writable: true,
40
- initializer: null
41
- }), _applyDecoratedDescriptor(_class.prototype, "__WRAPPED_FUNCTION__", [action, waitFor], Object.getOwnPropertyDescriptor(_class.prototype, "__WRAPPED_FUNCTION__"), _class.prototype)), _class);
39
+ }
42
40
 
43
41
  export { FindRecord };
44
42
  //# sourceMappingURL=find-record.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-record.js","sources":["../../../src/-private/resources/find-record.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\nimport { waitFor } from '@ember/test-waiters';\n\nimport { IdRequiredError, IdTypeError } from './errors';\nimport { Request } from './request';\n\nimport type { Id } from './types';\nimport type Store from '@ember-data/store';\n\nexport type FindRecordOptions = Parameters<Store['findRecord']>[2];\n\ntype PositionalArgs = [string, Id];\nexport interface NamedArgs {\n options: FindRecordOptions;\n}\n\nexport interface Args {\n named: NamedArgs;\n positional: PositionalArgs;\n}\n\nexport class FindRecord<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {\n @tracked private _record: Model | undefined;\n\n @action\n @waitFor\n async __WRAPPED_FUNCTION__([modelName, id]: PositionalArgs, { options }: NamedArgs) {\n /**\n * ember-data forbids usage of invalid arguments\n * in JS, this is typically fine as we can also try-catch, but\n * since this *might* be used in a template as well as JS, we need to instead\n * throw our own error that gives a bit more context to the user so\n * they can pass in the correct arguments\n */\n if (id === null || id === undefined) {\n throw new IdRequiredError(modelName);\n } else if (typeof id !== 'string' && typeof id !== 'number') {\n throw new IdTypeError(modelName, id);\n }\n\n const record = await this.store.findRecord(modelName as never, id, options);\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this._record = record;\n }\n\n get record(): Model | undefined {\n return this._record;\n }\n}\n"],"names":["FindRecord","_class","Request","constructor","args","_initializerDefineProperty","_descriptor","__WRAPPED_FUNCTION__","modelName","id","options","undefined","IdRequiredError","IdTypeError","record","store","findRecord","isDestroyed","isDestroying","_record","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","waitFor","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;AAuBaA,IAAAA,UAAU,IAAAC,MAAA,GAAhB,MAAMD,UAAU,SAA+CE,OAAO,CAAY;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,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AAA,CAAAoB,SAAA,2BAAApB,MAAA,CAAAoB,SAAA,CAAA,GAAApB,MAAA;;;;"}
1
+ {"version":3,"file":"find-record.js","sources":["../../../src/-private/resources/find-record.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\nimport { waitFor } from '@ember/test-waiters';\n\nimport { IdRequiredError, IdTypeError } from './errors.ts';\nimport { Request } from './request.ts';\n\nimport type { Id } from './types.ts';\nimport type Store from '@ember-data/store';\n\nexport type FindRecordOptions = Parameters<Store['findRecord']>[2];\n\ntype PositionalArgs = [string, Id];\nexport interface NamedArgs {\n options: FindRecordOptions;\n}\n\nexport interface Args {\n named: NamedArgs;\n positional: PositionalArgs;\n}\n\nexport class FindRecord<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {\n @tracked private _record: Model | undefined;\n\n @action\n @waitFor\n async __WRAPPED_FUNCTION__([modelName, id]: PositionalArgs, { options }: NamedArgs) {\n /**\n * ember-data forbids usage of invalid arguments\n * in JS, this is typically fine as we can also try-catch, but\n * since this *might* be used in a template as well as JS, we need to instead\n * throw our own error that gives a bit more context to the user so\n * they can pass in the correct arguments\n */\n if (id === null || id === undefined) {\n throw new IdRequiredError(modelName);\n } else if (typeof id !== 'string' && typeof id !== 'number') {\n throw new IdTypeError(modelName, id);\n }\n\n const record = await this.store.findRecord(modelName as never, id, options);\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this._record = record;\n }\n\n get record(): Model | undefined {\n return this._record;\n }\n}\n"],"names":["FindRecord","Request","g","prototype","tracked","i","void 0","__WRAPPED_FUNCTION__","modelName","id","options","undefined","IdRequiredError","IdTypeError","record","store","findRecord","isDestroyed","isDestroying","_record","n","waitFor","action"],"mappings":";;;;;;;;AAuBO,MAAMA,UAAU,SAA+CC,OAAO,CAAY;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CACtFC,OAAO,CAAA,CAAA;AAAA;AAAA,EAAA,QAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAAC,MAAA;AAER,EAAA,MAEMC,oBAAoBA,CAAC,CAACC,SAAS,EAAEC,EAAE,CAAiB,EAAE;AAAEC,IAAAA;AAAmB,GAAC,EAAE;AAClF;AACJ;AACA;AACA;AACA;AACA;AACA;AACI,IAAA,IAAID,EAAE,KAAK,IAAI,IAAIA,EAAE,KAAKE,SAAS,EAAE;AACnC,MAAA,MAAM,IAAIC,eAAe,CAACJ,SAAS,CAAC;KACrC,MAAM,IAAI,OAAOC,EAAE,KAAK,QAAQ,IAAI,OAAOA,EAAE,KAAK,QAAQ,EAAE;AAC3D,MAAA,MAAM,IAAII,WAAW,CAACL,SAAS,EAAEC,EAAE,CAAC;AACtC;AAEA,IAAA,MAAMK,MAAM,GAAG,MAAM,IAAI,CAACC,KAAK,CAACC,UAAU,CAACR,SAAS,EAAWC,EAAE,EAAEC,OAAO,CAAC;IAE3E,IAAIO,WAAW,CAAC,IAAI,CAAC,IAAIC,YAAY,CAAC,IAAI,CAAC,EAAE;IAE7C,IAAI,CAACC,OAAO,GAAGL,MAAM;AACvB;AAAC,EAAA;AAAAM,IAAAA,CAAA,CAAAjB,IAAAA,CAAAA,SAAA,EApBAkB,sBAAAA,EAAAA,CAAAA,OAAO,EADPC,MAAM,CAAA,CAAA;AAAA;EAuBP,IAAIR,MAAMA,GAAsB;IAC9B,OAAO,IAAI,CAACK,OAAO;AACrB;AACF;;;;"}
@@ -1,14 +1,14 @@
1
- import { _ as _applyDecoratedDescriptor, R as Request, a as _initializerDefineProperty } from '../../request-D75_GC-a.js';
2
1
  import { tracked } from '@glimmer/tracking';
3
2
  import { isDestroyed, isDestroying } from '@ember/destroyable';
4
3
  import { action } from '@ember/object';
4
+ import { Request } from './request.js';
5
+ import { g, i, n } from 'decorator-transforms/runtime-esm';
5
6
 
6
- var _class, _descriptor;
7
- let QueryRecord = (_class = class QueryRecord extends Request {
8
- constructor(...args) {
9
- super(...args);
10
- _initializerDefineProperty(this, "_record", _descriptor, this);
7
+ class QueryRecord extends Request {
8
+ static {
9
+ g(this.prototype, "_record", [tracked]);
11
10
  }
11
+ #_record = (i(this, "_record"), void 0);
12
12
  async __WRAPPED_FUNCTION__([modelName, query], {
13
13
  options
14
14
  }) {
@@ -16,15 +16,13 @@ let QueryRecord = (_class = class QueryRecord extends Request {
16
16
  if (isDestroyed(this) || isDestroying(this)) return;
17
17
  this._record = record;
18
18
  }
19
+ static {
20
+ n(this.prototype, "__WRAPPED_FUNCTION__", [action]);
21
+ }
19
22
  get record() {
20
23
  return this._record;
21
24
  }
22
- }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "_record", [tracked], {
23
- configurable: true,
24
- enumerable: true,
25
- writable: true,
26
- initializer: null
27
- }), _applyDecoratedDescriptor(_class.prototype, "__WRAPPED_FUNCTION__", [action], Object.getOwnPropertyDescriptor(_class.prototype, "__WRAPPED_FUNCTION__"), _class.prototype)), _class);
25
+ }
28
26
 
29
27
  export { QueryRecord };
30
28
  //# sourceMappingURL=query-record.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-record.js","sources":["../../../src/-private/resources/query-record.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\n\nimport { Request } from './request';\n\nimport type Store from '@ember-data/store';\n\ntype QueryParams = Parameters<Store['queryRecord']>;\nexport type QueryRecordQuery = QueryParams[1];\nexport type QueryRecordOptions = QueryParams[2];\n\ntype PositionalArgs = [string, QueryRecordQuery];\nexport interface NamedArgs {\n options: QueryRecordOptions;\n}\n\nexport interface Args {\n named: NamedArgs;\n positional: PositionalArgs;\n}\n\nexport class QueryRecord<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {\n @tracked private _record: Model | undefined;\n\n @action\n async __WRAPPED_FUNCTION__([modelName, query]: PositionalArgs, { options }: NamedArgs) {\n const record = await this.store.queryRecord(modelName as never, query, options);\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this._record = record;\n }\n\n get record(): Model | undefined {\n return this._record;\n }\n}\n"],"names":["QueryRecord","_class","Request","constructor","args","_initializerDefineProperty","_descriptor","__WRAPPED_FUNCTION__","modelName","query","options","record","store","queryRecord","isDestroyed","isDestroying","_record","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;AAsBaA,IAAAA,WAAW,IAAAC,MAAA,GAAjB,MAAMD,WAAW,SAA+CE,OAAO,CAAY;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,kBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAGxF,EAAA,MACMC,oBAAoBA,CAAC,CAACC,SAAS,EAAEC,KAAK,CAAiB,EAAE;AAAEC,IAAAA,OAAAA;AAAmB,GAAC,EAAE;AACrF,IAAA,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACC,KAAK,CAACC,WAAW,CAACL,SAAS,EAAWC,KAAK,EAAEC,OAAO,CAAC,CAAA;IAE/E,IAAII,WAAW,CAAC,IAAI,CAAC,IAAIC,YAAY,CAAC,IAAI,CAAC,EAAE,OAAA;IAE7C,IAAI,CAACC,OAAO,GAAGL,MAAM,CAAA;AACvB,GAAA;EAEA,IAAIA,MAAMA,GAAsB;IAC9B,OAAO,IAAI,CAACK,OAAO,CAAA;AACrB,GAAA;AACF,CAAC,GAAAV,WAAA,GAAAW,yBAAA,CAAAhB,MAAA,CAAAiB,SAAA,EAAA,SAAA,EAAA,CAdEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA,IAAA;AAAA,CAAAN,CAAAA,EAAAA,yBAAA,CAAAhB,MAAA,CAAAiB,SAAA,EAEPM,sBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAzB,MAAA,CAAAiB,SAAA,EAAA,sBAAA,CAAA,EAAAjB,MAAA,CAAAiB,SAAA,IAAAjB,MAAA;;;;"}
1
+ {"version":3,"file":"query-record.js","sources":["../../../src/-private/resources/query-record.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\n\nimport { Request } from './request.ts';\n\nimport type Store from '@ember-data/store';\n\ntype QueryParams = Parameters<Store['queryRecord']>;\nexport type QueryRecordQuery = QueryParams[1];\nexport type QueryRecordOptions = QueryParams[2];\n\ntype PositionalArgs = [string, QueryRecordQuery];\nexport interface NamedArgs {\n options: QueryRecordOptions;\n}\n\nexport interface Args {\n named: NamedArgs;\n positional: PositionalArgs;\n}\n\nexport class QueryRecord<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {\n @tracked private _record: Model | undefined;\n\n @action\n async __WRAPPED_FUNCTION__([modelName, query]: PositionalArgs, { options }: NamedArgs) {\n const record = await this.store.queryRecord(modelName as never, query, options);\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this._record = record;\n }\n\n get record(): Model | undefined {\n return this._record;\n }\n}\n"],"names":["QueryRecord","Request","g","prototype","tracked","i","void 0","__WRAPPED_FUNCTION__","modelName","query","options","record","store","queryRecord","isDestroyed","isDestroying","_record","n","action"],"mappings":";;;;;;AAsBO,MAAMA,WAAW,SAA+CC,OAAO,CAAY;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CACvFC,OAAO,CAAA,CAAA;AAAA;AAAA,EAAA,QAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAAC,MAAA;AAER,EAAA,MACMC,oBAAoBA,CAAC,CAACC,SAAS,EAAEC,KAAK,CAAiB,EAAE;AAAEC,IAAAA;AAAmB,GAAC,EAAE;AACrF,IAAA,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACC,KAAK,CAACC,WAAW,CAACL,SAAS,EAAWC,KAAK,EAAEC,OAAO,CAAC;IAE/E,IAAII,WAAW,CAAC,IAAI,CAAC,IAAIC,YAAY,CAAC,IAAI,CAAC,EAAE;IAE7C,IAAI,CAACC,OAAO,GAAGL,MAAM;AACvB;AAAC,EAAA;IAAAM,CAAA,CAAA,IAAA,CAAAd,SAAA,EAAA,sBAAA,EAAA,CAPAe,MAAM,CAAA,CAAA;AAAA;EASP,IAAIP,MAAMA,GAAsB;IAC9B,OAAO,IAAI,CAACK,OAAO;AACrB;AACF;;;;"}
@@ -1,14 +1,14 @@
1
- import { _ as _applyDecoratedDescriptor, R as Request, a as _initializerDefineProperty } from '../../request-D75_GC-a.js';
2
1
  import { tracked } from '@glimmer/tracking';
3
2
  import { isDestroyed, isDestroying } from '@ember/destroyable';
4
3
  import { action } from '@ember/object';
4
+ import { Request } from './request.js';
5
+ import { g, i, n } from 'decorator-transforms/runtime-esm';
5
6
 
6
- var _class, _descriptor;
7
- let Query = (_class = class Query extends Request {
8
- constructor(...args) {
9
- super(...args);
10
- _initializerDefineProperty(this, "_records", _descriptor, this);
7
+ class Query extends Request {
8
+ static {
9
+ g(this.prototype, "_records", [tracked]);
11
10
  }
11
+ #_records = (i(this, "_records"), void 0);
12
12
  async __WRAPPED_FUNCTION__([modelName, query], {
13
13
  options
14
14
  }) {
@@ -16,15 +16,13 @@ let Query = (_class = class Query extends Request {
16
16
  if (isDestroyed(this) || isDestroying(this)) return;
17
17
  this._records = records;
18
18
  }
19
+ static {
20
+ n(this.prototype, "__WRAPPED_FUNCTION__", [action]);
21
+ }
19
22
  get records() {
20
23
  return this._records;
21
24
  }
22
- }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "_records", [tracked], {
23
- configurable: true,
24
- enumerable: true,
25
- writable: true,
26
- initializer: null
27
- }), _applyDecoratedDescriptor(_class.prototype, "__WRAPPED_FUNCTION__", [action], Object.getOwnPropertyDescriptor(_class.prototype, "__WRAPPED_FUNCTION__"), _class.prototype)), _class);
25
+ }
28
26
 
29
27
  export { Query };
30
28
  //# sourceMappingURL=query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sources":["../../../src/-private/resources/query.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\n\nimport { Request } from './request';\n\nimport type ArrayProxy from '@ember/array/proxy';\nimport type Store from '@ember-data/store';\n\ntype QueryParams = Parameters<Store['query']>;\nexport type QueryQuery = QueryParams[1];\nexport type QueryOptions = QueryParams[2];\n\ntype PositionalArgs = [string, QueryQuery];\nexport interface NamedArgs {\n options: QueryOptions;\n}\n\nexport interface Args {\n named: NamedArgs;\n positional: PositionalArgs;\n}\n\nexport class Query<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {\n @tracked private _records: ArrayProxy<Model> | undefined;\n\n @action\n async __WRAPPED_FUNCTION__([modelName, query]: PositionalArgs, { options }: NamedArgs) {\n const records = await this.store.query(modelName as never, query, options);\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this._records = records;\n }\n\n get records(): ArrayProxy<Model> | undefined {\n return this._records;\n }\n}\n"],"names":["Query","_class","Request","constructor","args","_initializerDefineProperty","_descriptor","__WRAPPED_FUNCTION__","modelName","query","options","records","store","isDestroyed","isDestroying","_records","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;AAuBaA,IAAAA,KAAK,IAAAC,MAAA,GAAX,MAAMD,KAAK,SAA+CE,OAAO,CAAY;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,mBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAGlF,EAAA,MACMC,oBAAoBA,CAAC,CAACC,SAAS,EAAEC,KAAK,CAAiB,EAAE;AAAEC,IAAAA,OAAAA;AAAmB,GAAC,EAAE;AACrF,IAAA,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACC,KAAK,CAACH,KAAK,CAACD,SAAS,EAAWC,KAAK,EAAEC,OAAO,CAAC,CAAA;IAE1E,IAAIG,WAAW,CAAC,IAAI,CAAC,IAAIC,YAAY,CAAC,IAAI,CAAC,EAAE,OAAA;IAE7C,IAAI,CAACC,QAAQ,GAAGJ,OAAO,CAAA;AACzB,GAAA;EAEA,IAAIA,OAAOA,GAAkC;IAC3C,OAAO,IAAI,CAACI,QAAQ,CAAA;AACtB,GAAA;AACF,CAAC,GAAAT,WAAA,GAAAU,yBAAA,CAAAf,MAAA,CAAAgB,SAAA,EAAA,UAAA,EAAA,CAdEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA,IAAA;AAAA,CAAAN,CAAAA,EAAAA,yBAAA,CAAAf,MAAA,CAAAgB,SAAA,EAEPM,sBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAxB,MAAA,CAAAgB,SAAA,EAAA,sBAAA,CAAA,EAAAhB,MAAA,CAAAgB,SAAA,IAAAhB,MAAA;;;;"}
1
+ {"version":3,"file":"query.js","sources":["../../../src/-private/resources/query.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\n\nimport { Request } from './request.ts';\n\nimport type ArrayProxy from '@ember/array/proxy';\nimport type Store from '@ember-data/store';\n\ntype QueryParams = Parameters<Store['query']>;\nexport type QueryQuery = QueryParams[1];\nexport type QueryOptions = QueryParams[2];\n\ntype PositionalArgs = [string, QueryQuery];\nexport interface NamedArgs {\n options: QueryOptions;\n}\n\nexport interface Args {\n named: NamedArgs;\n positional: PositionalArgs;\n}\n\nexport class Query<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {\n @tracked private _records: ArrayProxy<Model> | undefined;\n\n @action\n async __WRAPPED_FUNCTION__([modelName, query]: PositionalArgs, { options }: NamedArgs) {\n const records = await this.store.query(modelName as never, query, options);\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this._records = records;\n }\n\n get records(): ArrayProxy<Model> | undefined {\n return this._records;\n }\n}\n"],"names":["Query","Request","g","prototype","tracked","i","void 0","__WRAPPED_FUNCTION__","modelName","query","options","records","store","isDestroyed","isDestroying","_records","n","action"],"mappings":";;;;;;AAuBO,MAAMA,KAAK,SAA+CC,OAAO,CAAY;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,UAAA,EAAA,CACjFC,OAAO,CAAA,CAAA;AAAA;AAAA,EAAA,SAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,UAAA,CAAA,EAAAC,MAAA;AAER,EAAA,MACMC,oBAAoBA,CAAC,CAACC,SAAS,EAAEC,KAAK,CAAiB,EAAE;AAAEC,IAAAA;AAAmB,GAAC,EAAE;AACrF,IAAA,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACC,KAAK,CAACH,KAAK,CAACD,SAAS,EAAWC,KAAK,EAAEC,OAAO,CAAC;IAE1E,IAAIG,WAAW,CAAC,IAAI,CAAC,IAAIC,YAAY,CAAC,IAAI,CAAC,EAAE;IAE7C,IAAI,CAACC,QAAQ,GAAGJ,OAAO;AACzB;AAAC,EAAA;IAAAK,CAAA,CAAA,IAAA,CAAAb,SAAA,EAAA,sBAAA,EAAA,CAPAc,MAAM,CAAA,CAAA;AAAA;EASP,IAAIN,OAAOA,GAAkC;IAC3C,OAAO,IAAI,CAACI,QAAQ;AACtB;AACF;;;;"}
@@ -1,9 +1,103 @@
1
- export { R as Request } from '../../request-D75_GC-a.js';
2
- import '@glimmer/tracking';
3
- import '@ember/debug';
4
- import '@ember/destroyable';
5
- import '@ember/object';
6
- import '@ember/service';
7
- import '@ember/test-waiters';
8
- import 'ember-modify-based-class-resource';
1
+ import { tracked } from '@glimmer/tracking';
2
+ import { assert } from '@ember/debug';
3
+ import { isDestroyed, isDestroying } from '@ember/destroyable';
4
+ import { action } from '@ember/object';
5
+ import * as emberService from '@ember/service';
6
+ import { waitForPromise, waitFor } from '@ember/test-waiters';
7
+ import { Resource } from 'ember-modify-based-class-resource';
8
+ import { g, i, n } from 'decorator-transforms/runtime-esm';
9
+
10
+ const service = emberService.service ?? emberService.inject;
11
+ class Request extends Resource {
12
+ static {
13
+ g(this.prototype, "store", [service]);
14
+ }
15
+ #store = (i(this, "store"), void 0);
16
+ static {
17
+ g(this.prototype, "error", [tracked]);
18
+ }
19
+ #error = (i(this, "error"), void 0);
20
+ static {
21
+ g(this.prototype, "isLoading", [tracked], function () {
22
+ return false;
23
+ });
24
+ }
25
+ #isLoading = (i(this, "isLoading"), void 0);
26
+ static {
27
+ g(this.prototype, "hasRan", [tracked], function () {
28
+ return false;
29
+ });
30
+ }
31
+ #hasRan = (i(this, "hasRan"), void 0);
32
+ /**
33
+ * Args saved, untracked, for retrying
34
+ */
35
+
36
+ modify(positional, named) {
37
+ this.positional = positional || [];
38
+ this.named = named || {};
39
+
40
+ /**
41
+ * We need to consume all arguments here so that we correctly respond to updates to
42
+ * dirtied source data.
43
+ *
44
+ * e.g.: when an id changes that is passed to findRecord, we re-fetch.
45
+ */
46
+ this.__REQUEST_FUNCTION__([...positional], {
47
+ ...named
48
+ });
49
+ }
50
+ async __WRAPPED_FUNCTION__(_positional, _named) {
51
+ throw new Error('Not Implemented');
52
+ }
53
+ get isSuccess() {
54
+ return !this.error;
55
+ }
56
+ get isError() {
57
+ return Boolean(this.error);
58
+ }
59
+ get records() {
60
+ return assert(`The resource for ${this.constructor.name} does not have a records property. ` + `You might be looking for .record instead.`);
61
+ }
62
+ get record() {
63
+ return assert(`The resource for ${this.constructor.name} does not have a record property. ` + `You might be looking for .records instead.`);
64
+ }
65
+ async retry() {
66
+ return waitForPromise(this.__WRAPPED_FUNCTION__(this.positional, this.named));
67
+ }
68
+ static {
69
+ n(this.prototype, "retry", [action]);
70
+ }
71
+ async __REQUEST_FUNCTION__(_positional, _named) {
72
+ /**
73
+ * Args are already consumed, but let's delay doing anything
74
+ * until we can get out of a tracking frame.
75
+ */
76
+ await Promise.resolve();
77
+ if (isDestroyed(this) || isDestroying(this)) return;
78
+ this.error = undefined;
79
+ this.isLoading = true;
80
+ try {
81
+ await this.retry();
82
+ } catch (e) {
83
+ if (isDestroyed(this) || isDestroying(this)) return;
84
+ if (e instanceof Error) {
85
+ this.error = e;
86
+ } else {
87
+ // How likely is this to happen?
88
+ throw e;
89
+ }
90
+ }
91
+ if (isDestroyed(this) || isDestroying(this)) {
92
+ return;
93
+ }
94
+ this.isLoading = false;
95
+ this.hasRan = true;
96
+ }
97
+ static {
98
+ n(this.prototype, "__REQUEST_FUNCTION__", [waitFor, action]);
99
+ }
100
+ }
101
+
102
+ export { Request };
9
103
  //# sourceMappingURL=request.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"request.js","sources":["../../../src/-private/resources/request.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\nimport * as emberService from '@ember/service';\n\nconst service = emberService.service ?? emberService.inject;\n\nimport { waitFor, waitForPromise } from '@ember/test-waiters';\n\nimport { Resource } from 'ember-modify-based-class-resource';\n\nimport type Store from '@ember-data/store';\n\nexport type FindRecordOptions = Parameters<Store['findRecord']>[2];\n\nexport class Request<Args> extends Resource<Args> {\n @service declare store: Store;\n\n @tracked error: Error | undefined;\n @tracked isLoading = false;\n @tracked hasRan = false;\n\n /**\n * Args saved, untracked, for retrying\n */\n declare positional: unknown[];\n declare named: object;\n\n modify(positional?: unknown[], named?: object) {\n this.positional = positional || [];\n this.named = named || {};\n\n /**\n * We need to consume all arguments here so that we correctly respond to updates to\n * dirtied source data.\n *\n * e.g.: when an id changes that is passed to findRecord, we re-fetch.\n */\n this.__REQUEST_FUNCTION__([...(positional as unknown[])], {\n ...named,\n });\n }\n\n async __WRAPPED_FUNCTION__(_positional: unknown[], _named: object) {\n throw new Error('Not Implemented');\n }\n\n get isSuccess() {\n return !this.error;\n }\n\n get isError() {\n return Boolean(this.error);\n }\n\n get records(): unknown | undefined {\n return assert(\n `The resource for ${this.constructor.name} does not have a records property. ` +\n `You might be looking for .record instead.`,\n );\n }\n\n get record(): unknown | undefined {\n return assert(\n `The resource for ${this.constructor.name} does not have a record property. ` +\n `You might be looking for .records instead.`,\n );\n }\n\n @action\n async retry() {\n return waitForPromise(this.__WRAPPED_FUNCTION__(this.positional, this.named));\n }\n\n @action\n @waitFor\n async __REQUEST_FUNCTION__(_positional: unknown[], _named: object) {\n /**\n * Args are already consumed, but let's delay doing anything\n * until we can get out of a tracking frame.\n */\n await Promise.resolve();\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this.error = undefined;\n this.isLoading = true;\n\n try {\n await this.retry();\n } catch (e) {\n if (isDestroyed(this) || isDestroying(this)) return;\n\n if (e instanceof Error) {\n this.error = e;\n } else {\n // How likely is this to happen?\n throw e;\n }\n }\n\n if (isDestroyed(this) || isDestroying(this)) {\n return;\n }\n\n this.isLoading = false;\n this.hasRan = true;\n }\n}\n"],"names":["service","emberService","inject","Request","Resource","g","prototype","i","void 0","tracked","modify","positional","named","__REQUEST_FUNCTION__","__WRAPPED_FUNCTION__","_positional","_named","Error","isSuccess","error","isError","Boolean","records","assert","constructor","name","record","retry","waitForPromise","n","action","Promise","resolve","isDestroyed","isDestroying","undefined","isLoading","e","hasRan","waitFor"],"mappings":";;;;;;;;;AAMA,MAAMA,OAAO,GAAGC,YAAY,CAACD,OAAO,IAAIC,YAAY,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YAAYpB,KAAK,EAAE;QACtB,IAAI,CAACE,KAAK,GAAGkB,CAAC;AAChB,OAAC,MAAM;AACL;AACA,QAAA,MAAMA,CAAC;AACT;AACF;IAEA,IAAIJ,WAAW,CAAC,IAAI,CAAC,IAAIC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC3C,MAAA;AACF;IAEA,IAAI,CAACE,SAAS,GAAG,KAAK;IACtB,IAAI,CAACE,MAAM,GAAG,IAAI;AACpB;AAAC,EAAA;AAAAT,IAAAA,CAAA,CAAAvB,IAAAA,CAAAA,SAAA,EAhCAiC,sBAAAA,EAAAA,CAAAA,OAAO,EADPT,MAAM,CAAA,CAAA;AAAA;AAkCT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"js-helpers.js","sources":["../src/js-helpers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport { FindAll } from './-private/resources/find-all';\nimport { FindRecord } from './-private/resources/find-record';\nimport { Query } from './-private/resources/query';\nimport { QueryRecord } from './-private/resources/query-record';\n\nimport type { FindAllOptions } from './-private/resources/find-all';\nimport type { FindRecordOptions } from './-private/resources/find-record';\nimport type { QueryOptions, QueryQuery } from './-private/resources/query';\nimport type { QueryRecordOptions, QueryRecordQuery } from './-private/resources/query-record';\nimport type { Id } from './-private/resources/types';\n\ntype FindRecordThunkResult = Id | [Id] | [Id, FindRecordOptions];\n\n/**\n * Wrapper around store.findRecord\n */\nexport function findRecord<Model = unknown>(\n destroyable: object,\n modelName: string,\n thunk: () => FindRecordThunkResult,\n) {\n return FindRecord.from(destroyable, () => {\n const reified = thunk();\n let id: Id;\n let options: FindRecordOptions;\n\n if (Array.isArray(reified)) {\n id = reified[0];\n options = reified[1] ?? {};\n } else {\n id = reified as Id;\n options = {};\n }\n\n return {\n positional: [modelName, id],\n named: {\n options,\n },\n };\n // Cast needed Until min-supported TS is 4.7\n }) as FindRecord<Model>;\n}\n\ntype FindAllThunkResult = { options: FindAllOptions } | FindAllOptions | void;\n\n/**\n * Wrapper around store.findAll\n */\nexport function findAll<Model = unknown>(\n destroyable: object,\n modelName: string,\n thunk?: () => FindAllThunkResult,\n) {\n return FindAll.from(destroyable, () => {\n const reified = thunk?.() || {};\n const options = 'options' in reified ? reified.options : reified;\n\n return {\n positional: [modelName],\n named: {\n options,\n },\n };\n // Cast needed Until min-supported TS is 4.7\n }) as FindAll<Model>;\n}\n\ntype QueryThunkResult = QueryQuery | [QueryQuery] | [QueryQuery, QueryOptions];\n\n/**\n * Wrapper around store.query\n */\nexport function query<Model = unknown>(\n destroyable: object,\n modelName: string,\n thunk: () => QueryThunkResult,\n) {\n return Query.from(destroyable, () => {\n const reified = thunk();\n\n if (Array.isArray(reified)) {\n const [query, options] = reified;\n\n return {\n positional: [modelName, query],\n named: {\n options: options || {},\n },\n };\n }\n\n return {\n positional: [modelName, reified],\n named: {\n options: {},\n },\n };\n // Cast needed Until min-supported TS is 4.7\n }) as Query<Model>;\n}\n\ntype QueryRecordThunkResult =\n | QueryRecordQuery\n | [QueryRecordQuery]\n | [QueryRecordQuery, QueryRecordOptions];\n\n/**\n * Wrapper around store.queryRecord\n */\nexport function queryRecord<Model = unknown>(\n destroyable: object,\n modelName: string,\n thunk: () => QueryRecordThunkResult,\n) {\n return QueryRecord.from(destroyable, () => {\n const reified = thunk();\n\n if (Array.isArray(reified)) {\n const [query, options] = reified;\n\n return {\n positional: [modelName, query],\n named: {\n options: options || {},\n },\n };\n }\n\n return {\n positional: [modelName, reified],\n named: {\n options: {},\n },\n };\n // Cast needed Until min-supported TS is 4.7\n }) as QueryRecord<Model>;\n}\n"],"names":["findRecord","destroyable","modelName","thunk","FindRecord","from","reified","id","options","Array","isArray","positional","named","findAll","FindAll","query","Query","queryRecord","QueryRecord"],"mappings":";;;;;AAAA;AAcA;AACA;AACA;AACO,SAASA,UAAUA,CACxBC,WAAmB,EACnBC,SAAiB,EACjBC,KAAkC,EAClC;AACA,EAAA,OAAOC,UAAU,CAACC,IAAI,CAACJ,WAAW,EAAE,M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ers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport { FindAll } from './-private/resources/find-all.ts';\nimport { FindRecord } from './-private/resources/find-record.ts';\nimport { Query } from './-private/resources/query.ts';\nimport { QueryRecord } from './-private/resources/query-record.ts';\n\nimport type { FindAllOptions } from './-private/resources/find-all';\nimport type { FindRecordOptions } from './-private/resources/find-record';\nimport type { QueryOptions, QueryQuery } from './-private/resources/query';\nimport type { QueryRecordOptions, QueryRecordQuery } from './-private/resources/query-record';\nimport type { Id } from './-private/resources/types';\n\ntype FindRecordThunkResult = Id | [Id] | [Id, FindRecordOptions];\n\n/**\n * Wrapper around store.findRecord\n */\nexport function findRecord<Model = unknown>(\n destroyable: object,\n modelName: string,\n thunk: () => FindRecordThunkResult,\n) {\n return FindRecord.from(destroyable, () => {\n const reified = thunk();\n let id: Id;\n let options: FindRecordOptions;\n\n if (Array.isArray(reified)) {\n id = reified[0];\n options = reified[1] ?? {};\n } else {\n id = reified as Id;\n options = {};\n }\n\n return {\n positional: [modelName, id],\n named: {\n options,\n },\n };\n // Cast needed Until min-supported TS is 4.7\n }) as FindRecord<Model>;\n}\n\ntype FindAllThunkResult = { options: FindAllOptions } | FindAllOptions | void;\n\n/**\n * Wrapper around store.findAll\n */\nexport function findAll<Model = unknown>(\n destroyable: object,\n modelName: string,\n thunk?: () => FindAllThunkResult,\n) {\n return FindAll.from(destroyable, () => {\n const reified = thunk?.() || {};\n const options = 'options' in reified ? reified.options : reified;\n\n return {\n positional: [modelName],\n named: {\n options,\n },\n };\n // Cast needed Until min-supported TS is 4.7\n }) as FindAll<Model>;\n}\n\ntype QueryThunkResult = QueryQuery | [QueryQuery] | [QueryQuery, QueryOptions];\n\n/**\n * Wrapper around store.query\n */\nexport function query<Model = unknown>(\n destroyable: object,\n modelName: string,\n thunk: () => QueryThunkResult,\n) {\n return Query.from(destroyable, () => {\n const reified = thunk();\n\n if (Array.isArray(reified)) {\n const [query, options] = reified;\n\n return {\n positional: [modelName, query],\n named: {\n options: options || {},\n },\n };\n }\n\n return {\n positional: [modelName, reified],\n named: {\n options: {},\n },\n };\n // Cast needed Until min-supported TS is 4.7\n }) as Query<Model>;\n}\n\ntype QueryRecordThunkResult =\n | QueryRecordQuery\n | [QueryRecordQuery]\n | [QueryRecordQuery, QueryRecordOptions];\n\n/**\n * Wrapper around store.queryRecord\n */\nexport function queryRecord<Model = unknown>(\n destroyable: object,\n modelName: string,\n thunk: () => QueryRecordThunkResult,\n) {\n return QueryRecord.from(destroyable, () => {\n const reified = thunk();\n\n if (Array.isArray(reified)) {\n const [query, options] = reified;\n\n return {\n positional: [modelName, query],\n named: {\n options: options || {},\n },\n };\n }\n\n return {\n positional: [modelName, reified],\n named: {\n options: {},\n },\n };\n // Cast needed Until min-supported TS is 4.7\n }) as QueryRecord<Model>;\n}\n"],"names":["findRecord","destroyable","modelName","thunk","FindRecord","from","reified","id","options","Array","isArray","positional","named","findAll","FindAll","query","Query","queryRecord","QueryRecord"],"mappings":";;;;;AAAA;AAcA;AACA;AACA;AACO,SAASA,UAAUA,CACxBC,WAAmB,EACnBC,SAAiB,EACjBC,KAAkC,EAClC;AACA,EAAA,OAAOC,UAAU,CAACC,IAAI,CAACJ,WAAW,EAAE,MAAM;AACxC,IAAA,MAAMK,OAAO,GAAGH,KAAK,EAAE;AACvB,IAAA,IAAII,EAAM;AACV,IAAA,IAAIC,OAA0B;AAE9B,IAAA,IAAIC,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,EAAE;AAC1BC,MAAAA,EAAE,GAAGD,OAAO,CAAC,CAAC,CAAC;AACfE,MAAAA,OAAO,GAAGF,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE;AAC5B,KAAC,MAAM;AACLC,MAAAA,EAAE,GAAGD,OAAa;MAClBE,OAAO,GAAG,EAAE;AACd;IAEA,OAAO;AACLG,MAAAA,UAAU,EAAE,CAACT,SAAS,EAAEK,EAAE,CAAC;AAC3BK,MAAAA,KAAK,EAAE;AACLJ,QAAAA;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AAMK,OAAO,GAAGH,KAAK,EAAE;AAEvB,IAAA,IAAIM,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,EAAE;AAC1B,MAAA,MAAM,CAACS,KAAK,EAAEP,OAAO,CAAC,GAAGF,OAAO;MAEhC,OAAO;AACLK,QAAAA,UAAU,EAAE,CAACT,SAAS,EAAEa,KAAK,CAAC;AAC9BH,QAAAA,KAAK,EAAE;UACLJ,OAAO,EAAEA,OAAO,IAAI;AACtB;OACD;AACH;IAEA,OAAO;AACLG,MAAAA,UAAU,EAAE,CAACT,SAAS,EAAEI,OAAO,CAAC;AAChCM,MAAAA,KAAK,EAAE;AACLJ,QAAAA,OAAO,EAAE;AACX;KACD;AACD;AACF,GAAC,CAAC;AACJ;;;;"}
@@ -1,8 +1,7 @@
1
- declare class IdRequiredError extends TypeError {
1
+ export declare class IdRequiredError extends TypeError {
2
2
  constructor(modelName: string);
3
3
  }
4
- declare class IdTypeError extends TypeError {
4
+ export declare class IdTypeError extends TypeError {
5
5
  constructor(modelName: string, id: unknown);
6
6
  }
7
- export { IdRequiredError, IdTypeError };
8
- //# sourceMappingURL=-private/resources/errors.d.ts.map
7
+ //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"-private/resources/errors.d.ts","sourceRoot":"","sources":["../src/-private/resources/errors.ts"],"names":[],"mappings":"AAAA,cAAa,eAAgB,SAAQ,SAAS;gBAC9B,SAAS,EAAE,MAAM;CAGhC;AACD,cAAa,WAAY,SAAQ,SAAS;gBAC1B,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO;CAG7C"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/-private/resources/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,SAAS,EAAE,MAAM;CAK9B;AAED,qBAAa,WAAY,SAAQ,SAAS;gBAC5B,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO;CAK3C"}
@@ -1,20 +1,19 @@
1
- /// <reference types="ember-data" />
2
- /// <reference types="ember__array" />
3
- import { Request } from "./request.js";
4
- import ArrayProxy from '@ember/array/proxy';
5
- import Store from '@ember-data/store';
6
- type FindAllOptions = Parameters<Store['findAll']>[1];
1
+ import { Request } from './request.ts';
2
+ import type ArrayProxy from '@ember/array/proxy';
3
+ import type Store from '@ember-data/store';
4
+ export type FindAllOptions = Parameters<Store['findAll']>[1];
7
5
  type PositionalArgs = [string];
8
- interface NamedArgs {
6
+ export interface NamedArgs {
9
7
  options: FindAllOptions;
10
8
  }
11
- interface Args {
9
+ export interface Args {
12
10
  named: NamedArgs;
13
11
  positional: PositionalArgs;
14
12
  }
15
- declare class FindAll<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {
13
+ export declare class FindAll<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {
16
14
  private _records;
17
15
  __WRAPPED_FUNCTION__([modelName]: PositionalArgs, { options }: NamedArgs): Promise<void>;
18
16
  get records(): ArrayProxy<Model> | undefined;
19
17
  }
20
- export { FindAllOptions, NamedArgs, Args, FindAll };
18
+ export {};
19
+ //# sourceMappingURL=find-all.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-all.d.ts","sourceRoot":"","sources":["../../../src/-private/resources/find-all.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7D,KAAK,cAAc,GAAG,CAAC,MAAM,CAAC,CAAC;AAC/B,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EA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types="ember-data" />
2
- import { Request } from "./request.js";
3
- import { Id } from "./types.js";
4
- import Store from '@ember-data/store';
5
- type FindRecordOptions = Parameters<Store['findRecord']>[2];
1
+ import { Request } from './request.ts';
2
+ import type { Id } from './types.ts';
3
+ import type Store from '@ember-data/store';
4
+ export type FindRecordOptions = Parameters<Store['findRecord']>[2];
6
5
  type PositionalArgs = [string, Id];
7
- interface NamedArgs {
6
+ export interface NamedArgs {
8
7
  options: FindRecordOptions;
9
8
  }
10
- interface Args {
9
+ export interface Args {
11
10
  named: NamedArgs;
12
11
  positional: PositionalArgs;
13
12
  }
14
- declare class FindRecord<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {
13
+ export declare class FindRecord<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {
15
14
  private _record;
16
15
  __WRAPPED_FUNCTION__([modelName, id]: PositionalArgs, { options }: NamedArgs): Promise<void>;
17
16
  get record(): Model | undefined;
18
17
  }
19
- export { FindRecordOptions, NamedArgs, Args, FindRecord };
18
+ export {};
19
+ //# sourceMappingURL=find-record.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-record.d.ts","sourceRoot":"","sources":["../../../src/-private/resources/find-record.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,KAAK,cAAc,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnC,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED,qBAAa,UAAU,CAAC,KAAK,EAAE,SAAS,SAAS,IAAI,GAAG,IAAI,CAAE,SAAQ,OAAO,CAAC,SAAS,CAAC;IAC7E,OAAO,CAAC,OAAO,CAAoB;IAItC,oBAAoB,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS;IAqBlF,IAAI,MAAM,IAAI,KAAK,GAAG,SAAS,CAE9B;CACF"}
1
+ {"version":3,"file":"find-record.d.ts","sourceRoot":"","sources":["../../../src/-private/resources/find-record.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,KAAK,cAAc,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnC,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED,qBAAa,UAAU,CAAC,KAAK,EAAE,SAAS,SAAS,IAAI,GAAG,IAAI,CAAE,SAAQ,OAAO,CAAC,SAAS,CAAC;IAC7E,OAAO,CAAC,OAAO,CAAoB;IAItC,oBAAoB,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS;IAqBlF,IAAI,MAAM,IAAI,KAAK,GAAG,SAAS,CAE9B;CACF"}
@@ -1,20 +1,20 @@
1
- /// <reference types="ember-data" />
2
- import { Request } from "./request.js";
3
- import Store from '@ember-data/store';
1
+ import { Request } from './request.ts';
2
+ import type Store from '@ember-data/store';
4
3
  type QueryParams = Parameters<Store['queryRecord']>;
5
- type QueryRecordQuery = QueryParams[1];
6
- type QueryRecordOptions = QueryParams[2];
4
+ export type QueryRecordQuery = QueryParams[1];
5
+ export type QueryRecordOptions = QueryParams[2];
7
6
  type PositionalArgs = [string, QueryRecordQuery];
8
- interface NamedArgs {
7
+ export interface NamedArgs {
9
8
  options: QueryRecordOptions;
10
9
  }
11
- interface Args {
10
+ export interface Args {
12
11
  named: NamedArgs;
13
12
  positional: PositionalArgs;
14
13
  }
15
- declare class QueryRecord<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {
14
+ export declare class QueryRecord<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {
16
15
  private _record;
17
16
  __WRAPPED_FUNCTION__([modelName, query]: PositionalArgs, { options }: NamedArgs): Promise<void>;
18
17
  get record(): Model | undefined;
19
18
  }
20
- export { QueryRecordQuery, QueryRecordOptions, NamedArgs, Args, QueryRecord };
19
+ export {};
20
+ //# sourceMappingURL=query-record.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-record.d.ts","sourceRoot":"","sources":["../../../src/-private/resources/query-record.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,KAAK,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AACpD,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAC9C,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAEhD,KAAK,cAAc,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACjD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED,qBAAa,WAAW,CAAC,KAAK,EAAE,SAAS,SAAS,IAAI,GAAG,IAAI,CAAE,SAAQ,OAAO,CAAC,SAAS,CAAC;IAC9E,OAAO,CAAC,OAAO,CAAoB;IAGtC,oBAAoB,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS;IAQrF,IAAI,MAAM,IAAI,KAAK,GAAG,SAAS,CAE9B;CACF"}
1
+ {"version":3,"file":"query-record.d.ts","sourceRoot":"","sources":["../../../src/-private/resources/query-record.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,KAAK,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AACpD,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAC9C,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAEhD,KAAK,cAAc,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACjD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED,qBAAa,WAAW,CAAC,KAAK,EAAE,SAAS,SAAS,IAAI,GAAG,IAAI,CAAE,SAAQ,OAAO,CAAC,SAAS,CAAC;IAC9E,OAAO,CAAC,OAAO,CAAoB;IAGtC,oBAAoB,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS;IAQrF,IAAI,MAAM,IAAI,KAAK,GAAG,SAAS,CAE9B;CACF"}
@@ -1,22 +1,21 @@
1
- /// <reference types="ember-data" />
2
- /// <reference types="ember__array" />
3
- import { Request } from "./request.js";
4
- import ArrayProxy from '@ember/array/proxy';
5
- import Store from '@ember-data/store';
1
+ import { Request } from './request.ts';
2
+ import type ArrayProxy from '@ember/array/proxy';
3
+ import type Store from '@ember-data/store';
6
4
  type QueryParams = Parameters<Store['query']>;
7
- type QueryQuery = QueryParams[1];
8
- type QueryOptions = QueryParams[2];
5
+ export type QueryQuery = QueryParams[1];
6
+ export type QueryOptions = QueryParams[2];
9
7
  type PositionalArgs = [string, QueryQuery];
10
- interface NamedArgs {
8
+ export interface NamedArgs {
11
9
  options: QueryOptions;
12
10
  }
13
- interface Args {
11
+ export interface Args {
14
12
  named: NamedArgs;
15
13
  positional: PositionalArgs;
16
14
  }
17
- declare class Query<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {
15
+ export declare class Query<Model, LocalArgs extends Args = Args> extends Request<LocalArgs> {
18
16
  private _records;
19
17
  __WRAPPED_FUNCTION__([modelName, query]: PositionalArgs, { options }: NamedArgs): Promise<void>;
20
18
  get records(): ArrayProxy<Model> | undefined;
21
19
  }
22
- export { QueryQuery, QueryOptions, NamedArgs, Args, Query };
20
+ export {};
21
+ //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/-private/resources/query.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,KAAK,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAC9C,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AACxC,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAE1C,KAAK,cAAc,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAC3C,M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,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS;IAQrF,IAAI,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,SAAS,CAE3C;CACF"}
@@ -1,8 +1,7 @@
1
- /// <reference types="ember-data" />
2
1
  import { Resource } from 'ember-modify-based-class-resource';
3
- import Store from '@ember-data/store';
4
- type FindRecordOptions = Parameters<Store['findRecord']>[2];
5
- declare class Request<Args> extends Resource<Args> {
2
+ import type Store from '@ember-data/store';
3
+ export type FindRecordOptions = Parameters<Store['findRecord']>[2];
4
+ export declare class Request<Args> extends Resource<Args> {
6
5
  store: Store;
7
6
  error: Error | undefined;
8
7
  isLoading: boolean;
@@ -21,4 +20,4 @@ declare class Request<Args> extends Resource<Args> {
21
20
  retry(): Promise<void>;
22
21
  __REQUEST_FUNCTION__(_positional: unknown[], _named: object): Promise<void>;
23
22
  }
24
- export { FindRecordOptions, Request };
23
+ //# sourceMappingURL=request.d.ts.map
@@ -1,2 +1,2 @@
1
- type Id = string | number | null | undefined;
2
- export { Id };
1
+ export type Id = string | number | null | undefined;
2
+ //# sourceMappingURL=types.d.ts.map
@@ -1,5 +1,6 @@
1
- export { FindAll } from "./-private/resources/find-all.js";
2
- export { FindRecord } from "./-private/resources/find-record.js";
3
- export { Query } from "./-private/resources/query.js";
4
- export { QueryRecord } from "./-private/resources/query-record.js";
5
- export { findAll, findRecord, query, queryRecord } from "./js-helpers.js";
1
+ export { FindAll } from './-private/resources/find-all.ts';
2
+ export { FindRecord } from './-private/resources/find-record.ts';
3
+ export { Query } from './-private/resources/query.ts';
4
+ export { QueryRecord } from './-private/resources/query-record.ts';
5
+ export { findAll, findRecord, query, queryRecord } from './js-helpers.ts';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGhE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAGnE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,28 +1,33 @@
1
- import { FindAll, FindAllOptions } from "./-private/resources/find-all.js";
2
- import { FindRecord, FindRecordOptions } from "./-private/resources/find-record.js";
3
- import { Query, QueryOptions, QueryQuery } from "./-private/resources/query.js";
4
- import { QueryRecord, QueryRecordOptions, QueryRecordQuery } from "./-private/resources/query-record.js";
5
- import { Id } from "./-private/resources/types.js";
1
+ import { FindAll } from './-private/resources/find-all.ts';
2
+ import { FindRecord } from './-private/resources/find-record.ts';
3
+ import { Query } from './-private/resources/query.ts';
4
+ import { QueryRecord } from './-private/resources/query-record.ts';
5
+ import type { FindAllOptions } from './-private/resources/find-all';
6
+ import type { FindRecordOptions } from './-private/resources/find-record';
7
+ import type { QueryOptions, QueryQuery } from './-private/resources/query';
8
+ import type { QueryRecordOptions, QueryRecordQuery } from './-private/resources/query-record';
9
+ import type { Id } from './-private/resources/types';
6
10
  type FindRecordThunkResult = Id | [Id] | [Id, FindRecordOptions];
7
11
  /**
8
12
  * Wrapper around store.findRecord
9
13
  */
10
- declare function findRecord<Model = unknown>(destroyable: object, modelName: string, thunk: () => FindRecordThunkResult): FindRecord<Model, import("./-private/resources/find-record.js").Args>;
14
+ export declare function findRecord<Model = unknown>(destroyable: object, modelName: string, thunk: () => FindRecordThunkResult): FindRecord<Model, import("./-private/resources/find-record.ts").Args>;
11
15
  type FindAllThunkResult = {
12
16
  options: FindAllOptions;
13
17
  } | FindAllOptions | void;
14
18
  /**
15
19
  * Wrapper around store.findAll
16
20
  */
17
- declare function findAll<Model = unknown>(destroyable: object, modelName: string, thunk?: () => FindAllThunkResult): FindAll<Model, import("./-private/resources/find-all.js").Args>;
21
+ export declare function findAll<Model = unknown>(destroyable: object, modelName: string, thunk?: () => FindAllThunkResult): FindAll<Model, import("./-private/resources/find-all.ts").Args>;
18
22
  type QueryThunkResult = QueryQuery | [QueryQuery] | [QueryQuery, QueryOptions];
19
23
  /**
20
24
  * Wrapper around store.query
21
25
  */
22
- declare function query<Model = unknown>(destroyable: object, modelName: string, thunk: () => QueryThunkResult): Query<Model, import("./-private/resources/query.js").Args>;
26
+ export declare function query<Model = unknown>(destroyable: object, modelName: string, thunk: () => QueryThunkResult): Query<Model, import("./-private/resources/query.ts").Args>;
23
27
  type QueryRecordThunkResult = QueryRecordQuery | [QueryRecordQuery] | [QueryRecordQuery, QueryRecordOptions];
24
28
  /**
25
29
  * Wrapper around store.queryRecord
26
30
  */
27
- declare function queryRecord<Model = unknown>(destroyable: object, modelName: string, thunk: () => QueryRecordThunkResult): QueryRecord<Model, import("./-private/resources/query-record.js").Args>;
28
- export { findRecord, findAll, query, queryRecord };
31
+ export declare function queryRecord<Model = unknown>(destroyable: object, modelName: string, thunk: () => QueryRecordThunkResult): QueryRecord<Model, import("./-private/resources/query-record.ts").Args>;
32
+ export {};
33
+ //# sourceMappingURL=js-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"js-helpers.d.ts","sourceRoot":"","sources":["../src/js-helpers.ts"],"names":[],"mappings":"AACA,OA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,wBAAgB,OAAO,CAAC,KAAK,GAAG,OAAO,EACrC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,kBAAkB,mEAcjC;AAED,KAAK,gBAAgB,GAAG,UAAU,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAE/E;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,GAAG,OAAO,EACnC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,gBAAgB,8DAwB9B;AAED,KAAK,sBAAsB,GACvB,gBAAgB,GAChB,CAAC,gBAAgB,CAAC,GAClB,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;AAE3C;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,GAAG,OAAO,EACzC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,sBAAsB,2EAwBpC"}
@@ -1,2 +1,3 @@
1
- import { FindAll } from "../../index.js";
2
- export { FindAll as default };
1
+ export default FindAll;
2
+ import { FindAll } from '../../index.ts';
3
+ //# sourceMappingURL=find-all.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-all.d.ts","sourceRoot":"","sources":["../../../src/loose-mode-compat/helpers/find-all.js"],"names":[],"mappings":";wBAAwB,aAAa"}
1
+ {"version":3,"file":"find-all.d.ts","sourceRoot":"","sources":["../../../src/loose-mode-compat/helpers/find-all.js"],"names":[],"mappings":";wBAAwB,gBAAgB"}
@@ -1,2 +1,3 @@
1
- import { FindRecord } from "../../index.js";
2
- export { FindRecord as default };
1
+ export default FindRecord;
2
+ import { FindRecord } from '../../index.ts';
3
+ //# sourceMappingURL=find-record.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-record.d.ts","sourceRoot":"","sources":["../../../src/loose-mode-compat/helpers/find-record.js"],"names":[],"mappings":";2BAA2B,aAAa"}
1
+ {"version":3,"file":"find-record.d.ts","sourceRoot":"","sources":["../../../src/loose-mode-compat/helpers/find-record.js"],"names":[],"mappings":";2BAA2B,gBAAgB"}
@@ -1,2 +1,3 @@
1
- import { QueryRecord } from "../../index.js";
2
- export { QueryRecord as default };
1
+ export default QueryRecord;
2
+ import { QueryRecord } from '../../index.ts';
3
+ //# sourceMappingURL=query-record.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-record.d.ts","sourceRoot":"","sources":["../../../src/loose-mode-compat/helpers/query-record.js"],"names":[],"mappings":";4BAA4B,aAAa"}
1
+ {"version":3,"file":"query-record.d.ts","sourceRoot":"","sources":["../../../src/loose-mode-compat/helpers/query-record.js"],"names":[],"mappings":";4BAA4B,gBAAgB"}
@@ -1,2 +1,3 @@
1
- import { Query } from "../../index.js";
2
- export { Query as default };
1
+ export default Query;
2
+ import { Query } from '../../index.ts';
3
+ //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/loose-mode-compat/helpers/query.js"],"names":[],"mappings":";sBAAsB,aAAa"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/loose-mode-compat/helpers/query.js"],"names":[],"mappings":";sBAAsB,gBAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-data-resources",
3
- "version": "5.2.3",
3
+ "version": "5.3.1",
4
4
  "description": "Resource helpers for reactively (re)fetching data with ember-data",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -17,6 +17,7 @@
17
17
  "@ember/string": "^3.1.1",
18
18
  "@ember/test-waiters": "^3.1.0",
19
19
  "@embroider/addon-shim": "^1.0.0",
20
+ "decorator-transforms": "^2.3.0",
20
21
  "ember-modify-based-class-resource": "^1.1.0"
21
22
  },
22
23
  "devDependencies": {
@@ -28,13 +29,15 @@
28
29
  "@babel/runtime": "^7.22.5",
29
30
  "@ember-data/store": "^5.0.0",
30
31
  "@ember-data/tracking": "^5.3.0",
31
- "@embroider/addon-dev": "^3.1.1",
32
+ "@ember/library-tsconfig": "^1.1.3",
33
+ "@embroider/addon-dev": "^8.0.0",
32
34
  "@glimmer/component": "^1.1.2",
33
35
  "@glimmer/tracking": "^1.1.2",
34
36
  "@glint/core": "^1.3.0",
35
37
  "@glint/environment-ember-loose": "^1.0.2",
36
38
  "@glint/template": "^1.0.2",
37
39
  "@nullvoxpopuli/eslint-configs": "^3.1.3",
40
+ "@rollup/plugin-babel": "^6.0.4",
38
41
  "@tsconfig/ember": "^3.0.3",
39
42
  "@types/ember": "^4.0.0",
40
43
  "@types/ember-data__store": "^4.0.3",
@@ -57,7 +60,7 @@
57
60
  "@types/ember__utils": "^4.0.0",
58
61
  "@typescript-eslint/eslint-plugin": "^6.19.0",
59
62
  "@typescript-eslint/parser": "^6.19.0",
60
- "concurrently": "^8.2.0",
63
+ "concurrently": "^9.1.2",
61
64
  "ember-resources": "^6.0.0",
62
65
  "ember-source": "~5.6.0",
63
66
  "ember-template-lint": "^5.10.3",
@@ -68,13 +71,12 @@
68
71
  "eslint-plugin-prettier": "^5.1.3",
69
72
  "eslint-plugin-qunit": "^8.0.1",
70
73
  "execa": "^8.0.1",
71
- "prettier": "^3.2.4",
72
- "prettier-plugin-ember-template-tag": "^2.0.0",
74
+ "prettier": "^3.5.3",
75
+ "prettier-plugin-ember-template-tag": "^2.0.5",
73
76
  "publint": "^0.2.7",
74
- "rollup": "~4.11.0",
77
+ "rollup": "~4.40.2",
75
78
  "rollup-plugin-copy": "^3.5.0",
76
79
  "rollup-plugin-delete": "^2.0.0",
77
- "rollup-plugin-ts": "^3.4.5",
78
80
  "typescript": "^5.3.3"
79
81
  },
80
82
  "publishConfig": {
@@ -117,15 +119,11 @@
117
119
  },
118
120
  "peerDependencies": {
119
121
  "@ember-data/store": "^3.25 || >= 4.0.0",
120
- "@glimmer/tracking": "^1.1.2",
121
122
  "ember-data": "^3.25.0 || >=4.0.0",
122
- "ember-resources": "^5.3.0 || >= 6.0.0",
123
- "ember-source": "^3.25.0 || >=4.0.0"
123
+ "ember-resources": "^5.3.0 || >= 6.0.0"
124
124
  },
125
125
  "scripts": {
126
- "build": "concurrently 'npm:build:*'",
127
- "build:js": "rollup --config",
128
- "build:types": "rm -rf dist-types; pnpm glint --build",
126
+ "build": "rollup --config",
129
127
  "lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
130
128
  "lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
131
129
  "lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
@@ -1,142 +0,0 @@
1
- import { tracked } from '@glimmer/tracking';
2
- import { assert } from '@ember/debug';
3
- import { isDestroyed, isDestroying } from '@ember/destroyable';
4
- import { action } from '@ember/object';
5
- import * as emberService from '@ember/service';
6
- import { waitFor, waitForPromise } from '@ember/test-waiters';
7
- import { Resource } from 'ember-modify-based-class-resource';
8
-
9
- function _initializerDefineProperty(target, property, descriptor, context) {
10
- if (!descriptor) return;
11
- Object.defineProperty(target, property, {
12
- enumerable: descriptor.enumerable,
13
- configurable: descriptor.configurable,
14
- writable: descriptor.writable,
15
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
16
- });
17
- }
18
-
19
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
20
- var desc = {};
21
- Object.keys(descriptor).forEach(function (key) {
22
- desc[key] = descriptor[key];
23
- });
24
- desc.enumerable = !!desc.enumerable;
25
- desc.configurable = !!desc.configurable;
26
- if ('value' in desc || desc.initializer) {
27
- desc.writable = true;
28
- }
29
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
30
- return decorator(target, property, desc) || desc;
31
- }, desc);
32
- if (context && desc.initializer !== void 0) {
33
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
34
- desc.initializer = undefined;
35
- }
36
- if (desc.initializer === void 0) {
37
- Object.defineProperty(target, property, desc);
38
- desc = null;
39
- }
40
- return desc;
41
- }
42
-
43
- var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4;
44
- const service = emberService.service ?? emberService.inject;
45
- let Request = (_class = class Request extends Resource {
46
- constructor(...args) {
47
- super(...args);
48
- _initializerDefineProperty(this, "store", _descriptor, this);
49
- _initializerDefineProperty(this, "error", _descriptor2, this);
50
- _initializerDefineProperty(this, "isLoading", _descriptor3, this);
51
- _initializerDefineProperty(this, "hasRan", _descriptor4, this);
52
- }
53
- /**
54
- * Args saved, untracked, for retrying
55
- */
56
-
57
- modify(positional, named) {
58
- this.positional = positional || [];
59
- this.named = named || {};
60
-
61
- /**
62
- * We need to consume all arguments here so that we correctly respond to updates to
63
- * dirtied source data.
64
- *
65
- * e.g.: when an id changes that is passed to findRecord, we re-fetch.
66
- */
67
- this.__REQUEST_FUNCTION__([...positional], {
68
- ...named
69
- });
70
- }
71
- async __WRAPPED_FUNCTION__(_positional, _named) {
72
- throw new Error('Not Implemented');
73
- }
74
- get isSuccess() {
75
- return !this.error;
76
- }
77
- get isError() {
78
- return Boolean(this.error);
79
- }
80
- get records() {
81
- return assert(`The resource for ${this.constructor.name} does not have a records property. ` + `You might be looking for .record instead.`);
82
- }
83
- get record() {
84
- return assert(`The resource for ${this.constructor.name} does not have a record property. ` + `You might be looking for .records instead.`);
85
- }
86
- async retry() {
87
- return waitForPromise(this.__WRAPPED_FUNCTION__(this.positional, this.named));
88
- }
89
- async __REQUEST_FUNCTION__(_positional, _named) {
90
- /**
91
- * Args are already consumed, but let's delay doing anything
92
- * until we can get out of a tracking frame.
93
- */
94
- await Promise.resolve();
95
- if (isDestroyed(this) || isDestroying(this)) return;
96
- this.error = undefined;
97
- this.isLoading = true;
98
- try {
99
- await this.retry();
100
- } catch (e) {
101
- if (isDestroyed(this) || isDestroying(this)) return;
102
- if (e instanceof Error) {
103
- this.error = e;
104
- } else {
105
- // How likely is this to happen?
106
- throw e;
107
- }
108
- }
109
- if (isDestroyed(this) || isDestroying(this)) {
110
- return;
111
- }
112
- this.isLoading = false;
113
- this.hasRan = true;
114
- }
115
- }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "store", [service], {
116
- configurable: true,
117
- enumerable: true,
118
- writable: true,
119
- initializer: null
120
- }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "error", [tracked], {
121
- configurable: true,
122
- enumerable: true,
123
- writable: true,
124
- initializer: null
125
- }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "isLoading", [tracked], {
126
- configurable: true,
127
- enumerable: true,
128
- writable: true,
129
- initializer: function () {
130
- return false;
131
- }
132
- }), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "hasRan", [tracked], {
133
- configurable: true,
134
- enumerable: true,
135
- writable: true,
136
- initializer: function () {
137
- return false;
138
- }
139
- }), _applyDecoratedDescriptor(_class.prototype, "retry", [action], Object.getOwnPropertyDescriptor(_class.prototype, "retry"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "__REQUEST_FUNCTION__", [action, waitFor], Object.getOwnPropertyDescriptor(_class.prototype, "__REQUEST_FUNCTION__"), _class.prototype)), _class);
140
-
141
- export { Request as R, _applyDecoratedDescriptor as _, _initializerDefineProperty as a };
142
- //# sourceMappingURL=request-D75_GC-a.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request-D75_GC-a.js","sources":["../node_modules/.pnpm/@babel+runtime@7.23.8/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js","../node_modules/.pnpm/@babel+runtime@7.23.8/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js","../src/-private/resources/request.ts"],"sourcesContent":["export default function _initializerDefineProperty(target, property, descriptor, context) {\n if (!descriptor) return;\n Object.defineProperty(target, property, {\n enumerable: descriptor.enumerable,\n configurable: descriptor.configurable,\n writable: descriptor.writable,\n value: descriptor.initializer ? descriptor.initializer.call(context) : void 0\n });\n}","export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {\n var desc = {};\n Object.keys(descriptor).forEach(function (key) {\n desc[key] = descriptor[key];\n });\n desc.enumerable = !!desc.enumerable;\n desc.configurable = !!desc.configurable;\n if ('value' in desc || desc.initializer) {\n desc.writable = true;\n }\n desc = decorators.slice().reverse().reduce(function (desc, decorator) {\n return decorator(target, property, desc) || desc;\n }, desc);\n if (context && desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(context) : void 0;\n desc.initializer = undefined;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(target, property, desc);\n desc = null;\n }\n return desc;\n}","import { tracked } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\nimport * as emberService from '@ember/service';\n\nconst service = emberService.service ?? emberService.inject;\n\nimport { waitFor, waitForPromise } from '@ember/test-waiters';\n\nimport { Resource } from 'ember-modify-based-class-resource';\n\nimport type Store from '@ember-data/store';\n\nexport type FindRecordOptions = Parameters<Store['findRecord']>[2];\n\nexport class Request<Args> extends Resource<Args> {\n @service declare store: Store;\n\n @tracked error: Error | undefined;\n @tracked isLoading = false;\n @tracked hasRan = false;\n\n /**\n * Args saved, untracked, for retrying\n */\n declare positional: unknown[];\n declare named: object;\n\n modify(positional?: unknown[], named?: object) {\n this.positional = positional || [];\n this.named = named || {};\n\n /**\n * We need to consume all arguments here so that we correctly respond to updates to\n * dirtied source data.\n *\n * e.g.: when an id changes that is passed to findRecord, we re-fetch.\n */\n this.__REQUEST_FUNCTION__([...(positional as unknown[])], {\n ...named,\n });\n }\n\n async __WRAPPED_FUNCTION__(_positional: unknown[], _named: object) {\n throw new Error('Not Implemented');\n }\n\n get isSuccess() {\n return !this.error;\n }\n\n get isError() {\n return Boolean(this.error);\n }\n\n get records(): unknown | undefined {\n return assert(\n `The resource for ${this.constructor.name} does not have a records property. ` +\n `You might be looking for .record instead.`,\n );\n }\n\n get record(): unknown | undefined {\n return assert(\n `The resource for ${this.constructor.name} does not have a record property. ` +\n `You might be looking for .records instead.`,\n );\n }\n\n @action\n async retry() {\n return waitForPromise(this.__WRAPPED_FUNCTION__(this.positional, this.named));\n }\n\n @action\n @waitFor\n async __REQUEST_FUNCTION__(_positional: unknown[], _named: object) {\n /**\n * Args are already consumed, but let's delay doing anything\n * until we can get out of a tracking frame.\n */\n await Promise.resolve();\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this.error = undefined;\n this.isLoading = true;\n\n try {\n await this.retry();\n } catch (e) {\n if (isDestroyed(this) || isDestroying(this)) return;\n\n if (e instanceof Error) {\n this.error = e;\n } else {\n // How likely is this to happen?\n throw e;\n }\n }\n\n if (isDestroyed(this) || isDestroying(this)) {\n return;\n }\n\n this.isLoading = false;\n this.hasRan = true;\n }\n}\n"],"names":["_initializerDefineProperty","target","property","descriptor","context","Object","defineProperty","enumerable","configurable","writable","value","initializer","call","_applyDecoratedDescriptor","decorators","desc","keys","forEach","key","slice","reverse","reduce","decorator","undefined","service","emberService","inject","Request","_class","Resource","constructor","args","_descriptor","_descriptor2","_descriptor3","_descriptor4","modify","positional","named","__REQUEST_FUNCTION__","__WRAPPED_FUNCTION__","_positional","_named","Error","isSuccess","error","isError","Boolean","records","assert","name","record","retry","waitForPromise","Promise","resolve","isDestroyed","isDestroying","isLoading","e","hasRan","prototype","tracked","action","getOwnPropertyDescriptor","waitFor"],"mappings":";;;;;;;;AAAe,SAASA,0BAA0BA,CAACC,MAAM,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,OAAO,EAAE;EACxF,IAAI,CAACD,UAAU,EAAE,OAAA;AACjBE,EAAAA,MAAM,CAACC,cAAc,CAACL,MAAM,EAAEC,QAAQ,EAAE;IACtCK,UAAU,EAAEJ,UAAU,CAACI,UAAU;IACjCC,YAAY,EAAEL,UAAU,CAACK,YAAY;IACrCC,QAAQ,EAAEN,UAAU,CAACM,QAAQ;AAC7BC,IAAAA,KAAK,EAAEP,UAAU,CAACQ,WAAW,GAAGR,UAAU,CAACQ,WAAW,CAACC,IAAI,CAACR,OAAO,CAAC,GAAG,KAAK,CAAA;AAC9E,GAAC,CAAC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AAA,CAAAiC,SAAA,CAAAhD,EAAAA,yBAAA,CAAAe,MAAA,CAAAiC,SAAA,EAAA,sBAAA,EAAA,CAKNE,MAAM,EACNE,OAAO,GAAA5D,MAAA,CAAA2D,wBAAA,CAAApC,MAAA,CAAAiC,SAAA,EAAA,sBAAA,CAAA,EAAAjC,MAAA,CAAAiC,SAAA,IAAAjC,MAAA;;;;","x_google_ignoreList":[0,1]}
@@ -1,2 +0,0 @@
1
- declare function _defineProperty(obj: any, key: any, value: any): any;
2
- export { _defineProperty as default };
@@ -1,9 +0,0 @@
1
- declare function _initializerDefineProperty(target: any, property: any, descriptor: any, context: any): void;
2
- declare function _applyDecoratedDescriptor(target: any, property: any, decorators: any, descriptor: any, context: any): {
3
- enumerable: any;
4
- configurable: any;
5
- writable: boolean;
6
- value: any;
7
- initializer: any;
8
- };
9
- export { _initializerDefineProperty as default };
@@ -1,4 +0,0 @@
1
- declare function _typeof(o: any): any;
2
- declare function toPrimitive(t: any, r: any): any;
3
- declare function toPropertyKey(t: any): any;
4
- export { _typeof as default };