@salto-io/persistent-pool 0.3.40-main.5ef2e84db → 0.3.40-publishOnlyDist.57b77fb79
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 +7 -8
- package/dist/test/lib/dynamodb/dynamodb_repo.e2e.test.d.ts +0 -2
- package/dist/test/lib/dynamodb/dynamodb_repo.e2e.test.d.ts.map +0 -1
- package/dist/test/lib/dynamodb/dynamodb_repo.e2e.test.js +0 -98
- package/dist/test/lib/dynamodb/dynamodb_repo.e2e.test.js.map +0 -1
- package/dist/test/lib/dynamodb/dynamodb_repo.test.d.ts +0 -2
- package/dist/test/lib/dynamodb/dynamodb_repo.test.d.ts.map +0 -1
- package/dist/test/lib/dynamodb/dynamodb_repo.test.js +0 -533
- package/dist/test/lib/dynamodb/dynamodb_repo.test.js.map +0 -1
- package/dist/test/lib/dynamodb/environment/index.d.ts +0 -9
- package/dist/test/lib/dynamodb/environment/index.d.ts.map +0 -1
- package/dist/test/lib/dynamodb/environment/index.js +0 -70
- package/dist/test/lib/dynamodb/environment/index.js.map +0 -1
- package/dist/test/lib/dynamodb/environment/types.d.ts +0 -7
- package/dist/test/lib/dynamodb/environment/types.d.ts.map +0 -1
- package/dist/test/lib/dynamodb/environment/types.js +0 -3
- package/dist/test/lib/dynamodb/environment/types.js.map +0 -1
- package/dist/test/lib/dynamodb/utils.d.ts +0 -12
- package/dist/test/lib/dynamodb/utils.d.ts.map +0 -1
- package/dist/test/lib/dynamodb/utils.js +0 -53
- package/dist/test/lib/dynamodb/utils.js.map +0 -1
- package/dist/test/lib/renewed_lease.test.d.ts +0 -2
- package/dist/test/lib/renewed_lease.test.d.ts.map +0 -1
- package/dist/test/lib/renewed_lease.test.js +0 -134
- package/dist/test/lib/renewed_lease.test.js.map +0 -1
- package/dist/test/mock_repo.d.ts +0 -8
- package/dist/test/mock_repo.d.ts.map +0 -1
- package/dist/test/mock_repo.js +0 -22
- package/dist/test/mock_repo.js.map +0 -1
- package/dist/test/types.d.ts +0 -7
- package/dist/test/types.d.ts.map +0 -1
- package/dist/test/types.js +0 -9
- package/dist/test/types.js.map +0 -1
- package/dist/test/utils/async_to_array.d.ts +0 -3
- package/dist/test/utils/async_to_array.d.ts.map +0 -1
- package/dist/test/utils/async_to_array.js +0 -32
- package/dist/test/utils/async_to_array.js.map +0 -1
- package/dist/test/utils/promise_series.d.ts +0 -3
- package/dist/test/utils/promise_series.d.ts.map +0 -1
- package/dist/test/utils/promise_series.js +0 -28
- package/dist/test/utils/promise_series.js.map +0 -1
- package/dist/test/utils/random_string.d.ts +0 -6
- package/dist/test/utils/random_string.d.ts.map +0 -1
- package/dist/test/utils/random_string.js +0 -22
- package/dist/test/utils/random_string.js.map +0 -1
- package/dist/test/utils/repeat.d.ts +0 -3
- package/dist/test/utils/repeat.d.ts.map +0 -1
- package/dist/test/utils/repeat.js +0 -20
- package/dist/test/utils/repeat.js.map +0 -1
- package/dist/test/utils/timing.d.ts +0 -10
- package/dist/test/utils/timing.d.ts.map +0 -1
- package/dist/test/utils/timing.js +0 -39
- package/dist/test/utils/timing.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -14427
- package/src/index.ts +0 -21
- package/src/lib/dynamodb/dynamodb_repo.ts +0 -487
- package/src/lib/dynamodb/utils.ts +0 -168
- package/src/lib/renewed_lease.ts +0 -83
- package/src/types.ts +0 -106
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../test/lib/dynamodb/environment/index.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;EAcE;AACF,iDAAiD;AACjD,iFAAoE;AACpE,8EAEmD;AACnD,iFAAuD;AACvD,oCAAyD;AAGzD,MAAqB,WAAY,SAAQ,qBAAuB;IAC9D,MAAM,CAAC,WAAW;QAChB,MAAM,WAAW,GAAG;YAClB,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB;YAC5C,UAAU,EAA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AAA;SACxD;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAA;IAC9B,CAAC;CACF;AA/CD,8BA+CC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../test/lib/dynamodb/environment/types.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAA;AAE9E,oBAAY,iBAAiB,GAAG;IAC9B,MAAM,EAAE,iBAAiB,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../test/lib/dynamodb/environment/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
import { retry } from '@salto-io/lowerdash';
|
|
3
|
-
export declare const testDbUtils: (db: DynamoDBClient) => {
|
|
4
|
-
tableStatus: (tableName: string) => Promise<string | undefined>;
|
|
5
|
-
tableExists: (tableName: string) => Promise<boolean>;
|
|
6
|
-
ensureTableExists: (tableParams: import("@aws-sdk/client-dynamodb").CreateTableCommandInput & {
|
|
7
|
-
TableName: string;
|
|
8
|
-
}, waitOpts?: retry.RetryOpts | undefined) => Promise<void>;
|
|
9
|
-
} & {
|
|
10
|
-
deleteTable: (tableName: string) => Promise<void>;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../test/lib/dynamodb/utils.ts"],"names":[],"mappings":"AAeA,OAAO,EAEL,cAAc,EACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAM3C,eAAO,MAAM,WAAW,OAAQ,cAAc;;;;;;;6BAI/B,MAAM,KAChB,QAAQ,IAAI,CAAC;CA4BjB,CAAA"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.testDbUtils = void 0;
|
|
4
|
-
/*
|
|
5
|
-
* Copyright 2023 Salto Labs Ltd.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with
|
|
9
|
-
* the License. You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
20
|
-
const lowerdash_1 = require("@salto-io/lowerdash");
|
|
21
|
-
const utils_1 = require("../../../src/lib/dynamodb/utils");
|
|
22
|
-
const { withRetry } = lowerdash_1.retry;
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
24
|
-
const testDbUtils = (db) => {
|
|
25
|
-
const utils = utils_1.dbUtils(db);
|
|
26
|
-
const deleteTable = async (tableName) => {
|
|
27
|
-
try {
|
|
28
|
-
const deleteCommand = new client_dynamodb_1.DeleteTableCommand({ TableName: tableName });
|
|
29
|
-
await db.send(deleteCommand);
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
if (e.toString().includes('ResourceNotFoundException')) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
if (e.code === 'ResourceInUseException') {
|
|
36
|
-
let status;
|
|
37
|
-
await withRetry(async () => {
|
|
38
|
-
status = await utils.tableStatus(tableName);
|
|
39
|
-
return [undefined, 'ACTIVE'].includes(status);
|
|
40
|
-
});
|
|
41
|
-
if (status !== undefined) {
|
|
42
|
-
return deleteTable(tableName);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
throw e;
|
|
46
|
-
}
|
|
47
|
-
await withRetry(async () => !(await utils.tableExists(tableName)));
|
|
48
|
-
return undefined;
|
|
49
|
-
};
|
|
50
|
-
return Object.assign(utils, { deleteTable });
|
|
51
|
-
};
|
|
52
|
-
exports.testDbUtils = testDbUtils;
|
|
53
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../test/lib/dynamodb/utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;EAcE;AACF,8DAGiC;AACjC,mDAA2C;AAC3C,2DAAyD;AAEzD,MAAM,EAAE,SAAS,EAAE,GAAG,iBAAK,CAAA;AAE3B,4EAA4E;AACrE,MAAM,WAAW,GAAG,CAAC,EAAkB,EAAE,EAAE;IAChD,MAAM,KAAK,GAAG,eAAO,CAAC,EAAE,CAAC,CAAA;IAEzB,MAAM,WAAW,GAAG,KAAK,EACvB,SAAiB,EACF,EAAE;QACjB,IAAI;YACF,MAAM,aAAa,GAAG,IAAI,oCAAkB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAA;YACtE,MAAM,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;SAC7B;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC,EAAE;gBACtD,OAAO,SAAS,CAAA;aACjB;YAED,IAAI,CAAC,CAAC,IAAI,KAAK,wBAAwB,EAAE;gBACvC,IAAI,MAA0B,CAAA;gBAC9B,MAAM,SAAS,CAAC,KAAK,IAAI,EAAE;oBACzB,MAAM,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;oBAC3C,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;gBAC/C,CAAC,CAAC,CAAA;gBACF,IAAI,MAAM,KAAK,SAAS,EAAE;oBACxB,OAAO,WAAW,CAAC,SAAS,CAAC,CAAA;iBAC9B;aACF;YAED,MAAM,CAAC,CAAA;SACR;QAED,MAAM,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAClE,OAAO,SAAS,CAAA;IAClB,CAAC,CAAA;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,CAAA;AAC9C,CAAC,CAAA;AAjCY,QAAA,WAAW,eAiCvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renewed_lease.test.d.ts","sourceRoot":"","sources":["../../../test/lib/renewed_lease.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/*
|
|
4
|
-
* Copyright 2023 Salto Labs Ltd.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with
|
|
8
|
-
* the License. You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
const index_1 = require("../../src/index");
|
|
19
|
-
const mock_repo_1 = require("../mock_repo");
|
|
20
|
-
jest.useFakeTimers('legacy');
|
|
21
|
-
describe('RenewedLease', () => {
|
|
22
|
-
let pool;
|
|
23
|
-
const lease = { id: 'my-id', value: { x: 42 } };
|
|
24
|
-
const timeout = 100;
|
|
25
|
-
const renewMargin = 5;
|
|
26
|
-
let renewedLease;
|
|
27
|
-
beforeEach(() => {
|
|
28
|
-
pool = mock_repo_1.createMockPool();
|
|
29
|
-
});
|
|
30
|
-
describe('constructor', () => {
|
|
31
|
-
beforeEach(() => {
|
|
32
|
-
jest.clearAllMocks();
|
|
33
|
-
});
|
|
34
|
-
beforeEach(() => {
|
|
35
|
-
renewedLease = new index_1.RenewedLease({
|
|
36
|
-
poolOrFactory: pool,
|
|
37
|
-
lease,
|
|
38
|
-
timeout,
|
|
39
|
-
renewMargin,
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
it('has the Lease properties', () => {
|
|
43
|
-
expect(renewedLease).toMatchObject(lease);
|
|
44
|
-
});
|
|
45
|
-
it('sets a renew timeout', () => {
|
|
46
|
-
expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 95);
|
|
47
|
-
});
|
|
48
|
-
describe('renew timeout', () => {
|
|
49
|
-
beforeEach(() => {
|
|
50
|
-
jest.clearAllMocks();
|
|
51
|
-
jest.advanceTimersByTime(95);
|
|
52
|
-
});
|
|
53
|
-
it('calls pool.updateTimeout correctly', () => {
|
|
54
|
-
expect(pool.updateTimeout).toHaveBeenLastCalledWith(lease.id, 100);
|
|
55
|
-
});
|
|
56
|
-
it('sets another renew timeout', () => {
|
|
57
|
-
expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 95);
|
|
58
|
-
});
|
|
59
|
-
describe('another renew timeout', () => {
|
|
60
|
-
beforeEach(() => {
|
|
61
|
-
jest.clearAllMocks();
|
|
62
|
-
jest.advanceTimersByTime(95);
|
|
63
|
-
});
|
|
64
|
-
it('calls pool.updateTimeout correctly', () => {
|
|
65
|
-
expect(pool.updateTimeout).toHaveBeenLastCalledWith(lease.id, 100);
|
|
66
|
-
});
|
|
67
|
-
it('sets another renew timeout', () => {
|
|
68
|
-
expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 95);
|
|
69
|
-
});
|
|
70
|
-
describe('when calling return', () => {
|
|
71
|
-
const opts = { validateClientId: false };
|
|
72
|
-
beforeEach(async () => {
|
|
73
|
-
jest.clearAllMocks();
|
|
74
|
-
await renewedLease.return(opts);
|
|
75
|
-
});
|
|
76
|
-
it('calls pool.return correctly', () => {
|
|
77
|
-
expect(pool.return).toHaveBeenCalledWith('my-id', opts);
|
|
78
|
-
});
|
|
79
|
-
it('clears the renew timeout', () => {
|
|
80
|
-
expect(clearTimeout).toHaveBeenCalled();
|
|
81
|
-
});
|
|
82
|
-
describe('once another renew time had passed', () => {
|
|
83
|
-
beforeEach(() => {
|
|
84
|
-
jest.advanceTimersByTime(timeout * 10);
|
|
85
|
-
});
|
|
86
|
-
it('does not call pool.updateTimeout', () => {
|
|
87
|
-
expect(pool.updateTimeout).not.toHaveBeenCalled();
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
describe('when calling return again', () => {
|
|
91
|
-
beforeEach(async () => {
|
|
92
|
-
jest.clearAllMocks();
|
|
93
|
-
await renewedLease.return(opts);
|
|
94
|
-
});
|
|
95
|
-
it('does not clear the renew timeout again', () => {
|
|
96
|
-
expect(clearTimeout).not.toHaveBeenCalled();
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
it('when renew throws InstanceNotLeasedError should stop silently', () => {
|
|
103
|
-
jest.clearAllMocks();
|
|
104
|
-
const instanceNotLeasedError = new index_1.InstanceNotLeasedError({ id: '1', typeName: '1', clientId: '1' });
|
|
105
|
-
pool.updateTimeout.mockRejectedValueOnce(instanceNotLeasedError);
|
|
106
|
-
expect(setTimeout).not.toHaveBeenCalled();
|
|
107
|
-
});
|
|
108
|
-
// eslint-disable-next-line jest/no-disabled-tests
|
|
109
|
-
it.skip('when renew throws unknown error should stop silently', () => {
|
|
110
|
-
jest.clearAllMocks();
|
|
111
|
-
const instanceNotLeasedError = new Error();
|
|
112
|
-
pool.updateTimeout.mockRejectedValueOnce(instanceNotLeasedError);
|
|
113
|
-
expect(setTimeout).not.toHaveBeenCalled();
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
describe('poolOrFactory', () => {
|
|
117
|
-
describe('when it is a factory Pool', () => {
|
|
118
|
-
beforeEach(() => {
|
|
119
|
-
renewedLease = new index_1.RenewedLease({
|
|
120
|
-
poolOrFactory: () => Promise.resolve(pool),
|
|
121
|
-
lease,
|
|
122
|
-
timeout,
|
|
123
|
-
renewMargin,
|
|
124
|
-
});
|
|
125
|
-
jest.clearAllMocks();
|
|
126
|
-
jest.advanceTimersByTime(95);
|
|
127
|
-
});
|
|
128
|
-
it('calls pool.updateTimeout correctly', () => {
|
|
129
|
-
expect(pool.updateTimeout).toHaveBeenLastCalledWith(lease.id, 100);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
//# sourceMappingURL=renewed_lease.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renewed_lease.test.js","sourceRoot":"","sources":["../../../test/lib/renewed_lease.test.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;EAcE;AACF,2CAAoG;AACpG,4CAAsD;AAEtD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;AAE5B,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAE5B,IAAI,IAA2B,CAAA;IAC/B,MAAM,KAAK,GAAkB,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAA;IAC9D,MAAM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YACnE,IAAI,CAAC,aAAa,EAAE,CAAA;YACpB,MAAM,sBAAsB,GAAG,IAAI,KAAK,EAAE,CAAA;YAC1C,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,sBAAsB,CAAC,CAAA;YAChE,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;QAC3C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC7B,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACzC,UAAU,CAAC,GAAG,EAAE;gBACd,YAAY,GAAG,IAAI,oBAAY,CAAC;oBAC9B,aAAa,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;oBAC1C,KAAK;oBACL,OAAO;oBACP,WAAW;iBACZ,CAAC,CAAA;gBAEF,IAAI,CAAC,aAAa,EAAE,CAAA;gBACpB,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAA;YAC9B,CAAC,CAAC,CAAA;YAEF,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;gBAC5C,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;YACpE,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/test/mock_repo.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
|
-
import { Repo, Pool } from '../src/index';
|
|
3
|
-
export declare type MockObj<T> = T & {
|
|
4
|
-
[K in keyof T]: T[K] extends (...args: any) => any ? jest.Mock<ReturnType<T[K]>> : never;
|
|
5
|
-
};
|
|
6
|
-
export declare const createMockPool: <T>() => MockObj<Pool<T>>;
|
|
7
|
-
export declare const createMockRepo: () => Repo;
|
|
8
|
-
//# sourceMappingURL=mock_repo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock_repo.d.ts","sourceRoot":"","sources":["../../test/mock_repo.ts"],"names":[],"mappings":";AAgBA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAA;AAW1D,oBAAY,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG;KAE1B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK;CACzF,CAAA;AASD,eAAO,MAAM,cAAc,2BAUzB,CAAA;AAEF,eAAO,MAAM,cAAc,QAAO,IAEhC,CAAA"}
|
package/dist/test/mock_repo.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMockRepo = exports.createMockPool = void 0;
|
|
4
|
-
const mockFunc = () => jest.fn();
|
|
5
|
-
const mockPoolFunc = () => mockFunc();
|
|
6
|
-
const createMockPool = () => ({
|
|
7
|
-
[Symbol.asyncIterator]: jest.fn(),
|
|
8
|
-
register: mockPoolFunc(),
|
|
9
|
-
unregister: mockPoolFunc(),
|
|
10
|
-
suspend: mockPoolFunc(),
|
|
11
|
-
lease: mockPoolFunc(),
|
|
12
|
-
waitForLease: mockPoolFunc(),
|
|
13
|
-
updateTimeout: mockPoolFunc(),
|
|
14
|
-
return: mockPoolFunc(),
|
|
15
|
-
clear: mockPoolFunc(),
|
|
16
|
-
});
|
|
17
|
-
exports.createMockPool = createMockPool;
|
|
18
|
-
const createMockRepo = () => ({
|
|
19
|
-
pool: () => Promise.resolve(exports.createMockPool()),
|
|
20
|
-
});
|
|
21
|
-
exports.createMockRepo = createMockRepo;
|
|
22
|
-
//# sourceMappingURL=mock_repo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock_repo.js","sourceRoot":"","sources":["../../test/mock_repo.ts"],"names":[],"mappings":";;;AAkBA,MAAM,QAAQ,GAAG,GAOQ,EAAE,CAAC,IAAI,CAAC,EAAE,EAAU,CAAA;AAO7C,MAAM,YAAY,GAAG,GAK0B,EAAE,CAAC,QAAQ,EAAe,CAAA;AAElE,MAAM,cAAc,GAAG,GAAwB,EAAE,CAAC,CAAC;IACxD,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC,EAAE,EAAyC;IACxE,QAAQ,EAAE,YAAY,EAAiB;IACvC,UAAU,EAAE,YAAY,EAAmB;IAC3C,OAAO,EAAE,YAAY,EAAgB;IACrC,KAAK,EAAE,YAAY,EAAc;IACjC,YAAY,EAAE,YAAY,EAAqB;IAC/C,aAAa,EAAE,YAAY,EAAsB;IACjD,MAAM,EAAE,YAAY,EAAe;IACnC,KAAK,EAAE,YAAY,EAAc;CAClC,CAAC,CAAA;AAVW,QAAA,cAAc,kBAUzB;AAEK,MAAM,cAAc,GAAG,GAAS,EAAE,CAAC,CAAC;IACzC,IAAI,EAAE,GAAwB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAc,EAAK,CAAC;CACtE,CAAC,CAAA;AAFW,QAAA,cAAc,kBAEzB"}
|
package/dist/test/types.d.ts
DELETED
package/dist/test/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../test/types.ts"],"names":[],"mappings":"AAeA,oBAAY,MAAM,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,UAAU,WAAW,CAAA;AAElC,eAAO,MAAM,KAAK,EAAE,MAGlB,CAAA"}
|
package/dist/test/types.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.myVal = exports.myTypeName = void 0;
|
|
4
|
-
exports.myTypeName = 'myType';
|
|
5
|
-
exports.myVal = Object.freeze({
|
|
6
|
-
intVal: 12,
|
|
7
|
-
arrayOfStrings: ['hello', 'world'],
|
|
8
|
-
});
|
|
9
|
-
//# sourceMappingURL=types.js.map
|
package/dist/test/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../test/types.ts"],"names":[],"mappings":";;;AAoBa,QAAA,UAAU,GAAG,QAAQ,CAAA;AAErB,QAAA,KAAK,GAAW,MAAM,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,EAAE;IACV,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;CACnC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async_to_array.d.ts","sourceRoot":"","sources":["../../../test/utils/async_to_array.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,YAAY,mDAYjB,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/*
|
|
4
|
-
* Copyright 2023 Salto Labs Ltd.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with
|
|
8
|
-
* the License. You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
const asyncToArray = (i) => {
|
|
19
|
-
const result = [];
|
|
20
|
-
const iter = i[Symbol.asyncIterator]();
|
|
21
|
-
const next = async () => {
|
|
22
|
-
const { done, value } = await iter.next();
|
|
23
|
-
if (done) {
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
result.push(value);
|
|
27
|
-
return next();
|
|
28
|
-
};
|
|
29
|
-
return next();
|
|
30
|
-
};
|
|
31
|
-
exports.default = asyncToArray;
|
|
32
|
-
//# sourceMappingURL=async_to_array.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async_to_array.js","sourceRoot":"","sources":["../../../test/utils/async_to_array.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;EAcE;AACF,MAAM,YAAY,GAAG,CAAI,CAAmB,EAA6B,EAAE;IACzE,MAAM,MAAM,GAAQ,EAAE,CAAA;IACtB,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;IACtC,MAAM,IAAI,GAAG,KAAK,IAAkB,EAAE;QACpC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QACzC,IAAI,IAAI,EAAE;YACR,OAAO,MAAM,CAAA;SACd;QACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAClB,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;IACD,OAAO,IAAI,EAAE,CAAA;AACf,CAAC,CAAA;AAED,kBAAe,YAAY,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promise_series.d.ts","sourceRoot":"","sources":["../../../test/utils/promise_series.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,aAAa,kCAAmC,MAAM,KAAG,QAAQ,IAAI,CAQ1E,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/*
|
|
4
|
-
* Copyright 2023 Salto Labs Ltd.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with
|
|
8
|
-
* the License. You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
const promiseSeries = (f, count) => {
|
|
19
|
-
const next = async (i = 0) => {
|
|
20
|
-
if (i < count) {
|
|
21
|
-
await f();
|
|
22
|
-
await next(i + 1);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
return next();
|
|
26
|
-
};
|
|
27
|
-
exports.default = promiseSeries;
|
|
28
|
-
//# sourceMappingURL=promise_series.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promise_series.js","sourceRoot":"","sources":["../../../test/utils/promise_series.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;EAcE;AACF,MAAM,aAAa,GAAG,CAAI,CAAmB,EAAE,KAAa,EAAiB,EAAE;IAC7E,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC,GAAG,CAAC,EAAiB,EAAE;QAC1C,IAAI,CAAC,GAAG,KAAK,EAAE;YACb,MAAM,CAAC,EAAE,CAAA;YACT,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;SAClB;IACH,CAAC,CAAA;IACD,OAAO,IAAI,EAAE,CAAA;AACf,CAAC,CAAA;AAED,kBAAe,aAAa,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"random_string.d.ts","sourceRoot":"","sources":["../../../test/utils/random_string.ts"],"names":[],"mappings":";;;MAsBG,MAAM;AALT,wBAOW"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/*
|
|
4
|
-
* Copyright 2023 Salto Labs Ltd.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with
|
|
8
|
-
* the License. You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
const DEFAULT_ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
19
|
-
exports.default = ({ length = 10, alphabet = DEFAULT_ALPHABET } = {}) => Array(...Array(length))
|
|
20
|
-
.map(() => alphabet.charAt(Math.floor(Math.random() * alphabet.length)))
|
|
21
|
-
.join('');
|
|
22
|
-
//# sourceMappingURL=random_string.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"random_string.js","sourceRoot":"","sources":["../../../test/utils/random_string.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;EAcE;AACF,MAAM,gBAAgB,GAAG,gEAAgE,CAAA;AAEzF,kBAAe,CACb,EAAE,MAAM,GAAG,EAAE,EAAE,QAAQ,GAAG,gBAAgB,KAGtC,EAAE,EACE,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;KACjC,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;KACvE,IAAI,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../../test/utils/repeat.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,MAAM,WACL,MAAM,aACA,MAAM,cACsC,CAAA;AAEzD,eAAe,MAAM,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/*
|
|
4
|
-
* Copyright 2023 Salto Labs Ltd.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with
|
|
8
|
-
* the License. You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
const repeat = (num, f) => Array.from({ length: num }).map((_, i) => f(i));
|
|
19
|
-
exports.default = repeat;
|
|
20
|
-
//# sourceMappingURL=repeat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repeat.js","sourceRoot":"","sources":["../../../test/utils/repeat.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;EAcE;AACF,MAAM,MAAM,GAAG,CACb,GAAW,EACX,CAAuB,EAClB,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEzD,kBAAe,MAAM,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { types } from '@salto-io/lowerdash';
|
|
2
|
-
export declare type InvocationsMeasurements = number[];
|
|
3
|
-
export declare type Timings = {
|
|
4
|
-
setup: <T extends {}, M extends types.KeysOfType<T, Function>>(objectName: string, object: T, method: M) => void;
|
|
5
|
-
invocations: Record<string, InvocationsMeasurements>;
|
|
6
|
-
teardown: () => void;
|
|
7
|
-
};
|
|
8
|
-
declare const timings: () => Timings;
|
|
9
|
-
export default timings;
|
|
10
|
-
//# sourceMappingURL=timing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../../test/utils/timing.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAI3C,oBAAY,uBAAuB,GAAG,MAAM,EAAE,CAAA;AAE9C,oBAAY,OAAO,GAAG;IAEpB,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,QAAQ,CAAC,EAC3D,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,CAAC,KACN,IAAI,CAAA;IACT,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;IACpD,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAMD,QAAA,MAAM,OAAO,QAAO,OAsCnB,CAAA;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function isPromiseLike(x) {
|
|
4
|
-
return typeof x.then === 'function';
|
|
5
|
-
}
|
|
6
|
-
const timings = () => {
|
|
7
|
-
const invocations = {};
|
|
8
|
-
const teardowns = [];
|
|
9
|
-
const wrap = (label, f) => (...args) => {
|
|
10
|
-
const before = Date.now();
|
|
11
|
-
const result = f(...args);
|
|
12
|
-
const after = () => {
|
|
13
|
-
var _a;
|
|
14
|
-
(invocations[label] = (_a = invocations[label]) !== null && _a !== void 0 ? _a : [])
|
|
15
|
-
.push(Date.now() - before);
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
|
-
return isPromiseLike(result)
|
|
19
|
-
? result.then(after, e => { after(); throw e; })
|
|
20
|
-
: after();
|
|
21
|
-
};
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
23
|
-
const setup = (objectName, object, method) => {
|
|
24
|
-
const original = object[method];
|
|
25
|
-
const label = `${objectName}.${method}`;
|
|
26
|
-
object[method] = wrap(label, original);
|
|
27
|
-
teardowns.push(() => { object[method] = original; });
|
|
28
|
-
};
|
|
29
|
-
const teardown = () => {
|
|
30
|
-
teardowns.forEach(f => f());
|
|
31
|
-
};
|
|
32
|
-
return {
|
|
33
|
-
invocations,
|
|
34
|
-
setup,
|
|
35
|
-
teardown,
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
exports.default = timings;
|
|
39
|
-
//# sourceMappingURL=timing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timing.js","sourceRoot":"","sources":["../../../test/utils/timing.ts"],"names":[],"mappings":";;AAgCA,SAAS,aAAa,CAAI,CAAU;IAClC,OAAO,OAAQ,CAAoB,CAAC,IAAI,KAAK,UAAU,CAAA;AACzD,CAAC;AAED,MAAM,OAAO,GAAG,GAAY,EAAE;IAC5B,MAAM,WAAW,GAA4C,EAAE,CAAA;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