@fjell/client-api 4.4.0 → 4.4.2

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 (57) hide show
  1. package/.kodrdriv/config.yaml +10 -0
  2. package/.kodrdriv/context/content.md +1 -0
  3. package/dist/AItemAPI.js +3 -1
  4. package/dist/AItemAPI.js.map +1 -0
  5. package/dist/CItemAPI.d.ts +11 -9
  6. package/dist/CItemAPI.js +4 -2
  7. package/dist/CItemAPI.js.map +1 -0
  8. package/dist/ClientApi.d.ts +11 -9
  9. package/dist/PItemAPI.d.ts +12 -10
  10. package/dist/PItemAPI.js +6 -2
  11. package/dist/PItemAPI.js.map +1 -0
  12. package/dist/Utilities.js +1 -1
  13. package/dist/Utilities.js.map +1 -0
  14. package/dist/index.cjs +486 -0
  15. package/dist/index.cjs.map +1 -0
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -0
  18. package/dist/logger.js +2 -2
  19. package/dist/logger.js.map +1 -0
  20. package/dist/ops/action.js +1 -1
  21. package/dist/ops/action.js.map +1 -0
  22. package/dist/ops/all.js +1 -1
  23. package/dist/ops/all.js.map +1 -0
  24. package/dist/ops/allAction.js +1 -1
  25. package/dist/ops/allAction.js.map +1 -0
  26. package/dist/ops/create.js +1 -1
  27. package/dist/ops/create.js.map +1 -0
  28. package/dist/ops/facet.d.ts +5 -0
  29. package/dist/ops/facet.js +32 -0
  30. package/dist/ops/facet.js.map +1 -0
  31. package/dist/ops/find.js +1 -1
  32. package/dist/ops/find.js.map +1 -0
  33. package/dist/ops/findOne.d.ts +5 -0
  34. package/dist/ops/findOne.js +26 -0
  35. package/dist/ops/findOne.js.map +1 -0
  36. package/dist/ops/get.js +1 -1
  37. package/dist/ops/get.js.map +1 -0
  38. package/dist/ops/index.js +5 -1
  39. package/dist/ops/index.js.map +1 -0
  40. package/dist/ops/one.d.ts +1 -1
  41. package/dist/ops/one.js +2 -2
  42. package/dist/ops/one.js.map +1 -0
  43. package/dist/ops/remove.js +1 -1
  44. package/dist/ops/remove.js.map +1 -0
  45. package/dist/ops/update.js +1 -1
  46. package/dist/ops/update.js.map +1 -0
  47. package/package.json +25 -25
  48. package/src/AItemAPI.ts +12 -9
  49. package/src/CItemAPI.ts +27 -19
  50. package/src/ClientApi.ts +25 -14
  51. package/src/PItemAPI.ts +63 -35
  52. package/src/Utilities.ts +47 -47
  53. package/src/logger.ts +1 -1
  54. package/src/ops/facet.ts +59 -0
  55. package/src/ops/findOne.ts +52 -0
  56. package/src/ops/index.ts +74 -61
  57. package/src/ops/one.ts +22 -23
package/src/PItemAPI.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
-
2
+
3
3
  import { ComKey, Item, ItemProperties, ItemQuery, PriKey, TypesProperties } from "@fjell/core";
4
4
  import { HttpApi } from "@fjell/http-api";
5
5
  import { createAItemAPI, PathNamesArray } from "./AItemAPI";
@@ -14,74 +14,84 @@ export interface PItemApi<
14
14
  V extends Item<S>,
15
15
  S extends string
16
16
  > extends ClientApi<V, S> {
17
-
17
+
18
18
  action: (
19
19
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
20
20
  action: string,
21
21
  body: any,
22
- options: Partial<PostMethodOptions>,
22
+ options?: Partial<PostMethodOptions>,
23
23
  locations?: []
24
24
  ) => Promise<V>;
25
25
 
26
26
  all: (
27
27
  query: ItemQuery,
28
- options: Partial<GetMethodOptions>,
28
+ options?: Partial<GetMethodOptions>,
29
29
  locations?: []
30
30
  ) => Promise<V[]>;
31
31
 
32
32
  allAction: (
33
33
  action: string,
34
34
  body: any,
35
- options: Partial<PostMethodOptions>
35
+ options?: Partial<PostMethodOptions>
36
36
  ) => Promise<V[]>;
37
37
 
38
38
  one: (
39
39
  query: ItemQuery,
40
- options: Partial<GetMethodOptions>
40
+ options?: Partial<GetMethodOptions>
41
41
  ) => Promise<V | null>;
42
42
 
43
43
  get: (
44
44
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
45
- options: Partial<GetMethodOptions>,
45
+ options?: Partial<GetMethodOptions>,
46
46
  locations?: []
47
47
  ) => Promise<V | null>;
48
48
 
49
49
  create: (
50
50
  item: TypesProperties<V, S>,
51
- options: Partial<PostMethodOptions>,
51
+ options?: Partial<PostMethodOptions>,
52
52
  locations?: []
53
53
  ) => Promise<V>;
54
54
 
55
55
  remove: (
56
56
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
57
- options: Partial<DeleteMethodOptions>,
57
+ options?: Partial<DeleteMethodOptions>,
58
58
  locations?: []
59
59
  ) => Promise<boolean>;
60
60
 
61
61
  update: (
62
62
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
63
63
  item: TypesProperties<V, S>,
64
- options: Partial<PutMethodOptions>,
64
+ options?: Partial<PutMethodOptions>,
65
65
  locations?: []
66
66
  ) => Promise<V>;
67
67
 
68
+ facet: (
69
+ ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
70
+ facet: string,
71
+ options?: Partial<GetMethodOptions>,
72
+ ) => Promise<any>;
73
+
68
74
  find: (
69
75
  finder: string,
70
76
  finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
71
- options: Partial<GetMethodOptions>,
77
+ options?: Partial<GetMethodOptions>,
72
78
  locations?: []
73
79
  ) => Promise<V[]>;
80
+
81
+ findOne: (
82
+ finder: string,
83
+ finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
84
+ options?: Partial<GetMethodOptions>,
85
+ locations?: []
86
+ ) => Promise<V>;
74
87
  }
75
88
 
76
- export const createPItemApi = <
77
- V extends Item<S>,
78
- S extends string
79
- >(
80
- api: HttpApi,
81
- type: S,
82
- pathName: string,
83
- options: ClientApiOptions
84
- ): PItemApi<V, S> => {
89
+ export const createPItemApi = <V extends Item<S>, S extends string>(
90
+ api: HttpApi,
91
+ type: S,
92
+ pathName: string,
93
+ options?: ClientApiOptions
94
+ ): PItemApi<V, S> => {
85
95
 
86
96
  logger.default('createPItemApi', { type, pathName, options });
87
97
 
@@ -94,14 +104,14 @@ export const createPItemApi = <
94
104
  body: any = {},
95
105
  options: Partial<PostMethodOptions> = {},
96
106
  ): Promise<V> =>
97
- await aItemAPI.action(ik, action, body, options) as V;
107
+ await aItemAPI.action(ik, action, body, options) as V;
98
108
 
99
109
  const all =
100
110
  async (
101
111
  query: ItemQuery = {} as ItemQuery,
102
112
  options: Partial<GetMethodOptions> = {},
103
113
  ): Promise<V[]> =>
104
- await aItemAPI.all(query, options, []) as V[];
114
+ await aItemAPI.all(query, options, []) as V[];
105
115
 
106
116
  const allAction =
107
117
  async (
@@ -109,51 +119,67 @@ export const createPItemApi = <
109
119
  body: any = {},
110
120
  options: Partial<PostMethodOptions> = {},
111
121
  ): Promise<V[]> =>
112
- await aItemAPI.allAction(action, body, options, []) as V[];
113
-
122
+ await aItemAPI.allAction(action, body, options, []) as V[];
123
+
114
124
  const one =
115
125
  async (
116
126
  query: ItemQuery = {} as ItemQuery,
117
127
  options: Partial<GetMethodOptions> = {},
118
128
  ): Promise<V | null> =>
119
- await aItemAPI.one(query, options, []) as V | null;
120
-
129
+ await aItemAPI.one(query, options, []) as V | null;
130
+
121
131
  const get =
122
132
  async (
123
133
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
124
134
  options: Partial<GetMethodOptions> = {},
125
135
  ): Promise<V | null> =>
126
- await aItemAPI.get(ik, options) as V | null;
127
-
136
+ await aItemAPI.get(ik, options) as V | null;
137
+
128
138
  const create =
129
139
  async (
130
140
  item: TypesProperties<V, S>,
131
141
  options: Partial<PostMethodOptions> = {},
132
142
  ): Promise<V> =>
133
- await aItemAPI.create(item, options, []) as V;
134
-
143
+ await aItemAPI.create(item, options, []) as V;
144
+
135
145
  const remove =
136
146
  async (
137
147
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
138
148
  options: Partial<DeleteMethodOptions> = {},
139
149
  ): Promise<boolean> =>
140
- await aItemAPI.remove(ik, options) as boolean;
141
-
150
+ await aItemAPI.remove(ik, options) as boolean;
151
+
142
152
  const update =
143
153
  async (
144
154
  ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
145
155
  item: TypesProperties<V, S>,
146
156
  options: Partial<PutMethodOptions> = {},
147
157
  ): Promise<V> =>
148
- await aItemAPI.update(ik, item, options) as V;
149
-
158
+ await aItemAPI.update(ik, item, options) as V;
159
+
160
+ const facet =
161
+ async (
162
+ ik: PriKey<S> | ComKey<S, never, never, never, never, never>,
163
+ facet: string,
164
+ options: Partial<GetMethodOptions> = {},
165
+ ): Promise<any> =>
166
+ await aItemAPI.facet(ik, facet, options) as any;
167
+
150
168
  const find =
151
169
  async (
152
170
  finder: string,
153
171
  finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
154
172
  options: Partial<GetMethodOptions> = {},
155
173
  ): Promise<V[]> =>
156
- await aItemAPI.find(finder, finderParams, options, []) as V[];
174
+ await aItemAPI.find(finder, finderParams, options, []) as V[];
175
+
176
+ const findOne =
177
+ async (
178
+ finder: string,
179
+ finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
180
+ options: Partial<GetMethodOptions> = {},
181
+ ): Promise<V> =>
182
+ await aItemAPI.findOne(finder, finderParams, options, []) as V;
157
183
 
158
184
  return {
159
185
  ...aItemAPI,
@@ -165,7 +191,9 @@ export const createPItemApi = <
165
191
  create,
166
192
  remove,
167
193
  update,
194
+ facet,
168
195
  find,
196
+ findOne,
169
197
  };
170
198
 
171
199
  };
package/src/Utilities.ts CHANGED
@@ -15,31 +15,31 @@ import deepmerge from "deepmerge";
15
15
  const logger = LibLogger.get('client-api', 'Utility');
16
16
 
17
17
  export interface Utilities<
18
- V extends Item<S, L1, L2, L3, L4, L5>,
19
- S extends string,
20
- L1 extends string = never,
21
- L2 extends string = never,
22
- L3 extends string = never,
23
- L4 extends string = never,
24
- L5 extends string = never
18
+ V extends Item<S, L1, L2, L3, L4, L5>,
19
+ S extends string,
20
+ L1 extends string = never,
21
+ L2 extends string = never,
22
+ L3 extends string = never,
23
+ L4 extends string = never,
24
+ L5 extends string = never
25
25
  > {
26
- verifyLocations: (locations: LocKeyArray<L1, L2, L3, L4, L5> | [] | never) => boolean;
27
- processOne: (apiCall: Promise<V>) => Promise<V>;
28
- processArray: (api: Promise<V[]>) => Promise<V[]>;
29
- convertDoc: (doc: V) => V;
30
- getPath: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | []) => string;
31
- validatePK: (item: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[]) =>
32
- Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[];
26
+ verifyLocations: (locations: LocKeyArray<L1, L2, L3, L4, L5> | [] | never) => boolean;
27
+ processOne: (apiCall: Promise<V>) => Promise<V>;
28
+ processArray: (api: Promise<V[]>) => Promise<V[]>;
29
+ convertDoc: (doc: V) => V;
30
+ getPath: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | []) => string;
31
+ validatePK: (item: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[]) =>
32
+ Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[];
33
33
  }
34
34
 
35
35
  export const createUtilities = <
36
- V extends Item<S, L1, L2, L3, L4, L5>,
37
- S extends string,
38
- L1 extends string = never,
39
- L2 extends string = never,
40
- L3 extends string = never,
41
- L4 extends string = never,
42
- L5 extends string = never
36
+ V extends Item<S, L1, L2, L3, L4, L5>,
37
+ S extends string,
38
+ L1 extends string = never,
39
+ L2 extends string = never,
40
+ L3 extends string = never,
41
+ L4 extends string = never,
42
+ L5 extends string = never
43
43
  >(pkType: S, pathNames: string[]): Utilities<V, S, L1, L2, L3, L4, L5> => {
44
44
 
45
45
  logger.default('createUtilities', { pkType, pathNames });
@@ -47,10 +47,10 @@ export const createUtilities = <
47
47
  const verifyLocations = (
48
48
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] | never,
49
49
  ): boolean => {
50
-
50
+
51
51
  if (locations && locations.length < pathNames.length - 1) {
52
52
  throw new Error('Not enough locations for pathNames: locations:'
53
- + locations.length + ' pathNames:' + pathNames.length);
53
+ + locations.length + ' pathNames:' + pathNames.length);
54
54
  }
55
55
  return true;
56
56
  }
@@ -96,33 +96,33 @@ export const createUtilities = <
96
96
  };
97
97
 
98
98
  const getPath =
99
- (
100
- key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | [],
101
- ):
102
- string => {
99
+ (
100
+ key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | [],
101
+ ):
102
+ string => {
103
103
 
104
- const localPathNames = [...pathNames];
105
- logger.default('getPath', { key, pathNames: localPathNames });
104
+ const localPathNames = [...pathNames];
105
+ logger.default('getPath', { key, pathNames: localPathNames });
106
106
 
107
- // console.log('getPath key: ' + JSON.stringify(key));
107
+ // console.log('getPath key: ' + JSON.stringify(key));
108
108
 
109
- const keys = generateKeyArray(key);
109
+ const keys = generateKeyArray(key);
110
110
 
111
- // console.log('getPath keys: ' + JSON.stringify(keys));
112
- // console.log('getPath pathNames: ' + JSON.stringify(pathNames));
111
+ // console.log('getPath keys: ' + JSON.stringify(keys));
112
+ // console.log('getPath pathNames: ' + JSON.stringify(pathNames));
113
113
 
114
- let path: string = addPath('', keys, localPathNames);
114
+ let path: string = addPath('', keys, localPathNames);
115
115
 
116
- // If there is only one collection left in the collections array, this means that
117
- // we received LocKeys and we need to add the last collection to the reference
118
- if (localPathNames.length === 1) {
119
- path = `${path}/${localPathNames[0]}`;
120
- }
116
+ // If there is only one collection left in the collections array, this means that
117
+ // we received LocKeys and we need to add the last collection to the reference
118
+ if (localPathNames.length === 1) {
119
+ path = `${path}/${localPathNames[0]}`;
120
+ }
121
121
 
122
- logger.default('getPath created', { key, path });
122
+ logger.default('getPath created', { key, path });
123
123
 
124
- return path;
125
- };
124
+ return path;
125
+ };
126
126
 
127
127
  const addPath = (
128
128
  base: string,
@@ -134,19 +134,19 @@ export const createUtilities = <
134
134
  logger.error('addPath should never have keys with a length less than the length of pathNames - 1',
135
135
  { keys, localPathNames });
136
136
  throw new Error('addPath should never have keys with a length less than the length of pathNames - 1: '
137
- + keys.length + ' ' + localPathNames.length + ' ' + JSON.stringify(keys, localPathNames));
137
+ + keys.length + ' ' + localPathNames.length + ' ' + JSON.stringify(keys, localPathNames));
138
138
  } else if (keys.length > localPathNames.length) {
139
139
  logger.error('addPath should never have keys with a length greater than the length of pathNames',
140
140
  { keys, pathNames });
141
141
  throw new Error('addPath should never have keys with a length greater than the length of pathNames: '
142
- + keys.length + ' ' + localPathNames.length + ' ' + JSON.stringify(keys, localPathNames));
142
+ + keys.length + ' ' + localPathNames.length + ' ' + JSON.stringify(keys, localPathNames));
143
143
  }
144
144
  if (keys.length === 0) {
145
- // If you've recursively consumed all of the keys, return the base.
145
+ // If you've recursively consumed all of the keys, return the base.
146
146
  logger.default('addPath returning base', { base });
147
147
  return base;
148
148
  } else {
149
- // Retrieve the next key and collection, and create the next base
149
+ // Retrieve the next key and collection, and create the next base
150
150
  let nextBase: string;
151
151
  const key = keys.pop();
152
152
  const pathName = localPathNames.pop();
@@ -168,7 +168,7 @@ export const createUtilities = <
168
168
 
169
169
  const validatePK = (
170
170
  item: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[]):
171
- Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[] => {
171
+ Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[] => {
172
172
  return coreValidatePK<S, L1, L2, L3, L4, L5>(item, pkType);
173
173
  }
174
174
 
package/src/logger.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Logging from '@fjell/logging';
2
2
 
3
- const LibLogger = Logging.getLogger('@fjellproject/client-api');
3
+ const LibLogger = Logging.getLogger('@fjell/client-api');
4
4
 
5
5
  export default LibLogger;
@@ -0,0 +1,59 @@
1
+ import {
2
+ ComKey,
3
+ Item,
4
+ PriKey,
5
+ } from "@fjell/core";
6
+ import { GetMethodOptions, HttpApi } from "@fjell/http-api";
7
+
8
+ import { ClientApiOptions } from "@/ClientApiOptions";
9
+ import LibLogger from "@/logger";
10
+ import { Utilities } from "@/Utilities";
11
+
12
+ const logger = LibLogger.get('client-api', 'ops', 'facet');
13
+
14
+ export const getFacetOperation = <
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
+ api: HttpApi,
23
+ apiOptions: ClientApiOptions,
24
+ utilities: Utilities<V, S, L1, L2, L3, L4, L5>
25
+
26
+ ) => {
27
+
28
+ /**
29
+ * Executes a facet operation on an item.
30
+ *
31
+ * A facet is a piece of information that is related to an item - it represents
32
+ * a specific aspect or characteristic of the item. Unlike actions which may
33
+ * return items or perform operations, facets are informational queries that
34
+ * return data about a particular facet of an item.
35
+ *
36
+ * @param ik - The item key (composite or primary key) identifying the item
37
+ * @param facet - The name of the facet to query
38
+ * @param body - Optional request body for the facet operation
39
+ * @param options - Optional HTTP request options
40
+ * @returns Promise resolving to the facet data
41
+ */
42
+ const facet = async (
43
+ ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
44
+ facet: string,
45
+ options: Partial<GetMethodOptions> = {}
46
+ ): Promise<any> => {
47
+ logger.default('facet', { ik, facet });
48
+
49
+ const requestOptions = Object.assign({}, options, { isAuthenticated: apiOptions.writeAuthenticated });
50
+
51
+ return api.httpGet<any>(
52
+ `${utilities.getPath(ik)}/${facet}`,
53
+ requestOptions,
54
+ );
55
+
56
+ };
57
+
58
+ return facet;
59
+ }
@@ -0,0 +1,52 @@
1
+ import {
2
+ Item,
3
+ LocKeyArray,
4
+ QueryParams
5
+ } from "@fjell/core";
6
+ import { GetMethodOptions, HttpApi } from "@fjell/http-api";
7
+
8
+ import { finderToParams } from "@/AItemAPI";
9
+ import { ClientApiOptions } from "@/ClientApiOptions";
10
+ import LibLogger from "@/logger";
11
+ import { Utilities } from "@/Utilities";
12
+
13
+ const logger = LibLogger.get('client-api', 'ops', 'find');
14
+
15
+ export const getFindOneOperation = <
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>(
23
+ api: HttpApi,
24
+ apiOptions: ClientApiOptions,
25
+ utilities: Utilities<V, S, L1, L2, L3, L4, L5>
26
+
27
+ ) => {
28
+
29
+ const findOne = async (
30
+ finder: string,
31
+ finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
32
+ options: Partial<GetMethodOptions> = {},
33
+ locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
34
+ ): Promise<V> => {
35
+ logger.default('findOne', { finder, finderParams, locations });
36
+ utilities.verifyLocations(locations);
37
+ const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;
38
+
39
+ const params: QueryParams = finderToParams(finder, finderParams);
40
+ params.one = true;
41
+
42
+ const requestOptions = Object.assign({}, options, { isAuthenticated: apiOptions.allAuthenticated, params });
43
+
44
+ return (utilities.validatePK(await utilities.processArray(
45
+ api.httpGet<V[]>(
46
+ utilities.getPath(loc),
47
+ requestOptions,
48
+ ))) as V[])[0];
49
+ }
50
+
51
+ return findOne;
52
+ }
package/src/ops/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable indent */
1
2
  import { Item } from "@fjell/core"
2
3
  import { getAllOperation } from "./all"
3
4
  import { getActionOperation } from "./action"
@@ -12,66 +13,78 @@ import { getRemoveOperation } from "./remove"
12
13
  import { getFindOperation } from "./find"
13
14
  import { ClientApiOptions } from "@/ClientApiOptions"
14
15
  import { ClientApi } from "@/ClientApi"
16
+ import { getFindOneOperation } from "./findOne"
17
+ import { getFacetOperation } from "./facet"
15
18
 
16
19
  export const getOperations =
17
- <
18
- V extends Item<S, L1, L2, L3, L4, L5>,
19
- S extends string,
20
- L1 extends string = never,
21
- L2 extends string = never,
22
- L3 extends string = never,
23
- L4 extends string = never,
24
- L5 extends string = never>(
25
- api: HttpApi,
26
- apiOptions: ClientApiOptions,
27
- utilities: Utilities<V, S, L1, L2, L3, L4, L5>,
28
-
29
- ): ClientApi<V, S, L1, L2, L3, L4, L5> => {
30
- return {
31
- action: getActionOperation<V, S, L1, L2, L3, L4, L5>(
32
- api,
33
- apiOptions,
34
- utilities,
35
- ),
36
- all: getAllOperation<V, S, L1, L2, L3, L4, L5>(
37
- api,
38
- apiOptions,
39
- utilities,
40
- ),
41
- allAction: getAllActionOperation<V, S, L1, L2, L3, L4, L5>(
42
- api,
43
- apiOptions,
44
- utilities,
45
- ),
46
- create: getCreateOperation<V, S, L1, L2, L3, L4, L5>(
47
- api,
48
- apiOptions,
49
- utilities,
50
- ),
51
- find: getFindOperation<V, S, L1, L2, L3, L4, L5>(
52
- api,
53
- apiOptions,
54
- utilities,
55
- ),
56
- get: getGetOperation<V, S, L1, L2, L3, L4, L5>(
57
- api,
58
- apiOptions,
59
- utilities,
60
- ),
61
- one: getOneOperation<V, S, L1, L2, L3, L4, L5>(
62
- api,
63
- apiOptions,
64
- utilities,
65
- ),
66
- remove: getRemoveOperation<V, S, L1, L2, L3, L4, L5>(
67
- api,
68
- apiOptions,
69
- utilities,
70
- ),
71
- update: getUpdateOperation<V, S, L1, L2, L3, L4, L5>(
72
- api,
73
- apiOptions,
74
- utilities,
75
- ),
76
- }
77
- }
20
+ <
21
+ V extends Item<S, L1, L2, L3, L4, L5>,
22
+ S extends string,
23
+ L1 extends string = never,
24
+ L2 extends string = never,
25
+ L3 extends string = never,
26
+ L4 extends string = never,
27
+ L5 extends string = never>(
28
+ api: HttpApi,
29
+ apiOptions: ClientApiOptions,
30
+ utilities: Utilities<V, S, L1, L2, L3, L4, L5>,
31
+
32
+ ): ClientApi<V, S, L1, L2, L3, L4, L5> => {
33
+ return {
34
+ action: getActionOperation<V, S, L1, L2, L3, L4, L5>(
35
+ api,
36
+ apiOptions,
37
+ utilities,
38
+ ),
39
+ all: getAllOperation<V, S, L1, L2, L3, L4, L5>(
40
+ api,
41
+ apiOptions,
42
+ utilities,
43
+ ),
44
+ allAction: getAllActionOperation<V, S, L1, L2, L3, L4, L5>(
45
+ api,
46
+ apiOptions,
47
+ utilities,
48
+ ),
49
+ create: getCreateOperation<V, S, L1, L2, L3, L4, L5>(
50
+ api,
51
+ apiOptions,
52
+ utilities,
53
+ ),
54
+ facet: getFacetOperation<V, S, L1, L2, L3, L4, L5>(
55
+ api,
56
+ apiOptions,
57
+ utilities,
58
+ ),
59
+ findOne: getFindOneOperation<V, S, L1, L2, L3, L4, L5>(
60
+ api,
61
+ apiOptions,
62
+ utilities,
63
+ ),
64
+ find: getFindOperation<V, S, L1, L2, L3, L4, L5>(
65
+ api,
66
+ apiOptions,
67
+ utilities,
68
+ ),
69
+ get: getGetOperation<V, S, L1, L2, L3, L4, L5>(
70
+ api,
71
+ apiOptions,
72
+ utilities,
73
+ ),
74
+ one: getOneOperation<V, S, L1, L2, L3, L4, L5>(
75
+ api,
76
+ apiOptions,
77
+ utilities,
78
+ ),
79
+ remove: getRemoveOperation<V, S, L1, L2, L3, L4, L5>(
80
+ api,
81
+ apiOptions,
82
+ utilities,
83
+ ),
84
+ update: getUpdateOperation<V, S, L1, L2, L3, L4, L5>(
85
+ api,
86
+ apiOptions,
87
+ utilities,
88
+ ),
89
+ }
90
+ }