cliodot 1.2.3 → 1.2.4
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/LICENSE +201 -0
- package/README.md +2 -0
- package/dist/AuthAppClient.d.ts +1 -0
- package/dist/AuthAppClient.d.ts.map +1 -1
- package/dist/AuthAppClient.js +199 -1
- package/dist/CommercialAppClient.d.ts +50 -9
- package/dist/CommercialAppClient.d.ts.map +1 -1
- package/dist/CommercialAppClient.js +576 -1
- package/dist/ConnectorBuilder.js +104 -1
- package/dist/Events.d.ts +2 -0
- package/dist/Events.d.ts.map +1 -1
- package/dist/Events.js +325 -1
- package/dist/Flosync.js +296 -1
- package/dist/FlosyncClient.js +429 -1
- package/dist/FunctionBuilder.js +65 -1
- package/dist/IdentityAppClient.d.ts +1 -0
- package/dist/IdentityAppClient.d.ts.map +1 -1
- package/dist/IdentityAppClient.js +197 -1
- package/dist/MemoryAppClient.d.ts +1 -0
- package/dist/MemoryAppClient.d.ts.map +1 -1
- package/dist/MemoryAppClient.js +149 -1
- package/dist/MemoryClient.js +20 -1
- package/dist/OAuthAppClient.d.ts +1 -0
- package/dist/OAuthAppClient.d.ts.map +1 -1
- package/dist/OAuthAppClient.js +269 -1
- package/dist/ProviderServicesClient.d.ts +24 -0
- package/dist/ProviderServicesClient.d.ts.map +1 -0
- package/dist/ProviderServicesClient.js +158 -0
- package/dist/Surface.d.ts +2 -0
- package/dist/Surface.d.ts.map +1 -1
- package/dist/Surface.js +255 -1
- package/dist/ValidatorBuilder.js +24 -1
- package/dist/Webhooks.js +61 -1
- package/dist/WorkflowBuilder.js +279 -1
- package/dist/__tests__/CommercialAppClient.test.d.ts +2 -0
- package/dist/__tests__/CommercialAppClient.test.d.ts.map +1 -0
- package/dist/__tests__/CommercialAppClient.test.js +217 -0
- package/dist/__tests__/Events.test.js +191 -1
- package/dist/__tests__/IdentityAppClient.test.js +232 -1
- package/dist/__tests__/OAuthAppClient.test.js +300 -1
- package/dist/__tests__/ProviderServicesClient.test.d.ts +2 -0
- package/dist/__tests__/ProviderServicesClient.test.d.ts.map +1 -0
- package/dist/__tests__/ProviderServicesClient.test.js +131 -0
- package/dist/__tests__/Surface.test.js +150 -1
- package/dist/__tests__/errors.test.js +54 -1
- package/dist/__tests__/function.test.js +58 -1
- package/dist/__tests__/helpers.d.ts +5 -0
- package/dist/__tests__/helpers.d.ts.map +1 -0
- package/dist/__tests__/helpers.js +10 -0
- package/dist/__tests__/localhost-lookup.test.d.ts +2 -0
- package/dist/__tests__/localhost-lookup.test.d.ts.map +1 -0
- package/dist/__tests__/localhost-lookup.test.js +26 -0
- package/dist/__tests__/parse-api-error.test.js +26 -1
- package/dist/__tests__/runner.test.js +156 -1
- package/dist/connectors/builtin.js +354 -1
- package/dist/connectors/registry.js +300 -1
- package/dist/decorators/build.js +105 -1
- package/dist/decorators/connector.js +56 -1
- package/dist/decorators/index.js +34 -1
- package/dist/decorators/metadata.js +338 -1
- package/dist/decorators/steps.js +220 -1
- package/dist/decorators/workflow.js +52 -1
- package/dist/errors.js +76 -1
- package/dist/http/__tests__/cliodot-request.environment.test.d.ts +2 -0
- package/dist/http/__tests__/cliodot-request.environment.test.d.ts.map +1 -0
- package/dist/http/__tests__/cliodot-request.environment.test.js +37 -0
- package/dist/http/__tests__/cliodot-result.test.d.ts +2 -0
- package/dist/http/__tests__/cliodot-result.test.d.ts.map +1 -0
- package/dist/http/__tests__/cliodot-result.test.js +57 -0
- package/dist/http/__tests__/events-instance-id.test.d.ts +2 -0
- package/dist/http/__tests__/events-instance-id.test.d.ts.map +1 -0
- package/dist/http/__tests__/events-instance-id.test.js +45 -0
- package/dist/http/cliodot-request.d.ts +35 -0
- package/dist/http/cliodot-request.d.ts.map +1 -0
- package/dist/http/cliodot-request.js +105 -0
- package/dist/http/cliodot-result.d.ts +40 -0
- package/dist/http/cliodot-result.d.ts.map +1 -0
- package/dist/http/cliodot-result.js +139 -0
- package/dist/http/create-client.d.ts +3 -0
- package/dist/http/create-client.d.ts.map +1 -0
- package/dist/http/create-client.js +14 -0
- package/dist/http/events-instance-id.d.ts +11 -0
- package/dist/http/events-instance-id.d.ts.map +1 -0
- package/dist/http/events-instance-id.js +86 -0
- package/dist/http/localhost-lookup.d.ts +12 -0
- package/dist/http/localhost-lookup.d.ts.map +1 -0
- package/dist/http/localhost-lookup.js +67 -0
- package/dist/http/parse-api-error.js +56 -1
- package/dist/http/sanitize-execution-headers.js +79 -1
- package/dist/identity-offline-verify.js +174 -1
- package/dist/identity-token-cache.js +51 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -1
- package/dist/runner/ProcessorEngine.js +1311 -1
- package/dist/runner/connector.executor.js +1786 -1
- package/dist/runner/utilities/math.executor.js +153 -1
- package/dist/runner/utilities/random.executor.js +151 -1
- package/dist/runner/utilities/string.executor.js +825 -1
- package/dist/template.js +127 -1
- package/dist/transformers/StepsToNodesTransformer.js +214 -1
- package/dist/transformers/WorkflowTransformer.js +189 -1
- package/dist/types/auth-app.api.d.ts +2 -0
- package/dist/types/auth-app.api.d.ts.map +1 -1
- package/dist/types/auth-app.api.js +2 -1
- package/dist/types/builtin.js +2 -1
- package/dist/types/client.api.js +2 -1
- package/dist/types/commercial-app.api.d.ts +407 -11
- package/dist/types/commercial-app.api.d.ts.map +1 -1
- package/dist/types/commercial-app.api.js +2 -1
- package/dist/types/connector.js +2 -1
- package/dist/types/context.js +2 -1
- package/dist/types/event-app.api.d.ts +8 -0
- package/dist/types/event-app.api.d.ts.map +1 -1
- package/dist/types/event-app.api.js +2 -1
- package/dist/types/function.js +2 -1
- package/dist/types/identity-app.api.d.ts +2 -0
- package/dist/types/identity-app.api.d.ts.map +1 -1
- package/dist/types/identity-app.api.js +2 -1
- package/dist/types/index.js +23 -1
- package/dist/types/memory-app.api.d.ts +2 -0
- package/dist/types/memory-app.api.d.ts.map +1 -1
- package/dist/types/memory-app.api.js +2 -1
- package/dist/types/oauth-app.api.d.ts +2 -0
- package/dist/types/oauth-app.api.d.ts.map +1 -1
- package/dist/types/oauth-app.api.js +105 -1
- package/dist/types/provider-services.api.d.ts +98 -0
- package/dist/types/provider-services.api.d.ts.map +1 -0
- package/dist/types/provider-services.api.js +2 -0
- package/dist/types/validator.js +2 -1
- package/dist/types/webhook-app.api.js +2 -1
- package/dist/types/workflow.js +33 -1
- package/dist/validators/validators.js +478 -1
- package/dist/variable.js +37 -1
- package/package.json +3 -2
|
@@ -1 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const errors_1 = require("../errors");
|
|
4
|
+
describe("CliodotApiError", () => {
|
|
5
|
+
it("exposes only API body on response/data from axios errors", () => {
|
|
6
|
+
const body = {
|
|
7
|
+
ok: false,
|
|
8
|
+
error: "Subscription not found",
|
|
9
|
+
code: "EVENT_SUBSCRIBER_NOT_FOUND",
|
|
10
|
+
};
|
|
11
|
+
const err = (0, errors_1.cliodotApiErrorFromAxios)({
|
|
12
|
+
message: "Request failed with status code 404",
|
|
13
|
+
response: {
|
|
14
|
+
status: 404,
|
|
15
|
+
statusText: "Not Found",
|
|
16
|
+
headers: { "content-type": "application/json" },
|
|
17
|
+
config: { url: "/v1/subscribe/x", method: "delete" },
|
|
18
|
+
request: {},
|
|
19
|
+
data: body,
|
|
20
|
+
},
|
|
21
|
+
}, "Request failed");
|
|
22
|
+
expect(err).toBeInstanceOf(errors_1.CliodotApiError);
|
|
23
|
+
expect(err.status).toBe(404);
|
|
24
|
+
expect(err.message).toBe("Subscription not found");
|
|
25
|
+
expect(err.code).toBe("EVENT_SUBSCRIBER_NOT_FOUND");
|
|
26
|
+
expect(err.response).toEqual(body);
|
|
27
|
+
expect(err.data).toEqual(body);
|
|
28
|
+
expect(err.response).not.toHaveProperty("config");
|
|
29
|
+
expect(err.response).not.toHaveProperty("headers");
|
|
30
|
+
expect(err.response).not.toHaveProperty("request");
|
|
31
|
+
expect(JSON.parse(JSON.stringify(err))).toEqual({
|
|
32
|
+
name: "CliodotApiError",
|
|
33
|
+
message: "Subscription not found",
|
|
34
|
+
status: 404,
|
|
35
|
+
code: "EVENT_SUBSCRIBER_NOT_FOUND",
|
|
36
|
+
data: body,
|
|
37
|
+
response: body,
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
it("unwraps axios-like response option if passed to constructor", () => {
|
|
41
|
+
const body = { ok: false, error: "Nope", code: "X" };
|
|
42
|
+
const err = new errors_1.CliodotApiError("Nope", {
|
|
43
|
+
response: {
|
|
44
|
+
status: 400,
|
|
45
|
+
headers: {},
|
|
46
|
+
config: {},
|
|
47
|
+
data: body,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
expect(err.response).toEqual(body);
|
|
51
|
+
expect(err.data).toEqual(body);
|
|
52
|
+
expect(err.status).toBe(400);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -1 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("../index");
|
|
4
|
+
describe("FunctionBuilder", () => {
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
index_1.flosync.configure({ connectors: {} });
|
|
7
|
+
});
|
|
8
|
+
it("creates and runs a function with transform and outputFrom", async () => {
|
|
9
|
+
const validatePayment = index_1.flosync
|
|
10
|
+
.function("validate-payment")
|
|
11
|
+
.input({ amount: "number", currency: "string" })
|
|
12
|
+
.step("validate", (s) => s.validator({ amount: "{{ args.amount }}", currency: "{{ args.currency }}" }))
|
|
13
|
+
.step("format", (s) => s.transform({
|
|
14
|
+
valid: "{{ stepResults.validate.valid }}",
|
|
15
|
+
amount: "{{ args.amount }}",
|
|
16
|
+
}))
|
|
17
|
+
.outputFrom("format")
|
|
18
|
+
.build();
|
|
19
|
+
index_1.flosync.registerFunction(validatePayment);
|
|
20
|
+
const result = await index_1.flosync.runFunction("validate-payment", {
|
|
21
|
+
amount: 100,
|
|
22
|
+
currency: "USD",
|
|
23
|
+
});
|
|
24
|
+
expect(result).toBeDefined();
|
|
25
|
+
expect(result.valid).toBe(true);
|
|
26
|
+
expect(result.amount).toBe(100);
|
|
27
|
+
});
|
|
28
|
+
it("uses function in workflow via call step", async () => {
|
|
29
|
+
const validatePayment = index_1.flosync
|
|
30
|
+
.function("validate-payment")
|
|
31
|
+
.input({ amount: "number", currency: "string" })
|
|
32
|
+
.step("format", (s) => s.transform({
|
|
33
|
+
valid: "true",
|
|
34
|
+
amount: "{{ args.amount }}",
|
|
35
|
+
currency: "{{ args.currency }}",
|
|
36
|
+
}))
|
|
37
|
+
.outputFrom("format")
|
|
38
|
+
.build();
|
|
39
|
+
index_1.flosync.registerFunction(validatePayment);
|
|
40
|
+
const w = index_1.flosync
|
|
41
|
+
.workflow("payment-flow")
|
|
42
|
+
.http("POST", "/pay")
|
|
43
|
+
.step("validate", (s) => s.call("validate-payment", {
|
|
44
|
+
amount: "{{ trigger.body.amount }}",
|
|
45
|
+
currency: "{{ trigger.body.currency }}",
|
|
46
|
+
}))
|
|
47
|
+
.step("respond", (s) => s.responder("json", { body: "{{ stepResults.validate }}" }))
|
|
48
|
+
.build();
|
|
49
|
+
index_1.flosync.register(w);
|
|
50
|
+
const result = await index_1.flosync.run("payment-flow", {
|
|
51
|
+
body: { amount: 50, currency: "NGN" },
|
|
52
|
+
});
|
|
53
|
+
expect(result.statusCode).toBe(200);
|
|
54
|
+
expect(result.body.valid).toBeDefined();
|
|
55
|
+
expect(result.body.valid).toBeTruthy();
|
|
56
|
+
expect(Number(result.body.amount)).toBe(50);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/__tests__/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE9F,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC7B,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,CAKjE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertOk = assertOk;
|
|
4
|
+
const cliodot_result_1 = require("../http/cliodot-result");
|
|
5
|
+
function assertOk(result) {
|
|
6
|
+
expect((0, cliodot_result_1.isCliodotOk)(result)).toBe(true);
|
|
7
|
+
if ((0, cliodot_result_1.isCliodotFail)(result)) {
|
|
8
|
+
throw new Error(`${result.error.code}: ${result.error.message}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localhost-lookup.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/localhost-lookup.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const localhost_lookup_1 = require("../http/localhost-lookup");
|
|
4
|
+
describe("localhostAwareLookup", () => {
|
|
5
|
+
it("treats localhost and *.localhost as loopback", () => {
|
|
6
|
+
expect((0, localhost_lookup_1.isLoopbackHostname)("localhost")).toBe(true);
|
|
7
|
+
expect((0, localhost_lookup_1.isLoopbackHostname)("flash.localhost")).toBe(true);
|
|
8
|
+
expect((0, localhost_lookup_1.isLoopbackHostname)("FLASH.LOCALHOST")).toBe(true);
|
|
9
|
+
expect((0, localhost_lookup_1.isLoopbackHostname)("api.example.com")).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
it("resolves *.localhost to 127.0.0.1 without DNS", (done) => {
|
|
12
|
+
(0, localhost_lookup_1.localhostAwareLookup)("flash.localhost", {}, (err, address, family) => {
|
|
13
|
+
expect(err).toBeNull();
|
|
14
|
+
expect(address).toBe("127.0.0.1");
|
|
15
|
+
expect(family).toBe(4);
|
|
16
|
+
done();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
it("supports all:true lookups", (done) => {
|
|
20
|
+
(0, localhost_lookup_1.localhostAwareLookup)("flash.localhost", { all: true }, (err, address) => {
|
|
21
|
+
expect(err).toBeNull();
|
|
22
|
+
expect(address).toEqual([{ address: "127.0.0.1", family: 4 }]);
|
|
23
|
+
done();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const parse_api_error_1 = require("../http/parse-api-error");
|
|
4
|
+
describe("parseApiError", () => {
|
|
5
|
+
it("prefers top-level message over nested error object", () => {
|
|
6
|
+
const data = {
|
|
7
|
+
message: "No refresh token available for this connection",
|
|
8
|
+
status: false,
|
|
9
|
+
statusCode: 422,
|
|
10
|
+
data: null,
|
|
11
|
+
error: { statusCode: 422, code: "OAUTH_PROVIDER_ERROR" },
|
|
12
|
+
};
|
|
13
|
+
expect((0, parse_api_error_1.parseApiErrorMessage)(data)).toBe("No refresh token available for this connection");
|
|
14
|
+
expect((0, parse_api_error_1.parseApiErrorCode)(data)).toBe("OAUTH_PROVIDER_ERROR");
|
|
15
|
+
expect((0, parse_api_error_1.parseApiErrorStatus)(data)).toBe(422);
|
|
16
|
+
});
|
|
17
|
+
it("reads string error field", () => {
|
|
18
|
+
const data = {
|
|
19
|
+
ok: false,
|
|
20
|
+
error: "Invalid or expired exchange code",
|
|
21
|
+
code: "OAUTH_EXCHANGE_CODE_INVALID",
|
|
22
|
+
};
|
|
23
|
+
expect((0, parse_api_error_1.parseApiErrorMessage)(data)).toBe("Invalid or expired exchange code");
|
|
24
|
+
expect((0, parse_api_error_1.parseApiErrorCode)(data)).toBe("OAUTH_EXCHANGE_CODE_INVALID");
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -1 +1,156 @@
|
|
|
1
|
-
'use strict';const _0xe630d2=_0x3e54;(function(_0x12e91e,_0x273217){const _0xc166e4=_0x3e54,_0x45e570=_0x12e91e();while(!![]){try{const _0x318f81=-parseInt(_0xc166e4(0x171))/0x1*(-parseInt(_0xc166e4(0x1a4))/0x2)+parseInt(_0xc166e4(0x152))/0x3*(parseInt(_0xc166e4(0x17d))/0x4)+-parseInt(_0xc166e4(0x19c))/0x5+-parseInt(_0xc166e4(0x170))/0x6*(-parseInt(_0xc166e4(0x1a2))/0x7)+parseInt(_0xc166e4(0x184))/0x8*(-parseInt(_0xc166e4(0x153))/0x9)+parseInt(_0xc166e4(0x14f))/0xa*(parseInt(_0xc166e4(0x178))/0xb)+-parseInt(_0xc166e4(0x196))/0xc;if(_0x318f81===_0x273217)break;else _0x45e570['push'](_0x45e570['shift']());}catch(_0x36f80e){_0x45e570['push'](_0x45e570['shift']());}}}(_0x1b4d,0x3f9d8));function _0x3e54(_0x3473a6,_0x108f25){_0x3473a6=_0x3473a6-0x147;const _0x1b4d90=_0x1b4d();let _0x3e5498=_0x1b4d90[_0x3473a6];if(_0x3e54['MXfwnB']===undefined){var _0x557d12=function(_0x21cec6){const _0xe208ff='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x796d4d='',_0x3847ce='';for(let _0x1380a0=0x0,_0x284695,_0x557e6c,_0x3b4521=0x0;_0x557e6c=_0x21cec6['charAt'](_0x3b4521++);~_0x557e6c&&(_0x284695=_0x1380a0%0x4?_0x284695*0x40+_0x557e6c:_0x557e6c,_0x1380a0++%0x4)?_0x796d4d+=String['fromCharCode'](0xff&_0x284695>>(-0x2*_0x1380a0&0x6)):0x0){_0x557e6c=_0xe208ff['indexOf'](_0x557e6c);}for(let _0x340618=0x0,_0x37e523=_0x796d4d['length'];_0x340618<_0x37e523;_0x340618++){_0x3847ce+='%'+('00'+_0x796d4d['charCodeAt'](_0x340618)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3847ce);};_0x3e54['hLpvrl']=_0x557d12,_0x3e54['pQioJu']={},_0x3e54['MXfwnB']=!![];}const _0x50abb1=_0x1b4d90[0x0],_0x5af780=_0x3473a6+_0x50abb1,_0xeadb0d=_0x3e54['pQioJu'][_0x5af780];return!_0xeadb0d?(_0x3e5498=_0x3e54['hLpvrl'](_0x3e5498),_0x3e54['pQioJu'][_0x5af780]=_0x3e5498):_0x3e5498=_0xeadb0d,_0x3e5498;}Object[_0xe630d2(0x16a)](exports,_0xe630d2(0x162),{'value':!![]});const index_1=require(_0xe630d2(0x194));describe(_0xe630d2(0x18e),()=>{const _0x17323a=_0xe630d2;beforeEach(()=>{const _0x3312e5=_0x3e54;index_1[_0x3312e5(0x176)][_0x3312e5(0x14d)]({'connectors':{}});}),it(_0x17323a(0x19f),async()=>{const _0x521f05=_0x17323a,_0x796d4d=index_1[_0x521f05(0x176)][_0x521f05(0x18d)](_0x521f05(0x147))[_0x521f05(0x14a)](_0x521f05(0x18f),_0x521f05(0x14e))[_0x521f05(0x16f)]('validate',_0x1380a0=>_0x1380a0[_0x521f05(0x155)]({'amount':_0x521f05(0x167),'currency':_0x521f05(0x191)}))[_0x521f05(0x16f)](_0x521f05(0x195),_0x284695=>_0x284695['responder'](_0x521f05(0x18b),{'statusCode':0xc8,'body':_0x521f05(0x172)}))[_0x521f05(0x16e)]();index_1[_0x521f05(0x176)][_0x521f05(0x15f)](_0x796d4d);const _0x3847ce=await index_1['flosync'][_0x521f05(0x175)]('test-flow',{'body':{'amount':0x64,'currency':'USD'}});expect(_0x3847ce['statusCode'])[_0x521f05(0x168)](0xc8),expect(_0x3847ce[_0x521f05(0x182)])[_0x521f05(0x158)](),expect(_0x3847ce['body']['valid'])[_0x521f05(0x168)](!![]);}),it(_0x17323a(0x15c),async()=>{const _0x780ad8=_0x17323a,_0x557e6c=index_1[_0x780ad8(0x176)][_0x780ad8(0x18d)]('cond-flow')[_0x780ad8(0x14a)](_0x780ad8(0x18f),'/cond')[_0x780ad8(0x16f)](_0x780ad8(0x19d),_0x37e523=>_0x37e523[_0x780ad8(0x187)]('{{\x20trigger.body.amount\x20>\x200\x20}}')[_0x780ad8(0x17f)]('ok')[_0x780ad8(0x1a8)](_0x780ad8(0x15b)))[_0x780ad8(0x16f)]('ok',_0x51c891=>_0x51c891[_0x780ad8(0x156)](_0x780ad8(0x18b),{'statusCode':0xc8,'body':{'status':'ok'}}))[_0x780ad8(0x16f)](_0x780ad8(0x15b),_0x147cb2=>_0x147cb2['responder'](_0x780ad8(0x18b),{'statusCode':0x190,'body':{'status':_0x780ad8(0x15b)}}))[_0x780ad8(0x16e)]();index_1[_0x780ad8(0x176)]['register'](_0x557e6c);const _0x3b4521=await index_1[_0x780ad8(0x176)]['run'](_0x780ad8(0x161),{'body':{'amount':0xa}});expect(_0x3b4521['statusCode'])['toBe'](0xc8),expect(_0x3b4521[_0x780ad8(0x182)])[_0x780ad8(0x15d)]({'status':'ok'});const _0x340618=await index_1[_0x780ad8(0x176)][_0x780ad8(0x175)](_0x780ad8(0x161),{'body':{'amount':0x0}});expect(_0x340618[_0x780ad8(0x197)])[_0x780ad8(0x168)](0x190),expect(_0x340618[_0x780ad8(0x182)])['toEqual']({'status':_0x780ad8(0x15b)});}),it('runs\x20workflow\x20with\x20transform\x20step',async()=>{const _0x5228e0=_0x17323a,_0x66a452=index_1[_0x5228e0(0x176)][_0x5228e0(0x18d)](_0x5228e0(0x180))[_0x5228e0(0x14a)](_0x5228e0(0x18f),_0x5228e0(0x14c))[_0x5228e0(0x16f)](_0x5228e0(0x198),_0x29f591=>_0x29f591[_0x5228e0(0x198)]({'doubled':_0x5228e0(0x165),'upper':_0x5228e0(0x18a)}))[_0x5228e0(0x16f)](_0x5228e0(0x195),_0x14cd27=>_0x14cd27[_0x5228e0(0x156)]('json',{'body':_0x5228e0(0x17a)}))[_0x5228e0(0x16e)]();index_1['flosync'][_0x5228e0(0x15f)](_0x66a452);const _0x5a7476=await index_1[_0x5228e0(0x176)]['run'](_0x5228e0(0x180),{'body':{'value':0x5,'name':_0x5228e0(0x15e)}});expect(_0x5a7476[_0x5228e0(0x197)])[_0x5228e0(0x168)](0xc8),expect(_0x5a7476[_0x5228e0(0x182)])[_0x5228e0(0x158)](),expect(_0x5a7476[_0x5228e0(0x182)][_0x5228e0(0x193)])[_0x5228e0(0x168)](0xa),expect(_0x5a7476[_0x5228e0(0x182)][_0x5228e0(0x174)])['toBe'](_0x5228e0(0x154));}),it(_0x17323a(0x179),async()=>{const _0x22fea2=_0x17323a,_0x515a16=index_1['flosync'][_0x22fea2(0x18d)]('validator-else')['http']('POST','/v')[_0x22fea2(0x16f)]('validate',_0x3ff732=>_0x3ff732[_0x22fea2(0x155)]({'amount':_0x22fea2(0x167)})[_0x22fea2(0x17f)](_0x22fea2(0x16c))[_0x22fea2(0x1a8)]('error'))[_0x22fea2(0x16f)](_0x22fea2(0x16c),_0xf1935e=>_0xf1935e[_0x22fea2(0x156)]('json',{'statusCode':0xc8,'body':{'saved':!![]}}))[_0x22fea2(0x16f)](_0x22fea2(0x17c),_0x3fe07f=>_0x3fe07f[_0x22fea2(0x156)](_0x22fea2(0x18b),{'statusCode':0x190,'body':{'error':_0x22fea2(0x163)}}))[_0x22fea2(0x16e)]();index_1[_0x22fea2(0x176)]['register'](_0x515a16);const _0x208205=await index_1['flosync'][_0x22fea2(0x175)]('validator-else',{'body':{}});expect(_0x208205[_0x22fea2(0x197)])[_0x22fea2(0x168)](0x190),expect(_0x208205['body'][_0x22fea2(0x17c)])['toBe'](_0x22fea2(0x163));}),it(_0x17323a(0x1a5),async()=>{const _0x14d43e=_0x17323a,_0x40bd7c=index_1[_0x14d43e(0x176)][_0x14d43e(0x18d)](_0x14d43e(0x148))['http'](_0x14d43e(0x18f),_0x14d43e(0x19e))[_0x14d43e(0x16f)](_0x14d43e(0x195),_0x12088d=>_0x12088d[_0x14d43e(0x156)]('json',{'body':{'received':_0x14d43e(0x167)}}))[_0x14d43e(0x16e)]();index_1[_0x14d43e(0x176)][_0x14d43e(0x15f)](_0x40bd7c);const _0x524e41=await index_1['flosync'][_0x14d43e(0x175)](_0x14d43e(0x148),{'amount':0x2a});expect(_0x524e41[_0x14d43e(0x197)])[_0x14d43e(0x168)](0xc8),expect(Number(_0x524e41[_0x14d43e(0x182)][_0x14d43e(0x1a0)]))[_0x14d43e(0x168)](0x2a);}),it(_0x17323a(0x15a),async()=>{const _0x3c2393=_0x17323a,_0x26e126=index_1[_0x3c2393(0x176)][_0x3c2393(0x18d)](_0x3c2393(0x177))[_0x3c2393(0x14a)](_0x3c2393(0x18f),_0x3c2393(0x183))[_0x3c2393(0x16f)](_0x3c2393(0x195),_0x4cde38=>_0x4cde38[_0x3c2393(0x156)](_0x3c2393(0x18b),{'body':{'bodyAmount':_0x3c2393(0x167),'headerX':_0x3c2393(0x18c),'pathId':_0x3c2393(0x185),'queryPage':_0x3c2393(0x186),'varOverride':_0x3c2393(0x17e)}}))[_0x3c2393(0x16e)]();index_1['flosync'][_0x3c2393(0x15f)](_0x26e126);const _0x489730=await index_1['flosync'][_0x3c2393(0x175)](_0x3c2393(0x177),{'body':{'amount':0xa},'headers':{'x-request-id':_0x3c2393(0x151)},'pathParams':{'id':_0x3c2393(0x157)},'query':{'page':0x2},'vars':{'override':_0x3c2393(0x159)}});expect(_0x489730['statusCode'])['toBe'](0xc8),expect(Number(_0x489730[_0x3c2393(0x182)][_0x3c2393(0x17b)]))[_0x3c2393(0x168)](0xa),expect(_0x489730[_0x3c2393(0x182)][_0x3c2393(0x188)])[_0x3c2393(0x168)](_0x3c2393(0x151)),expect(_0x489730['body'][_0x3c2393(0x189)])[_0x3c2393(0x168)](_0x3c2393(0x157)),expect(Number(_0x489730[_0x3c2393(0x182)][_0x3c2393(0x199)]))['toBe'](0x2),expect(_0x489730['body'][_0x3c2393(0x1a9)])[_0x3c2393(0x168)](_0x3c2393(0x159));}),it(_0x17323a(0x16b),async()=>{const _0x221b9a=_0x17323a,_0x419535=index_1[_0x221b9a(0x176)][_0x221b9a(0x18d)](_0x221b9a(0x190))[_0x221b9a(0x14a)](_0x221b9a(0x18f),_0x221b9a(0x14e))[_0x221b9a(0x16f)]('respond',_0x5e0fac=>_0x5e0fac[_0x221b9a(0x156)](_0x221b9a(0x18b),{'body':{'viaBody':_0x221b9a(0x1a6),'viaTrigger':_0x221b9a(0x160)}}))[_0x221b9a(0x16e)]();index_1[_0x221b9a(0x176)]['register'](_0x419535);const _0xf72ad1=await index_1[_0x221b9a(0x176)][_0x221b9a(0x175)]('body-trigger-access',{'body':{'account':_0x221b9a(0x149),'email':_0x221b9a(0x1a1)}});expect(_0xf72ad1[_0x221b9a(0x197)])[_0x221b9a(0x168)](0xc8),expect(_0xf72ad1[_0x221b9a(0x182)][_0x221b9a(0x173)])[_0x221b9a(0x168)](_0x221b9a(0x149)),expect(_0xf72ad1[_0x221b9a(0x182)][_0x221b9a(0x169)])[_0x221b9a(0x168)](_0x221b9a(0x1a1));}),it(_0x17323a(0x192),async()=>{const _0x41b7bd=_0x17323a,_0x149292=index_1[_0x41b7bd(0x176)][_0x41b7bd(0x18d)](_0x41b7bd(0x16d))['step'](_0x41b7bd(0x195),_0x16f82d=>_0x16f82d[_0x41b7bd(0x156)](_0x41b7bd(0x18b),{'body':{'received':_0x41b7bd(0x166)}}))[_0x41b7bd(0x16e)]();index_1[_0x41b7bd(0x176)][_0x41b7bd(0x15f)](_0x149292);const _0x183a18=await index_1['flosync']['run'](_0x41b7bd(0x16d),{'body':{'amount':0x63}});expect(_0x183a18[_0x41b7bd(0x197)])['toBe'](0xc8),expect(Number(_0x183a18[_0x41b7bd(0x182)][_0x41b7bd(0x1a0)]))['toBe'](0x63);}),it(_0x17323a(0x164),async()=>{const _0x4ec41c=_0x17323a,_0x3feebf=index_1[_0x4ec41c(0x176)][_0x4ec41c(0x18d)]('job-flow')['job'](_0x4ec41c(0x181),_0x4ec41c(0x19b))[_0x4ec41c(0x16f)]('respond',_0x3e6af3=>_0x3e6af3['responder'](_0x4ec41c(0x18b),{'body':{'ok':!![]}}))[_0x4ec41c(0x16e)]();expect(_0x3feebf['trigger'][_0x4ec41c(0x14b)])[_0x4ec41c(0x168)](_0x4ec41c(0x150)),expect(_0x3feebf['trigger'][_0x4ec41c(0x19a)])[_0x4ec41c(0x168)]('0\x20*\x20*\x20*\x20*'),expect(_0x3feebf['trigger'][_0x4ec41c(0x1a3)])[_0x4ec41c(0x168)](_0x4ec41c(0x19b)),index_1[_0x4ec41c(0x176)]['register'](_0x3feebf);const _0x592a92=await index_1[_0x4ec41c(0x176)][_0x4ec41c(0x175)](_0x4ec41c(0x1a7),{});expect(_0x592a92[_0x4ec41c(0x197)])['toBe'](0xc8),expect(_0x592a92[_0x4ec41c(0x182)]['ok'])['toBe'](!![]);});});function _0x1b4d(){const _0x1ff0fd=['otKYmZiWC1bZzgj6','y2HLy2S','l3bSywLU','CNvUCYbHihnPBxbSzsb3B3jRzMXVDYb3AxrOihzHBgLKyxrVCIbHBMqGCMvZCg9UzgvY','CMvJzwL2zwq','DxnLCKbLEgfTCgXLlMnVBq','mZvQD3LzAeS','DgLTzxPVBMu','mtHxEwn1DKq','ywnJzxb0CYbWBgfPBIbVyMPLy3qGyxmGDhjPz2DLCIbIB2r5icHUBYbIB2r5igTLEsK','E3SGyM9KEs5Hy2nVDw50ih19','AM9IlwzSB3C','zwXZzq','DMfYt3zLCNjPzgu','DgvZDc1MBg93','CgXHAw4TyM9KEq','ywnJDc0X','Ahr0Ca','DhLWzq','l3rYyw5ZzM9YBq','y29UzMLNDxjL','l3rLC3q','mZbTBNbgB0C','AM9I','CMvXlteYmW','nNbAyxfltG','nZjnvuj1v3m','sevmte8','DMfSAwrHDg9Y','CMvZCg9UzgvY','DxnLCI00nty','Dg9czurLzMLUzwq','zNjVBs1WyxLSB2fK','CgfZC2vZigHLywrLCNmSihbHDgHqyxjHBxmSihbHCMfTCYWGCxvLCNKSihzHCNmGDg8GDgvTCgXHDguGy29UDgv4Da','zMfPBa','CNvUCYb3B3jRzMXVDYb3AxrOignVBMrPDgLVBIb0AgvUl2vSC2u','Dg9fCxvHBa','AgvSBg8','CMvNAxn0zxi','E3SGDhjPz2DLCI5LBwfPBcb9Fq','y29Uzc1MBg93','x19LC01VzhvSzq','vMfSAwrHDgLVBIbMywLSzwq','yNvPBgrZihDVCMTMBg93ihDPDgGGAM9IihrYAwDNzxi','E3SGDhjPz2DLCI5IB2r5lNzHBhvLicOGmIb9Fq','E3SGyM9KEs5HBw91BNqGFx0','E3SGDhjPz2DLCI5IB2r5lMfTB3vUDcb9Fq','Dg9czq','DMLHvhjPz2DLCG','zgvMAw5LuhjVCgvYDhK','C3vWCg9YDhmGE3SGyM9KEs54ih19igfUzcb7EYb0CMLNz2vYlNGGFx0GzM9YigjVzhKGzMLLBgrZ','C2f2zq','BwfUDwfSlwzSB3C','yNvPBgq','C3rLCa','ntu2mde0EKf0vePH','mti0otDxCxrlCvO','E3SGC3rLCfjLC3vSDhmUDMfSAwrHDguGFx0','DMLHqM9KEq','DxbWzxi','CNvU','zMXVC3LUyW','zNvSBc1WyxLSB2fK','mtC5mJy4mu9xvhvutG','DMfSAwrHDg9YigzHAwXZigfUzcb0CMLNz2vYCYbLBhnLigjYyw5JAa','E3SGC3rLCfjLC3vSDhmUDhjHBNnMB3jTih19','yM9KEufTB3vUDa','zxjYB3i','otqZndeYqxjHwMzN','E3SGDMfYCY5VDMvYCMLKzsb9Fq','DgHLBG','DhjHBNnMB3jTlwzSB3C','mcaQicOGkIaQ','yM9KEq','l3vZzxjZlZPPza','mtm2nJi0DMjgz0nV','E3SGCgf0AfbHCMfTCY5Pzcb9Fq','E3SGCxvLCNKUCgfNzsb9Fq','y29UzgL0Aw9U','AgvHzgvYwa','Cgf0AeLK','E3SGDxbWzxjJyxnLkhrYAwDNzxiUyM9KEs5Uyw1Lksb9Fq','ANnVBG','E3SGAgvHzgvYC1SNEc1Yzxf1zxn0lwLKj10GFx0','D29YA2zSB3C','uhjVy2vZC29Yrw5NAw5L','ue9tva','yM9KEs10CMLNz2vYlwfJy2vZCW','E3SGDhjPz2DLCI5IB2r5lMn1CNjLBMn5ih19','CNvUCYb3B3jRzMXVDYb3AxrOB3v0igH0DhaGDhjPz2DLCIaOBwfUDwfSkq','zg91yMXLza','lI4VAw5KzxG','CMvZCg9Uza','mteYodKZnZjPuwDluhO','C3rHDhvZq29Kzq','DhjHBNnMB3jT','CxvLCNLqywDL','y3jVBG','vvrd'];_0x1b4d=function(){return _0x1ff0fd;};return _0x1b4d();}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("../index");
|
|
4
|
+
describe("ProcessorEngine", () => {
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
index_1.flosync.configure({ connectors: {} });
|
|
7
|
+
});
|
|
8
|
+
it("runs a simple workflow with validator and responder", async () => {
|
|
9
|
+
const w = index_1.flosync
|
|
10
|
+
.workflow("test-flow")
|
|
11
|
+
.http("POST", "/test")
|
|
12
|
+
.step("validate", (s) => s.validator({ amount: "{{ trigger.body.amount }}", currency: "{{ trigger.body.currency }}" }))
|
|
13
|
+
.step("respond", (s) => s.responder("json", { statusCode: 200, body: "{{ stepResults.validate }}" }))
|
|
14
|
+
.build();
|
|
15
|
+
index_1.flosync.register(w);
|
|
16
|
+
const result = await index_1.flosync.run("test-flow", {
|
|
17
|
+
body: { amount: 100, currency: "USD" },
|
|
18
|
+
});
|
|
19
|
+
expect(result.statusCode).toBe(200);
|
|
20
|
+
expect(result.body).toBeDefined();
|
|
21
|
+
expect(result.body.valid).toBe(true);
|
|
22
|
+
});
|
|
23
|
+
it("runs workflow with condition then/else", async () => {
|
|
24
|
+
const w = index_1.flosync
|
|
25
|
+
.workflow("cond-flow")
|
|
26
|
+
.http("POST", "/cond")
|
|
27
|
+
.step("check", (s) => s.condition("{{ trigger.body.amount > 0 }}").then("ok").else("fail"))
|
|
28
|
+
.step("ok", (s) => s.responder("json", { statusCode: 200, body: { status: "ok" } }))
|
|
29
|
+
.step("fail", (s) => s.responder("json", { statusCode: 400, body: { status: "fail" } }))
|
|
30
|
+
.build();
|
|
31
|
+
index_1.flosync.register(w);
|
|
32
|
+
const okResult = await index_1.flosync.run("cond-flow", { body: { amount: 10 } });
|
|
33
|
+
expect(okResult.statusCode).toBe(200);
|
|
34
|
+
expect(okResult.body).toEqual({ status: "ok" });
|
|
35
|
+
const failResult = await index_1.flosync.run("cond-flow", { body: { amount: 0 } });
|
|
36
|
+
expect(failResult.statusCode).toBe(400);
|
|
37
|
+
expect(failResult.body).toEqual({ status: "fail" });
|
|
38
|
+
});
|
|
39
|
+
it("runs workflow with transform step", async () => {
|
|
40
|
+
const w = index_1.flosync
|
|
41
|
+
.workflow("transform-flow")
|
|
42
|
+
.http("POST", "/transform")
|
|
43
|
+
.step("transform", (s) => s.transform({
|
|
44
|
+
doubled: "{{ trigger.body.value * 2 }}",
|
|
45
|
+
upper: "{{ uppercase(trigger.body.name) }}",
|
|
46
|
+
}))
|
|
47
|
+
.step("respond", (s) => s.responder("json", { body: "{{ stepResults.transform }}" }))
|
|
48
|
+
.build();
|
|
49
|
+
index_1.flosync.register(w);
|
|
50
|
+
const result = await index_1.flosync.run("transform-flow", {
|
|
51
|
+
body: { value: 5, name: "hello" },
|
|
52
|
+
});
|
|
53
|
+
expect(result.statusCode).toBe(200);
|
|
54
|
+
expect(result.body).toBeDefined();
|
|
55
|
+
expect(result.body.doubled).toBe(10);
|
|
56
|
+
expect(result.body.upper).toBe("HELLO");
|
|
57
|
+
});
|
|
58
|
+
it("validator fails and triggers else branch", async () => {
|
|
59
|
+
const w = index_1.flosync
|
|
60
|
+
.workflow("validator-else")
|
|
61
|
+
.http("POST", "/v")
|
|
62
|
+
.step("validate", (s) => s.validator({ amount: "{{ trigger.body.amount }}" })
|
|
63
|
+
.then("save")
|
|
64
|
+
.else("error"))
|
|
65
|
+
.step("save", (s) => s.responder("json", { statusCode: 200, body: { saved: true } }))
|
|
66
|
+
.step("error", (s) => s.responder("json", { statusCode: 400, body: { error: "Validation failed" } }))
|
|
67
|
+
.build();
|
|
68
|
+
index_1.flosync.register(w);
|
|
69
|
+
const result = await index_1.flosync.run("validator-else", { body: {} });
|
|
70
|
+
expect(result.statusCode).toBe(400);
|
|
71
|
+
expect(result.body.error).toBe("Validation failed");
|
|
72
|
+
});
|
|
73
|
+
it("accepts plain object as trigger body (no body key)", async () => {
|
|
74
|
+
const w = index_1.flosync
|
|
75
|
+
.workflow("plain-body")
|
|
76
|
+
.http("POST", "/plain")
|
|
77
|
+
.step("respond", (s) => s.responder("json", { body: { received: "{{ trigger.body.amount }}" } }))
|
|
78
|
+
.build();
|
|
79
|
+
index_1.flosync.register(w);
|
|
80
|
+
const result = await index_1.flosync.run("plain-body", { amount: 42 });
|
|
81
|
+
expect(result.statusCode).toBe(200);
|
|
82
|
+
expect(Number(result.body.received)).toBe(42);
|
|
83
|
+
});
|
|
84
|
+
it("passes headers, pathParams, params, query, vars to template context", async () => {
|
|
85
|
+
const w = index_1.flosync
|
|
86
|
+
.workflow("full-payload")
|
|
87
|
+
.http("POST", "/users/:id")
|
|
88
|
+
.step("respond", (s) => s.responder("json", {
|
|
89
|
+
body: {
|
|
90
|
+
bodyAmount: "{{ trigger.body.amount }}",
|
|
91
|
+
headerX: "{{ headers['x-request-id'] }}",
|
|
92
|
+
pathId: "{{ pathParams.id }}",
|
|
93
|
+
queryPage: "{{ query.page }}",
|
|
94
|
+
varOverride: "{{ vars.override }}",
|
|
95
|
+
},
|
|
96
|
+
}))
|
|
97
|
+
.build();
|
|
98
|
+
index_1.flosync.register(w);
|
|
99
|
+
const result = await index_1.flosync.run("full-payload", {
|
|
100
|
+
body: { amount: 10 },
|
|
101
|
+
headers: { "x-request-id": "req-123" },
|
|
102
|
+
pathParams: { id: "user-456" },
|
|
103
|
+
query: { page: 2 },
|
|
104
|
+
vars: { override: "from-payload" },
|
|
105
|
+
});
|
|
106
|
+
expect(result.statusCode).toBe(200);
|
|
107
|
+
expect(Number(result.body.bodyAmount)).toBe(10);
|
|
108
|
+
expect(result.body.headerX).toBe("req-123");
|
|
109
|
+
expect(result.body.pathId).toBe("user-456");
|
|
110
|
+
expect(Number(result.body.queryPage)).toBe(2);
|
|
111
|
+
expect(result.body.varOverride).toBe("from-payload");
|
|
112
|
+
});
|
|
113
|
+
it("supports {{ body.x }} and {{ trigger.x }} for body fields", async () => {
|
|
114
|
+
const w = index_1.flosync
|
|
115
|
+
.workflow("body-trigger-access")
|
|
116
|
+
.http("POST", "/test")
|
|
117
|
+
.step("respond", (s) => s.responder("json", {
|
|
118
|
+
body: {
|
|
119
|
+
viaBody: "{{ body.account }}",
|
|
120
|
+
viaTrigger: "{{ trigger.email }}",
|
|
121
|
+
},
|
|
122
|
+
}))
|
|
123
|
+
.build();
|
|
124
|
+
index_1.flosync.register(w);
|
|
125
|
+
const result = await index_1.flosync.run("body-trigger-access", {
|
|
126
|
+
body: { account: "acct-1", email: "user@example.com" },
|
|
127
|
+
});
|
|
128
|
+
expect(result.statusCode).toBe(200);
|
|
129
|
+
expect(result.body.viaBody).toBe("acct-1");
|
|
130
|
+
expect(result.body.viaTrigger).toBe("user@example.com");
|
|
131
|
+
});
|
|
132
|
+
it("runs workflow without http trigger (manual)", async () => {
|
|
133
|
+
const w = index_1.flosync
|
|
134
|
+
.workflow("manual-flow")
|
|
135
|
+
.step("respond", (s) => s.responder("json", { body: { received: "{{ body.amount }}" } }))
|
|
136
|
+
.build();
|
|
137
|
+
index_1.flosync.register(w);
|
|
138
|
+
const result = await index_1.flosync.run("manual-flow", { body: { amount: 99 } });
|
|
139
|
+
expect(result.statusCode).toBe(200);
|
|
140
|
+
expect(Number(result.body.received)).toBe(99);
|
|
141
|
+
});
|
|
142
|
+
it("builds workflow with job trigger", async () => {
|
|
143
|
+
const w = index_1.flosync
|
|
144
|
+
.workflow("job-flow")
|
|
145
|
+
.job("0 * * * *", "UTC")
|
|
146
|
+
.step("respond", (s) => s.responder("json", { body: { ok: true } }))
|
|
147
|
+
.build();
|
|
148
|
+
expect(w.trigger.type).toBe("job");
|
|
149
|
+
expect(w.trigger.cron).toBe("0 * * * *");
|
|
150
|
+
expect(w.trigger.timezone).toBe("UTC");
|
|
151
|
+
index_1.flosync.register(w);
|
|
152
|
+
const result = await index_1.flosync.run("job-flow", {});
|
|
153
|
+
expect(result.statusCode).toBe(200);
|
|
154
|
+
expect(result.body.ok).toBe(true);
|
|
155
|
+
});
|
|
156
|
+
});
|