@dbos-inc/dbos-sdk 0.7.18-preview

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -0
  3. package/dbos-config.schema.json +121 -0
  4. package/dbos-test-config.yaml +16 -0
  5. package/dist/schemas/system_db_schema.d.ts +34 -0
  6. package/dist/schemas/system_db_schema.d.ts.map +1 -0
  7. package/dist/schemas/system_db_schema.js +75 -0
  8. package/dist/schemas/system_db_schema.js.map +1 -0
  9. package/dist/schemas/user_db_schema.d.ts +11 -0
  10. package/dist/schemas/user_db_schema.d.ts.map +1 -0
  11. package/dist/schemas/user_db_schema.js +16 -0
  12. package/dist/schemas/user_db_schema.js.map +1 -0
  13. package/dist/src/cloud-cli/applications/configure.d.ts +2 -0
  14. package/dist/src/cloud-cli/applications/configure.d.ts.map +1 -0
  15. package/dist/src/cloud-cli/applications/configure.js +57 -0
  16. package/dist/src/cloud-cli/applications/configure.js.map +1 -0
  17. package/dist/src/cloud-cli/applications/delete-app.d.ts +2 -0
  18. package/dist/src/cloud-cli/applications/delete-app.d.ts.map +1 -0
  19. package/dist/src/cloud-cli/applications/delete-app.js +36 -0
  20. package/dist/src/cloud-cli/applications/delete-app.js.map +1 -0
  21. package/dist/src/cloud-cli/applications/deploy-app-code.d.ts +2 -0
  22. package/dist/src/cloud-cli/applications/deploy-app-code.d.ts.map +1 -0
  23. package/dist/src/cloud-cli/applications/deploy-app-code.js +64 -0
  24. package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -0
  25. package/dist/src/cloud-cli/applications/get-app-logs.d.ts +2 -0
  26. package/dist/src/cloud-cli/applications/get-app-logs.d.ts.map +1 -0
  27. package/dist/src/cloud-cli/applications/get-app-logs.js +37 -0
  28. package/dist/src/cloud-cli/applications/get-app-logs.js.map +1 -0
  29. package/dist/src/cloud-cli/applications/index.d.ts +8 -0
  30. package/dist/src/cloud-cli/applications/index.d.ts.map +1 -0
  31. package/dist/src/cloud-cli/applications/index.js +18 -0
  32. package/dist/src/cloud-cli/applications/index.js.map +1 -0
  33. package/dist/src/cloud-cli/applications/list-apps.d.ts +2 -0
  34. package/dist/src/cloud-cli/applications/list-apps.d.ts.map +1 -0
  35. package/dist/src/cloud-cli/applications/list-apps.js +45 -0
  36. package/dist/src/cloud-cli/applications/list-apps.js.map +1 -0
  37. package/dist/src/cloud-cli/applications/register-app.d.ts +2 -0
  38. package/dist/src/cloud-cli/applications/register-app.d.ts.map +1 -0
  39. package/dist/src/cloud-cli/applications/register-app.js +41 -0
  40. package/dist/src/cloud-cli/applications/register-app.js.map +1 -0
  41. package/dist/src/cloud-cli/applications/types.d.ts +7 -0
  42. package/dist/src/cloud-cli/applications/types.d.ts.map +1 -0
  43. package/dist/src/cloud-cli/applications/types.js +3 -0
  44. package/dist/src/cloud-cli/applications/types.js.map +1 -0
  45. package/dist/src/cloud-cli/applications/update-app.d.ts +2 -0
  46. package/dist/src/cloud-cli/applications/update-app.d.ts.map +1 -0
  47. package/dist/src/cloud-cli/applications/update-app.js +42 -0
  48. package/dist/src/cloud-cli/applications/update-app.js.map +1 -0
  49. package/dist/src/cloud-cli/cli.d.ts +3 -0
  50. package/dist/src/cloud-cli/cli.d.ts.map +1 -0
  51. package/dist/src/cloud-cli/cli.js +148 -0
  52. package/dist/src/cloud-cli/cli.js.map +1 -0
  53. package/dist/src/cloud-cli/login.d.ts +7 -0
  54. package/dist/src/cloud-cli/login.d.ts.map +1 -0
  55. package/dist/src/cloud-cli/login.js +40 -0
  56. package/dist/src/cloud-cli/login.js.map +1 -0
  57. package/dist/src/cloud-cli/register.d.ts +2 -0
  58. package/dist/src/cloud-cli/register.d.ts.map +1 -0
  59. package/dist/src/cloud-cli/register.js +35 -0
  60. package/dist/src/cloud-cli/register.js.map +1 -0
  61. package/dist/src/cloud-cli/userdb.d.ts +4 -0
  62. package/dist/src/cloud-cli/userdb.d.ts.map +1 -0
  63. package/dist/src/cloud-cli/userdb.js +149 -0
  64. package/dist/src/cloud-cli/userdb.js.map +1 -0
  65. package/dist/src/cloud-cli/utils.d.ts +3 -0
  66. package/dist/src/cloud-cli/utils.d.ts.map +1 -0
  67. package/dist/src/cloud-cli/utils.js +17 -0
  68. package/dist/src/cloud-cli/utils.js.map +1 -0
  69. package/dist/src/communicator.d.ts +24 -0
  70. package/dist/src/communicator.d.ts.map +1 -0
  71. package/dist/src/communicator.js +26 -0
  72. package/dist/src/communicator.js.map +1 -0
  73. package/dist/src/context.d.ts +60 -0
  74. package/dist/src/context.d.ts.map +1 -0
  75. package/dist/src/context.js +94 -0
  76. package/dist/src/context.js.map +1 -0
  77. package/dist/src/data_validation.d.ts +3 -0
  78. package/dist/src/data_validation.d.ts.map +1 -0
  79. package/dist/src/data_validation.js +168 -0
  80. package/dist/src/data_validation.js.map +1 -0
  81. package/dist/src/dbos-executor.d.ts +79 -0
  82. package/dist/src/dbos-executor.d.ts.map +1 -0
  83. package/dist/src/dbos-executor.js +408 -0
  84. package/dist/src/dbos-executor.js.map +1 -0
  85. package/dist/src/dbos-runtime/TypeParser.d.ts +33 -0
  86. package/dist/src/dbos-runtime/TypeParser.d.ts.map +1 -0
  87. package/dist/src/dbos-runtime/TypeParser.js +104 -0
  88. package/dist/src/dbos-runtime/TypeParser.js.map +1 -0
  89. package/dist/src/dbos-runtime/applicationVersion.d.ts +3 -0
  90. package/dist/src/dbos-runtime/applicationVersion.d.ts.map +1 -0
  91. package/dist/src/dbos-runtime/applicationVersion.js +13 -0
  92. package/dist/src/dbos-runtime/applicationVersion.js.map +1 -0
  93. package/dist/src/dbos-runtime/cli.d.ts +8 -0
  94. package/dist/src/dbos-runtime/cli.d.ts.map +1 -0
  95. package/dist/src/dbos-runtime/cli.js +52 -0
  96. package/dist/src/dbos-runtime/cli.js.map +1 -0
  97. package/dist/src/dbos-runtime/config.d.ts +28 -0
  98. package/dist/src/dbos-runtime/config.d.ts.map +1 -0
  99. package/dist/src/dbos-runtime/config.js +111 -0
  100. package/dist/src/dbos-runtime/config.js.map +1 -0
  101. package/dist/src/dbos-runtime/init.d.ts +7 -0
  102. package/dist/src/dbos-runtime/init.d.ts.map +1 -0
  103. package/dist/src/dbos-runtime/init.js +51 -0
  104. package/dist/src/dbos-runtime/init.js.map +1 -0
  105. package/dist/src/dbos-runtime/openApi.d.ts +35 -0
  106. package/dist/src/dbos-runtime/openApi.d.ts.map +1 -0
  107. package/dist/src/dbos-runtime/openApi.js +595 -0
  108. package/dist/src/dbos-runtime/openApi.js.map +1 -0
  109. package/dist/src/dbos-runtime/runtime.d.ts +28 -0
  110. package/dist/src/dbos-runtime/runtime.d.ts.map +1 -0
  111. package/dist/src/dbos-runtime/runtime.js +96 -0
  112. package/dist/src/dbos-runtime/runtime.js.map +1 -0
  113. package/dist/src/dbos-runtime/tsDiagUtil.d.ts +16 -0
  114. package/dist/src/dbos-runtime/tsDiagUtil.d.ts.map +1 -0
  115. package/dist/src/dbos-runtime/tsDiagUtil.js +72 -0
  116. package/dist/src/dbos-runtime/tsDiagUtil.js.map +1 -0
  117. package/dist/src/decorators.d.ts +118 -0
  118. package/dist/src/decorators.d.ts.map +1 -0
  119. package/dist/src/decorators.js +467 -0
  120. package/dist/src/decorators.js.map +1 -0
  121. package/dist/src/error.d.ts +44 -0
  122. package/dist/src/error.d.ts.map +1 -0
  123. package/dist/src/error.js +164 -0
  124. package/dist/src/error.js.map +1 -0
  125. package/dist/src/httpServer/handler.d.ts +62 -0
  126. package/dist/src/httpServer/handler.d.ts.map +1 -0
  127. package/dist/src/httpServer/handler.js +168 -0
  128. package/dist/src/httpServer/handler.js.map +1 -0
  129. package/dist/src/httpServer/middleware.d.ts +56 -0
  130. package/dist/src/httpServer/middleware.d.ts.map +1 -0
  131. package/dist/src/httpServer/middleware.js +57 -0
  132. package/dist/src/httpServer/middleware.js.map +1 -0
  133. package/dist/src/httpServer/server.d.ts +40 -0
  134. package/dist/src/httpServer/server.d.ts.map +1 -0
  135. package/dist/src/httpServer/server.js +231 -0
  136. package/dist/src/httpServer/server.js.map +1 -0
  137. package/dist/src/index.d.ts +12 -0
  138. package/dist/src/index.d.ts.map +1 -0
  139. package/dist/src/index.js +75 -0
  140. package/dist/src/index.js.map +1 -0
  141. package/dist/src/provenance/provenance_daemon.d.ts +34 -0
  142. package/dist/src/provenance/provenance_daemon.d.ts.map +1 -0
  143. package/dist/src/provenance/provenance_daemon.js +86 -0
  144. package/dist/src/provenance/provenance_daemon.js.map +1 -0
  145. package/dist/src/system_database.d.ts +69 -0
  146. package/dist/src/system_database.d.ts.map +1 -0
  147. package/dist/src/system_database.js +384 -0
  148. package/dist/src/system_database.js.map +1 -0
  149. package/dist/src/telemetry/collector.d.ts +17 -0
  150. package/dist/src/telemetry/collector.d.ts.map +1 -0
  151. package/dist/src/telemetry/collector.js +77 -0
  152. package/dist/src/telemetry/collector.js.map +1 -0
  153. package/dist/src/telemetry/exporters.d.ts +29 -0
  154. package/dist/src/telemetry/exporters.d.ts.map +1 -0
  155. package/dist/src/telemetry/exporters.js +186 -0
  156. package/dist/src/telemetry/exporters.js.map +1 -0
  157. package/dist/src/telemetry/index.d.ts +7 -0
  158. package/dist/src/telemetry/index.d.ts.map +1 -0
  159. package/dist/src/telemetry/index.js +3 -0
  160. package/dist/src/telemetry/index.js.map +1 -0
  161. package/dist/src/telemetry/logs.d.ts +25 -0
  162. package/dist/src/telemetry/logs.d.ts.map +1 -0
  163. package/dist/src/telemetry/logs.js +91 -0
  164. package/dist/src/telemetry/logs.js.map +1 -0
  165. package/dist/src/telemetry/signals.d.ts +30 -0
  166. package/dist/src/telemetry/signals.d.ts.map +1 -0
  167. package/dist/src/telemetry/signals.js +11 -0
  168. package/dist/src/telemetry/signals.js.map +1 -0
  169. package/dist/src/telemetry/traces.d.ts +17 -0
  170. package/dist/src/telemetry/traces.d.ts.map +1 -0
  171. package/dist/src/telemetry/traces.js +76 -0
  172. package/dist/src/telemetry/traces.js.map +1 -0
  173. package/dist/src/testing/testing_runtime.d.ts +76 -0
  174. package/dist/src/testing/testing_runtime.d.ts.map +1 -0
  175. package/dist/src/testing/testing_runtime.js +147 -0
  176. package/dist/src/testing/testing_runtime.js.map +1 -0
  177. package/dist/src/transaction.d.ts +28 -0
  178. package/dist/src/transaction.d.ts.map +1 -0
  179. package/dist/src/transaction.js +27 -0
  180. package/dist/src/transaction.js.map +1 -0
  181. package/dist/src/user_database.d.ts +132 -0
  182. package/dist/src/user_database.d.ts.map +1 -0
  183. package/dist/src/user_database.js +324 -0
  184. package/dist/src/user_database.js.map +1 -0
  185. package/dist/src/utils.d.ts +6 -0
  186. package/dist/src/utils.d.ts.map +1 -0
  187. package/dist/src/utils.js +35 -0
  188. package/dist/src/utils.js.map +1 -0
  189. package/dist/src/workflow.d.ts +179 -0
  190. package/dist/src/workflow.d.ts.map +1 -0
  191. package/dist/src/workflow.js +446 -0
  192. package/dist/src/workflow.js.map +1 -0
  193. package/examples/hello/README.md +41 -0
  194. package/examples/hello/dbos-config.yaml +15 -0
  195. package/examples/hello/jest.config.js +8 -0
  196. package/examples/hello/knexfile.ts +23 -0
  197. package/examples/hello/migrations/create_dbos_hello_tables.ts +12 -0
  198. package/examples/hello/package.json +21 -0
  199. package/examples/hello/src/operations.test.ts +38 -0
  200. package/examples/hello/src/operations.ts +21 -0
  201. package/examples/hello/start_postgres_docker.sh +23 -0
  202. package/examples/hello/tsconfig.json +24 -0
  203. package/package.json +78 -0
@@ -0,0 +1,231 @@
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.DBOSHttpServer = exports.WorkflowRecoveryUrl = exports.WorkflowUUIDHeader = void 0;
7
+ const koa_1 = __importDefault(require("koa"));
8
+ const router_1 = __importDefault(require("@koa/router"));
9
+ const bodyparser_1 = require("@koa/bodyparser");
10
+ const cors_1 = __importDefault(require("@koa/cors"));
11
+ const handler_1 = require("./handler");
12
+ const error_1 = require("../error");
13
+ const api_1 = require("@opentelemetry/api");
14
+ exports.WorkflowUUIDHeader = "dbos-workflowuuid";
15
+ exports.WorkflowRecoveryUrl = "/dbos-workflow-recovery";
16
+ class DBOSHttpServer {
17
+ dbosExec;
18
+ app;
19
+ router;
20
+ logger;
21
+ /**
22
+ * Create a Koa app.
23
+ * @param dbosExec User pass in an DBOS workflow executor instance.
24
+ * TODO: maybe call wfe.init() somewhere in this class?
25
+ */
26
+ constructor(dbosExec, config = {}) {
27
+ this.dbosExec = dbosExec;
28
+ if (!config.router) {
29
+ config.router = new router_1.default();
30
+ }
31
+ this.router = config.router;
32
+ this.logger = dbosExec.logger;
33
+ if (!config.koa) {
34
+ config.koa = new koa_1.default();
35
+ // Note: we definitely need bodyParser.
36
+ // For cors(), it doesn't work if we use it in a router, and thus we have to use it in app.
37
+ config.koa.use((0, bodyparser_1.bodyParser)());
38
+ config.koa.use((0, cors_1.default)());
39
+ }
40
+ this.app = config.koa;
41
+ // Register HTTP endpoints.
42
+ DBOSHttpServer.registerRecoveryEndpoint(this.dbosExec, this.router);
43
+ DBOSHttpServer.registerDecoratedEndpoints(this.dbosExec, this.router);
44
+ this.app.use(this.router.routes()).use(this.router.allowedMethods());
45
+ }
46
+ /**
47
+ * Register HTTP endpoints and attach to the app. Then start the server at the given port.
48
+ * @param port
49
+ */
50
+ listen(port) {
51
+ // Start the HTTP server.
52
+ return this.app.listen(port, () => {
53
+ this.logger.info(`DBOS Server is running at http://localhost:${port}`);
54
+ });
55
+ }
56
+ /**
57
+ * Register workflow recovery endpoint.
58
+ * Receives a list of executor IDs and returns a list of workflowUUIDs.
59
+ */
60
+ static registerRecoveryEndpoint(wfe, router) {
61
+ // Handler function that parses request for recovery.
62
+ const recoveryHandler = async (koaCtxt, koaNext) => {
63
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
64
+ const executorIDs = koaCtxt.request.body;
65
+ wfe.logger.info("Recovering workflows for executors: " + executorIDs.toString());
66
+ const recoverHandles = await wfe.recoverPendingWorkflows(executorIDs);
67
+ // Return a list of workflowUUIDs being recovered.
68
+ koaCtxt.body = await Promise.allSettled(recoverHandles.map((i) => i.getWorkflowUUID())).then((results) => results.filter((i) => i.status === "fulfilled").map((i) => i.value));
69
+ await koaNext();
70
+ };
71
+ router.post(exports.WorkflowRecoveryUrl, recoveryHandler);
72
+ wfe.logger.debug(`DBOS Server Registered Recovery POST ${exports.WorkflowRecoveryUrl}`);
73
+ }
74
+ /**
75
+ * Register decorated functions as HTTP endpoints.
76
+ */
77
+ static registerDecoratedEndpoints(wfe, router) {
78
+ // Register user declared endpoints, wrap around the endpoint with request parsing and response.
79
+ wfe.registeredOperations.forEach((registeredOperation) => {
80
+ const ro = registeredOperation;
81
+ if (ro.apiURL) {
82
+ // Ignore URL with "/dbos-workflow-recovery" prefix.
83
+ if (ro.apiURL.startsWith(exports.WorkflowRecoveryUrl)) {
84
+ wfe.logger.error(`Invalid URL: ${ro.apiURL} -- should not start with ${exports.WorkflowRecoveryUrl}!`);
85
+ return;
86
+ }
87
+ // Check if we need to apply any Koa middleware.
88
+ const defaults = ro.defaults;
89
+ if (defaults?.koaMiddlewares) {
90
+ defaults.koaMiddlewares.forEach((koaMiddleware) => {
91
+ wfe.logger.debug(`DBOS Server applying middleware ${koaMiddleware.name} to ${ro.apiURL}`);
92
+ router.use(ro.apiURL, koaMiddleware);
93
+ });
94
+ }
95
+ // Wrapper function that parses request and send response.
96
+ const wrappedHandler = async (koaCtxt, koaNext) => {
97
+ const oc = new handler_1.HandlerContextImpl(wfe, koaCtxt);
98
+ try {
99
+ // Check for auth first
100
+ if (defaults?.authMiddleware) {
101
+ const res = await defaults.authMiddleware({
102
+ name: ro.name,
103
+ requiredRole: ro.getRequiredRoles(),
104
+ koaContext: koaCtxt,
105
+ logger: oc.logger,
106
+ span: oc.span,
107
+ getConfig: (key, def) => {
108
+ return oc.getConfig(key, def);
109
+ },
110
+ query: (query, ...args) => {
111
+ return wfe.userDatabase.queryFunction(query, ...args);
112
+ },
113
+ });
114
+ if (res) {
115
+ oc.authenticatedUser = res.authenticatedUser;
116
+ oc.authenticatedRoles = res.authenticatedRoles;
117
+ }
118
+ }
119
+ // Parse the arguments.
120
+ const args = [];
121
+ ro.args.forEach((marg, idx) => {
122
+ marg.argSource = marg.argSource ?? handler_1.ArgSources.DEFAULT; // Assign a default value.
123
+ if (idx === 0) {
124
+ return; // Do not parse the context.
125
+ }
126
+ let foundArg = undefined;
127
+ if ((ro.apiType === handler_1.APITypes.GET && marg.argSource === handler_1.ArgSources.DEFAULT) || marg.argSource === handler_1.ArgSources.QUERY) {
128
+ foundArg = koaCtxt.request.query[marg.name];
129
+ if (foundArg) {
130
+ args.push(foundArg);
131
+ }
132
+ }
133
+ else if ((ro.apiType === handler_1.APITypes.POST && marg.argSource === handler_1.ArgSources.DEFAULT) || marg.argSource === handler_1.ArgSources.BODY) {
134
+ if (!koaCtxt.request.body) {
135
+ throw new error_1.DBOSDataValidationError(`Argument ${marg.name} requires a method body.`);
136
+ }
137
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
138
+ foundArg = koaCtxt.request.body[marg.name];
139
+ if (foundArg) {
140
+ args.push(foundArg);
141
+ }
142
+ }
143
+ // Try to parse the argument from the URL if nothing found.
144
+ if (!foundArg) {
145
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
146
+ args.push(koaCtxt.params[marg.name]);
147
+ }
148
+ //console.log(`found arg ${marg.name} ${idx} ${args[idx-1]}`);
149
+ });
150
+ // Extract workflow UUID from headers (if any).
151
+ // We pass in the specified workflow UUID to workflows and transactions, but doesn't restrict how handlers use it.
152
+ const headerWorkflowUUID = koaCtxt.get(exports.WorkflowUUIDHeader);
153
+ // Finally, invoke the transaction/workflow/plain function and properly set HTTP response.
154
+ // If functions return successfully and hasn't set the body, we set the body to the function return value. The status code will be automatically set to 200 or 204 (if the body is null/undefined).
155
+ // In case of an exception:
156
+ // - If a client-side error is thrown, we return 400.
157
+ // - If an error contains a `status` field, we return the specified status code.
158
+ // - Otherwise, we return 500.
159
+ const wfParams = { parentCtx: oc, workflowUUID: headerWorkflowUUID };
160
+ if (ro.txnConfig) {
161
+ koaCtxt.body = await wfe.transaction(ro.registeredFunction, wfParams, ...args);
162
+ }
163
+ else if (ro.workflowConfig) {
164
+ koaCtxt.body = await (await wfe.workflow(ro.registeredFunction, wfParams, ...args)).getResult();
165
+ }
166
+ else if (ro.commConfig) {
167
+ koaCtxt.body = await wfe.external(ro.registeredFunction, wfParams, ...args);
168
+ }
169
+ else {
170
+ // Directly invoke the handler code.
171
+ const retValue = await ro.invoke(undefined, [oc, ...args]);
172
+ // Set the body to the return value unless the body is already set by the handler.
173
+ if (koaCtxt.body === undefined) {
174
+ koaCtxt.body = retValue;
175
+ }
176
+ }
177
+ oc.span.setStatus({ code: api_1.SpanStatusCode.OK });
178
+ }
179
+ catch (e) {
180
+ if (e instanceof Error) {
181
+ oc.logger.error(e.message);
182
+ oc.span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: e.message });
183
+ let st = e?.status || 500;
184
+ const dbosErrorCode = e?.dbosErrorCode;
185
+ if (dbosErrorCode && (0, error_1.isClientError)(dbosErrorCode)) {
186
+ st = 400; // Set to 400: client-side error.
187
+ }
188
+ koaCtxt.status = st;
189
+ koaCtxt.message = e.message;
190
+ koaCtxt.body = {
191
+ status: st,
192
+ message: e.message,
193
+ details: e,
194
+ };
195
+ }
196
+ else {
197
+ // FIXME we should have a standard, user friendly message for errors that are not instances of Error.
198
+ // using stringify() will not produce a pretty output, because our format function uses stringify() too.
199
+ oc.logger.error(JSON.stringify(e));
200
+ oc.span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: JSON.stringify(e) });
201
+ koaCtxt.body = e;
202
+ koaCtxt.status = 500;
203
+ }
204
+ }
205
+ finally {
206
+ oc.W3CTraceContextPropagator.inject(api_1.trace.setSpanContext(api_1.ROOT_CONTEXT, oc.span.spanContext()), {
207
+ context: koaCtxt,
208
+ }, {
209
+ set: (carrier, key, value) => {
210
+ carrier.context.set(key, value);
211
+ },
212
+ });
213
+ wfe.tracer.endSpan(oc.span);
214
+ await koaNext();
215
+ }
216
+ };
217
+ // Actually register the endpoint.
218
+ if (ro.apiType === handler_1.APITypes.GET) {
219
+ router.get(ro.apiURL, wrappedHandler);
220
+ wfe.logger.debug(`DBOS Server Registered GET ${ro.apiURL}`);
221
+ }
222
+ else if (ro.apiType === handler_1.APITypes.POST) {
223
+ router.post(ro.apiURL, wrappedHandler);
224
+ wfe.logger.debug(`DBOS Server Registered POST ${ro.apiURL}`);
225
+ }
226
+ }
227
+ });
228
+ }
229
+ }
230
+ exports.DBOSHttpServer = DBOSHttpServer;
231
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/httpServer/server.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAsB;AACtB,yDAAiC;AACjC,gDAA6C;AAC7C,qDAA6B;AAC7B,uCAKmB;AAGnB,oCAKkB;AAIlB,4CAAyE;AAG5D,QAAA,kBAAkB,GAAG,mBAAmB,CAAC;AACzC,QAAA,mBAAmB,GAAG,yBAAyB,CAAA;AAE5D,MAAa,cAAc;IAUJ;IATZ,GAAG,CAAM;IACT,MAAM,CAAS;IACf,MAAM,CAAS;IAExB;;;;OAIG;IACH,YAAqB,QAAsB,EAAE,SAAyC,EAAE;QAAnE,aAAQ,GAAR,QAAQ,CAAc;QACzC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,MAAM,CAAC,MAAM,GAAG,IAAI,gBAAM,EAAE,CAAC;SAC9B;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAE9B,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,MAAM,CAAC,GAAG,GAAG,IAAI,aAAG,EAAE,CAAC;YAEvB,uCAAuC;YACvC,2FAA2F;YAC3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EACzD;4BACE,OAAO,EAAE,OAAO;yBACjB,EACD;4BACE,GAAG,EAAE,CAAC,OAAgB,EAAE,GAAW,EAAE,KAAa,EAAE,EAAE;gCACpD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;4BAClC,CAAC;yBACF,CACF,CAAC;wBACF,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;wBAC5B,MAAM,OAAO,EAAE,CAAC;qBACjB;gBACH,CAAC,CAAC;gBAEF,kCAAkC;gBAClC,IAAI,EAAE,CAAC,OAAO,KAAK,kBAAQ,CAAC,GAAG,EAAE;oBAC/B,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;oBACtC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;iBAC7D;qBAAM,IAAI,EAAE,CAAC,OAAO,KAAK,kBAAQ,CAAC,IAAI,EAAE;oBACvC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;oBACvC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;iBAC9D;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA5OD,wCA4OC"}
@@ -0,0 +1,12 @@
1
+ export { createTestingRuntime, TestingRuntime, } from './testing/testing_runtime';
2
+ export { DBOSContext, InitContext, } from './context';
3
+ export { TransactionContext, TransactionConfig, } from './transaction';
4
+ export { WorkflowContext, WorkflowConfig, WorkflowHandle, StatusString, } from './workflow';
5
+ export { CommunicatorContext, CommunicatorConfig, } from './communicator';
6
+ export * as Error from './error';
7
+ export { DBOSResponseError } from './error';
8
+ export { LogMasks, Debug, ArgRequired, ArgOptional, SkipLogging, LogMask, ArgName, ArgDate, ArgVarchar, DefaultRequiredRole, DefaultArgRequired, DefaultArgOptional, OrmEntities, Transaction, Workflow, Communicator, RequiredRole, DBOSInitializer, DBOSDeploy, } from "./decorators";
9
+ export { ArgSources, HandlerContext, ArgSource, GetApi, PostApi, } from "./httpServer/handler";
10
+ export { DBOSHttpServer, } from "./httpServer/server";
11
+ export { DBOSHttpAuthMiddleware, DBOSHttpAuthReturn, MiddlewareContext, Authentication, KoaMiddleware, OpenApiSecurityScheme } from "./httpServer/middleware";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,cAAc,GACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,WAAW,EACX,WAAW,GACZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EACL,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,QAAQ,EACR,KAAK,EAGL,WAAW,EACX,WAAW,EACX,WAAW,EACX,OAAO,EACP,OAAO,EACP,OAAO,EACP,UAAU,EAGV,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAElB,WAAW,EAGX,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,UAAU,EACV,cAAc,EAGd,SAAS,EAGT,MAAM,EACN,OAAO,GACR,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EAGjB,cAAc,EACd,aAAa,EAGb,qBAAqB,EACtB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.OpenApiSecurityScheme = exports.KoaMiddleware = exports.Authentication = exports.DBOSHttpServer = exports.PostApi = exports.GetApi = exports.ArgSource = exports.ArgSources = exports.DBOSDeploy = exports.DBOSInitializer = exports.RequiredRole = exports.Communicator = exports.Workflow = exports.Transaction = exports.OrmEntities = exports.DefaultArgOptional = exports.DefaultArgRequired = exports.DefaultRequiredRole = exports.ArgVarchar = exports.ArgDate = exports.ArgName = exports.LogMask = exports.SkipLogging = exports.ArgOptional = exports.ArgRequired = exports.Debug = exports.LogMasks = exports.DBOSResponseError = exports.Error = exports.StatusString = exports.InitContext = exports.createTestingRuntime = void 0;
27
+ var testing_runtime_1 = require("./testing/testing_runtime");
28
+ Object.defineProperty(exports, "createTestingRuntime", { enumerable: true, get: function () { return testing_runtime_1.createTestingRuntime; } });
29
+ var context_1 = require("./context");
30
+ Object.defineProperty(exports, "InitContext", { enumerable: true, get: function () { return context_1.InitContext; } });
31
+ var workflow_1 = require("./workflow");
32
+ Object.defineProperty(exports, "StatusString", { enumerable: true, get: function () { return workflow_1.StatusString; } });
33
+ exports.Error = __importStar(require("./error"));
34
+ var error_1 = require("./error");
35
+ Object.defineProperty(exports, "DBOSResponseError", { enumerable: true, get: function () { return error_1.DBOSResponseError; } });
36
+ var decorators_1 = require("./decorators");
37
+ Object.defineProperty(exports, "LogMasks", { enumerable: true, get: function () { return decorators_1.LogMasks; } });
38
+ Object.defineProperty(exports, "Debug", { enumerable: true, get: function () { return decorators_1.Debug; } });
39
+ // Parameter Decorators
40
+ Object.defineProperty(exports, "ArgRequired", { enumerable: true, get: function () { return decorators_1.ArgRequired; } });
41
+ Object.defineProperty(exports, "ArgOptional", { enumerable: true, get: function () { return decorators_1.ArgOptional; } });
42
+ Object.defineProperty(exports, "SkipLogging", { enumerable: true, get: function () { return decorators_1.SkipLogging; } });
43
+ Object.defineProperty(exports, "LogMask", { enumerable: true, get: function () { return decorators_1.LogMask; } });
44
+ Object.defineProperty(exports, "ArgName", { enumerable: true, get: function () { return decorators_1.ArgName; } });
45
+ Object.defineProperty(exports, "ArgDate", { enumerable: true, get: function () { return decorators_1.ArgDate; } });
46
+ Object.defineProperty(exports, "ArgVarchar", { enumerable: true, get: function () { return decorators_1.ArgVarchar; } });
47
+ // Class Decorators
48
+ Object.defineProperty(exports, "DefaultRequiredRole", { enumerable: true, get: function () { return decorators_1.DefaultRequiredRole; } });
49
+ Object.defineProperty(exports, "DefaultArgRequired", { enumerable: true, get: function () { return decorators_1.DefaultArgRequired; } });
50
+ Object.defineProperty(exports, "DefaultArgOptional", { enumerable: true, get: function () { return decorators_1.DefaultArgOptional; } });
51
+ // Typeorm Class Decorators
52
+ Object.defineProperty(exports, "OrmEntities", { enumerable: true, get: function () { return decorators_1.OrmEntities; } });
53
+ // Method Decorators
54
+ Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return decorators_1.Transaction; } });
55
+ Object.defineProperty(exports, "Workflow", { enumerable: true, get: function () { return decorators_1.Workflow; } });
56
+ Object.defineProperty(exports, "Communicator", { enumerable: true, get: function () { return decorators_1.Communicator; } });
57
+ Object.defineProperty(exports, "RequiredRole", { enumerable: true, get: function () { return decorators_1.RequiredRole; } });
58
+ Object.defineProperty(exports, "DBOSInitializer", { enumerable: true, get: function () { return decorators_1.DBOSInitializer; } });
59
+ Object.defineProperty(exports, "DBOSDeploy", { enumerable: true, get: function () { return decorators_1.DBOSDeploy; } });
60
+ var handler_1 = require("./httpServer/handler");
61
+ Object.defineProperty(exports, "ArgSources", { enumerable: true, get: function () { return handler_1.ArgSources; } });
62
+ // Endpoint Parameter Decorators
63
+ Object.defineProperty(exports, "ArgSource", { enumerable: true, get: function () { return handler_1.ArgSource; } });
64
+ // Endpoint Decorators
65
+ Object.defineProperty(exports, "GetApi", { enumerable: true, get: function () { return handler_1.GetApi; } });
66
+ Object.defineProperty(exports, "PostApi", { enumerable: true, get: function () { return handler_1.PostApi; } });
67
+ var server_1 = require("./httpServer/server");
68
+ Object.defineProperty(exports, "DBOSHttpServer", { enumerable: true, get: function () { return server_1.DBOSHttpServer; } });
69
+ var middleware_1 = require("./httpServer/middleware");
70
+ // Middleware Decorators
71
+ Object.defineProperty(exports, "Authentication", { enumerable: true, get: function () { return middleware_1.Authentication; } });
72
+ Object.defineProperty(exports, "KoaMiddleware", { enumerable: true, get: function () { return middleware_1.KoaMiddleware; } });
73
+ // OpenApi Decorators
74
+ Object.defineProperty(exports, "OpenApiSecurityScheme", { enumerable: true, get: function () { return middleware_1.OpenApiSecurityScheme; } });
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAGmC;AAFjC,uHAAA,oBAAoB,OAAA;AAItB,qCAGmB;AADjB,sGAAA,WAAW,OAAA;AAQb,uCAKoB;AADlB,wGAAA,YAAY,OAAA;AAQd,iDAAiC;AAEjC,iCAEiB;AADf,0GAAA,iBAAiB,OAAA;AAGnB,2CA2BsB;AA1BpB,sGAAA,QAAQ,OAAA;AACR,mGAAA,KAAK,OAAA;AAEL,uBAAuB;AACvB,yGAAA,WAAW,OAAA;AACX,yGAAA,WAAW,OAAA;AACX,yGAAA,WAAW,OAAA;AACX,qGAAA,OAAO,OAAA;AACP,qGAAA,OAAO,OAAA;AACP,qGAAA,OAAO,OAAA;AACP,wGAAA,UAAU,OAAA;AAEV,mBAAmB;AACnB,iHAAA,mBAAmB,OAAA;AACnB,gHAAA,kBAAkB,OAAA;AAClB,gHAAA,kBAAkB,OAAA;AAClB,2BAA2B;AAC3B,yGAAA,WAAW,OAAA;AAEX,oBAAoB;AACpB,yGAAA,WAAW,OAAA;AACX,sGAAA,QAAQ,OAAA;AACR,0GAAA,YAAY,OAAA;AACZ,0GAAA,YAAY,OAAA;AACZ,6GAAA,eAAe,OAAA;AACf,wGAAA,UAAU,OAAA;AAGZ,gDAU8B;AAT5B,qGAAA,UAAU,OAAA;AAGV,gCAAgC;AAChC,oGAAA,SAAS,OAAA;AAET,sBAAsB;AACtB,iGAAA,MAAM,OAAA;AACN,kGAAA,OAAO,OAAA;AAGT,8CAE6B;AAD3B,wGAAA,cAAc,OAAA;AAGhB,sDAWiC;AAN/B,wBAAwB;AACxB,4GAAA,cAAc,OAAA;AACd,2GAAA,aAAa,OAAA;AAEb,qBAAqB;AACrB,mHAAA,qBAAqB,OAAA"}
@@ -0,0 +1,34 @@
1
+ /// <reference types="node" />
2
+ import { Client } from "pg";
3
+ import { TelemetryCollector } from "../telemetry/collector";
4
+ import { DBOSConfig } from "../dbos-executor";
5
+ /**
6
+ * A class implementing a daemon which collects and exports provenance information,
7
+ * specifically a record of all INSERTs, UPDATEs, and DELETEs in the target database.
8
+ * Only one daemon is needed per database. The daemon need not run in the same process as workflow runtime.
9
+ * The daemon has three requirements and will fail to launch if any is not met:
10
+ *
11
+ * 1. The database must be configured with wal_level=logical.
12
+ * 2. An open replication slot must be available.
13
+ * 3. The wal2json Postgres plugin must be installed. It is installed by default on most cloud databases, including RDS.
14
+ *
15
+ * Because the daemon depends on Postgres logical replication, it can only export information on updates and deletes in tables
16
+ * whose rows are uniquely identifiable, either because the table has a primary key or a replica identity.
17
+ */
18
+ export declare class ProvenanceDaemon {
19
+ readonly slotName: string;
20
+ readonly client: Client;
21
+ readonly daemonID: NodeJS.Timeout;
22
+ readonly recordProvenanceIntervalMs = 1000;
23
+ readonly telemetryCollector: TelemetryCollector;
24
+ initialized: boolean;
25
+ /**
26
+ * @param dbosConfig An DBOS config defining exporters and database connection information.
27
+ * @param slotName The name of a logical replication slot. This slot is persistent and must be deleted if the daemon is no longer to be used.
28
+ */
29
+ constructor(dbosConfig: DBOSConfig, slotName: string);
30
+ start(): Promise<void>;
31
+ recordProvenance(): Promise<void>;
32
+ stop(): Promise<void>;
33
+ }
34
+ //# sourceMappingURL=provenance_daemon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provenance_daemon.d.ts","sourceRoot":"","sources":["../../../src/provenance/provenance_daemon.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAiB,MAAM,IAAI,CAAC;AAE3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAqB9C;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAgB;IAWS,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAV7D,QAAQ,CAAC,MAAM,SAAC;IAChB,QAAQ,CAAC,QAAQ,iBAAC;IAClB,QAAQ,CAAC,0BAA0B,QAAQ;IAC3C,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,WAAW,UAAS;IAEpB;;;OAGG;gBACS,UAAU,EAAE,UAAU,EAAW,QAAQ,EAAE,MAAM;IASvD,KAAK;IAkBL,gBAAgB;IAqBhB,IAAI;CAKX"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProvenanceDaemon = void 0;
4
+ const pg_1 = require("pg");
5
+ const exporters_1 = require("../telemetry/exporters");
6
+ const collector_1 = require("../telemetry/collector");
7
+ /**
8
+ * A class implementing a daemon which collects and exports provenance information,
9
+ * specifically a record of all INSERTs, UPDATEs, and DELETEs in the target database.
10
+ * Only one daemon is needed per database. The daemon need not run in the same process as workflow runtime.
11
+ * The daemon has three requirements and will fail to launch if any is not met:
12
+ *
13
+ * 1. The database must be configured with wal_level=logical.
14
+ * 2. An open replication slot must be available.
15
+ * 3. The wal2json Postgres plugin must be installed. It is installed by default on most cloud databases, including RDS.
16
+ *
17
+ * Because the daemon depends on Postgres logical replication, it can only export information on updates and deletes in tables
18
+ * whose rows are uniquely identifiable, either because the table has a primary key or a replica identity.
19
+ */
20
+ class ProvenanceDaemon {
21
+ slotName;
22
+ client;
23
+ daemonID;
24
+ recordProvenanceIntervalMs = 1000;
25
+ telemetryCollector;
26
+ initialized = false;
27
+ /**
28
+ * @param dbosConfig An DBOS config defining exporters and database connection information.
29
+ * @param slotName The name of a logical replication slot. This slot is persistent and must be deleted if the daemon is no longer to be used.
30
+ */
31
+ constructor(dbosConfig, slotName) {
32
+ this.slotName = slotName;
33
+ this.client = new pg_1.Client(dbosConfig.poolConfig);
34
+ this.daemonID = setInterval(() => {
35
+ void this.recordProvenance();
36
+ }, this.recordProvenanceIntervalMs);
37
+ const telemetryExporters = [new exporters_1.PostgresExporter(dbosConfig.poolConfig, dbosConfig?.observability_database)];
38
+ this.telemetryCollector = new collector_1.TelemetryCollector(telemetryExporters);
39
+ }
40
+ async start() {
41
+ await this.client.connect();
42
+ // Create a logical replication slot with the given name.
43
+ try { // TODO: Make this robust to daemon crashes, so records are not consumed until they've been exported.
44
+ await this.client.query("SELECT pg_create_logical_replication_slot($1, 'wal2json');", [this.slotName]);
45
+ }
46
+ catch (error) {
47
+ const err = error;
48
+ if (err.code === "42710") {
49
+ // The slot has already been created.
50
+ }
51
+ else {
52
+ console.error(err);
53
+ throw err;
54
+ }
55
+ }
56
+ await this.telemetryCollector.init();
57
+ this.initialized = true;
58
+ }
59
+ async recordProvenance() {
60
+ if (this.initialized) {
61
+ const { rows } = await this.client.query("SELECT CAST(xid AS TEXT), data FROM pg_logical_slot_get_changes($1, NULL, NULL, 'filter-tables', 'dbos.*')", [this.slotName]);
62
+ for (const row of rows) {
63
+ const data = JSON.parse(row.data).change;
64
+ for (const change of data) {
65
+ const signal = {
66
+ provTransactionID: row.xid,
67
+ kind: change.kind,
68
+ schema: change.schema,
69
+ table: change.table,
70
+ columnnames: change.columnnames,
71
+ columntypes: change.columntypes,
72
+ columnvalues: change.columnvalues
73
+ };
74
+ this.telemetryCollector.push(signal);
75
+ }
76
+ }
77
+ }
78
+ }
79
+ async stop() {
80
+ clearInterval(this.daemonID);
81
+ await this.client.end();
82
+ await this.telemetryCollector.destroy();
83
+ }
84
+ }
85
+ exports.ProvenanceDaemon = ProvenanceDaemon;
86
+ //# sourceMappingURL=provenance_daemon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provenance_daemon.js","sourceRoot":"","sources":["../../../src/provenance/provenance_daemon.ts"],"names":[],"mappings":";;;AAAA,2BAA2C;AAC3C,sDAA0D;AAC1D,sDAA4D;AAsB5D;;;;;;;;;;;;GAYG;AACH,MAAa,gBAAgB;IAWkB;IAVpC,MAAM,CAAC;IACP,QAAQ,CAAC;IACT,0BAA0B,GAAG,IAAI,CAAC;IAClC,kBAAkB,CAAqB;IAChD,WAAW,GAAG,KAAK,CAAC;IAEpB;;;OAGG;IACH,YAAY,UAAsB,EAAW,QAAgB;QAAhB,aAAQ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M,GAAG,IAAI,IAAI,EAAE;gBACtB,MAAM,IAAI,GAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAkB,CAAC,MAAM,CAAC;gBAC3D,KAAK,MAAM,MAAM,IAAI,IAAI,EAAE;oBACzB,MAAM,MAAM,GAAqB;wBAC/B,iBAAiB,EAAE,GAAG,CAAC,GAAG;wBAC1B,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;wBACrB,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;wBAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;wBAC/B,YAAY,EAAE,MAAM,CAAC,YAAY;qBAClC,CAAA;oBACD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;iBACtC;aACF;SACF;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACxB,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;IAC1C,CAAC;CACF;AAhED,4CAgEC"}
@@ -0,0 +1,69 @@
1
+ import { DBOSNull } from "./dbos-executor";
2
+ import { Pool, PoolClient, PoolConfig } from "pg";
3
+ import { WorkflowStatus } from "./workflow";
4
+ import { HTTPRequest } from "./context";
5
+ import { Logger } from "winston";
6
+ export declare const DBOSExecutorIDHeader = "dbos-executor-id";
7
+ export interface SystemDatabase {
8
+ init(): Promise<void>;
9
+ destroy(): Promise<void>;
10
+ checkWorkflowOutput<R>(workflowUUID: string): Promise<DBOSNull | R>;
11
+ initWorkflowStatus<T extends any[]>(workflowUUID: string, name: string, authenticatedUser: string, assumedRole: string, authenticatedRoles: string[], request: HTTPRequest | null, args: T): Promise<T>;
12
+ bufferWorkflowOutput<R>(workflowUUID: string, output: R): void;
13
+ flushWorkflowStatusBuffer(): Promise<Array<string>>;
14
+ recordWorkflowError(workflowUUID: string, error: Error): Promise<void>;
15
+ getPendingWorkflows(executorID: string): Promise<Array<string>>;
16
+ getWorkflowInputs<T extends any[]>(workflowUUID: string): Promise<T | null>;
17
+ checkOperationOutput<R>(workflowUUID: string, functionID: number): Promise<DBOSNull | R>;
18
+ recordOperationOutput<R>(workflowUUID: string, functionID: number, output: R): Promise<void>;
19
+ recordOperationError(workflowUUID: string, functionID: number, error: Error): Promise<void>;
20
+ getWorkflowStatus(workflowUUID: string, callerUUID?: string, functionID?: number): Promise<WorkflowStatus | null>;
21
+ getWorkflowResult<R>(workflowUUID: string): Promise<R>;
22
+ send<T extends NonNullable<any>>(workflowUUID: string, functionID: number, destinationUUID: string, message: T, topic?: string): Promise<void>;
23
+ recv<T extends NonNullable<any>>(workflowUUID: string, functionID: number, topic?: string, timeoutSeconds?: number): Promise<T | null>;
24
+ setEvent<T extends NonNullable<any>>(workflowUUID: string, functionID: number, key: string, value: T): Promise<void>;
25
+ getEvent<T extends NonNullable<any>>(workflowUUID: string, key: string, timeoutSeconds: number, callerUUID?: string, functionID?: number): Promise<T | null>;
26
+ }
27
+ export declare class PostgresSystemDatabase implements SystemDatabase {
28
+ readonly pgPoolConfig: PoolConfig;
29
+ readonly systemDatabaseName: string;
30
+ readonly logger: Logger;
31
+ readonly pool: Pool;
32
+ notificationsClient: PoolClient | null;
33
+ readonly notificationsMap: Record<string, () => void>;
34
+ readonly workflowEventsMap: Record<string, () => void>;
35
+ readonly workflowStatusBuffer: Map<string, any>;
36
+ constructor(pgPoolConfig: PoolConfig, systemDatabaseName: string, logger: Logger);
37
+ init(): Promise<void>;
38
+ destroy(): Promise<void>;
39
+ checkWorkflowOutput<R>(workflowUUID: string): Promise<DBOSNull | R>;
40
+ initWorkflowStatus<T extends any[]>(workflowUUID: string, name: string, authenticatedUser: string, assumedRole: string, authenticatedRoles: string[], request: HTTPRequest | null, args: T): Promise<T>;
41
+ bufferWorkflowOutput<R>(workflowUUID: string, output: R): void;
42
+ /**
43
+ * Flush the workflow output buffer to the database.
44
+ */
45
+ flushWorkflowStatusBuffer(): Promise<string[]>;
46
+ recordWorkflowError(workflowUUID: string, error: Error): Promise<void>;
47
+ getPendingWorkflows(executorID: string): Promise<Array<string>>;
48
+ getWorkflowInputs<T extends any[]>(workflowUUID: string): Promise<T | null>;
49
+ checkOperationOutput<R>(workflowUUID: string, functionID: number): Promise<DBOSNull | R>;
50
+ recordOperationOutput<R>(workflowUUID: string, functionID: number, output: R): Promise<void>;
51
+ recordOperationError(workflowUUID: string, functionID: number, error: Error): Promise<void>;
52
+ /**
53
+ * Guard the operation, throwing an error if a conflicting execution is detected.
54
+ */
55
+ recordNotificationOutput<R>(client: PoolClient, workflowUUID: string, functionID: number, output: R): Promise<void>;
56
+ readonly nullTopic = "__null__topic__";
57
+ send<T extends NonNullable<any>>(workflowUUID: string, functionID: number, destinationUUID: string, message: T, topic?: string): Promise<void>;
58
+ recv<T extends NonNullable<any>>(workflowUUID: string, functionID: number, topic?: string, timeoutSeconds?: number): Promise<T | null>;
59
+ setEvent<T extends NonNullable<any>>(workflowUUID: string, functionID: number, key: string, message: T): Promise<void>;
60
+ getEvent<T extends NonNullable<any>>(workflowUUID: string, key: string, timeoutSeconds: number, callerUUID?: string, functionID?: number): Promise<T | null>;
61
+ getWorkflowStatus(workflowUUID: string, callerUUID?: string, functionID?: number): Promise<WorkflowStatus | null>;
62
+ getWorkflowResult<R>(workflowUUID: string): Promise<R>;
63
+ /**
64
+ * A background process that listens for notifications from Postgres then signals the appropriate
65
+ * workflow listener by resolving its promise.
66
+ */
67
+ listenForNotifications(): Promise<void>;
68
+ }
69
+ //# sourceMappingURL=system_database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system_database.d.ts","sourceRoot":"","sources":["../../src/system_database.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAA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