@fjell/client-api 4.4.18 → 4.4.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ var getAllActionOperation = (api, apiOptions, utilities) => {
57
57
  return utilities.validatePK(
58
58
  await utilities.processArray(
59
59
  api.httpPost(
60
- utilities.getPath(loc),
60
+ `${utilities.getPath(loc)}/${action}`,
61
61
  body,
62
62
  requestOptions
63
63
  )
@@ -94,8 +94,7 @@ var getOneOperation = (api, apiOptions, utilities) => {
94
94
  return one;
95
95
  };
96
96
 
97
- // src/ops/create.ts
98
- var logger5 = logger_default.get("client-api", "ops", "create");
97
+ // src/ops/errorHandling.ts
99
98
  function shouldRetryError(error) {
100
99
  if (error.code === "ECONNREFUSED" || error.code === "ENOTFOUND" || error.code === "ENETUNREACH" || error.message?.includes("timeout") || error.message?.includes("network")) {
101
100
  return true;
@@ -126,6 +125,88 @@ function enhanceError(error, context) {
126
125
  });
127
126
  return enhancedError;
128
127
  }
128
+ function getRetryConfig(apiOptions) {
129
+ return {
130
+ maxRetries: 3,
131
+ initialDelayMs: 1e3,
132
+ maxDelayMs: 3e4,
133
+ backoffMultiplier: 2,
134
+ ...apiOptions.retryConfig
135
+ };
136
+ }
137
+ function executeErrorHandler(errorHandler, error, context, logger21) {
138
+ if (!errorHandler) return;
139
+ try {
140
+ errorHandler(error, context);
141
+ } catch (handlerError) {
142
+ logger21.error("Custom error handler failed", {
143
+ originalError: error.message,
144
+ handlerError: handlerError?.message || String(handlerError)
145
+ });
146
+ }
147
+ }
148
+ async function executeWithRetry(operation, operationName, operationContext, apiOptions, logger21, specialErrorHandling) {
149
+ const retryConfig = getRetryConfig(apiOptions);
150
+ let lastError = null;
151
+ const startTime = Date.now();
152
+ for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {
153
+ try {
154
+ logger21.debug(`Executing ${operationName} (attempt ${attempt + 1})`, operationContext);
155
+ const result = await operation();
156
+ if (attempt > 0) {
157
+ logger21.info(`${operationName} operation succeeded after ${attempt} retries`, {
158
+ ...operationContext,
159
+ totalAttempts: attempt + 1,
160
+ duration: Date.now() - startTime
161
+ });
162
+ }
163
+ return result;
164
+ } catch (error) {
165
+ lastError = error;
166
+ if (specialErrorHandling) {
167
+ const specialResult = specialErrorHandling(error);
168
+ if (specialResult !== void 0) {
169
+ return specialResult;
170
+ }
171
+ }
172
+ if (attempt === retryConfig.maxRetries) {
173
+ break;
174
+ }
175
+ const isRetryable = shouldRetryError(error);
176
+ if (!isRetryable) {
177
+ logger21.debug(`Not retrying ${operationName} operation due to non-retryable error`, {
178
+ ...operationContext,
179
+ errorMessage: error.message,
180
+ errorCode: error.code || error.status,
181
+ attempt: attempt + 1
182
+ });
183
+ break;
184
+ }
185
+ const delay = calculateRetryDelay(attempt, retryConfig);
186
+ logger21.warning(`Retrying ${operationName} operation (attempt ${attempt + 2}) after ${delay}ms`, {
187
+ ...operationContext,
188
+ errorMessage: error.message,
189
+ errorCode: error.code || error.status,
190
+ delay,
191
+ attemptNumber: attempt + 1
192
+ });
193
+ await new Promise((resolve) => setTimeout(resolve, delay));
194
+ }
195
+ }
196
+ const finalError = enhanceError(lastError, operationContext);
197
+ executeErrorHandler(apiOptions.errorHandler, finalError, operationContext, logger21);
198
+ logger21.error(`${operationName} operation failed after ${retryConfig.maxRetries + 1} attempts`, {
199
+ ...operationContext,
200
+ errorMessage: finalError.message,
201
+ errorCode: finalError.code || finalError.status,
202
+ duration: Date.now() - startTime,
203
+ totalAttempts: retryConfig.maxRetries + 1
204
+ });
205
+ throw finalError;
206
+ }
207
+
208
+ // src/ops/create.ts
209
+ var logger5 = logger_default.get("client-api", "ops", "create");
129
210
  var getCreateOperation = (api, apiOptions, utilities) => {
130
211
  const create = async (item, locations = []) => {
131
212
  const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });
@@ -232,36 +313,6 @@ var getUpdateOperation = (api, apiOptions, utilities) => {
232
313
 
233
314
  // src/ops/get.ts
234
315
  var logger7 = logger_default.get("client-api", "ops", "get");
235
- function shouldRetryError2(error) {
236
- if (error.code === "ECONNREFUSED" || error.code === "ENOTFOUND" || error.code === "ENETUNREACH" || error.message?.includes("timeout") || error.message?.includes("network")) {
237
- return true;
238
- }
239
- if (error.status >= 500 || error.status === 429) {
240
- return true;
241
- }
242
- if (error.status >= 400 && error.status < 500 && error.status !== 429) {
243
- return false;
244
- }
245
- return true;
246
- }
247
- function calculateRetryDelay2(attempt, config) {
248
- const exponentialDelay = (config.initialDelayMs || 1e3) * Math.pow(config.backoffMultiplier || 2, attempt);
249
- const cappedDelay = Math.min(exponentialDelay, config.maxDelayMs || 3e4);
250
- const jitter = 0.5 + Math.random() * 0.5;
251
- return Math.floor(cappedDelay * jitter);
252
- }
253
- function enhanceError2(error, context) {
254
- if (!error) return new Error("Unknown error occurred");
255
- if (error.context) return error;
256
- const enhancedError = new Error(error.message || "HTTP operation failed");
257
- Object.assign(enhancedError, {
258
- code: error.code || error.status || "UNKNOWN_ERROR",
259
- status: error.status,
260
- context,
261
- originalError: error
262
- });
263
- return enhancedError;
264
- }
265
316
  var getGetOperation = (api, apiOptions, utilities) => {
266
317
  const get = async (ik) => {
267
318
  const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.readAuthenticated });
@@ -307,7 +358,7 @@ var getGetOperation = (api, apiOptions, utilities) => {
307
358
  if (attempt === retryConfig.maxRetries) {
308
359
  break;
309
360
  }
310
- const isRetryable = shouldRetryError2(error);
361
+ const isRetryable = shouldRetryError(error);
311
362
  if (!isRetryable) {
312
363
  logger7.debug("Not retrying get operation due to non-retryable error", {
313
364
  ...operationContext,
@@ -317,7 +368,7 @@ var getGetOperation = (api, apiOptions, utilities) => {
317
368
  });
318
369
  break;
319
370
  }
320
- const delay = calculateRetryDelay2(attempt, retryConfig);
371
+ const delay = calculateRetryDelay(attempt, retryConfig);
321
372
  logger7.warning(`Retrying get operation (attempt ${attempt + 2}) after ${delay}ms`, {
322
373
  ...operationContext,
323
374
  errorMessage: error.message,
@@ -328,7 +379,7 @@ var getGetOperation = (api, apiOptions, utilities) => {
328
379
  await new Promise((resolve) => setTimeout(resolve, delay));
329
380
  }
330
381
  }
331
- const finalError = enhanceError2(lastError, operationContext);
382
+ const finalError = enhanceError(lastError, operationContext);
332
383
  if (apiOptions.errorHandler) {
333
384
  try {
334
385
  apiOptions.errorHandler(finalError, operationContext);
@@ -424,7 +475,7 @@ var getAllFacetOperation = (api, apiOptions, utilities) => {
424
475
  utilities.verifyLocations(locations);
425
476
  const loc = locations;
426
477
  return api.httpGet(
427
- utilities.getPath(loc),
478
+ `${utilities.getPath(loc)}/${facet}`,
428
479
  requestOptions
429
480
  );
430
481
  };
@@ -516,13 +567,20 @@ var createUtilities = (pkType, pathNames) => {
516
567
  const processOne = async (apiCall) => {
517
568
  logger13.default("processOne", { apiCall });
518
569
  const response = await apiCall;
519
- logger13.default("processOne response", { response: JSON.stringify(response, null, 2) });
570
+ logger13.default("processOne response", {
571
+ responseType: typeof response,
572
+ hasData: !!response
573
+ });
520
574
  return convertDoc(response);
521
575
  };
522
576
  const processArray = async (api) => {
523
577
  logger13.default("processArray", { api });
524
578
  const response = await api;
525
- logger13.default("processArray response", { response: JSON.stringify(response, null, 2) });
579
+ logger13.default("processArray response", {
580
+ responseType: typeof response,
581
+ isArray: Array.isArray(response),
582
+ length: Array.isArray(response) ? response.length : 0
583
+ });
526
584
  if (response && Array.isArray(response)) {
527
585
  return response.map(
528
586
  (subjectChat) => convertDoc(subjectChat)
@@ -928,117 +986,6 @@ function isClientApiError(error) {
928
986
  return error instanceof ClientApiError;
929
987
  }
930
988
 
931
- // src/ops/errorHandling.ts
932
- function shouldRetryError3(error) {
933
- if (error.code === "ECONNREFUSED" || error.code === "ENOTFOUND" || error.code === "ENETUNREACH" || error.message?.includes("timeout") || error.message?.includes("network")) {
934
- return true;
935
- }
936
- if (error.status >= 500 || error.status === 429) {
937
- return true;
938
- }
939
- if (error.status >= 400 && error.status < 500 && error.status !== 429) {
940
- return false;
941
- }
942
- return true;
943
- }
944
- function calculateRetryDelay3(attempt, config) {
945
- const exponentialDelay = (config.initialDelayMs || 1e3) * Math.pow(config.backoffMultiplier || 2, attempt);
946
- const cappedDelay = Math.min(exponentialDelay, config.maxDelayMs || 3e4);
947
- const jitter = 0.5 + Math.random() * 0.5;
948
- return Math.floor(cappedDelay * jitter);
949
- }
950
- function enhanceError3(error, context) {
951
- if (!error) return new Error("Unknown error occurred");
952
- if (error.context) return error;
953
- const enhancedError = new Error(error.message || "HTTP operation failed");
954
- Object.assign(enhancedError, {
955
- code: error.code || error.status || "UNKNOWN_ERROR",
956
- status: error.status,
957
- context,
958
- originalError: error
959
- });
960
- return enhancedError;
961
- }
962
- function getRetryConfig(apiOptions) {
963
- return {
964
- maxRetries: 3,
965
- initialDelayMs: 1e3,
966
- maxDelayMs: 3e4,
967
- backoffMultiplier: 2,
968
- ...apiOptions.retryConfig
969
- };
970
- }
971
- function executeErrorHandler(errorHandler, error, context, logger21) {
972
- if (!errorHandler) return;
973
- try {
974
- errorHandler(error, context);
975
- } catch (handlerError) {
976
- logger21.error("Custom error handler failed", {
977
- originalError: error.message,
978
- handlerError: handlerError?.message || String(handlerError)
979
- });
980
- }
981
- }
982
- async function executeWithRetry(operation, operationName, operationContext, apiOptions, logger21, specialErrorHandling) {
983
- const retryConfig = getRetryConfig(apiOptions);
984
- let lastError = null;
985
- const startTime = Date.now();
986
- for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {
987
- try {
988
- logger21.debug(`Executing ${operationName} (attempt ${attempt + 1})`, operationContext);
989
- const result = await operation();
990
- if (attempt > 0) {
991
- logger21.info(`${operationName} operation succeeded after ${attempt} retries`, {
992
- ...operationContext,
993
- totalAttempts: attempt + 1,
994
- duration: Date.now() - startTime
995
- });
996
- }
997
- return result;
998
- } catch (error) {
999
- lastError = error;
1000
- if (specialErrorHandling) {
1001
- const specialResult = specialErrorHandling(error);
1002
- if (specialResult !== void 0) {
1003
- return specialResult;
1004
- }
1005
- }
1006
- if (attempt === retryConfig.maxRetries) {
1007
- break;
1008
- }
1009
- const isRetryable = shouldRetryError3(error);
1010
- if (!isRetryable) {
1011
- logger21.debug(`Not retrying ${operationName} operation due to non-retryable error`, {
1012
- ...operationContext,
1013
- errorMessage: error.message,
1014
- errorCode: error.code || error.status,
1015
- attempt: attempt + 1
1016
- });
1017
- break;
1018
- }
1019
- const delay = calculateRetryDelay3(attempt, retryConfig);
1020
- logger21.warning(`Retrying ${operationName} operation (attempt ${attempt + 2}) after ${delay}ms`, {
1021
- ...operationContext,
1022
- errorMessage: error.message,
1023
- errorCode: error.code || error.status,
1024
- delay,
1025
- attemptNumber: attempt + 1
1026
- });
1027
- await new Promise((resolve) => setTimeout(resolve, delay));
1028
- }
1029
- }
1030
- const finalError = enhanceError3(lastError, operationContext);
1031
- executeErrorHandler(apiOptions.errorHandler, finalError, operationContext, logger21);
1032
- logger21.error(`${operationName} operation failed after ${retryConfig.maxRetries + 1} attempts`, {
1033
- ...operationContext,
1034
- errorMessage: finalError.message,
1035
- errorCode: finalError.code || finalError.status,
1036
- duration: Date.now() - startTime,
1037
- totalAttempts: retryConfig.maxRetries + 1
1038
- });
1039
- throw finalError;
1040
- }
1041
-
1042
989
  // src/http/HttpWrapper.ts
1043
990
  var logger20 = {
1044
991
  debug: (message, context) => console.debug(message, context),
@@ -1229,7 +1176,7 @@ export {
1229
1176
  ServerError,
1230
1177
  TimeoutError,
1231
1178
  ValidationError,
1232
- calculateRetryDelay3 as calculateRetryDelay,
1179
+ calculateRetryDelay,
1233
1180
  createCItemApi,
1234
1181
  createHttpError,
1235
1182
  createInstance,
@@ -1238,12 +1185,12 @@ export {
1238
1185
  createPItemApi,
1239
1186
  createRegistry,
1240
1187
  createRegistryFactory,
1241
- enhanceError3 as enhanceError,
1188
+ enhanceError,
1242
1189
  executeErrorHandler,
1243
1190
  executeWithRetry,
1244
1191
  getRetryConfig,
1245
1192
  isClientApiError,
1246
1193
  isRetryableError,
1247
- shouldRetryError3 as shouldRetryError
1194
+ shouldRetryError
1248
1195
  };
1249
1196
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/ops/all.ts", "../src/logger.ts", "../src/ops/action.ts", "../src/ops/allAction.ts", "../src/ops/one.ts", "../src/ops/create.ts", "../src/ops/update.ts", "../src/ops/get.ts", "../src/ops/remove.ts", "../src/ops/find.ts", "../src/ops/findOne.ts", "../src/ops/facet.ts", "../src/ops/allFacet.ts", "../src/ops/index.ts", "../src/Utilities.ts", "../src/AItemAPI.ts", "../src/CItemAPI.ts", "../src/PItemAPI.ts", "../src/Instance.ts", "../src/InstanceFactory.ts", "../src/Registry.ts", "../src/errors/index.ts", "../src/ops/errorHandling.ts", "../src/http/HttpWrapper.ts"],
4
- "sourcesContent": ["import {\n Item,\n ItemQuery,\n LocKeyArray,\n queryToParams,\n} from \"@fjell/core\";\nimport { HttpApi, QueryParams } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'all');\n\nexport const getAllOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const all = async (\n query: ItemQuery = {} as ItemQuery,\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n utilities.verifyLocations(locations);\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const params: QueryParams = queryToParams(query);\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params });\n\n logger.default('all', { query, locations, requestOptions });\n\n return utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[];\n }\n\n return all;\n}\n\n", "import Logging from '@fjell/logging';\n\nconst LibLogger = Logging.getLogger('@fjell/client-api');\n\nexport default LibLogger;\n", "import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'action');\n\nexport const getActionOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const action = async (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n action: string,\n body: any = {},\n ): Promise<V> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('action', { ik, action, body, requestOptions });\n\n return utilities.validatePK(\n await utilities.processOne(\n api.httpPost<V>(\n `${utilities.getPath(ik)}/${action}`,\n body,\n requestOptions,\n )\n )) as V;\n\n };\n\n return action;\n}\n", "import {\n Item,\n LocKeyArray\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'allAction');\n\nexport const getAllActionOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const allAction = async (\n action: string,\n body: any = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('allAction', { action, body, locations, requestOptions });\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n // TODO: This should respond to either a single object, or multiple objects in an array.\n return utilities.validatePK(\n await utilities.processArray(\n api.httpPost<V[]>(\n utilities.getPath(loc),\n body,\n requestOptions,\n )\n )) as V[];\n };\n\n return allAction;\n}\n", "import {\n Item,\n ItemQuery,\n LocKeyArray,\n QueryParams,\n queryToParams\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'one');\n\nexport const getOneOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ): (\n query: ItemQuery,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V | null> => {\n\n const one = async (\n query: ItemQuery = {} as ItemQuery,\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V | null> => {\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const params: QueryParams = queryToParams(query);\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.readAuthenticated, params });\n logger.default('one', { query, locations, requestOptions });\n\n let item: V | null = null;\n\n const items = utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[];\n\n if (items.length > 0) {\n item = items[0];\n }\n\n return item as V;\n }\n\n return one;\n}\n", "import {\n Item,\n LocKeyArray\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'create');\n\n// Utility functions for error handling\nfunction shouldRetryError(error: any): boolean {\n // Retry on network errors and 5xx server errors\n if (error.code === 'ECONNREFUSED' ||\n error.code === 'ENOTFOUND' ||\n error.code === 'ENETUNREACH' ||\n error.message?.includes('timeout') ||\n error.message?.includes('network')) {\n return true;\n }\n\n // Retry on HTTP 5xx errors and 429 (rate limiting)\n if (error.status >= 500 || error.status === 429) {\n return true;\n }\n\n // Don't retry on 4xx client errors (except 429)\n if (error.status >= 400 && error.status < 500 && error.status !== 429) {\n return false;\n }\n\n // Default to retrying unknown errors\n return true;\n}\n\nfunction calculateRetryDelay(attempt: number, config: any): number {\n const exponentialDelay = (config.initialDelayMs || 1000) * Math.pow(config.backoffMultiplier || 2, attempt);\n const cappedDelay = Math.min(exponentialDelay, config.maxDelayMs || 30000);\n\n // Add jitter: random value between 50% and 100% of calculated delay\n const jitter = 0.5 + (Math.random() * 0.5);\n return Math.floor(cappedDelay * jitter);\n}\n\nfunction enhanceError(error: any, context: any): any {\n if (!error) return new Error('Unknown error occurred');\n\n // If it's already enhanced, return as-is\n if (error.context) return error;\n\n // Add context to the error\n const enhancedError = new Error(error.message || 'HTTP operation failed');\n Object.assign(enhancedError, {\n code: error.code || error.status || 'UNKNOWN_ERROR',\n status: error.status,\n context,\n originalError: error\n });\n\n return enhancedError;\n}\n\nexport const getCreateOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const create = async (\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('create', { item, locations, requestOptions });\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n const operationContext = {\n operation: 'create',\n path: utilities.getPath(loc),\n itemType: typeof item,\n hasLocations: locations.length > 0\n };\n\n // Retry configuration from options or defaults\n const retryConfig = {\n maxRetries: 3,\n initialDelayMs: 1000,\n maxDelayMs: 30000,\n backoffMultiplier: 2,\n ...apiOptions.retryConfig\n };\n\n let lastError: any = null;\n const startTime = Date.now();\n\n for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {\n try {\n logger.debug(`Creating item (attempt ${attempt + 1})`, operationContext);\n\n const result = await utilities.processOne(api.httpPost<V>(\n utilities.getPath(loc),\n item,\n requestOptions,\n ));\n\n const created: V = utilities.validatePK(result) as V;\n\n if (attempt > 0) {\n logger.info(`Create operation succeeded after ${attempt} retries`, {\n ...operationContext,\n totalAttempts: attempt + 1,\n duration: Date.now() - startTime\n });\n }\n\n return created;\n } catch (error: any) {\n lastError = error;\n\n // Don't retry on the last attempt\n if (attempt === retryConfig.maxRetries) {\n break;\n }\n\n // Determine if error is retryable\n const isRetryable = shouldRetryError(error);\n if (!isRetryable) {\n logger.debug('Not retrying create operation due to non-retryable error', {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n attempt: attempt + 1\n });\n break;\n }\n\n // Calculate delay with exponential backoff\n const delay = calculateRetryDelay(attempt, retryConfig);\n\n logger.warning(`Retrying create operation (attempt ${attempt + 2}) after ${delay}ms`, {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n delay,\n attemptNumber: attempt + 1\n });\n\n // Wait before retrying\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n\n // Handle final error\n const finalError = enhanceError(lastError, operationContext);\n\n // Call custom error handler if provided\n if (apiOptions.errorHandler) {\n try {\n apiOptions.errorHandler(finalError, operationContext);\n } catch (handlerError: any) {\n logger.error('Custom error handler failed', {\n originalError: finalError.message,\n handlerError: handlerError?.message || String(handlerError)\n });\n }\n }\n\n logger.error(`Create operation failed after ${retryConfig.maxRetries + 1} attempts`, {\n ...operationContext,\n errorMessage: finalError.message,\n errorCode: finalError.code || finalError.status,\n duration: Date.now() - startTime,\n totalAttempts: retryConfig.maxRetries + 1\n });\n\n throw finalError;\n };\n\n return create;\n}\n", "import {\n ComKey,\n Item,\n PriKey\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'update');\n\nexport const getUpdateOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const update = async (\n ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n ): Promise<V> => {\n const requestOptions = Object.assign({}, apiOptions.putOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('update', { ik, item, requestOptions });\n\n return utilities.validatePK(await utilities.processOne(\n api.httpPut<V>(\n utilities.getPath(ik),\n item,\n requestOptions,\n ))) as V;\n }\n\n return update;\n}\n", "import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'get');\n\n// Utility functions for error handling\nfunction shouldRetryError(error: any): boolean {\n if (error.code === 'ECONNREFUSED' ||\n error.code === 'ENOTFOUND' ||\n error.code === 'ENETUNREACH' ||\n error.message?.includes('timeout') ||\n error.message?.includes('network')) {\n return true;\n }\n\n if (error.status >= 500 || error.status === 429) {\n return true;\n }\n\n if (error.status >= 400 && error.status < 500 && error.status !== 429) {\n return false;\n }\n\n return true;\n}\n\nfunction calculateRetryDelay(attempt: number, config: any): number {\n const exponentialDelay = (config.initialDelayMs || 1000) * Math.pow(config.backoffMultiplier || 2, attempt);\n const cappedDelay = Math.min(exponentialDelay, config.maxDelayMs || 30000);\n const jitter = 0.5 + (Math.random() * 0.5);\n return Math.floor(cappedDelay * jitter);\n}\n\nfunction enhanceError(error: any, context: any): any {\n if (!error) return new Error('Unknown error occurred');\n if (error.context) return error;\n\n const enhancedError = new Error(error.message || 'HTTP operation failed');\n Object.assign(enhancedError, {\n code: error.code || error.status || 'UNKNOWN_ERROR',\n status: error.status,\n context,\n originalError: error\n });\n\n return enhancedError;\n}\n\nexport const getGetOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const get = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ): Promise<V | null> => {\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.readAuthenticated });\n logger.default('get', { ik, requestOptions });\n\n const operationContext = {\n operation: 'get',\n path: utilities.getPath(ik),\n keyType: typeof ik\n };\n\n const retryConfig = {\n maxRetries: 3,\n initialDelayMs: 1000,\n maxDelayMs: 30000,\n backoffMultiplier: 2,\n ...apiOptions.retryConfig\n };\n\n let lastError: any = null;\n const startTime = Date.now();\n\n for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {\n try {\n logger.debug(`Getting item (attempt ${attempt + 1})`, operationContext);\n\n const result = await utilities.processOne(\n api.httpGet<V>(\n utilities.getPath(ik),\n requestOptions,\n )\n );\n\n const item = utilities.validatePK(result) as V;\n\n if (attempt > 0) {\n logger.info(`Get operation succeeded after ${attempt} retries`, {\n ...operationContext,\n totalAttempts: attempt + 1,\n duration: Date.now() - startTime\n });\n }\n\n return item;\n } catch (error: any) {\n lastError = error;\n\n // Handle 404 errors specially - return null instead of throwing\n if (error.status === 404) {\n logger.debug('Item not found (404)', operationContext);\n return null;\n }\n\n if (attempt === retryConfig.maxRetries) {\n break;\n }\n\n const isRetryable = shouldRetryError(error);\n if (!isRetryable) {\n logger.debug('Not retrying get operation due to non-retryable error', {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n attempt: attempt + 1\n });\n break;\n }\n\n const delay = calculateRetryDelay(attempt, retryConfig);\n\n logger.warning(`Retrying get operation (attempt ${attempt + 2}) after ${delay}ms`, {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n delay,\n attemptNumber: attempt + 1\n });\n\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n\n const finalError = enhanceError(lastError, operationContext);\n\n if (apiOptions.errorHandler) {\n try {\n apiOptions.errorHandler(finalError, operationContext);\n } catch (handlerError: any) {\n logger.error('Custom error handler failed', {\n originalError: finalError.message,\n handlerError: handlerError?.message || String(handlerError)\n });\n }\n }\n\n logger.error(`Get operation failed after ${retryConfig.maxRetries + 1} attempts`, {\n ...operationContext,\n errorMessage: finalError.message,\n errorCode: finalError.code || finalError.status,\n duration: Date.now() - startTime,\n totalAttempts: retryConfig.maxRetries + 1\n });\n\n throw finalError;\n }\n\n return get;\n}\n", "import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'remove');\n\nexport const getRemoveOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const remove = async (\n ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\n ): Promise<boolean> => {\n const requestOptions = Object.assign({}, apiOptions.deleteOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('remove', { ik, requestOptions });\n\n return api.httpDelete<boolean>(utilities.getPath(ik), requestOptions);\n }\n\n return remove;\n}\n", "import {\n Item,\n LocKeyArray,\n QueryParams\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { finderToParams } from \"../AItemAPI\";\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'find');\n\nexport const getFindOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const find = async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n utilities.verifyLocations(locations);\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const mergedParams: QueryParams = finderToParams(finder, finderParams);\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params: mergedParams });\n logger.default('find', { finder, finderParams, locations, requestOptions });\n\n return utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[];\n }\n\n return find;\n}\n", "import {\n Item,\n LocKeyArray,\n QueryParams\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { finderToParams } from \"../AItemAPI\";\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'find');\n\nexport const getFindOneOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const findOne = async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V> => {\n utilities.verifyLocations(locations);\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const params: QueryParams = finderToParams(finder, finderParams);\n params.one = true;\n\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params });\n logger.default('findOne', { finder, finderParams, locations, requestOptions });\n\n return (utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[])[0];\n }\n\n return findOne;\n}\n", "import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'facet');\n\nexport const getFacetOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n /**\n * Executes a facet operation on an item.\n *\n * A facet is a piece of information that is related to an item - it represents\n * a specific aspect or characteristic of the item. Unlike actions which may\n * return items or perform operations, facets are informational queries that\n * return data about a particular facet of an item.\n *\n * @param ik - The item key (composite or primary key) identifying the item\n * @param facet - The name of the facet to query\n * @param body - Optional request body for the facet operation\n * @param options - Optional HTTP request options\n * @returns Promise resolving to the facet data\n */\n const facet = async (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<any> => {\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.writeAuthenticated, params });\n logger.default('facet', { ik, facet, requestOptions });\n\n return api.httpGet<any>(\n `${utilities.getPath(ik)}/${facet}`,\n requestOptions,\n );\n\n };\n\n return facet;\n}\n", "import {\n Item,\n LocKeyArray\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'allFacet');\n\nexport const getAllFacetOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const allFacet = async (\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.writeAuthenticated, params });\n logger.default('allFacet', { facet, locations, requestOptions });\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n // TODO: This should respond to either a single object, or multiple objects in an array.\n return api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n )\n };\n\n return allFacet;\n}\n", "/* eslint-disable indent */\nimport { Item } from \"@fjell/core\"\nimport { getAllOperation } from \"./all\"\nimport { getActionOperation } from \"./action\"\nimport { Utilities } from \"../Utilities\"\nimport { HttpApi } from \"@fjell/http-api\"\nimport { getAllActionOperation } from \"./allAction\"\nimport { getOneOperation } from \"./one\"\nimport { getCreateOperation } from \"./create\"\nimport { getUpdateOperation } from \"./update\"\nimport { getGetOperation } from \"./get\"\nimport { getRemoveOperation } from \"./remove\"\nimport { getFindOperation } from \"./find\"\nimport { ClientApiOptions } from \"../ClientApiOptions\"\nimport { ClientApi } from \"../ClientApi\"\nimport { getFindOneOperation } from \"./findOne\"\nimport { getFacetOperation } from \"./facet\"\nimport { getAllFacetOperation } from \"./allFacet\"\n\nexport const getOperations =\n <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>,\n\n ): ClientApi<V, S, L1, L2, L3, L4, L5> => {\n return {\n action: getActionOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n all: getAllOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n allAction: getAllActionOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n allFacet: getAllFacetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n create: getCreateOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n facet: getFacetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n findOne: getFindOneOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n find: getFindOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n get: getGetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n one: getOneOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n remove: getRemoveOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n update: getUpdateOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n }\n }", "import {\n ComKey,\n validatePK as coreValidatePK,\n generateKeyArray,\n isPriKey,\n Item,\n LocKey,\n LocKeyArray,\n PriKey,\n} from \"@fjell/core\";\n\nimport LibLogger from \"./logger\";\nimport deepmerge from \"deepmerge\";\n\nconst logger = LibLogger.get('client-api', 'Utility');\n\nexport interface Utilities<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> {\n verifyLocations: (locations: LocKeyArray<L1, L2, L3, L4, L5> | [] | never) => boolean;\n processOne: (apiCall: Promise<V>) => Promise<V>;\n processArray: (api: Promise<V[]>) => Promise<V[]>;\n convertDoc: (doc: V) => V;\n getPath: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | []) => string;\n validatePK: (item: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[]) =>\n Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[];\n}\n\nexport const createUtilities = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(pkType: S, pathNames: string[]): Utilities<V, S, L1, L2, L3, L4, L5> => {\n\n logger.default('createUtilities', { pkType, pathNames });\n\n const verifyLocations = (\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] | never,\n ): boolean => {\n\n if (locations && locations.length < pathNames.length - 1) {\n throw new Error('Not enough locations for pathNames: locations:'\n + locations.length + ' pathNames:' + pathNames.length);\n }\n return true;\n }\n\n const processOne = async (\n apiCall: Promise<V>,\n ): Promise<V> => {\n logger.default('processOne', { apiCall });\n const response = await apiCall;\n logger.default('processOne response', { response: JSON.stringify(response, null, 2) });\n return convertDoc(response);\n };\n\n const processArray = async (\n api: Promise<V[]>,\n ): Promise<V[]> => {\n logger.default('processArray', { api });\n const response = await api;\n logger.default('processArray response', { response: JSON.stringify(response, null, 2) });\n if (response && Array.isArray(response)) {\n return response.map((subjectChat: V) =>\n convertDoc(subjectChat),\n ) as unknown as V[];\n } else {\n logger.error('Response was not an array', { response });\n throw new Error('Response was not an array');\n }\n };\n\n const convertDoc = (doc: V): V => {\n logger.default('convertDoc', { doc });\n // console.log(JSON.stringify(doc, null, 2));\n if (doc && doc.events) {\n const events = doc.events;\n for (const key in events) {\n events[key] = deepmerge(events[key], { at: events[key].at ? new Date(events[key].at) : null });\n }\n\n return doc as unknown as V;\n } else {\n return doc;\n }\n };\n\n const getPath =\n (\n key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | [],\n ):\n string => {\n\n const localPathNames = [...pathNames];\n logger.default('getPath', { key, pathNames: localPathNames });\n\n // console.log('getPath key: ' + JSON.stringify(key));\n\n const keys = generateKeyArray(key);\n\n // console.log('getPath keys: ' + JSON.stringify(keys));\n // console.log('getPath pathNames: ' + JSON.stringify(pathNames));\n\n let path: string = addPath('', keys, localPathNames);\n\n // If there is only one collection left in the collections array, this means that\n // we received LocKeys and we need to add the last collection to the reference\n if (localPathNames.length === 1) {\n path = `${path}/${localPathNames[0]}`;\n }\n\n logger.default('getPath created', { key, path });\n\n return path;\n };\n\n const addPath = (\n base: string,\n keys: Array<PriKey<S> | LocKey<L1 | L2 | L3 | L4 | L5>>,\n localPathNames: string[],\n ): string => {\n logger.default('addPath', { base, keys, pathNames: localPathNames });\n if (keys.length < localPathNames.length - 1) {\n logger.error('addPath should never have keys with a length less than the length of pathNames - 1',\n { keys, localPathNames });\n throw new Error('addPath should never have keys with a length less than the length of pathNames - 1: '\n + keys.length + ' ' + localPathNames.length + ' ' + JSON.stringify(keys, localPathNames));\n } else if (keys.length > localPathNames.length) {\n logger.error('addPath should never have keys with a length greater than the length of pathNames',\n { keys, pathNames });\n throw new Error('addPath should never have keys with a length greater than the length of pathNames: '\n + keys.length + ' ' + localPathNames.length + ' ' + JSON.stringify(keys, localPathNames));\n }\n if (keys.length === 0) {\n // If you've recursively consumed all of the keys, return the base.\n logger.default('addPath returning base', { base });\n return base;\n } else {\n // Retrieve the next key and collection, and create the next base\n let nextBase: string;\n const key = keys.pop();\n const pathName = localPathNames.pop();\n if (isPriKey(key)) {\n const PriKey = key as PriKey<S>;\n nextBase = `${base}/${pathName}/${PriKey.pk}`;\n logger.default('Adding Path for PK', { pathName, PriKey, nextBase });\n } else {\n const LocKey = key as LocKey<L1 | L2 | L3 | L4 | L5>;\n nextBase = `${base}/${pathName}/${LocKey.lk}`;\n logger.default('Retrieving Collection for LK', { pathName, LocKey });\n }\n\n logger.default('calling addPath recursively', { nextBase, keys, localPathNames });\n return addPath(nextBase, keys, localPathNames);\n }\n\n }\n\n const validatePK = (\n item: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[]):\n Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[] => {\n return coreValidatePK<S, L1, L2, L3, L4, L5>(item, pkType);\n }\n\n return {\n verifyLocations,\n processOne,\n convertDoc,\n processArray,\n getPath,\n validatePK,\n }\n}\n", "/* eslint-disable indent */\nimport { Item, QueryParams } from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nimport { getOperations } from \"./ops\";\nimport { createUtilities } from \"./Utilities\";\nimport { ClientApi } from \"./ClientApi\";\n\nimport LibLogger from \"./logger\";\n\nconst logger = LibLogger.get('AItemAPI');\n\nexport type PathNamesArray<\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> =\n ([L5] extends [never] ?\n ([L4] extends [never] ?\n ([L3] extends [never] ?\n ([L2] extends [never] ?\n ([L1] extends [never] ?\n [string] :\n [string, string]) :\n [string, string, string]) :\n [string, string, string, string]) :\n [string, string, string, string, string]) :\n [string, string, string, string, string, string]);\n\nexport const finderToParams = (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>\n): QueryParams => {\n return {\n finder,\n finderParams: JSON.stringify(finderParams),\n };\n};\n\nexport const createAItemAPI = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n api: HttpApi,\n pkType: S,\n pathNames: PathNamesArray<L1, L2, L3, L4, L5>,\n options?: ClientApiOptions,\n): ClientApi<V, S, L1, L2, L3, L4, L5> => {\n\n logger.default('createAItemAPI', { pkType, pathNames, options });\n\n let mergedOptions: ClientApiOptions;\n\n const defaultOptions: ClientApiOptions = {\n readAuthenticated: true,\n allAuthenticated: true,\n writeAuthenticated: true,\n getOptions: {},\n postOptions: {},\n putOptions: {},\n deleteOptions: {},\n };\n\n if (options) {\n mergedOptions = Object.assign({}, defaultOptions, options);\n } else {\n mergedOptions = defaultOptions;\n }\n\n const utilities = createUtilities<V, S, L1, L2, L3, L4, L5>(pkType, pathNames);\n const operations = getOperations<V, S, L1, L2, L3, L4, L5>(api, mergedOptions, utilities);\n\n return {\n action: operations.action,\n all: operations.all,\n allAction: operations.allAction,\n allFacet: operations.allFacet,\n create: operations.create,\n facet: operations.facet,\n find: operations.find,\n findOne: operations.findOne,\n get: operations.get,\n one: operations.one,\n remove: operations.remove,\n update: operations.update,\n }\n}", "\nimport {\n ComKey,\n Item,\n ItemQuery,\n LocKeyArray,\n PriKey,\n} from \"@fjell/core\";\nimport {\n HttpApi\n} from \"@fjell/http-api\";\nimport { createAItemAPI, PathNamesArray } from \"./AItemAPI\";\n\nimport LibLogger from \"./logger\";\nimport { ClientApi } from \"./ClientApi\";\nimport { ClientApiOptions } from \"./ClientApiOptions\";\n\nconst logger = LibLogger.get('CItemAPI');\n\nexport interface CItemApi<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> extends ClientApi<V, S, L1, L2, L3, L4, L5> {\n action: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n action: string,\n body: any,\n ) => Promise<V>;\n all: (\n query: ItemQuery,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n allAction: (\n action: string,\n body?: any,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n allFacet: (\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<any>;\n get: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n ) => Promise<V | null>;\n create: (\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V>;\n remove: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n ) => Promise<boolean>;\n update: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n ) => Promise<V>;\n facet: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<any>;\n find: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n findOne: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V>;\n};\n\nexport const createCItemApi = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(api: HttpApi, type: S, pathNames: PathNamesArray<L1, L2, L3, L4, L5>, options?: ClientApiOptions): CItemApi<V, S, L1, L2, L3, L4, L5> => {\n\n logger.default('createCItemApi', { api, type, pathNames, options });\n\n const aItemAPI = createAItemAPI(api, type, pathNames, options);\n\n return {\n action: aItemAPI.action,\n all: aItemAPI.all,\n allAction: aItemAPI.allAction,\n allFacet: aItemAPI.allFacet,\n one: aItemAPI.one,\n get: aItemAPI.get,\n create: aItemAPI.create,\n remove: aItemAPI.remove,\n update: aItemAPI.update,\n facet: aItemAPI.facet,\n find: aItemAPI.find,\n findOne: aItemAPI.findOne,\n } as unknown as CItemApi<V, S, L1, L2, L3, L4, L5>;\n}\n", "import { ComKey, Item, ItemQuery, PriKey } from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\nimport { createAItemAPI } from \"./AItemAPI\";\nimport { ClientApi } from \"./ClientApi\";\n\nimport LibLogger from \"./logger\";\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nconst logger = LibLogger.get('PItemAPI');\n\nexport interface PItemApi<\n V extends Item<S>,\n S extends string\n> extends ClientApi<V, S> {\n\n action: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n action: string,\n body: any,\n ) => Promise<V>;\n\n all: (\n query: ItemQuery,\n ) => Promise<V[]>;\n\n allAction: (\n action: string,\n body?: any,\n ) => Promise<V[]>;\n\n allFacet: (\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<any>;\n\n one: (\n query: ItemQuery,\n ) => Promise<V | null>;\n\n get: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ) => Promise<V | null>;\n\n create: (\n item: Partial<Item<S>>,\n ) => Promise<V>;\n\n remove: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ) => Promise<boolean>;\n\n update: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: Partial<Item<S>>,\n ) => Promise<V>;\n\n facet: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<any>;\n\n find: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<V[]>;\n\n findOne: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<V>;\n}\n\nexport const createPItemApi = <V extends Item<S>, S extends string>(\n api: HttpApi,\n type: S,\n pathName: string,\n options?: ClientApiOptions\n): PItemApi<V, S> => {\n\n logger.default('createPItemApi', { type, pathName, options });\n\n const aItemAPI = createAItemAPI<V, S>(api, type, [pathName], options);\n\n const action =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n action: string,\n body: any = {},\n ): Promise<V> =>\n await aItemAPI.action(ik, action, body) as V;\n\n const all =\n async (\n query: ItemQuery = {} as ItemQuery,\n ): Promise<V[]> =>\n await aItemAPI.all(query, []) as V[];\n\n const allAction =\n async (\n action: string,\n body: any = {},\n ): Promise<V[]> =>\n await aItemAPI.allAction(action, body, []) as V[];\n\n const allFacet =\n async (\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<any> =>\n await aItemAPI.allFacet(facet, params) as any;\n\n const one =\n async (\n query: ItemQuery = {} as ItemQuery,\n ): Promise<V | null> =>\n await aItemAPI.one(query, []) as V | null;\n\n const get =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ): Promise<V | null> =>\n await aItemAPI.get(ik) as V | null;\n\n const create =\n async (\n item: Partial<Item<S>>,\n ): Promise<V> =>\n await aItemAPI.create(item, []) as V;\n\n const remove =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ): Promise<boolean> =>\n await aItemAPI.remove(ik) as boolean;\n\n const update =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: Partial<Item<S>>,\n ): Promise<V> =>\n await aItemAPI.update(ik, item) as V;\n\n const facet =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<any> =>\n await aItemAPI.facet(ik, facet, params) as any;\n\n const find =\n async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<V[]> =>\n await aItemAPI.find(finder, finderParams) as V[];\n\n const findOne =\n async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<V> =>\n await aItemAPI.findOne(finder, finderParams) as V;\n\n return {\n ...aItemAPI,\n action,\n all,\n allAction,\n allFacet,\n one,\n get,\n create,\n remove,\n update,\n facet,\n find,\n findOne,\n };\n\n};\n", "\nimport LibLogger from \"./logger\";\nimport { Item } from \"@fjell/core\";\nimport { Instance as BaseInstance, Coordinate, createInstance as createBaseInstance, Registry } from \"@fjell/registry\";\nimport { ClientApi } from \"./ClientApi\";\n\nconst logger = LibLogger.get(\"Instance\");\n\n/**\n * The Client API Instance interface represents a client API model instance that extends the base Instance\n * from @fjell/registry and adds client API operations for interacting with remote data.\n *\n * The interface extends the base Instance (which provides coordinate and registry) with:\n * - clientApi: Provides methods for interacting with remote data through HTTP APIs (get, create, update, etc.)\n *\n * @template V - The type of the data model item, extending Item\n * @template S - The string literal type representing the model's key type\n * @template L1-L5 - Optional string literal types for location hierarchy levels\n */\nexport interface Instance<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> extends BaseInstance<S, L1, L2, L3, L4, L5> {\n /** The client API object that provides methods for interacting with remote data */\n clientApi: ClientApi<V, S, L1, L2, L3, L4, L5>;\n}\n\nexport const createInstance = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n registry: Registry,\n coordinate: Coordinate<S, L1, L2, L3, L4, L5>,\n clientApi: ClientApi<V, S, L1, L2, L3, L4, L5>,\n ): Instance<V, S, L1, L2, L3, L4, L5> => {\n logger.debug(\"createInstance\", { coordinate, clientApi, registry });\n const baseInstance = createBaseInstance(registry, coordinate);\n return { ...baseInstance, clientApi };\n}\n", "import { Item } from \"@fjell/core\";\nimport { ClientApi } from \"./ClientApi\";\nimport { InstanceFactory as BaseInstanceFactory, Registry, RegistryHub } from \"@fjell/registry\";\nimport { createInstance, Instance } from \"./Instance\";\nimport { Coordinate } from \"@fjell/registry\";\nimport LibLogger from \"./logger\";\n\nconst logger = LibLogger.get(\"InstanceFactory\");\n\nexport type InstanceFactory<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> = (\n clientApi: ClientApi<V, S, L1, L2, L3, L4, L5>\n) => BaseInstanceFactory<S, L1, L2, L3, L4, L5>;\n\n/**\n * Factory function for creating client-api instances\n */\nexport const createInstanceFactory = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n clientApi: ClientApi<V, S, L1, L2, L3, L4, L5>\n ): BaseInstanceFactory<S, L1, L2, L3, L4, L5> => {\n return (coordinate: Coordinate<S, L1, L2, L3, L4, L5>, context: { registry: Registry, registryHub?: RegistryHub }) => {\n logger.debug(\"Creating client-api instance\", { coordinate, registry: context.registry, clientApi });\n\n return createInstance(context.registry, coordinate, clientApi) as Instance<V, S, L1, L2, L3, L4, L5>;\n };\n};\n", "import LibLogger from './logger';\nimport {\n Registry as BaseRegistry,\n createRegistry as createBaseRegistry,\n RegistryFactory,\n RegistryHub\n} from '@fjell/registry';\n\nconst logger = LibLogger.get(\"Registry\");\n\n/**\n * Extended Registry interface for client-api-specific functionality\n */\nexport interface Registry extends BaseRegistry {\n type: 'client-api';\n}\n\n/**\n * Factory function for creating client-api registries\n */\nexport const createRegistryFactory = (): RegistryFactory => {\n return (type: string, registryHub?: RegistryHub): BaseRegistry => {\n if (type !== 'client-api') {\n throw new Error(`Client API registry factory can only create 'client-api' type registries, got: ${type}`);\n }\n\n logger.debug(\"Creating client-api registry\", { type, registryHub });\n\n const baseRegistry = createBaseRegistry(type, registryHub);\n\n // Cast to Registry for type safety\n return baseRegistry as Registry;\n };\n};\n\n/**\n * Creates a new client-api registry instance\n */\nexport const createRegistry = (registryHub?: RegistryHub): Registry => {\n const baseRegistry = createBaseRegistry('client-api', registryHub);\n\n return {\n ...baseRegistry,\n } as Registry;\n};\n", "/**\n * Base class for all Client API errors\n */\nexport abstract class ClientApiError extends Error {\n abstract readonly code: string;\n abstract readonly isRetryable: boolean;\n readonly timestamp: Date;\n readonly context?: Record<string, any>;\n\n constructor(message: string, context?: Record<string, any>) {\n super(message);\n this.name = this.constructor.name;\n this.timestamp = new Date();\n this.context = context;\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n toJSON() {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n isRetryable: this.isRetryable,\n timestamp: this.timestamp,\n context: this.context,\n stack: this.stack\n };\n }\n}\n\n/**\n * Network-related errors (connection issues, timeouts)\n */\nexport class NetworkError extends ClientApiError {\n readonly code = 'NETWORK_ERROR';\n readonly isRetryable = true;\n\n constructor(message: string, context?: Record<string, any>) {\n super(`Network error: ${message}`, context);\n }\n}\n\n/**\n * HTTP timeout errors\n */\nexport class TimeoutError extends ClientApiError {\n readonly code = 'TIMEOUT_ERROR';\n readonly isRetryable = true;\n\n constructor(timeout: number, context?: Record<string, any>) {\n super(`Request timed out after ${timeout}ms`, context);\n }\n}\n\n/**\n * Authentication errors (401 Unauthorized)\n */\nexport class AuthenticationError extends ClientApiError {\n readonly code = 'AUTHENTICATION_ERROR';\n readonly isRetryable = false;\n\n constructor(message?: string, context?: Record<string, any>) {\n super(message || 'Authentication failed - invalid or expired credentials', context);\n }\n}\n\n/**\n * Authorization errors (403 Forbidden)\n */\nexport class AuthorizationError extends ClientApiError {\n readonly code = 'AUTHORIZATION_ERROR';\n readonly isRetryable = false;\n\n constructor(message?: string, context?: Record<string, any>) {\n super(message || 'Access forbidden - insufficient permissions', context);\n }\n}\n\n/**\n * Resource not found errors (404 Not Found)\n */\nexport class NotFoundError extends ClientApiError {\n readonly code = 'NOT_FOUND_ERROR';\n readonly isRetryable = false;\n\n constructor(resource: string, identifier?: string, context?: Record<string, any>) {\n const message = identifier\n ? `${resource} with identifier '${identifier}' not found`\n : `${resource} not found`;\n super(message, context);\n }\n}\n\n/**\n * Request validation errors (400 Bad Request)\n */\nexport class ValidationError extends ClientApiError {\n readonly code = 'VALIDATION_ERROR';\n readonly isRetryable = false;\n readonly validationErrors?: Array<{ field: string; message: string }>;\n\n constructor(message: string, validationErrors?: Array<{ field: string; message: string }>, context?: Record<string, any>) {\n super(`Validation error: ${message}`, context);\n this.validationErrors = validationErrors;\n }\n}\n\n/**\n * Conflict errors (409 Conflict)\n */\nexport class ConflictError extends ClientApiError {\n readonly code = 'CONFLICT_ERROR';\n readonly isRetryable = false;\n\n constructor(message: string, context?: Record<string, any>) {\n super(`Conflict: ${message}`, context);\n }\n}\n\n/**\n * Rate limiting errors (429 Too Many Requests)\n */\nexport class RateLimitError extends ClientApiError {\n readonly code = 'RATE_LIMIT_ERROR';\n readonly isRetryable = true;\n readonly retryAfter?: number;\n\n constructor(retryAfter?: number, context?: Record<string, any>) {\n const message = retryAfter\n ? `Rate limit exceeded - retry after ${retryAfter} seconds`\n : 'Rate limit exceeded';\n super(message, context);\n this.retryAfter = retryAfter;\n }\n}\n\n/**\n * Server errors (5xx status codes)\n */\nexport class ServerError extends ClientApiError {\n readonly code = 'SERVER_ERROR';\n readonly isRetryable = true;\n readonly statusCode: number;\n\n constructor(statusCode: number, message?: string, context?: Record<string, any>) {\n super(message || `Server error (${statusCode})`, context);\n this.statusCode = statusCode;\n }\n}\n\n/**\n * Request payload too large errors (413)\n */\nexport class PayloadTooLargeError extends ClientApiError {\n readonly code = 'PAYLOAD_TOO_LARGE_ERROR';\n readonly isRetryable = false;\n\n constructor(maxSize?: string, context?: Record<string, any>) {\n const message = maxSize\n ? `Request payload too large - maximum size is ${maxSize}`\n : 'Request payload too large';\n super(message, context);\n }\n}\n\n/**\n * Generic HTTP errors for unhandled status codes\n */\nexport class HttpError extends ClientApiError {\n readonly code = 'HTTP_ERROR';\n readonly isRetryable: boolean;\n readonly statusCode: number;\n readonly statusText: string;\n\n constructor(statusCode: number, statusText: string, message?: string, context?: Record<string, any>) {\n super(message || `HTTP error ${statusCode}: ${statusText}`, context);\n this.statusCode = statusCode;\n this.statusText = statusText;\n\n // 5xx errors are generally retryable, 4xx are not\n this.isRetryable = statusCode >= 500;\n }\n}\n\n/**\n * Configuration errors\n */\nexport class ConfigurationError extends ClientApiError {\n readonly code = 'CONFIGURATION_ERROR';\n readonly isRetryable = false;\n\n constructor(message: string, context?: Record<string, any>) {\n super(`Configuration error: ${message}`, context);\n }\n}\n\n/**\n * Parse/serialization errors\n */\nexport class ParseError extends ClientApiError {\n readonly code = 'PARSE_ERROR';\n readonly isRetryable = false;\n\n constructor(message: string, context?: Record<string, any>) {\n super(`Parse error: ${message}`, context);\n }\n}\n\n/**\n * Create appropriate error from HTTP response\n */\nexport function createHttpError(\n statusCode: number,\n statusText: string,\n responseBody?: any,\n context?: Record<string, any>\n): ClientApiError {\n const errorContext = { statusCode, statusText, responseBody, ...context };\n\n switch (statusCode) {\n case 400:\n if (responseBody?.validationErrors) {\n return new ValidationError(\n responseBody.message || 'Request validation failed',\n responseBody.validationErrors,\n errorContext\n );\n }\n return new ValidationError(responseBody?.message || statusText, [], errorContext);\n\n case 401:\n return new AuthenticationError(responseBody?.message, errorContext);\n\n case 403:\n return new AuthorizationError(responseBody?.message, errorContext);\n\n case 404:\n return new NotFoundError(\n responseBody?.resource || 'Resource',\n responseBody?.identifier,\n errorContext\n );\n\n case 409:\n return new ConflictError(responseBody?.message || statusText, errorContext);\n\n case 413:\n return new PayloadTooLargeError(responseBody?.maxSize, errorContext);\n\n case 429: {\n let retryAfter: number | undefined;\n if (responseBody?.retryAfter) {\n retryAfter = responseBody.retryAfter;\n } else if (context?.headers?.['retry-after']) {\n retryAfter = parseInt(context.headers['retry-after']);\n }\n return new RateLimitError(retryAfter, errorContext);\n }\n\n default:\n if (statusCode >= 500) {\n return new ServerError(statusCode, responseBody?.message || statusText, errorContext);\n }\n\n return new HttpError(statusCode, statusText, responseBody?.message, errorContext);\n }\n}\n\n/**\n * Create appropriate error from network/connection issues\n */\nexport function createNetworkError(error: any, context?: Record<string, any>): ClientApiError {\n const errorContext = { originalError: error, ...context };\n\n if (error.code === 'ECONNABORTED' || error.message?.includes('timeout')) {\n return new TimeoutError(error.timeout || 5000, errorContext);\n }\n\n if (error.code === 'ECONNREFUSED' ||\n error.code === 'ENOTFOUND' ||\n error.code === 'ENETUNREACH' ||\n error.message?.includes('network')) {\n return new NetworkError(error.message || 'Network connection failed', errorContext);\n }\n\n // For unknown errors, treat as network issues that might be retryable\n return new NetworkError(error.message || 'Unknown network error', errorContext);\n}\n\n/**\n * Type guard to check if error is retryable\n */\nexport function isRetryableError(error: any): boolean {\n return error instanceof ClientApiError && error.isRetryable;\n}\n\n/**\n * Type guard to check if error is a Client API error\n */\nexport function isClientApiError(error: any): error is ClientApiError {\n return error instanceof ClientApiError;\n}\n", "/**\n * Shared error handling utilities for all HTTP operations\n */\n\n/**\n * Determines if an error should be retried based on error type and status code\n */\nexport function shouldRetryError(error: any): boolean {\n // Retry on network errors and timeouts\n if (error.code === 'ECONNREFUSED' ||\n error.code === 'ENOTFOUND' ||\n error.code === 'ENETUNREACH' ||\n error.message?.includes('timeout') ||\n error.message?.includes('network')) {\n return true;\n }\n\n // Retry on HTTP 5xx errors and 429 (rate limiting)\n if (error.status >= 500 || error.status === 429) {\n return true;\n }\n\n // Don't retry on 4xx client errors (except 429)\n if (error.status >= 400 && error.status < 500 && error.status !== 429) {\n return false;\n }\n\n // Default to retrying unknown errors\n return true;\n}\n\n/**\n * Calculates retry delay with exponential backoff and jitter\n */\nexport function calculateRetryDelay(attempt: number, config: any): number {\n const exponentialDelay = (config.initialDelayMs || 1000) * Math.pow(config.backoffMultiplier || 2, attempt);\n const cappedDelay = Math.min(exponentialDelay, config.maxDelayMs || 30000);\n\n // Add jitter: random value between 50% and 100% of calculated delay\n const jitter = 0.5 + (Math.random() * 0.5);\n return Math.floor(cappedDelay * jitter);\n}\n\n/**\n * Enhances error with additional context information\n */\nexport function enhanceError(error: any, context: any): any {\n if (!error) return new Error('Unknown error occurred');\n\n // If it's already enhanced, return as-is\n if (error.context) return error;\n\n // Add context to the error\n const enhancedError = new Error(error.message || 'HTTP operation failed');\n Object.assign(enhancedError, {\n code: error.code || error.status || 'UNKNOWN_ERROR',\n status: error.status,\n context,\n originalError: error\n });\n\n return enhancedError;\n}\n\n/**\n * Gets default retry configuration merged with provided options\n */\nexport function getRetryConfig(apiOptions: any): any {\n return {\n maxRetries: 3,\n initialDelayMs: 1000,\n maxDelayMs: 30000,\n backoffMultiplier: 2,\n ...apiOptions.retryConfig\n };\n}\n\n/**\n * Handles custom error handler execution with error protection\n */\nexport function executeErrorHandler(\n errorHandler: ((error: any, context?: Record<string, any>) => void) | undefined,\n error: any,\n context: any,\n logger: any\n): void {\n if (!errorHandler) return;\n\n try {\n errorHandler(error, context);\n } catch (handlerError: any) {\n logger.error('Custom error handler failed', {\n originalError: error.message,\n handlerError: handlerError?.message || String(handlerError)\n });\n }\n}\n\n/**\n * Common retry loop logic for HTTP operations\n */\nexport async function executeWithRetry<T>(\n operation: () => Promise<T>,\n operationName: string,\n operationContext: Record<string, any>,\n apiOptions: any,\n logger: any,\n specialErrorHandling?: (error: any) => T | null | undefined\n): Promise<T> {\n const retryConfig = getRetryConfig(apiOptions);\n let lastError: any = null;\n const startTime = Date.now();\n\n for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {\n try {\n logger.debug(`Executing ${operationName} (attempt ${attempt + 1})`, operationContext);\n\n const result = await operation();\n\n if (attempt > 0) {\n logger.info(`${operationName} operation succeeded after ${attempt} retries`, {\n ...operationContext,\n totalAttempts: attempt + 1,\n duration: Date.now() - startTime\n });\n }\n\n return result;\n } catch (error: any) {\n lastError = error;\n\n // Handle special error cases (like 404 returning null)\n if (specialErrorHandling) {\n const specialResult = specialErrorHandling(error);\n if (specialResult !== void 0) {\n return specialResult as T;\n }\n }\n\n // Don't retry on the last attempt\n if (attempt === retryConfig.maxRetries) {\n break;\n }\n\n // Check if we should retry this error\n const isRetryable = shouldRetryError(error);\n if (!isRetryable) {\n logger.debug(`Not retrying ${operationName} operation due to non-retryable error`, {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n attempt: attempt + 1\n });\n break;\n }\n\n // Calculate delay with exponential backoff\n const delay = calculateRetryDelay(attempt, retryConfig);\n\n logger.warning(`Retrying ${operationName} operation (attempt ${attempt + 2}) after ${delay}ms`, {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n delay,\n attemptNumber: attempt + 1\n });\n\n // Wait before retrying\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n\n // Handle final error\n const finalError = enhanceError(lastError, operationContext);\n\n // Execute custom error handler if provided\n executeErrorHandler(apiOptions.errorHandler, finalError, operationContext, logger);\n\n logger.error(`${operationName} operation failed after ${retryConfig.maxRetries + 1} attempts`, {\n ...operationContext,\n errorMessage: finalError.message,\n errorCode: finalError.code || finalError.status,\n duration: Date.now() - startTime,\n totalAttempts: retryConfig.maxRetries + 1\n });\n\n throw finalError;\n}\n", "import { HttpApi } from '@fjell/http-api';\nimport {\n ClientApiError,\n createHttpError,\n createNetworkError,\n RateLimitError\n} from '../errors/index';\n\n// Simple logger interface for now\nconst logger = {\n debug: (message: string, context?: any) => console.debug(message, context),\n info: (message: string, context?: any) => console.info(message, context),\n warning: (message: string, context?: any) => console.warn(message, context),\n error: (message: string, context?: any) => console.error(message, context)\n};\n\n/**\n * Configuration for retry behavior\n */\nexport interface RetryConfig {\n /** Maximum number of retry attempts (default: 3) */\n maxRetries?: number;\n /** Initial delay between retries in milliseconds (default: 1000) */\n initialDelayMs?: number;\n /** Maximum delay between retries in milliseconds (default: 30000) */\n maxDelayMs?: number;\n /** Backoff multiplier for exponential backoff (default: 2) */\n backoffMultiplier?: number;\n /** Whether to add jitter to retry delays (default: true) */\n enableJitter?: boolean;\n /** Custom function to determine if an error should be retried */\n shouldRetry?: (error: ClientApiError, attemptNumber: number) => boolean;\n /** Called before each retry attempt */\n onRetry?: (error: ClientApiError, attemptNumber: number, delay: number) => void;\n}\n\n/**\n * Default retry configuration\n */\nconst DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n maxRetries: 3,\n initialDelayMs: 1000,\n maxDelayMs: 30000,\n backoffMultiplier: 2,\n enableJitter: true,\n shouldRetry: (error: ClientApiError, attemptNumber: number) => {\n // Don't retry after max attempts\n if (attemptNumber >= 3) return false;\n\n // Always retry retryable errors\n if (error.isRetryable) return true;\n\n // Don't retry non-retryable errors\n return false;\n },\n onRetry: (error: ClientApiError, attemptNumber: number, delay: number) => {\n logger.warning(`Retrying HTTP request (attempt ${attemptNumber + 1}) after ${delay}ms`, {\n errorCode: error.code,\n errorMessage: error.message,\n delay,\n attemptNumber\n });\n }\n};\n\n/**\n * Sleep utility for retry delays\n */\nconst sleep = (ms: number): Promise<void> => new Promise(resolve => setTimeout(resolve, ms));\n\n/**\n * Calculate delay for exponential backoff with optional jitter\n */\nfunction calculateDelay(\n attemptNumber: number,\n config: Required<RetryConfig>\n): number {\n const exponentialDelay = config.initialDelayMs * Math.pow(config.backoffMultiplier, attemptNumber);\n const cappedDelay = Math.min(exponentialDelay, config.maxDelayMs);\n\n if (!config.enableJitter) {\n return cappedDelay;\n }\n\n // Add jitter: random value between 50% and 100% of calculated delay\n const jitter = 0.5 + (Math.random() * 0.5);\n return Math.floor(cappedDelay * jitter);\n}\n\n/**\n * Enhanced HTTP wrapper with retry logic and comprehensive error handling\n */\nexport class HttpWrapper {\n private readonly api: HttpApi;\n private readonly retryConfig: Required<RetryConfig>;\n\n constructor(api: HttpApi, retryConfig: RetryConfig = {}) {\n this.api = api;\n this.retryConfig = { ...DEFAULT_RETRY_CONFIG, ...retryConfig };\n }\n\n /**\n * Execute HTTP operation with retry logic and error handling\n */\n async executeWithRetry<T>(\n operation: () => Promise<T>,\n operationName: string,\n context?: Record<string, any>\n ): Promise<T> {\n let lastError: ClientApiError | null = null;\n const startTime = Date.now();\n\n for (let attempt = 0; attempt <= this.retryConfig.maxRetries; attempt++) {\n try {\n logger.debug(`Executing ${operationName}`, {\n attempt: attempt + 1,\n maxRetries: this.retryConfig.maxRetries + 1,\n ...context\n });\n\n const result = await operation();\n\n if (attempt > 0) {\n logger.info(`${operationName} succeeded after ${attempt} retries`, {\n totalAttempts: attempt + 1,\n duration: Date.now() - startTime,\n ...context\n });\n }\n\n return result;\n } catch (error) {\n lastError = this.convertToClientApiError(error, operationName, context);\n\n // Don't retry on the last attempt\n if (attempt === this.retryConfig.maxRetries) {\n break;\n }\n\n // Check if we should retry this error\n if (!this.retryConfig.shouldRetry(lastError, attempt)) {\n logger.debug(`Not retrying ${operationName} due to non-retryable error`, {\n errorCode: lastError.code,\n errorMessage: lastError.message,\n attempt: attempt + 1,\n ...context\n });\n break;\n }\n\n // Handle rate limiting with custom delay\n let delay = calculateDelay(attempt, this.retryConfig);\n if (lastError instanceof RateLimitError && lastError.retryAfter) {\n delay = Math.max(delay, lastError.retryAfter * 1000);\n }\n\n // Call retry callback\n this.retryConfig.onRetry(lastError, attempt, delay);\n\n // Wait before retrying\n await sleep(delay);\n }\n }\n\n // Log final failure\n logger.error(`${operationName} failed after ${this.retryConfig.maxRetries + 1} attempts`, {\n errorCode: lastError?.code,\n errorMessage: lastError?.message,\n duration: Date.now() - startTime,\n ...context\n });\n\n throw lastError;\n }\n\n /**\n * Convert any error to a ClientApiError\n */\n private convertToClientApiError(\n error: any,\n operationName: string,\n context?: Record<string, any>\n ): ClientApiError {\n const errorContext = { operation: operationName, ...context };\n\n // If it's already a ClientApiError, return as-is\n if (error instanceof ClientApiError) {\n return error;\n }\n\n // Handle HTTP response errors\n if (error.response) {\n const { status, statusText, data, headers } = error.response;\n return createHttpError(status, statusText, data, {\n ...errorContext,\n headers,\n url: error.config?.url\n });\n }\n\n // Handle request errors (network issues, timeouts, etc.)\n if (error.request) {\n return createNetworkError(error, {\n ...errorContext,\n url: error.config?.url,\n method: error.config?.method\n });\n }\n\n // Handle configuration or other errors\n return createNetworkError(error, errorContext);\n }\n\n /**\n * Wrapper for HTTP GET operations\n */\n async get<T>(\n url: string,\n options?: any,\n context?: Record<string, any>\n ): Promise<T> {\n return this.executeWithRetry(\n () => this.api.httpGet(url, options),\n 'GET',\n { url, ...context }\n );\n }\n\n /**\n * Wrapper for HTTP POST operations\n */\n async post<T>(\n url: string,\n data?: any,\n options?: any,\n context?: Record<string, any>\n ): Promise<T> {\n return this.executeWithRetry(\n () => this.api.httpPost(url, data, options),\n 'POST',\n { url, hasData: !!data, ...context }\n );\n }\n\n /**\n * Wrapper for HTTP PUT operations\n */\n async put<T>(\n url: string,\n data?: any,\n options?: any,\n context?: Record<string, any>\n ): Promise<T> {\n return this.executeWithRetry(\n () => this.api.httpPut(url, data, options),\n 'PUT',\n { url, hasData: !!data, ...context }\n );\n }\n\n /**\n * Wrapper for HTTP DELETE operations\n */\n async delete<T>(\n url: string,\n options?: any,\n context?: Record<string, any>\n ): Promise<T> {\n return this.executeWithRetry(\n () => this.api.httpDelete(url, options),\n 'DELETE',\n { url, ...context }\n );\n }\n\n /**\n * Update retry configuration\n */\n updateRetryConfig(newConfig: Partial<RetryConfig>): void {\n Object.assign(this.retryConfig, newConfig);\n }\n\n /**\n * Get current retry configuration\n */\n getRetryConfig(): Required<RetryConfig> {\n return { ...this.retryConfig };\n }\n}\n"],
5
- "mappings": ";AAAA;AAAA,EAIE;AAAA,OACK;;;ACLP,OAAO,aAAa;AAEpB,IAAM,YAAY,QAAQ,UAAU,mBAAmB;AAEvD,IAAO,iBAAQ;;;ADQf,IAAM,SAAS,eAAU,IAAI,cAAc,OAAO,KAAK;AAEhD,IAAM,kBAAkB,CAQ3B,KACA,YACA,cAEG;AAEL,QAAM,MAAM,OACV,QAAmB,CAAC,GACpB,YAAkD,CAAC,MAClC;AACjB,cAAU,gBAAgB,SAAS;AACnC,UAAM,MAA4C;AAElD,UAAM,SAAsB,cAAc,KAAK;AAC/C,UAAM,iBAAiB,OAAO,OAAO,CAAC,GAAG,WAAW,YAAY,EAAE,iBAAiB,WAAW,kBAAkB,OAAO,CAAC;AAExH,WAAO,QAAQ,OAAO,EAAE,OAAO,WAAW,eAAe,CAAC;AAE1D,WAAO,UAAU,WAAW,MAAM,UAAU;AAAA,MAC1C,IAAI;AAAA,QACF,UAAU,QAAQ,GAAG;AAAA,QACrB;AAAA,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ACxB,CAAC;AAAA,IACH;AAGA,WAAO,mBAAmB,OAAO,YAAY;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,IACJ,KACA,SACA,SACY;AACZ,WAAO,KAAK;AAAA,MACV,MAAM,KAAK,IAAI,QAAQ,KAAK,OAAO;AAAA,MACnC;AAAA,MACA,EAAE,KAAK,GAAG,QAAQ;AAAA,IACpB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,KACJ,KACA,MACA,SACA,SACY;AACZ,WAAO,KAAK;AAAA,MACV,MAAM,KAAK,IAAI,SAAS,KAAK,MAAM,OAAO;AAAA,MAC1C;AAAA,MACA,EAAE,KAAK,SAAS,CAAC,CAAC,MAAM,GAAG,QAAQ;AAAA,IACrC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,IACJ,KACA,MACA,SACA,SACY;AACZ,WAAO,KAAK;AAAA,MACV,MAAM,KAAK,IAAI,QAAQ,KAAK,MAAM,OAAO;AAAA,MACzC;AAAA,MACA,EAAE,KAAK,SAAS,CAAC,CAAC,MAAM,GAAG,QAAQ;AAAA,IACrC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,OACJ,KACA,SACA,SACY;AACZ,WAAO,KAAK;AAAA,MACV,MAAM,KAAK,IAAI,WAAW,KAAK,OAAO;AAAA,MACtC;AAAA,MACA,EAAE,KAAK,GAAG,QAAQ;AAAA,IACpB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAkB,WAAuC;AACvD,WAAO,OAAO,KAAK,aAAa,SAAS;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA,EAKA,iBAAwC;AACtC,WAAO,EAAE,GAAG,KAAK,YAAY;AAAA,EAC/B;AACF;",
6
- "names": ["logger", "action", "logger", "queryToParams", "logger", "queryToParams", "logger", "logger", "logger", "shouldRetryError", "calculateRetryDelay", "enhanceError", "logger", "logger", "logger", "logger", "facet", "logger", "logger", "PriKey", "LocKey", "logger", "logger", "logger", "logger", "action", "facet", "logger", "logger", "logger", "shouldRetryError", "calculateRetryDelay", "enhanceError", "logger", "logger"]
3
+ "sources": ["../src/ops/all.ts", "../src/logger.ts", "../src/ops/action.ts", "../src/ops/allAction.ts", "../src/ops/one.ts", "../src/ops/errorHandling.ts", "../src/ops/create.ts", "../src/ops/update.ts", "../src/ops/get.ts", "../src/ops/remove.ts", "../src/ops/find.ts", "../src/ops/findOne.ts", "../src/ops/facet.ts", "../src/ops/allFacet.ts", "../src/ops/index.ts", "../src/Utilities.ts", "../src/AItemAPI.ts", "../src/CItemAPI.ts", "../src/PItemAPI.ts", "../src/Instance.ts", "../src/InstanceFactory.ts", "../src/Registry.ts", "../src/errors/index.ts", "../src/http/HttpWrapper.ts"],
4
+ "sourcesContent": ["import {\n Item,\n ItemQuery,\n LocKeyArray,\n queryToParams,\n} from \"@fjell/core\";\nimport { HttpApi, QueryParams } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'all');\n\nexport const getAllOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const all = async (\n query: ItemQuery = {} as ItemQuery,\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n utilities.verifyLocations(locations);\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const params: QueryParams = queryToParams(query);\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params });\n\n logger.default('all', { query, locations, requestOptions });\n\n return utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[];\n }\n\n return all;\n}\n\n", "import Logging from '@fjell/logging';\n\nconst LibLogger = Logging.getLogger('@fjell/client-api');\n\nexport default LibLogger;\n", "import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'action');\n\nexport const getActionOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const action = async (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n action: string,\n body: any = {},\n ): Promise<V> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('action', { ik, action, body, requestOptions });\n\n return utilities.validatePK(\n await utilities.processOne(\n api.httpPost<V>(\n `${utilities.getPath(ik)}/${action}`,\n body,\n requestOptions,\n )\n )) as V;\n\n };\n\n return action;\n}\n", "import {\n Item,\n LocKeyArray\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'allAction');\n\nexport const getAllActionOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const allAction = async (\n action: string,\n body: any = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('allAction', { action, body, locations, requestOptions });\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n // TODO: This should respond to either a single object, or multiple objects in an array.\n return utilities.validatePK(\n await utilities.processArray(\n api.httpPost<V[]>(\n `${utilities.getPath(loc)}/${action}`,\n body,\n requestOptions,\n )\n )) as V[];\n };\n\n return allAction;\n}\n", "import {\n Item,\n ItemQuery,\n LocKeyArray,\n QueryParams,\n queryToParams\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'one');\n\nexport const getOneOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ): (\n query: ItemQuery,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V | null> => {\n\n const one = async (\n query: ItemQuery = {} as ItemQuery,\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V | null> => {\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const params: QueryParams = queryToParams(query);\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.readAuthenticated, params });\n logger.default('one', { query, locations, requestOptions });\n\n let item: V | null = null;\n\n const items = utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[];\n\n if (items.length > 0) {\n item = items[0];\n }\n\n return item as V;\n }\n\n return one;\n}\n", "/**\n * Shared error handling utilities for all HTTP operations\n */\n\n/**\n * Determines if an error should be retried based on error type and status code\n */\nexport function shouldRetryError(error: any): boolean {\n // Retry on network errors and timeouts\n if (error.code === 'ECONNREFUSED' ||\n error.code === 'ENOTFOUND' ||\n error.code === 'ENETUNREACH' ||\n error.message?.includes('timeout') ||\n error.message?.includes('network')) {\n return true;\n }\n\n // Retry on HTTP 5xx errors and 429 (rate limiting)\n if (error.status >= 500 || error.status === 429) {\n return true;\n }\n\n // Don't retry on 4xx client errors (except 429)\n if (error.status >= 400 && error.status < 500 && error.status !== 429) {\n return false;\n }\n\n // Default to retrying unknown errors\n return true;\n}\n\n/**\n * Calculates retry delay with exponential backoff and jitter\n */\nexport function calculateRetryDelay(attempt: number, config: any): number {\n const exponentialDelay = (config.initialDelayMs || 1000) * Math.pow(config.backoffMultiplier || 2, attempt);\n const cappedDelay = Math.min(exponentialDelay, config.maxDelayMs || 30000);\n\n // Add jitter: random value between 50% and 100% of calculated delay\n const jitter = 0.5 + (Math.random() * 0.5);\n return Math.floor(cappedDelay * jitter);\n}\n\n/**\n * Enhances error with additional context information\n */\nexport function enhanceError(error: any, context: any): any {\n if (!error) return new Error('Unknown error occurred');\n\n // If it's already enhanced, return as-is\n if (error.context) return error;\n\n // Add context to the error\n const enhancedError = new Error(error.message || 'HTTP operation failed');\n Object.assign(enhancedError, {\n code: error.code || error.status || 'UNKNOWN_ERROR',\n status: error.status,\n context,\n originalError: error\n });\n\n return enhancedError;\n}\n\n/**\n * Gets default retry configuration merged with provided options\n */\nexport function getRetryConfig(apiOptions: any): any {\n return {\n maxRetries: 3,\n initialDelayMs: 1000,\n maxDelayMs: 30000,\n backoffMultiplier: 2,\n ...apiOptions.retryConfig\n };\n}\n\n/**\n * Handles custom error handler execution with error protection\n */\nexport function executeErrorHandler(\n errorHandler: ((error: any, context?: Record<string, any>) => void) | undefined,\n error: any,\n context: any,\n logger: any\n): void {\n if (!errorHandler) return;\n\n try {\n errorHandler(error, context);\n } catch (handlerError: any) {\n logger.error('Custom error handler failed', {\n originalError: error.message,\n handlerError: handlerError?.message || String(handlerError)\n });\n }\n}\n\n/**\n * Common retry loop logic for HTTP operations\n */\nexport async function executeWithRetry<T>(\n operation: () => Promise<T>,\n operationName: string,\n operationContext: Record<string, any>,\n apiOptions: any,\n logger: any,\n specialErrorHandling?: (error: any) => T | null | undefined\n): Promise<T> {\n const retryConfig = getRetryConfig(apiOptions);\n let lastError: any = null;\n const startTime = Date.now();\n\n for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {\n try {\n logger.debug(`Executing ${operationName} (attempt ${attempt + 1})`, operationContext);\n\n const result = await operation();\n\n if (attempt > 0) {\n logger.info(`${operationName} operation succeeded after ${attempt} retries`, {\n ...operationContext,\n totalAttempts: attempt + 1,\n duration: Date.now() - startTime\n });\n }\n\n return result;\n } catch (error: any) {\n lastError = error;\n\n // Handle special error cases (like 404 returning null)\n if (specialErrorHandling) {\n const specialResult = specialErrorHandling(error);\n if (specialResult !== void 0) {\n return specialResult as T;\n }\n }\n\n // Don't retry on the last attempt\n if (attempt === retryConfig.maxRetries) {\n break;\n }\n\n // Check if we should retry this error\n const isRetryable = shouldRetryError(error);\n if (!isRetryable) {\n logger.debug(`Not retrying ${operationName} operation due to non-retryable error`, {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n attempt: attempt + 1\n });\n break;\n }\n\n // Calculate delay with exponential backoff\n const delay = calculateRetryDelay(attempt, retryConfig);\n\n logger.warning(`Retrying ${operationName} operation (attempt ${attempt + 2}) after ${delay}ms`, {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n delay,\n attemptNumber: attempt + 1\n });\n\n // Wait before retrying\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n\n // Handle final error\n const finalError = enhanceError(lastError, operationContext);\n\n // Execute custom error handler if provided\n executeErrorHandler(apiOptions.errorHandler, finalError, operationContext, logger);\n\n logger.error(`${operationName} operation failed after ${retryConfig.maxRetries + 1} attempts`, {\n ...operationContext,\n errorMessage: finalError.message,\n errorCode: finalError.code || finalError.status,\n duration: Date.now() - startTime,\n totalAttempts: retryConfig.maxRetries + 1\n });\n\n throw finalError;\n}\n", "import {\n Item,\n LocKeyArray\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\nimport { calculateRetryDelay, enhanceError, shouldRetryError } from \"./errorHandling\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'create');\n\nexport const getCreateOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const create = async (\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('create', { item, locations, requestOptions });\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n const operationContext = {\n operation: 'create',\n path: utilities.getPath(loc),\n itemType: typeof item,\n hasLocations: locations.length > 0\n };\n\n // Retry configuration from options or defaults\n const retryConfig = {\n maxRetries: 3,\n initialDelayMs: 1000,\n maxDelayMs: 30000,\n backoffMultiplier: 2,\n ...apiOptions.retryConfig\n };\n\n let lastError: any = null;\n const startTime = Date.now();\n\n for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {\n try {\n logger.debug(`Creating item (attempt ${attempt + 1})`, operationContext);\n\n const result = await utilities.processOne(api.httpPost<V>(\n utilities.getPath(loc),\n item,\n requestOptions,\n ));\n\n const created: V = utilities.validatePK(result) as V;\n\n if (attempt > 0) {\n logger.info(`Create operation succeeded after ${attempt} retries`, {\n ...operationContext,\n totalAttempts: attempt + 1,\n duration: Date.now() - startTime\n });\n }\n\n return created;\n } catch (error: any) {\n lastError = error;\n\n // Don't retry on the last attempt\n if (attempt === retryConfig.maxRetries) {\n break;\n }\n\n // Determine if error is retryable\n const isRetryable = shouldRetryError(error);\n if (!isRetryable) {\n logger.debug('Not retrying create operation due to non-retryable error', {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n attempt: attempt + 1\n });\n break;\n }\n\n // Calculate delay with exponential backoff\n const delay = calculateRetryDelay(attempt, retryConfig);\n\n logger.warning(`Retrying create operation (attempt ${attempt + 2}) after ${delay}ms`, {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n delay,\n attemptNumber: attempt + 1\n });\n\n // Wait before retrying\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n\n // Handle final error\n const finalError = enhanceError(lastError, operationContext);\n\n // Call custom error handler if provided\n if (apiOptions.errorHandler) {\n try {\n apiOptions.errorHandler(finalError, operationContext);\n } catch (handlerError: any) {\n logger.error('Custom error handler failed', {\n originalError: finalError.message,\n handlerError: handlerError?.message || String(handlerError)\n });\n }\n }\n\n logger.error(`Create operation failed after ${retryConfig.maxRetries + 1} attempts`, {\n ...operationContext,\n errorMessage: finalError.message,\n errorCode: finalError.code || finalError.status,\n duration: Date.now() - startTime,\n totalAttempts: retryConfig.maxRetries + 1\n });\n\n throw finalError;\n };\n\n return create;\n}\n", "import {\n ComKey,\n Item,\n PriKey\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'update');\n\nexport const getUpdateOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const update = async (\n ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n ): Promise<V> => {\n const requestOptions = Object.assign({}, apiOptions.putOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('update', { ik, item, requestOptions });\n\n return utilities.validatePK(await utilities.processOne(\n api.httpPut<V>(\n utilities.getPath(ik),\n item,\n requestOptions,\n ))) as V;\n }\n\n return update;\n}\n", "import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\nimport { calculateRetryDelay, enhanceError, shouldRetryError } from \"./errorHandling\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'get');\n\nexport const getGetOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const get = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ): Promise<V | null> => {\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.readAuthenticated });\n logger.default('get', { ik, requestOptions });\n\n const operationContext = {\n operation: 'get',\n path: utilities.getPath(ik),\n keyType: typeof ik\n };\n\n const retryConfig = {\n maxRetries: 3,\n initialDelayMs: 1000,\n maxDelayMs: 30000,\n backoffMultiplier: 2,\n ...apiOptions.retryConfig\n };\n\n let lastError: any = null;\n const startTime = Date.now();\n\n for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {\n try {\n logger.debug(`Getting item (attempt ${attempt + 1})`, operationContext);\n\n const result = await utilities.processOne(\n api.httpGet<V>(\n utilities.getPath(ik),\n requestOptions,\n )\n );\n\n const item = utilities.validatePK(result) as V;\n\n if (attempt > 0) {\n logger.info(`Get operation succeeded after ${attempt} retries`, {\n ...operationContext,\n totalAttempts: attempt + 1,\n duration: Date.now() - startTime\n });\n }\n\n return item;\n } catch (error: any) {\n lastError = error;\n\n // Handle 404 errors specially - return null instead of throwing\n if (error.status === 404) {\n logger.debug('Item not found (404)', operationContext);\n return null;\n }\n\n if (attempt === retryConfig.maxRetries) {\n break;\n }\n\n const isRetryable = shouldRetryError(error);\n if (!isRetryable) {\n logger.debug('Not retrying get operation due to non-retryable error', {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n attempt: attempt + 1\n });\n break;\n }\n\n const delay = calculateRetryDelay(attempt, retryConfig);\n\n logger.warning(`Retrying get operation (attempt ${attempt + 2}) after ${delay}ms`, {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n delay,\n attemptNumber: attempt + 1\n });\n\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n\n const finalError = enhanceError(lastError, operationContext);\n\n if (apiOptions.errorHandler) {\n try {\n apiOptions.errorHandler(finalError, operationContext);\n } catch (handlerError: any) {\n logger.error('Custom error handler failed', {\n originalError: finalError.message,\n handlerError: handlerError?.message || String(handlerError)\n });\n }\n }\n\n logger.error(`Get operation failed after ${retryConfig.maxRetries + 1} attempts`, {\n ...operationContext,\n errorMessage: finalError.message,\n errorCode: finalError.code || finalError.status,\n duration: Date.now() - startTime,\n totalAttempts: retryConfig.maxRetries + 1\n });\n\n throw finalError;\n }\n\n return get;\n}\n", "import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'remove');\n\nexport const getRemoveOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const remove = async (\n ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\n ): Promise<boolean> => {\n const requestOptions = Object.assign({}, apiOptions.deleteOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('remove', { ik, requestOptions });\n\n return api.httpDelete<boolean>(utilities.getPath(ik), requestOptions);\n }\n\n return remove;\n}\n", "import {\n Item,\n LocKeyArray,\n QueryParams\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { finderToParams } from \"../AItemAPI\";\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'find');\n\nexport const getFindOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const find = async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n utilities.verifyLocations(locations);\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const mergedParams: QueryParams = finderToParams(finder, finderParams);\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params: mergedParams });\n logger.default('find', { finder, finderParams, locations, requestOptions });\n\n return utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[];\n }\n\n return find;\n}\n", "import {\n Item,\n LocKeyArray,\n QueryParams\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { finderToParams } from \"../AItemAPI\";\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'find');\n\nexport const getFindOneOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const findOne = async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V> => {\n utilities.verifyLocations(locations);\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const params: QueryParams = finderToParams(finder, finderParams);\n params.one = true;\n\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params });\n logger.default('findOne', { finder, finderParams, locations, requestOptions });\n\n return (utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[])[0];\n }\n\n return findOne;\n}\n", "import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'facet');\n\nexport const getFacetOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n /**\n * Executes a facet operation on an item.\n *\n * A facet is a piece of information that is related to an item - it represents\n * a specific aspect or characteristic of the item. Unlike actions which may\n * return items or perform operations, facets are informational queries that\n * return data about a particular facet of an item.\n *\n * @param ik - The item key (composite or primary key) identifying the item\n * @param facet - The name of the facet to query\n * @param body - Optional request body for the facet operation\n * @param options - Optional HTTP request options\n * @returns Promise resolving to the facet data\n */\n const facet = async (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<any> => {\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.writeAuthenticated, params });\n logger.default('facet', { ik, facet, requestOptions });\n\n return api.httpGet<any>(\n `${utilities.getPath(ik)}/${facet}`,\n requestOptions,\n );\n\n };\n\n return facet;\n}\n", "import {\n Item,\n LocKeyArray\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"../ClientApiOptions\";\nimport LibLogger from \"../logger\";\nimport { Utilities } from \"../Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'allFacet');\n\nexport const getAllFacetOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const allFacet = async (\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.writeAuthenticated, params });\n logger.default('allFacet', { facet, locations, requestOptions });\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n // TODO: This should respond to either a single object, or multiple objects in an array.\n return api.httpGet<V[]>(\n `${utilities.getPath(loc)}/${facet}`,\n requestOptions,\n )\n };\n\n return allFacet;\n}\n", "/* eslint-disable indent */\nimport { Item } from \"@fjell/core\"\nimport { getAllOperation } from \"./all\"\nimport { getActionOperation } from \"./action\"\nimport { Utilities } from \"../Utilities\"\nimport { HttpApi } from \"@fjell/http-api\"\nimport { getAllActionOperation } from \"./allAction\"\nimport { getOneOperation } from \"./one\"\nimport { getCreateOperation } from \"./create\"\nimport { getUpdateOperation } from \"./update\"\nimport { getGetOperation } from \"./get\"\nimport { getRemoveOperation } from \"./remove\"\nimport { getFindOperation } from \"./find\"\nimport { ClientApiOptions } from \"../ClientApiOptions\"\nimport { ClientApi } from \"../ClientApi\"\nimport { getFindOneOperation } from \"./findOne\"\nimport { getFacetOperation } from \"./facet\"\nimport { getAllFacetOperation } from \"./allFacet\"\n\nexport const getOperations =\n <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>,\n\n ): ClientApi<V, S, L1, L2, L3, L4, L5> => {\n return {\n action: getActionOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n all: getAllOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n allAction: getAllActionOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n allFacet: getAllFacetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n create: getCreateOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n facet: getFacetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n findOne: getFindOneOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n find: getFindOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n get: getGetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n one: getOneOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n remove: getRemoveOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n update: getUpdateOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n }\n }", "import {\n ComKey,\n validatePK as coreValidatePK,\n generateKeyArray,\n isPriKey,\n Item,\n LocKey,\n LocKeyArray,\n PriKey,\n} from \"@fjell/core\";\n\nimport LibLogger from \"./logger\";\nimport deepmerge from \"deepmerge\";\n\nconst logger = LibLogger.get('client-api', 'Utility');\n\nexport interface Utilities<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> {\n verifyLocations: (locations: LocKeyArray<L1, L2, L3, L4, L5> | [] | never) => boolean;\n processOne: (apiCall: Promise<V>) => Promise<V>;\n processArray: (api: Promise<V[]>) => Promise<V[]>;\n convertDoc: (doc: V) => V;\n getPath: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | []) => string;\n validatePK: (item: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[]) =>\n Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[];\n}\n\nexport const createUtilities = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(pkType: S, pathNames: string[]): Utilities<V, S, L1, L2, L3, L4, L5> => {\n\n logger.default('createUtilities', { pkType, pathNames });\n\n const verifyLocations = (\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] | never,\n ): boolean => {\n\n if (locations && locations.length < pathNames.length - 1) {\n throw new Error('Not enough locations for pathNames: locations:'\n + locations.length + ' pathNames:' + pathNames.length);\n }\n return true;\n }\n\n const processOne = async (\n apiCall: Promise<V>,\n ): Promise<V> => {\n logger.default('processOne', { apiCall });\n const response = await apiCall;\n logger.default('processOne response', {\n responseType: typeof response,\n hasData: !!response\n });\n return convertDoc(response);\n };\n\n const processArray = async (\n api: Promise<V[]>,\n ): Promise<V[]> => {\n logger.default('processArray', { api });\n const response = await api;\n logger.default('processArray response', {\n responseType: typeof response,\n isArray: Array.isArray(response),\n length: Array.isArray(response) ? response.length : 0\n });\n if (response && Array.isArray(response)) {\n return response.map((subjectChat: V) =>\n convertDoc(subjectChat),\n ) as unknown as V[];\n } else {\n logger.error('Response was not an array', { response });\n throw new Error('Response was not an array');\n }\n };\n\n const convertDoc = (doc: V): V => {\n logger.default('convertDoc', { doc });\n // console.log(JSON.stringify(doc, null, 2));\n if (doc && doc.events) {\n const events = doc.events;\n for (const key in events) {\n events[key] = deepmerge(events[key], { at: events[key].at ? new Date(events[key].at) : null });\n }\n\n return doc as unknown as V;\n } else {\n return doc;\n }\n };\n\n const getPath =\n (\n key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | [],\n ):\n string => {\n\n const localPathNames = [...pathNames];\n logger.default('getPath', { key, pathNames: localPathNames });\n\n // console.log('getPath key: ' + JSON.stringify(key));\n\n const keys = generateKeyArray(key);\n\n // console.log('getPath keys: ' + JSON.stringify(keys));\n // console.log('getPath pathNames: ' + JSON.stringify(pathNames));\n\n let path: string = addPath('', keys, localPathNames);\n\n // If there is only one collection left in the collections array, this means that\n // we received LocKeys and we need to add the last collection to the reference\n if (localPathNames.length === 1) {\n path = `${path}/${localPathNames[0]}`;\n }\n\n logger.default('getPath created', { key, path });\n\n return path;\n };\n\n const addPath = (\n base: string,\n keys: Array<PriKey<S> | LocKey<L1 | L2 | L3 | L4 | L5>>,\n localPathNames: string[],\n ): string => {\n logger.default('addPath', { base, keys, pathNames: localPathNames });\n if (keys.length < localPathNames.length - 1) {\n logger.error('addPath should never have keys with a length less than the length of pathNames - 1',\n { keys, localPathNames });\n throw new Error('addPath should never have keys with a length less than the length of pathNames - 1: '\n + keys.length + ' ' + localPathNames.length + ' ' + JSON.stringify(keys, localPathNames));\n } else if (keys.length > localPathNames.length) {\n logger.error('addPath should never have keys with a length greater than the length of pathNames',\n { keys, pathNames });\n throw new Error('addPath should never have keys with a length greater than the length of pathNames: '\n + keys.length + ' ' + localPathNames.length + ' ' + JSON.stringify(keys, localPathNames));\n }\n if (keys.length === 0) {\n // If you've recursively consumed all of the keys, return the base.\n logger.default('addPath returning base', { base });\n return base;\n } else {\n // Retrieve the next key and collection, and create the next base\n let nextBase: string;\n const key = keys.pop();\n const pathName = localPathNames.pop();\n if (isPriKey(key)) {\n const PriKey = key as PriKey<S>;\n nextBase = `${base}/${pathName}/${PriKey.pk}`;\n logger.default('Adding Path for PK', { pathName, PriKey, nextBase });\n } else {\n const LocKey = key as LocKey<L1 | L2 | L3 | L4 | L5>;\n nextBase = `${base}/${pathName}/${LocKey.lk}`;\n logger.default('Retrieving Collection for LK', { pathName, LocKey });\n }\n\n logger.default('calling addPath recursively', { nextBase, keys, localPathNames });\n return addPath(nextBase, keys, localPathNames);\n }\n\n }\n\n const validatePK = (\n item: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[]):\n Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[] => {\n return coreValidatePK<S, L1, L2, L3, L4, L5>(item, pkType);\n }\n\n return {\n verifyLocations,\n processOne,\n convertDoc,\n processArray,\n getPath,\n validatePK,\n }\n}\n", "/* eslint-disable indent */\nimport { Item, QueryParams } from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nimport { getOperations } from \"./ops\";\nimport { createUtilities } from \"./Utilities\";\nimport { ClientApi } from \"./ClientApi\";\n\nimport LibLogger from \"./logger\";\n\nconst logger = LibLogger.get('AItemAPI');\n\nexport type PathNamesArray<\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> =\n ([L5] extends [never] ?\n ([L4] extends [never] ?\n ([L3] extends [never] ?\n ([L2] extends [never] ?\n ([L1] extends [never] ?\n [string] :\n [string, string]) :\n [string, string, string]) :\n [string, string, string, string]) :\n [string, string, string, string, string]) :\n [string, string, string, string, string, string]);\n\nexport const finderToParams = (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>\n): QueryParams => {\n return {\n finder,\n finderParams: JSON.stringify(finderParams),\n };\n};\n\nexport const createAItemAPI = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n api: HttpApi,\n pkType: S,\n pathNames: PathNamesArray<L1, L2, L3, L4, L5>,\n options?: ClientApiOptions,\n): ClientApi<V, S, L1, L2, L3, L4, L5> => {\n\n logger.default('createAItemAPI', { pkType, pathNames, options });\n\n let mergedOptions: ClientApiOptions;\n\n const defaultOptions: ClientApiOptions = {\n readAuthenticated: true,\n allAuthenticated: true,\n writeAuthenticated: true,\n getOptions: {},\n postOptions: {},\n putOptions: {},\n deleteOptions: {},\n };\n\n if (options) {\n mergedOptions = Object.assign({}, defaultOptions, options);\n } else {\n mergedOptions = defaultOptions;\n }\n\n const utilities = createUtilities<V, S, L1, L2, L3, L4, L5>(pkType, pathNames);\n const operations = getOperations<V, S, L1, L2, L3, L4, L5>(api, mergedOptions, utilities);\n\n return {\n action: operations.action,\n all: operations.all,\n allAction: operations.allAction,\n allFacet: operations.allFacet,\n create: operations.create,\n facet: operations.facet,\n find: operations.find,\n findOne: operations.findOne,\n get: operations.get,\n one: operations.one,\n remove: operations.remove,\n update: operations.update,\n }\n}", "\nimport {\n ComKey,\n Item,\n ItemQuery,\n LocKeyArray,\n PriKey,\n} from \"@fjell/core\";\nimport {\n HttpApi\n} from \"@fjell/http-api\";\nimport { createAItemAPI, PathNamesArray } from \"./AItemAPI\";\n\nimport LibLogger from \"./logger\";\nimport { ClientApi } from \"./ClientApi\";\nimport { ClientApiOptions } from \"./ClientApiOptions\";\n\nconst logger = LibLogger.get('CItemAPI');\n\nexport interface CItemApi<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> extends ClientApi<V, S, L1, L2, L3, L4, L5> {\n action: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n action: string,\n body: any,\n ) => Promise<V>;\n all: (\n query: ItemQuery,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n allAction: (\n action: string,\n body?: any,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n allFacet: (\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<any>;\n get: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n ) => Promise<V | null>;\n create: (\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V>;\n remove: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n ) => Promise<boolean>;\n update: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n ) => Promise<V>;\n facet: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<any>;\n find: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n findOne: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V>;\n};\n\nexport const createCItemApi = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(api: HttpApi, type: S, pathNames: PathNamesArray<L1, L2, L3, L4, L5>, options?: ClientApiOptions): CItemApi<V, S, L1, L2, L3, L4, L5> => {\n\n logger.default('createCItemApi', { api, type, pathNames, options });\n\n const aItemAPI = createAItemAPI(api, type, pathNames, options);\n\n return {\n action: aItemAPI.action,\n all: aItemAPI.all,\n allAction: aItemAPI.allAction,\n allFacet: aItemAPI.allFacet,\n one: aItemAPI.one,\n get: aItemAPI.get,\n create: aItemAPI.create,\n remove: aItemAPI.remove,\n update: aItemAPI.update,\n facet: aItemAPI.facet,\n find: aItemAPI.find,\n findOne: aItemAPI.findOne,\n } as unknown as CItemApi<V, S, L1, L2, L3, L4, L5>;\n}\n", "import { ComKey, Item, ItemQuery, PriKey } from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\nimport { createAItemAPI } from \"./AItemAPI\";\nimport { ClientApi } from \"./ClientApi\";\n\nimport LibLogger from \"./logger\";\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nconst logger = LibLogger.get('PItemAPI');\n\nexport interface PItemApi<\n V extends Item<S>,\n S extends string\n> extends ClientApi<V, S> {\n\n action: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n action: string,\n body: any,\n ) => Promise<V>;\n\n all: (\n query: ItemQuery,\n ) => Promise<V[]>;\n\n allAction: (\n action: string,\n body?: any,\n ) => Promise<V[]>;\n\n allFacet: (\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<any>;\n\n one: (\n query: ItemQuery,\n ) => Promise<V | null>;\n\n get: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ) => Promise<V | null>;\n\n create: (\n item: Partial<Item<S>>,\n ) => Promise<V>;\n\n remove: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ) => Promise<boolean>;\n\n update: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: Partial<Item<S>>,\n ) => Promise<V>;\n\n facet: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<any>;\n\n find: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<V[]>;\n\n findOne: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<V>;\n}\n\nexport const createPItemApi = <V extends Item<S>, S extends string>(\n api: HttpApi,\n type: S,\n pathName: string,\n options?: ClientApiOptions\n): PItemApi<V, S> => {\n\n logger.default('createPItemApi', { type, pathName, options });\n\n const aItemAPI = createAItemAPI<V, S>(api, type, [pathName], options);\n\n const action =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n action: string,\n body: any = {},\n ): Promise<V> =>\n await aItemAPI.action(ik, action, body) as V;\n\n const all =\n async (\n query: ItemQuery = {} as ItemQuery,\n ): Promise<V[]> =>\n await aItemAPI.all(query, []) as V[];\n\n const allAction =\n async (\n action: string,\n body: any = {},\n ): Promise<V[]> =>\n await aItemAPI.allAction(action, body, []) as V[];\n\n const allFacet =\n async (\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<any> =>\n await aItemAPI.allFacet(facet, params) as any;\n\n const one =\n async (\n query: ItemQuery = {} as ItemQuery,\n ): Promise<V | null> =>\n await aItemAPI.one(query, []) as V | null;\n\n const get =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ): Promise<V | null> =>\n await aItemAPI.get(ik) as V | null;\n\n const create =\n async (\n item: Partial<Item<S>>,\n ): Promise<V> =>\n await aItemAPI.create(item, []) as V;\n\n const remove =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ): Promise<boolean> =>\n await aItemAPI.remove(ik) as boolean;\n\n const update =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: Partial<Item<S>>,\n ): Promise<V> =>\n await aItemAPI.update(ik, item) as V;\n\n const facet =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<any> =>\n await aItemAPI.facet(ik, facet, params) as any;\n\n const find =\n async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<V[]> =>\n await aItemAPI.find(finder, finderParams) as V[];\n\n const findOne =\n async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<V> =>\n await aItemAPI.findOne(finder, finderParams) as V;\n\n return {\n ...aItemAPI,\n action,\n all,\n allAction,\n allFacet,\n one,\n get,\n create,\n remove,\n update,\n facet,\n find,\n findOne,\n };\n\n};\n", "\nimport LibLogger from \"./logger\";\nimport { Item } from \"@fjell/core\";\nimport { Instance as BaseInstance, Coordinate, createInstance as createBaseInstance, Registry } from \"@fjell/registry\";\nimport { ClientApi } from \"./ClientApi\";\n\nconst logger = LibLogger.get(\"Instance\");\n\n/**\n * The Client API Instance interface represents a client API model instance that extends the base Instance\n * from @fjell/registry and adds client API operations for interacting with remote data.\n *\n * The interface extends the base Instance (which provides coordinate and registry) with:\n * - clientApi: Provides methods for interacting with remote data through HTTP APIs (get, create, update, etc.)\n *\n * @template V - The type of the data model item, extending Item\n * @template S - The string literal type representing the model's key type\n * @template L1-L5 - Optional string literal types for location hierarchy levels\n */\nexport interface Instance<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> extends BaseInstance<S, L1, L2, L3, L4, L5> {\n /** The client API object that provides methods for interacting with remote data */\n clientApi: ClientApi<V, S, L1, L2, L3, L4, L5>;\n}\n\nexport const createInstance = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n registry: Registry,\n coordinate: Coordinate<S, L1, L2, L3, L4, L5>,\n clientApi: ClientApi<V, S, L1, L2, L3, L4, L5>,\n ): Instance<V, S, L1, L2, L3, L4, L5> => {\n logger.debug(\"createInstance\", { coordinate, clientApi, registry });\n const baseInstance = createBaseInstance(registry, coordinate);\n return { ...baseInstance, clientApi };\n}\n", "import { Item } from \"@fjell/core\";\nimport { ClientApi } from \"./ClientApi\";\nimport { InstanceFactory as BaseInstanceFactory, Registry, RegistryHub } from \"@fjell/registry\";\nimport { createInstance, Instance } from \"./Instance\";\nimport { Coordinate } from \"@fjell/registry\";\nimport LibLogger from \"./logger\";\n\nconst logger = LibLogger.get(\"InstanceFactory\");\n\nexport type InstanceFactory<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> = (\n clientApi: ClientApi<V, S, L1, L2, L3, L4, L5>\n) => BaseInstanceFactory<S, L1, L2, L3, L4, L5>;\n\n/**\n * Factory function for creating client-api instances\n */\nexport const createInstanceFactory = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n clientApi: ClientApi<V, S, L1, L2, L3, L4, L5>\n ): BaseInstanceFactory<S, L1, L2, L3, L4, L5> => {\n return (coordinate: Coordinate<S, L1, L2, L3, L4, L5>, context: { registry: Registry, registryHub?: RegistryHub }) => {\n logger.debug(\"Creating client-api instance\", { coordinate, registry: context.registry, clientApi });\n\n return createInstance(context.registry, coordinate, clientApi) as Instance<V, S, L1, L2, L3, L4, L5>;\n };\n};\n", "import LibLogger from './logger';\nimport {\n Registry as BaseRegistry,\n createRegistry as createBaseRegistry,\n RegistryFactory,\n RegistryHub\n} from '@fjell/registry';\n\nconst logger = LibLogger.get(\"Registry\");\n\n/**\n * Extended Registry interface for client-api-specific functionality\n */\nexport interface Registry extends BaseRegistry {\n type: 'client-api';\n}\n\n/**\n * Factory function for creating client-api registries\n */\nexport const createRegistryFactory = (): RegistryFactory => {\n return (type: string, registryHub?: RegistryHub): BaseRegistry => {\n if (type !== 'client-api') {\n throw new Error(`Client API registry factory can only create 'client-api' type registries, got: ${type}`);\n }\n\n logger.debug(\"Creating client-api registry\", { type, registryHub });\n\n const baseRegistry = createBaseRegistry(type, registryHub);\n\n // Cast to Registry for type safety\n return baseRegistry as Registry;\n };\n};\n\n/**\n * Creates a new client-api registry instance\n */\nexport const createRegistry = (registryHub?: RegistryHub): Registry => {\n const baseRegistry = createBaseRegistry('client-api', registryHub);\n\n return {\n ...baseRegistry,\n } as Registry;\n};\n", "/**\n * Base class for all Client API errors\n */\nexport abstract class ClientApiError extends Error {\n abstract readonly code: string;\n abstract readonly isRetryable: boolean;\n readonly timestamp: Date;\n readonly context?: Record<string, any>;\n\n constructor(message: string, context?: Record<string, any>) {\n super(message);\n this.name = this.constructor.name;\n this.timestamp = new Date();\n this.context = context;\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n toJSON() {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n isRetryable: this.isRetryable,\n timestamp: this.timestamp,\n context: this.context,\n stack: this.stack\n };\n }\n}\n\n/**\n * Network-related errors (connection issues, timeouts)\n */\nexport class NetworkError extends ClientApiError {\n readonly code = 'NETWORK_ERROR';\n readonly isRetryable = true;\n\n constructor(message: string, context?: Record<string, any>) {\n super(`Network error: ${message}`, context);\n }\n}\n\n/**\n * HTTP timeout errors\n */\nexport class TimeoutError extends ClientApiError {\n readonly code = 'TIMEOUT_ERROR';\n readonly isRetryable = true;\n\n constructor(timeout: number, context?: Record<string, any>) {\n super(`Request timed out after ${timeout}ms`, context);\n }\n}\n\n/**\n * Authentication errors (401 Unauthorized)\n */\nexport class AuthenticationError extends ClientApiError {\n readonly code = 'AUTHENTICATION_ERROR';\n readonly isRetryable = false;\n\n constructor(message?: string, context?: Record<string, any>) {\n super(message || 'Authentication failed - invalid or expired credentials', context);\n }\n}\n\n/**\n * Authorization errors (403 Forbidden)\n */\nexport class AuthorizationError extends ClientApiError {\n readonly code = 'AUTHORIZATION_ERROR';\n readonly isRetryable = false;\n\n constructor(message?: string, context?: Record<string, any>) {\n super(message || 'Access forbidden - insufficient permissions', context);\n }\n}\n\n/**\n * Resource not found errors (404 Not Found)\n */\nexport class NotFoundError extends ClientApiError {\n readonly code = 'NOT_FOUND_ERROR';\n readonly isRetryable = false;\n\n constructor(resource: string, identifier?: string, context?: Record<string, any>) {\n const message = identifier\n ? `${resource} with identifier '${identifier}' not found`\n : `${resource} not found`;\n super(message, context);\n }\n}\n\n/**\n * Request validation errors (400 Bad Request)\n */\nexport class ValidationError extends ClientApiError {\n readonly code = 'VALIDATION_ERROR';\n readonly isRetryable = false;\n readonly validationErrors?: Array<{ field: string; message: string }>;\n\n constructor(message: string, validationErrors?: Array<{ field: string; message: string }>, context?: Record<string, any>) {\n super(`Validation error: ${message}`, context);\n this.validationErrors = validationErrors;\n }\n}\n\n/**\n * Conflict errors (409 Conflict)\n */\nexport class ConflictError extends ClientApiError {\n readonly code = 'CONFLICT_ERROR';\n readonly isRetryable = false;\n\n constructor(message: string, context?: Record<string, any>) {\n super(`Conflict: ${message}`, context);\n }\n}\n\n/**\n * Rate limiting errors (429 Too Many Requests)\n */\nexport class RateLimitError extends ClientApiError {\n readonly code = 'RATE_LIMIT_ERROR';\n readonly isRetryable = true;\n readonly retryAfter?: number;\n\n constructor(retryAfter?: number, context?: Record<string, any>) {\n const message = retryAfter\n ? `Rate limit exceeded - retry after ${retryAfter} seconds`\n : 'Rate limit exceeded';\n super(message, context);\n this.retryAfter = retryAfter;\n }\n}\n\n/**\n * Server errors (5xx status codes)\n */\nexport class ServerError extends ClientApiError {\n readonly code = 'SERVER_ERROR';\n readonly isRetryable = true;\n readonly statusCode: number;\n\n constructor(statusCode: number, message?: string, context?: Record<string, any>) {\n super(message || `Server error (${statusCode})`, context);\n this.statusCode = statusCode;\n }\n}\n\n/**\n * Request payload too large errors (413)\n */\nexport class PayloadTooLargeError extends ClientApiError {\n readonly code = 'PAYLOAD_TOO_LARGE_ERROR';\n readonly isRetryable = false;\n\n constructor(maxSize?: string, context?: Record<string, any>) {\n const message = maxSize\n ? `Request payload too large - maximum size is ${maxSize}`\n : 'Request payload too large';\n super(message, context);\n }\n}\n\n/**\n * Generic HTTP errors for unhandled status codes\n */\nexport class HttpError extends ClientApiError {\n readonly code = 'HTTP_ERROR';\n readonly isRetryable: boolean;\n readonly statusCode: number;\n readonly statusText: string;\n\n constructor(statusCode: number, statusText: string, message?: string, context?: Record<string, any>) {\n super(message || `HTTP error ${statusCode}: ${statusText}`, context);\n this.statusCode = statusCode;\n this.statusText = statusText;\n\n // 5xx errors are generally retryable, 4xx are not\n this.isRetryable = statusCode >= 500;\n }\n}\n\n/**\n * Configuration errors\n */\nexport class ConfigurationError extends ClientApiError {\n readonly code = 'CONFIGURATION_ERROR';\n readonly isRetryable = false;\n\n constructor(message: string, context?: Record<string, any>) {\n super(`Configuration error: ${message}`, context);\n }\n}\n\n/**\n * Parse/serialization errors\n */\nexport class ParseError extends ClientApiError {\n readonly code = 'PARSE_ERROR';\n readonly isRetryable = false;\n\n constructor(message: string, context?: Record<string, any>) {\n super(`Parse error: ${message}`, context);\n }\n}\n\n/**\n * Create appropriate error from HTTP response\n */\nexport function createHttpError(\n statusCode: number,\n statusText: string,\n responseBody?: any,\n context?: Record<string, any>\n): ClientApiError {\n const errorContext = { statusCode, statusText, responseBody, ...context };\n\n switch (statusCode) {\n case 400:\n if (responseBody?.validationErrors) {\n return new ValidationError(\n responseBody.message || 'Request validation failed',\n responseBody.validationErrors,\n errorContext\n );\n }\n return new ValidationError(responseBody?.message || statusText, [], errorContext);\n\n case 401:\n return new AuthenticationError(responseBody?.message, errorContext);\n\n case 403:\n return new AuthorizationError(responseBody?.message, errorContext);\n\n case 404:\n return new NotFoundError(\n responseBody?.resource || 'Resource',\n responseBody?.identifier,\n errorContext\n );\n\n case 409:\n return new ConflictError(responseBody?.message || statusText, errorContext);\n\n case 413:\n return new PayloadTooLargeError(responseBody?.maxSize, errorContext);\n\n case 429: {\n let retryAfter: number | undefined;\n if (responseBody?.retryAfter) {\n retryAfter = responseBody.retryAfter;\n } else if (context?.headers?.['retry-after']) {\n retryAfter = parseInt(context.headers['retry-after']);\n }\n return new RateLimitError(retryAfter, errorContext);\n }\n\n default:\n if (statusCode >= 500) {\n return new ServerError(statusCode, responseBody?.message || statusText, errorContext);\n }\n\n return new HttpError(statusCode, statusText, responseBody?.message, errorContext);\n }\n}\n\n/**\n * Create appropriate error from network/connection issues\n */\nexport function createNetworkError(error: any, context?: Record<string, any>): ClientApiError {\n const errorContext = { originalError: error, ...context };\n\n if (error.code === 'ECONNABORTED' || error.message?.includes('timeout')) {\n return new TimeoutError(error.timeout || 5000, errorContext);\n }\n\n if (error.code === 'ECONNREFUSED' ||\n error.code === 'ENOTFOUND' ||\n error.code === 'ENETUNREACH' ||\n error.message?.includes('network')) {\n return new NetworkError(error.message || 'Network connection failed', errorContext);\n }\n\n // For unknown errors, treat as network issues that might be retryable\n return new NetworkError(error.message || 'Unknown network error', errorContext);\n}\n\n/**\n * Type guard to check if error is retryable\n */\nexport function isRetryableError(error: any): boolean {\n return error instanceof ClientApiError && error.isRetryable;\n}\n\n/**\n * Type guard to check if error is a Client API error\n */\nexport function isClientApiError(error: any): error is ClientApiError {\n return error instanceof ClientApiError;\n}\n", "import { HttpApi } from '@fjell/http-api';\nimport {\n ClientApiError,\n createHttpError,\n createNetworkError,\n RateLimitError\n} from '../errors/index';\n\n// Simple logger interface for now\nconst logger = {\n debug: (message: string, context?: any) => console.debug(message, context),\n info: (message: string, context?: any) => console.info(message, context),\n warning: (message: string, context?: any) => console.warn(message, context),\n error: (message: string, context?: any) => console.error(message, context)\n};\n\n/**\n * Configuration for retry behavior\n */\nexport interface RetryConfig {\n /** Maximum number of retry attempts (default: 3) */\n maxRetries?: number;\n /** Initial delay between retries in milliseconds (default: 1000) */\n initialDelayMs?: number;\n /** Maximum delay between retries in milliseconds (default: 30000) */\n maxDelayMs?: number;\n /** Backoff multiplier for exponential backoff (default: 2) */\n backoffMultiplier?: number;\n /** Whether to add jitter to retry delays (default: true) */\n enableJitter?: boolean;\n /** Custom function to determine if an error should be retried */\n shouldRetry?: (error: ClientApiError, attemptNumber: number) => boolean;\n /** Called before each retry attempt */\n onRetry?: (error: ClientApiError, attemptNumber: number, delay: number) => void;\n}\n\n/**\n * Default retry configuration\n */\nconst DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n maxRetries: 3,\n initialDelayMs: 1000,\n maxDelayMs: 30000,\n backoffMultiplier: 2,\n enableJitter: true,\n shouldRetry: (error: ClientApiError, attemptNumber: number) => {\n // Don't retry after max attempts\n if (attemptNumber >= 3) return false;\n\n // Always retry retryable errors\n if (error.isRetryable) return true;\n\n // Don't retry non-retryable errors\n return false;\n },\n onRetry: (error: ClientApiError, attemptNumber: number, delay: number) => {\n logger.warning(`Retrying HTTP request (attempt ${attemptNumber + 1}) after ${delay}ms`, {\n errorCode: error.code,\n errorMessage: error.message,\n delay,\n attemptNumber\n });\n }\n};\n\n/**\n * Sleep utility for retry delays\n */\nconst sleep = (ms: number): Promise<void> => new Promise(resolve => setTimeout(resolve, ms));\n\n/**\n * Calculate delay for exponential backoff with optional jitter\n */\nfunction calculateDelay(\n attemptNumber: number,\n config: Required<RetryConfig>\n): number {\n const exponentialDelay = config.initialDelayMs * Math.pow(config.backoffMultiplier, attemptNumber);\n const cappedDelay = Math.min(exponentialDelay, config.maxDelayMs);\n\n if (!config.enableJitter) {\n return cappedDelay;\n }\n\n // Add jitter: random value between 50% and 100% of calculated delay\n const jitter = 0.5 + (Math.random() * 0.5);\n return Math.floor(cappedDelay * jitter);\n}\n\n/**\n * Enhanced HTTP wrapper with retry logic and comprehensive error handling\n */\nexport class HttpWrapper {\n private readonly api: HttpApi;\n private readonly retryConfig: Required<RetryConfig>;\n\n constructor(api: HttpApi, retryConfig: RetryConfig = {}) {\n this.api = api;\n this.retryConfig = { ...DEFAULT_RETRY_CONFIG, ...retryConfig };\n }\n\n /**\n * Execute HTTP operation with retry logic and error handling\n */\n async executeWithRetry<T>(\n operation: () => Promise<T>,\n operationName: string,\n context?: Record<string, any>\n ): Promise<T> {\n let lastError: ClientApiError | null = null;\n const startTime = Date.now();\n\n for (let attempt = 0; attempt <= this.retryConfig.maxRetries; attempt++) {\n try {\n logger.debug(`Executing ${operationName}`, {\n attempt: attempt + 1,\n maxRetries: this.retryConfig.maxRetries + 1,\n ...context\n });\n\n const result = await operation();\n\n if (attempt > 0) {\n logger.info(`${operationName} succeeded after ${attempt} retries`, {\n totalAttempts: attempt + 1,\n duration: Date.now() - startTime,\n ...context\n });\n }\n\n return result;\n } catch (error) {\n lastError = this.convertToClientApiError(error, operationName, context);\n\n // Don't retry on the last attempt\n if (attempt === this.retryConfig.maxRetries) {\n break;\n }\n\n // Check if we should retry this error\n if (!this.retryConfig.shouldRetry(lastError, attempt)) {\n logger.debug(`Not retrying ${operationName} due to non-retryable error`, {\n errorCode: lastError.code,\n errorMessage: lastError.message,\n attempt: attempt + 1,\n ...context\n });\n break;\n }\n\n // Handle rate limiting with custom delay\n let delay = calculateDelay(attempt, this.retryConfig);\n if (lastError instanceof RateLimitError && lastError.retryAfter) {\n delay = Math.max(delay, lastError.retryAfter * 1000);\n }\n\n // Call retry callback\n this.retryConfig.onRetry(lastError, attempt, delay);\n\n // Wait before retrying\n await sleep(delay);\n }\n }\n\n // Log final failure\n logger.error(`${operationName} failed after ${this.retryConfig.maxRetries + 1} attempts`, {\n errorCode: lastError?.code,\n errorMessage: lastError?.message,\n duration: Date.now() - startTime,\n ...context\n });\n\n throw lastError;\n }\n\n /**\n * Convert any error to a ClientApiError\n */\n private convertToClientApiError(\n error: any,\n operationName: string,\n context?: Record<string, any>\n ): ClientApiError {\n const errorContext = { operation: operationName, ...context };\n\n // If it's already a ClientApiError, return as-is\n if (error instanceof ClientApiError) {\n return error;\n }\n\n // Handle HTTP response errors\n if (error.response) {\n const { status, statusText, data, headers } = error.response;\n return createHttpError(status, statusText, data, {\n ...errorContext,\n headers,\n url: error.config?.url\n });\n }\n\n // Handle request errors (network issues, timeouts, etc.)\n if (error.request) {\n return createNetworkError(error, {\n ...errorContext,\n url: error.config?.url,\n method: error.config?.method\n });\n }\n\n // Handle configuration or other errors\n return createNetworkError(error, errorContext);\n }\n\n /**\n * Wrapper for HTTP GET operations\n */\n async get<T>(\n url: string,\n options?: any,\n context?: Record<string, any>\n ): Promise<T> {\n return this.executeWithRetry(\n () => this.api.httpGet(url, options),\n 'GET',\n { url, ...context }\n );\n }\n\n /**\n * Wrapper for HTTP POST operations\n */\n async post<T>(\n url: string,\n data?: any,\n options?: any,\n context?: Record<string, any>\n ): Promise<T> {\n return this.executeWithRetry(\n () => this.api.httpPost(url, data, options),\n 'POST',\n { url, hasData: !!data, ...context }\n );\n }\n\n /**\n * Wrapper for HTTP PUT operations\n */\n async put<T>(\n url: string,\n data?: any,\n options?: any,\n context?: Record<string, any>\n ): Promise<T> {\n return this.executeWithRetry(\n () => this.api.httpPut(url, data, options),\n 'PUT',\n { url, hasData: !!data, ...context }\n );\n }\n\n /**\n * Wrapper for HTTP DELETE operations\n */\n async delete<T>(\n url: string,\n options?: any,\n context?: Record<string, any>\n ): Promise<T> {\n return this.executeWithRetry(\n () => this.api.httpDelete(url, options),\n 'DELETE',\n { url, ...context }\n );\n }\n\n /**\n * Update retry configuration\n */\n updateRetryConfig(newConfig: Partial<RetryConfig>): void {\n Object.assign(this.retryConfig, newConfig);\n }\n\n /**\n * Get current retry configuration\n */\n getRetryConfig(): Required<RetryConfig> {\n return { ...this.retryConfig };\n }\n}\n"],
5
+ "mappings": ";AAAA;AAAA,EAIE;AAAA,OACK;;;ACLP,OAAO,aAAa;AAEpB,IAAM,YAAY,QAAQ,UAAU,mBAAmB;AAEvD,IAAO,iBAAQ;;;ADQf,IAAM,SAAS,eAAU,IAAI,cAAc,OAAO,KAAK;AAEhD,IAAM,kBAAkB,CAQ3B,KACA,YACA,cAEG;AAEL,QAAM,MAAM,OACV,QAAmB,CAAC,GACpB,YAAkD,CAAC,MAClC;AACjB,cAAU,gBAAgB,SAAS;AACnC,UAAM,MAA4C;AAElD,UAAM,SAAsB,cAAc,KAAK;AAC/C,UAAM,iBAAiB,OAAO,OAAO,CAAC,GAAG,WAAW,YAAY,EAAE,iBAAiB,WAAW,kBAAkB,OAAO,CAAC;AAExH,WAAO,QAAQ,OAAO,EAAE,OAAO,WAAW,eAAe,CAAC;AAE1D,WAAO,UAAU,WAAW,MAAM,UAAU;AAAA,MAC1C,IAAI;AAAA,QACF,UAAU,QAAQ,GAAG;AAAA,QACrB;AAAA,MACF;AAAA,IAAC,CAAC;AAAA,EACN;AAEA,SAAO;AACT;;;AErCA,IAAMA,UAAS,eAAU,IAAI,cAAc,OAAO,QAAQ;AAEnD,IAAM,qBAAqB,CAQ9B,KACA,YACA,cAEG;AAEL,QAAM,SAAS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S,CAAC,CAAC,MAAM,GAAG,QAAQ;AAAA,IACrC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,OACJ,KACA,SACA,SACY;AACZ,WAAO,KAAK;AAAA,MACV,MAAM,KAAK,IAAI,WAAW,KAAK,OAAO;AAAA,MACtC;AAAA,MACA,EAAE,KAAK,GAAG,QAAQ;AAAA,IACpB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAkB,WAAuC;AACvD,WAAO,OAAO,KAAK,aAAa,SAAS;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA,EAKA,iBAAwC;AACtC,WAAO,EAAE,GAAG,KAAK,YAAY;AAAA,EAC/B;AACF;",
6
+ "names": ["logger", "action", "logger", "queryToParams", "logger", "queryToParams", "logger", "logger", "logger", "logger", "logger", "logger", "logger", "logger", "facet", "logger", "logger", "PriKey", "LocKey", "logger", "logger", "logger", "logger", "action", "facet", "logger", "logger", "logger", "logger"]
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fjell/client-api",
3
3
  "description": "Client API for Fjell",
4
- "version": "4.4.18",
4
+ "version": "4.4.20",
5
5
  "keywords": [
6
6
  "client",
7
7
  "api",
@@ -30,16 +30,16 @@
30
30
  "docs:test": "cd docs && npm run test"
31
31
  },
32
32
  "dependencies": {
33
- "@fjell/core": "^4.4.25",
34
- "@fjell/http-api": "^4.4.23",
35
- "@fjell/logging": "^4.4.30",
36
- "@fjell/registry": "^4.4.20",
33
+ "@fjell/core": "^4.4.29",
34
+ "@fjell/http-api": "^4.4.26",
35
+ "@fjell/logging": "^4.4.36",
36
+ "@fjell/registry": "^4.4.24",
37
37
  "deepmerge": "^4.3.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@eslint/eslintrc": "^3.3.1",
41
41
  "@eslint/js": "^9.32.0",
42
- "@fjell/eslint-config": "^1.1.3",
42
+ "@fjell/eslint-config": "^1.1.11",
43
43
  "@tsconfig/recommended": "^1.0.10",
44
44
  "@typescript-eslint/eslint-plugin": "^8.38.0",
45
45
  "@typescript-eslint/parser": "^8.38.0",