@ember-data/request-utils 5.5.0-alpha.9 → 5.5.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.
Files changed (49) hide show
  1. package/LICENSE.md +19 -7
  2. package/README.md +12 -2
  3. package/addon-main.cjs +5 -0
  4. package/dist/deprecation-support.js +188 -0
  5. package/dist/deprecation-support.js.map +1 -0
  6. package/dist/handlers.js +147 -0
  7. package/dist/handlers.js.map +1 -0
  8. package/dist/index.js +989 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/inflect-CwI_k2it.js +305 -0
  11. package/dist/inflect-CwI_k2it.js.map +1 -0
  12. package/dist/string.js +2 -0
  13. package/dist/string.js.map +1 -0
  14. package/dist/transform-1PDozfHr.js +192 -0
  15. package/dist/transform-1PDozfHr.js.map +1 -0
  16. package/logos/NCC-1701-a-blue.svg +4 -0
  17. package/logos/NCC-1701-a-gold.svg +4 -0
  18. package/logos/NCC-1701-a-gold_100.svg +1 -0
  19. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  20. package/logos/NCC-1701-a.svg +4 -0
  21. package/logos/README.md +4 -0
  22. package/logos/docs-badge.svg +2 -0
  23. package/logos/github-header.svg +444 -0
  24. package/logos/social1.png +0 -0
  25. package/logos/social2.png +0 -0
  26. package/logos/warp-drive-logo-dark.svg +4 -0
  27. package/logos/warp-drive-logo-gold.svg +4 -0
  28. package/package.json +61 -29
  29. package/unstable-preview-types/-private/handlers/auto-compress.d.ts +168 -0
  30. package/unstable-preview-types/-private/handlers/auto-compress.d.ts.map +1 -0
  31. package/unstable-preview-types/-private/string/inflect.d.ts +140 -0
  32. package/unstable-preview-types/-private/string/inflect.d.ts.map +1 -0
  33. package/unstable-preview-types/-private/string/inflections.d.ts +12 -0
  34. package/unstable-preview-types/-private/string/inflections.d.ts.map +1 -0
  35. package/unstable-preview-types/-private/string/transform.d.ts +117 -0
  36. package/unstable-preview-types/-private/string/transform.d.ts.map +1 -0
  37. package/unstable-preview-types/deprecation-support.d.ts +4 -0
  38. package/unstable-preview-types/deprecation-support.d.ts.map +1 -0
  39. package/unstable-preview-types/handlers.d.ts +11 -0
  40. package/unstable-preview-types/handlers.d.ts.map +1 -0
  41. package/unstable-preview-types/index.d.ts +688 -0
  42. package/unstable-preview-types/index.d.ts.map +1 -0
  43. package/unstable-preview-types/string.d.ts +17 -0
  44. package/unstable-preview-types/string.d.ts.map +1 -0
  45. package/addon/index.js +0 -424
  46. package/addon/index.js.map +0 -1
  47. package/addon-main.js +0 -19
  48. /package/{ember-data-logo-dark.svg → logos/ember-data-logo-dark.svg} +0 -0
  49. /package/{ember-data-logo-light.svg → logos/ember-data-logo-light.svg} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,KAAK,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACtH,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC7G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAI7E,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAC/B,KAAK,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAChE,KAAK,sBAAsB,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAExF,MAAM,WAAW,oBAAoB;IACnC,CAAC,UAAU,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,YAAY,GAAG,eAAe,EAAE,GAAG,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C;QAC3C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC;KACnD;gBASW,MAAM,EAAE,YAAY;IAuBhC;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CAAC,UAAU,EAAE,wBAAwB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAI3E;;;;;;;;;;;;;;;;;;;OAmBG;IACH,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAc3D;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CACR,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,QAAQ,GAAG,YAAY,GAAG,IAAI,EACxC,UAAU,EAAE,wBAAwB,GAAG,IAAI,EAC3C,KAAK,EAAE,KAAK,GACX,IAAI;IAgCP;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,UAAU,EAAE,wBAAwB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO;IAoB1E;;;;;;;;;;;;;;;OAeG;IACH,aAAa,CAAC,UAAU,EAAE,wBAAwB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO;CA0C3E;AAED,qBAAa,gBAAiB,SAAQ,WAAW;gBACnC,MAAM,EAAE,YAAY;CAgBjC"}
@@ -0,0 +1,17 @@
1
+ declare module '@ember-data/request-utils/string' {
2
+ /**
3
+ * String utilties for transforming and inflecting strings useful for
4
+ * when the format provided by the server is not the format you want to use
5
+ * in your application.
6
+ *
7
+ * Each transformation function stores its results in an LRUCache to avoid
8
+ * recomputing the same value multiple times. The cache size can be set
9
+ * using the `setMaxLRUCacheSize` function. The default size is 10,000.
10
+ *
11
+ * @module @ember-data/request-utils/string
12
+ * @main @ember-data/request-utils/string
13
+ */
14
+ export { pluralize, singularize, singular, plural, loadIrregular, loadUncountable, irregular, uncountable, resetToDefaults, clear, clearRules, } from '@ember-data/request-utils/-private/string/inflect';
15
+ export { dasherize, camelize, capitalize, underscore, setMaxLRUCacheSize } from '@ember-data/request-utils/-private/string/transform';
16
+ }
17
+ //# sourceMappingURL=string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,aAAa,EACb,eAAe,EACf,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACL,UAAU,GACX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
package/addon/index.js DELETED
@@ -1,424 +0,0 @@
1
- import { assert } from '@ember/debug';
2
-
3
- /**
4
- * Simple utility function to assist in url building,
5
- * query params, and other common request operations.
6
- *
7
- * These primitives may be used directly or composed
8
- * by request builders to provide a consistent interface
9
- * for building requests.
10
- *
11
- * For instance:
12
- *
13
- * ```ts
14
- * import { buildBaseURL, buildQueryParams } from '@ember-data/request-utils';
15
- *
16
- * const baseURL = buildBaseURL({
17
- * host: 'https://api.example.com',
18
- * namespace: 'api/v1',
19
- * resourcePath: 'emberDevelopers',
20
- * op: 'query',
21
- * identifier: { type: 'ember-developer' }
22
- * });
23
- * const url = `${baseURL}?${buildQueryParams({ name: 'Chris', include:['pets'] })}`;
24
- * // => 'https://api.example.com/api/v1/emberDevelopers?include=pets&name=Chris'
25
- * ```
26
- *
27
- * This is useful, but not as useful as the REST request builder for query which is sugar
28
- * over this (and more!):
29
- *
30
- * ```ts
31
- * import { query } from '@ember-data/rest/request';
32
- *
33
- * const options = query('ember-developer', { name: 'Chris', include:['pets'] });
34
- * // => { url: 'https://api.example.com/api/v1/emberDevelopers?include=pets&name=Chris' }
35
- * // Note: options will also include other request options like headers, method, etc.
36
- * ```
37
- *
38
- * @module @ember-data/request-utils
39
- * @main @ember-data/request-utils
40
- * @public
41
- */
42
-
43
- // prevents the final constructed object from needing to add
44
- // host and namespace which are provided by the final consuming
45
- // class to the prototype which can result in overwrite errors
46
- let CONFIG = {
47
- host: '',
48
- namespace: ''
49
- };
50
-
51
- /**
52
- * Sets the global configuration for `buildBaseURL`
53
- * for host and namespace values for the application.
54
- *
55
- * These values may still be overridden by passing
56
- * them to buildBaseURL directly.
57
- *
58
- * This method may be called as many times as needed
59
- *
60
- * ```ts
61
- * type BuildURLConfig = {
62
- * host: string;
63
- * namespace: string'
64
- * }
65
- * ```
66
- *
67
- * @method setBuildURLConfig
68
- * @static
69
- * @public
70
- * @for @ember-data/request-utils
71
- * @param {BuildURLConfig} config
72
- * @returns void
73
- */
74
- function setBuildURLConfig(config) {
75
- CONFIG = config;
76
- }
77
- const OPERATIONS_WITH_PRIMARY_RECORDS = new Set(['findRecord', 'findRelatedRecord', 'findRelatedCollection', 'updateRecord', 'deleteRecord']);
78
- function isOperationWithPrimaryRecord(options) {
79
- return OPERATIONS_WITH_PRIMARY_RECORDS.has(options.op);
80
- }
81
- function resourcePathForType(options) {
82
- return options.op === 'findMany' ? options.identifiers[0].type : options.identifier.type;
83
- }
84
-
85
- /**
86
- * Builds a URL for a request based on the provided options.
87
- * Does not include support for building query params (see `buildQueryParams`)
88
- * so that it may be composed cleanly with other query-params strategies.
89
- *
90
- * Usage:
91
- *
92
- * ```ts
93
- * import { buildBaseURL } from '@ember-data/request-utils';
94
- *
95
- * const url = buildBaseURL({
96
- * host: 'https://api.example.com',
97
- * namespace: 'api/v1',
98
- * resourcePath: 'emberDevelopers',
99
- * op: 'query',
100
- * identifier: { type: 'ember-developer' }
101
- * });
102
- *
103
- * // => 'https://api.example.com/api/v1/emberDevelopers'
104
- * ```
105
- *
106
- * On the surface this may seem like a lot of work to do something simple, but
107
- * it is designed to be composable with other utilities and interfaces that the
108
- * average product engineer will never need to see or use.
109
- *
110
- * A few notes:
111
- *
112
- * - `resourcePath` is optional, but if it is not provided, `identifier.type` will be used.
113
- * - `host` and `namespace` are optional, but if they are not provided, the values globally
114
- * configured via `setBuildURLConfig` will be used.
115
- * - `op` is required and must be one of the following:
116
- * - 'findRecord' 'query' 'findMany' 'findRelatedCollection' 'findRelatedRecord'` 'createRecord' 'updateRecord' 'deleteRecord'
117
- * - Depending on the value of `op`, `identifier` or `identifiers` will be required.
118
- *
119
- * @method buildBaseURL
120
- * @static
121
- * @public
122
- * @for @ember-data/request-utils
123
- * @param urlOptions
124
- * @returns string
125
- */
126
- function buildBaseURL(urlOptions) {
127
- const options = Object.assign({
128
- host: CONFIG.host,
129
- namespace: CONFIG.namespace
130
- }, urlOptions);
131
- assert(`buildBaseURL: You must pass \`op\` as part of options`, typeof options.op === 'string' && options.op.length > 0);
132
- assert(`buildBaseURL: You must pass \`identifier\` as part of options`, options.op === 'findMany' || options.identifier && typeof options.identifier === 'object');
133
- assert(`buildBaseURL: You must pass \`identifiers\` as part of options`, options.op !== 'findMany' || options.identifiers && Array.isArray(options.identifiers) && options.identifiers.length > 0 && options.identifiers.every(i => i && typeof i === 'object'));
134
- assert(`buildBaseURL: You must pass valid \`identifier\` as part of options, expected 'id'`, !isOperationWithPrimaryRecord(options) || typeof options.identifier.id === 'string' && options.identifier.id.length > 0);
135
- assert(`buildBaseURL: You must pass \`identifiers\` as part of options`, options.op !== 'findMany' || options.identifiers.every(i => typeof i.id === 'string' && i.id.length > 0));
136
- assert(`buildBaseURL: You must pass valid \`identifier\` as part of options, expected 'type'`, options.op === 'findMany' || typeof options.identifier.type === 'string' && options.identifier.type.length > 0);
137
- assert(`buildBaseURL: You must pass valid \`identifiers\` as part of options, expected 'type'`, options.op !== 'findMany' || typeof options.identifiers[0].type === 'string' && options.identifiers[0].type.length > 0);
138
-
139
- // prettier-ignore
140
- const idPath = isOperationWithPrimaryRecord(options) ? encodeURIComponent(options.identifier.id) : '';
141
- const resourcePath = options.resourcePath || resourcePathForType(options);
142
- const {
143
- host,
144
- namespace
145
- } = options;
146
- const fieldPath = 'fieldPath' in options ? options.fieldPath : '';
147
- assert(`buildBaseURL: You tried to build a ${String(options.op)} request to ${resourcePath} but op must be one of "${['findRecord', 'findRelatedRecord', 'findRelatedCollection', 'updateRecord', 'deleteRecord', 'createRecord', 'query', 'findMany'].join('","')}".`, ['findRecord', 'query', 'findMany', 'findRelatedCollection', 'findRelatedRecord', 'createRecord', 'updateRecord', 'deleteRecord'].includes(options.op));
148
- assert(`buildBaseURL: host must NOT end with '/', received '${host}'`, host === '/' || !host.endsWith('/'));
149
- assert(`buildBaseURL: namespace must NOT start with '/', received '${namespace}'`, !namespace.startsWith('/'));
150
- assert(`buildBaseURL: namespace must NOT end with '/', received '${namespace}'`, !namespace.endsWith('/'));
151
- assert(`buildBaseURL: resourcePath must NOT start with '/', received '${resourcePath}'`, !resourcePath.startsWith('/'));
152
- assert(`buildBaseURL: resourcePath must NOT end with '/', received '${resourcePath}'`, !resourcePath.endsWith('/'));
153
- assert(`buildBaseURL: fieldPath must NOT start with '/', received '${fieldPath}'`, !fieldPath.startsWith('/'));
154
- assert(`buildBaseURL: fieldPath must NOT end with '/', received '${fieldPath}'`, !fieldPath.endsWith('/'));
155
- assert(`buildBaseURL: idPath must NOT start with '/', received '${idPath}'`, !idPath.startsWith('/'));
156
- assert(`buildBaseURL: idPath must NOT end with '/', received '${idPath}'`, !idPath.endsWith('/'));
157
- const url = [host === '/' ? '' : host, namespace, resourcePath, idPath, fieldPath].filter(Boolean).join('/');
158
- return host ? url : `/${url}`;
159
- }
160
- const DEFAULT_QUERY_PARAMS_SERIALIZATION_OPTIONS = {
161
- arrayFormat: 'comma'
162
- };
163
- function handleInclude(include) {
164
- assert(`Expected include to be a string or array, got ${typeof include}`, typeof include === 'string' || Array.isArray(include));
165
- return typeof include === 'string' ? include.split(',') : include;
166
- }
167
-
168
- /**
169
- * filter out keys of an object that have falsy values or point to empty arrays
170
- * returning a new object with only those keys that have truthy values / non-empty arrays
171
- *
172
- * @method filterEmpty
173
- * @static
174
- * @public
175
- * @for @ember-data/request-utils
176
- * @param {Record<string, Serializable>} source object to filter keys with empty values from
177
- * @returns {Record<string, Serializable>} A new object with the keys that contained empty values removed
178
- */
179
- function filterEmpty(source) {
180
- const result = {};
181
- for (const key in source) {
182
- const value = source[key];
183
- // Allow `0` and `false` but filter falsy values that indicate "empty"
184
- if (value !== undefined && value !== null && value !== '') {
185
- if (!Array.isArray(value) || value.length > 0) {
186
- result[key] = source[key];
187
- }
188
- }
189
- }
190
- return result;
191
- }
192
-
193
- /**
194
- * Sorts query params by both key and value returning a new URLSearchParams
195
- * object with the keys inserted in sorted order.
196
- *
197
- * Treats `included` specially, splicing it into an array if it is a string and sorting the array.
198
- *
199
- * Options:
200
- * - arrayFormat: 'bracket' | 'indices' | 'repeat' | 'comma'
201
- *
202
- * 'bracket': appends [] to the key for every value e.g. `&ids[]=1&ids[]=2`
203
- * 'indices': appends [i] to the key for every value e.g. `&ids[0]=1&ids[1]=2`
204
- * 'repeat': appends the key for every value e.g. `&ids=1&ids=2`
205
- * 'comma' (default): appends the key once with a comma separated list of values e.g. `&ids=1,2`
206
- *
207
- * @method sortQueryParams
208
- * @static
209
- * @public
210
- * @for @ember-data/request-utils
211
- * @param {URLSearchParams | object} params
212
- * @param {object} options
213
- * @returns {URLSearchParams} A URLSearchParams with keys inserted in sorted order
214
- */
215
- function sortQueryParams(params, options) {
216
- options = Object.assign({}, DEFAULT_QUERY_PARAMS_SERIALIZATION_OPTIONS, options);
217
- const paramsIsObject = !(params instanceof URLSearchParams);
218
- const urlParams = new URLSearchParams();
219
- const dictionaryParams = paramsIsObject ? params : {};
220
- if (!paramsIsObject) {
221
- params.forEach((value, key) => {
222
- const hasExisting = (key in dictionaryParams);
223
- if (!hasExisting) {
224
- dictionaryParams[key] = value;
225
- } else {
226
- const existingValue = dictionaryParams[key];
227
- if (Array.isArray(existingValue)) {
228
- existingValue.push(value);
229
- } else {
230
- dictionaryParams[key] = [existingValue, value];
231
- }
232
- }
233
- });
234
- }
235
- if ('include' in dictionaryParams) {
236
- dictionaryParams.include = handleInclude(dictionaryParams.include);
237
- }
238
- const sortedKeys = Object.keys(dictionaryParams).sort();
239
- sortedKeys.forEach(key => {
240
- const value = dictionaryParams[key];
241
- if (Array.isArray(value)) {
242
- value.sort();
243
- switch (options.arrayFormat) {
244
- case 'indices':
245
- value.forEach((v, i) => {
246
- urlParams.append(`${key}[${i}]`, String(v));
247
- });
248
- return;
249
- case 'bracket':
250
- value.forEach(v => {
251
- urlParams.append(`${key}[]`, String(v));
252
- });
253
- return;
254
- case 'repeat':
255
- value.forEach(v => {
256
- urlParams.append(key, String(v));
257
- });
258
- return;
259
- case 'comma':
260
- default:
261
- urlParams.append(key, value.join(','));
262
- return;
263
- }
264
- } else {
265
- urlParams.append(key, String(value));
266
- }
267
- });
268
- return urlParams;
269
- }
270
-
271
- /**
272
- * Sorts query params by both key and value, returning a query params string
273
- *
274
- * Treats `included` specially, splicing it into an array if it is a string and sorting the array.
275
- *
276
- * Options:
277
- * - arrayFormat: 'bracket' | 'indices' | 'repeat' | 'comma'
278
- *
279
- * 'bracket': appends [] to the key for every value e.g. `ids[]=1&ids[]=2`
280
- * 'indices': appends [i] to the key for every value e.g. `ids[0]=1&ids[1]=2`
281
- * 'repeat': appends the key for every value e.g. `ids=1&ids=2`
282
- * 'comma' (default): appends the key once with a comma separated list of values e.g. `ids=1,2`
283
- *
284
- * @method sortQueryParams
285
- * @static
286
- * @public
287
- * @for @ember-data/request-utils
288
- * @param {URLSearchParams | object} params
289
- * @param {object} [options]
290
- * @returns {string} A sorted query params string without the leading `?`
291
- */
292
- function buildQueryParams(params, options) {
293
- return sortQueryParams(params, options).toString();
294
- }
295
- const NUMERIC_KEYS = new Set(['max-age', 's-maxage', 'stale-if-error', 'stale-while-revalidate']);
296
-
297
- /**
298
- * Parses a string Cache-Control header value into an object with the following structure:
299
- *
300
- * ```ts
301
- * interface CacheControlValue {
302
- * immutable?: boolean;
303
- * 'max-age'?: number;
304
- * 'must-revalidate'?: boolean;
305
- * 'must-understand'?: boolean;
306
- * 'no-cache'?: boolean;
307
- * 'no-store'?: boolean;
308
- * 'no-transform'?: boolean;
309
- * 'only-if-cached'?: boolean;
310
- * private?: boolean;
311
- * 'proxy-revalidate'?: boolean;
312
- * public?: boolean;
313
- * 's-maxage'?: number;
314
- * 'stale-if-error'?: number;
315
- * 'stale-while-revalidate'?: number;
316
- * }
317
- * ```
318
- * @method parseCacheControl
319
- * @static
320
- * @public
321
- * @for @ember-data/request-utils
322
- * @param {string} header
323
- * @returns {CacheControlValue}
324
- */
325
- function parseCacheControl(header) {
326
- let key = '';
327
- let value = '';
328
- let isParsingKey = true;
329
- let cacheControlValue = {};
330
- function parseCacheControlValue(stringToParse) {
331
- const parsedValue = Number.parseInt(stringToParse);
332
- assert(`Invalid Cache-Control value, expected a number but got - ${stringToParse}`, !Number.isNaN(parsedValue));
333
- return parsedValue;
334
- }
335
- for (let i = 0; i < header.length; i++) {
336
- let char = header.charAt(i);
337
- if (char === ',') {
338
- assert(`Invalid Cache-Control value, expected a value`, !isParsingKey || !NUMERIC_KEYS.has(key));
339
- assert(`Invalid Cache-Control value, expected a value after "=" but got ","`, i === 0 || header.charAt(i - 1) !== '=');
340
- isParsingKey = true;
341
- cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;
342
- key = '';
343
- value = '';
344
- continue;
345
- } else if (char === '=') {
346
- assert(`Invalid Cache-Control value, expected a value after "="`, i + 1 !== header.length);
347
- isParsingKey = false;
348
- } else if (char === ' ' || char === `\t` || char === `\n`) {
349
- continue;
350
- } else if (isParsingKey) {
351
- key += char;
352
- } else {
353
- value += char;
354
- }
355
- if (i === header.length - 1) {
356
- cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;
357
- }
358
- }
359
- return cacheControlValue;
360
- }
361
- function isStale(headers, expirationTime) {
362
- // const age = headers.get('age');
363
- // const cacheControl = parseCacheControl(headers.get('cache-control') || '');
364
- // const expires = headers.get('expires');
365
- // const lastModified = headers.get('last-modified');
366
- const date = headers.get('date');
367
- if (!date) {
368
- return true;
369
- }
370
- const time = new Date(date).getTime();
371
- const now = Date.now();
372
- const deadline = time + expirationTime;
373
- const result = now > deadline;
374
- return result;
375
- }
376
- /**
377
- * A basic LifetimesService that can be added to the Store service.
378
- *
379
- * Determines staleness based on time since the request was last received from the API
380
- * using the `date` header.
381
- *
382
- * This allows the Store's CacheHandler to determine if a request is expired and
383
- * should be refetched upon next request.
384
- *
385
- * The `Fetch` handler provided by `@ember-data/request/fetch` will automatically
386
- * add the `date` header to responses if it is not present.
387
- *
388
- * Usage:
389
- *
390
- * ```ts
391
- * import { LifetimesService } from '@ember-data/request-utils';
392
- * import DataStore from '@ember-data/store';
393
- *
394
- * // ...
395
- *
396
- * export class Store extends DataStore {
397
- * constructor(args) {
398
- * super(args);
399
- * this.lifetimes = new LifetimesService(this, { apiCacheSoftExpires: 30_000, apiCacheHardExpires: 60_000 });
400
- * }
401
- * }
402
- * ```
403
- *
404
- * @class LifetimesService
405
- * @public
406
- * @module @ember-data/request-utils
407
- */
408
- // TODO this doesn't get documented correctly on the website because it shares a class name
409
- // with the interface expected by the Store service
410
- class LifetimesService {
411
- constructor(store, config) {
412
- this.store = store;
413
- this.config = config;
414
- }
415
- isHardExpired(identifier) {
416
- const cached = this.store.cache.peekRequest(identifier);
417
- return !cached || !cached.response || isStale(cached.response.headers, this.config.apiCacheHardExpires);
418
- }
419
- isSoftExpired(identifier) {
420
- const cached = this.store.cache.peekRequest(identifier);
421
- return !cached || !cached.response || isStale(cached.response.headers, this.config.apiCacheSoftExpires);
422
- }
423
- }
424
- export { LifetimesService, buildBaseURL, buildQueryParams, filterEmpty, parseCacheControl, setBuildURLConfig, sortQueryParams };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { assert } from '@ember/debug';\n\nimport type Store from '@ember-data/store';\nimport { StableDocumentIdentifier } from '@ember-data/types/cache/identifier';\n\n/**\n * Simple utility function to assist in url building,\n * query params, and other common request operations.\n *\n * These primitives may be used directly or composed\n * by request builders to provide a consistent interface\n * for building requests.\n *\n * For instance:\n *\n * ```ts\n * import { buildBaseURL, buildQueryParams } from '@ember-data/request-utils';\n *\n * const baseURL = buildBaseURL({\n * host: 'https://api.example.com',\n * namespace: 'api/v1',\n * resourcePath: 'emberDevelopers',\n * op: 'query',\n * identifier: { type: 'ember-developer' }\n * });\n * const url = `${baseURL}?${buildQueryParams({ name: 'Chris', include:['pets'] })}`;\n * // => 'https://api.example.com/api/v1/emberDevelopers?include=pets&name=Chris'\n * ```\n *\n * This is useful, but not as useful as the REST request builder for query which is sugar\n * over this (and more!):\n *\n * ```ts\n * import { query } from '@ember-data/rest/request';\n *\n * const options = query('ember-developer', { name: 'Chris', include:['pets'] });\n * // => { url: 'https://api.example.com/api/v1/emberDevelopers?include=pets&name=Chris' }\n * // Note: options will also include other request options like headers, method, etc.\n * ```\n *\n * @module @ember-data/request-utils\n * @main @ember-data/request-utils\n * @public\n */\n\n// prevents the final constructed object from needing to add\n// host and namespace which are provided by the final consuming\n// class to the prototype which can result in overwrite errors\n\ninterface BuildURLConfig {\n host: string | null;\n namespace: string | null;\n}\n\nlet CONFIG: BuildURLConfig = {\n host: '',\n namespace: '',\n};\n\n/**\n * Sets the global configuration for `buildBaseURL`\n * for host and namespace values for the application.\n *\n * These values may still be overridden by passing\n * them to buildBaseURL directly.\n *\n * This method may be called as many times as needed\n *\n * ```ts\n * type BuildURLConfig = {\n * host: string;\n * namespace: string'\n * }\n * ```\n *\n * @method setBuildURLConfig\n * @static\n * @public\n * @for @ember-data/request-utils\n * @param {BuildURLConfig} config\n * @returns void\n */\nexport function setBuildURLConfig(config: BuildURLConfig) {\n CONFIG = config;\n}\n\nexport interface FindRecordUrlOptions {\n op: 'findRecord';\n identifier: { type: string; id: string };\n resourcePath?: string;\n host?: string;\n namespace?: string;\n}\n\nexport interface QueryUrlOptions {\n op: 'query';\n identifier: { type: string };\n resourcePath?: string;\n host?: string;\n namespace?: string;\n}\n\nexport interface FindManyUrlOptions {\n op: 'findMany';\n identifiers: { type: string; id: string }[];\n resourcePath?: string;\n host?: string;\n namespace?: string;\n}\nexport interface FindRelatedCollectionUrlOptions {\n op: 'findRelatedCollection';\n identifier: { type: string; id: string };\n fieldPath: string;\n resourcePath?: string;\n host?: string;\n namespace?: string;\n}\n\nexport interface FindRelatedResourceUrlOptions {\n op: 'findRelatedRecord';\n identifier: { type: string; id: string };\n fieldPath: string;\n resourcePath?: string;\n host?: string;\n namespace?: string;\n}\n\nexport interface CreateRecordUrlOptions {\n op: 'createRecord';\n identifier: { type: string };\n resourcePath?: string;\n host?: string;\n namespace?: string;\n}\n\nexport interface UpdateRecordUrlOptions {\n op: 'updateRecord';\n identifier: { type: string; id: string };\n resourcePath?: string;\n host?: string;\n namespace?: string;\n}\n\nexport interface DeleteRecordUrlOptions {\n op: 'deleteRecord';\n identifier: { type: string; id: string };\n resourcePath?: string;\n host?: string;\n namespace?: string;\n}\n\nexport type UrlOptions =\n | FindRecordUrlOptions\n | QueryUrlOptions\n | FindManyUrlOptions\n | FindRelatedCollectionUrlOptions\n | FindRelatedResourceUrlOptions\n | CreateRecordUrlOptions\n | UpdateRecordUrlOptions\n | DeleteRecordUrlOptions;\n\nconst OPERATIONS_WITH_PRIMARY_RECORDS = new Set([\n 'findRecord',\n 'findRelatedRecord',\n 'findRelatedCollection',\n 'updateRecord',\n 'deleteRecord',\n]);\n\nfunction isOperationWithPrimaryRecord(\n options: UrlOptions\n): options is\n | FindRecordUrlOptions\n | FindRelatedCollectionUrlOptions\n | FindRelatedResourceUrlOptions\n | UpdateRecordUrlOptions\n | DeleteRecordUrlOptions {\n return OPERATIONS_WITH_PRIMARY_RECORDS.has(options.op);\n}\n\nfunction resourcePathForType(options: UrlOptions): string {\n return options.op === 'findMany' ? options.identifiers[0].type : options.identifier.type;\n}\n\n/**\n * Builds a URL for a request based on the provided options.\n * Does not include support for building query params (see `buildQueryParams`)\n * so that it may be composed cleanly with other query-params strategies.\n *\n * Usage:\n *\n * ```ts\n * import { buildBaseURL } from '@ember-data/request-utils';\n *\n * const url = buildBaseURL({\n * host: 'https://api.example.com',\n * namespace: 'api/v1',\n * resourcePath: 'emberDevelopers',\n * op: 'query',\n * identifier: { type: 'ember-developer' }\n * });\n *\n * // => 'https://api.example.com/api/v1/emberDevelopers'\n * ```\n *\n * On the surface this may seem like a lot of work to do something simple, but\n * it is designed to be composable with other utilities and interfaces that the\n * average product engineer will never need to see or use.\n *\n * A few notes:\n *\n * - `resourcePath` is optional, but if it is not provided, `identifier.type` will be used.\n * - `host` and `namespace` are optional, but if they are not provided, the values globally\n * configured via `setBuildURLConfig` will be used.\n * - `op` is required and must be one of the following:\n * - 'findRecord' 'query' 'findMany' 'findRelatedCollection' 'findRelatedRecord'` 'createRecord' 'updateRecord' 'deleteRecord'\n * - Depending on the value of `op`, `identifier` or `identifiers` will be required.\n *\n * @method buildBaseURL\n * @static\n * @public\n * @for @ember-data/request-utils\n * @param urlOptions\n * @returns string\n */\nexport function buildBaseURL(urlOptions: UrlOptions): string {\n const options = Object.assign(\n {\n host: CONFIG.host,\n namespace: CONFIG.namespace,\n },\n urlOptions\n );\n assert(\n `buildBaseURL: You must pass \\`op\\` as part of options`,\n typeof options.op === 'string' && options.op.length > 0\n );\n assert(\n `buildBaseURL: You must pass \\`identifier\\` as part of options`,\n options.op === 'findMany' || (options.identifier && typeof options.identifier === 'object')\n );\n assert(\n `buildBaseURL: You must pass \\`identifiers\\` as part of options`,\n options.op !== 'findMany' ||\n (options.identifiers &&\n Array.isArray(options.identifiers) &&\n options.identifiers.length > 0 &&\n options.identifiers.every((i) => i && typeof i === 'object'))\n );\n assert(\n `buildBaseURL: You must pass valid \\`identifier\\` as part of options, expected 'id'`,\n !isOperationWithPrimaryRecord(options) ||\n (typeof options.identifier.id === 'string' && options.identifier.id.length > 0)\n );\n assert(\n `buildBaseURL: You must pass \\`identifiers\\` as part of options`,\n options.op !== 'findMany' || options.identifiers.every((i) => typeof i.id === 'string' && i.id.length > 0)\n );\n assert(\n `buildBaseURL: You must pass valid \\`identifier\\` as part of options, expected 'type'`,\n options.op === 'findMany' || (typeof options.identifier.type === 'string' && options.identifier.type.length > 0)\n );\n assert(\n `buildBaseURL: You must pass valid \\`identifiers\\` as part of options, expected 'type'`,\n options.op !== 'findMany' ||\n (typeof options.identifiers[0].type === 'string' && options.identifiers[0].type.length > 0)\n );\n\n // prettier-ignore\n const idPath: string =\n isOperationWithPrimaryRecord(options) ? encodeURIComponent(options.identifier.id)\n : '';\n const resourcePath = options.resourcePath || resourcePathForType(options);\n const { host, namespace } = options;\n const fieldPath = 'fieldPath' in options ? options.fieldPath : '';\n\n assert(\n `buildBaseURL: You tried to build a ${String(\n (options as { op: string }).op\n )} request to ${resourcePath} but op must be one of \"${[\n 'findRecord',\n 'findRelatedRecord',\n 'findRelatedCollection',\n 'updateRecord',\n 'deleteRecord',\n 'createRecord',\n 'query',\n 'findMany',\n ].join('\",\"')}\".`,\n [\n 'findRecord',\n 'query',\n 'findMany',\n 'findRelatedCollection',\n 'findRelatedRecord',\n 'createRecord',\n 'updateRecord',\n 'deleteRecord',\n ].includes(options.op)\n );\n\n assert(`buildBaseURL: host must NOT end with '/', received '${host}'`, host === '/' || !host.endsWith('/'));\n assert(`buildBaseURL: namespace must NOT start with '/', received '${namespace}'`, !namespace.startsWith('/'));\n assert(`buildBaseURL: namespace must NOT end with '/', received '${namespace}'`, !namespace.endsWith('/'));\n assert(\n `buildBaseURL: resourcePath must NOT start with '/', received '${resourcePath}'`,\n !resourcePath.startsWith('/')\n );\n assert(`buildBaseURL: resourcePath must NOT end with '/', received '${resourcePath}'`, !resourcePath.endsWith('/'));\n assert(`buildBaseURL: fieldPath must NOT start with '/', received '${fieldPath}'`, !fieldPath.startsWith('/'));\n assert(`buildBaseURL: fieldPath must NOT end with '/', received '${fieldPath}'`, !fieldPath.endsWith('/'));\n assert(`buildBaseURL: idPath must NOT start with '/', received '${idPath}'`, !idPath.startsWith('/'));\n assert(`buildBaseURL: idPath must NOT end with '/', received '${idPath}'`, !idPath.endsWith('/'));\n\n const url = [host === '/' ? '' : host, namespace, resourcePath, idPath, fieldPath].filter(Boolean).join('/');\n return host ? url : `/${url}`;\n}\n\ntype SerializablePrimitive = string | number | boolean | null;\ntype Serializable = SerializablePrimitive | SerializablePrimitive[];\nexport type QueryParamsSerializationOptions = {\n arrayFormat?: 'bracket' | 'indices' | 'repeat' | 'comma';\n};\nexport type QueryParamsSource = Record<string, Serializable> | URLSearchParams;\n\nconst DEFAULT_QUERY_PARAMS_SERIALIZATION_OPTIONS: QueryParamsSerializationOptions = {\n arrayFormat: 'comma',\n};\n\nfunction handleInclude(include: string | string[]): string[] {\n assert(\n `Expected include to be a string or array, got ${typeof include}`,\n typeof include === 'string' || Array.isArray(include)\n );\n return typeof include === 'string' ? include.split(',') : include;\n}\n\n/**\n * filter out keys of an object that have falsy values or point to empty arrays\n * returning a new object with only those keys that have truthy values / non-empty arrays\n *\n * @method filterEmpty\n * @static\n * @public\n * @for @ember-data/request-utils\n * @param {Record<string, Serializable>} source object to filter keys with empty values from\n * @returns {Record<string, Serializable>} A new object with the keys that contained empty values removed\n */\nexport function filterEmpty(source: Record<string, Serializable>): Record<string, Serializable> {\n const result: Record<string, Serializable> = {};\n for (const key in source) {\n const value = source[key];\n // Allow `0` and `false` but filter falsy values that indicate \"empty\"\n if (value !== undefined && value !== null && value !== '') {\n if (!Array.isArray(value) || value.length > 0) {\n result[key] = source[key];\n }\n }\n }\n return result;\n}\n\n/**\n * Sorts query params by both key and value returning a new URLSearchParams\n * object with the keys inserted in sorted order.\n *\n * Treats `included` specially, splicing it into an array if it is a string and sorting the array.\n *\n * Options:\n * - arrayFormat: 'bracket' | 'indices' | 'repeat' | 'comma'\n *\n * 'bracket': appends [] to the key for every value e.g. `&ids[]=1&ids[]=2`\n * 'indices': appends [i] to the key for every value e.g. `&ids[0]=1&ids[1]=2`\n * 'repeat': appends the key for every value e.g. `&ids=1&ids=2`\n * 'comma' (default): appends the key once with a comma separated list of values e.g. `&ids=1,2`\n *\n * @method sortQueryParams\n * @static\n * @public\n * @for @ember-data/request-utils\n * @param {URLSearchParams | object} params\n * @param {object} options\n * @returns {URLSearchParams} A URLSearchParams with keys inserted in sorted order\n */\nexport function sortQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): URLSearchParams {\n options = Object.assign({}, DEFAULT_QUERY_PARAMS_SERIALIZATION_OPTIONS, options);\n const paramsIsObject = !(params instanceof URLSearchParams);\n const urlParams = new URLSearchParams();\n const dictionaryParams: Record<string, Serializable> = paramsIsObject ? params : {};\n\n if (!paramsIsObject) {\n params.forEach((value, key) => {\n const hasExisting = key in dictionaryParams;\n if (!hasExisting) {\n dictionaryParams[key] = value;\n } else {\n const existingValue = dictionaryParams[key];\n if (Array.isArray(existingValue)) {\n existingValue.push(value);\n } else {\n dictionaryParams[key] = [existingValue, value];\n }\n }\n });\n }\n\n if ('include' in dictionaryParams) {\n dictionaryParams.include = handleInclude(dictionaryParams.include as string | string[]);\n }\n\n const sortedKeys = Object.keys(dictionaryParams).sort();\n sortedKeys.forEach((key) => {\n const value = dictionaryParams[key];\n if (Array.isArray(value)) {\n value.sort();\n switch (options!.arrayFormat) {\n case 'indices':\n value.forEach((v, i) => {\n urlParams.append(`${key}[${i}]`, String(v));\n });\n return;\n case 'bracket':\n value.forEach((v) => {\n urlParams.append(`${key}[]`, String(v));\n });\n return;\n case 'repeat':\n value.forEach((v) => {\n urlParams.append(key, String(v));\n });\n return;\n case 'comma':\n default:\n urlParams.append(key, value.join(','));\n return;\n }\n } else {\n urlParams.append(key, String(value));\n }\n });\n\n return urlParams;\n}\n\n/**\n * Sorts query params by both key and value, returning a query params string\n *\n * Treats `included` specially, splicing it into an array if it is a string and sorting the array.\n *\n * Options:\n * - arrayFormat: 'bracket' | 'indices' | 'repeat' | 'comma'\n *\n * 'bracket': appends [] to the key for every value e.g. `ids[]=1&ids[]=2`\n * 'indices': appends [i] to the key for every value e.g. `ids[0]=1&ids[1]=2`\n * 'repeat': appends the key for every value e.g. `ids=1&ids=2`\n * 'comma' (default): appends the key once with a comma separated list of values e.g. `ids=1,2`\n *\n * @method sortQueryParams\n * @static\n * @public\n * @for @ember-data/request-utils\n * @param {URLSearchParams | object} params\n * @param {object} [options]\n * @returns {string} A sorted query params string without the leading `?`\n */\nexport function buildQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): string {\n return sortQueryParams(params, options).toString();\n}\nexport interface CacheControlValue {\n immutable?: boolean;\n 'max-age'?: number;\n 'must-revalidate'?: boolean;\n 'must-understand'?: boolean;\n 'no-cache'?: boolean;\n 'no-store'?: boolean;\n 'no-transform'?: boolean;\n 'only-if-cached'?: boolean;\n private?: boolean;\n 'proxy-revalidate'?: boolean;\n public?: boolean;\n 's-maxage'?: number;\n 'stale-if-error'?: number;\n 'stale-while-revalidate'?: number;\n}\n\nconst NUMERIC_KEYS = new Set(['max-age', 's-maxage', 'stale-if-error', 'stale-while-revalidate']);\n\n/**\n * Parses a string Cache-Control header value into an object with the following structure:\n *\n * ```ts\n * interface CacheControlValue {\n * immutable?: boolean;\n * 'max-age'?: number;\n * 'must-revalidate'?: boolean;\n * 'must-understand'?: boolean;\n * 'no-cache'?: boolean;\n * 'no-store'?: boolean;\n * 'no-transform'?: boolean;\n * 'only-if-cached'?: boolean;\n * private?: boolean;\n * 'proxy-revalidate'?: boolean;\n * public?: boolean;\n * 's-maxage'?: number;\n * 'stale-if-error'?: number;\n * 'stale-while-revalidate'?: number;\n * }\n * ```\n * @method parseCacheControl\n * @static\n * @public\n * @for @ember-data/request-utils\n * @param {string} header\n * @returns {CacheControlValue}\n */\nexport function parseCacheControl(header: string): CacheControlValue {\n let key = '';\n let value = '';\n let isParsingKey = true;\n let cacheControlValue: CacheControlValue = {};\n\n function parseCacheControlValue(stringToParse: string): number {\n const parsedValue = Number.parseInt(stringToParse);\n assert(`Invalid Cache-Control value, expected a number but got - ${stringToParse}`, !Number.isNaN(parsedValue));\n return parsedValue;\n }\n\n for (let i = 0; i < header.length; i++) {\n let char = header.charAt(i);\n if (char === ',') {\n assert(`Invalid Cache-Control value, expected a value`, !isParsingKey || !NUMERIC_KEYS.has(key));\n assert(\n `Invalid Cache-Control value, expected a value after \"=\" but got \",\"`,\n i === 0 || header.charAt(i - 1) !== '='\n );\n isParsingKey = true;\n cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;\n key = '';\n value = '';\n continue;\n } else if (char === '=') {\n assert(`Invalid Cache-Control value, expected a value after \"=\"`, i + 1 !== header.length);\n isParsingKey = false;\n } else if (char === ' ' || char === `\\t` || char === `\\n`) {\n continue;\n } else if (isParsingKey) {\n key += char;\n } else {\n value += char;\n }\n\n if (i === header.length - 1) {\n cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;\n }\n }\n\n return cacheControlValue;\n}\n\nfunction isStale(headers: Headers, expirationTime: number): boolean {\n // const age = headers.get('age');\n // const cacheControl = parseCacheControl(headers.get('cache-control') || '');\n // const expires = headers.get('expires');\n // const lastModified = headers.get('last-modified');\n const date = headers.get('date');\n\n if (!date) {\n return true;\n }\n\n const time = new Date(date).getTime();\n const now = Date.now();\n const deadline = time + expirationTime;\n\n const result = now > deadline;\n\n return result;\n}\n\nexport type LifetimesConfig = { apiCacheSoftExpires: number; apiCacheHardExpires: number };\n\n/**\n * A basic LifetimesService that can be added to the Store service.\n *\n * Determines staleness based on time since the request was last received from the API\n * using the `date` header.\n *\n * This allows the Store's CacheHandler to determine if a request is expired and\n * should be refetched upon next request.\n *\n * The `Fetch` handler provided by `@ember-data/request/fetch` will automatically\n * add the `date` header to responses if it is not present.\n *\n * Usage:\n *\n * ```ts\n * import { LifetimesService } from '@ember-data/request-utils';\n * import DataStore from '@ember-data/store';\n *\n * // ...\n *\n * export class Store extends DataStore {\n * constructor(args) {\n * super(args);\n * this.lifetimes = new LifetimesService(this, { apiCacheSoftExpires: 30_000, apiCacheHardExpires: 60_000 });\n * }\n * }\n * ```\n *\n * @class LifetimesService\n * @public\n * @module @ember-data/request-utils\n */\n// TODO this doesn't get documented correctly on the website because it shares a class name\n// with the interface expected by the Store service\nexport class LifetimesService {\n declare store: Store;\n declare config: LifetimesConfig;\n constructor(store: Store, config: LifetimesConfig) {\n this.store = store;\n this.config = config;\n }\n\n isHardExpired(identifier: StableDocumentIdentifier): boolean {\n const cached = this.store.cache.peekRequest(identifier);\n return !cached || !cached.response || isStale(cached.response.headers, this.config.apiCacheHardExpires);\n }\n isSoftExpired(identifier: StableDocumentIdentifier): boolean {\n const cached = this.store.cache.peekRequest(identifier);\n return !cached || !cached.response || isStale(cached.response.headers, this.config.apiCacheSoftExpires);\n }\n}\n"],"names":["CONFIG","host","namespace","setBuildURLConfig","config","OPERATIONS_WITH_PRIMARY_RECORDS","Set","isOperationWithPrimaryRecord","options","has","op","resourcePathForType","identifiers","type","identifier","buildBaseURL","urlOptions","Object","assign","assert","length","Array","isArray","every","i","id","idPath","encodeURIComponent","resourcePath","fieldPath","String","join","includes","endsWith","startsWith","url","filter","Boolean","DEFAULT_QUERY_PARAMS_SERIALIZATION_OPTIONS","arrayFormat","handleInclude","include","split","filterEmpty","source","result","key","value","undefined","sortQueryParams","params","paramsIsObject","URLSearchParams","urlParams","dictionaryParams","forEach","hasExisting","existingValue","push","sortedKeys","keys","sort","v","append","buildQueryParams","toString","NUMERIC_KEYS","parseCacheControl","header","isParsingKey","cacheControlValue","parseCacheControlValue","stringToParse","parsedValue","Number","parseInt","isNaN","char","charAt","isStale","headers","expirationTime","date","get","time","Date","getTime","now","deadline","LifetimesService","constructor","store","isHardExpired","cached","cache","peekRequest","response","apiCacheHardExpires","isSoftExpired","apiCacheSoftExpires"],"mappings":";;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AAOA,IAAIA,MAAsB,GAAG;AAC3BC,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,SAAS,EAAE,EAAA;AACb,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,iBAAiBA,CAACC,MAAsB,EAAE;AACxDJ,EAAAA,MAAM,GAAGI,MAAM,CAAA;AACjB,CAAA;AA6EA,MAAMC,+BAA+B,GAAG,IAAIC,GAAG,CAAC,CAC9C,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,cAAc,CACf,CAAC,CAAA;AAEF,SAASC,4BAA4BA,CACnCC,OAAmB,EAMM;AACzB,EAAA,OAAOH,+BAA+B,CAACI,GAAG,CAACD,OAAO,CAACE,EAAE,CAAC,CAAA;AACxD,CAAA;AAEA,SAASC,mBAAmBA,CAACH,OAAmB,EAAU;AACxD,EAAA,OAAOA,OAAO,CAACE,EAAE,KAAK,UAAU,GAAGF,OAAO,CAACI,WAAW,CAAC,CAAC,CAAC,CAACC,IAAI,GAAGL,OAAO,CAACM,UAAU,CAACD,IAAI,CAAA;AAC1F,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,YAAYA,CAACC,UAAsB,EAAU;AAC3D,EAAA,MAAMR,OAAO,GAAGS,MAAM,CAACC,MAAM,CAC3B;IACEjB,IAAI,EAAED,MAAM,CAACC,IAAI;IACjBC,SAAS,EAAEF,MAAM,CAACE,SAAA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AACC,WAAW,CAACjF,UAAU,CAAC,CAAA;IACvD,OAAO,CAAC+E,MAAM,IAAI,CAACA,MAAM,CAACG,QAAQ,IAAIjB,OAAO,CAACc,MAAM,CAACG,QAAQ,CAAChB,OAAO,EAAE,IAAI,CAAC5E,MAAM,CAAC6F,mBAAmB,CAAC,CAAA;AACzG,GAAA;EACAC,aAAaA,CAACpF,UAAoC,EAAW;IAC3D,MAAM+E,MAAM,GAAG,IAAI,CAACF,KAAK,CAACG,KAAK,CAACC,WAAW,CAACjF,UAAU,CAAC,CAAA;IACvD,OAAO,CAAC+E,MAAM,IAAI,CAACA,MAAM,CAACG,QAAQ,IAAIjB,OAAO,CAACc,MAAM,CAACG,QAAQ,CAAChB,OAAO,EAAE,IAAI,CAAC5E,MAAM,CAAC+F,mBAAmB,CAAC,CAAA;AACzG,GAAA;AACF;;;;"}
package/addon-main.js DELETED
@@ -1,19 +0,0 @@
1
- module.exports = {
2
- name: require('./package.json').name,
3
-
4
- treeForVendor() {
5
- return;
6
- },
7
- treeForPublic() {
8
- return;
9
- },
10
- treeForStyles() {
11
- return;
12
- },
13
- treeForAddonStyles() {
14
- return;
15
- },
16
- treeForApp() {
17
- return;
18
- },
19
- };