@mxpicture/gcp-functions-common 0.2.61 → 0.2.62
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.
|
@@ -3,8 +3,8 @@ import { AnnotationsError, AnnotationsHeader, AnnotationsProperty } from "../typ
|
|
|
3
3
|
import { DocumentData } from "../types/types.document.js";
|
|
4
4
|
import { ValidationResultFields } from "../types/types.validation.js";
|
|
5
5
|
export declare const annoProperty: (propertyKey: string, headerOrProps: AnnotationsHeader | AnnotationsProperty[]) => AnnotationsProperty | null;
|
|
6
|
-
export declare const annoPropertyTitle: (propertyKey: keyof AnnotationsProperty, headerOrProps: AnnotationsHeader | AnnotationsProperty[], type
|
|
7
|
-
export declare const annoPropertyBase: <T>(propertyKey: keyof AnnotationsProperty, headerOrProps: AnnotationsHeader | AnnotationsProperty[], type: MetaFacetItemType, fallback: T) => T;
|
|
8
|
-
export declare const annoPropertyError: (propertyKey: keyof AnnotationsProperty, headerOrProps: AnnotationsHeader | AnnotationsProperty[], errorFields: ValidationResultFields, type
|
|
6
|
+
export declare const annoPropertyTitle: (propertyKey: keyof AnnotationsProperty, headerOrProps: AnnotationsHeader | AnnotationsProperty[], type?: MetaFacetItemType | "*") => string;
|
|
7
|
+
export declare const annoPropertyBase: <T>(propertyKey: keyof AnnotationsProperty, headerOrProps: AnnotationsHeader | AnnotationsProperty[], type: (MetaFacetItemType | "*") | undefined, fallback: T) => T;
|
|
8
|
+
export declare const annoPropertyError: (propertyKey: keyof AnnotationsProperty, headerOrProps: AnnotationsHeader | AnnotationsProperty[], errorFields: ValidationResultFields, type?: MetaFacetItemType | "*") => AnnotationsError | undefined;
|
|
9
9
|
export declare const annoDocInitial: <T extends DocumentData>(properties: AnnotationsProperty[]) => Partial<T>;
|
|
10
10
|
//# sourceMappingURL=helper.annotation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.annotation.d.ts","sourceRoot":"","sources":["../../src/helper/helper.annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAEL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,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,mBAAmB,EACtC,eAAe,iBAAiB,GAAG,mBAAmB,EAAE,EACxD,
|
|
1
|
+
{"version":3,"file":"helper.annotation.d.ts","sourceRoot":"","sources":["../../src/helper/helper.annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAEL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,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,mBAAmB,EACtC,eAAe,iBAAiB,GAAG,mBAAmB,EAAE,EACxD,OAAM,iBAAiB,GAAG,GAAS,KAClC,MAAyE,CAAC;AAE7E,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAChC,aAAa,MAAM,mBAAmB,EACtC,eAAe,iBAAiB,GAAG,mBAAmB,EAAE,EACxD,OAAM,iBAAiB,GAAG,GAAG,aAAM,EACnC,UAAU,CAAC,KACV,CAkBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,aAAa,MAAM,mBAAmB,EACtC,eAAe,iBAAiB,GAAG,mBAAmB,EAAE,EACxD,aAAa,sBAAsB,EACnC,OAAM,iBAAiB,GAAG,GAAS,KAClC,gBAAgB,GAAG,SAQrB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,YAAY,EACnD,YAAY,mBAAmB,EAAE,KAChC,OAAO,CAAC,CAAC,CAcX,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { MetaFacetItemType } from "../meta/meta.enum.js";
|
|
1
2
|
export const annoProperty = (propertyKey, headerOrProps) => {
|
|
2
3
|
const properties = Array.isArray(headerOrProps)
|
|
3
4
|
? headerOrProps
|
|
4
5
|
: headerOrProps.properties;
|
|
5
6
|
return properties.find((prop) => prop.propertyKey == propertyKey) ?? null;
|
|
6
7
|
};
|
|
7
|
-
export const annoPropertyTitle = (propertyKey, headerOrProps, type) => annoPropertyBase(propertyKey, headerOrProps, type, propertyKey);
|
|
8
|
-
export const annoPropertyBase = (propertyKey, headerOrProps, type, fallback) => {
|
|
8
|
+
export const annoPropertyTitle = (propertyKey, headerOrProps, type = "*") => annoPropertyBase(propertyKey, headerOrProps, type, propertyKey);
|
|
9
|
+
export const annoPropertyBase = (propertyKey, headerOrProps, type = "*", fallback) => {
|
|
9
10
|
const prop = annoProperty(propertyKey, headerOrProps);
|
|
10
11
|
if (!prop)
|
|
11
12
|
return fallback;
|
|
@@ -14,14 +15,16 @@ export const annoPropertyBase = (propertyKey, headerOrProps, type, fallback) =>
|
|
|
14
15
|
return fallback;
|
|
15
16
|
if (typeof res === "object") {
|
|
16
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
const
|
|
18
|
-
|
|
18
|
+
const resAny = res;
|
|
19
|
+
const typesToBeChecked = type === "*" ? Object.values(MetaFacetItemType) : [type];
|
|
20
|
+
const foundType = typesToBeChecked.find((t) => resAny[t] !== null && resAny[t] !== undefined);
|
|
21
|
+
return foundType ? resAny[foundType] : fallback;
|
|
19
22
|
}
|
|
20
23
|
if (typeof res === typeof fallback)
|
|
21
24
|
return res;
|
|
22
25
|
return fallback;
|
|
23
26
|
};
|
|
24
|
-
export const annoPropertyError = (propertyKey, headerOrProps, errorFields, type) => {
|
|
27
|
+
export const annoPropertyError = (propertyKey, headerOrProps, errorFields, type = "*") => {
|
|
25
28
|
const errors = errorFields[propertyKey];
|
|
26
29
|
if (!errors)
|
|
27
30
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.annotation.js","sourceRoot":"","sources":["../../src/helper/helper.annotation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helper.annotation.js","sourceRoot":"","sources":["../../src/helper/helper.annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAUzD,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,WAAsC,EACtC,aAAwD,EACxD,OAAgC,GAAG,EAC3B,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,WAAsC,EACtC,aAAwD,EACxD,OAAgC,GAAG,EACnC,QAAW,EACR,EAAE;IACL,MAAM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