@dbos-inc/dbos-sdk 3.0.20-preview → 3.0.37-preview.gfd7eaf193c

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.
Files changed (83) hide show
  1. package/dist/src/authdecorators.d.ts +0 -7
  2. package/dist/src/authdecorators.d.ts.map +1 -1
  3. package/dist/src/authdecorators.js +1 -29
  4. package/dist/src/authdecorators.js.map +1 -1
  5. package/dist/src/conductor/conductor.d.ts.map +1 -1
  6. package/dist/src/conductor/conductor.js +3 -0
  7. package/dist/src/conductor/conductor.js.map +1 -1
  8. package/dist/src/conductor/protocol.d.ts +3 -0
  9. package/dist/src/conductor/protocol.d.ts.map +1 -1
  10. package/dist/src/conductor/protocol.js.map +1 -1
  11. package/dist/src/context.d.ts +9 -43
  12. package/dist/src/context.d.ts.map +1 -1
  13. package/dist/src/context.js +28 -113
  14. package/dist/src/context.js.map +1 -1
  15. package/dist/src/datasource.d.ts +14 -3
  16. package/dist/src/datasource.d.ts.map +1 -1
  17. package/dist/src/datasource.js +12 -11
  18. package/dist/src/datasource.js.map +1 -1
  19. package/dist/src/dbos-executor.d.ts +37 -79
  20. package/dist/src/dbos-executor.d.ts.map +1 -1
  21. package/dist/src/dbos-executor.js +297 -498
  22. package/dist/src/dbos-executor.js.map +1 -1
  23. package/dist/src/dbos-runtime/cli.d.ts.map +1 -1
  24. package/dist/src/dbos-runtime/cli.js +1 -3
  25. package/dist/src/dbos-runtime/cli.js.map +1 -1
  26. package/dist/src/dbos-runtime/debug.d.ts +1 -1
  27. package/dist/src/dbos-runtime/debug.d.ts.map +1 -1
  28. package/dist/src/dbos-runtime/debug.js +2 -3
  29. package/dist/src/dbos-runtime/debug.js.map +1 -1
  30. package/dist/src/dbos-runtime/runtime.d.ts.map +1 -1
  31. package/dist/src/dbos-runtime/runtime.js +0 -9
  32. package/dist/src/dbos-runtime/runtime.js.map +1 -1
  33. package/dist/src/dbos.d.ts +9 -34
  34. package/dist/src/dbos.d.ts.map +1 -1
  35. package/dist/src/dbos.js +95 -273
  36. package/dist/src/dbos.js.map +1 -1
  37. package/dist/src/decorators.d.ts +35 -60
  38. package/dist/src/decorators.d.ts.map +1 -1
  39. package/dist/src/decorators.js +157 -184
  40. package/dist/src/decorators.js.map +1 -1
  41. package/dist/src/httpServer/handler.d.ts +1 -9
  42. package/dist/src/httpServer/handler.d.ts.map +1 -1
  43. package/dist/src/httpServer/handler.js +1 -1
  44. package/dist/src/httpServer/handler.js.map +1 -1
  45. package/dist/src/httpServer/server.d.ts.map +1 -1
  46. package/dist/src/httpServer/server.js +8 -7
  47. package/dist/src/httpServer/server.js.map +1 -1
  48. package/dist/src/index.d.ts +5 -8
  49. package/dist/src/index.d.ts.map +1 -1
  50. package/dist/src/index.js +7 -17
  51. package/dist/src/index.js.map +1 -1
  52. package/dist/src/paramdecorators.d.ts.map +1 -1
  53. package/dist/src/paramdecorators.js +0 -6
  54. package/dist/src/paramdecorators.js.map +1 -1
  55. package/dist/src/procedure.d.ts +0 -22
  56. package/dist/src/procedure.d.ts.map +1 -1
  57. package/dist/src/procedure.js +0 -16
  58. package/dist/src/procedure.js.map +1 -1
  59. package/dist/src/scheduler/scheduler.d.ts.map +1 -1
  60. package/dist/src/scheduler/scheduler.js +3 -2
  61. package/dist/src/scheduler/scheduler.js.map +1 -1
  62. package/dist/src/step.d.ts +0 -25
  63. package/dist/src/step.d.ts.map +1 -1
  64. package/dist/src/step.js +0 -20
  65. package/dist/src/step.js.map +1 -1
  66. package/dist/src/system_database.d.ts +2 -3
  67. package/dist/src/system_database.d.ts.map +1 -1
  68. package/dist/src/system_database.js +56 -3
  69. package/dist/src/system_database.js.map +1 -1
  70. package/dist/src/transaction.d.ts +0 -25
  71. package/dist/src/transaction.d.ts.map +1 -1
  72. package/dist/src/transaction.js +1 -15
  73. package/dist/src/transaction.js.map +1 -1
  74. package/dist/src/workflow.d.ts +7 -148
  75. package/dist/src/workflow.d.ts.map +1 -1
  76. package/dist/src/workflow.js +7 -226
  77. package/dist/src/workflow.js.map +1 -1
  78. package/dist/tsconfig.tsbuildinfo +1 -1
  79. package/package.json +2 -2
  80. package/dist/src/eventreceiver.d.ts +0 -155
  81. package/dist/src/eventreceiver.d.ts.map +0 -1
  82. package/dist/src/eventreceiver.js +0 -3
  83. package/dist/src/eventreceiver.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbos-inc/dbos-sdk",
3
- "version": "3.0.20-preview",
3
+ "version": "3.0.37-preview.gfd7eaf193c",
4
4
  "description": "A Typescript framework built on the database",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -30,7 +30,7 @@
30
30
  "lint": "rm -rf packages/create/templates/hello-prisma/node_modules/ && eslint --ignore-pattern **/coverage/ .",
31
31
  "setversion": "npm run --workspaces setversion && grunt setversion",
32
32
  "test": "npm run build && rm -rf packages/create/templates/hello-prisma/node_modules/ && npm run --workspaces test && npx prisma generate --schema tests/prisma/schema.prisma && jest ./tests --coverage --collectCoverageFrom='src/**/*' --detectOpenHandles",
33
- "prepare": "husky install"
33
+ "prepare": "husky"
34
34
  },
35
35
  "bin": {
36
36
  "dbos": "./dist/src/dbos-runtime/cli.js",
@@ -1,155 +0,0 @@
1
- import { Tracer } from './telemetry/traces';
2
- import { GlobalLogger as Logger } from './telemetry/logs';
3
- import type { GetQueuedWorkflowsInput, GetWorkflowsInput, StepInfo, WorkflowFunction, WorkflowHandle, WorkflowParams, WorkflowStatus } from './workflow';
4
- import type { TransactionFunction } from './transaction';
5
- import type { MethodRegistrationBase } from './decorators';
6
- import type { StepFunction } from './step';
7
- import type { Notification } from 'pg';
8
- import type { StoredProcedure } from './procedure';
9
- export type DBNotification = Notification;
10
- export type DBNotificationCallback = (n: DBNotification) => void;
11
- export interface DBNotificationListener {
12
- close(): Promise<void>;
13
- }
14
- /**
15
- * Interface for registration information provided to `DBOSEventReceiver`
16
- * instances about each method and containing class. This contains any
17
- * information stored by the decorators that registered the method with
18
- * its event receiver.
19
- */
20
- export interface DBOSEventReceiverRegistration {
21
- /** Method-level configuration information, as stored by the event receiver's decorators (or other registration mechanism) */
22
- methodConfig: unknown;
23
- /** Class-level configuration information, as stored by the event receiver's decorators (or other registration mechanism) */
24
- classConfig: unknown;
25
- /** Method to dispatch, and associated DBOS registration information */
26
- methodReg: MethodRegistrationBase;
27
- }
28
- export interface DBOSExecutorContext {
29
- /** Logging service; @deprecated: Use `DBOS.logger` instead. */
30
- readonly logger: Logger;
31
- /** Tracing service; @deprecated: Use `DBOS.tracer` instead. */
32
- readonly tracer: Tracer;
33
- /** @deprecated */
34
- getConfig<T>(key: string): T | undefined;
35
- /** @deprecated */
36
- getConfig<T>(key: string, defaultValue: T): T;
37
- /**
38
- * Get the registrations for a receiver
39
- * @param eri - all registrations for this `DBOSEventReceiver` will be returned
40
- * @returns array of all methods registered for the receiver, including:
41
- * methodConfig: the method info the receiver stored
42
- * classConfig: the class info the receiver stored
43
- * methodReg: the method registration (w/ workflow, transaction, function, and other info)
44
- */
45
- getRegistrationsFor(eri: DBOSEventReceiver): DBOSEventReceiverRegistration[];
46
- /**
47
- * Invoke a transaction function.
48
- * Note that functions can be called directly instead of using this interface.
49
- */
50
- transaction<T extends unknown[], R>(txn: TransactionFunction<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
51
- /**
52
- * Invoke a workflow function.
53
- * Note that functions can be enqueued directly with `DBOS.startWorkflow` instead of using this interface.
54
- */
55
- workflow<T extends unknown[], R>(wf: WorkflowFunction<T, R>, params: WorkflowParams, ...args: T): Promise<WorkflowHandle<R>>;
56
- /**
57
- * @deprecated
58
- * Invoke a step function.
59
- * Note that functions can be called directly instead of using this interface.
60
- */
61
- external<T extends unknown[], R>(stepFn: StepFunction<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
62
- /**
63
- * @deprecated
64
- * Invoke a stored procedure function.
65
- * Note that functions can be called directly instead of using this interface.
66
- */
67
- procedure<T extends unknown[], R>(proc: StoredProcedure<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
68
- /**
69
- * Send a messsage to workflow with a given ID.
70
- * @deprecated `DBOS.send` can be used instead.
71
- * @param destinationID - ID of workflow to receive the message
72
- * @param message - Message
73
- * @param topic - Topic for message
74
- * @param idempotencyKey - For sending exactly once
75
- * @template T - Type of object to send
76
- */
77
- send<T>(destinationID: string, message: T, topic?: string, idempotencyKey?: string): Promise<void>;
78
- /**
79
- * Get an event set by a workflow.
80
- * @deprecated Note that `DBOS.getEvent` can be used instead.
81
- */
82
- getEvent<T>(workflowID: string, key: string, timeoutSeconds?: number): Promise<T | null>;
83
- /**
84
- * Retrieve a workflow handle given the workflow ID.
85
- * @deprecated Note that `DBOS.retrieveWorkflow` can be used instead
86
- */
87
- retrieveWorkflow<R>(workflowID: string): WorkflowHandle<R>;
88
- /** @deprecated Use functions on `DBOS` */
89
- getWorkflowStatus(workflowID: string, callerID?: string, callerFN?: number): Promise<WorkflowStatus | null>;
90
- /** @deprecated Use functions on `DBOS` */
91
- listWorkflows(input: GetWorkflowsInput): Promise<WorkflowStatus[]>;
92
- /** @deprecated Use functions on `DBOS` */
93
- listQueuedWorkflows(input: GetQueuedWorkflowsInput): Promise<WorkflowStatus[]>;
94
- /** @deprecated Use functions on `DBOS` */
95
- listWorkflowSteps(workflowID: string): Promise<StepInfo[] | undefined>;
96
- /** @deprecated Use functions on `DBOS` */
97
- cancelWorkflow(workflowID: string): Promise<void>;
98
- /** @deprecated Use functions on `DBOS` */
99
- resumeWorkflow(workflowID: string): Promise<void>;
100
- /** @deprecated Use functions on `DBOS` */
101
- forkWorkflow(workflowID: string, startStep: number, options?: {
102
- newWorkflowID?: string;
103
- applicationVersion?: string;
104
- timeoutMS?: number;
105
- }): Promise<string>;
106
- /** @deprecated see DBOS.getEventDispatchState */
107
- getEventDispatchState(service: string, workflowFnName: string, key: string): Promise<DBOSEventReceiverState | undefined>;
108
- /** @deprecated see DBOS.upsertEventDispatchState */
109
- upsertEventDispatchState(state: DBOSEventReceiverState): Promise<DBOSEventReceiverState>;
110
- /** @deprecated Use `DBOS.queryUserDB` */
111
- queryUserDB(sql: string, params?: unknown[]): Promise<unknown[]>;
112
- /** @deprecated Listen for notifications from the user DB */
113
- userDBListen(channels: string[], callback: DBNotificationCallback): Promise<DBNotificationListener>;
114
- }
115
- /**
116
- * Interface for DBOS pluggable event receivers.
117
- * This is for things like kafka, SQS, HTTP, schedulers, etc., that listen or poll
118
- * for events and dispatch workflows in response.
119
- * A `DBOSEventReceiver` will be:
120
- * Registered with DBOS executor when any endpoint workflow function needs it
121
- * Initialized with the executor during launch
122
- * Destroyed upon any clean `shutdown()`
123
- * It is the implementer's job to keep going and dispatch workflows between
124
- * `initialize` and `destroy`
125
- */
126
- export interface DBOSEventReceiver {
127
- /** Executor, for providing state and dispatching DBOS workflows or other methods */
128
- executor?: DBOSExecutorContext;
129
- /** Called upon shutdown (usually in tests) to stop event receivers and free resources */
130
- destroy(): Promise<void>;
131
- /** Called during DBOS launch to indicate that event receiving should start */
132
- initialize(executor: DBOSExecutorContext): Promise<void>;
133
- /** Called at launch; Implementers should emit a diagnostic list of all registrations */
134
- logRegisteredEndpoints(): void;
135
- }
136
- /**
137
- * State item to be kept in the DBOS system database on behalf of `DBOSEventReceiver`s
138
- * @see DBOSEventReceiver.upsertEventDispatchState
139
- * @see DBOSEventReceiver.getEventDispatchState
140
- */
141
- export interface DBOSEventReceiverState {
142
- /** Name of event receiver service */
143
- service: string;
144
- /** Fully qualified function name for which state is kept */
145
- workflowFnName: string;
146
- /** subkey within the service+workflowFnName */
147
- key: string;
148
- /** Value kept for the service+workflowFnName+key combination */
149
- value?: string;
150
- /** Updated time (used to version the value) */
151
- updateTime?: number;
152
- /** Updated sequence number (used to version the value) */
153
- updateSeq?: bigint;
154
- }
155
- //# sourceMappingURL=eventreceiver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eventreceiver.d.ts","sourceRoot":"","sources":["../../src/eventreceiver.ts"],"names":[],"mappings":"AAAA,O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SAAS,CAAC,CAAC;IAE/C,oDAAoD;IACpD,wBAAwB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAEzF,yCAAyC;IACzC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEjE,4DAA4D;IAC5D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACrG;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAChC,oFAAoF;IACpF,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,yFAAyF;IACzF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,8EAA8E;IAC9E,UAAU,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,wFAAwF;IACxF,sBAAsB,IAAI,IAAI,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=eventreceiver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eventreceiver.js","sourceRoot":"","sources":["../../src/eventreceiver.ts"],"names":[],"mappings":""}