@or-sdk/contacts 4.5.20 → 4.5.21-beta.3426.0
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/cjs/api/migrationsApi.js +7 -6
- package/dist/cjs/api/migrationsApi.js.map +1 -1
- package/dist/esm/api/migrationsApi.js +5 -6
- package/dist/esm/api/migrationsApi.js.map +1 -1
- package/dist/types/api/migrationsApi.d.ts +1 -1
- package/dist/types/api/migrationsApi.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/api/migrationsApi.ts +5 -7
|
@@ -54,7 +54,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
54
54
|
var types_contacts_api_1 = require("@onereach/types-contacts-api");
|
|
55
55
|
var utils_1 = require("../utils");
|
|
56
56
|
var baseApi_1 = require("./baseApi");
|
|
57
|
-
var DEFAULT_MIGRATION_TIMEOUT = 900000;
|
|
58
57
|
var MigrationsApi = (function (_super) {
|
|
59
58
|
__extends(MigrationsApi, _super);
|
|
60
59
|
function MigrationsApi() {
|
|
@@ -88,10 +87,12 @@ var MigrationsApi = (function (_super) {
|
|
|
88
87
|
});
|
|
89
88
|
});
|
|
90
89
|
};
|
|
91
|
-
MigrationsApi.prototype.pollMigrationUntilDone = function (
|
|
92
|
-
return __awaiter(this,
|
|
90
|
+
MigrationsApi.prototype.pollMigrationUntilDone = function () {
|
|
91
|
+
return __awaiter(this, arguments, void 0, function (timeoutMs, stepMs) {
|
|
93
92
|
var poll;
|
|
94
93
|
var _this = this;
|
|
94
|
+
if (timeoutMs === void 0) { timeoutMs = 900000; }
|
|
95
|
+
if (stepMs === void 0) { stepMs = 1000; }
|
|
95
96
|
return __generator(this, function (_a) {
|
|
96
97
|
poll = function (timeout) { return __awaiter(_this, void 0, void 0, function () {
|
|
97
98
|
var state;
|
|
@@ -107,15 +108,15 @@ var MigrationsApi = (function (_super) {
|
|
|
107
108
|
if (state === types_contacts_api_1.MigrationState.Done) {
|
|
108
109
|
return [2, true];
|
|
109
110
|
}
|
|
110
|
-
if (state === types_contacts_api_1.MigrationState.ToDo) {
|
|
111
|
+
if (state === types_contacts_api_1.MigrationState.ToDo || state === types_contacts_api_1.MigrationState.NotStarted) {
|
|
111
112
|
this.launchMigration();
|
|
112
113
|
}
|
|
113
|
-
return [2, (0, utils_1.debouncePromise)(function () { return poll(timeout -
|
|
114
|
+
return [2, (0, utils_1.debouncePromise)(function () { return poll(timeout - stepMs); }, stepMs)];
|
|
114
115
|
}
|
|
115
116
|
});
|
|
116
117
|
}); };
|
|
117
118
|
this.launchMigration();
|
|
118
|
-
return [2, (0, utils_1.debouncePromise)(function () { return poll(timeoutMs
|
|
119
|
+
return [2, (0, utils_1.debouncePromise)(function () { return poll(timeoutMs); }, 3000)];
|
|
119
120
|
});
|
|
120
121
|
});
|
|
121
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrationsApi.js","sourceRoot":"","sources":["../../../src/api/migrationsApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAwF;AAExF,kCAA2C;AAE3C,qCAAoC;
|
|
1
|
+
{"version":3,"file":"migrationsApi.js","sourceRoot":"","sources":["../../../src/api/migrationsApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAwF;AAExF,kCAA2C;AAE3C,qCAAoC;AAEpC;IAA2C,iCAAO;IAAlD;;IAsFA,CAAC;IAhFC,wCAAgB,GAAhB;QACE,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,mBAAmB;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,yCAAiB,GAAjB;QACE,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,sBAAsB;SAC9B,CAAC,CAAC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;IAEK,8CAAsB,GAA5B;;;gBACE,WAAO,IAAI,CAAC,OAAO,CAAC;wBAClB,MAAM,EAAE,KAAK;wBACb,KAAK,EAAE,oBAAoB;qBAC5B,CAAC,EAAC;;;KACJ;IACH,oBAAC;AAAD,CAAC,AAtFD,CAA2C,iBAAO,GAsFjD"}
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { MigrationState } from '@onereach/types-contacts-api';
|
|
11
11
|
import { debouncePromise } from '../utils';
|
|
12
12
|
import { BaseApi } from './baseApi';
|
|
13
|
-
const DEFAULT_MIGRATION_TIMEOUT = 900000;
|
|
14
13
|
export default class MigrationsApi extends BaseApi {
|
|
15
14
|
migrationsStatus() {
|
|
16
15
|
return this.apiCall({
|
|
@@ -38,8 +37,8 @@ export default class MigrationsApi extends BaseApi {
|
|
|
38
37
|
});
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
|
-
pollMigrationUntilDone(
|
|
42
|
-
return __awaiter(this,
|
|
40
|
+
pollMigrationUntilDone() {
|
|
41
|
+
return __awaiter(this, arguments, void 0, function* (timeoutMs = 900000, stepMs = 1000) {
|
|
43
42
|
const poll = (timeout) => __awaiter(this, void 0, void 0, function* () {
|
|
44
43
|
if (timeout <= 0) {
|
|
45
44
|
return false;
|
|
@@ -48,13 +47,13 @@ export default class MigrationsApi extends BaseApi {
|
|
|
48
47
|
if (state === MigrationState.Done) {
|
|
49
48
|
return true;
|
|
50
49
|
}
|
|
51
|
-
if (state === MigrationState.ToDo) {
|
|
50
|
+
if (state === MigrationState.ToDo || state === MigrationState.NotStarted) {
|
|
52
51
|
this.launchMigration();
|
|
53
52
|
}
|
|
54
|
-
return debouncePromise(() => poll(timeout -
|
|
53
|
+
return debouncePromise(() => poll(timeout - stepMs), stepMs);
|
|
55
54
|
});
|
|
56
55
|
this.launchMigration();
|
|
57
|
-
return debouncePromise(() => poll(timeoutMs
|
|
56
|
+
return debouncePromise(() => poll(timeoutMs), 3000);
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
listMigrations() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrationsApi.js","sourceRoot":"","sources":["../../../src/api/migrationsApi.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAA4B,MAAM,8BAA8B,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"migrationsApi.js","sourceRoot":"","sources":["../../../src/api/migrationsApi.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAA4B,MAAM,8BAA8B,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IAMhD,gBAAgB;QACd,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,mBAAmB;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,sBAAsB;SAC9B,CAAC,CAAC;IACL,CAAC;IAMD,aAAa;QACX,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,gBAAgB;SACxB,CAAC,CAAC;IACL,CAAC;IAQK,eAAe;;YACnB,OAAO,IAAI,CAAC,OAAO,CAAC;gBAClB,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,mBAAmB;aAC3B,CAAC,CAAC;QACL,CAAC;KAAA;IAQK,sBAAsB;6DAAC,SAAS,GAAG,MAAM,EAAE,MAAM,GAAG,IAAI;YAC5D,MAAM,IAAI,GAAG,CAAO,OAAe,EAAoB,EAAE;gBACvD,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;oBACjB,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBAC7C,IAAI,KAAK,KAAK,cAAc,CAAC,IAAI,EAAE,CAAC;oBAClC,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,IAAI,KAAK,KAAK,cAAc,CAAC,IAAI,IAAI,KAAK,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;oBACzE,IAAI,CAAC,eAAe,EAAE,CAAC;gBACzB,CAAC;gBAED,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;YAE/D,CAAC,CAAA,CAAC;YACF,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,OAAO,eAAe,CACpB,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EACrB,IAAI,CACL,CAAC;QACJ,CAAC;KAAA;IAEK,cAAc;;YAClB,OAAO,IAAI,CAAC,OAAO,CAAC;gBAClB,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,aAAa;aACrB,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,sBAAsB;;YAC1B,OAAO,IAAI,CAAC,OAAO,CAAC;gBAClB,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,oBAAoB;aAC5B,CAAC,CAAC;QACL,CAAC;KAAA;CACF"}
|
|
@@ -5,7 +5,7 @@ export default class MigrationsApi extends BaseApi {
|
|
|
5
5
|
getMigrationState(): Promise<MigrationState>;
|
|
6
6
|
migrationsRun(): Promise<void>;
|
|
7
7
|
launchMigration(): Promise<void>;
|
|
8
|
-
pollMigrationUntilDone(timeoutMs?: number): Promise<boolean>;
|
|
8
|
+
pollMigrationUntilDone(timeoutMs?: number, stepMs?: number): Promise<boolean>;
|
|
9
9
|
listMigrations(): Promise<MigrationListResponseDto[]>;
|
|
10
10
|
dropMigrationLockTable(): Promise<void>;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrationsApi.d.ts","sourceRoot":"","sources":["../../../src/api/migrationsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAIxF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"migrationsApi.d.ts","sourceRoot":"","sources":["../../../src/api/migrationsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAIxF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IAMhD,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAOpC,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC;IAW5C,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAahC,sBAAsB,CAAC,SAAS,SAAS,EAAE,MAAM,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAuB3E,cAAc,IAAI,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAOrD,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;CAM9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@or-sdk/contacts",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.21-beta.3426.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"test:watch": "vitest --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@onereach/types-contacts-api": "5.
|
|
23
|
+
"@onereach/types-contacts-api": "5.40.14",
|
|
24
24
|
"@or-sdk/base": "^0.40.0",
|
|
25
25
|
"agentkeepalive": "^4.5.0",
|
|
26
26
|
"uuid": "^8.3.2"
|
|
@@ -36,6 +36,5 @@
|
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
|
-
}
|
|
40
|
-
"gitHead": "810cda00d5c1b16f9ad2ea656d440db15c5e8601"
|
|
39
|
+
}
|
|
41
40
|
}
|
package/src/api/migrationsApi.ts
CHANGED
|
@@ -4,8 +4,6 @@ import { debouncePromise } from '../utils';
|
|
|
4
4
|
|
|
5
5
|
import { BaseApi } from './baseApi';
|
|
6
6
|
|
|
7
|
-
/** 15 mins, which is equaled to max time of lambda execution duration */
|
|
8
|
-
const DEFAULT_MIGRATION_TIMEOUT = 900000;
|
|
9
7
|
export default class MigrationsApi extends BaseApi {
|
|
10
8
|
/**
|
|
11
9
|
* Migrations status.
|
|
@@ -54,9 +52,9 @@ export default class MigrationsApi extends BaseApi {
|
|
|
54
52
|
/**
|
|
55
53
|
* Launches migration and waits until its status turns to Done.
|
|
56
54
|
* @param timeoutMs optional, time in ms during which the poling will be kept alive; default is 15m
|
|
57
|
-
* @param
|
|
55
|
+
* @param stepMs optional, time in ms between the polling requests; default is 1s
|
|
58
56
|
*/
|
|
59
|
-
async pollMigrationUntilDone(timeoutMs
|
|
57
|
+
async pollMigrationUntilDone(timeoutMs = 900000, stepMs = 1000): Promise<boolean> {
|
|
60
58
|
const poll = async (timeout: number): Promise<boolean> => {
|
|
61
59
|
if (timeout <= 0) {
|
|
62
60
|
return false;
|
|
@@ -65,16 +63,16 @@ export default class MigrationsApi extends BaseApi {
|
|
|
65
63
|
if (state === MigrationState.Done) {
|
|
66
64
|
return true;
|
|
67
65
|
}
|
|
68
|
-
if (state === MigrationState.ToDo) {
|
|
66
|
+
if (state === MigrationState.ToDo || state === MigrationState.NotStarted) {
|
|
69
67
|
this.launchMigration();
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
return debouncePromise(() => poll(timeout -
|
|
70
|
+
return debouncePromise(() => poll(timeout - stepMs), stepMs);
|
|
73
71
|
|
|
74
72
|
};
|
|
75
73
|
this.launchMigration();
|
|
76
74
|
return debouncePromise(
|
|
77
|
-
() => poll(timeoutMs
|
|
75
|
+
() => poll(timeoutMs),
|
|
78
76
|
3000
|
|
79
77
|
);
|
|
80
78
|
}
|