@ember-data-mirror/request-utils 5.4.0-alpha.129 → 5.4.0-alpha.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deprecation-support.js +1 -1
- package/dist/index.js +31 -31
- package/dist/inflect-8aYUyMN7.js +7 -7
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { deprecate } from '@ember/debug';
|
|
2
2
|
import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
|
|
3
3
|
import { m as defaultRules, b as plural, a as singular, i as irregular, u as uncountable } from "./inflect-8aYUyMN7.js";
|
|
4
|
-
if (macroCondition(getGlobalConfig().
|
|
4
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_EMBER_INFLECTOR)) {
|
|
5
5
|
if (macroCondition(dependencySatisfies('ember-inflector', '*'))) {
|
|
6
6
|
const Inflector = importSync('ember-inflector').default;
|
|
7
7
|
const {
|
package/dist/index.js
CHANGED
|
@@ -89,29 +89,29 @@ const CONFIG = {
|
|
|
89
89
|
* @return void
|
|
90
90
|
*/
|
|
91
91
|
function setBuildURLConfig(config) {
|
|
92
|
-
macroCondition(getGlobalConfig().
|
|
92
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
93
93
|
if (!test) {
|
|
94
94
|
throw new Error(`setBuildURLConfig: You must pass a config object`);
|
|
95
95
|
}
|
|
96
96
|
})(config) : {};
|
|
97
|
-
macroCondition(getGlobalConfig().
|
|
97
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
98
98
|
if (!test) {
|
|
99
99
|
throw new Error(`setBuildURLConfig: You must pass a config object with a 'host' or 'namespace' property`);
|
|
100
100
|
}
|
|
101
101
|
})('host' in config || 'namespace' in config) : {};
|
|
102
102
|
CONFIG.host = config.host || '';
|
|
103
103
|
CONFIG.namespace = config.namespace || '';
|
|
104
|
-
macroCondition(getGlobalConfig().
|
|
104
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
105
105
|
if (!test) {
|
|
106
106
|
throw new Error(`buildBaseURL: host must NOT end with '/', received '${CONFIG.host}'`);
|
|
107
107
|
}
|
|
108
108
|
})(CONFIG.host === '/' || !CONFIG.host.endsWith('/')) : {};
|
|
109
|
-
macroCondition(getGlobalConfig().
|
|
109
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
110
110
|
if (!test) {
|
|
111
111
|
throw new Error(`buildBaseURL: namespace must NOT start with '/', received '${CONFIG.namespace}'`);
|
|
112
112
|
}
|
|
113
113
|
})(!CONFIG.namespace.startsWith('/')) : {};
|
|
114
|
-
macroCondition(getGlobalConfig().
|
|
114
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
115
115
|
if (!test) {
|
|
116
116
|
throw new Error(`buildBaseURL: namespace must NOT end with '/', received '${CONFIG.namespace}'`);
|
|
117
117
|
}
|
|
@@ -125,7 +125,7 @@ function hasResourcePath(options) {
|
|
|
125
125
|
return 'resourcePath' in options && typeof options.resourcePath === 'string' && options.resourcePath.length > 0;
|
|
126
126
|
}
|
|
127
127
|
function resourcePathForType(options) {
|
|
128
|
-
macroCondition(getGlobalConfig().
|
|
128
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
129
129
|
if (!test) {
|
|
130
130
|
throw new Error(`resourcePathForType: You must pass a valid op as part of options`);
|
|
131
131
|
}
|
|
@@ -179,37 +179,37 @@ function buildBaseURL(urlOptions) {
|
|
|
179
179
|
host: CONFIG.host,
|
|
180
180
|
namespace: CONFIG.namespace
|
|
181
181
|
}, urlOptions);
|
|
182
|
-
macroCondition(getGlobalConfig().
|
|
182
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
183
183
|
if (!test) {
|
|
184
184
|
throw new Error(`buildBaseURL: You must pass \`op\` as part of options`);
|
|
185
185
|
}
|
|
186
186
|
})(hasResourcePath(options) || typeof options.op === 'string' && options.op.length > 0) : {};
|
|
187
|
-
macroCondition(getGlobalConfig().
|
|
187
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
188
188
|
if (!test) {
|
|
189
189
|
throw new Error(`buildBaseURL: You must pass \`identifier\` as part of options`);
|
|
190
190
|
}
|
|
191
191
|
})(hasResourcePath(options) || options.op === 'findMany' || options.identifier && typeof options.identifier === 'object') : {};
|
|
192
|
-
macroCondition(getGlobalConfig().
|
|
192
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
193
193
|
if (!test) {
|
|
194
194
|
throw new Error(`buildBaseURL: You must pass \`identifiers\` as part of options`);
|
|
195
195
|
}
|
|
196
196
|
})(hasResourcePath(options) || options.op !== 'findMany' || options.identifiers && Array.isArray(options.identifiers) && options.identifiers.length > 0 && options.identifiers.every(i => i && typeof i === 'object')) : {};
|
|
197
|
-
macroCondition(getGlobalConfig().
|
|
197
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
198
198
|
if (!test) {
|
|
199
199
|
throw new Error(`buildBaseURL: You must pass valid \`identifier\` as part of options, expected 'id'`);
|
|
200
200
|
}
|
|
201
201
|
})(hasResourcePath(options) || !isOperationWithPrimaryRecord(options) || typeof options.identifier.id === 'string' && options.identifier.id.length > 0) : {};
|
|
202
|
-
macroCondition(getGlobalConfig().
|
|
202
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
203
203
|
if (!test) {
|
|
204
204
|
throw new Error(`buildBaseURL: You must pass \`identifiers\` as part of options`);
|
|
205
205
|
}
|
|
206
206
|
})(hasResourcePath(options) || options.op !== 'findMany' || options.identifiers.every(i => typeof i.id === 'string' && i.id.length > 0)) : {};
|
|
207
|
-
macroCondition(getGlobalConfig().
|
|
207
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
208
208
|
if (!test) {
|
|
209
209
|
throw new Error(`buildBaseURL: You must pass valid \`identifier\` as part of options, expected 'type'`);
|
|
210
210
|
}
|
|
211
211
|
})(hasResourcePath(options) || options.op === 'findMany' || typeof options.identifier.type === 'string' && options.identifier.type.length > 0) : {};
|
|
212
|
-
macroCondition(getGlobalConfig().
|
|
212
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
213
213
|
if (!test) {
|
|
214
214
|
throw new Error(`buildBaseURL: You must pass valid \`identifiers\` as part of options, expected 'type'`);
|
|
215
215
|
}
|
|
@@ -223,52 +223,52 @@ function buildBaseURL(urlOptions) {
|
|
|
223
223
|
namespace
|
|
224
224
|
} = options;
|
|
225
225
|
const fieldPath = 'fieldPath' in options ? options.fieldPath : '';
|
|
226
|
-
macroCondition(getGlobalConfig().
|
|
226
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
227
227
|
if (!test) {
|
|
228
228
|
throw new Error(`buildBaseURL: You tried to build a url for a ${String('op' in options ? options.op + ' ' : '')}request to ${resourcePath} but resourcePath must be set or op must be one of "${['findRecord', 'findRelatedRecord', 'findRelatedCollection', 'updateRecord', 'deleteRecord', 'createRecord', 'query', 'findMany'].join('","')}".`);
|
|
229
229
|
}
|
|
230
230
|
})(hasResourcePath(options) || ['findRecord', 'query', 'findMany', 'findRelatedCollection', 'findRelatedRecord', 'createRecord', 'updateRecord', 'deleteRecord'].includes(options.op)) : {};
|
|
231
|
-
macroCondition(getGlobalConfig().
|
|
231
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
232
232
|
if (!test) {
|
|
233
233
|
throw new Error(`buildBaseURL: host must NOT end with '/', received '${host}'`);
|
|
234
234
|
}
|
|
235
235
|
})(host === '/' || !host.endsWith('/')) : {};
|
|
236
|
-
macroCondition(getGlobalConfig().
|
|
236
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
237
237
|
if (!test) {
|
|
238
238
|
throw new Error(`buildBaseURL: namespace must NOT start with '/', received '${namespace}'`);
|
|
239
239
|
}
|
|
240
240
|
})(!namespace.startsWith('/')) : {};
|
|
241
|
-
macroCondition(getGlobalConfig().
|
|
241
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
242
242
|
if (!test) {
|
|
243
243
|
throw new Error(`buildBaseURL: namespace must NOT end with '/', received '${namespace}'`);
|
|
244
244
|
}
|
|
245
245
|
})(!namespace.endsWith('/')) : {};
|
|
246
|
-
macroCondition(getGlobalConfig().
|
|
246
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
247
247
|
if (!test) {
|
|
248
248
|
throw new Error(`buildBaseURL: resourcePath must NOT start with '/', received '${resourcePath}'`);
|
|
249
249
|
}
|
|
250
250
|
})(!resourcePath.startsWith('/')) : {};
|
|
251
|
-
macroCondition(getGlobalConfig().
|
|
251
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
252
252
|
if (!test) {
|
|
253
253
|
throw new Error(`buildBaseURL: resourcePath must NOT end with '/', received '${resourcePath}'`);
|
|
254
254
|
}
|
|
255
255
|
})(!resourcePath.endsWith('/')) : {};
|
|
256
|
-
macroCondition(getGlobalConfig().
|
|
256
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
257
257
|
if (!test) {
|
|
258
258
|
throw new Error(`buildBaseURL: fieldPath must NOT start with '/', received '${fieldPath}'`);
|
|
259
259
|
}
|
|
260
260
|
})(!fieldPath.startsWith('/')) : {};
|
|
261
|
-
macroCondition(getGlobalConfig().
|
|
261
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
262
262
|
if (!test) {
|
|
263
263
|
throw new Error(`buildBaseURL: fieldPath must NOT end with '/', received '${fieldPath}'`);
|
|
264
264
|
}
|
|
265
265
|
})(!fieldPath.endsWith('/')) : {};
|
|
266
|
-
macroCondition(getGlobalConfig().
|
|
266
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
267
267
|
if (!test) {
|
|
268
268
|
throw new Error(`buildBaseURL: idPath must NOT start with '/', received '${idPath}'`);
|
|
269
269
|
}
|
|
270
270
|
})(!idPath.startsWith('/')) : {};
|
|
271
|
-
macroCondition(getGlobalConfig().
|
|
271
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
272
272
|
if (!test) {
|
|
273
273
|
throw new Error(`buildBaseURL: idPath must NOT end with '/', received '${idPath}'`);
|
|
274
274
|
}
|
|
@@ -281,7 +281,7 @@ const DEFAULT_QUERY_PARAMS_SERIALIZATION_OPTIONS = {
|
|
|
281
281
|
arrayFormat: 'comma'
|
|
282
282
|
};
|
|
283
283
|
function handleInclude(include) {
|
|
284
|
-
macroCondition(getGlobalConfig().
|
|
284
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
285
285
|
if (!test) {
|
|
286
286
|
throw new Error(`Expected include to be a string or array, got ${typeof include}`);
|
|
287
287
|
}
|
|
@@ -453,7 +453,7 @@ function parseCacheControl(header) {
|
|
|
453
453
|
const cacheControlValue = {};
|
|
454
454
|
function parseCacheControlValue(stringToParse) {
|
|
455
455
|
const parsedValue = Number.parseInt(stringToParse);
|
|
456
|
-
macroCondition(getGlobalConfig().
|
|
456
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
457
457
|
if (!test) {
|
|
458
458
|
throw new Error(`Invalid Cache-Control value, expected a number but got - ${stringToParse}`);
|
|
459
459
|
}
|
|
@@ -463,12 +463,12 @@ function parseCacheControl(header) {
|
|
|
463
463
|
for (let i = 0; i < header.length; i++) {
|
|
464
464
|
const char = header.charAt(i);
|
|
465
465
|
if (char === ',') {
|
|
466
|
-
macroCondition(getGlobalConfig().
|
|
466
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
467
467
|
if (!test) {
|
|
468
468
|
throw new Error(`Invalid Cache-Control value, expected a value`);
|
|
469
469
|
}
|
|
470
470
|
})(!isParsingKey || !NUMERIC_KEYS.has(key)) : {};
|
|
471
|
-
macroCondition(getGlobalConfig().
|
|
471
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
472
472
|
if (!test) {
|
|
473
473
|
throw new Error(`Invalid Cache-Control value, expected a value after "=" but got ","`);
|
|
474
474
|
}
|
|
@@ -480,7 +480,7 @@ function parseCacheControl(header) {
|
|
|
480
480
|
value = '';
|
|
481
481
|
continue;
|
|
482
482
|
} else if (char === '=') {
|
|
483
|
-
macroCondition(getGlobalConfig().
|
|
483
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
484
484
|
if (!test) {
|
|
485
485
|
throw new Error(`Invalid Cache-Control value, expected a value after "="`);
|
|
486
486
|
}
|
|
@@ -588,17 +588,17 @@ class CachePolicy {
|
|
|
588
588
|
for: '@ember-data-mirror/request-utils',
|
|
589
589
|
until: '6.0'
|
|
590
590
|
});
|
|
591
|
-
macroCondition(getGlobalConfig().
|
|
591
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
592
592
|
if (!test) {
|
|
593
593
|
throw new Error(`You must pass a config to the CachePolicy`);
|
|
594
594
|
}
|
|
595
595
|
})(_config) : {};
|
|
596
|
-
macroCondition(getGlobalConfig().
|
|
596
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
597
597
|
if (!test) {
|
|
598
598
|
throw new Error(`You must pass a apiCacheSoftExpires to the CachePolicy`);
|
|
599
599
|
}
|
|
600
600
|
})(typeof _config.apiCacheSoftExpires === 'number') : {};
|
|
601
|
-
macroCondition(getGlobalConfig().
|
|
601
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
602
602
|
if (!test) {
|
|
603
603
|
throw new Error(`You must pass a apiCacheHardExpires to the CachePolicy`);
|
|
604
604
|
}
|
package/dist/inflect-8aYUyMN7.js
CHANGED
|
@@ -13,7 +13,7 @@ class LRUCache {
|
|
|
13
13
|
this.size = size || DEFAULT_MAX_CACHE_SIZE;
|
|
14
14
|
this.state = new Map();
|
|
15
15
|
this.doWork = doWork;
|
|
16
|
-
if (macroCondition(getGlobalConfig().
|
|
16
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
17
17
|
this._hits = 0;
|
|
18
18
|
this._misses = 0;
|
|
19
19
|
this._ejected = 0;
|
|
@@ -22,14 +22,14 @@ class LRUCache {
|
|
|
22
22
|
get(key) {
|
|
23
23
|
const value = this.state.get(key);
|
|
24
24
|
if (value) {
|
|
25
|
-
if (macroCondition(getGlobalConfig().
|
|
25
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
26
26
|
this._hits++;
|
|
27
27
|
}
|
|
28
28
|
this.state.delete(key);
|
|
29
29
|
this.state.set(key, value);
|
|
30
30
|
return value;
|
|
31
31
|
}
|
|
32
|
-
if (macroCondition(getGlobalConfig().
|
|
32
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
33
33
|
this._misses++;
|
|
34
34
|
}
|
|
35
35
|
const newValue = this.doWork(key);
|
|
@@ -39,7 +39,7 @@ class LRUCache {
|
|
|
39
39
|
set(key, value) {
|
|
40
40
|
if (this.state.size === this.size) {
|
|
41
41
|
for (const [k] of this.state) {
|
|
42
|
-
if (macroCondition(getGlobalConfig().
|
|
42
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
43
43
|
this._ejected++;
|
|
44
44
|
}
|
|
45
45
|
this.state.delete(k);
|
|
@@ -50,7 +50,7 @@ class LRUCache {
|
|
|
50
50
|
}
|
|
51
51
|
clear() {
|
|
52
52
|
this.state.clear();
|
|
53
|
-
if (macroCondition(getGlobalConfig().
|
|
53
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
54
54
|
this._hits = 0;
|
|
55
55
|
this._misses = 0;
|
|
56
56
|
this._ejected = 0;
|
|
@@ -219,7 +219,7 @@ function clearRules() {
|
|
|
219
219
|
PLURAL_RULES.clear();
|
|
220
220
|
}
|
|
221
221
|
function singularize(word) {
|
|
222
|
-
macroCondition(getGlobalConfig().
|
|
222
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
223
223
|
if (!test) {
|
|
224
224
|
throw new Error(`singularize expects to receive a non-empty string`);
|
|
225
225
|
}
|
|
@@ -228,7 +228,7 @@ function singularize(word) {
|
|
|
228
228
|
return SINGULARS.get(word);
|
|
229
229
|
}
|
|
230
230
|
function pluralize(word) {
|
|
231
|
-
macroCondition(getGlobalConfig().
|
|
231
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
232
232
|
if (!test) {
|
|
233
233
|
throw new Error(`pluralize expects to receive a non-empty string`);
|
|
234
234
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data-mirror/request-utils",
|
|
3
3
|
"description": "Request Building Utilities for use with EmberData",
|
|
4
|
-
"version": "5.4.0-alpha.
|
|
4
|
+
"version": "5.4.0-alpha.131",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Chris Thoburn <runspired@users.noreply.github.com>",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"ember-source": "3.28.12 || ^4.0.4 || ^5.0.0 || ^6.0.0",
|
|
48
48
|
"@ember/string": "^3.1.1 || ^4.0.0",
|
|
49
|
-
"@warp-drive-mirror/core-types": "5.4.0-alpha.
|
|
49
|
+
"@warp-drive-mirror/core-types": "5.4.0-alpha.131",
|
|
50
50
|
"ember-inflector": "^4.0.2 || ^5.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@embroider/macros": "^1.16.6",
|
|
62
|
-
"@warp-drive-mirror/build-config": "5.4.0-alpha.
|
|
62
|
+
"@warp-drive-mirror/build-config": "5.4.0-alpha.131"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@babel/core": "^7.24.5",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"@babel/preset-typescript": "^7.24.1",
|
|
69
69
|
"@glimmer/component": "^1.1.2",
|
|
70
70
|
"@ember/string": "3.1.1",
|
|
71
|
-
"@warp-drive-mirror/core-types": "5.4.0-alpha.
|
|
72
|
-
"@warp-drive/internal-config": "5.4.0-alpha.
|
|
71
|
+
"@warp-drive-mirror/core-types": "5.4.0-alpha.131",
|
|
72
|
+
"@warp-drive/internal-config": "5.4.0-alpha.131",
|
|
73
73
|
"ember-source": "~5.12.0",
|
|
74
74
|
"ember-inflector": "4.0.3",
|
|
75
75
|
"pnpm-sync-dependencies-meta-injected": "0.0.14",
|