@fjell/client-api 4.4.1 → 4.4.2

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 CHANGED
@@ -33,7 +33,9 @@ const createAItemAPI = (api, pkType, pathNames, options)=>{
33
33
  all: operations.all,
34
34
  allAction: operations.allAction,
35
35
  create: operations.create,
36
+ facet: operations.facet,
36
37
  find: operations.find,
38
+ findOne: operations.findOne,
37
39
  get: operations.get,
38
40
  one: operations.one,
39
41
  remove: operations.remove,
@@ -1 +1 @@
1
- {"version":3,"file":"AItemAPI.js","sources":["../src/AItemAPI.ts"],"sourcesContent":["import { 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 find: operations.find,\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","find","one","remove","update"],"mappings":";;;;AAUA,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,CAS1BC,GAAAA,EACAC,QACAC,SACAC,EAAAA,OAAAA,GAAAA;IAGFZ,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;AACtB,KAAA;AAEA,IAAA,IAAIN,OAAS,EAAA;AACXE,QAAAA,aAAAA,GAAgBK,MAAOC,CAAAA,MAAM,CAAC,IAAIL,cAAgBH,EAAAA,OAAAA,CAAAA;KAC7C,MAAA;QACLE,aAAgBC,GAAAA,cAAAA;AAClB;IAEA,MAAMM,SAAAA,GAAaC,gBAA0CZ,MAAQC,EAAAA,SAAAA,CAAAA;IACrE,MAAMY,UAAAA,GAAaC,aAAwCf,CAAAA,GAAAA,EAAKK,aAAeO,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,MAAAA,EAAQL,WAAWK,MAAM;AACzBC,QAAAA,IAAAA,EAAMN,WAAWM,IAAI;AACrB3B,QAAAA,GAAAA,EAAKqB,WAAWrB,GAAG;AACnB4B,QAAAA,GAAAA,EAAKP,WAAWO,GAAG;AACnBC,QAAAA,MAAAA,EAAQR,WAAWQ,MAAM;AACzBC,QAAAA,MAAAA,EAAQT,WAAWS;AACrB,KAAA;AACF;;;;"}
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,M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WW;AACrB,KAAA;AACF;;;;"}
@@ -11,6 +11,8 @@ export interface CItemApi<V extends Item<S, L1, L2, L3, L4, L5>, S extends strin
11
11
  create: (item: TypesProperties<V, S, L1, L2, L3, L4, L5>, options?: Partial<PostMethodOptions>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
12
12
  remove: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, options?: Partial<DeleteMethodOptions>) => Promise<boolean>;
13
13
  update: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, item: TypesProperties<V, S, L1, L2, L3, L4, L5>, options?: Partial<PutMethodOptions>) => Promise<V>;
14
+ facet: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, facet: string, options?: Partial<GetMethodOptions>) => Promise<any>;
14
15
  find: (finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, options?: Partial<GetMethodOptions>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
16
+ findOne: (finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, options?: Partial<GetMethodOptions>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
15
17
  }
16
18
  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
@@ -19,7 +19,9 @@ const createCItemApi = (api, type, pathNames, options)=>{
19
19
  create: aItemAPI.create,
20
20
  remove: aItemAPI.remove,
21
21
  update: aItemAPI.update,
22
- find: aItemAPI.find
22
+ facet: aItemAPI.facet,
23
+ find: aItemAPI.find,
24
+ findOne: aItemAPI.findOne
23
25
  };
24
26
  };
25
27
 
@@ -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 DeleteMethodOptions,\n GetMethodOptions,\n HttpApi,\n PostMethodOptions,\n PutMethodOptions,\n} from \"@fjell/http-api\";\nimport { createAItemAPI, PathNamesArray } from \"./AItemAPI\";\n\nimport { ClientApi } from \"./ClientApi\";\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nimport LibLogger from \"@/logger\";\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 options?: Partial<PostMethodOptions>\n ) => Promise<V>;\n all: (\n query: ItemQuery,\n options?: Partial<GetMethodOptions>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n allAction: (\n action: string,\n body: any,\n options?: Partial<PostMethodOptions>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n get: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n options?: Partial<GetMethodOptions>,\n ) => Promise<V | null>;\n create: (\n item: TypesProperties<V, S, L1, L2, L3, L4, L5>,\n options?: Partial<PostMethodOptions>,\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 options?: Partial<DeleteMethodOptions>\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 options?: Partial<PutMethodOptions>\n ) => Promise<V>;\n find: (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n options?: Partial<GetMethodOptions>,\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 one: aItemAPI.one,\n get: aItemAPI.get,\n create: aItemAPI.create,\n remove: aItemAPI.remove,\n update: aItemAPI.update,\n find: aItemAPI.find,\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","one","create","remove","update","find"],"mappings":";;;AAsBA,MAAMA,MAAAA,GAASC,SAAUC,CAAAA,GAAG,CAAC,UAAA,CAAA;AAsDhBC,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,GAAAA,EAAKL,SAASK,GAAG;AACjBZ,QAAAA,GAAAA,EAAKO,SAASP,GAAG;AACjBa,QAAAA,MAAAA,EAAQN,SAASM,MAAM;AACvBC,QAAAA,MAAAA,EAAQP,SAASO,MAAM;AACvBC,QAAAA,MAAAA,EAAQR,SAASQ,MAAM;AACvBC,QAAAA,IAAAA,EAAMT,SAASS;AACjB,KAAA;AACF;;;;"}
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 DeleteMethodOptions,\n GetMethodOptions,\n HttpApi,\n PostMethodOptions,\n PutMethodOptions,\n} from \"@fjell/http-api\";\nimport { createAItemAPI, PathNamesArray } from \"./AItemAPI\";\n\nimport { ClientApi } from \"./ClientApi\";\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nimport LibLogger from \"@/logger\";\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 options?: Partial<PostMethodOptions>\n ) => Promise<V>;\n all: (\n query: ItemQuery,\n options?: Partial<GetMethodOptions>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n allAction: (\n action: string,\n body: any,\n options?: Partial<PostMethodOptions>,\n locations?: LocKeyArray<L1, L2, L3, L4, L5> | []\n ) => Promise<V[]>;\n get: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n options?: Partial<GetMethodOptions>,\n ) => Promise<V | null>;\n create: (\n item: TypesProperties<V, S, L1, L2, L3, L4, L5>,\n options?: Partial<PostMethodOptions>,\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 options?: Partial<DeleteMethodOptions>\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 options?: Partial<PutMethodOptions>\n ) => Promise<V>;\n facet: (\n ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n facet: string,\n options?: Partial<GetMethodOptions>,\n ) => Promise<any>;\n find: (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n options?: Partial<GetMethodOptions>,\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 options?: Partial<GetMethodOptions>,\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 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","one","create","remove","update","facet","find","findOne"],"mappings":";;;AAsBA,MAAMA,MAAAA,GAASC,SAAUC,CAAAA,GAAG,CAAC,UAAA,CAAA;AAiEhBC,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,GAAAA,EAAKL,SAASK,GAAG;AACjBZ,QAAAA,GAAAA,EAAKO,SAASP,GAAG;AACjBa,QAAAA,MAAAA,EAAQN,SAASM,MAAM;AACvBC,QAAAA,MAAAA,EAAQP,SAASO,MAAM;AACvBC,QAAAA,MAAAA,EAAQR,SAASQ,MAAM;AACvBC,QAAAA,KAAAA,EAAOT,SAASS,KAAK;AACrBC,QAAAA,IAAAA,EAAMV,SAASU,IAAI;AACnBC,QAAAA,OAAAA,EAASX,SAASW;AACpB,KAAA;AACF;;;;"}
@@ -5,7 +5,9 @@ export interface ClientApi<V extends Item<S, L1, L2, L3, L4, L5>, S extends stri
5
5
  all: (query: ItemQuery, options?: Partial<GetMethodOptions>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
6
6
  allAction: (action: string, body: any, options?: Partial<PostMethodOptions>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V[]>;
7
7
  create: (item: TypesProperties<V, S, L1, L2, L3, L4, L5>, options?: Partial<PostMethodOptions>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
8
+ facet: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, facet: string, options?: Partial<GetMethodOptions>) => Promise<any>;
8
9
  find: (finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, options?: Partial<GetMethodOptions>, 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>>, options?: Partial<GetMethodOptions>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V>;
9
11
  get: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, options?: Partial<GetMethodOptions>) => Promise<V | null>;
10
12
  one: (query: ItemQuery, options?: Partial<GetMethodOptions>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<V | null>;
11
13
  remove: (ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, options?: Partial<DeleteMethodOptions>) => Promise<boolean>;
@@ -11,6 +11,8 @@ export interface PItemApi<V extends Item<S>, S extends string> extends ClientApi
11
11
  create: (item: TypesProperties<V, S>, options?: Partial<PostMethodOptions>, locations?: []) => Promise<V>;
12
12
  remove: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, options?: Partial<DeleteMethodOptions>, locations?: []) => Promise<boolean>;
13
13
  update: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, item: TypesProperties<V, S>, options?: Partial<PutMethodOptions>, locations?: []) => Promise<V>;
14
+ facet: (ik: PriKey<S> | ComKey<S, never, never, never, never, never>, facet: string, options?: Partial<GetMethodOptions>) => Promise<any>;
14
15
  find: (finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, options?: Partial<GetMethodOptions>, locations?: []) => Promise<V[]>;
16
+ findOne: (finder: string, finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, options?: Partial<GetMethodOptions>, locations?: []) => Promise<V>;
15
17
  }
16
18
  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
@@ -19,7 +19,9 @@ const createPItemApi = (api, type, pathName, options)=>{
19
19
  const create = async (item, options = {})=>await aItemAPI.create(item, options, []);
20
20
  const remove = async (ik, options = {})=>await aItemAPI.remove(ik, options);
21
21
  const update = async (ik, item, options = {})=>await aItemAPI.update(ik, item, options);
22
+ const facet = async (ik, facet, options = {})=>await aItemAPI.facet(ik, facet, options);
22
23
  const find = async (finder, finderParams, options = {})=>await aItemAPI.find(finder, finderParams, options, []);
24
+ const findOne = async (finder, finderParams, options = {})=>await aItemAPI.findOne(finder, finderParams, options, []);
23
25
  return {
24
26
  ...aItemAPI,
25
27
  action,
@@ -30,7 +32,9 @@ const createPItemApi = (api, type, pathName, options)=>{
30
32
  create,
31
33
  remove,
32
34
  update,
33
- find
35
+ facet,
36
+ find,
37
+ findOne
34
38
  };
35
39
  };
36
40
 
@@ -1 +1 @@
1
- {"version":3,"file":"PItemAPI.js","sources":["../src/PItemAPI.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport { ComKey, Item, ItemProperties, ItemQuery, PriKey, TypesProperties } from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\nimport { createAItemAPI, PathNamesArray } from \"./AItemAPI\";\nimport { ClientApi } from \"./ClientApi\";\n\nimport { DeleteMethodOptions, GetMethodOptions, PostMethodOptions, PutMethodOptions } from \"@fjell/http-api\";\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nimport LibLogger from \"@/logger\";\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 options?: Partial<PostMethodOptions>,\n locations?: []\n ) => Promise<V>;\n\n all: (\n query: ItemQuery,\n options?: Partial<GetMethodOptions>,\n locations?: []\n ) => Promise<V[]>;\n\n allAction: (\n action: string,\n body: any,\n options?: Partial<PostMethodOptions>\n ) => Promise<V[]>;\n\n one: (\n query: ItemQuery,\n options?: Partial<GetMethodOptions>\n ) => Promise<V | null>;\n\n get: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n options?: Partial<GetMethodOptions>,\n locations?: []\n ) => Promise<V | null>;\n\n create: (\n item: TypesProperties<V, S>,\n options?: Partial<PostMethodOptions>,\n locations?: []\n ) => Promise<V>;\n\n remove: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n options?: Partial<DeleteMethodOptions>,\n locations?: []\n ) => Promise<boolean>;\n\n update: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: TypesProperties<V, S>,\n options?: Partial<PutMethodOptions>,\n locations?: []\n ) => Promise<V>;\n\n find: (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n options?: Partial<GetMethodOptions>,\n locations?: []\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 options: Partial<PostMethodOptions> = {},\n ): Promise<V> =>\n await aItemAPI.action(ik, action, body, options) as V;\n\n const all =\n async (\n query: ItemQuery = {} as ItemQuery,\n options: Partial<GetMethodOptions> = {},\n ): Promise<V[]> =>\n await aItemAPI.all(query, options, []) as V[];\n\n const allAction =\n async (\n action: string,\n body: any = {},\n options: Partial<PostMethodOptions> = {},\n ): Promise<V[]> =>\n await aItemAPI.allAction(action, body, options, []) as V[];\n\n const one =\n async (\n query: ItemQuery = {} as ItemQuery,\n options: Partial<GetMethodOptions> = {},\n ): Promise<V | null> =>\n await aItemAPI.one(query, options, []) as V | null;\n\n const get =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n options: Partial<GetMethodOptions> = {},\n ): Promise<V | null> =>\n await aItemAPI.get(ik, options) as V | null;\n\n const create =\n async (\n item: TypesProperties<V, S>,\n options: Partial<PostMethodOptions> = {},\n ): Promise<V> =>\n await aItemAPI.create(item, options, []) as V;\n\n const remove =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n options: Partial<DeleteMethodOptions> = {},\n ): Promise<boolean> =>\n await aItemAPI.remove(ik, options) 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 options: Partial<PutMethodOptions> = {},\n ): Promise<V> =>\n await aItemAPI.update(ik, item, options) as V;\n\n const find =\n async (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n options: Partial<GetMethodOptions> = {},\n ): Promise<V[]> =>\n await aItemAPI.find(finder, finderParams, options, []) as V[];\n\n return {\n ...aItemAPI,\n action,\n all,\n allAction,\n one,\n get,\n create,\n remove,\n update,\n find,\n };\n\n};\n"],"names":["logger","LibLogger","get","createPItemApi","api","type","pathName","options","default","aItemAPI","createAItemAPI","action","ik","body","all","query","allAction","one","create","item","remove","update","find","finder","finderParams"],"mappings":";;;AAUA,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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A,MAAMc,MACJ,GAAA,OACET,EACAO,EAAAA,IAAAA,EACAZ,OAAqC,GAAA,EAAE,GAEvC,MAAME,QAAAA,CAASY,MAAM,CAACT,IAAIO,IAAMZ,EAAAA,OAAAA,CAAAA;AAEpC,IAAA,MAAMe,IACJ,GAAA,OACEC,MACAC,EAAAA,YAAAA,EACAjB,UAAqC,EAAE,GAEvC,MAAME,SAASa,IAAI,CAACC,MAAQC,EAAAA,YAAAA,EAAcjB,SAAS,EAAE,CAAA;IAEzD,OAAO;AACL,QAAA,GAAGE,QAAQ;AACXE,QAAAA,MAAAA;AACAG,QAAAA,GAAAA;AACAE,QAAAA,SAAAA;AACAC,QAAAA,GAAAA;AACAf,QAAAA,GAAAA;AACAgB,QAAAA,MAAAA;AACAE,QAAAA,MAAAA;AACAC,QAAAA,MAAAA;AACAC,QAAAA;AACF,KAAA;AAEF;;;;"}
1
+ {"version":3,"file":"PItemAPI.js","sources":["../src/PItemAPI.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport { ComKey, Item, ItemProperties, ItemQuery, PriKey, TypesProperties } from \"@fjell/core\";\nimport { HttpApi } from \"@fjell/http-api\";\nimport { createAItemAPI, PathNamesArray } from \"./AItemAPI\";\nimport { ClientApi } from \"./ClientApi\";\n\nimport { DeleteMethodOptions, GetMethodOptions, PostMethodOptions, PutMethodOptions } from \"@fjell/http-api\";\nimport { ClientApiOptions } from \"./ClientApiOptions\";\nimport LibLogger from \"@/logger\";\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 options?: Partial<PostMethodOptions>,\n locations?: []\n ) => Promise<V>;\n\n all: (\n query: ItemQuery,\n options?: Partial<GetMethodOptions>,\n locations?: []\n ) => Promise<V[]>;\n\n allAction: (\n action: string,\n body: any,\n options?: Partial<PostMethodOptions>\n ) => Promise<V[]>;\n\n one: (\n query: ItemQuery,\n options?: Partial<GetMethodOptions>\n ) => Promise<V | null>;\n\n get: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n options?: Partial<GetMethodOptions>,\n locations?: []\n ) => Promise<V | null>;\n\n create: (\n item: TypesProperties<V, S>,\n options?: Partial<PostMethodOptions>,\n locations?: []\n ) => Promise<V>;\n\n remove: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n options?: Partial<DeleteMethodOptions>,\n locations?: []\n ) => Promise<boolean>;\n\n update: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n item: TypesProperties<V, S>,\n options?: Partial<PutMethodOptions>,\n locations?: []\n ) => Promise<V>;\n\n facet: (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n facet: string,\n options?: Partial<GetMethodOptions>,\n ) => Promise<any>;\n\n find: (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n options?: Partial<GetMethodOptions>,\n locations?: []\n ) => Promise<V[]>;\n\n findOne: (\n finder: string,\n finderParams: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>,\n options?: Partial<GetMethodOptions>,\n locations?: []\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 options: Partial<PostMethodOptions> = {},\n ): Promise<V> =>\n await aItemAPI.action(ik, action, body, options) as V;\n\n const all =\n async (\n query: ItemQuery = {} as ItemQuery,\n options: Partial<GetMethodOptions> = {},\n ): Promise<V[]> =>\n await aItemAPI.all(query, options, []) as V[];\n\n const allAction =\n async (\n action: string,\n body: any = {},\n options: Partial<PostMethodOptions> = {},\n ): Promise<V[]> =>\n await aItemAPI.allAction(action, body, options, []) as V[];\n\n const one =\n async (\n query: ItemQuery = {} as ItemQuery,\n options: Partial<GetMethodOptions> = {},\n ): Promise<V | null> =>\n await aItemAPI.one(query, options, []) as V | null;\n\n const get =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n options: Partial<GetMethodOptions> = {},\n ): Promise<V | null> =>\n await aItemAPI.get(ik, options) as V | null;\n\n const create =\n async (\n item: TypesProperties<V, S>,\n options: Partial<PostMethodOptions> = {},\n ): Promise<V> =>\n await aItemAPI.create(item, options, []) as V;\n\n const remove =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n options: Partial<DeleteMethodOptions> = {},\n ): Promise<boolean> =>\n await aItemAPI.remove(ik, options) 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 options: Partial<PutMethodOptions> = {},\n ): Promise<V> =>\n await aItemAPI.update(ik, item, options) as V;\n\n const facet =\n async (\n ik: PriKey<S> | ComKey<S, never, never, never, never, never>,\n facet: string,\n options: Partial<GetMethodOptions> = {},\n ): Promise<any> =>\n await aItemAPI.facet(ik, facet, options) 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 options: Partial<GetMethodOptions> = {},\n ): Promise<V[]> =>\n await aItemAPI.find(finder, finderParams, options, []) 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 options: Partial<GetMethodOptions> = {},\n ): Promise<V> =>\n await aItemAPI.findOne(finder, finderParams, options, []) as V;\n\n return {\n ...aItemAPI,\n action,\n all,\n allAction,\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","one","create","item","remove","update","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
9
9
  const LibLogger = Logging.getLogger('@fjell/client-api');
10
10
 
11
- const logger$c = LibLogger.get('client-api', 'ops', 'all');
11
+ const logger$e = LibLogger.get('client-api', 'ops', 'all');
12
12
  const getAllOperation = (api, apiOptions, utilities)=>{
13
13
  const all = async (query = {}, options = {}, locations = [])=>{
14
- logger$c.default('all', {
14
+ logger$e.default('all', {
15
15
  query,
16
16
  locations
17
17
  });
@@ -27,10 +27,10 @@ const getAllOperation = (api, apiOptions, utilities)=>{
27
27
  return all;
28
28
  };
29
29
 
30
- const logger$b = LibLogger.get('client-api', 'ops', 'action');
30
+ const logger$d = LibLogger.get('client-api', 'ops', 'action');
31
31
  const getActionOperation = (api, apiOptions, utilities)=>{
32
32
  const action = async (ik, action, body = {}, options = {})=>{
33
- logger$b.default('action', {
33
+ logger$d.default('action', {
34
34
  ik,
35
35
  action,
36
36
  body
@@ -43,10 +43,10 @@ const getActionOperation = (api, apiOptions, utilities)=>{
43
43
  return action;
44
44
  };
45
45
 
46
- const logger$a = LibLogger.get('client-api', 'ops', 'allAction');
46
+ const logger$c = LibLogger.get('client-api', 'ops', 'allAction');
47
47
  const getAllActionOperation = (api, apiOptions, utilities)=>{
48
48
  const allAction = async (action, body = {}, options = {}, locations = [])=>{
49
- logger$a.default('allAction', {
49
+ logger$c.default('allAction', {
50
50
  action,
51
51
  body,
52
52
  locations
@@ -62,10 +62,10 @@ const getAllActionOperation = (api, apiOptions, utilities)=>{
62
62
  return allAction;
63
63
  };
64
64
 
65
- const logger$9 = LibLogger.get('client-api', 'ops', 'one');
65
+ const logger$b = LibLogger.get('client-api', 'ops', 'one');
66
66
  const getOneOperation = (api, apiOptions, utilities)=>{
67
67
  const one = async (query = {}, options = {}, locations = [])=>{
68
- logger$9.default('one', {
68
+ logger$b.default('one', {
69
69
  query,
70
70
  locations
71
71
  });
@@ -86,10 +86,10 @@ const getOneOperation = (api, apiOptions, utilities)=>{
86
86
  return one;
87
87
  };
88
88
 
89
- const logger$8 = LibLogger.get('client-api', 'ops', 'create');
89
+ const logger$a = LibLogger.get('client-api', 'ops', 'create');
90
90
  const getCreateOperation = (api, apiOptions, utilities)=>{
91
91
  const create = async (item, options = {}, locations = [])=>{
92
- logger$8.default('create', {
92
+ logger$a.default('create', {
93
93
  item,
94
94
  locations
95
95
  });
@@ -104,10 +104,10 @@ const getCreateOperation = (api, apiOptions, utilities)=>{
104
104
  return create;
105
105
  };
106
106
 
107
- const logger$7 = LibLogger.get('client-api', 'ops', 'update');
107
+ const logger$9 = LibLogger.get('client-api', 'ops', 'update');
108
108
  const getUpdateOperation = (api, apiOptions, utilities)=>{
109
109
  const update = async (ik, item, options = {})=>{
110
- logger$7.default('update', {
110
+ logger$9.default('update', {
111
111
  ik,
112
112
  item
113
113
  });
@@ -119,10 +119,10 @@ const getUpdateOperation = (api, apiOptions, utilities)=>{
119
119
  return update;
120
120
  };
121
121
 
122
- const logger$6 = LibLogger.get('client-api', 'ops', 'get');
122
+ const logger$8 = LibLogger.get('client-api', 'ops', 'get');
123
123
  const getGetOperation = (api, apiOptions, utilities)=>{
124
124
  const get = async (ik, options = {})=>{
125
- logger$6.default('get', {
125
+ logger$8.default('get', {
126
126
  ik
127
127
  });
128
128
  const requestOptions = Object.assign({}, options, {
@@ -133,10 +133,10 @@ const getGetOperation = (api, apiOptions, utilities)=>{
133
133
  return get;
134
134
  };
135
135
 
136
- const logger$5 = LibLogger.get('client-api', 'ops', 'remove');
136
+ const logger$7 = LibLogger.get('client-api', 'ops', 'remove');
137
137
  const getRemoveOperation = (api, apiOptions, utilities)=>{
138
138
  const remove = async (ik, options = {})=>{
139
- logger$5.default('remove', {
139
+ logger$7.default('remove', {
140
140
  ik
141
141
  });
142
142
  const requestOptions = Object.assign({}, options, {
@@ -147,10 +147,10 @@ const getRemoveOperation = (api, apiOptions, utilities)=>{
147
147
  return remove;
148
148
  };
149
149
 
150
- const logger$4 = LibLogger.get('client-api', 'ops', 'find');
150
+ const logger$6 = LibLogger.get('client-api', 'ops', 'find');
151
151
  const getFindOperation = (api, apiOptions, utilities)=>{
152
152
  const find = async (finder, finderParams, options = {}, locations = [])=>{
153
- logger$4.default('find', {
153
+ logger$6.default('find', {
154
154
  finder,
155
155
  finderParams,
156
156
  locations
@@ -167,12 +167,63 @@ const getFindOperation = (api, apiOptions, utilities)=>{
167
167
  return find;
168
168
  };
169
169
 
170
+ const logger$5 = LibLogger.get('client-api', 'ops', 'find');
171
+ const getFindOneOperation = (api, apiOptions, utilities)=>{
172
+ const findOne = async (finder, finderParams, options = {}, locations = [])=>{
173
+ logger$5.default('findOne', {
174
+ finder,
175
+ finderParams,
176
+ locations
177
+ });
178
+ utilities.verifyLocations(locations);
179
+ const loc = locations;
180
+ const params = finderToParams(finder, finderParams);
181
+ params.one = true;
182
+ const requestOptions = Object.assign({}, options, {
183
+ isAuthenticated: apiOptions.allAuthenticated,
184
+ params
185
+ });
186
+ return utilities.validatePK(await utilities.processArray(api.httpGet(utilities.getPath(loc), requestOptions)))[0];
187
+ };
188
+ return findOne;
189
+ };
190
+
191
+ const logger$4 = LibLogger.get('client-api', 'ops', 'facet');
192
+ const getFacetOperation = (api, apiOptions, utilities)=>{
193
+ /**
194
+ * Executes a facet operation on an item.
195
+ *
196
+ * A facet is a piece of information that is related to an item - it represents
197
+ * a specific aspect or characteristic of the item. Unlike actions which may
198
+ * return items or perform operations, facets are informational queries that
199
+ * return data about a particular facet of an item.
200
+ *
201
+ * @param ik - The item key (composite or primary key) identifying the item
202
+ * @param facet - The name of the facet to query
203
+ * @param body - Optional request body for the facet operation
204
+ * @param options - Optional HTTP request options
205
+ * @returns Promise resolving to the facet data
206
+ */ const facet = async (ik, facet, options = {})=>{
207
+ logger$4.default('facet', {
208
+ ik,
209
+ facet
210
+ });
211
+ const requestOptions = Object.assign({}, options, {
212
+ isAuthenticated: apiOptions.writeAuthenticated
213
+ });
214
+ return api.httpGet(`${utilities.getPath(ik)}/${facet}`, requestOptions);
215
+ };
216
+ return facet;
217
+ };
218
+
170
219
  const getOperations = (api, apiOptions, utilities)=>{
171
220
  return {
172
221
  action: getActionOperation(api, apiOptions, utilities),
173
222
  all: getAllOperation(api, apiOptions, utilities),
174
223
  allAction: getAllActionOperation(api, apiOptions, utilities),
175
224
  create: getCreateOperation(api, apiOptions, utilities),
225
+ facet: getFacetOperation(api, apiOptions, utilities),
226
+ findOne: getFindOneOperation(api, apiOptions, utilities),
176
227
  find: getFindOperation(api, apiOptions, utilities),
177
228
  get: getGetOperation(api, apiOptions, utilities),
178
229
  one: getOneOperation(api, apiOptions, utilities),
@@ -359,7 +410,9 @@ const createAItemAPI = (api, pkType, pathNames, options)=>{
359
410
  all: operations.all,
360
411
  allAction: operations.allAction,
361
412
  create: operations.create,
413
+ facet: operations.facet,
362
414
  find: operations.find,
415
+ findOne: operations.findOne,
363
416
  get: operations.get,
364
417
  one: operations.one,
365
418
  remove: operations.remove,
@@ -385,7 +438,9 @@ const createCItemApi = (api, type, pathNames, options)=>{
385
438
  create: aItemAPI.create,
386
439
  remove: aItemAPI.remove,
387
440
  update: aItemAPI.update,
388
- find: aItemAPI.find
441
+ facet: aItemAPI.facet,
442
+ find: aItemAPI.find,
443
+ findOne: aItemAPI.findOne
389
444
  };
390
445
  };
391
446
 
@@ -407,7 +462,9 @@ const createPItemApi = (api, type, pathName, options)=>{
407
462
  const create = async (item, options = {})=>await aItemAPI.create(item, options, []);
408
463
  const remove = async (ik, options = {})=>await aItemAPI.remove(ik, options);
409
464
  const update = async (ik, item, options = {})=>await aItemAPI.update(ik, item, options);
465
+ const facet = async (ik, facet, options = {})=>await aItemAPI.facet(ik, facet, options);
410
466
  const find = async (finder, finderParams, options = {})=>await aItemAPI.find(finder, finderParams, options, []);
467
+ const findOne = async (finder, finderParams, options = {})=>await aItemAPI.findOne(finder, finderParams, options, []);
411
468
  return {
412
469
  ...aItemAPI,
413
470
  action,
@@ -418,7 +475,9 @@ const createPItemApi = (api, type, pathName, options)=>{
418
475
  create,
419
476
  remove,
420
477
  update,
421
- find
478
+ facet,
479
+ find,
480
+ findOne
422
481
  };
423
482
  };
424
483