@fjell/client-api 4.4.2 → 4.4.4
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/.kodrdriv/config.yaml +4 -0
- package/commit.sh +8 -0
- package/dist/AItemAPI.js +6 -1
- package/dist/AItemAPI.js.map +1 -1
- package/dist/CItemAPI.d.ts +13 -12
- package/dist/CItemAPI.js +1 -0
- package/dist/CItemAPI.js.map +1 -1
- package/dist/ClientApi.d.ts +13 -13
- package/dist/ClientApiOptions.d.ts +5 -0
- package/dist/PItemAPI.d.ts +14 -13
- package/dist/PItemAPI.js +13 -11
- package/dist/PItemAPI.js.map +1 -1
- package/dist/Utilities.js.map +1 -1
- package/dist/index.cjs +132 -91
- package/dist/index.cjs.map +1 -1
- package/dist/logger.js.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 +3 -3
- 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 +3 -3
- 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 +13 -13
- package/release.sh +89 -0
- package/src/AItemAPI.ts +5 -0
- package/src/CItemAPI.ts +14 -22
- package/src/ClientApi.ts +60 -66
- package/src/ClientApiOptions.ts +5 -0
- package/src/PItemAPI.ts +38 -56
- 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 +22 -25
- 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 +18 -21
- 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,MAAAA,GAASC,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAA,EAAO,OAAA,CAAA;AAE3C,MAAMC,iBAAAA,GAAoB,CAQ7BC,GAAAA,EACAC,UAAAA,EACAC,SAAAA,GAAAA;AAIF;;;;;;;;;;;;;AAaC,MACD,MAAMC,KAAAA,GAAQ,OACZC,IACAD,KAAAA,EACAE,MAAAA,GAAqG,EAAE,GAAA;QAEvG,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAC,EAAGP,UAAAA,CAAWQ,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBT,WAAWU,kBAAkB;AAAEN,YAAAA;AAAO,SAAA,CAAA;QACzHT,MAAAA,CAAOgB,OAAO,CAAC,OAAA,EAAS;AAAER,YAAAA,EAAAA;AAAID,YAAAA,KAAAA;AAAOG,YAAAA;AAAe,SAAA,CAAA;QAEpD,OAAON,GAAAA,CAAIa,OAAO,CAChB,CAAA,EAAGX,SAAAA,CAAUY,OAAO,CAACV,EAAAA,CAAAA,CAAI,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,MAAAA,GAASC,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAA,EAAO,MAAA,CAAA;AAE3C,MAAMC,gBAAAA,GAAmB,CAQ5BC,GAAAA,EACAC,UAAAA,EACAC,SAAAA,GAAAA;IAIF,MAAMC,IAAAA,GAAO,OACXC,MAAAA,EACAC,YAAAA,GAA2G,EAAE,EAC7GC,YAAkD,EAAE,GAAA;AAEpDJ,QAAAA,SAAAA,CAAUK,eAAe,CAACD,SAAAA,CAAAA;AAC1B,QAAA,MAAME,GAAAA,GAA4CF,SAAAA;QAElD,MAAMG,YAAAA,GAA4BC,eAAeN,MAAAA,EAAQC,YAAAA,CAAAA;QACzD,MAAMM,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAC,EAAGZ,UAAAA,CAAWa,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBd,WAAWe,gBAAgB;YAAEC,MAAAA,EAAQR;AAAa,SAAA,CAAA;QACrIb,MAAAA,CAAOsB,OAAO,CAAC,MAAA,EAAQ;AAAEd,YAAAA,MAAAA;AAAQC,YAAAA,YAAAA;AAAcC,YAAAA,SAAAA;AAAWK,YAAAA;AAAe,SAAA,CAAA;AAEzE,QAAA,OAAOT,SAAAA,CAAUiB,UAAU,CAAC,MAAMjB,SAAAA,CAAUkB,YAAY,CACtDpB,GAAAA,CAAIqB,OAAO,CACTnB,SAAAA,CAAUoB,OAAO,CAACd,GAAAA,CAAAA,EAClBG,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,MAAAA,GAASC,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAA,EAAO,MAAA,CAAA;AAE3C,MAAMC,mBAAAA,GAAsB,CAQ/BC,GAAAA,EACAC,UAAAA,EACAC,SAAAA,GAAAA;IAIF,MAAMC,OAAAA,GAAU,OACdC,MAAAA,EACAC,YAAAA,GAA2G,EAAE,EAC7GC,YAAkD,EAAE,GAAA;AAEpDJ,QAAAA,SAAAA,CAAUK,eAAe,CAACD,SAAAA,CAAAA;AAC1B,QAAA,MAAME,GAAAA,GAA4CF,SAAAA;QAElD,MAAMG,MAAAA,GAAsBC,eAAeN,MAAAA,EAAQC,YAAAA,CAAAA;AACnDI,QAAAA,MAAAA,CAAOE,GAAG,GAAG,IAAA;QAEb,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAC,EAAGb,UAAAA,CAAWc,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBf,WAAWgB,gBAAgB;AAAER,YAAAA;AAAO,SAAA,CAAA;QACvHb,MAAAA,CAAOsB,OAAO,CAAC,SAAA,EAAW;AAAEd,YAAAA,MAAAA;AAAQC,YAAAA,YAAAA;AAAcC,YAAAA,SAAAA;AAAWM,YAAAA;AAAe,SAAA,CAAA;AAE5E,QAAA,OAAO,SAACV,CAAUiB,UAAU,CAAC,MAAMjB,UAAUkB,YAAY,CACvDpB,GAAAA,CAAIqB,OAAO,CACTnB,SAAAA,CAAUoB,OAAO,CAACd,GAAAA,CAAAA,EAClBI,cAAAA,CAAAA,CAAAA,CACS,CAAC,CAAA,CAAE;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,MAAAA,GAASC,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAA,EAAO,KAAA,CAAA;AAE3C,MAAMC,eAAAA,GAAkB,CAQ3BC,GAAAA,EACAC,UAAAA,EACAC,SAAAA,GAAAA;AAIF,IAAA,MAAMJ,MAAM,OACVK,EAAAA,GAAAA;QAEA,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAC,EAAGL,UAAAA,CAAWM,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBP,WAAWQ;AAAkB,SAAA,CAAA;QAChHb,MAAAA,CAAOc,OAAO,CAAC,KAAA,EAAO;AAAEP,YAAAA,EAAAA;AAAIC,YAAAA;AAAe,SAAA,CAAA;AAE3C,QAAA,OAAOF,SAAAA,CAAUS,UAAU,CAAC,MAAMT,SAAAA,CAAUU,UAAU,CACpDZ,GAAAA,CAAIa,OAAO,CACTX,SAAAA,CAAUY,OAAO,CAACX,EAAAA,CAAAA,EAClBC,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":";;;;;;;;;;;;;AAmBO,MAAMA,aAAAA,GACX,CAQIC,GAAAA,EACAC,UAAAA,EACAC,SAAAA,GAAAA;IAGF,OAAO;QACLC,MAAAA,EAAQC,kBAAAA,CACNJ,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFG,GAAAA,EAAKC,eAAAA,CACHN,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFK,SAAAA,EAAWC,qBAAAA,CACTR,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFO,QAAAA,EAAUC,oBAAAA,CACRV,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFS,MAAAA,EAAQC,kBAAAA,CACNZ,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFW,KAAAA,EAAOC,iBAAAA,CACLd,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFa,OAAAA,EAASC,mBAAAA,CACPhB,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFe,IAAAA,EAAMC,gBAAAA,CACJlB,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFiB,GAAAA,EAAKC,eAAAA,CACHpB,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFmB,GAAAA,EAAKC,eAAAA,CACHtB,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFqB,MAAAA,EAAQC,kBAAAA,CACNxB,KACAC,UAAAA,EACAC,SAAAA,CAAAA;QAEFuB,MAAAA,EAAQC,kBAAAA,CACN1B,KACAC,UAAAA,EACAC,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,MAAAA,GAASC,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAA,EAAO,KAAA,CAAA;AAE3C,MAAMC,eAAAA,GAAkB,CAQ3BC,GAAAA,EACAC,UAAAA,EACAC,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,GAAAA,GAA4CF,SAAAA;AAElD,QAAA,MAAMG,SAAsBC,aAAAA,CAAcL,KAAAA,CAAAA;QAC1C,MAAMM,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAC,EAAGX,UAAAA,CAAWY,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBb,WAAWc,iBAAiB;AAAEP,YAAAA;AAAO,SAAA,CAAA;QACxHZ,MAAAA,CAAOoB,OAAO,CAAC,KAAA,EAAO;AAAEZ,YAAAA,KAAAA;AAAOC,YAAAA,SAAAA;AAAWK,YAAAA;AAAe,SAAA,CAAA;AAEzD,QAAA,IAAIO,IAAAA,GAAiB,IAAA;AAErB,QAAA,MAAMC,KAAAA,GAAQhB,SAAAA,CAAUiB,UAAU,CAAC,MAAMjB,SAAAA,CAAUkB,YAAY,CAC7DpB,GAAAA,CAAIqB,OAAO,CACTnB,SAAAA,CAAUoB,OAAO,CAACf,GAAAA,CAAAA,EAClBG,cAAAA,CAAAA,CAAAA,CAAAA;QAGJ,IAAIQ,KAAAA,CAAMK,MAAM,GAAG,CAAA,EAAG;YACpBN,IAAAA,GAAOC,KAAK,CAAC,CAAA,CAAE;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,MAAAA,GAASC,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAA,EAAO,QAAA,CAAA;AAE3C,MAAMC,kBAAAA,GAAqB,CAQ9BC,GAAAA,EACAC,UAAAA,EACAC,SAAAA,GAAAA;AAIF,IAAA,MAAMC,SAAS,OACbC,EAAAA,GAAAA;QAEA,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAC,EAAGN,UAAAA,CAAWO,aAAa,EAAE;AAAEC,YAAAA,eAAAA,EAAiBR,WAAWS;AAAmB,SAAA,CAAA;QACpHd,MAAAA,CAAOe,OAAO,CAAC,QAAA,EAAU;AAAEP,YAAAA,EAAAA;AAAIC,YAAAA;AAAe,SAAA,CAAA;AAE9C,QAAA,OAAOL,IAAIY,UAAU,CAAUV,SAAAA,CAAUW,OAAO,CAACT,EAAAA,CAAAA,EAAKC,cAAAA,CAAAA;AACxD,KAAA;IAEA,OAAOF,MAAAA;AACT;;;;"}
|
package/dist/ops/update.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComKey, Item,
|
|
2
|
-
import { HttpApi
|
|
1
|
+
import { ComKey, Item, PriKey } from '@fjell/core';
|
|
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:
|
|
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: Partial<Item<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
|
|
1
|
+
{"version":3,"file":"update.js","sources":["../../src/ops/update.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', 'update');\n\nexport const getUpdateOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const update = async (\n ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>,\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n ): Promise<V> => {\n const requestOptions = Object.assign({}, apiOptions.putOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('update', { ik, item, requestOptions });\n\n return utilities.validatePK(await utilities.processOne(\n api.httpPut<V>(\n utilities.getPath(ik),\n item,\n requestOptions,\n ))) as V;\n }\n\n return update;\n}\n"],"names":["logger","LibLogger","get","getUpdateOperation","api","apiOptions","utilities","update","ik","item","requestOptions","Object","assign","putOptions","isAuthenticated","writeAuthenticated","default","validatePK","processOne","httpPut","getPath"],"mappings":";;AAWA,MAAMA,MAAAA,GAASC,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAA,EAAO,QAAA,CAAA;AAE3C,MAAMC,kBAAAA,GAAqB,CAQ9BC,GAAAA,EACAC,UAAAA,EACAC,SAAAA,GAAAA;IAIF,MAAMC,MAAAA,GAAS,OACbC,EAAAA,EACAC,IAAAA,GAAAA;QAEA,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAC,EAAGP,UAAAA,CAAWQ,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBT,WAAWU;AAAmB,SAAA,CAAA;QACjHf,MAAAA,CAAOgB,OAAO,CAAC,QAAA,EAAU;AAAER,YAAAA,EAAAA;AAAIC,YAAAA,IAAAA;AAAMC,YAAAA;AAAe,SAAA,CAAA;AAEpD,QAAA,OAAOJ,SAAAA,CAAUW,UAAU,CAAC,MAAMX,UAAUY,UAAU,CACpDd,GAAAA,CAAIe,OAAO,CACTb,SAAAA,CAAUc,OAAO,CAACZ,KAClBC,IAAAA,EACAC,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.4",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -12,31 +12,31 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fjell/core": "^4.4.
|
|
16
|
-
"@fjell/http-api": "^4.4.
|
|
17
|
-
"@fjell/logging": "^4.4.
|
|
15
|
+
"@fjell/core": "^4.4.5",
|
|
16
|
+
"@fjell/http-api": "^4.4.3",
|
|
17
|
+
"@fjell/logging": "^4.4.5",
|
|
18
18
|
"deepmerge": "^4.3.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@babel/core": "^7.27.
|
|
21
|
+
"@babel/core": "^7.27.7",
|
|
22
22
|
"@babel/preset-env": "^7.27.2",
|
|
23
23
|
"@babel/preset-typescript": "^7.27.1",
|
|
24
24
|
"@eslint/eslintrc": "^3.3.1",
|
|
25
|
-
"@eslint/js": "^9.
|
|
26
|
-
"@swc/core": "^1.12.
|
|
27
|
-
"@tsconfig/recommended": "^1.0.
|
|
25
|
+
"@eslint/js": "^9.30.0",
|
|
26
|
+
"@swc/core": "^1.12.7",
|
|
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.
|
|
35
|
-
"eslint": "^9.
|
|
34
|
+
"concurrently": "^9.2.0",
|
|
35
|
+
"eslint": "^9.30.0",
|
|
36
36
|
"rimraf": "^6.0.1",
|
|
37
37
|
"tsc-alias": "^1.8.16",
|
|
38
38
|
"typescript": "^5.8.3",
|
|
39
|
-
"vite": "^
|
|
39
|
+
"vite": "^7.0.0",
|
|
40
40
|
"vite-plugin-dts": "^4.5.4",
|
|
41
41
|
"vite-plugin-node": "^5.0.1",
|
|
42
42
|
"vitest": "^3.2.4"
|
package/release.sh
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
echo "Preparing for release: switching from workspace to remote dependencies."
|
|
6
|
+
if [ -f "pnpm-workspace.yaml" ]; then
|
|
7
|
+
echo "Renaming pnpm-workspace.yaml to prevent workspace-protocol resolution"
|
|
8
|
+
mv pnpm-workspace.yaml pnpm-workspace.yaml.bak
|
|
9
|
+
else
|
|
10
|
+
echo "pnpm-workspace.yaml not found, skipping rename."
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
echo "Updating dependencies to latest versions from registry"
|
|
14
|
+
pnpm update --latest
|
|
15
|
+
|
|
16
|
+
echo "Staging changes for release commit"
|
|
17
|
+
git add package.json pnpm-lock.yaml
|
|
18
|
+
|
|
19
|
+
echo "Running clean, lint, build, and test..."
|
|
20
|
+
pnpm run clean && pnpm run lint && pnpm run build && pnpm run test
|
|
21
|
+
|
|
22
|
+
if git diff --staged --quiet; then
|
|
23
|
+
echo "No changes to commit, skipping commit."
|
|
24
|
+
else
|
|
25
|
+
./commit.sh
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
echo "Bumping version..."
|
|
29
|
+
pnpm version patch
|
|
30
|
+
|
|
31
|
+
echo "Generating release notes..."
|
|
32
|
+
pnpm dlx @eldrforge/kodrdriv release > RELEASE_NOTES.md
|
|
33
|
+
|
|
34
|
+
echo "Pushing to origin..."
|
|
35
|
+
git push --follow-tags
|
|
36
|
+
|
|
37
|
+
echo "Creating GitHub pull request..."
|
|
38
|
+
PR_URL=$(gh pr create --fill)
|
|
39
|
+
PR_NUM=$(echo "$PR_URL" | grep -o '[0-9]*$')
|
|
40
|
+
echo "Pull request created: $PR_URL"
|
|
41
|
+
|
|
42
|
+
echo "Waiting for PR #$PR_NUM checks to complete..."
|
|
43
|
+
while true; do
|
|
44
|
+
STATUS=$(gh pr view "$PR_NUM" --json statusCheckRollup --jq '.statusCheckRollup.state' 2>/dev/null)
|
|
45
|
+
if [[ -z "$STATUS" ]]; then
|
|
46
|
+
STATUS="PENDING"
|
|
47
|
+
fi
|
|
48
|
+
echo "PR status: $STATUS"
|
|
49
|
+
if [[ "$STATUS" == "SUCCESS" ]]; then
|
|
50
|
+
echo "All checks passed!"
|
|
51
|
+
break
|
|
52
|
+
elif [[ "$STATUS" == "FAILURE" || "$STATUS" == "ERROR" ]]; then
|
|
53
|
+
echo "PR checks failed."
|
|
54
|
+
gh pr checks "$PR_NUM"
|
|
55
|
+
exit 1
|
|
56
|
+
elif [[ "$STATUS" == "PENDING" || "$STATUS" == "EXPECTED" ]]; then
|
|
57
|
+
echo "Checks are pending... waiting 10 seconds."
|
|
58
|
+
sleep 10
|
|
59
|
+
else
|
|
60
|
+
echo "Unknown PR status: $STATUS. Waiting 10 seconds."
|
|
61
|
+
sleep 10
|
|
62
|
+
fi
|
|
63
|
+
done
|
|
64
|
+
|
|
65
|
+
echo "Merging PR #$PR_NUM..."
|
|
66
|
+
gh pr merge "$PR_NUM" --squash --delete-branch
|
|
67
|
+
|
|
68
|
+
echo "Checking out main branch..."
|
|
69
|
+
git checkout main
|
|
70
|
+
git pull origin main
|
|
71
|
+
|
|
72
|
+
echo "Creating GitHub release..."
|
|
73
|
+
TAG_NAME="v$(jq -r .version package.json)"
|
|
74
|
+
gh release create "$TAG_NAME" --notes-file RELEASE_NOTES.md
|
|
75
|
+
|
|
76
|
+
echo "Creating next release branch..."
|
|
77
|
+
CURRENT_VERSION=$(jq -r .version package.json)
|
|
78
|
+
MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
|
|
79
|
+
MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
|
|
80
|
+
PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
|
|
81
|
+
NEXT_PATCH=$((PATCH + 1))
|
|
82
|
+
NEXT_VERSION="$MAJOR.$MINOR.$NEXT_PATCH"
|
|
83
|
+
|
|
84
|
+
echo "Next version is $NEXT_VERSION"
|
|
85
|
+
git checkout -b "release/v$NEXT_VERSION"
|
|
86
|
+
git commit -m "feat: Start release v$NEXT_VERSION"
|
|
87
|
+
git push -u origin "release/v$NEXT_VERSION"
|
|
88
|
+
|
|
89
|
+
echo "Release process completed."
|
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,
|