@fjell/client-api 4.4.2 → 4.4.4

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.
Files changed (76) hide show
  1. package/.kodrdriv/config.yaml +4 -0
  2. package/commit.sh +8 -0
  3. package/dist/AItemAPI.js +6 -1
  4. package/dist/AItemAPI.js.map +1 -1
  5. package/dist/CItemAPI.d.ts +13 -12
  6. package/dist/CItemAPI.js +1 -0
  7. package/dist/CItemAPI.js.map +1 -1
  8. package/dist/ClientApi.d.ts +13 -13
  9. package/dist/ClientApiOptions.d.ts +5 -0
  10. package/dist/PItemAPI.d.ts +14 -13
  11. package/dist/PItemAPI.js +13 -11
  12. package/dist/PItemAPI.js.map +1 -1
  13. package/dist/Utilities.js.map +1 -1
  14. package/dist/index.cjs +132 -91
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/logger.js.map +1 -1
  17. package/dist/ops/action.d.ts +2 -2
  18. package/dist/ops/action.js +6 -5
  19. package/dist/ops/action.js.map +1 -1
  20. package/dist/ops/all.d.ts +2 -2
  21. package/dist/ops/all.js +7 -6
  22. package/dist/ops/all.js.map +1 -1
  23. package/dist/ops/allAction.d.ts +2 -2
  24. package/dist/ops/allAction.js +6 -5
  25. package/dist/ops/allAction.js.map +1 -1
  26. package/dist/ops/allFacet.d.ts +5 -0
  27. package/dist/ops/allFacet.js +24 -0
  28. package/dist/ops/allFacet.js.map +1 -0
  29. package/dist/ops/create.d.ts +3 -3
  30. package/dist/ops/create.js +6 -5
  31. package/dist/ops/create.js.map +1 -1
  32. package/dist/ops/facet.d.ts +2 -2
  33. package/dist/ops/facet.js +7 -5
  34. package/dist/ops/facet.js.map +1 -1
  35. package/dist/ops/find.d.ts +2 -2
  36. package/dist/ops/find.js +10 -9
  37. package/dist/ops/find.js.map +1 -1
  38. package/dist/ops/findOne.d.ts +2 -2
  39. package/dist/ops/findOne.js +8 -7
  40. package/dist/ops/findOne.js.map +1 -1
  41. package/dist/ops/get.d.ts +2 -2
  42. package/dist/ops/get.js +6 -5
  43. package/dist/ops/get.js.map +1 -1
  44. package/dist/ops/index.js +2 -0
  45. package/dist/ops/index.js.map +1 -1
  46. package/dist/ops/one.d.ts +2 -2
  47. package/dist/ops/one.js +7 -6
  48. package/dist/ops/one.js.map +1 -1
  49. package/dist/ops/remove.d.ts +2 -2
  50. package/dist/ops/remove.js +6 -5
  51. package/dist/ops/remove.js.map +1 -1
  52. package/dist/ops/update.d.ts +3 -3
  53. package/dist/ops/update.js +6 -5
  54. package/dist/ops/update.js.map +1 -1
  55. package/dist/util/general.d.ts +4 -0
  56. package/package.json +13 -13
  57. package/release.sh +89 -0
  58. package/src/AItemAPI.ts +5 -0
  59. package/src/CItemAPI.ts +14 -22
  60. package/src/ClientApi.ts +60 -66
  61. package/src/ClientApiOptions.ts +5 -0
  62. package/src/PItemAPI.ts +38 -56
  63. package/src/ops/action.ts +19 -23
  64. package/src/ops/all.ts +17 -19
  65. package/src/ops/allAction.ts +18 -21
  66. package/src/ops/allFacet.ts +46 -0
  67. package/src/ops/create.ts +22 -25
  68. package/src/ops/facet.ts +4 -5
  69. package/src/ops/find.ts +20 -23
  70. package/src/ops/findOne.ts +4 -5
  71. package/src/ops/get.ts +17 -20
  72. package/src/ops/index.ts +6 -0
  73. package/src/ops/one.ts +3 -5
  74. package/src/ops/remove.ts +17 -20
  75. package/src/ops/update.ts +18 -21
  76. package/src/util/general.ts +65 -0
package/src/CItemAPI.ts CHANGED
@@ -5,20 +5,15 @@ import {
5
5
  ItemQuery,
6
6
  LocKeyArray,
7
7
  PriKey,
8
- TypesProperties
9
8
  } from "@fjell/core";
10
9
  import {
11
- DeleteMethodOptions,
12
- GetMethodOptions,
13
- HttpApi,
14
- PostMethodOptions,
15
- PutMethodOptions,
10
+ HttpApi
16
11
  } from "@fjell/http-api";
17
12
  import { createAItemAPI, PathNamesArray } from "./AItemAPI";
18
13
 
14
+ import LibLogger from "@/logger";
19
15
  import { ClientApi } from "./ClientApi";
20
16
  import { ClientApiOptions } from "./ClientApiOptions";
21
- import LibLogger from "@/logger";
22
17
 
23
18
  const logger = LibLogger.get('CItemAPI');
24
19
 
@@ -35,52 +30,48 @@ export interface CItemApi<
35
30
  ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
36
31
  action: string,
37
32
  body: any,
38
- options?: Partial<PostMethodOptions>
39
33
  ) => Promise<V>;
40
34
  all: (
41
35
  query: ItemQuery,
42
- options?: Partial<GetMethodOptions>,
43
36
  locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
44
37
  ) => Promise<V[]>;
45
38
  allAction: (
46
39
  action: string,
47
- body: any,
48
- options?: Partial<PostMethodOptions>,
40
+ body?: any,
49
41
  locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
50
42
  ) => Promise<V[]>;
43
+ allFacet: (
44
+ facet: string,
45
+ params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
46
+ locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
47
+ ) => Promise<any>;
51
48
  get: (
52
49
  ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
53
- options?: Partial<GetMethodOptions>,
54
50
  ) => Promise<V | null>;
55
51
  create: (
56
- item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
57
- options?: Partial<PostMethodOptions>,
52
+ item: Partial<Item<S, L1, L2, L3, L4, L5>>,
58
53
  locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
59
54
  ) => Promise<V>;
60
55
  remove: (
61
56
  ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
62
- options?: Partial<DeleteMethodOptions>
63
57
  ) => Promise<boolean>;
64
58
  update: (
65
59
  ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
66
- item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
67
- options?: Partial<PutMethodOptions>
60
+ item: Partial<Item<S, L1, L2, L3, L4, L5>>,
68
61
  ) => Promise<V>;
69
62
  facet: (
70
63
  ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
71
64
  facet: string,
72
- options?: Partial<GetMethodOptions>,
65
+ params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
73
66
  ) => Promise<any>;
74
67
  find: (
75
68
  finder: string,
76
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
77
- options?: Partial<GetMethodOptions>,
69
+ finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
78
70
  locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
79
71
  ) => Promise<V[]>;
80
72
  findOne: (
81
73
  finder: string,
82
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
83
- options?: Partial<GetMethodOptions>,
74
+ finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
84
75
  locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
85
76
  ) => Promise<V>;
86
77
  };
@@ -103,6 +94,7 @@ export const createCItemApi = <
103
94
  action: aItemAPI.action,
104
95
  all: aItemAPI.all,
105
96
  allAction: aItemAPI.allAction,
97
+ allFacet: aItemAPI.allFacet,
106
98
  one: aItemAPI.one,
107
99
  get: aItemAPI.get,
108
100
  create: aItemAPI.create,
package/src/ClientApi.ts CHANGED
@@ -1,70 +1,64 @@
1
- import { ComKey, Item, ItemQuery, LocKeyArray, PriKey, TypesProperties } from "@fjell/core";
2
- import { DeleteMethodOptions, GetMethodOptions, PostMethodOptions, PutMethodOptions } from "@fjell/http-api";
1
+ import { ComKey, Item, ItemQuery, LocKeyArray, PriKey } from "@fjell/core";
3
2
 
4
3
  export interface ClientApi<
5
- V extends Item<S, L1, L2, L3, L4, L5>,
6
- S extends string,
7
- L1 extends string = never,
8
- L2 extends string = never,
9
- L3 extends string = never,
10
- L4 extends string = never,
11
- L5 extends string = never
4
+ V extends Item<S, L1, L2, L3, L4, L5>,
5
+ S extends string,
6
+ L1 extends string = never,
7
+ L2 extends string = never,
8
+ L3 extends string = never,
9
+ L4 extends string = never,
10
+ L5 extends string = never
12
11
  > {
13
- action: (
14
- ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
15
- action: string,
16
- body: any,
17
- options?: Partial<PostMethodOptions>,
18
- ) => Promise<V>;
19
- all: (
20
- query: ItemQuery,
21
- options?: Partial<GetMethodOptions>,
22
- locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
23
- ) => Promise<V[]>;
24
- allAction: (
25
- action: string,
26
- body: any,
27
- options?: Partial<PostMethodOptions>,
28
- locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
29
- ) => Promise<V[]>;
30
- create: (
31
- item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
32
- options?: Partial<PostMethodOptions>,
33
- locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
34
- ) => Promise<V>;
35
- facet: (
36
- ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
37
- facet: string,
38
- options?: Partial<GetMethodOptions>,
39
- ) => Promise<any>;
40
- find: (
41
- finder: string,
42
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
43
- options?: Partial<GetMethodOptions>,
44
- locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
45
- ) => Promise<V[]>;
46
- findOne: (
47
- finder: string,
48
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
49
- options?: Partial<GetMethodOptions>,
50
- locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
51
- ) => Promise<V>;
52
- get: (
53
- ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
54
- options?: Partial<GetMethodOptions>,
55
- ) => Promise<V | null>;
56
- one: (
57
- query: ItemQuery,
58
- options?: Partial<GetMethodOptions>,
59
- locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
60
- ) => Promise<V | null>;
61
- remove: (
62
- ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
63
- options?: Partial<DeleteMethodOptions>
64
- ) => Promise<boolean>;
65
- update: (
66
- ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
67
- item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
68
- options?: Partial<PutMethodOptions>
69
- ) => Promise<V>;
12
+ action: (
13
+ ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
14
+ action: string,
15
+ body?: any,
16
+ ) => Promise<V>;
17
+ all: (
18
+ query: ItemQuery,
19
+ locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
20
+ ) => Promise<V[]>;
21
+ allAction: (
22
+ action: string,
23
+ body?: any,
24
+ locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
25
+ ) => Promise<V[]>;
26
+ allFacet: (
27
+ facet: string,
28
+ params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
29
+ locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
30
+ ) => Promise<any>;
31
+ create: (
32
+ item: Partial<Item<S, L1, L2, L3, L4, L5>>,
33
+ locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
34
+ ) => Promise<V>;
35
+ facet: (
36
+ ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
37
+ facet: string,
38
+ params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
39
+ ) => Promise<any>;
40
+ find: (
41
+ finder: string,
42
+ finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
43
+ locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
44
+ ) => Promise<V[]>;
45
+ findOne: (
46
+ finder: string,
47
+ finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
48
+ locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
49
+ ) => Promise<V>;
50
+ get: (
51
+ ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
52
+ ) => Promise<V | null>;
53
+ one: (
54
+ query: ItemQuery,
55
+ locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
56
+ ) => Promise<V | null>;
57
+ remove: (
58
+ ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
59
+ ) => Promise<boolean>;
60
+ update: (
61
+ ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
62
+ item: Partial<Item<S, L1, L2, L3, L4, L5>>,
63
+ ) => Promise<V>;
70
64
  }
@@ -1,5 +1,6 @@
1
1
  import { Item } from "@fjell/core";
2
2
  import { ClientApi } from "./ClientApi";
3
+ import { DeleteMethodOptions, GetMethodOptions, PostMethodOptions, PutMethodOptions } from "@fjell/http-api";
3
4
 
4
5
  export interface ClientApiOptions {
5
6
  readAuthenticated?: boolean;
@@ -14,4 +15,8 @@ export interface ClientApiOptions {
14
15
  string | never,
15
16
  string | never
16
17
  >;
18
+ getOptions?: Partial<GetMethodOptions>;
19
+ postOptions?: Partial<PostMethodOptions>;
20
+ putOptions?: Partial<PutMethodOptions>;
21
+ deleteOptions?: Partial<DeleteMethodOptions>;
17
22
  }
package/src/PItemAPI.ts CHANGED
@@ -1,13 +1,10 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
-
3
- import { ComKey, Item, ItemProperties, ItemQuery, PriKey, TypesProperties } from "@fjell/core";
1
+ import { ComKey, Item, ItemQuery, PriKey } from "@fjell/core";
4
2
  import { HttpApi } from "@fjell/http-api";
5
- import { createAItemAPI, PathNamesArray } from "./AItemAPI";
3
+ import { createAItemAPI } from "./AItemAPI";
6
4
  import { ClientApi } from "./ClientApi";
7
5
 
8
- import { DeleteMethodOptions, GetMethodOptions, PostMethodOptions, PutMethodOptions } from "@fjell/http-api";
9
- import { ClientApiOptions } from "./ClientApiOptions";
10
6
  import LibLogger from "@/logger";
7
+ import { ClientApiOptions } from "./ClientApiOptions";
11
8
  const logger = LibLogger.get('PItemAPI');
12
9
 
13
10
  export interface PItemApi<
@@ -19,70 +16,57 @@ export interface PItemApi<
19
16
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
20
17
  action: string,
21
18
  body: any,
22
- options?: Partial<PostMethodOptions>,
23
- locations?: []
24
19
  ) => Promise<V>;
25
20
 
26
21
  all: (
27
22
  query: ItemQuery,
28
- options?: Partial<GetMethodOptions>,
29
- locations?: []
30
23
  ) => Promise<V[]>;
31
24
 
32
25
  allAction: (
33
26
  action: string,
34
- body: any,
35
- options?: Partial<PostMethodOptions>
27
+ body?: any,
36
28
  ) => Promise<V[]>;
37
29
 
30
+ allFacet: (
31
+ facet: string,
32
+ params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
33
+ ) => Promise<any>;
34
+
38
35
  one: (
39
36
  query: ItemQuery,
40
- options?: Partial<GetMethodOptions>
41
37
  ) => Promise<V | null>;
42
38
 
43
39
  get: (
44
40
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
45
- options?: Partial<GetMethodOptions>,
46
- locations?: []
47
41
  ) => Promise<V | null>;
48
42
 
49
43
  create: (
50
- item: TypesProperties<V, S>,
51
- options?: Partial<PostMethodOptions>,
52
- locations?: []
44
+ item: Partial<Item<S>>,
53
45
  ) => Promise<V>;
54
46
 
55
47
  remove: (
56
48
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
57
- options?: Partial<DeleteMethodOptions>,
58
- locations?: []
59
49
  ) => Promise<boolean>;
60
50
 
61
51
  update: (
62
52
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
63
- item: TypesProperties<V, S>,
64
- options?: Partial<PutMethodOptions>,
65
- locations?: []
53
+ item: Partial<Item<S>>,
66
54
  ) => Promise<V>;
67
55
 
68
56
  facet: (
69
57
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
70
58
  facet: string,
71
- options?: Partial<GetMethodOptions>,
59
+ params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
72
60
  ) => Promise<any>;
73
61
 
74
62
  find: (
75
63
  finder: string,
76
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
77
- options?: Partial<GetMethodOptions>,
78
- locations?: []
64
+ finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
79
65
  ) => Promise<V[]>;
80
66
 
81
67
  findOne: (
82
68
  finder: string,
83
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
84
- options?: Partial<GetMethodOptions>,
85
- locations?: []
69
+ finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
86
70
  ) => Promise<V>;
87
71
  }
88
72
 
@@ -102,90 +86,88 @@ export const createPItemApi = <V extends Item<S>, S extends string>(
102
86
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
103
87
  action: string,
104
88
  body: any = {},
105
- options: Partial<PostMethodOptions> = {},
106
89
  ): Promise<V> =>
107
- await aItemAPI.action(ik, action, body, options) as V;
90
+ await aItemAPI.action(ik, action, body) as V;
108
91
 
109
92
  const all =
110
93
  async (
111
94
  query: ItemQuery = {} as ItemQuery,
112
- options: Partial<GetMethodOptions> = {},
113
95
  ): Promise<V[]> =>
114
- await aItemAPI.all(query, options, []) as V[];
96
+ await aItemAPI.all(query, []) as V[];
115
97
 
116
98
  const allAction =
117
99
  async (
118
100
  action: string,
119
101
  body: any = {},
120
- options: Partial<PostMethodOptions> = {},
121
102
  ): Promise<V[]> =>
122
- await aItemAPI.allAction(action, body, options, []) as V[];
103
+ await aItemAPI.allAction(action, body, []) as V[];
104
+
105
+ const allFacet =
106
+ async (
107
+ facet: string,
108
+ params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
109
+ ): Promise<any> =>
110
+ await aItemAPI.allFacet(facet, params) as any;
123
111
 
124
112
  const one =
125
113
  async (
126
114
  query: ItemQuery = {} as ItemQuery,
127
- options: Partial<GetMethodOptions> = {},
128
115
  ): Promise<V | null> =>
129
- await aItemAPI.one(query, options, []) as V | null;
116
+ await aItemAPI.one(query, []) as V | null;
130
117
 
131
118
  const get =
132
119
  async (
133
120
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
134
- options: Partial<GetMethodOptions> = {},
135
121
  ): Promise<V | null> =>
136
- await aItemAPI.get(ik, options) as V | null;
122
+ await aItemAPI.get(ik) as V | null;
137
123
 
138
124
  const create =
139
125
  async (
140
- item: TypesProperties<V, S>,
141
- options: Partial<PostMethodOptions> = {},
126
+ item: Partial<Item<S>>,
142
127
  ): Promise<V> =>
143
- await aItemAPI.create(item, options, []) as V;
128
+ await aItemAPI.create(item, []) as V;
144
129
 
145
130
  const remove =
146
131
  async (
147
132
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
148
- options: Partial<DeleteMethodOptions> = {},
149
133
  ): Promise<boolean> =>
150
- await aItemAPI.remove(ik, options) as boolean;
134
+ await aItemAPI.remove(ik) as boolean;
151
135
 
152
136
  const update =
153
137
  async (
154
138
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
155
- item: TypesProperties<V, S>,
156
- options: Partial<PutMethodOptions> = {},
139
+ item: Partial<Item<S>>,
157
140
  ): Promise<V> =>
158
- await aItemAPI.update(ik, item, options) as V;
141
+ await aItemAPI.update(ik, item) as V;
159
142
 
160
143
  const facet =
161
144
  async (
162
145
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
163
146
  facet: string,
164
- options: Partial<GetMethodOptions> = {},
147
+ params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
165
148
  ): Promise<any> =>
166
- await aItemAPI.facet(ik, facet, options) as any;
149
+ await aItemAPI.facet(ik, facet, params) as any;
167
150
 
168
151
  const find =
169
152
  async (
170
153
  finder: string,
171
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
172
- options: Partial<GetMethodOptions> = {},
154
+ finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
173
155
  ): Promise<V[]> =>
174
- await aItemAPI.find(finder, finderParams, options, []) as V[];
156
+ await aItemAPI.find(finder, finderParams) as V[];
175
157
 
176
158
  const findOne =
177
159
  async (
178
160
  finder: string,
179
- finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
180
- options: Partial<GetMethodOptions> = {},
161
+ finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},
181
162
  ): Promise<V> =>
182
- await aItemAPI.findOne(finder, finderParams, options, []) as V;
163
+ await aItemAPI.findOne(finder, finderParams) as V;
183
164
 
184
165
  return {
185
166
  ...aItemAPI,
186
167
  action,
187
168
  all,
188
169
  allAction,
170
+ allFacet,
189
171
  one,
190
172
  get,
191
173
  create,
package/src/ops/action.ts CHANGED
@@ -3,39 +3,36 @@ import {
3
3
  Item,
4
4
  PriKey,
5
5
  } from "@fjell/core";
6
- import { HttpApi, PostMethodOptions } from "@fjell/http-api";
7
-
6
+ import { HttpApi } from "@fjell/http-api";
7
+
8
8
  import { ClientApiOptions } from "@/ClientApiOptions";
9
9
  import LibLogger from "@/logger";
10
10
  import { Utilities } from "@/Utilities";
11
-
11
+
12
12
  const logger = LibLogger.get('client-api', 'ops', 'action');
13
-
13
+
14
14
  export const getActionOperation = <
15
- V extends Item<S, L1, L2, L3, L4, L5>,
16
- S extends string,
17
- L1 extends string = never,
18
- L2 extends string = never,
19
- L3 extends string = never,
20
- L4 extends string = never,
21
- L5 extends string = never>(
15
+ V extends Item<S, L1, L2, L3, L4, L5>,
16
+ S extends string,
17
+ L1 extends string = never,
18
+ L2 extends string = never,
19
+ L3 extends string = never,
20
+ L4 extends string = never,
21
+ L5 extends string = never>(
22
22
  api: HttpApi,
23
23
  apiOptions: ClientApiOptions,
24
24
  utilities: Utilities<V, S, L1, L2, L3, L4, L5>
25
-
25
+
26
26
  ) => {
27
-
27
+
28
28
  const action = async (
29
29
  ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
30
30
  action: string,
31
31
  body: any = {},
32
- options: Partial<PostMethodOptions> = {}
33
- ):
34
- Promise<V> => {
35
- logger.default('action', { ik, action, body });
36
-
37
- const requestOptions = Object.assign({}, options, { isAuthenticated: apiOptions.writeAuthenticated });
38
-
32
+ ): Promise<V> => {
33
+ const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });
34
+ logger.default('action', { ik, action, body, requestOptions });
35
+
39
36
  return utilities.validatePK(
40
37
  await utilities.processOne(
41
38
  api.httpPost<V>(
@@ -44,9 +41,8 @@ export const getActionOperation = <
44
41
  requestOptions,
45
42
  )
46
43
  )) as V;
47
-
44
+
48
45
  };
49
-
46
+
50
47
  return action;
51
48
  }
52
-
package/src/ops/all.ts CHANGED
@@ -5,41 +5,39 @@ import {
5
5
  queryToParams,
6
6
  } from "@fjell/core";
7
7
  import { HttpApi, QueryParams } from "@fjell/http-api";
8
-
8
+
9
9
  import { ClientApiOptions } from "@/ClientApiOptions";
10
10
  import LibLogger from "@/logger";
11
11
  import { Utilities } from "@/Utilities";
12
- import { GetMethodOptions } from "@fjell/http-api";
13
-
12
+
14
13
  const logger = LibLogger.get('client-api', 'ops', 'all');
15
14
 
16
15
  export const getAllOperation = <
17
- V extends Item<S, L1, L2, L3, L4, L5>,
18
- S extends string,
19
- L1 extends string = never,
20
- L2 extends string = never,
21
- L3 extends string = never,
22
- L4 extends string = never,
23
- L5 extends string = never>(
16
+ V extends Item<S, L1, L2, L3, L4, L5>,
17
+ S extends string,
18
+ L1 extends string = never,
19
+ L2 extends string = never,
20
+ L3 extends string = never,
21
+ L4 extends string = never,
22
+ L5 extends string = never>(
24
23
  api: HttpApi,
25
24
  apiOptions: ClientApiOptions,
26
25
  utilities: Utilities<V, S, L1, L2, L3, L4, L5>
27
-
26
+
28
27
  ) => {
29
-
28
+
30
29
  const all = async (
31
30
  query: ItemQuery = {} as ItemQuery,
32
- options: Partial<GetMethodOptions> = {},
33
31
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
34
32
  ): Promise<V[]> => {
35
- logger.default('all', { query, locations });
36
33
  utilities.verifyLocations(locations);
37
34
  const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;
38
-
35
+
39
36
  const params: QueryParams = queryToParams(query);
40
-
41
- const requestOptions = Object.assign({}, options, { isAuthenticated: apiOptions.allAuthenticated, params });
42
-
37
+ const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params });
38
+
39
+ logger.default('all', { query, locations, requestOptions });
40
+
43
41
  return utilities.validatePK(await utilities.processArray(
44
42
  api.httpGet<V[]>(
45
43
  utilities.getPath(loc),
@@ -49,4 +47,4 @@ export const getAllOperation = <
49
47
 
50
48
  return all;
51
49
  }
52
-
50
+
@@ -2,41 +2,39 @@ import {
2
2
  Item,
3
3
  LocKeyArray
4
4
  } from "@fjell/core";
5
- import { HttpApi, PostMethodOptions } from "@fjell/http-api";
6
-
5
+ import { HttpApi } from "@fjell/http-api";
6
+
7
7
  import { ClientApiOptions } from "@/ClientApiOptions";
8
8
  import LibLogger from "@/logger";
9
9
  import { Utilities } from "@/Utilities";
10
-
10
+
11
11
  const logger = LibLogger.get('client-api', 'ops', 'allAction');
12
-
12
+
13
13
  export const getAllActionOperation = <
14
- V extends Item<S, L1, L2, L3, L4, L5>,
15
- S extends string,
16
- L1 extends string = never,
17
- L2 extends string = never,
18
- L3 extends string = never,
19
- L4 extends string = never,
20
- L5 extends string = never>(
14
+ V extends Item<S, L1, L2, L3, L4, L5>,
15
+ S extends string,
16
+ L1 extends string = never,
17
+ L2 extends string = never,
18
+ L3 extends string = never,
19
+ L4 extends string = never,
20
+ L5 extends string = never>(
21
21
  api: HttpApi,
22
22
  apiOptions: ClientApiOptions,
23
23
  utilities: Utilities<V, S, L1, L2, L3, L4, L5>
24
-
24
+
25
25
  ) => {
26
-
26
+
27
27
  const allAction = async (
28
28
  action: string,
29
29
  body: any = {},
30
- options: Partial<PostMethodOptions> = {},
31
30
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
32
31
  ): Promise<V[]> => {
33
- logger.default('allAction', { action, body, locations });
32
+ const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });
33
+ logger.default('allAction', { action, body, locations, requestOptions });
34
34
  utilities.verifyLocations(locations);
35
-
35
+
36
36
  const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;
37
-
38
- const requestOptions = Object.assign({}, options, { isAuthenticated: apiOptions.writeAuthenticated });
39
-
37
+
40
38
  // TODO: This should respond to either a single object, or multiple objects in an array.
41
39
  return utilities.validatePK(
42
40
  await utilities.processArray(
@@ -47,7 +45,6 @@ export const getAllActionOperation = <
47
45
  )
48
46
  )) as V[];
49
47
  };
50
-
48
+
51
49
  return allAction;
52
50
  }
53
-