@5minds/processcube_engine_client 6.0.0-alpha.5 → 6.0.0-alpha.7
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/Client.d.ts +4 -5
- package/dist/ClientCredentialsIdentityAccessor.d.ts +14 -0
- package/dist/ClientFactory.d.ts +16 -17
- package/dist/Clients/ApplicationInfoHttpClient.d.ts +5 -4
- package/dist/Clients/BaseClient.d.ts +10 -8
- package/dist/Clients/CorrelationHttpClient.d.ts +4 -3
- package/dist/Clients/CronjobHttpClient.d.ts +5 -4
- package/dist/Clients/DataObjectInstanceHttpClient.d.ts +3 -2
- package/dist/Clients/EventHttpClient.d.ts +13 -12
- package/dist/Clients/ExternalTaskApiHttpClient.d.ts +7 -6
- package/dist/Clients/ExternalTaskHttpClient.d.ts +4 -3
- package/dist/Clients/FlowNodeInstanceHttpClient.d.ts +8 -7
- package/dist/Clients/Lib/SocketIoManager.d.ts +15 -28
- package/dist/Clients/ManualTaskHttpClient.d.ts +7 -6
- package/dist/Clients/NotificationHttpClient.d.ts +52 -51
- package/dist/Clients/ProcessDefinitionHttpClient.d.ts +11 -10
- package/dist/Clients/ProcessDefinitionHttpClientNode.d.ts +2 -2
- package/dist/Clients/ProcessInstanceHttpClient.d.ts +10 -9
- package/dist/Clients/ProcessModelHttpClient.d.ts +11 -10
- package/dist/Clients/UntypedTaskHttpClient.d.ts +7 -6
- package/dist/Clients/UserTaskHttpClient.d.ts +11 -10
- package/dist/Clients/index.d.ts +0 -1
- package/dist/ExternalTaskExecution.d.ts +1 -0
- package/dist/ExternalTaskWorker.d.ts +8 -1
- package/dist/IdentityAccessor.d.ts +50 -0
- package/dist/Retry.d.ts +1 -0
- package/dist/Types/IExternalTaskWorker.d.ts +3 -2
- package/dist/commonjs/Client.js +22 -27
- package/dist/commonjs/Client.js.map +1 -1
- package/dist/commonjs/ClientCredentialsIdentityAccessor.js +94 -0
- package/dist/commonjs/ClientCredentialsIdentityAccessor.js.map +1 -0
- package/dist/commonjs/ClientFactory.js +23 -29
- package/dist/commonjs/ClientFactory.js.map +1 -1
- package/dist/commonjs/Clients/ApplicationInfoHttpClient.js +5 -5
- package/dist/commonjs/Clients/ApplicationInfoHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/BaseClient.js +23 -15
- package/dist/commonjs/Clients/BaseClient.js.map +1 -1
- package/dist/commonjs/Clients/CorrelationHttpClient.js +2 -2
- package/dist/commonjs/Clients/CorrelationHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/CronjobHttpClient.js +3 -3
- package/dist/commonjs/Clients/CronjobHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/DataObjectInstanceHttpClient.js +1 -1
- package/dist/commonjs/Clients/DataObjectInstanceHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/EventHttpClient.js +4 -4
- package/dist/commonjs/Clients/EventHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/ExternalTaskApiHttpClient.js +5 -5
- package/dist/commonjs/Clients/ExternalTaskApiHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/ExternalTaskHttpClient.js +7 -5
- package/dist/commonjs/Clients/ExternalTaskHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/FlowNodeInstanceHttpClient.js +6 -6
- package/dist/commonjs/Clients/FlowNodeInstanceHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/Lib/SocketIoManager.js +132 -60
- package/dist/commonjs/Clients/Lib/SocketIoManager.js.map +1 -1
- package/dist/commonjs/Clients/ManualTaskHttpClient.js +2 -2
- package/dist/commonjs/Clients/ManualTaskHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/NotificationHttpClient.js +3 -3
- package/dist/commonjs/Clients/NotificationHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/ProcessDefinitionHttpClient.js +8 -8
- package/dist/commonjs/Clients/ProcessDefinitionHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/ProcessDefinitionHttpClientNode.js.map +1 -1
- package/dist/commonjs/Clients/ProcessInstanceHttpClient.js +9 -9
- package/dist/commonjs/Clients/ProcessInstanceHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/ProcessModelHttpClient.js +9 -9
- package/dist/commonjs/Clients/ProcessModelHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/UntypedTaskHttpClient.js +2 -2
- package/dist/commonjs/Clients/UntypedTaskHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/UserTaskHttpClient.js +4 -4
- package/dist/commonjs/Clients/UserTaskHttpClient.js.map +1 -1
- package/dist/commonjs/Clients/index.js +0 -1
- package/dist/commonjs/Clients/index.js.map +1 -1
- package/dist/commonjs/ExternalTaskExecution.js +7 -3
- package/dist/commonjs/ExternalTaskExecution.js.map +1 -1
- package/dist/commonjs/ExternalTaskWorker.js +21 -11
- package/dist/commonjs/ExternalTaskWorker.js.map +1 -1
- package/dist/commonjs/IdentityAccessor.js +235 -0
- package/dist/commonjs/IdentityAccessor.js.map +1 -0
- package/dist/commonjs/Retry.js +30 -0
- package/dist/commonjs/Retry.js.map +1 -0
- package/dist/commonjs/index.js +5 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +12 -6
- package/tsconfig.tests.json +20 -0
- package/dist/Clients/AnonymousSessionHttpClient.d.ts +0 -26
- package/dist/commonjs/Clients/AnonymousSessionHttpClient.js +0 -48
- package/dist/commonjs/Clients/AnonymousSessionHttpClient.js.map +0 -1
|
@@ -0,0 +1,235 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.IdentityAccessor = void 0;
|
|
40
|
+
const async_lock_1 = __importDefault(require("async-lock"));
|
|
41
|
+
const uuid = __importStar(require("uuid"));
|
|
42
|
+
const processcube_engine_sdk_1 = require("@5minds/processcube_engine_sdk");
|
|
43
|
+
const index_1 = require("./index");
|
|
44
|
+
const dummyIdentity = {
|
|
45
|
+
token: 'ZHVtbXlfdG9rZW4=',
|
|
46
|
+
userId: 'dummy_token',
|
|
47
|
+
};
|
|
48
|
+
class IdentityAccessor {
|
|
49
|
+
static wrap(identity, engineUrl) {
|
|
50
|
+
if (identity instanceof IdentityAccessor) {
|
|
51
|
+
return identity;
|
|
52
|
+
}
|
|
53
|
+
let accessor;
|
|
54
|
+
if (!identity) {
|
|
55
|
+
accessor = new IdentityAccessor();
|
|
56
|
+
}
|
|
57
|
+
else if (typeof identity === 'function') {
|
|
58
|
+
accessor = new IdentityAccessor(identity);
|
|
59
|
+
}
|
|
60
|
+
else if (isClientCredentialsConfig(identity)) {
|
|
61
|
+
if (!identity.engineUrl && engineUrl) {
|
|
62
|
+
identity.engineUrl = engineUrl;
|
|
63
|
+
}
|
|
64
|
+
accessor = new index_1.ClientCredentialsIdentityAccessor(identity);
|
|
65
|
+
}
|
|
66
|
+
else if (!identity.token) {
|
|
67
|
+
const invalidIdentity = new processcube_engine_sdk_1.BadRequestError(`The given identity is invalid. Required property 'token' is missing.`);
|
|
68
|
+
invalidIdentity.additionalInformation = {
|
|
69
|
+
configuredIdentity: identity,
|
|
70
|
+
};
|
|
71
|
+
throw invalidIdentity;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
accessor = new IdentityAccessor(identity);
|
|
75
|
+
}
|
|
76
|
+
accessor.initialize();
|
|
77
|
+
return accessor;
|
|
78
|
+
}
|
|
79
|
+
identityGetter;
|
|
80
|
+
latestIdentity;
|
|
81
|
+
expirationTimeInMs;
|
|
82
|
+
id;
|
|
83
|
+
identityAvailablePromise;
|
|
84
|
+
identityAvailableResolve;
|
|
85
|
+
identityAvailableReject;
|
|
86
|
+
refreshTimeout;
|
|
87
|
+
disposed = false;
|
|
88
|
+
isDynamicRefreshObject = false;
|
|
89
|
+
logger = new processcube_engine_sdk_1.Logger('engine-client:identity-accessor');
|
|
90
|
+
newIdentityCallbacks = [];
|
|
91
|
+
asyncLock = new async_lock_1.default({ maxPending: 100000 });
|
|
92
|
+
constructor(staticOrDynamicIdentity) {
|
|
93
|
+
if (typeof staticOrDynamicIdentity === 'function') {
|
|
94
|
+
this.id = uuid.v4();
|
|
95
|
+
this.identityGetter = staticOrDynamicIdentity;
|
|
96
|
+
this.isDynamicRefreshObject = true;
|
|
97
|
+
}
|
|
98
|
+
else if (staticOrDynamicIdentity) {
|
|
99
|
+
this.id = staticOrDynamicIdentity?.userId ?? uuid.v4();
|
|
100
|
+
this.latestIdentity = staticOrDynamicIdentity;
|
|
101
|
+
this.identityGetter = async () => staticOrDynamicIdentity;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.id = dummyIdentity.userId;
|
|
105
|
+
this.latestIdentity = dummyIdentity;
|
|
106
|
+
this.identityGetter = async () => dummyIdentity;
|
|
107
|
+
}
|
|
108
|
+
this.identityAvailablePromise = new Promise((resolve, reject) => {
|
|
109
|
+
this.identityAvailableResolve = resolve;
|
|
110
|
+
this.identityAvailableReject = reject;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
initialize() {
|
|
114
|
+
this.refreshIdentityIfNeeded();
|
|
115
|
+
}
|
|
116
|
+
getId() {
|
|
117
|
+
return this.id;
|
|
118
|
+
}
|
|
119
|
+
getIdentitySync() {
|
|
120
|
+
return this.latestIdentity;
|
|
121
|
+
}
|
|
122
|
+
async getIdentity() {
|
|
123
|
+
await this.waitUntilIdentityIsAvailable();
|
|
124
|
+
return this.latestIdentity;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* This method only waits the first time the identity is retrieved from any remote source to ensure no missing references occur.
|
|
128
|
+
*/
|
|
129
|
+
async waitUntilIdentityIsAvailable() {
|
|
130
|
+
return await this.identityAvailablePromise;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated This method only exists for downward compatibility purposes, use getIdentity instead.
|
|
134
|
+
*/
|
|
135
|
+
getIdentityStatic() {
|
|
136
|
+
if (!this.latestIdentity) {
|
|
137
|
+
throw new Error('Identity not yet initialized');
|
|
138
|
+
}
|
|
139
|
+
return this.latestIdentity;
|
|
140
|
+
}
|
|
141
|
+
onNewIdentity(callback) {
|
|
142
|
+
this.newIdentityCallbacks.push(callback);
|
|
143
|
+
}
|
|
144
|
+
removeOnNewIdentityListener(callback) {
|
|
145
|
+
this.newIdentityCallbacks = this.newIdentityCallbacks.filter((cb) => cb !== callback);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The IdentityAccesor creates a refresh timer, which needs to be disposed.
|
|
149
|
+
* This method should be called when the IdentityAccessor is not needed anymore.
|
|
150
|
+
* If any Client using this will be disposed, the IdentityAccessor will be disposed as well.
|
|
151
|
+
*/
|
|
152
|
+
dispose() {
|
|
153
|
+
clearTimeout(this.refreshTimeout);
|
|
154
|
+
this.refreshTimeout = undefined;
|
|
155
|
+
this.identityAvailableResolve();
|
|
156
|
+
this.disposed = true;
|
|
157
|
+
}
|
|
158
|
+
getBaseMinRefreshTimeInMs() {
|
|
159
|
+
const fiveMinutes = 5 * 60 * 1000;
|
|
160
|
+
return fiveMinutes;
|
|
161
|
+
}
|
|
162
|
+
async refreshIdentityIfNeeded() {
|
|
163
|
+
await this.asyncLock.acquire('refreshIdentity', async () => {
|
|
164
|
+
clearTimeout(this.refreshTimeout);
|
|
165
|
+
let failedCritically = false;
|
|
166
|
+
try {
|
|
167
|
+
this.latestIdentity = await this.identityGetter();
|
|
168
|
+
if (this.latestIdentity == dummyIdentity || this.latestIdentity?.token == dummyIdentity.token) {
|
|
169
|
+
this.expirationTimeInMs = 0;
|
|
170
|
+
this.identityAvailableResolve();
|
|
171
|
+
}
|
|
172
|
+
else if (this.latestIdentity?.token) {
|
|
173
|
+
const decodedToken = this.getDecodedToken(this.latestIdentity.token);
|
|
174
|
+
this.expirationTimeInMs = decodedToken?.exp ? decodedToken.exp * 1000 : 0;
|
|
175
|
+
this.identityAvailableResolve();
|
|
176
|
+
const announceNewIdentity = async () => {
|
|
177
|
+
try {
|
|
178
|
+
await Promise.all(this.newIdentityCallbacks.map((cb) => cb(this.latestIdentity)));
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
this.logger.warn('Error while refreshing identity', { err });
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
announceNewIdentity();
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
this.identityAvailableResolve();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
this.logger.error('Error while refreshing identity', { err });
|
|
192
|
+
failedCritically =
|
|
193
|
+
!err.message ||
|
|
194
|
+
!['ETIMEDOUT', 'ECONNRESET', 'ECONNREFUSED', 'other side closed', 'SocketError', 'EAI_AGAIN', 'EHOSTUNREACH', 'EPIPE', 'ECONNABORTED', 'EHOSTDOWN'].some((errorString) => err.message.includes(errorString));
|
|
195
|
+
}
|
|
196
|
+
const canBeRefreshed = this.expirationTimeInMs > 0 && !failedCritically && !this.disposed && this.isDynamicRefreshObject;
|
|
197
|
+
if (canBeRefreshed) {
|
|
198
|
+
const timeUntilNextRefresh = Math.max((this.expirationTimeInMs ?? 0) - Date.now() - this.getBaseMinRefreshTimeInMs(), this.getBaseMinRefreshTimeInMs());
|
|
199
|
+
const timeUntilNextRefresh32Bit = Math.min(timeUntilNextRefresh, 2147483647);
|
|
200
|
+
this.refreshTimeout = setTimeout(() => {
|
|
201
|
+
this.refreshIdentityIfNeeded();
|
|
202
|
+
}, timeUntilNextRefresh32Bit);
|
|
203
|
+
}
|
|
204
|
+
else if (failedCritically) {
|
|
205
|
+
this.logger.error('Identity refresh failed critically and wont be refreshed anymore.');
|
|
206
|
+
this.identityAvailableReject(new Error('Identity refresh failed critically and wont be refreshed anymore.'));
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
getDecodedToken(tokenString) {
|
|
211
|
+
if (!tokenString) {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
if (tokenString === dummyIdentity.token) {
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
try {
|
|
218
|
+
const splitToken = this.latestIdentity.token.split('.');
|
|
219
|
+
const decodedToken = JSON.parse(Buffer.from(splitToken[1], 'base64').toString());
|
|
220
|
+
return decodedToken;
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
exports.IdentityAccessor = IdentityAccessor;
|
|
228
|
+
function isClientCredentialsConfig(identity) {
|
|
229
|
+
return (identity.clientId !== undefined ||
|
|
230
|
+
identity.clientSecret !== undefined ||
|
|
231
|
+
identity.scope !== undefined ||
|
|
232
|
+
identity.authorityUrl !== undefined ||
|
|
233
|
+
identity.engineUrl !== undefined);
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=IdentityAccessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdentityAccessor.js","sourceRoot":"","sources":["../../src/IdentityAccessor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAmC;AACnC,2CAA6B;AAE7B,2EAAmF;AAEnF,mCAA4D;AAa5D,MAAM,aAAa,GAAa;IAC9B,KAAK,EAAE,kBAAkB;IACzB,MAAM,EAAE,aAAa;CACtB,CAAC;AAEF,MAAa,gBAAgB;IAC3B,MAAM,CAAC,IAAI,CAAC,QAAuB,EAAE,SAAkB;QACrD,IAAI,QAAQ,YAAY,gBAAgB,EAAE,CAAC;YACzC,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,IAAI,QAA0B,CAAC;QAE/B,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACpC,CAAC;aAAM,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YAC1C,QAAQ,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;aAAM,IAAI,yBAAyB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC,QAAQ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AyB,CAAC,QAAsB;IACvD,OAAO,CACJ,QAAoC,CAAC,QAAQ,KAAK,SAAS;QAC3D,QAAoC,CAAC,YAAY,KAAK,SAAS;QAC/D,QAAoC,CAAC,KAAK,KAAK,SAAS;QACxD,QAAoC,CAAC,YAAY,KAAK,SAAS;QAC/D,QAAoC,CAAC,SAAS,KAAK,SAAS,CAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeWithRetry = executeWithRetry;
|
|
4
|
+
const processcube_engine_sdk_1 = require("@5minds/processcube_engine_sdk");
|
|
5
|
+
const logger = new processcube_engine_sdk_1.Logger('engine-client:retry');
|
|
6
|
+
function executeWithRetry(fn, retryMessage, errorsToRetry = ['ETIMEDOUT', 'ECONNRESET', 'ECONNREFUSED', 'other side closed', 'SocketError', 'EAI_AGAIN', 'EHOSTUNREACH', 'EPIPE', 'ECONNABORTED', 'EHOSTDOWN'], maxRetries = 20, retryInterval = 5000) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const execute = async (retries) => {
|
|
9
|
+
try {
|
|
10
|
+
const result = await fn();
|
|
11
|
+
resolve(result);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
const message = error.message || error || '';
|
|
15
|
+
const isRetryable = errorsToRetry.some((retryError) => message.includes(retryError));
|
|
16
|
+
if (retries > 0 && isRetryable) {
|
|
17
|
+
if (retryMessage) {
|
|
18
|
+
logger.debug(retryMessage, { reason: message });
|
|
19
|
+
}
|
|
20
|
+
setTimeout(() => execute(retries - 1), retryInterval);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
reject(error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
execute(maxRetries);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Retry.js.map
|
|
@@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CAAC;gBAChB,CAAC;YACH,CAAC;QACH,CAAC,CAAC;QAEF,OAAO,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -14,12 +14,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Model = exports.EventType = exports.DataModels = exports.BpmnType = void 0;
|
|
17
|
+
exports.Model = exports.EventType = exports.DataModels = exports.BpmnType = exports.ClientCredentialsIdentityAccessor = exports.IdentityAccessor = void 0;
|
|
18
18
|
__exportStar(require("./Client"), exports);
|
|
19
19
|
__exportStar(require("./ClientFactory"), exports);
|
|
20
20
|
__exportStar(require("./ExternalTaskWorker"), exports);
|
|
21
21
|
__exportStar(require("./Clients/index"), exports);
|
|
22
22
|
__exportStar(require("./Types/index"), exports);
|
|
23
|
+
var IdentityAccessor_1 = require("./IdentityAccessor");
|
|
24
|
+
Object.defineProperty(exports, "IdentityAccessor", { enumerable: true, get: function () { return IdentityAccessor_1.IdentityAccessor; } });
|
|
25
|
+
var ClientCredentialsIdentityAccessor_1 = require("./ClientCredentialsIdentityAccessor");
|
|
26
|
+
Object.defineProperty(exports, "ClientCredentialsIdentityAccessor", { enumerable: true, get: function () { return ClientCredentialsIdentityAccessor_1.ClientCredentialsIdentityAccessor; } });
|
|
23
27
|
var processcube_engine_sdk_1 = require("@5minds/processcube_engine_sdk");
|
|
24
28
|
Object.defineProperty(exports, "BpmnType", { enumerable: true, get: function () { return processcube_engine_sdk_1.BpmnType; } });
|
|
25
29
|
Object.defineProperty(exports, "DataModels", { enumerable: true, get: function () { return processcube_engine_sdk_1.DataModels; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,kDAAgC;AAChC,uDAAqC;AAErC,kDAAgC;AAChC,gDAA8B;AAE9B,yEAAuI;AAA9H,kHAAA,QAAQ,OAAA;AAAE,oHAAA,UAAU,OAAA;AAAE,mHAAA,SAAS,OAAA;AAAY,+GAAA,KAAK,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,kDAAgC;AAChC,uDAAqC;AAErC,kDAAgC;AAChC,gDAA8B;AAE9B,uDAA6F;AAA3D,oHAAA,gBAAgB,OAAA;AAClD,yFAAwF;AAA/E,sJAAA,iCAAiC,OAAA;AAE1C,yEAAuI;AAA9H,kHAAA,QAAQ,OAAA;AAAE,oHAAA,UAAU,OAAA;AAAE,mHAAA,SAAS,OAAA;AAAY,+GAAA,KAAK,OAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ export * from './ClientFactory';
|
|
|
3
3
|
export * from './ExternalTaskWorker';
|
|
4
4
|
export * from './Clients/index';
|
|
5
5
|
export * from './Types/index';
|
|
6
|
+
export { ClientCredentialsConfig, IdentityAccessor, IdentityLike } from './IdentityAccessor';
|
|
7
|
+
export { ClientCredentialsIdentityAccessor } from './ClientCredentialsIdentityAccessor';
|
|
6
8
|
export { BpmnType, DataModels, EventType, Identity, Model, EventReceivedCallback, Subscription } from '@5minds/processcube_engine_sdk';
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"utf-8-validate": "Not used by the client directly, but a requirement of the 'ws' sub-dependency. Since it is not available in the browser, the client would be unusable for the APP SDK, if we did not install it explicitly here"
|
|
5
5
|
},
|
|
6
6
|
"name": "@5minds/processcube_engine_client",
|
|
7
|
-
"version": "6.0.0-alpha.
|
|
7
|
+
"version": "6.0.0-alpha.7",
|
|
8
8
|
"description": "Contains a typescript based client for accessing the Engine.",
|
|
9
9
|
"main": "dist/commonjs/index.js",
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
@@ -33,12 +33,17 @@
|
|
|
33
33
|
"build": "tsc",
|
|
34
34
|
"lint": "prettier --write --config ./.prettierrc.json ./src",
|
|
35
35
|
"prepare": "npm run build",
|
|
36
|
-
"test": "
|
|
36
|
+
"build:test": "tsc --project tsconfig.tests.json",
|
|
37
|
+
"test": "npm run test:smoke",
|
|
38
|
+
"test:smoke": "npm run build:test && node ./dist_test/commonjs/test/smoke-test.js",
|
|
39
|
+
"test:integration": "npm run build:test && node ./dist_test/commonjs/test/integration-test.js"
|
|
37
40
|
},
|
|
38
41
|
"dependencies": {
|
|
39
|
-
"@5minds/processcube_engine_sdk": "6.1.0-alpha.
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
+
"@5minds/processcube_engine_sdk": "6.1.0-alpha.6",
|
|
43
|
+
"async-lock": "^1.4.1",
|
|
44
|
+
"bufferutil": "4.0.9",
|
|
45
|
+
"cross-fetch": "4.1.0",
|
|
46
|
+
"openid-client": "^6.1.7",
|
|
42
47
|
"socket.io-client": "4.8.1",
|
|
43
48
|
"utf-8-validate": "5.0.10",
|
|
44
49
|
"uuid": "^11.0.0"
|
|
@@ -47,6 +52,7 @@
|
|
|
47
52
|
"@trivago/prettier-plugin-sort-imports": "^5.2.0",
|
|
48
53
|
"@types/node": "^22.10.2",
|
|
49
54
|
"prettier": "^3.3.2",
|
|
50
|
-
"typescript": "^5.5.3"
|
|
55
|
+
"typescript": "^5.5.3",
|
|
56
|
+
"why-is-node-running": "^3.2.1"
|
|
51
57
|
}
|
|
52
58
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"typingOptions": {
|
|
3
|
+
"enableAutoDiscovery": true
|
|
4
|
+
},
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"rootDir": "./",
|
|
7
|
+
"outDir": "./dist_test/commonjs",
|
|
8
|
+
"module": "NodeNext",
|
|
9
|
+
"moduleResolution": "NodeNext",
|
|
10
|
+
"target": "esnext",
|
|
11
|
+
"lib": ["esnext"],
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"declarationDir": "./dist_test",
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"emitDecoratorMetadata": true,
|
|
17
|
+
"experimentalDecorators": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src", "test"]
|
|
20
|
+
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Identity } from '@5minds/processcube_engine_sdk';
|
|
2
|
-
import { BaseClient } from './BaseClient';
|
|
3
|
-
export type AnonymousSession = {
|
|
4
|
-
sessionId: string;
|
|
5
|
-
userId: string;
|
|
6
|
-
createdAt: Date;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated The Anonymous Session Feature has been moved to the ProcessCube Authority.
|
|
10
|
-
Therefore, this client is no longer needed and will be removed with a future major update.
|
|
11
|
-
*/
|
|
12
|
-
export declare class AnonymousSessionHttpClient extends BaseClient {
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated The Anonymous Session Feature has been moved to the ProcessCube Authority.
|
|
15
|
-
*/
|
|
16
|
-
getAnonymousSessionById(sessionId: string): Promise<AnonymousSession>;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated The Anonymous Session Feature has been moved to the ProcessCube Authority.
|
|
19
|
-
*/
|
|
20
|
-
getAnonymousSessionsByUserId(userId: string): Promise<Array<AnonymousSession>>;
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated The Anonymous Session Feature has been moved to the ProcessCube Authority.
|
|
23
|
-
*/
|
|
24
|
-
createAnonymousSessionForIdentity(identity: Identity): Promise<string>;
|
|
25
|
-
private mapAnonymousSession;
|
|
26
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnonymousSessionHttpClient = void 0;
|
|
4
|
-
const index_1 = require("../Types/index");
|
|
5
|
-
const BaseClient_1 = require("./BaseClient");
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated The Anonymous Session Feature has been moved to the ProcessCube Authority.
|
|
8
|
-
Therefore, this client is no longer needed and will be removed with a future major update.
|
|
9
|
-
*/
|
|
10
|
-
class AnonymousSessionHttpClient extends BaseClient_1.BaseClient {
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated The Anonymous Session Feature has been moved to the ProcessCube Authority.
|
|
13
|
-
*/
|
|
14
|
-
async getAnonymousSessionById(sessionId) {
|
|
15
|
-
const requestAuthHeaders = this.createRequestAuthHeaders(this.identity);
|
|
16
|
-
const endpoint = index_1.restSettings.paths.getAnonymousSessionById.replace(index_1.restSettings.params.sessionId, sessionId);
|
|
17
|
-
const url = this.buildUrl(endpoint);
|
|
18
|
-
const httpResponse = await this.httpClient.get(url, requestAuthHeaders);
|
|
19
|
-
return this.mapAnonymousSession(httpResponse.result);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated The Anonymous Session Feature has been moved to the ProcessCube Authority.
|
|
23
|
-
*/
|
|
24
|
-
async getAnonymousSessionsByUserId(userId) {
|
|
25
|
-
const requestAuthHeaders = this.createRequestAuthHeaders(this.identity);
|
|
26
|
-
const endpoint = index_1.restSettings.paths.getAnonymousSessionsByUserId.replace(index_1.restSettings.params.userId, userId);
|
|
27
|
-
const url = this.buildUrl(endpoint);
|
|
28
|
-
const httpResponse = await this.httpClient.get(url, requestAuthHeaders);
|
|
29
|
-
return httpResponse.result.map(this.mapAnonymousSession.bind(this));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated The Anonymous Session Feature has been moved to the ProcessCube Authority.
|
|
33
|
-
*/
|
|
34
|
-
async createAnonymousSessionForIdentity(identity) {
|
|
35
|
-
const requestAuthHeaders = this.createRequestAuthHeaders(identity);
|
|
36
|
-
const url = this.buildUrl(index_1.restSettings.paths.createAnonymousSession);
|
|
37
|
-
const httpResponse = await this.httpClient.post(url, {}, requestAuthHeaders);
|
|
38
|
-
return httpResponse.result.sessionId;
|
|
39
|
-
}
|
|
40
|
-
mapAnonymousSession(data) {
|
|
41
|
-
return {
|
|
42
|
-
...data,
|
|
43
|
-
createdAt: new Date(data.createdAt),
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.AnonymousSessionHttpClient = AnonymousSessionHttpClient;
|
|
48
|
-
//# sourceMappingURL=AnonymousSessionHttpClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnonymousSessionHttpClient.js","sourceRoot":"","sources":["../../../src/Clients/AnonymousSessionHttpClient.ts"],"names":[],"mappings":";;;AAEA,0CAA8C;AAC9C,6CAA0C;AAQ1C;;;GAGG;AAEH,MAAa,0BAA2B,SAAQ,uBAAU;IACxD;;OAEG;IACI,KAAK,CAAC,uBAAuB,CAAC,SAAiB;QACpD,MAAM,kBAAkB,GAAG,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAExE,MAAM,QAAQ,GAAG,oBAAY,CAAC,KAAK,CAAC,uBAAuB,CAAC,OAAO,CAAC,oBAAY,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAE9G,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEpC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAmB,GAAG,EAAE,kBAAkB,CAAC,CAAC;QAE1F,OAAO,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC;IACD;;OAEG;IACI,KAAK,CAAC,4BAA4B,CAAC,MAAc;QACtD,MAAM,kBAAkB,GAAG,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,QAAQ,CAAC,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