@mxpicture/gcp-functions-frontend 0.1.44 → 0.1.46

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.
@@ -1,21 +1 @@
1
- import type { MetaItem } from "@mxpicture/zod-meta";
2
- import type { DocumentData, WithKey, CallbackAble, ApiFromRoutes, CrudRoutes, WithoutKey, DocumentKey, ApiFilter } from "@mxpicture/gcp-functions-common/types";
3
- import { IFrontendApi } from "./IFrontendApi.js";
4
- import { FrontendFunction } from "../function/FrontendFunction.js";
5
- export declare class FrontendApi<DTO extends DocumentData, FUNC extends FrontendFunction<DTO>> extends IFrontendApi<DTO, FUNC> implements ApiFromRoutes<CrudRoutes<DTO>> {
6
- constructor(funcC: CallbackAble<FUNC>);
7
- delete(request: DocumentKey): Promise<{
8
- deleted: true;
9
- }>;
10
- get(request: DocumentKey): Promise<WithKey<DTO>>;
11
- query(request?: ApiFilter | null): Promise<WithKey<DTO>[]>;
12
- count(request?: ApiFilter | null): Promise<{
13
- count: number;
14
- }>;
15
- exists(request: DocumentKey): Promise<{
16
- exists: boolean;
17
- }>;
18
- meta(): Promise<MetaItem[]>;
19
- create(request: WithoutKey<DTO>): Promise<WithKey<DTO>>;
20
- update(request: WithKey<Partial<DTO>>): Promise<WithKey<DTO>>;
21
- }
1
+ export {};
@@ -1,30 +1,50 @@
1
- import { IFrontendApi } from "./IFrontendApi.js";
2
- export class FrontendApi extends IFrontendApi {
3
- constructor(funcC) {
4
- super(funcC);
5
- }
6
- async delete(request) {
7
- return (await (await this.func()).delete(request)).data;
8
- }
9
- async get(request) {
10
- return (await (await this.func()).get(request)).data;
11
- }
12
- async query(request) {
13
- return (await (await this.func()).query(request)).data;
14
- }
15
- async count(request) {
16
- return (await (await this.func()).count(request)).data;
17
- }
18
- async exists(request) {
19
- return (await (await this.func()).exists(request)).data;
20
- }
21
- async meta() {
22
- return (await (await this.func()).meta()).data;
23
- }
24
- async create(request) {
25
- return (await (await this.func()).create(request)).data;
26
- }
27
- async update(request) {
28
- return (await (await this.func()).update(request)).data;
29
- }
30
- }
1
+ // todo not needed?
2
+ // import type { MetaItem } from "@mxpicture/zod-meta";
3
+ // import type {
4
+ // DocumentData,
5
+ // WithKey,
6
+ // CallbackAble,
7
+ // ApiFromRoutes,
8
+ // CrudRoutes,
9
+ // WithoutKey,
10
+ // DocumentKey,
11
+ // ApiFilter,
12
+ // } from "@mxpicture/gcp-functions-common/types";
13
+ // import { IFrontendApi } from "./IFrontendApi.js";
14
+ // import { FrontendFunction } from "../function/FrontendFunction.js";
15
+ export {};
16
+ // export class FrontendApi<
17
+ // DTO extends DocumentData,
18
+ // FUNC extends FrontendFunction<DTO>,
19
+ // >
20
+ // extends IFrontendApi<DTO, FUNC>
21
+ // implements ApiFromRoutes<CrudRoutes<DTO>>
22
+ // {
23
+ // public constructor(funcC: CallbackAble<FUNC>) {
24
+ // super(funcC);
25
+ // }
26
+ // public async delete(request: DocumentKey): Promise<{ deleted: true }> {
27
+ // return (await (await this.func()).delete(request)).data;
28
+ // }
29
+ // public async get(request: DocumentKey): Promise<WithKey<DTO>> {
30
+ // return (await (await this.func()).get(request)).data;
31
+ // }
32
+ // public async query(request?: ApiFilter | null): Promise<WithKey<DTO>[]> {
33
+ // return (await (await this.func()).query(request)).data;
34
+ // }
35
+ // public async count(request?: ApiFilter | null): Promise<{ count: number }> {
36
+ // return (await (await this.func()).count(request)).data;
37
+ // }
38
+ // public async exists(request: DocumentKey): Promise<{ exists: boolean }> {
39
+ // return (await (await this.func()).exists(request)).data;
40
+ // }
41
+ // public async meta(): Promise<MetaItem[]> {
42
+ // return (await (await this.func()).meta()).data;
43
+ // }
44
+ // public async create(request: WithoutKey<DTO>): Promise<WithKey<DTO>> {
45
+ // return (await (await this.func()).create(request)).data;
46
+ // }
47
+ // public async update(request: WithKey<Partial<DTO>>): Promise<WithKey<DTO>> {
48
+ // return (await (await this.func()).update(request)).data;
49
+ // }
50
+ // }
@@ -1,6 +1,6 @@
1
- import type { DocumentData, CallbackAble } from "@mxpicture/gcp-functions-common/types";
2
- import { FrontendFunction } from "../function/FrontendFunction.js";
3
- export declare class IFrontendApi<DTO extends DocumentData, FUNC extends FrontendFunction<DTO>> {
1
+ import type { CallbackAble } from "@mxpicture/gcp-functions-common/types";
2
+ import { IFrontendFunction } from "../function/IFrontendFunction.js";
3
+ export declare class IFrontendApi<FUNC extends IFrontendFunction> {
4
4
  protected funcC: CallbackAble<FUNC>;
5
5
  protected _func?: FUNC;
6
6
  protected constructor(funcC: CallbackAble<FUNC>);
@@ -1,2 +1 @@
1
- export { FrontendApi } from "./FrontendApi.js";
2
1
  export { IFrontendApi } from "./IFrontendApi.js";
package/dist/api/index.js CHANGED
@@ -1,2 +1 @@
1
- export { FrontendApi } from "./FrontendApi.js";
2
1
  export { IFrontendApi } from "./IFrontendApi.js";
@@ -1,20 +1 @@
1
- import type { DocumentData, CrudRoutes, FunctionFromRoutes, ApiFilter, DocumentKey, FunctionResponse, WithKey, WithoutKey } from "@mxpicture/gcp-functions-common/types";
2
- import { IFrontendFunction } from "./IFrontendFunction.js";
3
- import { MetaItem } from "@mxpicture/zod-meta";
4
- export declare class FrontendFunction<DTO extends DocumentData> extends IFrontendFunction implements FunctionFromRoutes<CrudRoutes<DTO>> {
5
- constructor(name: string, additionalRoutes?: string[]);
6
- create(request: WithoutKey<DTO>): Promise<FunctionResponse<WithKey<DTO>>>;
7
- update(request: WithKey<Partial<DTO>>): Promise<FunctionResponse<WithKey<DTO>>>;
8
- delete(request: DocumentKey): Promise<FunctionResponse<{
9
- deleted: true;
10
- }>>;
11
- get(request: DocumentKey): Promise<FunctionResponse<WithKey<DTO>>>;
12
- query(request: ApiFilter | null | undefined): Promise<FunctionResponse<WithKey<DTO>[]>>;
13
- count(request: ApiFilter | null | undefined): Promise<FunctionResponse<{
14
- count: number;
15
- }>>;
16
- exists(request: DocumentKey): Promise<FunctionResponse<{
17
- exists: boolean;
18
- }>>;
19
- meta(): Promise<FunctionResponse<MetaItem[]>>;
20
- }
1
+ export {};
@@ -1,31 +1,61 @@
1
- import { IFrontendFunction } from "./IFrontendFunction.js";
2
- import { CRUD_ROUTES } from "@mxpicture/gcp-functions-common/config";
3
- export class FrontendFunction extends IFrontendFunction {
4
- constructor(name, additionalRoutes) {
5
- super(name, [...CRUD_ROUTES, ...(additionalRoutes ?? [])]);
6
- }
7
- async create(request) {
8
- return this.outgress({ data: request, route: "create" });
9
- }
10
- async update(request) {
11
- return this.outgress({ data: request, route: "update" });
12
- }
13
- async delete(request) {
14
- return this.outgress({ data: request, route: "delete" });
15
- }
16
- async get(request) {
17
- return this.outgress({ data: request, route: "get" });
18
- }
19
- async query(request) {
20
- return this.outgress({ data: request, route: "query" });
21
- }
22
- async count(request) {
23
- return this.outgress({ data: request, route: "count" });
24
- }
25
- async exists(request) {
26
- return this.outgress({ data: request, route: "exists" });
27
- }
28
- async meta() {
29
- return this.outgress({ data: null, route: "meta" });
30
- }
31
- }
1
+ // todo not needed?
2
+ // import type {
3
+ // DocumentData,
4
+ // CrudRoutes,
5
+ // FunctionFromRoutes,
6
+ // ApiFilter,
7
+ // DocumentKey,
8
+ // FunctionResponse,
9
+ // WithKey,
10
+ // WithoutKey,
11
+ // } from "@mxpicture/gcp-functions-common/types";
12
+ // import { IFrontendFunction } from "./IFrontendFunction.js";
13
+ // import { MetaItem } from "@mxpicture/zod-meta";
14
+ // import { CRUD_ROUTES } from "@mxpicture/gcp-functions-common/config";
15
+ export {};
16
+ // export class FrontendFunction<DTO extends DocumentData>
17
+ // extends IFrontendFunction
18
+ // implements FunctionFromRoutes<CrudRoutes<DTO>>
19
+ // {
20
+ // public constructor(name: string, additionalRoutes?: string[]) {
21
+ // super(name, [...CRUD_ROUTES, ...(additionalRoutes ?? [])]);
22
+ // }
23
+ // public async create(
24
+ // request: WithoutKey<DTO>,
25
+ // ): Promise<FunctionResponse<WithKey<DTO>>> {
26
+ // return this.outgress({ data: request, route: "create" });
27
+ // }
28
+ // public async update(
29
+ // request: WithKey<Partial<DTO>>,
30
+ // ): Promise<FunctionResponse<WithKey<DTO>>> {
31
+ // return this.outgress({ data: request, route: "update" });
32
+ // }
33
+ // public async delete(
34
+ // request: DocumentKey,
35
+ // ): Promise<FunctionResponse<{ deleted: true }>> {
36
+ // return this.outgress({ data: request, route: "delete" });
37
+ // }
38
+ // public async get(
39
+ // request: DocumentKey,
40
+ // ): Promise<FunctionResponse<WithKey<DTO>>> {
41
+ // return this.outgress({ data: request, route: "get" });
42
+ // }
43
+ // public async query(
44
+ // request: ApiFilter | null | undefined,
45
+ // ): Promise<FunctionResponse<WithKey<DTO>[]>> {
46
+ // return this.outgress({ data: request, route: "query" });
47
+ // }
48
+ // public async count(
49
+ // request: ApiFilter | null | undefined,
50
+ // ): Promise<FunctionResponse<{ count: number }>> {
51
+ // return this.outgress({ data: request, route: "count" });
52
+ // }
53
+ // public async exists(
54
+ // request: DocumentKey,
55
+ // ): Promise<FunctionResponse<{ exists: boolean }>> {
56
+ // return this.outgress({ data: request, route: "exists" });
57
+ // }
58
+ // public async meta(): Promise<FunctionResponse<MetaItem[]>> {
59
+ // return this.outgress({ data: null, route: "meta" });
60
+ // }
61
+ // }
@@ -1,2 +1 @@
1
- export { FrontendFunction } from "./FrontendFunction.js";
2
1
  export { IFrontendFunction } from "./IFrontendFunction.js";
@@ -1,2 +1 @@
1
- export { FrontendFunction } from "./FrontendFunction.js";
2
1
  export { IFrontendFunction } from "./IFrontendFunction.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mxpicture/gcp-functions-frontend",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "description": "Utils for google cloud functions, publishing both CommonJS and ESM builds",
5
5
  "type": "module",
6
6
  "author": "MXPicture",