@fjell/client-api 4.4.53 → 4.4.54
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 +126 -14
- package/dist/index.js.map +3 -3
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -17,12 +17,26 @@ var getAllOperation = (api, apiOptions, utilities) => {
|
|
|
17
17
|
const params = queryToParams(query);
|
|
18
18
|
const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params });
|
|
19
19
|
logger.default("all", { query, locations, requestOptions });
|
|
20
|
-
|
|
20
|
+
logger.debug("QUERY_CACHE: client-api.all() - Making API request", {
|
|
21
|
+
query: JSON.stringify(query),
|
|
22
|
+
locations: JSON.stringify(locations),
|
|
23
|
+
path: utilities.getPath(loc),
|
|
24
|
+
params: JSON.stringify(params),
|
|
25
|
+
isAuthenticated: apiOptions.allAuthenticated
|
|
26
|
+
});
|
|
27
|
+
const result = await utilities.processArray(
|
|
21
28
|
api.httpGet(
|
|
22
29
|
utilities.getPath(loc),
|
|
23
30
|
requestOptions
|
|
24
31
|
)
|
|
25
32
|
);
|
|
33
|
+
logger.debug("QUERY_CACHE: client-api.all() - API response received", {
|
|
34
|
+
query: JSON.stringify(query),
|
|
35
|
+
locations: JSON.stringify(locations),
|
|
36
|
+
itemCount: result.length,
|
|
37
|
+
itemKeys: result.map((item) => JSON.stringify(item.key))
|
|
38
|
+
});
|
|
39
|
+
return result;
|
|
26
40
|
};
|
|
27
41
|
return all;
|
|
28
42
|
};
|
|
@@ -99,6 +113,13 @@ var getOneOperation = (api, apiOptions, utilities) => {
|
|
|
99
113
|
const params = queryToParams2(query);
|
|
100
114
|
const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.readAuthenticated, params });
|
|
101
115
|
logger4.default("one", { query, locations, requestOptions });
|
|
116
|
+
logger4.debug("QUERY_CACHE: client-api.one() - Making API request", {
|
|
117
|
+
query: JSON.stringify(query),
|
|
118
|
+
locations: JSON.stringify(locations),
|
|
119
|
+
path: utilities.getPath(loc),
|
|
120
|
+
params: JSON.stringify(params),
|
|
121
|
+
isAuthenticated: apiOptions.readAuthenticated
|
|
122
|
+
});
|
|
102
123
|
let item = null;
|
|
103
124
|
const items = await utilities.processArray(
|
|
104
125
|
api.httpGet(
|
|
@@ -108,6 +129,16 @@ var getOneOperation = (api, apiOptions, utilities) => {
|
|
|
108
129
|
);
|
|
109
130
|
if (items.length > 0) {
|
|
110
131
|
item = items[0];
|
|
132
|
+
logger4.debug("QUERY_CACHE: client-api.one() - API response received", {
|
|
133
|
+
query: JSON.stringify(query),
|
|
134
|
+
locations: JSON.stringify(locations),
|
|
135
|
+
itemKey: JSON.stringify(item.key)
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
logger4.debug("QUERY_CACHE: client-api.one() - API returned no items", {
|
|
139
|
+
query: JSON.stringify(query),
|
|
140
|
+
locations: JSON.stringify(locations)
|
|
141
|
+
});
|
|
111
142
|
}
|
|
112
143
|
return item;
|
|
113
144
|
};
|
|
@@ -367,12 +398,18 @@ var logger8 = logger_default.get("client-api", "ops", "get");
|
|
|
367
398
|
var getGetOperation = (api, apiOptions, utilities) => {
|
|
368
399
|
const get = async (ik) => {
|
|
369
400
|
const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.readAuthenticated });
|
|
401
|
+
const keyStr = JSON.stringify(ik);
|
|
370
402
|
logger8.default("get", { ik, requestOptions });
|
|
371
403
|
const operationContext = {
|
|
372
404
|
operation: "get",
|
|
373
405
|
path: utilities.getPath(ik),
|
|
374
|
-
keyType: typeof ik
|
|
406
|
+
keyType: typeof ik,
|
|
407
|
+
key: keyStr
|
|
375
408
|
};
|
|
409
|
+
logger8.debug("CLIENT_API: get() started", {
|
|
410
|
+
...operationContext,
|
|
411
|
+
isAuthenticated: apiOptions.readAuthenticated
|
|
412
|
+
});
|
|
376
413
|
const retryConfig = {
|
|
377
414
|
maxRetries: 3,
|
|
378
415
|
initialDelayMs: 1e3,
|
|
@@ -383,69 +420,108 @@ var getGetOperation = (api, apiOptions, utilities) => {
|
|
|
383
420
|
let lastError = null;
|
|
384
421
|
const startTime = Date.now();
|
|
385
422
|
for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {
|
|
423
|
+
const attemptStartTime = Date.now();
|
|
386
424
|
try {
|
|
387
|
-
logger8.debug(`
|
|
425
|
+
logger8.debug(`CLIENT_API: get() attempt ${attempt + 1}`, {
|
|
426
|
+
...operationContext,
|
|
427
|
+
attempt: attempt + 1,
|
|
428
|
+
maxRetries: retryConfig.maxRetries + 1
|
|
429
|
+
});
|
|
430
|
+
const httpStartTime = Date.now();
|
|
388
431
|
const result = await utilities.processOne(
|
|
389
432
|
api.httpGet(
|
|
390
433
|
utilities.getPath(ik),
|
|
391
434
|
requestOptions
|
|
392
435
|
)
|
|
393
436
|
);
|
|
437
|
+
const httpDuration = Date.now() - httpStartTime;
|
|
394
438
|
utilities.validatePK(result);
|
|
439
|
+
const attemptDuration = Date.now() - attemptStartTime;
|
|
440
|
+
const totalDuration2 = Date.now() - startTime;
|
|
395
441
|
if (attempt > 0) {
|
|
396
|
-
logger8.info(`
|
|
442
|
+
logger8.info(`CLIENT_API: get() succeeded after retries`, {
|
|
397
443
|
...operationContext,
|
|
398
444
|
totalAttempts: attempt + 1,
|
|
399
|
-
|
|
445
|
+
httpDuration,
|
|
446
|
+
attemptDuration,
|
|
447
|
+
totalDuration: totalDuration2
|
|
448
|
+
});
|
|
449
|
+
} else {
|
|
450
|
+
logger8.debug(`CLIENT_API: get() succeeded (first attempt)`, {
|
|
451
|
+
...operationContext,
|
|
452
|
+
httpDuration,
|
|
453
|
+
totalDuration: totalDuration2,
|
|
454
|
+
hasResult: !!result
|
|
400
455
|
});
|
|
401
456
|
}
|
|
402
457
|
return result;
|
|
403
458
|
} catch (error) {
|
|
404
459
|
lastError = error;
|
|
460
|
+
const attemptDuration = Date.now() - attemptStartTime;
|
|
405
461
|
if (error.status === 404) {
|
|
406
|
-
logger8.debug("
|
|
462
|
+
logger8.debug("CLIENT_API: get() - item not found (404)", {
|
|
463
|
+
...operationContext,
|
|
464
|
+
attemptDuration,
|
|
465
|
+
totalDuration: Date.now() - startTime
|
|
466
|
+
});
|
|
407
467
|
return null;
|
|
408
468
|
}
|
|
469
|
+
logger8.debug("CLIENT_API: get() attempt failed", {
|
|
470
|
+
...operationContext,
|
|
471
|
+
attempt: attempt + 1,
|
|
472
|
+
attemptDuration,
|
|
473
|
+
errorStatus: error.status,
|
|
474
|
+
errorCode: error.code,
|
|
475
|
+
errorMessage: error.message
|
|
476
|
+
});
|
|
409
477
|
if (attempt === retryConfig.maxRetries) {
|
|
410
478
|
break;
|
|
411
479
|
}
|
|
412
480
|
const isRetryable = shouldRetryError(error);
|
|
413
481
|
if (!isRetryable) {
|
|
414
|
-
logger8.debug("
|
|
482
|
+
logger8.debug("CLIENT_API: get() - not retrying (non-retryable error)", {
|
|
415
483
|
...operationContext,
|
|
416
484
|
errorMessage: error.message,
|
|
417
485
|
errorCode: error.code || error.status,
|
|
418
|
-
|
|
486
|
+
errorStatus: error.status,
|
|
487
|
+
attempt: attempt + 1,
|
|
488
|
+
totalDuration: Date.now() - startTime
|
|
419
489
|
});
|
|
420
490
|
break;
|
|
421
491
|
}
|
|
422
492
|
const delay = calculateRetryDelay(attempt, retryConfig);
|
|
423
|
-
logger8.warning(`
|
|
493
|
+
logger8.warning(`CLIENT_API: get() - retrying after ${delay}ms`, {
|
|
424
494
|
...operationContext,
|
|
425
495
|
errorMessage: error.message,
|
|
426
496
|
errorCode: error.code || error.status,
|
|
497
|
+
errorStatus: error.status,
|
|
427
498
|
delay,
|
|
428
|
-
attemptNumber: attempt + 1
|
|
499
|
+
attemptNumber: attempt + 1,
|
|
500
|
+
nextAttempt: attempt + 2,
|
|
501
|
+
maxRetries: retryConfig.maxRetries + 1
|
|
429
502
|
});
|
|
430
503
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
431
504
|
}
|
|
432
505
|
}
|
|
433
506
|
const finalError = enhanceError(lastError, operationContext);
|
|
507
|
+
const totalDuration = Date.now() - startTime;
|
|
434
508
|
if (apiOptions.errorHandler) {
|
|
435
509
|
try {
|
|
436
510
|
apiOptions.errorHandler(finalError, operationContext);
|
|
437
511
|
} catch (handlerError) {
|
|
438
|
-
logger8.error("Custom error handler failed", {
|
|
512
|
+
logger8.error("CLIENT_API: Custom error handler failed", {
|
|
513
|
+
...operationContext,
|
|
439
514
|
originalError: finalError.message,
|
|
440
515
|
handlerError: handlerError?.message || String(handlerError)
|
|
441
516
|
});
|
|
442
517
|
}
|
|
443
518
|
}
|
|
444
|
-
logger8.error(`
|
|
519
|
+
logger8.error(`CLIENT_API: get() failed after all retries`, {
|
|
445
520
|
...operationContext,
|
|
446
521
|
errorMessage: finalError.message,
|
|
447
522
|
errorCode: finalError.code || finalError.status,
|
|
448
|
-
|
|
523
|
+
errorStatus: finalError.status,
|
|
524
|
+
totalDuration,
|
|
449
525
|
totalAttempts: retryConfig.maxRetries + 1
|
|
450
526
|
});
|
|
451
527
|
throw finalError;
|
|
@@ -477,12 +553,28 @@ var getFindOperation = (api, apiOptions, utilities) => {
|
|
|
477
553
|
const mergedParams = finderToParams(finder, finderParams);
|
|
478
554
|
const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params: mergedParams });
|
|
479
555
|
logger10.default("find", { finder, finderParams, locations, requestOptions });
|
|
480
|
-
|
|
556
|
+
logger10.debug("QUERY_CACHE: client-api.find() - Making API request", {
|
|
557
|
+
finder,
|
|
558
|
+
finderParams: JSON.stringify(finderParams),
|
|
559
|
+
locations: JSON.stringify(locations),
|
|
560
|
+
path: utilities.getPath(loc),
|
|
561
|
+
params: JSON.stringify(mergedParams),
|
|
562
|
+
isAuthenticated: apiOptions.allAuthenticated
|
|
563
|
+
});
|
|
564
|
+
const result = await utilities.processArray(
|
|
481
565
|
api.httpGet(
|
|
482
566
|
utilities.getPath(loc),
|
|
483
567
|
requestOptions
|
|
484
568
|
)
|
|
485
569
|
);
|
|
570
|
+
logger10.debug("QUERY_CACHE: client-api.find() - API response received", {
|
|
571
|
+
finder,
|
|
572
|
+
finderParams: JSON.stringify(finderParams),
|
|
573
|
+
locations: JSON.stringify(locations),
|
|
574
|
+
itemCount: result.length,
|
|
575
|
+
itemKeys: result.map((item) => JSON.stringify(item.key))
|
|
576
|
+
});
|
|
577
|
+
return result;
|
|
486
578
|
};
|
|
487
579
|
return find;
|
|
488
580
|
};
|
|
@@ -497,6 +589,14 @@ var getFindOneOperation = (api, apiOptions, utilities) => {
|
|
|
497
589
|
params.one = true;
|
|
498
590
|
const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params });
|
|
499
591
|
logger11.default("findOne", { finder, finderParams, locations, requestOptions });
|
|
592
|
+
logger11.debug("QUERY_CACHE: client-api.findOne() - Making API request", {
|
|
593
|
+
finder,
|
|
594
|
+
finderParams: JSON.stringify(finderParams),
|
|
595
|
+
locations: JSON.stringify(locations),
|
|
596
|
+
path: utilities.getPath(loc),
|
|
597
|
+
params: JSON.stringify(params),
|
|
598
|
+
isAuthenticated: apiOptions.allAuthenticated
|
|
599
|
+
});
|
|
500
600
|
const results = await utilities.processArray(
|
|
501
601
|
api.httpGet(
|
|
502
602
|
utilities.getPath(loc),
|
|
@@ -506,6 +606,18 @@ var getFindOneOperation = (api, apiOptions, utilities) => {
|
|
|
506
606
|
const result = results[0];
|
|
507
607
|
if (result) {
|
|
508
608
|
utilities.validatePK(result);
|
|
609
|
+
logger11.debug("QUERY_CACHE: client-api.findOne() - API response received", {
|
|
610
|
+
finder,
|
|
611
|
+
finderParams: JSON.stringify(finderParams),
|
|
612
|
+
locations: JSON.stringify(locations),
|
|
613
|
+
itemKey: JSON.stringify(result.key)
|
|
614
|
+
});
|
|
615
|
+
} else {
|
|
616
|
+
logger11.debug("QUERY_CACHE: client-api.findOne() - API returned no items", {
|
|
617
|
+
finder,
|
|
618
|
+
finderParams: JSON.stringify(finderParams),
|
|
619
|
+
locations: JSON.stringify(locations)
|
|
620
|
+
});
|
|
509
621
|
}
|
|
510
622
|
return result;
|
|
511
623
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
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/upsert.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/index.ts", "../src/http/HttpWrapper.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n AllMethod,\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 ): AllMethod<V, S, L1, L2, L3, L4, L5> => {\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 await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ));\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 { ActionOperationMethod, ComKey, Item, LocKeyArray, OperationParams, PriKey } 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>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n ): ActionOperationMethod<V, S, L1, L2, L3, L4, L5> => {\n const action = async (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n action: string,\n params?: OperationParams,\n ): Promise<[V, Array<PriKey<any> | ComKey<any, any, any, any, any, any> | LocKeyArray<any, any, any, any, any>>]> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('action', { ik, action, params, requestOptions });\n\n const response = await api.httpPost<[V, Array<PriKey<any> | ComKey<any, any, any, any, any, any> | LocKeyArray<any, any, any, any, any>>]>(\n `${utilities.getPath(ik)}/${action}`,\n params || {},\n requestOptions,\n );\n\n const [item, affectedItems] = response;\n return [\n await utilities.processOne(Promise.resolve(item)),\n affectedItems\n ];\n };\n return action;\n}\n", " \nimport { AllActionOperationMethod, ComKey, Item, LocKeyArray, OperationParams, PriKey } 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>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n ): AllActionOperationMethod<V, S, L1, L2, L3, L4, L5> => {\n const allAction = async (\n action: string,\n params?: OperationParams,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ): Promise<[V[], Array<PriKey<any> | ComKey<any, any, any, any, any, any> | LocKeyArray<any, any, any, any, any>>]> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations || [];\n logger.default('allAction', { action, params, locations: loc, requestOptions });\n utilities.verifyLocations(loc);\n\n const response = await api.httpPost<[V[], Array<PriKey<any> | ComKey<any, any, any, any, any, any> | LocKeyArray<any, any, any, any, any>>]>(\n `${utilities.getPath(loc)}/${action}`,\n params || {},\n requestOptions,\n );\n\n // Handle edge cases where response might not be an array\n let items: V[] = [];\n let affectedItems: Array<PriKey<any> | ComKey<any, any, any, any, any, any> | LocKeyArray<any, any, any, any, any>> = [];\n\n if (Array.isArray(response)) {\n // Check if this is a properly formatted tuple response [items, affectedItems]\n if (response.length === 2 && Array.isArray(response[0])) {\n [items, affectedItems] = response;\n } else {\n // Handle other array responses - return as-is\n return response as any;\n }\n } else if (response && typeof response === 'object' && Object.keys(response).length === 0) {\n // Handle empty object response {}\n items = [];\n affectedItems = [];\n } else if (typeof response === 'string' && response === '{}') {\n // Handle string response \"{}\"\n items = [];\n affectedItems = [];\n }\n\n const processedItems = await utilities.processArray(Promise.resolve(items));\n if (Array.isArray(processedItems)) {\n processedItems.forEach(item => utilities.validatePK(item));\n }\n return [\n processedItems,\n affectedItems\n ];\n };\n return allAction;\n}\n", "import {\n Item,\n ItemQuery,\n LocKeyArray,\n OneMethod,\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 ): OneMethod<V, S, L1, L2, L3, L4, L5> => {\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 = await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ));\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\nimport { isFjellHttpError } from '@fjell/http-api';\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 // Check FjellHttpError retryable flag first\n if (isFjellHttpError(error)) {\n return error.isRetryable();\n }\n\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 * Preserves FjellHttpError without modification\n */\nexport function enhanceError(error: any, context: any): any {\n if (!error) return new Error('Unknown error occurred');\n\n // Don't modify FjellHttpError - it already has full context\n if (isFjellHttpError(error)) {\n return error;\n }\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 CreateMethod,\n CreateOptions,\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 ): CreateMethod<V, S, L1, L2, L3, L4, L5> => {\n\n const create = async (\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n options?: CreateOptions<S, L1, L2, L3, L4, L5>\n ): Promise<V> => {\n // Extract locations or key from options for backward compatibility\n const locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = options?.locations || [];\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('create', { item, options, locations, requestOptions });\n utilities.verifyLocations(locations);\n \n // If a key was provided in options, include it in the item\n let itemToCreate = item;\n if (options?.key) {\n itemToCreate = { ...item, ...options.key };\n }\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 itemToCreate,\n requestOptions,\n ));\n\n utilities.validatePK(result);\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 result;\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 UpdateMethod\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 ): UpdateMethod<V, S, L1, L2, L3, L4, L5> => {\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 await utilities.processOne(\n api.httpPut<V>(\n utilities.getPath(ik),\n item,\n requestOptions,\n ));\n }\n\n return update;\n}\n", "import {\n ComKey,\n Item,\n LocKeyArray,\n PriKey,\n UpsertMethod\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', 'upsert');\n\nexport const getUpsertOperation = <\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 ): UpsertMethod<V, S, L1, L2, L3, L4, L5> => {\n\n const upsert = async (\n key: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\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.putOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('upsert', { key, item, locations, requestOptions });\n\n // Add locations to query params if provided\n const path = utilities.getPath(key);\n const url = locations && locations.length > 0\n ? `${path}?locations=${encodeURIComponent(JSON.stringify(locations))}`\n : path;\n\n return await utilities.processOne(\n api.httpPut<V>(\n url,\n { ...item, upsert: true },\n requestOptions,\n ));\n }\n\n return upsert;\n}\n\n", "import {\n ComKey,\n GetMethod,\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 ): GetMethod<V, S, L1, L2, L3, L4, L5> => {\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 utilities.validatePK(result);\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 result;\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 RemoveMethod\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 ): RemoveMethod<V, S, L1, L2, L3, L4, L5> => {\n\n const remove = async (\n ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\n ): Promise<V | void> => {\n const requestOptions = Object.assign({}, apiOptions.deleteOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('remove', { ik, requestOptions });\n\n const result = await api.httpDelete<V | boolean | void>(utilities.getPath(ik), requestOptions);\n \n // If result is a boolean, return void for compatibility\n if (typeof result === 'boolean') {\n return;\n }\n \n // Otherwise return the item (if the server returns it)\n return result as V | void;\n }\n\n return remove;\n}\n", "import {\n FindMethod,\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 ): FindMethod<V, S, L1, L2, L3, L4, L5> => {\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 await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ));\n }\n\n return find;\n}\n", "import {\n FindOneMethod,\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 ): FindOneMethod<V, S, L1, L2, L3, L4, L5> => {\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 const results = await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ));\n \n const result = results[0];\n if (result) {\n utilities.validatePK(result);\n }\n \n return result;\n }\n\n return findOne;\n}\n", "import {\n ComKey,\n FacetOperationMethod,\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 ): FacetOperationMethod<S, L1, L2, L3, L4, L5> => {\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 AllFacetOperationMethod,\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 ): AllFacetOperationMethod<L1, L2, L3, L4, L5> => {\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 { getUpsertOperation } from \"./upsert\"\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 upsert: getUpsertOperation<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 // For contained items (ComKey), we need to process location keys first\n // to match the URL structure: /parents/{parentId}/children/{childId}\n if (keys.length > 1) {\n // Separate PriKeys and LocKeys\n const priKeys = keys.filter(k => isPriKey(k));\n const locKeys = keys.filter(k => !isPriKey(k));\n \n // Location keys come in child->parent order, but paths must be parent->child\n // So reverse the locKeys to get parent->child order for path building\n const reversedLocKeys = [...locKeys].reverse();\n \n // Reorder: reversed LocKeys first, then PriKeys\n const reorderedKeys = [...reversedLocKeys, ...priKeys];\n logger.default('Reordered keys for contained item', {\n original: keys,\n locKeys,\n reversedLocKeys,\n reordered: reorderedKeys,\n priKeys\n });\n \n let path: string = addPath('', reorderedKeys, 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 return path;\n } else {\n // For primary items or single keys\n // If it's a LocKey array, we still need to reverse it for path building\n const priKeys = keys.filter(k => isPriKey(k));\n const locKeys = keys.filter(k => !isPriKey(k));\n \n // Reverse locKeys if present (child->parent to parent->child)\n const reversedLocKeys = locKeys.length > 0 ? [...locKeys].reverse() : [];\n const orderedKeys = [...reversedLocKeys, ...priKeys];\n \n let path: string = addPath('', orderedKeys, 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 return path;\n }\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 const currentKey = keys[0];\n const keyType = isPriKey(currentKey) ? currentKey.kt : currentKey.kt;\n \n // Find the best matching pathName for this key type\n const matchingPathNameIndex = localPathNames.findIndex(pathName => {\n const singularPathName = pathName.endsWith('s') ? pathName.slice(0, -1) : pathName;\n const pluralKeyType = keyType + 's';\n \n // Try various matching strategies\n return pathName === pluralKeyType || // photos === photo+s\n pathName === keyType + 'es' || // matches === match+es\n singularPathName === keyType || // photo === photo\n pathName.toLowerCase() === keyType.toLowerCase() || // case insensitive\n pathName.toLowerCase() === pluralKeyType.toLowerCase(); // case insensitive plural\n });\n \n if (matchingPathNameIndex !== -1) {\n // Found a matching pathName\n const pathName = localPathNames.splice(matchingPathNameIndex, 1)[0];\n const key = keys.shift()!;\n const id = isPriKey(key) ? (key as PriKey<S>).pk : (key as LocKey<L1 | L2 | L3 | L4 | L5>).lk;\n const nextBase = `${base}/${pathName}/${id}`;\n logger.default('Adding Path (matched)', {\n pathName,\n keyType,\n isPriKey: isPriKey(key),\n key,\n nextBase\n });\n return addPath(nextBase, keys, localPathNames);\n } else {\n // No match found, use first available pathName\n const pathName = localPathNames.shift()!;\n const key = keys.shift()!;\n const id = isPriKey(key) ? (key as PriKey<S>).pk : (key as LocKey<L1 | L2 | L3 | L4 | L5>).lk;\n const nextBase = `${base}/${pathName}/${id}`;\n logger.default('Adding Path (no match, using first)', {\n pathName,\n keyType,\n isPriKey: isPriKey(key),\n key,\n nextBase\n });\n return addPath(nextBase, keys, localPathNames);\n }\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 } 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): Record<string, string> => {\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 upsert: operations.upsert,\n }\n}", "\nimport {\n Item,\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\n/**\n * CItemApi extends ClientApi for contained items.\n * No additional methods needed - pure Operations interface.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface CItemApi<\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 ClientApi<V, S, L1, L2, L3, L4, L5> {\n // Inherits all methods from ClientApi (which extends core Operations)\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 upsert: aItemAPI.upsert,\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\n// PItemApi now directly extends ClientApi without re-declaring methods\n// This ensures compatibility with core Operations interface\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface PItemApi<\n V extends Item<S>,\n S extends string\n> extends ClientApi<V, S> {\n // Inherits all methods from ClientApi\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 // Simplified wrapper functions that adapt to primary-only API (no locations)\n const action = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n action: string,\n params?: any,\n ) => await aItemAPI.action(ik, action, params);\n\n const all = async (query?: ItemQuery) =>\n await aItemAPI.all(query || {}, []);\n\n const allAction = async (action: string, params?: any) =>\n await aItemAPI.allAction(action, params, []);\n\n const allFacet = async (facet: string, params?: any) =>\n await aItemAPI.allFacet(facet, params);\n\n const one = async (query?: ItemQuery) =>\n await aItemAPI.one(query || {}, []);\n\n const get = async (ik: PriKey<S> | ComKey<S, never, never, never, never, never>) =>\n await aItemAPI.get(ik);\n\n const create = async (item: Partial<Item<S>>, options?: any) =>\n await aItemAPI.create(item, options);\n\n const remove = async (ik: PriKey<S> | ComKey<S, never, never, never, never, never>) =>\n await aItemAPI.remove(ik);\n\n const update = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: Partial<Item<S>>,\n ) => await aItemAPI.update(ik, item);\n\n const upsert = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: Partial<Item<S>>,\n locations?: any\n ) => await aItemAPI.upsert(ik, item, locations);\n\n const facet = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n facet: string,\n params?: any,\n ) => await aItemAPI.facet(ik, facet, params);\n\n const find = async (finder: string, finderParams?: any) =>\n await aItemAPI.find(finder, finderParams);\n\n const findOne = async (finder: string, finderParams?: any) =>\n await aItemAPI.findOne(finder, finderParams);\n\n return {\n action,\n all,\n allAction,\n allFacet,\n one,\n get,\n create,\n remove,\n update,\n upsert,\n facet,\n find,\n findOne,\n } as PItemApi<V, S>;\n\n};\n", "\nimport LibLogger from \"./logger\";\nimport { Item } from \"@fjell/core\";\nimport { Instance as BaseInstance, createInstance as createBaseInstance, Registry } from \"@fjell/registry\";\nimport { ClientApi } from \"./ClientApi\";\nimport { Coordinate } from \"@fjell/core\";\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/core\";\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", "export type { CItemApi } from \"./CItemAPI\";\nexport type { PItemApi } from \"./PItemAPI\";\nexport type { ClientApi } from \"./ClientApi\";\nexport type { ClientApiOptions } from \"./ClientApiOptions\";\n\nexport { createCItemApi } from \"./CItemAPI\";\nexport { createPItemApi } from \"./PItemAPI\";\n\n// Registry components\nexport * from './Instance';\nexport * from './InstanceFactory';\nexport * from './Registry';\n\n// Error handling\nexport * from './errors/index';\nexport * from './ops/errorHandling';\n\n// Re-export FjellHttpError from http-api for convenience\nexport { FjellHttpError, isFjellHttpError, extractErrorInfo, type ErrorInfo } from '@fjell/http-api';\n\n// HTTP wrapper\nexport * from './http/HttpWrapper';\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,EAKE;AAAA,OACK;;;ACNP,OAAO,aAAa;AAEpB,IAAM,YAAY,QAAQ,UAAU,mBAAmB;AAEvD,IAAO,iBAAQ;;;ADSf,IAAM,SAAS,eAAU,IAAI,cAAc,OAAO,KAAK;AAEhD,IAAM,kBAAkB,CAQ3B,KACA,YACA,cAEwC;AAE1C,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,MAAM,UAAU;AAAA,MACrB,IAAI;AAAA,QACF,UAAU,QAAQ,GAAG;AAAA,QACrB;AAAA,MACF;AAAA,IAAC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A,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", "logger", "facet", "logger", "logger", "logger", "logger", "logger", "action", "facet", "options", "logger", "logger", "logger", "isFjellHttpError", "logger"]
|
|
4
|
+
"sourcesContent": ["import {\n AllMethod,\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 ): AllMethod<V, S, L1, L2, L3, L4, L5> => {\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 logger.debug('QUERY_CACHE: client-api.all() - Making API request', {\n query: JSON.stringify(query),\n locations: JSON.stringify(locations),\n path: utilities.getPath(loc),\n params: JSON.stringify(params),\n isAuthenticated: apiOptions.allAuthenticated\n });\n\n const result = await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ));\n \n logger.debug('QUERY_CACHE: client-api.all() - API response received', {\n query: JSON.stringify(query),\n locations: JSON.stringify(locations),\n itemCount: result.length,\n itemKeys: result.map(item => JSON.stringify(item.key))\n });\n\n return result;\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 { ActionOperationMethod, ComKey, Item, LocKeyArray, OperationParams, PriKey } 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>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n ): ActionOperationMethod<V, S, L1, L2, L3, L4, L5> => {\n const action = async (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n action: string,\n params?: OperationParams,\n ): Promise<[V, Array<PriKey<any> | ComKey<any, any, any, any, any, any> | LocKeyArray<any, any, any, any, any>>]> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('action', { ik, action, params, requestOptions });\n\n const response = await api.httpPost<[V, Array<PriKey<any> | ComKey<any, any, any, any, any, any> | LocKeyArray<any, any, any, any, any>>]>(\n `${utilities.getPath(ik)}/${action}`,\n params || {},\n requestOptions,\n );\n\n const [item, affectedItems] = response;\n return [\n await utilities.processOne(Promise.resolve(item)),\n affectedItems\n ];\n };\n return action;\n}\n", " \nimport { AllActionOperationMethod, ComKey, Item, LocKeyArray, OperationParams, PriKey } 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>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n ): AllActionOperationMethod<V, S, L1, L2, L3, L4, L5> => {\n const allAction = async (\n action: string,\n params?: OperationParams,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ): Promise<[V[], Array<PriKey<any> | ComKey<any, any, any, any, any, any> | LocKeyArray<any, any, any, any, any>>]> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations || [];\n logger.default('allAction', { action, params, locations: loc, requestOptions });\n utilities.verifyLocations(loc);\n\n const response = await api.httpPost<[V[], Array<PriKey<any> | ComKey<any, any, any, any, any, any> | LocKeyArray<any, any, any, any, any>>]>(\n `${utilities.getPath(loc)}/${action}`,\n params || {},\n requestOptions,\n );\n\n // Handle edge cases where response might not be an array\n let items: V[] = [];\n let affectedItems: Array<PriKey<any> | ComKey<any, any, any, any, any, any> | LocKeyArray<any, any, any, any, any>> = [];\n\n if (Array.isArray(response)) {\n // Check if this is a properly formatted tuple response [items, affectedItems]\n if (response.length === 2 && Array.isArray(response[0])) {\n [items, affectedItems] = response;\n } else {\n // Handle other array responses - return as-is\n return response as any;\n }\n } else if (response && typeof response === 'object' && Object.keys(response).length === 0) {\n // Handle empty object response {}\n items = [];\n affectedItems = [];\n } else if (typeof response === 'string' && response === '{}') {\n // Handle string response \"{}\"\n items = [];\n affectedItems = [];\n }\n\n const processedItems = await utilities.processArray(Promise.resolve(items));\n if (Array.isArray(processedItems)) {\n processedItems.forEach(item => utilities.validatePK(item));\n }\n return [\n processedItems,\n affectedItems\n ];\n };\n return allAction;\n}\n", "import {\n Item,\n ItemQuery,\n LocKeyArray,\n OneMethod,\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 ): OneMethod<V, S, L1, L2, L3, L4, L5> => {\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 logger.debug('QUERY_CACHE: client-api.one() - Making API request', {\n query: JSON.stringify(query),\n locations: JSON.stringify(locations),\n path: utilities.getPath(loc),\n params: JSON.stringify(params),\n isAuthenticated: apiOptions.readAuthenticated\n });\n\n let item: V | null = null;\n\n const items = await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ));\n\n if (items.length > 0) {\n item = items[0];\n logger.debug('QUERY_CACHE: client-api.one() - API response received', {\n query: JSON.stringify(query),\n locations: JSON.stringify(locations),\n itemKey: JSON.stringify(item.key)\n });\n } else {\n logger.debug('QUERY_CACHE: client-api.one() - API returned no items', {\n query: JSON.stringify(query),\n locations: JSON.stringify(locations)\n });\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\nimport { isFjellHttpError } from '@fjell/http-api';\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 // Check FjellHttpError retryable flag first\n if (isFjellHttpError(error)) {\n return error.isRetryable();\n }\n\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 * Preserves FjellHttpError without modification\n */\nexport function enhanceError(error: any, context: any): any {\n if (!error) return new Error('Unknown error occurred');\n\n // Don't modify FjellHttpError - it already has full context\n if (isFjellHttpError(error)) {\n return error;\n }\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 CreateMethod,\n CreateOptions,\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 ): CreateMethod<V, S, L1, L2, L3, L4, L5> => {\n\n const create = async (\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n options?: CreateOptions<S, L1, L2, L3, L4, L5>\n ): Promise<V> => {\n // Extract locations or key from options for backward compatibility\n const locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = options?.locations || [];\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('create', { item, options, locations, requestOptions });\n utilities.verifyLocations(locations);\n \n // If a key was provided in options, include it in the item\n let itemToCreate = item;\n if (options?.key) {\n itemToCreate = { ...item, ...options.key };\n }\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 itemToCreate,\n requestOptions,\n ));\n\n utilities.validatePK(result);\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 result;\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 UpdateMethod\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 ): UpdateMethod<V, S, L1, L2, L3, L4, L5> => {\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 await utilities.processOne(\n api.httpPut<V>(\n utilities.getPath(ik),\n item,\n requestOptions,\n ));\n }\n\n return update;\n}\n", "import {\n ComKey,\n Item,\n LocKeyArray,\n PriKey,\n UpsertMethod\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', 'upsert');\n\nexport const getUpsertOperation = <\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 ): UpsertMethod<V, S, L1, L2, L3, L4, L5> => {\n\n const upsert = async (\n key: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\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.putOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('upsert', { key, item, locations, requestOptions });\n\n // Add locations to query params if provided\n const path = utilities.getPath(key);\n const url = locations && locations.length > 0\n ? `${path}?locations=${encodeURIComponent(JSON.stringify(locations))}`\n : path;\n\n return await utilities.processOne(\n api.httpPut<V>(\n url,\n { ...item, upsert: true },\n requestOptions,\n ));\n }\n\n return upsert;\n}\n\n", "import {\n ComKey,\n GetMethod,\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 ): GetMethod<V, S, L1, L2, L3, L4, L5> => {\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 const keyStr = JSON.stringify(ik);\n \n logger.default('get', { ik, requestOptions });\n\n const operationContext = {\n operation: 'get',\n path: utilities.getPath(ik),\n keyType: typeof ik,\n key: keyStr\n };\n\n logger.debug('CLIENT_API: get() started', {\n ...operationContext,\n isAuthenticated: apiOptions.readAuthenticated\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 const attemptStartTime = Date.now();\n try {\n logger.debug(`CLIENT_API: get() attempt ${attempt + 1}`, {\n ...operationContext,\n attempt: attempt + 1,\n maxRetries: retryConfig.maxRetries + 1\n });\n\n const httpStartTime = Date.now();\n const result = await utilities.processOne(\n api.httpGet<V>(\n utilities.getPath(ik),\n requestOptions,\n )\n );\n const httpDuration = Date.now() - httpStartTime;\n\n utilities.validatePK(result);\n\n const attemptDuration = Date.now() - attemptStartTime;\n const totalDuration = Date.now() - startTime;\n\n if (attempt > 0) {\n logger.info(`CLIENT_API: get() succeeded after retries`, {\n ...operationContext,\n totalAttempts: attempt + 1,\n httpDuration,\n attemptDuration,\n totalDuration\n });\n } else {\n logger.debug(`CLIENT_API: get() succeeded (first attempt)`, {\n ...operationContext,\n httpDuration,\n totalDuration,\n hasResult: !!result\n });\n }\n\n return result;\n } catch (error: any) {\n lastError = error;\n const attemptDuration = Date.now() - attemptStartTime;\n\n // Handle 404 errors specially - return null instead of throwing\n if (error.status === 404) {\n logger.debug('CLIENT_API: get() - item not found (404)', {\n ...operationContext,\n attemptDuration,\n totalDuration: Date.now() - startTime\n });\n return null;\n }\n\n logger.debug('CLIENT_API: get() attempt failed', {\n ...operationContext,\n attempt: attempt + 1,\n attemptDuration,\n errorStatus: error.status,\n errorCode: error.code,\n errorMessage: error.message\n });\n\n if (attempt === retryConfig.maxRetries) {\n break;\n }\n\n const isRetryable = shouldRetryError(error);\n if (!isRetryable) {\n logger.debug('CLIENT_API: get() - not retrying (non-retryable error)', {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n errorStatus: error.status,\n attempt: attempt + 1,\n totalDuration: Date.now() - startTime\n });\n break;\n }\n\n const delay = calculateRetryDelay(attempt, retryConfig);\n\n logger.warning(`CLIENT_API: get() - retrying after ${delay}ms`, {\n ...operationContext,\n errorMessage: error.message,\n errorCode: error.code || error.status,\n errorStatus: error.status,\n delay,\n attemptNumber: attempt + 1,\n nextAttempt: attempt + 2,\n maxRetries: retryConfig.maxRetries + 1\n });\n\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n\n const finalError = enhanceError(lastError, operationContext);\n const totalDuration = Date.now() - startTime;\n\n if (apiOptions.errorHandler) {\n try {\n apiOptions.errorHandler(finalError, operationContext);\n } catch (handlerError: any) {\n logger.error('CLIENT_API: Custom error handler failed', {\n ...operationContext,\n originalError: finalError.message,\n handlerError: handlerError?.message || String(handlerError)\n });\n }\n }\n\n logger.error(`CLIENT_API: get() failed after all retries`, {\n ...operationContext,\n errorMessage: finalError.message,\n errorCode: finalError.code || finalError.status,\n errorStatus: finalError.status,\n totalDuration,\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 RemoveMethod\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 ): RemoveMethod<V, S, L1, L2, L3, L4, L5> => {\n\n const remove = async (\n ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\n ): Promise<V | void> => {\n const requestOptions = Object.assign({}, apiOptions.deleteOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('remove', { ik, requestOptions });\n\n const result = await api.httpDelete<V | boolean | void>(utilities.getPath(ik), requestOptions);\n \n // If result is a boolean, return void for compatibility\n if (typeof result === 'boolean') {\n return;\n }\n \n // Otherwise return the item (if the server returns it)\n return result as V | void;\n }\n\n return remove;\n}\n", "import {\n FindMethod,\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 ): FindMethod<V, S, L1, L2, L3, L4, L5> => {\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 logger.debug('QUERY_CACHE: client-api.find() - Making API request', {\n finder,\n finderParams: JSON.stringify(finderParams),\n locations: JSON.stringify(locations),\n path: utilities.getPath(loc),\n params: JSON.stringify(mergedParams),\n isAuthenticated: apiOptions.allAuthenticated\n });\n\n const result = await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ));\n \n logger.debug('QUERY_CACHE: client-api.find() - API response received', {\n finder,\n finderParams: JSON.stringify(finderParams),\n locations: JSON.stringify(locations),\n itemCount: result.length,\n itemKeys: result.map(item => JSON.stringify(item.key))\n });\n\n return result;\n }\n\n return find;\n}\n", "import {\n FindOneMethod,\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 ): FindOneMethod<V, S, L1, L2, L3, L4, L5> => {\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 logger.debug('QUERY_CACHE: client-api.findOne() - Making API request', {\n finder,\n finderParams: JSON.stringify(finderParams),\n locations: JSON.stringify(locations),\n path: utilities.getPath(loc),\n params: JSON.stringify(params),\n isAuthenticated: apiOptions.allAuthenticated\n });\n\n const results = await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ));\n \n const result = results[0];\n if (result) {\n utilities.validatePK(result);\n logger.debug('QUERY_CACHE: client-api.findOne() - API response received', {\n finder,\n finderParams: JSON.stringify(finderParams),\n locations: JSON.stringify(locations),\n itemKey: JSON.stringify(result.key)\n });\n } else {\n logger.debug('QUERY_CACHE: client-api.findOne() - API returned no items', {\n finder,\n finderParams: JSON.stringify(finderParams),\n locations: JSON.stringify(locations)\n });\n }\n \n return result;\n }\n\n return findOne;\n}\n", "import {\n ComKey,\n FacetOperationMethod,\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 ): FacetOperationMethod<S, L1, L2, L3, L4, L5> => {\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 AllFacetOperationMethod,\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 ): AllFacetOperationMethod<L1, L2, L3, L4, L5> => {\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 { getUpsertOperation } from \"./upsert\"\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 upsert: getUpsertOperation<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 // For contained items (ComKey), we need to process location keys first\n // to match the URL structure: /parents/{parentId}/children/{childId}\n if (keys.length > 1) {\n // Separate PriKeys and LocKeys\n const priKeys = keys.filter(k => isPriKey(k));\n const locKeys = keys.filter(k => !isPriKey(k));\n \n // Location keys come in child->parent order, but paths must be parent->child\n // So reverse the locKeys to get parent->child order for path building\n const reversedLocKeys = [...locKeys].reverse();\n \n // Reorder: reversed LocKeys first, then PriKeys\n const reorderedKeys = [...reversedLocKeys, ...priKeys];\n logger.default('Reordered keys for contained item', {\n original: keys,\n locKeys,\n reversedLocKeys,\n reordered: reorderedKeys,\n priKeys\n });\n \n let path: string = addPath('', reorderedKeys, 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 return path;\n } else {\n // For primary items or single keys\n // If it's a LocKey array, we still need to reverse it for path building\n const priKeys = keys.filter(k => isPriKey(k));\n const locKeys = keys.filter(k => !isPriKey(k));\n \n // Reverse locKeys if present (child->parent to parent->child)\n const reversedLocKeys = locKeys.length > 0 ? [...locKeys].reverse() : [];\n const orderedKeys = [...reversedLocKeys, ...priKeys];\n \n let path: string = addPath('', orderedKeys, 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 return path;\n }\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 const currentKey = keys[0];\n const keyType = isPriKey(currentKey) ? currentKey.kt : currentKey.kt;\n \n // Find the best matching pathName for this key type\n const matchingPathNameIndex = localPathNames.findIndex(pathName => {\n const singularPathName = pathName.endsWith('s') ? pathName.slice(0, -1) : pathName;\n const pluralKeyType = keyType + 's';\n \n // Try various matching strategies\n return pathName === pluralKeyType || // photos === photo+s\n pathName === keyType + 'es' || // matches === match+es\n singularPathName === keyType || // photo === photo\n pathName.toLowerCase() === keyType.toLowerCase() || // case insensitive\n pathName.toLowerCase() === pluralKeyType.toLowerCase(); // case insensitive plural\n });\n \n if (matchingPathNameIndex !== -1) {\n // Found a matching pathName\n const pathName = localPathNames.splice(matchingPathNameIndex, 1)[0];\n const key = keys.shift()!;\n const id = isPriKey(key) ? (key as PriKey<S>).pk : (key as LocKey<L1 | L2 | L3 | L4 | L5>).lk;\n const nextBase = `${base}/${pathName}/${id}`;\n logger.default('Adding Path (matched)', {\n pathName,\n keyType,\n isPriKey: isPriKey(key),\n key,\n nextBase\n });\n return addPath(nextBase, keys, localPathNames);\n } else {\n // No match found, use first available pathName\n const pathName = localPathNames.shift()!;\n const key = keys.shift()!;\n const id = isPriKey(key) ? (key as PriKey<S>).pk : (key as LocKey<L1 | L2 | L3 | L4 | L5>).lk;\n const nextBase = `${base}/${pathName}/${id}`;\n logger.default('Adding Path (no match, using first)', {\n pathName,\n keyType,\n isPriKey: isPriKey(key),\n key,\n nextBase\n });\n return addPath(nextBase, keys, localPathNames);\n }\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 } 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): Record<string, string> => {\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 upsert: operations.upsert,\n }\n}", "\nimport {\n Item,\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\n/**\n * CItemApi extends ClientApi for contained items.\n * No additional methods needed - pure Operations interface.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface CItemApi<\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 ClientApi<V, S, L1, L2, L3, L4, L5> {\n // Inherits all methods from ClientApi (which extends core Operations)\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 upsert: aItemAPI.upsert,\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\n// PItemApi now directly extends ClientApi without re-declaring methods\n// This ensures compatibility with core Operations interface\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface PItemApi<\n V extends Item<S>,\n S extends string\n> extends ClientApi<V, S> {\n // Inherits all methods from ClientApi\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 // Simplified wrapper functions that adapt to primary-only API (no locations)\n const action = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n action: string,\n params?: any,\n ) => await aItemAPI.action(ik, action, params);\n\n const all = async (query?: ItemQuery) =>\n await aItemAPI.all(query || {}, []);\n\n const allAction = async (action: string, params?: any) =>\n await aItemAPI.allAction(action, params, []);\n\n const allFacet = async (facet: string, params?: any) =>\n await aItemAPI.allFacet(facet, params);\n\n const one = async (query?: ItemQuery) =>\n await aItemAPI.one(query || {}, []);\n\n const get = async (ik: PriKey<S> | ComKey<S, never, never, never, never, never>) =>\n await aItemAPI.get(ik);\n\n const create = async (item: Partial<Item<S>>, options?: any) =>\n await aItemAPI.create(item, options);\n\n const remove = async (ik: PriKey<S> | ComKey<S, never, never, never, never, never>) =>\n await aItemAPI.remove(ik);\n\n const update = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: Partial<Item<S>>,\n ) => await aItemAPI.update(ik, item);\n\n const upsert = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: Partial<Item<S>>,\n locations?: any\n ) => await aItemAPI.upsert(ik, item, locations);\n\n const facet = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n facet: string,\n params?: any,\n ) => await aItemAPI.facet(ik, facet, params);\n\n const find = async (finder: string, finderParams?: any) =>\n await aItemAPI.find(finder, finderParams);\n\n const findOne = async (finder: string, finderParams?: any) =>\n await aItemAPI.findOne(finder, finderParams);\n\n return {\n action,\n all,\n allAction,\n allFacet,\n one,\n get,\n create,\n remove,\n update,\n upsert,\n facet,\n find,\n findOne,\n } as PItemApi<V, S>;\n\n};\n", "\nimport LibLogger from \"./logger\";\nimport { Item } from \"@fjell/core\";\nimport { Instance as BaseInstance, createInstance as createBaseInstance, Registry } from \"@fjell/registry\";\nimport { ClientApi } from \"./ClientApi\";\nimport { Coordinate } from \"@fjell/core\";\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/core\";\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", "export type { CItemApi } from \"./CItemAPI\";\nexport type { PItemApi } from \"./PItemAPI\";\nexport type { ClientApi } from \"./ClientApi\";\nexport type { ClientApiOptions } from \"./ClientApiOptions\";\n\nexport { createCItemApi } from \"./CItemAPI\";\nexport { createPItemApi } from \"./PItemAPI\";\n\n// Registry components\nexport * from './Instance';\nexport * from './InstanceFactory';\nexport * from './Registry';\n\n// Error handling\nexport * from './errors/index';\nexport * from './ops/errorHandling';\n\n// Re-export FjellHttpError from http-api for convenience\nexport { FjellHttpError, isFjellHttpError, extractErrorInfo, type ErrorInfo } from '@fjell/http-api';\n\n// HTTP wrapper\nexport * from './http/HttpWrapper';\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,EAKE;AAAA,OACK;;;ACNP,OAAO,aAAa;AAEpB,IAAM,YAAY,QAAQ,UAAU,mBAAmB;AAEvD,IAAO,iBAAQ;;;ADSf,IAAM,SAAS,eAAU,IA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
"names": ["logger", "action", "logger", "queryToParams", "logger", "queryToParams", "logger", "logger", "logger", "logger", "logger", "totalDuration", "logger", "logger", "logger", "logger", "facet", "logger", "logger", "logger", "logger", "logger", "action", "facet", "options", "logger", "logger", "logger", "isFjellHttpError", "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.
|
|
4
|
+
"version": "4.4.54",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"client",
|
|
7
7
|
"api",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"docs:test": "cd docs && npm run test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@fjell/core": "^4.4.
|
|
42
|
-
"@fjell/http-api": "^4.4.
|
|
43
|
-
"@fjell/logging": "^4.4.
|
|
44
|
-
"@fjell/registry": "^4.4.
|
|
41
|
+
"@fjell/core": "^4.4.61",
|
|
42
|
+
"@fjell/http-api": "^4.4.51",
|
|
43
|
+
"@fjell/logging": "^4.4.58",
|
|
44
|
+
"@fjell/registry": "^4.4.66",
|
|
45
45
|
"deepmerge": "^4.3.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|