@etohq/workflow-engine-inmemory 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/loaders/index.d.ts +2 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +9 -0
- package/dist/loaders/index.js.map +1 -0
- package/dist/loaders/utils.d.ts +5 -0
- package/dist/loaders/utils.d.ts.map +1 -0
- package/dist/loaders/utils.js +10 -0
- package/dist/loaders/utils.js.map +1 -0
- package/dist/migrations/Migration20231228143900.d.ts +6 -0
- package/dist/migrations/Migration20231228143900.d.ts.map +1 -0
- package/dist/migrations/Migration20231228143900.js +40 -0
- package/dist/migrations/Migration20231228143900.js.map +1 -0
- package/dist/migrations/Migration20241206101446.d.ts +5 -0
- package/dist/migrations/Migration20241206101446.d.ts.map +1 -0
- package/dist/migrations/Migration20241206101446.js +19 -0
- package/dist/migrations/Migration20241206101446.js.map +1 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +6 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/workflow-execution.d.ts +10 -0
- package/dist/models/workflow-execution.d.ts.map +1 -0
- package/dist/models/workflow-execution.js +33 -0
- package/dist/models/workflow-execution.js.map +1 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +26 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +19 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/workflow-orchestrator.d.ts +69 -0
- package/dist/services/workflow-orchestrator.d.ts.map +1 -0
- package/dist/services/workflow-orchestrator.js +423 -0
- package/dist/services/workflow-orchestrator.js.map +1 -0
- package/dist/services/workflows-module.d.ts +48 -0
- package/dist/services/workflows-module.d.ts.map +1 -0
- package/dist/services/workflows-module.js +100 -0
- package/dist/services/workflows-module.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/workflow-orchestrator-storage.d.ts +34 -0
- package/dist/utils/workflow-orchestrator-storage.d.ts.map +1 -0
- package/dist/utils/workflow-orchestrator-storage.js +227 -0
- package/dist/utils/workflow-orchestrator-storage.js.map +1 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Workflow Orchestrator
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;;;;AAGlD,wBAGE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
4
|
+
const _services_1 = require("./services");
|
|
5
|
+
const loaders_1 = require("./loaders");
|
|
6
|
+
exports.default = (0, utils_1.Module)(utils_1.Modules.WORKFLOW_ENGINE, {
|
|
7
|
+
service: _services_1.WorkflowsModuleService,
|
|
8
|
+
loaders: [loaders_1.loadUtils],
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,kDAAwD;AACxD,yCAAkD;AAClD,uCAAqC;AAErC,kBAAe,IAAA,cAAM,EAAC,eAAO,CAAC,eAAe,EAAE;IAC7C,OAAO,EAAE,kCAAsB;IAC/B,OAAO,EAAE,CAAC,mBAAS,CAAC;CACrB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadUtils = void 0;
|
|
7
|
+
var utils_1 = require("./utils");
|
|
8
|
+
Object.defineProperty(exports, "loadUtils", { enumerable: true, get: function () { return __importDefault(utils_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA8C;AAArC,mHAAA,OAAO,OAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":";;MAGsC,OAAO,CAAC,IAAI,CAAC;AAAnD,wBAMC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const awilix_1 = require("awilix");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
exports.default = async ({ container }) => {
|
|
6
|
+
container.register({
|
|
7
|
+
inMemoryDistributedTransactionStorage: (0, awilix_1.asClass)(utils_1.InMemoryDistributedTransactionStorage).singleton(),
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":";;AAAA,mCAAgC;AAChC,oCAAgE;AAEhE,kBAAe,KAAK,EAAE,EAAE,SAAS,EAAE,EAAiB,EAAE;IACpD,SAAS,CAAC,QAAQ,CAAC;QACjB,qCAAqC,EAAE,IAAA,gBAAO,EAC5C,6CAAqC,CACtC,CAAC,SAAS,EAAE;KACd,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Migration20231228143900.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20231228143900.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAY5B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20231221104256 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20231221104256 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql(`
|
|
8
|
+
CREATE TABLE IF NOT EXISTS workflow_execution
|
|
9
|
+
(
|
|
10
|
+
id character varying NOT NULL,
|
|
11
|
+
workflow_id character varying NOT NULL,
|
|
12
|
+
transaction_id character varying NOT NULL,
|
|
13
|
+
execution jsonb NULL,
|
|
14
|
+
context jsonb NULL,
|
|
15
|
+
state character varying NOT NULL,
|
|
16
|
+
created_at timestamp WITHOUT time zone NOT NULL DEFAULT Now(),
|
|
17
|
+
updated_at timestamp WITHOUT time zone NOT NULL DEFAULT Now(),
|
|
18
|
+
deleted_at timestamp WITHOUT time zone NULL,
|
|
19
|
+
CONSTRAINT "PK_workflow_execution_workflow_id_transaction_id" PRIMARY KEY ("workflow_id", "transaction_id")
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "IDX_workflow_execution_id" ON "workflow_execution" ("id");
|
|
23
|
+
CREATE INDEX IF NOT EXISTS "IDX_workflow_execution_workflow_id" ON "workflow_execution" ("workflow_id") WHERE deleted_at IS NULL;
|
|
24
|
+
CREATE INDEX IF NOT EXISTS "IDX_workflow_execution_transaction_id" ON "workflow_execution" ("transaction_id") WHERE deleted_at IS NULL;
|
|
25
|
+
CREATE INDEX IF NOT EXISTS "IDX_workflow_execution_state" ON "workflow_execution" ("state") WHERE deleted_at IS NULL;
|
|
26
|
+
`);
|
|
27
|
+
}
|
|
28
|
+
async down() {
|
|
29
|
+
this.addSql(`
|
|
30
|
+
DROP INDEX "IDX_workflow_execution_id";
|
|
31
|
+
DROP INDEX "IDX_workflow_execution_workflow_id";
|
|
32
|
+
DROP INDEX "IDX_workflow_execution_transaction_id";
|
|
33
|
+
DROP INDEX "IDX_workflow_execution_state";
|
|
34
|
+
|
|
35
|
+
DROP TABLE IF EXISTS workflow_execution;
|
|
36
|
+
`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Migration20231221104256 = Migration20231221104256;
|
|
40
|
+
//# sourceMappingURL=Migration20231228143900.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Migration20231228143900.js","sourceRoot":"","sources":["../../src/migrations/Migration20231228143900.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT;;;;;;;;;;;;;;;;;;;OAmBC,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,CACT;;;;;;;OAOC,CACF,CAAA;IACH,CAAC;CACF;AAtCD,0DAsCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Migration20241206101446.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20241206101446.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAuB1B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20241206101446 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20241206101446 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql(`DROP INDEX IF EXISTS "IDX_workflow_execution_id";
|
|
8
|
+
DROP INDEX IF EXISTS "IDX_workflow_execution_workflow_id";
|
|
9
|
+
DROP INDEX IF EXISTS "IDX_workflow_execution_transaction_id";
|
|
10
|
+
DROP INDEX IF EXISTS "IDX_workflow_execution_state";`);
|
|
11
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_workflow_execution_deleted_at" ON "workflow_execution" (deleted_at) WHERE deleted_at IS NULL;');
|
|
12
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_workflow_execution_id" ON "workflow_execution" (id) WHERE deleted_at IS NULL;');
|
|
13
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_workflow_execution_workflow_id" ON "workflow_execution" (workflow_id) WHERE deleted_at IS NULL;');
|
|
14
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_workflow_execution_transaction_id" ON "workflow_execution" (transaction_id) WHERE deleted_at IS NULL;');
|
|
15
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_workflow_execution_state" ON "workflow_execution" (state) WHERE deleted_at IS NULL;');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Migration20241206101446 = Migration20241206101446;
|
|
19
|
+
//# sourceMappingURL=Migration20241206101446.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Migration20241206101446.js","sourceRoot":"","sources":["../../src/migrations/Migration20241206101446.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT;;;2DAGqD,CACtD,CAAA;QACD,IAAI,CAAC,MAAM,CACT,+HAA+H,CAChI,CAAA;QACD,IAAI,CAAC,MAAM,CACT,+GAA+G,CAChH,CAAA;QACD,IAAI,CAAC,MAAM,CACT,iIAAiI,CAClI,CAAA;QACD,IAAI,CAAC,MAAM,CACT,uIAAuI,CACxI,CAAA;QACD,IAAI,CAAC,MAAM,CACT,qHAAqH,CACtH,CAAA;IACH,CAAC;CACF;AAxBD,0DAwBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowExecution = void 0;
|
|
4
|
+
var workflow_execution_1 = require("./workflow-execution");
|
|
5
|
+
Object.defineProperty(exports, "WorkflowExecution", { enumerable: true, get: function () { return workflow_execution_1.WorkflowExecution; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AAA/C,uHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransactionState } from "@etohq/framework/orchestration";
|
|
2
|
+
export declare const WorkflowExecution: import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<{
|
|
3
|
+
id: import("@etohq/framework/utils").IdProperty;
|
|
4
|
+
workflow_id: import("@etohq/framework/utils").PrimaryKeyModifier<string, import("@etohq/framework/utils").TextProperty>;
|
|
5
|
+
transaction_id: import("@etohq/framework/utils").PrimaryKeyModifier<string, import("@etohq/framework/utils").TextProperty>;
|
|
6
|
+
execution: import("@etohq/framework/utils").NullableModifier<Record<string, unknown>, import("@etohq/framework/utils").JSONProperty>;
|
|
7
|
+
context: import("@etohq/framework/utils").NullableModifier<Record<string, unknown>, import("@etohq/framework/utils").JSONProperty>;
|
|
8
|
+
state: import("@etohq/framework/utils").EnumProperty<typeof TransactionState>;
|
|
9
|
+
}>, "workflow_execution">;
|
|
10
|
+
//# sourceMappingURL=workflow-execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-execution.d.ts","sourceRoot":"","sources":["../../src/models/workflow-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAGjE,eAAO,MAAM,iBAAiB;;;;;;;yBA0B1B,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowExecution = void 0;
|
|
4
|
+
const orchestration_1 = require("@etohq/framework/orchestration");
|
|
5
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
6
|
+
exports.WorkflowExecution = utils_1.model
|
|
7
|
+
.define("workflow_execution", {
|
|
8
|
+
id: utils_1.model.id({ prefix: "wf_exec" }),
|
|
9
|
+
workflow_id: utils_1.model.text().primaryKey(),
|
|
10
|
+
transaction_id: utils_1.model.text().primaryKey(),
|
|
11
|
+
execution: utils_1.model.json().nullable(),
|
|
12
|
+
context: utils_1.model.json().nullable(),
|
|
13
|
+
state: utils_1.model.enum(orchestration_1.TransactionState),
|
|
14
|
+
})
|
|
15
|
+
.indexes([
|
|
16
|
+
{
|
|
17
|
+
on: ["id"],
|
|
18
|
+
where: "deleted_at IS NULL",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
on: ["workflow_id"],
|
|
22
|
+
where: "deleted_at IS NULL",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
on: ["transaction_id"],
|
|
26
|
+
where: "deleted_at IS NULL",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
on: ["state"],
|
|
30
|
+
where: "deleted_at IS NULL",
|
|
31
|
+
},
|
|
32
|
+
]);
|
|
33
|
+
//# sourceMappingURL=workflow-execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-execution.js","sourceRoot":"","sources":["../../src/models/workflow-execution.ts"],"names":[],"mappings":";;;AAAA,kEAAiE;AACjE,kDAA8C;AAEjC,QAAA,iBAAiB,GAAG,aAAK;KACnC,MAAM,CAAC,oBAAoB,EAAE;IAC5B,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACnC,WAAW,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IACtC,cAAc,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IACzC,SAAS,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAChC,KAAK,EAAE,aAAK,CAAC,IAAI,CAAC,gCAAgB,CAAC;CACpC,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,IAAI,CAAC;QACV,KAAK,EAAE,oBAAoB;KAC5B;IACD;QACE,EAAE,EAAE,CAAC,aAAa,CAAC;QACnB,KAAK,EAAE,oBAAoB;KAC5B;IACD;QACE,EAAE,EAAE,CAAC,gBAAgB,CAAC;QACtB,KAAK,EAAE,oBAAoB;KAC5B;IACD;QACE,EAAE,EAAE,CAAC,OAAO,CAAC;QACb,KAAK,EAAE,oBAAoB;KAC5B;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: "\nenum TransactionState {\n NOT_STARTED\n INVOKING\n WAITING_TO_COMPENSATE\n COMPENSATING\n DONE\n REVERTED\n FAILED\n}\n\ntype WorkflowExecution {\n id: ID!\n created_at: DateTime!\n updated_at: DateTime!\n deleted_at: DateTime\n workflow_id: string\n transaction_id: string\n execution: JSON\n context: JSON\n state: TransactionState\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":";AAAA,wBAsBC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = `
|
|
4
|
+
enum TransactionState {
|
|
5
|
+
NOT_STARTED
|
|
6
|
+
INVOKING
|
|
7
|
+
WAITING_TO_COMPENSATE
|
|
8
|
+
COMPENSATING
|
|
9
|
+
DONE
|
|
10
|
+
REVERTED
|
|
11
|
+
FAILED
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type WorkflowExecution {
|
|
15
|
+
id: ID!
|
|
16
|
+
created_at: DateTime!
|
|
17
|
+
updated_at: DateTime!
|
|
18
|
+
deleted_at: DateTime
|
|
19
|
+
workflow_id: string
|
|
20
|
+
transaction_id: string
|
|
21
|
+
execution: JSON
|
|
22
|
+
context: JSON
|
|
23
|
+
state: TransactionState
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":";;AAAA,kBAAe;;;;;;;;;;;;;;;;;;;;;;CAsBd,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./workflow-orchestrator"), exports);
|
|
18
|
+
__exportStar(require("./workflows-module"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AACvC,qDAAkC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DistributedTransactionEvents, DistributedTransactionType, TransactionStep } from "@etohq/framework/orchestration";
|
|
2
|
+
import { ContainerLike, Context, EtoContainer } from "@etohq/framework/types";
|
|
3
|
+
import { type FlowRunOptions, ReturnWorkflow } from "@etohq/framework/workflows-sdk";
|
|
4
|
+
import { InMemoryDistributedTransactionStorage } from "../utils";
|
|
5
|
+
export type WorkflowOrchestratorRunOptions<T> = Omit<FlowRunOptions<T>, "container"> & {
|
|
6
|
+
transactionId?: string;
|
|
7
|
+
container?: ContainerLike;
|
|
8
|
+
};
|
|
9
|
+
type RegisterStepSuccessOptions<T> = Omit<WorkflowOrchestratorRunOptions<T>, "transactionId" | "input">;
|
|
10
|
+
type IdempotencyKeyParts = {
|
|
11
|
+
workflowId: string;
|
|
12
|
+
transactionId: string;
|
|
13
|
+
stepId: string;
|
|
14
|
+
action: "invoke" | "compensate";
|
|
15
|
+
};
|
|
16
|
+
type NotifyOptions = {
|
|
17
|
+
eventType: keyof DistributedTransactionEvents;
|
|
18
|
+
workflowId: string;
|
|
19
|
+
transactionId?: string;
|
|
20
|
+
step?: TransactionStep;
|
|
21
|
+
response?: unknown;
|
|
22
|
+
result?: unknown;
|
|
23
|
+
errors?: unknown[];
|
|
24
|
+
};
|
|
25
|
+
type SubscriberHandler = {
|
|
26
|
+
(input: NotifyOptions): void;
|
|
27
|
+
} & {
|
|
28
|
+
_id?: string;
|
|
29
|
+
};
|
|
30
|
+
type SubscribeOptions = {
|
|
31
|
+
workflowId: string;
|
|
32
|
+
transactionId?: string;
|
|
33
|
+
subscriber: SubscriberHandler;
|
|
34
|
+
subscriberId?: string;
|
|
35
|
+
};
|
|
36
|
+
type UnsubscribeOptions = {
|
|
37
|
+
workflowId: string;
|
|
38
|
+
transactionId?: string;
|
|
39
|
+
subscriberOrId: string | SubscriberHandler;
|
|
40
|
+
};
|
|
41
|
+
export declare class WorkflowOrchestratorService {
|
|
42
|
+
private subscribers;
|
|
43
|
+
private container_;
|
|
44
|
+
constructor({ inMemoryDistributedTransactionStorage, sharedContainer, }: {
|
|
45
|
+
inMemoryDistributedTransactionStorage: InMemoryDistributedTransactionStorage;
|
|
46
|
+
workflowOrchestratorService: WorkflowOrchestratorService;
|
|
47
|
+
sharedContainer: EtoContainer;
|
|
48
|
+
});
|
|
49
|
+
private triggerParentStep;
|
|
50
|
+
run<T = unknown>(workflowIdOrWorkflow: string | ReturnWorkflow<any, any, any>, options?: WorkflowOrchestratorRunOptions<T>, sharedContext?: Context): Promise<any>;
|
|
51
|
+
getRunningTransaction(workflowId: string, transactionId: string, options?: WorkflowOrchestratorRunOptions<undefined>, sharedContext?: Context): Promise<DistributedTransactionType>;
|
|
52
|
+
setStepSuccess<T = unknown>({ idempotencyKey, stepResponse, options, }: {
|
|
53
|
+
idempotencyKey: string | IdempotencyKeyParts;
|
|
54
|
+
stepResponse: unknown;
|
|
55
|
+
options?: RegisterStepSuccessOptions<T>;
|
|
56
|
+
}, sharedContext?: Context): Promise<any>;
|
|
57
|
+
setStepFailure<T = unknown>({ idempotencyKey, stepResponse, options, }: {
|
|
58
|
+
idempotencyKey: string | IdempotencyKeyParts;
|
|
59
|
+
stepResponse: unknown;
|
|
60
|
+
options?: RegisterStepSuccessOptions<T>;
|
|
61
|
+
}, sharedContext?: Context): Promise<any>;
|
|
62
|
+
subscribe({ workflowId, transactionId, subscriber, subscriberId }: SubscribeOptions, sharedContext?: Context): void;
|
|
63
|
+
unsubscribe({ workflowId, transactionId, subscriberOrId }: UnsubscribeOptions, sharedContext?: Context): void;
|
|
64
|
+
private notify;
|
|
65
|
+
private buildWorkflowEvents;
|
|
66
|
+
private buildIdempotencyKeyAndParts;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=workflow-orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-orchestrator.d.ts","sourceRoot":"","sources":["../../src/services/workflow-orchestrator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