@warp-drive-mirror/utilities 5.8.0-alpha.37 → 5.8.0-alpha.40

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 (137) hide show
  1. package/dist/unpkg/dev/active-record.js +11 -12
  2. package/dist/unpkg/dev/handlers.js +4 -5
  3. package/dist/unpkg/dev/index.js +50 -49
  4. package/dist/unpkg/{prod-deprecated/inflect-BSG696t-.js → dev/inflect-BEv8WqY1.js} +4 -5
  5. package/dist/unpkg/dev/json-api.js +16 -16
  6. package/dist/unpkg/dev/rest.js +11 -12
  7. package/dist/unpkg/dev/string.js +1 -1
  8. package/dist/unpkg/dev-deprecated/active-record.js +11 -12
  9. package/dist/unpkg/dev-deprecated/handlers.js +4 -5
  10. package/dist/unpkg/dev-deprecated/index.js +50 -49
  11. package/dist/unpkg/dev-deprecated/{inflect-BSG696t-.js → inflect-BEv8WqY1.js} +4 -5
  12. package/dist/unpkg/dev-deprecated/json-api.js +16 -16
  13. package/dist/unpkg/dev-deprecated/rest.js +11 -12
  14. package/dist/unpkg/dev-deprecated/string.js +1 -1
  15. package/dist/unpkg/prod/active-record.js +1 -30
  16. package/dist/unpkg/prod/handlers.js +1 -13
  17. package/dist/unpkg/prod/index.js +2 -124
  18. package/dist/unpkg/{dev/inflect-BSG696t-.js → prod/inflect-Dh9dyEYx.js} +0 -11
  19. package/dist/unpkg/prod/json-api.js +2 -40
  20. package/dist/unpkg/prod/rest.js +1 -30
  21. package/dist/unpkg/prod/string.js +1 -1
  22. package/dist/unpkg/prod-deprecated/active-record.js +1 -30
  23. package/dist/unpkg/prod-deprecated/handlers.js +1 -13
  24. package/dist/unpkg/prod-deprecated/index.js +2 -124
  25. package/dist/unpkg/{prod/inflect-BSG696t-.js → prod-deprecated/inflect-Dh9dyEYx.js} +0 -11
  26. package/dist/unpkg/prod-deprecated/json-api.js +2 -40
  27. package/dist/unpkg/prod-deprecated/rest.js +1 -30
  28. package/dist/unpkg/prod-deprecated/string.js +1 -1
  29. package/package.json +12 -20
  30. package/dist/unpkg/dev/declarations/-private/active-record/find-record.d.ts +0 -64
  31. package/dist/unpkg/dev/declarations/-private/active-record/query.d.ts +0 -53
  32. package/dist/unpkg/dev/declarations/-private/active-record/save-record.d.ts +0 -146
  33. package/dist/unpkg/dev/declarations/-private/builder-utils.d.ts +0 -4
  34. package/dist/unpkg/dev/declarations/-private/handlers/auto-compress.d.ts +0 -158
  35. package/dist/unpkg/dev/declarations/-private/handlers/gated.d.ts +0 -19
  36. package/dist/unpkg/dev/declarations/-private/handlers/meta-doc.d.ts +0 -47
  37. package/dist/unpkg/dev/declarations/-private/handlers/utils.d.ts +0 -41
  38. package/dist/unpkg/dev/declarations/-private/json-api/-utils.d.ts +0 -109
  39. package/dist/unpkg/dev/declarations/-private/json-api/find-record.d.ts +0 -84
  40. package/dist/unpkg/dev/declarations/-private/json-api/query.d.ts +0 -100
  41. package/dist/unpkg/dev/declarations/-private/json-api/save-record.d.ts +0 -228
  42. package/dist/unpkg/dev/declarations/-private/json-api/serialize.d.ts +0 -70
  43. package/dist/unpkg/dev/declarations/-private/rest/find-record.d.ts +0 -62
  44. package/dist/unpkg/dev/declarations/-private/rest/query.d.ts +0 -53
  45. package/dist/unpkg/dev/declarations/-private/rest/save-record.d.ts +0 -146
  46. package/dist/unpkg/dev/declarations/-private/string/inflect.d.ts +0 -82
  47. package/dist/unpkg/dev/declarations/-private/string/inflections.d.ts +0 -9
  48. package/dist/unpkg/dev/declarations/-private/string/transform.d.ts +0 -77
  49. package/dist/unpkg/dev/declarations/-private.d.ts +0 -1
  50. package/dist/unpkg/dev/declarations/active-record.d.ts +0 -3
  51. package/dist/unpkg/dev/declarations/derivations.d.ts +0 -27
  52. package/dist/unpkg/dev/declarations/handlers.d.ts +0 -10
  53. package/dist/unpkg/dev/declarations/index.d.ts +0 -208
  54. package/dist/unpkg/dev/declarations/json-api.d.ts +0 -5
  55. package/dist/unpkg/dev/declarations/rest.d.ts +0 -3
  56. package/dist/unpkg/dev/declarations/string.d.ts +0 -14
  57. package/dist/unpkg/dev-deprecated/declarations/-private/active-record/find-record.d.ts +0 -64
  58. package/dist/unpkg/dev-deprecated/declarations/-private/active-record/query.d.ts +0 -53
  59. package/dist/unpkg/dev-deprecated/declarations/-private/active-record/save-record.d.ts +0 -146
  60. package/dist/unpkg/dev-deprecated/declarations/-private/builder-utils.d.ts +0 -4
  61. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/auto-compress.d.ts +0 -158
  62. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/gated.d.ts +0 -19
  63. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/meta-doc.d.ts +0 -47
  64. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/utils.d.ts +0 -41
  65. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/-utils.d.ts +0 -109
  66. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/find-record.d.ts +0 -84
  67. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/query.d.ts +0 -100
  68. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/save-record.d.ts +0 -228
  69. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/serialize.d.ts +0 -70
  70. package/dist/unpkg/dev-deprecated/declarations/-private/rest/find-record.d.ts +0 -62
  71. package/dist/unpkg/dev-deprecated/declarations/-private/rest/query.d.ts +0 -53
  72. package/dist/unpkg/dev-deprecated/declarations/-private/rest/save-record.d.ts +0 -146
  73. package/dist/unpkg/dev-deprecated/declarations/-private/string/inflect.d.ts +0 -82
  74. package/dist/unpkg/dev-deprecated/declarations/-private/string/inflections.d.ts +0 -9
  75. package/dist/unpkg/dev-deprecated/declarations/-private/string/transform.d.ts +0 -77
  76. package/dist/unpkg/dev-deprecated/declarations/-private.d.ts +0 -1
  77. package/dist/unpkg/dev-deprecated/declarations/active-record.d.ts +0 -3
  78. package/dist/unpkg/dev-deprecated/declarations/derivations.d.ts +0 -27
  79. package/dist/unpkg/dev-deprecated/declarations/handlers.d.ts +0 -10
  80. package/dist/unpkg/dev-deprecated/declarations/index.d.ts +0 -208
  81. package/dist/unpkg/dev-deprecated/declarations/json-api.d.ts +0 -5
  82. package/dist/unpkg/dev-deprecated/declarations/rest.d.ts +0 -3
  83. package/dist/unpkg/dev-deprecated/declarations/string.d.ts +0 -14
  84. package/dist/unpkg/prod/declarations/-private/active-record/find-record.d.ts +0 -64
  85. package/dist/unpkg/prod/declarations/-private/active-record/query.d.ts +0 -53
  86. package/dist/unpkg/prod/declarations/-private/active-record/save-record.d.ts +0 -146
  87. package/dist/unpkg/prod/declarations/-private/builder-utils.d.ts +0 -4
  88. package/dist/unpkg/prod/declarations/-private/handlers/auto-compress.d.ts +0 -158
  89. package/dist/unpkg/prod/declarations/-private/handlers/gated.d.ts +0 -19
  90. package/dist/unpkg/prod/declarations/-private/handlers/meta-doc.d.ts +0 -47
  91. package/dist/unpkg/prod/declarations/-private/handlers/utils.d.ts +0 -41
  92. package/dist/unpkg/prod/declarations/-private/json-api/-utils.d.ts +0 -109
  93. package/dist/unpkg/prod/declarations/-private/json-api/find-record.d.ts +0 -84
  94. package/dist/unpkg/prod/declarations/-private/json-api/query.d.ts +0 -100
  95. package/dist/unpkg/prod/declarations/-private/json-api/save-record.d.ts +0 -228
  96. package/dist/unpkg/prod/declarations/-private/json-api/serialize.d.ts +0 -70
  97. package/dist/unpkg/prod/declarations/-private/rest/find-record.d.ts +0 -62
  98. package/dist/unpkg/prod/declarations/-private/rest/query.d.ts +0 -53
  99. package/dist/unpkg/prod/declarations/-private/rest/save-record.d.ts +0 -146
  100. package/dist/unpkg/prod/declarations/-private/string/inflect.d.ts +0 -82
  101. package/dist/unpkg/prod/declarations/-private/string/inflections.d.ts +0 -9
  102. package/dist/unpkg/prod/declarations/-private/string/transform.d.ts +0 -77
  103. package/dist/unpkg/prod/declarations/-private.d.ts +0 -1
  104. package/dist/unpkg/prod/declarations/active-record.d.ts +0 -3
  105. package/dist/unpkg/prod/declarations/derivations.d.ts +0 -27
  106. package/dist/unpkg/prod/declarations/handlers.d.ts +0 -10
  107. package/dist/unpkg/prod/declarations/index.d.ts +0 -208
  108. package/dist/unpkg/prod/declarations/json-api.d.ts +0 -5
  109. package/dist/unpkg/prod/declarations/rest.d.ts +0 -3
  110. package/dist/unpkg/prod/declarations/string.d.ts +0 -14
  111. package/dist/unpkg/prod-deprecated/declarations/-private/active-record/find-record.d.ts +0 -64
  112. package/dist/unpkg/prod-deprecated/declarations/-private/active-record/query.d.ts +0 -53
  113. package/dist/unpkg/prod-deprecated/declarations/-private/active-record/save-record.d.ts +0 -146
  114. package/dist/unpkg/prod-deprecated/declarations/-private/builder-utils.d.ts +0 -4
  115. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/auto-compress.d.ts +0 -158
  116. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/gated.d.ts +0 -19
  117. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/meta-doc.d.ts +0 -47
  118. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/utils.d.ts +0 -41
  119. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/-utils.d.ts +0 -109
  120. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/find-record.d.ts +0 -84
  121. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/query.d.ts +0 -100
  122. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/save-record.d.ts +0 -228
  123. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/serialize.d.ts +0 -70
  124. package/dist/unpkg/prod-deprecated/declarations/-private/rest/find-record.d.ts +0 -62
  125. package/dist/unpkg/prod-deprecated/declarations/-private/rest/query.d.ts +0 -53
  126. package/dist/unpkg/prod-deprecated/declarations/-private/rest/save-record.d.ts +0 -146
  127. package/dist/unpkg/prod-deprecated/declarations/-private/string/inflect.d.ts +0 -82
  128. package/dist/unpkg/prod-deprecated/declarations/-private/string/inflections.d.ts +0 -9
  129. package/dist/unpkg/prod-deprecated/declarations/-private/string/transform.d.ts +0 -77
  130. package/dist/unpkg/prod-deprecated/declarations/-private.d.ts +0 -1
  131. package/dist/unpkg/prod-deprecated/declarations/active-record.d.ts +0 -3
  132. package/dist/unpkg/prod-deprecated/declarations/derivations.d.ts +0 -27
  133. package/dist/unpkg/prod-deprecated/declarations/handlers.d.ts +0 -10
  134. package/dist/unpkg/prod-deprecated/declarations/index.d.ts +0 -208
  135. package/dist/unpkg/prod-deprecated/declarations/json-api.d.ts +0 -5
  136. package/dist/unpkg/prod-deprecated/declarations/rest.d.ts +0 -3
  137. package/dist/unpkg/prod-deprecated/declarations/string.d.ts +0 -14
@@ -1,8 +1,7 @@
1
1
  import { setBuildURLConfig as setBuildURLConfig$1, buildBaseURL, buildQueryParams } from './index.js';
2
- import { p as pluralize } from "./inflect-BSG696t-.js";
2
+ import { p as pluralize } from "./inflect-Dh9dyEYx.js";
3
3
  import { e as extractCacheOptions, c as copyForwardUrlOptions } from "./builder-utils-Donkk-BZ.js";
4
4
  import { recordIdentifierFor } from '@warp-drive-mirror/core';
5
- import { macroCondition, getGlobalConfig } from '@embroider/macros';
6
5
  const JsonApiAccept = 'application/vnd.api+json';
7
6
  const DEFAULT_CONFIG = {
8
7
  host: '',
@@ -321,9 +320,6 @@ query = {}, options = {}) {
321
320
  op: 'query'
322
321
  };
323
322
  }
324
- function isExisting(identifier) {
325
- return 'id' in identifier && identifier.id !== null && 'type' in identifier && identifier.type !== null;
326
- }
327
323
 
328
324
  /**
329
325
  * :::warning ⚠️ **These Mutation Builders DO NOT Set The Request Body**
@@ -382,16 +378,6 @@ function isExisting(identifier) {
382
378
 
383
379
  function deleteRecord(record, options = {}) {
384
380
  const identifier = recordIdentifierFor(record);
385
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
386
- if (!test) {
387
- throw new Error(`Expected to be given a record instance`);
388
- }
389
- })(identifier) : {};
390
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
391
- if (!test) {
392
- throw new Error(`Cannot delete a record that does not have an associated type and id.`);
393
- }
394
- })(isExisting(identifier)) : {};
395
381
  const urlOptions = {
396
382
  identifier: identifier,
397
383
  op: 'deleteRecord',
@@ -470,11 +456,6 @@ function deleteRecord(record, options = {}) {
470
456
 
471
457
  function createRecord(record, options = {}) {
472
458
  const identifier = recordIdentifierFor(record);
473
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
474
- if (!test) {
475
- throw new Error(`Expected to be given a record instance`);
476
- }
477
- })(identifier) : {};
478
459
  const urlOptions = {
479
460
  identifier: identifier,
480
461
  op: 'createRecord',
@@ -556,16 +537,6 @@ function createRecord(record, options = {}) {
556
537
 
557
538
  function updateRecord(record, options = {}) {
558
539
  const identifier = recordIdentifierFor(record);
559
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
560
- if (!test) {
561
- throw new Error(`Expected to be given a record instance`);
562
- }
563
- })(identifier) : {};
564
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
565
- if (!test) {
566
- throw new Error(`Cannot update a record that does not have an associated type and id.`);
567
- }
568
- })(isExisting(identifier)) : {};
569
540
  const urlOptions = {
570
541
  identifier: identifier,
571
542
  op: 'updateRecord',
@@ -602,6 +573,7 @@ function updateRecord(record, options = {}) {
602
573
  * @param {ResourceKey} identifier
603
574
  * @return {Object} An object with a `data` property containing the serialized resource patch
604
575
  */
576
+
605
577
  function serializeResources(cache, identifiers) {
606
578
  return {
607
579
  data: Array.isArray(identifiers) ? identifiers.map(identifier => _serializeResource(cache, identifier)) : _serializeResource(cache, identifiers)
@@ -641,11 +613,6 @@ function _serializeResource(cache, identifier) {
641
613
  // peek gives us everything we want, but since its referentially the same data
642
614
  // as is in the cache we clone it to avoid any accidental mutations
643
615
  const record = structuredClone(cache.peek(identifier));
644
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
645
- if (!test) {
646
- throw new Error(`A record with id ${String(id)} and type ${type} for lid ${lid} was not found not in the supplied Cache.`);
647
- }
648
- })(record) : {};
649
616
 
650
617
  // remove lid from anything that has an ID and slice any relationship arrays
651
618
  if (record.id !== null) {
@@ -700,11 +667,6 @@ function serializePatch(cache, identifier) {
700
667
  lid,
701
668
  type
702
669
  } = identifier;
703
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
704
- if (!test) {
705
- throw new Error(`A record with id ${String(id)} and type ${type} for lid ${lid} was not found not in the supplied Cache.`);
706
- }
707
- })(cache.peek(identifier)) : {};
708
670
  const data = id === null ? {
709
671
  type,
710
672
  lid,
@@ -1,8 +1,7 @@
1
1
  import { buildBaseURL, buildQueryParams } from './index.js';
2
- import { p as pluralize, g as camelize } from "./inflect-BSG696t-.js";
2
+ import { p as pluralize, g as camelize } from "./inflect-Dh9dyEYx.js";
3
3
  import { e as extractCacheOptions, c as copyForwardUrlOptions } from "./builder-utils-Donkk-BZ.js";
4
4
  import { recordIdentifierFor } from '@warp-drive-mirror/core';
5
- import { macroCondition, getGlobalConfig } from '@embroider/macros';
6
5
 
7
6
  /**
8
7
  * Builds request options to fetch a single resource by a known id or identifier
@@ -160,9 +159,6 @@ query = {}, options = {}) {
160
159
  op: 'query'
161
160
  };
162
161
  }
163
- function isExisting(identifier) {
164
- return 'id' in identifier && identifier.id !== null && 'type' in identifier && identifier.type !== null;
165
- }
166
162
 
167
163
  /**
168
164
  * Builds request options to delete record for resources,
@@ -216,16 +212,6 @@ function isExisting(identifier) {
216
212
 
217
213
  function deleteRecord(record, options = {}) {
218
214
  const identifier = recordIdentifierFor(record);
219
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
220
- if (!test) {
221
- throw new Error(`Expected to be given a record instance`);
222
- }
223
- })(identifier) : {};
224
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
225
- if (!test) {
226
- throw new Error(`Cannot delete a record that does not have an associated type and id.`);
227
- }
228
- })(isExisting(identifier)) : {};
229
215
  const urlOptions = {
230
216
  identifier: identifier,
231
217
  op: 'deleteRecord',
@@ -289,11 +275,6 @@ function deleteRecord(record, options = {}) {
289
275
 
290
276
  function createRecord(record, options = {}) {
291
277
  const identifier = recordIdentifierFor(record);
292
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
293
- if (!test) {
294
- throw new Error(`Expected to be given a record instance`);
295
- }
296
- })(identifier) : {};
297
278
  const urlOptions = {
298
279
  identifier: identifier,
299
280
  op: 'createRecord',
@@ -360,16 +341,6 @@ function createRecord(record, options = {}) {
360
341
 
361
342
  function updateRecord(record, options = {}) {
362
343
  const identifier = recordIdentifierFor(record);
363
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
364
- if (!test) {
365
- throw new Error(`Expected to be given a record instance`);
366
- }
367
- })(identifier) : {};
368
- macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
369
- if (!test) {
370
- throw new Error(`Cannot update a record that does not have an associated type and id.`);
371
- }
372
- })(isExisting(identifier)) : {};
373
344
  const urlOptions = {
374
345
  identifier: identifier,
375
346
  op: 'updateRecord',
@@ -1 +1 @@
1
- export { g as camelize, h as capitalize, d as clear, e as clearRules, f as dasherize, i as irregular, l as loadIrregular, c as loadUncountable, b as plural, p as pluralize, r as resetToDefaults, k as setMaxLRUCacheSize, a as singular, s as singularize, u as uncountable, j as underscore } from "./inflect-BSG696t-.js";
1
+ export { g as camelize, h as capitalize, d as clear, e as clearRules, f as dasherize, i as irregular, l as loadIrregular, c as loadUncountable, b as plural, p as pluralize, r as resetToDefaults, k as setMaxLRUCacheSize, a as singular, s as singularize, u as uncountable, j as underscore } from "./inflect-Dh9dyEYx.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warp-drive-mirror/utilities",
3
- "version": "5.8.0-alpha.37",
3
+ "version": "5.8.0-alpha.40",
4
4
  "description": "Utilities package for WarpDrive | Things your app might find useful",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -23,14 +23,10 @@
23
23
  ],
24
24
  "exports": {
25
25
  ".": {
26
- "unpkg": {
27
- "development": {
28
- "deprecations": "./dist/unpkg/dev-deprecated/index.js",
29
- "default": "./dist/unpkg/dev/index.js"
30
- },
31
- "deprecations": "./dist/unpkg/prod-deprecated/index.js",
32
- "default": "./dist/unpkg/prod/index.js"
33
- },
26
+ "unpkg-dev-deprecated": "./dist/unpkg/dev-deprecated/index.js",
27
+ "unpkg-dev": "./dist/unpkg/dev/index.js",
28
+ "unpkg-deprecated": "./dist/unpkg/prod-deprecated/index.js",
29
+ "unpkg": "./dist/unpkg/prod/index.js",
34
30
  "types": "./declarations/index.d.ts",
35
31
  "default": "./dist/index.js"
36
32
  },
@@ -39,20 +35,16 @@
39
35
  "default": "./dist/*.cjs"
40
36
  },
41
37
  "./*": {
42
- "unpkg": {
43
- "development": {
44
- "deprecations": "./dist/unpkg/dev-deprecated/*.js",
45
- "default": "./dist/unpkg/dev/*.js"
46
- },
47
- "deprecations": "./dist/unpkg/prod-deprecated/*.js",
48
- "default": "./dist/unpkg/prod/*.js"
49
- },
38
+ "unpkg-dev-deprecated": "./dist/unpkg/dev-deprecated/*.js",
39
+ "unpkg-dev": "./dist/unpkg/dev/*.js",
40
+ "unpkg-deprecated": "./dist/unpkg/prod-deprecated/*.js",
41
+ "unpkg": "./dist/unpkg/prod/*.js",
50
42
  "types": "./declarations/*.d.ts",
51
43
  "default": "./dist/*.js"
52
44
  }
53
45
  },
54
46
  "peerDependencies": {
55
- "@warp-drive-mirror/core": "5.8.0-alpha.37"
47
+ "@warp-drive-mirror/core": "5.8.0-alpha.40"
56
48
  },
57
49
  "dependencies": {
58
50
  "@embroider/macros": "^1.18.1"
@@ -61,8 +53,8 @@
61
53
  "@babel/core": "^7.28.3",
62
54
  "@babel/plugin-transform-typescript": "^7.28.0",
63
55
  "@babel/preset-typescript": "^7.27.1",
64
- "@warp-drive/internal-config": "5.8.0-alpha.37",
65
- "@warp-drive-mirror/core": "5.8.0-alpha.37",
56
+ "@warp-drive/internal-config": "5.8.0-alpha.40",
57
+ "@warp-drive-mirror/core": "5.8.0-alpha.40",
66
58
  "decorator-transforms": "^2.3.0",
67
59
  "expect-type": "^1.2.2",
68
60
  "typescript": "^5.9.2",
@@ -1,64 +0,0 @@
1
- import type { ReactiveDataDocument } from "@warp-drive-mirror/core/reactive";
2
- import type { TypeFromInstance } from "@warp-drive-mirror/core/types/record";
3
- import type { FindRecordOptions, FindRecordRequestOptions, RemotelyAccessibleIdentifier } from "@warp-drive-mirror/core/types/request";
4
- /**
5
- * Builds request options to fetch a single resource by a known id or identifier
6
- * configured for the url and header expectations of most ActiveRecord APIs.
7
- *
8
- * **Basic Usage**
9
- *
10
- * ```ts
11
- * import { findRecord } from '@warp-drive-mirror/utilities/active-record';
12
- *
13
- * const data = await store.request(findRecord('person', '1'));
14
- * ```
15
- *
16
- * **With Options**
17
- *
18
- * ```ts
19
- * import { findRecord } from '@warp-drive-mirror/utilities/active-record';
20
- *
21
- * const options = findRecord('person', '1', { include: ['pets', 'friends'] });
22
- * const data = await store.request(options);
23
- * ```
24
- *
25
- * **With an Identifier**
26
- *
27
- * ```ts
28
- * import { findRecord } from '@warp-drive-mirror/utilities/active-record';
29
- *
30
- * const options = findRecord({ type: 'person', id: '1' }, { include: ['pets', 'friends'] });
31
- * const data = await store.request(options);
32
- * ```
33
- *
34
- * **Supplying Options to Modify the Request Behavior**
35
- *
36
- * The following options are supported:
37
- *
38
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
39
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
40
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and underscoring the supplied type
41
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
42
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
43
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
44
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
45
- * defaulting to `false` if none is configured.
46
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
47
- *
48
- * ```ts
49
- * import { findRecord } from '@warp-drive-mirror/utilities/active-record';
50
- *
51
- * const options = findRecord('person', '1', { include: ['pets', 'friends'] }, { namespace: 'api/v2' });
52
- * const data = await store.request(options);
53
- * ```
54
- *
55
- * @public
56
- * @param identifier
57
- * @param options
58
- */
59
- export declare function findRecord<T>(identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>>, options?: FindRecordOptions): FindRecordRequestOptions<ReactiveDataDocument<T>, T>;
60
- export declare function findRecord(identifier: RemotelyAccessibleIdentifier, options?: FindRecordOptions): FindRecordRequestOptions;
61
- export declare function findRecord<T>(type: TypeFromInstance<T>, id: string, options?: FindRecordOptions): FindRecordRequestOptions<ReactiveDataDocument<T>, T>;
62
- export declare function findRecord(type: string, id: string, options?: FindRecordOptions): FindRecordRequestOptions;
63
- /** @deprecated use {@link ReactiveDataDocument} instead */
64
- export type FindRecordResultDocument<T> = ReactiveDataDocument<T>;
@@ -1,53 +0,0 @@
1
- import type { ReactiveDataDocument } from "@warp-drive-mirror/core/reactive";
2
- import type { QueryParamsSource } from "@warp-drive-mirror/core/types/params";
3
- import type { TypeFromInstance } from "@warp-drive-mirror/core/types/record";
4
- import type { ConstrainedRequestOptions, QueryRequestOptions } from "@warp-drive-mirror/core/types/request";
5
- /**
6
- * Builds request options to query for resources, usually by a primary
7
- * type, configured for the url and header expectations of most ActiveRecord APIs.
8
- *
9
- * **Basic Usage**
10
- *
11
- * ```ts
12
- * import { query } from '@warp-drive-mirror/utilities/active-record';
13
- *
14
- * const data = await store.request(query('person'));
15
- * ```
16
- *
17
- * **With Query Params**
18
- *
19
- * ```ts
20
- * import { query } from '@warp-drive-mirror/utilities/active-record';
21
- *
22
- * const options = query('person', { include: ['pets', 'friends'] });
23
- * const data = await store.request(options);
24
- * ```
25
- *
26
- * **Supplying Options to Modify the Request Behavior**
27
- *
28
- * The following options are supported:
29
- *
30
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
31
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
32
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and underscoring the supplied type
33
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
34
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
35
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
36
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
37
- * defaulting to `false` if none is configured.
38
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
39
- *
40
- * ```ts
41
- * import { query } from '@warp-drive-mirror/utilities/active-record';
42
- *
43
- * const options = query('person', { include: ['pets', 'friends'] }, { reload: true });
44
- * const data = await store.request(options);
45
- * ```
46
- *
47
- * @public
48
- * @param identifier
49
- * @param query
50
- * @param options
51
- */
52
- export declare function query<T>(type: TypeFromInstance<T>, query?: QueryParamsSource, options?: ConstrainedRequestOptions): QueryRequestOptions<ReactiveDataDocument<T[]>>;
53
- export declare function query(type: string, query?: QueryParamsSource, options?: ConstrainedRequestOptions): QueryRequestOptions;
@@ -1,146 +0,0 @@
1
- import type { ReactiveDataDocument } from "@warp-drive-mirror/core/reactive";
2
- import type { TypedRecordInstance } from "@warp-drive-mirror/core/types/record";
3
- import type { ConstrainedRequestOptions, CreateRequestOptions, DeleteRequestOptions, UpdateRequestOptions } from "@warp-drive-mirror/core/types/request";
4
- /**
5
- * Builds request options to delete record for resources,
6
- * configured for the url, method and header expectations of ActiveRecord APIs.
7
- *
8
- * **Basic Usage**
9
- *
10
- * ```ts
11
- * import { deleteRecord } from '@warp-drive-mirror/utilities/active-record';
12
- *
13
- * const person = store.peekRecord('person', '1');
14
- *
15
- * // mark record as deleted
16
- * store.deleteRecord(person);
17
- *
18
- * // persist deletion
19
- * const data = await store.request(deleteRecord(person));
20
- * ```
21
- *
22
- * **Supplying Options to Modify the Request Behavior**
23
- *
24
- * The following options are supported:
25
- *
26
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
27
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
28
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
29
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
30
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
31
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
32
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
33
- * defaulting to `false` if none is configured.
34
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
35
- *
36
- * ```ts
37
- * import { deleteRecord } from '@warp-drive-mirror/utilities/active-record';
38
- *
39
- * const person = store.peekRecord('person', '1');
40
- *
41
- * // mark record as deleted
42
- * store.deleteRecord(person);
43
- *
44
- * // persist deletion
45
- * const options = deleteRecord(person, { namespace: 'api/v1' });
46
- * const data = await store.request(options);
47
- * ```
48
- *
49
- * @public
50
- * @param record
51
- * @param options
52
- */
53
- export declare function deleteRecord<T>(record: T, options?: ConstrainedRequestOptions): DeleteRequestOptions<T>;
54
- export declare function deleteRecord(record: unknown, options?: ConstrainedRequestOptions): DeleteRequestOptions;
55
- /**
56
- * Builds request options to create new record for resources,
57
- * configured for the url, method and header expectations of most ActiveRecord APIs.
58
- *
59
- * **Basic Usage**
60
- *
61
- * ```ts
62
- * import { createRecord } from '@warp-drive-mirror/utilities/active-record';
63
- *
64
- * const person = store.createRecord('person', { name: 'Ted' });
65
- * const data = await store.request(createRecord(person));
66
- * ```
67
- *
68
- * **Supplying Options to Modify the Request Behavior**
69
- *
70
- * The following options are supported:
71
- *
72
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
73
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
74
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
75
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
76
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
77
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
78
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
79
- * defaulting to `false` if none is configured.
80
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
81
- *
82
- * ```ts
83
- * import { createRecord } from '@warp-drive-mirror/utilities/active-record';
84
- *
85
- * const person = store.createRecord('person', { name: 'Ted' });
86
- * const options = createRecord(person, { namespace: 'api/v1' });
87
- * const data = await store.request(options);
88
- * ```
89
- *
90
- * @public
91
- * @param record
92
- * @param options
93
- */
94
- export declare function createRecord<T>(record: T, options?: ConstrainedRequestOptions): CreateRequestOptions<T>;
95
- export declare function createRecord(record: unknown, options?: ConstrainedRequestOptions): CreateRequestOptions;
96
- /**
97
- * Builds request options to update existing record for resources,
98
- * configured for the url, method and header expectations of most ActiveRecord APIs.
99
- *
100
- * **Basic Usage**
101
- *
102
- * ```ts
103
- * import { updateRecord } from '@warp-drive-mirror/utilities/active-record';
104
- *
105
- * const person = store.peekRecord('person', '1');
106
- * person.name = 'Chris';
107
- * const data = await store.request(updateRecord(person));
108
- * ```
109
- *
110
- * **Supplying Options to Modify the Request Behavior**
111
- *
112
- * The following options are supported:
113
- *
114
- * - `patch` - Allows caller to specify whether to use a PATCH request instead of a PUT request, defaults to `false`.
115
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
116
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
117
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
118
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
119
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
120
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
121
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
122
- * defaulting to `false` if none is configured.
123
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
124
- *
125
- * ```ts
126
- * import { updateRecord } from '@warp-drive-mirror/utilities/active-record';
127
- *
128
- * const person = store.peekRecord('person', '1');
129
- * person.name = 'Chris';
130
- * const options = updateRecord(person, { patch: true });
131
- * const data = await store.request(options);
132
- * ```
133
- *
134
- * @public
135
- * @param record
136
- * @param options
137
- */
138
- export declare function updateRecord<
139
- T extends TypedRecordInstance,
140
- RT extends TypedRecordInstance = T
141
- >(record: T, options?: ConstrainedRequestOptions & {
142
- patch?: boolean;
143
- }): UpdateRequestOptions<ReactiveDataDocument<RT>, T>;
144
- export declare function updateRecord(record: unknown, options?: ConstrainedRequestOptions & {
145
- patch?: boolean;
146
- }): UpdateRequestOptions;
@@ -1,4 +0,0 @@
1
- import type { CacheOptions, ConstrainedRequestOptions } from "@warp-drive-mirror/core/types/request";
2
- import type { UrlOptions } from "../index.js";
3
- export declare function copyForwardUrlOptions(urlOptions: UrlOptions, options: ConstrainedRequestOptions): void;
4
- export declare function extractCacheOptions(options: ConstrainedRequestOptions): CacheOptions;
@@ -1,158 +0,0 @@
1
- import type { Future, Handler, NextFn } from "@warp-drive-mirror/core/request";
2
- import type { RequestContext } from "@warp-drive-mirror/core/types/request";
3
- /**
4
- * Whether the browser supports `ReadableStream` as a request body
5
- * in a `POST` request.
6
- *
7
- * @group Constants
8
- */
9
- export declare const SupportsRequestStreams: boolean;
10
- interface Constraints {
11
- /**
12
- * The minimum size at which to compress blobs
13
- *
14
- * @default 1000
15
- */
16
- Blob?: number;
17
- /**
18
- * The minimum size at which to compress array buffers
19
- *
20
- * @default 1000
21
- */
22
- ArrayBuffer?: number;
23
- /**
24
- * The minimum size at which to compress typed arrays
25
- *
26
- * @default 1000
27
- */
28
- TypedArray?: number;
29
- /**
30
- * The minimum size at which to compress data views
31
- *
32
- * @default 1000
33
- */
34
- DataView?: number;
35
- /**
36
- * The minimum size at which to compress strings
37
- *
38
- * @default 1000
39
- */
40
- String?: number;
41
- }
42
- /**
43
- * Options for configuring the AutoCompress handler.
44
- *
45
- */
46
- interface CompressionOptions {
47
- /**
48
- * The compression format to use. Must be a valid
49
- * compression format supported by [CompressionStream](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)
50
- *
51
- * The default is `gzip`.
52
- *
53
- */
54
- format?: CompressionFormat;
55
- /**
56
- * Some browsers support `ReadableStream` as a request body. This option
57
- * enables passing the compression stream as the request body instead of
58
- * the final compressed body when the browser supports doing so.
59
- *
60
- * This comes with several caveats:
61
- *
62
- * - the request will be put into `duplex: 'half'` mode. This should be
63
- * transparent to you, but it is worth noting.
64
- * - the request mode cannot be `no-cors` as requests with a `ReadableStream`
65
- * have no content length and thus are a new form of request that triggers
66
- * cors requirements and a preflight request.
67
- * - http/1.x is not supported.
68
- *
69
- * For additional reading about the restrictions of using `ReadableStream`
70
- * as a request body, see the [Chromium Documentation](https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests#restrictions)
71
- *
72
- * Streaming can be enabled per-request in browsers which support it by
73
- * setting `request.options.allowStreaming` to `true`.
74
- *
75
- * Streaming can be forced even when the browser does not support it by setting
76
- * `request.options.forceStreaming` to `true`. This is useful if later handlers
77
- * in the chain can handle the request body as a stream.
78
- *
79
- * @default false
80
- */
81
- allowStreaming?: boolean;
82
- /**
83
- * If `true`, the request will be forced into streaming mode even
84
- * if the browser does not support it. This is useful if later handlers
85
- * in the chain can handle the request body as a stream.
86
- *
87
- * @default false
88
- */
89
- forceStreaming?: boolean;
90
- /**
91
- * The constraints for the request body. This is used to determine
92
- * whether to compress the request body or not.
93
- *
94
- * The defaults are:
95
- *
96
- * ```ts
97
- * {
98
- * Blob: 1000, // blob.size
99
- * ArrayBuffer: 1000, // buffer.byteLength
100
- * TypedArray: 1000, // array.byteLength
101
- * DataView: 1000, // view.byteLength
102
- * String: 1000, // string.length
103
- * }
104
- * ```
105
- *
106
- * The following body types are never compressed unless explicitly
107
- * configured by the request:
108
- * - `FormData`
109
- * - `URLSearchParams`
110
- * - `ReadableStream`
111
- *
112
- * A request.options.compress value of `false` will disable
113
- * compression for a request body of any type. While a value of
114
- * `true` will enable compression for the request.
115
- *
116
- * An undefined value will use the default, a value of `0` will
117
- * enable compression for all values, and a value of `-1` will
118
- * disable compression.
119
- *
120
- */
121
- constraints?: Constraints;
122
- }
123
- /**
124
- * A request handler that automatically compresses the request body
125
- * if the request body is a string, array buffer, blob, or form data.
126
- *
127
- * This uses the [CompressionStream API](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)
128
- *
129
- * The compression format as well as the kinds of data to compress can be
130
- * configured using the `format` and `constraints` options.
131
- *
132
- * ```diff
133
- * +import { AutoCompress } from '@ember-data-mirror/request-utils/handlers';
134
- * import Fetch from '@ember-data-mirror/request/fetch';
135
- * import RequestManager from '@ember-data-mirror/request';
136
- * import Store from '@ember-data-mirror/store';
137
- *
138
- * class AppStore extends Store {
139
- * requestManager = new RequestManager()
140
- * .use([
141
- * + new AutoCompress(),
142
- * Fetch
143
- * ]);
144
- * }
145
- * ```
146
- *
147
- * @group Handlers
148
- * @public
149
- * @since 5.5.0
150
- */
151
- export declare class AutoCompress implements Handler {
152
- options: Required<CompressionOptions> & {
153
- constraints: Required<Constraints>;
154
- };
155
- constructor(options?: CompressionOptions);
156
- request<T>({ request }: RequestContext, next: NextFn<T>): Promise<T> | Future<T>;
157
- }
158
- export {};
@@ -1,19 +0,0 @@
1
- import type { Future, Handler, NextFn } from "@warp-drive-mirror/core/request";
2
- import type { RequestContext, StructuredDataDocument } from "@warp-drive-mirror/core/types/request";
3
- /**
4
- * If CheckFn returns true, the wrapped handler will be used.
5
- * If CheckFn returns false, the wrapped handler will be skipped.
6
- */
7
- type CheckFn = (context: RequestContext) => boolean;
8
- /**
9
- *
10
- * @group Handlers
11
- * @public
12
- */
13
- export declare class Gate implements Handler {
14
- handler: Handler;
15
- checkFn: CheckFn;
16
- constructor(handler: Handler, checkFn: CheckFn);
17
- request<T = unknown>(context: RequestContext, next: NextFn<T>): Promise<T | StructuredDataDocument<T>> | Future<T>;
18
- }
19
- export {};