@activepieces/pieces-common 0.2.28 → 0.2.30
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 +4 -4
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/http/core/http-error.d.ts +4 -3
- package/src/lib/http/core/http-error.js +15 -14
- package/src/lib/http/core/http-error.js.map +1 -1
- package/src/lib/validation/index.d.ts +4 -0
- package/src/lib/validation/index.js +23 -0
- package/src/lib/validation/index.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/pieces-common",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@anthropic-ai/sdk": "0.27.3",
|
|
7
7
|
"@sinclair/typebox": "0.33.18",
|
|
8
8
|
"axios": "1.7.7",
|
|
9
9
|
"axios-retry": "4.4.1",
|
|
10
|
-
"dayjs": "1.11.9",
|
|
11
10
|
"deepmerge": "4.3.1",
|
|
12
11
|
"mime-types": "2.1.35",
|
|
13
12
|
"nanoid": "3.3.6",
|
|
14
13
|
"openai": "4.67.1",
|
|
15
14
|
"replicate": "0.34.1",
|
|
16
15
|
"semver": "7.6.0",
|
|
17
|
-
"
|
|
16
|
+
"zod": "3.23.8",
|
|
17
|
+
"@activepieces/pieces-framework": "0.7.40",
|
|
18
18
|
"@activepieces/shared": "0.10.126",
|
|
19
|
-
"tslib": "
|
|
19
|
+
"tslib": "1.14.1"
|
|
20
20
|
},
|
|
21
21
|
"overrides": {
|
|
22
22
|
"@tryfabric/martian": {
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -6,4 +6,5 @@ tslib_1.__exportStar(require("./lib/helpers"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./lib/http"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./lib/polling"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./lib/ai"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./lib/validation"), exports);
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/common/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,wDAA8B;AAC9B,qDAA2B;AAC3B,wDAA8B;AAC9B,mDAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/common/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,wDAA8B;AAC9B,qDAA2B;AAC3B,wDAA8B;AAC9B,mDAAyB;AACzB,2DAAiC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AxiosError } from 'axios';
|
|
2
2
|
export declare class HttpError extends Error {
|
|
3
|
-
private readonly
|
|
4
|
-
private readonly
|
|
5
|
-
|
|
3
|
+
private readonly requestBody;
|
|
4
|
+
private readonly status;
|
|
5
|
+
private readonly responseBody;
|
|
6
|
+
constructor(requestBody: unknown, err: AxiosError);
|
|
6
7
|
errorMessage(): {
|
|
7
8
|
response: {
|
|
8
9
|
status: number;
|
|
@@ -2,42 +2,43 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpError = void 0;
|
|
4
4
|
class HttpError extends Error {
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(requestBody, err) {
|
|
6
6
|
var _a, _b;
|
|
7
|
+
const status = ((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.status) || 500;
|
|
8
|
+
const responseBody = (_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.data;
|
|
7
9
|
super(JSON.stringify({
|
|
8
10
|
response: {
|
|
9
|
-
status:
|
|
10
|
-
body:
|
|
11
|
+
status: status,
|
|
12
|
+
body: responseBody,
|
|
11
13
|
},
|
|
12
14
|
request: {
|
|
13
|
-
body:
|
|
15
|
+
body: requestBody,
|
|
14
16
|
},
|
|
15
17
|
}));
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
+
this.requestBody = requestBody;
|
|
19
|
+
this.status = status;
|
|
20
|
+
this.responseBody = responseBody;
|
|
18
21
|
}
|
|
19
22
|
errorMessage() {
|
|
20
|
-
var _a, _b, _c, _d;
|
|
21
23
|
return {
|
|
22
24
|
response: {
|
|
23
|
-
status:
|
|
24
|
-
body:
|
|
25
|
+
status: this.status,
|
|
26
|
+
body: this.responseBody,
|
|
25
27
|
},
|
|
26
28
|
request: {
|
|
27
|
-
body: this.
|
|
29
|
+
body: this.requestBody,
|
|
28
30
|
},
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
get response() {
|
|
32
|
-
var _a, _b, _c, _d;
|
|
33
34
|
return {
|
|
34
|
-
status:
|
|
35
|
-
body:
|
|
35
|
+
status: this.status,
|
|
36
|
+
body: this.responseBody,
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
get request() {
|
|
39
40
|
return {
|
|
40
|
-
body: this.
|
|
41
|
+
body: this.requestBody,
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-error.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/common/src/lib/http/core/http-error.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAU,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"http-error.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/common/src/lib/http/core/http-error.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAU,SAAQ,KAAK;IAIlC,YAA6B,WAAoB,EAAE,GAAe;;QAChE,MAAM,MAAM,GAAG,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,MAAM,KAAI,GAAG,CAAC;QAC5C,MAAM,YAAY,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,IAAI,CAAC;QAEzC,KAAK,CACH,IAAI,CAAC,SAAS,CAAC;YACb,QAAQ,EAAE;gBACR,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,YAAY;aACnB;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,WAAW;aAClB;SACF,CAAC,CACH,CAAC;QAdyB,gBAAW,GAAX,WAAW,CAAS;QAgB/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,YAAY;QACjB,OAAO;YACL,QAAQ,EAAE;gBACR,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,IAAI,EAAE,IAAI,CAAC,YAAY;aACxB;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,IAAI,CAAC,WAAW;aACvB;SACF,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ;QACV,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,YAAY;SACxB,CAAC;IACJ,CAAC;IAED,IAAI,OAAO;QACT,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,WAAW;SACvB,CAAC;IACJ,CAAC;CACF;AAhDD,8BAgDC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.propsValidation = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.propsValidation = {
|
|
6
|
+
validateZod(props, schema) {
|
|
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
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;YACA,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC3B,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"}
|