tm1npm 1.6.0 → 2.0.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/CHANGELOG.md +89 -0
- package/lib/services/ApplicationService.d.ts.map +1 -1
- package/lib/services/AsyncOperationService.d.ts +8 -1
- package/lib/services/AsyncOperationService.d.ts.map +1 -1
- package/lib/services/AsyncOperationService.js +69 -26
- package/lib/services/FileService.d.ts.map +1 -1
- package/lib/services/ProcessService.d.ts +18 -13
- package/lib/services/ProcessService.d.ts.map +1 -1
- package/lib/services/ProcessService.js +28 -17
- package/lib/services/RestService.d.ts +213 -25
- package/lib/services/RestService.d.ts.map +1 -1
- package/lib/services/RestService.js +840 -271
- package/lib/services/TM1Service.d.ts +42 -1
- package/lib/services/TM1Service.d.ts.map +1 -1
- package/lib/services/TM1Service.js +94 -4
- package/lib/tests/asyncOperationService.test.js +51 -45
- package/lib/tests/processService.comprehensive.test.js +2 -2
- package/lib/tests/processService.test.js +20 -6
- package/lib/tests/restService.test.d.ts +0 -4
- package/lib/tests/restService.test.d.ts.map +1 -1
- package/lib/tests/restService.test.js +1558 -143
- package/lib/tests/tm1Service.test.js +80 -8
- package/package.json +1 -1
- package/src/services/ApplicationService.ts +4 -4
- package/src/services/AsyncOperationService.ts +76 -29
- package/src/services/FileService.ts +3 -3
- package/src/services/ProcessService.ts +67 -37
- package/src/services/RestService.ts +1020 -278
- package/src/services/TM1Service.ts +124 -6
- package/src/tests/asyncOperationService.test.ts +52 -48
- package/src/tests/processService.comprehensive.test.ts +3 -3
- package/src/tests/processService.test.ts +21 -9
- package/src/tests/restService.test.ts +1844 -139
- package/src/tests/tm1Service.test.ts +95 -11
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
## 2.0.0 — 2026-04-16
|
|
6
|
+
|
|
7
|
+
### BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
**RestService HTTP methods now use tm1py-parity semantics**
|
|
10
|
+
(see [#80](https://github.com/KimKaoPoo/tm1npm/pull/95)).
|
|
11
|
+
|
|
12
|
+
- **Timeout unit is seconds, not milliseconds.** `get/post/patch/put/delete`
|
|
13
|
+
now accept a `RequestOptions` object (extending `Omit<AxiosRequestConfig,
|
|
14
|
+
'timeout'>`) whose `timeout` is specified in seconds to match tm1py's
|
|
15
|
+
`RestService.request(timeout: float)`. The value is converted to
|
|
16
|
+
milliseconds internally before reaching Axios.
|
|
17
|
+
- Migration: `rest.get(url, { timeout: 30000 })` → `rest.get(url, { timeout: 30 })`.
|
|
18
|
+
- TypeScript will **not** flag the change because both old and new
|
|
19
|
+
values are `number`; audit call sites before upgrading.
|
|
20
|
+
- Heuristic to find likely millisecond-valued call sites:
|
|
21
|
+
```
|
|
22
|
+
rg -n 'rest\.(get|post|patch|put|delete).*timeout:\s*\d{4,}' src/
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- **`retrieve_async_response` now returns the full `AxiosResponse`**
|
|
26
|
+
instead of `response.data`. This matches tm1py's `retrieve_async_response`
|
|
27
|
+
which returns `requests.Response`.
|
|
28
|
+
- Migration: `(await rest.retrieve_async_response(id)).Status` →
|
|
29
|
+
`(await rest.retrieve_async_response(id)).data.Status`.
|
|
30
|
+
|
|
31
|
+
- **`get_async_operation_status` was removed.** The `/_async('{id}')`
|
|
32
|
+
endpoint does not expose a `Status` sub-resource, so the helper always
|
|
33
|
+
returned `'Unknown'` on real servers. Use `retrieve_async_response` and
|
|
34
|
+
inspect the response status instead.
|
|
35
|
+
|
|
36
|
+
- **`wait_for_async_operation` parameter order.** `cancel_at_timeout` is
|
|
37
|
+
now the fourth parameter (after `poll_interval_seconds`) to preserve
|
|
38
|
+
the pre-existing signature of callers passing a polling cadence.
|
|
39
|
+
|
|
40
|
+
- **`getConnectionStats().timeout` is now in seconds** (was
|
|
41
|
+
`(config.timeout || 60) * 1000` i.e. milliseconds). Dashboards or
|
|
42
|
+
logging that compare the value against an ms threshold will need
|
|
43
|
+
updating.
|
|
44
|
+
- Migration: `stats.timeout / 1000` → `stats.timeout` (already seconds).
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- Central `_request()` dispatcher in `RestService` that routes to sync or
|
|
49
|
+
async execution and honors new per-request options: `asyncRequestsMode`,
|
|
50
|
+
`returnAsyncId`, `cancelAtTimeout`, `timeout` (seconds), `idempotent`,
|
|
51
|
+
`verifyResponse`.
|
|
52
|
+
- `_executeAsyncRequest` sends `Prefer: respond-async[,wait=55]`, parses
|
|
53
|
+
the `Location` header on `202 Accepted`, and polls `/_async('{id}')`
|
|
54
|
+
via `waitTimeGenerator` (exponential backoff capped at
|
|
55
|
+
`asyncPollingMaxDelay`).
|
|
56
|
+
- `cancel_async_operation` and `retrieve_async_response` now target the
|
|
57
|
+
correct TM1 v12 endpoint `/_async('{id}')` (previously
|
|
58
|
+
`/AsyncOperations('{id}')`). `AsyncOperationService` updated to match.
|
|
59
|
+
- `wait_for_async_operation` detects the `asyncresult` response header
|
|
60
|
+
and throws `TM1RestException` on non-2xx embedded status codes to
|
|
61
|
+
match tm1py's `_transform_async_response` semantics.
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
|
|
65
|
+
- 5xx and network-level retries in the response interceptor now only
|
|
66
|
+
apply when the request is marked `idempotent: true` (default `true`
|
|
67
|
+
for GET, `false` for POST/PATCH/PUT/DELETE).
|
|
68
|
+
- `verifyResponse: false` honors a caller-supplied `validateStatus`
|
|
69
|
+
instead of silently overwriting it.
|
|
70
|
+
- `AsyncOperationService.createAsyncOperation` now marks returned
|
|
71
|
+
operations with `trackedLocally: true` so `getAsyncOperationStatus`
|
|
72
|
+
reads from the in-memory cache instead of polling `/_async('{id}')`
|
|
73
|
+
with a client-side UUID (which the server does not recognize).
|
|
74
|
+
`ProcessService.executeWithReturnAsync` / `pollProcessExecution`
|
|
75
|
+
depend on this behavior for their background-resolve pattern.
|
|
76
|
+
- `retrieve_async_response` no longer throws on non-2xx statuses; it
|
|
77
|
+
returns the raw `AxiosResponse` so the internal poller can retry on
|
|
78
|
+
transient 404s (resource not yet materialized) without aborting.
|
|
79
|
+
|
|
80
|
+
### Known Parity Gaps
|
|
81
|
+
|
|
82
|
+
- **No `cancel_running_operation` / thread cancellation on sync
|
|
83
|
+
timeout.** tm1py's `request()` catches `Timeout` / `ConnectionError`
|
|
84
|
+
and calls `cancel_running_operation()` (which uses
|
|
85
|
+
`MonitoringService.cancel_thread()` to abort the server-side thread).
|
|
86
|
+
tm1npm cancels via `DELETE /_async('{id}')` in the async-polling path,
|
|
87
|
+
but has no top-level thread-cancellation fallback for sync-mode
|
|
88
|
+
timeouts or pre-202 async timeouts. Tracked for a future PR once
|
|
89
|
+
`MonitoringService.cancelThread` is implemented.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationService.d.ts","sourceRoot":"","sources":["../../src/services/ApplicationService.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ApplicationService.d.ts","sourceRoot":"","sources":["../../src/services/ApplicationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACH,WAAW,EACX,gBAAgB,EAIhB,mBAAmB,EAOtB,MAAM,wBAAwB,CAAC;AAIhC,qBAAa,kBAAmB,SAAQ,aAAa;IACjD,OAAO,CAAC,SAAS,CAAkC;gBAEvC,IAAI,EAAE,WAAW;IAItB,cAAc,IAAI,IAAI;IAIhB,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAM1C,sBAAsB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAM3C,QAAQ,CAAC,IAAI,EAAE,MA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EAChB,SAAS,GAAE,OAAe,GAC3B,OAAO,CAAC,aAAa,CAAC;IAQZ,sBAAsB,CAC/B,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,EACvB,SAAS,GAAE,OAAe,GAC3B,OAAO,CAAC,aAAa,CAAC;IAMZ,sBAAsB,CAC/B,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,EACvB,SAAS,GAAE,OAAe,GAC3B,OAAO,CAAC,aAAa,CAAC;IAQZ,QAAQ,CACjB,IAAI,GAAE,MAAW,EACjB,cAAc,GAAE,OAAe,EAC/B,SAAS,GAAE,OAAe,EAC1B,KAAK,GAAE,OAAe,GACvB,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;YAItE,eAAe;YA2Bf,eAAe;YAmBf,aAAa;IA0C3B,OAAO,CAAC,qBAAqB;YASf,oBAAoB;IA0BlC,OAAO,CAAC,aAAa;YAgBP,YAAY;IA0E1B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,eAAe;CAO1B"}
|
|
@@ -46,6 +46,12 @@ export interface AsyncOperation {
|
|
|
46
46
|
result?: any;
|
|
47
47
|
parameters?: Record<string, any>;
|
|
48
48
|
metadata?: Record<string, any>;
|
|
49
|
+
/**
|
|
50
|
+
* When true, the operation is tracked with a client-side UUID and the
|
|
51
|
+
* TM1 server has no record of it. `getAsyncOperationStatus` returns the
|
|
52
|
+
* cached status instead of polling `/_async('{id}')`.
|
|
53
|
+
*/
|
|
54
|
+
trackedLocally?: boolean;
|
|
49
55
|
}
|
|
50
56
|
/**
|
|
51
57
|
* Interface for schedule configuration
|
|
@@ -87,6 +93,8 @@ export declare class AsyncOperationService {
|
|
|
87
93
|
* @returns Promise resolving to the operation status
|
|
88
94
|
*/
|
|
89
95
|
getAsyncOperationStatus(operationId: string): Promise<OperationStatus>;
|
|
96
|
+
private deriveStatusFromResponse;
|
|
97
|
+
private extractErrorFromResponse;
|
|
90
98
|
/**
|
|
91
99
|
* List all active async operations
|
|
92
100
|
*
|
|
@@ -169,7 +177,6 @@ export declare class AsyncOperationService {
|
|
|
169
177
|
getAllOperations(): AsyncOperation[];
|
|
170
178
|
private generateOperationId;
|
|
171
179
|
private isTerminalStatus;
|
|
172
|
-
private mapServerStatus;
|
|
173
180
|
private stopPolling;
|
|
174
181
|
private sleep;
|
|
175
182
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncOperationService.d.ts","sourceRoot":"","sources":["../../src/services/AsyncOperationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C;;GAEG;AACH,oBAAY,eAAe;IACvB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;CACtB;AAED;;GAEG;AACH,oBAAY,aAAa;IACrB,iBAAiB,qBAAqB;IACtC,SAAS,aAAa;IACtB,cAAc,kBAAkB;IAChC,cAAc,kBAAkB;IAChC,MAAM,WAAW;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"AsyncOperationService.d.ts","sourceRoot":"","sources":["../../src/services/AsyncOperationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C;;GAEG;AACH,oBAAY,eAAe;IACvB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;CACtB;AAED;;GAEG;AACH,oBAAY,aAAa;IACrB,iBAAiB,qBAAqB;IACtC,SAAS,aAAa;IACtB,cAAc,kBAAkB;IAChC,cAAc,kBAAkB;IAChC,MAAM,WAAW;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA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,QAAQ,GAAE,MAAgB,GAAG,IAAI;IAmBnE;;;;OAIG;IACI,gBAAgB,IAAI,cAAc,EAAE;IAM3C,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,KAAK;IAIb;;OAEG;IACI,OAAO,IAAI,IAAI;CAMzB"}
|
|
@@ -44,6 +44,7 @@ class AsyncOperationService {
|
|
|
44
44
|
* @returns Promise resolving to the operation status
|
|
45
45
|
*/
|
|
46
46
|
async getAsyncOperationStatus(operationId) {
|
|
47
|
+
var _a, _b, _c;
|
|
47
48
|
const operation = this.operations.get(operationId);
|
|
48
49
|
if (!operation) {
|
|
49
50
|
throw new TM1Exception_1.TM1Exception(`Operation with ID ${operationId} not found`);
|
|
@@ -52,29 +53,79 @@ class AsyncOperationService {
|
|
|
52
53
|
if (this.isTerminalStatus(operation.status)) {
|
|
53
54
|
return operation.status;
|
|
54
55
|
}
|
|
55
|
-
//
|
|
56
|
+
// Locally tracked operations hold a client-side UUID; the TM1 server
|
|
57
|
+
// would return 404 for them. Rely on the in-memory cache, which is
|
|
58
|
+
// populated by background .then()/.catch() callbacks in helpers like
|
|
59
|
+
// ProcessService.executeWithReturnAsync.
|
|
60
|
+
if (operation.trackedLocally) {
|
|
61
|
+
return operation.status;
|
|
62
|
+
}
|
|
63
|
+
// Poll TM1 server for updated status. /_async('{id}') returns 202 while
|
|
64
|
+
// the op is pending, and 200/201 with the final operation payload once done.
|
|
65
|
+
// TM1 v12 may encode embedded failures in the `asyncresult` response header.
|
|
56
66
|
try {
|
|
57
|
-
const url = (0, Utils_1.formatUrl)("/
|
|
58
|
-
const response = await this.rest.get(url);
|
|
59
|
-
const serverStatus = this.
|
|
60
|
-
// Update operation status
|
|
67
|
+
const url = (0, Utils_1.formatUrl)("/_async('{}')", operationId);
|
|
68
|
+
const response = await this.rest.get(url, { asyncRequestsMode: false });
|
|
69
|
+
const serverStatus = this.deriveStatusFromResponse(response);
|
|
61
70
|
operation.status = serverStatus;
|
|
62
71
|
if (this.isTerminalStatus(serverStatus)) {
|
|
63
72
|
operation.endTime = new Date();
|
|
64
|
-
if (serverStatus === OperationStatus.COMPLETED
|
|
65
|
-
operation.result = response.data
|
|
73
|
+
if (serverStatus === OperationStatus.COMPLETED) {
|
|
74
|
+
operation.result = response.data;
|
|
66
75
|
}
|
|
67
|
-
else if (serverStatus === OperationStatus.FAILED
|
|
68
|
-
operation.error = response
|
|
76
|
+
else if (serverStatus === OperationStatus.FAILED) {
|
|
77
|
+
operation.error = this.extractErrorFromResponse(response);
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
80
|
return serverStatus;
|
|
72
81
|
}
|
|
73
82
|
catch (error) {
|
|
74
|
-
//
|
|
83
|
+
// HTTP 4xx/5xx surfaces as a thrown TM1RestException — treat as a terminal FAILED
|
|
84
|
+
// so callers stop polling. Network errors (no status) leave cached status intact.
|
|
85
|
+
// Note: 404 is treated as FAILED here (operation never materialized). This differs
|
|
86
|
+
// from ProcessService.pollExecuteWithReturn which treats 404 as "not ready yet"
|
|
87
|
+
// because process async IDs can take a moment to register on the server.
|
|
88
|
+
const status = (_a = error === null || error === void 0 ? void 0 : error.status) !== null && _a !== void 0 ? _a : (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status;
|
|
89
|
+
if (typeof status === 'number' && status >= 400) {
|
|
90
|
+
operation.status = OperationStatus.FAILED;
|
|
91
|
+
operation.endTime = new Date();
|
|
92
|
+
operation.error = (_c = error === null || error === void 0 ? void 0 : error.message) !== null && _c !== void 0 ? _c : String(error);
|
|
93
|
+
return OperationStatus.FAILED;
|
|
94
|
+
}
|
|
75
95
|
return operation.status;
|
|
76
96
|
}
|
|
77
97
|
}
|
|
98
|
+
deriveStatusFromResponse(response) {
|
|
99
|
+
var _a;
|
|
100
|
+
if (response.status === 202) {
|
|
101
|
+
return OperationStatus.RUNNING;
|
|
102
|
+
}
|
|
103
|
+
const asyncResult = (_a = response.headers) === null || _a === void 0 ? void 0 : _a['asyncresult'];
|
|
104
|
+
if (typeof asyncResult === 'string') {
|
|
105
|
+
const embedded = parseInt(asyncResult.trim().split(/\s+/)[0], 10);
|
|
106
|
+
if (!Number.isNaN(embedded) && (embedded < 200 || embedded >= 300)) {
|
|
107
|
+
return OperationStatus.FAILED;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (response.status === 200 || response.status === 201) {
|
|
111
|
+
return OperationStatus.COMPLETED;
|
|
112
|
+
}
|
|
113
|
+
return OperationStatus.PENDING;
|
|
114
|
+
}
|
|
115
|
+
extractErrorFromResponse(response) {
|
|
116
|
+
var _a, _b, _c;
|
|
117
|
+
const asyncResult = (_a = response.headers) === null || _a === void 0 ? void 0 : _a['asyncresult'];
|
|
118
|
+
if (typeof asyncResult === 'string') {
|
|
119
|
+
return asyncResult;
|
|
120
|
+
}
|
|
121
|
+
if (typeof response.data === 'string') {
|
|
122
|
+
return response.data;
|
|
123
|
+
}
|
|
124
|
+
if ((_c = (_b = response.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) {
|
|
125
|
+
return response.data.error.message;
|
|
126
|
+
}
|
|
127
|
+
return JSON.stringify(response.data);
|
|
128
|
+
}
|
|
78
129
|
/**
|
|
79
130
|
* List all active async operations
|
|
80
131
|
*
|
|
@@ -110,12 +161,11 @@ class AsyncOperationService {
|
|
|
110
161
|
// Stop polling if active
|
|
111
162
|
this.stopPolling(operationId);
|
|
112
163
|
try {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
await this.rest.post(url, {});
|
|
164
|
+
const url = (0, Utils_1.formatUrl)("/_async('{}')", operationId);
|
|
165
|
+
await this.rest.delete(url, { asyncRequestsMode: false });
|
|
116
166
|
}
|
|
117
167
|
catch (error) {
|
|
118
|
-
|
|
168
|
+
console.warn(`Failed to cancel async operation ${operationId} on server:`, error);
|
|
119
169
|
}
|
|
120
170
|
// Update operation status
|
|
121
171
|
operation.status = OperationStatus.CANCELLED;
|
|
@@ -173,6 +223,9 @@ class AsyncOperationService {
|
|
|
173
223
|
*/
|
|
174
224
|
async createAsyncOperation(definition) {
|
|
175
225
|
const operationId = this.generateOperationId();
|
|
226
|
+
// generateOperationId produces a client-side UUID; the server has no
|
|
227
|
+
// record of it, so polling /_async('{id}') would 404. Mark as locally
|
|
228
|
+
// tracked so getAsyncOperationStatus returns the cached status instead.
|
|
176
229
|
const operation = {
|
|
177
230
|
id: operationId,
|
|
178
231
|
type: definition.type,
|
|
@@ -180,7 +233,8 @@ class AsyncOperationService {
|
|
|
180
233
|
status: OperationStatus.PENDING,
|
|
181
234
|
startTime: new Date(),
|
|
182
235
|
parameters: definition.parameters,
|
|
183
|
-
metadata: definition.metadata
|
|
236
|
+
metadata: definition.metadata,
|
|
237
|
+
trackedLocally: true
|
|
184
238
|
};
|
|
185
239
|
this.operations.set(operationId, operation);
|
|
186
240
|
return operationId;
|
|
@@ -337,17 +391,6 @@ class AsyncOperationService {
|
|
|
337
391
|
status === OperationStatus.CANCELLED ||
|
|
338
392
|
status === OperationStatus.TIMEOUT;
|
|
339
393
|
}
|
|
340
|
-
mapServerStatus(serverStatus) {
|
|
341
|
-
const statusMap = {
|
|
342
|
-
'Pending': OperationStatus.PENDING,
|
|
343
|
-
'Running': OperationStatus.RUNNING,
|
|
344
|
-
'CompletedSuccessfully': OperationStatus.COMPLETED,
|
|
345
|
-
'CompletedWithErrors': OperationStatus.FAILED,
|
|
346
|
-
'Cancelled': OperationStatus.CANCELLED,
|
|
347
|
-
'Timeout': OperationStatus.TIMEOUT
|
|
348
|
-
};
|
|
349
|
-
return statusMap[serverStatus] || OperationStatus.PENDING;
|
|
350
|
-
}
|
|
351
394
|
stopPolling(operationId) {
|
|
352
395
|
const intervalId = this.pollingIntervals.get(operationId);
|
|
353
396
|
if (intervalId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileService.d.ts","sourceRoot":"","sources":["../../src/services/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|
12
|
+
line: number;
|
|
13
|
+
message: string;
|
|
14
|
+
severity: string;
|
|
15
|
+
}
|
|
16
|
+
interface ValidationResult {
|
|
17
|
+
isValid: boolean;
|
|
18
|
+
errors: ValidationError[];
|
|
19
|
+
}
|
|
11
20
|
export declare class ProcessService extends ObjectService {
|
|
12
21
|
/** Service to handle Object Updates for TI Processes
|
|
13
22
|
*
|
|
@@ -127,8 +136,8 @@ export declare class ProcessService extends ObjectService {
|
|
|
127
136
|
* @example
|
|
128
137
|
* ```typescript
|
|
129
138
|
* const deps = await processService.analyzeProcessDependencies('ImportData');
|
|
130
|
-
*
|
|
131
|
-
*
|
|
139
|
+
* // deps.cubes => array of cube names referenced in the process
|
|
140
|
+
* // deps.dimensions => array of dimension names referenced in the process
|
|
132
141
|
* ```
|
|
133
142
|
*/
|
|
134
143
|
analyzeProcessDependencies(processName: string): Promise<any>;
|
|
@@ -136,20 +145,17 @@ export declare class ProcessService extends ObjectService {
|
|
|
136
145
|
* Validate process syntax without executing it
|
|
137
146
|
*
|
|
138
147
|
* @param processName - Name of the process
|
|
139
|
-
* @returns Promise<
|
|
148
|
+
* @returns Promise<ValidationResult> - Validation result
|
|
140
149
|
*
|
|
141
150
|
* @example
|
|
142
151
|
* ```typescript
|
|
143
152
|
* const result = await processService.validateProcessSyntax('MyProcess');
|
|
144
153
|
* if (!result.isValid) {
|
|
145
|
-
*
|
|
154
|
+
* // result.errors contains ValidationError[] entries
|
|
146
155
|
* }
|
|
147
156
|
* ```
|
|
148
157
|
*/
|
|
149
|
-
validateProcessSyntax(processName: string): Promise<
|
|
150
|
-
isValid: boolean;
|
|
151
|
-
errors: any[];
|
|
152
|
-
}>;
|
|
158
|
+
validateProcessSyntax(processName: string): Promise<ValidationResult>;
|
|
153
159
|
/**
|
|
154
160
|
* Get process execution plan (estimated resource usage)
|
|
155
161
|
*
|
|
@@ -159,7 +165,7 @@ export declare class ProcessService extends ObjectService {
|
|
|
159
165
|
* @example
|
|
160
166
|
* ```typescript
|
|
161
167
|
* const plan = await processService.getProcessExecutionPlan('ImportData');
|
|
162
|
-
*
|
|
168
|
+
* // plan.estimatedTime => estimated execution time (ms)
|
|
163
169
|
* ```
|
|
164
170
|
*/
|
|
165
171
|
getProcessExecutionPlan(processName: string): Promise<any>;
|
|
@@ -189,9 +195,7 @@ export declare class ProcessService extends ObjectService {
|
|
|
189
195
|
* @example
|
|
190
196
|
* ```typescript
|
|
191
197
|
* const status = await processService.pollProcessExecution(operationId);
|
|
192
|
-
* if (status === OperationStatus.COMPLETED)
|
|
193
|
-
* console.log('Process completed!');
|
|
194
|
-
* }
|
|
198
|
+
* // if (status === OperationStatus.COMPLETED) handle completion
|
|
195
199
|
* ```
|
|
196
200
|
*/
|
|
197
201
|
pollProcessExecution(operationId: string): Promise<OperationStatus>;
|
|
@@ -204,9 +208,10 @@ export declare class ProcessService extends ObjectService {
|
|
|
204
208
|
* @example
|
|
205
209
|
* ```typescript
|
|
206
210
|
* await processService.cancelProcessExecution(operationId);
|
|
207
|
-
*
|
|
211
|
+
* // cancellation is acknowledged once the promise resolves
|
|
208
212
|
* ```
|
|
209
213
|
*/
|
|
210
214
|
cancelProcessExecution(operationId: string): Promise<void>;
|
|
211
215
|
}
|
|
216
|
+
export {};
|
|
212
217
|
//# sourceMappingURL=ProcessService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcessService.d.ts","sourceRoot":"","sources":["../../src/services/ProcessService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,
|
|
1
|
+
{"version":3,"file":"ProcessService.d.ts","sourceRoot":"","sources":["../../src/services/ProcessService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAkB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,E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IACU,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAuCvE;;;;;;;;;;;;;;;OAeG;IACU,sBAAsB,CAC/B,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;IAuClB;;;;;;;;;;;OAWG;IACU,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAShF;;;;;;;;;;;OAWG;IACU,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ1E"}
|
|
@@ -180,7 +180,7 @@ class ProcessService extends ObjectService_1.ObjectService {
|
|
|
180
180
|
}
|
|
181
181
|
const config = {};
|
|
182
182
|
if (timeout) {
|
|
183
|
-
config.timeout = timeout
|
|
183
|
+
config.timeout = timeout;
|
|
184
184
|
}
|
|
185
185
|
return await this.rest.post(url, JSON.stringify(body), config);
|
|
186
186
|
}
|
|
@@ -214,13 +214,21 @@ class ProcessService extends ObjectService_1.ObjectService {
|
|
|
214
214
|
var _a, _b;
|
|
215
215
|
try {
|
|
216
216
|
const response = await this.rest.retrieve_async_response(asyncId);
|
|
217
|
+
// tm1py returns None while the async op is still in-flight (status 202).
|
|
218
|
+
if (response.status !== 200 && response.status !== 201) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
217
221
|
// TODO: tm1py handles TM1 < v11 binary-wrapped responses via
|
|
218
222
|
// build_response_from_binary_response. Add support if needed.
|
|
219
|
-
return this._executeWithReturnParseResponse(response);
|
|
223
|
+
return this._executeWithReturnParseResponse(response.data);
|
|
220
224
|
}
|
|
221
225
|
catch (error) {
|
|
222
|
-
//
|
|
223
|
-
|
|
226
|
+
// 404 means the async resource hasn't materialized yet — return null
|
|
227
|
+
// so the caller can retry. 202 means still running. Both are
|
|
228
|
+
// retryable, unlike AsyncOperationService which treats 404 as
|
|
229
|
+
// terminal FAILED for locally-tracked operations.
|
|
230
|
+
const err = error;
|
|
231
|
+
const status = (_a = err === null || err === void 0 ? void 0 : err.status) !== null && _a !== void 0 ? _a : (_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.status;
|
|
224
232
|
if (status === 202 || status === 404) {
|
|
225
233
|
return null;
|
|
226
234
|
}
|
|
@@ -536,9 +544,11 @@ class ProcessService extends ObjectService_1.ObjectService {
|
|
|
536
544
|
}
|
|
537
545
|
const config = {};
|
|
538
546
|
if (timeout) {
|
|
539
|
-
config.timeout = timeout
|
|
547
|
+
config.timeout = timeout;
|
|
540
548
|
}
|
|
541
|
-
|
|
549
|
+
// rest.post returns AxiosResponse | string (string only when caller
|
|
550
|
+
// opts into returnAsyncId). debugProcess never does, so narrow.
|
|
551
|
+
const response = (await this.rest.post(url, JSON.stringify(body), config));
|
|
542
552
|
return response.data;
|
|
543
553
|
}
|
|
544
554
|
/**
|
|
@@ -684,8 +694,8 @@ class ProcessService extends ObjectService_1.ObjectService {
|
|
|
684
694
|
* @example
|
|
685
695
|
* ```typescript
|
|
686
696
|
* const deps = await processService.analyzeProcessDependencies('ImportData');
|
|
687
|
-
*
|
|
688
|
-
*
|
|
697
|
+
* // deps.cubes => array of cube names referenced in the process
|
|
698
|
+
* // deps.dimensions => array of dimension names referenced in the process
|
|
689
699
|
* ```
|
|
690
700
|
*/
|
|
691
701
|
async analyzeProcessDependencies(processName) {
|
|
@@ -746,13 +756,13 @@ class ProcessService extends ObjectService_1.ObjectService {
|
|
|
746
756
|
* Validate process syntax without executing it
|
|
747
757
|
*
|
|
748
758
|
* @param processName - Name of the process
|
|
749
|
-
* @returns Promise<
|
|
759
|
+
* @returns Promise<ValidationResult> - Validation result
|
|
750
760
|
*
|
|
751
761
|
* @example
|
|
752
762
|
* ```typescript
|
|
753
763
|
* const result = await processService.validateProcessSyntax('MyProcess');
|
|
754
764
|
* if (!result.isValid) {
|
|
755
|
-
*
|
|
765
|
+
* // result.errors contains ValidationError[] entries
|
|
756
766
|
* }
|
|
757
767
|
* ```
|
|
758
768
|
*/
|
|
@@ -769,7 +779,8 @@ class ProcessService extends ObjectService_1.ObjectService {
|
|
|
769
779
|
};
|
|
770
780
|
}
|
|
771
781
|
catch (error) {
|
|
772
|
-
const
|
|
782
|
+
const err = error;
|
|
783
|
+
const errorMessage = ((_c = (_b = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || err.message || 'Validation failed';
|
|
773
784
|
return {
|
|
774
785
|
isValid: false,
|
|
775
786
|
errors: [{ line: 0, message: errorMessage, severity: 'Error' }]
|
|
@@ -785,7 +796,7 @@ class ProcessService extends ObjectService_1.ObjectService {
|
|
|
785
796
|
* @example
|
|
786
797
|
* ```typescript
|
|
787
798
|
* const plan = await processService.getProcessExecutionPlan('ImportData');
|
|
788
|
-
*
|
|
799
|
+
* // plan.estimatedTime => estimated execution time (ms)
|
|
789
800
|
* ```
|
|
790
801
|
*/
|
|
791
802
|
async getProcessExecutionPlan(processName) {
|
|
@@ -860,7 +871,9 @@ class ProcessService extends ObjectService_1.ObjectService {
|
|
|
860
871
|
asyncOps.updateOperationStatus(operationId, AsyncOperationService_1.OperationStatus.COMPLETED, result);
|
|
861
872
|
})
|
|
862
873
|
.catch((error) => {
|
|
863
|
-
|
|
874
|
+
var _a;
|
|
875
|
+
const message = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : String(error);
|
|
876
|
+
asyncOps.updateOperationStatus(operationId, AsyncOperationService_1.OperationStatus.FAILED, undefined, message);
|
|
864
877
|
});
|
|
865
878
|
return operationId;
|
|
866
879
|
}
|
|
@@ -873,9 +886,7 @@ class ProcessService extends ObjectService_1.ObjectService {
|
|
|
873
886
|
* @example
|
|
874
887
|
* ```typescript
|
|
875
888
|
* const status = await processService.pollProcessExecution(operationId);
|
|
876
|
-
* if (status === OperationStatus.COMPLETED)
|
|
877
|
-
* console.log('Process completed!');
|
|
878
|
-
* }
|
|
889
|
+
* // if (status === OperationStatus.COMPLETED) handle completion
|
|
879
890
|
* ```
|
|
880
891
|
*/
|
|
881
892
|
async pollProcessExecution(operationId) {
|
|
@@ -894,7 +905,7 @@ class ProcessService extends ObjectService_1.ObjectService {
|
|
|
894
905
|
* @example
|
|
895
906
|
* ```typescript
|
|
896
907
|
* await processService.cancelProcessExecution(operationId);
|
|
897
|
-
*
|
|
908
|
+
* // cancellation is acknowledged once the promise resolves
|
|
898
909
|
* ```
|
|
899
910
|
*/
|
|
900
911
|
async cancelProcessExecution(operationId) {
|