@smartsheet-extensions/handler 1.0.0-alpha.4 → 1.0.0-alpha.7
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/lib/enhancers/handleBigPayLoad.d.ts.map +1 -1
- package/lib/enhancers/handleBigPayLoad.js +51 -6
- package/lib/enhancers/handleBigPayLoad.js.map +1 -1
- package/lib/errors/PayloadFetchError.d.ts +7 -0
- package/lib/errors/PayloadFetchError.d.ts.map +1 -0
- package/lib/errors/PayloadFetchError.js +13 -0
- package/lib/errors/PayloadFetchError.js.map +1 -0
- package/lib/errors/PayloadPostError.d.ts +7 -0
- package/lib/errors/PayloadPostError.d.ts.map +1 -0
- package/lib/errors/PayloadPostError.js +13 -0
- package/lib/errors/PayloadPostError.js.map +1 -0
- package/lib/errors/PlatformError.d.ts +8 -0
- package/lib/errors/PlatformError.d.ts.map +1 -0
- package/lib/errors/PlatformError.js +25 -0
- package/lib/errors/PlatformError.js.map +1 -0
- package/lib/responses/PlatformResponse.d.ts +21 -0
- package/lib/responses/PlatformResponse.d.ts.map +1 -0
- package/lib/responses/PlatformResponse.js +15 -0
- package/lib/responses/PlatformResponse.js.map +1 -0
- package/lib/utils/normalizeError.d.ts +2 -1
- package/lib/utils/normalizeError.d.ts.map +1 -1
- package/lib/utils/normalizeError.js +4 -0
- package/lib/utils/normalizeError.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleBigPayLoad.d.ts","sourceRoot":"","sources":["../../src/enhancers/handleBigPayLoad.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handleBigPayLoad.d.ts","sourceRoot":"","sources":["../../src/enhancers/handleBigPayLoad.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAiGtD,eAAO,MAAM,gBAAgB,EAAE,wBA+B9B,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// @ts-ignore
|
|
3
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -16,6 +15,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
15
|
exports.handleBigPayLoad = void 0;
|
|
17
16
|
const axios_1 = __importDefault(require("axios"));
|
|
18
17
|
const form_data_1 = __importDefault(require("form-data"));
|
|
18
|
+
const PlatformResponse_1 = require("../responses/PlatformResponse");
|
|
19
|
+
const PayloadFetchError_1 = require("../errors/PayloadFetchError");
|
|
20
|
+
const PayloadPostError_1 = require("../errors/PayloadPostError");
|
|
19
21
|
const S3_EXECUTION = 's3Execution';
|
|
20
22
|
const STREAM_EXECUTION = 'streamExecution';
|
|
21
23
|
const getPayloadFromS3 = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -48,20 +50,63 @@ const isS3Execution = (payload) => {
|
|
|
48
50
|
return payload.meta.type === S3_EXECUTION;
|
|
49
51
|
}
|
|
50
52
|
};
|
|
53
|
+
const wrapS3Response = (result) => {
|
|
54
|
+
return {
|
|
55
|
+
status: PlatformResponse_1.PlatformStatus.SUCCESS,
|
|
56
|
+
data: result,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const handleFetchError = (err) => {
|
|
60
|
+
if (axios_1.default.isAxiosError(err)) {
|
|
61
|
+
if (err.response) {
|
|
62
|
+
return new PayloadFetchError_1.PayloadFetchError(err.response.data);
|
|
63
|
+
}
|
|
64
|
+
if (err.request) {
|
|
65
|
+
return new PayloadFetchError_1.PayloadFetchError(err.request.data);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return new PayloadFetchError_1.PayloadFetchError(err.stack);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const handlePostError = (err) => {
|
|
73
|
+
if (axios_1.default.isAxiosError(err)) {
|
|
74
|
+
if (err.response) {
|
|
75
|
+
return new PayloadPostError_1.PayloadPostError(err.response.data);
|
|
76
|
+
}
|
|
77
|
+
if (err.request) {
|
|
78
|
+
return new PayloadPostError_1.PayloadPostError(err.request.data);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return new PayloadPostError_1.PayloadPostError(err.stack);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
51
85
|
exports.handleBigPayLoad = create => {
|
|
52
86
|
return () => {
|
|
53
87
|
const handler = create();
|
|
54
88
|
return (payload, callback) => {
|
|
55
89
|
if (isS3Execution(payload)) {
|
|
56
|
-
getPayloadFromS3(payload.body.
|
|
90
|
+
getPayloadFromS3(payload.body.getURL)
|
|
57
91
|
.then(resultFromS3 => {
|
|
58
92
|
handler(resultFromS3, (err, result) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
93
|
+
if (err) {
|
|
94
|
+
callback(err);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
putPayloadToS3(payload.body.postURL, result)
|
|
98
|
+
.then(resultNext => {
|
|
99
|
+
callback(err, wrapS3Response(resultNext));
|
|
100
|
+
})
|
|
101
|
+
.catch(s3Error => {
|
|
102
|
+
callback(handlePostError(s3Error));
|
|
103
|
+
});
|
|
104
|
+
}
|
|
62
105
|
});
|
|
63
106
|
})
|
|
64
|
-
.catch(
|
|
107
|
+
.catch(s3GetErr => {
|
|
108
|
+
callback(handleFetchError(s3GetErr));
|
|
109
|
+
});
|
|
65
110
|
}
|
|
66
111
|
else if (isStreamExecution(payload)) {
|
|
67
112
|
handler(payload.body.payload, callback);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleBigPayLoad.js","sourceRoot":"","sources":["../../src/enhancers/handleBigPayLoad.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handleBigPayLoad.js","sourceRoot":"","sources":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zC;iBAAM;gBACL,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;aAC5B;QACH,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadFetchError.d.ts","sourceRoot":"","sources":["../../src/errors/PayloadFetchError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,qBAAa,iBAAkB,SAAQ,aAAa;IAClD,OAAc,IAAI,SAAyB;IAC3C,OAAc,OAAO,SAA+B;gBACjC,UAAU,CAAC,EAAE,GAAG;CAGpC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PayloadFetchError = void 0;
|
|
4
|
+
const PlatformError_1 = require("./PlatformError");
|
|
5
|
+
class PayloadFetchError extends PlatformError_1.PlatformError {
|
|
6
|
+
constructor(stacktrace) {
|
|
7
|
+
super(PayloadFetchError.message, stacktrace, PayloadFetchError.CODE);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.PayloadFetchError = PayloadFetchError;
|
|
11
|
+
PayloadFetchError.CODE = 'PAYLOAD_FETCH_ERROR';
|
|
12
|
+
PayloadFetchError.message = 'Error in fetching payload';
|
|
13
|
+
//# sourceMappingURL=PayloadFetchError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadFetchError.js","sourceRoot":"","sources":["../../src/errors/PayloadFetchError.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAEhD,MAAa,iBAAkB,SAAQ,6BAAa;IAGlD,YAAmB,UAAgB;QACjC,KAAK,CAAC,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC;;AALH,8CAMC;AALe,sBAAI,GAAG,qBAAqB,CAAC;AAC7B,yBAAO,GAAG,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadPostError.d.ts","sourceRoot":"","sources":["../../src/errors/PayloadPostError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,OAAc,IAAI,SAAwB;IAC1C,OAAc,OAAO,SAA8B;gBAChC,UAAU,CAAC,EAAE,GAAG;CAGpC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PayloadPostError = void 0;
|
|
4
|
+
const PlatformError_1 = require("./PlatformError");
|
|
5
|
+
class PayloadPostError extends PlatformError_1.PlatformError {
|
|
6
|
+
constructor(stacktrace) {
|
|
7
|
+
super(PayloadPostError.message, stacktrace, PayloadPostError.CODE);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.PayloadPostError = PayloadPostError;
|
|
11
|
+
PayloadPostError.CODE = 'PAYLOAD_POST_ERROR';
|
|
12
|
+
PayloadPostError.message = 'Error in storing payload';
|
|
13
|
+
//# sourceMappingURL=PayloadPostError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadPostError.js","sourceRoot":"","sources":["../../src/errors/PayloadPostError.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAEhD,MAAa,gBAAiB,SAAQ,6BAAa;IAGjD,YAAmB,UAAgB;QACjC,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;;AALH,4CAMC;AALe,qBAAI,GAAG,oBAAoB,CAAC;AAC5B,wBAAO,GAAG,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PlatformResponse } from '../responses/PlatformResponse';
|
|
2
|
+
export declare class PlatformError extends Error {
|
|
3
|
+
private code;
|
|
4
|
+
private stacktrace;
|
|
5
|
+
constructor(description: string, stacktrace?: any, code?: string);
|
|
6
|
+
toJSON(): PlatformResponse;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=PlatformError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformError.d.ts","sourceRoot":"","sources":["../../src/errors/PlatformError.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEjB,MAAM,+BAA+B,CAAC;AAIvC,qBAAa,aAAc,SAAQ,KAAK;IACtC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,UAAU,CAAM;gBAEL,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,IAAI,SAAO;IAO9D,MAAM,IAAI,gBAAgB;CAUlC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlatformError = void 0;
|
|
4
|
+
const PlatformResponse_1 = require("../responses/PlatformResponse");
|
|
5
|
+
const CODE = 'PLATFORM_ERROR';
|
|
6
|
+
class PlatformError extends Error {
|
|
7
|
+
constructor(description, stacktrace, code = CODE) {
|
|
8
|
+
super(description);
|
|
9
|
+
Object.setPrototypeOf(this, PlatformError.prototype);
|
|
10
|
+
this.stacktrace = stacktrace;
|
|
11
|
+
this.code = code;
|
|
12
|
+
}
|
|
13
|
+
toJSON() {
|
|
14
|
+
return {
|
|
15
|
+
status: PlatformResponse_1.PlatformStatus.FAIL,
|
|
16
|
+
error: {
|
|
17
|
+
code: this.code,
|
|
18
|
+
message: this.message,
|
|
19
|
+
stacktrace: this.stacktrace,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.PlatformError = PlatformError;
|
|
25
|
+
//# sourceMappingURL=PlatformError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformError.js","sourceRoot":"","sources":["../../src/errors/PlatformError.ts"],"names":[],"mappings":";;;AAAA,oEAGuC;AAEvC,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAE9B,MAAa,aAAc,SAAQ,KAAK;IAItC,YAAmB,WAAmB,EAAE,UAAgB,EAAE,IAAI,GAAG,IAAI;QACnE,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,MAAM;QACX,OAAO;YACL,MAAM,EAAE,iCAAc,CAAC,IAAI;YAC3B,KAAK,EAAE;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B;SACF,CAAC;IACJ,CAAC;CACF;AArBD,sCAqBC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare enum PlatformStatus {
|
|
2
|
+
/**
|
|
3
|
+
* The function execution from platform is success.
|
|
4
|
+
*/
|
|
5
|
+
SUCCESS = "SUCCESS",
|
|
6
|
+
/**
|
|
7
|
+
* The function executionfrom platform is failure.
|
|
8
|
+
* */
|
|
9
|
+
FAIL = "FAIL"
|
|
10
|
+
}
|
|
11
|
+
export interface PlatformErrorResponse {
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
stacktrace: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PlatformResponse {
|
|
17
|
+
status: PlatformStatus;
|
|
18
|
+
data?: any;
|
|
19
|
+
error?: PlatformErrorResponse;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=PlatformResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformResponse.d.ts","sourceRoot":"","sources":["../../src/responses/PlatformResponse.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB;;OAEG;IACH,OAAO,YAAY;IACnB;;SAEK;IACL,IAAI,SAAS;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC/B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlatformStatus = void 0;
|
|
4
|
+
var PlatformStatus;
|
|
5
|
+
(function (PlatformStatus) {
|
|
6
|
+
/**
|
|
7
|
+
* The function execution from platform is success.
|
|
8
|
+
*/
|
|
9
|
+
PlatformStatus["SUCCESS"] = "SUCCESS";
|
|
10
|
+
/**
|
|
11
|
+
* The function executionfrom platform is failure.
|
|
12
|
+
* */
|
|
13
|
+
PlatformStatus["FAIL"] = "FAIL";
|
|
14
|
+
})(PlatformStatus = exports.PlatformStatus || (exports.PlatformStatus = {}));
|
|
15
|
+
//# sourceMappingURL=PlatformResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformResponse.js","sourceRoot":"","sources":["../../src/responses/PlatformResponse.ts"],"names":[],"mappings":";;;AAAA,IAAY,cASX;AATD,WAAY,cAAc;IACxB;;OAEG;IACH,qCAAmB,CAAA;IACnB;;SAEK;IACL,+BAAa,CAAA;AACf,CAAC,EATW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QASzB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { AbstractError } from '../errors/AbstractError';
|
|
2
|
-
|
|
2
|
+
import { PlatformError } from '../errors/PlatformError';
|
|
3
|
+
export declare const normalizeError: (e: any) => AbstractError | PlatformError;
|
|
3
4
|
//# sourceMappingURL=normalizeError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeError.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"normalizeError.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,eAAO,MAAM,cAAc,MAAO,GAAG,kCAoBpC,CAAC"}
|
|
@@ -5,10 +5,14 @@ const AbstractError_1 = require("../errors/AbstractError");
|
|
|
5
5
|
const ExtensionError_1 = require("../errors/ExtensionError");
|
|
6
6
|
const InternalError_1 = require("../errors/InternalError");
|
|
7
7
|
const UncaughtError_1 = require("../errors/UncaughtError");
|
|
8
|
+
const PlatformError_1 = require("../errors/PlatformError");
|
|
8
9
|
exports.normalizeError = (e) => {
|
|
9
10
|
if (e instanceof AbstractError_1.AbstractError) {
|
|
10
11
|
return e;
|
|
11
12
|
}
|
|
13
|
+
if (e instanceof PlatformError_1.PlatformError) {
|
|
14
|
+
return e;
|
|
15
|
+
}
|
|
12
16
|
if (e instanceof Error) {
|
|
13
17
|
return ExtensionError_1.ExtensionError.wrap(e);
|
|
14
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeError.js","sourceRoot":"","sources":["../../src/utils/normalizeError.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AACxD,6DAA0D;AAC1D,2DAAwD;AACxD,2DAAwD;AAE3C,QAAA,cAAc,GAAG,CAAC,CAAM,EAAE,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IACD,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,YAAY,MAAM,EAAE;QAChD,OAAO,IAAI,6BAAa,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC;KACjE;IACD,IAAI,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,YAAY,OAAO,EAAE;QAClD,OAAO,IAAI,6BAAa,CAAC,mCAAmC,CAAC,EAAE,CAAC,CAAC;KAClE;IACD,OAAO,IAAI,6BAAa,CAAC,gCAAgC,CAAC,CAAC;AAC7D,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartsheet-extensions/handler",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@types/express": "^4.17.0",
|
|
23
|
-
"axios": "^0.
|
|
23
|
+
"axios": "^0.27.2",
|
|
24
24
|
"form-data": "^4.0.0"
|
|
25
25
|
}
|
|
26
26
|
}
|