@mxpicture/gcp-functions-common 0.2.23 → 0.2.24
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/helper/helper.validation.d.ts +4 -0
- package/dist/helper/helper.validation.d.ts.map +1 -0
- package/dist/helper/helper.validation.js +24 -0
- package/dist/helper/helper.validation.js.map +1 -0
- package/dist/helper/index.d.ts +1 -0
- package/dist/helper/index.d.ts.map +1 -1
- package/dist/helper/index.js +1 -0
- package/dist/helper/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ValidationFieldErrors, ValidationFieldsErrors } from "../types/types.validation.js";
|
|
2
|
+
export declare const guardValidationFieldsErrors: (data: unknown) => ValidationFieldsErrors | null;
|
|
3
|
+
export declare const guardValidationFieldErrors: (fields: unknown) => ValidationFieldErrors | null;
|
|
4
|
+
//# sourceMappingURL=helper.validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.validation.d.ts","sourceRoot":"","sources":["../../src/helper/helper.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,2BAA2B,GACtC,MAAM,OAAO,KACZ,sBAAsB,GAAG,IAQ3B,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,QAAQ,OAAO,KACd,qBAAqB,GAAG,IAc1B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const guardValidationFieldsErrors = (data) => {
|
|
2
|
+
if (Array.isArray(data))
|
|
3
|
+
return null;
|
|
4
|
+
const partData = data;
|
|
5
|
+
const fields = guardValidationFieldErrors(partData.fields);
|
|
6
|
+
if (!fields)
|
|
7
|
+
return null;
|
|
8
|
+
return { fields };
|
|
9
|
+
};
|
|
10
|
+
export const guardValidationFieldErrors = (fields) => {
|
|
11
|
+
if (!fields || typeof fields !== "object" || Array.isArray(fields))
|
|
12
|
+
return null;
|
|
13
|
+
const result = {};
|
|
14
|
+
for (const [fieldname, messages] of Object.entries(fields)) {
|
|
15
|
+
if (!messages || !Array.isArray(messages))
|
|
16
|
+
continue;
|
|
17
|
+
result[fieldname] = [];
|
|
18
|
+
for (const message of messages)
|
|
19
|
+
if (typeof message === "string")
|
|
20
|
+
result[fieldname].push(message);
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=helper.validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.validation.js","sourceRoot":"","sources":["../../src/helper/helper.validation.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,IAAa,EACkB,EAAE;IACjC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAErC,MAAM,QAAQ,GAAG,IAAuC,CAAC;IACzD,MAAM,MAAM,GAAG,0BAA0B,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE3D,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,MAAe,EACe,EAAE;IAChC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAChE,OAAO,IAAI,CAAC;IAEd,MAAM,MAAM,GAA0B,EAAE,CAAC;IAEzC,KAAK,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3D,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YAAE,SAAS;QAEpD,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,OAAO,IAAI,QAAQ;YAC5B,IAAI,OAAO,OAAO,KAAK,QAAQ;gBAAE,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/dist/helper/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { callableUnwrap, DOCUMENT_KEY_ADMIN_KEYS, documentKeyAdmin, } from "./helper.document.js";
|
|
2
2
|
export { stripObject } from "./helper.object.js";
|
|
3
|
+
export { guardValidationFieldErrors, guardValidationFieldsErrors, } from "./helper.validation.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,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC"}
|
package/dist/helper/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
2
|
export { callableUnwrap, DOCUMENT_KEY_ADMIN_KEYS, documentKeyAdmin, } from "./helper.document.js";
|
|
3
3
|
export { stripObject } from "./helper.object.js";
|
|
4
|
+
export { guardValidationFieldErrors, guardValidationFieldsErrors, } from "./helper.validation.js";
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/helper/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC"}
|