@unmeshed/sdk 1.0.5 → 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.
@@ -0,0 +1,14 @@
1
+ import { ApiClientConfig, ApiResponse, ClientRequestConfig, QueryParams, RequestConfig } from "./types/index";
2
+ export declare class ApiClient {
3
+ private axiosInstance;
4
+ private clientId;
5
+ initialize(config: ApiClientConfig): void;
6
+ private validateInstance;
7
+ private handleRequest;
8
+ private handleError;
9
+ get<T = any>(endpoint: string, params?: QueryParams, config?: RequestConfig): Promise<ApiResponse<T>>;
10
+ post<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>>;
11
+ put<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>>;
12
+ delete<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>>;
13
+ getClientId(): string | null;
14
+ }
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiClient = void 0;
4
+ const axios_1 = require("axios");
5
+ const unmeshedCommonUtils_1 = require("./utils/unmeshedCommonUtils");
6
+ class ApiClient {
7
+ constructor() {
8
+ this.axiosInstance = null;
9
+ this.clientId = null;
10
+ }
11
+ initialize(config) {
12
+ const { clientId, authToken, baseUrl, port, timeout = 10000 } = config;
13
+ this.clientId = clientId;
14
+ if (!baseUrl) {
15
+ throw new Error("baseUrl is required");
16
+ }
17
+ const baseURL = port ? `${baseUrl}:${port}` : baseUrl;
18
+ this.axiosInstance = axios_1.default.create({
19
+ baseURL,
20
+ timeout,
21
+ headers: {
22
+ "Content-Type": "application/json",
23
+ Authorization: `Bearer client.sdk.${clientId}.${unmeshedCommonUtils_1.UnmeshedCommonUtils.createSecureHash(authToken)}`,
24
+ },
25
+ });
26
+ }
27
+ validateInstance() {
28
+ if (!this.axiosInstance) {
29
+ throw new Error("ApiClient must be initialized before making requests");
30
+ }
31
+ }
32
+ async handleRequest({ method, endpoint, params, data, config, }) {
33
+ this.validateInstance();
34
+ try {
35
+ const response = await this.axiosInstance.request({
36
+ method,
37
+ url: endpoint,
38
+ params,
39
+ data,
40
+ ...config,
41
+ });
42
+ return {
43
+ data: response.data,
44
+ status: response.status,
45
+ headers: response.headers,
46
+ };
47
+ }
48
+ catch (error) {
49
+ console.error("Request failed:", error.message);
50
+ throw this.handleError(error);
51
+ }
52
+ }
53
+ handleError(error) {
54
+ var _a, _b;
55
+ console.error("Error details:", {
56
+ message: error.message,
57
+ status: (_a = error.response) === null || _a === void 0 ? void 0 : _a.status,
58
+ data: (_b = error.response) === null || _b === void 0 ? void 0 : _b.data,
59
+ });
60
+ }
61
+ async get(endpoint, params, config) {
62
+ return this.handleRequest({
63
+ method: "get",
64
+ endpoint: endpoint,
65
+ params: params,
66
+ config: config,
67
+ });
68
+ }
69
+ async post(endpoint, clientRequestConfig) {
70
+ return this.handleRequest({
71
+ method: "post",
72
+ endpoint: endpoint,
73
+ ...clientRequestConfig,
74
+ });
75
+ }
76
+ async put(endpoint, clientRequestConfig) {
77
+ return this.handleRequest({
78
+ method: "put",
79
+ endpoint: endpoint,
80
+ ...clientRequestConfig,
81
+ });
82
+ }
83
+ async delete(endpoint, clientRequestConfig) {
84
+ return this.handleRequest({
85
+ method: "delete",
86
+ endpoint: endpoint,
87
+ ...clientRequestConfig,
88
+ });
89
+ }
90
+ getClientId() {
91
+ return this.clientId;
92
+ }
93
+ }
94
+ exports.ApiClient = ApiClient;
package/dist/index.d.ts CHANGED
@@ -1 +1,21 @@
1
- export { sayHello, sayGoodbye } from './hello-world';
1
+ import { ApiClient } from "./apiClient";
2
+ import pollForWorkers from "./poller/pollerClientImpl";
3
+ import { ApiCallType, ApiClientConfig, ProcessRequestData, ProcessSearchRequest } from "./types";
4
+ export declare const apiClient: ApiClient;
5
+ declare const UnmeshedClient: {
6
+ initialize: (config: ApiClientConfig) => void;
7
+ runProcessSync: (ProcessRequestData: ProcessRequestData) => Promise<import("./types").ProcessData>;
8
+ runProcessAsync: (ProcessRequestData: ProcessRequestData) => Promise<import("./types").ProcessData>;
9
+ getProcessData: (processId: number) => Promise<import("./types").ProcessData>;
10
+ getStepData: (stepId: number | null) => Promise<import("./types").StepData>;
11
+ bulkTerminate: (processIds: number[], reason?: string) => Promise<import("./types").ProcessActionResponseData>;
12
+ bulkResume: (processIds: number[]) => Promise<import("./types").ProcessActionResponseData>;
13
+ bulkReviewed: (processIds: number[], reason?: string) => Promise<import("./types").ProcessActionResponseData>;
14
+ rerun: (processId: number, clientId: string, version?: number) => Promise<import("./types").ProcessData>;
15
+ searchProcessExecutions: (params: ProcessSearchRequest) => Promise<any>;
16
+ invokeApiMappingGet: (endpoint: string, id: string, correlationId: string, apiCallType: ApiCallType) => Promise<any>;
17
+ invokeApiMappingPost: (endpoint: string, input: Record<string, any>, id: string, correlationId: string, apiCallType?: ApiCallType) => Promise<any>;
18
+ renewRegistration: () => Promise<string>;
19
+ pollForWorkers: typeof pollForWorkers;
20
+ };
21
+ export default UnmeshedClient;
package/dist/index.js CHANGED
@@ -1,6 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sayGoodbye = exports.sayHello = void 0;
4
- var hello_world_1 = require("./hello-world");
5
- Object.defineProperty(exports, "sayHello", { enumerable: true, get: function () { return hello_world_1.sayHello; } });
6
- Object.defineProperty(exports, "sayGoodbye", { enumerable: true, get: function () { return hello_world_1.sayGoodbye; } });
3
+ exports.apiClient = void 0;
4
+ const apiClient_1 = require("./apiClient");
5
+ const pollerClientImpl_1 = require("./poller/pollerClientImpl");
6
+ const processClientImpl_1 = require("./process/processClientImpl");
7
+ const registrationClientImpl_1 = require("./registration/registrationClientImpl");
8
+ exports.apiClient = new apiClient_1.ApiClient();
9
+ const UnmeshedClient = {
10
+ initialize: (config) => exports.apiClient.initialize(config),
11
+ runProcessSync: processClientImpl_1.runProcessSync,
12
+ runProcessAsync: processClientImpl_1.runProcessAsync,
13
+ getProcessData: processClientImpl_1.getProcessData,
14
+ getStepData: processClientImpl_1.getStepData,
15
+ bulkTerminate: processClientImpl_1.bulkTerminate,
16
+ bulkResume: processClientImpl_1.bulkResume,
17
+ bulkReviewed: processClientImpl_1.bulkReviewed,
18
+ rerun: processClientImpl_1.rerun,
19
+ searchProcessExecutions: processClientImpl_1.searchProcessExecutions,
20
+ invokeApiMappingGet: processClientImpl_1.invokeApiMappingGet,
21
+ invokeApiMappingPost: processClientImpl_1.invokeApiMappingPost,
22
+ renewRegistration: registrationClientImpl_1.renewRegistration,
23
+ pollForWorkers: pollerClientImpl_1.default,
24
+ };
25
+ exports.default = UnmeshedClient;
@@ -0,0 +1,2 @@
1
+ import { UnmeshedWorkerConfig } from "../types";
2
+ export default function pollForWorkers(workers: UnmeshedWorkerConfig[]): Promise<void>;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = pollForWorkers;
4
+ const __1 = require("..");
5
+ const types_1 = require("../types");
6
+ async function registerPolling(data) {
7
+ const attempt = async () => {
8
+ try {
9
+ const response = await __1.apiClient.put("/api/clients/register", {
10
+ data: data,
11
+ });
12
+ console.log("Successfully executed polling registration...");
13
+ return response.data;
14
+ }
15
+ catch {
16
+ console.error("An error occurred during polling registration. Retrying in 3 seconds...");
17
+ await new Promise((resolve) => setTimeout(resolve, 3000));
18
+ return attempt();
19
+ }
20
+ };
21
+ return attempt();
22
+ }
23
+ async function pollWorker(data) {
24
+ try {
25
+ const response = await __1.apiClient.post("/api/clients/poll", {
26
+ data: data,
27
+ });
28
+ console.log("Succesfully executed worker polling...");
29
+ return response.data;
30
+ }
31
+ catch (error) {
32
+ console.error("Error occurred during worker polling", error);
33
+ }
34
+ }
35
+ async function pollWorkerResult(data) {
36
+ try {
37
+ const response = await __1.apiClient.post("/api/clients/bulkResults", {
38
+ data: data,
39
+ });
40
+ console.log("Worker Result returned successfully...");
41
+ return response.data;
42
+ }
43
+ catch (error) {
44
+ console.log("Error:", error);
45
+ }
46
+ }
47
+ async function pollForWorkers(workers) {
48
+ const registerPollingData = workers.map((worker) => {
49
+ return {
50
+ orgId: 0,
51
+ namespace: worker.namespace,
52
+ stepType: "WORKER",
53
+ name: worker.name,
54
+ };
55
+ });
56
+ await registerPolling(registerPollingData);
57
+ const pollWorkerData = workers.map((worker) => {
58
+ return {
59
+ stepQueueNameData: {
60
+ orgId: 0,
61
+ namespace: worker.namespace,
62
+ stepType: "WORKER",
63
+ name: worker.name,
64
+ },
65
+ size: worker.maxInProgress,
66
+ };
67
+ });
68
+ const pollResponse = await pollWorker(pollWorkerData);
69
+ const workerResult = await Promise.all(pollResponse.map(async (polledWorker) => {
70
+ const associatedWorker = workers.find((worker) => worker.name === polledWorker.stepName &&
71
+ worker.namespace === polledWorker.stepNamespace);
72
+ let workerResponse = {
73
+ processId: polledWorker.processId,
74
+ stepId: polledWorker.stepId,
75
+ stepExecutionId: polledWorker.stepExecutionId,
76
+ runCount: polledWorker.runCount,
77
+ output: {},
78
+ status: types_1.StepStatus.RUNNING,
79
+ rescheduleAfterSeconds: null,
80
+ startedAt: new Date().getTime(),
81
+ };
82
+ const TIMEOUT = 1000;
83
+ const timeoutPromise = new Promise((_, reject) => {
84
+ setTimeout(() => reject(new Error("Timed out")), TIMEOUT);
85
+ });
86
+ try {
87
+ const result = await Promise.race([
88
+ associatedWorker.worker(polledWorker.inputParam),
89
+ timeoutPromise,
90
+ ]);
91
+ workerResponse = {
92
+ ...workerResponse,
93
+ output: {
94
+ ...result,
95
+ __workCompletedAt: new Date().getTime(),
96
+ },
97
+ status: types_1.StepStatus.COMPLETED,
98
+ };
99
+ }
100
+ catch (error) {
101
+ if (error.message === "Timed out") {
102
+ workerResponse = {
103
+ ...workerResponse,
104
+ output: {
105
+ error: error.message,
106
+ },
107
+ status: types_1.StepStatus.TIMED_OUT,
108
+ };
109
+ }
110
+ else {
111
+ workerResponse = {
112
+ ...workerResponse,
113
+ output: {
114
+ error: error.message,
115
+ },
116
+ status: types_1.StepStatus.FAILED,
117
+ };
118
+ console.error("Error:", error.message);
119
+ }
120
+ }
121
+ return workerResponse;
122
+ }));
123
+ const workerResultResponse = await pollWorkerResult(workerResult);
124
+ console.log("Worker result : ", workerResultResponse);
125
+ }
@@ -0,0 +1,12 @@
1
+ import { ApiCallType, ProcessSearchRequest, ProcessActionResponseData, ProcessData, ProcessRequestData, StepData } from "../types";
2
+ export declare const runProcessSync: (ProcessRequestData: ProcessRequestData) => Promise<ProcessData>;
3
+ export declare const runProcessAsync: (ProcessRequestData: ProcessRequestData) => Promise<ProcessData>;
4
+ export declare const getProcessData: (processId: number) => Promise<ProcessData>;
5
+ export declare const getStepData: (stepId: number | null) => Promise<StepData>;
6
+ export declare const bulkTerminate: (processIds: number[], reason?: string) => Promise<ProcessActionResponseData>;
7
+ export declare const bulkResume: (processIds: number[]) => Promise<ProcessActionResponseData>;
8
+ export declare const bulkReviewed: (processIds: number[], reason?: string) => Promise<ProcessActionResponseData>;
9
+ export declare const rerun: (processId: number, clientId: string, version?: number) => Promise<ProcessData>;
10
+ export declare const searchProcessExecutions: (params: ProcessSearchRequest) => Promise<any>;
11
+ export declare const invokeApiMappingGet: (endpoint: string, id: string, correlationId: string, apiCallType: ApiCallType) => Promise<any>;
12
+ export declare const invokeApiMappingPost: (endpoint: string, input: Record<string, any>, id: string, correlationId: string, apiCallType?: ApiCallType) => Promise<any>;
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.invokeApiMappingPost = exports.invokeApiMappingGet = exports.searchProcessExecutions = exports.rerun = exports.bulkReviewed = exports.bulkResume = exports.bulkTerminate = exports.getStepData = exports.getProcessData = exports.runProcessAsync = exports.runProcessSync = void 0;
4
+ const __1 = require("..");
5
+ const types_1 = require("../types");
6
+ const RUN_PROCESS_REQUEST_URL = "api/process/";
7
+ const runProcessSync = async (ProcessRequestData) => {
8
+ try {
9
+ const response = await __1.apiClient.post(RUN_PROCESS_REQUEST_URL + "runSync", {
10
+ data: ProcessRequestData,
11
+ params: {
12
+ clientId: __1.apiClient.getClientId(),
13
+ },
14
+ });
15
+ console.log("Response:", response);
16
+ return response.data;
17
+ }
18
+ catch (error) {
19
+ console.error("Some error occurred running process request : ", error);
20
+ throw error;
21
+ }
22
+ };
23
+ exports.runProcessSync = runProcessSync;
24
+ const runProcessAsync = async (ProcessRequestData) => {
25
+ try {
26
+ const response = await __1.apiClient.post(RUN_PROCESS_REQUEST_URL + "runAsync", {
27
+ data: ProcessRequestData,
28
+ params: {
29
+ clientId: __1.apiClient.getClientId(),
30
+ },
31
+ });
32
+ console.log("Response:", response);
33
+ return response.data;
34
+ }
35
+ catch (error) {
36
+ console.error("Some error occurred running process request : ", error);
37
+ throw error;
38
+ }
39
+ };
40
+ exports.runProcessAsync = runProcessAsync;
41
+ const getProcessData = async (processId) => {
42
+ if (processId == null) {
43
+ throw new Error("Process ID cannot be null");
44
+ }
45
+ try {
46
+ const response = await __1.apiClient.get(RUN_PROCESS_REQUEST_URL + "context/" + processId);
47
+ return response.data;
48
+ }
49
+ catch (error) {
50
+ console.error("Error occurred while fetching process record: ", error);
51
+ throw error;
52
+ }
53
+ };
54
+ exports.getProcessData = getProcessData;
55
+ const getStepData = async (stepId) => {
56
+ if (stepId === null || stepId === undefined) {
57
+ throw new Error("Step ID cannot be null or undefined");
58
+ }
59
+ try {
60
+ const response = await __1.apiClient.get(RUN_PROCESS_REQUEST_URL + "stepContext/" + stepId);
61
+ return response.data;
62
+ }
63
+ catch (error) {
64
+ throw new Error(`Error occurred while fetching step record: ${error.message || error}`);
65
+ }
66
+ };
67
+ exports.getStepData = getStepData;
68
+ const bulkTerminate = async (processIds, reason) => {
69
+ try {
70
+ const response = await __1.apiClient.post(RUN_PROCESS_REQUEST_URL + "bulkTerminate", {
71
+ params: { reason },
72
+ data: processIds,
73
+ });
74
+ return response.data;
75
+ }
76
+ catch (error) {
77
+ throw new Error(`Error occurred while terminating processes: ${error.message || error}`);
78
+ }
79
+ };
80
+ exports.bulkTerminate = bulkTerminate;
81
+ const bulkResume = async (processIds) => {
82
+ try {
83
+ const response = await __1.apiClient.post(RUN_PROCESS_REQUEST_URL + "bulkResume", {
84
+ data: processIds,
85
+ });
86
+ return response.data;
87
+ }
88
+ catch (error) {
89
+ throw new Error(`Error occurred while resuming processes: ${error.message || error}`);
90
+ }
91
+ };
92
+ exports.bulkResume = bulkResume;
93
+ const bulkReviewed = async (processIds, reason) => {
94
+ try {
95
+ const response = await __1.apiClient.post(RUN_PROCESS_REQUEST_URL + "bulkReviewed", {
96
+ data: processIds,
97
+ params: { reason },
98
+ });
99
+ return response.data;
100
+ }
101
+ catch (error) {
102
+ throw new Error(`Error occurred while marking processes as reviewed: ${error.message || error}`);
103
+ }
104
+ };
105
+ exports.bulkReviewed = bulkReviewed;
106
+ const rerun = async (processId, clientId, version) => {
107
+ var _a, _b;
108
+ const params = {
109
+ clientId,
110
+ processId,
111
+ };
112
+ if (version !== undefined) {
113
+ params["version"] = version;
114
+ }
115
+ try {
116
+ const response = await __1.apiClient.post(RUN_PROCESS_REQUEST_URL + "rerun", {
117
+ params,
118
+ });
119
+ return response.data;
120
+ }
121
+ catch (error) {
122
+ if (error.isAxiosError) {
123
+ throw new Error(`HTTP request error during rerun process: ${(_a = error.response) === null || _a === void 0 ? void 0 : _a.status} - ${(_b = error.response) === null || _b === void 0 ? void 0 : _b.data}`);
124
+ }
125
+ else {
126
+ throw new Error(`Unexpected error during rerun process: ${error.message}`);
127
+ }
128
+ }
129
+ };
130
+ exports.rerun = rerun;
131
+ const searchProcessExecutions = async (params) => {
132
+ const queryParams = new URLSearchParams();
133
+ if (params.startTimeEpoch !== undefined && params.startTimeEpoch !== 0)
134
+ queryParams.set("startTimeEpoch", params.startTimeEpoch.toString());
135
+ if (params.endTimeEpoch !== undefined && params.endTimeEpoch !== 0)
136
+ queryParams.set("endTimeEpoch", params.endTimeEpoch.toString());
137
+ if (params.namespace)
138
+ queryParams.set("namespace", params.namespace);
139
+ if (params.names && params.names.length)
140
+ queryParams.set("names", params.names.join(","));
141
+ if (params.processIds && params.processIds.length)
142
+ queryParams.set("processIds", params.processIds.join(","));
143
+ if (params.correlationIds && params.correlationIds.length)
144
+ queryParams.set("correlationIds", params.correlationIds.join(","));
145
+ if (params.requestIds && params.requestIds.length)
146
+ queryParams.set("requestIds", params.requestIds.join(","));
147
+ if (params.statuses && params.statuses.length)
148
+ queryParams.set("statuses", params.statuses.join(","));
149
+ if (params.triggerTypes && params.triggerTypes.length)
150
+ queryParams.set("triggerTypes", params.triggerTypes.join(","));
151
+ const updatedParams = Object.fromEntries(new URLSearchParams(queryParams));
152
+ try {
153
+ const response = await __1.apiClient.get(RUN_PROCESS_REQUEST_URL + "api/stats/process/search", updatedParams);
154
+ console.log("Response:", response);
155
+ return response.data;
156
+ }
157
+ catch (error) {
158
+ console.error("Error occurred while searching process executions: ", error);
159
+ throw error;
160
+ }
161
+ };
162
+ exports.searchProcessExecutions = searchProcessExecutions;
163
+ const invokeApiMappingGet = async (endpoint, id, correlationId, apiCallType) => {
164
+ try {
165
+ const response = await __1.apiClient.get(RUN_PROCESS_REQUEST_URL + "api/call/" + endpoint, {
166
+ id: id,
167
+ correlationId: correlationId,
168
+ apiCallType,
169
+ });
170
+ console.log("Response:", response);
171
+ return response.data;
172
+ }
173
+ catch (error) {
174
+ console.error("Error occurred while invoking API Mapping GET: ", error);
175
+ throw error;
176
+ }
177
+ };
178
+ exports.invokeApiMappingGet = invokeApiMappingGet;
179
+ const invokeApiMappingPost = async (endpoint, input, id, correlationId, apiCallType = types_1.ApiCallType.ASYNC) => {
180
+ try {
181
+ const response = await __1.apiClient.post(RUN_PROCESS_REQUEST_URL + "api/call/" + endpoint, {
182
+ data: input,
183
+ params: {
184
+ id: id,
185
+ correlationId: correlationId,
186
+ apiCallType,
187
+ },
188
+ });
189
+ return response.data;
190
+ }
191
+ catch (error) {
192
+ console.error("Error occurred while invoking API Mapping POST: ", error);
193
+ throw error;
194
+ }
195
+ };
196
+ exports.invokeApiMappingPost = invokeApiMappingPost;
@@ -0,0 +1 @@
1
+ export declare const renewRegistration: () => Promise<string>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renewRegistration = void 0;
4
+ const __1 = require("..");
5
+ const renewRegistration = async () => {
6
+ try {
7
+ const response = await __1.apiClient.put("/api/clients/register", {
8
+ params: {
9
+ friendlyName: "Unmeshed",
10
+ tokenExpiryDate: "",
11
+ },
12
+ });
13
+ console.debug("Response from server:", response);
14
+ return response.data;
15
+ }
16
+ catch (error) {
17
+ console.error("Error occurred during registration renewal:", error);
18
+ throw error;
19
+ }
20
+ };
21
+ exports.renewRegistration = renewRegistration;
@@ -0,0 +1,2 @@
1
+ export declare const getApi: () => Promise<void>;
2
+ export declare const postApi: () => Promise<import("../types").ApiResponse<any>>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.postApi = exports.getApi = void 0;
4
+ const __1 = require("..");
5
+ const getApi = async () => {
6
+ try {
7
+ const response = await __1.apiClient.get("/api/schedules", {
8
+ name: "test_name",
9
+ });
10
+ console.log("Response:", response);
11
+ }
12
+ catch (error) {
13
+ console.error("Error occurred:", error);
14
+ }
15
+ };
16
+ exports.getApi = getApi;
17
+ const postApi = async () => {
18
+ try {
19
+ const response = await __1.apiClient.post("/api/test/post", {
20
+ data: { name: "test_name" },
21
+ });
22
+ console.log("Response:", response);
23
+ return response;
24
+ }
25
+ catch (error) {
26
+ console.error("Error occurred:", error);
27
+ }
28
+ };
29
+ exports.postApi = postApi;
@@ -0,0 +1 @@
1
+ import "dotenv/config";
@@ -0,0 +1,76 @@
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
+ const ArithmeticWorker_1 = require("./workers/ArithmeticWorker");
7
+ const BASE_URL = process.env.UNMESHED_BASE_URL;
8
+ const PORT = process.env.UNMESHED_PORT;
9
+ const ClIENT_ID = process.env.UNMESHED_CLIENT_ID;
10
+ const AUTH_TOKEN = process.env.UNMESHED_AUTH_TOKEN;
11
+ __1.default.initialize({
12
+ baseUrl: BASE_URL,
13
+ port: PORT,
14
+ clientId: ClIENT_ID,
15
+ authToken: AUTH_TOKEN,
16
+ });
17
+ const request = {
18
+ name: "sample-http",
19
+ namespace: "default",
20
+ input: {},
21
+ correlationId: "",
22
+ requestId: "",
23
+ version: 1,
24
+ };
25
+ const workers = [
26
+ {
27
+ worker: (input) => (0, ArithmeticWorker_1.ArithmeticOperation)(input),
28
+ namespace: "default",
29
+ name: "arithmetic_operation_worker",
30
+ maxInProgress: 10,
31
+ },
32
+ ];
33
+ // UnmeshedClient.pollForWorkers(workers);
34
+ const processId = 28878569;
35
+ const stepId = 28878571;
36
+ const processIds = [34, 344];
37
+ const clientId = "jdjfjf";
38
+ const endpoint = "your-endpoint";
39
+ const input = { key: "value" };
40
+ const id = "12345";
41
+ const apiCallType = types_1.ApiCallType.SYNC;
42
+ const params = {
43
+ startTimeEpoch: 1673606400000,
44
+ endTimeEpoch: 1673692800000,
45
+ namespace: "default",
46
+ processTypes: [types_1.ProcessType.STANDARD],
47
+ triggerTypes: [types_1.ProcessTriggerType.MANUAL],
48
+ names: ["process1", "process2", "process3"],
49
+ processIds: [28883174, 28883162],
50
+ correlationIds: ["correlationId1", "correlationId2"],
51
+ requestIds: ["requestId1", "requestId2"],
52
+ statuses: [types_1.ProcessStatus.COMPLETED],
53
+ limit: 10,
54
+ offset: 0,
55
+ };
56
+ // UnmeshedClient.getStepData(stepId)
57
+ // .then((stepData) => {
58
+ // console.log("STEP_DATA", stepData);
59
+ // })
60
+ // .catch((error) => {
61
+ // console.error("Error fetching step data:", error.message);
62
+ // });
63
+ // UnmeshedClient.rerun(processId, ClIENT_ID)
64
+ // .then((data) => {
65
+ // console.log("PROCESS_DATA", data);
66
+ // })
67
+ // .catch((error) => {
68
+ // console.error("Error fetching step data:", error.message);
69
+ // });
70
+ __1.default.bulkTerminate(processIds)
71
+ .then((data) => {
72
+ console.log("PROCESS_DATA", data);
73
+ })
74
+ .catch((error) => {
75
+ console.error("Error fetching step data:", error.message);
76
+ });
@@ -0,0 +1,5 @@
1
+ type ArithmeticOutput = {
2
+ result: number | string;
3
+ };
4
+ export declare const ArithmeticOperation: (input: Record<string, any>) => Promise<ArithmeticOutput>;
5
+ export {};
@@ -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;
@@ -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);
@@ -0,0 +1,313 @@
1
+ import { AxiosRequestConfig } from "axios";
2
+ export declare enum ApiCallType {
3
+ SYNC = "SYNC",
4
+ ASYNC = "ASYNC",
5
+ STREAM = "STREAM"
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 {};
@@ -0,0 +1,80 @@
1
+ "use strict";
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,3 @@
1
+ export declare class UnmeshedCommonUtils {
2
+ static createSecureHash(input: string): string;
3
+ }
@@ -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,3 @@
1
+ export declare class UnmeshedCommonUtils {
2
+ static createSecureHash(input: string): string;
3
+ }
@@ -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.5",
4
- "description": "Can log \"hello world\" and \"goodbye world\" to the console!",
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
  }
@@ -1,2 +0,0 @@
1
- export declare function sayHello(): void;
2
- export declare function sayGoodbye(): void;
@@ -1,10 +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
- }