@fjell/client-api 4.4.2 → 4.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AItemAPI.js +6 -1
- package/dist/AItemAPI.js.map +1 -1
- package/dist/CItemAPI.d.ts +12 -11
- package/dist/CItemAPI.js +1 -0
- package/dist/CItemAPI.js.map +1 -1
- package/dist/ClientApi.d.ts +12 -12
- package/dist/ClientApiOptions.d.ts +5 -0
- package/dist/PItemAPI.d.ts +13 -12
- package/dist/PItemAPI.js +13 -11
- package/dist/PItemAPI.js.map +1 -1
- package/dist/index.cjs +132 -91
- package/dist/index.cjs.map +1 -1
- package/dist/ops/action.d.ts +2 -2
- package/dist/ops/action.js +6 -5
- package/dist/ops/action.js.map +1 -1
- package/dist/ops/all.d.ts +2 -2
- package/dist/ops/all.js +7 -6
- package/dist/ops/all.js.map +1 -1
- package/dist/ops/allAction.d.ts +2 -2
- package/dist/ops/allAction.js +6 -5
- package/dist/ops/allAction.js.map +1 -1
- package/dist/ops/allFacet.d.ts +5 -0
- package/dist/ops/allFacet.js +24 -0
- package/dist/ops/allFacet.js.map +1 -0
- package/dist/ops/create.d.ts +2 -2
- package/dist/ops/create.js +6 -5
- package/dist/ops/create.js.map +1 -1
- package/dist/ops/facet.d.ts +2 -2
- package/dist/ops/facet.js +7 -5
- package/dist/ops/facet.js.map +1 -1
- package/dist/ops/find.d.ts +2 -2
- package/dist/ops/find.js +10 -9
- package/dist/ops/find.js.map +1 -1
- package/dist/ops/findOne.d.ts +2 -2
- package/dist/ops/findOne.js +8 -7
- package/dist/ops/findOne.js.map +1 -1
- package/dist/ops/get.d.ts +2 -2
- package/dist/ops/get.js +6 -5
- package/dist/ops/get.js.map +1 -1
- package/dist/ops/index.js +2 -0
- package/dist/ops/index.js.map +1 -1
- package/dist/ops/one.d.ts +2 -2
- package/dist/ops/one.js +7 -6
- package/dist/ops/one.js.map +1 -1
- package/dist/ops/remove.d.ts +2 -2
- package/dist/ops/remove.js +6 -5
- package/dist/ops/remove.js.map +1 -1
- package/dist/ops/update.d.ts +2 -2
- package/dist/ops/update.js +6 -5
- package/dist/ops/update.js.map +1 -1
- package/dist/util/general.d.ts +4 -0
- package/package.json +6 -6
- package/src/AItemAPI.ts +5 -0
- package/src/CItemAPI.ts +12 -19
- package/src/ClientApi.ts +59 -65
- package/src/ClientApiOptions.ts +5 -0
- package/src/PItemAPI.ts +34 -51
- package/src/ops/action.ts +19 -23
- package/src/ops/all.ts +17 -19
- package/src/ops/allAction.ts +18 -21
- package/src/ops/allFacet.ts +46 -0
- package/src/ops/create.ts +21 -23
- package/src/ops/facet.ts +4 -5
- package/src/ops/find.ts +20 -23
- package/src/ops/findOne.ts +4 -5
- package/src/ops/get.ts +17 -20
- package/src/ops/index.ts +6 -0
- package/src/ops/one.ts +3 -5
- package/src/ops/remove.ts +17 -20
- package/src/ops/update.ts +17 -19
- package/src/util/general.ts +65 -0
package/dist/ops/facet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet.js","sources":["../../src/ops/facet.ts"],"sourcesContent":["import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"facet.js","sources":["../../src/ops/facet.ts"],"sourcesContent":["import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"@/ClientApiOptions\";\nimport LibLogger from \"@/logger\";\nimport { Utilities } from \"@/Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'facet');\n\nexport const getFacetOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n /**\n * Executes a facet operation on an item.\n *\n * A facet is a piece of information that is related to an item - it represents\n * a specific aspect or characteristic of the item. Unlike actions which may\n * return items or perform operations, facets are informational queries that\n * return data about a particular facet of an item.\n *\n * @param ik - The item key (composite or primary key) identifying the item\n * @param facet - The name of the facet to query\n * @param body - Optional request body for the facet operation\n * @param options - Optional HTTP request options\n * @returns Promise resolving to the facet data\n */\n const facet = async (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<any> => {\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.writeAuthenticated, params });\n logger.default('facet', { ik, facet, requestOptions });\n\n return api.httpGet<any>(\n `${utilities.getPath(ik)}/${facet}`,\n requestOptions,\n );\n\n };\n\n return facet;\n}\n"],"names":["logger","LibLogger","get","getFacetOperation","api","apiOptions","utilities","facet","ik","params","requestOptions","Object","assign","getOptions","isAuthenticated","writeAuthenticated","default","httpGet","getPath"],"mappings":";;AAWA,MAAMA,MAASC,GAAAA,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAO,EAAA,OAAA,CAAA;AAErCC,MAAAA,iBAAAA,GAAoB,CAQ7BC,GAAAA,EACAC,UACAC,EAAAA,SAAAA,GAAAA;AAIF;;;;;;;;;;;;;AAaC,MACD,MAAMC,KAAQ,GAAA,OACZC,IACAD,KACAE,EAAAA,MAAAA,GAAqG,EAAE,GAAA;QAEvG,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAIP,EAAAA,UAAAA,CAAWQ,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBT,WAAWU,kBAAkB;AAAEN,YAAAA;AAAO,SAAA,CAAA;QACzHT,MAAOgB,CAAAA,OAAO,CAAC,OAAS,EAAA;AAAER,YAAAA,EAAAA;AAAID,YAAAA,KAAAA;AAAOG,YAAAA;AAAe,SAAA,CAAA;QAEpD,OAAON,GAAAA,CAAIa,OAAO,CAChB,CAAGX,EAAAA,SAAAA,CAAUY,OAAO,CAACV,EAAI,CAAA,CAAA,CAAC,EAAED,KAAAA,CAAAA,CAAO,EACnCG,cAAAA,CAAAA;AAGJ,KAAA;IAEA,OAAOH,KAAAA;AACT;;;;"}
|
package/dist/ops/find.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Item, LocKeyArray } from '@fjell/core';
|
|
2
|
-
import {
|
|
2
|
+
import { HttpApi } from '@fjell/http-api';
|
|
3
3
|
import { ClientApiOptions } from '../ClientApiOptions';
|
|
4
4
|
import { Utilities } from '../Utilities';
|
|
5
|
-
export declare const getFindOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (finder: string, finderParams
|
|
5
|
+
export declare const getFindOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (finder: string, finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
|
package/dist/ops/find.js
CHANGED
|
@@ -3,18 +3,19 @@ import LibLogger from '../logger.js';
|
|
|
3
3
|
|
|
4
4
|
const logger = LibLogger.get('client-api', 'ops', 'find');
|
|
5
5
|
const getFindOperation = (api, apiOptions, utilities)=>{
|
|
6
|
-
const find = async (finder, finderParams
|
|
7
|
-
logger.default('find', {
|
|
8
|
-
finder,
|
|
9
|
-
finderParams,
|
|
10
|
-
locations
|
|
11
|
-
});
|
|
6
|
+
const find = async (finder, finderParams = {}, locations = [])=>{
|
|
12
7
|
utilities.verifyLocations(locations);
|
|
13
8
|
const loc = locations;
|
|
14
|
-
const
|
|
15
|
-
const requestOptions = Object.assign({},
|
|
9
|
+
const mergedParams = finderToParams(finder, finderParams);
|
|
10
|
+
const requestOptions = Object.assign({}, apiOptions.getOptions, {
|
|
16
11
|
isAuthenticated: apiOptions.allAuthenticated,
|
|
17
|
-
params
|
|
12
|
+
params: mergedParams
|
|
13
|
+
});
|
|
14
|
+
logger.default('find', {
|
|
15
|
+
finder,
|
|
16
|
+
finderParams,
|
|
17
|
+
locations,
|
|
18
|
+
requestOptions
|
|
18
19
|
});
|
|
19
20
|
return utilities.validatePK(await utilities.processArray(api.httpGet(utilities.getPath(loc), requestOptions)));
|
|
20
21
|
};
|
package/dist/ops/find.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.js","sources":["../../src/ops/find.ts"],"sourcesContent":["import {\n Item,\n LocKeyArray,\n QueryParams\n} from \"@fjell/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"find.js","sources":["../../src/ops/find.ts"],"sourcesContent":["import {\n Item,\n LocKeyArray,\n QueryParams\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { finderToParams } from \"@/AItemAPI\";\nimport { ClientApiOptions } from \"@/ClientApiOptions\";\nimport LibLogger from \"@/logger\";\nimport { Utilities } from \"@/Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'find');\n\nexport const getFindOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const find = async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n utilities.verifyLocations(locations);\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const mergedParams: QueryParams = finderToParams(finder, finderParams);\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params: mergedParams });\n logger.default('find', { finder, finderParams, locations, requestOptions });\n\n return utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[];\n }\n\n return find;\n}\n"],"names":["logger","LibLogger","get","getFindOperation","api","apiOptions","utilities","find","finder","finderParams","locations","verifyLocations","loc","mergedParams","finderToParams","requestOptions","Object","assign","getOptions","isAuthenticated","allAuthenticated","params","default","validatePK","processArray","httpGet","getPath"],"mappings":";;;AAYA,MAAMA,MAASC,GAAAA,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAO,EAAA,MAAA,CAAA;AAErCC,MAAAA,gBAAAA,GAAmB,CAQ5BC,GAAAA,EACAC,UACAC,EAAAA,SAAAA,GAAAA;IAIF,MAAMC,IAAAA,GAAO,OACXC,MACAC,EAAAA,YAAAA,GAA2G,EAAE,EAC7GC,YAAkD,EAAE,GAAA;AAEpDJ,QAAAA,SAAAA,CAAUK,eAAe,CAACD,SAAAA,CAAAA;AAC1B,QAAA,MAAME,GAA4CF,GAAAA,SAAAA;QAElD,MAAMG,YAAAA,GAA4BC,eAAeN,MAAQC,EAAAA,YAAAA,CAAAA;QACzD,MAAMM,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAIZ,EAAAA,UAAAA,CAAWa,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBd,WAAWe,gBAAgB;YAAEC,MAAQR,EAAAA;AAAa,SAAA,CAAA;QACrIb,MAAOsB,CAAAA,OAAO,CAAC,MAAQ,EAAA;AAAEd,YAAAA,MAAAA;AAAQC,YAAAA,YAAAA;AAAcC,YAAAA,SAAAA;AAAWK,YAAAA;AAAe,SAAA,CAAA;AAEzE,QAAA,OAAOT,SAAUiB,CAAAA,UAAU,CAAC,MAAMjB,SAAUkB,CAAAA,YAAY,CACtDpB,GAAAA,CAAIqB,OAAO,CACTnB,SAAUoB,CAAAA,OAAO,CAACd,GAClBG,CAAAA,EAAAA,cAAAA,CAAAA,CAAAA,CAAAA;AAEN,KAAA;IAEA,OAAOR,IAAAA;AACT;;;;"}
|
package/dist/ops/findOne.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Item, LocKeyArray } from '@fjell/core';
|
|
2
|
-
import {
|
|
2
|
+
import { HttpApi } from '@fjell/http-api';
|
|
3
3
|
import { ClientApiOptions } from '../ClientApiOptions';
|
|
4
4
|
import { Utilities } from '../Utilities';
|
|
5
|
-
export declare const getFindOneOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (finder: string, finderParams
|
|
5
|
+
export declare const getFindOneOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (finder: string, finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
|
package/dist/ops/findOne.js
CHANGED
|
@@ -3,20 +3,21 @@ import LibLogger from '../logger.js';
|
|
|
3
3
|
|
|
4
4
|
const logger = LibLogger.get('client-api', 'ops', 'find');
|
|
5
5
|
const getFindOneOperation = (api, apiOptions, utilities)=>{
|
|
6
|
-
const findOne = async (finder, finderParams
|
|
7
|
-
logger.default('findOne', {
|
|
8
|
-
finder,
|
|
9
|
-
finderParams,
|
|
10
|
-
locations
|
|
11
|
-
});
|
|
6
|
+
const findOne = async (finder, finderParams = {}, locations = [])=>{
|
|
12
7
|
utilities.verifyLocations(locations);
|
|
13
8
|
const loc = locations;
|
|
14
9
|
const params = finderToParams(finder, finderParams);
|
|
15
10
|
params.one = true;
|
|
16
|
-
const requestOptions = Object.assign({},
|
|
11
|
+
const requestOptions = Object.assign({}, apiOptions.getOptions, {
|
|
17
12
|
isAuthenticated: apiOptions.allAuthenticated,
|
|
18
13
|
params
|
|
19
14
|
});
|
|
15
|
+
logger.default('findOne', {
|
|
16
|
+
finder,
|
|
17
|
+
finderParams,
|
|
18
|
+
locations,
|
|
19
|
+
requestOptions
|
|
20
|
+
});
|
|
20
21
|
return utilities.validatePK(await utilities.processArray(api.httpGet(utilities.getPath(loc), requestOptions)))[0];
|
|
21
22
|
};
|
|
22
23
|
return findOne;
|
package/dist/ops/findOne.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findOne.js","sources":["../../src/ops/findOne.ts"],"sourcesContent":["import {\n Item,\n LocKeyArray,\n QueryParams\n} from \"@fjell/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"findOne.js","sources":["../../src/ops/findOne.ts"],"sourcesContent":["import {\n Item,\n LocKeyArray,\n QueryParams\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { finderToParams } from \"@/AItemAPI\";\nimport { ClientApiOptions } from \"@/ClientApiOptions\";\nimport LibLogger from \"@/logger\";\nimport { Utilities } from \"@/Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'find');\n\nexport const getFindOneOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const findOne = async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V> => {\n utilities.verifyLocations(locations);\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const params: QueryParams = finderToParams(finder, finderParams);\n params.one = true;\n\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.allAuthenticated, params });\n logger.default('findOne', { finder, finderParams, locations, requestOptions });\n\n return (utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[])[0];\n }\n\n return findOne;\n}\n"],"names":["logger","LibLogger","get","getFindOneOperation","api","apiOptions","utilities","findOne","finder","finderParams","locations","verifyLocations","loc","params","finderToParams","one","requestOptions","Object","assign","getOptions","isAuthenticated","allAuthenticated","default","validatePK","processArray","httpGet","getPath"],"mappings":";;;AAYA,MAAMA,MAASC,GAAAA,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAO,EAAA,MAAA,CAAA;AAErCC,MAAAA,mBAAAA,GAAsB,CAQ/BC,GAAAA,EACAC,UACAC,EAAAA,SAAAA,GAAAA;IAIF,MAAMC,OAAAA,GAAU,OACdC,MACAC,EAAAA,YAAAA,GAA2G,EAAE,EAC7GC,YAAkD,EAAE,GAAA;AAEpDJ,QAAAA,SAAAA,CAAUK,eAAe,CAACD,SAAAA,CAAAA;AAC1B,QAAA,MAAME,GAA4CF,GAAAA,SAAAA;QAElD,MAAMG,MAAAA,GAAsBC,eAAeN,MAAQC,EAAAA,YAAAA,CAAAA;AACnDI,QAAAA,MAAAA,CAAOE,GAAG,GAAG,IAAA;QAEb,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAIb,EAAAA,UAAAA,CAAWc,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBf,WAAWgB,gBAAgB;AAAER,YAAAA;AAAO,SAAA,CAAA;QACvHb,MAAOsB,CAAAA,OAAO,CAAC,SAAW,EAAA;AAAEd,YAAAA,MAAAA;AAAQC,YAAAA,YAAAA;AAAcC,YAAAA,SAAAA;AAAWM,YAAAA;AAAe,SAAA,CAAA;AAE5E,QAAA,OAAO,SAAWO,CAAAA,UAAU,CAAC,MAAMjB,UAAUkB,YAAY,CACvDpB,GAAIqB,CAAAA,OAAO,CACTnB,SAAUoB,CAAAA,OAAO,CAACd,GAClBI,CAAAA,EAAAA,cAAAA,CAAAA,CAAAA,CACS,CAAC,CAAE,CAAA;AAClB,KAAA;IAEA,OAAOT,OAAAA;AACT;;;;"}
|
package/dist/ops/get.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComKey, Item, PriKey } from '@fjell/core';
|
|
2
|
-
import {
|
|
2
|
+
import { HttpApi } from '@fjell/http-api';
|
|
3
3
|
import { ClientApiOptions } from '../ClientApiOptions';
|
|
4
4
|
import { Utilities } from '../Utilities';
|
|
5
|
-
export declare const getGetOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (ik: PriKey<S> | ComKey<S, never, never, never, never, never
|
|
5
|
+
export declare const getGetOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (ik: PriKey<S> | ComKey<S, never, never, never, never, never>) => Promise<V | null>;
|
package/dist/ops/get.js
CHANGED
|
@@ -2,13 +2,14 @@ import LibLogger from '../logger.js';
|
|
|
2
2
|
|
|
3
3
|
const logger = LibLogger.get('client-api', 'ops', 'get');
|
|
4
4
|
const getGetOperation = (api, apiOptions, utilities)=>{
|
|
5
|
-
const get = async (ik
|
|
6
|
-
|
|
7
|
-
ik
|
|
8
|
-
});
|
|
9
|
-
const requestOptions = Object.assign({}, options, {
|
|
5
|
+
const get = async (ik)=>{
|
|
6
|
+
const requestOptions = Object.assign({}, apiOptions.getOptions, {
|
|
10
7
|
isAuthenticated: apiOptions.readAuthenticated
|
|
11
8
|
});
|
|
9
|
+
logger.default('get', {
|
|
10
|
+
ik,
|
|
11
|
+
requestOptions
|
|
12
|
+
});
|
|
12
13
|
return utilities.validatePK(await utilities.processOne(api.httpGet(utilities.getPath(ik), requestOptions)));
|
|
13
14
|
};
|
|
14
15
|
return get;
|
package/dist/ops/get.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sources":["../../src/ops/get.ts"],"sourcesContent":["import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"get.js","sources":["../../src/ops/get.ts"],"sourcesContent":["import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"@/ClientApiOptions\";\nimport LibLogger from \"@/logger\";\nimport { Utilities } from \"@/Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'get');\n\nexport const getGetOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const get = async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ): Promise<V | null> => {\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.readAuthenticated });\n logger.default('get', { ik, requestOptions });\n\n return utilities.validatePK(await utilities.processOne(\n api.httpGet<V>(\n utilities.getPath(ik),\n requestOptions,\n ))) as V;\n }\n\n return get;\n}\n"],"names":["logger","LibLogger","get","getGetOperation","api","apiOptions","utilities","ik","requestOptions","Object","assign","getOptions","isAuthenticated","readAuthenticated","default","validatePK","processOne","httpGet","getPath"],"mappings":";;AAWA,MAAMA,MAASC,GAAAA,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAO,EAAA,KAAA,CAAA;AAErCC,MAAAA,eAAAA,GAAkB,CAQ3BC,GAAAA,EACAC,UACAC,EAAAA,SAAAA,GAAAA;AAIF,IAAA,MAAMJ,MAAM,OACVK,EAAAA,GAAAA;QAEA,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAIL,EAAAA,UAAAA,CAAWM,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBP,WAAWQ;AAAkB,SAAA,CAAA;QAChHb,MAAOc,CAAAA,OAAO,CAAC,KAAO,EAAA;AAAEP,YAAAA,EAAAA;AAAIC,YAAAA;AAAe,SAAA,CAAA;AAE3C,QAAA,OAAOF,SAAUS,CAAAA,UAAU,CAAC,MAAMT,SAAUU,CAAAA,UAAU,CACpDZ,GAAAA,CAAIa,OAAO,CACTX,SAAUY,CAAAA,OAAO,CAACX,EAClBC,CAAAA,EAAAA,cAAAA,CAAAA,CAAAA,CAAAA;AAEN,KAAA;IAEA,OAAON,GAAAA;AACT;;;;"}
|
package/dist/ops/index.js
CHANGED
|
@@ -9,12 +9,14 @@ import { getRemoveOperation } from './remove.js';
|
|
|
9
9
|
import { getFindOperation } from './find.js';
|
|
10
10
|
import { getFindOneOperation } from './findOne.js';
|
|
11
11
|
import { getFacetOperation } from './facet.js';
|
|
12
|
+
import { getAllFacetOperation } from './allFacet.js';
|
|
12
13
|
|
|
13
14
|
const getOperations = (api, apiOptions, utilities)=>{
|
|
14
15
|
return {
|
|
15
16
|
action: getActionOperation(api, apiOptions, utilities),
|
|
16
17
|
all: getAllOperation(api, apiOptions, utilities),
|
|
17
18
|
allAction: getAllActionOperation(api, apiOptions, utilities),
|
|
19
|
+
allFacet: getAllFacetOperation(api, apiOptions, utilities),
|
|
18
20
|
create: getCreateOperation(api, apiOptions, utilities),
|
|
19
21
|
facet: getFacetOperation(api, apiOptions, utilities),
|
|
20
22
|
findOne: getFindOneOperation(api, apiOptions, utilities),
|
package/dist/ops/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/ops/index.ts"],"sourcesContent":["/* eslint-disable indent */\nimport { Item } from \"@fjell/core\"\nimport { getAllOperation } from \"./all\"\nimport { getActionOperation } from \"./action\"\nimport { Utilities } from \"@/Utilities\"\nimport { HttpApi } from \"@fjell/http-api\"\nimport { getAllActionOperation } from \"./allAction\"\nimport { getOneOperation } from \"./one\"\nimport { getCreateOperation } from \"./create\"\nimport { getUpdateOperation } from \"./update\"\nimport { getGetOperation } from \"./get\"\nimport { getRemoveOperation } from \"./remove\"\nimport { getFindOperation } from \"./find\"\nimport { ClientApiOptions } from \"@/ClientApiOptions\"\nimport { ClientApi } from \"@/ClientApi\"\nimport { getFindOneOperation } from \"./findOne\"\nimport { getFacetOperation } from \"./facet\"\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 create: getCreateOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n facet: getFacetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n findOne: getFindOneOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n find: getFindOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n get: getGetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n one: getOneOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n remove: getRemoveOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n update: getUpdateOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n }\n }"],"names":["getOperations","api","apiOptions","utilities","action","getActionOperation","all","getAllOperation","allAction","getAllActionOperation","create","getCreateOperation","facet","getFacetOperation","findOne","getFindOneOperation","find","getFindOperation","get","getGetOperation","one","getOneOperation","remove","getRemoveOperation","update","getUpdateOperation"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/ops/index.ts"],"sourcesContent":["/* eslint-disable indent */\nimport { Item } from \"@fjell/core\"\nimport { getAllOperation } from \"./all\"\nimport { getActionOperation } from \"./action\"\nimport { Utilities } from \"@/Utilities\"\nimport { HttpApi } from \"@fjell/http-api\"\nimport { getAllActionOperation } from \"./allAction\"\nimport { getOneOperation } from \"./one\"\nimport { getCreateOperation } from \"./create\"\nimport { getUpdateOperation } from \"./update\"\nimport { getGetOperation } from \"./get\"\nimport { getRemoveOperation } from \"./remove\"\nimport { getFindOperation } from \"./find\"\nimport { ClientApiOptions } from \"@/ClientApiOptions\"\nimport { ClientApi } from \"@/ClientApi\"\nimport { getFindOneOperation } from \"./findOne\"\nimport { getFacetOperation } from \"./facet\"\nimport { getAllFacetOperation } from \"./allFacet\"\n\nexport const getOperations =\n <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>,\n\n ): ClientApi<V, S, L1, L2, L3, L4, L5> => {\n return {\n action: getActionOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n all: getAllOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n allAction: getAllActionOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n allFacet: getAllFacetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n create: getCreateOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n facet: getFacetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n findOne: getFindOneOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n find: getFindOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n get: getGetOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n one: getOneOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n remove: getRemoveOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n update: getUpdateOperation<V, S, L1, L2, L3, L4, L5>(\n api,\n apiOptions,\n utilities,\n ),\n }\n }"],"names":["getOperations","api","apiOptions","utilities","action","getActionOperation","all","getAllOperation","allAction","getAllActionOperation","allFacet","getAllFacetOperation","create","getCreateOperation","facet","getFacetOperation","findOne","getFindOneOperation","find","getFindOperation","get","getGetOperation","one","getOneOperation","remove","getRemoveOperation","update","getUpdateOperation"],"mappings":";;;;;;;;;;;;;AAmBaA,MAAAA,aAAAA,GACX,CAQIC,GAAAA,EACAC,UACAC,EAAAA,SAAAA,GAAAA;IAGF,OAAO;QACLC,MAAQC,EAAAA,kBAAAA,CACNJ,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFG,GAAKC,EAAAA,eAAAA,CACHN,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFK,SAAWC,EAAAA,qBAAAA,CACTR,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFO,QAAUC,EAAAA,oBAAAA,CACRV,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFS,MAAQC,EAAAA,kBAAAA,CACNZ,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFW,KAAOC,EAAAA,iBAAAA,CACLd,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFa,OAASC,EAAAA,mBAAAA,CACPhB,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFe,IAAMC,EAAAA,gBAAAA,CACJlB,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFiB,GAAKC,EAAAA,eAAAA,CACHpB,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFmB,GAAKC,EAAAA,eAAAA,CACHtB,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFqB,MAAQC,EAAAA,kBAAAA,CACNxB,KACAC,UACAC,EAAAA,SAAAA,CAAAA;QAEFuB,MAAQC,EAAAA,kBAAAA,CACN1B,KACAC,UACAC,EAAAA,SAAAA;AAEJ,KAAA;AACF;;;;"}
|
package/dist/ops/one.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Item, ItemQuery, LocKeyArray } from '@fjell/core';
|
|
2
|
-
import {
|
|
2
|
+
import { HttpApi } from '@fjell/http-api';
|
|
3
3
|
import { ClientApiOptions } from '../ClientApiOptions';
|
|
4
4
|
import { Utilities } from '../Utilities';
|
|
5
|
-
export declare const getOneOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (query: ItemQuery,
|
|
5
|
+
export declare const getOneOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (query: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V | null>;
|
package/dist/ops/one.js
CHANGED
|
@@ -3,18 +3,19 @@ import LibLogger from '../logger.js';
|
|
|
3
3
|
|
|
4
4
|
const logger = LibLogger.get('client-api', 'ops', 'one');
|
|
5
5
|
const getOneOperation = (api, apiOptions, utilities)=>{
|
|
6
|
-
const one = async (query = {},
|
|
7
|
-
logger.default('one', {
|
|
8
|
-
query,
|
|
9
|
-
locations
|
|
10
|
-
});
|
|
6
|
+
const one = async (query = {}, locations = [])=>{
|
|
11
7
|
utilities.verifyLocations(locations);
|
|
12
8
|
const loc = locations;
|
|
13
9
|
const params = queryToParams(query);
|
|
14
|
-
const requestOptions = Object.assign({},
|
|
10
|
+
const requestOptions = Object.assign({}, apiOptions.getOptions, {
|
|
15
11
|
isAuthenticated: apiOptions.readAuthenticated,
|
|
16
12
|
params
|
|
17
13
|
});
|
|
14
|
+
logger.default('one', {
|
|
15
|
+
query,
|
|
16
|
+
locations,
|
|
17
|
+
requestOptions
|
|
18
|
+
});
|
|
18
19
|
let item = null;
|
|
19
20
|
const items = utilities.validatePK(await utilities.processArray(api.httpGet(utilities.getPath(loc), requestOptions)));
|
|
20
21
|
if (items.length > 0) {
|
package/dist/ops/one.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"one.js","sources":["../../src/ops/one.ts"],"sourcesContent":["import {\n Item,\n ItemQuery,\n LocKeyArray,\n QueryParams,\n queryToParams\n} from \"@fjell/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"one.js","sources":["../../src/ops/one.ts"],"sourcesContent":["import {\n Item,\n ItemQuery,\n LocKeyArray,\n QueryParams,\n queryToParams\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"@/ClientApiOptions\";\nimport LibLogger from \"@/logger\";\nimport { Utilities } from \"@/Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'one');\n\nexport const getOneOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ): (\n query: ItemQuery,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V | null> => {\n\n const one = async (\n query: ItemQuery = {} as ItemQuery,\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V | null> => {\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const params: QueryParams = queryToParams(query);\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.readAuthenticated, params });\n logger.default('one', { query, locations, requestOptions });\n\n let item: V | null = null;\n\n const items = utilities.validatePK(await utilities.processArray(\n api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n ))) as V[];\n\n if (items.length > 0) {\n item = items[0];\n }\n\n return item as V;\n }\n\n return one;\n}\n"],"names":["logger","LibLogger","get","getOneOperation","api","apiOptions","utilities","one","query","locations","verifyLocations","loc","params","queryToParams","requestOptions","Object","assign","getOptions","isAuthenticated","readAuthenticated","default","item","items","validatePK","processArray","httpGet","getPath","length"],"mappings":";;;AAaA,MAAMA,MAASC,GAAAA,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAO,EAAA,KAAA,CAAA;AAErCC,MAAAA,eAAAA,GAAkB,CAQ3BC,GAAAA,EACAC,UACAC,EAAAA,SAAAA,GAAAA;AAOF,IAAA,MAAMC,MAAM,OACVC,KAAAA,GAAmB,EAAe,EAClCC,YAAkD,EAAE,GAAA;AAEpDH,QAAAA,SAAAA,CAAUI,eAAe,CAACD,SAAAA,CAAAA;AAE1B,QAAA,MAAME,GAA4CF,GAAAA,SAAAA;AAElD,QAAA,MAAMG,SAAsBC,aAAcL,CAAAA,KAAAA,CAAAA;QAC1C,MAAMM,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAIX,EAAAA,UAAAA,CAAWY,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBb,WAAWc,iBAAiB;AAAEP,YAAAA;AAAO,SAAA,CAAA;QACxHZ,MAAOoB,CAAAA,OAAO,CAAC,KAAO,EAAA;AAAEZ,YAAAA,KAAAA;AAAOC,YAAAA,SAAAA;AAAWK,YAAAA;AAAe,SAAA,CAAA;AAEzD,QAAA,IAAIO,IAAiB,GAAA,IAAA;AAErB,QAAA,MAAMC,KAAQhB,GAAAA,SAAAA,CAAUiB,UAAU,CAAC,MAAMjB,SAAUkB,CAAAA,YAAY,CAC7DpB,GAAAA,CAAIqB,OAAO,CACTnB,SAAUoB,CAAAA,OAAO,CAACf,GAClBG,CAAAA,EAAAA,cAAAA,CAAAA,CAAAA,CAAAA;QAGJ,IAAIQ,KAAAA,CAAMK,MAAM,GAAG,CAAG,EAAA;YACpBN,IAAOC,GAAAA,KAAK,CAAC,CAAE,CAAA;AACjB;QAEA,OAAOD,IAAAA;AACT,KAAA;IAEA,OAAOd,GAAAA;AACT;;;;"}
|
package/dist/ops/remove.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComKey, Item, PriKey } from '@fjell/core';
|
|
2
|
-
import {
|
|
2
|
+
import { HttpApi } from '@fjell/http-api';
|
|
3
3
|
import { ClientApiOptions } from '../ClientApiOptions';
|
|
4
4
|
import { Utilities } from '../Utilities';
|
|
5
|
-
export declare const getRemoveOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5
|
|
5
|
+
export declare const getRemoveOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>) => Promise<boolean>;
|
package/dist/ops/remove.js
CHANGED
|
@@ -2,13 +2,14 @@ import LibLogger from '../logger.js';
|
|
|
2
2
|
|
|
3
3
|
const logger = LibLogger.get('client-api', 'ops', 'remove');
|
|
4
4
|
const getRemoveOperation = (api, apiOptions, utilities)=>{
|
|
5
|
-
const remove = async (ik
|
|
6
|
-
|
|
7
|
-
ik
|
|
8
|
-
});
|
|
9
|
-
const requestOptions = Object.assign({}, options, {
|
|
5
|
+
const remove = async (ik)=>{
|
|
6
|
+
const requestOptions = Object.assign({}, apiOptions.deleteOptions, {
|
|
10
7
|
isAuthenticated: apiOptions.writeAuthenticated
|
|
11
8
|
});
|
|
9
|
+
logger.default('remove', {
|
|
10
|
+
ik,
|
|
11
|
+
requestOptions
|
|
12
|
+
});
|
|
12
13
|
return api.httpDelete(utilities.getPath(ik), requestOptions);
|
|
13
14
|
};
|
|
14
15
|
return remove;
|
package/dist/ops/remove.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.js","sources":["../../src/ops/remove.ts"],"sourcesContent":["import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"remove.js","sources":["../../src/ops/remove.ts"],"sourcesContent":["import {\n ComKey,\n Item,\n PriKey,\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"@/ClientApiOptions\";\nimport LibLogger from \"@/logger\";\nimport { Utilities } from \"@/Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'remove');\n\nexport const getRemoveOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const remove = async (\n ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\n ): Promise<boolean> => {\n const requestOptions = Object.assign({}, apiOptions.deleteOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('remove', { ik, requestOptions });\n\n return api.httpDelete<boolean>(utilities.getPath(ik), requestOptions);\n }\n\n return remove;\n}\n"],"names":["logger","LibLogger","get","getRemoveOperation","api","apiOptions","utilities","remove","ik","requestOptions","Object","assign","deleteOptions","isAuthenticated","writeAuthenticated","default","httpDelete","getPath"],"mappings":";;AAWA,MAAMA,MAASC,GAAAA,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAO,EAAA,QAAA,CAAA;AAErCC,MAAAA,kBAAAA,GAAqB,CAQ9BC,GAAAA,EACAC,UACAC,EAAAA,SAAAA,GAAAA;AAIF,IAAA,MAAMC,SAAS,OACbC,EAAAA,GAAAA;QAEA,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAIN,EAAAA,UAAAA,CAAWO,aAAa,EAAE;AAAEC,YAAAA,eAAAA,EAAiBR,WAAWS;AAAmB,SAAA,CAAA;QACpHd,MAAOe,CAAAA,OAAO,CAAC,QAAU,EAAA;AAAEP,YAAAA,EAAAA;AAAIC,YAAAA;AAAe,SAAA,CAAA;AAE9C,QAAA,OAAOL,IAAIY,UAAU,CAAUV,SAAUW,CAAAA,OAAO,CAACT,EAAKC,CAAAA,EAAAA,cAAAA,CAAAA;AACxD,KAAA;IAEA,OAAOF,MAAAA;AACT;;;;"}
|
package/dist/ops/update.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComKey, Item, ItemProperties, PriKey } from '@fjell/core';
|
|
2
|
-
import { HttpApi
|
|
2
|
+
import { HttpApi } from '@fjell/http-api';
|
|
3
3
|
import { ClientApiOptions } from '../ClientApiOptions';
|
|
4
4
|
import { Utilities } from '../Utilities';
|
|
5
|
-
export declare const getUpdateOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>, item: ItemProperties<S, L1, L2, L3, L4, L5
|
|
5
|
+
export declare const getUpdateOperation: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, apiOptions: ClientApiOptions, utilities: Utilities<V, S, L1, L2, L3, L4, L5>) => (ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>, item: ItemProperties<S, L1, L2, L3, L4, L5>) => Promise<V>;
|
package/dist/ops/update.js
CHANGED
|
@@ -2,13 +2,14 @@ import LibLogger from '../logger.js';
|
|
|
2
2
|
|
|
3
3
|
const logger = LibLogger.get('client-api', 'ops', 'update');
|
|
4
4
|
const getUpdateOperation = (api, apiOptions, utilities)=>{
|
|
5
|
-
const update = async (ik, item
|
|
5
|
+
const update = async (ik, item)=>{
|
|
6
|
+
const requestOptions = Object.assign({}, apiOptions.putOptions, {
|
|
7
|
+
isAuthenticated: apiOptions.writeAuthenticated
|
|
8
|
+
});
|
|
6
9
|
logger.default('update', {
|
|
7
10
|
ik,
|
|
8
|
-
item
|
|
9
|
-
|
|
10
|
-
const requestOptions = Object.assign({}, options, {
|
|
11
|
-
isAuthenticated: apiOptions.writeAuthenticated
|
|
11
|
+
item,
|
|
12
|
+
requestOptions
|
|
12
13
|
});
|
|
13
14
|
return utilities.validatePK(await utilities.processOne(api.httpPut(utilities.getPath(ik), item, requestOptions)));
|
|
14
15
|
};
|
package/dist/ops/update.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sources":["../../src/ops/update.ts"],"sourcesContent":["import {\n ComKey,\n Item,\n ItemProperties,\n PriKey\n} from \"@fjell/core\";\nimport { HttpApi
|
|
1
|
+
{"version":3,"file":"update.js","sources":["../../src/ops/update.ts"],"sourcesContent":["import {\n ComKey,\n Item,\n ItemProperties,\n PriKey\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"@/ClientApiOptions\";\nimport LibLogger from \"@/logger\";\nimport { Utilities } from \"@/Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'update');\n\nexport const getUpdateOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const update = async (\n ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\n item: ItemProperties<S, L1, L2, L3, L4, L5>,\n ): Promise<V> => {\n const requestOptions = Object.assign({}, apiOptions.putOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('update', { ik, item, requestOptions });\n\n return utilities.validatePK(await utilities.processOne(\n api.httpPut<V>(\n utilities.getPath(ik),\n item,\n requestOptions,\n ))) as V;\n }\n\n return update;\n}\n"],"names":["logger","LibLogger","get","getUpdateOperation","api","apiOptions","utilities","update","ik","item","requestOptions","Object","assign","putOptions","isAuthenticated","writeAuthenticated","default","validatePK","processOne","httpPut","getPath"],"mappings":";;AAYA,MAAMA,MAASC,GAAAA,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAO,EAAA,QAAA,CAAA;AAErCC,MAAAA,kBAAAA,GAAqB,CAQ9BC,GAAAA,EACAC,UACAC,EAAAA,SAAAA,GAAAA;IAIF,MAAMC,MAAAA,GAAS,OACbC,EACAC,EAAAA,IAAAA,GAAAA;QAEA,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAIP,EAAAA,UAAAA,CAAWQ,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBT,WAAWU;AAAmB,SAAA,CAAA;QACjHf,MAAOgB,CAAAA,OAAO,CAAC,QAAU,EAAA;AAAER,YAAAA,EAAAA;AAAIC,YAAAA,IAAAA;AAAMC,YAAAA;AAAe,SAAA,CAAA;AAEpD,QAAA,OAAOJ,SAAUW,CAAAA,UAAU,CAAC,MAAMX,UAAUY,UAAU,CACpDd,GAAIe,CAAAA,OAAO,CACTb,SAAAA,CAAUc,OAAO,CAACZ,KAClBC,IACAC,EAAAA,cAAAA,CAAAA,CAAAA,CAAAA;AAEN,KAAA;IAEA,OAAOH,MAAAA;AACT;;;;"}
|
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.3",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"@babel/preset-typescript": "^7.27.1",
|
|
24
24
|
"@eslint/eslintrc": "^3.3.1",
|
|
25
25
|
"@eslint/js": "^9.29.0",
|
|
26
|
-
"@swc/core": "^1.12.
|
|
27
|
-
"@tsconfig/recommended": "^1.0.
|
|
26
|
+
"@swc/core": "^1.12.6",
|
|
27
|
+
"@tsconfig/recommended": "^1.0.10",
|
|
28
28
|
"@types/luxon": "^3.6.2",
|
|
29
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
30
|
-
"@typescript-eslint/parser": "^8.
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^8.35.0",
|
|
30
|
+
"@typescript-eslint/parser": "^8.35.0",
|
|
31
31
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
32
32
|
"@vitest/coverage-v8": "^3.2.4",
|
|
33
33
|
"@vitest/ui": "^3.2.4",
|
|
34
|
-
"concurrently": "^9.
|
|
34
|
+
"concurrently": "^9.2.0",
|
|
35
35
|
"eslint": "^9.29.0",
|
|
36
36
|
"rimraf": "^6.0.1",
|
|
37
37
|
"tsc-alias": "^1.8.16",
|
package/src/AItemAPI.ts
CHANGED
|
@@ -63,6 +63,10 @@ export const createAItemAPI = <
|
|
|
63
63
|
readAuthenticated: true,
|
|
64
64
|
allAuthenticated: true,
|
|
65
65
|
writeAuthenticated: true,
|
|
66
|
+
getOptions: {},
|
|
67
|
+
postOptions: {},
|
|
68
|
+
putOptions: {},
|
|
69
|
+
deleteOptions: {},
|
|
66
70
|
};
|
|
67
71
|
|
|
68
72
|
if (options) {
|
|
@@ -78,6 +82,7 @@ export const createAItemAPI = <
|
|
|
78
82
|
action: operations.action,
|
|
79
83
|
all: operations.all,
|
|
80
84
|
allAction: operations.allAction,
|
|
85
|
+
allFacet: operations.allFacet,
|
|
81
86
|
create: operations.create,
|
|
82
87
|
facet: operations.facet,
|
|
83
88
|
find: operations.find,
|
package/src/CItemAPI.ts
CHANGED
|
@@ -8,17 +8,13 @@ import {
|
|
|
8
8
|
TypesProperties
|
|
9
9
|
} from "@fjell/core";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
GetMethodOptions,
|
|
13
|
-
HttpApi,
|
|
14
|
-
PostMethodOptions,
|
|
15
|
-
PutMethodOptions,
|
|
11
|
+
HttpApi
|
|
16
12
|
} from "@fjell/http-api";
|
|
17
13
|
import { createAItemAPI, PathNamesArray } from "./AItemAPI";
|
|
18
14
|
|
|
15
|
+
import LibLogger from "@/logger";
|
|
19
16
|
import { ClientApi } from "./ClientApi";
|
|
20
17
|
import { ClientApiOptions } from "./ClientApiOptions";
|
|
21
|
-
import LibLogger from "@/logger";
|
|
22
18
|
|
|
23
19
|
const logger = LibLogger.get('CItemAPI');
|
|
24
20
|
|
|
@@ -35,52 +31,48 @@ export interface CItemApi<
|
|
|
35
31
|
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
36
32
|
action: string,
|
|
37
33
|
body: any,
|
|
38
|
-
options?: Partial<PostMethodOptions>
|
|
39
34
|
) => Promise<V>;
|
|
40
35
|
all: (
|
|
41
36
|
query: ItemQuery,
|
|
42
|
-
options?: Partial<GetMethodOptions>,
|
|
43
37
|
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
44
38
|
) => Promise<V[]>;
|
|
45
39
|
allAction: (
|
|
46
40
|
action: string,
|
|
47
|
-
body
|
|
48
|
-
options?: Partial<PostMethodOptions>,
|
|
41
|
+
body?: any,
|
|
49
42
|
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
50
43
|
) => Promise<V[]>;
|
|
44
|
+
allFacet: (
|
|
45
|
+
facet: string,
|
|
46
|
+
params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
47
|
+
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
48
|
+
) => Promise<any>;
|
|
51
49
|
get: (
|
|
52
50
|
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
53
|
-
options?: Partial<GetMethodOptions>,
|
|
54
51
|
) => Promise<V | null>;
|
|
55
52
|
create: (
|
|
56
53
|
item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
|
|
57
|
-
options?: Partial<PostMethodOptions>,
|
|
58
54
|
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
59
55
|
) => Promise<V>;
|
|
60
56
|
remove: (
|
|
61
57
|
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
62
|
-
options?: Partial<DeleteMethodOptions>
|
|
63
58
|
) => Promise<boolean>;
|
|
64
59
|
update: (
|
|
65
60
|
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
66
61
|
item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
|
|
67
|
-
options?: Partial<PutMethodOptions>
|
|
68
62
|
) => Promise<V>;
|
|
69
63
|
facet: (
|
|
70
64
|
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
71
65
|
facet: string,
|
|
72
|
-
|
|
66
|
+
params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
73
67
|
) => Promise<any>;
|
|
74
68
|
find: (
|
|
75
69
|
finder: string,
|
|
76
|
-
finderParams
|
|
77
|
-
options?: Partial<GetMethodOptions>,
|
|
70
|
+
finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
78
71
|
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
79
72
|
) => Promise<V[]>;
|
|
80
73
|
findOne: (
|
|
81
74
|
finder: string,
|
|
82
|
-
finderParams
|
|
83
|
-
options?: Partial<GetMethodOptions>,
|
|
75
|
+
finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
84
76
|
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
85
77
|
) => Promise<V>;
|
|
86
78
|
};
|
|
@@ -103,6 +95,7 @@ export const createCItemApi = <
|
|
|
103
95
|
action: aItemAPI.action,
|
|
104
96
|
all: aItemAPI.all,
|
|
105
97
|
allAction: aItemAPI.allAction,
|
|
98
|
+
allFacet: aItemAPI.allFacet,
|
|
106
99
|
one: aItemAPI.one,
|
|
107
100
|
get: aItemAPI.get,
|
|
108
101
|
create: aItemAPI.create,
|