@warp-drive/ember 5.6.0-alpha.1 → 5.6.0-alpha.3
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/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/-private/await.gts","../../../node_modules/.pnpm/decorat_bfe8edbefc8aced6f61ce140cd72ecf2/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js","../src/-private/request.gts"],"sourcesContent":["/**\n * @module @warp-drive/ember\n */\nimport type Owner from '@ember/owner';\nimport Component from '@glimmer/component';\n\nimport type { Awaitable } from '@ember-data/request';\nimport { getPromiseState } from '@ember-data/store/-private';\n\nexport const and = (x: unknown, y: unknown) => Boolean(x && y);\ninterface ThrowSignature<E = Error | string | object> {\n Args: {\n error: E;\n };\n}\n\n/**\n * The `<Throw />` component is used to throw an error in a template.\n *\n * That's all it does. So don't use it unless the application should\n * throw an error if it reaches this point in the template.\n *\n * ```hbs\n * <Throw @error={{anError}} />\n * ```\n *\n * @class <Throw />\n * @public\n */\nexport class Throw<T> extends Component<ThrowSignature<T>> {\n constructor(owner: Owner, args: ThrowSignature<T>['Args']) {\n super(owner, args);\n // this error is opaque (user supplied) so we don't validate it\n // as an Error instance.\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw this.args.error;\n }\n <template></template>\n}\n\ninterface AwaitSignature<T, E = Error | string | object> {\n Args: {\n promise: Promise<T> | Awaitable<T, E>;\n };\n Blocks: {\n pending: [];\n error: [error: E];\n success: [value: T];\n };\n}\n\n/**\n * The <Await /> component allow you to utilize reactive control flow\n * for asynchronous states in your application.\n *\n * Await is ideal for handling \"boundaries\", outside which some state is\n * still allowed to be unresolved and within which it MUST be resolved.\n *\n * ```gjs\n * import { Await } from '@warp-drive/ember';\n *\n * <template>\n * <Await @promise={{@request}}>\n * <:pending>\n * <Spinner />\n * </:pending>\n *\n * <:error as |error|>\n * <ErrorForm @error={{error}} />\n * </:error>\n *\n * <:success as |result|>\n * <h1>{{result.title}}</h1>\n * </:success>\n * </Await>\n * </template>\n * ```\n *\n * The <Await /> component requires that error states are properly handled.\n *\n * If no error block is provided and the promise rejects, the error will\n * be thrown.\n *\n * @class <Await />\n * @public\n */\nexport class Await<T, E> extends Component<AwaitSignature<T, E>> {\n get state() {\n return getPromiseState<T, E>(this.args.promise);\n }\n\n get error() {\n return this.state.error as E;\n }\n\n get result() {\n return this.state.result as T;\n }\n\n <template>\n {{#if this.state.isPending}}\n {{yield to=\"pending\"}}\n {{else if (and this.state.isError (has-block \"error\"))}}\n {{yield this.error to=\"error\"}}\n {{else if this.state.isSuccess}}\n {{yield this.result to=\"success\"}}\n {{else}}\n <Throw @error={{this.error}} />\n {{/if}}\n </template>\n}\n","const deferred = /* @__PURE__ */ new WeakMap();\nfunction deferDecorator(proto, prop, desc) {\n let map = deferred.get(proto);\n if (!map) {\n map = /* @__PURE__ */ new Map();\n deferred.set(proto, map);\n }\n map.set(prop, desc);\n}\nfunction findDeferredDecorator(target, prop) {\n var _a;\n let cursor = target.prototype;\n while (cursor) {\n let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);\n if (desc) {\n return desc;\n }\n cursor = cursor.prototype;\n }\n}\nfunction decorateFieldV1(target, prop, decorators, initializer) {\n return decorateFieldV2(target.prototype, prop, decorators, initializer);\n}\nfunction decorateFieldV2(prototype, prop, decorators, initializer) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n };\n if (initializer) {\n desc.initializer = initializer;\n }\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(prototype, prop, desc);\n } else {\n deferDecorator(prototype, prop, desc);\n }\n}\nfunction decorateMethodV1({ prototype }, prop, decorators) {\n return decorateMethodV2(prototype, prop, decorators);\n}\nfunction decorateMethodV2(prototype, prop, decorators) {\n const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);\n let desc = { ...origDesc };\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;\n desc.initializer = void 0;\n }\n Object.defineProperty(prototype, prop, desc);\n}\nfunction initializeDeferredDecorator(target, prop) {\n let desc = findDeferredDecorator(target.constructor, prop);\n if (desc) {\n Object.defineProperty(target, prop, {\n enumerable: desc.enumerable,\n configurable: desc.configurable,\n writable: desc.writable,\n value: desc.initializer ? desc.initializer.call(target) : void 0\n });\n }\n}\nfunction decorateClass(target, decorators) {\n return decorators.reduce(\n (accum, decorator) => decorator(accum) || accum,\n target\n );\n}\nfunction decoratePOJO(pojo, decorated) {\n for (let [type, prop, decorators] of decorated) {\n if (type === \"field\") {\n decoratePojoField(pojo, prop, decorators);\n } else {\n decorateMethodV2(pojo, prop, decorators);\n }\n }\n return pojo;\n}\nfunction decoratePojoField(pojo, prop, decorators) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: () => {\n var _a;\n return (_a = Object.getOwnPropertyDescriptor(pojo, prop)) == null ? void 0 : _a.value;\n }\n };\n for (let decorator of decorators) {\n desc = decorator(pojo, prop, desc) || desc;\n }\n if (desc.initializer) {\n desc.value = desc.initializer.call(pojo);\n delete desc.initializer;\n }\n Object.defineProperty(pojo, prop, desc);\n}\nconst runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n c: decorateClass,\n f: decorateFieldV1,\n g: decorateFieldV2,\n i: initializeDeferredDecorator,\n m: decorateMethodV1,\n n: decorateMethodV2,\n p: decoratePOJO\n}, Symbol.toStringTag, { value: \"Module\" }));\nexport {\n decorateFieldV2 as a,\n decorateMethodV1 as b,\n decorateMethodV2 as c,\n decorateFieldV1 as d,\n decorateClass as e,\n decoratePOJO as f,\n initializeDeferredDecorator as i,\n runtime as r\n};\n//# sourceMappingURL=runtime-BPCpkOf1.js.map\n","/**\n * @module @warp-drive/ember\n */\nimport type Owner from '@ember/owner';\nimport { service } from '@ember/service';\nimport Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\n\nimport { importSync, macroCondition, moduleExists } from '@embroider/macros';\n\nimport type { Future, StructuredErrorDocument } from '@ember-data/request';\nimport type { StoreRequestInput } from '@ember-data/store';\nimport type Store from '@ember-data/store';\nimport type { RequestLoadingState, RequestState } from '@ember-data/store/-private';\nimport { getRequestState } from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableDocumentIdentifier } from '@warp-drive/core-types/identifier.js';\nimport { EnableHydration, type RequestInfo } from '@warp-drive/core-types/request';\n\nimport { and, Throw } from './await.gts';\n\nfunction notNull(x: null): never;\nfunction notNull<T>(x: T): Exclude<T, null>;\nfunction notNull<T>(x: T | null) {\n assert('Expected a non-null value, but got null', x !== null);\n return x;\n}\n\nconst not = (x: unknown) => !x;\n// default to 30 seconds unavailable before we refresh\nconst DEFAULT_DEADLINE = 30_000;\nconst IdleBlockMissingError = new Error(\n 'No idle block provided for <Request> component, and no query or request was provided.'\n);\n\nlet consume = service;\nif (macroCondition(moduleExists('ember-provide-consume-context'))) {\n const { consume: contextConsume } = importSync('ember-provide-consume-context') as { consume: typeof service };\n consume = contextConsume;\n}\n\nfunction isNeverString(val: never): string {\n return val;\n}\n\ntype AutorefreshBehaviorType = 'online' | 'interval' | 'invalid';\ntype AutorefreshBehaviorCombos =\n | boolean\n | AutorefreshBehaviorType\n | `${AutorefreshBehaviorType},${AutorefreshBehaviorType}`\n | `${AutorefreshBehaviorType},${AutorefreshBehaviorType},${AutorefreshBehaviorType}`;\n\ntype ContentFeatures<RT> = {\n isOnline: boolean;\n isHidden: boolean;\n isRefreshing: boolean;\n refresh: () => Promise<void>;\n reload: () => Promise<void>;\n abort?: () => void;\n latestRequest?: Future<RT>;\n};\n\ninterface RequestSignature<T, RT, E> {\n Args: {\n /**\n * The request to monitor. This should be a `Future` instance returned\n * by either the `store.request` or `store.requestManager.request` methods.\n *\n * @typedoc\n */\n request?: Future<RT>;\n\n /**\n * A query to use for the request. This should be an object that can be\n * passed to `store.request`. Use this in place of `@request` if you would\n * like the component to also initiate the request.\n *\n * @typedoc\n */\n query?: StoreRequestInput<T, RT>;\n\n /**\n * The store instance to use for making requests. If contexts are available,\n * the component will default to using the `store` on the context.\n *\n * This is required if the store is not available via context or should be\n * different from the store provided via context.\n *\n * @typedoc\n */\n store?: Store;\n\n /**\n * The autorefresh behavior for the request. This can be a boolean, or any\n * combination of the following values: `'online'`, `'interval'`, `'invalid'`.\n *\n * - `'online'`: Refresh the request when the browser comes back online\n * - `'interval'`: Refresh the request at a specified interval\n * - `'invalid'`: Refresh the request when the store emits an invalidation\n *\n * If `true`, this is equivalent to `'online,invalid'`.\n *\n * Defaults to `false`.\n *\n * @typedoc\n */\n autorefresh?: AutorefreshBehaviorCombos;\n\n /**\n * The number of milliseconds to wait before refreshing the request when the\n * browser comes back online or the network becomes available.\n *\n * This also controls the interval at which the request will be refreshed if\n * the `interval` autorefresh type is enabled.\n *\n * Defaults to `30_000` (30 seconds).\n *\n * @typedoc\n */\n autorefreshThreshold?: number;\n\n /**\n * The behavior of the request initiated by autorefresh. This can be one of\n * the following values:\n *\n * - `'refresh'`: Refresh the request in the background\n * - `'reload'`: Force a reload of the request\n * - `'policy'` (**default**): Let the store's configured CachePolicy decide whether to\n * reload, refresh, or do nothing.\n *\n * Defaults to `'policy'`.\n *\n * @typedoc\n */\n autorefreshBehavior?: 'refresh' | 'reload' | 'policy';\n };\n Blocks: {\n /**\n * The block to render when the component is idle and waiting to be given a request.\n *\n * @typedoc\n */\n idle: [];\n\n /**\n * The block to render when the request is loading.\n *\n * @typedoc\n */\n loading: [state: RequestLoadingState];\n\n /**\n * The block to render when the request was cancelled.\n *\n * @typedoc\n */\n cancelled: [\n error: StructuredErrorDocument<E>,\n features: { isOnline: boolean; isHidden: boolean; retry: () => Promise<void> },\n ];\n\n /**\n * The block to render when the request failed. If this block is not provided,\n * the error will be rethrown.\n *\n * Thus it is required to provide an error block and proper error handling if\n * you do not want the error to crash the application.\n *\n * @typedoc\n */\n error: [\n error: StructuredErrorDocument<E>,\n features: { isOnline: boolean; isHidden: boolean; retry: () => Promise<void> },\n ];\n\n /**\n * The block to render when the request succeeded.\n *\n * @typedoc\n */\n content: [value: RT, features: ContentFeatures<RT>];\n always: [state: RequestState<T, RT, StructuredErrorDocument<E>>];\n };\n}\n\n/**\n * The `<Request />` component is a powerful tool for managing data fetching and\n * state in your Ember application. It provides a declarative approach to reactive\n * control-flow for managing requests and state in your application.\n *\n * The `<Request />` component is ideal for handling \"boundaries\", outside which some\n * state is still allowed to be unresolved and within which it MUST be resolved.\n *\n * ## Request States\n *\n * `<Request />` has five states, only one of which will be active and rendered at a time.\n *\n * - `idle`: The component is waiting to be given a request to monitor\n * - `loading`: The request is in progress\n * - `error`: The request failed\n * - `content`: The request succeeded\n * - `cancelled`: The request was cancelled\n *\n * Additionally, the `content` state has a `refresh` method that can be used to\n * refresh the request in the background, which is available as a sub-state of\n * the `content` state.\n *\n * As with the `<Await />` component, if no error block is provided and the request\n * rejects, the error will be thrown. Cancellation errors are swallowed instead of\n * rethrown if no error block or cancellation block is present.\n *\n * ```gts\n * import { Request } from '@warp-drive/ember';\n *\n * <template>\n * <Request @request={{@request}}>\n * <:loading as |state|>\n * <Spinner @percentDone={{state.completedRatio}} />\n * <button {{on \"click\" state.abort}}>Cancel</button>\n * </:loading>\n *\n * <:error as |error state|>\n * <ErrorForm @error={{error}} />\n * <button {{on \"click\" state.retry}}>Retry</button>\n * </:error>\n *\n * <:content as |data state|>\n * <h1>{{data.title}}</h1>\n * {{#if state.isBackgroundReloading}}\n * <SmallSpinner />\n * <button {{on \"click\" state.abort}}>Cancel</button>\n * {{else}}\n * <button {{on \"click\" state.refresh}}>Refresh</button>\n * {{/if}}\n * </:content>\n *\n * <:cancelled as |error state|>\n * <h2>The Request was cancelled</h2>\n * <button {{on \"click\" state.retry}}>Retry</button>\n * </:cancelled>\n *\n * <:idle>\n * <button {{on \"click\" @kickOffRequest}}>Load Preview?</button>\n * </:idle>\n *\n * </Request>\n * </template>\n * ```\n *\n * ## Streaming Data\n *\n * The loading state exposes the download `ReadableStream` instance for consumption\n *\n * ```gjs\n * import { Request } from '@warp-drive/ember';\n *\n * <template>\n * <Request @request={{@request}}>\n * <:loading as |state|>\n * <Video @stream={{state.stream}} />\n * </:loading>\n *\n * <:error as |error|>\n * <ErrorForm @error={{error}} />\n * </:error>\n * </Request>\n * </template>\n * ```\n *\n * ## Retry\n *\n * Cancelled and error'd requests may be retried by calling the `retry` method.\n *\n * Retry will restart the state progression, using the loading, error, cancelled,\n * and content blocks as appropriate.\n *\n * ## Reloading\n *\n * The `reload` method will force the request to be fully re-executed, bypassing\n * cache and restarting the state progression through the loading, error, and\n * content blocks as appropriate.\n *\n * Background reload (refresh) is a special substate of the content state that\n * allows you to refresh the request in the background. This is useful for when\n * you want to update the data in the background without blocking the UI.\n *\n * Reload and refresh are available as methods on the `content` state.\n *\n * ```gjs\n * import { Request } from '@warp-drive/ember';\n *\n * <template>\n * <Request @request={{@request}}>\n * <:content as |data state|>\n * <h1>{{data.title}}</h1>\n * {{#if state.isBackgroundReloading}}\n * <SmallSpinner />\n * <button {{on \"click\" state.abort}}>Cancel</button>\n * {{/if}}\n *\n * <button {{on \"click\" state.refresh}}>Refresh</button>\n * <button {{on \"click\" state.reload}}>Reload</button>\n * </:content>\n * </Request>\n * </template>\n * ```\n *\n * ## Advanced Reloading\n *\n * We can nest our usage of `<Request />` to handle more advanced\n * reloading scenarios.\n *\n * ```gjs\n * import { Request } from '@warp-drive/ember';\n *\n * <template>\n * <Request @request={{@request}}>\n * <:cancelled>\n * <h2>The Request Cancelled</h2>\n * </:cancelled>\n *\n * <:error as |error|>\n * <ErrorForm @error={{error}} />\n * </:error>\n *\n * <:content as |result state|>\n * <Request @request={{state.latestRequest}}>\n * <!-- Handle Background Request -->\n * </Request>\n *\n * <h1>{{result.title}}</h1>\n *\n * <button {{on \"click\" state.refresh}}>Refresh</button>\n * </:content>\n * </Request>\n * </template>\n * ```\n *\n * ## Autorefresh\n *\n * `<Request />` supports automatic refresh and reload under certain conditions.\n *\n * - `online`: This occurs when a browser window or tab comes back to the foreground\n * after being backgrounded or when the network reports as being online after\n * having been offline.\n * - `interval`: This occurs when a specified amount of time has passed.\n * - `invalid`: This occurs when the store emits a notification that the request\n * has become invalid.\n *\n * You can specify when autorefresh should occur by setting the `autorefresh` arg\n * to `true` or a comma-separated list of the above values.\n *\n * A value of `true` is equivalent to `'online,invalid'`.\n *\n * By default, an autorefresh will only occur if the browser was backgrounded or\n * offline for more than 30s before coming back available. This amount of time can\n * be tweaked by setting the number of milliseconds via `@autorefreshThreshold`.\n *\n * This arg also controls the interval at which the request will be refreshed\n * if the `interval` autorefresh type is enabled.\n *\n * Finally, the behavior of the request initiated by autorefresh can be adjusted\n * by setting the `autorefreshBehavior` arg to `'refresh'`, `'reload'`, or `'policy'`.\n *\n * - `'refresh'`: Refresh the request in the background\n * - `'reload'`: Force a reload of the request\n * - `'policy'` (**default**): Let the store's configured CachePolicy decide whether to\n * reload, refresh, or do nothing.\n *\n * More advanced refresh and reload behaviors can be created by passing the reload and\n * refresh actions into another component. For instance, refresh could be set up on a\n * timer or on a websocket subscription.\n *\n *\n * ```gjs\n * import { Request } from '@warp-drive/ember';\n *\n * <template>\n * <Request @request={{@request}}>\n * <:content as |result state|>\n * <h1>{{result.title}}</h1>\n *\n * <Interval @period={{30_000}} @fn={{state.refresh}} />\n * <Subscribe @channel={{@someValue}} @fn={{state.refresh}} />\n * </:content>\n * </Request>\n * </template>\n * ```\n *\n * If a matching request is refreshed or reloaded by any other component,\n * the `Request` component will react accordingly.\n *\n * ## Deduping\n *\n * The store dedupes requests by identity. If a request is made for the same identity\n * from multiple `<Request />` components, even if the request is not referentially the\n * same, only one actual request will be made.\n *\n *\n * @class <Request />\n * @public\n */\nexport class Request<T, RT, E> extends Component<RequestSignature<T, RT, E>> {\n /**\n * The store instance to use for making requests. If contexts are available, this\n * will be the `store` on the context, else it will be the store service.\n *\n * @internal\n */\n @consume('store') declare _store: Store;\n\n /**\n * Whether the browser reports that the network is online.\n *\n * @internal\n */\n @tracked isOnline = true;\n\n /**\n * Whether the browser reports that the tab is hidden.\n *\n * @internal\n */\n @tracked isHidden = true;\n\n /**\n * Whether the component is currently refreshing the request.\n *\n * @internal\n */\n @tracked isRefreshing = false;\n\n /**\n * The most recent blocking request that was made, typically\n * the result of a reload.\n *\n * This will never be the original request passed as an arg to\n * the component.\n *\n * @internal\n */\n @tracked _localRequest: Future<RT> | undefined;\n\n /**\n * The most recent request that was made, typically due to either a\n * reload or a refresh.\n *\n * This will never be the original request passed as an arg to\n * the component.\n *\n * @internal\n */\n @tracked _latestRequest: Future<RT> | undefined;\n\n /**\n * The time at which the network was reported as offline.\n *\n * @internal\n */\n declare unavailableStart: number | null;\n declare intervalStart: number | null;\n declare nextInterval: number | null;\n declare invalidated: boolean;\n declare isUpdating: boolean;\n\n /**\n * The event listener for network status changes,\n * cached to use the reference for removal.\n *\n * @internal\n */\n declare onlineChanged: (event: Event) => void;\n\n /**\n * The event listener for visibility status changes,\n * cached to use the reference for removal.\n *\n * @internal\n */\n declare backgroundChanged: (event: Event) => void;\n\n /**\n * The last request passed as an arg to the component,\n * cached for comparison.\n *\n * @internal\n */\n declare _originalRequest: Future<RT> | undefined;\n\n /**\n * The last query passed as an arg to the component,\n * cached for comparison.\n *\n * @internal\n */\n declare _originalQuery: StoreRequestInput<T, RT> | undefined;\n\n declare _subscription: object | null;\n declare _subscribedTo: object | null;\n\n constructor(owner: Owner, args: RequestSignature<T, RT, E>['Args']) {\n super(owner, args);\n this._subscribedTo = null;\n this._subscription = null;\n this.intervalStart = null;\n this.invalidated = false;\n this.nextInterval = null;\n\n this.installListeners();\n void this.beginPolling();\n }\n\n async beginPolling() {\n // await the initial request\n try {\n await this.request;\n } catch {\n // ignore errors here, we just want to wait for the request to finish\n } finally {\n if (!this.isDestroyed) {\n void this.scheduleInterval();\n }\n }\n }\n\n @cached\n get isIdle() {\n const { request, query } = this.args;\n\n return Boolean(!request && !query);\n }\n\n @cached\n get autorefreshTypes(): Set<AutorefreshBehaviorType> {\n const { autorefresh } = this.args;\n let types: AutorefreshBehaviorType[];\n\n if (autorefresh === true) {\n types = ['online', 'invalid'];\n } else if (typeof autorefresh === 'string') {\n types = autorefresh.split(',') as AutorefreshBehaviorType[];\n } else {\n types = [];\n }\n\n return new Set(types);\n }\n\n // we only run this function on component creation\n // and when an update is triggered, so it does not\n // react to changes in the autorefreshThreshold\n // or autorefresh args.\n //\n // if we need to react to those changes, we can\n // use a modifier or internal component or some\n // such to trigger a re-run of this function.\n async scheduleInterval() {\n const { autorefreshThreshold } = this.args;\n const hasValidThreshold = typeof autorefreshThreshold === 'number' && autorefreshThreshold > 0;\n if (\n // dont schedule in SSR\n typeof window === 'undefined' ||\n // dont schedule without a threshold\n !hasValidThreshold ||\n // dont schedule if we weren't told to\n !this.autorefreshTypes.has('interval') ||\n // dont schedule if we're already scheduled\n this.intervalStart !== null\n ) {\n return;\n }\n\n // if we have a current request, wait for it to finish\n // before scheduling the next one\n if (this._latestRequest) {\n try {\n await this._latestRequest;\n } catch {\n // ignore errors here, we just want to wait for the request to finish\n }\n\n if (this.isDestroyed) {\n return;\n }\n }\n\n // setup the next interval\n this.intervalStart = Date.now();\n this.nextInterval = setTimeout(() => {\n this.maybeUpdate();\n }, autorefreshThreshold) as unknown as number;\n }\n\n clearInterval() {\n if (this.nextInterval) {\n clearTimeout(this.nextInterval);\n this.intervalStart = null;\n }\n }\n\n updateSubscriptions() {\n if (this.isIdle) {\n return;\n }\n const requestId = this._request.lid;\n\n // if we're already subscribed to this request, we don't need to do anything\n if (this._subscribedTo === requestId) {\n return;\n }\n\n // if we're subscribed to a different request, we need to unsubscribe\n this.removeSubscriptions();\n\n // if we have a request, we need to subscribe to it\n if (requestId) {\n this._subscribedTo = requestId;\n this._subscription = this.store.notifications.subscribe(\n requestId,\n (_id: StableDocumentIdentifier, op: 'invalidated' | 'state' | 'added' | 'updated' | 'removed') => {\n // ignore subscription events that occur while our own component's request\n // is ocurring\n if (this.isUpdating) {\n return;\n }\n switch (op) {\n case 'invalidated': {\n // if we're subscribed to invalidations, we need to update\n if (this.autorefreshTypes.has('invalid')) {\n this.invalidated = true;\n this.maybeUpdate();\n }\n break;\n }\n case 'state': {\n const latest = this.store.requestManager._deduped.get(requestId);\n const priority = latest?.priority;\n const state = this.reqState;\n if (!priority) {\n // if there is no priority, we have completed whatever request\n // was occurring and so we are no longer refreshing (if we were)\n this.isRefreshing = false;\n } else if (priority.blocking && !state.isLoading) {\n // if we are blocking, there is an active request for this identity\n // that MUST be fulfilled from network (not cache).\n // Thus this is not \"refreshing\" because we should clear out and\n // block on this request.\n //\n // we receive state notifications when either a request initiates\n // or completes.\n //\n // In the completes case: we may receive the state notification\n // slightly before the request is finalized because the NotificationManager\n // may sync flush it (and thus deliver it before the microtask completes)\n //\n // In the initiates case: we aren't supposed to receive one unless there\n // is no other request in flight for this identity.\n //\n // However, there is a race condition here where the completed\n // notification can trigger an update that generates a new request\n // thus giving us an initiated notification before the older request\n // finalizes.\n //\n // When this occurs, if the triggered update happens to have caused\n // a new request to be made for the same identity AND that request\n // is the one passed into this component as the @request arg, then\n // getRequestState will return the state of the new request.\n // We can detect this by checking if the request state is \"loading\"\n // as outside of this case we would have a completed request.\n //\n // That is the reason for the `&& !state.isLoading` check above.\n\n // TODO should we just treat this as refreshing?\n this.isRefreshing = false;\n this.maybeUpdate('policy', true);\n } else {\n this.isRefreshing = true;\n }\n }\n }\n }\n );\n }\n }\n\n removeSubscriptions() {\n if (this._subscription) {\n this.store.notifications.unsubscribe(this._subscription);\n this._subscribedTo = null;\n this._subscription = null;\n }\n }\n\n /**\n * Install the event listeners for network and visibility changes.\n * This is only done in browser environments with a global `window`.\n *\n * @internal\n */\n installListeners() {\n if (typeof window === 'undefined') {\n return;\n }\n\n this.isOnline = window.navigator.onLine;\n this.unavailableStart = this.isOnline ? null : Date.now();\n this.isHidden = document.visibilityState === 'hidden';\n\n this.onlineChanged = (event: Event) => {\n this.isOnline = event.type === 'online';\n if (event.type === 'offline' && this.unavailableStart === null) {\n this.unavailableStart = Date.now();\n }\n this.maybeUpdate();\n };\n this.backgroundChanged = () => {\n const isHidden = document.visibilityState === 'hidden';\n this.isHidden = isHidden;\n\n if (isHidden && this.unavailableStart === null) {\n this.unavailableStart = Date.now();\n }\n\n this.maybeUpdate();\n };\n\n window.addEventListener('online', this.onlineChanged, { passive: true, capture: true });\n window.addEventListener('offline', this.onlineChanged, { passive: true, capture: true });\n document.addEventListener('visibilitychange', this.backgroundChanged, { passive: true, capture: true });\n }\n\n /**\n * If the network is online and the tab is visible, either reload or refresh the request\n * based on the component's configuration and the requested update mode.\n *\n * Valid modes are:\n *\n * - `'reload'`: Force a reload of the request.\n * - `'refresh'`: Refresh the request in the background.\n * - `'policy'`: Make the request, letting the store's configured CachePolicy decide whether to reload, refresh, or do nothing.\n * - `undefined`: Make the request using the component's autorefreshBehavior setting if the autorefreshThreshold has passed.\n *\n * @internal\n */\n maybeUpdate(mode?: 'reload' | 'refresh' | 'policy' | 'invalidated', silent?: boolean): void {\n if (this.isIdle) {\n return;\n }\n const canAttempt = Boolean(this.isOnline && !this.isHidden && (mode || this.autorefreshTypes.size));\n\n if (!canAttempt) {\n if (!silent && mode && mode !== 'invalidated') {\n throw new Error(`Reload not available: the network is not online or the tab is hidden`);\n }\n\n return;\n }\n\n const { autorefreshTypes } = this;\n let shouldAttempt = this.invalidated || Boolean(mode);\n\n if (!shouldAttempt && autorefreshTypes.has('online')) {\n const { unavailableStart } = this;\n const { autorefreshThreshold } = this.args;\n const deadline = typeof autorefreshThreshold === 'number' ? autorefreshThreshold : DEFAULT_DEADLINE;\n shouldAttempt = Boolean(unavailableStart && Date.now() - unavailableStart > deadline);\n }\n\n if (!shouldAttempt && autorefreshTypes.has('interval')) {\n const { intervalStart } = this;\n const { autorefreshThreshold } = this.args;\n\n if (intervalStart && typeof autorefreshThreshold === 'number' && autorefreshThreshold > 0) {\n shouldAttempt = Boolean(Date.now() - intervalStart >= autorefreshThreshold);\n }\n }\n\n this.unavailableStart = null;\n this.invalidated = false;\n\n if (shouldAttempt) {\n this.clearInterval();\n const request = Object.assign({}, this.reqState.request as unknown as RequestInfo<T, RT>);\n const realMode = mode === 'invalidated' ? null : mode;\n const val = realMode ?? this.args.autorefreshBehavior ?? 'policy';\n switch (val) {\n case 'reload':\n request.cacheOptions = Object.assign({}, request.cacheOptions, { reload: true });\n break;\n case 'refresh':\n request.cacheOptions = Object.assign({}, request.cacheOptions, { backgroundReload: true });\n break;\n case 'policy':\n break;\n default:\n throw new Error(\n `Invalid ${mode ? 'update mode' : '@autorefreshBehavior'} for <Request />: ${isNeverString(val)}`\n );\n }\n\n const wasStoreRequest = request[EnableHydration] === true;\n assert(\n `Cannot supply a different store via context than was used to create the request`,\n !request.store || request.store === this.store\n );\n\n this.isUpdating = true;\n this._latestRequest = wasStoreRequest ? this.store.request(request) : this.store.requestManager.request(request);\n\n if (val !== 'refresh') {\n this._localRequest = this._latestRequest;\n }\n\n void this.scheduleInterval();\n void this._latestRequest.finally(() => {\n this.isUpdating = false;\n });\n } else {\n // TODO probably want this\n // void this.scheduleInterval();\n }\n }\n\n /**\n * Retry the request, reloading it from the server.\n *\n * @internal\n */\n retry = async () => {\n this.maybeUpdate('reload');\n await this._localRequest;\n };\n\n /**\n * Refresh the request, updating it in the background.\n *\n * @internal\n */\n refresh = async () => {\n this.maybeUpdate('refresh');\n await this._latestRequest;\n };\n\n @cached\n get errorFeatures() {\n return {\n isHidden: this.isHidden,\n isOnline: this.isOnline,\n retry: this.retry,\n };\n }\n\n @cached\n get contentFeatures() {\n const feat: ContentFeatures<RT> = {\n isHidden: this.isHidden,\n isOnline: this.isOnline,\n reload: this.retry,\n refresh: this.refresh,\n isRefreshing: this.isRefreshing,\n latestRequest: this._latestRequest,\n };\n\n if (feat.isRefreshing) {\n feat.abort = () => {\n this._latestRequest?.abort();\n };\n }\n\n return feat;\n }\n\n willDestroy() {\n this.removeSubscriptions();\n\n if (typeof window === 'undefined') {\n return;\n }\n\n this.clearInterval();\n\n window.removeEventListener('online', this.onlineChanged, { passive: true, capture: true } as unknown as boolean);\n window.removeEventListener('offline', this.onlineChanged, { passive: true, capture: true } as unknown as boolean);\n document.removeEventListener('visibilitychange', this.backgroundChanged, {\n passive: true,\n capture: true,\n } as unknown as boolean);\n }\n\n @cached\n get _request(): Future<RT> {\n const { request, query } = this.args;\n assert(`Cannot use both @request and @query args with the <Request> component`, !request || !query);\n const { _localRequest, _originalRequest, _originalQuery } = this;\n const isOriginalRequest = request === _originalRequest && query === _originalQuery;\n\n if (_localRequest && isOriginalRequest) {\n return _localRequest;\n }\n\n // update state checks for the next time\n this._originalQuery = query;\n this._originalRequest = request;\n\n if (request) {\n return request;\n }\n assert(`You must provide either @request or an @query arg with the <Request> component`, query);\n return this.store.request<RT, T>(query);\n }\n\n @cached\n get request(): Future<RT> {\n const request = this._request;\n this.updateSubscriptions();\n return request;\n }\n\n get store(): Store {\n const store = this.args.store || this._store;\n assert(\n moduleExists('ember-provide-consume-context')\n ? `No store was provided to the <Request> component. Either provide a store via the @store arg or via the context API provided by ember-provide-consume-context.`\n : `No store was provided to the <Request> component. Either provide a store via the @store arg or by registering a store service.`,\n store\n );\n return store;\n }\n\n get reqState() {\n return getRequestState<RT, T, E>(this.request);\n }\n\n get result() {\n return this.reqState.result as RT;\n }\n\n <template>\n {{#if (and this.isIdle (has-block \"idle\"))}}\n {{yield to=\"idle\"}}\n {{else if this.isIdle}}\n <Throw @error={{IdleBlockMissingError}} />\n {{else if this.reqState.isLoading}}\n {{yield this.reqState.loadingState to=\"loading\"}}\n {{else if (and this.reqState.isCancelled (has-block \"cancelled\"))}}\n {{yield (notNull this.reqState.error) this.errorFeatures to=\"cancelled\"}}\n {{else if (and this.reqState.isError (has-block \"error\"))}}\n {{yield (notNull this.reqState.error) this.errorFeatures to=\"error\"}}\n {{else if this.reqState.isSuccess}}\n {{yield this.result this.contentFeatures to=\"content\"}}\n {{else if (not this.reqState.isCancelled)}}\n <Throw @error={{(notNull this.reqState.error)}} />\n {{/if}}\n {{yield this.reqState to=\"always\"}}\n </template>\n}\n"],"names":["and","x","y","Boolean","Throw","Component","constructor","owner","args","error","setComponentTemplate","precompileTemplate","strictMode","Await","state","getPromiseState","promise","result","scope","deferred","WeakMap","deferDecorator","proto","prop","desc","map","get","Map","set","findDeferredDecorator","target","_a","cursor","prototype","decorateFieldV2","decorators","initializer","configurable","enumerable","writable","decorator","Object","defineProperty","decorateMethodV2","origDesc","getOwnPropertyDescriptor","value","call","initializeDeferredDecorator","notNull","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","not","DEFAULT_DEADLINE","IdleBlockMissingError","consume","service","moduleExists","contextConsume","importSync","isNeverString","val","Request","g","i","void 0","tracked","unavailableStart","intervalStart","nextInterval","invalidated","isUpdating","onlineChanged","backgroundChanged","_originalRequest","_originalQuery","_subscription","_subscribedTo","installListeners","beginPolling","request","isDestroyed","scheduleInterval","isIdle","query","n","cached","autorefreshTypes","autorefresh","types","split","Set","autorefreshThreshold","hasValidThreshold","window","has","_latestRequest","Date","now","setTimeout","maybeUpdate","clearInterval","clearTimeout","updateSubscriptions","requestId","_request","lid","removeSubscriptions","store","notifications","subscribe","_id","op","latest","requestManager","_deduped","priority","reqState","isRefreshing","blocking","isLoading","unsubscribe","isOnline","navigator","onLine","isHidden","document","visibilityState","event","type","addEventListener","passive","capture","mode","silent","canAttempt","size","shouldAttempt","deadline","assign","realMode","autorefreshBehavior","cacheOptions","reload","backgroundReload","wasStoreRequest","EnableHydration","_localRequest","finally","retry","refresh","errorFeatures","contentFeatures","feat","latestRequest","abort","willDestroy","removeEventListener","isOriginalRequest","_store","getRequestState"],"mappings":";;;;;;;;;;AAAA;;AAEC;;AAOM,MAAMA,GAAM,GAAAA,CAACC,CAA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AAA;AAAA,MAAA,IAAA,CAAAA,IAAA,EAAA;QAAA,MAAAC,IAAAA,KAAA,CACEM,YAAA,CAAa,mCACT,CAA+J,6JAAA,CAAA,GAC/J,CAAgI,8HAAA,CAAA,CAAA;AAAA;AAAA,KAAA,EACpImD,KAAA,CAAA,GAAA,EAAA;AAEF,IAAA,OAAOA,KAAA;AACT;EAEA,IAAIS,QAAWA,GAAA;AACb,IAAA,OAAO2C,gBAA0B,IAAI,CAAChF,OAAO,CAAA;AAC/C;EAEA,IAAIpE,MAASA,GAAA;AACX,IAAA,OAAO,IAAI,CAACyG,QAAQ,CAACzG,MAAM;AAC7B;AAEA,EAAA;IAAAP,oBAAA,CAAAC,kBAAA,CAiBA,u0BAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAM,MAAAA,KAAA,EAAAA,OAAA;QAAAlB,GAAA;QAAAI,KAAA;QAAAuD,qBAAA;QAAAV,OAAA;AAAAQ,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;","x_google_ignoreList":[1]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/-private/await.gts","../../../node_modules/.pnpm/decorat_bfe8edbefc8aced6f61ce140cd72ecf2/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js","../src/-private/request.gts"],"sourcesContent":["/**\n * @module @warp-drive/ember\n */\nimport type Owner from '@ember/owner';\nimport Component from '@glimmer/component';\n\nimport type { Awaitable } from '@ember-data/request';\nimport { getPromiseState } from '@ember-data/store/-private';\n\nexport const and = (x: unknown, y: unknown) => Boolean(x && y);\ninterface ThrowSignature<E = Error | string | object> {\n Args: {\n error: E;\n };\n}\n\n/**\n * The `<Throw />` component is used to throw an error in a template.\n *\n * That's all it does. So don't use it unless the application should\n * throw an error if it reaches this point in the template.\n *\n * ```hbs\n * <Throw @error={{anError}} />\n * ```\n *\n * @class <Throw />\n * @public\n */\nexport class Throw<T> extends Component<ThrowSignature<T>> {\n constructor(owner: Owner, args: ThrowSignature<T>['Args']) {\n super(owner, args);\n // this error is opaque (user supplied) so we don't validate it\n // as an Error instance.\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw this.args.error;\n }\n <template></template>\n}\n\ninterface AwaitSignature<T, E = Error | string | object> {\n Args: {\n promise: Promise<T> | Awaitable<T, E>;\n };\n Blocks: {\n pending: [];\n error: [error: E];\n success: [value: T];\n };\n}\n\n/**\n * The <Await /> component allow you to utilize reactive control flow\n * for asynchronous states in your application.\n *\n * Await is ideal for handling \"boundaries\", outside which some state is\n * still allowed to be unresolved and within which it MUST be resolved.\n *\n * ```gjs\n * import { Await } from '@warp-drive/ember';\n *\n * <template>\n * <Await @promise={{@request}}>\n * <:pending>\n * <Spinner />\n * </:pending>\n *\n * <:error as |error|>\n * <ErrorForm @error={{error}} />\n * </:error>\n *\n * <:success as |result|>\n * <h1>{{result.title}}</h1>\n * </:success>\n * </Await>\n * </template>\n * ```\n *\n * The <Await /> component requires that error states are properly handled.\n *\n * If no error block is provided and the promise rejects, the error will\n * be thrown.\n *\n * @class <Await />\n * @public\n */\nexport class Await<T, E> extends Component<AwaitSignature<T, E>> {\n get state() {\n return getPromiseState<T, E>(this.args.promise);\n }\n\n get error() {\n return this.state.error as E;\n }\n\n get result() {\n return this.state.result as T;\n }\n\n <template>\n {{#if this.state.isPending}}\n {{yield to=\"pending\"}}\n {{else if (and this.state.isError (has-block \"error\"))}}\n {{yield this.error to=\"error\"}}\n {{else if this.state.isSuccess}}\n {{yield this.result to=\"success\"}}\n {{else}}\n <Throw @error={{this.error}} />\n {{/if}}\n </template>\n}\n","const deferred = /* @__PURE__ */ new WeakMap();\nfunction deferDecorator(proto, prop, desc) {\n let map = deferred.get(proto);\n if (!map) {\n map = /* @__PURE__ */ new Map();\n deferred.set(proto, map);\n }\n map.set(prop, desc);\n}\nfunction findDeferredDecorator(target, prop) {\n var _a;\n let cursor = target.prototype;\n while (cursor) {\n let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);\n if (desc) {\n return desc;\n }\n cursor = cursor.prototype;\n }\n}\nfunction decorateFieldV1(target, prop, decorators, initializer) {\n return decorateFieldV2(target.prototype, prop, decorators, initializer);\n}\nfunction decorateFieldV2(prototype, prop, decorators, initializer) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n };\n if (initializer) {\n desc.initializer = initializer;\n }\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(prototype, prop, desc);\n } else {\n deferDecorator(prototype, prop, desc);\n }\n}\nfunction decorateMethodV1({ prototype }, prop, decorators) {\n return decorateMethodV2(prototype, prop, decorators);\n}\nfunction decorateMethodV2(prototype, prop, decorators) {\n const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);\n let desc = { ...origDesc };\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;\n desc.initializer = void 0;\n }\n Object.defineProperty(prototype, prop, desc);\n}\nfunction initializeDeferredDecorator(target, prop) {\n let desc = findDeferredDecorator(target.constructor, prop);\n if (desc) {\n Object.defineProperty(target, prop, {\n enumerable: desc.enumerable,\n configurable: desc.configurable,\n writable: desc.writable,\n value: desc.initializer ? desc.initializer.call(target) : void 0\n });\n }\n}\nfunction decorateClass(target, decorators) {\n return decorators.reduce(\n (accum, decorator) => decorator(accum) || accum,\n target\n );\n}\nfunction decoratePOJO(pojo, decorated) {\n for (let [type, prop, decorators] of decorated) {\n if (type === \"field\") {\n decoratePojoField(pojo, prop, decorators);\n } else {\n decorateMethodV2(pojo, prop, decorators);\n }\n }\n return pojo;\n}\nfunction decoratePojoField(pojo, prop, decorators) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: () => {\n var _a;\n return (_a = Object.getOwnPropertyDescriptor(pojo, prop)) == null ? void 0 : _a.value;\n }\n };\n for (let decorator of decorators) {\n desc = decorator(pojo, prop, desc) || desc;\n }\n if (desc.initializer) {\n desc.value = desc.initializer.call(pojo);\n delete desc.initializer;\n }\n Object.defineProperty(pojo, prop, desc);\n}\nconst runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n c: decorateClass,\n f: decorateFieldV1,\n g: decorateFieldV2,\n i: initializeDeferredDecorator,\n m: decorateMethodV1,\n n: decorateMethodV2,\n p: decoratePOJO\n}, Symbol.toStringTag, { value: \"Module\" }));\nexport {\n decorateFieldV2 as a,\n decorateMethodV1 as b,\n decorateMethodV2 as c,\n decorateFieldV1 as d,\n decorateClass as e,\n decoratePOJO as f,\n initializeDeferredDecorator as i,\n runtime as r\n};\n//# sourceMappingURL=runtime-BPCpkOf1.js.map\n","/**\n * @module @warp-drive/ember\n */\nimport type Owner from '@ember/owner';\nimport { service } from '@ember/service';\nimport Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\n\nimport { importSync, macroCondition, moduleExists } from '@embroider/macros';\n\nimport type { Future, StructuredErrorDocument } from '@ember-data/request';\nimport type { StoreRequestInput } from '@ember-data/store';\nimport type Store from '@ember-data/store';\nimport type { RequestLoadingState, RequestState } from '@ember-data/store/-private';\nimport { getRequestState } from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableDocumentIdentifier } from '@warp-drive/core-types/identifier.js';\nimport { EnableHydration, withBrand, type RequestInfo } from '@warp-drive/core-types/request';\n\nimport { and, Throw } from './await.gts';\n\nfunction notNull(x: null): never;\nfunction notNull<T>(x: T): Exclude<T, null>;\nfunction notNull<T>(x: T | null) {\n assert('Expected a non-null value, but got null', x !== null);\n return x;\n}\n\nconst not = (x: unknown) => !x;\n// default to 30 seconds unavailable before we refresh\nconst DEFAULT_DEADLINE = 30_000;\nconst IdleBlockMissingError = new Error(\n 'No idle block provided for <Request> component, and no query or request was provided.'\n);\n\nlet consume = service;\nif (macroCondition(moduleExists('ember-provide-consume-context'))) {\n const { consume: contextConsume } = importSync('ember-provide-consume-context') as { consume: typeof service };\n consume = contextConsume;\n}\n\nfunction isNeverString(val: never): string {\n return val;\n}\n\ntype AutorefreshBehaviorType = 'online' | 'interval' | 'invalid';\ntype AutorefreshBehaviorCombos =\n | boolean\n | AutorefreshBehaviorType\n | `${AutorefreshBehaviorType},${AutorefreshBehaviorType}`\n | `${AutorefreshBehaviorType},${AutorefreshBehaviorType},${AutorefreshBehaviorType}`;\n\ntype ContentFeatures<RT> = {\n isOnline: boolean;\n isHidden: boolean;\n isRefreshing: boolean;\n refresh: () => Promise<void>;\n reload: () => Promise<void>;\n abort?: () => void;\n latestRequest?: Future<RT>;\n};\n\ninterface RequestSignature<RT, T, E> {\n Args: {\n /**\n * The request to monitor. This should be a `Future` instance returned\n * by either the `store.request` or `store.requestManager.request` methods.\n *\n * @typedoc\n */\n request?: Future<RT>;\n\n /**\n * A query to use for the request. This should be an object that can be\n * passed to `store.request`. Use this in place of `@request` if you would\n * like the component to also initiate the request.\n *\n * @typedoc\n */\n query?: StoreRequestInput<RT, T>;\n\n /**\n * The store instance to use for making requests. If contexts are available,\n * the component will default to using the `store` on the context.\n *\n * This is required if the store is not available via context or should be\n * different from the store provided via context.\n *\n * @typedoc\n */\n store?: Store;\n\n /**\n * The autorefresh behavior for the request. This can be a boolean, or any\n * combination of the following values: `'online'`, `'interval'`, `'invalid'`.\n *\n * - `'online'`: Refresh the request when the browser comes back online\n * - `'interval'`: Refresh the request at a specified interval\n * - `'invalid'`: Refresh the request when the store emits an invalidation\n *\n * If `true`, this is equivalent to `'online,invalid'`.\n *\n * Defaults to `false`.\n *\n * @typedoc\n */\n autorefresh?: AutorefreshBehaviorCombos;\n\n /**\n * The number of milliseconds to wait before refreshing the request when the\n * browser comes back online or the network becomes available.\n *\n * This also controls the interval at which the request will be refreshed if\n * the `interval` autorefresh type is enabled.\n *\n * Defaults to `30_000` (30 seconds).\n *\n * @typedoc\n */\n autorefreshThreshold?: number;\n\n /**\n * The behavior of the request initiated by autorefresh. This can be one of\n * the following values:\n *\n * - `'refresh'`: Refresh the request in the background\n * - `'reload'`: Force a reload of the request\n * - `'policy'` (**default**): Let the store's configured CachePolicy decide whether to\n * reload, refresh, or do nothing.\n *\n * Defaults to `'policy'`.\n *\n * @typedoc\n */\n autorefreshBehavior?: 'refresh' | 'reload' | 'policy';\n };\n Blocks: {\n /**\n * The block to render when the component is idle and waiting to be given a request.\n *\n * @typedoc\n */\n idle: [];\n\n /**\n * The block to render when the request is loading.\n *\n * @typedoc\n */\n loading: [state: RequestLoadingState];\n\n /**\n * The block to render when the request was cancelled.\n *\n * @typedoc\n */\n cancelled: [\n error: StructuredErrorDocument<E>,\n features: { isOnline: boolean; isHidden: boolean; retry: () => Promise<void> },\n ];\n\n /**\n * The block to render when the request failed. If this block is not provided,\n * the error will be rethrown.\n *\n * Thus it is required to provide an error block and proper error handling if\n * you do not want the error to crash the application.\n *\n * @typedoc\n */\n error: [\n error: StructuredErrorDocument<E>,\n features: { isOnline: boolean; isHidden: boolean; retry: () => Promise<void> },\n ];\n\n /**\n * The block to render when the request succeeded.\n *\n * @typedoc\n */\n content: [value: RT, features: ContentFeatures<RT>];\n always: [state: RequestState<RT, T, StructuredErrorDocument<E>>];\n };\n}\n\n/**\n * The `<Request />` component is a powerful tool for managing data fetching and\n * state in your Ember application. It provides a declarative approach to reactive\n * control-flow for managing requests and state in your application.\n *\n * The `<Request />` component is ideal for handling \"boundaries\", outside which some\n * state is still allowed to be unresolved and within which it MUST be resolved.\n *\n * ## Request States\n *\n * `<Request />` has five states, only one of which will be active and rendered at a time.\n *\n * - `idle`: The component is waiting to be given a request to monitor\n * - `loading`: The request is in progress\n * - `error`: The request failed\n * - `content`: The request succeeded\n * - `cancelled`: The request was cancelled\n *\n * Additionally, the `content` state has a `refresh` method that can be used to\n * refresh the request in the background, which is available as a sub-state of\n * the `content` state.\n *\n * As with the `<Await />` component, if no error block is provided and the request\n * rejects, the error will be thrown. Cancellation errors are swallowed instead of\n * rethrown if no error block or cancellation block is present.\n *\n * ```gts\n * import { Request } from '@warp-drive/ember';\n *\n * <template>\n * <Request @request={{@request}}>\n * <:loading as |state|>\n * <Spinner @percentDone={{state.completedRatio}} />\n * <button {{on \"click\" state.abort}}>Cancel</button>\n * </:loading>\n *\n * <:error as |error state|>\n * <ErrorForm @error={{error}} />\n * <button {{on \"click\" state.retry}}>Retry</button>\n * </:error>\n *\n * <:content as |data state|>\n * <h1>{{data.title}}</h1>\n * {{#if state.isBackgroundReloading}}\n * <SmallSpinner />\n * <button {{on \"click\" state.abort}}>Cancel</button>\n * {{else}}\n * <button {{on \"click\" state.refresh}}>Refresh</button>\n * {{/if}}\n * </:content>\n *\n * <:cancelled as |error state|>\n * <h2>The Request was cancelled</h2>\n * <button {{on \"click\" state.retry}}>Retry</button>\n * </:cancelled>\n *\n * <:idle>\n * <button {{on \"click\" @kickOffRequest}}>Load Preview?</button>\n * </:idle>\n *\n * </Request>\n * </template>\n * ```\n *\n * ## Streaming Data\n *\n * The loading state exposes the download `ReadableStream` instance for consumption\n *\n * ```gjs\n * import { Request } from '@warp-drive/ember';\n *\n * <template>\n * <Request @request={{@request}}>\n * <:loading as |state|>\n * <Video @stream={{state.stream}} />\n * </:loading>\n *\n * <:error as |error|>\n * <ErrorForm @error={{error}} />\n * </:error>\n * </Request>\n * </template>\n * ```\n *\n * ## Retry\n *\n * Cancelled and error'd requests may be retried by calling the `retry` method.\n *\n * Retry will restart the state progression, using the loading, error, cancelled,\n * and content blocks as appropriate.\n *\n * ## Reloading\n *\n * The `reload` method will force the request to be fully re-executed, bypassing\n * cache and restarting the state progression through the loading, error, and\n * content blocks as appropriate.\n *\n * Background reload (refresh) is a special substate of the content state that\n * allows you to refresh the request in the background. This is useful for when\n * you want to update the data in the background without blocking the UI.\n *\n * Reload and refresh are available as methods on the `content` state.\n *\n * ```gjs\n * import { Request } from '@warp-drive/ember';\n *\n * <template>\n * <Request @request={{@request}}>\n * <:content as |data state|>\n * <h1>{{data.title}}</h1>\n * {{#if state.isBackgroundReloading}}\n * <SmallSpinner />\n * <button {{on \"click\" state.abort}}>Cancel</button>\n * {{/if}}\n *\n * <button {{on \"click\" state.refresh}}>Refresh</button>\n * <button {{on \"click\" state.reload}}>Reload</button>\n * </:content>\n * </Request>\n * </template>\n * ```\n *\n * ## Advanced Reloading\n *\n * We can nest our usage of `<Request />` to handle more advanced\n * reloading scenarios.\n *\n * ```gjs\n * import { Request } from '@warp-drive/ember';\n *\n * <template>\n * <Request @request={{@request}}>\n * <:cancelled>\n * <h2>The Request Cancelled</h2>\n * </:cancelled>\n *\n * <:error as |error|>\n * <ErrorForm @error={{error}} />\n * </:error>\n *\n * <:content as |result state|>\n * <Request @request={{state.latestRequest}}>\n * <!-- Handle Background Request -->\n * </Request>\n *\n * <h1>{{result.title}}</h1>\n *\n * <button {{on \"click\" state.refresh}}>Refresh</button>\n * </:content>\n * </Request>\n * </template>\n * ```\n *\n * ## Autorefresh\n *\n * `<Request />` supports automatic refresh and reload under certain conditions.\n *\n * - `online`: This occurs when a browser window or tab comes back to the foreground\n * after being backgrounded or when the network reports as being online after\n * having been offline.\n * - `interval`: This occurs when a specified amount of time has passed.\n * - `invalid`: This occurs when the store emits a notification that the request\n * has become invalid.\n *\n * You can specify when autorefresh should occur by setting the `autorefresh` arg\n * to `true` or a comma-separated list of the above values.\n *\n * A value of `true` is equivalent to `'online,invalid'`.\n *\n * By default, an autorefresh will only occur if the browser was backgrounded or\n * offline for more than 30s before coming back available. This amount of time can\n * be tweaked by setting the number of milliseconds via `@autorefreshThreshold`.\n *\n * This arg also controls the interval at which the request will be refreshed\n * if the `interval` autorefresh type is enabled.\n *\n * Finally, the behavior of the request initiated by autorefresh can be adjusted\n * by setting the `autorefreshBehavior` arg to `'refresh'`, `'reload'`, or `'policy'`.\n *\n * - `'refresh'`: Refresh the request in the background\n * - `'reload'`: Force a reload of the request\n * - `'policy'` (**default**): Let the store's configured CachePolicy decide whether to\n * reload, refresh, or do nothing.\n *\n * More advanced refresh and reload behaviors can be created by passing the reload and\n * refresh actions into another component. For instance, refresh could be set up on a\n * timer or on a websocket subscription.\n *\n *\n * ```gjs\n * import { Request } from '@warp-drive/ember';\n *\n * <template>\n * <Request @request={{@request}}>\n * <:content as |result state|>\n * <h1>{{result.title}}</h1>\n *\n * <Interval @period={{30_000}} @fn={{state.refresh}} />\n * <Subscribe @channel={{@someValue}} @fn={{state.refresh}} />\n * </:content>\n * </Request>\n * </template>\n * ```\n *\n * If a matching request is refreshed or reloaded by any other component,\n * the `Request` component will react accordingly.\n *\n * ## Deduping\n *\n * The store dedupes requests by identity. If a request is made for the same identity\n * from multiple `<Request />` components, even if the request is not referentially the\n * same, only one actual request will be made.\n *\n *\n * @class <Request />\n * @public\n */\nexport class Request<RT, T, E> extends Component<RequestSignature<RT, T, E>> {\n /**\n * The store instance to use for making requests. If contexts are available, this\n * will be the `store` on the context, else it will be the store service.\n *\n * @internal\n */\n @consume('store') declare _store: Store;\n\n /**\n * Whether the browser reports that the network is online.\n *\n * @internal\n */\n @tracked isOnline = true;\n\n /**\n * Whether the browser reports that the tab is hidden.\n *\n * @internal\n */\n @tracked isHidden = true;\n\n /**\n * Whether the component is currently refreshing the request.\n *\n * @internal\n */\n @tracked isRefreshing = false;\n\n /**\n * The most recent blocking request that was made, typically\n * the result of a reload.\n *\n * This will never be the original request passed as an arg to\n * the component.\n *\n * @internal\n */\n @tracked _localRequest: Future<RT> | undefined;\n\n /**\n * The most recent request that was made, typically due to either a\n * reload or a refresh.\n *\n * This will never be the original request passed as an arg to\n * the component.\n *\n * @internal\n */\n @tracked _latestRequest: Future<RT> | undefined;\n\n /**\n * The time at which the network was reported as offline.\n *\n * @internal\n */\n declare unavailableStart: number | null;\n declare intervalStart: number | null;\n declare nextInterval: number | null;\n declare invalidated: boolean;\n declare isUpdating: boolean;\n\n /**\n * The event listener for network status changes,\n * cached to use the reference for removal.\n *\n * @internal\n */\n declare onlineChanged: (event: Event) => void;\n\n /**\n * The event listener for visibility status changes,\n * cached to use the reference for removal.\n *\n * @internal\n */\n declare backgroundChanged: (event: Event) => void;\n\n /**\n * The last request passed as an arg to the component,\n * cached for comparison.\n *\n * @internal\n */\n declare _originalRequest: Future<RT> | undefined;\n\n /**\n * The last query passed as an arg to the component,\n * cached for comparison.\n *\n * @internal\n */\n declare _originalQuery: StoreRequestInput<RT, T> | undefined;\n\n declare _subscription: object | null;\n declare _subscribedTo: object | null;\n\n constructor(owner: Owner, args: RequestSignature<RT, T, E>['Args']) {\n super(owner, args);\n this._subscribedTo = null;\n this._subscription = null;\n this.intervalStart = null;\n this.invalidated = false;\n this.nextInterval = null;\n\n this.installListeners();\n void this.beginPolling();\n }\n\n async beginPolling() {\n // await the initial request\n try {\n await this.request;\n } catch {\n // ignore errors here, we just want to wait for the request to finish\n } finally {\n if (!this.isDestroyed) {\n void this.scheduleInterval();\n }\n }\n }\n\n @cached\n get isIdle() {\n const { request, query } = this.args;\n\n return Boolean(!request && !query);\n }\n\n @cached\n get autorefreshTypes(): Set<AutorefreshBehaviorType> {\n const { autorefresh } = this.args;\n let types: AutorefreshBehaviorType[];\n\n if (autorefresh === true) {\n types = ['online', 'invalid'];\n } else if (typeof autorefresh === 'string') {\n types = autorefresh.split(',') as AutorefreshBehaviorType[];\n } else {\n types = [];\n }\n\n return new Set(types);\n }\n\n // we only run this function on component creation\n // and when an update is triggered, so it does not\n // react to changes in the autorefreshThreshold\n // or autorefresh args.\n //\n // if we need to react to those changes, we can\n // use a modifier or internal component or some\n // such to trigger a re-run of this function.\n async scheduleInterval() {\n const { autorefreshThreshold } = this.args;\n const hasValidThreshold = typeof autorefreshThreshold === 'number' && autorefreshThreshold > 0;\n if (\n // dont schedule in SSR\n typeof window === 'undefined' ||\n // dont schedule without a threshold\n !hasValidThreshold ||\n // dont schedule if we weren't told to\n !this.autorefreshTypes.has('interval') ||\n // dont schedule if we're already scheduled\n this.intervalStart !== null\n ) {\n return;\n }\n\n // if we have a current request, wait for it to finish\n // before scheduling the next one\n if (this._latestRequest) {\n try {\n await this._latestRequest;\n } catch {\n // ignore errors here, we just want to wait for the request to finish\n }\n\n if (this.isDestroyed) {\n return;\n }\n }\n\n // setup the next interval\n this.intervalStart = Date.now();\n this.nextInterval = setTimeout(() => {\n this.maybeUpdate();\n }, autorefreshThreshold) as unknown as number;\n }\n\n clearInterval() {\n if (this.nextInterval) {\n clearTimeout(this.nextInterval);\n this.intervalStart = null;\n }\n }\n\n updateSubscriptions() {\n if (this.isIdle) {\n return;\n }\n const requestId = this._request.lid;\n\n // if we're already subscribed to this request, we don't need to do anything\n if (this._subscribedTo === requestId) {\n return;\n }\n\n // if we're subscribed to a different request, we need to unsubscribe\n this.removeSubscriptions();\n\n // if we have a request, we need to subscribe to it\n if (requestId) {\n this._subscribedTo = requestId;\n this._subscription = this.store.notifications.subscribe(\n requestId,\n (_id: StableDocumentIdentifier, op: 'invalidated' | 'state' | 'added' | 'updated' | 'removed') => {\n // ignore subscription events that occur while our own component's request\n // is ocurring\n if (this.isUpdating) {\n return;\n }\n switch (op) {\n case 'invalidated': {\n // if we're subscribed to invalidations, we need to update\n if (this.autorefreshTypes.has('invalid')) {\n this.invalidated = true;\n this.maybeUpdate();\n }\n break;\n }\n case 'state': {\n const latest = this.store.requestManager._deduped.get(requestId);\n const priority = latest?.priority;\n const state = this.reqState;\n if (!priority) {\n // if there is no priority, we have completed whatever request\n // was occurring and so we are no longer refreshing (if we were)\n this.isRefreshing = false;\n } else if (priority.blocking && !state.isLoading) {\n // if we are blocking, there is an active request for this identity\n // that MUST be fulfilled from network (not cache).\n // Thus this is not \"refreshing\" because we should clear out and\n // block on this request.\n //\n // we receive state notifications when either a request initiates\n // or completes.\n //\n // In the completes case: we may receive the state notification\n // slightly before the request is finalized because the NotificationManager\n // may sync flush it (and thus deliver it before the microtask completes)\n //\n // In the initiates case: we aren't supposed to receive one unless there\n // is no other request in flight for this identity.\n //\n // However, there is a race condition here where the completed\n // notification can trigger an update that generates a new request\n // thus giving us an initiated notification before the older request\n // finalizes.\n //\n // When this occurs, if the triggered update happens to have caused\n // a new request to be made for the same identity AND that request\n // is the one passed into this component as the @request arg, then\n // getRequestState will return the state of the new request.\n // We can detect this by checking if the request state is \"loading\"\n // as outside of this case we would have a completed request.\n //\n // That is the reason for the `&& !state.isLoading` check above.\n\n // TODO should we just treat this as refreshing?\n this.isRefreshing = false;\n this.maybeUpdate('policy', true);\n } else {\n this.isRefreshing = true;\n }\n }\n }\n }\n );\n }\n }\n\n removeSubscriptions() {\n if (this._subscription) {\n this.store.notifications.unsubscribe(this._subscription);\n this._subscribedTo = null;\n this._subscription = null;\n }\n }\n\n /**\n * Install the event listeners for network and visibility changes.\n * This is only done in browser environments with a global `window`.\n *\n * @internal\n */\n installListeners() {\n if (typeof window === 'undefined') {\n return;\n }\n\n this.isOnline = window.navigator.onLine;\n this.unavailableStart = this.isOnline ? null : Date.now();\n this.isHidden = document.visibilityState === 'hidden';\n\n this.onlineChanged = (event: Event) => {\n this.isOnline = event.type === 'online';\n if (event.type === 'offline' && this.unavailableStart === null) {\n this.unavailableStart = Date.now();\n }\n this.maybeUpdate();\n };\n this.backgroundChanged = () => {\n const isHidden = document.visibilityState === 'hidden';\n this.isHidden = isHidden;\n\n if (isHidden && this.unavailableStart === null) {\n this.unavailableStart = Date.now();\n }\n\n this.maybeUpdate();\n };\n\n window.addEventListener('online', this.onlineChanged, { passive: true, capture: true });\n window.addEventListener('offline', this.onlineChanged, { passive: true, capture: true });\n document.addEventListener('visibilitychange', this.backgroundChanged, { passive: true, capture: true });\n }\n\n /**\n * If the network is online and the tab is visible, either reload or refresh the request\n * based on the component's configuration and the requested update mode.\n *\n * Valid modes are:\n *\n * - `'reload'`: Force a reload of the request.\n * - `'refresh'`: Refresh the request in the background.\n * - `'policy'`: Make the request, letting the store's configured CachePolicy decide whether to reload, refresh, or do nothing.\n * - `undefined`: Make the request using the component's autorefreshBehavior setting if the autorefreshThreshold has passed.\n *\n * @internal\n */\n maybeUpdate(mode?: 'reload' | 'refresh' | 'policy' | 'invalidated', silent?: boolean): void {\n if (this.isIdle) {\n return;\n }\n const canAttempt = Boolean(this.isOnline && !this.isHidden && (mode || this.autorefreshTypes.size));\n\n if (!canAttempt) {\n if (!silent && mode && mode !== 'invalidated') {\n throw new Error(`Reload not available: the network is not online or the tab is hidden`);\n }\n\n return;\n }\n\n const { autorefreshTypes } = this;\n let shouldAttempt = this.invalidated || Boolean(mode);\n\n if (!shouldAttempt && autorefreshTypes.has('online')) {\n const { unavailableStart } = this;\n const { autorefreshThreshold } = this.args;\n const deadline = typeof autorefreshThreshold === 'number' ? autorefreshThreshold : DEFAULT_DEADLINE;\n shouldAttempt = Boolean(unavailableStart && Date.now() - unavailableStart > deadline);\n }\n\n if (!shouldAttempt && autorefreshTypes.has('interval')) {\n const { intervalStart } = this;\n const { autorefreshThreshold } = this.args;\n\n if (intervalStart && typeof autorefreshThreshold === 'number' && autorefreshThreshold > 0) {\n shouldAttempt = Boolean(Date.now() - intervalStart >= autorefreshThreshold);\n }\n }\n\n this.unavailableStart = null;\n this.invalidated = false;\n\n if (shouldAttempt) {\n this.clearInterval();\n const request = Object.assign({}, this.reqState.request as unknown as RequestInfo<RT, T>);\n const realMode = mode === 'invalidated' ? null : mode;\n const val = realMode ?? this.args.autorefreshBehavior ?? 'policy';\n switch (val) {\n case 'reload':\n request.cacheOptions = Object.assign({}, request.cacheOptions, { reload: true });\n break;\n case 'refresh':\n request.cacheOptions = Object.assign({}, request.cacheOptions, { backgroundReload: true });\n break;\n case 'policy':\n break;\n default:\n throw new Error(\n `Invalid ${mode ? 'update mode' : '@autorefreshBehavior'} for <Request />: ${isNeverString(val)}`\n );\n }\n\n const wasStoreRequest = request[EnableHydration] === true;\n assert(\n `Cannot supply a different store via context than was used to create the request`,\n !request.store || request.store === this.store\n );\n\n this.isUpdating = true;\n this._latestRequest = wasStoreRequest ? this.store.request(request) : this.store.requestManager.request(request);\n\n if (val !== 'refresh') {\n this._localRequest = this._latestRequest;\n }\n\n void this.scheduleInterval();\n void this._latestRequest.finally(() => {\n this.isUpdating = false;\n });\n } else {\n // TODO probably want this\n // void this.scheduleInterval();\n }\n }\n\n /**\n * Retry the request, reloading it from the server.\n *\n * @internal\n */\n retry = async () => {\n this.maybeUpdate('reload');\n await this._localRequest;\n };\n\n /**\n * Refresh the request, updating it in the background.\n *\n * @internal\n */\n refresh = async () => {\n this.maybeUpdate('refresh');\n await this._latestRequest;\n };\n\n @cached\n get errorFeatures() {\n return {\n isHidden: this.isHidden,\n isOnline: this.isOnline,\n retry: this.retry,\n };\n }\n\n @cached\n get contentFeatures() {\n const feat: ContentFeatures<RT> = {\n isHidden: this.isHidden,\n isOnline: this.isOnline,\n reload: this.retry,\n refresh: this.refresh,\n isRefreshing: this.isRefreshing,\n latestRequest: this._latestRequest,\n };\n\n if (feat.isRefreshing) {\n feat.abort = () => {\n this._latestRequest?.abort();\n };\n }\n\n return feat;\n }\n\n willDestroy() {\n this.removeSubscriptions();\n\n if (typeof window === 'undefined') {\n return;\n }\n\n this.clearInterval();\n\n window.removeEventListener('online', this.onlineChanged, { passive: true, capture: true } as unknown as boolean);\n window.removeEventListener('offline', this.onlineChanged, { passive: true, capture: true } as unknown as boolean);\n document.removeEventListener('visibilitychange', this.backgroundChanged, {\n passive: true,\n capture: true,\n } as unknown as boolean);\n }\n\n @cached\n get _request(): Future<RT> {\n const { request, query } = this.args;\n assert(`Cannot use both @request and @query args with the <Request> component`, !request || !query);\n const { _localRequest, _originalRequest, _originalQuery } = this;\n const isOriginalRequest = request === _originalRequest && query === _originalQuery;\n\n if (_localRequest && isOriginalRequest) {\n return _localRequest;\n }\n\n // update state checks for the next time\n this._originalQuery = query;\n this._originalRequest = request;\n\n if (request) {\n return request;\n }\n assert(`You must provide either @request or an @query arg with the <Request> component`, query);\n return this.store.request(query);\n }\n\n @cached\n get request(): Future<RT> {\n const request = this._request;\n this.updateSubscriptions();\n return request;\n }\n\n get store(): Store {\n const store = this.args.store || this._store;\n assert(\n moduleExists('ember-provide-consume-context')\n ? `No store was provided to the <Request> component. Either provide a store via the @store arg or via the context API provided by ember-provide-consume-context.`\n : `No store was provided to the <Request> component. Either provide a store via the @store arg or by registering a store service.`,\n store\n );\n return store;\n }\n\n get reqState() {\n return getRequestState<RT, T, E>(this.request);\n }\n\n get result() {\n return this.reqState.result as RT;\n }\n\n <template>\n {{#if (and this.isIdle (has-block \"idle\"))}}\n {{yield to=\"idle\"}}\n {{else if this.isIdle}}\n <Throw @error={{IdleBlockMissingError}} />\n {{else if this.reqState.isLoading}}\n {{yield this.reqState.loadingState to=\"loading\"}}\n {{else if (and this.reqState.isCancelled (has-block \"cancelled\"))}}\n {{yield (notNull this.reqState.error) this.errorFeatures to=\"cancelled\"}}\n {{else if (and this.reqState.isError (has-block \"error\"))}}\n {{yield (notNull this.reqState.error) this.errorFeatures to=\"error\"}}\n {{else if this.reqState.isSuccess}}\n {{yield this.result this.contentFeatures to=\"content\"}}\n {{else if (not this.reqState.isCancelled)}}\n <Throw @error={{(notNull this.reqState.error)}} />\n {{/if}}\n {{yield this.reqState to=\"always\"}}\n </template>\n}\n"],"names":["and","x","y","Boolean","Throw","Component","constructor","owner","args","error","setComponentTemplate","precompileTemplate","strictMode","Await","state","getPromiseState","promise","result","scope","deferred","WeakMap","deferDecorator","proto","prop","desc","map","get","Map","set","findDeferredDecorator","target","_a","cursor","prototype","decorateFieldV2","decorators","initializer","configurable","enumerable","writable","decorator","Object","defineProperty","decorateMethodV2","origDesc","getOwnPropertyDescriptor","value","call","initializeDeferredDecorator","notNull","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","not","DEFAULT_DEADLINE","IdleBlockMissingError","consume","service","moduleExists","contextConsume","importSync","isNeverString","val","Request","g","i","void 0","tracked","unavailableStart","intervalStart","nextInterval","invalidated","isUpdating","onlineChanged","backgroundChanged","_originalRequest","_originalQuery","_subscription","_subscribedTo","installListeners","beginPolling","request","isDestroyed","scheduleInterval","isIdle","query","n","cached","autorefreshTypes","autorefresh","types","split","Set","autorefreshThreshold","hasValidThreshold","window","has","_latestRequest","Date","now","setTimeout","maybeUpdate","clearInterval","clearTimeout","updateSubscriptions","requestId","_request","lid","removeSubscriptions","store","notifications","subscribe","_id","op","latest","requestManager","_deduped","priority","reqState","isRefreshing","blocking","isLoading","unsubscribe","isOnline","navigator","onLine","isHidden","document","visibilityState","event","type","addEventListener","passive","capture","mode","silent","canAttempt","size","shouldAttempt","deadline","assign","realMode","autorefreshBehavior","cacheOptions","reload","backgroundReload","wasStoreRequest","EnableHydration","_localRequest","finally","retry","refresh","errorFeatures","contentFeatures","feat","latestRequest","abort","willDestroy","removeEventListener","isOriginalRequest","_store","getRequestState"],"mappings":";;;;;;;;;;AAAA;;AAEC;;AAOM,MAAMA,GAAM,GAAAA,CAACC,CAAU,EAAEC,CAAU,KAAKC,OAAQ,CAAAF,CAAA,IAAKC,CAAG,CAAA;AAO/D;;;;;;;;;;;;AAYC;AACM,MAAME,KAAM,SAAWC,UAAyB;AACrDC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAA+B,EAAE;AACzD,IAAA,KAAK,CAACD,KAAO,EAAAC,IAAA,CAAA;AACb;AACA;AACA;AACA,IAAA,MAAM,IAAI,CAACA,IAAI,CAACC,KAAK;AACvB;AACA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAU,EAAA,EAAA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACtB;AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCC;AACM,MAAMC,KAAA,SAAoBR,SAAA,CAA4B;EAC3D,IAAIS,KAAQA,GAAA;AACV,IAAA,OAAOC,gBAAsB,IAAI,CAACP,IAAI,CAACQ,OAAO,CAAA;AAChD;EAEA,IAAIP,KAAQA,GAAA;AACV,IAAA,OAAO,IAAI,CAACK,KAAK,CAACL,KAAK;AACzB;EAEA,IAAIQ,MAASA,GAAA;AACX,IAAA,OAAO,IAAI,C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
|
"name": "@warp-drive/ember",
|
|
3
3
|
"description": "Data bindings and utilities for Ember applications using WarpDrive",
|
|
4
|
-
"version": "5.6.0-alpha.
|
|
4
|
+
"version": "5.6.0-alpha.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Chris Thoburn <runspired@users.noreply.github.com>",
|
|
7
7
|
"repository": {
|
|
@@ -34,17 +34,16 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"ember-source": "3.28.12 || ^4.0.4 || ^5.0.0 || ^6.0.0",
|
|
38
37
|
"@ember/test-waiters": "^3.1.0 || ^4.0.0",
|
|
39
|
-
"@ember-data/store": "5.6.0-alpha.
|
|
40
|
-
"@ember-data/request": "5.6.0-alpha.
|
|
41
|
-
"@ember-data/request-utils": "5.6.0-alpha.
|
|
42
|
-
"@warp-drive/core-types": "5.6.0-alpha.
|
|
38
|
+
"@ember-data/store": "5.6.0-alpha.3",
|
|
39
|
+
"@ember-data/request": "5.6.0-alpha.3",
|
|
40
|
+
"@ember-data/request-utils": "5.6.0-alpha.3",
|
|
41
|
+
"@warp-drive/core-types": "5.6.0-alpha.3",
|
|
43
42
|
"ember-provide-consume-context": "^0.7.0"
|
|
44
43
|
},
|
|
45
44
|
"dependencies": {
|
|
46
45
|
"@embroider/macros": "^1.16.12",
|
|
47
|
-
"@warp-drive/build-config": "5.6.0-alpha.
|
|
46
|
+
"@warp-drive/build-config": "5.6.0-alpha.3"
|
|
48
47
|
},
|
|
49
48
|
"peerDependenciesMeta": {
|
|
50
49
|
"ember-provide-consume-context": {
|
|
@@ -58,7 +57,6 @@
|
|
|
58
57
|
"@babel/preset-typescript": "^7.27.0",
|
|
59
58
|
"@babel/runtime": "^7.27.0",
|
|
60
59
|
"@glimmer/component": "^2.0.0",
|
|
61
|
-
"@glimmer/tracking": "^1.1.2",
|
|
62
60
|
"@glimmer/validator": "^0.94.8",
|
|
63
61
|
"@glint/core": "1.5.2",
|
|
64
62
|
"@glint/environment-ember-loose": "1.5.2",
|
|
@@ -66,13 +64,13 @@
|
|
|
66
64
|
"@glint/template": "1.5.2",
|
|
67
65
|
"decorator-transforms": "^2.3.0",
|
|
68
66
|
"@embroider/addon-dev": "^7.1.3",
|
|
69
|
-
"@ember-data/request": "5.6.0-alpha.
|
|
70
|
-
"@ember-data/request-utils": "5.6.0-alpha.
|
|
71
|
-
"@ember-data/store": "5.6.0-alpha.
|
|
67
|
+
"@ember-data/request": "5.6.0-alpha.3",
|
|
68
|
+
"@ember-data/request-utils": "5.6.0-alpha.3",
|
|
69
|
+
"@ember-data/store": "5.6.0-alpha.3",
|
|
72
70
|
"@ember/test-helpers": "5.2.0",
|
|
73
71
|
"@ember/test-waiters": "^4.1.0",
|
|
74
|
-
"@warp-drive/core-types": "5.6.0-alpha.
|
|
75
|
-
"@warp-drive/internal-config": "5.6.0-alpha.
|
|
72
|
+
"@warp-drive/core-types": "5.6.0-alpha.3",
|
|
73
|
+
"@warp-drive/internal-config": "5.6.0-alpha.3",
|
|
76
74
|
"babel-plugin-ember-template-compilation": "^2.4.1",
|
|
77
75
|
"ember-template-imports": "^4.3.0",
|
|
78
76
|
"ember-source": "~6.3.0",
|
|
@@ -19,7 +19,7 @@ declare module '@warp-drive/ember/-private/request' {
|
|
|
19
19
|
abort?: () => void;
|
|
20
20
|
latestRequest?: Future<RT>;
|
|
21
21
|
};
|
|
22
|
-
interface RequestSignature<
|
|
22
|
+
interface RequestSignature<RT, T, E> {
|
|
23
23
|
Args: {
|
|
24
24
|
/**
|
|
25
25
|
* The request to monitor. This should be a `Future` instance returned
|
|
@@ -35,7 +35,7 @@ declare module '@warp-drive/ember/-private/request' {
|
|
|
35
35
|
*
|
|
36
36
|
* @typedoc
|
|
37
37
|
*/
|
|
38
|
-
query?: StoreRequestInput<
|
|
38
|
+
query?: StoreRequestInput<RT, T>;
|
|
39
39
|
/**
|
|
40
40
|
* The store instance to use for making requests. If contexts are available,
|
|
41
41
|
* the component will default to using the `store` on the context.
|
|
@@ -137,7 +137,7 @@ declare module '@warp-drive/ember/-private/request' {
|
|
|
137
137
|
* @typedoc
|
|
138
138
|
*/
|
|
139
139
|
content: [value: RT, features: ContentFeatures<RT>];
|
|
140
|
-
always: [state: RequestState<
|
|
140
|
+
always: [state: RequestState<RT, T, StructuredErrorDocument<E>>];
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
@@ -357,7 +357,7 @@ declare module '@warp-drive/ember/-private/request' {
|
|
|
357
357
|
* @class <Request />
|
|
358
358
|
* @public
|
|
359
359
|
*/
|
|
360
|
-
export class Request<
|
|
360
|
+
export class Request<RT, T, E> extends Component<RequestSignature<RT, T, E>> {
|
|
361
361
|
/**
|
|
362
362
|
* The store instance to use for making requests. If contexts are available, this
|
|
363
363
|
* will be the `store` on the context, else it will be the store service.
|
|
@@ -440,10 +440,10 @@ declare module '@warp-drive/ember/-private/request' {
|
|
|
440
440
|
*
|
|
441
441
|
* @internal
|
|
442
442
|
*/
|
|
443
|
-
_originalQuery: StoreRequestInput<
|
|
443
|
+
_originalQuery: StoreRequestInput<RT, T> | undefined;
|
|
444
444
|
_subscription: object | null;
|
|
445
445
|
_subscribedTo: object | null;
|
|
446
|
-
constructor(owner: Owner, args: RequestSignature<
|
|
446
|
+
constructor(owner: Owner, args: RequestSignature<RT, T, E>['Args']);
|
|
447
447
|
beginPolling(): Promise<void>;
|
|
448
448
|
get isIdle(): boolean;
|
|
449
449
|
get autorefreshTypes(): Set<AutorefreshBehaviorType>;
|
|
@@ -494,7 +494,7 @@ declare module '@warp-drive/ember/-private/request' {
|
|
|
494
494
|
get _request(): Future<RT>;
|
|
495
495
|
get request(): Future<RT>;
|
|
496
496
|
get store(): Store;
|
|
497
|
-
get reqState(): Readonly<RequestState<
|
|
497
|
+
get reqState(): Readonly<RequestState<RT, T, StructuredErrorDocument<E>>>;
|
|
498
498
|
get result(): RT;
|
|
499
499
|
}
|
|
500
500
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/-private/request.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAK3C,OAAO,KAAK,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAgCpF,KAAK,uBAAuB,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AACjE,KAAK,yBAAyB,GAC1B,OAAO,GACP,uBAAuB,GACvB,GAAG,uBAAuB,IAAI,uBAAuB,EAAE,GACvD,GAAG,uBAAuB,IAAI,uBAAuB,IAAI,uBAAuB,EAAE,CAAC;AAEvF,KAAK,eAAe,CAAC,EAAE,IAAI;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;CAC5B,CAAC;AAEF,UAAU,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/-private/request.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAK3C,OAAO,KAAK,EAAE,MAAM,EAAE,uBAA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