@fjell/client-api 4.4.3 → 4.4.5
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.map +1 -1
- package/dist/CItemAPI.d.ts +3 -3
- package/dist/CItemAPI.js.map +1 -1
- package/dist/ClientApi.d.ts +3 -3
- package/dist/PItemAPI.d.ts +3 -3
- package/dist/PItemAPI.js.map +1 -1
- package/dist/Utilities.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/logger.js.map +1 -1
- package/dist/ops/action.js.map +1 -1
- package/dist/ops/all.js.map +1 -1
- package/dist/ops/allAction.js.map +1 -1
- package/dist/ops/allFacet.js.map +1 -1
- package/dist/ops/create.d.ts +2 -2
- package/dist/ops/create.js.map +1 -1
- package/dist/ops/facet.js.map +1 -1
- package/dist/ops/find.js.map +1 -1
- package/dist/ops/findOne.js.map +1 -1
- package/dist/ops/get.js.map +1 -1
- package/dist/ops/index.js.map +1 -1
- package/dist/ops/one.js.map +1 -1
- package/dist/ops/remove.js.map +1 -1
- package/dist/ops/update.d.ts +2 -2
- package/dist/ops/update.js.map +1 -1
- package/package.json +16 -16
- package/.kodrdriv/config.yaml +0 -10
- package/.kodrdriv/context/content.md +0 -1
- package/babel.config.cjs +0 -14
- package/src/AItemAPI.ts +0 -95
- package/src/CItemAPI.ts +0 -108
- package/src/ClientApi.ts +0 -64
- package/src/ClientApiOptions.ts +0 -22
- package/src/PItemAPI.ts +0 -182
- package/src/Utilities.ts +0 -183
- package/src/index.ts +0 -7
- package/src/logger.ts +0 -5
- package/src/ops/action.ts +0 -48
- package/src/ops/all.ts +0 -50
- package/src/ops/allAction.ts +0 -50
- package/src/ops/allFacet.ts +0 -46
- package/src/ops/create.ts +0 -48
- package/src/ops/facet.ts +0 -58
- package/src/ops/find.ts +0 -49
- package/src/ops/findOne.ts +0 -51
- package/src/ops/get.ts +0 -42
- package/src/ops/index.ts +0 -96
- package/src/ops/one.ts +0 -61
- package/src/ops/remove.ts +0 -38
- package/src/ops/update.ts +0 -45
- package/src/util/general.ts +0 -65
package/dist/ops/allFacet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"allFacet.js","sources":["../../src/ops/allFacet.ts"],"sourcesContent":["import {\n Item,\n LocKeyArray\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"@/ClientApiOptions\";\nimport LibLogger from \"@/logger\";\nimport { Utilities } from \"@/Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'allFacet');\n\nexport const getAllFacetOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const allFacet = async (\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.writeAuthenticated, params });\n logger.default('allFacet', { facet, locations, requestOptions });\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n // TODO: This should respond to either a single object, or multiple objects in an array.\n return api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n )\n };\n\n return allFacet;\n}\n"],"names":["logger","LibLogger","get","getAllFacetOperation","api","apiOptions","utilities","allFacet","facet","params","locations","requestOptions","Object","assign","getOptions","isAuthenticated","writeAuthenticated","default","verifyLocations","loc","httpGet","getPath"],"mappings":";;AAUA,MAAMA,
|
|
1
|
+
{"version":3,"file":"allFacet.js","sources":["../../src/ops/allFacet.ts"],"sourcesContent":["import {\n Item,\n LocKeyArray\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"@/ClientApiOptions\";\nimport LibLogger from \"@/logger\";\nimport { Utilities } from \"@/Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'allFacet');\n\nexport const getAllFacetOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const allFacet = async (\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V[]> => {\n const requestOptions = Object.assign({}, apiOptions.getOptions, { isAuthenticated: apiOptions.writeAuthenticated, params });\n logger.default('allFacet', { facet, locations, requestOptions });\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n // TODO: This should respond to either a single object, or multiple objects in an array.\n return api.httpGet<V[]>(\n utilities.getPath(loc),\n requestOptions,\n )\n };\n\n return allFacet;\n}\n"],"names":["logger","LibLogger","get","getAllFacetOperation","api","apiOptions","utilities","allFacet","facet","params","locations","requestOptions","Object","assign","getOptions","isAuthenticated","writeAuthenticated","default","verifyLocations","loc","httpGet","getPath"],"mappings":";;AAUA,MAAMA,MAAAA,GAASC,SAAAA,CAAUC,GAAG,CAAC,cAAc,KAAA,EAAO,UAAA,CAAA;AAE3C,MAAMC,oBAAAA,GAAuB,CAQhCC,GAAAA,EACAC,UAAAA,EACAC,SAAAA,GAAAA;IAIF,MAAMC,QAAAA,GAAW,OACfC,KAAAA,EACAC,MAAAA,GAAqG,EAAE,EACvGC,YAAkD,EAAE,GAAA;QAEpD,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAC,EAAGR,UAAAA,CAAWS,UAAU,EAAE;AAAEC,YAAAA,eAAAA,EAAiBV,WAAWW,kBAAkB;AAAEP,YAAAA;AAAO,SAAA,CAAA;QACzHT,MAAAA,CAAOiB,OAAO,CAAC,UAAA,EAAY;AAAET,YAAAA,KAAAA;AAAOE,YAAAA,SAAAA;AAAWC,YAAAA;AAAe,SAAA,CAAA;AAC9DL,QAAAA,SAAAA,CAAUY,eAAe,CAACR,SAAAA,CAAAA;AAE1B,QAAA,MAAMS,GAAAA,GAA4CT,SAAAA;;AAGlD,QAAA,OAAON,IAAIgB,OAAO,CAChBd,SAAAA,CAAUe,OAAO,CAACF,GAAAA,CAAAA,EAClBR,cAAAA,CAAAA;AAEJ,IAAA,CAAA;IAEA,OAAOJ,QAAAA;AACT;;;;"}
|
package/dist/ops/create.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Item,
|
|
1
|
+
import { Item, LocKeyArray } from '@fjell/core';
|
|
2
2
|
import { HttpApi } from '@fjell/http-api';
|
|
3
3
|
import { ClientApiOptions } from '../ClientApiOptions';
|
|
4
4
|
import { Utilities } from '../Utilities';
|
|
5
|
-
export declare const getCreateOperation: <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>) => (item:
|
|
5
|
+
export declare const getCreateOperation: <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>) => (item: Partial<Item<S, L1, L2, L3, L4, L5>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
|
package/dist/ops/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sources":["../../src/ops/create.ts"],"sourcesContent":["import {\n Item,\n
|
|
1
|
+
{"version":3,"file":"create.js","sources":["../../src/ops/create.ts"],"sourcesContent":["import {\n Item,\n LocKeyArray\n} from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"@/ClientApiOptions\";\nimport LibLogger from \"@/logger\";\nimport { Utilities } from \"@/Utilities\";\n\nconst logger = LibLogger.get('client-api', 'ops', 'create');\n\nexport const getCreateOperation = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never>(\n api: HttpApi,\n apiOptions: ClientApiOptions,\n utilities: Utilities<V, S, L1, L2, L3, L4, L5>\n\n ) => {\n\n const create = async (\n item: Partial<Item<S, L1, L2, L3, L4, L5>>,\n locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []\n ): Promise<V> => {\n const requestOptions = Object.assign({}, apiOptions.postOptions, { isAuthenticated: apiOptions.writeAuthenticated });\n logger.default('create', { item, locations, requestOptions });\n utilities.verifyLocations(locations);\n\n const loc: LocKeyArray<L1, L2, L3, L4, L5> | [] = locations;\n\n const created: V =\n utilities.validatePK(await utilities.processOne(api.httpPost<V>(\n utilities.getPath(loc),\n item,\n requestOptions,\n ))) as V;\n return created;\n };\n\n return create;\n}\n"],"names":["logger","LibLogger","get","getCreateOperation","api","apiOptions","utilities","create","item","locations","requestOptions","Object","assign","postOptions","isAuthenticated","writeAuthenticated","default","verifyLocations","loc","created","validatePK","processOne","httpPost","getPath"],"mappings":";;AAUA,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,MAAAA,GAAS,OACbC,IAAAA,EACAC,SAAAA,GAAkD,EAAE,GAAA;QAEpD,MAAMC,cAAAA,GAAiBC,OAAOC,MAAM,CAAC,EAAC,EAAGP,UAAAA,CAAWQ,WAAW,EAAE;AAAEC,YAAAA,eAAAA,EAAiBT,WAAWU;AAAmB,SAAA,CAAA;QAClHf,MAAAA,CAAOgB,OAAO,CAAC,QAAA,EAAU;AAAER,YAAAA,IAAAA;AAAMC,YAAAA,SAAAA;AAAWC,YAAAA;AAAe,SAAA,CAAA;AAC3DJ,QAAAA,SAAAA,CAAUW,eAAe,CAACR,SAAAA,CAAAA;AAE1B,QAAA,MAAMS,GAAAA,GAA4CT,SAAAA;AAElD,QAAA,MAAMU,OAAAA,GACJb,SAAAA,CAAUc,UAAU,CAAC,MAAMd,SAAAA,CAAUe,UAAU,CAACjB,GAAAA,CAAIkB,QAAQ,CAC1DhB,SAAAA,CAAUiB,OAAO,CAACL,MAClBV,IAAAA,EACAE,cAAAA,CAAAA,CAAAA,CAAAA;QAEJ,OAAOS,OAAAA;AACT,IAAA,CAAA;IAEA,OAAOZ,MAAAA;AACT;;;;"}
|
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 { 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,
|
|
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,IAAA,CAAA;IAEA,OAAOH,KAAAA;AACT;;;;"}
|
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 { 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,
|
|
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,IAAA,CAAA;IAEA,OAAOR,IAAAA;AACT;;;;"}
|
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 { 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,
|
|
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,IAAA,CAAA;IAEA,OAAOT,OAAAA;AACT;;;;"}
|
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 { 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,
|
|
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,IAAA,CAAA;IAEA,OAAON,GAAAA;AACT;;;;"}
|
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\"\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":";;;;;;;;;;;;;
|
|
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.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 { 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,
|
|
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,QAAA;QAEA,OAAOD,IAAAA;AACT,IAAA,CAAA;IAEA,OAAOd,GAAAA;AACT;;;;"}
|
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 { 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,
|
|
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,IAAA,CAAA;IAEA,OAAOF,MAAAA;AACT;;;;"}
|
package/dist/ops/update.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComKey, Item,
|
|
1
|
+
import { ComKey, Item, PriKey } from '@fjell/core';
|
|
2
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.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,IAAA,CAAA;IAEA,OAAOH,MAAAA;AACT;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjell/client-api",
|
|
3
3
|
"description": "Client API for Fjell",
|
|
4
|
-
"version": "4.4.
|
|
4
|
+
"version": "4.4.5",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"client",
|
|
7
|
+
"api",
|
|
8
|
+
"fjell"
|
|
9
|
+
],
|
|
5
10
|
"license": "Apache-2.0",
|
|
6
11
|
"type": "module",
|
|
7
12
|
"module": "./dist/index.js",
|
|
@@ -12,33 +17,28 @@
|
|
|
12
17
|
}
|
|
13
18
|
},
|
|
14
19
|
"dependencies": {
|
|
15
|
-
"@fjell/core": "^4.4.
|
|
16
|
-
"@fjell/http-api": "^4.4.
|
|
17
|
-
"@fjell/logging": "^4.4.
|
|
20
|
+
"@fjell/core": "^4.4.6",
|
|
21
|
+
"@fjell/http-api": "^4.4.4",
|
|
22
|
+
"@fjell/logging": "^4.4.6",
|
|
18
23
|
"deepmerge": "^4.3.1"
|
|
19
24
|
},
|
|
20
25
|
"devDependencies": {
|
|
21
|
-
"@babel/core": "^7.27.4",
|
|
22
|
-
"@babel/preset-env": "^7.27.2",
|
|
23
|
-
"@babel/preset-typescript": "^7.27.1",
|
|
24
26
|
"@eslint/eslintrc": "^3.3.1",
|
|
25
|
-
"@eslint/js": "^9.
|
|
26
|
-
"@swc/core": "^1.12.
|
|
27
|
+
"@eslint/js": "^9.30.1",
|
|
28
|
+
"@swc/core": "^1.12.11",
|
|
27
29
|
"@tsconfig/recommended": "^1.0.10",
|
|
28
|
-
"@
|
|
29
|
-
"@typescript-eslint/
|
|
30
|
-
"@typescript-eslint/parser": "^8.35.0",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
|
31
|
+
"@typescript-eslint/parser": "^8.36.0",
|
|
31
32
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
32
33
|
"@vitest/coverage-v8": "^3.2.4",
|
|
33
34
|
"@vitest/ui": "^3.2.4",
|
|
34
35
|
"concurrently": "^9.2.0",
|
|
35
|
-
"eslint": "^9.
|
|
36
|
+
"eslint": "^9.30.1",
|
|
36
37
|
"rimraf": "^6.0.1",
|
|
37
|
-
"tsc-alias": "^1.8.16",
|
|
38
38
|
"typescript": "^5.8.3",
|
|
39
|
-
"vite": "^
|
|
39
|
+
"vite": "^7.0.3",
|
|
40
40
|
"vite-plugin-dts": "^4.5.4",
|
|
41
|
-
"vite-plugin-node": "^
|
|
41
|
+
"vite-plugin-node": "^7.0.0",
|
|
42
42
|
"vitest": "^3.2.4"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
package/.kodrdriv/config.yaml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
This the Fjell library that provides a framework for client-side APIs
|
package/babel.config.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
presets: [
|
|
3
|
-
['@babel/preset-env', { targets: { node: 'current' } }],
|
|
4
|
-
'@babel/preset-typescript'
|
|
5
|
-
],
|
|
6
|
-
overrides: [
|
|
7
|
-
{
|
|
8
|
-
test: /node_modules[\\/](?:@fjell[\\/](core|http-api|logging))/,
|
|
9
|
-
presets: [
|
|
10
|
-
['@babel/preset-env', { targets: { node: 'current' } }]
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
};
|
package/src/AItemAPI.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/* eslint-disable indent */
|
|
2
|
-
import { Item, QueryParams } from "@fjell/core";
|
|
3
|
-
import { HttpApi } from "@fjell/http-api";
|
|
4
|
-
|
|
5
|
-
import { ClientApiOptions } from "./ClientApiOptions";
|
|
6
|
-
import { getOperations } from "./ops";
|
|
7
|
-
import { createUtilities } from "./Utilities";
|
|
8
|
-
import { ClientApi } from "./ClientApi";
|
|
9
|
-
|
|
10
|
-
import LibLogger from "@/logger";
|
|
11
|
-
|
|
12
|
-
const logger = LibLogger.get('AItemAPI');
|
|
13
|
-
|
|
14
|
-
export type PathNamesArray<
|
|
15
|
-
L1 extends string = never,
|
|
16
|
-
L2 extends string = never,
|
|
17
|
-
L3 extends string = never,
|
|
18
|
-
L4 extends string = never,
|
|
19
|
-
L5 extends string = never
|
|
20
|
-
> =
|
|
21
|
-
([L5] extends [never] ?
|
|
22
|
-
([L4] extends [never] ?
|
|
23
|
-
([L3] extends [never] ?
|
|
24
|
-
([L2] extends [never] ?
|
|
25
|
-
([L1] extends [never] ?
|
|
26
|
-
[string] :
|
|
27
|
-
[string, string]) :
|
|
28
|
-
[string, string, string]) :
|
|
29
|
-
[string, string, string, string]) :
|
|
30
|
-
[string, string, string, string, string]) :
|
|
31
|
-
[string, string, string, string, string, string]);
|
|
32
|
-
|
|
33
|
-
export const finderToParams = (
|
|
34
|
-
finder: string,
|
|
35
|
-
finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>
|
|
36
|
-
): QueryParams => {
|
|
37
|
-
return {
|
|
38
|
-
finder,
|
|
39
|
-
finderParams: JSON.stringify(finderParams),
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const createAItemAPI = <
|
|
44
|
-
V extends Item<S, L1, L2, L3, L4, L5>,
|
|
45
|
-
S extends string,
|
|
46
|
-
L1 extends string = never,
|
|
47
|
-
L2 extends string = never,
|
|
48
|
-
L3 extends string = never,
|
|
49
|
-
L4 extends string = never,
|
|
50
|
-
L5 extends string = never
|
|
51
|
-
>(
|
|
52
|
-
api: HttpApi,
|
|
53
|
-
pkType: S,
|
|
54
|
-
pathNames: PathNamesArray<L1, L2, L3, L4, L5>,
|
|
55
|
-
options?: ClientApiOptions,
|
|
56
|
-
): ClientApi<V, S, L1, L2, L3, L4, L5> => {
|
|
57
|
-
|
|
58
|
-
logger.default('createAItemAPI', { pkType, pathNames, options });
|
|
59
|
-
|
|
60
|
-
let mergedOptions: ClientApiOptions;
|
|
61
|
-
|
|
62
|
-
const defaultOptions: ClientApiOptions = {
|
|
63
|
-
readAuthenticated: true,
|
|
64
|
-
allAuthenticated: true,
|
|
65
|
-
writeAuthenticated: true,
|
|
66
|
-
getOptions: {},
|
|
67
|
-
postOptions: {},
|
|
68
|
-
putOptions: {},
|
|
69
|
-
deleteOptions: {},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
if (options) {
|
|
73
|
-
mergedOptions = Object.assign({}, defaultOptions, options);
|
|
74
|
-
} else {
|
|
75
|
-
mergedOptions = defaultOptions;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const utilities = createUtilities<V, S, L1, L2, L3, L4, L5>(pkType, pathNames);
|
|
79
|
-
const operations = getOperations<V, S, L1, L2, L3, L4, L5>(api, mergedOptions, utilities);
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
action: operations.action,
|
|
83
|
-
all: operations.all,
|
|
84
|
-
allAction: operations.allAction,
|
|
85
|
-
allFacet: operations.allFacet,
|
|
86
|
-
create: operations.create,
|
|
87
|
-
facet: operations.facet,
|
|
88
|
-
find: operations.find,
|
|
89
|
-
findOne: operations.findOne,
|
|
90
|
-
get: operations.get,
|
|
91
|
-
one: operations.one,
|
|
92
|
-
remove: operations.remove,
|
|
93
|
-
update: operations.update,
|
|
94
|
-
}
|
|
95
|
-
}
|
package/src/CItemAPI.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
ComKey,
|
|
4
|
-
Item,
|
|
5
|
-
ItemQuery,
|
|
6
|
-
LocKeyArray,
|
|
7
|
-
PriKey,
|
|
8
|
-
TypesProperties
|
|
9
|
-
} from "@fjell/core";
|
|
10
|
-
import {
|
|
11
|
-
HttpApi
|
|
12
|
-
} from "@fjell/http-api";
|
|
13
|
-
import { createAItemAPI, PathNamesArray } from "./AItemAPI";
|
|
14
|
-
|
|
15
|
-
import LibLogger from "@/logger";
|
|
16
|
-
import { ClientApi } from "./ClientApi";
|
|
17
|
-
import { ClientApiOptions } from "./ClientApiOptions";
|
|
18
|
-
|
|
19
|
-
const logger = LibLogger.get('CItemAPI');
|
|
20
|
-
|
|
21
|
-
export interface CItemApi<
|
|
22
|
-
V extends Item<S, L1, L2, L3, L4, L5>,
|
|
23
|
-
S extends string,
|
|
24
|
-
L1 extends string,
|
|
25
|
-
L2 extends string = never,
|
|
26
|
-
L3 extends string = never,
|
|
27
|
-
L4 extends string = never,
|
|
28
|
-
L5 extends string = never
|
|
29
|
-
> extends ClientApi<V, S, L1, L2, L3, L4, L5> {
|
|
30
|
-
action: (
|
|
31
|
-
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
32
|
-
action: string,
|
|
33
|
-
body: any,
|
|
34
|
-
) => Promise<V>;
|
|
35
|
-
all: (
|
|
36
|
-
query: ItemQuery,
|
|
37
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
38
|
-
) => Promise<V[]>;
|
|
39
|
-
allAction: (
|
|
40
|
-
action: string,
|
|
41
|
-
body?: any,
|
|
42
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
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>;
|
|
49
|
-
get: (
|
|
50
|
-
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
51
|
-
) => Promise<V | null>;
|
|
52
|
-
create: (
|
|
53
|
-
item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
|
|
54
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
55
|
-
) => Promise<V>;
|
|
56
|
-
remove: (
|
|
57
|
-
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
58
|
-
) => Promise<boolean>;
|
|
59
|
-
update: (
|
|
60
|
-
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
61
|
-
item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
|
|
62
|
-
) => Promise<V>;
|
|
63
|
-
facet: (
|
|
64
|
-
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
65
|
-
facet: string,
|
|
66
|
-
params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
67
|
-
) => Promise<any>;
|
|
68
|
-
find: (
|
|
69
|
-
finder: string,
|
|
70
|
-
finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
71
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
72
|
-
) => Promise<V[]>;
|
|
73
|
-
findOne: (
|
|
74
|
-
finder: string,
|
|
75
|
-
finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
76
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
77
|
-
) => Promise<V>;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const createCItemApi = <
|
|
81
|
-
V extends Item<S, L1, L2, L3, L4, L5>,
|
|
82
|
-
S extends string,
|
|
83
|
-
L1 extends string,
|
|
84
|
-
L2 extends string = never,
|
|
85
|
-
L3 extends string = never,
|
|
86
|
-
L4 extends string = never,
|
|
87
|
-
L5 extends string = never
|
|
88
|
-
>(api: HttpApi, type: S, pathNames: PathNamesArray<L1, L2, L3, L4, L5>, options?: ClientApiOptions): CItemApi<V, S, L1, L2, L3, L4, L5> => {
|
|
89
|
-
|
|
90
|
-
logger.default('createCItemApi', { api, type, pathNames, options });
|
|
91
|
-
|
|
92
|
-
const aItemAPI = createAItemAPI(api, type, pathNames, options);
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
action: aItemAPI.action,
|
|
96
|
-
all: aItemAPI.all,
|
|
97
|
-
allAction: aItemAPI.allAction,
|
|
98
|
-
allFacet: aItemAPI.allFacet,
|
|
99
|
-
one: aItemAPI.one,
|
|
100
|
-
get: aItemAPI.get,
|
|
101
|
-
create: aItemAPI.create,
|
|
102
|
-
remove: aItemAPI.remove,
|
|
103
|
-
update: aItemAPI.update,
|
|
104
|
-
facet: aItemAPI.facet,
|
|
105
|
-
find: aItemAPI.find,
|
|
106
|
-
findOne: aItemAPI.findOne,
|
|
107
|
-
} as unknown as CItemApi<V, S, L1, L2, L3, L4, L5>;
|
|
108
|
-
}
|
package/src/ClientApi.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { ComKey, Item, ItemQuery, LocKeyArray, PriKey, TypesProperties } from "@fjell/core";
|
|
2
|
-
|
|
3
|
-
export interface ClientApi<
|
|
4
|
-
V extends Item<S, L1, L2, L3, L4, L5>,
|
|
5
|
-
S extends string,
|
|
6
|
-
L1 extends string = never,
|
|
7
|
-
L2 extends string = never,
|
|
8
|
-
L3 extends string = never,
|
|
9
|
-
L4 extends string = never,
|
|
10
|
-
L5 extends string = never
|
|
11
|
-
> {
|
|
12
|
-
action: (
|
|
13
|
-
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
14
|
-
action: string,
|
|
15
|
-
body?: any,
|
|
16
|
-
) => Promise<V>;
|
|
17
|
-
all: (
|
|
18
|
-
query: ItemQuery,
|
|
19
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
20
|
-
) => Promise<V[]>;
|
|
21
|
-
allAction: (
|
|
22
|
-
action: string,
|
|
23
|
-
body?: any,
|
|
24
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
25
|
-
) => Promise<V[]>;
|
|
26
|
-
allFacet: (
|
|
27
|
-
facet: string,
|
|
28
|
-
params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
29
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
30
|
-
) => Promise<any>;
|
|
31
|
-
create: (
|
|
32
|
-
item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
|
|
33
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
34
|
-
) => Promise<V>;
|
|
35
|
-
facet: (
|
|
36
|
-
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
37
|
-
facet: string,
|
|
38
|
-
params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
39
|
-
) => Promise<any>;
|
|
40
|
-
find: (
|
|
41
|
-
finder: string,
|
|
42
|
-
finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
43
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
44
|
-
) => Promise<V[]>;
|
|
45
|
-
findOne: (
|
|
46
|
-
finder: string,
|
|
47
|
-
finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,
|
|
48
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
49
|
-
) => Promise<V>;
|
|
50
|
-
get: (
|
|
51
|
-
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
52
|
-
) => Promise<V | null>;
|
|
53
|
-
one: (
|
|
54
|
-
query: ItemQuery,
|
|
55
|
-
locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
|
|
56
|
-
) => Promise<V | null>;
|
|
57
|
-
remove: (
|
|
58
|
-
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
59
|
-
) => Promise<boolean>;
|
|
60
|
-
update: (
|
|
61
|
-
ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
|
|
62
|
-
item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
|
|
63
|
-
) => Promise<V>;
|
|
64
|
-
}
|
package/src/ClientApiOptions.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Item } from "@fjell/core";
|
|
2
|
-
import { ClientApi } from "./ClientApi";
|
|
3
|
-
import { DeleteMethodOptions, GetMethodOptions, PostMethodOptions, PutMethodOptions } from "@fjell/http-api";
|
|
4
|
-
|
|
5
|
-
export interface ClientApiOptions {
|
|
6
|
-
readAuthenticated?: boolean;
|
|
7
|
-
allAuthenticated?: boolean;
|
|
8
|
-
writeAuthenticated?: boolean;
|
|
9
|
-
parentApi?: ClientApi<
|
|
10
|
-
Item<string, string | never, string | never, string | never, string | never, string | never>,
|
|
11
|
-
string,
|
|
12
|
-
string | never,
|
|
13
|
-
string | never,
|
|
14
|
-
string | never,
|
|
15
|
-
string | never,
|
|
16
|
-
string | never
|
|
17
|
-
>;
|
|
18
|
-
getOptions?: Partial<GetMethodOptions>;
|
|
19
|
-
postOptions?: Partial<PostMethodOptions>;
|
|
20
|
-
putOptions?: Partial<PutMethodOptions>;
|
|
21
|
-
deleteOptions?: Partial<DeleteMethodOptions>;
|
|
22
|
-
}
|