@spoosh/angular 0.6.4 → 0.7.0

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/README.md CHANGED
@@ -16,15 +16,14 @@ npm install @spoosh/core @spoosh/angular
16
16
 
17
17
  ```typescript
18
18
  import { Spoosh } from "@spoosh/core";
19
- import { createAngularSpoosh } from "@spoosh/angular";
19
+ import { create } from "@spoosh/angular";
20
20
  import { cachePlugin } from "@spoosh/plugin-cache";
21
21
 
22
22
  const spoosh = new Spoosh<ApiSchema, Error>("/api").use([
23
23
  cachePlugin({ staleTime: 5000 }),
24
24
  ]);
25
25
 
26
- export const { injectRead, injectWrite, injectInfiniteRead } =
27
- createAngularSpoosh(spoosh);
26
+ export const { injectRead, injectWrite, injectInfiniteRead } = create(spoosh);
28
27
  ```
29
28
 
30
29
  ### injectRead
package/dist/index.d.mts CHANGED
@@ -359,6 +359,6 @@ type SpooshAngularFunctions<TDefaultError, TSchema, TPlugins extends PluginArray
359
359
  injectInfiniteRead: ReturnType<typeof createInjectInfiniteRead<TSchema, TDefaultError, TPlugins>>;
360
360
  } & MergePluginInstanceApi<TPlugins, TSchema>;
361
361
 
362
- declare function createAngularSpoosh<TSchema, TDefaultError, TPlugins extends PluginArray, TApi>(instance: SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins>): SpooshAngularFunctions<TDefaultError, TSchema, TPlugins>;
362
+ declare function create<TSchema, TDefaultError, TPlugins extends PluginArray, TApi>(instance: SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins>): SpooshAngularFunctions<TDefaultError, TSchema, TPlugins>;
363
363
 
364
- export { type AngularOptionsMap, type BaseInfiniteReadOptions, type BaseInfiniteReadResult, type BaseReadOptions, type BaseReadResult, type BaseWriteResult, type EnabledOption, type ExtractMethodBody, type ExtractMethodData, type ExtractMethodError, type ExtractMethodOptions, type ExtractMethodQuery, type ExtractResponseBody, type ExtractResponseParamNames, type ExtractResponseQuery, type InfiniteReadApiClient, type PageContext, type ReadApiClient, type ResponseInputFields, type SpooshInstanceShape, type TriggerOptions, type WriteApiClient, type WriteResponseInputFields, createAngularSpoosh };
364
+ export { type AngularOptionsMap, type BaseInfiniteReadOptions, type BaseInfiniteReadResult, type BaseReadOptions, type BaseReadResult, type BaseWriteResult, type EnabledOption, type ExtractMethodBody, type ExtractMethodData, type ExtractMethodError, type ExtractMethodOptions, type ExtractMethodQuery, type ExtractResponseBody, type ExtractResponseParamNames, type ExtractResponseQuery, type InfiniteReadApiClient, type PageContext, type ReadApiClient, type ResponseInputFields, type SpooshInstanceShape, type TriggerOptions, type WriteApiClient, type WriteResponseInputFields, create };
package/dist/index.d.ts CHANGED
@@ -359,6 +359,6 @@ type SpooshAngularFunctions<TDefaultError, TSchema, TPlugins extends PluginArray
359
359
  injectInfiniteRead: ReturnType<typeof createInjectInfiniteRead<TSchema, TDefaultError, TPlugins>>;
360
360
  } & MergePluginInstanceApi<TPlugins, TSchema>;
361
361
 
362
- declare function createAngularSpoosh<TSchema, TDefaultError, TPlugins extends PluginArray, TApi>(instance: SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins>): SpooshAngularFunctions<TDefaultError, TSchema, TPlugins>;
362
+ declare function create<TSchema, TDefaultError, TPlugins extends PluginArray, TApi>(instance: SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins>): SpooshAngularFunctions<TDefaultError, TSchema, TPlugins>;
363
363
 
364
- export { type AngularOptionsMap, type BaseInfiniteReadOptions, type BaseInfiniteReadResult, type BaseReadOptions, type BaseReadResult, type BaseWriteResult, type EnabledOption, type ExtractMethodBody, type ExtractMethodData, type ExtractMethodError, type ExtractMethodOptions, type ExtractMethodQuery, type ExtractResponseBody, type ExtractResponseParamNames, type ExtractResponseQuery, type InfiniteReadApiClient, type PageContext, type ReadApiClient, type ResponseInputFields, type SpooshInstanceShape, type TriggerOptions, type WriteApiClient, type WriteResponseInputFields, createAngularSpoosh };
364
+ export { type AngularOptionsMap, type BaseInfiniteReadOptions, type BaseInfiniteReadResult, type BaseReadOptions, type BaseReadResult, type BaseWriteResult, type EnabledOption, type ExtractMethodBody, type ExtractMethodData, type ExtractMethodError, type ExtractMethodOptions, type ExtractMethodQuery, type ExtractResponseBody, type ExtractResponseParamNames, type ExtractResponseQuery, type InfiniteReadApiClient, type PageContext, type ReadApiClient, type ResponseInputFields, type SpooshInstanceShape, type TriggerOptions, type WriteApiClient, type WriteResponseInputFields, create };
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- createAngularSpoosh: () => createAngularSpoosh
23
+ create: () => create
24
24
  });
25
25
  module.exports = __toCommonJS(src_exports);
26
26
 
@@ -50,7 +50,7 @@ function createInjectRead(options) {
50
50
  let currentResolvedTags = [];
51
51
  let prevContext = null;
52
52
  let isMounted = false;
53
- const hookId = `angular-${Math.random().toString(36).slice(2)}`;
53
+ const instanceId = `angular-${Math.random().toString(36).slice(2)}`;
54
54
  const captureSelector = () => {
55
55
  const selectorResult = {
56
56
  call: null,
@@ -78,7 +78,7 @@ function createInjectRead(options) {
78
78
  stateManager,
79
79
  eventEmitter,
80
80
  pluginExecutor,
81
- hookId,
81
+ instanceId,
82
82
  fetchFn: async (fetchOpts) => {
83
83
  const pathMethods = api(capturedCall.path);
84
84
  const method = pathMethods[capturedCall.method];
@@ -365,7 +365,7 @@ function createInjectWrite(options) {
365
365
  }
366
366
  return selectorResult.selector;
367
367
  };
368
- const hookId = `angular-${Math.random().toString(36).slice(2)}`;
368
+ const instanceId = `angular-${Math.random().toString(36).slice(2)}`;
369
369
  let currentQueryKey = null;
370
370
  let currentController = null;
371
371
  let currentSubscription = null;
@@ -406,7 +406,7 @@ function createInjectWrite(options) {
406
406
  stateManager,
407
407
  eventEmitter,
408
408
  pluginExecutor,
409
- hookId,
409
+ instanceId,
410
410
  fetchFn: async (fetchOpts) => {
411
411
  const pathMethods = api(selectedEndpoint.path);
412
412
  const method = pathMethods[selectedEndpoint.method];
@@ -519,7 +519,7 @@ function createInjectInfiniteRead(options) {
519
519
  }
520
520
  return selectorResult.call;
521
521
  };
522
- const hookId = `angular-${Math.random().toString(36).slice(2)}`;
522
+ const instanceId = `angular-${Math.random().toString(36).slice(2)}`;
523
523
  const dataSignal = (0, import_core5.signal)(void 0);
524
524
  const allResponsesSignal = (0, import_core5.signal)(void 0);
525
525
  const errorSignal = (0, import_core5.signal)(void 0);
@@ -600,7 +600,7 @@ function createInjectInfiniteRead(options) {
600
600
  stateManager,
601
601
  eventEmitter,
602
602
  pluginExecutor,
603
- hookId,
603
+ instanceId,
604
604
  fetchFn: async (opts, abortSignal) => {
605
605
  const pathMethods = api(capturedCall.path);
606
606
  const method = pathMethods[capturedCall.method];
@@ -821,8 +821,8 @@ function createInjectInfiniteRead(options) {
821
821
  };
822
822
  }
823
823
 
824
- // src/createAngularSpoosh/index.ts
825
- function createAngularSpoosh(instance) {
824
+ // src/create/index.ts
825
+ function create(instance) {
826
826
  const { api, stateManager, eventEmitter, pluginExecutor } = instance;
827
827
  const injectRead = createInjectRead({
828
828
  api,
package/dist/index.mjs CHANGED
@@ -35,7 +35,7 @@ function createInjectRead(options) {
35
35
  let currentResolvedTags = [];
36
36
  let prevContext = null;
37
37
  let isMounted = false;
38
- const hookId = `angular-${Math.random().toString(36).slice(2)}`;
38
+ const instanceId = `angular-${Math.random().toString(36).slice(2)}`;
39
39
  const captureSelector = () => {
40
40
  const selectorResult = {
41
41
  call: null,
@@ -63,7 +63,7 @@ function createInjectRead(options) {
63
63
  stateManager,
64
64
  eventEmitter,
65
65
  pluginExecutor,
66
- hookId,
66
+ instanceId,
67
67
  fetchFn: async (fetchOpts) => {
68
68
  const pathMethods = api(capturedCall.path);
69
69
  const method = pathMethods[capturedCall.method];
@@ -355,7 +355,7 @@ function createInjectWrite(options) {
355
355
  }
356
356
  return selectorResult.selector;
357
357
  };
358
- const hookId = `angular-${Math.random().toString(36).slice(2)}`;
358
+ const instanceId = `angular-${Math.random().toString(36).slice(2)}`;
359
359
  let currentQueryKey = null;
360
360
  let currentController = null;
361
361
  let currentSubscription = null;
@@ -396,7 +396,7 @@ function createInjectWrite(options) {
396
396
  stateManager,
397
397
  eventEmitter,
398
398
  pluginExecutor,
399
- hookId,
399
+ instanceId,
400
400
  fetchFn: async (fetchOpts) => {
401
401
  const pathMethods = api(selectedEndpoint.path);
402
402
  const method = pathMethods[selectedEndpoint.method];
@@ -521,7 +521,7 @@ function createInjectInfiniteRead(options) {
521
521
  }
522
522
  return selectorResult.call;
523
523
  };
524
- const hookId = `angular-${Math.random().toString(36).slice(2)}`;
524
+ const instanceId = `angular-${Math.random().toString(36).slice(2)}`;
525
525
  const dataSignal = signal3(void 0);
526
526
  const allResponsesSignal = signal3(void 0);
527
527
  const errorSignal = signal3(void 0);
@@ -602,7 +602,7 @@ function createInjectInfiniteRead(options) {
602
602
  stateManager,
603
603
  eventEmitter,
604
604
  pluginExecutor,
605
- hookId,
605
+ instanceId,
606
606
  fetchFn: async (opts, abortSignal) => {
607
607
  const pathMethods = api(capturedCall.path);
608
608
  const method = pathMethods[capturedCall.method];
@@ -823,8 +823,8 @@ function createInjectInfiniteRead(options) {
823
823
  };
824
824
  }
825
825
 
826
- // src/createAngularSpoosh/index.ts
827
- function createAngularSpoosh(instance) {
826
+ // src/create/index.ts
827
+ function create(instance) {
828
828
  const { api, stateManager, eventEmitter, pluginExecutor } = instance;
829
829
  const injectRead = createInjectRead({
830
830
  api,
@@ -868,5 +868,5 @@ function createAngularSpoosh(instance) {
868
868
  };
869
869
  }
870
870
  export {
871
- createAngularSpoosh
871
+ create
872
872
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoosh/angular",
3
- "version": "0.6.4",
3
+ "version": "0.7.0",
4
4
  "license": "MIT",
5
5
  "description": "Angular signals integration for Spoosh API toolkit",
6
6
  "keywords": [
@@ -34,13 +34,13 @@
34
34
  }
35
35
  },
36
36
  "peerDependencies": {
37
- "@spoosh/core": ">=0.11.1",
37
+ "@spoosh/core": ">=0.12.0",
38
38
  "@angular/core": ">=16.0.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@angular/core": "^19.0.0",
42
- "@spoosh/core": "0.11.1",
43
- "@spoosh/test-utils": "0.1.6"
42
+ "@spoosh/core": "0.12.0",
43
+ "@spoosh/test-utils": "0.1.8"
44
44
  },
45
45
  "scripts": {
46
46
  "dev": "tsup --watch",