ag-common 0.0.727 → 0.0.729
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/api/helpers/api.js +0 -6
- package/dist/api/helpers/dynamo.d.ts +2 -1
- package/dist/api/helpers/dynamo.js +13 -14
- package/dist/api/helpers/enforceDynamoProvisionCap.js +0 -1
- package/dist/api/helpers/openApiHelpers.js +1 -2
- package/dist/api/helpers/s3.d.ts +0 -1
- package/dist/api/helpers/s3.js +11 -11
- package/dist/api/helpers/ses.d.ts +1 -1
- package/dist/api/helpers/sts.js +2 -2
- package/dist/api/helpers/validateOpenApi.js +1 -4
- package/dist/api/helpers/validations.js +3 -5
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +0 -1
- package/dist/api/openapi-postfix.js +0 -3
- package/dist/api/openapi-prefix.js +0 -6
- package/dist/api/types/index.d.ts +1 -1
- package/dist/api/types/index.js +0 -15
- package/dist/common/helpers/array.d.ts +1 -1
- package/dist/common/helpers/array.js +3 -4
- package/dist/common/helpers/async.js +2 -3
- package/dist/common/helpers/binary.d.ts +3 -4
- package/dist/common/helpers/binary.js +4 -4
- package/dist/common/helpers/csv.js +1 -3
- package/dist/common/helpers/date.js +0 -1
- package/dist/common/helpers/func.js +1 -2
- package/dist/common/helpers/generator.js +1 -3
- package/dist/common/helpers/groupBy.js +3 -4
- package/dist/common/helpers/hashCode.js +0 -1
- package/dist/common/helpers/log.js +0 -2
- package/dist/common/helpers/math.js +6 -8
- package/dist/common/helpers/memo.js +1 -4
- package/dist/common/helpers/object.js +9 -14
- package/dist/common/helpers/random.js +3 -3
- package/dist/common/helpers/stream.js +3 -3
- package/dist/common/helpers/string/contains.js +3 -3
- package/dist/common/helpers/string/json.js +0 -1
- package/dist/common/helpers/string/object.js +1 -2
- package/dist/common/helpers/string/redact.js +3 -3
- package/dist/common/helpers/string/trim.js +2 -3
- package/dist/common/helpers/string/truncate.js +1 -2
- package/dist/common/helpers/string/url.js +3 -2
- package/dist/common/helpers/xml.js +0 -1
- package/dist/node/helpers/fetch.js +2 -2
- package/dist/node/helpers/fs.js +2 -3
- package/dist/ui/components/Accordion/index.js +17 -7
- package/dist/ui/components/BarChart/index.d.ts +1 -1
- package/dist/ui/components/BarChart/index.js +0 -1
- package/dist/ui/components/Button/index.d.ts +2 -3
- package/dist/ui/components/Button/index.js +1 -4
- package/dist/ui/components/Confirm/Dialog.js +1 -0
- package/dist/ui/components/Confirm/index.d.ts +1 -1
- package/dist/ui/components/Confirm/index.js +0 -1
- package/dist/ui/components/DarkMode/Base.d.ts +3 -4
- package/dist/ui/components/DarkMode/Base.js +18 -7
- package/dist/ui/components/DropdownList/Base.d.ts +2 -2
- package/dist/ui/components/DropdownList/Base.js +19 -10
- package/dist/ui/components/DropdownList/Dialog.d.ts +1 -1
- package/dist/ui/components/DropdownList/Dialog.js +2 -0
- package/dist/ui/components/DropdownList/types.d.ts +1 -1
- package/dist/ui/components/HorizontalScrollBar/index.js +18 -7
- package/dist/ui/components/Icon/index.d.ts +2 -2
- package/dist/ui/components/Image/index.js +17 -7
- package/dist/ui/components/InfiniteScroll/index.js +17 -8
- package/dist/ui/components/LineChart/index.d.ts +1 -1
- package/dist/ui/components/LineChart/index.js +0 -1
- package/dist/ui/components/Loader/index.js +17 -7
- package/dist/ui/components/Markdown/index.d.ts +2 -2
- package/dist/ui/components/MinSidebar/index.js +17 -7
- package/dist/ui/components/Modal/Dialog.js +1 -0
- package/dist/ui/components/Modal/Modal.d.ts +2 -2
- package/dist/ui/components/Modal/Modal.js +18 -7
- package/dist/ui/components/Modal/index.d.ts +1 -1
- package/dist/ui/components/Modal/index.js +0 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/index.d.ts +2 -2
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.d.ts +4 -5
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +0 -1
- package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/index.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/index.js +0 -1
- package/dist/ui/components/OpenApiCodeBlock/types.d.ts +1 -1
- package/dist/ui/components/ProgressBar/index.js +17 -7
- package/dist/ui/components/Prompt/Modal.js +18 -7
- package/dist/ui/components/Prompt/index.d.ts +1 -1
- package/dist/ui/components/Prompt/index.js +0 -1
- package/dist/ui/components/RadioGroup/index.d.ts +2 -2
- package/dist/ui/components/RadioGroup/index.js +17 -8
- package/dist/ui/components/Search/AutoHideSearchBox.js +17 -7
- package/dist/ui/components/Search/Dialog.js +1 -0
- package/dist/ui/components/Search/Inline.js +17 -8
- package/dist/ui/components/Search/SearchBox.d.ts +1 -1
- package/dist/ui/components/Search/SearchBox.js +17 -7
- package/dist/ui/components/Search/index.d.ts +1 -1
- package/dist/ui/components/Search/index.js +0 -1
- package/dist/ui/components/Search/types.d.ts +2 -2
- package/dist/ui/components/Sidebar/index.js +17 -7
- package/dist/ui/components/TabBar/index.d.ts +2 -2
- package/dist/ui/components/TabBar/index.js +17 -7
- package/dist/ui/components/Table/index.d.ts +2 -2
- package/dist/ui/components/TextEdit/CheckboxEdit.js +17 -7
- package/dist/ui/components/TextEdit/ColourEdit.js +17 -7
- package/dist/ui/components/TextEdit/ListboxEdit.js +20 -18
- package/dist/ui/components/TextEdit/TextEdit.d.ts +2 -2
- package/dist/ui/components/TextEdit/TextEdit.js +20 -18
- package/dist/ui/components/TextEdit/common.d.ts +6 -7
- package/dist/ui/components/TextEdit/index.d.ts +1 -1
- package/dist/ui/components/TextEdit/index.js +0 -1
- package/dist/ui/components/TextEdit/types.d.ts +1 -0
- package/dist/ui/components/TextWithButton/index.js +17 -7
- package/dist/ui/components/Toast/base.js +18 -7
- package/dist/ui/components/Toast/index.d.ts +1 -1
- package/dist/ui/components/Toast/index.js +0 -1
- package/dist/ui/components/Toast/types.d.ts +1 -1
- package/dist/ui/components/TreeChart/base.js +17 -7
- package/dist/ui/components/TreeChart/index.d.ts +1 -1
- package/dist/ui/components/TreeChart/index.js +0 -1
- package/dist/ui/components/UserImage/index.js +17 -7
- package/dist/ui/helpers/axiosHelper.d.ts +1 -1
- package/dist/ui/helpers/axiosHelper.js +0 -2
- package/dist/ui/helpers/callOpenApi/direct.js +2 -7
- package/dist/ui/helpers/callOpenApi/helpers.js +1 -2
- package/dist/ui/helpers/callOpenApi/hook.d.ts +0 -1
- package/dist/ui/helpers/callOpenApi/index.d.ts +1 -1
- package/dist/ui/helpers/callOpenApi/index.js +0 -1
- package/dist/ui/helpers/cookie/get.js +3 -3
- package/dist/ui/helpers/cookie/raw.js +4 -4
- package/dist/ui/helpers/cookie/set.js +2 -2
- package/dist/ui/helpers/cookie/use.js +2 -2
- package/dist/ui/helpers/debounce.js +2 -3
- package/dist/ui/helpers/dom.js +0 -2
- package/dist/ui/helpers/extractAttributes.js +0 -1
- package/dist/ui/helpers/index.d.ts +2 -2
- package/dist/ui/helpers/index.js +0 -2
- package/dist/ui/helpers/plural.js +1 -2
- package/dist/ui/helpers/routes.d.ts +2 -2
- package/dist/ui/helpers/serviceWorker.js +1 -2
- package/dist/ui/helpers/useContextMenu.d.ts +1 -1
- package/dist/ui/helpers/useContextMenu.js +2 -3
- package/dist/ui/helpers/useElementAttribute.js +3 -2
- package/dist/ui/helpers/useGranularHook.js +1 -1
- package/dist/ui/helpers/useInterval.js +2 -2
- package/dist/ui/helpers/useIsInViewport.js +1 -2
- package/dist/ui/helpers/useLocalStorage.js +2 -2
- package/dist/ui/helpers/useLockBodyScroll.js +1 -2
- package/dist/ui/helpers/useOnClickOutside.d.ts +1 -1
- package/dist/ui/helpers/useOnClickOutside.js +3 -3
- package/dist/ui/helpers/useOnScroll.js +6 -7
- package/dist/ui/helpers/useOverloadPageSearch.js +2 -0
- package/dist/ui/helpers/useQueryString.js +1 -1
- package/dist/ui/helpers/useResize.js +2 -2
- package/dist/ui/helpers/useTimeout.js +1 -2
- package/dist/ui/helpers/useTooltip.d.ts +1 -0
- package/dist/ui/helpers/useTooltip.js +18 -7
- package/dist/ui/icons/index.d.ts +27 -28
- package/dist/ui/styles/common.d.ts +2 -2
- package/dist/ui/styles/standaloneStyles.d.ts +12 -13
- package/package.json +36 -33
package/dist/api/helpers/api.js
CHANGED
|
@@ -12,8 +12,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.generateDynamoPKS = exports.stripPKs = exports.returnCode = void 0;
|
|
15
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
16
|
-
// eslint-disable-next-line
|
|
17
15
|
const array_1 = require("../../common/helpers/array");
|
|
18
16
|
const returnCode = (statusCode, body, extraHeaders, fullSiteUrl) => {
|
|
19
17
|
let headers = {
|
|
@@ -28,7 +26,6 @@ const returnCode = (statusCode, body, extraHeaders, fullSiteUrl) => {
|
|
|
28
26
|
return {
|
|
29
27
|
headers,
|
|
30
28
|
statusCode,
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
29
|
body: (!body ? undefined : JSON.stringify(body, null, 2)),
|
|
33
30
|
};
|
|
34
31
|
};
|
|
@@ -39,10 +36,8 @@ exports.returnCode = returnCode;
|
|
|
39
36
|
* @param keepPk if true, will keep PK. default true
|
|
40
37
|
* @returns stripped record
|
|
41
38
|
*/
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
39
|
const stripPKs = (record, keepPk = true) => {
|
|
44
40
|
if (!record) {
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
41
|
return null;
|
|
47
42
|
}
|
|
48
43
|
// @ts-ignore
|
|
@@ -52,7 +47,6 @@ const stripPKs = (record, keepPk = true) => {
|
|
|
52
47
|
//@ts-ignore
|
|
53
48
|
rest.PK = PK;
|
|
54
49
|
}
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
56
50
|
// @ts-ignore
|
|
57
51
|
return rest;
|
|
58
52
|
};
|
|
@@ -27,6 +27,7 @@ interface ScanOptions {
|
|
|
27
27
|
*/
|
|
28
28
|
filter?: DynamoFilter;
|
|
29
29
|
requiredAttributeList?: string[];
|
|
30
|
+
indexName?: string;
|
|
30
31
|
}
|
|
31
32
|
interface DynamoQueryParams {
|
|
32
33
|
tableName: string;
|
|
@@ -87,6 +88,6 @@ export declare const getDynamoUpdates: <T extends Record<string, unknown>>(item:
|
|
|
87
88
|
UpdateExpression: string;
|
|
88
89
|
ExpressionAttributeNames: Record<string, string>;
|
|
89
90
|
ExpressionAttributeValues: Record<string, unknown>;
|
|
90
|
-
ReturnValues:
|
|
91
|
+
ReturnValues: "UPDATED_NEW";
|
|
91
92
|
};
|
|
92
93
|
export {};
|
|
@@ -12,7 +12,7 @@ var __await = (this && this.__await) || function (v) { return this instanceof __
|
|
|
12
12
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
13
13
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
14
14
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
15
|
-
return i =
|
|
15
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
16
16
|
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
17
17
|
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
18
18
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
@@ -22,7 +22,8 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
|
|
|
22
22
|
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.getDynamoUpdates = exports.wipeTable = exports.getDynamoTtlMinutes = exports.getDynamoTtlDays = exports.queryDynamo = exports.getItemDynamo = exports.getItemsDynamo = exports.
|
|
25
|
+
exports.getDynamoUpdates = exports.wipeTable = exports.getDynamoTtlMinutes = exports.getDynamoTtlDays = exports.queryDynamo = exports.getItemDynamo = exports.getItemsDynamo = exports.scan = exports.batchDelete = exports.batchWrite = exports.putDynamo = exports.setDynamo = exports.dynamoDb = void 0;
|
|
26
|
+
exports.scanWithGenerator = scanWithGenerator;
|
|
26
27
|
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
27
28
|
const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
28
29
|
const array_1 = require("../../common/helpers/array");
|
|
@@ -131,7 +132,7 @@ const scan = (tableName, options) => __awaiter(void 0, void 0, void 0, function*
|
|
|
131
132
|
}, {});
|
|
132
133
|
const expressionAttributeNames = Object.assign(Object.assign({}, projectionAttrs), (_b = options === null || options === void 0 ? void 0 : options.filter) === null || _b === void 0 ? void 0 : _b.attrNames);
|
|
133
134
|
do {
|
|
134
|
-
const params = new lib_dynamodb_1.ScanCommand(Object.assign(Object.assign(Object.assign(Object.assign({ TableName: tableName }, ((options === null || options === void 0 ? void 0 : options.filter) && Object.assign({ FilterExpression: options.filter.filterExpression }, (options.filter.attrValues && {
|
|
135
|
+
const params = new lib_dynamodb_1.ScanCommand(Object.assign(Object.assign(Object.assign(Object.assign({ TableName: tableName, IndexName: options === null || options === void 0 ? void 0 : options.indexName }, ((options === null || options === void 0 ? void 0 : options.filter) && Object.assign({ FilterExpression: options.filter.filterExpression }, (options.filter.attrValues && {
|
|
135
136
|
ExpressionAttributeValues: options.filter.attrValues,
|
|
136
137
|
})))), (Object.keys(expressionAttributeNames).length > 0 && {
|
|
137
138
|
ExpressionAttributeNames: expressionAttributeNames,
|
|
@@ -166,7 +167,7 @@ function scanWithGenerator(tableName, options) {
|
|
|
166
167
|
}, {});
|
|
167
168
|
const expressionAttributeNames = Object.assign(Object.assign({}, projectionAttrs), (_c = options === null || options === void 0 ? void 0 : options.filter) === null || _c === void 0 ? void 0 : _c.attrNames);
|
|
168
169
|
do {
|
|
169
|
-
const params = new lib_dynamodb_1.ScanCommand(Object.assign(Object.assign(Object.assign(Object.assign({ TableName: tableName, Limit: BATCH_SIZE }, ((options === null || options === void 0 ? void 0 : options.filter) && Object.assign({ FilterExpression: options.filter.filterExpression }, (options.filter.attrValues && {
|
|
170
|
+
const params = new lib_dynamodb_1.ScanCommand(Object.assign(Object.assign(Object.assign(Object.assign({ TableName: tableName, IndexName: options === null || options === void 0 ? void 0 : options.indexName, Limit: BATCH_SIZE }, ((options === null || options === void 0 ? void 0 : options.filter) && Object.assign({ FilterExpression: options.filter.filterExpression }, (options.filter.attrValues && {
|
|
170
171
|
ExpressionAttributeValues: options.filter.attrValues,
|
|
171
172
|
})))), (Object.keys(expressionAttributeNames).length > 0 && {
|
|
172
173
|
ExpressionAttributeNames: expressionAttributeNames,
|
|
@@ -197,9 +198,8 @@ function scanWithGenerator(tableName, options) {
|
|
|
197
198
|
}
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
|
-
exports.scanWithGenerator = scanWithGenerator;
|
|
201
201
|
const getItemsDynamo = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
202
|
-
var
|
|
202
|
+
var _a, _b;
|
|
203
203
|
try {
|
|
204
204
|
const command = new lib_dynamodb_1.BatchGetCommand({
|
|
205
205
|
RequestItems: {
|
|
@@ -212,7 +212,7 @@ const getItemsDynamo = (params) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
212
212
|
});
|
|
213
213
|
const result = yield withRetry(() => exports.dynamoDb.send(command), 'getItemsDynamo');
|
|
214
214
|
return {
|
|
215
|
-
data: (
|
|
215
|
+
data: (_b = (_a = result.Responses) === null || _a === void 0 ? void 0 : _a[params.tableName]) !== null && _b !== void 0 ? _b : [],
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
catch (e) {
|
|
@@ -232,9 +232,9 @@ const getItemDynamo = (params) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
232
232
|
});
|
|
233
233
|
exports.getItemDynamo = getItemDynamo;
|
|
234
234
|
const queryDynamo = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
235
|
-
var
|
|
235
|
+
var _a, _b, _c;
|
|
236
236
|
try {
|
|
237
|
-
let kce = `#${params.pkName.toLowerCase()} ${(
|
|
237
|
+
let kce = `#${params.pkName.toLowerCase()} ${(_a = params.pkOperator) !== null && _a !== void 0 ? _a : '='} :${params.pkName.toLowerCase()}`;
|
|
238
238
|
const ean = {
|
|
239
239
|
[`#${params.pkName.toLowerCase()}`]: params.pkName,
|
|
240
240
|
};
|
|
@@ -268,7 +268,7 @@ const queryDynamo = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
268
268
|
FilterExpression =
|
|
269
269
|
params.filterOperator === 'contains'
|
|
270
270
|
? `contains(#${params.filterName.toLowerCase()}, :${params.filterName.toLowerCase()})`
|
|
271
|
-
: `#${params.filterName.toLowerCase()} ${(
|
|
271
|
+
: `#${params.filterName.toLowerCase()} ${(_b = params.filterOperator) !== null && _b !== void 0 ? _b : '='} :${params.filterName.toLowerCase()}`;
|
|
272
272
|
}
|
|
273
273
|
const items = [];
|
|
274
274
|
let { startKey } = params;
|
|
@@ -278,7 +278,7 @@ const queryDynamo = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
278
278
|
KeyConditionExpression: kce,
|
|
279
279
|
ExpressionAttributeNames: ean,
|
|
280
280
|
ExpressionAttributeValues: eav,
|
|
281
|
-
ScanIndexForward: (
|
|
281
|
+
ScanIndexForward: (_c = params.sortAscending) !== null && _c !== void 0 ? _c : true,
|
|
282
282
|
Limit: params.limit,
|
|
283
283
|
IndexName: params.indexName,
|
|
284
284
|
ExclusiveStartKey: startKey,
|
|
@@ -308,14 +308,13 @@ exports.getDynamoTtlDays = getDynamoTtlDays;
|
|
|
308
308
|
const getDynamoTtlMinutes = (minutes) => Math.ceil(Date.now() / 1000) + minutes * 60;
|
|
309
309
|
exports.getDynamoTtlMinutes = getDynamoTtlMinutes;
|
|
310
310
|
const wipeTable = (tableName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
311
|
-
var
|
|
311
|
+
var _a, _b, _c;
|
|
312
312
|
try {
|
|
313
313
|
const info = yield withRetry(() => exports.dynamoDb.send(new client_dynamodb_1.DescribeTableCommand({ TableName: tableName })), 'wipeTable-describe');
|
|
314
|
-
const keyHash = (
|
|
314
|
+
const keyHash = (_c = (_b = (_a = info.Table) === null || _a === void 0 ? void 0 : _a.KeySchema) === null || _b === void 0 ? void 0 : _b.find((k) => k.KeyType === 'HASH')) === null || _c === void 0 ? void 0 : _c.AttributeName;
|
|
315
315
|
if (!keyHash) {
|
|
316
316
|
throw new Error('Could not find hash key');
|
|
317
317
|
}
|
|
318
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
319
318
|
const scanResult = yield (0, exports.scan)(tableName);
|
|
320
319
|
if (isError(scanResult)) {
|
|
321
320
|
throw new Error(scanResult.error);
|
|
@@ -16,7 +16,6 @@ const enforceDynamoProvisionCap = ({ tables, readsMax = 25, writesMax = 25, must
|
|
|
16
16
|
(0, log_1.warn)('error in dynamo FT enforce');
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
19
|
const t = tables[0];
|
|
21
20
|
const s = (0, json_1.safeStringify)(t.node._children.Resource.node.scope);
|
|
22
21
|
const reads = extractSum({ str: s, regex: /readCapacityUnits.*/gim });
|
|
@@ -4,7 +4,6 @@ exports.openApiImpl = void 0;
|
|
|
4
4
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
5
|
const array_1 = require("../../common/helpers/array");
|
|
6
6
|
const log_1 = require("../../common/helpers/log");
|
|
7
|
-
// eslint-disable-next-line
|
|
8
7
|
const getPaths = (schema) => Object.entries(schema.paths).map(([fullPath, verbs]) => ({
|
|
9
8
|
fullPath,
|
|
10
9
|
pathList: fullPath.split('/').filter((s) => s),
|
|
@@ -152,7 +151,7 @@ const openApiImpl = (p) => {
|
|
|
152
151
|
});
|
|
153
152
|
});
|
|
154
153
|
Object.keys(lambdaConfig).forEach((k) => {
|
|
155
|
-
if (!seenPermissions[k]
|
|
154
|
+
if (!seenPermissions[k]) {
|
|
156
155
|
(0, log_1.warn)(`unused permissions for '${k}', did you mean one of these paths?=`, Object.entries(seenPermissions)
|
|
157
156
|
.filter(([, b]) => !b)
|
|
158
157
|
.map(([f]) => f)
|
package/dist/api/helpers/s3.d.ts
CHANGED
package/dist/api/helpers/s3.js
CHANGED
|
@@ -12,7 +12,7 @@ var __await = (this && this.__await) || function (v) { return this instanceof __
|
|
|
12
12
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
13
13
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
14
14
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
15
|
-
return i =
|
|
15
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
16
16
|
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
17
17
|
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
18
18
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
@@ -22,7 +22,10 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
|
|
|
22
22
|
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
25
|
+
exports.copyFile = exports.deleteFiles = exports.deleteFile = exports.putS3Object = exports.getS3Object = exports.s3 = exports.setS3 = void 0;
|
|
26
|
+
exports.getS3Objects = getS3Objects;
|
|
27
|
+
exports.listFiles = listFiles;
|
|
28
|
+
exports.getPresignedPostURL = getPresignedPostURL;
|
|
26
29
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
27
30
|
const s3_presigned_post_1 = require("@aws-sdk/s3-presigned-post");
|
|
28
31
|
const array_1 = require("../../common/helpers/array");
|
|
@@ -73,8 +76,7 @@ function getS3Objects(_a) {
|
|
|
73
76
|
}
|
|
74
77
|
});
|
|
75
78
|
}
|
|
76
|
-
|
|
77
|
-
const putS3Object = (_b) => __awaiter(void 0, [_b], void 0, function* ({ Body, Bucket, Key, ContentType, CacheControl = 'public, max-age=300', }) {
|
|
79
|
+
const putS3Object = (_a) => __awaiter(void 0, [_a], void 0, function* ({ Body, Bucket, Key, ContentType, CacheControl = 'public, max-age=300', }) {
|
|
78
80
|
try {
|
|
79
81
|
yield exports.s3.send(new client_s3_1.PutObjectCommand({ Body, Bucket, Key, ContentType, CacheControl }));
|
|
80
82
|
return {};
|
|
@@ -84,7 +86,7 @@ const putS3Object = (_b) => __awaiter(void 0, [_b], void 0, function* ({ Body, B
|
|
|
84
86
|
}
|
|
85
87
|
});
|
|
86
88
|
exports.putS3Object = putS3Object;
|
|
87
|
-
const deleteFile = (
|
|
89
|
+
const deleteFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ Bucket, Key, }) {
|
|
88
90
|
try {
|
|
89
91
|
yield exports.s3.send(new client_s3_1.DeleteObjectCommand({ Bucket, Key }));
|
|
90
92
|
return {};
|
|
@@ -94,8 +96,8 @@ const deleteFile = (_c) => __awaiter(void 0, [_c], void 0, function* ({ Bucket,
|
|
|
94
96
|
}
|
|
95
97
|
});
|
|
96
98
|
exports.deleteFile = deleteFile;
|
|
97
|
-
const deleteFiles = (
|
|
98
|
-
var
|
|
99
|
+
const deleteFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ Bucket, Keys, }) {
|
|
100
|
+
var _b;
|
|
99
101
|
try {
|
|
100
102
|
let toDelete = Keys.map((Key) => ({ Key }));
|
|
101
103
|
let deleted = 0;
|
|
@@ -106,7 +108,7 @@ const deleteFiles = (_d) => __awaiter(void 0, [_d], void 0, function* ({ Bucket,
|
|
|
106
108
|
Bucket,
|
|
107
109
|
Delete: { Objects: part },
|
|
108
110
|
}));
|
|
109
|
-
if (!((
|
|
111
|
+
if (!((_b = res.Deleted) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
110
112
|
throw new Error('no deleted files');
|
|
111
113
|
}
|
|
112
114
|
deleted += res.Deleted.length;
|
|
@@ -119,7 +121,7 @@ const deleteFiles = (_d) => __awaiter(void 0, [_d], void 0, function* ({ Bucket,
|
|
|
119
121
|
}
|
|
120
122
|
});
|
|
121
123
|
exports.deleteFiles = deleteFiles;
|
|
122
|
-
const copyFile = (
|
|
124
|
+
const copyFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ Bucket, fromKey, toKey, deleteSource = false, }) {
|
|
123
125
|
try {
|
|
124
126
|
(0, log_1.debug)(`copying s3 file from ${Bucket}- ${fromKey} to ${toKey}`);
|
|
125
127
|
yield exports.s3.send(new client_s3_1.CopyObjectCommand({
|
|
@@ -166,7 +168,6 @@ function listFiles(bucketName, opt) {
|
|
|
166
168
|
}
|
|
167
169
|
});
|
|
168
170
|
}
|
|
169
|
-
exports.listFiles = listFiles;
|
|
170
171
|
/**
|
|
171
172
|
* allow uploading of file directly to s3
|
|
172
173
|
* @param param0
|
|
@@ -200,4 +201,3 @@ function getPresignedPostURL(_a) {
|
|
|
200
201
|
}
|
|
201
202
|
});
|
|
202
203
|
}
|
|
203
|
-
exports.getPresignedPostURL = getPresignedPostURL;
|
package/dist/api/helpers/sts.js
CHANGED
|
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.sts = exports.setSts = void 0;
|
|
13
|
+
exports.assumeRole = assumeRole;
|
|
13
14
|
const client_sts_1 = require("@aws-sdk/client-sts");
|
|
14
15
|
const log_1 = require("../../common/helpers/log");
|
|
15
16
|
const setSts = (region) => {
|
|
@@ -53,4 +54,3 @@ function assumeRole(_a) {
|
|
|
53
54
|
}
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
|
-
exports.assumeRole = assumeRole;
|
|
@@ -12,8 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.validateOpenApi =
|
|
16
|
-
// eslint-disable-next-line import/no-unresolved
|
|
15
|
+
exports.validateOpenApi = validateOpenApi;
|
|
17
16
|
const openapi_request_validator_1 = __importDefault(require("openapi-request-validator"));
|
|
18
17
|
const i18n_1 = require("../../common/helpers/i18n");
|
|
19
18
|
const log_1 = require("../../common/helpers/log");
|
|
@@ -55,7 +54,6 @@ function validateOpenApi(_a) {
|
|
|
55
54
|
const request = {
|
|
56
55
|
method: event.httpMethod,
|
|
57
56
|
path: event.path,
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
57
|
params: undefined,
|
|
60
58
|
query: event.queryStringParameters,
|
|
61
59
|
body: (0, object_1.tryJsonParse)(event.body, event.body),
|
|
@@ -127,4 +125,3 @@ function validateOpenApi(_a) {
|
|
|
127
125
|
return res;
|
|
128
126
|
});
|
|
129
127
|
}
|
|
130
|
-
exports.validateOpenApi = validateOpenApi;
|
|
@@ -13,9 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.getAndValidateToken = void 0;
|
|
16
|
-
/* eslint-disable import/no-unresolved */
|
|
17
16
|
const jsonwebtoken_1 = require("jsonwebtoken");
|
|
18
|
-
// eslint-disable-next-line import/no-named-as-default
|
|
19
17
|
const jwks_rsa_1 = __importDefault(require("jwks-rsa"));
|
|
20
18
|
const log_1 = require("../../common/helpers/log");
|
|
21
19
|
const api_1 = require("./api");
|
|
@@ -63,8 +61,8 @@ const jwtVerify = (_a) => __awaiter(void 0, [_a], void 0, function* ({ token, jw
|
|
|
63
61
|
});
|
|
64
62
|
});
|
|
65
63
|
/** extracts user details from oauth token */
|
|
66
|
-
const getAndValidateToken = (
|
|
67
|
-
var
|
|
64
|
+
const getAndValidateToken = (_a) => __awaiter(void 0, [_a], void 0, function* ({ tokenRaw, jwksRegion = 'ap-southeast-2', COGNITO_USER_POOL_ID, }) {
|
|
65
|
+
var _b;
|
|
68
66
|
const jwksUri = `https://cognito-idp.${jwksRegion}.amazonaws.com/${COGNITO_USER_POOL_ID}/.well-known/jwks.json`;
|
|
69
67
|
const issuer = `https://cognito-idp.${jwksRegion}.amazonaws.com/${COGNITO_USER_POOL_ID}`;
|
|
70
68
|
let token = '';
|
|
@@ -103,7 +101,7 @@ const getAndValidateToken = (_b) => __awaiter(void 0, [_b], void 0, function* ({
|
|
|
103
101
|
throw new Error(mess);
|
|
104
102
|
}
|
|
105
103
|
let { picture } = decoded;
|
|
106
|
-
if (((
|
|
104
|
+
if (((_b = decoded.identities[0]) === null || _b === void 0 ? void 0 : _b.providerName) === 'Facebook') {
|
|
107
105
|
picture = JSON.parse(decoded.picture).data.url;
|
|
108
106
|
}
|
|
109
107
|
const userId = decoded.email.toLowerCase();
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './helpers';
|
|
2
|
-
export * from './types';
|
|
2
|
+
export type * from './types';
|
package/dist/api/index.js
CHANGED
|
@@ -8,9 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
12
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
13
|
-
/* eslint-disable no-console */
|
|
14
11
|
var { load } = require('js-yaml');
|
|
15
12
|
const SwaggerParser = require('swagger-parser');
|
|
16
13
|
const fs = require('fs');
|
|
@@ -20,7 +17,6 @@ var cwd = process.cwd();
|
|
|
20
17
|
var resolvePath = (p) => pathV.resolve(cwd, p);
|
|
21
18
|
//
|
|
22
19
|
function cleanSrc() {
|
|
23
|
-
// eslint-disable-next-line no-console
|
|
24
20
|
console.log('fixing colons in field names');
|
|
25
21
|
let files = fs
|
|
26
22
|
.readdirSync(resolvePath('./src/api'))
|
|
@@ -72,14 +68,12 @@ function generateJs() {
|
|
|
72
68
|
return;
|
|
73
69
|
}
|
|
74
70
|
const yml = load(fs.readFileSync(p, 'utf8'));
|
|
75
|
-
// eslint-disable-next-line
|
|
76
71
|
const schema = yield SwaggerParser.validate(yml);
|
|
77
72
|
const content = `var ret=${JSON.stringify(schema)};\nmodule.exports.default=ret`;
|
|
78
73
|
fs.writeFileSync(resolvePath('./openapi.generated.js'), content);
|
|
79
74
|
console.log('generated');
|
|
80
75
|
}
|
|
81
76
|
catch (e) {
|
|
82
|
-
// eslint-disable-next-line no-console
|
|
83
77
|
console.log('err=', e);
|
|
84
78
|
}
|
|
85
79
|
});
|
package/dist/api/types/index.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./aws"), exports);
|
|
@@ -7,7 +7,7 @@ export declare const take: <T>(array: T[], num: number) => {
|
|
|
7
7
|
export declare const chunk: <T>(array: T[], max: number) => T[][];
|
|
8
8
|
export declare const partition: <T>(array: T[], func: (v: T) => boolean) => T[][] | null;
|
|
9
9
|
/** removes null, undefined, false, empty string */
|
|
10
|
-
export declare const notEmpty: <TValue>(value: TValue | null | undefined | false |
|
|
10
|
+
export declare const notEmpty: <TValue>(value: TValue | null | undefined | false | "") => value is TValue;
|
|
11
11
|
/**
|
|
12
12
|
* return a distinct array of items determined by a key function
|
|
13
13
|
* @param data
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insertElementAtIndex = exports.
|
|
3
|
+
exports.insertElementAtIndex = exports.distinct = exports.notEmpty = exports.partition = exports.chunk = exports.take = exports.flat = exports.arrayToObject = void 0;
|
|
4
|
+
exports.distinctBy = distinctBy;
|
|
5
|
+
exports.findLastIndex = findLastIndex;
|
|
4
6
|
const arrayToObject = (
|
|
5
7
|
/**
|
|
6
8
|
* array items
|
|
@@ -26,7 +28,6 @@ valueF) => {
|
|
|
26
28
|
return ret;
|
|
27
29
|
};
|
|
28
30
|
exports.arrayToObject = arrayToObject;
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
30
31
|
// @ts-ignore
|
|
31
32
|
const flat = (arr) => [].concat(...arr);
|
|
32
33
|
exports.flat = flat;
|
|
@@ -92,7 +93,6 @@ function distinctBy(data, key, ignoreEmpty) {
|
|
|
92
93
|
return false;
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
|
-
exports.distinctBy = distinctBy;
|
|
96
96
|
const distinct = (arr) => [
|
|
97
97
|
...new Set(arr),
|
|
98
98
|
];
|
|
@@ -105,6 +105,5 @@ function findLastIndex(arr, predicate) {
|
|
|
105
105
|
}
|
|
106
106
|
return -1;
|
|
107
107
|
}
|
|
108
|
-
exports.findLastIndex = findLastIndex;
|
|
109
108
|
const insertElementAtIndex = (arr, element, index) => [...arr.slice(0, index), element, ...arr.slice(index)];
|
|
110
109
|
exports.insertElementAtIndex = insertElementAtIndex;
|
|
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.asyncForEach = asyncForEach;
|
|
13
|
+
exports.asyncMap = asyncMap;
|
|
13
14
|
const array_1 = require("./array");
|
|
14
15
|
/**
|
|
15
16
|
* run async forEach over all array items
|
|
@@ -31,7 +32,6 @@ function asyncForEach(array, callback, opt) {
|
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
|
-
exports.asyncForEach = asyncForEach;
|
|
35
35
|
/**
|
|
36
36
|
* run async map over all array items
|
|
37
37
|
* @param array
|
|
@@ -56,4 +56,3 @@ function asyncMap(array, callback, opt) {
|
|
|
56
56
|
return ret;
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
exports.asyncMap = asyncMap;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Buffer } from 'buffer';
|
|
3
|
-
export declare const toBuffer: (ab: ArrayBuffer) => Buffer
|
|
2
|
+
export declare const toBuffer: (ab: ArrayBuffer) => Buffer<ArrayBufferLike>;
|
|
4
3
|
export declare function bufferToArrayBuffer(buffer: Buffer): ArrayBuffer;
|
|
5
|
-
export declare function b64ToArrayBuffer(base64: string):
|
|
4
|
+
export declare function b64ToArrayBuffer(base64: string): ArrayBuffer;
|
|
6
5
|
/**
|
|
7
6
|
* convert an ArrayBuffer (usually from file.arrayBuffer) to base64. Usually on client side before server send
|
|
8
7
|
* @param buffer
|
|
@@ -14,4 +13,4 @@ export declare function arrayBufferToBase64(buffer: ArrayBuffer): string;
|
|
|
14
13
|
* @param raw
|
|
15
14
|
* @returns
|
|
16
15
|
*/
|
|
17
|
-
export declare const base64ToBinary: (raw: string) => Buffer
|
|
16
|
+
export declare const base64ToBinary: (raw: string) => Buffer<ArrayBufferLike>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.base64ToBinary = exports.
|
|
3
|
+
exports.base64ToBinary = exports.toBuffer = void 0;
|
|
4
|
+
exports.bufferToArrayBuffer = bufferToArrayBuffer;
|
|
5
|
+
exports.b64ToArrayBuffer = b64ToArrayBuffer;
|
|
6
|
+
exports.arrayBufferToBase64 = arrayBufferToBase64;
|
|
4
7
|
const buffer_1 = require("buffer");
|
|
5
8
|
const base64_1 = require("./string/base64");
|
|
6
9
|
const toBuffer = (ab) => buffer_1.Buffer.from(ab);
|
|
@@ -13,7 +16,6 @@ function bufferToArrayBuffer(buffer) {
|
|
|
13
16
|
}
|
|
14
17
|
return arrayBuffer;
|
|
15
18
|
}
|
|
16
|
-
exports.bufferToArrayBuffer = bufferToArrayBuffer;
|
|
17
19
|
function b64ToArrayBuffer(base64) {
|
|
18
20
|
const binary_string = (0, base64_1.fromBase64)(base64);
|
|
19
21
|
const len = binary_string.length;
|
|
@@ -23,7 +25,6 @@ function b64ToArrayBuffer(base64) {
|
|
|
23
25
|
}
|
|
24
26
|
return bytes.buffer;
|
|
25
27
|
}
|
|
26
|
-
exports.b64ToArrayBuffer = b64ToArrayBuffer;
|
|
27
28
|
/**
|
|
28
29
|
* convert an ArrayBuffer (usually from file.arrayBuffer) to base64. Usually on client side before server send
|
|
29
30
|
* @param buffer
|
|
@@ -38,7 +39,6 @@ function arrayBufferToBase64(buffer) {
|
|
|
38
39
|
}
|
|
39
40
|
return (0, base64_1.toBase64)(binary);
|
|
40
41
|
}
|
|
41
|
-
exports.arrayBufferToBase64 = arrayBufferToBase64;
|
|
42
42
|
/**
|
|
43
43
|
* convert a base64 string to a binary Buffer. Usually on server side from client sent content
|
|
44
44
|
* @param raw
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadCsvAsJson =
|
|
3
|
+
exports.loadCsvAsJson = loadCsvAsJson;
|
|
4
4
|
const math_1 = require("./math");
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
5
|
function loadCsvAsJson(p) {
|
|
7
6
|
const lines = p.fileData.split(/[\r]?\n/);
|
|
8
7
|
let sep = ',';
|
|
@@ -55,4 +54,3 @@ function loadCsvAsJson(p) {
|
|
|
55
54
|
});
|
|
56
55
|
return jsonData;
|
|
57
56
|
}
|
|
58
|
-
exports.loadCsvAsJson = loadCsvAsJson;
|
|
@@ -55,7 +55,6 @@ exports.CSharpToJs = CSharpToJs;
|
|
|
55
55
|
const dateTimeToNearestMinute = (minutes, date) => {
|
|
56
56
|
const coeff = 1000 * 60 * minutes;
|
|
57
57
|
if (!date) {
|
|
58
|
-
// eslint-disable-next-line no-param-reassign
|
|
59
58
|
date = new Date();
|
|
60
59
|
}
|
|
61
60
|
const rounded = new Date(Math.round(date.getTime() / coeff) * coeff);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.retry =
|
|
3
|
+
exports.retry = retry;
|
|
4
4
|
const log_1 = require("./log");
|
|
5
5
|
function retry(name, fn, retriesLeft = 3, interval = 1000) {
|
|
6
6
|
return new Promise((resolve, reject) => {
|
|
@@ -19,4 +19,3 @@ function retry(name, fn, retriesLeft = 3, interval = 1000) {
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
exports.retry = retry;
|
|
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.runGenerator =
|
|
13
|
-
/* eslint-disable no-await-in-loop */
|
|
12
|
+
exports.runGenerator = runGenerator;
|
|
14
13
|
function runGenerator(iter, partialRun) {
|
|
15
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
15
|
let curr;
|
|
@@ -23,4 +22,3 @@ function runGenerator(iter, partialRun) {
|
|
|
23
22
|
} while (!curr.done);
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
|
-
exports.runGenerator = runGenerator;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.groupBy = groupBy;
|
|
4
|
+
exports.groupByList = groupByList;
|
|
5
|
+
exports.groupByTwice = groupByTwice;
|
|
4
6
|
/**
|
|
5
7
|
* group an array of items by the output of a key function
|
|
6
8
|
* @param arr
|
|
@@ -17,7 +19,6 @@ function groupBy(arr, getKey) {
|
|
|
17
19
|
});
|
|
18
20
|
return ret;
|
|
19
21
|
}
|
|
20
|
-
exports.groupBy = groupBy;
|
|
21
22
|
/**
|
|
22
23
|
* group an array of items by the output of a key function
|
|
23
24
|
* @param arr
|
|
@@ -37,7 +38,6 @@ function groupByList(arr, getKey) {
|
|
|
37
38
|
});
|
|
38
39
|
return ret;
|
|
39
40
|
}
|
|
40
|
-
exports.groupByList = groupByList;
|
|
41
41
|
function groupByTwice(arr, getKey, getSubKey) {
|
|
42
42
|
const ret = {};
|
|
43
43
|
arr.forEach((item) => {
|
|
@@ -50,4 +50,3 @@ function groupByTwice(arr, getKey, getSubKey) {
|
|
|
50
50
|
});
|
|
51
51
|
return ret;
|
|
52
52
|
}
|
|
53
|
-
exports.groupByTwice = groupByTwice;
|