@warp-drive/utilities 5.6.0-alpha.14 → 5.6.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/-private/active-record/find-record.d.ts +59 -60
- package/declarations/-private/active-record/query.d.ts +50 -51
- package/declarations/-private/active-record/save-record.d.ts +136 -134
- package/declarations/-private/builder-utils.d.ts +2 -3
- package/declarations/-private/handlers/auto-compress.d.ts +142 -143
- package/declarations/-private/handlers/gated.d.ts +12 -13
- package/declarations/-private/handlers/utils.d.ts +22 -23
- package/declarations/-private/json-api/-utils.d.ts +96 -97
- package/declarations/-private/json-api/find-record.d.ts +59 -60
- package/declarations/-private/json-api/query.d.ts +97 -98
- package/declarations/-private/json-api/save-record.d.ts +180 -178
- package/declarations/-private/json-api/serialize.d.ts +43 -44
- package/declarations/-private/rest/find-record.d.ts +59 -60
- package/declarations/-private/rest/query.d.ts +50 -51
- package/declarations/-private/rest/save-record.d.ts +136 -134
- package/declarations/-private/string/inflect.d.ts +60 -83
- package/declarations/-private/string/inflections.d.ts +4 -5
- package/declarations/-private/string/transform.d.ts +68 -80
- package/declarations/-private.d.ts +1 -2
- package/declarations/active-record.d.ts +3 -4
- package/declarations/handlers.d.ts +8 -9
- package/declarations/index.d.ts +180 -182
- package/declarations/json-api.d.ts +5 -6
- package/declarations/rest.d.ts +3 -4
- package/declarations/string.d.ts +13 -14
- package/dist/active-record.js +1 -1
- package/dist/{inflect-Dr20y6b1.js → inflect-BSG696t-.js} +0 -32
- package/dist/json-api.js +1 -1
- package/dist/rest.js +1 -1
- package/dist/string.cjs +0 -33
- package/dist/string.js +1 -1
- package/package.json +5 -5
- package/declarations/-private/active-record/find-record.d.ts.map +0 -1
- package/declarations/-private/active-record/query.d.ts.map +0 -1
- package/declarations/-private/active-record/save-record.d.ts.map +0 -1
- package/declarations/-private/builder-utils.d.ts.map +0 -1
- package/declarations/-private/derivations.d.ts +0 -23
- package/declarations/-private/derivations.d.ts.map +0 -1
- package/declarations/-private/handlers/auto-compress.d.ts.map +0 -1
- package/declarations/-private/handlers/gated.d.ts.map +0 -1
- package/declarations/-private/handlers/utils.d.ts.map +0 -1
- package/declarations/-private/json-api/-utils.d.ts.map +0 -1
- package/declarations/-private/json-api/find-record.d.ts.map +0 -1
- package/declarations/-private/json-api/find-record.type-test.d.ts +0 -2
- package/declarations/-private/json-api/find-record.type-test.d.ts.map +0 -1
- package/declarations/-private/json-api/query.d.ts.map +0 -1
- package/declarations/-private/json-api/query.type-test.d.ts +0 -2
- package/declarations/-private/json-api/query.type-test.d.ts.map +0 -1
- package/declarations/-private/json-api/save-record.d.ts.map +0 -1
- package/declarations/-private/json-api/serialize.d.ts.map +0 -1
- package/declarations/-private/rest/find-record.d.ts.map +0 -1
- package/declarations/-private/rest/query.d.ts.map +0 -1
- package/declarations/-private/rest/save-record.d.ts.map +0 -1
- package/declarations/-private/string/inflect.d.ts.map +0 -1
- package/declarations/-private/string/inflections.d.ts.map +0 -1
- package/declarations/-private/string/transform.d.ts.map +0 -1
- package/declarations/-private.d.ts.map +0 -1
- package/declarations/active-record.d.ts.map +0 -1
- package/declarations/handlers.d.ts.map +0 -1
- package/declarations/index.d.ts.map +0 -1
- package/declarations/json-api.d.ts.map +0 -1
- package/declarations/rest.d.ts.map +0 -1
- package/declarations/string.d.ts.map +0 -1
- package/dist/-private.js.map +0 -1
- package/dist/active-record.js.map +0 -1
- package/dist/builder-utils-Donkk-BZ.js.map +0 -1
- package/dist/handlers.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/inflect-Dr20y6b1.js.map +0 -1
- package/dist/json-api.js.map +0 -1
- package/dist/rest.js.map +0 -1
- package/dist/string.cjs.map +0 -1
- package/dist/string.js.map +0 -1
package/dist/handlers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sources":["../src/-private/handlers/auto-compress.ts","../src/-private/handlers/gated.ts","../src/-private/handlers/utils.ts"],"sourcesContent":["import { assert } from '@warp-drive/core/build-config/macros';\nimport type { Future, Handler, NextFn } from '@warp-drive/core/request';\nimport type { HTTPMethod, RequestContext } 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 */\n Blob?: number;\n /**\n * The minimum size at which to compress array buffers\n *\n * @default 1000\n */\n ArrayBuffer?: number;\n /**\n * The minimum size at which to compress typed arrays\n *\n * @default 1000\n */\n TypedArray?: number;\n /**\n * The minimum size at which to compress data views\n *\n * @default 1000\n */\n DataView?: number;\n /**\n * The minimum size at which to compress strings\n *\n * @default 1000\n */\n String?: number;\n}\n\n/**\n * Options for configuring the AutoCompress handler.\n *\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 */\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 */\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 */\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 */\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 * @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 headers,\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 }\n\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\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 assert(`Unsupported compression format: ${format as unknown as string}`);\n // @ts-expect-error - unreachable code is reachable in production\n return format;\n }\n}\n","import type { Future, Handler, NextFn } from '@warp-drive/core/request';\nimport type { RequestContext, StructuredDataDocument } from '@warp-drive/core/types/request';\n\n/**\n * If CheckFn returns true, the wrapped handler will be used.\n * If CheckFn returns false, the wrapped handler will be skipped.\n */\ntype CheckFn = (context: RequestContext) => boolean;\n\n/**\n *\n * @public\n */\nexport class Gate implements Handler {\n declare handler: Handler;\n declare checkFn: CheckFn;\n\n constructor(handler: Handler, checkFn: CheckFn) {\n this.handler = handler;\n this.checkFn = checkFn;\n }\n\n request<T = unknown>(context: RequestContext, next: NextFn<T>): Promise<T | StructuredDataDocument<T>> | Future<T> {\n if (this.checkFn(context)) {\n return this.handler.request(context, next);\n }\n return next(context.request);\n }\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nif (typeof FastBoot === 'undefined') {\n globalThis.addEventListener('beforeunload', function () {\n sessionStorage.setItem('tab-closed', 'true');\n });\n}\n\nfunction getTabId() {\n if (typeof sessionStorage === 'undefined') {\n return crypto.randomUUID();\n }\n\n const tabId = sessionStorage.getItem('tab-id');\n if (tabId) {\n const tabClosed = sessionStorage.getItem('tab-closed');\n if (tabClosed === 'true') {\n return tabId;\n }\n\n // fall through to generate a new tab id\n }\n\n const newTabId = crypto.randomUUID();\n sessionStorage.setItem('tab-id', newTabId);\n return newTabId;\n}\n\n/**\n * A unique identifier for the current browser tab\n * useful for observability/tracing and deduping\n * across multiple tabs.\n */\nexport const TAB_ID = getTabId();\n/**\n * The epoch seconds at which the tab id was generated\n */\nexport const TAB_ASSIGNED = Math.floor(Date.now() / 1000);\n\n/**\n * Adds the `X-Amzn-Trace-Id` header to support observability\n * tooling around request routing.\n *\n * This makes use of the {@link TAB_ID} and {@link TAB_ASSIGNED}\n * to enable tracking the browser tab of origin across multiple requests.\n *\n * Follows the template: `Root=1-${now}-${uuidv4};TabId=1-${epochSeconds}-${tab-uuid}`\n */\nexport function addTraceHeader(headers: Headers) {\n const now = Math.floor(Date.now() / 1000);\n headers.set('X-Amzn-Trace-Id', `Root=1-${now}-${crypto.randomUUID()};TabId=1-${TAB_ASSIGNED}-${TAB_ID}`);\n\n return headers;\n}\n\n/**\n * Source: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html\n * As of 2024-12-05 the maximum URL length is 8192 bytes.\n *\n */\nexport const MAX_URL_LENGTH = 8192;\n\n/**\n * This assertion takes a URL and throws an error if the URL is longer than the maximum URL length.\n *\n * See also {@link MAX_URL_LENGTH}\n */\nexport function assertInvalidUrlLength(url: string | undefined) {\n assert(\n `URL length ${url?.length} exceeds the maximum URL length of ${MAX_URL_LENGTH} bytes.\\n\\nConsider converting this request query a \\`/query\\` endpoint instead of a GET, or upgrade the current endpoint to be able to receive a POST request directly (ideally specifying the header HTTP-Method-Override: QUERY)\\n\\nThe Invalid URL is:\\n\\n${url}`,\n !url || url.length <= MAX_URL_LENGTH\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","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","Gate","handler","checkFn","context","FastBoot","globalThis","addEventListener","sessionStorage","setItem","getTabId","crypto","randomUUID","tabId","getItem","tabClosed","newTabId","TAB_ID","TAB_ASSIGNED","Math","floor","Date","now","addTraceHeader","MAX_URL_LENGTH","assertInvalidUrlLength","url"],"mappings":";;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;;AAmCD;AACA;AACA;AACA;;AAkFA,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,UAAU,GAAGG,MAAM,CAACC,cAAc,CAACC,UAAU,CAACC,SAAS,CAAsB;;AAEnF;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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AACA;AACA;AACA;AACO,SAASC,cAAcA,CAACvE,OAAgB,EAAE;AAC/C,EAAA,MAAMsE,GAAG,GAAGH,IAAI,CAACC,KAAK,CAACC,IAAI,CAACC,GAAG,EAAE,GAAG,IAAI,CAAC;AACzCtE,EAAAA,OAAO,CAACmC,GAAG,CAAC,iBAAiB,EAAE,CAAA,OAAA,EAAUmC,GAAG,CAAIX,CAAAA,EAAAA,MAAM,CAACC,UAAU,EAAE,CAAA,SAAA,EAAYM,YAAY,CAAID,CAAAA,EAAAA,MAAM,EAAE,CAAC;AAExG,EAAA,OAAOjE,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMwE,cAAc,GAAG;;AAE9B;AACA;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CAACC,GAAuB,EAAE;EAC9DhC,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,CACE,CAAA,WAAA,EAAc0B,GAAG,EAAEhD,MAAM,CAAsC8C,mCAAAA,EAAAA,cAAc,CAAiQE,8PAAAA,EAAAA,GAAG,CAAE,CAAA,CAAA;AAAA;AAAA,GAAA,EACnV,CAACA,GAAG,IAAIA,GAAG,CAAChD,MAAM,IAAI8C,cAAc,CAAA,GAAA,EAAA;AAExC;;;;"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * @module\n * @mergeModuleWith <project>\n */\n\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { QueryParamsSerializationOptions, QueryParamsSource, Serializable } from '@warp-drive/core/types/params';\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 * @public\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 * @public\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 * @public\n * @param source object to filter keys with empty values from\n * @return 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 * @public\n * @return A {@link 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 * @public\n * @return A sorted query params string without the leading `?`\n */\nexport function buildQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): string {\n return sortQueryParams(params, options).toString();\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"],"mappings":";;;AAAA;AACA;AACA;AACA;;AAOA;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;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,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AAG,EAAEf,MAAM,CAACgB,KAAK,CAAC,CAAC;AACtC;AACF,GAAC,CAAC;AAEF,EAAA,OAAOO,SAAS;AAClB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,gBAAgBA,CAACf,MAAyB,EAAEzC,OAAyC,EAAU;EAC7G,OAAOwC,eAAe,CAACC,MAAM,EAAEzC,OAAO,CAAC,CAACyD,QAAQ,EAAE;AACpD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inflect-Dr20y6b1.js","sources":["../src/-private/string/transform.ts","../src/-private/string/inflect.ts"],"sourcesContent":["import { dasherize as internalDasherize, LRUCache, STRING_DASHERIZE_CACHE } from '@warp-drive/core/utils/string';\n\n// eslint-disable-next-line no-useless-escape\nconst STRING_CAMELIZE_REGEXP_1 = /(\\-|\\_|\\.|\\s)+(.)?/g;\nconst STRING_CAMELIZE_REGEXP_2 = /(^|\\/)([A-Z])/g;\nconst CAMELIZE_CACHE = new LRUCache<string, string>((key: string) =>\n key\n .replace(STRING_CAMELIZE_REGEXP_1, (_match, _separator, chr: string | null) => (chr ? chr.toUpperCase() : ''))\n .replace(STRING_CAMELIZE_REGEXP_2, (match /*, separator, chr */) => match.toLowerCase())\n);\n\nconst STRING_UNDERSCORE_REGEXP_1 = /([a-z\\d])([A-Z]+)/g;\n// eslint-disable-next-line no-useless-escape\nconst STRING_UNDERSCORE_REGEXP_2 = /\\-|\\s+/g;\nconst UNDERSCORE_CACHE = new LRUCache<string, string>((str: string) =>\n str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase()\n);\n\nconst STRING_CAPITALIZE_REGEXP = /(^|\\/)([a-z\\u00C0-\\u024F])/g;\nconst CAPITALIZE_CACHE = new LRUCache<string, string>((str: string) =>\n str.replace(STRING_CAPITALIZE_REGEXP, (match /*, separator, chr */) => match.toUpperCase())\n);\n\n/**\n * Replaces underscores, spaces, or camelCase with dashes.\n *\n * ```js\n * import { dasherize } from '@warp-drive/utilities/string';\n *\n * dasherize('innerHTML'); // 'inner-html'\n * dasherize('action_name'); // 'action-name'\n * dasherize('css-class-name'); // 'css-class-name'\n * dasherize('my favorite items'); // 'my-favorite-items'\n * dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport const dasherize = internalDasherize;\n\n/**\n * Returns the lowerCamelCase form of a string.\n *\n * ```js\n * import { camelize } from '@warp-drive/utilities/string';\n *\n * camelize('innerHTML'); // 'innerHTML'\n * camelize('action_name'); // 'actionName'\n * camelize('css-class-name'); // 'cssClassName'\n * camelize('my favorite items'); // 'myFavoriteItems'\n * camelize('My Favorite Items'); // 'myFavoriteItems'\n * camelize('private-docs/owner-invoice'); // 'privateDocs/ownerInvoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport function camelize(str: string): string {\n return CAMELIZE_CACHE.get(str);\n}\n\n/**\n * Returns the lower\\_case\\_and\\_underscored form of a string.\n *\n * ```js\n * import { underscore } from '@warp-drive/utilities/string';\n *\n * underscore('innerHTML'); // 'inner_html'\n * underscore('action_name'); // 'action_name'\n * underscore('css-class-name'); // 'css_class_name'\n * underscore('my favorite items'); // 'my_favorite_items'\n * underscore('privateDocs/ownerInvoice'); // 'private_docs/owner_invoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport function underscore(str: string): string {\n return UNDERSCORE_CACHE.get(str);\n}\n\n/**\n * Returns the Capitalized form of a string\n *\n * ```js\n * import { capitalize } from '@warp-drive/utilities/string';\n *\n * capitalize('innerHTML') // 'InnerHTML'\n * capitalize('action_name') // 'Action_name'\n * capitalize('css-class-name') // 'Css-class-name'\n * capitalize('my favorite items') // 'My favorite items'\n * capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport function capitalize(str: string): string {\n return CAPITALIZE_CACHE.get(str);\n}\n\n/**\n * Sets the maximum size of the LRUCache for all string transformation functions.\n * The default size is 10,000.\n *\n * @public\n * @param {Number} size\n * @return {void}\n * @since 4.13.0\n */\nexport function setMaxLRUCacheSize(size: number) {\n CAMELIZE_CACHE.size = size;\n UNDERSCORE_CACHE.size = size;\n CAPITALIZE_CACHE.size = size;\n STRING_DASHERIZE_CACHE.size = size;\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\nimport { LRUCache } from '@warp-drive/core/utils/string';\n\nimport { defaultRules } from './inflections.ts';\nimport { capitalize } from './transform.ts';\n\nconst BLANK_REGEX = /^\\s*$/;\nconst LAST_WORD_DASHED_REGEX = /([\\w/-]+[_/\\s-])([a-z\\d]+$)/;\nconst LAST_WORD_CAMELIZED_REGEX = /([\\w/\\s-]+)([A-Z][a-z\\d]*$)/;\nconst CAMELIZED_REGEX = /[A-Z][a-z\\d]*$/;\n\nconst SINGULARS = new LRUCache<string, string>((word: string) => {\n return _singularize(word);\n});\nconst PLURALS = new LRUCache<string, string>((word: string) => {\n return _pluralize(word);\n});\nconst UNCOUNTABLE = new Set(defaultRules.uncountable);\nconst IRREGULAR: Map<string, string> = new Map();\nconst INVERSE_IRREGULAR: Map<string, string> = new Map();\nconst SINGULAR_RULES = new Map(defaultRules.singular.reverse());\nconst PLURAL_RULES = new Map(defaultRules.plurals.reverse());\n\n/**\n * Marks a word as uncountable. Uncountable words are not pluralized\n * or singularized.\n *\n * @public\n * @param {String} word\n * @return {void}\n * @since 4.13.0\n */\nexport function uncountable(word: string) {\n UNCOUNTABLE.add(word.toLowerCase());\n}\n\n/**\n * Marks a list of words as uncountable. Uncountable words are not pluralized\n * or singularized.\n *\n * @public\n * @param {Array<String>} uncountables\n * @return {void}\n * @since 4.13.0\n */\nexport function loadUncountable(uncountables: string[]) {\n uncountables.forEach((word) => {\n uncountable(word);\n });\n}\n\n/**\n * Marks a word as irregular. Irregular words have unique\n * pluralization and singularization rules.\n *\n * @public\n * @param {String} single\n * @param {String} plur\n * @return {void}\n * @since 4.13.0\n */\nexport function irregular(single: string, plur: string) {\n //pluralizing\n IRREGULAR.set(single.toLowerCase(), plur);\n IRREGULAR.set(plur.toLowerCase(), plur);\n\n //singularizing\n INVERSE_IRREGULAR.set(plur.toLowerCase(), single);\n INVERSE_IRREGULAR.set(single.toLowerCase(), single);\n}\n\n/**\n * Marks a list of word pairs as irregular. Irregular words have unique\n * pluralization and singularization rules.\n *\n * @public\n * @param {Array<Array<String>>} irregularPairs\n * @return {void}\n * @since 4.13.0\n */\nexport function loadIrregular(irregularPairs: Array<[string, string]>) {\n irregularPairs.forEach((pair) => {\n //pluralizing\n IRREGULAR.set(pair[0].toLowerCase(), pair[1]);\n IRREGULAR.set(pair[1].toLowerCase(), pair[1]);\n\n //singularizing\n INVERSE_IRREGULAR.set(pair[1].toLowerCase(), pair[0]);\n INVERSE_IRREGULAR.set(pair[0].toLowerCase(), pair[0]);\n });\n}\nloadIrregular(defaultRules.irregularPairs);\n\n/**\n * Clears the caches for singularize and pluralize.\n *\n * @public\n * @return {void}\n * @since 4.13.0\n */\nexport function clear() {\n SINGULARS.clear();\n PLURALS.clear();\n}\n\n/**\n * Resets the inflection rules to the defaults.\n *\n * @public\n * @return {void}\n * @since 4.13.0\n */\nexport function resetToDefaults() {\n clearRules();\n defaultRules.uncountable.forEach((v) => UNCOUNTABLE.add(v));\n defaultRules.singular.forEach((v) => SINGULAR_RULES.set(v[0], v[1]));\n defaultRules.plurals.forEach((v) => PLURAL_RULES.set(v[0], v[1]));\n loadIrregular(defaultRules.irregularPairs);\n}\n\n/**\n * Clears all inflection rules\n * and resets the caches for singularize and pluralize.\n *\n * @public\n * @return {void}\n * @since 4.13.0\n */\nexport function clearRules() {\n SINGULARS.clear();\n PLURALS.clear();\n UNCOUNTABLE.clear();\n IRREGULAR.clear();\n INVERSE_IRREGULAR.clear();\n SINGULAR_RULES.clear();\n PLURAL_RULES.clear();\n}\n\n/**\n * Singularizes a word.\n *\n * @public\n * @param {String} word\n * @return {String}\n * @since 4.13.0\n */\nexport function singularize(word: string) {\n assert(`singularize expects to receive a non-empty string`, typeof word === 'string' && word.length > 0);\n if (!word) return '';\n return SINGULARS.get(word);\n}\n\n/**\n * Pluralizes a word.\n *\n * @public\n * @param {String} word\n * @return {String}\n * @since 4.13.0\n */\nexport function pluralize(word: string) {\n assert(`pluralize expects to receive a non-empty string`, typeof word === 'string' && word.length > 0);\n if (!word) return '';\n return PLURALS.get(word);\n}\n\nfunction unshiftMap<K, V>(v: [K, V], map: Map<K, V>) {\n // reorder\n const rules = [v, ...map.entries()];\n map.clear();\n rules.forEach((rule) => {\n map.set(rule[0], rule[1]);\n });\n}\n\n/**\n * Adds a pluralization rule.\n *\n * @public\n * @param {RegExp} regex\n * @param {String} string\n * @return {void}\n * @since 4.13.0\n */\nexport function plural(regex: RegExp, string: string) {\n // rule requires reordering if exists, so remove it first\n if (PLURAL_RULES.has(regex)) {\n PLURAL_RULES.delete(regex);\n }\n\n // reorder\n unshiftMap([regex, string], PLURAL_RULES);\n}\n\n/**\n * Adds a singularization rule.\n *\n * @public\n * @param {RegExp} regex\n * @param {String} string\n * @return {void}\n * @since 4.13.0\n */\nexport function singular(regex: RegExp, string: string) {\n // rule requires reordering if exists, so remove it first\n if (SINGULAR_RULES.has(regex)) {\n SINGULAR_RULES.delete(regex);\n }\n\n // reorder\n unshiftMap([regex, string], SINGULAR_RULES);\n}\n\nfunction _pluralize(word: string) {\n return inflect(word, PLURAL_RULES, IRREGULAR);\n}\n\nfunction _singularize(word: string) {\n return inflect(word, SINGULAR_RULES, INVERSE_IRREGULAR);\n}\n\nfunction inflect(word: string, typeRules: Map<RegExp, string>, irregulars: Map<string, string>) {\n // empty strings\n const isBlank = !word || BLANK_REGEX.test(word);\n if (isBlank) {\n return word;\n }\n\n // basic uncountables\n const lowercase = word.toLowerCase();\n if (UNCOUNTABLE.has(lowercase)) {\n return word;\n }\n\n // adv uncountables\n const wordSplit = LAST_WORD_DASHED_REGEX.exec(word) || LAST_WORD_CAMELIZED_REGEX.exec(word);\n const lastWord = wordSplit ? wordSplit[2].toLowerCase() : null;\n if (lastWord && UNCOUNTABLE.has(lastWord)) {\n return word;\n }\n\n // handle irregulars\n const isCamelized = CAMELIZED_REGEX.test(word);\n for (let [rule, substitution] of irregulars) {\n if (lowercase.match(rule + '$')) {\n if (isCamelized && lastWord && irregulars.has(lastWord)) {\n substitution = capitalize(substitution);\n rule = capitalize(rule);\n }\n\n return word.replace(new RegExp(rule, 'i'), substitution);\n }\n }\n\n // do the actual inflection\n for (const [rule, substitution] of typeRules) {\n if (rule.test(word)) {\n return word.replace(rule, substitution);\n }\n }\n\n return word;\n}\n"],"names":["STRING_CAMELIZE_REGEXP_1","STRING_CAMELIZE_REGEXP_2","CAMELIZE_CACHE","LRUCache","key","replace","_match","_separator","chr","toUpperCase","match","toLowerCase","STRING_UNDERSCORE_REGEXP_1","STRING_UNDERSCORE_REGEXP_2","UNDERSCORE_CACHE","str","STRING_CAPITALIZE_REGEXP","CAPITALIZE_CACHE","dasherize","internalDasherize","camelize","get","underscore","capitalize","setMaxLRUCacheSize","size","STRING_DASHERIZE_CACHE","BLANK_REGEX","LAST_WORD_DASHED_REGEX","LAST_WORD_CAMELIZED_REGEX","CAMELIZED_REGEX","SINGULARS","word","_singularize","PLURALS","_pluralize","UNCOUNTABLE","Set","defaultRules","uncountable","IRREGULAR","Map","INVERSE_IRREGULAR","SINGULAR_RULES","singular","reverse","PLURAL_RULES","plurals","add","loadUncountable","uncountables","forEach","irregular","single","plur","set","loadIrregular","irregularPairs","pair","clear","resetToDefaults","clearRules","v","singularize","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","length","pluralize","unshiftMap","map","rules","entries","rule","plural","regex","string","has","delete","inflect","typeRules","irregulars","isBlank","lowercase","wordSplit","exec","lastWord","isCamelized","substitution","RegExp"],"mappings":";;;;AAEA;AACA,MAAMA,wBAAwB,GAAG,qBAAqB;AACtD,MAAMC,wBAAwB,GAAG,gBAAgB;AACjD,MAAMC,cAAc,GAAG,IAAIC,QAAQ,CAAkBC,GAAW,IAC9DA,GAAG,CACAC,OAAO,CAACL,wBAAwB,EAAE,CAACM,MAAM,EAAEC,UAAU,EAAEC,GAAkB,KAAMA,GAAG,GAAGA,GAAG,CAACC,WAAW,EAAE,GAAG,EAAG,CAAC,CAC7GJ,OAAO,CAACJ,wBAAwB,EAAE,CAACS,KAAK,2BAA2BA,KAAK,CAACC,WAAW,EAAE,CAC3F,CAAC;AAED,MAAMC,0BAA0B,GAAG,oBAAoB;AACvD;AACA,MAAMC,0BAA0B,GAAG,SAAS;AAC5C,MAAMC,gBAAgB,GAAG,IAAIX,QAAQ,CAAkBY,GAAW,IAChEA,GAAG,CAACV,OAAO,CAACO,0BAA0B,EAAE,OAAO,CAAC,CAACP,OAAO,CAACQ,0BAA0B,EAAE,GAAG,CAAC,CAACF,WAAW,EACvG,CAAC;AAED,MAAMK,wBAAwB,GAAG,6BAA6B;AAC9D,MAAMC,gBAAgB,GAAG,IAAId,QAAQ,CAAkBY,GAAW,IAChEA,GAAG,CAACV,OAAO,CAACW,wBAAwB,EAAE,CAACN,KAAK,2BAA2BA,KAAK,CAACD,WAAW,EAAE,CAC5F,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMS,SAAS,GAAGC;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAACL,GAAW,EAAU;AAC5C,EAAA,OAAOb,cAAc,CAACmB,GAAG,CAACN,GAAG,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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ACrC,IAAI,CAAC,EAAE;AACnB,MAAA,OAAOA,IAAI,CAAC3B,OAAO,CAACwE,IAAI,EAAEe,YAAY,CAAC;AACzC;AACF;AAEA,EAAA,OAAO5D,IAAI;AACb;;;;"}
|
package/dist/json-api.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-api.js","sources":["../src/-private/json-api/-utils.ts","../src/-private/json-api/find-record.ts","../src/-private/json-api/query.ts","../src/-private/json-api/save-record.ts","../src/-private/json-api/serialize.ts"],"sourcesContent":["import type { QueryParamsSource } from '@warp-drive/core/types/params';\n\nimport type { BuildURLConfig } from '../../index.ts';\nimport { buildQueryParams as buildParams, setBuildURLConfig as setConfig } from '../../index.ts';\n\nexport interface JSONAPIConfig extends BuildURLConfig {\n profiles?: {\n pagination?: string;\n [key: string]: string | undefined;\n };\n extensions?: {\n atomic?: string;\n [key: string]: string | undefined;\n };\n}\n\nconst JsonApiAccept = 'application/vnd.api+json';\nconst DEFAULT_CONFIG: JSONAPIConfig = { host: '', namespace: '' };\nexport let CONFIG: JSONAPIConfig = DEFAULT_CONFIG;\nexport let ACCEPT_HEADER_VALUE = 'application/vnd.api+json';\n\n/**\n * Allows setting extensions and profiles to be used in the `Accept` header.\n *\n * Extensions and profiles are keyed by their namespace with the value being\n * their URI.\n *\n * Example:\n *\n * ```ts\n * setBuildURLConfig({\n * extensions: {\n * atomic: 'https://jsonapi.org/ext/atomic'\n * },\n * profiles: {\n * pagination: 'https://jsonapi.org/profiles/ethanresnick/cursor-pagination'\n * }\n * });\n * ```\n *\n * This also sets the global configuration for `buildBaseURL`\n * for host and namespace values for the global coniguration\n * done via `import { setBuildURLConfig } from '@warp-drive/utilities';`\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 * @public\n * @param {BuildURLConfig} config\n * @return {void}\n */\nexport function setBuildURLConfig(config: JSONAPIConfig): void {\n CONFIG = Object.assign({}, DEFAULT_CONFIG, config);\n\n if (config.profiles || config.extensions) {\n let accept = JsonApiAccept;\n if (config.profiles) {\n const profiles = Object.values(config.profiles);\n if (profiles.length) {\n accept += ';profile=\"' + profiles.join(' ') + '\"';\n }\n }\n if (config.extensions) {\n const extensions = Object.values(config.extensions);\n if (extensions.length) {\n accept += ';ext=' + extensions.join(' ');\n }\n }\n ACCEPT_HEADER_VALUE = accept;\n }\n\n setConfig(config);\n}\n\ninterface RelatedObject {\n [key: string]: string | string[] | RelatedObject;\n}\n\nexport type JsonApiQuery = {\n include?: string | string[] | RelatedObject;\n fields?: Record<string, string | string[]>;\n page?: {\n size?: number;\n after?: string;\n before?: string;\n };\n};\n\nfunction isJsonApiQuery(query: JsonApiQuery | QueryParamsSource): query is JsonApiQuery {\n if ('include' in query && query.include && typeof query.include === 'object') {\n return true;\n }\n if ('fields' in query || 'page' in query) {\n return true;\n }\n return false;\n}\n\nfunction collapseIncludePaths(basePath: string, include: RelatedObject, paths: string[]) {\n const keys = Object.keys(include);\n for (let i = 0; i < keys.length; i++) {\n // the key is always included too\n paths.push(`${basePath}.${keys[i]}`);\n const key = keys[i];\n const value = include[key];\n\n // include: { 'company': 'field1,field2' }\n if (typeof value === 'string') {\n value.split(',').forEach((field) => {\n paths.push(`${basePath}.${key}.${field}`);\n });\n\n // include: { 'company': ['field1', 'field2'] }\n } else if (Array.isArray(value)) {\n value.forEach((field) => {\n paths.push(`${basePath}.${key}.${field}`);\n });\n\n // include: { 'company': { 'nested': 'field1,field2' } }\n } else {\n collapseIncludePaths(`${basePath}.${key}`, value, paths);\n }\n }\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 * - If `included` is an object we build paths dynamically for you\n * Treats `fields` specially, building JSON:API partial fields params from an object\n * Treats `page` specially, building cursor-pagination profile page params from an object\n *\n * ```ts\n * const params = buildQueryParams({\n * include: {\n * company: {\n * locations: 'address'\n * }\n * },\n * fields: {\n * company: ['name', 'ticker'],\n * person: 'name'\n * },\n * page: {\n * size: 10,\n * after: 'abc',\n * }\n * });\n *\n * // => 'fields[company]=name,ticker&fields[person]=name&include=company.locations,company.locations.address&page[after]=abc&page[size]=10'\n * ```\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 * @public\n * @param {URLSearchParams | Object} params\n * @param {Object} [options]\n * @return {String} A sorted query params string without the leading `?`\n */\nexport function buildQueryParams(query: JsonApiQuery | QueryParamsSource): string {\n if (query instanceof URLSearchParams) {\n return buildParams(query);\n }\n\n if (!isJsonApiQuery(query)) {\n return buildParams(query);\n }\n\n const { include, fields, page, ...rest } = query;\n const finalQuery: QueryParamsSource = {\n ...rest,\n };\n\n if ('include' in query) {\n // include: { 'company': 'field1,field2' }\n // include: { 'company': ['field1', 'field2'] }\n // include: { 'company': { 'nested': 'field1,field2' } }\n // include: { 'company': { 'nested': ['field1', 'field2'] } }\n if (include && !Array.isArray(include) && typeof include === 'object') {\n const includePaths: string[] = [];\n collapseIncludePaths('', include, includePaths);\n finalQuery.include = includePaths.sort();\n\n // include: 'field1,field2'\n // include: ['field1', 'field2']\n } else {\n finalQuery.include = include as string;\n }\n }\n\n if (fields) {\n const keys = Object.keys(fields).sort();\n for (let i = 0; i < keys.length; i++) {\n const resourceType = keys[i];\n const value = fields[resourceType];\n\n // fields: { 'company': ['field1', 'field2'] }\n if (Array.isArray(value)) {\n finalQuery[`fields[${resourceType}]`] = value.sort().join(',');\n\n // fields: { 'company': 'field1' }\n // fields: { 'company': 'field1,field2' }\n } else {\n finalQuery[`fields[${resourceType}]`] = value.split(',').sort().join(',');\n }\n }\n }\n\n if (page) {\n const keys = Object.keys(page).sort() as Array<'size' | 'after' | 'before'>;\n keys.forEach((key) => {\n const value = page[key];\n finalQuery[`page[${key}]`] = value!;\n });\n }\n\n return buildParams(finalQuery);\n}\n","import type { TypeFromInstance } from '@warp-drive/core/types/record';\nimport type {\n FindRecordOptions,\n FindRecordRequestOptions,\n RemotelyAccessibleIdentifier,\n} from '@warp-drive/core/types/request';\nimport type { SingleResourceDataDocument } from '@warp-drive/core/types/spec/document';\n\nimport { buildBaseURL, buildQueryParams, type FindRecordUrlOptions } from '../../index.ts';\nimport { pluralize } from '../../string.ts';\nimport { copyForwardUrlOptions, extractCacheOptions } from '../builder-utils.ts';\nimport { ACCEPT_HEADER_VALUE } from './-utils.ts';\n\n/**\n * Builds request options to fetch a single resource by a known id or identifier\n * configured for the url and header expectations of most JSON:API APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { findRecord } from '@warp-drive/utilities/json-api';\n *\n * const data = await store.request(findRecord('person', '1'));\n * ```\n *\n * **With Options**\n *\n * ```ts\n * import { findRecord } from '@warp-drive/utilities/json-api';\n *\n * const options = findRecord('person', '1', { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **With an Identifier**\n *\n * ```ts\n * import { findRecord } from '@warp-drive/utilities/json-api';\n *\n * const options = findRecord({ type: 'person', id: '1' }, { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { findRecord } from '@warp-drive/utilities/json-api';\n *\n * const options = findRecord('person', '1', { include: ['pets', 'friends'] }, { namespace: 'api/v2' });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param identifier\n * @param options\n */\n\nexport type FindRecordResultDocument<T> = Omit<SingleResourceDataDocument<T>, 'data'> & { data: T };\n\nexport function findRecord<T>(\n identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>>,\n options?: FindRecordOptions<T>\n): FindRecordRequestOptions<FindRecordResultDocument<T>, T>;\nexport function findRecord(\n identifier: RemotelyAccessibleIdentifier,\n options?: FindRecordOptions\n): FindRecordRequestOptions;\nexport function findRecord<T>(\n type: TypeFromInstance<T>,\n id: string,\n options?: FindRecordOptions<T>\n): FindRecordRequestOptions<FindRecordResultDocument<T>, T>;\nexport function findRecord(type: string, id: string, options?: FindRecordOptions): FindRecordRequestOptions;\nexport function findRecord(\n arg1: string | RemotelyAccessibleIdentifier,\n arg2: string | FindRecordOptions | undefined,\n arg3?: FindRecordOptions\n): FindRecordRequestOptions {\n const identifier: RemotelyAccessibleIdentifier = typeof arg1 === 'string' ? { type: arg1, id: arg2 as string } : arg1;\n const options = ((typeof arg1 === 'string' ? arg3 : arg2) || {}) as FindRecordOptions;\n const cacheOptions = extractCacheOptions(options);\n const urlOptions: FindRecordUrlOptions = {\n identifier,\n op: 'findRecord',\n resourcePath: pluralize(identifier.type),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', ACCEPT_HEADER_VALUE);\n\n return {\n url: options.include?.length\n ? `${url}?${buildQueryParams({ include: options.include }, options.urlParamsSettings)}`\n : url,\n method: 'GET',\n headers,\n cacheOptions,\n op: 'findRecord',\n records: [identifier],\n };\n}\n","import type { QueryParamsSource } from '@warp-drive/core/types/params';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type {\n CacheOptions,\n ConstrainedRequestOptions,\n PostQueryRequestOptions,\n QueryRequestOptions,\n} from '@warp-drive/core/types/request';\nimport type { CollectionResourceDataDocument } from '@warp-drive/core/types/spec/document';\n\nimport { buildBaseURL, buildQueryParams, type QueryUrlOptions } from '../../index.ts';\nimport { pluralize } from '../../string.ts';\nimport { copyForwardUrlOptions, extractCacheOptions } from '../builder-utils.ts';\nimport { ACCEPT_HEADER_VALUE } from './-utils.ts';\n/**\n * Builds request options to query for resources, usually by a primary\n * type, configured for the url and header expectations of most JSON:API APIs.\n *\n * The key difference between this and `postQuery` is that this method will send the query\n * as query params in the url of a \"GET\" request instead of as the JSON body of a \"POST\"\n * request.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { query } from '@warp-drive/utilities/json-api';\n *\n * const data = await store.request(query('person'));\n * ```\n *\n * **With Query Params**\n *\n * ```ts\n * import { query } from '@warp-drive/utilities/json-api';\n *\n * const options = query('person', { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { query } from '@warp-drive/utilities/json-api';\n *\n * const options = query('person', { include: ['pets', 'friends'] }, { reload: true });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param identifier\n * @param query\n * @param options\n */\nexport function query<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query?: QueryParamsSource<T>,\n options?: ConstrainedRequestOptions\n): QueryRequestOptions<CollectionResourceDataDocument<T>, T>;\nexport function query(\n type: string,\n query?: QueryParamsSource,\n options?: ConstrainedRequestOptions\n): QueryRequestOptions;\nexport function query(\n type: string,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n query: QueryParamsSource = {},\n options: ConstrainedRequestOptions = {}\n): QueryRequestOptions {\n const cacheOptions = extractCacheOptions(options);\n const urlOptions: QueryUrlOptions = {\n identifier: { type },\n op: 'query',\n resourcePath: pluralize(type),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', ACCEPT_HEADER_VALUE);\n const queryString = buildQueryParams(query, options.urlParamsSettings);\n\n return {\n url: queryString ? `${url}?${queryString}` : url,\n method: 'GET',\n headers,\n cacheOptions,\n op: 'query',\n };\n}\n\n/**\n * Builds request options to query for resources, usually by a primary\n * type, configured for the url and header expectations of most JSON:API APIs.\n *\n * The key difference between this and `query` is that this method will send the query\n * as the JSON body of a \"POST\" request instead of as query params in the url of a \"GET\"\n * request.\n *\n * A CacheKey is generated from the url and query params, and used to cache the response\n * in the store.\n *\n * ```ts\n * import { postQuery } from '@warp-drive/utilities/json-api';\n *\n * const options = postQuery('person', { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { postQuery } from '@warp-drive/utilities/json-api';\n *\n * const options = postQuery('person', { include: ['pets', 'friends'] }, { reload: true });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param identifier\n * @param query\n * @param options\n */\nexport function postQuery<T>(\n type: TypeFromInstance<T>,\n query?: QueryParamsSource,\n options?: ConstrainedRequestOptions\n): PostQueryRequestOptions<CollectionResourceDataDocument<T>, T>;\nexport function postQuery(\n type: string,\n query?: QueryParamsSource,\n options?: ConstrainedRequestOptions\n): PostQueryRequestOptions;\nexport function postQuery(\n type: string,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n query: QueryParamsSource = {},\n options: ConstrainedRequestOptions = {}\n): PostQueryRequestOptions {\n const cacheOptions = extractCacheOptions(options);\n const urlOptions: QueryUrlOptions = {\n identifier: { type },\n op: 'query',\n resourcePath: options.resourcePath ?? pluralize(type),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', ACCEPT_HEADER_VALUE);\n\n const queryData = structuredClone(query);\n cacheOptions.key = cacheOptions.key ?? `${url}?${buildQueryParams(queryData, options.urlParamsSettings)}`;\n\n return {\n url,\n method: 'POST',\n body: JSON.stringify(query),\n headers,\n cacheOptions: cacheOptions as CacheOptions & { key: string },\n op: 'query',\n };\n}\n","import { recordIdentifierFor } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core/types/identifier';\nimport type { TypedRecordInstance } from '@warp-drive/core/types/record';\nimport type {\n ConstrainedRequestOptions,\n CreateRequestOptions,\n DeleteRequestOptions,\n UpdateRequestOptions,\n} from '@warp-drive/core/types/request';\nimport type { SingleResourceDataDocument } from '@warp-drive/core/types/spec/document';\n\nimport {\n buildBaseURL,\n type CreateRecordUrlOptions,\n type DeleteRecordUrlOptions,\n type UpdateRecordUrlOptions,\n} from '../../index.ts';\nimport { pluralize } from '../../string.ts';\nimport { copyForwardUrlOptions } from '../builder-utils.ts';\nimport { ACCEPT_HEADER_VALUE } from './-utils.ts';\n\nfunction isExisting(identifier: StableRecordIdentifier): identifier is StableExistingRecordIdentifier {\n return 'id' in identifier && identifier.id !== null && 'type' in identifier && identifier.type !== null;\n}\n\n/**\n * Builds request options to delete record for resources,\n * configured for the url, method and header expectations of most JSON:API APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { deleteRecord } from '@warp-drive/utilities/json-api';\n *\n * const person = store.peekRecord('person', '1');\n *\n * // mark record as deleted\n * store.deleteRecord(person);\n *\n * // persist deletion\n * const data = await store.request(deleteRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { deleteRecord } from '@warp-drive/utilities/json-api';\n *\n * const person = store.peekRecord('person', '1');\n *\n * // mark record as deleted\n * store.deleteRecord(person);\n *\n * // persist deletion\n * const options = deleteRecord(person, { namespace: 'api/v1' });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param record\n * @param options\n */\nexport function deleteRecord<T>(record: T, options?: ConstrainedRequestOptions): DeleteRequestOptions<T>;\nexport function deleteRecord(record: unknown, options?: ConstrainedRequestOptions): DeleteRequestOptions;\nexport function deleteRecord(record: unknown, options: ConstrainedRequestOptions = {}): DeleteRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));\n\n const urlOptions: DeleteRecordUrlOptions = {\n identifier: identifier,\n op: 'deleteRecord',\n resourcePath: pluralize(identifier.type),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', ACCEPT_HEADER_VALUE);\n\n return {\n url,\n method: 'DELETE',\n headers,\n op: 'deleteRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n\n/**\n * Builds request options to create new record for resources,\n * configured for the url, method and header expectations of most JSON:API APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { createRecord } from '@warp-drive/utilities/json-api';\n *\n * const person = store.createRecord('person', { name: 'Ted' });\n * const data = await store.request(createRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { createRecord } from '@warp-drive/utilities/json-api';\n *\n * const person = store.createRecord('person', { name: 'Ted' });\n * const options = createRecord(person, { namespace: 'api/v1' });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param record\n * @param options\n */\nexport function createRecord<T>(record: T, options?: ConstrainedRequestOptions): CreateRequestOptions<T>;\nexport function createRecord(record: unknown, options?: ConstrainedRequestOptions): CreateRequestOptions;\nexport function createRecord(record: unknown, options: ConstrainedRequestOptions = {}): CreateRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n\n const urlOptions: CreateRecordUrlOptions = {\n identifier: identifier,\n op: 'createRecord',\n resourcePath: pluralize(identifier.type),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', ACCEPT_HEADER_VALUE);\n\n return {\n url,\n method: 'POST',\n headers,\n op: 'createRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n\n/**\n * Builds request options to update existing record for resources,\n * configured for the url, method and header expectations of most JSON:API APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { updateRecord } from '@warp-drive/utilities/json-api';\n *\n * const person = store.peekRecord('person', '1');\n * person.name = 'Chris';\n * const data = await store.request(updateRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `patch` - Allows caller to specify whether to use a PATCH request instead of a PUT request, defaults to `false`.\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { updateRecord } from '@warp-drive/utilities/json-api';\n *\n * const person = store.peekRecord('person', '1');\n * person.name = 'Chris';\n * const options = updateRecord(person, { patch: true });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param record\n * @param options\n */\nexport function updateRecord<T extends TypedRecordInstance, RT extends TypedRecordInstance = T>(\n record: T,\n options?: ConstrainedRequestOptions & { patch?: boolean }\n): UpdateRequestOptions<SingleResourceDataDocument<RT>, T>;\nexport function updateRecord(\n record: unknown,\n options?: ConstrainedRequestOptions & { patch?: boolean }\n): UpdateRequestOptions;\nexport function updateRecord(\n record: unknown,\n options: ConstrainedRequestOptions & { patch?: boolean } = {}\n): UpdateRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n assert(`Cannot update a record that does not have an associated type and id.`, isExisting(identifier));\n\n const urlOptions: UpdateRecordUrlOptions = {\n identifier: identifier,\n op: 'updateRecord',\n resourcePath: pluralize(identifier.type),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', ACCEPT_HEADER_VALUE);\n\n return {\n url,\n method: options.patch ? 'PATCH' : 'PUT',\n headers,\n op: 'updateRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n\n/**\n * Builds request options to update existing record for resources,\n * configured for the url and header expectations of most JSON:API APIs\n * for a PATCH request.\n *\n * Note: This is a convenience method that calls `updateRecord` with the\n * supplied request with the `patch` option set to `true`.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { patchRecord } from '@warp-drive/utilities/json-api';\n *\n * const person = store.peekRecord('person', '1');\n * person.name = 'Chris';\n * const data = await store.request(patchRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { patchRecord } from '@warp-drive/utilities/json-api';\n *\n * const person = store.peekRecord('person', '1');\n * person.name = 'Chris';\n * const options = patchRecord(person);\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param record\n * @param options\n */\nexport function patchRecord<T>(record: T, options?: ConstrainedRequestOptions): UpdateRequestOptions<T>;\nexport function patchRecord(record: unknown, options?: ConstrainedRequestOptions): UpdateRequestOptions;\nexport function patchRecord(record: unknown, options: ConstrainedRequestOptions = {}): UpdateRequestOptions {\n const opts = options as ConstrainedRequestOptions & { patch: true };\n opts.patch = true;\n return updateRecord(record, opts);\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { Relationship } from '@warp-drive/core/types/cache/relationship';\nimport type { StableRecordIdentifier } from '@warp-drive/core/types/identifier';\nimport type { Value } from '@warp-drive/core/types/json/raw';\nimport type { InnerRelationshipDocument, ResourceObject } from '@warp-drive/core/types/spec/json-api-raw';\n\ntype ChangedRelationshipData = InnerRelationshipDocument;\n\nexport type JsonApiResourcePatch =\n | {\n type: string;\n id: string;\n attributes?: Record<string, Value>;\n relationships?: Record<string, ChangedRelationshipData>;\n }\n | {\n type: string;\n id: null;\n lid: string;\n attributes?: Record<string, Value>;\n relationships?: Record<string, ChangedRelationshipData>;\n };\n\n/**\n * Serializes the current state of a resource or array of resources for use with POST or PUT requests.\n *\n * @public\n * @param {Cache} cache}\n * @param {StableRecordIdentifier} identifier\n * @return {Object} An object with a `data` property containing the serialized resource patch\n */\nexport function serializeResources(cache: Cache, identifiers: StableRecordIdentifier): { data: ResourceObject };\nexport function serializeResources(cache: Cache, identifiers: StableRecordIdentifier[]): { data: ResourceObject[] };\nexport function serializeResources(\n cache: Cache,\n identifiers: StableRecordIdentifier | StableRecordIdentifier[]\n): { data: ResourceObject | ResourceObject[] } {\n return {\n data: Array.isArray(identifiers)\n ? identifiers.map((identifier) => _serializeResource(cache, identifier))\n : _serializeResource(cache, identifiers),\n };\n}\n\ntype SerializedRef =\n | {\n id: string;\n type: string;\n }\n | { id: null; lid: string; type: string };\n\nfunction fixRef({\n id,\n lid,\n type,\n}: { id: string; lid?: string; type: string } | { id: null; lid: string; type: string }): SerializedRef {\n if (id !== null) {\n return { id, type };\n }\n return { id, lid, type };\n}\n\nfunction fixRelData(\n rel: Relationship['data'] | InnerRelationshipDocument['data']\n): SerializedRef | SerializedRef[] | null {\n if (Array.isArray(rel)) {\n return rel.map((ref) => fixRef(ref));\n } else if (typeof rel === 'object' && rel !== null) {\n return fixRef(rel);\n }\n return null;\n}\n\nfunction _serializeResource(cache: Cache, identifier: StableRecordIdentifier): ResourceObject {\n const { id, lid, type } = identifier;\n // peek gives us everything we want, but since its referentially the same data\n // as is in the cache we clone it to avoid any accidental mutations\n const record = structuredClone(cache.peek(identifier)) as ResourceObject;\n assert(\n `A record with id ${String(id)} and type ${type} for lid ${lid} was not found not in the supplied Cache.`,\n record\n );\n\n // remove lid from anything that has an ID and slice any relationship arrays\n if (record.id !== null) {\n delete record.lid;\n }\n\n if (record.relationships) {\n for (const key of Object.keys(record.relationships)) {\n const relationship = record.relationships[key];\n if (Array.isArray(relationship.data)) {\n relationship.data = relationship.data.map((ref) => fixRef(ref));\n } else if (typeof relationship.data === 'object' && relationship.data !== null) {\n relationship.data = fixRef(relationship.data);\n } else if (Object.keys(relationship ?? {}).length === 0) {\n delete record.relationships[key];\n }\n }\n }\n\n return record;\n}\n\n/**\n * Serializes changes to a resource for use with PATCH requests.\n *\n * Only attributes which are changed are serialized.\n * Only relationships which are changed are serialized.\n *\n * Collection relationships serialize the collection as a whole.\n *\n * If you would like to serialize updates to a collection more granularly\n * (for instance, as operations) request the diff from the store and\n * serialize as desired:\n *\n * ```ts\n * const relationshipDiffMap = cache.changedRelationships(identifier);\n * ```\n *\n * @public\n * @param {Cache} cache}\n * @param {StableRecordIdentifier} identifier\n * @return {Object} An object with a `data` property containing the serialized resource patch\n */\nexport function serializePatch(\n cache: Cache,\n identifier: StableRecordIdentifier\n // options: { include?: string[] } = {}\n): { data: JsonApiResourcePatch } {\n const { id, lid, type } = identifier;\n assert(\n `A record with id ${String(id)} and type ${type} for lid ${lid} was not found not in the supplied Cache.`,\n cache.peek(identifier)\n );\n\n const data: JsonApiResourcePatch =\n id === null\n ? { type, lid, id }\n : {\n type,\n id,\n };\n\n if (cache.hasChangedAttrs(identifier)) {\n const attrsChanges = cache.changedAttrs(identifier);\n const attributes: ResourceObject['attributes'] = {};\n\n Object.keys(attrsChanges).forEach((key) => {\n const change = attrsChanges[key];\n const newVal = change[1];\n attributes[key] = newVal === undefined ? null : structuredClone(newVal);\n });\n\n data.attributes = attributes;\n }\n\n const changedRelationships = cache.changedRelationships(identifier);\n if (changedRelationships.size) {\n const relationships: Record<string, ChangedRelationshipData> = {};\n changedRelationships.forEach((diff, key) => {\n relationships[key] = { data: fixRelData(diff.localState) } as ChangedRelationshipData;\n });\n\n data.relationships = relationships;\n }\n\n return { data };\n}\n"],"names":["JsonApiAccept","DEFAULT_CONFIG","host","namespace","ACCEPT_HEADER_VALUE","setBuildURLConfig","config","Object","assign","profiles","extensions","accept","values","length","join","setConfig","findRecord","arg1","arg2","arg3","identifier","type","id","options","cacheOptions","extractCacheOptions","urlOptions","op","resourcePath","pluralize","copyForwardUrlOptions","url","buildBaseURL","headers","Headers","append","include","buildQueryParams","urlParamsSettings","method","records","query","queryString","postQuery","queryData","structuredClone","key","body","JSON","stringify","isExisting","deleteRecord","record","recordIdentifierFor","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","data","createRecord","updateRecord","patch","serializeResources","cache","identifiers","Array","isArray","map","_serializeResource","fixRef","lid","fixRelData","rel","ref","peek","String","relationships","keys","relationship","serializePatch","hasChangedAttrs","attrsChanges","changedAttrs","attributes","forEach","change","newVal","undefined","changedRelationships","size","diff","localState"],"mappings":";;;;;;AAgBA,MAAMA,aAAa,GAAG,0BAA0B;AAChD,MAAMC,cAA6B,GAAG;AAAEC,EAAAA,IAAI,EAAE,EAAE;AAAEC,EAAAA,SAAS,EAAE;AAAG,CAAC;AAE1D,IAAIC,mBAAmB,GAAG,0BAA0B;;AAE3D;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,MAAqB,EAAQ;EACpDC,MAAM,CAACC,MAAM,CAAC,EAAE,EAAEP,cAAc,EAAEK,MAAM,CAAC;AAElD,EAAA,IAAIA,MAAM,CAACG,QAAQ,IAAIH,MAAM,CAACI,UAAU,EAAE;IACxC,IAAIC,MAAM,GAAGX,aAAa;IAC1B,IAAIM,MAAM,CAACG,QAAQ,EAAE;MACnB,MAAMA,QAAQ,GAAGF,MAAM,CAACK,MAAM,CAACN,MAAM,CAACG,QAAQ,CAAC;MAC/C,IAAIA,QAAQ,CAACI,MAAM,EAAE;QACnBF,MAAM,IAAI,YAAY,GAAGF,QAAQ,CAACK,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG;AACnD;AACF;IACA,IAAIR,MAAM,CAACI,UAAU,EAAE;MACrB,MAAMA,UAAU,GAAGH,MAAM,CAACK,MAAM,CAACN,MAAM,CAACI,UAAU,CAAC;MACnD,IAAIA,UAAU,CAACG,MAAM,EAAE;QACrBF,MAAM,IAAI,OAAO,GAAGD,UAAU,CAACI,IAAI,CAAC,GAAG,CAAC;AAC1C;AACF;AACAV,IAAAA,mBAAmB,GAAGO,MAAM;AAC9B;EAEAI,mBAAS,CAACT,MAAM,CAAC;AACnB;;ACpEA;AACA;AACA;A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ts","../src/-private/rest/query.ts","../src/-private/rest/save-record.ts"],"sourcesContent":["import type { TypeFromInstance } from '@warp-drive/core/types/record';\nimport type {\n FindRecordOptions,\n FindRecordRequestOptions,\n RemotelyAccessibleIdentifier,\n} from '@warp-drive/core/types/request';\nimport type { SingleResourceDataDocument } from '@warp-drive/core/types/spec/document';\n\nimport { buildBaseURL, buildQueryParams, type FindRecordUrlOptions } from '../../index.ts';\nimport { camelize, pluralize } from '../../string';\nimport { copyForwardUrlOptions, extractCacheOptions } from '../builder-utils.ts';\n\n/**\n * Builds request options to fetch a single resource by a known id or identifier\n * configured for the url and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { findRecord } from '@warp-drive/utilities/rest';\n *\n * const data = await store.request(findRecord('person', '1'));\n * ```\n *\n * **With Options**\n *\n * ```ts\n * import { findRecord } from '@warp-drive/utilities/rest';\n *\n * const options = findRecord('person', '1', { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **With an Identifier**\n *\n * ```ts\n * import { findRecord } from '@warp-drive/utilities/rest';\n *\n * const options = findRecord({ type: 'person', id: '1' }, { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { findRecord } from '@warp-drive/utilities/rest';\n *\n * const options = findRecord('person', '1', { include: ['pets', 'friends'] }, { namespace: 'api/v2' });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param identifier\n * @param options\n */\nexport type FindRecordResultDocument<T> = Omit<SingleResourceDataDocument<T>, 'data'> & { data: T };\n\nexport function findRecord<T>(\n identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>>,\n options?: FindRecordOptions<T>\n): FindRecordRequestOptions<FindRecordResultDocument<T>, T>;\nexport function findRecord(\n identifier: RemotelyAccessibleIdentifier,\n options?: FindRecordOptions\n): FindRecordRequestOptions;\nexport function findRecord<T>(\n type: TypeFromInstance<T>,\n id: string,\n options?: FindRecordOptions<T>\n): FindRecordRequestOptions<FindRecordResultDocument<T>, T>;\nexport function findRecord(type: string, id: string, options?: FindRecordOptions): FindRecordRequestOptions;\nexport function findRecord<T>(\n arg1: TypeFromInstance<T> | RemotelyAccessibleIdentifier<TypeFromInstance<T>>,\n arg2: string | FindRecordOptions | undefined,\n arg3?: FindRecordOptions\n): FindRecordRequestOptions<FindRecordResultDocument<T>, T> {\n const identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>> =\n typeof arg1 === 'string' ? { type: arg1, id: arg2 as string } : arg1;\n const options: FindRecordOptions = (typeof arg1 === 'string' ? arg3 : (arg2 as FindRecordOptions)) || {};\n const cacheOptions = extractCacheOptions(options);\n const urlOptions: FindRecordUrlOptions = {\n identifier,\n op: 'findRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url: options.include?.length\n ? `${url}?${buildQueryParams({ include: options.include }, options.urlParamsSettings)}`\n : url,\n method: 'GET',\n headers,\n cacheOptions,\n op: 'findRecord',\n records: [identifier],\n };\n}\n","import type { QueryParamsSource } from '@warp-drive/core/types/params';\nimport type { TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { ConstrainedRequestOptions, QueryRequestOptions } from '@warp-drive/core/types/request';\nimport type { CollectionResourceDataDocument } from '@warp-drive/core/types/spec/document';\n\nimport { buildBaseURL, buildQueryParams, type QueryUrlOptions } from '../../index.ts';\nimport { camelize, pluralize } from '../../string';\nimport { copyForwardUrlOptions, extractCacheOptions } from '../builder-utils.ts';\n\n/**\n * Builds request options to query for resources, usually by a primary\n * type, configured for the url and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { query } from '@warp-drive/utilities/rest';\n *\n * const data = await store.request(query('person'));\n * ```\n *\n * **With Query Params**\n *\n * ```ts\n * import { query } from '@warp-drive/utilities/rest';\n *\n * const options = query('person', { include: ['pets', 'friends'] });\n * const data = await store.request(options);\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSettings` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { query } from '@warp-drive/utilities/rest';\n *\n * const options = query('person', { include: ['pets', 'friends'] }, { reload: true });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param identifier\n * @param query\n * @param options\n */\nexport function query<T>(\n type: TypeFromInstance<T>,\n query?: QueryParamsSource,\n options?: ConstrainedRequestOptions\n): QueryRequestOptions<CollectionResourceDataDocument<T>, T>;\nexport function query(\n type: string,\n query?: QueryParamsSource,\n options?: ConstrainedRequestOptions\n): QueryRequestOptions;\nexport function query(\n type: string,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n query: QueryParamsSource = {},\n options: ConstrainedRequestOptions = {}\n): QueryRequestOptions {\n const cacheOptions = extractCacheOptions(options);\n const urlOptions: QueryUrlOptions = {\n identifier: { type },\n op: 'query',\n resourcePath: pluralize(camelize(type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n const queryString = buildQueryParams(query, options.urlParamsSettings);\n\n return {\n url: queryString ? `${url}?${queryString}` : url,\n method: 'GET',\n headers,\n cacheOptions,\n op: 'query',\n };\n}\n","import { recordIdentifierFor } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core/types/identifier';\nimport type { TypedRecordInstance } from '@warp-drive/core/types/record';\nimport type {\n ConstrainedRequestOptions,\n CreateRequestOptions,\n DeleteRequestOptions,\n UpdateRequestOptions,\n} from '@warp-drive/core/types/request';\nimport type { SingleResourceDataDocument } from '@warp-drive/core/types/spec/document';\n\nimport {\n buildBaseURL,\n type CreateRecordUrlOptions,\n type DeleteRecordUrlOptions,\n type UpdateRecordUrlOptions,\n} from '../../index.ts';\nimport { camelize, pluralize } from '../../string';\nimport { copyForwardUrlOptions } from '../builder-utils.ts';\n\nfunction isExisting(identifier: StableRecordIdentifier): identifier is StableExistingRecordIdentifier {\n return 'id' in identifier && identifier.id !== null && 'type' in identifier && identifier.type !== null;\n}\n\n/**\n * Builds request options to delete record for resources,\n * configured for the url, method and header expectations of REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { deleteRecord } from '@warp-drive/utilities/rest';\n *\n * const person = store.peekRecord('person', '1');\n *\n * // mark record as deleted\n * store.deleteRecord(person);\n *\n * // persist deletion\n * const data = await store.request(deleteRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { deleteRecord } from '@warp-drive/utilities/rest';\n *\n * const person = store.peekRecord('person', '1');\n *\n * // mark record as deleted\n * store.deleteRecord(person);\n *\n * // persist deletion\n * const options = deleteRecord(person, { namespace: 'api/v1' });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param record\n * @param options\n */\nexport function deleteRecord<T>(record: T, options?: ConstrainedRequestOptions): DeleteRequestOptions<T>;\nexport function deleteRecord(record: unknown, options?: ConstrainedRequestOptions): DeleteRequestOptions;\nexport function deleteRecord(record: unknown, options: ConstrainedRequestOptions = {}): DeleteRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));\n\n const urlOptions: DeleteRecordUrlOptions = {\n identifier: identifier,\n op: 'deleteRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url,\n method: 'DELETE',\n headers,\n op: 'deleteRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n\n/**\n * Builds request options to create new record for resources,\n * configured for the url, method and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { createRecord } from '@warp-drive/utilities/rest';\n *\n * const person = store.createRecord('person', { name: 'Ted' });\n * const data = await store.request(createRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { createRecord } from '@warp-drive/utilities/rest';\n *\n * const person = store.createRecord('person', { name: 'Ted' });\n * const options = createRecord(person, { namespace: 'api/v1' });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param record\n * @param options\n */\nexport function createRecord<T>(record: T, options?: ConstrainedRequestOptions): CreateRequestOptions<T>;\nexport function createRecord(record: unknown, options?: ConstrainedRequestOptions): CreateRequestOptions;\nexport function createRecord(record: unknown, options: ConstrainedRequestOptions = {}): CreateRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n\n const urlOptions: CreateRecordUrlOptions = {\n identifier: identifier,\n op: 'createRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url,\n method: 'POST',\n headers,\n op: 'createRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n\n/**\n * Builds request options to update existing record for resources,\n * configured for the url, method and header expectations of most REST APIs.\n *\n * **Basic Usage**\n *\n * ```ts\n * import { updateRecord } from '@warp-drive/utilities/rest';\n *\n * const person = store.peekRecord('person', '1');\n * person.name = 'Chris';\n * const data = await store.request(updateRecord(person));\n * ```\n *\n * **Supplying Options to Modify the Request Behavior**\n *\n * The following options are supported:\n *\n * - `patch` - Allows caller to specify whether to use a PATCH request instead of a PUT request, defaults to `false`.\n * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.\n * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.\n * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type\n * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this\n * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.\n * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the\n * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,\n * defaulting to `false` if none is configured.\n * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)\n *\n * ```ts\n * import { updateRecord } from '@warp-drive/utilities/rest';\n *\n * const person = store.peekRecord('person', '1');\n * person.name = 'Chris';\n * const options = updateRecord(person, { patch: true });\n * const data = await store.request(options);\n * ```\n *\n * @public\n * @param record\n * @param options\n */\nexport function updateRecord<T extends TypedRecordInstance, RT extends TypedRecordInstance = T>(\n record: T,\n options?: ConstrainedRequestOptions & { patch?: boolean }\n): UpdateRequestOptions<SingleResourceDataDocument<RT>, T>;\nexport function updateRecord(\n record: unknown,\n options?: ConstrainedRequestOptions & { patch?: boolean }\n): UpdateRequestOptions;\nexport function updateRecord(\n record: unknown,\n options: ConstrainedRequestOptions & { patch?: boolean } = {}\n): UpdateRequestOptions {\n const identifier = recordIdentifierFor(record);\n assert(`Expected to be given a record instance`, identifier);\n assert(`Cannot update a record that does not have an associated type and id.`, isExisting(identifier));\n\n const urlOptions: UpdateRecordUrlOptions = {\n identifier: identifier,\n op: 'updateRecord',\n resourcePath: pluralize(camelize(identifier.type)),\n };\n\n copyForwardUrlOptions(urlOptions, options);\n\n const url = buildBaseURL(urlOptions);\n const headers = new Headers();\n headers.append('Accept', 'application/json;charset=utf-8');\n\n return {\n url,\n method: options.patch ? 'PATCH' : 'PUT',\n headers,\n op: 'updateRecord',\n data: {\n record: identifier,\n },\n records: [identifier],\n };\n}\n"],"names":["findRecord","arg1","arg2","arg3","identifier","type","id","options","cacheOptions","extractCacheOptions","urlOptions","op","resourcePath","pluralize","camelize","copyForwardUrlOptions","url","buildBaseURL","headers","Headers","append","include","length","buildQueryParams","urlParamsSettings","method","records","query","queryString","isExisting","deleteRecord","record","recordIdentifierFor","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","data","createRecord","updateRecord","patch"],"mappings":";;;;;;AAYA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBO,SAASA,UAAUA,CACxBC,IAA6E,EAC7EC,IAA4C,EAC5CC,IAAwB,EACkC;AAC1D,EAAA,MAAMC,UAA6D,GACjE,OAAOH,IAAI,KAAK,QAAQ,GAAG;AAAEI,IAAAA,IAAI,EAAEJ,IAAI;AAAEK,IAAAA,EAAE,EAAEJ;AAAe,GAAC,GAAGD,IAAI;AACtE,EAAA,MAAMM,OAA0B,GAAG,CAAC,OAAON,IAAI,KAAK,QAAQ,GAAGE,IAAI,GAAID,IAA0B,KAAK,EAAE;AACxG,EAAA,MAAMM,YAAY,GAAGC,mBAAmB,CAACF,OAAO,CAAC;AACjD,EAAA,MAAMG,UAAgC,GAAG;IACvCN,UAAU;AACVO,IAAAA,EAAE,EAAE,YAAY;IAChBC,YAAY,EAAEC,SAAS,CAACC,QAAQ,CAACV,UAAU,CAACC,IAAI,CAAC;GAClD;AAEDU,EAAAA,qBAAqB,CAACL,UAAU,EAAEH,OAAO,CAAC;A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p-drive/core/dist/utils/string.js","../src/-private/string/inflections.ts","../src/-private/string/transform.ts","../src/-private/string/inflect.ts"],"sourcesContent":["import { macroCondition, getGlobalConfig } from '@embroider/macros';\nconst DEFAULT_MAX_CACHE_SIZE = 10_000;\n\n/**\n * An LRUCache implementation with upsert semantics.\n *\n * This implementation is *not* generic, but focuses on\n * performance tuning for the string transformation cases\n * where the key maps to the value very simply.\n *\n * It takes a work function that should generate a new value\n * for a given key when called. It will be called when the key\n * is not found in the cache.\n *\n * It keeps track of the number of hits, misses, and ejections\n * in DEBUG envs, which is useful for tuning the cache size.\n *\n * This is an internal utility class for use by this module\n * and by `@warp-drive/utilities/string`. It is not intended\n * for use outside of these modules at this time.\n *\n * @internal\n */\nclass LRUCache {\n // debug stats\n\n constructor(doWork, size) {\n this.size = size || DEFAULT_MAX_CACHE_SIZE;\n this.state = new Map();\n this.doWork = doWork;\n if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {\n this._hits = 0;\n this._misses = 0;\n this._ejected = 0;\n }\n }\n get(key) {\n const value = this.state.get(key);\n if (value) {\n if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {\n this._hits++;\n }\n this.state.delete(key);\n this.state.set(key, value);\n return value;\n }\n if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {\n this._misses++;\n }\n const newValue = this.doWork(key);\n this.set(key, newValue);\n return newValue;\n }\n set(key, value) {\n if (this.state.size === this.size) {\n for (const [k] of this.state) {\n if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {\n this._ejected++;\n }\n this.state.delete(k);\n break;\n }\n }\n this.state.set(key, value);\n }\n clear() {\n this.state.clear();\n if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {\n this._hits = 0;\n this._misses = 0;\n this._ejected = 0;\n }\n }\n}\nconst STRING_DASHERIZE_REGEXP = /[ _]/g;\nconst STRING_DECAMELIZE_REGEXP = /([a-z\\d])([A-Z])/g;\nconst STRING_DASHERIZE_CACHE = new LRUCache(key => key.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase().replace(STRING_DASHERIZE_REGEXP, '-'));\n\n/**\n * This is an internal utility function that converts a string\n * to a dasherized format. Library consumers should use the\n * re-exported version from `@warp-drive/utilities/string` instead.\n *\n * This version is only in this location to support a deprecated\n * behavior in the core package and will be removed in a future.\n *\n * @internal\n */\nfunction dasherize(str) {\n return STRING_DASHERIZE_CACHE.get(str);\n}\nexport { LRUCache, STRING_DASHERIZE_CACHE, dasherize };","export type RulesArray = Array<[RegExp, string]>;\ntype DefaultRulesType = {\n plurals: RulesArray;\n singular: RulesArray;\n irregularPairs: Array<[string, string]>;\n uncountable: string[];\n};\n\nexport const defaultRules: DefaultRulesType = {\n plurals: [\n [/$/, 's'],\n [/s$/i, 's'],\n [/^(ax|test)is$/i, '$1es'],\n [/(octop|vir)us$/i, '$1i'],\n [/(octop|vir)i$/i, '$1i'],\n [/(alias|status|bonus)$/i, '$1es'],\n [/(bu)s$/i, '$1ses'],\n [/(buffal|tomat)o$/i, '$1oes'],\n [/([ti])um$/i, '$1a'],\n [/([ti])a$/i, '$1a'],\n [/sis$/i, 'ses'],\n [/(?:([^f])fe|([lr])f)$/i, '$1$2ves'],\n [/(hive)$/i, '$1s'],\n [/([^aeiouy]|qu)y$/i, '$1ies'],\n [/(x|ch|ss|sh)$/i, '$1es'],\n [/(matr|vert|ind)(?:ix|ex)$/i, '$1ices'],\n [/^(m|l)ouse$/i, '$1ice'],\n [/^(m|l)ice$/i, '$1ice'],\n [/^(ox)$/i, '$1en'],\n [/^(oxen)$/i, '$1'],\n [/(quiz)$/i, '$1zes'],\n ],\n\n singular: [\n [/s$/i, ''],\n [/(ss)$/i, '$1'],\n [/(n)ews$/i, '$1ews'],\n [/([ti])a$/i, '$1um'],\n [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '$1sis'],\n [/(^analy)(sis|ses)$/i, '$1sis'],\n [/([^f])ves$/i, '$1fe'],\n [/(hive)s$/i, '$1'],\n [/(tive)s$/i, '$1'],\n [/([lr])ves$/i, '$1f'],\n [/([^aeiouy]|qu)ies$/i, '$1y'],\n [/(s)eries$/i, '$1eries'],\n [/(m)ovies$/i, '$1ovie'],\n [/(x|ch|ss|sh)es$/i, '$1'],\n [/^(m|l)ice$/i, '$1ouse'],\n [/(bus)(es)?$/i, '$1'],\n [/(o)es$/i, '$1'],\n [/(shoe)s$/i, '$1'],\n [/(cris|test)(is|es)$/i, '$1is'],\n [/^(a)x[ie]s$/i, '$1xis'],\n [/(octop|vir)(us|i)$/i, '$1us'],\n [/(alias|status|bonus)(es)?$/i, '$1'],\n [/^(ox)en/i, '$1'],\n [/(vert|ind)ices$/i, '$1ex'],\n [/(matr)ices$/i, '$1ix'],\n [/(quiz)zes$/i, '$1'],\n [/(database)s$/i, '$1'],\n ],\n\n irregularPairs: [\n ['person', 'people'],\n ['man', 'men'],\n ['child', 'children'],\n ['sex', 'sexes'],\n ['move', 'moves'],\n ['cow', 'kine'],\n ['zombie', 'zombies'],\n ],\n\n uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police'],\n};\n","import { dasherize as internalDasherize, LRUCache, STRING_DASHERIZE_CACHE } from '@warp-drive/core/utils/string';\n\n// eslint-disable-next-line no-useless-escape\nconst STRING_CAMELIZE_REGEXP_1 = /(\\-|\\_|\\.|\\s)+(.)?/g;\nconst STRING_CAMELIZE_REGEXP_2 = /(^|\\/)([A-Z])/g;\nconst CAMELIZE_CACHE = new LRUCache<string, string>((key: string) =>\n key\n .replace(STRING_CAMELIZE_REGEXP_1, (_match, _separator, chr: string | null) => (chr ? chr.toUpperCase() : ''))\n .replace(STRING_CAMELIZE_REGEXP_2, (match /*, separator, chr */) => match.toLowerCase())\n);\n\nconst STRING_UNDERSCORE_REGEXP_1 = /([a-z\\d])([A-Z]+)/g;\n// eslint-disable-next-line no-useless-escape\nconst STRING_UNDERSCORE_REGEXP_2 = /\\-|\\s+/g;\nconst UNDERSCORE_CACHE = new LRUCache<string, string>((str: string) =>\n str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase()\n);\n\nconst STRING_CAPITALIZE_REGEXP = /(^|\\/)([a-z\\u00C0-\\u024F])/g;\nconst CAPITALIZE_CACHE = new LRUCache<string, string>((str: string) =>\n str.replace(STRING_CAPITALIZE_REGEXP, (match /*, separator, chr */) => match.toUpperCase())\n);\n\n/**\n * Replaces underscores, spaces, or camelCase with dashes.\n *\n * ```js\n * import { dasherize } from '@warp-drive/utilities/string';\n *\n * dasherize('innerHTML'); // 'inner-html'\n * dasherize('action_name'); // 'action-name'\n * dasherize('css-class-name'); // 'css-class-name'\n * dasherize('my favorite items'); // 'my-favorite-items'\n * dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport const dasherize = internalDasherize;\n\n/**\n * Returns the lowerCamelCase form of a string.\n *\n * ```js\n * import { camelize } from '@warp-drive/utilities/string';\n *\n * camelize('innerHTML'); // 'innerHTML'\n * camelize('action_name'); // 'actionName'\n * camelize('css-class-name'); // 'cssClassName'\n * camelize('my favorite items'); // 'myFavoriteItems'\n * camelize('My Favorite Items'); // 'myFavoriteItems'\n * camelize('private-docs/owner-invoice'); // 'privateDocs/ownerInvoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport function camelize(str: string): string {\n return CAMELIZE_CACHE.get(str);\n}\n\n/**\n * Returns the lower\\_case\\_and\\_underscored form of a string.\n *\n * ```js\n * import { underscore } from '@warp-drive/utilities/string';\n *\n * underscore('innerHTML'); // 'inner_html'\n * underscore('action_name'); // 'action_name'\n * underscore('css-class-name'); // 'css_class_name'\n * underscore('my favorite items'); // 'my_favorite_items'\n * underscore('privateDocs/ownerInvoice'); // 'private_docs/owner_invoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport function underscore(str: string): string {\n return UNDERSCORE_CACHE.get(str);\n}\n\n/**\n * Returns the Capitalized form of a string\n *\n * ```js\n * import { capitalize } from '@warp-drive/utilities/string';\n *\n * capitalize('innerHTML') // 'InnerHTML'\n * capitalize('action_name') // 'Action_name'\n * capitalize('css-class-name') // 'Css-class-name'\n * capitalize('my favorite items') // 'My favorite items'\n * capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport function capitalize(str: string): string {\n return CAPITALIZE_CACHE.get(str);\n}\n\n/**\n * Sets the maximum size of the LRUCache for all string transformation functions.\n * The default size is 10,000.\n *\n * @public\n * @param {Number} size\n * @return {void}\n * @since 4.13.0\n */\nexport function setMaxLRUCacheSize(size: number) {\n CAMELIZE_CACHE.size = size;\n UNDERSCORE_CACHE.size = size;\n CAPITALIZE_CACHE.size = size;\n STRING_DASHERIZE_CACHE.size = size;\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\nimport { LRUCache } from '@warp-drive/core/utils/string';\n\nimport { defaultRules } from './inflections.ts';\nimport { capitalize } from './transform.ts';\n\nconst BLANK_REGEX = /^\\s*$/;\nconst LAST_WORD_DASHED_REGEX = /([\\w/-]+[_/\\s-])([a-z\\d]+$)/;\nconst LAST_WORD_CAMELIZED_REGEX = /([\\w/\\s-]+)([A-Z][a-z\\d]*$)/;\nconst CAMELIZED_REGEX = /[A-Z][a-z\\d]*$/;\n\nconst SINGULARS = new LRUCache<string, string>((word: string) => {\n return _singularize(word);\n});\nconst PLURALS = new LRUCache<string, string>((word: string) => {\n return _pluralize(word);\n});\nconst UNCOUNTABLE = new Set(defaultRules.uncountable);\nconst IRREGULAR: Map<string, string> = new Map();\nconst INVERSE_IRREGULAR: Map<string, string> = new Map();\nconst SINGULAR_RULES = new Map(defaultRules.singular.reverse());\nconst PLURAL_RULES = new Map(defaultRules.plurals.reverse());\n\n/**\n * Marks a word as uncountable. Uncountable words are not pluralized\n * or singularized.\n *\n * @public\n * @param {String} word\n * @return {void}\n * @since 4.13.0\n */\nexport function uncountable(word: string) {\n UNCOUNTABLE.add(word.toLowerCase());\n}\n\n/**\n * Marks a list of words as uncountable. Uncountable words are not pluralized\n * or singularized.\n *\n * @public\n * @param {Array<String>} uncountables\n * @return {void}\n * @since 4.13.0\n */\nexport function loadUncountable(uncountables: string[]) {\n uncountables.forEach((word) => {\n uncountable(word);\n });\n}\n\n/**\n * Marks a word as irregular. Irregular words have unique\n * pluralization and singularization rules.\n *\n * @public\n * @param {String} single\n * @param {String} plur\n * @return {void}\n * @since 4.13.0\n */\nexport function irregular(single: string, plur: string) {\n //pluralizing\n IRREGULAR.set(single.toLowerCase(), plur);\n IRREGULAR.set(plur.toLowerCase(), plur);\n\n //singularizing\n INVERSE_IRREGULAR.set(plur.toLowerCase(), single);\n INVERSE_IRREGULAR.set(single.toLowerCase(), single);\n}\n\n/**\n * Marks a list of word pairs as irregular. Irregular words have unique\n * pluralization and singularization rules.\n *\n * @public\n * @param {Array<Array<String>>} irregularPairs\n * @return {void}\n * @since 4.13.0\n */\nexport function loadIrregular(irregularPairs: Array<[string, string]>) {\n irregularPairs.forEach((pair) => {\n //pluralizing\n IRREGULAR.set(pair[0].toLowerCase(), pair[1]);\n IRREGULAR.set(pair[1].toLowerCase(), pair[1]);\n\n //singularizing\n INVERSE_IRREGULAR.set(pair[1].toLowerCase(), pair[0]);\n INVERSE_IRREGULAR.set(pair[0].toLowerCase(), pair[0]);\n });\n}\nloadIrregular(defaultRules.irregularPairs);\n\n/**\n * Clears the caches for singularize and pluralize.\n *\n * @public\n * @return {void}\n * @since 4.13.0\n */\nexport function clear() {\n SINGULARS.clear();\n PLURALS.clear();\n}\n\n/**\n * Resets the inflection rules to the defaults.\n *\n * @public\n * @return {void}\n * @since 4.13.0\n */\nexport function resetToDefaults() {\n clearRules();\n defaultRules.uncountable.forEach((v) => UNCOUNTABLE.add(v));\n defaultRules.singular.forEach((v) => SINGULAR_RULES.set(v[0], v[1]));\n defaultRules.plurals.forEach((v) => PLURAL_RULES.set(v[0], v[1]));\n loadIrregular(defaultRules.irregularPairs);\n}\n\n/**\n * Clears all inflection rules\n * and resets the caches for singularize and pluralize.\n *\n * @public\n * @return {void}\n * @since 4.13.0\n */\nexport function clearRules() {\n SINGULARS.clear();\n PLURALS.clear();\n UNCOUNTABLE.clear();\n IRREGULAR.clear();\n INVERSE_IRREGULAR.clear();\n SINGULAR_RULES.clear();\n PLURAL_RULES.clear();\n}\n\n/**\n * Singularizes a word.\n *\n * @public\n * @param {String} word\n * @return {String}\n * @since 4.13.0\n */\nexport function singularize(word: string) {\n assert(`singularize expects to receive a non-empty string`, typeof word === 'string' && word.length > 0);\n if (!word) return '';\n return SINGULARS.get(word);\n}\n\n/**\n * Pluralizes a word.\n *\n * @public\n * @param {String} word\n * @return {String}\n * @since 4.13.0\n */\nexport function pluralize(word: string) {\n assert(`pluralize expects to receive a non-empty string`, typeof word === 'string' && word.length > 0);\n if (!word) return '';\n return PLURALS.get(word);\n}\n\nfunction unshiftMap<K, V>(v: [K, V], map: Map<K, V>) {\n // reorder\n const rules = [v, ...map.entries()];\n map.clear();\n rules.forEach((rule) => {\n map.set(rule[0], rule[1]);\n });\n}\n\n/**\n * Adds a pluralization rule.\n *\n * @public\n * @param {RegExp} regex\n * @param {String} string\n * @return {void}\n * @since 4.13.0\n */\nexport function plural(regex: RegExp, string: string) {\n // rule requires reordering if exists, so remove it first\n if (PLURAL_RULES.has(regex)) {\n PLURAL_RULES.delete(regex);\n }\n\n // reorder\n unshiftMap([regex, string], PLURAL_RULES);\n}\n\n/**\n * Adds a singularization rule.\n *\n * @public\n * @param {RegExp} regex\n * @param {String} string\n * @return {void}\n * @since 4.13.0\n */\nexport function singular(regex: RegExp, string: string) {\n // rule requires reordering if exists, so remove it first\n if (SINGULAR_RULES.has(regex)) {\n SINGULAR_RULES.delete(regex);\n }\n\n // reorder\n unshiftMap([regex, string], SINGULAR_RULES);\n}\n\nfunction _pluralize(word: string) {\n return inflect(word, PLURAL_RULES, IRREGULAR);\n}\n\nfunction _singularize(word: string) {\n return inflect(word, SINGULAR_RULES, INVERSE_IRREGULAR);\n}\n\nfunction inflect(word: string, typeRules: Map<RegExp, string>, irregulars: Map<string, string>) {\n // empty strings\n const isBlank = !word || BLANK_REGEX.test(word);\n if (isBlank) {\n return word;\n }\n\n // basic uncountables\n const lowercase = word.toLowerCase();\n if (UNCOUNTABLE.has(lowercase)) {\n return word;\n }\n\n // adv uncountables\n const wordSplit = LAST_WORD_DASHED_REGEX.exec(word) || LAST_WORD_CAMELIZED_REGEX.exec(word);\n const lastWord = wordSplit ? wordSplit[2].toLowerCase() : null;\n if (lastWord && UNCOUNTABLE.has(lastWord)) {\n return word;\n }\n\n // handle irregulars\n const isCamelized = CAMELIZED_REGEX.test(word);\n for (let [rule, substitution] of irregulars) {\n if (lowercase.match(rule + '$')) {\n if (isCamelized && lastWord && irregulars.has(lastWord)) {\n substitution = capitalize(substitution);\n rule = capitalize(rule);\n }\n\n return word.replace(new RegExp(rule, 'i'), substitution);\n }\n }\n\n // do the actual inflection\n for (const [rule, substitution] of typeRules) {\n if (rule.test(word)) {\n return word.replace(rule, substitution);\n }\n }\n\n return word;\n}\n"],"names":["DEFAULT_MAX_CACHE_SIZE","LRUCache","constructor","doWork","size","state","Map","get","key","value","delete","set","newValue","k","clear","STRING_DASHERIZE_REGEXP","STRING_DECAMELIZE_REGEXP","STRING_DASHERIZE_CACHE","replace","toLowerCase","dasherize","str","defaultRules","plurals","singular","irregularPairs","uncountable","STRING_CAMELIZE_REGEXP_1","STRING_CAMELIZE_REGEXP_2","CAMELIZE_CACHE","_match","_separator","chr","toUpperCase","match","STRING_UNDERSCORE_REGEXP_1","STRING_UNDERSCORE_REGEXP_2","UNDERSCORE_CACHE","STRING_CAPITALIZE_REGEXP","CAPITALIZE_CACHE","internalDasherize","camelize","underscore","capitalize","setMaxLRUCacheSize","BLANK_REGEX","LAST_WORD_DASHED_REGEX","LAST_WORD_CAMELIZED_REGEX","CAMELIZED_REGEX","SINGULARS","word","_singularize","PLURALS","_pluralize","UNCOUNTABLE","Set","IRREGULAR","INVERSE_IRREGULAR","SINGULAR_RULES","reverse","PLURAL_RULES","add","loadUncountable","uncountables","forEach","irregular","single","plur","loadIrregular","pair","resetToDefaults","clearRules","v","singularize","pluralize","unshiftMap","map","rules","entries","rule","plural","regex","string","has","inflect","typeRules","irregulars","isBlank","test","lowercase","wordSplit","exec","lastWord","isCamelized","substitution","RegExp"],"mappings":";;;;AACA,MAAMA,sBAAsB,GAAG,MAAM;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,CAAC;AACb;;AAEAC,EAAAA,WAAWA,CAACC,MAAM,EAAEC,IAAI,EAAE;AACxB,IAAA,IAAI,CAACA,IAAI,GAAGA,IAAI,IAAIJ,sBAAsB;AAC1C,IAAA,IAAI,CAACK,KAAK,GAAG,IAAIC,GAAG,EAAE;IACtB,IAAI,CAACH,MAAM,GAAGA,MAAM;AAMtB;EACAI,GAAGA,CAACC,GAAG,EAAE;IACP,MAAMC,KAAK,GAAG,IAAI,CAACJ,KAAK,CAACE,GAAG,CAACC,GAAG,CAAC;AACjC,IAAA,IAAIC,KAAK,EAAE;AAIT,MAAA,IAAI,CAACJ,KAAK,CAACK,MAAM,CAACF,GAAG,CAAC;MACtB,IAAI,CAACH,KAAK,CAACM,GAAG,CAACH,GAAG,EAAEC,KAAK,CAAC;AAC1B,MAAA,OAAOA,KAAK;AACd;AAIA,IAAA,MAAMG,QAAQ,GAAG,IAAI,CAACT,MAAM,CAACK,GAAG,CAAC;AACjC,IAAA,IAAI,CAACG,GAAG,CAACH,GAAG,EAAEI,QAAQ,CAAC;AACvB,IAAA,OAAOA,QAAQ;AAC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AACiB,0BAA0B,EAAE,OAAO,CAAC,CAACjB,OAAO,CAACkB,0BAA0B,EAAE,GAAG,CAAC,CAACjB,WAAW,EACvG,CAAC;AAED,MAAMmB,wBAAwB,GAAG,6BAA6B;AAC9D,MAAMC,gBAAgB,GAAG,IAAItC,QAAQ,CAAkBoB,GAAW,IAChEA,GAAG,CAACH,OAAO,CAACoB,wBAAwB,EAAE,CAACJ,KAAK,2BAA2BA,KAAK,CAACD,WAAW,EAAE,CAC5F,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMb,SAAS,GAAGoB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAACpB,GAAW,EAAU;AAC5C,EAAA,OAAOQ,cAAc,CAACtB,GAAG,CAACc,GAAG,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASqB,UAAUA,CAACrB,GAAW,EAAU;AAC9C,EAAA,OAAOgB,gBAAgB,CAAC9B,GAAG,CAACc,GAAG,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASsB,UAAUA,CAACtB,GAAW,EAAU;AAC9C,EAAA,OAAOkB,gBAAgB,CAAChC,GAAG,CAACc,GAAG,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASuB,kBAAkBA,CAACxC,IAAY,EAAE;EAC/CyB,cAAc,CAACzB,IAAI,GAAGA,IAAI;EAC1BiC,gBAAgB,CAACjC,IAAI,GAAGA,IAAI;EAC5BmC,gBAAgB,CAACnC,IAAI,GAAGA,IAAI;EAC5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E,GAAG,CAAC,EAAEe,YAAY,CAAC;AAC1D;AACF;;AAEA;EACA,KAAK,MAAM,CAACf,IAAI,EAAEe,YAAY,CAAC,IAAIT,SAAS,EAAE;AAC5C,IAAA,IAAIN,IAAI,CAACS,IAAI,CAACtC,IAAI,CAAC,EAAE;AACnB,MAAA,OAAOA,IAAI,CAAChC,OAAO,CAAC6D,IAAI,EAAEe,YAAY,CAAC;AACzC;AACF;AAEA,EAAA,OAAO5C,IAAI;AACb;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
|
package/dist/string.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|