@ember-data-mirror/request 5.4.0-beta.15 → 5.4.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,11 +1,23 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (C) 2017-2023 Ember.js contributors
4
- Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
5
- Portions Copyright (C) 2011 LivingSocial Inc.
3
+ Copyright (c) 2017-2025 Ember.js and contributors
4
+ Copyright (c) 2011-2017 Tilde, Inc. and contributors
5
+ Copyright (c) 2011 LivingSocial Inc.
6
6
 
7
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
8
13
 
9
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
10
16
 
11
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  <p align="center">
2
2
  <img
3
3
  class="project-logo"
4
- src="./ember-data-logo-dark.svg#gh-dark-mode-only"
4
+ src="./logos/ember-data-logo-dark.svg#gh-dark-mode-only"
5
5
  alt="EmberData RequestManager"
6
6
  width="240px"
7
7
  title="EmberData RequestManager"
8
8
  />
9
9
  <img
10
10
  class="project-logo"
11
- src="./ember-data-logo-light.svg#gh-light-mode-only"
11
+ src="./logos/ember-data-logo-light.svg#gh-light-mode-only"
12
12
  alt="EmberData RequestManager"
13
13
  width="240px"
14
14
  title="EmberData RequestManager"
@@ -405,7 +405,7 @@ const BODY_TYPES = {
405
405
  type: 'string',
406
406
  klass: ['Blob', 'ArrayBuffer', 'TypedArray', 'DataView', 'FormData', 'URLSearchParams', 'ReadableStream']
407
407
  };
408
- const ValidKeys = new Map([['records', 'array'], ['data', 'json'], ['body', BODY_TYPES], ['disableTestWaiter', 'boolean'], ['options', 'object'], ['cacheOptions', 'object'], ['op', 'string'], ['store', 'object'], ['url', 'string'], ['cache', ['default', 'force-cache', 'no-cache', 'no-store', 'only-if-cached', 'reload']], ['credentials', ['include', 'omit', 'same-origin']], ['destination', ['', 'object', 'audio', 'audioworklet', 'document', 'embed', 'font', 'frame', 'iframe', 'image', 'manifest', 'paintworklet', 'report', 'script', 'sharedworker', 'style', 'track', 'video', 'worker', 'xslt']], ['headers', 'headers'], ['integrity', 'string'], ['keepalive', 'boolean'], ['method', ['GET', 'PUT', 'PATCH', 'DELETE', 'POST', 'OPTIONS']], ['mode', ['same-origin', 'cors', 'navigate', 'no-cors']], ['redirect', ['error', 'follow', 'manual']], ['referrer', 'string'], ['signal', 'AbortSignal'], ['controller', 'AbortController'], ['referrerPolicy', ['', 'same-origin', 'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'strict-origin', 'strict-origin-when-cross-origin', 'unsafe-url']]]);
408
+ const ValidKeys = new Map([['records', 'array'], ['data', 'json'], ['body', BODY_TYPES], ['disableTestWaiter', 'boolean'], ['options', 'object'], ['cacheOptions', 'object'], ['op', 'string'], ['store', 'object'], ['url', 'string'], ['cache', ['default', 'force-cache', 'no-cache', 'no-store', 'only-if-cached', 'reload']], ['credentials', ['include', 'omit', 'same-origin']], ['destination', ['', 'object', 'audio', 'audioworklet', 'document', 'embed', 'font', 'frame', 'iframe', 'image', 'manifest', 'paintworklet', 'report', 'script', 'sharedworker', 'style', 'track', 'video', 'worker', 'xslt']], ['headers', 'headers'], ['integrity', 'string'], ['keepalive', 'boolean'], ['method', ['QUERY', 'GET', 'PUT', 'PATCH', 'DELETE', 'POST', 'OPTIONS', 'HEAD', 'CONNECT', 'TRACE']], ['mode', ['same-origin', 'cors', 'navigate', 'no-cors']], ['redirect', ['error', 'follow', 'manual']], ['referrer', 'string'], ['signal', 'AbortSignal'], ['controller', 'AbortController'], ['referrerPolicy', ['', 'same-origin', 'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'strict-origin', 'strict-origin-when-cross-origin', 'unsafe-url']]]);
409
409
  const IS_FROZEN = getOrSetGlobal('IS_FROZEN', Symbol('FROZEN'));
410
410
  const IS_COLLECTION = getOrSetGlobal('IS_COLLECTION', Symbol.for('Collection'));
411
411
  function freezeHeaders(headers) {
@@ -538,7 +538,7 @@ function validateKey(key, value, errors) {
538
538
  }
539
539
  if (Array.isArray(schema)) {
540
540
  if (!schema.includes(value)) {
541
- errors.push(`InvalidValue: key ${key} should be a one of '${schema.join("', '")}', received ${typeof value === 'string' ? value : '<a value of type ' + niceTypeOf(value) + '>'}`);
541
+ errors.push(`InvalidValue: key ${key} should be one of '${schema.join("', '")}', received ${typeof value === 'string' ? value : '<a value of type ' + niceTypeOf(value) + '>'}`);
542
542
  }
543
543
  return;
544
544
  } else if (schema === 'json') {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-nHWzWIMX.js","sources":["../src/-private/promise-cache.ts","../src/-private/utils.ts","../src/-private/future.ts","../src/-private/context.ts","../src/-private/debug.ts"],"sourcesContent":["import { getOrSetUniversal } from '@warp-drive-mirror/core-types/-private';\n\nexport type CacheResult<T = unknown, E = unknown> = { isError: true; result: E } | { isError: false; result: T };\n\nexport type Awaitable<T = unknown, E = unknown> = {\n then: (onFulfilled: (value: T) => unknown, onRejected: (reason: E) => unknown) => unknown;\n catch: (onRejected: (reason: E) => unknown) => unknown;\n finally: (onFinally: () => unknown) => unknown;\n};\n\nexport const PromiseCache = getOrSetUniversal('PromiseCache', new WeakMap<Awaitable, CacheResult>());\nexport const RequestMap = getOrSetUniversal('RequestMap', new Map<number, CacheResult>());\n\nexport function setRequestResult(requestId: number, result: CacheResult) {\n RequestMap.set(requestId, result);\n}\nexport function clearRequestResult(requestId: number) {\n RequestMap.delete(requestId);\n}\nexport function getRequestResult(requestId: number): CacheResult | undefined {\n return RequestMap.get(requestId);\n}\n\nexport function setPromiseResult(promise: Promise<unknown> | Awaitable, result: CacheResult) {\n PromiseCache.set(promise, result);\n}\n\nexport function getPromiseResult<T, E>(promise: Promise<T> | Awaitable<T, E>): CacheResult<T, E> | undefined {\n return PromiseCache.get(promise) as CacheResult<T, E> | undefined;\n}\n","import { DEBUG } from '@warp-drive-mirror/build-config/env';\nimport { getOrSetGlobal } from '@warp-drive-mirror/core-types/-private';\nimport type {\n RequestInfo,\n StructuredDataDocument,\n StructuredDocument,\n StructuredErrorDocument,\n} from '@warp-drive-mirror/core-types/request';\nimport { STRUCTURED } from '@warp-drive-mirror/core-types/request';\n\nimport { Context, ContextOwner } from './context';\nimport { assertValidRequest } from './debug';\nimport { createFuture, isFuture } from './future';\nimport { setRequestResult } from './promise-cache';\nimport type { DeferredFuture, Future, GodContext, Handler } from './types';\n\nexport const IS_CACHE_HANDLER = getOrSetGlobal('IS_CACHE_HANDLER', Symbol('IS_CACHE_HANDLER'));\nexport function curryFuture<T>(owner: ContextOwner, inbound: Future<T>, outbound: DeferredFuture<T>): Future<T> {\n owner.setStream(inbound.getStream());\n\n inbound.then(\n (doc: StructuredDataDocument<T>) => {\n const document = {\n [STRUCTURED]: true as const,\n request: owner.request,\n response: doc.response,\n content: doc.content,\n };\n outbound.resolve(document);\n },\n (error: Error & StructuredErrorDocument) => {\n if (isDoc(error)) {\n owner.setStream(owner.god.stream);\n }\n if (!error || !(error instanceof Error)) {\n try {\n throw new Error(error ? error : `Request Rejected with an Unknown Error`);\n } catch (e: unknown) {\n if (error && typeof error === 'object') {\n Object.assign(e as Error, error);\n (e as Error & StructuredErrorDocument).message =\n (error as Error).message || `Request Rejected with an Unknown Error`;\n }\n error = e as Error & StructuredErrorDocument;\n }\n }\n\n error[STRUCTURED] = true;\n error.request = owner.request;\n error.response = owner.getResponse();\n error.error = error.error || error.message;\n\n outbound.reject(error);\n }\n );\n return outbound.promise;\n}\n\nfunction isDoc<T>(doc: T | StructuredDataDocument<T>): doc is StructuredDataDocument<T> {\n return doc && (doc as StructuredDataDocument<T>)[STRUCTURED] === true;\n}\n\nfunction ensureDoc<T>(owner: ContextOwner, content: T | Error, isError: boolean): StructuredDocument<T> {\n if (isDoc(content)) {\n return content as StructuredDocument<T>;\n }\n\n if (isError) {\n return {\n [STRUCTURED]: true,\n request: owner.request,\n response: owner.getResponse(),\n error: content as Error,\n } as StructuredErrorDocument<T>;\n }\n\n return {\n [STRUCTURED]: true,\n request: owner.request,\n response: owner.getResponse(),\n content: content as T,\n };\n}\n\nexport interface HttpErrorProps extends DOMException {\n code: number;\n name: string;\n status: number;\n statusText: string;\n isRequestError: boolean;\n}\n\nexport function enhanceReason(reason?: string) {\n return new DOMException(reason || 'The user aborted a request.', 'AbortError');\n}\n\nexport function handleOutcome<T>(\n owner: ContextOwner,\n inbound: Promise<T | StructuredDataDocument<T>>,\n outbound: DeferredFuture<T>\n): Future<T> {\n inbound.then(\n (content: T | StructuredDataDocument<T>) => {\n if (owner.controller.signal.aborted) {\n // the next function did not respect the signal, we handle it here\n outbound.reject(enhanceReason(owner.controller.signal.reason as string));\n return;\n }\n if (isDoc(content)) {\n owner.setStream(owner.god.stream);\n content = content.content;\n }\n const document = {\n [STRUCTURED]: true as const,\n request: owner.request,\n response: owner.getResponse(),\n content,\n };\n outbound.resolve(document);\n },\n (error: Error & StructuredErrorDocument) => {\n if (isDoc(error)) {\n owner.setStream(owner.god.stream);\n }\n if (!error || !(error instanceof Error)) {\n try {\n throw new Error(error ? error : `Request Rejected with an Unknown Error`);\n } catch (e: unknown) {\n if (error && typeof error === 'object') {\n Object.assign(e as Error, error);\n (e as Error & StructuredErrorDocument).message =\n (error as Error).message || `Request Rejected with an Unknown Error`;\n }\n error = e as Error & StructuredErrorDocument;\n }\n }\n\n error[STRUCTURED] = true;\n error.request = owner.request;\n error.response = owner.getResponse();\n error.error = error.error || error.message;\n outbound.reject(error);\n }\n );\n return outbound.promise;\n}\n\nfunction isCacheHandler(handler: Handler & { [IS_CACHE_HANDLER]?: boolean }, index: number): boolean {\n return index === 0 && Boolean(handler[IS_CACHE_HANDLER]);\n}\n\nexport function executeNextHandler<T>(\n wares: Readonly<Handler[]>,\n request: RequestInfo,\n i: number,\n god: GodContext\n): Future<T> {\n if (DEBUG) {\n if (i === wares.length) {\n throw new Error(`No handler was able to handle this request.`);\n }\n assertValidRequest(request, false);\n }\n const owner = new ContextOwner(request, god, i === 0);\n\n function next(r: RequestInfo): Future<T> {\n owner.nextCalled++;\n return executeNextHandler(wares, r, i + 1, god);\n }\n\n const _isCacheHandler = isCacheHandler(wares[i], i);\n const context = new Context(owner, _isCacheHandler);\n let outcome: Promise<T | StructuredDataDocument<T>> | Future<T>;\n try {\n outcome = wares[i].request<T>(context, next);\n if (_isCacheHandler) {\n context._finalize();\n }\n if (!!outcome && _isCacheHandler) {\n if (!(outcome instanceof Promise)) {\n setRequestResult(owner.requestId, { isError: false, result: ensureDoc(owner, outcome, false) });\n outcome = Promise.resolve(outcome);\n }\n } else if (DEBUG) {\n if (!outcome || (!(outcome instanceof Promise) && !(typeof outcome === 'object' && 'then' in outcome))) {\n // eslint-disable-next-line no-console\n console.log({ request, handler: wares[i], outcome });\n if (outcome === undefined) {\n throw new Error(`Expected handler.request to return a promise, instead received undefined.`);\n }\n throw new Error(`Expected handler.request to return a promise, instead received a synchronous value.`);\n }\n }\n } catch (e) {\n if (_isCacheHandler) {\n setRequestResult(owner.requestId, { isError: true, result: ensureDoc(owner, e, true) });\n }\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n outcome = Promise.reject<StructuredDataDocument<T>>(e);\n }\n const future = createFuture<T>(owner);\n\n if (isFuture<T>(outcome)) {\n return curryFuture(owner, outcome, future);\n }\n\n return handleOutcome(owner, outcome, future);\n}\n","import { IS_FUTURE, type StructuredDocument } from '@warp-drive-mirror/core-types/request';\n\nimport type { ContextOwner } from './context';\nimport type { Deferred, DeferredFuture, Future } from './types';\nimport { enhanceReason } from './utils';\n\nexport function isFuture<T>(maybe: unknown): maybe is Future<T> {\n return Boolean(maybe && maybe instanceof Promise && (maybe as Future<T>)[IS_FUTURE] === true);\n}\n\nexport function createDeferred<T>(): Deferred<T> {\n let resolve!: (v: T) => void;\n let reject!: (v: unknown) => void;\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return { resolve, reject, promise };\n}\n\nexport function upgradePromise<T>(promise: Promise<StructuredDocument<T>>, future: Future<T>): Future<T> {\n (promise as Future<T>)[IS_FUTURE] = true;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n (promise as Future<T>).getStream = future.getStream;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n (promise as Future<T>).abort = future.abort;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n (promise as Future<T>).onFinalize = future.onFinalize;\n (promise as Future<T>).id = future.id;\n (promise as Future<T>).lid = future.lid;\n\n return promise as Future<T>;\n}\n\nexport function createFuture<T>(owner: ContextOwner): DeferredFuture<T> {\n const deferred = createDeferred<T>() as unknown as DeferredFuture<T>;\n let { promise } = deferred;\n let cbs: Array<() => void> | undefined;\n promise = promise.finally(() => {\n owner.resolveStream();\n if (cbs) {\n cbs.forEach((cb) => cb());\n }\n }) as Future<T>;\n promise.onFinalize = (fn: () => void) => {\n cbs = cbs || [];\n cbs.push(fn);\n };\n promise[IS_FUTURE] = true;\n promise.getStream = () => {\n return owner.getStream();\n };\n promise.abort = (reason?: string) => {\n owner.abort(enhanceReason(reason));\n };\n promise.id = owner.requestId;\n promise.lid = owner.god.identifier;\n\n deferred.promise = promise;\n return deferred;\n}\n","import { DEBUG } from '@warp-drive-mirror/build-config/env';\nimport { assert } from '@warp-drive-mirror/build-config/macros';\nimport type { StableDocumentIdentifier } from '@warp-drive-mirror/core-types/identifier';\nimport type { ImmutableHeaders, ImmutableRequestInfo, RequestInfo, ResponseInfo } from '@warp-drive-mirror/core-types/request';\nimport { SkipCache } from '@warp-drive-mirror/core-types/request';\n\nimport { deepFreeze } from './debug';\nimport { createDeferred } from './future';\nimport type { DeferredStream, GodContext } from './types';\n\nexport function upgradeHeaders(headers: Headers | ImmutableHeaders): ImmutableHeaders {\n (headers as ImmutableHeaders).clone = () => {\n return new Headers(headers);\n };\n (headers as ImmutableHeaders).toJSON = () => {\n return Array.from(headers as unknown as Iterable<[string, string]>);\n };\n return headers as ImmutableHeaders;\n}\n\nexport function cloneResponseProperties(response: Response): ResponseInfo {\n const { headers, ok, redirected, status, statusText, type, url } = response;\n upgradeHeaders(headers);\n return {\n headers: headers as ImmutableHeaders,\n ok,\n redirected,\n status,\n statusText,\n type,\n url,\n };\n}\n\nexport class ContextOwner {\n hasSetStream = false;\n hasSetResponse = false;\n hasSubscribers = false;\n stream: DeferredStream = createDeferred<ReadableStream | null>();\n response: ResponseInfo | null = null;\n declare request: ImmutableRequestInfo;\n declare enhancedRequest: ImmutableRequestInfo;\n nextCalled = 0;\n declare god: GodContext;\n declare controller: AbortController;\n declare requestId: number;\n declare isRoot: boolean;\n\n constructor(request: RequestInfo, god: GodContext, isRoot = false) {\n this.isRoot = isRoot;\n this.requestId = god.id;\n this.controller = request.controller || god.controller;\n this.stream.promise.sizeHint = 0;\n\n if (request.controller) {\n if (request.controller !== god.controller) {\n god.controller.signal.addEventListener('abort', () => {\n this.controller.abort(god.controller.signal.reason);\n });\n }\n delete request.controller;\n }\n let enhancedRequest: ImmutableRequestInfo = Object.assign(\n { signal: this.controller.signal },\n request\n ) as ImmutableRequestInfo;\n if (DEBUG) {\n if (!request?.cacheOptions?.[SkipCache]) {\n request = deepFreeze(request) as ImmutableRequestInfo;\n enhancedRequest = deepFreeze(enhancedRequest);\n }\n } else {\n if (request.headers) {\n upgradeHeaders(request.headers);\n }\n }\n this.enhancedRequest = enhancedRequest;\n this.request = request as ImmutableRequestInfo;\n this.god = god;\n this.stream.promise = this.stream.promise.then((stream: ReadableStream | null) => {\n if (this.god.stream === stream && this.hasSubscribers) {\n this.god.stream = null;\n }\n return stream;\n });\n }\n\n get hasRequestedStream(): boolean {\n return this.god.hasRequestedStream;\n }\n\n getResponse(): ResponseInfo | null {\n if (this.hasSetResponse) {\n return this.response;\n }\n if (this.nextCalled === 1) {\n return this.god.response;\n }\n return null;\n }\n getStream(): Promise<ReadableStream | null> {\n if (this.isRoot) {\n this.god.hasRequestedStream = true;\n }\n if (!this.hasSetResponse) {\n const hint = this.god.response?.headers?.get('content-length');\n this.stream.promise.sizeHint = hint ? parseInt(hint, 10) : 0;\n }\n this.hasSubscribers = true;\n return this.stream.promise;\n }\n abort(reason: DOMException) {\n this.controller.abort(reason);\n }\n\n setStream(stream: ReadableStream | Promise<ReadableStream | null> | null) {\n if (!this.hasSetStream) {\n this.hasSetStream = true;\n\n if (!(stream instanceof Promise)) {\n this.god.stream = stream;\n }\n // @ts-expect-error\n this.stream.resolve(stream);\n }\n }\n\n resolveStream() {\n this.setStream(this.nextCalled === 1 ? this.god.stream : null);\n }\n\n setResponse(response: ResponseInfo | Response | null) {\n if (this.hasSetResponse) {\n if (DEBUG) {\n throw new Error(`Cannot setResponse when a response has already been set`);\n }\n return;\n }\n this.hasSetResponse = true;\n if (response instanceof Response) {\n // TODO potentially avoid cloning in prod\n let responseData = cloneResponseProperties(response);\n\n if (DEBUG) {\n responseData = deepFreeze(responseData);\n }\n this.response = responseData;\n this.god.response = responseData;\n const sizeHint = response.headers?.get('content-length');\n this.stream.promise.sizeHint = sizeHint ? parseInt(sizeHint, 10) : 0;\n } else {\n this.response = response;\n this.god.response = response;\n }\n }\n}\n\nexport class Context {\n #owner: ContextOwner;\n declare request: ImmutableRequestInfo;\n declare id: number;\n declare private _isCacheHandler: boolean;\n declare private _finalized: boolean;\n\n constructor(owner: ContextOwner, isCacheHandler: boolean) {\n this.id = owner.requestId;\n this.#owner = owner;\n this.request = owner.enhancedRequest;\n this._isCacheHandler = isCacheHandler;\n this._finalized = false;\n }\n setStream(stream: ReadableStream | Promise<ReadableStream | null>) {\n this.#owner.setStream(stream);\n }\n setResponse(response: ResponseInfo | Response | null) {\n this.#owner.setResponse(response);\n }\n\n setIdentifier(identifier: StableDocumentIdentifier) {\n assert(\n `setIdentifier may only be used synchronously from a CacheHandler`,\n identifier && this._isCacheHandler && !this._finalized\n );\n this.#owner.god.identifier = identifier;\n }\n\n get hasRequestedStream() {\n return this.#owner.hasRequestedStream;\n }\n\n _finalize() {\n this._finalized = true;\n }\n}\nexport type HandlerRequestContext = Context;\n","import { DEBUG } from '@warp-drive-mirror/build-config/env';\nimport { getOrSetGlobal } from '@warp-drive-mirror/core-types/-private';\nimport type { ImmutableHeaders, RequestInfo } from '@warp-drive-mirror/core-types/request';\n\nimport { Context, upgradeHeaders } from './context';\n\nconst BODY_TYPES = {\n type: 'string',\n klass: ['Blob', 'ArrayBuffer', 'TypedArray', 'DataView', 'FormData', 'URLSearchParams', 'ReadableStream'],\n};\nconst ValidKeys = new Map<string, string | string[] | typeof BODY_TYPES>([\n ['records', 'array'],\n ['data', 'json'],\n ['body', BODY_TYPES],\n ['disableTestWaiter', 'boolean'],\n ['options', 'object'],\n ['cacheOptions', 'object'],\n ['op', 'string'],\n ['store', 'object'],\n ['url', 'string'],\n ['cache', ['default', 'force-cache', 'no-cache', 'no-store', 'only-if-cached', 'reload']],\n ['credentials', ['include', 'omit', 'same-origin']],\n [\n 'destination',\n [\n '',\n 'object',\n 'audio',\n 'audioworklet',\n 'document',\n 'embed',\n 'font',\n 'frame',\n 'iframe',\n 'image',\n 'manifest',\n 'paintworklet',\n 'report',\n 'script',\n 'sharedworker',\n 'style',\n 'track',\n 'video',\n 'worker',\n 'xslt',\n ],\n ],\n ['headers', 'headers'],\n ['integrity', 'string'],\n ['keepalive', 'boolean'],\n ['method', ['QUERY', 'GET', 'PUT', 'PATCH', 'DELETE', 'POST', 'OPTIONS', 'HEAD', 'CONNECT', 'TRACE']],\n ['mode', ['same-origin', 'cors', 'navigate', 'no-cors']],\n ['redirect', ['error', 'follow', 'manual']],\n ['referrer', 'string'],\n ['signal', 'AbortSignal'],\n ['controller', 'AbortController'],\n [\n 'referrerPolicy',\n [\n '',\n 'same-origin',\n 'no-referrer',\n 'no-referrer-when-downgrade',\n 'origin',\n 'origin-when-cross-origin',\n 'strict-origin',\n 'strict-origin-when-cross-origin',\n 'unsafe-url',\n ],\n ],\n]);\n\nconst IS_FROZEN = getOrSetGlobal('IS_FROZEN', Symbol('FROZEN'));\nconst IS_COLLECTION = getOrSetGlobal('IS_COLLECTION', Symbol.for('Collection'));\n\nfunction freezeHeaders(headers: Headers | ImmutableHeaders): ImmutableHeaders {\n headers.delete =\n headers.set =\n headers.append =\n () => {\n throw new Error(`Cannot Mutate Immutatable Headers, use headers.clone to get a copy`);\n };\n upgradeHeaders(headers);\n return headers as ImmutableHeaders;\n}\n\nexport function deepFreeze<T = unknown>(value: T): T {\n if (value && (value as { [IS_FROZEN]?: true })[IS_FROZEN]) {\n return value;\n }\n const _type = typeof value;\n switch (_type) {\n case 'boolean':\n case 'string':\n case 'number':\n case 'symbol':\n case 'undefined':\n case 'bigint':\n return value;\n case 'function':\n throw new Error(`Cannot deep-freeze a function`);\n case 'object': {\n const _niceType = niceTypeOf(value);\n switch (_niceType) {\n case 'array': {\n if ((value as unknown[] & { [IS_COLLECTION]?: true })[IS_COLLECTION]) {\n return value;\n }\n const arr = (value as unknown[]).map(deepFreeze);\n arr[IS_FROZEN as unknown as number] = true;\n return Object.freeze(arr) as T;\n }\n case 'null':\n return value;\n case 'object':\n Object.keys(value as Record<string, unknown>).forEach((key) => {\n try {\n (value as Record<string, unknown>)[key] = deepFreeze((value as Record<string, unknown>)[key]) as object;\n } catch {\n // continue\n }\n });\n (value as Record<string | symbol, unknown>)[IS_FROZEN] = true;\n return Object.freeze(value);\n case 'headers':\n return freezeHeaders(value as Headers) as T;\n case 'Collection':\n case 'Store':\n case 'AbortSignal':\n return value;\n case 'date':\n case 'map':\n case 'set':\n case 'error':\n case 'stream':\n default:\n // console.log(`Cannot deep-freeze ${_niceType}`);\n return value;\n }\n }\n }\n}\n\nfunction isMaybeContext(request: unknown) {\n if (request && typeof request === 'object') {\n const keys = Object.keys(request);\n if (keys.length === 1 && keys[0] === 'request') {\n return true;\n }\n }\n return false;\n}\n\nfunction niceTypeOf(v: unknown) {\n if (v === null) {\n return 'null';\n }\n if (typeof v === 'string') {\n return v ? 'non-empty-string' : 'empty-string';\n }\n if (!v) {\n return typeof v;\n }\n if (Array.isArray(v)) {\n return 'array';\n }\n if (v instanceof Date) {\n return 'date';\n }\n if (v instanceof Map) {\n return 'map';\n }\n if (v instanceof Set) {\n return 'set';\n }\n if (v instanceof Error) {\n return 'error';\n }\n if (v instanceof ReadableStream || v instanceof WritableStream || v instanceof TransformStream) {\n return 'stream';\n }\n if (v instanceof Headers) {\n return 'headers';\n }\n if (typeof v === 'object' && v.constructor && v.constructor.name !== 'Object') {\n return v.constructor.name;\n }\n return typeof v;\n}\n\nfunction validateKey(key: string, value: unknown, errors: string[]) {\n const schema = ValidKeys.get(key);\n if (!schema && !IgnoredKeys.has(key)) {\n errors.push(`InvalidKey: '${key}'`);\n return;\n }\n if (schema) {\n if (schema === BODY_TYPES) {\n if (typeof value === 'string' || value instanceof ReadableStream) {\n return;\n }\n const type = niceTypeOf(value);\n if (schema.klass.includes(type)) {\n return;\n }\n errors.push(\n `InvalidValue: key 'body' should be a string or one of '${schema.klass.join(\"', '\")}', received ${\n '<a value of type ' + niceTypeOf(value) + '>'\n }`\n );\n return;\n }\n if (Array.isArray(schema)) {\n if (!schema.includes(value as string)) {\n errors.push(\n `InvalidValue: key ${key} should be one of '${schema.join(\"', '\")}', received ${\n typeof value === 'string' ? value : '<a value of type ' + niceTypeOf(value) + '>'\n }`\n );\n }\n return;\n } else if (schema === 'json') {\n try {\n JSON.stringify(value);\n } catch (e) {\n errors.push(\n `InvalidValue: key ${key} should be a JSON serializable value, but failed to serialize with Error - ${\n (e as Error).message\n }`\n );\n }\n return;\n } else if (schema === 'headers') {\n if (!(value instanceof Headers)) {\n errors.push(`InvalidValue: key ${key} should be an instance of Headers, received ${niceTypeOf(value)}`);\n }\n return;\n } else if (schema === 'record') {\n const _type = typeof value;\n // record must extend plain object or Object.create(null)\n if (!value || _type !== 'object' || (value.constructor && value.constructor !== Object)) {\n errors.push(\n `InvalidValue: key ${key} should be a dictionary of string keys to string values, received ${niceTypeOf(\n value\n )}`\n );\n return;\n }\n const keys = Object.keys(value);\n keys.forEach((k) => {\n const v: unknown = (value as Record<string, unknown>)[k];\n if (typeof k !== 'string') {\n errors.push(`\\tThe key ${String(k)} on ${key} should be a string key`);\n } else if (typeof v !== 'string') {\n errors.push(`\\tThe value of ${key}.${k} should be a string not ${niceTypeOf(v)}`);\n }\n });\n return;\n } else if (schema === 'string') {\n if (typeof value !== 'string' || value.length === 0) {\n errors.push(\n `InvalidValue: key ${key} should be a non-empty string, received ${\n typeof value === 'string' ? \"''\" : typeof value\n }`\n );\n }\n return;\n } else if (schema === 'object') {\n if (!value || Array.isArray(value) || typeof value !== 'object') {\n errors.push(`InvalidValue: key ${key} should be an object`);\n }\n return;\n } else if (schema === 'boolean') {\n if (typeof value !== 'boolean') {\n errors.push(`InvalidValue: key ${key} should be a boolean, received ${typeof value}`);\n }\n return;\n } else if (schema === 'array') {\n if (!Array.isArray(value)) {\n errors.push(`InvalidValue: key ${key} should be an array, received ${typeof value}`);\n }\n return;\n }\n }\n}\n\nconst IgnoredKeys = new Set<string>([]);\n\nexport function assertValidRequest(\n request: RequestInfo | Context,\n isTopLevel: boolean\n): asserts request is RequestInfo {\n if (DEBUG) {\n // handle basic shape\n if (!request) {\n throw new Error(\n `Expected ${\n isTopLevel ? 'RequestManager.request' : 'next'\n }(<request>) to be called with a request, but none was provided.`\n );\n }\n if (Array.isArray(request) || typeof request !== 'object') {\n throw new Error(\n `The \\`request\\` passed to \\`${\n isTopLevel ? 'RequestManager.request' : 'next'\n }(<request>)\\` should be an object, received \\`${niceTypeOf(request)}\\``\n );\n }\n if (Object.keys(request).length === 0) {\n throw new Error(\n `The \\`request\\` passed to \\`${\n isTopLevel ? 'RequestManager.request' : 'next'\n }(<request>)\\` was empty (\\`{}\\`). Requests need at least one valid key.`\n );\n }\n\n // handle accidentally passing context entirely\n if (request instanceof Context) {\n throw new Error(\n `Expected a request passed to \\`${\n isTopLevel ? 'RequestManager.request' : 'next'\n }(<request>)\\` but received the previous handler's context instead`\n );\n }\n // handle Object.assign({}, context);\n if (isMaybeContext(request)) {\n throw new Error(\n `Expected a request passed to \\`${\n isTopLevel ? 'RequestManager.request' : 'next'\n }(<request>)\\` but received an object with a request key instead.`\n );\n }\n\n // handle schema\n const keys = Object.keys(request) as Array<keyof RequestInfo>;\n const validationErrors: string[] = [];\n const isLegacyRequest = Boolean('op' in request && !request.url);\n keys.forEach((key) => {\n if (isLegacyRequest && key === 'data') {\n return;\n }\n validateKey(key, request[key], validationErrors);\n });\n if (validationErrors.length) {\n const error: Error & { errors: string[] } = new Error(\n `Invalid Request passed to \\`${\n isTopLevel ? 'RequestManager.request' : 'next'\n }(<request>)\\`.\\n\\nThe following issues were found:\\n\\n\\t${validationErrors.join('\\n\\t')}`\n ) as Error & { errors: string[] };\n error.errors = validationErrors;\n throw error;\n }\n }\n}\n"],"names":["PromiseCache","getOrSetUniversal","WeakMap","RequestMap","Map","setRequestResult","requestId","result","set","clearRequestResult","delete","getRequestResult","get","setPromiseResult","promise","getPromiseResult","IS_CACHE_HANDLER","getOrSetGlobal","Symbol","curryFuture","owner","inbound","outbound","setStream","getStream","then","doc","document","STRUCTURED","request","response","content","resolve","error","isDoc","god","stream","Error","e","Object","assign","message","getResponse","reject","ensureDoc","isError","enhanceReason","reason","DOMException","handleOutcome","controller","signal","aborted","isCacheHandler","handler","index","Boolean","executeNextHandler","wares","i","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","length","assertValidRequest","ContextOwner","next","r","nextCalled","_isCacheHandler","context","Context","outcome","_finalize","Promise","console","log","undefined","future","createFuture","isFuture","maybe","IS_FUTURE","createDeferred","res","rej","upgradePromise","abort","onFinalize","id","lid","deferred","cbs","finally","resolveStream","forEach","cb","fn","push","identifier","upgradeHeaders","headers","clone","Headers","toJSON","Array","from","cloneResponseProperties","ok","redirected","status","statusText","type","url","hasSetStream","hasSetResponse","hasSubscribers","constructor","isRoot","sizeHint","addEventListener","enhancedRequest","cacheOptions","SkipCache","deepFreeze","hasRequestedStream","hint","parseInt","setResponse","Response","responseData","_finalized","setIdentifier","test","BODY_TYPES","klass","ValidKeys","IS_FROZEN","IS_COLLECTION","for","freezeHeaders","append","value","_type","_niceType","niceTypeOf","arr","map","freeze","keys","key","isMaybeContext","v","isArray","Date","Set","ReadableStream","WritableStream","TransformStream","name","validateKey","errors","schema","IgnoredKeys","has","includes","join","JSON","stringify","k","String","isTopLevel","validationErrors","isLegacyRequest"],"mappings":";;;;AAUO,MAAMA,YAAY,GAAGC,iBAAiB,CAAC,cAAc,EAAE,IAAIC,OAAO,EAA0B,CAAC;AAC7F,MAAMC,UAAU,GAAGF,iBAAiB,CAAC,YAAY,EAAE,IAAIG,GAAG,EAAuB,CAAC;AAElF,SAASC,gBAAgBA,CAACC,SAAiB,EAAEC,MAAmB,EAAE;AACvEJ,EAAAA,UAAU,CAACK,GAAG,CAACF,SAAS,EAAEC,MAAM,CAAC;AACnC;AACO,SAASE,kBAAkBA,CAACH,SAAiB,EAAE;AACpDH,EAAAA,UAAU,CAACO,MAAM,CAACJ,SAAS,CAAC;AAC9B;AACO,SAASK,gBAAgBA,CAACL,SAAiB,EAA2B;AAC3E,EAAA,OAAOH,UAAU,CAACS,GAAG,CAACN,SAAS,CAAC;AAClC;AAEO,SAASO,gBAAgBA,CAACC,OAAqC,EAAEP,MAAmB,EAAE;AAC3FP,EAAAA,YAAY,CAACQ,GAAG,CAACM,OAAO,EAAEP,MAAM,CAAC;AACnC;AAEO,SAASQ,gBAAgBA,CAAOD,OAAqC,EAAiC;AAC3G,EAAA,OAAOd,YAAY,CAACY,GAAG,CAACE,OAAO,CAAC;AAClC;;ACbO,MAAME,gBAAgB,GAAGC,cAAc,CAAC,kBAAkB,EAAEC,MAAM,CAAC,kBAAkB,CAAC;AACtF,SAASC,WAAWA,CAAIC,KAAmB,EAAEC,OAAkB,EAAEC,QAA2B,EAAa;EAC9GF,KAAK,CAACG,SAAS,CAACF,OAAO,CAACG,SAAS,EAAE,CAAC;AAEpCH,EAAAA,OAAO,CAACI,IAAI,CACTC,GAA8B,IAAK;AAClC,IAAA,MAAMC,QAAQ,GAAG;MACf,CAACC,UAAU,GA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H,OAAO,CAAC,IAAI,IAAI3B,OAAO,IAAI,CAACA,OAAO,CAACsF,GAAG,CAAC;AAChEoC,IAAAA,IAAI,CAACtD,OAAO,CAAEuD,GAAG,IAAK;AACpB,MAAA,IAAIuB,eAAe,IAAIvB,GAAG,KAAK,MAAM,EAAE;AACrC,QAAA;AACF;MACAU,WAAW,CAACV,GAAG,EAAE3H,OAAO,CAAC2H,GAAG,CAAC,EAAEsB,gBAAgB,CAAC;AAClD,KAAC,CAAC;IACF,IAAIA,gBAAgB,CAAC7G,MAAM,EAAE;AAC3B,MAAA,MAAMhC,KAAmC,GAAG,IAAII,KAAK,CACnD,CAAA,4BAAA,EACEwI,UAAU,GAAG,wBAAwB,GAAG,MAAM,CAAA,wDAAA,EACWC,gBAAgB,CAACN,IAAI,CAAC,MAAM,CAAC,EAC1F,CAAiC;MACjCvI,KAAK,CAACkI,MAAM,GAAGW,gBAAgB;AAC/B,MAAA,MAAM7I,KAAK;AACb;AACF;AACF;;;;"}
package/dist/fetch.js CHANGED
@@ -1,4 +1,4 @@
1
- import { f as cloneResponseProperties } from "./debug-D0st-bv4.js";
1
+ import { f as cloneResponseProperties } from "./debug-nHWzWIMX.js";
2
2
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
3
3
 
4
4
  /**
package/dist/fetch.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sources":["../src/fetch.ts"],"sourcesContent":["/**\n * A basic Fetch Handler which converts a request into a\n * `fetch` call presuming the response to be `json`.\n *\n * ```ts\n * import Fetch from '@ember-data-mirror/request/fetch';\n *\n * manager.use([Fetch]);\n * ```\n *\n * @module @ember-data-mirror/request/fetch\n * @main @ember-data-mirror/request/fetch\n */\n\nimport { DEBUG } from '@warp-drive-mirror/build-config/env';\n\nimport { cloneResponseProperties, type Context } from './-private/context';\nimport type { HttpErrorProps } from './-private/utils';\n\n// Lazily close over fetch to avoid breaking Mirage\nconst _fetch: typeof fetch =\n typeof fetch !== 'undefined'\n ? (...args) => fetch(...args)\n : typeof FastBoot !== 'undefined'\n ? (...args) => (FastBoot.require('node-fetch') as typeof fetch)(...args)\n : ((() => {\n throw new Error('No Fetch Implementation Found');\n }) as typeof fetch);\n\n// clones a response in a way that should still\n// allow it to stream\nfunction cloneResponse(response: Response, overrides: Partial<Response>) {\n const props = cloneResponseProperties(response);\n return new Response(response.body, Object.assign(props, overrides));\n}\n\nlet IS_MAYBE_MIRAGE = () => false;\nif (DEBUG) {\n IS_MAYBE_MIRAGE = () =>\n Boolean(\n typeof window !== 'undefined' &&\n ((window as { server?: { pretender: unknown } }).server?.pretender ||\n window.fetch.toString().replace(/\\s+/g, '') !== 'function fetch() { [native code] }'.replace(/\\s+/g, ''))\n );\n}\n\nconst MUTATION_OPS = new Set(['updateRecord', 'createRecord', 'deleteRecord']);\nconst ERROR_STATUS_CODE_FOR = new Map([\n [400, 'Bad Request'],\n [401, 'Unauthorized'],\n [402, 'Payment Required'],\n [403, 'Forbidden'],\n [404, 'Not Found'],\n [405, 'Method Not Allowed'],\n [406, 'Not Acceptable'],\n [407, 'Proxy Authentication Required'],\n [408, 'Request Timeout'],\n [409, 'Conflict'],\n [410, 'Gone'],\n [411, 'Length Required'],\n [412, 'Precondition Failed'],\n [413, 'Payload Too Large'],\n [414, 'URI Too Long'],\n [415, 'Unsupported Media Type'],\n [416, 'Range Not Satisfiable'],\n [417, 'Expectation Failed'],\n [419, 'Page Expired'],\n [420, 'Enhance Your Calm'],\n [421, 'Misdirected Request'],\n [422, 'Unprocessable Entity'],\n [423, 'Locked'],\n [424, 'Failed Dependency'],\n [425, 'Too Early'],\n [426, 'Upgrade Required'],\n [428, 'Precondition Required'],\n [429, 'Too Many Requests'],\n [430, 'Request Header Fields Too Large'],\n [431, 'Request Header Fields Too Large'],\n [450, 'Blocked By Windows Parental Controls'],\n [451, 'Unavailable For Legal Reasons'],\n [500, 'Internal Server Error'],\n [501, 'Not Implemented'],\n [502, 'Bad Gateway'],\n [503, 'Service Unavailable'],\n [504, 'Gateway Timeout'],\n [505, 'HTTP Version Not Supported'],\n [506, 'Variant Also Negotiates'],\n [507, 'Insufficient Storage'],\n [508, 'Loop Detected'],\n [509, 'Bandwidth Limit Exceeded'],\n [510, 'Not Extended'],\n [511, 'Network Authentication Required'],\n]);\n\n/**\n * A basic handler which converts a request into a\n * `fetch` call presuming the response to be `json`.\n *\n * ```ts\n * import Fetch from '@ember-data-mirror/request/fetch';\n *\n * manager.use([Fetch]);\n * ```\n *\n * @class Fetch\n * @public\n */\nconst Fetch = {\n async request<T>(context: Context): Promise<T> {\n let response: Response;\n\n try {\n response = await _fetch(context.request.url!, context.request);\n } catch (e) {\n if (e instanceof DOMException && e.name === 'AbortError') {\n (e as unknown as HttpErrorProps).statusText = 'Aborted';\n (e as unknown as HttpErrorProps).status = 20;\n (e as unknown as HttpErrorProps).isRequestError = true;\n } else {\n (e as HttpErrorProps).statusText = 'Unknown Network Error';\n (e as HttpErrorProps).status = 0;\n (e as HttpErrorProps).isRequestError = true;\n }\n throw e;\n }\n\n const isError = !response.ok || response.status >= 400;\n const op = context.request.op;\n const isMutationOp = Boolean(op && MUTATION_OPS.has(op));\n\n if (!isError && !isMutationOp && response.status !== 204 && !response.headers.has('date')) {\n if (IS_MAYBE_MIRAGE()) {\n response.headers.set('date', new Date().toUTCString());\n } else {\n const headers = new Headers(response.headers);\n headers.set('date', new Date().toUTCString());\n response = cloneResponse(response, {\n headers,\n });\n }\n }\n\n context.setResponse(response);\n\n if (response.status === 204) {\n return null as T;\n }\n\n let text = '';\n // if we are in a mirage context, we cannot support streaming\n if (IS_MAYBE_MIRAGE()) {\n text = await response.text();\n } else {\n const reader = response.body!.getReader();\n const decoder = new TextDecoder();\n let isStreaming = context.hasRequestedStream;\n let stream: TransformStream | null = isStreaming ? new TransformStream() : null;\n let writer = stream?.writable.getWriter();\n\n if (isStreaming) {\n // Listen for the abort event on the AbortSignal\n context.request.signal?.addEventListener('abort', () => {\n if (!isStreaming) {\n return;\n }\n void stream!.writable.abort('Request Aborted');\n void stream!.readable.cancel('Request Aborted');\n });\n context.setStream(stream!.readable);\n }\n\n while (true) {\n // we manually read the stream instead of using `response.json()`\n // or `response.text()` because if we need to stream the body\n // we need to be able to pass the stream along efficiently.\n const { done, value } = await reader.read();\n if (done) {\n if (isStreaming) {\n isStreaming = false;\n await writer!.ready;\n await writer!.close();\n }\n break;\n }\n text += decoder.decode(value, { stream: true });\n\n // if we are streaming, we want to pass the stream along\n if (isStreaming) {\n await writer!.ready;\n await writer!.write(value);\n } else if (context.hasRequestedStream) {\n const encode = new TextEncoder();\n isStreaming = true;\n stream = new TransformStream();\n // Listen for the abort event on the AbortSignal\n // eslint-disable-next-line @typescript-eslint/no-loop-func\n context.request.signal?.addEventListener('abort', () => {\n if (!isStreaming) {\n return;\n }\n void stream!.writable.abort('Request Aborted');\n void stream!.readable.cancel('Request Aborted');\n });\n context.setStream(stream.readable);\n writer = stream.writable.getWriter();\n await writer.ready;\n await writer.write(encode.encode(text));\n await writer.ready;\n await writer.write(value);\n }\n }\n\n if (isStreaming) {\n isStreaming = false;\n await writer!.ready;\n await writer!.close();\n }\n }\n // if we are an error, we will want to throw\n if (isError) {\n let errorPayload: object | undefined;\n try {\n errorPayload = JSON.parse(text) as object;\n } catch {\n // void;\n }\n // attempt errors discovery\n const errors = Array.isArray(errorPayload)\n ? errorPayload\n : isDict(errorPayload) && Array.isArray(errorPayload.errors)\n ? errorPayload.errors\n : null;\n\n const statusText = response.statusText || ERROR_STATUS_CODE_FOR.get(response.status) || 'Unknown Request Error';\n const msg = `[${response.status} ${statusText}] ${context.request.method ?? 'GET'} (${response.type}) - ${\n response.url\n }`;\n\n const error = (errors ? new AggregateError(errors, msg) : new Error(msg)) as Error & {\n content: object | undefined;\n } & HttpErrorProps;\n error.status = response.status;\n error.statusText = statusText;\n error.isRequestError = true;\n error.code = error.status;\n error.name = error.statusText.replaceAll(' ', '') + 'Error';\n error.content = errorPayload;\n throw error;\n } else {\n return JSON.parse(text) as T;\n }\n },\n};\n\nfunction isDict(v: unknown): v is Record<string, unknown> {\n return v !== null && typeof v === 'object';\n}\n\nexport default Fetch;\n"],"names":["_fetch","fetch","args","FastBoot","require","Error","cloneResponse","response","overrides","props","cloneResponseProperties","Response","body","Object","assign","IS_MAYBE_MIRAGE","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","Boolean","window","server","pretender","toString","replace","MUTATION_OPS","Set","ERROR_STATUS_CODE_FOR","Map","Fetch","request","context","url","e","DOMException","name","statusText","status","isRequestError","isError","ok","op","isMutationOp","has","headers","set","Date","toUTCString","Headers","setResponse","text","reader","getReader","decoder","TextDecoder","isStreaming","hasRequestedStream","stream","TransformStream","writer","writable","getWriter","signal","addEventListener","abort","readable","cancel","setStream","done","value","read","ready","close","decode","write","encode","TextEncoder","errorPayload","JSON","parse","errors","Array","isArray","isDict","get","msg","method","type","error","AggregateError","code","replaceAll","content","v"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA,MAAMA,MAAoB,GACxB,OAAOC,KAAK,KAAK,WAAW,GACxB,CAAC,GAAGC,IAAI,KAAKD,KAAK,CAAC,GAAGC,IAAI,CAAC,GAC3B,OAAOC,QAAQ,KAAK,WAAW,GAC7B,CAAC,GAAGD,IAAI,KAAMC,QAAQ,CAACC,OAAO,CAAC,YAAY,CAAC,CAAkB,GAAGF,IAAI,CAAC,GACpE,MAAM;AACN,EAAA,MAAM,IAAIG,KAAK,CAAC,+BAA+B,CAAC,CAAA;AAClD,CAAmB,CAAA;;AAE3B;AACA;AACA,SAASC,aAAaA,CAACC,QAAkB,EAAEC,SAA4B,EAAE;AACvE,EAAA,MAAMC,KAAK,GAAGC,uBAAuB,CAACH,QAAQ,CAAC,CAAA;AAC/C,EAAA,OAAO,IAAII,QAAQ,CAACJ,QAAQ,CAACK,IAAI,EAAEC,MAAM,CAACC,MAAM,CAACL,KAAK,EAAED,SAAS,CAAC,CAAC,CAAA;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gC,MAAM,CAAID,CAAAA,EAAAA,UAAU,CAAKL,EAAAA,EAAAA,OAAO,CAACD,OAAO,CAACwD,MAAM,IAAI,KAAK,CAAA,EAAA,EAAKjF,QAAQ,CAACkF,IAAI,CACjGlF,IAAAA,EAAAA,QAAQ,CAAC2B,GAAG,CACZ,CAAA,CAAA;AAEF,MAAA,MAAMwD,KAAK,GAAIR,MAAM,GAAG,IAAIS,cAAc,CAACT,MAAM,EAAEK,GAAG,CAAC,GAAG,IAAIlF,KAAK,CAACkF,GAAG,CAErD,CAAA;AAClBG,MAAAA,KAAK,CAACnD,MAAM,GAAGhC,QAAQ,CAACgC,MAAM,CAAA;MAC9BmD,KAAK,CAACpD,UAAU,GAAGA,UAAU,CAAA;MAC7BoD,KAAK,CAAClD,cAAc,GAAG,IAAI,CAAA;AAC3BkD,MAAAA,KAAK,CAACE,IAAI,GAAGF,KAAK,CAACnD,MAAM,CAAA;AACzBmD,MAAAA,KAAK,CAACrD,IAAI,GAAGqD,KAAK,CAACpD,UAAU,CAACuD,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,OAAO,CAAA;MAC3DH,KAAK,CAACI,OAAO,GAAGf,YAAY,CAAA;AAC5B,MAAA,MAAMW,KAAK,CAAA;AACb,KAAC,MAAM;AACL,MAAA,OAAOV,IAAI,CAACC,KAAK,CAAC7B,IAAI,CAAC,CAAA;AACzB,KAAA;AACF,GAAA;AACF,EAAC;AAED,SAASiC,MAAMA,CAACU,CAAU,EAAgC;AACxD,EAAA,OAAOA,CAAC,KAAK,IAAI,IAAI,OAAOA,CAAC,KAAK,QAAQ,CAAA;AAC5C;;;;"}
1
+ {"version":3,"file":"fetch.js","sources":["../src/fetch.ts"],"sourcesContent":["/**\n * A basic Fetch Handler which converts a request into a\n * `fetch` call presuming the response to be `json`.\n *\n * ```ts\n * import Fetch from '@ember-data-mirror/request/fetch';\n *\n * manager.use([Fetch]);\n * ```\n *\n * @module @ember-data-mirror/request/fetch\n * @main @ember-data-mirror/request/fetch\n */\n\nimport { DEBUG } from '@warp-drive-mirror/build-config/env';\n\nimport { cloneResponseProperties, type Context } from './-private/context';\nimport type { HttpErrorProps } from './-private/utils';\n\ninterface FastbootRequest {\n protocol: string;\n host: string;\n}\ninterface FastBoot {\n require(moduleName: string): unknown;\n isFastBoot: boolean;\n request: FastbootRequest;\n}\ndeclare global {\n const FastBoot: undefined | FastBoot;\n}\n\n// Lazily close over fetch to avoid breaking Mirage\nconst _fetch: typeof fetch =\n typeof fetch !== 'undefined'\n ? (...args) => fetch(...args)\n : typeof FastBoot !== 'undefined'\n ? (...args) => (FastBoot.require('node-fetch') as typeof fetch)(...args)\n : ((() => {\n throw new Error('No Fetch Implementation Found');\n }) as typeof fetch);\n\n// clones a response in a way that should still\n// allow it to stream\nfunction cloneResponse(response: Response, overrides: Partial<Response>) {\n const props = cloneResponseProperties(response);\n return new Response(response.body, Object.assign(props, overrides));\n}\n\nlet IS_MAYBE_MIRAGE = () => false;\nif (DEBUG) {\n IS_MAYBE_MIRAGE = () =>\n Boolean(\n typeof window !== 'undefined' &&\n ((window as { server?: { pretender: unknown } }).server?.pretender ||\n window.fetch.toString().replace(/\\s+/g, '') !== 'function fetch() { [native code] }'.replace(/\\s+/g, ''))\n );\n}\n\nconst MUTATION_OPS = new Set(['updateRecord', 'createRecord', 'deleteRecord']);\nconst ERROR_STATUS_CODE_FOR = new Map([\n [400, 'Bad Request'],\n [401, 'Unauthorized'],\n [402, 'Payment Required'],\n [403, 'Forbidden'],\n [404, 'Not Found'],\n [405, 'Method Not Allowed'],\n [406, 'Not Acceptable'],\n [407, 'Proxy Authentication Required'],\n [408, 'Request Timeout'],\n [409, 'Conflict'],\n [410, 'Gone'],\n [411, 'Length Required'],\n [412, 'Precondition Failed'],\n [413, 'Payload Too Large'],\n [414, 'URI Too Long'],\n [415, 'Unsupported Media Type'],\n [416, 'Range Not Satisfiable'],\n [417, 'Expectation Failed'],\n [419, 'Page Expired'],\n [420, 'Enhance Your Calm'],\n [421, 'Misdirected Request'],\n [422, 'Unprocessable Entity'],\n [423, 'Locked'],\n [424, 'Failed Dependency'],\n [425, 'Too Early'],\n [426, 'Upgrade Required'],\n [428, 'Precondition Required'],\n [429, 'Too Many Requests'],\n [430, 'Request Header Fields Too Large'],\n [431, 'Request Header Fields Too Large'],\n [450, 'Blocked By Windows Parental Controls'],\n [451, 'Unavailable For Legal Reasons'],\n [500, 'Internal Server Error'],\n [501, 'Not Implemented'],\n [502, 'Bad Gateway'],\n [503, 'Service Unavailable'],\n [504, 'Gateway Timeout'],\n [505, 'HTTP Version Not Supported'],\n [506, 'Variant Also Negotiates'],\n [507, 'Insufficient Storage'],\n [508, 'Loop Detected'],\n [509, 'Bandwidth Limit Exceeded'],\n [510, 'Not Extended'],\n [511, 'Network Authentication Required'],\n]);\n\n/**\n * A basic handler which converts a request into a\n * `fetch` call presuming the response to be `json`.\n *\n * ```ts\n * import Fetch from '@ember-data-mirror/request/fetch';\n *\n * manager.use([Fetch]);\n * ```\n *\n * @class Fetch\n * @public\n */\nconst Fetch = {\n async request<T>(context: Context): Promise<T> {\n let response: Response;\n\n try {\n response = await _fetch(context.request.url!, context.request);\n } catch (e) {\n if (e instanceof DOMException && e.name === 'AbortError') {\n (e as HttpErrorProps).statusText = 'Aborted';\n (e as HttpErrorProps).status = 20;\n (e as HttpErrorProps).isRequestError = true;\n } else {\n (e as HttpErrorProps).statusText = 'Unknown Network Error';\n (e as HttpErrorProps).status = 0;\n (e as HttpErrorProps).isRequestError = true;\n }\n throw e;\n }\n\n const isError = !response.ok || response.status >= 400;\n const op = context.request.op;\n const isMutationOp = Boolean(op && MUTATION_OPS.has(op));\n\n if (!isError && !isMutationOp && response.status !== 204 && !response.headers.has('date')) {\n if (IS_MAYBE_MIRAGE()) {\n response.headers.set('date', new Date().toUTCString());\n } else {\n const headers = new Headers(response.headers);\n headers.set('date', new Date().toUTCString());\n response = cloneResponse(response, {\n headers,\n });\n }\n }\n\n context.setResponse(response);\n\n if (response.status === 204) {\n return null as T;\n }\n\n let text = '';\n // if we are in a mirage context, we cannot support streaming\n if (IS_MAYBE_MIRAGE()) {\n text = await response.text();\n } else {\n const reader = response.body!.getReader();\n const decoder = new TextDecoder();\n let isStreaming = context.hasRequestedStream;\n let stream: TransformStream | null = isStreaming ? new TransformStream() : null;\n let writer = stream?.writable.getWriter();\n\n if (isStreaming) {\n // Listen for the abort event on the AbortSignal\n context.request.signal?.addEventListener('abort', () => {\n if (!isStreaming) {\n return;\n }\n void stream!.writable.abort('Request Aborted');\n void stream!.readable.cancel('Request Aborted');\n });\n context.setStream(stream!.readable);\n }\n\n while (true) {\n // we manually read the stream instead of using `response.json()`\n // or `response.text()` because if we need to stream the body\n // we need to be able to pass the stream along efficiently.\n const { done, value } = await reader.read();\n if (done) {\n if (isStreaming) {\n isStreaming = false;\n await writer!.ready;\n await writer!.close();\n }\n break;\n }\n text += decoder.decode(value, { stream: true });\n\n // if we are streaming, we want to pass the stream along\n if (isStreaming) {\n await writer!.ready;\n await writer!.write(value);\n } else if (context.hasRequestedStream) {\n const encode = new TextEncoder();\n isStreaming = true;\n stream = new TransformStream();\n // Listen for the abort event on the AbortSignal\n // eslint-disable-next-line @typescript-eslint/no-loop-func\n context.request.signal?.addEventListener('abort', () => {\n if (!isStreaming) {\n return;\n }\n void stream!.writable.abort('Request Aborted');\n void stream!.readable.cancel('Request Aborted');\n });\n context.setStream(stream.readable);\n writer = stream.writable.getWriter();\n await writer.ready;\n await writer.write(encode.encode(text));\n await writer.ready;\n await writer.write(value);\n }\n }\n\n if (isStreaming) {\n isStreaming = false;\n await writer!.ready;\n await writer!.close();\n }\n }\n // if we are an error, we will want to throw\n if (isError) {\n let errorPayload: object | undefined;\n try {\n errorPayload = JSON.parse(text) as object;\n } catch {\n // void;\n }\n // attempt errors discovery\n const errors = Array.isArray(errorPayload)\n ? errorPayload\n : isDict(errorPayload) && Array.isArray(errorPayload.errors)\n ? errorPayload.errors\n : null;\n\n const statusText = response.statusText || ERROR_STATUS_CODE_FOR.get(response.status) || 'Unknown Request Error';\n const msg = `[${response.status} ${statusText}] ${context.request.method ?? 'GET'} (${response.type}) - ${\n response.url\n }`;\n\n const error = (errors ? new AggregateError(errors, msg) : new Error(msg)) as Error & {\n content: object | undefined;\n } & HttpErrorProps;\n error.status = response.status;\n error.statusText = statusText;\n error.isRequestError = true;\n error.code = error.status;\n error.name = error.statusText.replaceAll(' ', '') + 'Error';\n error.content = errorPayload;\n throw error;\n } else {\n return JSON.parse(text) as T;\n }\n },\n};\n\nfunction isDict(v: unknown): v is Record<string, unknown> {\n return v !== null && typeof v === 'object';\n}\n\nexport default Fetch;\n"],"names":["_fetch","fetch","args","FastBoot","require","Error","cloneResponse","response","overrides","props","cloneResponseProperties","Response","body","Object","assign","IS_MAYBE_MIRAGE","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","Boolean","window","server","pretender","toString","replace","MUTATION_OPS","Set","ERROR_STATUS_CODE_FOR","Map","Fetch","request","context","url","e","DOMException","name","statusText","status","isRequestError","isError","ok","op","isMutationOp","has","headers","set","Date","toUTCString","Headers","setResponse","text","reader","getReader","decoder","TextDecoder","isStreaming","hasRequestedStream","stream","TransformStream","writer","writable","getWriter","signal","addEventListener","abort","readable","cancel","setStream","done","value","read","ready","close","decode","write","encode","TextEncoder","errorPayload","JSON","parse","errors","Array","isArray","isDict","get","msg","method","type","error","AggregateError","code","replaceAll","content","v"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA,MAAMA,MAAoB,GACxB,OAAOC,KAAK,KAAK,WAAW,GACxB,CAAC,GAAGC,IAAI,KAAKD,KAAK,CAAC,GAAGC,IAAI,CAAC,GAC3B,OAAOC,QAAQ,KAAK,WAAW,GAC7B,CAAC,GAAGD,IAAI,KAAMC,QAAQ,CAACC,OAAO,CAAC,YAAY,CAAC,CAAkB,GAAGF,IAAI,CAAC,GACpE,MAAM;AACN,EAAA,MAAM,IAA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AAA,MAAMwD,KAAK,GAAIR,MAAM,GAAG,IAAIS,cAAc,CAACT,MAAM,EAAEK,GAAG,CAAC,GAAG,IAAIlF,KAAK,CAACkF,GAAG,CAErD;AAClBG,MAAAA,KAAK,CAACnD,MAAM,GAAGhC,QAAQ,CAACgC,MAAM;MAC9BmD,KAAK,CAACpD,UAAU,GAAGA,UAAU;MAC7BoD,KAAK,CAAClD,cAAc,GAAG,IAAI;AAC3BkD,MAAAA,KAAK,CAACE,IAAI,GAAGF,KAAK,CAACnD,MAAM;AACzBmD,MAAAA,KAAK,CAACrD,IAAI,GAAGqD,KAAK,CAACpD,UAAU,CAACuD,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,OAAO;MAC3DH,KAAK,CAACI,OAAO,GAAGf,YAAY;AAC5B,MAAA,MAAMW,KAAK;AACb,KAAC,MAAM;AACL,MAAA,OAAOV,IAAI,CAACC,KAAK,CAAC7B,IAAI,CAAC;AACzB;AACF;AACF;AAEA,SAASiC,MAAMA,CAACU,CAAU,EAAgC;AACxD,EAAA,OAAOA,CAAC,KAAK,IAAI,IAAI,OAAOA,CAAC,KAAK,QAAQ;AAC5C;;;;"}
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
+ import { setLogging, getRuntimeConfig } from '@warp-drive-mirror/build-config/runtime';
1
2
  import { macroCondition, getGlobalConfig, importSync } from '@embroider/macros';
2
3
  import { peekUniversalTransient, setUniversalTransient } from '@warp-drive-mirror/core-types/-private';
3
- import { I as IS_CACHE_HANDLER, a as assertValidRequest, e as executeNextHandler, g as getRequestResult, u as upgradePromise, s as setPromiseResult, c as clearRequestResult } from "./debug-D0st-bv4.js";
4
- export { b as createDeferred, d as getPromiseResult } from "./debug-D0st-bv4.js";
4
+ import { I as IS_CACHE_HANDLER, a as assertValidRequest, e as executeNextHandler, g as getRequestResult, u as upgradePromise, s as setPromiseResult, c as clearRequestResult } from "./debug-nHWzWIMX.js";
5
+ export { b as createDeferred, d as getPromiseResult } from "./debug-nHWzWIMX.js";
5
6
 
6
7
  /* eslint-disable no-irregular-whitespace */
7
8
  /**
@@ -677,4 +678,10 @@ class RequestManager {
677
678
  return new this(options);
678
679
  }
679
680
  }
681
+
682
+ // @ts-expect-error adding to globalThis
683
+ globalThis.setWarpDriveLogging = setLogging;
684
+
685
+ // @ts-expect-error adding to globalThis
686
+ globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
680
687
  export { RequestManager as default, setPromiseResult };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/-private/manager.ts"],"sourcesContent":["/* eslint-disable no-irregular-whitespace */\n/**\n *\n <p align=\"center\">\n <img\n class=\"project-logo\"\n src=\"https://raw.githubusercontent.com/emberjs/data/4612c9354e4c54d53327ec2cf21955075ce21294/ember-data-logo-light.svg#gh-light-mode-only\"\n alt=\"EmberData RequestManager\"\n width=\"240px\"\n title=\"EmberData RequestManager\"\n />\n</p>\n\n<p align=\"center\">⚡️ a simple abstraction over fetch to enable easy management of request/response flows</p>\n\nThis package provides [*Ember*‍**Data**](https://github.com/emberjs/data/)'s `RequestManager`, a framework agnostic library that can be integrated with any Javascript application to make [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) happen.\n\n- [Installation](#installation)\n- [Basic Usage](#🚀-basic-usage)\n- [Architecture](#🪜-architecture)\n- [Usage](#usage)\n - [Making Requests](#making-requests)\n - [Using The Response](#using-the-response)\n - [Request Handlers](#handling-requests)\n - [Handling Errors](#handling-errors)\n - [Handling Abort](#handling-abort)\n - [Stream Currying](#stream-currying)\n - [Automatic Currying](#automatic-currying-of-stream-and-response)\n - [Using as a Service](#using-as-a-service)\n - [Using with `@ember-data-mirror/store`](#using-with-ember-datastore)\n - [Using with `ember-data`](#using-with-ember-data)\n\n---\n\n## Installation\n\nInstall using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)\n\n```no-highlight\npnpm add @ember-data-mirror/request\n```\n\n---\n\n## 🚀 Basic Usage\n\nA `RequestManager` provides a request/response flow in which configured handlers are successively given the opportunity to handle, modify, or pass-along a request.\n\nThe RequestManager on its own does not know how to fulfill requests. For this we must register at least one handler. A basic `Fetch` handler is provided that will take the request options provided and execute `fetch`.\n\n```ts\nimport RequestManager from '@ember-data-mirror/request';\nimport Fetch from '@ember-data-mirror/request/fetch';\nimport { apiUrl } from './config';\n\n// ... create manager and add our Fetch handler\nconst manager = new RequestManager()\n .use([Fetch]);\n\n// ... execute a request\nconst response = await manager.request({\n url: `${apiUrl}/users`\n});\n```\n\n---\n\n## 🪜 Architecture\n\nA `RequestManager` receives a request and manages fulfillment via configured handlers. It may be used standalone from the rest of *Ember*‍**Data** and is not specific to any library or framework.\n\nEach handler may choose to fulfill the request using some source of data or to pass the request along to other handlers.\n\nThe same or a separate instance of a `RequestManager` may also be used to fulfill requests issued by [*Ember*‍**Data**{Store}](https://github.com/emberjs/data/tree/main/packages/store)\n\nWhen the same instance is used by both this allows for simple coordination throughout the application. Requests issued by the Store will use the in-memory cache\nand return hydrated responses, requests issued directly to the RequestManager\nwill skip the in-memory cache and return raw responses.\n\n---\n\n## Usage\n\n```ts\nconst userList = await manager.request({\n url: `/api/v1/users.list`\n});\n\nconst users = userList.content;\n```\n\n---\n\n### Making Requests\n\n`RequestManager` has a single asyncronous method as it's API: `request`\n\n```ts\nclass RequestManager {\n request<T>(req: RequestInfo): Future<T>;\n}\n```\n\n`manager.request(<RequestInfo>)` accepts an object containing the information\nnecessary for the request to be handled successfully.\n\nThese options extend the [options](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters) provided to `fetch`, and can accept a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). All properties accepted by Request options and fetch options are valid.\n\n```ts\ninterface RequestInfo extends FetchOptions {\n op?: string;\n store?: Store;\n\n url: string;\n // data that a handler should convert into\n // the query (GET) or body (POST)\n data?: Record<string, unknown>;\n\n // options specifically intended for handlers\n // to utilize to process the request\n options?: Record<string, unknown>;\n}\n```\n\n> **note**\n> providing a `signal` is unnecessary as an `AbortController` is automatically provided if none is present.\n\n---\n\n#### Using the Response\n\n`manager.request` returns a `Future`, which allows access to limited information about the request while it is still pending and fulfills with the final state when the request completes and the response has been read.\n\n```ts\nconst usersFuture = manager.request({\n url: `/api/v1/users.list`\n});\n```\n\nA `Future` is cancellable via `abort`.\n\n```ts\nusersFuture.abort();\n```\n\nHandlers may *optionally* expose a ReadableStream to the `Future` for streaming data; however, when doing so the handler should not resolve until it has fully read the response stream itself.\n\n```ts\ninterface Future<T> extends Promise<StructuredDocument<T>> {\n abort(): void;\n\n async getStream(): ReadableStream | null;\n}\n```\n\nA Future resolves or rejects with a `StructuredDocument`.\n\n```ts\ninterface StructuredDocument<T> {\n request: RequestInfo;\n response: ResponseInfo | null;\n content?: T;\n error?: Error;\n}\n```\n\nThe `RequestInfo` specified by `document.request` is the same as originally provided to `manager.request`. If any handler fulfilled this request using different request info it is not represented here. This contract helps to ensure that `retry` and `caching` are possible since the original arguments are correctly preserved. This also allows handlers to \"fork\" the request or fulfill from multiple sources without the details of fulfillment muddying the original request.\n\nThe `ResponseInfo` is a serializable fulfilled subset of a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) if set via `setResponse`. If no response was ever set this will be `null`.\n\n```ts\ninterface ResponseInfo {\n headers?: Record<string, string>;\n ok?: boolean;\n redirected?: boolean;\n status?: HTTPStatusCode;\n statusText?: string;\n type?: 'basic' | 'cors';\n url?: string;\n}\n```\n\n---\n\n### Request Handlers\n\nRequests are fulfilled by handlers. A handler receives the request context\nas well as a `next` function with which to pass along a request to the next\nhandler if it so chooses.\n\nA handler may be any object with a `request` method. This allows both stateful and non-stateful\nhandlers to be utilized.\n\nIf a handler calls `next`, it receives a `Future` which resolves to a `StructuredDocument`\nthat it can then compose how it sees fit with its own response.\n\n```ts\n\ntype NextFn<P> = (req: RequestInfo) => Future<P>;\n\ninterface Handler {\n async request<T>(context: RequestContext, next: NextFn<P>): T;\n}\n```\n\n`RequestContext` contains a readonly version of the RequestInfo as well as a few methods for building up the `StructuredDocument` and `Future` that will be part of the response.\n\n```ts\ninterface RequestContext<T> {\n readonly request: RequestInfo;\n\n setStream(stream: ReadableStream | Promise<ReadableStream>): void;\n setResponse(response: Response | ResponseInfo): void;\n}\n```\n\nA basic `fetch` handler with support for streaming content updates while\nthe download is still underway might look like the following, where we use\n[`response.clone()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/clone) to `tee` the `ReadableStream` into two streams.\n\nA more efficient handler might read from the response stream, building up the\nresponse content before passing along the chunk downstream.\n\n```ts\nconst FetchHandler = {\n async request(context) {\n const response = await fetch(context.request);\n context.setResponse(reponse);\n context.setStream(response.clone().body);\n\n return response.json();\n }\n}\n```\n\nRequest handlers are registered by configuring the manager via `use`\n\n```ts\nmanager.use([Handler1, Handler2])\n```\n\nHandlers will be invoked in the order they are registered (\"fifo\", first-in first-out), and may only be registered up until the first request is made. It is recommended but not required to register all handlers at one time in order to ensure explicitly visible handler ordering.\n\n---\n\n#### Handling Errors\n\nEach handler in the chain can catch errors from upstream and choose to\neither handle the error, re-throw the error, or throw a new error.\n\n```ts\nconst MAX_RETRIES = 5;\n\nconst Handler = {\n async request(context, next) {\n let attempts = 0;\n\n while (attempts < MAX_RETRIES) {\n attempts++;\n try {\n const response = await next(context.request);\n return response;\n } catch (e) {\n if (isTimeoutError(e) && attempts < MAX_RETRIES) {\n // retry request\n continue;\n }\n // rethrow if it is not a timeout error\n throw e;\n }\n }\n }\n}\n```\n\n---\n\n#### Handling Abort\n\nAborting a request will reject the current handler in the chain. However,\nevery handler can potentially catch this error. If your handler needs to\nseparate AbortError from other Error types, it is recommended to check\n`context.request.signal.aborted` (or if a custom controller was supplied `controller.signal.aborted`).\n\nIn this manner it is possible for a request to recover from an abort and\nstill proceed; however, as a best practice this should be used for necessary\ncleanup only and the original AbortError rethrown if the abort signal comes\nfrom the root controller.\n\n**AbortControllers are Always Present and Always Entangled**\n\nIf the initial request does not supply an [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController), one will be generated.\n\nThe [signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) for this controller is automatically added to the request passed into the first handler.\n\nEach handler has the option to supply a new controller to the request when calling `next`. If a new controller is provided it will be automatically\nentangled with the root controller. If the root controller aborts, so will\nany entangled controllers.\n\nIf an entangled controller aborts, the root controller will not abort. This\nallows for advanced request-flow scenarios to abort subsections of the request tree without aborting the entire request.\n\n---\n\n#### Stream Currying\n\n`RequestManager.request` and `next` differ from `fetch` in one **crucial detail** in that the outer Promise resolves only once the response stream has been processed.\n\nFor context, it helps to understand a few of the use-cases that RequestManager\nis intended to allow.\n\n- to manage and return streaming content (such as video files)\n- to fulfill a request from multiple sources or by splitting one request into multiple requests\n - for instance one API call for a user and another for the user's friends\n - or e.g. fulfilling part of the request from one source (one API, in-memory, localStorage, IndexedDB\n etc.) and the rest from another source (a different API, a WebWorker, etc.)\n- to coalesce multiple requests\n- to decorate a request with additional info\n - e.g. an Auth handler that ensures the correct tokens or headers or cookies are attached.\n\n\n`await fetch(<req>)` resolves at the moment headers are received. This allows for the body of the request to be processed as a stream by application\ncode *while chunks are still being received by the browser*.\n\nWhen an app chooses to `await response.json()` what occurs is the browser reads the stream to completion and then returns the result. Additionally, this stream may only be read **once**.\n\nThe `RequestManager` preserves this ability to subscribe to and utilize the stream by either the application or the handler – thereby delivering the full power and flexibility of native APIs – without restricting developers in ways that lead to complicated workarounds.\n\nEach handler may call `setStream` only once, but may do so *at any time* until the promise that the handler returns has resolved. The associated promise returned by calling `future.getStream` will resolve with the stream set by `setStream` if that method is called, or `null` if that method\nhas not been called by the time that the handler's request method has resolved.\n\nHandlers that do not create a stream of their own, but which call `next`, should defensively pipe the stream forward. While this is not required (see automatic currying below) it is better to do so in most cases as otherwise the stream may not become available to downstream handlers or the application until the upstream handler has fully read it.\n\n```ts\ncontext.setStream(future.getStream());\n```\n\nHandlers that either call `next` multiple times or otherwise have reason to create multiple fetch requests should either choose to return no stream, meaningfully combine the streams, or select a single prioritized stream.\n\nOf course, any handler may choose to read and handle the stream, and return either no stream or a different stream in the process.\n\n---\n\n#### Automatic Currying of Stream and Response\n\nIn order to simplify the common case for handlers which decorate a request, if `next` is called only a single time and `setResponse` was never called by the handler, the response set by the next handler in the chain will be applied to that handler's outcome. For instance, this makes the following pattern possible `return (await next(<req>)).content;`.\n\nSimilarly, if `next` is called only a single time and neither `setStream` nor `getStream` was called, we automatically curry the stream from the future returned by `next` onto the future returned by the handler.\n\nFinally, if the return value of a handler is a `Future`, we curry `content` and `errors` as well, thus enabling the simplest form `return next(<req>)`.\n\nIn the case of the `Future` being returned, `Stream` proxying is automatic and immediate and does not wait for the `Future` to resolve.\n\n---\n\n### Using as a Service\n\nMost applications will desire to have a single `RequestManager` instance, which can be achieved using module-state patterns for singletons, or for [Ember](https://emberjs.com) applications by exporting the manager as a [service](https://guides.emberjs.com/release/services/).\n\n*services/request.ts*\n```ts\nimport RequestManager from '@ember-data-mirror/request';\nimport Fetch from '@ember-data-mirror/request/fetch';\nimport Auth from 'ember-simple-auth/ember-data-handler';\n\nexport default class extends RequestManager {\n constructor(createArgs) {\n super(createArgs);\n this.use([Auth, Fetch]);\n }\n}\n```\n\n---\n\n#### Using with `@ember-data-mirror/store`\n\nTo have a request service unique to a Store:\n\n```ts\nimport Store, { CacheHandler } from '@ember-data-mirror/store';\nimport RequestManager from '@ember-data-mirror/request';\nimport Fetch from '@ember-data-mirror/request/fetch';\n\nclass extends Store {\n requestManager = new RequestManager()\n .use([Fetch])\n .useCache(CacheHandler);\n}\n```\n\n---\n\n#### Using with `ember-data`\n\nIf using the package [ember-data](https://github.com/emberjs/data/tree/main/packages/-ember-data),\nthe following configuration will automatically be done in order to preserve the\nlegacy [Adapter](https://github.com/emberjs/data/tree/main/packages/adapter) and\n[Serializer](https://github.com/emberjs/data/tree/main/packages/serializer) behavior.\nAdditional handlers or a service injection like the above would need to be done by the\nconsuming application in order to make broader use of `RequestManager`.\n\n```ts\nimport Store from 'ember-data-mirror/store';\nimport { CacheHandler } from '@ember-data-mirror/store';\nimport RequestManager from '@ember-data-mirror/request';\nimport Fetch from '@ember-data-mirror/request/fetch';\nimport { LegacyNetworkHandler } from '@ember-data-mirror/legacy-compat';\n\nexport default class extends Store {\n requestManager = new RequestManager()\n .use([LegacyNetworkHandler, Fetch])\n .useCache(CacheHandler);\n}\n```\n\nTo provide a different configuration, import and extend `ember-data/store`. The\ndefault configuration will be ignored if the `requestManager` property is set,\nthough the store will still register the CacheHandler.\n\nFor usage of the store's `requestManager` via `store.request(<req>)` see the\n[Store](https://api.emberjs.com/ember-data/release/modules/@ember-data%2Fstore) documentation.\n\n *\n * @module @ember-data-mirror/request\n * @main @ember-data-mirror/request\n */\nimport { importSync } from '@embroider/macros';\n\nimport { DEBUG, TESTING } from '@warp-drive-mirror/build-config/env';\nimport { peekUniversalTransient, setUniversalTransient } from '@warp-drive-mirror/core-types/-private';\nimport type { StableDocumentIdentifier } from '@warp-drive-mirror/core-types/identifier';\nimport type { RequestInfo, StructuredErrorDocument } from '@warp-drive-mirror/core-types/request';\n\nimport { assertValidRequest } from './debug';\nimport { upgradePromise } from './future';\nimport { clearRequestResult, getRequestResult, setPromiseResult } from './promise-cache';\nimport type { CacheHandler, Future, GenericCreateArgs, Handler, ManagedRequestPriority } from './types';\nimport { executeNextHandler, IS_CACHE_HANDLER } from './utils';\n\n/**\n * ```js\n * import RequestManager from '@ember-data-mirror/request';\n * ```\n *\n * A RequestManager provides a request/response flow in which configured\n * handlers are successively given the opportunity to handle, modify, or\n * pass-along a request.\n *\n * ```ts\n * interface RequestManager {\n * request<T>(req: RequestInfo): Future<T>;\n * }\n * ```\n *\n * For example:\n *\n * ```ts\n * import RequestManager from '@ember-data-mirror/request';\n * import Fetch from '@ember-data-mirror/request/fetch';\n * import Auth from 'ember-simple-auth/ember-data-handler';\n * import Config from './config';\n *\n * const { apiUrl } = Config;\n *\n * // ... create manager\n * const manager = new RequestManager().use([Auth, Fetch]);\n *\n * // ... execute a request\n * const response = await manager.request({\n * url: `${apiUrl}/users`\n * });\n * ```\n *\n * ### Futures\n *\n * The return value of `manager.request` is a `Future`, which allows\n * access to limited information about the request while it is still\n * pending and fulfills with the final state when the request completes.\n *\n * A `Future` is cancellable via `abort`.\n *\n * Handlers may optionally expose a `ReadableStream` to the `Future` for\n * streaming data; however, when doing so the future should not resolve\n * until the response stream is fully read.\n *\n * ```ts\n * interface Future<T> extends Promise<StructuredDocument<T>> {\n * abort(): void;\n *\n * async getStream(): ReadableStream | null;\n * }\n * ```\n *\n * ### StructuredDocuments\n *\n * A Future resolves with a `StructuredDataDocument` or rejects with a `StructuredErrorDocument`.\n *\n * ```ts\n * interface StructuredDataDocument<T> {\n * request: ImmutableRequestInfo;\n * response: ImmutableResponseInfo;\n * content: T;\n * }\n * interface StructuredErrorDocument extends Error {\n * request: ImmutableRequestInfo;\n * response: ImmutableResponseInfo;\n * error: string | object;\n * }\n * type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument;\n * ```\n *\n * @class RequestManager\n * @public\n */\nexport class RequestManager {\n #handlers: Handler[] = [];\n declare _hasCacheHandler: boolean;\n /**\n * A map of pending requests from request.id to their\n * associated CacheHandler promise.\n *\n * This queue is managed by the CacheHandler\n *\n * @internal\n */\n declare _pending: Map<number, Promise<unknown>>;\n declare _deduped: Map<StableDocumentIdentifier, { priority: ManagedRequestPriority; promise: Promise<unknown> }>;\n\n constructor(options?: GenericCreateArgs) {\n Object.assign(this, options);\n this._pending = new Map();\n this._deduped = new Map();\n }\n\n /**\n * Register a handler to use for primary cache intercept.\n *\n * Only one such handler may exist. If using the same\n * RequestManager as the Store instance the Store\n * registers itself as a Cache handler.\n *\n * @method useCache\n * @public\n * @param {Handler[]} cacheHandler\n * @return {ThisType}\n */\n useCache(cacheHandler: CacheHandler & { [IS_CACHE_HANDLER]?: true }): this {\n if (DEBUG) {\n if (this._hasCacheHandler) {\n throw new Error(`\\`RequestManager.useCache(<handler>)\\` May only be invoked once.`);\n }\n if (Object.isFrozen(this.#handlers)) {\n throw new Error(\n `\\`RequestManager.useCache(<handler>)\\` May only be invoked prior to any request having been made.`\n );\n }\n this._hasCacheHandler = true;\n }\n cacheHandler[IS_CACHE_HANDLER] = true;\n this.#handlers.unshift(cacheHandler as Handler);\n return this;\n }\n\n /**\n * Register handler(s) to use when a request is issued.\n *\n * Handlers will be invoked in the order they are registered.\n * Each Handler is given the opportunity to handle the request,\n * curry the request, or pass along a modified request.\n *\n * @method use\n * @public\n * @param {Handler[]} newHandlers\n * @return {ThisType}\n */\n use(newHandlers: Handler[]): this {\n const handlers = this.#handlers;\n if (DEBUG) {\n if (Object.isFrozen(handlers)) {\n throw new Error(`Cannot add a Handler to a RequestManager after a request has been made`);\n }\n if (!Array.isArray(newHandlers)) {\n throw new Error(\n `\\`RequestManager.use(<Handler[]>)\\` expects an array of handlers, but was called with \\`${typeof newHandlers}\\``\n );\n }\n newHandlers.forEach((handler, index) => {\n if (!handler || typeof handler !== 'object' || typeof handler.request !== 'function') {\n throw new Error(\n `\\`RequestManager.use(<Handler[]>)\\` expected to receive an array of handler objects with request methods, by the handler at index ${index} does not conform.`\n );\n }\n });\n }\n handlers.push(...newHandlers);\n return this;\n }\n\n /**\n * Issue a Request.\n *\n * Returns a Future that fulfills with a StructuredDocument\n *\n * @method request\n * @public\n * @param {RequestInfo} request\n * @return {Future}\n */\n request<RT, T = unknown>(request: RequestInfo<T, RT>): Future<RT> {\n const handlers = this.#handlers;\n if (DEBUG) {\n if (!Object.isFrozen(handlers)) {\n Object.freeze(handlers);\n }\n assertValidRequest(request, true);\n }\n\n const controller = request.controller || new AbortController();\n if (request.controller) {\n delete request.controller;\n }\n\n const requestId = peekUniversalTransient<number>('REQ_ID') ?? 0;\n setUniversalTransient('REQ_ID', requestId + 1);\n\n const context = {\n controller,\n response: null,\n stream: null,\n hasRequestedStream: false,\n id: requestId,\n identifier: null,\n };\n const promise = executeNextHandler<RT>(handlers, request, 0, context);\n\n // the cache handler will set the result of the request synchronously\n // if it is able to fulfill the request from the cache\n const cacheResult = getRequestResult(requestId);\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n const { waitForPromise } = importSync('@ember/test-waiters') as {\n waitForPromise: <PT>(promise: Promise<PT>) => Promise<PT>;\n };\n const newPromise = waitForPromise(promise);\n const finalPromise = upgradePromise(\n newPromise.then(\n (result) => {\n setPromiseResult(finalPromise, { isError: false, result });\n clearRequestResult(requestId);\n return result;\n },\n (error: StructuredErrorDocument) => {\n setPromiseResult(finalPromise, { isError: true, result: error });\n clearRequestResult(requestId);\n throw error;\n }\n ),\n promise\n );\n\n if (cacheResult) {\n setPromiseResult(finalPromise, cacheResult);\n }\n\n return finalPromise;\n }\n }\n\n // const promise1 = store.request(myRequest);\n // const promise2 = store.request(myRequest);\n // promise1 === promise2; // false\n // either we need to make promise1 === promise2, or we need to make sure that\n // we need to have a way to key from request to result\n // such that we can lookup the result here and return it if it exists\n const finalPromise = upgradePromise(\n promise.then(\n (result) => {\n setPromiseResult(finalPromise, { isError: false, result });\n clearRequestResult(requestId);\n return result;\n },\n (error: StructuredErrorDocument) => {\n setPromiseResult(finalPromise, { isError: true, result: error });\n clearRequestResult(requestId);\n throw error;\n }\n ),\n promise\n );\n\n if (cacheResult) {\n setPromiseResult(finalPromise, cacheResult);\n }\n\n return finalPromise;\n }\n\n static create(options?: GenericCreateArgs) {\n return new this(options);\n }\n}\n"],"names":["RequestManager","constructor","options","Object","assign","_pending","Map","_deduped","useCache","cacheHandler","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","_hasCacheHandler","Error","isFrozen","IS_CACHE_HANDLER","unshift","use","newHandlers","handlers","Array","isArray","forEach","handler","index","request","push","freeze","assertValidRequest","controller","AbortController","requestId","peekUniversalTransient","setUniversalTransient","context","response","stream","hasRequestedStream","id","identifier","promise","executeNextHandler","cacheResult","getRequestResult","TESTING","disableTestWaiter","waitForPromise","importSync","newPromise","finalPromise","upgradePromise","then","result","setPromiseResult","isError","clearRequestResult","error","create"],"mappings":";;;;;AAAA;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;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;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;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;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;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;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,CAAC;EAC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","sources":["../src/-private/manager.ts","../src/index.ts"],"sourcesContent":["/* eslint-disable no-irregular-whitespace */\n/**\n *\n <p align=\"center\">\n <img\n class=\"project-logo\"\n src=\"https://raw.githubusercontent.com/emberjs/data/4612c9354e4c54d53327ec2cf21955075ce21294/ember-data-logo-light.svg#gh-light-mode-only\"\n alt=\"EmberData RequestManager\"\n width=\"240px\"\n title=\"EmberData RequestManager\"\n />\n</p>\n\n<p align=\"center\">⚡️ a simple abstraction over fetch to enable easy management of request/response flows</p>\n\nThis package provides [*Ember*‍**Data**](https://github.com/emberjs/data/)'s `RequestManager`, a framework agnostic library that can be integrated with any Javascript application to make [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) happen.\n\n- [Installation](#installation)\n- [Basic Usage](#🚀-basic-usage)\n- [Architecture](#🪜-architecture)\n- [Usage](#usage)\n - [Making Requests](#making-requests)\n - [Using The Response](#using-the-response)\n - [Request Handlers](#handling-requests)\n - [Handling Errors](#handling-errors)\n - [Handling Abort](#handling-abort)\n - [Stream Currying](#stream-currying)\n - [Automatic Currying](#automatic-currying-of-stream-and-response)\n - [Using as a Service](#using-as-a-service)\n - [Using with `@ember-data-mirror/store`](#using-with-ember-datastore)\n - [Using with `ember-data`](#using-with-ember-data)\n\n---\n\n## Installation\n\nInstall using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)\n\n```no-highlight\npnpm add @ember-data-mirror/request\n```\n\n---\n\n## 🚀 Basic Usage\n\nA `RequestManager` provides a request/response flow in which configured handlers are successively given the opportunity to handle, modify, or pass-along a request.\n\nThe RequestManager on its own does not know how to fulfill requests. For this we must register at least one handler. A basic `Fetch` handler is provided that will take the request options provided and execute `fetch`.\n\n```ts\nimport RequestManager from '@ember-data-mirror/request';\nimport Fetch from '@ember-data-mirror/request/fetch';\nimport { apiUrl } from './config';\n\n// ... create manager and add our Fetch handler\nconst manager = new RequestManager()\n .use([Fetch]);\n\n// ... execute a request\nconst response = await manager.request({\n url: `${apiUrl}/users`\n});\n```\n\n---\n\n## 🪜 Architecture\n\nA `RequestManager` receives a request and manages fulfillment via configured handlers. It may be used standalone from the rest of *Ember*‍**Data** and is not specific to any library or framework.\n\nEach handler may choose to fulfill the request using some source of data or to pass the request along to other handlers.\n\nThe same or a separate instance of a `RequestManager` may also be used to fulfill requests issued by [*Ember*‍**Data**{Store}](https://github.com/emberjs/data/tree/main/packages/store)\n\nWhen the same instance is used by both this allows for simple coordination throughout the application. Requests issued by the Store will use the in-memory cache\nand return hydrated responses, requests issued directly to the RequestManager\nwill skip the in-memory cache and return raw responses.\n\n---\n\n## Usage\n\n```ts\nconst userList = await manager.request({\n url: `/api/v1/users.list`\n});\n\nconst users = userList.content;\n```\n\n---\n\n### Making Requests\n\n`RequestManager` has a single asyncronous method as it's API: `request`\n\n```ts\nclass RequestManager {\n request<T>(req: RequestInfo): Future<T>;\n}\n```\n\n`manager.request(<RequestInfo>)` accepts an object containing the information\nnecessary for the request to be handled successfully.\n\nThese options extend the [options](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters) provided to `fetch`, and can accept a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). All properties accepted by Request options and fetch options are valid.\n\n```ts\ninterface RequestInfo extends FetchOptions {\n op?: string;\n store?: Store;\n\n url: string;\n // data that a handler should convert into\n // the query (GET) or body (POST)\n data?: Record<string, unknown>;\n\n // options specifically intended for handlers\n // to utilize to process the request\n options?: Record<string, unknown>;\n}\n```\n\n> **note**\n> providing a `signal` is unnecessary as an `AbortController` is automatically provided if none is present.\n\n---\n\n#### Using the Response\n\n`manager.request` returns a `Future`, which allows access to limited information about the request while it is still pending and fulfills with the final state when the request completes and the response has been read.\n\n```ts\nconst usersFuture = manager.request({\n url: `/api/v1/users.list`\n});\n```\n\nA `Future` is cancellable via `abort`.\n\n```ts\nusersFuture.abort();\n```\n\nHandlers may *optionally* expose a ReadableStream to the `Future` for streaming data; however, when doing so the handler should not resolve until it has fully read the response stream itself.\n\n```ts\ninterface Future<T> extends Promise<StructuredDocument<T>> {\n abort(): void;\n\n async getStream(): ReadableStream | null;\n}\n```\n\nA Future resolves or rejects with a `StructuredDocument`.\n\n```ts\ninterface StructuredDocument<T> {\n request: RequestInfo;\n response: ResponseInfo | null;\n content?: T;\n error?: Error;\n}\n```\n\nThe `RequestInfo` specified by `document.request` is the same as originally provided to `manager.request`. If any handler fulfilled this request using different request info it is not represented here. This contract helps to ensure that `retry` and `caching` are possible since the original arguments are correctly preserved. This also allows handlers to \"fork\" the request or fulfill from multiple sources without the details of fulfillment muddying the original request.\n\nThe `ResponseInfo` is a serializable fulfilled subset of a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) if set via `setResponse`. If no response was ever set this will be `null`.\n\n```ts\ninterface ResponseInfo {\n headers?: Record<string, string>;\n ok?: boolean;\n redirected?: boolean;\n status?: HTTPStatusCode;\n statusText?: string;\n type?: 'basic' | 'cors';\n url?: string;\n}\n```\n\n---\n\n### Request Handlers\n\nRequests are fulfilled by handlers. A handler receives the request context\nas well as a `next` function with which to pass along a request to the next\nhandler if it so chooses.\n\nA handler may be any object with a `request` method. This allows both stateful and non-stateful\nhandlers to be utilized.\n\nIf a handler calls `next`, it receives a `Future` which resolves to a `StructuredDocument`\nthat it can then compose how it sees fit with its own response.\n\n```ts\n\ntype NextFn<P> = (req: RequestInfo) => Future<P>;\n\ninterface Handler {\n async request<T>(context: RequestContext, next: NextFn<P>): T;\n}\n```\n\n`RequestContext` contains a readonly version of the RequestInfo as well as a few methods for building up the `StructuredDocument` and `Future` that will be part of the response.\n\n```ts\ninterface RequestContext<T> {\n readonly request: RequestInfo;\n\n setStream(stream: ReadableStream | Promise<ReadableStream>): void;\n setResponse(response: Response | ResponseInfo): void;\n}\n```\n\nA basic `fetch` handler with support for streaming content updates while\nthe download is still underway might look like the following, where we use\n[`response.clone()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/clone) to `tee` the `ReadableStream` into two streams.\n\nA more efficient handler might read from the response stream, building up the\nresponse content before passing along the chunk downstream.\n\n```ts\nconst FetchHandler = {\n async request(context) {\n const response = await fetch(context.request);\n context.setResponse(reponse);\n context.setStream(response.clone().body);\n\n return response.json();\n }\n}\n```\n\nRequest handlers are registered by configuring the manager via `use`\n\n```ts\nmanager.use([Handler1, Handler2])\n```\n\nHandlers will be invoked in the order they are registered (\"fifo\", first-in first-out), and may only be registered up until the first request is made. It is recommended but not required to register all handlers at one time in order to ensure explicitly visible handler ordering.\n\n---\n\n#### Handling Errors\n\nEach handler in the chain can catch errors from upstream and choose to\neither handle the error, re-throw the error, or throw a new error.\n\n```ts\nconst MAX_RETRIES = 5;\n\nconst Handler = {\n async request(context, next) {\n let attempts = 0;\n\n while (attempts < MAX_RETRIES) {\n attempts++;\n try {\n const response = await next(context.request);\n return response;\n } catch (e) {\n if (isTimeoutError(e) && attempts < MAX_RETRIES) {\n // retry request\n continue;\n }\n // rethrow if it is not a timeout error\n throw e;\n }\n }\n }\n}\n```\n\n---\n\n#### Handling Abort\n\nAborting a request will reject the current handler in the chain. However,\nevery handler can potentially catch this error. If your handler needs to\nseparate AbortError from other Error types, it is recommended to check\n`context.request.signal.aborted` (or if a custom controller was supplied `controller.signal.aborted`).\n\nIn this manner it is possible for a request to recover from an abort and\nstill proceed; however, as a best practice this should be used for necessary\ncleanup only and the original AbortError rethrown if the abort signal comes\nfrom the root controller.\n\n**AbortControllers are Always Present and Always Entangled**\n\nIf the initial request does not supply an [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController), one will be generated.\n\nThe [signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) for this controller is automatically added to the request passed into the first handler.\n\nEach handler has the option to supply a new controller to the request when calling `next`. If a new controller is provided it will be automatically\nentangled with the root controller. If the root controller aborts, so will\nany entangled controllers.\n\nIf an entangled controller aborts, the root controller will not abort. This\nallows for advanced request-flow scenarios to abort subsections of the request tree without aborting the entire request.\n\n---\n\n#### Stream Currying\n\n`RequestManager.request` and `next` differ from `fetch` in one **crucial detail** in that the outer Promise resolves only once the response stream has been processed.\n\nFor context, it helps to understand a few of the use-cases that RequestManager\nis intended to allow.\n\n- to manage and return streaming content (such as video files)\n- to fulfill a request from multiple sources or by splitting one request into multiple requests\n - for instance one API call for a user and another for the user's friends\n - or e.g. fulfilling part of the request from one source (one API, in-memory, localStorage, IndexedDB\n etc.) and the rest from another source (a different API, a WebWorker, etc.)\n- to coalesce multiple requests\n- to decorate a request with additional info\n - e.g. an Auth handler that ensures the correct tokens or headers or cookies are attached.\n\n\n`await fetch(<req>)` resolves at the moment headers are received. This allows for the body of the request to be processed as a stream by application\ncode *while chunks are still being received by the browser*.\n\nWhen an app chooses to `await response.json()` what occurs is the browser reads the stream to completion and then returns the result. Additionally, this stream may only be read **once**.\n\nThe `RequestManager` preserves this ability to subscribe to and utilize the stream by either the application or the handler – thereby delivering the full power and flexibility of native APIs – without restricting developers in ways that lead to complicated workarounds.\n\nEach handler may call `setStream` only once, but may do so *at any time* until the promise that the handler returns has resolved. The associated promise returned by calling `future.getStream` will resolve with the stream set by `setStream` if that method is called, or `null` if that method\nhas not been called by the time that the handler's request method has resolved.\n\nHandlers that do not create a stream of their own, but which call `next`, should defensively pipe the stream forward. While this is not required (see automatic currying below) it is better to do so in most cases as otherwise the stream may not become available to downstream handlers or the application until the upstream handler has fully read it.\n\n```ts\ncontext.setStream(future.getStream());\n```\n\nHandlers that either call `next` multiple times or otherwise have reason to create multiple fetch requests should either choose to return no stream, meaningfully combine the streams, or select a single prioritized stream.\n\nOf course, any handler may choose to read and handle the stream, and return either no stream or a different stream in the process.\n\n---\n\n#### Automatic Currying of Stream and Response\n\nIn order to simplify the common case for handlers which decorate a request, if `next` is called only a single time and `setResponse` was never called by the handler, the response set by the next handler in the chain will be applied to that handler's outcome. For instance, this makes the following pattern possible `return (await next(<req>)).content;`.\n\nSimilarly, if `next` is called only a single time and neither `setStream` nor `getStream` was called, we automatically curry the stream from the future returned by `next` onto the future returned by the handler.\n\nFinally, if the return value of a handler is a `Future`, we curry `content` and `errors` as well, thus enabling the simplest form `return next(<req>)`.\n\nIn the case of the `Future` being returned, `Stream` proxying is automatic and immediate and does not wait for the `Future` to resolve.\n\n---\n\n### Using as a Service\n\nMost applications will desire to have a single `RequestManager` instance, which can be achieved using module-state patterns for singletons, or for [Ember](https://emberjs.com) applications by exporting the manager as a [service](https://guides.emberjs.com/release/services/).\n\n*services/request.ts*\n```ts\nimport RequestManager from '@ember-data-mirror/request';\nimport Fetch from '@ember-data-mirror/request/fetch';\nimport Auth from 'ember-simple-auth/ember-data-handler';\n\nexport default class extends RequestManager {\n constructor(createArgs) {\n super(createArgs);\n this.use([Auth, Fetch]);\n }\n}\n```\n\n---\n\n#### Using with `@ember-data-mirror/store`\n\nTo have a request service unique to a Store:\n\n```ts\nimport Store, { CacheHandler } from '@ember-data-mirror/store';\nimport RequestManager from '@ember-data-mirror/request';\nimport Fetch from '@ember-data-mirror/request/fetch';\n\nclass extends Store {\n requestManager = new RequestManager()\n .use([Fetch])\n .useCache(CacheHandler);\n}\n```\n\n---\n\n#### Using with `ember-data`\n\nIf using the package [ember-data](https://github.com/emberjs/data/tree/main/packages/-ember-data),\nthe following configuration will automatically be done in order to preserve the\nlegacy [Adapter](https://github.com/emberjs/data/tree/main/packages/adapter) and\n[Serializer](https://github.com/emberjs/data/tree/main/packages/serializer) behavior.\nAdditional handlers or a service injection like the above would need to be done by the\nconsuming application in order to make broader use of `RequestManager`.\n\n```ts\nimport Store from 'ember-data-mirror/store';\nimport { CacheHandler } from '@ember-data-mirror/store';\nimport RequestManager from '@ember-data-mirror/request';\nimport Fetch from '@ember-data-mirror/request/fetch';\nimport { LegacyNetworkHandler } from '@ember-data-mirror/legacy-compat';\n\nexport default class extends Store {\n requestManager = new RequestManager()\n .use([LegacyNetworkHandler, Fetch])\n .useCache(CacheHandler);\n}\n```\n\nTo provide a different configuration, import and extend `ember-data/store`. The\ndefault configuration will be ignored if the `requestManager` property is set,\nthough the store will still register the CacheHandler.\n\nFor usage of the store's `requestManager` via `store.request(<req>)` see the\n[Store](https://api.emberjs.com/ember-data/release/modules/@ember-data%2Fstore) documentation.\n\n *\n * @module @ember-data-mirror/request\n * @main @ember-data-mirror/request\n */\nimport { importSync } from '@embroider/macros';\n\nimport { DEBUG, TESTING } from '@warp-drive-mirror/build-config/env';\nimport { peekUniversalTransient, setUniversalTransient } from '@warp-drive-mirror/core-types/-private';\nimport type { StableDocumentIdentifier } from '@warp-drive-mirror/core-types/identifier';\nimport type { RequestInfo, StructuredErrorDocument } from '@warp-drive-mirror/core-types/request';\n\nimport { assertValidRequest } from './debug';\nimport { upgradePromise } from './future';\nimport { clearRequestResult, getRequestResult, setPromiseResult } from './promise-cache';\nimport type { CacheHandler, Future, GenericCreateArgs, Handler, ManagedRequestPriority } from './types';\nimport { executeNextHandler, IS_CACHE_HANDLER } from './utils';\n\n/**\n * ```js\n * import RequestManager from '@ember-data-mirror/request';\n * ```\n *\n * A RequestManager provides a request/response flow in which configured\n * handlers are successively given the opportunity to handle, modify, or\n * pass-along a request.\n *\n * ```ts\n * interface RequestManager {\n * request<T>(req: RequestInfo): Future<T>;\n * }\n * ```\n *\n * For example:\n *\n * ```ts\n * import RequestManager from '@ember-data-mirror/request';\n * import Fetch from '@ember-data-mirror/request/fetch';\n * import Auth from 'ember-simple-auth/ember-data-handler';\n * import Config from './config';\n *\n * const { apiUrl } = Config;\n *\n * // ... create manager\n * const manager = new RequestManager().use([Auth, Fetch]);\n *\n * // ... execute a request\n * const response = await manager.request({\n * url: `${apiUrl}/users`\n * });\n * ```\n *\n * ### Futures\n *\n * The return value of `manager.request` is a `Future`, which allows\n * access to limited information about the request while it is still\n * pending and fulfills with the final state when the request completes.\n *\n * A `Future` is cancellable via `abort`.\n *\n * Handlers may optionally expose a `ReadableStream` to the `Future` for\n * streaming data; however, when doing so the future should not resolve\n * until the response stream is fully read.\n *\n * ```ts\n * interface Future<T> extends Promise<StructuredDocument<T>> {\n * abort(): void;\n *\n * async getStream(): ReadableStream | null;\n * }\n * ```\n *\n * ### StructuredDocuments\n *\n * A Future resolves with a `StructuredDataDocument` or rejects with a `StructuredErrorDocument`.\n *\n * ```ts\n * interface StructuredDataDocument<T> {\n * request: ImmutableRequestInfo;\n * response: ImmutableResponseInfo;\n * content: T;\n * }\n * interface StructuredErrorDocument extends Error {\n * request: ImmutableRequestInfo;\n * response: ImmutableResponseInfo;\n * error: string | object;\n * }\n * type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument;\n * ```\n *\n * @class RequestManager\n * @public\n */\nexport class RequestManager {\n #handlers: Handler[] = [];\n declare _hasCacheHandler: boolean;\n /**\n * A map of pending requests from request.id to their\n * associated CacheHandler promise.\n *\n * This queue is managed by the CacheHandler\n *\n * @internal\n */\n declare _pending: Map<number, Promise<unknown>>;\n declare _deduped: Map<StableDocumentIdentifier, { priority: ManagedRequestPriority; promise: Promise<unknown> }>;\n\n constructor(options?: GenericCreateArgs) {\n Object.assign(this, options);\n this._pending = new Map();\n this._deduped = new Map();\n }\n\n /**\n * Register a handler to use for primary cache intercept.\n *\n * Only one such handler may exist. If using the same\n * RequestManager as the Store instance the Store\n * registers itself as a Cache handler.\n *\n * @method useCache\n * @public\n * @param {Handler[]} cacheHandler\n * @return {ThisType}\n */\n useCache(cacheHandler: CacheHandler & { [IS_CACHE_HANDLER]?: true }): this {\n if (DEBUG) {\n if (this._hasCacheHandler) {\n throw new Error(`\\`RequestManager.useCache(<handler>)\\` May only be invoked once.`);\n }\n if (Object.isFrozen(this.#handlers)) {\n throw new Error(\n `\\`RequestManager.useCache(<handler>)\\` May only be invoked prior to any request having been made.`\n );\n }\n this._hasCacheHandler = true;\n }\n cacheHandler[IS_CACHE_HANDLER] = true;\n this.#handlers.unshift(cacheHandler as Handler);\n return this;\n }\n\n /**\n * Register handler(s) to use when a request is issued.\n *\n * Handlers will be invoked in the order they are registered.\n * Each Handler is given the opportunity to handle the request,\n * curry the request, or pass along a modified request.\n *\n * @method use\n * @public\n * @param {Handler[]} newHandlers\n * @return {ThisType}\n */\n use(newHandlers: Handler[]): this {\n const handlers = this.#handlers;\n if (DEBUG) {\n if (Object.isFrozen(handlers)) {\n throw new Error(`Cannot add a Handler to a RequestManager after a request has been made`);\n }\n if (!Array.isArray(newHandlers)) {\n throw new Error(\n `\\`RequestManager.use(<Handler[]>)\\` expects an array of handlers, but was called with \\`${typeof newHandlers}\\``\n );\n }\n newHandlers.forEach((handler, index) => {\n if (!handler || typeof handler !== 'object' || typeof handler.request !== 'function') {\n throw new Error(\n `\\`RequestManager.use(<Handler[]>)\\` expected to receive an array of handler objects with request methods, by the handler at index ${index} does not conform.`\n );\n }\n });\n }\n handlers.push(...newHandlers);\n return this;\n }\n\n /**\n * Issue a Request.\n *\n * Returns a Future that fulfills with a StructuredDocument\n *\n * @method request\n * @public\n * @param {RequestInfo} request\n * @return {Future}\n */\n request<RT, T = unknown>(request: RequestInfo<T, RT>): Future<RT> {\n const handlers = this.#handlers;\n if (DEBUG) {\n if (!Object.isFrozen(handlers)) {\n Object.freeze(handlers);\n }\n assertValidRequest(request, true);\n }\n\n const controller = request.controller || new AbortController();\n if (request.controller) {\n delete request.controller;\n }\n\n const requestId = peekUniversalTransient<number>('REQ_ID') ?? 0;\n setUniversalTransient('REQ_ID', requestId + 1);\n\n const context = {\n controller,\n response: null,\n stream: null,\n hasRequestedStream: false,\n id: requestId,\n identifier: null,\n };\n const promise = executeNextHandler<RT>(handlers, request, 0, context);\n\n // the cache handler will set the result of the request synchronously\n // if it is able to fulfill the request from the cache\n const cacheResult = getRequestResult(requestId);\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n const { waitForPromise } = importSync('@ember/test-waiters') as {\n waitForPromise: <PT>(promise: Promise<PT>) => Promise<PT>;\n };\n const newPromise = waitForPromise(promise);\n const finalPromise = upgradePromise(\n newPromise.then(\n (result) => {\n setPromiseResult(finalPromise, { isError: false, result });\n clearRequestResult(requestId);\n return result;\n },\n (error: StructuredErrorDocument) => {\n setPromiseResult(finalPromise, { isError: true, result: error });\n clearRequestResult(requestId);\n throw error;\n }\n ),\n promise\n );\n\n if (cacheResult) {\n setPromiseResult(finalPromise, cacheResult);\n }\n\n return finalPromise;\n }\n }\n\n // const promise1 = store.request(myRequest);\n // const promise2 = store.request(myRequest);\n // promise1 === promise2; // false\n // either we need to make promise1 === promise2, or we need to make sure that\n // we need to have a way to key from request to result\n // such that we can lookup the result here and return it if it exists\n const finalPromise = upgradePromise(\n promise.then(\n (result) => {\n setPromiseResult(finalPromise, { isError: false, result });\n clearRequestResult(requestId);\n return result;\n },\n (error: StructuredErrorDocument) => {\n setPromiseResult(finalPromise, { isError: true, result: error });\n clearRequestResult(requestId);\n throw error;\n }\n ),\n promise\n );\n\n if (cacheResult) {\n setPromiseResult(finalPromise, cacheResult);\n }\n\n return finalPromise;\n }\n\n static create(options?: GenericCreateArgs) {\n return new this(options);\n }\n}\n","import { getRuntimeConfig, setLogging } from '@warp-drive-mirror/build-config/runtime';\n\nexport { RequestManager as default } from './-private/manager';\nexport { createDeferred } from './-private/future';\nexport type { Future, Handler, CacheHandler, NextFn } from './-private/types';\nexport type {\n RequestContext,\n ImmutableRequestInfo,\n RequestInfo,\n ResponseInfo,\n StructuredDocument,\n StructuredErrorDocument,\n StructuredDataDocument,\n} from '@warp-drive-mirror/core-types/request';\nexport { setPromiseResult, getPromiseResult } from './-private/promise-cache';\nexport type { Awaitable } from './-private/promise-cache';\n\n// @ts-expect-error adding to globalThis\nglobalThis.setWarpDriveLogging = setLogging;\n\n// @ts-expect-error adding to globalThis\nglobalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;\n"],"names":["RequestManager","constructor","options","Object","assign","_pending","Map","_deduped","useCache","cacheHandler","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","_hasCacheHandler","Error","isFrozen","IS_CACHE_HANDLER","unshift","use","newHandlers","handlers","Array","isArray","forEach","handler","index","request","push","freeze","assertValidRequest","controller","AbortController","requestId","peekUniversalTransient","setUniversalTransient","context","response","stream","hasRequestedStream","id","identifier","promise","executeNextHandler","cacheResult","getRequestResult","TESTING","disableTestWaiter","waitForPromise","importSync","newPromise","finalPromise","upgradePromise","then","result","setPromiseResult","isError","clearRequestResult","error","create","globalThis","setWarpDriveLogging","setLogging","getWarpDriveRuntimeConfig","getRuntimeConfig"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,MAAMA,cAAc,CAAC;EAC1B,SAAS,GAAc,EAAE;;AAEzB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAIEC,WAAWA,CAACC,OAA2B,EAAE;AACvCC,IAAAA,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AACW,IAAI,CACTC,MAAM,IAAK;MACVC,gBAAgB,CAACJ,YAAY,EAAE;AAAEK,QAAAA,OAAO,EAAE,KAAK;AAAEF,QAAAA;AAAO,OAAC,CAAC;MAC1DG,kBAAkB,CAACxB,SAAS,CAAC;AAC7B,MAAA,OAAOqB,MAAM;KACd,EACAI,KAA8B,IAAK;MAClCH,gBAAgB,CAACJ,YAAY,EAAE;AAAEK,QAAAA,OAAO,EAAE,IAAI;AAAEF,QAAAA,MAAM,EAAEI;AAAM,OAAC,CAAC;MAChED,kBAAkB,CAACxB,SAAS,CAAC;AAC7B,MAAA,MAAMyB,KAAK;KAEf,CAAC,EACDhB,OACF,CAAC;AAED,IAAA,IAAIE,WAAW,EAAE;AACfW,MAAAA,gBAAgB,CAACJ,YAAY,EAAEP,WAAW,CAAC;AAC7C;AAEA,IAAA,OAAOO,YAAY;AACrB;EAEA,OAAOQ,MAAMA,CAAC1D,OAA2B,EAAE;AACzC,IAAA,OAAO,IAAI,IAAI,CAACA,OAAO,CAAC;AAC1B;AACF;;AC7qBA;AACA2D,UAAU,CAACC,mBAAmB,GAAGC,UAAU;;AAE3C;AACAF,UAAU,CAACG,yBAAyB,GAAGC,gBAAgB;;;;"}
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="1200pt" height="1200pt" version="1.1" viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg">
3
+ <path fill="#0969da" d="m1096.3 402.82c-53.148-53.008-117.12-79.516-191.93-79.516-67.488 0-126.55 21.938-177.16 65.805-50.617 43.871-80.988 98.285-91.113 163.25l53.57 4.2188c14.625 0.28125 25.449 6.75 32.48 19.406h18.984c11.809 0 17.715 5.7617 17.715 17.293s-5.9062 17.293-17.715 17.293h-17.297c-6.75 14.344-18.137 21.797-34.168 22.359l-53.57 4.6406c10.125 64.68 40.496 118.95 91.113 162.82 50.617 43.871 109.68 65.805 177.16 65.805 74.805 0 138.78-26.574 191.93-79.723 53.152-53.148 79.727-116.98 79.727-191.51 0-75.086-26.574-139.13-79.727-192.14zm-79.422 185.27c0 2.9531 2.3906 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477 0-2.9492-2.3945-5.3438-5.3477-5.3438-2.9531 0-5.3438 2.3945-5.3438 5.3438zm-104.54-111.07c0 2.9531 2.3945 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477s-2.3945-5.3438-5.3477-5.3438c-2.9492 0-5.3438 2.3906-5.3438 5.3438zm-12.473 0c0 2.9531 2.3906 5.3477 5.3438 5.3477s5.3477-2.3945 5.3477-5.3477-2.3945-5.3438-5.3477-5.3438-5.3438 2.3906-5.3438 5.3438zm117.01 123.55c0 2.9492 2.3906 5.3438 5.3438 5.3438 2.9531 0 5.3477-2.3945 5.3477-5.3438 0-2.9531-2.3945-5.3477-5.3477-5.3477-2.9531 0-5.3438 2.3945-5.3438 5.3477zm-104.54 111.66c0 2.9531 2.3945 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477s-2.3945-5.3438-5.3477-5.3438c-2.9492 0-5.3438 2.3906-5.3438 5.3438zm-12.473 0c0 2.9531 2.3906 5.3477 5.3438 5.3477s5.3477-2.3945 5.3477-5.3477-2.3945-5.3438-5.3477-5.3438-5.3438 2.3906-5.3438 5.3438zm-848-318.48c14.062-2.5312 30.934-4.5 50.621-5.9062l-46.402-0.84375zm499.86 169.15c-8.7188-2.25-18.141-8.7188-28.266-19.402l-101.23-103.35h-111.36l173.79 126.12v4.2188c21.652 6.1836 44.008 3.6562 67.07-7.5938zm47.664-148.48c-0.84375 3.3711-2.8125 6.6055-5.9062 9.6992h-5.0625l-6.3242-5.0625h-79.305v-4.6367zm-5.9062-16.031c3.0938 3.0938 5.0625 6.4688 5.9062 10.125h-96.598v-4.6406h79.305l6.3242-5.4844zm-541.62 397.78 4.2188 6.7461 46.402-0.84375c-22.5-2.2461-39.371-4.2148-50.621-5.9023zm499.86-169.15c-23.062-11.531-45.418-14.062-67.07-7.5938v4.2188l-173.79 126.12h111.36l101.23-103.77c10.406-10.684 19.828-17.012 28.266-18.98zm47.664 148.48h-96.598v-4.6406h79.305l6.3242-5.4805h5.0625c3.0938 3.6523 5.0625 7.0273 5.9062 10.121zm-5.9062 15.609h-5.0625l-6.3242-5.0625h-79.305v-4.6406h96.598c-0.84375 3.0938-2.8125 6.3281-5.9062 9.7031zm-102.5 9.6992c3.6562 1.4062 7.4531 2.1094 11.391 2.1094h64.961c24.746 0 37.121-8.4336 37.121-25.309 0-8.4375-4.6406-14.691-13.922-18.77-9.2773-4.0781-17.012-6.1172-23.199-6.1172h-64.961c-4.7812 0-8.5781 0.5625-11.391 1.6875h-333.66c-5.0625 0-28.543 1.6172-70.445 4.8516-41.902 3.2344-62.852 7.3828-62.852 12.441v11.812c0 4.5 20.949 8.5078 62.852 12.023 41.902 3.5156 65.383 5.2695 70.445 5.2695zm125.28-207.54h-42.602c-3.375 1.125-3.375 2.25 0 3.375h42.602zm-43.445 8.4375h-5.4844v-13.5h5.4844c17.152-6.1875 33.605-9.9844 49.352-11.391l4.6406-25.309 4.6406 0.42188c0.5625-4.2188 1.6875-10.262 3.375-18.137-28.684-0.5625-64.398 1.6875-107.14 6.75 3.6562 4.2148 7.4531 7.8711 11.391 10.965 4.7812 3.375 9.4219 5.625 13.918 6.75l12.656 2.9531-11.812 5.9062c-13.496 6.75-30.23 10.121-50.195 10.121-5.0625 0-8.5781-0.14062-10.547-0.42188-4.2188-0.5625-7.5898-1.1211-10.121-1.6836l-3.375-1.2656v-5.4844l-24.043-17.297c-41.34 5.625-69.32 8.5781-83.945 8.8594-31.496 0.28125-47.242 11.953-47.242 35.012 0 22.215 15.746 33.887 47.242 35.012 18.844 0.28125 46.824 3.2344 83.945 8.8594l24.043-17.297v-5.4844l3.375-1.2656c2.5312-0.84375 5.9023-1.4062 10.121-1.6875 1.9688-0.28125 5.4844-0.42187 10.547-0.42187 19.965 0 36.699 3.375 50.195 10.125l11.812 5.4844-12.656 3.375c-4.4961 0.84375-9.1367 3.0938-13.918 6.75-3.6562 2.2461-7.4531 5.7617-11.391 10.543 40.777 5.0625 76.492 7.4531 107.14 7.1719-1.6875-7.3125-2.8125-13.359-3.375-18.137h-4.6406l-4.6406-24.891c-17.434-2.25-33.887-6.043-49.352-11.387zm48.508-20.25c-12.652 1.6875-23.762 3.9375-33.324 6.75h29.105l3.7969-4.2188zm-4.2188 20.25h-29.105c9.5625 2.5312 20.672 4.7812 33.324 6.7461l-0.42188-2.5273zm136.67-8.4375c0-8.4375-4.2188-12.656-12.652-12.656h-21.516c-6.4688-12.652-16.59-18.98-30.371-18.98l-58.211-5.0625-5.9062 29.527-4.2188 5.0625v7.5938l4.2188 5.0625 5.9062 29.105 58.211-5.0625c15.469 0 26.012-7.3125 31.637-21.934h20.25c8.4336 0 12.652-4.2188 12.652-12.656zm-46.82 1.6875c0-11.531-5.9062-17.297-17.719-17.297-11.527 0-17.293 5.7656-17.293 17.297 0 11.812 5.7656 17.715 17.293 17.715 11.812 0 17.719-5.9023 17.719-17.715zm4.6406 0c0 14.902-7.4531 22.355-22.359 22.355-14.902 0-22.355-7.4531-22.355-22.355 0-14.906 7.4531-22.355 22.355-22.355 14.906 0 22.359 7.4492 22.359 22.355zm-13.922 0c0-5.625-2.8125-8.4375-8.4375-8.4375-5.3438 0-8.0156 2.8125-8.0156 8.4375s2.6719 8.4375 8.0156 8.4375c5.625 0 8.4375-2.8125 8.4375-8.4375zm4.6406 0c0 8.7188-4.3594 13.078-13.078 13.078-8.4375 0-12.652-4.3594-12.652-13.078s4.2148-13.078 12.652-13.078c8.7188 0 13.078 4.3594 13.078 13.078zm-43.871-2.1094v4.2188h-35.012v-4.2188zm258.58 2.1094c-0.5625-8.4375-4.7812-12.656-12.656-12.656-8.4336 0-12.652 4.2188-12.652 12.656s4.2188 12.656 12.652 12.656c8.4375 0 12.656-4.2188 12.656-12.656zm4.6406 0c0 11.531-5.7656 17.293-17.297 17.293-11.527 0-17.293-5.7617-17.293-17.293s5.7656-17.297 17.293-17.297c11.531 0 17.297 5.7656 17.297 17.297zm32.48 0c0-13.781-4.9219-25.59-14.766-35.434-9.5586-9.5625-21.23-14.344-35.012-14.344-15.184 0-31.777 5.7656-49.773 17.297-18.559 11.531-27.84 22.355-27.84 32.48 0 9.8438 9.2812 20.668 27.84 32.48 17.996 11.531 34.59 17.293 49.773 17.293 13.781 0 25.453-4.918 35.012-14.762 9.8438-9.5625 14.766-21.234 14.766-35.012zm5.0625 0c0 14.902-5.3438 27.699-16.031 38.387-10.684 10.684-23.621 16.027-38.809 16.027-15.746 0-33.18-6.0469-52.305-18.137-20.246-12.656-30.371-24.746-30.371-36.277s10.125-23.762 30.371-36.699c19.125-12.094 36.559-18.137 52.305-18.137 14.625 0 27.562 5.3398 38.809 16.027 10.688 10.969 16.031 23.902 16.031 38.809zm-54.418-29.105c-3.9336 0-10.262 1.6875-18.98 5.0625-7.875 3.9375-11.812 6.4648-11.812 7.5898v32.48c0 3.0938 3.9375 5.625 11.812 7.5938 7.875 3.375 14.203 5.0625 18.98 5.0625 19.406 0 29.391-9.2812 29.953-27.84 0-19.688-9.9844-29.668-29.953-29.949zm34.59 29.105v0.84375c0 21.371-11.527 32.34-34.59 32.902-4.4961 0-11.527-1.8281-21.09-5.4844-7.0312-3.9375-10.969-6.3281-11.809-7.1719-1.6875-1.4062-2.5312-3.0938-2.5312-5.0625v-32.48c0-1.4062 0.70312-2.9492 2.1094-4.6367 3.0898-2.8125 7.168-5.2031 12.23-7.1719 9-3.6562 16.031-5.4844 21.09-5.4844 22.5 0.28125 34.027 11.531 34.59 33.746zm-448.4-206.27h-333.66c-5.0625 0-28.543 1.6875-70.445 5.0625-41.902 3.375-62.852 7.5938-62.852 12.656v11.387c0 4.7812 20.949 8.8594 62.852 12.234 41.902 3.375 65.383 5.0625 70.445 5.0625h333.66c3.6562 1.4062 7.4531 2.1094 11.391 2.1094h64.961c5.3438 0 12.867-2.25 22.566-6.75 9.7031-4.5 14.555-10.547 14.555-18.137 0.28125-16.875-12.094-25.312-37.121-25.312h-64.961c-4.7812 0-8.5781 0.5625-11.391 1.6875z" fill-rule="evenodd"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="1200pt" height="1200pt" version="1.1" viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg">
3
+ <path fill="#FFC474" d="m1096.3 402.82c-53.148-53.008-117.12-79.516-191.93-79.516-67.488 0-126.55 21.938-177.16 65.805-50.617 43.871-80.988 98.285-91.113 163.25l53.57 4.2188c14.625 0.28125 25.449 6.75 32.48 19.406h18.984c11.809 0 17.715 5.7617 17.715 17.293s-5.9062 17.293-17.715 17.293h-17.297c-6.75 14.344-18.137 21.797-34.168 22.359l-53.57 4.6406c10.125 64.68 40.496 118.95 91.113 162.82 50.617 43.871 109.68 65.805 177.16 65.805 74.805 0 138.78-26.574 191.93-79.723 53.152-53.148 79.727-116.98 79.727-191.51 0-75.086-26.574-139.13-79.727-192.14zm-79.422 185.27c0 2.9531 2.3906 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477 0-2.9492-2.3945-5.3438-5.3477-5.3438-2.9531 0-5.3438 2.3945-5.3438 5.3438zm-104.54-111.07c0 2.9531 2.3945 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477s-2.3945-5.3438-5.3477-5.3438c-2.9492 0-5.3438 2.3906-5.3438 5.3438zm-12.473 0c0 2.9531 2.3906 5.3477 5.3438 5.3477s5.3477-2.3945 5.3477-5.3477-2.3945-5.3438-5.3477-5.3438-5.3438 2.3906-5.3438 5.3438zm117.01 123.55c0 2.9492 2.3906 5.3438 5.3438 5.3438 2.9531 0 5.3477-2.3945 5.3477-5.3438 0-2.9531-2.3945-5.3477-5.3477-5.3477-2.9531 0-5.3438 2.3945-5.3438 5.3477zm-104.54 111.66c0 2.9531 2.3945 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477s-2.3945-5.3438-5.3477-5.3438c-2.9492 0-5.3438 2.3906-5.3438 5.3438zm-12.473 0c0 2.9531 2.3906 5.3477 5.3438 5.3477s5.3477-2.3945 5.3477-5.3477-2.3945-5.3438-5.3477-5.3438-5.3438 2.3906-5.3438 5.3438zm-848-318.48c14.062-2.5312 30.934-4.5 50.621-5.9062l-46.402-0.84375zm499.86 169.15c-8.7188-2.25-18.141-8.7188-28.266-19.402l-101.23-103.35h-111.36l173.79 126.12v4.2188c21.652 6.1836 44.008 3.6562 67.07-7.5938zm47.664-148.48c-0.84375 3.3711-2.8125 6.6055-5.9062 9.6992h-5.0625l-6.3242-5.0625h-79.305v-4.6367zm-5.9062-16.031c3.0938 3.0938 5.0625 6.4688 5.9062 10.125h-96.598v-4.6406h79.305l6.3242-5.4844zm-541.62 397.78 4.2188 6.7461 46.402-0.84375c-22.5-2.2461-39.371-4.2148-50.621-5.9023zm499.86-169.15c-23.062-11.531-45.418-14.062-67.07-7.5938v4.2188l-173.79 126.12h111.36l101.23-103.77c10.406-10.684 19.828-17.012 28.266-18.98zm47.664 148.48h-96.598v-4.6406h79.305l6.3242-5.4805h5.0625c3.0938 3.6523 5.0625 7.0273 5.9062 10.121zm-5.9062 15.609h-5.0625l-6.3242-5.0625h-79.305v-4.6406h96.598c-0.84375 3.0938-2.8125 6.3281-5.9062 9.7031zm-102.5 9.6992c3.6562 1.4062 7.4531 2.1094 11.391 2.1094h64.961c24.746 0 37.121-8.4336 37.121-25.309 0-8.4375-4.6406-14.691-13.922-18.77-9.2773-4.0781-17.012-6.1172-23.199-6.1172h-64.961c-4.7812 0-8.5781 0.5625-11.391 1.6875h-333.66c-5.0625 0-28.543 1.6172-70.445 4.8516-41.902 3.2344-62.852 7.3828-62.852 12.441v11.812c0 4.5 20.949 8.5078 62.852 12.023 41.902 3.5156 65.383 5.2695 70.445 5.2695zm125.28-207.54h-42.602c-3.375 1.125-3.375 2.25 0 3.375h42.602zm-43.445 8.4375h-5.4844v-13.5h5.4844c17.152-6.1875 33.605-9.9844 49.352-11.391l4.6406-25.309 4.6406 0.42188c0.5625-4.2188 1.6875-10.262 3.375-18.137-28.684-0.5625-64.398 1.6875-107.14 6.75 3.6562 4.2148 7.4531 7.8711 11.391 10.965 4.7812 3.375 9.4219 5.625 13.918 6.75l12.656 2.9531-11.812 5.9062c-13.496 6.75-30.23 10.121-50.195 10.121-5.0625 0-8.5781-0.14062-10.547-0.42188-4.2188-0.5625-7.5898-1.1211-10.121-1.6836l-3.375-1.2656v-5.4844l-24.043-17.297c-41.34 5.625-69.32 8.5781-83.945 8.8594-31.496 0.28125-47.242 11.953-47.242 35.012 0 22.215 15.746 33.887 47.242 35.012 18.844 0.28125 46.824 3.2344 83.945 8.8594l24.043-17.297v-5.4844l3.375-1.2656c2.5312-0.84375 5.9023-1.4062 10.121-1.6875 1.9688-0.28125 5.4844-0.42187 10.547-0.42187 19.965 0 36.699 3.375 50.195 10.125l11.812 5.4844-12.656 3.375c-4.4961 0.84375-9.1367 3.0938-13.918 6.75-3.6562 2.2461-7.4531 5.7617-11.391 10.543 40.777 5.0625 76.492 7.4531 107.14 7.1719-1.6875-7.3125-2.8125-13.359-3.375-18.137h-4.6406l-4.6406-24.891c-17.434-2.25-33.887-6.043-49.352-11.387zm48.508-20.25c-12.652 1.6875-23.762 3.9375-33.324 6.75h29.105l3.7969-4.2188zm-4.2188 20.25h-29.105c9.5625 2.5312 20.672 4.7812 33.324 6.7461l-0.42188-2.5273zm136.67-8.4375c0-8.4375-4.2188-12.656-12.652-12.656h-21.516c-6.4688-12.652-16.59-18.98-30.371-18.98l-58.211-5.0625-5.9062 29.527-4.2188 5.0625v7.5938l4.2188 5.0625 5.9062 29.105 58.211-5.0625c15.469 0 26.012-7.3125 31.637-21.934h20.25c8.4336 0 12.652-4.2188 12.652-12.656zm-46.82 1.6875c0-11.531-5.9062-17.297-17.719-17.297-11.527 0-17.293 5.7656-17.293 17.297 0 11.812 5.7656 17.715 17.293 17.715 11.812 0 17.719-5.9023 17.719-17.715zm4.6406 0c0 14.902-7.4531 22.355-22.359 22.355-14.902 0-22.355-7.4531-22.355-22.355 0-14.906 7.4531-22.355 22.355-22.355 14.906 0 22.359 7.4492 22.359 22.355zm-13.922 0c0-5.625-2.8125-8.4375-8.4375-8.4375-5.3438 0-8.0156 2.8125-8.0156 8.4375s2.6719 8.4375 8.0156 8.4375c5.625 0 8.4375-2.8125 8.4375-8.4375zm4.6406 0c0 8.7188-4.3594 13.078-13.078 13.078-8.4375 0-12.652-4.3594-12.652-13.078s4.2148-13.078 12.652-13.078c8.7188 0 13.078 4.3594 13.078 13.078zm-43.871-2.1094v4.2188h-35.012v-4.2188zm258.58 2.1094c-0.5625-8.4375-4.7812-12.656-12.656-12.656-8.4336 0-12.652 4.2188-12.652 12.656s4.2188 12.656 12.652 12.656c8.4375 0 12.656-4.2188 12.656-12.656zm4.6406 0c0 11.531-5.7656 17.293-17.297 17.293-11.527 0-17.293-5.7617-17.293-17.293s5.7656-17.297 17.293-17.297c11.531 0 17.297 5.7656 17.297 17.297zm32.48 0c0-13.781-4.9219-25.59-14.766-35.434-9.5586-9.5625-21.23-14.344-35.012-14.344-15.184 0-31.777 5.7656-49.773 17.297-18.559 11.531-27.84 22.355-27.84 32.48 0 9.8438 9.2812 20.668 27.84 32.48 17.996 11.531 34.59 17.293 49.773 17.293 13.781 0 25.453-4.918 35.012-14.762 9.8438-9.5625 14.766-21.234 14.766-35.012zm5.0625 0c0 14.902-5.3438 27.699-16.031 38.387-10.684 10.684-23.621 16.027-38.809 16.027-15.746 0-33.18-6.0469-52.305-18.137-20.246-12.656-30.371-24.746-30.371-36.277s10.125-23.762 30.371-36.699c19.125-12.094 36.559-18.137 52.305-18.137 14.625 0 27.562 5.3398 38.809 16.027 10.688 10.969 16.031 23.902 16.031 38.809zm-54.418-29.105c-3.9336 0-10.262 1.6875-18.98 5.0625-7.875 3.9375-11.812 6.4648-11.812 7.5898v32.48c0 3.0938 3.9375 5.625 11.812 7.5938 7.875 3.375 14.203 5.0625 18.98 5.0625 19.406 0 29.391-9.2812 29.953-27.84 0-19.688-9.9844-29.668-29.953-29.949zm34.59 29.105v0.84375c0 21.371-11.527 32.34-34.59 32.902-4.4961 0-11.527-1.8281-21.09-5.4844-7.0312-3.9375-10.969-6.3281-11.809-7.1719-1.6875-1.4062-2.5312-3.0938-2.5312-5.0625v-32.48c0-1.4062 0.70312-2.9492 2.1094-4.6367 3.0898-2.8125 7.168-5.2031 12.23-7.1719 9-3.6562 16.031-5.4844 21.09-5.4844 22.5 0.28125 34.027 11.531 34.59 33.746zm-448.4-206.27h-333.66c-5.0625 0-28.543 1.6875-70.445 5.0625-41.902 3.375-62.852 7.5938-62.852 12.656v11.387c0 4.7812 20.949 8.8594 62.852 12.234 41.902 3.375 65.383 5.0625 70.445 5.0625h333.66c3.6562 1.4062 7.4531 2.1094 11.391 2.1094h64.961c5.3438 0 12.867-2.25 22.566-6.75 9.7031-4.5 14.555-10.547 14.555-18.137 0.28125-16.875-12.094-25.312-37.121-25.312h-64.961c-4.7812 0-8.5781 0.5625-11.391 1.6875z" fill-rule="evenodd"/>
4
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><path d="M91.36 33.566q-6.645-6.623-15.997-6.625-8.439 0-14.761 5.485-6.329 5.484-7.594 13.605l4.465.352Q59.3 46.418 60.18 48h1.582q1.476 0 1.476 1.441 0 1.44-1.476 1.438H60.32q-.843 1.793-2.847 1.863l-4.465.387q1.266 8.085 7.594 13.57t14.761 5.485q9.352 0 15.996-6.645 6.645-6.646 6.645-15.957 0-9.389-6.645-16.012Zm-6.622 15.442a.445.445 0 1 0 .89 0 .445.445 0 0 0-.89 0m-8.71-9.258c0 .246.199.45.445.45a.45.45 0 0 0 .445-.45.445.445 0 1 0-.89 0m-1.04 0c0 .246.2.45.446.45a.45.45 0 0 0 .445-.45.445.445 0 1 0-.89 0m9.75 10.297a.445.445 0 1 0 .89 0 .445.445 0 0 0-.89 0m-8.71 9.305a.445.445 0 1 0 .89 0 .445.445 0 0 0-.89 0m-1.04 0a.445.445 0 1 0 .89 0 .445.445 0 0 0-.89 0M4.32 32.812q1.757-.315 4.22-.492l-3.868-.07ZM45.977 46.91q-1.09-.28-2.356-1.617l-8.437-8.613h-9.278l14.48 10.508v.351q2.708.774 5.59-.633Zm3.972-12.375q-.105.421-.492.809h-.422l-.527-.422h-6.61v-.387Zm-.492-1.336q.387.388.492.844H41.9v-.387h6.609l.527-.457ZM4.32 66.348l.352.562 3.867-.07q-2.812-.282-4.219-.492M45.977 52.25q-2.883-1.44-5.59-.633v.352L25.907 62.48h9.277l8.437-8.648q1.3-1.335 2.356-1.582m3.972 12.375H41.9v-.387h6.609l.527-.457h.422q.387.457.492.844m-.492 1.3h-.422l-.527-.421h-6.61v-.387h8.051q-.105.387-.492.809m-8.543.81q.457.175.95.175h5.413q3.094 0 3.094-2.11 0-1.052-1.16-1.562t-1.934-.511h-5.414q-.598 0-.949.14H13.11q-.633.001-5.87.406-5.24.404-5.239 1.036v.984q0 .561 5.238 1 5.239.44 5.871.441Zm10.441-17.297h-3.55q-.423.14 0 .28h3.55Zm-3.62.703h-.458v-1.125h.457q2.145-.773 4.114-.95l.386-2.109.387.035c.047-.351.14-.851.281-1.508q-3.585-.07-8.93.563.458.523.95.91.597.422 1.16.563l1.055.246-.985.492q-1.688.843-4.183.844-.633 0-.88-.036a10 10 0 0 1-.843-.14l-.281-.106v-.457l-2.004-1.441q-5.162.704-6.992.738-3.938.035-3.938 2.918 0 2.777 3.938 2.918 2.356.036 6.992.738l2.004-1.441v-.457l.281-.106q.316-.105.844-.14.246-.035.879-.035 2.496 0 4.183.843l.985.457-1.055.282q-.563.106-1.16.562-.457.281-.95.88 5.1.631 8.93.597-.21-.915-.28-1.512h-.388l-.386-2.074a20.7 20.7 0 0 1-4.114-.95m4.042-1.688q-1.581.21-2.777.563h2.426l.316-.352Zm-.351 1.688H49q1.196.316 2.777.562l-.035-.21Zm11.386-.703q0-1.055-1.05-1.055h-1.793q-.81-1.582-2.532-1.582l-4.851-.422-.492 2.46-.352.423v.633l.352.421.492 2.426 4.852-.422q1.933 0 2.636-1.828h1.688q1.05 0 1.05-1.054m-3.898.14q0-1.44-1.477-1.441-1.44 0-1.44 1.441 0 1.476 1.44 1.477 1.477 0 1.477-1.477m.387 0q0 1.863-1.864 1.863-1.863 0-1.863-1.863t1.864-1.863 1.863 1.863m-1.16 0q0-.703-.703-.703-.668 0-.668.703t.667.703q.704 0 .704-.703m.386 0q0 1.09-1.09 1.09-1.054 0-1.054-1.09t1.054-1.09q1.09 0 1.09 1.09m-3.656-.176v.352h-2.918v-.352Zm21.547.176q-.07-1.055-1.055-1.055-1.054 0-1.054 1.055t1.054 1.055 1.055-1.055m.387 0q0 1.442-1.442 1.442-1.44 0-1.441-1.442 0-1.44 1.441-1.441 1.442 0 1.442 1.441m2.707 0q0-1.723-1.23-2.953-1.196-1.195-2.919-1.195-1.898 0-4.148 1.441-2.32 1.441-2.32 2.707 0 1.23 2.32 2.707 2.25 1.442 4.148 1.442 1.723 0 2.918-1.23 1.23-1.196 1.23-2.919m.422 0q0 1.863-1.336 3.2-1.337 1.335-3.235 1.335-1.968 0-4.36-1.511-2.53-1.583-2.53-3.024 0-1.44 2.53-3.058c1.595-1.008 3.048-1.508 4.36-1.508 1.219 0 2.297.441 3.235 1.332q1.335 1.371 1.336 3.234m-4.536-2.426q-.492 0-1.582.422-.984.493-.984.633v2.707q0 .387.984.633.985.422 1.582.422 2.427 0 2.497-2.32 0-2.461-2.497-2.497m2.883 2.426v.07q0 2.673-2.883 2.743-.562 0-1.757-.457-.879-.493-.985-.598a.53.53 0 0 1-.21-.422v-2.707q0-.175.175-.387.387-.351 1.02-.597 1.125-.457 1.757-.457 2.813.034 2.883 2.812M40.914 32.391H13.11q-.633 0-5.87.422-5.24.42-5.239 1.054v.95q0 .597 5.238 1.019t5.871.422h27.805q.457.176.95.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.org/2000/svg">
3
+ <path fill="#FFFFFF" d="m1096.3 402.82c-53.148-53.008-117.12-79.516-191.93-79.516-67.488 0-126.55 21.938-177.16 65.805-50.617 43.871-80.988 98.285-91.113 163.25l53.57 4.2188c14.625 0.28125 25.449 6.75 32.48 19.406h18.984c11.809 0 17.715 5.7617 17.715 17.293s-5.9062 17.293-17.715 17.293h-17.297c-6.75 14.344-18.137 21.797-34.168 22.359l-53.57 4.6406c10.125 64.68 40.496 118.95 91.113 162.82 50.617 43.871 109.68 65.805 177.16 65.805 74.805 0 138.78-26.574 191.93-79.723 53.152-53.148 79.727-116.98 79.727-191.51 0-75.086-26.574-139.13-79.727-192.14zm-79.422 185.27c0 2.9531 2.3906 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477 0-2.9492-2.3945-5.3438-5.3477-5.3438-2.9531 0-5.3438 2.3945-5.3438 5.3438zm-104.54-111.07c0 2.9531 2.3945 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477s-2.3945-5.3438-5.3477-5.3438c-2.9492 0-5.3438 2.3906-5.3438 5.3438zm-12.473 0c0 2.9531 2.3906 5.3477 5.3438 5.3477s5.3477-2.3945 5.3477-5.3477-2.3945-5.3438-5.3477-5.3438-5.3438 2.3906-5.3438 5.3438zm117.01 123.55c0 2.9492 2.3906 5.3438 5.3438 5.3438 2.9531 0 5.3477-2.3945 5.3477-5.3438 0-2.9531-2.3945-5.3477-5.3477-5.3477-2.9531 0-5.3438 2.3945-5.3438 5.3477zm-104.54 111.66c0 2.9531 2.3945 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477s-2.3945-5.3438-5.3477-5.3438c-2.9492 0-5.3438 2.3906-5.3438 5.3438zm-12.473 0c0 2.9531 2.3906 5.3477 5.3438 5.3477s5.3477-2.3945 5.3477-5.3477-2.3945-5.3438-5.3477-5.3438-5.3438 2.3906-5.3438 5.3438zm-848-318.48c14.062-2.5312 30.934-4.5 50.621-5.9062l-46.402-0.84375zm499.86 169.15c-8.7188-2.25-18.141-8.7188-28.266-19.402l-101.23-103.35h-111.36l173.79 126.12v4.2188c21.652 6.1836 44.008 3.6562 67.07-7.5938zm47.664-148.48c-0.84375 3.3711-2.8125 6.6055-5.9062 9.6992h-5.0625l-6.3242-5.0625h-79.305v-4.6367zm-5.9062-16.031c3.0938 3.0938 5.0625 6.4688 5.9062 10.125h-96.598v-4.6406h79.305l6.3242-5.4844zm-541.62 397.78 4.2188 6.7461 46.402-0.84375c-22.5-2.2461-39.371-4.2148-50.621-5.9023zm499.86-169.15c-23.062-11.531-45.418-14.062-67.07-7.5938v4.2188l-173.79 126.12h111.36l101.23-103.77c10.406-10.684 19.828-17.012 28.266-18.98zm47.664 148.48h-96.598v-4.6406h79.305l6.3242-5.4805h5.0625c3.0938 3.6523 5.0625 7.0273 5.9062 10.121zm-5.9062 15.609h-5.0625l-6.3242-5.0625h-79.305v-4.6406h96.598c-0.84375 3.0938-2.8125 6.3281-5.9062 9.7031zm-102.5 9.6992c3.6562 1.4062 7.4531 2.1094 11.391 2.1094h64.961c24.746 0 37.121-8.4336 37.121-25.309 0-8.4375-4.6406-14.691-13.922-18.77-9.2773-4.0781-17.012-6.1172-23.199-6.1172h-64.961c-4.7812 0-8.5781 0.5625-11.391 1.6875h-333.66c-5.0625 0-28.543 1.6172-70.445 4.8516-41.902 3.2344-62.852 7.3828-62.852 12.441v11.812c0 4.5 20.949 8.5078 62.852 12.023 41.902 3.5156 65.383 5.2695 70.445 5.2695zm125.28-207.54h-42.602c-3.375 1.125-3.375 2.25 0 3.375h42.602zm-43.445 8.4375h-5.4844v-13.5h5.4844c17.152-6.1875 33.605-9.9844 49.352-11.391l4.6406-25.309 4.6406 0.42188c0.5625-4.2188 1.6875-10.262 3.375-18.137-28.684-0.5625-64.398 1.6875-107.14 6.75 3.6562 4.2148 7.4531 7.8711 11.391 10.965 4.7812 3.375 9.4219 5.625 13.918 6.75l12.656 2.9531-11.812 5.9062c-13.496 6.75-30.23 10.121-50.195 10.121-5.0625 0-8.5781-0.14062-10.547-0.42188-4.2188-0.5625-7.5898-1.1211-10.121-1.6836l-3.375-1.2656v-5.4844l-24.043-17.297c-41.34 5.625-69.32 8.5781-83.945 8.8594-31.496 0.28125-47.242 11.953-47.242 35.012 0 22.215 15.746 33.887 47.242 35.012 18.844 0.28125 46.824 3.2344 83.945 8.8594l24.043-17.297v-5.4844l3.375-1.2656c2.5312-0.84375 5.9023-1.4062 10.121-1.6875 1.9688-0.28125 5.4844-0.42187 10.547-0.42187 19.965 0 36.699 3.375 50.195 10.125l11.812 5.4844-12.656 3.375c-4.4961 0.84375-9.1367 3.0938-13.918 6.75-3.6562 2.2461-7.4531 5.7617-11.391 10.543 40.777 5.0625 76.492 7.4531 107.14 7.1719-1.6875-7.3125-2.8125-13.359-3.375-18.137h-4.6406l-4.6406-24.891c-17.434-2.25-33.887-6.043-49.352-11.387zm48.508-20.25c-12.652 1.6875-23.762 3.9375-33.324 6.75h29.105l3.7969-4.2188zm-4.2188 20.25h-29.105c9.5625 2.5312 20.672 4.7812 33.324 6.7461l-0.42188-2.5273zm136.67-8.4375c0-8.4375-4.2188-12.656-12.652-12.656h-21.516c-6.4688-12.652-16.59-18.98-30.371-18.98l-58.211-5.0625-5.9062 29.527-4.2188 5.0625v7.5938l4.2188 5.0625 5.9062 29.105 58.211-5.0625c15.469 0 26.012-7.3125 31.637-21.934h20.25c8.4336 0 12.652-4.2188 12.652-12.656zm-46.82 1.6875c0-11.531-5.9062-17.297-17.719-17.297-11.527 0-17.293 5.7656-17.293 17.297 0 11.812 5.7656 17.715 17.293 17.715 11.812 0 17.719-5.9023 17.719-17.715zm4.6406 0c0 14.902-7.4531 22.355-22.359 22.355-14.902 0-22.355-7.4531-22.355-22.355 0-14.906 7.4531-22.355 22.355-22.355 14.906 0 22.359 7.4492 22.359 22.355zm-13.922 0c0-5.625-2.8125-8.4375-8.4375-8.4375-5.3438 0-8.0156 2.8125-8.0156 8.4375s2.6719 8.4375 8.0156 8.4375c5.625 0 8.4375-2.8125 8.4375-8.4375zm4.6406 0c0 8.7188-4.3594 13.078-13.078 13.078-8.4375 0-12.652-4.3594-12.652-13.078s4.2148-13.078 12.652-13.078c8.7188 0 13.078 4.3594 13.078 13.078zm-43.871-2.1094v4.2188h-35.012v-4.2188zm258.58 2.1094c-0.5625-8.4375-4.7812-12.656-12.656-12.656-8.4336 0-12.652 4.2188-12.652 12.656s4.2188 12.656 12.652 12.656c8.4375 0 12.656-4.2188 12.656-12.656zm4.6406 0c0 11.531-5.7656 17.293-17.297 17.293-11.527 0-17.293-5.7617-17.293-17.293s5.7656-17.297 17.293-17.297c11.531 0 17.297 5.7656 17.297 17.297zm32.48 0c0-13.781-4.9219-25.59-14.766-35.434-9.5586-9.5625-21.23-14.344-35.012-14.344-15.184 0-31.777 5.7656-49.773 17.297-18.559 11.531-27.84 22.355-27.84 32.48 0 9.8438 9.2812 20.668 27.84 32.48 17.996 11.531 34.59 17.293 49.773 17.293 13.781 0 25.453-4.918 35.012-14.762 9.8438-9.5625 14.766-21.234 14.766-35.012zm5.0625 0c0 14.902-5.3438 27.699-16.031 38.387-10.684 10.684-23.621 16.027-38.809 16.027-15.746 0-33.18-6.0469-52.305-18.137-20.246-12.656-30.371-24.746-30.371-36.277s10.125-23.762 30.371-36.699c19.125-12.094 36.559-18.137 52.305-18.137 14.625 0 27.562 5.3398 38.809 16.027 10.688 10.969 16.031 23.902 16.031 38.809zm-54.418-29.105c-3.9336 0-10.262 1.6875-18.98 5.0625-7.875 3.9375-11.812 6.4648-11.812 7.5898v32.48c0 3.0938 3.9375 5.625 11.812 7.5938 7.875 3.375 14.203 5.0625 18.98 5.0625 19.406 0 29.391-9.2812 29.953-27.84 0-19.688-9.9844-29.668-29.953-29.949zm34.59 29.105v0.84375c0 21.371-11.527 32.34-34.59 32.902-4.4961 0-11.527-1.8281-21.09-5.4844-7.0312-3.9375-10.969-6.3281-11.809-7.1719-1.6875-1.4062-2.5312-3.0938-2.5312-5.0625v-32.48c0-1.4062 0.70312-2.9492 2.1094-4.6367 3.0898-2.8125 7.168-5.2031 12.23-7.1719 9-3.6562 16.031-5.4844 21.09-5.4844 22.5 0.28125 34.027 11.531 34.59 33.746zm-448.4-206.27h-333.66c-5.0625 0-28.543 1.6875-70.445 5.0625-41.902 3.375-62.852 7.5938-62.852 12.656v11.387c0 4.7812 20.949 8.8594 62.852 12.234 41.902 3.375 65.383 5.0625 70.445 5.0625h333.66c3.6562 1.4062 7.4531 2.1094 11.391 2.1094h64.961c5.3438 0 12.867-2.25 22.566-6.75 9.7031-4.5 14.555-10.547 14.555-18.137 0.28125-16.875-12.094-25.312-37.121-25.312h-64.961c-4.7812 0-8.5781 0.5625-11.391 1.6875z" fill-rule="evenodd"/>
4
+ </svg>