@unmeshed/sdk 1.0.6 → 1.0.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/apiClient.d.ts +14 -3
- package/dist/apiClient.js +80 -17
- package/dist/index.d.ts +21 -4
- package/dist/index.js +22 -7
- package/dist/poller/pollerClientImpl.d.ts +2 -0
- package/dist/poller/pollerClientImpl.js +125 -0
- package/dist/process/processClientImpl.d.ts +12 -0
- package/dist/process/processClientImpl.js +196 -0
- package/dist/registration/registrationClientImpl.d.ts +1 -0
- package/dist/registration/registrationClientImpl.js +21 -0
- package/dist/sample/sampleAPI.d.ts +2 -0
- package/dist/sample/sampleAPI.js +29 -0
- package/dist/sample/sampleServer.d.ts +1 -0
- package/dist/sample/sampleServer.js +76 -0
- package/dist/sample/workers/ArithmeticWorker.d.ts +5 -0
- package/dist/sample/workers/ArithmeticWorker.js +23 -0
- package/dist/sample/workers/DelayedWorker.d.ts +1 -0
- package/dist/sample/workers/DelayedWorker.js +11 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +62 -0
- package/dist/types/index.d.ts +312 -3
- package/dist/types/index.js +78 -0
- package/dist/types/unmeshedCommonUtils.d.ts +3 -0
- package/dist/types/unmeshedCommonUtils.js +17 -0
- package/dist/utils/unmeshedCommonUtils.d.ts +3 -0
- package/dist/utils/unmeshedCommonUtils.js +17 -0
- package/package.json +12 -3
- package/dist/config.d.ts +0 -16
- package/dist/config.js +0 -21
- package/dist/hello-world.d.ts +0 -2
- package/dist/hello-world.js +0 -14
- package/dist/testApi.d.ts +0 -2
- package/dist/testApi.js +0 -9
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArithmeticOperation = void 0;
|
|
4
|
+
const ArithmeticOperation = async (input) => {
|
|
5
|
+
const { operation, num1, num2 } = input;
|
|
6
|
+
console.info(`Performing ${operation} operation on ${num1} and ${num2}`);
|
|
7
|
+
switch (operation.toLowerCase()) {
|
|
8
|
+
case "add":
|
|
9
|
+
return { result: num1 + num2 };
|
|
10
|
+
case "subtract":
|
|
11
|
+
return { result: num1 - num2 };
|
|
12
|
+
case "multiply":
|
|
13
|
+
return { result: num1 * num2 };
|
|
14
|
+
case "divide":
|
|
15
|
+
if (num2 === 0) {
|
|
16
|
+
throw new Error("Division by zero is not allowed");
|
|
17
|
+
}
|
|
18
|
+
return { result: num1 / num2 };
|
|
19
|
+
default:
|
|
20
|
+
throw new Error("Invalid operation");
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.ArithmeticOperation = ArithmeticOperation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DelayedWorkers: () => Promise<string>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DelayedWorkers = void 0;
|
|
4
|
+
const DelayedWorkers = async () => {
|
|
5
|
+
return new Promise((resolve) => {
|
|
6
|
+
setTimeout(() => {
|
|
7
|
+
resolve("Function executed after 10 seconds");
|
|
8
|
+
}, 10000);
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
exports.DelayedWorkers = DelayedWorkers;
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "dotenv/config";
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _1 = require(".");
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
require("dotenv/config");
|
|
6
|
+
_1.default.initialize({
|
|
7
|
+
baseUrl: process.env.UNMESHED_BASE_URL,
|
|
8
|
+
port: process.env.UNMESHED_PORT,
|
|
9
|
+
clientId: process.env.UNMESHED_CLIENT_ID,
|
|
10
|
+
authToken: process.env.UNMESHED_AUTH_TOKEN,
|
|
11
|
+
});
|
|
12
|
+
const request = {
|
|
13
|
+
name: "sample-http",
|
|
14
|
+
namespace: "default",
|
|
15
|
+
input: {},
|
|
16
|
+
correlationId: "",
|
|
17
|
+
requestId: "",
|
|
18
|
+
version: 1,
|
|
19
|
+
};
|
|
20
|
+
const workers = [
|
|
21
|
+
// {
|
|
22
|
+
// worker: async (input) => {
|
|
23
|
+
// return new Promise((resolve, reject) => {
|
|
24
|
+
// if (!input) {
|
|
25
|
+
// reject(new Error("Input is required"));
|
|
26
|
+
// } else {
|
|
27
|
+
// console.log("Input:", input);
|
|
28
|
+
// resolve(input);
|
|
29
|
+
// }
|
|
30
|
+
// });
|
|
31
|
+
// },
|
|
32
|
+
// namespace: "default",
|
|
33
|
+
// name: "test_sdk_worker",
|
|
34
|
+
// maxInProgress: 10,
|
|
35
|
+
// },
|
|
36
|
+
];
|
|
37
|
+
// UnmeshedClient.pollForWorkers(workers);
|
|
38
|
+
const processId = 28878569;
|
|
39
|
+
const stepId = 28878571;
|
|
40
|
+
const processIds = [34, 344];
|
|
41
|
+
const clientId = "jdjfjf";
|
|
42
|
+
const endpoint = "your-endpoint";
|
|
43
|
+
const input = { key: "value" };
|
|
44
|
+
const id = "12345";
|
|
45
|
+
const apiCallType = types_1.ApiCallType.SYNC;
|
|
46
|
+
const params = {
|
|
47
|
+
startTimeEpoch: 1673606400000,
|
|
48
|
+
endTimeEpoch: 1673692800000,
|
|
49
|
+
namespace: "default",
|
|
50
|
+
processTypes: [types_1.ProcessType.STANDARD],
|
|
51
|
+
triggerTypes: [types_1.ProcessTriggerType.MANUAL],
|
|
52
|
+
names: ["process1", "process2", "process3"],
|
|
53
|
+
processIds: [12345, 67890],
|
|
54
|
+
correlationIds: ["correlationId1", "correlationId2"],
|
|
55
|
+
requestIds: ["requestId1", "requestId2"],
|
|
56
|
+
statuses: [types_1.ProcessStatus.COMPLETED],
|
|
57
|
+
limit: 10,
|
|
58
|
+
offset: 0,
|
|
59
|
+
};
|
|
60
|
+
const stepData = _1.default.getStepData(stepId);
|
|
61
|
+
// UnmeshedClient.rerun(processId,process.env.UNMESHED_CLIENT_ID)
|
|
62
|
+
console.log("server res", stepData);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,313 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { AxiosRequestConfig } from "axios";
|
|
2
|
+
export declare enum ApiCallType {
|
|
3
|
+
SYNC = "SYNC",
|
|
4
|
+
ASYNC = "ASYNC",
|
|
5
|
+
STREAM = "STREAM"
|
|
4
6
|
}
|
|
7
|
+
export interface ApiMappingData {
|
|
8
|
+
endpoint: string;
|
|
9
|
+
processDefNamespace: string;
|
|
10
|
+
processDefName: string;
|
|
11
|
+
processDefVersion: number;
|
|
12
|
+
authType: string;
|
|
13
|
+
authClaims: string;
|
|
14
|
+
createdBy: string;
|
|
15
|
+
updatedBy: string;
|
|
16
|
+
created: Date;
|
|
17
|
+
updated: Date;
|
|
18
|
+
}
|
|
19
|
+
export type ApiMappingWebhookData = {
|
|
20
|
+
endpoint: string;
|
|
21
|
+
name: string;
|
|
22
|
+
uniqueId: string;
|
|
23
|
+
urlSecret: string;
|
|
24
|
+
description: string;
|
|
25
|
+
userIdentifier: string;
|
|
26
|
+
webhookSource: WebhookSource;
|
|
27
|
+
webhookSourceConfig: Record<string, string>;
|
|
28
|
+
expiryDate: Date;
|
|
29
|
+
userType: SQAuthUserType;
|
|
30
|
+
createdBy: string;
|
|
31
|
+
updatedBy: string;
|
|
32
|
+
created: Date;
|
|
33
|
+
updated: Date;
|
|
34
|
+
};
|
|
35
|
+
export declare enum WebhookSource {
|
|
36
|
+
MS_TEAMS = "MS_TEAMS",
|
|
37
|
+
NOT_DEFINED = "NOT_DEFINED"
|
|
38
|
+
}
|
|
39
|
+
export declare enum SQAuthUserType {
|
|
40
|
+
USER = "USER",
|
|
41
|
+
API = "API",
|
|
42
|
+
INTERNAL = "INTERNAL"
|
|
43
|
+
}
|
|
44
|
+
export declare enum StepType {
|
|
45
|
+
WORKER = "WORKER",
|
|
46
|
+
HTTP = "HTTP",
|
|
47
|
+
WAIT = "WAIT",
|
|
48
|
+
FAIL = "FAIL",
|
|
49
|
+
PYTHON = "PYTHON",
|
|
50
|
+
JAVASCRIPT = "JAVASCRIPT",
|
|
51
|
+
JQ = "JQ",
|
|
52
|
+
MANAGED = "MANAGED",
|
|
53
|
+
BUILTIN = "BUILTIN",
|
|
54
|
+
NOOP = "NOOP",
|
|
55
|
+
PERSISTED_STATE = "PERSISTED_STATE",
|
|
56
|
+
DEPENDSON = "DEPENDSON",
|
|
57
|
+
INTEGRATION = "INTEGRATION",
|
|
58
|
+
EXIT = "EXIT",
|
|
59
|
+
SUB_PROCESS = "SUB_PROCESS",
|
|
60
|
+
LIST = "LIST",
|
|
61
|
+
PARALLEL = "PARALLEL",
|
|
62
|
+
FOREACH = "FOREACH",
|
|
63
|
+
SWITCH = "SWITCH"
|
|
64
|
+
}
|
|
65
|
+
export declare enum StepStatus {
|
|
66
|
+
PENDING = "PENDING",
|
|
67
|
+
SCHEDULED = "SCHEDULED",
|
|
68
|
+
RUNNING = "RUNNING",
|
|
69
|
+
PAUSED = "PAUSED",
|
|
70
|
+
COMPLETED = "COMPLETED",
|
|
71
|
+
FAILED = "FAILED",
|
|
72
|
+
TIMED_OUT = "TIMED_OUT",
|
|
73
|
+
SKIPPED = "SKIPPED",
|
|
74
|
+
CANCELLED = "CANCELLED"
|
|
75
|
+
}
|
|
76
|
+
export declare enum ProcessStatus {
|
|
77
|
+
RUNNING = "RUNNING",
|
|
78
|
+
COMPLETED = "COMPLETED",
|
|
79
|
+
FAILED = "FAILED",
|
|
80
|
+
TIMED_OUT = "TIMED_OUT",
|
|
81
|
+
CANCELLED = "CANCELLED",
|
|
82
|
+
TERMINATED = "TERMINATED",
|
|
83
|
+
REVIEWED = "REVIEWED"
|
|
84
|
+
}
|
|
85
|
+
export declare enum ProcessTriggerType {
|
|
86
|
+
MANUAL = "MANUAL",
|
|
87
|
+
SCHEDULED = "SCHEDULED",
|
|
88
|
+
API_MAPPING = "API_MAPPING",
|
|
89
|
+
WEBHOOK = "WEBHOOK",
|
|
90
|
+
API = "API",
|
|
91
|
+
SUB_PROCESS = "SUB_PROCESS"
|
|
92
|
+
}
|
|
93
|
+
export declare enum ProcessType {
|
|
94
|
+
STANDARD = "STANDARD",
|
|
95
|
+
DYNAMIC = "DYNAMIC",
|
|
96
|
+
API_ORCHESTRATION = "API_ORCHESTRATION",
|
|
97
|
+
INTERNAL = "INTERNAL"
|
|
98
|
+
}
|
|
99
|
+
export type ClientProfileData = {
|
|
100
|
+
clientId: string;
|
|
101
|
+
ipAddress: string;
|
|
102
|
+
friendlyName: string;
|
|
103
|
+
userIdentifier: string;
|
|
104
|
+
stepQueueNames: StepQueueNameData[];
|
|
105
|
+
createdBy: string;
|
|
106
|
+
updatedBy: string;
|
|
107
|
+
created: Date;
|
|
108
|
+
updated: Date;
|
|
109
|
+
expiryDate: Date;
|
|
110
|
+
};
|
|
111
|
+
export type FullClientProfileData = {
|
|
112
|
+
clientId: string;
|
|
113
|
+
ipAddress: string;
|
|
114
|
+
friendlyName: string;
|
|
115
|
+
userIdentifier: string;
|
|
116
|
+
stepQueueNames: StepQueueNameData[];
|
|
117
|
+
createdBy: string;
|
|
118
|
+
updatedBy: string;
|
|
119
|
+
created: Date;
|
|
120
|
+
updated: Date;
|
|
121
|
+
expiryDate: Date;
|
|
122
|
+
tokenValue: string;
|
|
123
|
+
};
|
|
124
|
+
export type StepQueueNameData = {
|
|
125
|
+
orgId: number;
|
|
126
|
+
namespace: string;
|
|
127
|
+
stepType: StepType;
|
|
128
|
+
name: string;
|
|
129
|
+
};
|
|
130
|
+
export type ProcessActionResponseData = {
|
|
131
|
+
count: number;
|
|
132
|
+
details: ProcessActionResponseDetailData[];
|
|
133
|
+
};
|
|
134
|
+
export type ProcessActionResponseDetailData = {
|
|
135
|
+
id: string;
|
|
136
|
+
message: string;
|
|
137
|
+
error: string;
|
|
138
|
+
};
|
|
139
|
+
export type ProcessData = {
|
|
140
|
+
processId: number;
|
|
141
|
+
processType: ProcessType;
|
|
142
|
+
triggerType: ProcessTriggerType;
|
|
143
|
+
namespace: string;
|
|
144
|
+
name: string;
|
|
145
|
+
version: number | null;
|
|
146
|
+
processDefinitionHistoryId: number | null;
|
|
147
|
+
requestId: string;
|
|
148
|
+
correlationId: string;
|
|
149
|
+
status: ProcessStatus;
|
|
150
|
+
input: Record<string, unknown>;
|
|
151
|
+
output: Record<string, unknown>;
|
|
152
|
+
stepIdCount: number | null;
|
|
153
|
+
shardName: string;
|
|
154
|
+
shardInstanceId: number | null;
|
|
155
|
+
stepIds: StepId[];
|
|
156
|
+
stepDataById: Record<number, StepData>;
|
|
157
|
+
created: number;
|
|
158
|
+
updated: number;
|
|
159
|
+
createdBy: string;
|
|
160
|
+
};
|
|
161
|
+
export type StepData = {
|
|
162
|
+
id: number;
|
|
163
|
+
processId: number;
|
|
164
|
+
ref: string;
|
|
165
|
+
parentId: number | null;
|
|
166
|
+
parentRef: string | null;
|
|
167
|
+
namespace: string;
|
|
168
|
+
name: string;
|
|
169
|
+
type: StepType;
|
|
170
|
+
stepDefinitionHistoryId: number | null;
|
|
171
|
+
status: StepStatus;
|
|
172
|
+
input: Record<string, unknown>;
|
|
173
|
+
output: Record<string, unknown>;
|
|
174
|
+
workerId: string;
|
|
175
|
+
start: number;
|
|
176
|
+
schedule: number;
|
|
177
|
+
priority: number;
|
|
178
|
+
updated: number;
|
|
179
|
+
optional: boolean;
|
|
180
|
+
executionList: StepExecutionData[];
|
|
181
|
+
};
|
|
182
|
+
export type StepExecutionData = {
|
|
183
|
+
id: number;
|
|
184
|
+
scheduled: number;
|
|
185
|
+
polled: number;
|
|
186
|
+
start: number;
|
|
187
|
+
updated: number;
|
|
188
|
+
executor: string;
|
|
189
|
+
ref: string;
|
|
190
|
+
runs: number;
|
|
191
|
+
output: Record<string, unknown>;
|
|
192
|
+
};
|
|
193
|
+
export type StepId = {
|
|
194
|
+
id: number;
|
|
195
|
+
processId: number;
|
|
196
|
+
ref: string;
|
|
197
|
+
};
|
|
198
|
+
export type ProcessRequestData = {
|
|
199
|
+
name: string;
|
|
200
|
+
namespace: string;
|
|
201
|
+
version: number | null;
|
|
202
|
+
requestId: string;
|
|
203
|
+
correlationId: string;
|
|
204
|
+
input: Record<string, unknown>;
|
|
205
|
+
};
|
|
206
|
+
export type ProcessSearchRequest = {
|
|
207
|
+
startTimeEpoch: number;
|
|
208
|
+
endTimeEpoch?: number | null;
|
|
209
|
+
namespace: string;
|
|
210
|
+
processTypes: ProcessType[];
|
|
211
|
+
triggerTypes: ProcessTriggerType[];
|
|
212
|
+
names: string[];
|
|
213
|
+
processIds: number[];
|
|
214
|
+
correlationIds: string[];
|
|
215
|
+
requestIds: string[];
|
|
216
|
+
statuses: ProcessStatus[];
|
|
217
|
+
limit: number;
|
|
218
|
+
offset: number;
|
|
219
|
+
};
|
|
220
|
+
export type StepSize = {
|
|
221
|
+
stepQueueNameData: StepQueueNameData;
|
|
222
|
+
size: number | null;
|
|
223
|
+
};
|
|
224
|
+
export type ClientSubmitResult = {
|
|
225
|
+
processId: number;
|
|
226
|
+
stepId: number;
|
|
227
|
+
errorMessage: string | null;
|
|
228
|
+
httpStatusCode: number | null;
|
|
229
|
+
};
|
|
230
|
+
export type WorkRequest = {
|
|
231
|
+
processId: number;
|
|
232
|
+
stepId: number;
|
|
233
|
+
stepExecutionId: number;
|
|
234
|
+
runCount: number;
|
|
235
|
+
stepName: string;
|
|
236
|
+
stepNamespace: string;
|
|
237
|
+
stepRef: string;
|
|
238
|
+
inputParam: Record<string, unknown>;
|
|
239
|
+
isOptional: boolean;
|
|
240
|
+
polled: number;
|
|
241
|
+
scheduled: number;
|
|
242
|
+
updated: number;
|
|
243
|
+
priority: number;
|
|
244
|
+
};
|
|
245
|
+
export type WorkResponse = {
|
|
246
|
+
processId: number;
|
|
247
|
+
stepId: number;
|
|
248
|
+
stepExecutionId: number;
|
|
249
|
+
runCount: number;
|
|
250
|
+
output: Record<string, unknown>;
|
|
251
|
+
status: StepStatus;
|
|
252
|
+
rescheduleAfterSeconds: number | null;
|
|
253
|
+
startedAt: number;
|
|
254
|
+
};
|
|
255
|
+
export type WorkResult = {
|
|
256
|
+
output: unknown;
|
|
257
|
+
taskExecutionId: string;
|
|
258
|
+
startTime: number;
|
|
259
|
+
endTime: number;
|
|
260
|
+
workRequest: WorkRequest;
|
|
261
|
+
};
|
|
262
|
+
export interface ApiClientConfig {
|
|
263
|
+
baseUrl: string;
|
|
264
|
+
clientId: string;
|
|
265
|
+
authToken: string;
|
|
266
|
+
port?: string | number;
|
|
267
|
+
timeout?: number;
|
|
268
|
+
}
|
|
269
|
+
export interface ApiResponse<T = any> {
|
|
270
|
+
data: T;
|
|
271
|
+
status: number;
|
|
272
|
+
headers: Record<string, string>;
|
|
273
|
+
}
|
|
274
|
+
export interface ApiError extends Error {
|
|
275
|
+
status?: number;
|
|
276
|
+
response?: {
|
|
277
|
+
data?: any;
|
|
278
|
+
status: number;
|
|
279
|
+
headers: Record<string, string>;
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
export interface QueryParams {
|
|
283
|
+
[key: string]: string | number | boolean | undefined;
|
|
284
|
+
}
|
|
285
|
+
export interface RequestConfig extends Omit<AxiosRequestConfig, "baseURL" | "url" | "method"> {
|
|
286
|
+
headers?: Record<string, string>;
|
|
287
|
+
}
|
|
288
|
+
export interface HandleRequestConfig {
|
|
289
|
+
method: "get" | "post" | "put" | "delete";
|
|
290
|
+
endpoint: string;
|
|
291
|
+
params?: QueryParams;
|
|
292
|
+
data?: Record<string, unknown>;
|
|
293
|
+
config?: RequestConfig;
|
|
294
|
+
}
|
|
295
|
+
export interface ClientRequestConfig {
|
|
296
|
+
params?: QueryParams;
|
|
297
|
+
data?: any;
|
|
298
|
+
config?: RequestConfig;
|
|
299
|
+
}
|
|
300
|
+
interface UnmeshedWorker {
|
|
301
|
+
(input: Record<string, any>): Promise<any>;
|
|
302
|
+
}
|
|
303
|
+
export interface UnmeshedWorkerConfig {
|
|
304
|
+
worker: UnmeshedWorker;
|
|
305
|
+
namespace: string;
|
|
306
|
+
name: string;
|
|
307
|
+
maxInProgress: number;
|
|
308
|
+
}
|
|
309
|
+
export interface PollRequestData {
|
|
310
|
+
stepQueueNameData: StepQueueNameData;
|
|
311
|
+
size: number;
|
|
312
|
+
}
|
|
313
|
+
export {};
|
package/dist/types/index.js
CHANGED
|
@@ -1,2 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProcessType = exports.ProcessTriggerType = exports.ProcessStatus = exports.StepStatus = exports.StepType = exports.SQAuthUserType = exports.WebhookSource = exports.ApiCallType = void 0;
|
|
4
|
+
var ApiCallType;
|
|
5
|
+
(function (ApiCallType) {
|
|
6
|
+
ApiCallType["SYNC"] = "SYNC";
|
|
7
|
+
ApiCallType["ASYNC"] = "ASYNC";
|
|
8
|
+
ApiCallType["STREAM"] = "STREAM";
|
|
9
|
+
})(ApiCallType || (exports.ApiCallType = ApiCallType = {}));
|
|
10
|
+
var WebhookSource;
|
|
11
|
+
(function (WebhookSource) {
|
|
12
|
+
WebhookSource["MS_TEAMS"] = "MS_TEAMS";
|
|
13
|
+
WebhookSource["NOT_DEFINED"] = "NOT_DEFINED";
|
|
14
|
+
})(WebhookSource || (exports.WebhookSource = WebhookSource = {}));
|
|
15
|
+
var SQAuthUserType;
|
|
16
|
+
(function (SQAuthUserType) {
|
|
17
|
+
SQAuthUserType["USER"] = "USER";
|
|
18
|
+
SQAuthUserType["API"] = "API";
|
|
19
|
+
SQAuthUserType["INTERNAL"] = "INTERNAL";
|
|
20
|
+
})(SQAuthUserType || (exports.SQAuthUserType = SQAuthUserType = {}));
|
|
21
|
+
var StepType;
|
|
22
|
+
(function (StepType) {
|
|
23
|
+
StepType["WORKER"] = "WORKER";
|
|
24
|
+
StepType["HTTP"] = "HTTP";
|
|
25
|
+
StepType["WAIT"] = "WAIT";
|
|
26
|
+
StepType["FAIL"] = "FAIL";
|
|
27
|
+
StepType["PYTHON"] = "PYTHON";
|
|
28
|
+
StepType["JAVASCRIPT"] = "JAVASCRIPT";
|
|
29
|
+
StepType["JQ"] = "JQ";
|
|
30
|
+
StepType["MANAGED"] = "MANAGED";
|
|
31
|
+
StepType["BUILTIN"] = "BUILTIN";
|
|
32
|
+
StepType["NOOP"] = "NOOP";
|
|
33
|
+
StepType["PERSISTED_STATE"] = "PERSISTED_STATE";
|
|
34
|
+
StepType["DEPENDSON"] = "DEPENDSON";
|
|
35
|
+
StepType["INTEGRATION"] = "INTEGRATION";
|
|
36
|
+
StepType["EXIT"] = "EXIT";
|
|
37
|
+
StepType["SUB_PROCESS"] = "SUB_PROCESS";
|
|
38
|
+
StepType["LIST"] = "LIST";
|
|
39
|
+
StepType["PARALLEL"] = "PARALLEL";
|
|
40
|
+
StepType["FOREACH"] = "FOREACH";
|
|
41
|
+
StepType["SWITCH"] = "SWITCH";
|
|
42
|
+
})(StepType || (exports.StepType = StepType = {}));
|
|
43
|
+
var StepStatus;
|
|
44
|
+
(function (StepStatus) {
|
|
45
|
+
StepStatus["PENDING"] = "PENDING";
|
|
46
|
+
StepStatus["SCHEDULED"] = "SCHEDULED";
|
|
47
|
+
StepStatus["RUNNING"] = "RUNNING";
|
|
48
|
+
StepStatus["PAUSED"] = "PAUSED";
|
|
49
|
+
StepStatus["COMPLETED"] = "COMPLETED";
|
|
50
|
+
StepStatus["FAILED"] = "FAILED";
|
|
51
|
+
StepStatus["TIMED_OUT"] = "TIMED_OUT";
|
|
52
|
+
StepStatus["SKIPPED"] = "SKIPPED";
|
|
53
|
+
StepStatus["CANCELLED"] = "CANCELLED";
|
|
54
|
+
})(StepStatus || (exports.StepStatus = StepStatus = {}));
|
|
55
|
+
var ProcessStatus;
|
|
56
|
+
(function (ProcessStatus) {
|
|
57
|
+
ProcessStatus["RUNNING"] = "RUNNING";
|
|
58
|
+
ProcessStatus["COMPLETED"] = "COMPLETED";
|
|
59
|
+
ProcessStatus["FAILED"] = "FAILED";
|
|
60
|
+
ProcessStatus["TIMED_OUT"] = "TIMED_OUT";
|
|
61
|
+
ProcessStatus["CANCELLED"] = "CANCELLED";
|
|
62
|
+
ProcessStatus["TERMINATED"] = "TERMINATED";
|
|
63
|
+
ProcessStatus["REVIEWED"] = "REVIEWED";
|
|
64
|
+
})(ProcessStatus || (exports.ProcessStatus = ProcessStatus = {}));
|
|
65
|
+
var ProcessTriggerType;
|
|
66
|
+
(function (ProcessTriggerType) {
|
|
67
|
+
ProcessTriggerType["MANUAL"] = "MANUAL";
|
|
68
|
+
ProcessTriggerType["SCHEDULED"] = "SCHEDULED";
|
|
69
|
+
ProcessTriggerType["API_MAPPING"] = "API_MAPPING";
|
|
70
|
+
ProcessTriggerType["WEBHOOK"] = "WEBHOOK";
|
|
71
|
+
ProcessTriggerType["API"] = "API";
|
|
72
|
+
ProcessTriggerType["SUB_PROCESS"] = "SUB_PROCESS";
|
|
73
|
+
})(ProcessTriggerType || (exports.ProcessTriggerType = ProcessTriggerType = {}));
|
|
74
|
+
var ProcessType;
|
|
75
|
+
(function (ProcessType) {
|
|
76
|
+
ProcessType["STANDARD"] = "STANDARD";
|
|
77
|
+
ProcessType["DYNAMIC"] = "DYNAMIC";
|
|
78
|
+
ProcessType["API_ORCHESTRATION"] = "API_ORCHESTRATION";
|
|
79
|
+
ProcessType["INTERNAL"] = "INTERNAL";
|
|
80
|
+
})(ProcessType || (exports.ProcessType = ProcessType = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnmeshedCommonUtils = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
class UnmeshedCommonUtils {
|
|
6
|
+
static createSecureHash(input) {
|
|
7
|
+
try {
|
|
8
|
+
const hash = (0, crypto_1.createHash)("sha256");
|
|
9
|
+
hash.update(input, "utf8");
|
|
10
|
+
return hash.digest("hex");
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
throw new Error("Error creating hash");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.UnmeshedCommonUtils = UnmeshedCommonUtils;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnmeshedCommonUtils = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
class UnmeshedCommonUtils {
|
|
6
|
+
static createSecureHash(input) {
|
|
7
|
+
try {
|
|
8
|
+
const hash = (0, crypto_1.createHash)("sha256");
|
|
9
|
+
hash.update(input, "utf8");
|
|
10
|
+
return hash.digest("hex");
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
throw new Error("Error creating hash");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.UnmeshedCommonUtils = UnmeshedCommonUtils;
|
package/package.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unmeshed/sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "Unmeshed SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "tsc && node dist/sample/sampleServer.js",
|
|
9
|
+
"start": "tsc && node dist/sample/sampleServer.js",
|
|
10
|
+
"publishToNpm": "tsc && npm publish --access public"
|
|
11
|
+
},
|
|
7
12
|
"files": [
|
|
8
13
|
"/dist"
|
|
9
14
|
],
|
|
10
15
|
"dependencies": {
|
|
11
16
|
"@types/axios": "^0.14.4",
|
|
12
|
-
"axios": "^1.7.9"
|
|
17
|
+
"axios": "^1.7.9",
|
|
18
|
+
"dotenv": "^16.4.7"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^22.10.6"
|
|
13
22
|
}
|
|
14
23
|
}
|
package/dist/config.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface ApiConfig {
|
|
2
|
-
hostname: string;
|
|
3
|
-
port: number;
|
|
4
|
-
bearerToken: string;
|
|
5
|
-
basePath?: string;
|
|
6
|
-
}
|
|
7
|
-
declare class Config {
|
|
8
|
-
private static instance;
|
|
9
|
-
private config;
|
|
10
|
-
private constructor();
|
|
11
|
-
static getInstance(): Config;
|
|
12
|
-
setConfig(config: ApiConfig): void;
|
|
13
|
-
getConfig(): ApiConfig;
|
|
14
|
-
}
|
|
15
|
-
declare const _default: Config;
|
|
16
|
-
export default _default;
|
package/dist/config.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class Config {
|
|
4
|
-
constructor() { }
|
|
5
|
-
static getInstance() {
|
|
6
|
-
if (!Config.instance) {
|
|
7
|
-
Config.instance = new Config();
|
|
8
|
-
}
|
|
9
|
-
return Config.instance;
|
|
10
|
-
}
|
|
11
|
-
setConfig(config) {
|
|
12
|
-
this.config = config;
|
|
13
|
-
}
|
|
14
|
-
getConfig() {
|
|
15
|
-
if (!this.config) {
|
|
16
|
-
throw new Error("API configuration not set.");
|
|
17
|
-
}
|
|
18
|
-
return this.config;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.default = Config.getInstance();
|
package/dist/hello-world.d.ts
DELETED
package/dist/hello-world.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sayHello = sayHello;
|
|
4
|
-
exports.sayGoodbye = sayGoodbye;
|
|
5
|
-
function sayHello() {
|
|
6
|
-
console.log('hi');
|
|
7
|
-
}
|
|
8
|
-
function sayGoodbye() {
|
|
9
|
-
console.log('goodbye');
|
|
10
|
-
}
|
|
11
|
-
// {
|
|
12
|
-
// "randomId": "876259e6-37b3-4def-b21e-2ca36a12236a",
|
|
13
|
-
// "counter": 3
|
|
14
|
-
// }
|
package/dist/testApi.d.ts
DELETED
package/dist/testApi.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTest = void 0;
|
|
4
|
-
const apiClient_1 = require("./apiClient");
|
|
5
|
-
const getTest = async () => {
|
|
6
|
-
const response = await apiClient_1.default.get("api/test/get");
|
|
7
|
-
return response.data;
|
|
8
|
-
};
|
|
9
|
-
exports.getTest = getTest;
|