@smartsheet-extensions/handler 1.0.0-alpha.6 → 1.0.0-beta.10

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.
Files changed (37) hide show
  1. package/lib/enhancers/handleBigPayLoad.d.ts +1 -1
  2. package/lib/enhancers/handleBigPayLoad.d.ts.map +1 -1
  3. package/lib/enhancers/handleBigPayLoad.js +177 -33
  4. package/lib/enhancers/handleBigPayLoad.js.map +1 -1
  5. package/lib/errors/PayloadFetchError.d.ts +7 -0
  6. package/lib/errors/PayloadFetchError.d.ts.map +1 -0
  7. package/lib/errors/PayloadFetchError.js +13 -0
  8. package/lib/errors/PayloadFetchError.js.map +1 -0
  9. package/lib/errors/PayloadLimitExceedError.d.ts +8 -0
  10. package/lib/errors/PayloadLimitExceedError.d.ts.map +1 -0
  11. package/lib/errors/PayloadLimitExceedError.js +19 -0
  12. package/lib/errors/PayloadLimitExceedError.js.map +1 -0
  13. package/lib/errors/PayloadPostError.d.ts +7 -0
  14. package/lib/errors/PayloadPostError.d.ts.map +1 -0
  15. package/lib/errors/PayloadPostError.js +13 -0
  16. package/lib/errors/PayloadPostError.js.map +1 -0
  17. package/lib/errors/PlatformError.d.ts +8 -0
  18. package/lib/errors/PlatformError.d.ts.map +1 -0
  19. package/lib/errors/PlatformError.js +25 -0
  20. package/lib/errors/PlatformError.js.map +1 -0
  21. package/lib/index.d.ts +1 -0
  22. package/lib/index.d.ts.map +1 -1
  23. package/lib/index.js +1 -0
  24. package/lib/index.js.map +1 -1
  25. package/lib/responses/PlatformResponse.d.ts +21 -0
  26. package/lib/responses/PlatformResponse.d.ts.map +1 -0
  27. package/lib/responses/PlatformResponse.js +15 -0
  28. package/lib/responses/PlatformResponse.js.map +1 -0
  29. package/lib/utils/constants.d.ts +8 -0
  30. package/lib/utils/constants.d.ts.map +1 -0
  31. package/lib/utils/constants.js +11 -0
  32. package/lib/utils/constants.js.map +1 -0
  33. package/lib/utils/normalizeError.d.ts +2 -1
  34. package/lib/utils/normalizeError.d.ts.map +1 -1
  35. package/lib/utils/normalizeError.js +4 -0
  36. package/lib/utils/normalizeError.js.map +1 -1
  37. package/package.json +3 -3
@@ -1,3 +1,3 @@
1
1
  import { ExtensionHandlerEnhancer } from '../handler';
2
- export declare const handleBigPayLoad: ExtensionHandlerEnhancer;
2
+ export declare const handleBigPayLoad: ExtensionHandlerEnhancer<import("../handler").DefaultExtensionHandler, import("../handler").DefaultExtensionHandler>;
3
3
  //# sourceMappingURL=handleBigPayLoad.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleBigPayLoad.d.ts","sourceRoot":"","sources":["../../src/enhancers/handleBigPayLoad.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AA0DtD,eAAO,MAAM,gBAAgB,EAAE,wBAqB9B,CAAC"}
1
+ {"version":3,"file":"handleBigPayLoad.d.ts","sourceRoot":"","sources":["../../src/enhancers/handleBigPayLoad.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAqPtD,eAAO,MAAM,gBAAgB,sHAiB5B,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,60 +15,205 @@ 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"));
19
- const S3_EXECUTION = 's3Execution';
20
- const STREAM_EXECUTION = 'streamExecution';
18
+ const PayloadFetchError_1 = require("../errors/PayloadFetchError");
19
+ const PayloadLimitExceedError_1 = require("../errors/PayloadLimitExceedError");
20
+ const PayloadPostError_1 = require("../errors/PayloadPostError");
21
+ const PlatformResponse_1 = require("../responses/PlatformResponse");
22
+ const constants_1 = require("../utils/constants");
23
+ const normalizeError_1 = require("../utils/normalizeError");
24
+ const xorHandler_1 = require("./xorHandler");
25
+ const retryWrapper = (func, retryTimes) => __awaiter(void 0, void 0, void 0, function* () {
26
+ for (let counter = retryTimes - 1; counter >= 0; counter -= 1) {
27
+ try {
28
+ // eslint-disable-next-line no-await-in-loop
29
+ const resp = yield func();
30
+ return resp.data;
31
+ }
32
+ catch (error) {
33
+ if (counter === 0) {
34
+ throw error;
35
+ }
36
+ // eslint-disable-next-line no-console
37
+ console.warn(`Request to s3 failed. Retry attempts remaining ${counter} (of ${retryTimes})`);
38
+ // eslint-disable-next-line no-await-in-loop
39
+ yield new Promise(resolve => {
40
+ setTimeout(resolve, constants_1.S3_REQUEST_DELAY_MS);
41
+ });
42
+ }
43
+ }
44
+ });
21
45
  const getPayloadFromS3 = (url) => __awaiter(void 0, void 0, void 0, function* () {
22
- const resp = yield axios_1.default.get(url);
23
- return resp.data;
46
+ const config = {
47
+ timeout: constants_1.S3_REQUEST_TIMEOUT_MS,
48
+ };
49
+ const resp = yield retryWrapper(() => __awaiter(void 0, void 0, void 0, function* () { return axios_1.default.get(url, config); }), constants_1.S3_GET_RETRY_LIMIT);
50
+ return resp;
24
51
  });
25
- const putPayloadToS3 = (url, payload) => __awaiter(void 0, void 0, void 0, function* () {
26
- const urlObj = new URL(decodeURI(url));
52
+ const preparePostData = (urlObj, payload) => {
53
+ let payloadStr = JSON.stringify(payload);
54
+ if (payloadStr.length > constants_1.PAYLOAD_LIMIT) {
55
+ payloadStr = JSON.stringify(normalizeError_1.normalizeError(new PayloadLimitExceedError_1.PayloadLimitExceedError()).toJSON());
56
+ }
27
57
  const formData = new form_data_1.default();
28
- const urlVal = urlObj.origin + urlObj.pathname;
29
- urlObj.searchParams.forEach(function (value, key) {
58
+ urlObj.searchParams.forEach((value, key) => {
30
59
  formData.append(key, value);
31
60
  });
32
- formData.append('file', JSON.stringify(payload));
33
- const resp = yield axios_1.default.post(urlVal, formData, {
34
- headers: {
35
- 'Content-Type': 'multipart/form-data',
36
- 'Content-Length': formData.getLengthSync(),
37
- },
38
- });
39
- return resp.data;
61
+ formData.append('file', payloadStr);
62
+ return formData;
63
+ };
64
+ const preparePostUrl = (urlObj) => {
65
+ const url = urlObj.origin + urlObj.pathname;
66
+ return url;
67
+ };
68
+ const postPayloadToS3 = (url, result) => __awaiter(void 0, void 0, void 0, function* () {
69
+ const resp = yield retryWrapper(() => __awaiter(void 0, void 0, void 0, function* () {
70
+ const urlObj = new URL(decodeURI(url));
71
+ const data = preparePostData(urlObj, result);
72
+ const config = {
73
+ headers: {
74
+ 'Content-Type': 'multipart/form-data',
75
+ 'Content-Length': data.getLengthSync(),
76
+ },
77
+ maxContentLength: Infinity,
78
+ maxBodyLength: Infinity,
79
+ timeout: constants_1.S3_REQUEST_TIMEOUT_MS,
80
+ };
81
+ const postUrl = preparePostUrl(urlObj);
82
+ return axios_1.default.post(postUrl, data, config);
83
+ }), constants_1.S3_POST_RETRY_LIMIT);
84
+ return resp;
40
85
  });
41
86
  const isStreamExecution = (payload) => {
42
87
  if (payload.meta !== undefined && payload.meta.type !== undefined) {
43
- return payload.meta.type === STREAM_EXECUTION;
88
+ return payload.meta.type === constants_1.STREAM_EXECUTION;
44
89
  }
45
90
  };
46
91
  const isS3Execution = (payload) => {
47
92
  if (payload.meta !== undefined && payload.meta.type !== undefined) {
48
- return payload.meta.type === S3_EXECUTION;
93
+ return payload.meta.type === constants_1.S3_EXECUTION;
94
+ }
95
+ };
96
+ const wrapS3Response = (result) => {
97
+ return {
98
+ status: PlatformResponse_1.PlatformStatus.SUCCESS,
99
+ data: result,
100
+ };
101
+ };
102
+ const handleGetError = (err) => {
103
+ // eslint-disable-next-line no-console
104
+ console.error(err);
105
+ if (axios_1.default.isAxiosError(err)) {
106
+ if (err.response) {
107
+ return new PayloadFetchError_1.PayloadFetchError(err.response.data);
108
+ }
109
+ if (err.request) {
110
+ return new PayloadFetchError_1.PayloadFetchError(err.request.data);
111
+ }
112
+ }
113
+ else {
114
+ return new PayloadFetchError_1.PayloadFetchError(err.stack);
115
+ }
116
+ };
117
+ const handlePostError = (err) => {
118
+ // eslint-disable-next-line no-console
119
+ console.error(err);
120
+ if (axios_1.default.isAxiosError(err)) {
121
+ if (err.response) {
122
+ return new PayloadPostError_1.PayloadPostError(err.response.data);
123
+ }
124
+ if (err.request) {
125
+ return new PayloadPostError_1.PayloadPostError(err.request.data);
126
+ }
127
+ }
128
+ else {
129
+ return new PayloadPostError_1.PayloadPostError(err.stack);
49
130
  }
50
131
  };
51
- exports.handleBigPayLoad = create => {
132
+ /**
133
+ * Handles payloads that aren't wrapped.
134
+ */
135
+ const handlePassThroughPayload = create => {
52
136
  return () => {
53
137
  const handler = create();
54
138
  return (payload, callback) => {
55
- if (isS3Execution(payload)) {
56
- getPayloadFromS3(payload.body.getURL)
57
- .then(resultFromS3 => {
58
- handler(resultFromS3, (err, result) => {
59
- putPayloadToS3(payload.body.postURL, result)
60
- .then(resultNext => callback(err, resultNext))
61
- .catch(callback);
62
- });
63
- })
64
- .catch(callback);
139
+ try {
140
+ handler(payload, callback);
65
141
  }
66
- else if (isStreamExecution(payload)) {
142
+ catch (err) {
143
+ callback(err);
144
+ }
145
+ };
146
+ };
147
+ };
148
+ /**
149
+ * Handles payloads that are wrapped and `meta.type === 'streamExecution'`.
150
+ * The payload is wrapped but the response is still raw, passed straight
151
+ * from the extension's usercode.
152
+ */
153
+ const handleStreamPayLoad = create => {
154
+ return () => {
155
+ const handler = create();
156
+ return (payload, callback) => {
157
+ try {
67
158
  handler(payload.body.payload, callback);
68
159
  }
69
- else {
70
- handler(payload, callback);
160
+ catch (err) {
161
+ callback(err);
71
162
  }
72
163
  };
73
164
  };
74
165
  };
166
+ /**
167
+ * Handles payloads that are wrapped and `meta.type === 's3Execution'`.
168
+ * The payload is fetched from S3 and the response is posted to S3.
169
+ * Only Platform errors are returned via the callback.
170
+ */
171
+ const handleS3PayLoad = create => {
172
+ return () => {
173
+ const handler = create();
174
+ const handlerAsPromise = (payload) => new Promise((resolve, reject) => {
175
+ handler(payload, (err, result) => {
176
+ if (err) {
177
+ reject(err);
178
+ }
179
+ else {
180
+ resolve(result);
181
+ }
182
+ });
183
+ });
184
+ return ({ body: { getURL, postURL } }, callback) => __awaiter(void 0, void 0, void 0, function* () {
185
+ getPayloadFromS3(getURL).then((payload) => {
186
+ return handlerAsPromise(payload)
187
+ .catch(upstreamErr => normalizeError_1.normalizeError(upstreamErr).toJSON())
188
+ .then(result => {
189
+ // All upstream results, including errors.
190
+ postPayloadToS3(postURL, result).then(response => {
191
+ callback(null, wrapS3Response(response));
192
+ }, s3Error => {
193
+ // Only putPayloadToS3 error
194
+ callback(handlePostError(s3Error));
195
+ });
196
+ });
197
+ }, s3GetErr => {
198
+ // Only getPayloadFromS3 error
199
+ callback(handleGetError(s3GetErr));
200
+ });
201
+ });
202
+ };
203
+ };
204
+ exports.handleBigPayLoad = xorHandler_1.xorHandler({
205
+ passThroughPayload: handlePassThroughPayload,
206
+ streamPayload: handleStreamPayLoad,
207
+ s3Payload: handleS3PayLoad,
208
+ }, {
209
+ getFunctionKey: (payload) => {
210
+ if (isS3Execution(payload)) {
211
+ return 's3Payload';
212
+ }
213
+ if (isStreamExecution(payload)) {
214
+ return 'streamPayload';
215
+ }
216
+ return 'passThroughPayload';
217
+ },
218
+ });
75
219
  //# sourceMappingURL=handleBigPayLoad.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleBigPayLoad.js","sourceRoot":"","sources":["../../src/enhancers/handleBigPayLoad.ts"],"names":[],"mappings":";AAAA,aAAa;;;;;;;;;;;;;;;AAEb,kDAA0B;AAC1B,0DAAiC;AAGjC,MAAM,YAAY,GAAG,aAAa,CAAC;AACnC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAE3C,MAAM,gBAAgB,GAAG,CAAO,GAAW,EAAE,EAAE;IAC7C,MAAM,IA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AAG,uBAAU,CACxC;IACE,kBAAkB,EAAE,wBAAwB;IAC5C,aAAa,EAAE,mBAAmB;IAClC,SAAS,EAAE,eAAe;CAC3B,EACD;IACE,cAAc,EAAE,CAAC,OAAgB,EAAE,EAAE;QACnC,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE;YAC1B,OAAO,WAAW,CAAC;SACpB;QACD,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE;YAC9B,OAAO,eAAe,CAAC;SACxB;QACD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;CACF,CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { PlatformError } from './PlatformError';
2
+ export declare class PayloadFetchError extends PlatformError {
3
+ static CODE: string;
4
+ static message: string;
5
+ constructor(stacktrace?: any);
6
+ }
7
+ //# sourceMappingURL=PayloadFetchError.d.ts.map
@@ -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,8 @@
1
+ import { AbstractError } from './AbstractError';
2
+ export declare class PayloadLimitExceedError extends AbstractError {
3
+ static CODE: string;
4
+ static STATUS: number;
5
+ static DESCRIPTION: string;
6
+ constructor();
7
+ }
8
+ //# sourceMappingURL=PayloadLimitExceedError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadLimitExceedError.d.ts","sourceRoot":"","sources":["../../src/errors/PayloadLimitExceedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,OAAc,IAAI,SAAgC;IAClD,OAAc,MAAM,SAAO;IAC3B,OAAc,WAAW,SACiC;;CAQ3D"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PayloadLimitExceedError = void 0;
4
+ const AbstractError_1 = require("./AbstractError");
5
+ const InternalError_1 = require("./InternalError");
6
+ class PayloadLimitExceedError extends AbstractError_1.AbstractError {
7
+ constructor() {
8
+ super({
9
+ httpStatus: InternalError_1.InternalError.STATUS,
10
+ code: PayloadLimitExceedError.CODE,
11
+ description: PayloadLimitExceedError.DESCRIPTION,
12
+ });
13
+ }
14
+ }
15
+ exports.PayloadLimitExceedError = PayloadLimitExceedError;
16
+ PayloadLimitExceedError.CODE = 'PAYLOAD_LIMIT_EXCEED_ERROR';
17
+ PayloadLimitExceedError.STATUS = 413;
18
+ PayloadLimitExceedError.DESCRIPTION = 'Platform does not support payloads larger than 48 MB.';
19
+ //# sourceMappingURL=PayloadLimitExceedError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadLimitExceedError.js","sourceRoot":"","sources":["../../src/errors/PayloadLimitExceedError.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,mDAAgD;AAEhD,MAAa,uBAAwB,SAAQ,6BAAa;IAKxD;QACE,KAAK,CAAC;YACJ,UAAU,EAAE,6BAAa,CAAC,MAAM;YAChC,IAAI,EAAE,uBAAuB,CAAC,IAAI;YAClC,WAAW,EAAE,uBAAuB,CAAC,WAAW;SACjD,CAAC,CAAC;IACL,CAAC;;AAXH,0DAYC;AAXe,4BAAI,GAAG,4BAA4B,CAAC;AACpC,8BAAM,GAAG,GAAG,CAAC;AACb,mCAAW,GACvB,uDAAuD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { PlatformError } from './PlatformError';
2
+ export declare class PayloadPostError extends PlatformError {
3
+ static CODE: string;
4
+ static message: string;
5
+ constructor(stacktrace?: any);
6
+ }
7
+ //# sourceMappingURL=PayloadPostError.d.ts.map
@@ -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"}
package/lib/index.d.ts CHANGED
@@ -18,4 +18,5 @@ export * from './transports/httpTransport';
18
18
  export * from './transports/lambdaTransport';
19
19
  export * from './utils/compose';
20
20
  export * from './utils/serializable';
21
+ export * from './utils/constants';
21
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC"}
package/lib/index.js CHANGED
@@ -30,4 +30,5 @@ __exportStar(require("./transports/httpTransport"), exports);
30
30
  __exportStar(require("./transports/lambdaTransport"), exports);
31
31
  __exportStar(require("./utils/compose"), exports);
32
32
  __exportStar(require("./utils/serializable"), exports);
33
+ __exportStar(require("./utils/constants"), exports);
33
34
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAA8C;AAC9C,yDAAuC;AACvC,6DAA2C;AAC3C,2DAAyC;AACzC,mEAAiD;AACjD,yDAAuC;AACvC,+DAA6C;AAC7C,yDAAuC;AACvC,2DAAyC;AACzC,0DAAwC;AACxC,yDAAuC;AACvC,yDAAuC;AACvC,yDAAuC;AACvC,4CAA0B;AAC1B,4DAA0C;AAC1C,gEAA8C;AAC9C,6DAA2C;AAC3C,+DAA6C;AAC7C,kDAAgC;AAChC,uDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAA8C;AAC9C,yDAAuC;AACvC,6DAA2C;AAC3C,2DAAyC;AACzC,mEAAiD;AACjD,yDAAuC;AACvC,+DAA6C;AAC7C,yDAAuC;AACvC,2DAAyC;AACzC,0DAAwC;AACxC,yDAAuC;AACvC,yDAAuC;AACvC,yDAAuC;AACvC,4CAA0B;AAC1B,4DAA0C;AAC1C,gEAA8C;AAC9C,6DAA2C;AAC3C,+DAA6C;AAC7C,kDAAgC;AAChC,uDAAqC;AACrC,oDAAkC"}
@@ -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"}
@@ -0,0 +1,8 @@
1
+ export declare const S3_EXECUTION = "s3Execution";
2
+ export declare const STREAM_EXECUTION = "streamExecution";
3
+ export declare const PAYLOAD_LIMIT: number;
4
+ export declare const S3_GET_RETRY_LIMIT: number;
5
+ export declare const S3_POST_RETRY_LIMIT: number;
6
+ export declare const S3_REQUEST_DELAY_MS: number;
7
+ export declare const S3_REQUEST_TIMEOUT_MS: number;
8
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,gBAAgB,CAAC;AAC1C,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAClD,eAAO,MAAM,aAAa,QAAmB,CAAC;AAE9C,eAAO,MAAM,kBAAkB,EAAE,MAAW,CAAC;AAC7C,eAAO,MAAM,mBAAmB,EAAE,MAAW,CAAC;AAC9C,eAAO,MAAM,mBAAmB,EAAE,MAAY,CAAC;AAC/C,eAAO,MAAM,qBAAqB,EAAE,MAAkB,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.S3_REQUEST_TIMEOUT_MS = exports.S3_REQUEST_DELAY_MS = exports.S3_POST_RETRY_LIMIT = exports.S3_GET_RETRY_LIMIT = exports.PAYLOAD_LIMIT = exports.STREAM_EXECUTION = exports.S3_EXECUTION = void 0;
4
+ exports.S3_EXECUTION = 's3Execution';
5
+ exports.STREAM_EXECUTION = 'streamExecution';
6
+ exports.PAYLOAD_LIMIT = 48 * 1024 * 1024;
7
+ exports.S3_GET_RETRY_LIMIT = 10;
8
+ exports.S3_POST_RETRY_LIMIT = 10;
9
+ exports.S3_REQUEST_DELAY_MS = 200;
10
+ exports.S3_REQUEST_TIMEOUT_MS = 20 * 1000;
11
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,aAAa,CAAC;AAC7B,QAAA,gBAAgB,GAAG,iBAAiB,CAAC;AACrC,QAAA,aAAa,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjC,QAAA,kBAAkB,GAAW,EAAE,CAAC;AAChC,QAAA,mBAAmB,GAAW,EAAE,CAAC;AACjC,QAAA,mBAAmB,GAAW,GAAG,CAAC;AAClC,QAAA,qBAAqB,GAAW,EAAE,GAAG,IAAI,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import { AbstractError } from '../errors/AbstractError';
2
- export declare const normalizeError: (e: any) => AbstractError;
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;AAKxD,eAAO,MAAM,cAAc,MAAO,GAAG,kBAiBpC,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,EAAE;IACvC,IAAI,CAAC,YAAY,6BAAa,EAAE;QAC9B,OAAO,CAAC,CAAC;KACV;IACD,IAAI,CAAC,YAAY,KAAK,EAAE;QACtB,OAAO,+BAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC/B;IACD,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,YAAY,MAAM,EAAE;QAChD,OAAO,IAAI,6BAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACrC;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"}
1
+ {"version":3,"file":"normalizeError.js","sourceRoot":"","sources":["../../src/utils/normalizeError.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AACxD,6DAA0D;AAC1D,2DAAwD;AACxD,2DAAwD;AACxD,2DAAwD;AAE3C,QAAA,cAAc,GAAG,CAAC,CAAM,EAAE,EAAE;IACvC,IAAI,CAAC,YAAY,6BAAa,EAAE;QAC9B,OAAO,CAAC,CAAC;KACV;IACD,IAAI,CAAC,YAAY,6BAAa,EAAE;QAC9B,OAAO,CAAC,CAAC;KACV;IACD,IAAI,CAAC,YAAY,KAAK,EAAE;QACtB,OAAO,+BAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC/B;IACD,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,YAAY,MAAM,EAAE;QAChD,OAAO,IAAI,6BAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACrC;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.6",
3
+ "version": "1.0.0-beta.10",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "main": "./lib/index.js",
@@ -11,7 +11,6 @@
11
11
  },
12
12
  "author": "graeme.cassels@smartsheet.com",
13
13
  "devDependencies": {
14
- "@types/aws-lambda": "^8.10.89",
15
14
  "@types/supertest": "^2.0.8",
16
15
  "body-parser": "^1.19.0",
17
16
  "express": "^4.17.1",
@@ -19,8 +18,9 @@
19
18
  "supertest": "^4.0.2"
20
19
  },
21
20
  "dependencies": {
21
+ "@types/aws-lambda": "^8.10.89",
22
22
  "@types/express": "^4.17.0",
23
- "axios": "0.27.2",
23
+ "axios": "^0.27.2",
24
24
  "form-data": "^4.0.0"
25
25
  }
26
26
  }