@fjell/client-api 4.4.2 → 4.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AItemAPI.js +6 -1
- package/dist/AItemAPI.js.map +1 -1
- package/dist/CItemAPI.d.ts +12 -11
- package/dist/CItemAPI.js +1 -0
- package/dist/CItemAPI.js.map +1 -1
- package/dist/ClientApi.d.ts +12 -12
- package/dist/ClientApiOptions.d.ts +5 -0
- package/dist/PItemAPI.d.ts +13 -12
- package/dist/PItemAPI.js +13 -11
- package/dist/PItemAPI.js.map +1 -1
- package/dist/index.cjs +132 -91
- package/dist/index.cjs.map +1 -1
- package/dist/ops/action.d.ts +2 -2
- package/dist/ops/action.js +6 -5
- package/dist/ops/action.js.map +1 -1
- package/dist/ops/all.d.ts +2 -2
- package/dist/ops/all.js +7 -6
- package/dist/ops/all.js.map +1 -1
- package/dist/ops/allAction.d.ts +2 -2
- package/dist/ops/allAction.js +6 -5
- package/dist/ops/allAction.js.map +1 -1
- package/dist/ops/allFacet.d.ts +5 -0
- package/dist/ops/allFacet.js +24 -0
- package/dist/ops/allFacet.js.map +1 -0
- package/dist/ops/create.d.ts +2 -2
- package/dist/ops/create.js +6 -5
- package/dist/ops/create.js.map +1 -1
- package/dist/ops/facet.d.ts +2 -2
- package/dist/ops/facet.js +7 -5
- package/dist/ops/facet.js.map +1 -1
- package/dist/ops/find.d.ts +2 -2
- package/dist/ops/find.js +10 -9
- package/dist/ops/find.js.map +1 -1
- package/dist/ops/findOne.d.ts +2 -2
- package/dist/ops/findOne.js +8 -7
- package/dist/ops/findOne.js.map +1 -1
- package/dist/ops/get.d.ts +2 -2
- package/dist/ops/get.js +6 -5
- package/dist/ops/get.js.map +1 -1
- package/dist/ops/index.js +2 -0
- package/dist/ops/index.js.map +1 -1
- package/dist/ops/one.d.ts +2 -2
- package/dist/ops/one.js +7 -6
- package/dist/ops/one.js.map +1 -1
- package/dist/ops/remove.d.ts +2 -2
- package/dist/ops/remove.js +6 -5
- package/dist/ops/remove.js.map +1 -1
- package/dist/ops/update.d.ts +2 -2
- package/dist/ops/update.js +6 -5
- package/dist/ops/update.js.map +1 -1
- package/dist/util/general.d.ts +4 -0
- package/package.json +6 -6
- package/src/AItemAPI.ts +5 -0
- package/src/CItemAPI.ts +12 -19
- package/src/ClientApi.ts +59 -65
- package/src/ClientApiOptions.ts +5 -0
- package/src/PItemAPI.ts +34 -51
- package/src/ops/action.ts +19 -23
- package/src/ops/all.ts +17 -19
- package/src/ops/allAction.ts +18 -21
- package/src/ops/allFacet.ts +46 -0
- package/src/ops/create.ts +21 -23
- package/src/ops/facet.ts +4 -5
- package/src/ops/find.ts +20 -23
- package/src/ops/findOne.ts +4 -5
- package/src/ops/get.ts +17 -20
- package/src/ops/index.ts +6 -0
- package/src/ops/one.ts +3 -5
- package/src/ops/remove.ts +17 -20
- package/src/ops/update.ts +17 -19
- package/src/util/general.ts +65 -0
package/dist/AItemAPI.js
CHANGED
|
@@ -19,7 +19,11 @@ const createAItemAPI = (api, pkType, pathNames, options)=>{
|
|
|
19
19
|
const defaultOptions = {
|
|
20
20
|
readAuthenticated: true,
|
|
21
21
|
allAuthenticated: true,
|
|
22
|
-
writeAuthenticated: true
|
|
22
|
+
writeAuthenticated: true,
|
|
23
|
+
getOptions: {},
|
|
24
|
+
postOptions: {},
|
|
25
|
+
putOptions: {},
|
|
26
|
+
deleteOptions: {}
|
|
23
27
|
};
|
|
24
28
|
if (options) {
|
|
25
29
|
mergedOptions = Object.assign({}, defaultOptions, options);
|
|
@@ -32,6 +36,7 @@ const createAItemAPI = (api, pkType, pathNames, options)=>{
|
|
|
32
36
|
action: operations.action,
|
|
33
37
|
all: operations.all,
|
|
34
38
|
allAction: operations.allAction,
|
|
39
|
+
allFacet: operations.allFacet,
|
|
35
40
|
create: operations.create,
|
|
36
41
|
facet: operations.facet,
|
|
37
42
|
find: operations.find,
|
package/dist/AItemAPI.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AItemAPI.js","sources":["../src/AItemAPI.ts"],"sourcesContent":["/* eslint-disable indent */\nimport { Item, QueryParams } from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nimport { getOperations } from \"./ops\";\nimport { createUtilities } from \"./Utilities\";\nimport { ClientApi } from \"./ClientApi\";\n\nimport LibLogger from \"@/logger\";\n\nconst logger = LibLogger.get('AItemAPI');\n\nexport type PathNamesArray<\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> =\n ([L5] extends [never] ?\n ([L4] extends [never] ?\n ([L3] extends [never] ?\n ([L2] extends [never] ?\n ([L1] extends [never] ?\n [string] :\n [string, string]) :\n [string, string, string]) :\n [string, string, string, string]) :\n [string, string, string, string, string]) :\n [string, string, string, string, string, string]);\n\nexport const finderToParams = (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>\n): QueryParams => {\n return {\n finder,\n finderParams: JSON.stringify(finderParams),\n };\n};\n\nexport const createAItemAPI = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n api: HttpApi,\n pkType: S,\n pathNames: PathNamesArray<L1, L2, L3, L4, L5>,\n options?: ClientApiOptions,\n): ClientApi<V, S, L1, L2, L3, L4, L5> => {\n\n logger.default('createAItemAPI', { pkType, pathNames, options });\n\n let mergedOptions: ClientApiOptions;\n\n const defaultOptions: ClientApiOptions = {\n readAuthenticated: true,\n allAuthenticated: true,\n writeAuthenticated: true,\n };\n\n if (options) {\n mergedOptions = Object.assign({}, defaultOptions, options);\n } else {\n mergedOptions = defaultOptions;\n }\n\n const utilities = createUtilities<V, S, L1, L2, L3, L4, L5>(pkType, pathNames);\n const operations = getOperations<V, S, L1, L2, L3, L4, L5>(api, mergedOptions, utilities);\n\n return {\n action: operations.action,\n all: operations.all,\n allAction: operations.allAction,\n create: operations.create,\n facet: operations.facet,\n find: operations.find,\n findOne: operations.findOne,\n get: operations.get,\n one: operations.one,\n remove: operations.remove,\n update: operations.update,\n }\n}"],"names":["logger","LibLogger","get","finderToParams","finder","finderParams","JSON","stringify","createAItemAPI","api","pkType","pathNames","options","default","mergedOptions","defaultOptions","readAuthenticated","allAuthenticated","writeAuthenticated","Object","assign","utilities","createUtilities","operations","getOperations","action","all","allAction","create","facet","find","findOne","one","remove","update"],"mappings":";;;;AAWA,MAAMA,MAAAA,GAASC,SAAUC,CAAAA,GAAG,CAAC,UAAA,CAAA;AAqBtB,MAAMC,cAAiB,GAAA,CAC5BC,MACAC,EAAAA,YAAAA,GAAAA;IAEA,OAAO;AACLD,QAAAA,MAAAA;QACAC,YAAcC,EAAAA,IAAAA,CAAKC,SAAS,CAACF,YAAAA;AAC/B,KAAA;AACF;AAEaG,MAAAA,cAAAA,GAAiB,CAS5BC,GAAAA,EACAC,QACAC,SACAC,EAAAA,OAAAA,GAAAA;IAGAZ,MAAOa,CAAAA,OAAO,CAAC,gBAAkB,EAAA;AAAEH,QAAAA,MAAAA;AAAQC,QAAAA,SAAAA;AAAWC,QAAAA;AAAQ,KAAA,CAAA;IAE9D,IAAIE,aAAAA;AAEJ,IAAA,MAAMC,cAAmC,GAAA;QACvCC,iBAAmB,EAAA,IAAA;QACnBC,gBAAkB,EAAA,IAAA;QAClBC,kBAAoB,EAAA;
|
|
1
|
+
{"version":3,"file":"AItemAPI.js","sources":["../src/AItemAPI.ts"],"sourcesContent":["/* eslint-disable indent */\nimport { Item, QueryParams } from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\n\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nimport { getOperations } from \"./ops\";\nimport { createUtilities } from \"./Utilities\";\nimport { ClientApi } from \"./ClientApi\";\n\nimport LibLogger from \"@/logger\";\n\nconst logger = LibLogger.get('AItemAPI');\n\nexport type PathNamesArray<\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> =\n ([L5] extends [never] ?\n ([L4] extends [never] ?\n ([L3] extends [never] ?\n ([L2] extends [never] ?\n ([L1] extends [never] ?\n [string] :\n [string, string]) :\n [string, string, string]) :\n [string, string, string, string]) :\n [string, string, string, string, string]) :\n [string, string, string, string, string, string]);\n\nexport const finderToParams = (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>\n): QueryParams => {\n return {\n finder,\n finderParams: JSON.stringify(finderParams),\n };\n};\n\nexport const createAItemAPI = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n api: HttpApi,\n pkType: S,\n pathNames: PathNamesArray<L1, L2, L3, L4, L5>,\n options?: ClientApiOptions,\n): ClientApi<V, S, L1, L2, L3, L4, L5> => {\n\n logger.default('createAItemAPI', { pkType, pathNames, options });\n\n let mergedOptions: ClientApiOptions;\n\n const defaultOptions: ClientApiOptions = {\n readAuthenticated: true,\n allAuthenticated: true,\n writeAuthenticated: true,\n getOptions: {},\n postOptions: {},\n putOptions: {},\n deleteOptions: {},\n };\n\n if (options) {\n mergedOptions = Object.assign({}, defaultOptions, options);\n } else {\n mergedOptions = defaultOptions;\n }\n\n const utilities = createUtilities<V, S, L1, L2, L3, L4, L5>(pkType, pathNames);\n const operations = getOperations<V, S, L1, L2, L3, L4, L5>(api, mergedOptions, utilities);\n\n return {\n action: operations.action,\n all: operations.all,\n allAction: operations.allAction,\n allFacet: operations.allFacet,\n create: operations.create,\n facet: operations.facet,\n find: operations.find,\n findOne: operations.findOne,\n get: operations.get,\n one: operations.one,\n remove: operations.remove,\n update: operations.update,\n }\n}"],"names":["logger","LibLogger","get","finderToParams","finder","finderParams","JSON","stringify","createAItemAPI","api","pkType","pathNames","options","default","mergedOptions","defaultOptions","readAuthenticated","allAuthenticated","writeAuthenticated","getOptions","postOptions","putOptions","deleteOptions","Object","assign","utilities","createUtilities","operations","getOperations","action","all","allAction","allFacet","create","facet","find","findOne","one","remove","update"],"mappings":";;;;AAWA,MAAMA,MAAAA,GAASC,SAAUC,CAAAA,GAAG,CAAC,UAAA,CAAA;AAqBtB,MAAMC,cAAiB,GAAA,CAC5BC,MACAC,EAAAA,YAAAA,GAAAA;IAEA,OAAO;AACLD,QAAAA,MAAAA;QACAC,YAAcC,EAAAA,IAAAA,CAAKC,SAAS,CAACF,YAAAA;AAC/B,KAAA;AACF;AAEaG,MAAAA,cAAAA,GAAiB,CAS5BC,GAAAA,EACAC,QACAC,SACAC,EAAAA,OAAAA,GAAAA;IAGAZ,MAAOa,CAAAA,OAAO,CAAC,gBAAkB,EAAA;AAAEH,QAAAA,MAAAA;AAAQC,QAAAA,SAAAA;AAAWC,QAAAA;AAAQ,KAAA,CAAA;IAE9D,IAAIE,aAAAA;AAEJ,IAAA,MAAMC,cAAmC,GAAA;QACvCC,iBAAmB,EAAA,IAAA;QACnBC,gBAAkB,EAAA,IAAA;QAClBC,kBAAoB,EAAA,IAAA;AACpBC,QAAAA,UAAAA,EAAY,EAAC;AACbC,QAAAA,WAAAA,EAAa,EAAC;AACdC,QAAAA,UAAAA,EAAY,EAAC;AACbC,QAAAA,aAAAA,EAAe;AACjB,KAAA;AAEA,IAAA,IAAIV,OAAS,EAAA;AACXE,QAAAA,aAAAA,GAAgBS,MAAOC,CAAAA,MAAM,CAAC,IAAIT,cAAgBH,EAAAA,OAAAA,CAAAA;KAC7C,MAAA;QACLE,aAAgBC,GAAAA,cAAAA;AAClB;IAEA,MAAMU,SAAAA,GAAYC,gBAA0ChB,MAAQC,EAAAA,SAAAA,CAAAA;IACpE,MAAMgB,UAAAA,GAAaC,aAAwCnB,CAAAA,GAAAA,EAAKK,aAAeW,EAAAA,SAAAA,CAAAA;IAE/E,OAAO;AACLI,QAAAA,MAAAA,EAAQF,WAAWE,MAAM;AACzBC,QAAAA,GAAAA,EAAKH,WAAWG,GAAG;AACnBC,QAAAA,SAAAA,EAAWJ,WAAWI,SAAS;AAC/BC,QAAAA,QAAAA,EAAUL,WAAWK,QAAQ;AAC7BC,QAAAA,MAAAA,EAAQN,WAAWM,MAAM;AACzBC,QAAAA,KAAAA,EAAOP,WAAWO,KAAK;AACvBC,QAAAA,IAAAA,EAAMR,WAAWQ,IAAI;AACrBC,QAAAA,OAAAA,EAAST,WAAWS,OAAO;AAC3BlC,QAAAA,GAAAA,EAAKyB,WAAWzB,GAAG;AACnBmC,QAAAA,GAAAA,EAAKV,WAAWU,GAAG;AACnBC,QAAAA,MAAAA,EAAQX,WAAWW,MAAM;AACzBC,QAAAA,MAAAA,EAAQZ,WAAWY;AACrB,KAAA;AACF;;;;"}
|
package/dist/CItemAPI.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { ComKey, Item, ItemQuery, LocKeyArray, PriKey, TypesProperties } from '@fjell/core';
|
|
2
|
-
import {
|
|
2
|
+
import { HttpApi } from '@fjell/http-api';
|
|
3
3
|
import { PathNamesArray } from './AItemAPI';
|
|
4
4
|
import { ClientApi } from './ClientApi';
|
|
5
5
|
import { ClientApiOptions } from './ClientApiOptions';
|
|
6
6
|
export interface CItemApi<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> extends ClientApi<V, S, L1, L2, L3, L4, L5> {
|
|
7
|
-
action: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, action: string, body: any
|
|
8
|
-
all: (query: ItemQuery,
|
|
9
|
-
allAction: (action: string, body
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
action: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, action: string, body: any) => Promise<V>;
|
|
8
|
+
all: (query: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
|
|
9
|
+
allAction: (action: string, body?: any, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
|
|
10
|
+
allFacet: (facet: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<any>;
|
|
11
|
+
get: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => Promise<V | null>;
|
|
12
|
+
create: (item: TypesProperties<V, S, L1, L2, L3, L4, L5>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
|
|
13
|
+
remove: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => Promise<boolean>;
|
|
14
|
+
update: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, item: TypesProperties<V, S, L1, L2, L3, L4, L5>) => Promise<V>;
|
|
15
|
+
facet: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, facet: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>) => Promise<any>;
|
|
16
|
+
find: (finder: string, finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
|
|
17
|
+
findOne: (finder: string, finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
|
|
17
18
|
}
|
|
18
19
|
export declare const createCItemApi: <V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(api: HttpApi, type: S, pathNames: PathNamesArray<L1, L2, L3, L4, L5>, options?: ClientApiOptions) => CItemApi<V, S, L1, L2, L3, L4, L5>;
|
package/dist/CItemAPI.js
CHANGED
package/dist/CItemAPI.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CItemAPI.js","sources":["../src/CItemAPI.ts"],"sourcesContent":["\nimport {\n ComKey,\n Item,\n ItemQuery,\n LocKeyArray,\n PriKey,\n TypesProperties\n} from \"@fjell/core\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"CItemAPI.js","sources":["../src/CItemAPI.ts"],"sourcesContent":["\nimport {\n ComKey,\n Item,\n ItemQuery,\n LocKeyArray,\n PriKey,\n TypesProperties\n} from \"@fjell/core\";\nimport {\n HttpApi\n} from \"@fjell/http-api\";\nimport { createAItemAPI, PathNamesArray } from \"./AItemAPI\";\n\nimport LibLogger from \"@/logger\";\nimport { ClientApi } from \"./ClientApi\";\nimport { ClientApiOptions } from \"./ClientApiOptions\";\n\nconst logger = LibLogger.get('CItemAPI');\n\nexport interface CItemApi<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> extends ClientApi<V, S, L1, L2, L3, L4, L5> {\n action: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n action: string,\n body: any,\n ) => Promise<V>;\n all: (\n query: ItemQuery,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n allAction: (\n action: string,\n body?: any,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n allFacet: (\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<any>;\n get: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n ) => Promise<V | null>;\n create: (\n item: TypesProperties<V, S, L1, L2, L3, L4, L5>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V>;\n remove: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n ) => Promise<boolean>;\n update: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n item: TypesProperties<V, S, L1, L2, L3, L4, L5>,\n ) => Promise<V>;\n facet: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<any>;\n find: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n findOne: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V>;\n};\n\nexport const createCItemApi = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(api: HttpApi, type: S, pathNames: PathNamesArray<L1, L2, L3, L4, L5>, options?: ClientApiOptions): CItemApi<V, S, L1, L2, L3, L4, L5> => {\n\n logger.default('createCItemApi', { api, type, pathNames, options });\n\n const aItemAPI = createAItemAPI(api, type, pathNames, options);\n\n return {\n action: aItemAPI.action,\n all: aItemAPI.all,\n allAction: aItemAPI.allAction,\n allFacet: aItemAPI.allFacet,\n one: aItemAPI.one,\n get: aItemAPI.get,\n create: aItemAPI.create,\n remove: aItemAPI.remove,\n update: aItemAPI.update,\n facet: aItemAPI.facet,\n find: aItemAPI.find,\n findOne: aItemAPI.findOne,\n } as unknown as CItemApi<V, S, L1, L2, L3, L4, L5>;\n}\n"],"names":["logger","LibLogger","get","createCItemApi","api","type","pathNames","options","default","aItemAPI","createAItemAPI","action","all","allAction","allFacet","one","create","remove","update","facet","find","findOne"],"mappings":";;;AAkBA,MAAMA,MAAAA,GAASC,SAAUC,CAAAA,GAAG,CAAC,UAAA,CAAA;AA6DhBC,MAAAA,cAAAA,GAAiB,CAQ5BC,GAAAA,EAAcC,MAASC,SAA+CC,EAAAA,OAAAA,GAAAA;IAEtEP,MAAOQ,CAAAA,OAAO,CAAC,gBAAkB,EAAA;AAAEJ,QAAAA,GAAAA;AAAKC,QAAAA,IAAAA;AAAMC,QAAAA,SAAAA;AAAWC,QAAAA;AAAQ,KAAA,CAAA;AAEjE,IAAA,MAAME,QAAWC,GAAAA,cAAAA,CAAeN,GAAKC,EAAAA,IAAAA,EAAMC,SAAWC,EAAAA,OAAAA,CAAAA;IAEtD,OAAO;AACLI,QAAAA,MAAAA,EAAQF,SAASE,MAAM;AACvBC,QAAAA,GAAAA,EAAKH,SAASG,GAAG;AACjBC,QAAAA,SAAAA,EAAWJ,SAASI,SAAS;AAC7BC,QAAAA,QAAAA,EAAUL,SAASK,QAAQ;AAC3BC,QAAAA,GAAAA,EAAKN,SAASM,GAAG;AACjBb,QAAAA,GAAAA,EAAKO,SAASP,GAAG;AACjBc,QAAAA,MAAAA,EAAQP,SAASO,MAAM;AACvBC,QAAAA,MAAAA,EAAQR,SAASQ,MAAM;AACvBC,QAAAA,MAAAA,EAAQT,SAASS,MAAM;AACvBC,QAAAA,KAAAA,EAAOV,SAASU,KAAK;AACrBC,QAAAA,IAAAA,EAAMX,SAASW,IAAI;AACnBC,QAAAA,OAAAA,EAASZ,SAASY;AACpB,KAAA;AACF;;;;"}
|
package/dist/ClientApi.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ComKey, Item, ItemQuery, LocKeyArray, PriKey, TypesProperties } from '@fjell/core';
|
|
2
|
-
import { DeleteMethodOptions, GetMethodOptions, PostMethodOptions, PutMethodOptions } from '@fjell/http-api';
|
|
3
2
|
export interface ClientApi<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> {
|
|
4
|
-
action: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, action: string, body
|
|
5
|
-
all: (query: ItemQuery,
|
|
6
|
-
allAction: (action: string, body
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
action: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, action: string, body?: any) => Promise<V>;
|
|
4
|
+
all: (query: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
|
|
5
|
+
allAction: (action: string, body?: any, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
|
|
6
|
+
allFacet: (facet: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<any>;
|
|
7
|
+
create: (item: TypesProperties<V, S, L1, L2, L3, L4, L5>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
|
|
8
|
+
facet: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, facet: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>) => Promise<any>;
|
|
9
|
+
find: (finder: string, finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
|
|
10
|
+
findOne: (finder: string, finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
|
|
11
|
+
get: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => Promise<V | null>;
|
|
12
|
+
one: (query: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V | null>;
|
|
13
|
+
remove: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => Promise<boolean>;
|
|
14
|
+
update: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, item: TypesProperties<V, S, L1, L2, L3, L4, L5>) => Promise<V>;
|
|
15
15
|
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Item } from '@fjell/core';
|
|
2
2
|
import { ClientApi } from './ClientApi';
|
|
3
|
+
import { DeleteMethodOptions, GetMethodOptions, PostMethodOptions, PutMethodOptions } from '@fjell/http-api';
|
|
3
4
|
export interface ClientApiOptions {
|
|
4
5
|
readAuthenticated?: boolean;
|
|
5
6
|
allAuthenticated?: boolean;
|
|
6
7
|
writeAuthenticated?: boolean;
|
|
7
8
|
parentApi?: ClientApi<Item<string, string | never, string | never, string | never, string | never, string | never>, string, string | never, string | never, string | never, string | never, string | never>;
|
|
9
|
+
getOptions?: Partial<GetMethodOptions>;
|
|
10
|
+
postOptions?: Partial<PostMethodOptions>;
|
|
11
|
+
putOptions?: Partial<PutMethodOptions>;
|
|
12
|
+
deleteOptions?: Partial<DeleteMethodOptions>;
|
|
8
13
|
}
|
package/dist/PItemAPI.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { ComKey, Item, ItemQuery, PriKey, TypesProperties } from '@fjell/core';
|
|
2
|
-
import { HttpApi
|
|
2
|
+
import { HttpApi } from '@fjell/http-api';
|
|
3
3
|
import { ClientApi } from './ClientApi';
|
|
4
4
|
import { ClientApiOptions } from './ClientApiOptions';
|
|
5
5
|
export interface PItemApi<V extends Item<S>, S extends string> extends ClientApi<V, S> {
|
|
6
|
-
action: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, action: string, body: any
|
|
7
|
-
all: (query: ItemQuery
|
|
8
|
-
allAction: (action: string, body
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
action: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, action: string, body: any) => Promise<V>;
|
|
7
|
+
all: (query: ItemQuery) => Promise<V[]>;
|
|
8
|
+
allAction: (action: string, body?: any) => Promise<V[]>;
|
|
9
|
+
allFacet: (facet: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>) => Promise<any>;
|
|
10
|
+
one: (query: ItemQuery) => Promise<V | null>;
|
|
11
|
+
get: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>) => Promise<V | null>;
|
|
12
|
+
create: (item: TypesProperties<V, S>) => Promise<V>;
|
|
13
|
+
remove: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>) => Promise<boolean>;
|
|
14
|
+
update: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, item: TypesProperties<V, S>) => Promise<V>;
|
|
15
|
+
facet: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, facet: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>) => Promise<any>;
|
|
16
|
+
find: (finder: string, finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>) => Promise<V[]>;
|
|
17
|
+
findOne: (finder: string, finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>) => Promise<V>;
|
|
17
18
|
}
|
|
18
19
|
export declare const createPItemApi: <V extends Item<S>, S extends string>(api: HttpApi, type: S, pathName: string, options?: ClientApiOptions) => PItemApi<V, S>;
|
package/dist/PItemAPI.js
CHANGED
|
@@ -11,22 +11,24 @@ const createPItemApi = (api, type, pathName, options)=>{
|
|
|
11
11
|
const aItemAPI = createAItemAPI(api, type, [
|
|
12
12
|
pathName
|
|
13
13
|
], options);
|
|
14
|
-
const action = async (ik, action, body = {}
|
|
15
|
-
const all = async (query = {}
|
|
16
|
-
const allAction = async (action, body = {}
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
14
|
+
const action = async (ik, action, body = {})=>await aItemAPI.action(ik, action, body);
|
|
15
|
+
const all = async (query = {})=>await aItemAPI.all(query, []);
|
|
16
|
+
const allAction = async (action, body = {})=>await aItemAPI.allAction(action, body, []);
|
|
17
|
+
const allFacet = async (facet, params = {})=>await aItemAPI.allFacet(facet, params);
|
|
18
|
+
const one = async (query = {})=>await aItemAPI.one(query, []);
|
|
19
|
+
const get = async (ik)=>await aItemAPI.get(ik);
|
|
20
|
+
const create = async (item)=>await aItemAPI.create(item, []);
|
|
21
|
+
const remove = async (ik)=>await aItemAPI.remove(ik);
|
|
22
|
+
const update = async (ik, item)=>await aItemAPI.update(ik, item);
|
|
23
|
+
const facet = async (ik, facet, params = {})=>await aItemAPI.facet(ik, facet, params);
|
|
24
|
+
const find = async (finder, finderParams = {})=>await aItemAPI.find(finder, finderParams);
|
|
25
|
+
const findOne = async (finder, finderParams = {})=>await aItemAPI.findOne(finder, finderParams);
|
|
25
26
|
return {
|
|
26
27
|
...aItemAPI,
|
|
27
28
|
action,
|
|
28
29
|
all,
|
|
29
30
|
allAction,
|
|
31
|
+
allFacet,
|
|
30
32
|
one,
|
|
31
33
|
get,
|
|
32
34
|
create,
|
package/dist/PItemAPI.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PItemAPI.js","sources":["../src/PItemAPI.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"PItemAPI.js","sources":["../src/PItemAPI.ts"],"sourcesContent":["\nimport { ComKey, Item, ItemQuery, PriKey, TypesProperties } from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\nimport { createAItemAPI } from \"./AItemAPI\";\nimport { ClientApi } from \"./ClientApi\";\n\nimport LibLogger from \"@/logger\";\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nconst logger = LibLogger.get('PItemAPI');\n\nexport interface PItemApi<\n V extends Item<S>,\n S extends string\n> extends ClientApi<V, S> {\n\n action: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n action: string,\n body: any,\n ) => Promise<V>;\n\n all: (\n query: ItemQuery,\n ) => Promise<V[]>;\n\n allAction: (\n action: string,\n body?: any,\n ) => Promise<V[]>;\n\n allFacet: (\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<any>;\n\n one: (\n query: ItemQuery,\n ) => Promise<V | null>;\n\n get: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ) => Promise<V | null>;\n\n create: (\n item: TypesProperties<V, S>,\n ) => Promise<V>;\n\n remove: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ) => Promise<boolean>;\n\n update: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: TypesProperties<V, S>,\n ) => Promise<V>;\n\n facet: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n facet: string,\n params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<any>;\n\n find: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<V[]>;\n\n findOne: (\n finder: string,\n finderParams?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n ) => Promise<V>;\n}\n\nexport const createPItemApi = <V extends Item<S>, S extends string>(\n api: HttpApi,\n type: S,\n pathName: string,\n options?: ClientApiOptions\n): PItemApi<V, S> => {\n\n logger.default('createPItemApi', { type, pathName, options });\n\n const aItemAPI = createAItemAPI<V, S>(api, type, [pathName], options);\n\n const action =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n action: string,\n body: any = {},\n ): Promise<V> =>\n await aItemAPI.action(ik, action, body) as V;\n\n const all =\n async (\n query: ItemQuery = {} as ItemQuery,\n ): Promise<V[]> =>\n await aItemAPI.all(query, []) as V[];\n\n const allAction =\n async (\n action: string,\n body: any = {},\n ): Promise<V[]> =>\n await aItemAPI.allAction(action, body, []) as V[];\n\n const allFacet =\n async (\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<any> =>\n await aItemAPI.allFacet(facet, params) as any;\n\n const one =\n async (\n query: ItemQuery = {} as ItemQuery,\n ): Promise<V | null> =>\n await aItemAPI.one(query, []) as V | null;\n\n const get =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ): Promise<V | null> =>\n await aItemAPI.get(ik) as V | null;\n\n const create =\n async (\n item: TypesProperties<V, S>,\n ): Promise<V> =>\n await aItemAPI.create(item, []) as V;\n\n const remove =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n ): Promise<boolean> =>\n await aItemAPI.remove(ik) as boolean;\n\n const update =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: TypesProperties<V, S>,\n ): Promise<V> =>\n await aItemAPI.update(ik, item) as V;\n\n const facet =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n facet: string,\n params: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<any> =>\n await aItemAPI.facet(ik, facet, params) as any;\n\n const find =\n async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<V[]> =>\n await aItemAPI.find(finder, finderParams) as V[];\n\n const findOne =\n async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>> = {},\n ): Promise<V> =>\n await aItemAPI.findOne(finder, finderParams) as V;\n\n return {\n ...aItemAPI,\n action,\n all,\n allAction,\n allFacet,\n one,\n get,\n create,\n remove,\n update,\n facet,\n find,\n findOne,\n };\n\n};\n"],"names":["logger","LibLogger","get","createPItemApi","api","type","pathName","options","default","aItemAPI","createAItemAPI","action","ik","body","all","query","allAction","allFacet","facet","params","one","create","item","remove","update","find","finder","finderParams","findOne"],"mappings":";;;AAQA,MAAMA,MAAAA,GAASC,SAAUC,CAAAA,GAAG,CAAC,UAAA,CAAA;AAiEhBC,MAAAA,cAAAA,GAAiB,CAC5BC,GAAAA,EACAC,MACAC,QACAC,EAAAA,OAAAA,GAAAA;IAGAP,MAAOQ,CAAAA,OAAO,CAAC,gBAAkB,EAAA;AAAEH,QAAAA,IAAAA;AAAMC,QAAAA,QAAAA;AAAUC,QAAAA;AAAQ,KAAA,CAAA;IAE3D,MAAME,QAAAA,GAAWC,cAAqBN,CAAAA,GAAAA,EAAKC,IAAM,EAAA;AAACC,QAAAA;KAAS,EAAEC,OAAAA,CAAAA;AAE7D,IAAA,MAAMI,MACJ,GAAA,OACEC,EACAD,EAAAA,MAAAA,EACAE,IAAY,GAAA,EAAE,GAEd,MAAMJ,QAAAA,CAASE,MAAM,CAACC,IAAID,MAAQE,EAAAA,IAAAA,CAAAA;IAEtC,MAAMC,GAAAA,GACJ,OACEC,KAAAA,GAAmB,EAAe,GAElC,MAAMN,QAASK,CAAAA,GAAG,CAACC,KAAAA,EAAO,EAAE,CAAA;AAEhC,IAAA,MAAMC,SACJ,GAAA,OACEL,MACAE,EAAAA,IAAAA,GAAY,EAAE,GAEd,MAAMJ,QAASO,CAAAA,SAAS,CAACL,MAAAA,EAAQE,MAAM,EAAE,CAAA;IAE7C,MAAMI,QAAAA,GACJ,OACEC,KAAAA,EACAC,MAAqG,GAAA,EAAE,GAEvG,MAAMV,QAAAA,CAASQ,QAAQ,CAACC,KAAOC,EAAAA,MAAAA,CAAAA;IAEnC,MAAMC,GAAAA,GACJ,OACEL,KAAAA,GAAmB,EAAe,GAElC,MAAMN,QAASW,CAAAA,GAAG,CAACL,KAAAA,EAAO,EAAE,CAAA;AAEhC,IAAA,MAAMb,MACJ,OACEU,EAAAA,GAEA,MAAMH,QAAAA,CAASP,GAAG,CAACU,EAAAA,CAAAA;IAEvB,MAAMS,MAAAA,GACJ,OACEC,IAEA,GAAA,MAAMb,SAASY,MAAM,CAACC,MAAM,EAAE,CAAA;AAElC,IAAA,MAAMC,SACJ,OACEX,EAAAA,GAEA,MAAMH,QAAAA,CAASc,MAAM,CAACX,EAAAA,CAAAA;IAE1B,MAAMY,MAAAA,GACJ,OACEZ,EACAU,EAAAA,IAAAA,GAEA,MAAMb,QAASe,CAAAA,MAAM,CAACZ,EAAIU,EAAAA,IAAAA,CAAAA;AAE9B,IAAA,MAAMJ,KACJ,GAAA,OACEN,EACAM,EAAAA,KAAAA,EACAC,MAAqG,GAAA,EAAE,GAEvG,MAAMV,QAAAA,CAASS,KAAK,CAACN,IAAIM,KAAOC,EAAAA,MAAAA,CAAAA;IAEpC,MAAMM,IAAAA,GACJ,OACEC,MAAAA,EACAC,YAA2G,GAAA,EAAE,GAE7G,MAAMlB,QAAAA,CAASgB,IAAI,CAACC,MAAQC,EAAAA,YAAAA,CAAAA;IAEhC,MAAMC,OAAAA,GACJ,OACEF,MAAAA,EACAC,YAA2G,GAAA,EAAE,GAE7G,MAAMlB,QAAAA,CAASmB,OAAO,CAACF,MAAQC,EAAAA,YAAAA,CAAAA;IAEnC,OAAO;AACL,QAAA,GAAGlB,QAAQ;AACXE,QAAAA,MAAAA;AACAG,QAAAA,GAAAA;AACAE,QAAAA,SAAAA;AACAC,QAAAA,QAAAA;AACAG,QAAAA,GAAAA;AACAlB,QAAAA,GAAAA;AACAmB,QAAAA,MAAAA;AACAE,QAAAA,MAAAA;AACAC,QAAAA,MAAAA;AACAN,QAAAA,KAAAA;AACAO,QAAAA,IAAAA;AACAG,QAAAA;AACF,KAAA;AAEF;;;;"}
|