@ember-data-mirror/request-utils 5.4.0-beta.9 → 5.4.1-beta.0
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/LICENSE.md +19 -7
- package/README.md +2 -2
- package/dist/deprecation-support.js +26 -17
- package/dist/deprecation-support.js.map +1 -1
- package/dist/index.js +45 -41
- package/dist/index.js.map +1 -1
- package/dist/{inflect-CuaHncAE.js → inflect-8aYUyMN7.js} +8 -8
- package/dist/{inflect-CuaHncAE.js.map → inflect-8aYUyMN7.js.map} +1 -1
- package/dist/string.js +1 -1
- package/logos/NCC-1701-a-blue.svg +4 -0
- package/logos/NCC-1701-a-gold.svg +4 -0
- package/logos/NCC-1701-a-gold_100.svg +1 -0
- package/logos/NCC-1701-a-gold_base-64.txt +1 -0
- package/logos/NCC-1701-a.svg +4 -0
- package/logos/README.md +4 -0
- package/logos/docs-badge.svg +2 -0
- package/logos/ember-data-logo-dark.svg +12 -0
- package/logos/ember-data-logo-light.svg +12 -0
- package/logos/github-header.svg +444 -0
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +4 -0
- package/logos/warp-drive-logo-gold.svg +4 -0
- package/package.json +35 -33
- package/unstable-preview-types/index.d.ts +30 -6
- package/unstable-preview-types/index.d.ts.map +1 -1
package/LICENSE.md
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Copyright (c) 2017-2025 Ember.js and contributors
|
|
4
|
+
Copyright (c) 2011-2017 Tilde, Inc. and contributors
|
|
5
|
+
Copyright (c) 2011 LivingSocial Inc.
|
|
6
6
|
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
8
13
|
|
|
9
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
10
16
|
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<img
|
|
3
3
|
class="project-logo"
|
|
4
|
-
src="./ember-data-logo-dark.svg#gh-dark-mode-only"
|
|
4
|
+
src="./logos/ember-data-logo-dark.svg#gh-dark-mode-only"
|
|
5
5
|
alt="EmberData RequestUtils"
|
|
6
6
|
width="240px"
|
|
7
7
|
title="EmberData RequestUtils"
|
|
8
8
|
/>
|
|
9
9
|
<img
|
|
10
10
|
class="project-logo"
|
|
11
|
-
src="./ember-data-logo-light.svg#gh-light-mode-only"
|
|
11
|
+
src="./logos/ember-data-logo-light.svg#gh-light-mode-only"
|
|
12
12
|
alt="EmberData RequestUtils"
|
|
13
13
|
width="240px"
|
|
14
14
|
title="EmberData RequestUtils"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { deprecate } from '@ember/debug';
|
|
2
2
|
import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
|
|
3
|
-
import { b as plural, a as singular, i as irregular, u as uncountable } from "./inflect-
|
|
4
|
-
if (macroCondition(getGlobalConfig().
|
|
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().WarpDriveMirror.deprecations.DEPRECATE_EMBER_INFLECTOR)) {
|
|
5
5
|
if (macroCondition(dependencySatisfies('ember-inflector', '*'))) {
|
|
6
6
|
const Inflector = importSync('ember-inflector').default;
|
|
7
7
|
const {
|
|
@@ -19,18 +19,27 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
19
19
|
|
|
20
20
|
// copy over any already registered rules
|
|
21
21
|
|
|
22
|
+
// ember-inflector mutates the default rules arrays
|
|
23
|
+
// with user supplied rules, so we keep track of what
|
|
24
|
+
// is default via our own list.
|
|
25
|
+
const defaultPluralKeys = new Set();
|
|
26
|
+
const defaultSingularKeys = new Set();
|
|
27
|
+
defaultRules.plurals.forEach(([regex]) => {
|
|
28
|
+
defaultPluralKeys.add(regex.toString());
|
|
29
|
+
});
|
|
30
|
+
defaultRules.singular.forEach(([regex]) => {
|
|
31
|
+
defaultSingularKeys.add(regex.toString());
|
|
32
|
+
});
|
|
22
33
|
const {
|
|
23
|
-
defaultRules
|
|
34
|
+
defaultRules: defaultRules$1
|
|
24
35
|
} = Inflector;
|
|
25
36
|
const {
|
|
26
37
|
rules
|
|
27
38
|
} = inflector;
|
|
28
|
-
const pluralMap = new Map(defaultRules.plurals);
|
|
29
|
-
const singularMap = new Map(defaultRules.singular);
|
|
30
39
|
const irregularMap = new Map();
|
|
31
40
|
const toIgnore = new Set();
|
|
32
|
-
const uncountableSet = new Set(defaultRules.uncountable);
|
|
33
|
-
defaultRules.irregularPairs.forEach(([single, plur]) => {
|
|
41
|
+
const uncountableSet = new Set(defaultRules$1.uncountable);
|
|
42
|
+
defaultRules$1.irregularPairs.forEach(([single, plur]) => {
|
|
34
43
|
irregularMap.set(single.toLowerCase(), plur);
|
|
35
44
|
toIgnore.add(plur.toLowerCase());
|
|
36
45
|
});
|
|
@@ -42,7 +51,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
42
51
|
|
|
43
52
|
// load plurals
|
|
44
53
|
rules.plurals.forEach(([regex, replacement]) => {
|
|
45
|
-
if (
|
|
54
|
+
if (defaultPluralKeys.has(regex.toString())) {
|
|
46
55
|
return;
|
|
47
56
|
}
|
|
48
57
|
plural(regex, replacement);
|
|
@@ -52,7 +61,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
52
61
|
for: 'warp-drive',
|
|
53
62
|
since: {
|
|
54
63
|
enabled: '5.3.4',
|
|
55
|
-
available: '
|
|
64
|
+
available: '4.13'
|
|
56
65
|
},
|
|
57
66
|
url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector'
|
|
58
67
|
});
|
|
@@ -60,7 +69,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
60
69
|
|
|
61
70
|
// load singulars
|
|
62
71
|
rules.singular.forEach(([regex, replacement]) => {
|
|
63
|
-
if (
|
|
72
|
+
if (defaultSingularKeys.has(regex.toString())) {
|
|
64
73
|
return;
|
|
65
74
|
}
|
|
66
75
|
singular(regex, replacement);
|
|
@@ -70,7 +79,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
70
79
|
for: 'warp-drive',
|
|
71
80
|
since: {
|
|
72
81
|
enabled: '5.3.4',
|
|
73
|
-
available: '
|
|
82
|
+
available: '4.13'
|
|
74
83
|
},
|
|
75
84
|
url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector'
|
|
76
85
|
});
|
|
@@ -95,7 +104,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
95
104
|
for: 'warp-drive',
|
|
96
105
|
since: {
|
|
97
106
|
enabled: '5.3.4',
|
|
98
|
-
available: '
|
|
107
|
+
available: '4.13'
|
|
99
108
|
},
|
|
100
109
|
url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector'
|
|
101
110
|
});
|
|
@@ -113,7 +122,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
113
122
|
for: 'warp-drive',
|
|
114
123
|
since: {
|
|
115
124
|
enabled: '5.3.4',
|
|
116
|
-
available: '
|
|
125
|
+
available: '4.13'
|
|
117
126
|
},
|
|
118
127
|
url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector'
|
|
119
128
|
});
|
|
@@ -126,7 +135,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
126
135
|
for: 'warp-drive',
|
|
127
136
|
since: {
|
|
128
137
|
enabled: '5.3.4',
|
|
129
|
-
available: '
|
|
138
|
+
available: '4.13'
|
|
130
139
|
},
|
|
131
140
|
url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector'
|
|
132
141
|
});
|
|
@@ -140,7 +149,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
140
149
|
for: 'warp-drive',
|
|
141
150
|
since: {
|
|
142
151
|
enabled: '5.3.4',
|
|
143
|
-
available: '
|
|
152
|
+
available: '4.13'
|
|
144
153
|
},
|
|
145
154
|
url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector'
|
|
146
155
|
});
|
|
@@ -154,7 +163,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
154
163
|
for: 'warp-drive',
|
|
155
164
|
since: {
|
|
156
165
|
enabled: '5.3.4',
|
|
157
|
-
available: '
|
|
166
|
+
available: '4.13'
|
|
158
167
|
},
|
|
159
168
|
url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector'
|
|
160
169
|
});
|
|
@@ -168,7 +177,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_EMBER_INFL
|
|
|
168
177
|
for: 'warp-drive',
|
|
169
178
|
since: {
|
|
170
179
|
enabled: '5.3.4',
|
|
171
|
-
available: '
|
|
180
|
+
available: '4.13'
|
|
172
181
|
},
|
|
173
182
|
url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector'
|
|
174
183
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation-support.js","sources":["../src/deprecation-support.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { dependencySatisfies, importSync, macroCondition } from '@embroider/macros';\n\nimport { DEPRECATE_EMBER_INFLECTOR } from '@warp-drive-mirror/build-config/deprecations';\n\nimport { irregular, plural, singular, uncountable } from './string';\n\nif (DEPRECATE_EMBER_INFLECTOR) {\n if (macroCondition(dependencySatisfies('ember-inflector', '*'))) {\n const Inflector = (importSync('ember-inflector') as { default: typeof import('ember-inflector').default }).default;\n const { inflector } = Inflector;\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalPlural = inflector.plural;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSingular = inflector.singular;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalIrregular = inflector.irregular;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalUncountable = inflector.uncountable;\n\n // copy over any already registered rules\n type DefaultRules = {\n plurals: [RegExp, string][];\n singular: [RegExp, string][];\n irregularPairs: [string, string][];\n uncountable: string[];\n };\n type InternalRules = {\n plurals: [RegExp, string][];\n singular: [RegExp, string][];\n\n // [str1, str2] =>\n // { [str1.lower]: str2 }\n // { [str2.lower]: str2 }\n irregular: Record<string, string>;\n\n // [str1, str2] =>\n // { [str2.lower]: str1 }\n // { [str1.lower]: str1 }\n irregularInverse: Record<string, string>;\n\n // lower cased string\n uncountable: Record<string, boolean>;\n };\n const { defaultRules } = Inflector as unknown as { defaultRules: DefaultRules };\n const { rules } = inflector as unknown as { rules: InternalRules };\n\n const pluralMap = new Map(defaultRules.plurals);\n const singularMap = new Map(defaultRules.singular);\n const irregularMap = new Map<string, string>();\n const toIgnore = new Set<string>();\n const uncountableSet = new Set(defaultRules.uncountable);\n\n defaultRules.irregularPairs.forEach(([single, plur]) => {\n irregularMap.set(single.toLowerCase(), plur);\n toIgnore.add(plur.toLowerCase());\n });\n const irregularLookups = new Map<string, string>();\n Object.keys(rules.irregular).forEach((single) => {\n const plur = rules.irregular[single];\n irregularLookups.set(single, plur);\n });\n\n // load plurals\n rules.plurals.forEach(([regex, replacement]) => {\n if (pluralMap.has(regex)) {\n return;\n }\n\n plural(regex, replacement);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for pluralization.\\nPlease \\`import { plural } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom pluralization rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '5.3.4',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n });\n\n // load singulars\n rules.singular.forEach(([regex, replacement]) => {\n if (singularMap.has(regex)) {\n return;\n }\n\n singular(regex, replacement);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for singularization.\\nPlease \\`import { singular } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom singularization rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '5.3.4',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n });\n\n // load irregulars\n Object.keys(rules.irregular).forEach((single) => {\n const plur = rules.irregular[single];\n const defaultPlur = irregularMap.get(single);\n if (defaultPlur && defaultPlur === plur) {\n return;\n }\n\n if (toIgnore.has(single)) {\n return;\n }\n\n const actualSingle = irregularLookups.get(plur.toLowerCase()) || single;\n toIgnore.add(plur.toLowerCase());\n irregular(actualSingle, plur);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for irregular rules.\\nPlease \\`import { irregular } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom irregular rule for use with EmberData for '${actualSingle}' <=> '${plur}'.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '5.3.4',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n });\n\n // load uncountables\n Object.keys(rules.uncountable).forEach((word) => {\n if (uncountableSet.has(word) || rules.uncountable[word] !== true) {\n return;\n }\n\n uncountable(word);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for uncountable rules.\\nPlease \\`import { uncountable } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom uncountable rule for '${word}' for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '5.3.4',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n });\n\n inflector.plural = function (...args: Parameters<typeof originalPlural>) {\n plural(...args);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for pluralization.\\nPlease \\`import { plural } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom pluralization rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '5.3.4',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n\n return originalPlural.apply(inflector, args);\n };\n\n inflector.singular = function (...args: Parameters<typeof originalSingular>) {\n singular(...args);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for singularization.\\nPlease \\`import { singular } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom singularization rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '5.3.4',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n\n return originalSingular.apply(inflector, args);\n };\n\n inflector.irregular = function (...args: Parameters<typeof originalIrregular>) {\n irregular(...args);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for irregular rules.\\nPlease \\`import { irregular } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom irregular rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '5.3.4',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n\n return originalIrregular.apply(inflector, args);\n };\n\n inflector.uncountable = function (...args: Parameters<typeof originalUncountable>) {\n uncountable(...args);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for uncountable rules.\\nPlease \\`import { uncountable } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom uncountable rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '5.3.4',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n\n return originalUncountable.apply(inflector, args);\n };\n }\n}\n"],"names":["macroCondition","getGlobalConfig","WarpDrive","deprecations","DEPRECATE_EMBER_INFLECTOR","dependencySatisfies","Inflector","importSync","default","inflector","originalPlural","plural","originalSingular","singular","originalIrregular","irregular","originalUncountable","uncountable","defaultRules","rules","pluralMap","Map","plurals","singularMap","irregularMap","toIgnore","Set","uncountableSet","irregularPairs","forEach","single","plur","set","toLowerCase","add","irregularLookups","Object","keys","regex","replacement","has","deprecate","id","until","for","since","enabled","available","url","defaultPlur","get","actualSingle","word","args","apply"],"mappings":";;;;AAQA,IAAAA,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,YAAA,CAAAC,yBAAA,CAA+B,EAAA;EAC7B,IAAIJ,cAAc,CAACK,mBAAmB,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,EAAE;AAC/D,IAAA,MAAMC,SAAS,GAAIC,UAAU,CAAC,iBAAiB,CAAC,CAA2DC,OAAO,CAAA;IAClH,MAAM;AAAEC,MAAAA,SAAAA;AAAU,KAAC,GAAGH,SAAS,CAAA;;AAE/B;AACA,IAAA,MAAMI,cAAc,GAAGD,SAAS,CAACE,MAAM,CAAA;AACvC;AACA,IAAA,MAAMC,gBAAgB,GAAGH,SAAS,CAACI,QAAQ,CAAA;AAC3C;AACA,IAAA,MAAMC,iBAAiB,GAAGL,SAAS,CAACM,SAAS,CAAA;AAC7C;AACA,IAAA,MAAMC,mBAAmB,GAAGP,SAAS,CAACQ,WAAW,CAAA;;AAEjD;;IAwBA,MAAM;AAAEC,MAAAA,YAAAA;AAAa,KAAC,GAAGZ,SAAsD,CAAA;IAC/E,MAAM;AAAEa,MAAAA,KAAAA;AAAM,KAAC,GAAGV,SAAgD,CAAA;IAElE,MAAMW,SAAS,GAAG,IAAIC,GAAG,CAACH,YAAY,CAACI,OAAO,CAAC,CAAA;IAC/C,MAAMC,WAAW,GAAG,IAAIF,GAAG,CAACH,YAAY,CAACL,QAAQ,CAAC,CAAA;AAClD,IAAA,MAAMW,YAAY,GAAG,IAAIH,GAAG,EAAkB,CAAA;AAC9C,IAAA,MAAMI,QAAQ,GAAG,IAAIC,GAAG,EAAU,CAAA;IAClC,MAAMC,c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DC,QAAAA,GAAG,EAAE,gEAAA;AACP,OACF,CAAC,CAAA;AAED,MAAA,OAAOlC,iBAAiB,CAACwC,KAAK,CAAC7C,SAAS,EAAE4C,IAAI,CAAC,CAAA;KAChD,CAAA;AAED5C,IAAAA,SAAS,CAACQ,WAAW,GAAG,UAAU,GAAGoC,IAA4C,EAAE;MACjFpC,WAAW,CAAC,GAAGoC,IAAI,CAAC,CAAA;AAEpBZ,MAAAA,SAAS,CACN,CAAA,2NAAA,CAA4N,EAC7N,KAAK,EACL;AACEC,QAAAA,EAAE,EAAE,4BAA4B;AAChCC,QAAAA,KAAK,EAAE,OAAO;AACdC,QAAAA,GAAG,EAAE,YAAY;AACjBC,QAAAA,KAAK,EAAE;AACLC,UAAAA,OAAO,EAAE,OAAO;AAChBC,UAAAA,SAAS,EAAE,OAAA;SACZ;AACDC,QAAAA,GAAG,EAAE,gEAAA;AACP,OACF,CAAC,CAAA;AAED,MAAA,OAAOhC,mBAAmB,CAACsC,KAAK,CAAC7C,SAAS,EAAE4C,IAAI,CAAC,CAAA;KAClD,CAAA;AACH,GAAA;AACF"}
|
|
1
|
+
{"version":3,"file":"deprecation-support.js","sources":["../src/deprecation-support.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { dependencySatisfies, importSync, macroCondition } from '@embroider/macros';\n\nimport { DEPRECATE_EMBER_INFLECTOR } from '@warp-drive-mirror/build-config/deprecations';\n\nimport { defaultRules as WarpDriveDefaults } from './-private/string/inflections';\nimport { irregular, plural, singular, uncountable } from './string';\n\nif (DEPRECATE_EMBER_INFLECTOR) {\n if (macroCondition(dependencySatisfies('ember-inflector', '*'))) {\n const Inflector = (importSync('ember-inflector') as { default: typeof import('ember-inflector').default }).default;\n const { inflector } = Inflector;\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalPlural = inflector.plural;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSingular = inflector.singular;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalIrregular = inflector.irregular;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalUncountable = inflector.uncountable;\n\n // copy over any already registered rules\n type DefaultRules = {\n plurals: [RegExp, string][];\n singular: [RegExp, string][];\n irregularPairs: [string, string][];\n uncountable: string[];\n };\n type InternalRules = {\n plurals: [RegExp, string][];\n singular: [RegExp, string][];\n\n // [str1, str2] =>\n // { [str1.lower]: str2 }\n // { [str2.lower]: str2 }\n irregular: Record<string, string>;\n\n // [str1, str2] =>\n // { [str2.lower]: str1 }\n // { [str1.lower]: str1 }\n irregularInverse: Record<string, string>;\n\n // lower cased string\n uncountable: Record<string, boolean>;\n };\n\n // ember-inflector mutates the default rules arrays\n // with user supplied rules, so we keep track of what\n // is default via our own list.\n const defaultPluralKeys = new Set<string>();\n const defaultSingularKeys = new Set<string>();\n WarpDriveDefaults.plurals.forEach(([regex]) => {\n defaultPluralKeys.add(regex.toString());\n });\n WarpDriveDefaults.singular.forEach(([regex]) => {\n defaultSingularKeys.add(regex.toString());\n });\n\n const { defaultRules } = Inflector as unknown as { defaultRules: DefaultRules };\n const { rules } = inflector as unknown as { rules: InternalRules };\n\n const irregularMap = new Map<string, string>();\n const toIgnore = new Set<string>();\n const uncountableSet = new Set(defaultRules.uncountable);\n\n defaultRules.irregularPairs.forEach(([single, plur]) => {\n irregularMap.set(single.toLowerCase(), plur);\n toIgnore.add(plur.toLowerCase());\n });\n const irregularLookups = new Map<string, string>();\n Object.keys(rules.irregular).forEach((single) => {\n const plur = rules.irregular[single];\n irregularLookups.set(single, plur);\n });\n\n // load plurals\n rules.plurals.forEach(([regex, replacement]) => {\n if (defaultPluralKeys.has(regex.toString())) {\n return;\n }\n\n plural(regex, replacement);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for pluralization.\\nPlease \\`import { plural } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom pluralization rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '4.13',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n });\n\n // load singulars\n rules.singular.forEach(([regex, replacement]) => {\n if (defaultSingularKeys.has(regex.toString())) {\n return;\n }\n\n singular(regex, replacement);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for singularization.\\nPlease \\`import { singular } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom singularization rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '4.13',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n });\n\n // load irregulars\n Object.keys(rules.irregular).forEach((single) => {\n const plur = rules.irregular[single];\n const defaultPlur = irregularMap.get(single);\n if (defaultPlur && defaultPlur === plur) {\n return;\n }\n\n if (toIgnore.has(single)) {\n return;\n }\n\n const actualSingle = irregularLookups.get(plur.toLowerCase()) || single;\n toIgnore.add(plur.toLowerCase());\n irregular(actualSingle, plur);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for irregular rules.\\nPlease \\`import { irregular } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom irregular rule for use with EmberData for '${actualSingle}' <=> '${plur}'.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '4.13',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n });\n\n // load uncountables\n Object.keys(rules.uncountable).forEach((word) => {\n if (uncountableSet.has(word) || rules.uncountable[word] !== true) {\n return;\n }\n\n uncountable(word);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for uncountable rules.\\nPlease \\`import { uncountable } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom uncountable rule for '${word}' for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '4.13',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n });\n\n inflector.plural = function (...args: Parameters<typeof originalPlural>) {\n plural(...args);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for pluralization.\\nPlease \\`import { plural } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom pluralization rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '4.13',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n\n return originalPlural.apply(inflector, args);\n };\n\n inflector.singular = function (...args: Parameters<typeof originalSingular>) {\n singular(...args);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for singularization.\\nPlease \\`import { singular } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom singularization rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '4.13',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n\n return originalSingular.apply(inflector, args);\n };\n\n inflector.irregular = function (...args: Parameters<typeof originalIrregular>) {\n irregular(...args);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for irregular rules.\\nPlease \\`import { irregular } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom irregular rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '4.13',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n\n return originalIrregular.apply(inflector, args);\n };\n\n inflector.uncountable = function (...args: Parameters<typeof originalUncountable>) {\n uncountable(...args);\n\n deprecate(\n `WarpDrive/EmberData no longer uses ember-inflector for uncountable rules.\\nPlease \\`import { uncountable } from '@ember-data-mirror/request-utils/string';\\` instead to register a custom uncountable rule for use with EmberData.`,\n false,\n {\n id: 'warp-drive.ember-inflector',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '4.13',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.ember-inflector',\n }\n );\n\n return originalUncountable.apply(inflector, args);\n };\n }\n}\n"],"names":["macroCondition","getGlobalConfig","WarpDrive","deprecations","DEPRECATE_EMBER_INFLECTOR","dependencySatisfies","Inflector","importSync","default","inflector","originalPlural","plural","originalSingular","singular","originalIrregular","irregular","originalUncountable","uncountable","defaultPluralKeys","Set","defaultSingularKeys","WarpDriveDefaults","plurals","forEach","regex","add","toString","defaultRules","rules","irregularMap","Map","toIgnore","uncountableSet","irregularPairs","single","plur","set","toLowerCase","irregularLookups","Object","keys","replacement","has","deprecate","id","until","for","since","enabled","available","url","defaultPlur","get","actualSingle","word","args","apply"],"mappings":";;;;AASA,IAAAA,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,YAAA,CAAAC,yBAAA,CAA+B,EAAA;EAC7B,IAAIJ,cAAc,CAACK,mBAAmB,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,EAAE;AAC/D,IAAA,MAAMC,SAAS,GAAIC,UAAU,CAAC,iBAAiB,CAAC,CAA2DC,OAAO;IAClH,MAAM;AAAEC,MAAAA;AAAU,KAAC,GAAGH,SAAS;;AAE/B;AACA,IAAA,MAAMI,cAAc,GAAGD,SAAS,CAACE,MAAM;AACvC;AACA,IAAA,MAAMC,gBAAgB,GAAGH,SAAS,CAACI,QAAQ;AAC3C;AACA,IAAA,MAAMC,iBAAiB,GAAGL,SAAS,CAACM,SAAS;AAC7C;AACA,IAAA,MAAMC,mBAAmB,GAAGP,SAAS,CAACQ,WAAW;;AAEjD;;AAyBA;AACA;AACA;AACA,IAAA,MAAMC,iBAAiB,GAAG,IAAIC,GAAG,EAAU;AAC3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ExC,SAAS,CAAC,GAAGwC,IAAI,CAAC;AAElBZ,MAAAA,SAAS,CACP,CAAA,qNAAA,CAAuN,EACvN,KAAK,EACL;AACEC,QAAAA,EAAE,EAAE,4BAA4B;AAChCC,QAAAA,KAAK,EAAE,OAAO;AACdC,QAAAA,GAAG,EAAE,YAAY;AACjBC,QAAAA,KAAK,EAAE;AACLC,UAAAA,OAAO,EAAE,OAAO;AAChBC,UAAAA,SAAS,EAAE;SACZ;AACDC,QAAAA,GAAG,EAAE;AACP,OACF,CAAC;AAED,MAAA,OAAOpC,iBAAiB,CAAC0C,KAAK,CAAC/C,SAAS,EAAE8C,IAAI,CAAC;KAChD;AAED9C,IAAAA,SAAS,CAACQ,WAAW,GAAG,UAAU,GAAGsC,IAA4C,EAAE;MACjFtC,WAAW,CAAC,GAAGsC,IAAI,CAAC;AAEpBZ,MAAAA,SAAS,CACP,CAAA,2NAAA,CAA6N,EAC7N,KAAK,EACL;AACEC,QAAAA,EAAE,EAAE,4BAA4B;AAChCC,QAAAA,KAAK,EAAE,OAAO;AACdC,QAAAA,GAAG,EAAE,YAAY;AACjBC,QAAAA,KAAK,EAAE;AACLC,UAAAA,OAAO,EAAE,OAAO;AAChBC,UAAAA,SAAS,EAAE;SACZ;AACDC,QAAAA,GAAG,EAAE;AACP,OACF,CAAC;AAED,MAAA,OAAOlC,mBAAmB,CAACwC,KAAK,CAAC/C,SAAS,EAAE8C,IAAI,CAAC;KAClD;AACH;AACF"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { deprecate } from '@ember/debug';
|
|
2
|
+
import { getOrSetGlobal } from '@warp-drive-mirror/core-types/-private';
|
|
2
3
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -43,10 +44,10 @@ import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
|
43
44
|
// prevents the final constructed object from needing to add
|
|
44
45
|
// host and namespace which are provided by the final consuming
|
|
45
46
|
// class to the prototype which can result in overwrite errors
|
|
46
|
-
const CONFIG = {
|
|
47
|
+
const CONFIG = getOrSetGlobal('CONFIG', {
|
|
47
48
|
host: '',
|
|
48
49
|
namespace: ''
|
|
49
|
-
};
|
|
50
|
+
});
|
|
50
51
|
|
|
51
52
|
/**
|
|
52
53
|
* Sets the global configuration for `buildBaseURL`
|
|
@@ -89,29 +90,29 @@ const CONFIG = {
|
|
|
89
90
|
* @return void
|
|
90
91
|
*/
|
|
91
92
|
function setBuildURLConfig(config) {
|
|
92
|
-
macroCondition(getGlobalConfig().
|
|
93
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
93
94
|
if (!test) {
|
|
94
95
|
throw new Error(`setBuildURLConfig: You must pass a config object`);
|
|
95
96
|
}
|
|
96
97
|
})(config) : {};
|
|
97
|
-
macroCondition(getGlobalConfig().
|
|
98
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
98
99
|
if (!test) {
|
|
99
100
|
throw new Error(`setBuildURLConfig: You must pass a config object with a 'host' or 'namespace' property`);
|
|
100
101
|
}
|
|
101
102
|
})('host' in config || 'namespace' in config) : {};
|
|
102
103
|
CONFIG.host = config.host || '';
|
|
103
104
|
CONFIG.namespace = config.namespace || '';
|
|
104
|
-
macroCondition(getGlobalConfig().
|
|
105
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
105
106
|
if (!test) {
|
|
106
107
|
throw new Error(`buildBaseURL: host must NOT end with '/', received '${CONFIG.host}'`);
|
|
107
108
|
}
|
|
108
109
|
})(CONFIG.host === '/' || !CONFIG.host.endsWith('/')) : {};
|
|
109
|
-
macroCondition(getGlobalConfig().
|
|
110
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
110
111
|
if (!test) {
|
|
111
112
|
throw new Error(`buildBaseURL: namespace must NOT start with '/', received '${CONFIG.namespace}'`);
|
|
112
113
|
}
|
|
113
114
|
})(!CONFIG.namespace.startsWith('/')) : {};
|
|
114
|
-
macroCondition(getGlobalConfig().
|
|
115
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
115
116
|
if (!test) {
|
|
116
117
|
throw new Error(`buildBaseURL: namespace must NOT end with '/', received '${CONFIG.namespace}'`);
|
|
117
118
|
}
|
|
@@ -125,7 +126,7 @@ function hasResourcePath(options) {
|
|
|
125
126
|
return 'resourcePath' in options && typeof options.resourcePath === 'string' && options.resourcePath.length > 0;
|
|
126
127
|
}
|
|
127
128
|
function resourcePathForType(options) {
|
|
128
|
-
macroCondition(getGlobalConfig().
|
|
129
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
129
130
|
if (!test) {
|
|
130
131
|
throw new Error(`resourcePathForType: You must pass a valid op as part of options`);
|
|
131
132
|
}
|
|
@@ -179,37 +180,37 @@ function buildBaseURL(urlOptions) {
|
|
|
179
180
|
host: CONFIG.host,
|
|
180
181
|
namespace: CONFIG.namespace
|
|
181
182
|
}, urlOptions);
|
|
182
|
-
macroCondition(getGlobalConfig().
|
|
183
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
183
184
|
if (!test) {
|
|
184
185
|
throw new Error(`buildBaseURL: You must pass \`op\` as part of options`);
|
|
185
186
|
}
|
|
186
187
|
})(hasResourcePath(options) || typeof options.op === 'string' && options.op.length > 0) : {};
|
|
187
|
-
macroCondition(getGlobalConfig().
|
|
188
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
188
189
|
if (!test) {
|
|
189
190
|
throw new Error(`buildBaseURL: You must pass \`identifier\` as part of options`);
|
|
190
191
|
}
|
|
191
192
|
})(hasResourcePath(options) || options.op === 'findMany' || options.identifier && typeof options.identifier === 'object') : {};
|
|
192
|
-
macroCondition(getGlobalConfig().
|
|
193
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
193
194
|
if (!test) {
|
|
194
195
|
throw new Error(`buildBaseURL: You must pass \`identifiers\` as part of options`);
|
|
195
196
|
}
|
|
196
197
|
})(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().
|
|
198
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
198
199
|
if (!test) {
|
|
199
200
|
throw new Error(`buildBaseURL: You must pass valid \`identifier\` as part of options, expected 'id'`);
|
|
200
201
|
}
|
|
201
202
|
})(hasResourcePath(options) || !isOperationWithPrimaryRecord(options) || typeof options.identifier.id === 'string' && options.identifier.id.length > 0) : {};
|
|
202
|
-
macroCondition(getGlobalConfig().
|
|
203
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
203
204
|
if (!test) {
|
|
204
205
|
throw new Error(`buildBaseURL: You must pass \`identifiers\` as part of options`);
|
|
205
206
|
}
|
|
206
207
|
})(hasResourcePath(options) || options.op !== 'findMany' || options.identifiers.every(i => typeof i.id === 'string' && i.id.length > 0)) : {};
|
|
207
|
-
macroCondition(getGlobalConfig().
|
|
208
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
208
209
|
if (!test) {
|
|
209
210
|
throw new Error(`buildBaseURL: You must pass valid \`identifier\` as part of options, expected 'type'`);
|
|
210
211
|
}
|
|
211
212
|
})(hasResourcePath(options) || options.op === 'findMany' || typeof options.identifier.type === 'string' && options.identifier.type.length > 0) : {};
|
|
212
|
-
macroCondition(getGlobalConfig().
|
|
213
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
213
214
|
if (!test) {
|
|
214
215
|
throw new Error(`buildBaseURL: You must pass valid \`identifiers\` as part of options, expected 'type'`);
|
|
215
216
|
}
|
|
@@ -223,52 +224,52 @@ function buildBaseURL(urlOptions) {
|
|
|
223
224
|
namespace
|
|
224
225
|
} = options;
|
|
225
226
|
const fieldPath = 'fieldPath' in options ? options.fieldPath : '';
|
|
226
|
-
macroCondition(getGlobalConfig().
|
|
227
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
227
228
|
if (!test) {
|
|
228
229
|
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
230
|
}
|
|
230
231
|
})(hasResourcePath(options) || ['findRecord', 'query', 'findMany', 'findRelatedCollection', 'findRelatedRecord', 'createRecord', 'updateRecord', 'deleteRecord'].includes(options.op)) : {};
|
|
231
|
-
macroCondition(getGlobalConfig().
|
|
232
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
232
233
|
if (!test) {
|
|
233
234
|
throw new Error(`buildBaseURL: host must NOT end with '/', received '${host}'`);
|
|
234
235
|
}
|
|
235
236
|
})(host === '/' || !host.endsWith('/')) : {};
|
|
236
|
-
macroCondition(getGlobalConfig().
|
|
237
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
237
238
|
if (!test) {
|
|
238
239
|
throw new Error(`buildBaseURL: namespace must NOT start with '/', received '${namespace}'`);
|
|
239
240
|
}
|
|
240
241
|
})(!namespace.startsWith('/')) : {};
|
|
241
|
-
macroCondition(getGlobalConfig().
|
|
242
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
242
243
|
if (!test) {
|
|
243
244
|
throw new Error(`buildBaseURL: namespace must NOT end with '/', received '${namespace}'`);
|
|
244
245
|
}
|
|
245
246
|
})(!namespace.endsWith('/')) : {};
|
|
246
|
-
macroCondition(getGlobalConfig().
|
|
247
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
247
248
|
if (!test) {
|
|
248
249
|
throw new Error(`buildBaseURL: resourcePath must NOT start with '/', received '${resourcePath}'`);
|
|
249
250
|
}
|
|
250
251
|
})(!resourcePath.startsWith('/')) : {};
|
|
251
|
-
macroCondition(getGlobalConfig().
|
|
252
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
252
253
|
if (!test) {
|
|
253
254
|
throw new Error(`buildBaseURL: resourcePath must NOT end with '/', received '${resourcePath}'`);
|
|
254
255
|
}
|
|
255
256
|
})(!resourcePath.endsWith('/')) : {};
|
|
256
|
-
macroCondition(getGlobalConfig().
|
|
257
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
257
258
|
if (!test) {
|
|
258
259
|
throw new Error(`buildBaseURL: fieldPath must NOT start with '/', received '${fieldPath}'`);
|
|
259
260
|
}
|
|
260
261
|
})(!fieldPath.startsWith('/')) : {};
|
|
261
|
-
macroCondition(getGlobalConfig().
|
|
262
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
262
263
|
if (!test) {
|
|
263
264
|
throw new Error(`buildBaseURL: fieldPath must NOT end with '/', received '${fieldPath}'`);
|
|
264
265
|
}
|
|
265
266
|
})(!fieldPath.endsWith('/')) : {};
|
|
266
|
-
macroCondition(getGlobalConfig().
|
|
267
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
267
268
|
if (!test) {
|
|
268
269
|
throw new Error(`buildBaseURL: idPath must NOT start with '/', received '${idPath}'`);
|
|
269
270
|
}
|
|
270
271
|
})(!idPath.startsWith('/')) : {};
|
|
271
|
-
macroCondition(getGlobalConfig().
|
|
272
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
272
273
|
if (!test) {
|
|
273
274
|
throw new Error(`buildBaseURL: idPath must NOT end with '/', received '${idPath}'`);
|
|
274
275
|
}
|
|
@@ -281,7 +282,7 @@ const DEFAULT_QUERY_PARAMS_SERIALIZATION_OPTIONS = {
|
|
|
281
282
|
arrayFormat: 'comma'
|
|
282
283
|
};
|
|
283
284
|
function handleInclude(include) {
|
|
284
|
-
macroCondition(getGlobalConfig().
|
|
285
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
285
286
|
if (!test) {
|
|
286
287
|
throw new Error(`Expected include to be a string or array, got ${typeof include}`);
|
|
287
288
|
}
|
|
@@ -343,7 +344,7 @@ function sortQueryParams(params, options) {
|
|
|
343
344
|
const dictionaryParams = paramsIsObject ? params : {};
|
|
344
345
|
if (!paramsIsObject) {
|
|
345
346
|
params.forEach((value, key) => {
|
|
346
|
-
const hasExisting =
|
|
347
|
+
const hasExisting = key in dictionaryParams;
|
|
347
348
|
if (!hasExisting) {
|
|
348
349
|
dictionaryParams[key] = value;
|
|
349
350
|
} else {
|
|
@@ -453,7 +454,7 @@ function parseCacheControl(header) {
|
|
|
453
454
|
const cacheControlValue = {};
|
|
454
455
|
function parseCacheControlValue(stringToParse) {
|
|
455
456
|
const parsedValue = Number.parseInt(stringToParse);
|
|
456
|
-
macroCondition(getGlobalConfig().
|
|
457
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
457
458
|
if (!test) {
|
|
458
459
|
throw new Error(`Invalid Cache-Control value, expected a number but got - ${stringToParse}`);
|
|
459
460
|
}
|
|
@@ -463,12 +464,12 @@ function parseCacheControl(header) {
|
|
|
463
464
|
for (let i = 0; i < header.length; i++) {
|
|
464
465
|
const char = header.charAt(i);
|
|
465
466
|
if (char === ',') {
|
|
466
|
-
macroCondition(getGlobalConfig().
|
|
467
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
467
468
|
if (!test) {
|
|
468
469
|
throw new Error(`Invalid Cache-Control value, expected a value`);
|
|
469
470
|
}
|
|
470
471
|
})(!isParsingKey || !NUMERIC_KEYS.has(key)) : {};
|
|
471
|
-
macroCondition(getGlobalConfig().
|
|
472
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
472
473
|
if (!test) {
|
|
473
474
|
throw new Error(`Invalid Cache-Control value, expected a value after "=" but got ","`);
|
|
474
475
|
}
|
|
@@ -480,7 +481,7 @@ function parseCacheControl(header) {
|
|
|
480
481
|
value = '';
|
|
481
482
|
continue;
|
|
482
483
|
} else if (char === '=') {
|
|
483
|
-
macroCondition(getGlobalConfig().
|
|
484
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
484
485
|
if (!test) {
|
|
485
486
|
throw new Error(`Invalid Cache-Control value, expected a value after "="`);
|
|
486
487
|
}
|
|
@@ -583,22 +584,22 @@ class CachePolicy {
|
|
|
583
584
|
id: 'ember-data-mirror:request-utils:lifetimes-service-store-arg',
|
|
584
585
|
since: {
|
|
585
586
|
enabled: '5.4',
|
|
586
|
-
available: '
|
|
587
|
+
available: '4.13'
|
|
587
588
|
},
|
|
588
589
|
for: '@ember-data-mirror/request-utils',
|
|
589
590
|
until: '6.0'
|
|
590
591
|
});
|
|
591
|
-
macroCondition(getGlobalConfig().
|
|
592
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
592
593
|
if (!test) {
|
|
593
594
|
throw new Error(`You must pass a config to the CachePolicy`);
|
|
594
595
|
}
|
|
595
596
|
})(_config) : {};
|
|
596
|
-
macroCondition(getGlobalConfig().
|
|
597
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
597
598
|
if (!test) {
|
|
598
599
|
throw new Error(`You must pass a apiCacheSoftExpires to the CachePolicy`);
|
|
599
600
|
}
|
|
600
601
|
})(typeof _config.apiCacheSoftExpires === 'number') : {};
|
|
601
|
-
macroCondition(getGlobalConfig().
|
|
602
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
602
603
|
if (!test) {
|
|
603
604
|
throw new Error(`You must pass a apiCacheHardExpires to the CachePolicy`);
|
|
604
605
|
}
|
|
@@ -623,7 +624,7 @@ class CachePolicy {
|
|
|
623
624
|
* @param {Store} store
|
|
624
625
|
*/
|
|
625
626
|
invalidateRequest(identifier, store) {
|
|
626
|
-
this._getStore(store).invalidated.add(identifier
|
|
627
|
+
this._getStore(store).invalidated.add(identifier);
|
|
627
628
|
}
|
|
628
629
|
|
|
629
630
|
/**
|
|
@@ -649,9 +650,12 @@ class CachePolicy {
|
|
|
649
650
|
invalidateRequestsForType(type, store) {
|
|
650
651
|
const storeCache = this._getStore(store);
|
|
651
652
|
const set = storeCache.types.get(type);
|
|
653
|
+
const notifications = store.notifications;
|
|
652
654
|
if (set) {
|
|
655
|
+
// TODO batch notifications
|
|
653
656
|
set.forEach(id => {
|
|
654
657
|
storeCache.invalidated.add(id);
|
|
658
|
+
notifications.notify(id, 'invalidated');
|
|
655
659
|
});
|
|
656
660
|
}
|
|
657
661
|
}
|
|
@@ -696,10 +700,10 @@ class CachePolicy {
|
|
|
696
700
|
request.cacheOptions?.types.forEach(type => {
|
|
697
701
|
const set = storeCache.types.get(type);
|
|
698
702
|
if (set) {
|
|
699
|
-
set.add(identifier
|
|
700
|
-
storeCache.invalidated.delete(identifier
|
|
703
|
+
set.add(identifier);
|
|
704
|
+
storeCache.invalidated.delete(identifier);
|
|
701
705
|
} else {
|
|
702
|
-
storeCache.types.set(type, new Set([identifier
|
|
706
|
+
storeCache.types.set(type, new Set([identifier]));
|
|
703
707
|
}
|
|
704
708
|
});
|
|
705
709
|
}
|
|
@@ -725,7 +729,7 @@ class CachePolicy {
|
|
|
725
729
|
isHardExpired(identifier, store) {
|
|
726
730
|
// if we are explicitly invalidated, we are hard expired
|
|
727
731
|
const storeCache = this._getStore(store);
|
|
728
|
-
if (storeCache.invalidated.has(identifier
|
|
732
|
+
if (storeCache.invalidated.has(identifier)) {
|
|
729
733
|
return true;
|
|
730
734
|
}
|
|
731
735
|
const cache = store.cache;
|
|
@@ -761,7 +765,7 @@ class LifetimesService extends CachePolicy {
|
|
|
761
765
|
id: 'ember-data-mirror:deprecate-lifetimes-service-import',
|
|
762
766
|
since: {
|
|
763
767
|
enabled: '5.4',
|
|
764
|
-
available: '
|
|
768
|
+
available: '4.13'
|
|
765
769
|
},
|
|
766
770
|
for: 'ember-data-mirror',
|
|
767
771
|
until: '6.0'
|