@ember-data-mirror/request 5.4.0-alpha.129 → 5.4.0-alpha.130

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.
@@ -122,7 +122,7 @@ function isCacheHandler(handler, index) {
122
122
  return index === 0 && Boolean(handler[IS_CACHE_HANDLER]);
123
123
  }
124
124
  function executeNextHandler(wares, request, i, god) {
125
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
125
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
126
126
  if (i === wares.length) {
127
127
  throw new Error(`No handler was able to handle this request.`);
128
128
  }
@@ -149,7 +149,7 @@ function executeNextHandler(wares, request, i, god) {
149
149
  });
150
150
  outcome = Promise.resolve(outcome);
151
151
  }
152
- } else if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
152
+ } else if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
153
153
  if (!outcome || !(outcome instanceof Promise) && !(typeof outcome === 'object' && 'then' in outcome)) {
154
154
  // eslint-disable-next-line no-console
155
155
  console.log({
@@ -288,7 +288,7 @@ class ContextOwner {
288
288
  let enhancedRequest = Object.assign({
289
289
  signal: this.controller.signal
290
290
  }, request);
291
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
291
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
292
292
  if (!request?.cacheOptions?.[SkipCache]) {
293
293
  request = deepFreeze(request);
294
294
  enhancedRequest = deepFreeze(enhancedRequest);
@@ -349,7 +349,7 @@ class ContextOwner {
349
349
  }
350
350
  setResponse(response) {
351
351
  if (this.hasSetResponse) {
352
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
352
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
353
353
  throw new Error(`Cannot setResponse when a response has already been set`);
354
354
  }
355
355
  return;
@@ -358,7 +358,7 @@ class ContextOwner {
358
358
  if (response instanceof Response) {
359
359
  // TODO potentially avoid cloning in prod
360
360
  let responseData = cloneResponseProperties(response);
361
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
361
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
362
362
  responseData = deepFreeze(responseData);
363
363
  }
364
364
  this.response = responseData;
@@ -387,7 +387,7 @@ class Context {
387
387
  this.#owner.setResponse(response);
388
388
  }
389
389
  setIdentifier(identifier) {
390
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
390
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
391
391
  if (!test) {
392
392
  throw new Error(`setIdentifier may only be used synchronously from a CacheHandler`);
393
393
  }
@@ -595,7 +595,7 @@ function validateKey(key, value, errors) {
595
595
  }
596
596
  const IgnoredKeys = new Set([]);
597
597
  function assertValidRequest(request, isTopLevel) {
598
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
598
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
599
599
  // handle basic shape
600
600
  if (!request) {
601
601
  throw new Error(`Expected ${isTopLevel ? 'RequestManager.request' : 'next'}(<request>) to be called with a request, but none was provided.`);
package/dist/fetch.js CHANGED
@@ -27,7 +27,7 @@ function cloneResponse(response, overrides) {
27
27
  return new Response(response.body, Object.assign(props, overrides));
28
28
  }
29
29
  let IS_MAYBE_MIRAGE = () => false;
30
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
30
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
31
31
  IS_MAYBE_MIRAGE = () => Boolean(typeof window !== 'undefined' && (window.server?.pretender || window.fetch.toString().replace(/\s+/g, '') !== 'function fetch() { [native code] }'.replace(/\s+/g, '')));
32
32
  }
33
33
  const MUTATION_OPS = new Set(['updateRecord', 'createRecord', 'deleteRecord']);
package/dist/index.js CHANGED
@@ -544,7 +544,7 @@ class RequestManager {
544
544
  * @return {ThisType}
545
545
  */
546
546
  useCache(cacheHandler) {
547
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
547
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
548
548
  if (this._hasCacheHandler) {
549
549
  throw new Error(`\`RequestManager.useCache(<handler>)\` May only be invoked once.`);
550
550
  }
@@ -572,7 +572,7 @@ class RequestManager {
572
572
  */
573
573
  use(newHandlers) {
574
574
  const handlers = this.#handlers;
575
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
575
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
576
576
  if (Object.isFrozen(handlers)) {
577
577
  throw new Error(`Cannot add a Handler to a RequestManager after a request has been made`);
578
578
  }
@@ -601,7 +601,7 @@ class RequestManager {
601
601
  */
602
602
  request(request) {
603
603
  const handlers = this.#handlers;
604
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
604
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
605
605
  if (!Object.isFrozen(handlers)) {
606
606
  Object.freeze(handlers);
607
607
  }
@@ -626,7 +626,7 @@ class RequestManager {
626
626
  // the cache handler will set the result of the request synchronously
627
627
  // if it is able to fulfill the request from the cache
628
628
  const cacheResult = getRequestResult(requestId);
629
- if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
629
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
630
630
  if (!request.disableTestWaiter) {
631
631
  const {
632
632
  waitForPromise
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ember-data-mirror/request",
3
3
  "description": "⚡️ A simple, small and fast framework-agnostic library to make `fetch` happen",
4
- "version": "5.4.0-alpha.129",
4
+ "version": "5.4.0-alpha.130",
5
5
  "license": "MIT",
6
6
  "author": "Chris Thoburn <runspired@users.noreply.github.com>",
7
7
  "repository": {
@@ -32,12 +32,12 @@
32
32
  }
33
33
  },
34
34
  "peerDependencies": {
35
- "@warp-drive-mirror/core-types": "5.4.0-alpha.129"
35
+ "@warp-drive-mirror/core-types": "5.4.0-alpha.130"
36
36
  },
37
37
  "dependencies": {
38
38
  "@ember/test-waiters": "^3.1.0 || ^4.0.0",
39
39
  "@embroider/macros": "^1.16.6",
40
- "@warp-drive-mirror/build-config": "5.4.0-alpha.129"
40
+ "@warp-drive-mirror/build-config": "5.4.0-alpha.130"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/core": "^7.24.5",
@@ -45,8 +45,8 @@
45
45
  "@babel/preset-env": "^7.24.5",
46
46
  "@babel/preset-typescript": "^7.24.1",
47
47
  "@glimmer/component": "^1.1.2",
48
- "@warp-drive-mirror/core-types": "5.4.0-alpha.129",
49
- "@warp-drive/internal-config": "5.4.0-alpha.129",
48
+ "@warp-drive-mirror/core-types": "5.4.0-alpha.130",
49
+ "@warp-drive/internal-config": "5.4.0-alpha.130",
50
50
  "ember-source": "~5.12.0",
51
51
  "pnpm-sync-dependencies-meta-injected": "0.0.14",
52
52
  "typescript": "^5.7.2",