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