@mxpicture/gcp-functions-common 0.2.29 → 0.2.31

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.
@@ -0,0 +1,6 @@
1
+ import { AnnotationsError, AnnotationsHeader, AnnotationsProperty } from "../types/types.annotation.js";
2
+ import { ValidationResultFields } from "../types/types.validation.js";
3
+ export declare const annoProperty: (propertyKey: string, headerOrProps: AnnotationsHeader | AnnotationsProperty[]) => AnnotationsProperty | null;
4
+ export declare const annoPropertyTitle: (propertyKey: string, headerOrProps: AnnotationsHeader | AnnotationsProperty[]) => string;
5
+ export declare const annoPropertyError: (propertyKey: string, headerOrProps: AnnotationsHeader | AnnotationsProperty[], errorFields: ValidationResultFields) => AnnotationsError | undefined;
6
+ //# sourceMappingURL=helper.annotation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.annotation.d.ts","sourceRoot":"","sources":["../../src/helper/helper.annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,eAAO,MAAM,YAAY,GACvB,aAAa,MAAM,EACnB,eAAe,iBAAiB,GAAG,mBAAmB,EAAE,KACvD,mBAAmB,GAAG,IAMxB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,aAAa,MAAM,EACnB,eAAe,iBAAiB,GAAG,mBAAmB,EAAE,KACvD,MAAwE,CAAC;AAE5E,eAAO,MAAM,iBAAiB,GAC5B,aAAa,MAAM,EACnB,eAAe,iBAAiB,GAAG,mBAAmB,EAAE,EACxD,aAAa,sBAAsB,KAClC,gBAAgB,GAAG,SAQrB,CAAC"}
@@ -0,0 +1,18 @@
1
+ export const annoProperty = (propertyKey, headerOrProps) => {
2
+ const properties = Array.isArray(headerOrProps)
3
+ ? headerOrProps
4
+ : headerOrProps.properties;
5
+ return properties.find((prop) => prop.propertyKey == propertyKey) ?? null;
6
+ };
7
+ export const annoPropertyTitle = (propertyKey, headerOrProps) => annoProperty(propertyKey, headerOrProps)?.title ?? propertyKey;
8
+ export const annoPropertyError = (propertyKey, headerOrProps, errorFields) => {
9
+ const errors = errorFields[propertyKey];
10
+ if (!errors)
11
+ return undefined;
12
+ return {
13
+ propertyKey,
14
+ title: annoPropertyTitle(propertyKey, headerOrProps),
15
+ error: errors.join("\n"),
16
+ };
17
+ };
18
+ //# sourceMappingURL=helper.annotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.annotation.js","sourceRoot":"","sources":["../../src/helper/helper.annotation.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,WAAmB,EACnB,aAAwD,EAC5B,EAAE;IAC9B,MAAM,UAAU,GAA0B,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC;QACpE,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC;IAE7B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,IAAI,IAAI,CAAC;AAC5E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,WAAmB,EACnB,aAAwD,EAChD,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,aAAa,CAAC,EAAE,KAAK,IAAI,WAAW,CAAC;AAE5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,WAAmB,EACnB,aAAwD,EACxD,WAAmC,EACL,EAAE;IAChC,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,OAAO;QACL,WAAW;QACX,KAAK,EAAE,iBAAiB,CAAC,WAAW,EAAE,aAAa,CAAC;QACpD,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;KACzB,CAAC;AACJ,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ export * from "./helper.annotation.js";
1
2
  export * from "./helper.document.js";
2
3
  export * from "./helper.object.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  // This file is auto-generated by build-cli. Do not edit manually.
2
+ export * from "./helper.annotation.js";
2
3
  export * from "./helper.document.js";
3
4
  export * from "./helper.object.js";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -14,4 +14,10 @@ export interface AnnotationsHeader {
14
14
  routes: AnnotationsRoute[];
15
15
  }
16
16
  export declare const stripAnnotationsHeader: (header: AnnotationsHeader, deepStrip?: boolean) => AnnotationsHeader;
17
+ export interface AnnotationsError {
18
+ propertyKey: string;
19
+ title: string;
20
+ error: string;
21
+ }
22
+ export declare const stripAnnotationsError: (error: AnnotationsError) => AnnotationsError;
17
23
  //# sourceMappingURL=types.annotation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.annotation.d.ts","sourceRoot":"","sources":["../../src/types/types.annotation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EAGvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EAKhB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,IAAI,EAAE,MAAM,CAAC;CACd;AAWD,eAAO,MAAM,qBAAqB,GAAI,OAAO,gBAAgB,qBACD,CAAC;AAG7D,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE,WAAW,EAAE,MAAM,sBAAsB,CAAC;CAC3C;AAED,eAAO,MAAM,wBAAwB,GACnC,MAAM,mBAAmB,KACxB,mBAeF,CAAC;AAGF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAWD,eAAO,MAAM,sBAAsB,GACjC,QAAQ,iBAAiB,EACzB,YAAW,OAAe,KACzB,iBAMF,CAAC"}
1
+ {"version":3,"file":"types.annotation.d.ts","sourceRoot":"","sources":["../../src/types/types.annotation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EAGvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EAKhB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,IAAI,EAAE,MAAM,CAAC;CACd;AAWD,eAAO,MAAM,qBAAqB,GAAI,OAAO,gBAAgB,qBACD,CAAC;AAG7D,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE,WAAW,EAAE,MAAM,sBAAsB,CAAC;CAC3C;AAED,eAAO,MAAM,wBAAwB,GACnC,MAAM,mBAAmB,KACxB,mBAeF,CAAC;AAGF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAWD,eAAO,MAAM,sBAAsB,GACjC,QAAQ,iBAAiB,EACzB,YAAW,OAAe,KACzB,iBAMF,CAAC;AAGF,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAWD,eAAO,MAAM,qBAAqB,GAChC,OAAO,gBAAgB,KACtB,gBACyD,CAAC"}
@@ -35,28 +35,11 @@ export const stripAnnotationsHeader = (header, deepStrip = false) => {
35
35
  }
36
36
  return stripObject(header, annotationsHeaderKeys);
37
37
  };
38
- // AnnotationsFile ----------------------------------------------------
39
- // export interface AnnotationsFile {
40
- // templateFilePath: string;
41
- // templateRepoFilePath: string;
42
- // headers: AnnotationsHeader[];
43
- // }
44
- // const annotationsFile: Required<AnnotationsFile> = {
45
- // templateFilePath: undefined!,
46
- // templateRepoFilePath: undefined!,
47
- // headers: undefined!,
48
- // };
49
- // const annotationsFileKeys = Object.keys(
50
- // annotationsFile,
51
- // ) as (keyof AnnotationsFile)[];
52
- // export const stripAnnotationsFile = (
53
- // file: AnnotationsFile,
54
- // deepStrip: boolean = false,
55
- // ): AnnotationsFile => {
56
- // if (deepStrip)
57
- // file.headers = file.headers.map((header) =>
58
- // stripAnnotationsHeader(header, deepStrip),
59
- // );
60
- // return stripObject<AnnotationsFile>(file, annotationsFileKeys);
61
- // };
38
+ const annotationsError = {
39
+ propertyKey: undefined,
40
+ title: undefined,
41
+ error: undefined,
42
+ };
43
+ const annotationsErrorKeys = Object.keys(annotationsError);
44
+ export const stripAnnotationsError = (error) => stripObject(error, annotationsErrorKeys);
62
45
  //# sourceMappingURL=types.annotation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.annotation.js","sourceRoot":"","sources":["../../src/types/types.annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4B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IACtB,MAAM,EAAE,SAAU;CACnB,CAAC;AACF,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CACvC,iBAAiB,CACa,CAAC;AAEjC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,MAAyB,EACzB,YAAqB,KAAK,EACP,EAAE;IACrB,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QACzD,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,WAAW,CAAoB,MAAM,EAAE,qBAAqB,CAAC,CAAC;AACvE,CAAC,CAAC;AACF,uEAAuE;AACvE,qCAAqC;AACrC,8BAA8B;AAC9B,kCAAkC;AAClC,kCAAkC;AAClC,IAAI;AAEJ,uDAAuD;AACvD,kCAAkC;AAClC,sCAAsC;AACtC,yBAAyB;AACzB,KAAK;AACL,2CAA2C;AAC3C,qBAAqB;AACrB,kCAAkC;AAElC,wCAAwC;AACxC,2BAA2B;AAC3B,gCAAgC;AAChC,0BAA0B;AAC1B,mBAAmB;AACnB,kDAAkD;AAClD,mDAAmD;AACnD,SAAS;AACT,oEAAoE;AACpE,KAAK"}
1
+ {"version":3,"file":"types.annotation.js","sourceRoot":"","sources":["../../src/types/types.annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAEL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGL,uBAAuB,EAEvB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,gBAAgB,GAA+B;IACnD,IAAI,EAAE,SAAU;IAChB,WAAW,EAAE,SAAU;IACvB,YAAY,EAAE,SAAU;CACzB,CAAC;AACF,MAAM,oBAAoB,GAAG,MAAM,CAAC,I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C;QACzD,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,WAAW,CAAoB,MAAM,EAAE,qBAAqB,CAAC,CAAC;AACvE,CAAC,CAAC;AASF,MAAM,gBAAgB,GAA+B;IACnD,WAAW,EAAE,SAAU;IACvB,KAAK,EAAE,SAAU;IACjB,KAAK,EAAE,SAAU;CAClB,CAAC;AACF,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CACtC,gBAAgB,CACa,CAAC;AAEhC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,KAAuB,EACL,EAAE,CACpB,WAAW,CAAmB,KAAK,EAAE,oBAAoB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mxpicture/gcp-functions-common",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
4
4
  "description": "Utils for google cloud functions, publishing both CommonJS and ESM builds",
5
5
  "type": "module",
6
6
  "author": "MXPicture",