@activepieces/pieces-common 0.2.31 → 0.2.32

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activepieces/pieces-common",
3
- "version": "0.2.31",
3
+ "version": "0.2.32",
4
4
  "type": "commonjs",
5
5
  "dependencies": {
6
6
  "@anthropic-ai/sdk": "0.27.3",
@@ -1,30 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.propsValidation = void 0;
4
+ const zod_1 = require("zod");
4
5
  exports.propsValidation = {
5
6
  validateZod(props, schema) {
6
- /* const schemaObj = z.object(
7
- Object.entries(schema).reduce((acc, [key, value]) => ({
8
- ...acc,
9
- [key]: value
10
- }), {})
11
- )
12
-
13
- try {
14
- schemaObj.parse(props)
15
- } catch (error) {
16
- if (error instanceof z.ZodError) {
17
- const errors = error.errors.reduce((acc, err) => {
18
- const path = err.path.join('.')
19
- return {
20
- ...acc,
21
- [path]: err.message
22
- }
23
- }, {})
24
- throw new Error(JSON.stringify({ errors }, null, 2))
25
- }
26
- throw error
27
- }*/
7
+ const schemaObj = zod_1.z.object(Object.entries(schema).reduce((acc, [key, value]) => (Object.assign(Object.assign({}, acc), { [key]: value })), {}));
8
+ try {
9
+ schemaObj.parse(props);
10
+ }
11
+ catch (error) {
12
+ if (error instanceof zod_1.z.ZodError) {
13
+ const errors = error.errors.reduce((acc, err) => {
14
+ const path = err.path.join('.');
15
+ return Object.assign(Object.assign({}, acc), { [path]: err.message });
16
+ }, {});
17
+ throw new Error(JSON.stringify({ errors }, null, 2));
18
+ }
19
+ throw error;
20
+ }
28
21
  }
29
22
  };
30
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/common/src/lib/validation/index.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAG;IAC3B,WAAW,CAAoC,KAAQ,EAAE,MAA2C;QAClG;;;;;;;;;;;;;;;;;;;;;aAqBK;IACP,CAAC;CACJ,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/common/src/lib/validation/index.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,eAAe,GAAG;IAC3B,WAAW,CAAoC,KAAQ,EAAE,MAA2C;QAChG,MAAM,SAAS,GAAG,OAAC,CAAC,MAAM,CACtB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,iCAC9C,GAAG,KACN,CAAC,GAAG,CAAC,EAAE,KAAK,IACd,EAAE,EAAE,CAAC,CACV,CAAA;QAED,IAAI,CAAC;YACD,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,KAAK,YAAY,OAAC,CAAC,QAAQ,EAAE,CAAC;gBAC9B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;oBAC5C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;oBAC/B,uCACO,GAAG,KACN,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,IACtB;gBACL,CAAC,EAAE,EAAE,CAAC,CAAA;gBACN,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;YACxD,CAAC;YACD,MAAM,KAAK,CAAA;QACf,CAAC;IACL,CAAC;CACJ,CAAA"}