@spoosh/angular 0.3.0 → 0.4.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/dist/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +5 -7
- package/dist/index.mjs +5 -7
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _spoosh_core from '@spoosh/core';
|
|
2
|
-
import { PluginArray, StateManager, EventEmitter, PluginExecutor, ReadClient, SpooshResponse, WriteClient, MethodOptionsMap, CoreRequestOptionsBase, SpooshPlugin, PluginTypeConfig, InfiniteRequestOptions, ResolveTypes, ResolverContext, ResolveResultTypes, MergePluginInstanceApi } from '@spoosh/core';
|
|
2
|
+
import { PluginArray, StateManager, EventEmitter, PluginExecutor, ReadClient, TagOptions, SpooshResponse, WriteClient, MethodOptionsMap, CoreRequestOptionsBase, SpooshPlugin, PluginTypeConfig, InfiniteRequestOptions, ResolveTypes, ResolverContext, ResolveResultTypes, MergePluginInstanceApi } from '@spoosh/core';
|
|
3
3
|
import { Signal } from '@angular/core';
|
|
4
4
|
|
|
5
5
|
interface SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins extends PluginArray> {
|
|
@@ -14,10 +14,8 @@ interface SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins extends Plu
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
type EnabledOption = boolean | (() => boolean);
|
|
17
|
-
interface BaseReadOptions {
|
|
17
|
+
interface BaseReadOptions extends TagOptions {
|
|
18
18
|
enabled?: EnabledOption;
|
|
19
|
-
tags?: string[];
|
|
20
|
-
additionalTags?: string[];
|
|
21
19
|
}
|
|
22
20
|
interface BaseReadResult<TData, TError, TPluginResult = Record<string, unknown>> {
|
|
23
21
|
data: Signal<TData | undefined>;
|
|
@@ -42,7 +40,8 @@ type PageContext<TData, TRequest> = {
|
|
|
42
40
|
allResponses: TData[];
|
|
43
41
|
request: TRequest;
|
|
44
42
|
};
|
|
45
|
-
interface BaseInfiniteReadOptions<TData, TItem, TRequest> extends
|
|
43
|
+
interface BaseInfiniteReadOptions<TData, TItem, TRequest> extends TagOptions {
|
|
44
|
+
enabled?: EnabledOption;
|
|
46
45
|
canFetchNext: (ctx: PageContext<TData, TRequest>) => boolean;
|
|
47
46
|
canFetchPrev?: (ctx: PageContext<TData, TRequest>) => boolean;
|
|
48
47
|
nextPageRequest: (ctx: PageContext<TData, TRequest>) => Partial<TRequest>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _spoosh_core from '@spoosh/core';
|
|
2
|
-
import { PluginArray, StateManager, EventEmitter, PluginExecutor, ReadClient, SpooshResponse, WriteClient, MethodOptionsMap, CoreRequestOptionsBase, SpooshPlugin, PluginTypeConfig, InfiniteRequestOptions, ResolveTypes, ResolverContext, ResolveResultTypes, MergePluginInstanceApi } from '@spoosh/core';
|
|
2
|
+
import { PluginArray, StateManager, EventEmitter, PluginExecutor, ReadClient, TagOptions, SpooshResponse, WriteClient, MethodOptionsMap, CoreRequestOptionsBase, SpooshPlugin, PluginTypeConfig, InfiniteRequestOptions, ResolveTypes, ResolverContext, ResolveResultTypes, MergePluginInstanceApi } from '@spoosh/core';
|
|
3
3
|
import { Signal } from '@angular/core';
|
|
4
4
|
|
|
5
5
|
interface SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins extends PluginArray> {
|
|
@@ -14,10 +14,8 @@ interface SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins extends Plu
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
type EnabledOption = boolean | (() => boolean);
|
|
17
|
-
interface BaseReadOptions {
|
|
17
|
+
interface BaseReadOptions extends TagOptions {
|
|
18
18
|
enabled?: EnabledOption;
|
|
19
|
-
tags?: string[];
|
|
20
|
-
additionalTags?: string[];
|
|
21
19
|
}
|
|
22
20
|
interface BaseReadResult<TData, TError, TPluginResult = Record<string, unknown>> {
|
|
23
21
|
data: Signal<TData | undefined>;
|
|
@@ -42,7 +40,8 @@ type PageContext<TData, TRequest> = {
|
|
|
42
40
|
allResponses: TData[];
|
|
43
41
|
request: TRequest;
|
|
44
42
|
};
|
|
45
|
-
interface BaseInfiniteReadOptions<TData, TItem, TRequest> extends
|
|
43
|
+
interface BaseInfiniteReadOptions<TData, TItem, TRequest> extends TagOptions {
|
|
44
|
+
enabled?: EnabledOption;
|
|
46
45
|
canFetchNext: (ctx: PageContext<TData, TRequest>) => boolean;
|
|
47
46
|
canFetchPrev?: (ctx: PageContext<TData, TRequest>) => boolean;
|
|
48
47
|
nextPageRequest: (ctx: PageContext<TData, TRequest>) => Partial<TRequest>;
|
package/dist/index.js
CHANGED
|
@@ -33,8 +33,7 @@ function createInjectRead(options) {
|
|
|
33
33
|
const destroyRef = (0, import_core.inject)(import_core.DestroyRef);
|
|
34
34
|
const {
|
|
35
35
|
enabled: enabledOption = true,
|
|
36
|
-
tags
|
|
37
|
-
additionalTags = void 0,
|
|
36
|
+
tags,
|
|
38
37
|
...pluginOpts
|
|
39
38
|
} = readOptions ?? {};
|
|
40
39
|
const getEnabled = () => typeof enabledOption === "function" ? enabledOption() : enabledOption;
|
|
@@ -137,7 +136,7 @@ function createInjectRead(options) {
|
|
|
137
136
|
initialRequestOptions?.params
|
|
138
137
|
);
|
|
139
138
|
const initialResolvedTags = (0, import_core2.resolveTags)(
|
|
140
|
-
{ tags
|
|
139
|
+
tags !== void 0 ? { tags } : void 0,
|
|
141
140
|
initialResolvedPath
|
|
142
141
|
);
|
|
143
142
|
const initialQueryKey = stateManager.createQueryKey({
|
|
@@ -162,7 +161,7 @@ function createInjectRead(options) {
|
|
|
162
161
|
const pathSegments = capturedCall.path.split("/").filter(Boolean);
|
|
163
162
|
const resolvedPath = (0, import_core2.resolvePath)(pathSegments, requestOptions?.params);
|
|
164
163
|
const resolvedTags = (0, import_core2.resolveTags)(
|
|
165
|
-
{ tags
|
|
164
|
+
tags !== void 0 ? { tags } : void 0,
|
|
166
165
|
resolvedPath
|
|
167
166
|
);
|
|
168
167
|
const queryKey = stateManager.createQueryKey({
|
|
@@ -449,7 +448,6 @@ function createInjectInfiniteRead(options) {
|
|
|
449
448
|
const {
|
|
450
449
|
enabled: enabledOption = true,
|
|
451
450
|
tags,
|
|
452
|
-
additionalTags,
|
|
453
451
|
canFetchNext,
|
|
454
452
|
nextPageRequest,
|
|
455
453
|
merger,
|
|
@@ -617,7 +615,7 @@ function createInjectInfiniteRead(options) {
|
|
|
617
615
|
initialRequestOptions?.params
|
|
618
616
|
);
|
|
619
617
|
const initialResolvedTags = (0, import_core6.resolveTags)(
|
|
620
|
-
{ tags
|
|
618
|
+
tags !== void 0 ? { tags } : void 0,
|
|
621
619
|
initialResolvedPath
|
|
622
620
|
);
|
|
623
621
|
const initialBaseOptionsForKey = {
|
|
@@ -640,7 +638,7 @@ function createInjectInfiniteRead(options) {
|
|
|
640
638
|
const pathSegments = capturedCall.path.split("/").filter(Boolean);
|
|
641
639
|
const resolvedPath = (0, import_core6.resolvePath)(pathSegments, requestOptions?.params);
|
|
642
640
|
const resolvedTags = (0, import_core6.resolveTags)(
|
|
643
|
-
{ tags
|
|
641
|
+
tags !== void 0 ? { tags } : void 0,
|
|
644
642
|
resolvedPath
|
|
645
643
|
);
|
|
646
644
|
const baseOptionsForKey = {
|
package/dist/index.mjs
CHANGED
|
@@ -18,8 +18,7 @@ function createInjectRead(options) {
|
|
|
18
18
|
const destroyRef = inject(DestroyRef);
|
|
19
19
|
const {
|
|
20
20
|
enabled: enabledOption = true,
|
|
21
|
-
tags
|
|
22
|
-
additionalTags = void 0,
|
|
21
|
+
tags,
|
|
23
22
|
...pluginOpts
|
|
24
23
|
} = readOptions ?? {};
|
|
25
24
|
const getEnabled = () => typeof enabledOption === "function" ? enabledOption() : enabledOption;
|
|
@@ -122,7 +121,7 @@ function createInjectRead(options) {
|
|
|
122
121
|
initialRequestOptions?.params
|
|
123
122
|
);
|
|
124
123
|
const initialResolvedTags = resolveTags(
|
|
125
|
-
{ tags
|
|
124
|
+
tags !== void 0 ? { tags } : void 0,
|
|
126
125
|
initialResolvedPath
|
|
127
126
|
);
|
|
128
127
|
const initialQueryKey = stateManager.createQueryKey({
|
|
@@ -147,7 +146,7 @@ function createInjectRead(options) {
|
|
|
147
146
|
const pathSegments = capturedCall.path.split("/").filter(Boolean);
|
|
148
147
|
const resolvedPath = resolvePath(pathSegments, requestOptions?.params);
|
|
149
148
|
const resolvedTags = resolveTags(
|
|
150
|
-
{ tags
|
|
149
|
+
tags !== void 0 ? { tags } : void 0,
|
|
151
150
|
resolvedPath
|
|
152
151
|
);
|
|
153
152
|
const queryKey = stateManager.createQueryKey({
|
|
@@ -451,7 +450,6 @@ function createInjectInfiniteRead(options) {
|
|
|
451
450
|
const {
|
|
452
451
|
enabled: enabledOption = true,
|
|
453
452
|
tags,
|
|
454
|
-
additionalTags,
|
|
455
453
|
canFetchNext,
|
|
456
454
|
nextPageRequest,
|
|
457
455
|
merger,
|
|
@@ -619,7 +617,7 @@ function createInjectInfiniteRead(options) {
|
|
|
619
617
|
initialRequestOptions?.params
|
|
620
618
|
);
|
|
621
619
|
const initialResolvedTags = resolveTags3(
|
|
622
|
-
{ tags
|
|
620
|
+
tags !== void 0 ? { tags } : void 0,
|
|
623
621
|
initialResolvedPath
|
|
624
622
|
);
|
|
625
623
|
const initialBaseOptionsForKey = {
|
|
@@ -642,7 +640,7 @@ function createInjectInfiniteRead(options) {
|
|
|
642
640
|
const pathSegments = capturedCall.path.split("/").filter(Boolean);
|
|
643
641
|
const resolvedPath = resolvePath3(pathSegments, requestOptions?.params);
|
|
644
642
|
const resolvedTags = resolveTags3(
|
|
645
|
-
{ tags
|
|
643
|
+
tags !== void 0 ? { tags } : void 0,
|
|
646
644
|
resolvedPath
|
|
647
645
|
);
|
|
648
646
|
const baseOptionsForKey = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Angular signals integration for Spoosh API client",
|
|
6
6
|
"keywords": [
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@spoosh/core": ">=0.
|
|
37
|
+
"@spoosh/core": ">=0.7.0",
|
|
38
38
|
"@angular/core": ">=16.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@spoosh/core": "0.
|
|
41
|
+
"@spoosh/core": "0.7.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"dev": "tsup --watch",
|