@ember-data/request-utils 5.6.0-beta.0 → 5.6.0-beta.2

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 (30) hide show
  1. package/addon-main.cjs +1 -1
  2. package/dist/deprecation-support.js +9 -8
  3. package/dist/handlers.js +1 -147
  4. package/dist/index.js +7 -936
  5. package/dist/string.js +1 -2
  6. package/package.json +5 -17
  7. package/unstable-preview-types/deprecation-support.d.ts +2 -2
  8. package/unstable-preview-types/handlers.d.ts +8 -9
  9. package/unstable-preview-types/index.d.ts +10 -685
  10. package/unstable-preview-types/string.d.ts +13 -15
  11. package/dist/deprecation-support.js.map +0 -1
  12. package/dist/handlers.js.map +0 -1
  13. package/dist/index.js.map +0 -1
  14. package/dist/inflect-CwI_k2it.js +0 -305
  15. package/dist/inflect-CwI_k2it.js.map +0 -1
  16. package/dist/string.js.map +0 -1
  17. package/dist/transform-1PDozfHr.js +0 -192
  18. package/dist/transform-1PDozfHr.js.map +0 -1
  19. package/unstable-preview-types/-private/handlers/auto-compress.d.ts +0 -168
  20. package/unstable-preview-types/-private/handlers/auto-compress.d.ts.map +0 -1
  21. package/unstable-preview-types/-private/string/inflect.d.ts +0 -140
  22. package/unstable-preview-types/-private/string/inflect.d.ts.map +0 -1
  23. package/unstable-preview-types/-private/string/inflections.d.ts +0 -12
  24. package/unstable-preview-types/-private/string/inflections.d.ts.map +0 -1
  25. package/unstable-preview-types/-private/string/transform.d.ts +0 -117
  26. package/unstable-preview-types/-private/string/transform.d.ts.map +0 -1
  27. package/unstable-preview-types/deprecation-support.d.ts.map +0 -1
  28. package/unstable-preview-types/handlers.d.ts.map +0 -1
  29. package/unstable-preview-types/index.d.ts.map +0 -1
  30. package/unstable-preview-types/string.d.ts.map +0 -1
@@ -1,17 +1,15 @@
1
1
  declare module '@ember-data/request-utils/string' {
2
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
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
12
+ */
13
+ export * from "@warp-drive/utilities/string";
14
+
15
+ }
@@ -1 +0,0 @@
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/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/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/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/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/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/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/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/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/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;AAC3C,IAAA,MAAMC,mBAAmB,GAAG,IAAID,GAAG,EAAU;IAC7CE,YAAiB,CAACC,OAAO,CAACC,OAAO,CAAC,CAAC,CAACC,KAAK,C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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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlers.js","sources":["../src/-private/handlers/auto-compress.ts"],"sourcesContent":["/**\n * @module @ember-data/request-utils/handlers\n */\nimport type { Future, Handler, NextFn, RequestContext } from '@ember-data/request';\nimport type { HTTPMethod } from '@warp-drive/core-types/request';\n\nfunction isCompressibleMethod(method?: HTTPMethod): boolean {\n return method === 'POST' || method === 'PUT' || method === 'PATCH' || method === 'DELETE';\n}\n\nexport const SupportsRequestStreams = (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request('', {\n body: new ReadableStream(),\n method: 'POST',\n // @ts-expect-error untyped\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\ninterface Constraints {\n /**\n * The minimum size at which to compress blobs\n *\n * @default 1000\n * @typedoc\n */\n Blob?: number;\n /**\n * The minimum size at which to compress array buffers\n *\n * @default 1000\n * @typedoc\n */\n ArrayBuffer?: number;\n /**\n * The minimum size at which to compress typed arrays\n *\n * @default 1000\n * @typedoc\n */\n TypedArray?: number;\n /**\n * The minimum size at which to compress data views\n *\n * @default 1000\n * @typedoc\n */\n DataView?: number;\n /**\n * The minimum size at which to compress strings\n *\n * @default 1000\n * @typedoc\n */\n String?: number;\n}\n\n/**\n * Options for configuring the AutoCompress handler.\n *\n * @typedoc\n */\ninterface CompressionOptions {\n /**\n * The compression format to use. Must be a valid\n * compression format supported by [CompressionStream](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)\n *\n * The default is `gzip`.\n *\n * @typedoc\n */\n format?: CompressionFormat;\n\n /**\n * Some browsers support `ReadableStream` as a request body. This option\n * enables passing the compression stream as the request body instead of\n * the final compressed body when the browser supports doing so.\n *\n * This comes with several caveats:\n *\n * - the request will be put into `duplex: 'half'` mode. This should be\n * transparent to you, but it is worth noting.\n * - the request mode cannot be `no-cors` as requests with a `ReadableStream`\n * have no content length and thus are a new form of request that triggers\n * cors requirements and a preflight request.\n * - http/1.x is not supported.\n *\n * For additional reading about the restrictions of using `ReadableStream`\n * as a request body, see the [Chromium Documentation](https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests#restrictions)\n *\n * Streaming can be enabled per-request in browsers which support it by\n * setting `request.options.allowStreaming` to `true`.\n *\n * Streaming can be forced even when the browser does not support it by setting\n * `request.options.forceStreaming` to `true`. This is useful if later handlers\n * in the chain can handle the request body as a stream.\n *\n * @default false\n * @typedoc\n */\n allowStreaming?: boolean;\n\n /**\n * If `true`, the request will be forced into streaming mode even\n * if the browser does not support it. This is useful if later handlers\n * in the chain can handle the request body as a stream.\n *\n * @default false\n * @typedoc\n */\n forceStreaming?: boolean;\n\n /**\n * The constraints for the request body. This is used to determine\n * whether to compress the request body or not.\n *\n * The defaults are:\n *\n * ```ts\n * {\n * Blob: 1000, // blob.size\n * ArrayBuffer: 1000, // buffer.byteLength\n * TypedArray: 1000, // array.byteLength\n * DataView: 1000, // view.byteLength\n * String: 1000, // string.length\n * }\n * ```\n *\n * The following body types are never compressed unless explicitly\n * configured by the request:\n * - `FormData`\n * - `URLSearchParams`\n * - `ReadableStream`\n *\n * A request.options.compress value of `false` will disable\n * compression for a request body of any type. While a value of\n * `true` will enable compression for the request.\n *\n * An undefined value will use the default, a value of `0` will\n * enable compression for all values, and a value of `-1` will\n * disable compression.\n *\n * @typedoc\n */\n constraints?: Constraints;\n}\n\nconst DEFAULT_CONSTRAINTS = {\n Blob: 1000,\n ArrayBuffer: 1000,\n TypedArray: 1000,\n DataView: 1000,\n String: 1000,\n};\nconst TypedArray = Object.getPrototypeOf(Uint8Array.prototype) as typeof Uint8Array;\n\n/**\n * A request handler that automatically compresses the request body\n * if the request body is a string, array buffer, blob, or form data.\n *\n * This uses the [CompressionStream API](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)\n *\n * The compression format as well as the kinds of data to compress can be\n * configured using the `format` and `constraints` options.\n *\n * ```diff\n * +import { AutoCompress } from '@ember-data/request-utils/handlers';\n * import Fetch from '@ember-data/request/fetch';\n * import RequestManager from '@ember-data/request';\n * import Store from '@ember-data/store';\n *\n * class AppStore extends Store {\n * requestManager = new RequestManager()\n * .use([\n * + new AutoCompress(),\n * Fetch\n * ]);\n * }\n * ```\n *\n * @class AutoCompress\n * @extends Handler\n * @public\n * @since 5.5.0\n */\nexport class AutoCompress implements Handler {\n declare options: Required<CompressionOptions> & { constraints: Required<Constraints> };\n\n constructor(options: CompressionOptions = {}) {\n const opts = {\n format: options.format ?? 'gzip',\n constraints: Object.assign({}, DEFAULT_CONSTRAINTS, options.constraints),\n allowStreaming: options.allowStreaming ?? false,\n forceStreaming: options.forceStreaming ?? false,\n };\n this.options = opts;\n }\n\n request<T>({ request }: RequestContext, next: NextFn<T>): Promise<T> | Future<T> {\n const { constraints } = this.options;\n const { body } = request;\n\n const shouldCompress =\n isCompressibleMethod(request.method) &&\n request.options?.compress !== false &&\n // prettier-ignore\n (request.options?.compress ? true\n : typeof body === 'string' || body instanceof String ? canCompress('String', constraints, body.length)\n : body instanceof Blob ? canCompress('Blob', constraints, body.size)\n : body instanceof ArrayBuffer ? canCompress('ArrayBuffer', constraints, body.byteLength)\n : body instanceof DataView ? canCompress('DataView', constraints, body.byteLength)\n : body instanceof TypedArray ? canCompress('TypedArray', constraints, body.byteLength)\n : false);\n\n if (!shouldCompress) return next(request);\n\n // A convenient way to convert all of the supported body types to a readable\n // stream is to use a `Response` object body\n const response = new Response(request.body);\n const stream = response.body?.pipeThrough(new CompressionStream(this.options.format));\n const headers = new Headers(request.headers);\n headers.set('Content-Encoding', encodingForFormat(this.options.format));\n\n //\n // For browsers that support it, `fetch` can receive a `ReadableStream` as\n // the body, so all we need to do is to create a new `ReadableStream` and\n // compress it on the fly\n //\n const forceStreaming = request.options?.forceStreaming ?? this.options.forceStreaming;\n const allowStreaming = request.options?.allowStreaming ?? this.options.allowStreaming;\n if (forceStreaming || (SupportsRequestStreams && allowStreaming)) {\n const req = Object.assign({}, request, {\n body: stream,\n });\n if (SupportsRequestStreams) {\n // @ts-expect-error untyped\n req.duplex = 'half';\n }\n\n return next(req);\n\n //\n // For non-chromium browsers, we have to \"pull\" the stream to get the final\n // bytes and supply the final byte array as the new request body.\n //\n } else {\n // we need to pull the stream to get the final bytes\n const resp = new Response(stream);\n return resp.blob().then((blob) => {\n const req = Object.assign({}, request, {\n body: blob,\n headers,\n });\n return next(req);\n }) as Promise<T>;\n }\n }\n}\n\nfunction canCompress(type: keyof Constraints, constraints: Required<Constraints>, size: number): boolean {\n // if we have a value of 0, we can compress anything\n if (constraints[type] === 0) return true;\n if (constraints[type] === -1) return false;\n return size >= constraints[type];\n}\n\nfunction encodingForFormat(format: CompressionFormat): string {\n switch (format) {\n case 'gzip':\n case 'deflate':\n case 'deflate-raw':\n return format;\n default:\n throw new Error(`Unsupported compression format: ${format as unknown as string}`);\n }\n}\n"],"names":["isCompressibleMethod","method","SupportsRequestStreams","duplexAccessed","hasContentType","Request","body","ReadableStream","duplex","headers","has","DEFAULT_CONSTRAINTS","Blob","ArrayBuffer","TypedArray","DataView","String","Object","getPrototypeOf","Uint8Array","prototype","AutoCompress","constructor","options","opts","format","constraints","assign","allowStreaming","forceStreaming","request","next","shouldCompress","compress","canCompress","length","size","byteLength","response","Response","stream","pipeThrough","CompressionStream","Headers","set","encodingForFormat","req","resp","blob","then","type","Error"],"mappings":"AAAA;AACA;AACA;;AAIA,SAASA,oBAAoBA,CAACC,MAAmB,EAAW;AAC1D,EAAA,OAAOA,MAAM,KAAK,MAAM,IAAIA,MAAM,KAAK,KAAK,IAAIA,MAAM,KAAK,OAAO,IAAIA,MAAM,KAAK,QAAQ;AAC3F;AAEaC,MAAAA,sBAAsB,GAAG,CAAC,MAAM;EAC3C,IAAIC,cAAc,GAAG,KAAK;AAE1B,EAAA,MAAMC,cAAc,GAAG,IAAIC,OAAO,CAAC,EAAE,EAAE;AACrCC,IAAAA,IAAI,EAAE,IAAIC,cAAc,EAAE;AAC1BN,IAAAA,MAAM,EAAE,MAAM;AACd;IACA,IAAIO,MAAMA,GAAG;AACXL,MAAAA,cAAc,GAAG,IAAI;AACrB,MAAA,OAAO,MAAM;AACf;AACF,GAAC,CAAC,CAACM,OAAO,CAACC,GAAG,CAAC,cAAc,CAAC;EAE9B,OAAOP,cAAc,IAAI,CAACC,cAAc;AAC1C,CAAC;;AAwCD;AACA;AACA;AACA;AACA;;AAsFA,MAAMO,mBAAmB,GAAG;AAC1BC,EAAAA,IAAI,EAAE,IAAI;AACVC,EAAAA,WAAW,EAAE,IAAI;AACjBC,EAAAA,UAAU,EAAE,IAAI;AAChBC,EAAAA,QAAQ,EAAE,IAAI;AACdC,EAAAA,MAAM,EAAE;AACV,CAAC;AACD,MAAMF,UAA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AACF,MAAA,IAAItC,sBAAsB,EAAE;AAC1B;QACA4C,GAAG,CAACtC,MAAM,GAAG,MAAM;AACrB;MAEA,OAAOuB,IAAI,CAACe,GAAG,CAAC;;AAEhB;AACA;AACA;AACA;AACF,KAAC,MAAM;AACL;AACA,MAAA,MAAMC,IAAI,GAAG,IAAIR,QAAQ,CAACC,MAAM,CAAC;MACjC,OAAOO,IAAI,CAACC,IAAI,EAAE,CAACC,IAAI,CAAED,IAAI,IAAK;QAChC,MAAMF,GAAG,GAAG7B,MAAM,CAACU,MAAM,CAAC,EAAE,EAAEG,OAAO,EAAE;AACrCxB,UAAAA,IAAI,EAAE0C,IAAI;AACVvC,UAAAA;AACF,SAAC,CAAC;QACF,OAAOsB,IAAI,CAACe,GAAG,CAAC;AAClB,OAAC,CAAC;AACJ;AACF;AACF;AAEA,SAASZ,WAAWA,CAACgB,IAAuB,EAAExB,WAAkC,EAAEU,IAAY,EAAW;AACvG;EACA,IAAIV,WAAW,CAACwB,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,IAAI;EACxC,IAAIxB,WAAW,CAACwB,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,KAAK;AAC1C,EAAA,OAAOd,IAAI,IAAIV,WAAW,CAACwB,IAAI,CAAC;AAClC;AAEA,SAASL,iBAAiBA,CAACpB,MAAyB,EAAU;AAC5D,EAAA,QAAQA,MAAM;AACZ,IAAA,KAAK,MAAM;AACX,IAAA,KAAK,SAAS;AACd,IAAA,KAAK,aAAa;AAChB,MAAA,OAAOA,MAAM;AACf,IAAA;AACE,MAAA,MAAM,IAAI0B,KAAK,CAAC,CAAmC1B,gCAAAA,EAAAA,MAAM,EAAuB,CAAC;AACrF;AACF;;;;"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { LOG_CACHE_POLICY } from '@warp-drive/build-config/debugging';\nimport { TESTING } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport { getOrSetGlobal } from '@warp-drive/core-types/-private';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { StableDocumentIdentifier } from '@warp-drive/core-types/identifier';\nimport type { QueryParamsSerializationOptions, QueryParamsSource, Serializable } from '@warp-drive/core-types/params';\nimport type { ImmutableRequestInfo, ResponseInfo, StructuredDocument } from '@warp-drive/core-types/request';\nimport type { ResourceDocument } from '@warp-drive/core-types/spec/document';\n\nimport { LRUCache } from './-private/string/transform';\n\ntype UnsubscribeToken = object;\ntype CacheOperation = 'added' | 'removed' | 'updated' | 'state';\ntype DocumentCacheOperation = 'invalidated' | 'added' | 'removed' | 'updated' | 'state';\n\nexport interface NotificationCallback {\n (identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;\n (identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;\n // (identifier: StableRecordIdentifier, notificationType: NotificationType, key?: string): void;\n}\n\ninterface ResourceOperationCallback {\n // resource updates\n (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;\n}\n\ninterface DocumentOperationCallback {\n // document updates\n (identifier: StableDocumentIdentifier, notificationType: DocumentCacheOperation): void;\n}\n\ntype NotificationManager = {\n subscribe(identifier: StableRecordIdentifier, callback: NotificationCallback): UnsubscribeToken;\n subscribe(identifier: 'resource', callback: ResourceOperationCallback): UnsubscribeToken;\n subscribe(identifier: 'document' | StableDocumentIdentifier, callback: DocumentOperationCallback): UnsubscribeToken;\n\n notify(identifier: StableRecordIdentifier, value: 'attributes' | 'relationships', key?: string): boolean;\n notify(identifier: StableRecordIdentifier, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;\n notify(identifier: StableRecordIdentifier, value: CacheOperation): boolean;\n notify(identifier: StableDocumentIdentifier, value: DocumentCacheOperation): boolean;\n};\n\ntype Store = {\n cache: Cache;\n notifications: NotificationManager;\n};\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\nexport interface BuildURLConfig {\n host: string | null;\n namespace: string | null;\n}\n\nconst CONFIG: BuildURLConfig = getOrSetGlobal('CONFIG', {\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 * host values of `''` or `'/'` are equivalent.\n *\n * Except for the value of `/` as host, host should not\n * end with `/`.\n *\n * namespace should not start or end with a `/`.\n *\n * ```ts\n * type BuildURLConfig = {\n * host: string;\n * namespace: string'\n * }\n * ```\n *\n * Example:\n *\n * ```ts\n * import { setBuildURLConfig } from '@ember-data/request-utils';\n *\n * setBuildURLConfig({\n * host: 'https://api.example.com',\n * namespace: 'api/v1'\n * });\n * ```\n *\n * @method setBuildURLConfig\n * @static\n * @public\n * @for @ember-data/request-utils\n * @param {BuildURLConfig} config\n * @return void\n */\nexport function setBuildURLConfig(config: BuildURLConfig) {\n assert(`setBuildURLConfig: You must pass a config object`, config);\n assert(\n `setBuildURLConfig: You must pass a config object with a 'host' or 'namespace' property`,\n 'host' in config || 'namespace' in config\n );\n\n CONFIG.host = config.host || '';\n CONFIG.namespace = config.namespace || '';\n\n assert(\n `buildBaseURL: host must NOT end with '/', received '${CONFIG.host}'`,\n CONFIG.host === '/' || !CONFIG.host.endsWith('/')\n );\n assert(\n `buildBaseURL: namespace must NOT start with '/', received '${CONFIG.namespace}'`,\n !CONFIG.namespace.startsWith('/')\n );\n assert(\n `buildBaseURL: namespace must NOT end with '/', received '${CONFIG.namespace}'`,\n !CONFIG.namespace.endsWith('/')\n );\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 interface GenericUrlOptions {\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 | GenericUrlOptions;\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 'op' in options && OPERATIONS_WITH_PRIMARY_RECORDS.has(options.op);\n}\n\nfunction hasResourcePath(options: UrlOptions): options is GenericUrlOptions {\n return 'resourcePath' in options && typeof options.resourcePath === 'string' && options.resourcePath.length > 0;\n}\n\nfunction resourcePathForType(options: UrlOptions): string {\n assert(\n `resourcePathForType: You must pass a valid op as part of options`,\n 'op' in options && typeof options.op === 'string'\n );\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 * @return 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 hasResourcePath(options) || (typeof options.op === 'string' && options.op.length > 0)\n );\n assert(\n `buildBaseURL: You must pass \\`identifier\\` as part of options`,\n hasResourcePath(options) ||\n options.op === 'findMany' ||\n (options.identifier && typeof options.identifier === 'object')\n );\n assert(\n `buildBaseURL: You must pass \\`identifiers\\` as part of options`,\n hasResourcePath(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 hasResourcePath(options) ||\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 hasResourcePath(options) ||\n options.op !== 'findMany' ||\n 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 hasResourcePath(options) ||\n options.op === 'findMany' ||\n (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 hasResourcePath(options) ||\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 url for a ${String(\n 'op' in options ? options.op + ' ' : ''\n )}request to ${resourcePath} but resourcePath must be set or op must be one of \"${[\n 'findRecord',\n 'findRelatedRecord',\n 'findRelatedCollection',\n 'updateRecord',\n 'deleteRecord',\n 'createRecord',\n 'query',\n 'findMany',\n ].join('\",\"')}\".`,\n hasResourcePath(options) ||\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 hasHost = host !== '' && host !== '/';\n const url = [hasHost ? host : '', namespace, resourcePath, idPath, fieldPath].filter(Boolean).join('/');\n return hasHost ? url : `/${url}`;\n}\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 * @return {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 * @return {URLSearchParams} A URLSearchParams with keys inserted in sorted order\n */\nexport function sortQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): URLSearchParams {\n const opts = 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 (opts.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 buildQueryParams\n * @static\n * @public\n * @for @ember-data/request-utils\n * @param {URLSearchParams | Object} params\n * @param {Object} [options]\n * @return {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\ntype CacheControlKey = keyof CacheControlValue;\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 * @return {CacheControlValue}\n */\nexport function parseCacheControl(header: string): CacheControlValue {\n return CACHE_CONTROL_CACHE.get(header);\n}\n\nconst CACHE_CONTROL_CACHE = new LRUCache((header: string) => {\n let key: CacheControlKey = '' as CacheControlKey;\n let value = '';\n let isParsingKey = true;\n const cacheControlValue: CacheControlValue = {};\n\n for (let i = 0; i < header.length; i++) {\n const 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 // @ts-expect-error TS incorrectly thinks that optional keys must have a type that includes undefined\n cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;\n key = '' as CacheControlKey;\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 // @ts-expect-error TS incorrectly thinks that optional keys must have a type that includes undefined\n cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;\n }\n }\n\n return cacheControlValue;\n}, 200);\n\nfunction 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 assert(`Invalid Cache-Control value, expected a number greater than 0 but got - ${stringToParse}`, parsedValue >= 0);\n if (Number.isNaN(parsedValue) || parsedValue < 0) {\n return 0;\n }\n\n return parsedValue;\n}\n\nfunction isExpired(\n identifier: StableDocumentIdentifier,\n request: StructuredDocument<ResourceDocument>,\n config: PolicyConfig\n): boolean {\n const { constraints } = config;\n\n if (constraints?.isExpired) {\n const result = constraints.isExpired(request);\n if (result !== null) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${identifier.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because constraints.isExpired returned ${result}`\n );\n }\n return result;\n }\n }\n\n const { headers } = request.response!;\n\n if (!headers) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${identifier.lid} is EXPIRED because no headers were provided`);\n }\n\n // if we have no headers then both the headers based expiration\n // and the time based expiration will be considered expired\n return true;\n }\n\n // check for X-WarpDrive-Expires\n const now = Date.now();\n const date = headers.get('Date');\n\n if (constraints?.headers) {\n if (constraints.headers['X-WarpDrive-Expires']) {\n const xWarpDriveExpires = headers.get('X-WarpDrive-Expires');\n if (xWarpDriveExpires) {\n const expirationTime = new Date(xWarpDriveExpires).getTime();\n const result = now >= expirationTime;\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${identifier.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by X-WarpDrive-Expires header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n return result;\n }\n }\n\n // check for Cache-Control\n if (constraints.headers['Cache-Control']) {\n const cacheControl = headers.get('Cache-Control');\n const age = headers.get('Age');\n\n if (cacheControl && age && date) {\n const cacheControlValue = parseCacheControl(cacheControl);\n\n // max-age and s-maxage are stored in\n const maxAge = cacheControlValue['max-age'] || cacheControlValue['s-maxage'];\n\n if (maxAge) {\n // age is stored in seconds\n const ageValue = parseInt(age, 10);\n assert(`Invalid Cache-Control value, expected a number but got - ${age}`, !Number.isNaN(ageValue));\n assert(`Invalid Cache-Control value, expected a number greater than 0 but got - ${age}`, ageValue >= 0);\n\n if (!Number.isNaN(ageValue) && ageValue >= 0) {\n const dateValue = new Date(date).getTime();\n const expirationTime = dateValue + (maxAge - ageValue) * 1000;\n const result = now >= expirationTime;\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${identifier.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by Cache-Control header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n\n return result;\n }\n }\n }\n }\n\n // check for Expires\n if (constraints.headers.Expires) {\n const expires = headers.get('Expires');\n if (expires) {\n const expirationTime = new Date(expires).getTime();\n const result = now >= expirationTime;\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${identifier.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by Expires header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n return result;\n }\n }\n }\n\n // check for Date\n if (!date) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${identifier.lid} is EXPIRED because no Date header was provided`);\n }\n return true;\n }\n\n let expirationTime = config.apiCacheHardExpires;\n if (TESTING) {\n if (!config.disableTestOptimization) {\n expirationTime = config.apiCacheSoftExpires;\n }\n }\n\n const time = new Date(date).getTime();\n const deadline = time + expirationTime;\n const result = now >= deadline;\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${identifier.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the apiCacheHardExpires time since the response's Date header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n\n return result;\n}\n\n/**\n * The configuration options for the CachePolicy\n * provided by `@ember-data/request-utils`.\n *\n * ```ts\n * import { CachePolicy } from '@ember-data/request-utils';\n *\n * new CachePolicy({\n * // ... PolicyConfig Settings ... //\n * });\n * ```\n *\n * @typedoc\n */\nexport type PolicyConfig = {\n /**\n * the number of milliseconds after which a request is considered\n * stale. If a request is issued again after this time, the request\n * will respond from cache immediately while a background request\n * is made to update the cache.\n *\n * This is calculated against the `date` header of the response.\n *\n * If your API does not provide a `date` header, the `Fetch` handler\n * provided by `@ember-data/request/fetch` will automatically add\n * it to responses if it is not present. Responses without a `date`\n * header will be considered stale immediately.\n *\n * @typedoc\n */\n apiCacheSoftExpires: number;\n /**\n * the number of milliseconds after which a request is considered\n * expired and should be re-fetched. If a request is issued again\n * after this time, the request will disregard the cache and\n * wait for a fresh response from the API.\n *\n * This is calculated against the `date` header of the response.\n *\n * If your API does not provide a `date` header, the `Fetch` handler\n * provided by `@ember-data/request/fetch` will automatically add\n * it to responses if it is not present. Responses without a `date`\n * header will be considered hard expired immediately.\n *\n * @typedoc\n */\n apiCacheHardExpires: number;\n /**\n * In Testing environments, the `apiCacheSoftExpires` will always be `false`\n * and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.\n *\n * This helps reduce flakiness and produce predictably rendered results in test suites.\n *\n * Requests that specifically set `cacheOptions.backgroundReload = true` will\n * still be background reloaded in tests.\n *\n * This behavior can be opted out of by setting this value to `true`.\n *\n * @typedoc\n */\n disableTestOptimization?: boolean;\n\n /**\n * In addition to the simple time-based expiration strategy, CachePolicy\n * supports various common server-supplied expiration strategies via\n * headers, as well as custom expiration strategies via the `isExpired`\n * function.\n *\n * Requests will be validated for expiration against these constraints.\n * If any of these constraints are not met, the request will be considered\n * expired. If all constraints are met, the request will be considered\n * valid and the time based expiration strategy will NOT be used.\n *\n * Meeting a constraint means BOTH that the properties the constraint\n * requires are present AND that the expiration time indicated by those\n * properties has not been exceeded.\n *\n * In other words, if the properties for a constraint are not present,\n * this does not count either as meeting or as not meeting the constraint,\n * the constraint simply does not apply.\n *\n * The `isExpired` function is called with the request and should return\n * `true` if the request is expired, `false` if it is not expired, and\n * `null` if the expiration status is unknown.\n *\n * In order constraints are checked:\n *\n * - isExpired function\n * - ↳ (if null) X-WarpDrive-Expires header\n * - ↳ (if null) Cache-Control header\n * - ↳ (if null) Expires header\n *\n * @typedoc\n */\n constraints?: {\n /**\n * Headers that should be checked for expiration.\n *\n * @typedoc\n */\n headers?: {\n /**\n * Whether the `Cache-Control` header should be checked for expiration.\n * If `true`, then the `max-age` and `s-maxage` directives are used alongside\n * the `Age` and `Date` headers to determine if the expiration time has passed.\n *\n * Other directives are ignored.\n *\n * 'Cache-Control' will take precedence over 'Expires' if both are present\n * and both configured to be checked.\n *\n * @typedoc\n */\n 'Cache-Control'?: boolean;\n\n /**\n * Whether the `Expires` header should be checked for expiration.\n *\n * If `true`, then the `Expires` header is used to caclulate the expiration time\n * and determine if the expiration time has passed.\n *\n * 'Cache-Control' will take precedence over 'Expires' if both are present.\n *\n * @typedoc\n */\n Expires?: boolean;\n\n /**\n * Whether the `X-WarpDrive-Expires` header should be checked for expiration.\n *\n * If `true`, then the `X-WarpDrive-Expires` header is used to caclulate the expiration time\n * and determine if the expiration time has passed.\n *\n * This header will take precedence over 'Cache-Control' and 'Expires' if all three are present.\n *\n * The header's value should be a [UTC date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString).\n *\n * @typedoc\n */\n 'X-WarpDrive-Expires'?: boolean;\n };\n\n /**\n * A function that should be called to determine if the request is expired.\n *\n * If present, this function will be called with the request and should return\n * `true` if the request is expired, `false` if it is not expired, and\n * `null` if the expiration status is unknown.\n *\n * If the function does not return `null`,\n *\n * @typedoc\n */\n isExpired?: (request: StructuredDocument<ResourceDocument>) => boolean | null;\n };\n};\n\n/**\n * A basic CachePolicy 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 * Determines expiration based on configured constraints as well as a time based\n * expiration strategy based on the `date` header.\n *\n * In order expiration is determined by:\n *\n * - Is explicitly invalidated\n * - ↳ (if null) isExpired function <IF Constraint Active>\n * - ↳ (if null) X-WarpDrive-Expires header <IF Constraint Active>\n * - ↳ (if null) Cache-Control header <IF Constraint Active>\n * - ↳ (if null) Expires header <IF Constraint Active>\n * - ↳ (if null) Date header + apiCacheHardExpires < current time\n *\n * Invalidates any request for which `cacheOptions.types` was provided when a createRecord\n * request for that type is successful.\n *\n * For this to work, the `createRecord` request must include the `cacheOptions.types` array\n * with the types that should be invalidated, or its request should specify the identifiers\n * of the records that are being created via `records`. Providing both is valid.\n *\n * > [!NOTE]\n * > only requests that had specified `cacheOptions.types` and occurred prior to the\n * > createRecord request will be invalidated. This means that a given request should always\n * > specify the types that would invalidate it to opt into this behavior. Abstracting this\n * > behavior via builders is recommended to ensure consistency.\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 * > [!NOTE]\n * > Date headers do not have millisecond precision, so expiration times should\n * > generally be larger than 1000ms.\n *\n * Usage:\n *\n * ```ts\n * import { CachePolicy } 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 CachePolicy({ apiCacheSoftExpires: 30_000, apiCacheHardExpires: 60_000 });\n * }\n * }\n * ```\n *\n * In Testing environments, the `apiCacheSoftExpires` will always be `false`\n * and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.\n *\n * This helps reduce flakiness and produce predictably rendered results in test suites.\n *\n * Requests that specifically set `cacheOptions.backgroundReload = true` will\n * still be background reloaded in tests.\n *\n * This behavior can be opted out of by setting `disableTestOptimization = true`\n * in the policy config.\n *\n * @class CachePolicy\n * @public\n * @module @ember-data/request-utils\n */\nexport class CachePolicy {\n declare config: PolicyConfig;\n declare _stores: WeakMap<\n Store,\n { invalidated: Set<StableDocumentIdentifier>; types: Map<string, Set<StableDocumentIdentifier>> }\n >;\n\n _getStore(store: Store): {\n invalidated: Set<StableDocumentIdentifier>;\n types: Map<string, Set<StableDocumentIdentifier>>;\n } {\n let set = this._stores.get(store);\n if (!set) {\n set = { invalidated: new Set(), types: new Map() };\n this._stores.set(store, set);\n }\n return set;\n }\n\n constructor(config: PolicyConfig) {\n this._stores = new WeakMap();\n\n const _config = arguments.length === 1 ? config : (arguments[1] as unknown as PolicyConfig);\n deprecate(\n `Passing a Store to the CachePolicy is deprecated, please pass only a config instead.`,\n arguments.length === 1,\n {\n id: 'ember-data:request-utils:lifetimes-service-store-arg',\n since: {\n enabled: '5.4',\n available: '4.13',\n },\n for: '@ember-data/request-utils',\n until: '6.0',\n }\n );\n assert(`You must pass a config to the CachePolicy`, _config);\n assert(`You must pass a apiCacheSoftExpires to the CachePolicy`, typeof _config.apiCacheSoftExpires === 'number');\n assert(`You must pass a apiCacheHardExpires to the CachePolicy`, typeof _config.apiCacheHardExpires === 'number');\n this.config = _config;\n }\n\n /**\n * Invalidate a request by its identifier for a given store instance.\n *\n * While the store argument may seem redundant, the CachePolicy\n * is designed to be shared across multiple stores / forks\n * of the store.\n *\n * ```ts\n * store.lifetimes.invalidateRequest(store, identifier);\n * ```\n *\n * @method invalidateRequest\n * @public\n * @param {StableDocumentIdentifier} identifier\n * @param {Store} store\n */\n invalidateRequest(identifier: StableDocumentIdentifier, store: Store): void {\n this._getStore(store).invalidated.add(identifier);\n }\n\n /**\n * Invalidate all requests associated to a specific type\n * for a given store instance.\n *\n * While the store argument may seem redundant, the CachePolicy\n * is designed to be shared across multiple stores / forks\n * of the store.\n *\n * This invalidation is done automatically when using this service\n * for both the CacheHandler and the LegacyNetworkHandler.\n *\n * ```ts\n * store.lifetimes.invalidateRequestsForType(store, 'person');\n * ```\n *\n * @method invalidateRequestsForType\n * @public\n * @param {String} type\n * @param {Store} store\n */\n invalidateRequestsForType(type: string, store: Store): void {\n const storeCache = this._getStore(store);\n const set = storeCache.types.get(type);\n const notifications = store.notifications;\n\n if (set) {\n // TODO batch notifications\n set.forEach((id) => {\n storeCache.invalidated.add(id);\n notifications.notify(id, 'invalidated');\n });\n }\n }\n\n /**\n * Invoked when a request has been fulfilled from the configured request handlers.\n * This is invoked by the CacheHandler for both foreground and background requests\n * once the cache has been updated.\n *\n * Note, this is invoked by the CacheHandler regardless of whether\n * the request has a cache-key.\n *\n * This method should not be invoked directly by consumers.\n *\n * @method didRequest\n * @public\n * @param {ImmutableRequestInfo} request\n * @param {ImmutableResponse} response\n * @param {Store} store\n * @param {StableDocumentIdentifier | null} identifier\n * @return {void}\n */\n didRequest(\n request: ImmutableRequestInfo,\n response: Response | ResponseInfo | null,\n identifier: StableDocumentIdentifier | null,\n store: Store\n ): void {\n // if this is a successful createRecord request, invalidate the cacheKey for the type\n if (request.op === 'createRecord') {\n const statusNumber = response?.status ?? 0;\n if (statusNumber >= 200 && statusNumber < 400) {\n const types = new Set(request.records?.map((r) => r.type));\n const additionalTypes = request.cacheOptions?.types;\n additionalTypes?.forEach((type) => {\n types.add(type);\n });\n\n types.forEach((type) => {\n this.invalidateRequestsForType(type, store);\n });\n }\n\n // add this document's cacheKey to a map for all associated types\n // it is recommended to only use this for queries\n } else if (identifier && request.cacheOptions?.types?.length) {\n const storeCache = this._getStore(store);\n request.cacheOptions?.types.forEach((type) => {\n const set = storeCache.types.get(type);\n if (set) {\n set.add(identifier);\n storeCache.invalidated.delete(identifier);\n } else {\n storeCache.types.set(type, new Set([identifier]));\n }\n });\n }\n }\n\n /**\n * Invoked to determine if the request may be fulfilled from cache\n * if possible.\n *\n * Note, this is only invoked by the CacheHandler if the request has\n * a cache-key.\n *\n * If no cache entry is found or the entry is hard expired,\n * the request will be fulfilled from the configured request handlers\n * and the cache will be updated before returning the response.\n *\n * @method isHardExpired\n * @public\n * @param {StableDocumentIdentifier} identifier\n * @param {Store} store\n * @return {Boolean} true if the request is considered hard expired\n */\n isHardExpired(identifier: StableDocumentIdentifier, store: Store): boolean {\n // if we are explicitly invalidated, we are hard expired\n const storeCache = this._getStore(store);\n if (storeCache.invalidated.has(identifier)) {\n return true;\n }\n const cache = store.cache;\n const cached = cache.peekRequest(identifier);\n\n if (!cached?.response) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${identifier.lid} is EXPIRED because no cache entry was found`);\n }\n return true;\n }\n\n return isExpired(identifier, cached, this.config);\n }\n\n /**\n * Invoked if `isHardExpired` is false to determine if the request\n * should be update behind the scenes if cache data is already available.\n *\n * Note, this is only invoked by the CacheHandler if the request has\n * a cache-key.\n *\n * If true, the request will be fulfilled from cache while a backgrounded\n * request is made to update the cache via the configured request handlers.\n *\n * @method isSoftExpired\n * @public\n * @param {StableDocumentIdentifier} identifier\n * @param {Store} store\n * @return {Boolean} true if the request is considered soft expired\n */\n isSoftExpired(identifier: StableDocumentIdentifier, store: Store): boolean {\n if (TESTING) {\n if (!this.config.disableTestOptimization) {\n return false;\n }\n }\n const cache = store.cache;\n const cached = cache.peekRequest(identifier);\n\n if (cached?.response) {\n const date = cached.response.headers.get('date');\n\n if (!date) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${identifier.lid} is STALE because no date header was found`);\n }\n return true;\n } else {\n const time = new Date(date).getTime();\n const now = Date.now();\n const deadline = time + this.config.apiCacheSoftExpires;\n const result = now >= deadline;\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${identifier.lid} is ${result ? 'STALE' : 'NOT stale'}. Expiration time: ${deadline}, now: ${now}`\n );\n }\n\n return result;\n }\n }\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${identifier.lid} is STALE because no cache entry was found`);\n }\n\n return true;\n }\n}\n\nexport class LifetimesService extends CachePolicy {\n constructor(config: PolicyConfig) {\n deprecate(\n `\\`import { LifetimesService } from '@ember-data/request-utils';\\` is deprecated, please use \\`import { CachePolicy } from '@ember-data/request-utils';\\` instead.`,\n false,\n {\n id: 'ember-data:deprecate-lifetimes-service-import',\n since: {\n enabled: '5.4',\n available: '4.13',\n },\n for: 'ember-data',\n until: '6.0',\n }\n );\n super(config);\n }\n}\n"],"names":["CONFIG","getOrSetGlobal","host","namespace","setBuildURLConfig","config","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","endsWith","startsWith","OPERATIONS_WITH_PRIMARY_RECORDS","Set","isOperationWithPrimaryRecord","options","has","op","hasResourcePath","resourcePath","length","resourcePathForType","identifiers","type","identifier","buildBaseURL","urlOptions","Object","assign","Array","isArray","every","i","id","idPath","encodeURIComponent","fieldPath","String","join","includes","hasHost","url","filter","Boolean","DEFAULT_QUERY_PARAMS_SERIALIZATION_OPTIONS","arrayFormat","handleInclude","include","split","filterEmpty","source","result","key","value","undefined","sortQueryParams","params","opts","paramsIsObject","URLSearchParams","urlParams","dictionaryParams","forEach","hasExisting","existingValue","push","sortedKeys","keys","sort","v","append","buildQueryParams","toString","NUMERIC_KEYS","parseCacheControl","header","CACHE_CONTROL_CACHE","get","LRUCache","isParsingKey","cacheControlValue","char","charAt","parseCacheControlValue","stringToParse","parsedValue","Number","parseInt","isNaN","isExpired","request","constraints","activeLogging","LOG_CACHE_POLICY","debug","globalThis","getWarpDriveRuntimeConfig","console","log","lid","headers","response","now","Date","date","xWarpDriveExpires","expirationTime","getTime","cacheControl","age","maxAge","ageValue","dateValue","Expires","expires","apiCacheHardExpires","TESTING","disableTestOptimization","apiCacheSoftExpires","time","deadline","CachePolicy","_getStore","store","set","_stores","invalidated","types","Map","constructor","WeakMap","_config","arguments","deprecate","since","enabled","available","for","until","invalidateRequest","add","invalidateRequestsForType","storeCache","notifications","notify","didRequest","statusNumber","status","records","map","r","additionalTypes","cacheOptions","delete","isHardExpired","cache","cached","peekRequest","isSoftExpired","LifetimesService"],"mappings":";;;;;AAmDA;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,MAAMA,MAAsB,GAAGC,cAAc,CAAC,QAAQ,EAAE;AACtDC,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,SAAS,EAAE;AACb,CAAC,CAAC;;AAEF;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,SAASC,iBAAiBA,CAACC,MAAsB,EAAE;EACxDC,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,IAAA,IAAA,CAAAA,IAAA,EAAA;MAAA,MAAAC,IAAAA,KAAA,CAAO,CAAkD,gDAAA,CAAA,CAAA;AAAA;AAAA,GAAA,EAAEP,MAAM,CAAA,GAAA,EAAA;EACjEC,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,IAAA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,EAAgB1E,UAAU,CAAC2E,GAAG,4CAA4C,CAAC;AACzF;AAAC;AAED,IAAA,OAAO,IAAI;AACb;AACF;AAEO,MAAM4D,gBAAgB,SAAStC,WAAW,CAAC;EAChDQ,WAAWA,CAAC/H,MAAoB,EAAE;AAChCmI,IAAAA,SAAS,CACP,CAAA,iKAAA,CAAmK,EACnK,KAAK,EACL;AACEpG,MAAAA,EAAE,EAAE,+CAA+C;AACnDqG,MAAAA,KAAK,EAAE;AACLC,QAAAA,OAAO,EAAE,KAAK;AACdC,QAAAA,SAAS,EAAE;OACZ;AACDC,MAAAA,GAAG,EAAE,YAAY;AACjBC,MAAAA,KAAK,EAAE;AACT,KACF,CAAC;IACD,KAAK,CAACxI,MAAM,CAAC;AACf;AACF;;;;"}
@@ -1,305 +0,0 @@
1
- import { L as LRUCache, a as capitalize } from "./transform-1PDozfHr.js";
2
- import { macroCondition, getGlobalConfig } from '@embroider/macros';
3
- const defaultRules = {
4
- plurals: [[/$/, 's'], [/s$/i, 's'], [/^(ax|test)is$/i, '$1es'], [/(octop|vir)us$/i, '$1i'], [/(octop|vir)i$/i, '$1i'], [/(alias|status|bonus)$/i, '$1es'], [/(bu)s$/i, '$1ses'], [/(buffal|tomat)o$/i, '$1oes'], [/([ti])um$/i, '$1a'], [/([ti])a$/i, '$1a'], [/sis$/i, 'ses'], [/(?:([^f])fe|([lr])f)$/i, '$1$2ves'], [/(hive)$/i, '$1s'], [/([^aeiouy]|qu)y$/i, '$1ies'], [/(x|ch|ss|sh)$/i, '$1es'], [/(matr|vert|ind)(?:ix|ex)$/i, '$1ices'], [/^(m|l)ouse$/i, '$1ice'], [/^(m|l)ice$/i, '$1ice'], [/^(ox)$/i, '$1en'], [/^(oxen)$/i, '$1'], [/(quiz)$/i, '$1zes']],
5
- singular: [[/s$/i, ''], [/(ss)$/i, '$1'], [/(n)ews$/i, '$1ews'], [/([ti])a$/i, '$1um'], [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '$1sis'], [/(^analy)(sis|ses)$/i, '$1sis'], [/([^f])ves$/i, '$1fe'], [/(hive)s$/i, '$1'], [/(tive)s$/i, '$1'], [/([lr])ves$/i, '$1f'], [/([^aeiouy]|qu)ies$/i, '$1y'], [/(s)eries$/i, '$1eries'], [/(m)ovies$/i, '$1ovie'], [/(x|ch|ss|sh)es$/i, '$1'], [/^(m|l)ice$/i, '$1ouse'], [/(bus)(es)?$/i, '$1'], [/(o)es$/i, '$1'], [/(shoe)s$/i, '$1'], [/(cris|test)(is|es)$/i, '$1is'], [/^(a)x[ie]s$/i, '$1xis'], [/(octop|vir)(us|i)$/i, '$1us'], [/(alias|status|bonus)(es)?$/i, '$1'], [/^(ox)en/i, '$1'], [/(vert|ind)ices$/i, '$1ex'], [/(matr)ices$/i, '$1ix'], [/(quiz)zes$/i, '$1'], [/(database)s$/i, '$1']],
6
- irregularPairs: [['person', 'people'], ['man', 'men'], ['child', 'children'], ['sex', 'sexes'], ['move', 'moves'], ['cow', 'kine'], ['zombie', 'zombies']],
7
- uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police']
8
- };
9
-
10
- /**
11
- * @module @ember-data/request-utils/string
12
- */
13
-
14
- const BLANK_REGEX = /^\s*$/;
15
- const LAST_WORD_DASHED_REGEX = /([\w/-]+[_/\s-])([a-z\d]+$)/;
16
- const LAST_WORD_CAMELIZED_REGEX = /([\w/\s-]+)([A-Z][a-z\d]*$)/;
17
- const CAMELIZED_REGEX = /[A-Z][a-z\d]*$/;
18
- const SINGULARS = new LRUCache(word => {
19
- return _singularize(word);
20
- });
21
- const PLURALS = new LRUCache(word => {
22
- return _pluralize(word);
23
- });
24
- const UNCOUNTABLE = new Set(defaultRules.uncountable);
25
- const IRREGULAR = new Map();
26
- const INVERSE_IRREGULAR = new Map();
27
- const SINGULAR_RULES = new Map(defaultRules.singular.reverse());
28
- const PLURAL_RULES = new Map(defaultRules.plurals.reverse());
29
-
30
- /**
31
- * Marks a word as uncountable. Uncountable words are not pluralized
32
- * or singularized.
33
- *
34
- * @method uncountable
35
- * @public
36
- * @static
37
- * @for @ember-data/request-utils/string
38
- * @param {String} word
39
- * @return {void}
40
- * @since 4.13.0
41
- */
42
- function uncountable(word) {
43
- UNCOUNTABLE.add(word.toLowerCase());
44
- }
45
-
46
- /**
47
- * Marks a list of words as uncountable. Uncountable words are not pluralized
48
- * or singularized.
49
- *
50
- * @method loadUncountable
51
- * @public
52
- * @static
53
- * @for @ember-data/request-utils/string
54
- * @param {Array<String>} uncountables
55
- * @return {void}
56
- * @since 4.13.0
57
- */
58
- function loadUncountable(uncountables) {
59
- uncountables.forEach(word => {
60
- uncountable(word);
61
- });
62
- }
63
-
64
- /**
65
- * Marks a word as irregular. Irregular words have unique
66
- * pluralization and singularization rules.
67
- *
68
- * @method irregular
69
- * @public
70
- * @static
71
- * @for @ember-data/request-utils/string
72
- * @param {String} single
73
- * @param {String} plur
74
- * @return {void}
75
- * @since 4.13.0
76
- */
77
- function irregular(single, plur) {
78
- //pluralizing
79
- IRREGULAR.set(single.toLowerCase(), plur);
80
- IRREGULAR.set(plur.toLowerCase(), plur);
81
-
82
- //singularizing
83
- INVERSE_IRREGULAR.set(plur.toLowerCase(), single);
84
- INVERSE_IRREGULAR.set(single.toLowerCase(), single);
85
- }
86
-
87
- /**
88
- * Marks a list of word pairs as irregular. Irregular words have unique
89
- * pluralization and singularization rules.
90
- *
91
- * @method loadIrregular
92
- * @public
93
- * @static
94
- * @for @ember-data/request-utils/string
95
- * @param {Array<Array<String>>} irregularPairs
96
- * @return {void}
97
- * @since 4.13.0
98
- */
99
- function loadIrregular(irregularPairs) {
100
- irregularPairs.forEach(pair => {
101
- //pluralizing
102
- IRREGULAR.set(pair[0].toLowerCase(), pair[1]);
103
- IRREGULAR.set(pair[1].toLowerCase(), pair[1]);
104
-
105
- //singularizing
106
- INVERSE_IRREGULAR.set(pair[1].toLowerCase(), pair[0]);
107
- INVERSE_IRREGULAR.set(pair[0].toLowerCase(), pair[0]);
108
- });
109
- }
110
- loadIrregular(defaultRules.irregularPairs);
111
-
112
- /**
113
- * Clears the caches for singularize and pluralize.
114
- *
115
- * @method clear
116
- * @public
117
- * @static
118
- * @for @ember-data/request-utils/string
119
- * @return {void}
120
- * @since 4.13.0
121
- */
122
- function clear() {
123
- SINGULARS.clear();
124
- PLURALS.clear();
125
- }
126
-
127
- /**
128
- * Resets the inflection rules to the defaults.
129
- *
130
- * @method resetToDefaults
131
- * @public
132
- * @static
133
- * @for @ember-data/request-utils/string
134
- * @return {void}
135
- * @since 4.13.0
136
- */
137
- function resetToDefaults() {
138
- clearRules();
139
- defaultRules.uncountable.forEach(v => UNCOUNTABLE.add(v));
140
- defaultRules.singular.forEach(v => SINGULAR_RULES.set(v[0], v[1]));
141
- defaultRules.plurals.forEach(v => PLURAL_RULES.set(v[0], v[1]));
142
- loadIrregular(defaultRules.irregularPairs);
143
- }
144
-
145
- /**
146
- * Clears all inflection rules
147
- * and resets the caches for singularize and pluralize.
148
- *
149
- * @method clearRules
150
- * @public
151
- * @static
152
- * @for @ember-data/request-utils/string
153
- * @return {void}
154
- * @since 4.13.0
155
- */
156
- function clearRules() {
157
- SINGULARS.clear();
158
- PLURALS.clear();
159
- UNCOUNTABLE.clear();
160
- IRREGULAR.clear();
161
- INVERSE_IRREGULAR.clear();
162
- SINGULAR_RULES.clear();
163
- PLURAL_RULES.clear();
164
- }
165
-
166
- /**
167
- * Singularizes a word.
168
- *
169
- * @method singularize
170
- * @public
171
- * @static
172
- * @for @ember-data/request-utils/string
173
- * @param {String} word
174
- * @return {String}
175
- * @since 4.13.0
176
- */
177
- function singularize(word) {
178
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
179
- if (!test) {
180
- throw new Error(`singularize expects to receive a non-empty string`);
181
- }
182
- })(typeof word === 'string' && word.length > 0) : {};
183
- if (!word) return '';
184
- return SINGULARS.get(word);
185
- }
186
-
187
- /**
188
- * Pluralizes a word.
189
- *
190
- * @method pluralize
191
- * @public
192
- * @static
193
- * @for @ember-data/request-utils/string
194
- * @param {String} word
195
- * @return {String}
196
- * @since 4.13.0
197
- */
198
- function pluralize(word) {
199
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
200
- if (!test) {
201
- throw new Error(`pluralize expects to receive a non-empty string`);
202
- }
203
- })(typeof word === 'string' && word.length > 0) : {};
204
- if (!word) return '';
205
- return PLURALS.get(word);
206
- }
207
- function unshiftMap(v, map) {
208
- // reorder
209
- const rules = [v, ...map.entries()];
210
- map.clear();
211
- rules.forEach(rule => {
212
- map.set(rule[0], rule[1]);
213
- });
214
- }
215
-
216
- /**
217
- * Adds a pluralization rule.
218
- *
219
- * @method plural
220
- * @public
221
- * @static
222
- * @for @ember-data/request-utils/string
223
- * @param {RegExp} regex
224
- * @param {String} string
225
- * @return {void}
226
- * @since 4.13.0
227
- */
228
- function plural(regex, string) {
229
- // rule requires reordering if exists, so remove it first
230
- if (PLURAL_RULES.has(regex)) {
231
- PLURAL_RULES.delete(regex);
232
- }
233
-
234
- // reorder
235
- unshiftMap([regex, string], PLURAL_RULES);
236
- }
237
-
238
- /**
239
- * Adds a singularization rule.
240
- *
241
- * @method singular
242
- * @public
243
- * @static
244
- * @for @ember-data/request-utils/string
245
- * @param {RegExp} regex
246
- * @param {String} string
247
- * @return {void}
248
- * @since 4.13.0
249
- */
250
- function singular(regex, string) {
251
- // rule requires reordering if exists, so remove it first
252
- if (SINGULAR_RULES.has(regex)) {
253
- SINGULAR_RULES.delete(regex);
254
- }
255
-
256
- // reorder
257
- unshiftMap([regex, string], SINGULAR_RULES);
258
- }
259
- function _pluralize(word) {
260
- return inflect(word, PLURAL_RULES, IRREGULAR);
261
- }
262
- function _singularize(word) {
263
- return inflect(word, SINGULAR_RULES, INVERSE_IRREGULAR);
264
- }
265
- function inflect(word, typeRules, irregulars) {
266
- // empty strings
267
- const isBlank = !word || BLANK_REGEX.test(word);
268
- if (isBlank) {
269
- return word;
270
- }
271
-
272
- // basic uncountables
273
- const lowercase = word.toLowerCase();
274
- if (UNCOUNTABLE.has(lowercase)) {
275
- return word;
276
- }
277
-
278
- // adv uncountables
279
- const wordSplit = LAST_WORD_DASHED_REGEX.exec(word) || LAST_WORD_CAMELIZED_REGEX.exec(word);
280
- const lastWord = wordSplit ? wordSplit[2].toLowerCase() : null;
281
- if (lastWord && UNCOUNTABLE.has(lastWord)) {
282
- return word;
283
- }
284
-
285
- // handle irregulars
286
- const isCamelized = CAMELIZED_REGEX.test(word);
287
- for (let [rule, substitution] of irregulars) {
288
- if (lowercase.match(rule + '$')) {
289
- if (isCamelized && lastWord && irregulars.has(lastWord)) {
290
- substitution = capitalize(substitution);
291
- rule = capitalize(rule);
292
- }
293
- return word.replace(new RegExp(rule, 'i'), substitution);
294
- }
295
- }
296
-
297
- // do the actual inflection
298
- for (const [rule, substitution] of typeRules) {
299
- if (rule.test(word)) {
300
- return word.replace(rule, substitution);
301
- }
302
- }
303
- return word;
304
- }
305
- export { singular as a, plural as b, loadUncountable as c, clear as d, clearRules as e, defaultRules as f, irregular as i, loadIrregular as l, pluralize as p, resetToDefaults as r, singularize as s, uncountable as u };