@fjell/client-api 4.2.1

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/LICENSE +202 -0
  2. package/dist/src/AItemAPI.d.ts +34 -0
  3. package/dist/src/AItemAPI.js +39 -0
  4. package/dist/src/AItemAPI.js.map +1 -0
  5. package/dist/src/CItemAPI.d.ts +16 -0
  6. package/dist/src/CItemAPI.js +20 -0
  7. package/dist/src/CItemAPI.js.map +1 -0
  8. package/dist/src/ClientApi.d.ts +13 -0
  9. package/dist/src/ClientApi.js +2 -0
  10. package/dist/src/ClientApi.js.map +1 -0
  11. package/dist/src/ClientApiOptions.d.ts +8 -0
  12. package/dist/src/ClientApiOptions.js +2 -0
  13. package/dist/src/ClientApiOptions.js.map +1 -0
  14. package/dist/src/PItemAPI.d.ts +17 -0
  15. package/dist/src/PItemAPI.js +30 -0
  16. package/dist/src/PItemAPI.js.map +1 -0
  17. package/dist/src/Utilities.d.ts +10 -0
  18. package/dist/src/Utilities.js +110 -0
  19. package/dist/src/Utilities.js.map +1 -0
  20. package/dist/src/index.d.ts +4 -0
  21. package/dist/src/index.js +3 -0
  22. package/dist/src/index.js.map +1 -0
  23. package/dist/src/logger.d.ts +2 -0
  24. package/dist/src/logger.js +4 -0
  25. package/dist/src/logger.js.map +1 -0
  26. package/dist/src/ops/action.d.ts +5 -0
  27. package/dist/src/ops/action.js +11 -0
  28. package/dist/src/ops/action.js.map +1 -0
  29. package/dist/src/ops/all.d.ts +6 -0
  30. package/dist/src/ops/all.js +15 -0
  31. package/dist/src/ops/all.js.map +1 -0
  32. package/dist/src/ops/allAction.d.ts +5 -0
  33. package/dist/src/ops/allAction.js +14 -0
  34. package/dist/src/ops/allAction.js.map +1 -0
  35. package/dist/src/ops/create.d.ts +5 -0
  36. package/dist/src/ops/create.js +14 -0
  37. package/dist/src/ops/create.js.map +1 -0
  38. package/dist/src/ops/find.d.ts +5 -0
  39. package/dist/src/ops/find.js +15 -0
  40. package/dist/src/ops/find.js.map +1 -0
  41. package/dist/src/ops/get.d.ts +5 -0
  42. package/dist/src/ops/get.js +11 -0
  43. package/dist/src/ops/get.js.map +1 -0
  44. package/dist/src/ops/index.d.ts +6 -0
  45. package/dist/src/ops/index.js +23 -0
  46. package/dist/src/ops/index.js.map +1 -0
  47. package/dist/src/ops/one.d.ts +5 -0
  48. package/dist/src/ops/one.js +20 -0
  49. package/dist/src/ops/one.js.map +1 -0
  50. package/dist/src/ops/remove.d.ts +5 -0
  51. package/dist/src/ops/remove.js +11 -0
  52. package/dist/src/ops/remove.js.map +1 -0
  53. package/dist/src/ops/update.d.ts +5 -0
  54. package/dist/src/ops/update.js +11 -0
  55. package/dist/src/ops/update.js.map +1 -0
  56. package/dist/tsconfig.tsbuildinfo +1 -0
  57. package/eslint.config.mjs +70 -0
  58. package/package.json +51 -0
  59. package/src/AItemAPI.ts +87 -0
  60. package/src/CItemAPI.ts +107 -0
  61. package/src/ClientApi.ts +59 -0
  62. package/src/ClientApiOptions.ts +17 -0
  63. package/src/PItemAPI.ts +171 -0
  64. package/src/Utilities.ts +183 -0
  65. package/src/index.ts +4 -0
  66. package/src/logger.ts +5 -0
  67. package/src/ops/action.ts +52 -0
  68. package/src/ops/all.ts +52 -0
  69. package/src/ops/allAction.ts +53 -0
  70. package/src/ops/create.ts +50 -0
  71. package/src/ops/find.ts +52 -0
  72. package/src/ops/get.ts +45 -0
  73. package/src/ops/index.ts +77 -0
  74. package/src/ops/one.ts +64 -0
  75. package/src/ops/remove.ts +41 -0
  76. package/src/ops/update.ts +47 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2025 Fjell Project
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,34 @@
1
+ import { Item, QueryParams } from "@fjell/core";
2
+ import { HttpApi } from "@fjell/http-api";
3
+ import { ClientApiOptions } from "./ClientApiOptions";
4
+ import { ClientApi } from "./ClientApi";
5
+ export type PathNamesArray<L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> = ([L5] extends [never] ? ([L4] extends [never] ? ([L3] extends [never] ? ([L2] extends [never] ? ([L1] extends [never] ? [
6
+ string
7
+ ] : [
8
+ string,
9
+ string
10
+ ]) : [
11
+ string,
12
+ string,
13
+ string
14
+ ]) : [
15
+ string,
16
+ string,
17
+ string,
18
+ string
19
+ ]) : [
20
+ string,
21
+ string,
22
+ string,
23
+ string,
24
+ string
25
+ ]) : [
26
+ string,
27
+ string,
28
+ string,
29
+ string,
30
+ string,
31
+ string
32
+ ]);
33
+ export declare const finderToParams: (finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>) => QueryParams;
34
+ export declare const createAItemAPI: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, pkType: S, pathNames: PathNamesArray<L1, L2, L3, L4, L5>, options?: ClientApiOptions) => ClientApi<V, S, L1, L2, L3, L4, L5>;
@@ -0,0 +1,39 @@
1
+ import { getOperations } from "./ops";
2
+ import { createUtilities } from "./Utilities";
3
+ import LibLogger from "./logger";
4
+ const logger = LibLogger.get('AItemAPI');
5
+ export const finderToParams = (finder, finderParams) => {
6
+ return {
7
+ finder,
8
+ finderParams: JSON.stringify(finderParams),
9
+ };
10
+ };
11
+ export const createAItemAPI = (api, pkType, pathNames, options) => {
12
+ logger.default('createAItemAPI', { pkType, pathNames, options });
13
+ let mergedOptions;
14
+ const defaultOptions = {
15
+ readAuthenticated: true,
16
+ allAuthenticated: true,
17
+ writeAuthenticated: true,
18
+ };
19
+ if (options) {
20
+ mergedOptions = Object.assign({}, defaultOptions, options);
21
+ }
22
+ else {
23
+ mergedOptions = defaultOptions;
24
+ }
25
+ const utilities = createUtilities(pkType, pathNames);
26
+ const operations = getOperations(api, mergedOptions, utilities);
27
+ return {
28
+ action: operations.action,
29
+ all: operations.all,
30
+ allAction: operations.allAction,
31
+ create: operations.create,
32
+ find: operations.find,
33
+ get: operations.get,
34
+ one: operations.one,
35
+ remove: operations.remove,
36
+ update: operations.update,
37
+ };
38
+ };
39
+ //# sourceMappingURL=AItemAPI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AItemAPI.js","sourceRoot":"","sources":["../../src/AItemAPI.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,SAAS,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAqBzC,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAc,EACd,YAAwG,EAC3F,EAAE;IACf,OAAO;QACL,MAAM;QACN,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;KAC3C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAS1B,GAAY,EACZ,MAAS,EACT,SAA6C,EAC7C,OAA0B,EACW,EAAE;IAEzC,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;IAEjE,IAAI,aAA+B,CAAC;IAEpC,MAAM,cAAc,GAAqB;QACvC,iBAAiB,EAAE,IAAI;QACvB,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,IAAI;KACzB,CAAC;IAEF,IAAI,OAAO,EAAE,CAAC;QACZ,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;SAAM,CAAC;QACN,aAAa,GAAG,cAAc,CAAC;IACjC,CAAC;IAED,MAAM,SAAS,GAAI,eAAe,CAA2B,MAAM,EAAE,SAAS,CAAC,CAAC;IAChF,MAAM,UAAU,GAAG,aAAa,CAA2B,GAAG,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAE1F,OAAO;QACL,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { ComKey, Item, ItemQuery, LocKeyArray, PriKey, TypesProperties } from "@fjell/core";
2
+ import { DeleteMethodOptions, GetMethodOptions, HttpApi, PostMethodOptions, PutMethodOptions } from "@fjell/http-api";
3
+ import { PathNamesArray } from "./AItemAPI";
4
+ import { ClientApi } from "./ClientApi";
5
+ import { ClientApiOptions } from "./ClientApiOptions";
6
+ export interface CItemApi<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> extends ClientApi<V, S, L1, L2, L3, L4, L5> {
7
+ action: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, action: string, body: any, options: Partial<PostMethodOptions>) => Promise<V>;
8
+ all: (query: ItemQuery, options: Partial<GetMethodOptions>, locations: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
9
+ allAction: (action: string, body: any, options: Partial<PostMethodOptions>, locations: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
10
+ get: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, options: Partial<GetMethodOptions>) => Promise<V | null>;
11
+ create: (item: TypesProperties<V, S, L1, L2, L3, L4, L5>, options: Partial<PostMethodOptions>, locations: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
12
+ remove: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, options: Partial<DeleteMethodOptions>) => Promise<boolean>;
13
+ update: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, item: TypesProperties<V, S, L1, L2, L3, L4, L5>, options: Partial<PutMethodOptions>) => Promise<V>;
14
+ find: (finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, options: Partial<GetMethodOptions>, locations: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
15
+ }
16
+ export declare const createCItemApi: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, type: S, pathNames: PathNamesArray<L1, L2, L3, L4, L5>, options: ClientApiOptions) => CItemApi<V, S, L1, L2, L3, L4, L5>;
@@ -0,0 +1,20 @@
1
+ import { createAItemAPI } from "./AItemAPI";
2
+ import LibLogger from "./logger";
3
+ const logger = LibLogger.get('CItemAPI');
4
+ ;
5
+ export const createCItemApi = (api, type, pathNames, options) => {
6
+ logger.default('createCItemApi', { api, type, pathNames, options });
7
+ const aItemAPI = createAItemAPI(api, type, pathNames, options);
8
+ return {
9
+ action: aItemAPI.action,
10
+ all: aItemAPI.all,
11
+ allAction: aItemAPI.allAction,
12
+ one: aItemAPI.one,
13
+ get: aItemAPI.get,
14
+ create: aItemAPI.create,
15
+ remove: aItemAPI.remove,
16
+ update: aItemAPI.update,
17
+ find: aItemAPI.find,
18
+ };
19
+ };
20
+ //# sourceMappingURL=CItemAPI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CItemAPI.js","sourceRoot":"","sources":["../../src/CItemAPI.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAC;AAI5D,OAAO,SAAS,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAoDxC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAS1B,GAAY,EACZ,IAAO,EACP,SAA6C,EAC7C,OAAyB,EACW,EAAE;IAExC,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;IAEpE,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAE/D,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;KAC6B,CAAC;AACrD,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { ComKey, Item, ItemQuery, LocKeyArray, PriKey, TypesProperties } from "@fjell/core";
2
+ import { DeleteMethodOptions, GetMethodOptions, PostMethodOptions, PutMethodOptions } from "@fjell/http-api";
3
+ export interface ClientApi<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> {
4
+ action: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, action: string, body: any, options: Partial<PostMethodOptions>) => Promise<V>;
5
+ all: (query: ItemQuery, options: Partial<GetMethodOptions>, locations: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
6
+ allAction: (action: string, body: any, options: Partial<PostMethodOptions>, locations: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
7
+ create: (item: TypesProperties<V, S, L1, L2, L3, L4, L5>, options: Partial<PostMethodOptions>, locations: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
8
+ find: (finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, options: Partial<GetMethodOptions>, locations: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
9
+ get: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, options: Partial<GetMethodOptions>) => Promise<V | null>;
10
+ one: (query: ItemQuery, options: Partial<GetMethodOptions>, locations: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V | null>;
11
+ remove: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, options: Partial<DeleteMethodOptions>) => Promise<boolean>;
12
+ update: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, item: TypesProperties<V, S, L1, L2, L3, L4, L5>, options: Partial<PutMethodOptions>) => Promise<V>;
13
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ClientApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClientApi.js","sourceRoot":"","sources":["../../src/ClientApi.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { Item } from "@fjell/core";
2
+ import { ClientApi } from "./ClientApi";
3
+ export interface ClientApiOptions {
4
+ readAuthenticated?: boolean;
5
+ allAuthenticated?: boolean;
6
+ writeAuthenticated?: boolean;
7
+ parentApi?: ClientApi<Item<string, string | never, string | never, string | never, string | never, string | never>, string, string | never, string | never, string | never, string | never, string | never>;
8
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ClientApiOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClientApiOptions.js","sourceRoot":"","sources":["../../src/ClientApiOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { ComKey, Item, ItemQuery, PriKey, TypesProperties } from "@fjell/core";
2
+ import { HttpApi } from "@fjell/http-api";
3
+ import { ClientApi } from "./ClientApi";
4
+ import { DeleteMethodOptions, GetMethodOptions, PostMethodOptions, PutMethodOptions } from "@fjell/http-api";
5
+ import { ClientApiOptions } from "./ClientApiOptions";
6
+ export interface PItemApi<V extends Item<S>, S extends string> extends ClientApi<V, S> {
7
+ action: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, action: string, body: any, options: Partial<PostMethodOptions>, locations?: []) => Promise<V>;
8
+ all: (query: ItemQuery, options: Partial<GetMethodOptions>, locations?: []) => Promise<V[]>;
9
+ allAction: (action: string, body: any, options: Partial<PostMethodOptions>) => Promise<V[]>;
10
+ one: (query: ItemQuery, options: Partial<GetMethodOptions>) => Promise<V | null>;
11
+ get: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, options: Partial<GetMethodOptions>, locations?: []) => Promise<V | null>;
12
+ create: (item: TypesProperties<V, S>, options: Partial<PostMethodOptions>, locations?: []) => Promise<V>;
13
+ remove: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, options: Partial<DeleteMethodOptions>, locations?: []) => Promise<boolean>;
14
+ update: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, item: TypesProperties<V, S>, options: Partial<PutMethodOptions>, locations?: []) => Promise<V>;
15
+ find: (finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, options: Partial<GetMethodOptions>, locations?: []) => Promise<V[]>;
16
+ }
17
+ export declare const createPItemApi: <V extends Item<S>, S extends string>(api: HttpApi, type: S, pathName: string, options: ClientApiOptions) => PItemApi<V, S>;
@@ -0,0 +1,30 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ import { createAItemAPI } from "./AItemAPI";
3
+ import LibLogger from "./logger";
4
+ const logger = LibLogger.get('PItemAPI');
5
+ export const createPItemApi = (api, type, pathName, options) => {
6
+ logger.default('createPItemApi', { type, pathName, options });
7
+ const aItemAPI = createAItemAPI(api, type, [pathName], options);
8
+ const action = async (ik, action, body = {}, options = {}) => await aItemAPI.action(ik, action, body, options);
9
+ const all = async (query = {}, options = {}) => await aItemAPI.all(query, options, []);
10
+ const allAction = async (action, body = {}, options = {}) => await aItemAPI.allAction(action, body, options, []);
11
+ const one = async (query = {}, options = {}) => await aItemAPI.one(query, options, []);
12
+ const get = async (ik, options = {}) => await aItemAPI.get(ik, options);
13
+ const create = async (item, options = {}) => await aItemAPI.create(item, options, []);
14
+ const remove = async (ik, options = {}) => await aItemAPI.remove(ik, options);
15
+ const update = async (ik, item, options = {}) => await aItemAPI.update(ik, item, options);
16
+ const find = async (finder, finderParams, options = {}) => await aItemAPI.find(finder, finderParams, options, []);
17
+ return {
18
+ ...aItemAPI,
19
+ action,
20
+ all,
21
+ allAction,
22
+ one,
23
+ get,
24
+ create,
25
+ remove,
26
+ update,
27
+ find,
28
+ };
29
+ };
30
+ //# sourceMappingURL=PItemAPI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PItemAPI.js","sourceRoot":"","sources":["../../src/PItemAPI.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAItD,OAAO,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAC;AAK5D,OAAO,SAAS,MAAM,UAAU,CAAC;AACjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAiEzC,MAAM,CAAC,MAAM,cAAc,GAAG,CAI1B,GAAY,EACZ,IAAO,EACP,QAAgB,EAChB,OAAyB,EACT,EAAE;IAEpB,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IAE9D,MAAM,QAAQ,GAAG,cAAc,CAAO,GAAG,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;IAEtE,MAAM,MAAM,GACV,KAAK,EACH,EAA4D,EAC5D,MAAc,EACd,OAAY,EAAE,EACd,U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AM,IAAI,GACR,KAAK,EACH,MAAc,EACd,YAAwG,EACxG,UAAqC,EAAE,EACzB,EAAE,CACd,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,CAAQ,CAAC;IAEpE,OAAO;QACL,GAAG,QAAQ;QACX,MAAM;QACN,GAAG;QACH,SAAS;QACT,GAAG;QACH,GAAG;QACH,MAAM;QACN,MAAM;QACN,MAAM;QACN,IAAI;KACL,CAAC;AAEJ,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ComKey, Item, LocKeyArray, PriKey } from "@fjell/core";
2
+ export interface Utilities<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> {
3
+ verifyLocations: (locations: LocKeyArray<L1, L2, L3, L4, L5> | [] | never) => boolean;
4
+ processOne: (apiCall: Promise<V>) => Promise<V>;
5
+ processArray: (api: Promise<V[]>) => Promise<V[]>;
6
+ convertDoc: (doc: V) => V;
7
+ getPath: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | []) => string;
8
+ validatePK: (item: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[]) => Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[];
9
+ }
10
+ export declare const createUtilities: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(pkType: S, pathNames: string[]) => Utilities<V, S, L1, L2, L3, L4, L5>;
@@ -0,0 +1,110 @@
1
+ import { validatePK as coreValidatePK, generateKeyArray, isPriKey, } from "@fjell/core";
2
+ import LibLogger from "./logger";
3
+ import deepmerge from "deepmerge";
4
+ const logger = LibLogger.get('client-api', 'Utility');
5
+ export const createUtilities = (pkType, pathNames) => {
6
+ logger.default('createUtilities', { pkType, pathNames });
7
+ const verifyLocations = (locations) => {
8
+ if (locations && locations.length < pathNames.length - 1) {
9
+ throw new Error('Not enough locations for pathNames: locations:'
10
+ + locations.length + ' pathNames:' + pathNames.length);
11
+ }
12
+ return true;
13
+ };
14
+ const processOne = async (apiCall) => {
15
+ logger.default('processOne', { apiCall });
16
+ const response = await apiCall;
17
+ logger.default('processOne response', { response: JSON.stringify(response, null, 2) });
18
+ return convertDoc(response);
19
+ };
20
+ const processArray = async (api) => {
21
+ logger.default('processArray', { api });
22
+ const response = await api;
23
+ logger.default('processArray response', { response: JSON.stringify(response, null, 2) });
24
+ if (response && Array.isArray(response)) {
25
+ return response.map((subjectChat) => convertDoc(subjectChat));
26
+ }
27
+ else {
28
+ logger.error('Response was not an array', { response });
29
+ throw new Error('Response was not an array');
30
+ }
31
+ };
32
+ const convertDoc = (doc) => {
33
+ logger.default('convertDoc', { doc });
34
+ // console.log(JSON.stringify(doc, null, 2));
35
+ if (doc && doc.events) {
36
+ const events = doc.events;
37
+ for (const key in events) {
38
+ events[key] = deepmerge(events[key], { at: events[key].at ? new Date(events[key].at) : null });
39
+ }
40
+ return doc;
41
+ }
42
+ else {
43
+ return doc;
44
+ }
45
+ };
46
+ const getPath = (key) => {
47
+ const localPathNames = [...pathNames];
48
+ logger.default('getPath', { key, pathNames: localPathNames });
49
+ // console.log('getPath key: ' + JSON.stringify(key));
50
+ const keys = generateKeyArray(key);
51
+ // console.log('getPath keys: ' + JSON.stringify(keys));
52
+ // console.log('getPath pathNames: ' + JSON.stringify(pathNames));
53
+ let path = addPath('', keys, localPathNames);
54
+ // If there is only one collection left in the collections array, this means that
55
+ // we received LocKeys and we need to add the last collection to the reference
56
+ if (localPathNames.length === 1) {
57
+ path = `${path}/${localPathNames[0]}`;
58
+ }
59
+ logger.default('getPath created', { key, path });
60
+ return path;
61
+ };
62
+ const addPath = (base, keys, localPathNames) => {
63
+ logger.default('addPath', { base, keys, pathNames: localPathNames });
64
+ if (keys.length < localPathNames.length - 1) {
65
+ logger.error('addPath should never have keys with a length less than the length of pathNames - 1', { keys, localPathNames });
66
+ throw new Error('addPath should never have keys with a length less than the length of pathNames - 1: '
67
+ + keys.length + ' ' + localPathNames.length + ' ' + JSON.stringify(keys, localPathNames));
68
+ }
69
+ else if (keys.length > localPathNames.length) {
70
+ logger.error('addPath should never have keys with a length greater than the length of pathNames', { keys, pathNames });
71
+ throw new Error('addPath should never have keys with a length greater than the length of pathNames: '
72
+ + keys.length + ' ' + localPathNames.length + ' ' + JSON.stringify(keys, localPathNames));
73
+ }
74
+ if (keys.length === 0) {
75
+ // If you've recursively consumed all of the keys, return the base.
76
+ logger.default('addPath returning base', { base });
77
+ return base;
78
+ }
79
+ else {
80
+ // Retrieve the next key and collection, and create the next base
81
+ let nextBase;
82
+ const key = keys.pop();
83
+ const pathName = localPathNames.pop();
84
+ if (isPriKey(key)) {
85
+ const PriKey = key;
86
+ nextBase = `${base}/${pathName}/${PriKey.pk}`;
87
+ logger.default('Adding Path for PK', { pathName, PriKey, nextBase });
88
+ }
89
+ else {
90
+ const LocKey = key;
91
+ nextBase = `${base}/${pathName}/${LocKey.lk}`;
92
+ logger.default('Retrieving Collection for LK', { pathName, LocKey });
93
+ }
94
+ logger.default('calling addPath recursively', { nextBase, keys, localPathNames });
95
+ return addPath(nextBase, keys, localPathNames);
96
+ }
97
+ };
98
+ const validatePK = (item) => {
99
+ return coreValidatePK(item, pkType);
100
+ };
101
+ return {
102
+ verifyLocations,
103
+ processOne,
104
+ convertDoc,
105
+ processArray,
106
+ getPath,
107
+ validatePK,
108
+ };
109
+ };
110
+ //# sourceMappingURL=Utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../../src/Utilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,IAAI,cAAc,EAC5B,gBAAgB,EAChB,QAAQ,GAKT,MAAM,aAAa,CAAC;AAErB,OAAO,SAAS,MAAM,UAAU,CAAC;AACjC,OAAO,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,EACD,EAAE;QAClE,OAAO,cAAc,CAAwB,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC,CAAA;IAED,OAAO;QACL,eAAe;QACf,UAAU;QACV,UAAU;QACV,YAAY;QACZ,OAAO;QACP,UAAU;KACX,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { createCItemApi, CItemApi } from "./CItemAPI";
2
+ export { createPItemApi, PItemApi } from "./PItemAPI";
3
+ export { ClientApi } from "./ClientApi";
4
+ export { ClientApiOptions } from "./ClientApiOptions";
@@ -0,0 +1,3 @@
1
+ export { createCItemApi } from "./CItemAPI";
2
+ export { createPItemApi } from "./PItemAPI";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,cAAc,EAAY,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const LibLogger: import("@fjell/logging").Logger;
2
+ export default LibLogger;
@@ -0,0 +1,4 @@
1
+ import Logging from '@fjell/logging';
2
+ const LibLogger = Logging.getLogger('@fjellproject/client-api');
3
+ export default LibLogger;
4
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;AAEhE,eAAe,SAAS,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ComKey, Item, PriKey } from "@fjell/core";
2
+ import { HttpApi, PostMethodOptions } from "@fjell/http-api";
3
+ import { ClientApiOptions } from "../ClientApiOptions";
4
+ import { Utilities } from "../Utilities";
5
+ export declare const getActionOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, action: string, body?: any, options?: Partial<PostMethodOptions>) => Promise<V>;
@@ -0,0 +1,11 @@
1
+ import LibLogger from "../logger";
2
+ const logger = LibLogger.get('client-api', 'ops', 'action');
3
+ export const getActionOperation = (api, apiOptions, utilities) => {
4
+ const action = async (ik, action, body = {}, options = {}) => {
5
+ logger.default('action', { ik, action, body });
6
+ const requestOptions = Object.assign({}, options, { isAuthenticated: apiOptions.writeAuthenticated });
7
+ return utilities.validatePK(await utilities.processOne(api.httpPost(`${utilities.getPath(ik)}/${action}`, body, requestOptions)));
8
+ };
9
+ return action;
10
+ };
11
+ //# sourceMappingURL=action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/ops/action.ts"],"names":[],"mappings":"AAQA,OAAO,SAAS,MAAM,UAAU,CAAC;AAGjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAQ9B,GAAY,EACZ,UAA4B,EAC5B,SAA8C,EAE9C,EAAE;IAEJ,MAAM,MAAM,GAAG,KAAK,EAClB,EAA6C,EAC7C,MAAc,EACd,OAAY,EAAE,EACd,UAAsC,EAAE,EAEzB,EAAE;QACjB,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAE/C,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAEtG,OAAO,SAAS,CAAC,UAAU,CACzB,MAAM,SAAS,CAAC,UAAU,CACxB,GAAG,CAAC,QAAQ,CACV,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,MAAM,EAAE,EACpC,IAAI,EACJ,cAAc,CACf,CACF,CAAM,CAAC;IAEZ,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { Item, ItemQuery, LocKeyArray } from "@fjell/core";
2
+ import { HttpApi } from "@fjell/http-api";
3
+ import { ClientApiOptions } from "../ClientApiOptions";
4
+ import { Utilities } from "../Utilities";
5
+ import { GetMethodOptions } from "@fjell/http-api";
6
+ export declare const getAllOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (query?: ItemQuery, options?: Partial<GetMethodOptions>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;