@decaf-ts/as-graph 0.4.0 → 0.6.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.
Files changed (146) hide show
  1. package/README.md +167 -5
  2. package/dist/as-graph.cjs +1 -1
  3. package/dist/as-graph.cjs.map +1 -1
  4. package/dist/as-graph.js +1 -1
  5. package/dist/as-graph.js.map +1 -1
  6. package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs +102 -11
  7. package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs.map +1 -1
  8. package/lib/cjs/dagster/DagsterGraphQLClient.cjs +738 -0
  9. package/lib/cjs/dagster/DagsterGraphQLClient.cjs.map +1 -0
  10. package/lib/cjs/dagster/index.cjs +1 -0
  11. package/lib/cjs/dagster/index.cjs.map +1 -1
  12. package/lib/cjs/engine/execution/GraphExecutionEngine.cjs +7 -0
  13. package/lib/cjs/engine/execution/GraphExecutionEngine.cjs.map +1 -1
  14. package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs +39 -0
  15. package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs.map +1 -1
  16. package/lib/cjs/engine/index.cjs +1 -0
  17. package/lib/cjs/engine/index.cjs.map +1 -1
  18. package/lib/cjs/engine/services/GraphNodeModelService.cjs +129 -0
  19. package/lib/cjs/engine/services/GraphNodeModelService.cjs.map +1 -0
  20. package/lib/cjs/engine/services/GraphWorkflowService.cjs +33 -0
  21. package/lib/cjs/engine/services/GraphWorkflowService.cjs.map +1 -1
  22. package/lib/cjs/mastra/MastraDefaultStepHandlers.cjs +217 -0
  23. package/lib/cjs/mastra/MastraDefaultStepHandlers.cjs.map +1 -0
  24. package/lib/cjs/mastra/MastraEventBridge.cjs +10 -3
  25. package/lib/cjs/mastra/MastraEventBridge.cjs.map +1 -1
  26. package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs +111 -13
  27. package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs.map +1 -1
  28. package/lib/cjs/mastra/MastraWorkflowCompiler.cjs +3 -3
  29. package/lib/cjs/mastra/MastraWorkflowCompiler.cjs.map +1 -1
  30. package/lib/cjs/mastra/index.cjs +1 -0
  31. package/lib/cjs/mastra/index.cjs.map +1 -1
  32. package/lib/cjs/mastra/types.cjs +5 -1
  33. package/lib/cjs/mastra/types.cjs.map +1 -1
  34. package/lib/cjs/nest/graph/GraphBackendHost.cjs +232 -0
  35. package/lib/cjs/nest/graph/GraphBackendHost.cjs.map +1 -0
  36. package/lib/cjs/nest/graph/GraphExecutionModule.cjs +38 -1
  37. package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +1 -1
  38. package/lib/cjs/nest/graph/index.cjs +1 -0
  39. package/lib/cjs/nest/graph/index.cjs.map +1 -1
  40. package/lib/cjs/nest/graph/main.cjs +112 -12
  41. package/lib/cjs/nest/graph/main.cjs.map +1 -1
  42. package/lib/cjs/ram/GraphNodeRepository.cjs +40 -0
  43. package/lib/cjs/ram/GraphNodeRepository.cjs.map +1 -0
  44. package/lib/cjs/ram/index.cjs +1 -0
  45. package/lib/cjs/ram/index.cjs.map +1 -1
  46. package/lib/cjs/shared/graph/GraphNodeConverters.cjs +43 -0
  47. package/lib/cjs/shared/graph/GraphNodeConverters.cjs.map +1 -0
  48. package/lib/cjs/shared/graph/GraphNodeModel.cjs +74 -0
  49. package/lib/cjs/shared/graph/GraphNodeModel.cjs.map +1 -0
  50. package/lib/cjs/shared/graph/index.cjs +2 -0
  51. package/lib/cjs/shared/graph/index.cjs.map +1 -1
  52. package/lib/esm/dagster/DagsterGraphExecutionBackend.js +102 -11
  53. package/lib/esm/dagster/DagsterGraphExecutionBackend.js.map +1 -1
  54. package/lib/esm/dagster/DagsterGraphQLClient.js +733 -0
  55. package/lib/esm/dagster/DagsterGraphQLClient.js.map +1 -0
  56. package/lib/esm/dagster/index.js +1 -0
  57. package/lib/esm/dagster/index.js.map +1 -1
  58. package/lib/esm/engine/execution/GraphExecutionBackend.js.map +1 -1
  59. package/lib/esm/engine/execution/GraphExecutionEngine.js +7 -0
  60. package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -1
  61. package/lib/esm/engine/execution/LocalGraphExecutionBackend.js +39 -0
  62. package/lib/esm/engine/execution/LocalGraphExecutionBackend.js.map +1 -1
  63. package/lib/esm/engine/index.js +1 -0
  64. package/lib/esm/engine/index.js.map +1 -1
  65. package/lib/esm/engine/services/GraphNodeModelService.js +120 -0
  66. package/lib/esm/engine/services/GraphNodeModelService.js.map +1 -0
  67. package/lib/esm/engine/services/GraphWorkflowService.js +34 -1
  68. package/lib/esm/engine/services/GraphWorkflowService.js.map +1 -1
  69. package/lib/esm/mastra/MastraCapabilities.js.map +1 -1
  70. package/lib/esm/mastra/MastraDefaultStepHandlers.js +212 -0
  71. package/lib/esm/mastra/MastraDefaultStepHandlers.js.map +1 -0
  72. package/lib/esm/mastra/MastraEventBridge.js +10 -3
  73. package/lib/esm/mastra/MastraEventBridge.js.map +1 -1
  74. package/lib/esm/mastra/MastraGraphExecutionBackend.js +112 -14
  75. package/lib/esm/mastra/MastraGraphExecutionBackend.js.map +1 -1
  76. package/lib/esm/mastra/MastraWorkflowCompiler.js +3 -3
  77. package/lib/esm/mastra/MastraWorkflowCompiler.js.map +1 -1
  78. package/lib/esm/mastra/index.js +1 -0
  79. package/lib/esm/mastra/index.js.map +1 -1
  80. package/lib/esm/mastra/types.js +4 -0
  81. package/lib/esm/mastra/types.js.map +1 -1
  82. package/lib/esm/nest/graph/GraphBackendHost.js +189 -0
  83. package/lib/esm/nest/graph/GraphBackendHost.js.map +1 -0
  84. package/lib/esm/nest/graph/GraphExecutionModule.js +39 -2
  85. package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -1
  86. package/lib/esm/nest/graph/index.js +1 -0
  87. package/lib/esm/nest/graph/index.js.map +1 -1
  88. package/lib/esm/nest/graph/main.js +79 -12
  89. package/lib/esm/nest/graph/main.js.map +1 -1
  90. package/lib/esm/ram/GraphNodeRepository.js +31 -0
  91. package/lib/esm/ram/GraphNodeRepository.js.map +1 -0
  92. package/lib/esm/ram/index.js +1 -0
  93. package/lib/esm/ram/index.js.map +1 -1
  94. package/lib/esm/shared/graph/GraphNodeConverters.js +38 -0
  95. package/lib/esm/shared/graph/GraphNodeConverters.js.map +1 -0
  96. package/lib/esm/shared/graph/GraphNodeModel.js +65 -0
  97. package/lib/esm/shared/graph/GraphNodeModel.js.map +1 -0
  98. package/lib/esm/shared/graph/index.js +2 -0
  99. package/lib/esm/shared/graph/index.js.map +1 -1
  100. package/lib/types/dagster/DagsterGraphExecutionBackend.d.cts +40 -4
  101. package/lib/types/dagster/DagsterGraphExecutionBackend.d.mts +40 -4
  102. package/lib/types/dagster/DagsterGraphQLClient.d.cts +231 -0
  103. package/lib/types/dagster/DagsterGraphQLClient.d.mts +231 -0
  104. package/lib/types/dagster/index.d.cts +1 -0
  105. package/lib/types/dagster/index.d.mts +1 -0
  106. package/lib/types/engine/execution/GraphExecutionBackend.d.cts +27 -0
  107. package/lib/types/engine/execution/GraphExecutionBackend.d.mts +27 -0
  108. package/lib/types/engine/execution/GraphExecutionEngine.d.cts +9 -0
  109. package/lib/types/engine/execution/GraphExecutionEngine.d.mts +9 -0
  110. package/lib/types/engine/execution/LocalGraphExecutionBackend.d.cts +14 -0
  111. package/lib/types/engine/execution/LocalGraphExecutionBackend.d.mts +14 -0
  112. package/lib/types/engine/index.d.cts +1 -0
  113. package/lib/types/engine/index.d.mts +1 -0
  114. package/lib/types/engine/services/GraphNodeModelService.d.cts +54 -0
  115. package/lib/types/engine/services/GraphNodeModelService.d.mts +54 -0
  116. package/lib/types/engine/services/GraphWorkflowService.d.cts +21 -0
  117. package/lib/types/engine/services/GraphWorkflowService.d.mts +21 -0
  118. package/lib/types/mastra/MastraCapabilities.d.cts +0 -5
  119. package/lib/types/mastra/MastraCapabilities.d.mts +0 -5
  120. package/lib/types/mastra/MastraDefaultStepHandlers.d.cts +74 -0
  121. package/lib/types/mastra/MastraDefaultStepHandlers.d.mts +74 -0
  122. package/lib/types/mastra/MastraGraphExecutionBackend.d.cts +29 -0
  123. package/lib/types/mastra/MastraGraphExecutionBackend.d.mts +29 -0
  124. package/lib/types/mastra/MastraWorkflowCompiler.d.cts +3 -3
  125. package/lib/types/mastra/MastraWorkflowCompiler.d.mts +3 -3
  126. package/lib/types/mastra/index.d.cts +1 -0
  127. package/lib/types/mastra/index.d.mts +1 -0
  128. package/lib/types/mastra/types.d.cts +12 -0
  129. package/lib/types/mastra/types.d.mts +12 -0
  130. package/lib/types/nest/graph/GraphBackendHost.d.cts +152 -0
  131. package/lib/types/nest/graph/GraphBackendHost.d.mts +152 -0
  132. package/lib/types/nest/graph/GraphExecutionModule.d.cts +23 -0
  133. package/lib/types/nest/graph/GraphExecutionModule.d.mts +23 -0
  134. package/lib/types/nest/graph/index.d.cts +1 -0
  135. package/lib/types/nest/graph/index.d.mts +1 -0
  136. package/lib/types/ram/GraphNodeRepository.d.cts +13 -0
  137. package/lib/types/ram/GraphNodeRepository.d.mts +13 -0
  138. package/lib/types/ram/index.d.cts +1 -0
  139. package/lib/types/ram/index.d.mts +1 -0
  140. package/lib/types/shared/graph/GraphNodeConverters.d.cts +15 -0
  141. package/lib/types/shared/graph/GraphNodeConverters.d.mts +15 -0
  142. package/lib/types/shared/graph/GraphNodeModel.d.cts +24 -0
  143. package/lib/types/shared/graph/GraphNodeModel.d.mts +24 -0
  144. package/lib/types/shared/graph/index.d.cts +2 -0
  145. package/lib/types/shared/graph/index.d.mts +2 -0
  146. package/package.json +15 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeModel.js","sourceRoot":"","sources":["../../../../src/shared/graph/GraphNodeModel.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGrE;;;;;;GAMG;AAGI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,SAAS;IA2B3C,YAAY,GAA6B;QACvC,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AA3BC;IADC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;4CACzB;AAKd;IAFC,MAAM,EAAE;IACR,KAAK,EAAE;;4CACM;AAKd;IAFC,MAAM,EAAE;IACR,KAAK,EAAE;;gDACU;AAIlB;IADC,MAAM,EAAE;;6CACM;AAIf;IADC,MAAM,EAAE;;mDACY;AAIrB;IADC,MAAM,EAAE;;gDACoB;AAzBlB,cAAc;IAF1B,KAAK,CAAC,YAAY,CAAC;IACnB,KAAK,EAAE;;GACK,cAAc,CA8B1B"}
@@ -16,6 +16,8 @@ export * from "./layout/index.js";
16
16
  export * from "./types.js";
17
17
  export * from "./GraphRunModel.js";
18
18
  export * from "./GraphWorkflowModel.js";
19
+ export * from "./GraphNodeModel.js";
20
+ export * from "./GraphNodeConverters.js";
19
21
  export * from "./GraphResolution.js";
20
22
  export * from "./GraphExecutionStateMapper.js";
21
23
  export * from "./category-styles.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared/graph/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,yBAAyB,CAAC;AACjC,8BAAqB;AAErB,+BAA4B;AAC5B,0BAAuB;AACvB,gCAA6B;AAC7B,8BAA2B;AAC3B,qCAA4B;AAC5B,8BAA2B;AAC3B,4BAAyB;AACzB,oCAA2B;AAC3B,mCAA0B;AAC1B,kCAAyB;AACzB,2BAAwB;AACxB,mCAAgC;AAChC,wCAAqC;AACrC,qCAAkC;AAClC,+CAA4C;AAC5C,qCAAkC;AAClC,qCAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared/graph/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,yBAAyB,CAAC;AACjC,8BAAqB;AAErB,+BAA4B;AAC5B,0BAAuB;AACvB,gCAA6B;AAC7B,8BAA2B;AAC3B,qCAA4B;AAC5B,8BAA2B;AAC3B,4BAAyB;AACzB,oCAA2B;AAC3B,mCAA0B;AAC1B,kCAAyB;AACzB,2BAAwB;AACxB,mCAAgC;AAChC,wCAAqC;AACrC,oCAAiC;AACjC,yCAAsC;AACtC,qCAAkC;AAClC,+CAA4C;AAC5C,qCAAkC;AAClC,qCAA4B"}
@@ -79,6 +79,13 @@ export declare class DagsterGraphExecutionBackend implements GraphExecutionBacke
79
79
  private client?;
80
80
  private readonly mapper;
81
81
  private readonly bridges;
82
+ /**
83
+ * Read-only catalogue of seeded canonical documents. Seeding registers the
84
+ * documents a host supplies at boot (its fixture registry) so they are listed
85
+ * and looked up through this backend; it is NOT an authoring surface — the
86
+ * backend's declared authoring capabilities stay `not_supported`.
87
+ */
88
+ private readonly seeded;
82
89
  private defaultTags;
83
90
  private _config?;
84
91
  private executionEnabled;
@@ -104,22 +111,51 @@ export declare class DagsterGraphExecutionBackend implements GraphExecutionBacke
104
111
  */
105
112
  get capabilities(): GraphBackendCapabilities;
106
113
  /**
107
- * Lists the deployment's Dagster jobs through the client port.
114
+ * Lists the seeded fixture catalogue plus the deployment's Dagster jobs
115
+ * through the client port. Seeded fixtures (owner-less, read-only) appear for
116
+ * ids the deployment does not define; a deployment job whose name collides with
117
+ * a seeded fixture replaces that fixture (F6), so the real job stays reachable
118
+ * from the listing as well as from {@link getWorkflow}.
108
119
  *
109
120
  * @returns Real workflow summaries.
110
- * @throws {GraphExecutionError} when the client port exposes no job listing.
121
+ * @throws {GraphExecutionError} when there is nothing to list: no seeded
122
+ * fixtures and the client port exposes no job listing.
111
123
  */
112
124
  listWorkflows(): Promise<GraphBackendWorkflowSummary[]>;
125
+ /**
126
+ * Seeds canonical workflow documents into this backend's read-only catalogue
127
+ * so they are listed and looked up alongside the deployment's jobs. Seeding is
128
+ * a host boot action, never an authoring surface: the backend's declared
129
+ * authoring capabilities stay `not_supported`.
130
+ *
131
+ * @param documents - The canonical documents to register.
132
+ * @returns The seeded workflow summaries.
133
+ */
134
+ seedWorkflows(documents: readonly GraphWorkflowDocument[]): Promise<GraphBackendWorkflowSummary[]>;
113
135
  /**
114
136
  * Reads a single already-deployed Dagster job through the client port and maps
115
137
  * its ACTUAL deployment structure (graph/op structure, asset keys,
116
138
  * schedules/sensors) into the canonical document shape.
117
139
  *
140
+ * The real deployment is authoritative on an id collision (F6): when the
141
+ * deployment defines a job whose name matches the requested id, the deployment
142
+ * job is served even if a seeded fixture shares that id, so a real job can never
143
+ * be shadowed by the boot seed. A seeded document is returned only for ids the
144
+ * deployment does not define (or when no client port is wired).
145
+ *
118
146
  * @param workflowId - The canonical workflow id (the Dagster job name).
119
- * @returns A canonical document describing the existing job.
120
- * @throws {GraphExecutionError} when the client port exposes no job lookup.
147
+ * @returns A canonical document describing the existing job, or the seeded fixture.
148
+ * @throws {GraphExecutionError} when no client is wired and the id is not seeded, or when the client port exposes no job lookup.
121
149
  */
122
150
  getWorkflow(workflowId: string): Promise<GraphWorkflowDocument>;
151
+ /**
152
+ * Whether the Dagster deployment defines a job with the given id (F6). Resolves
153
+ * an id collision between a seeded fixture and a real deployment job in favour
154
+ * of the deployment. Fails safe to `false` when the port exposes no job listing
155
+ * or the listing cannot be read, so an unavailable listing never hides the
156
+ * seeded catalogue.
157
+ */
158
+ private deploymentDefinesJob;
123
159
  /**
124
160
  * Reads an EXISTING Dagster run's terminal record through the client port.
125
161
  *
@@ -79,6 +79,13 @@ export declare class DagsterGraphExecutionBackend implements GraphExecutionBacke
79
79
  private client?;
80
80
  private readonly mapper;
81
81
  private readonly bridges;
82
+ /**
83
+ * Read-only catalogue of seeded canonical documents. Seeding registers the
84
+ * documents a host supplies at boot (its fixture registry) so they are listed
85
+ * and looked up through this backend; it is NOT an authoring surface — the
86
+ * backend's declared authoring capabilities stay `not_supported`.
87
+ */
88
+ private readonly seeded;
82
89
  private defaultTags;
83
90
  private _config?;
84
91
  private executionEnabled;
@@ -104,22 +111,51 @@ export declare class DagsterGraphExecutionBackend implements GraphExecutionBacke
104
111
  */
105
112
  get capabilities(): GraphBackendCapabilities;
106
113
  /**
107
- * Lists the deployment's Dagster jobs through the client port.
114
+ * Lists the seeded fixture catalogue plus the deployment's Dagster jobs
115
+ * through the client port. Seeded fixtures (owner-less, read-only) appear for
116
+ * ids the deployment does not define; a deployment job whose name collides with
117
+ * a seeded fixture replaces that fixture (F6), so the real job stays reachable
118
+ * from the listing as well as from {@link getWorkflow}.
108
119
  *
109
120
  * @returns Real workflow summaries.
110
- * @throws {GraphExecutionError} when the client port exposes no job listing.
121
+ * @throws {GraphExecutionError} when there is nothing to list: no seeded
122
+ * fixtures and the client port exposes no job listing.
111
123
  */
112
124
  listWorkflows(): Promise<GraphBackendWorkflowSummary[]>;
125
+ /**
126
+ * Seeds canonical workflow documents into this backend's read-only catalogue
127
+ * so they are listed and looked up alongside the deployment's jobs. Seeding is
128
+ * a host boot action, never an authoring surface: the backend's declared
129
+ * authoring capabilities stay `not_supported`.
130
+ *
131
+ * @param documents - The canonical documents to register.
132
+ * @returns The seeded workflow summaries.
133
+ */
134
+ seedWorkflows(documents: readonly GraphWorkflowDocument[]): Promise<GraphBackendWorkflowSummary[]>;
113
135
  /**
114
136
  * Reads a single already-deployed Dagster job through the client port and maps
115
137
  * its ACTUAL deployment structure (graph/op structure, asset keys,
116
138
  * schedules/sensors) into the canonical document shape.
117
139
  *
140
+ * The real deployment is authoritative on an id collision (F6): when the
141
+ * deployment defines a job whose name matches the requested id, the deployment
142
+ * job is served even if a seeded fixture shares that id, so a real job can never
143
+ * be shadowed by the boot seed. A seeded document is returned only for ids the
144
+ * deployment does not define (or when no client port is wired).
145
+ *
118
146
  * @param workflowId - The canonical workflow id (the Dagster job name).
119
- * @returns A canonical document describing the existing job.
120
- * @throws {GraphExecutionError} when the client port exposes no job lookup.
147
+ * @returns A canonical document describing the existing job, or the seeded fixture.
148
+ * @throws {GraphExecutionError} when no client is wired and the id is not seeded, or when the client port exposes no job lookup.
121
149
  */
122
150
  getWorkflow(workflowId: string): Promise<GraphWorkflowDocument>;
151
+ /**
152
+ * Whether the Dagster deployment defines a job with the given id (F6). Resolves
153
+ * an id collision between a seeded fixture and a real deployment job in favour
154
+ * of the deployment. Fails safe to `false` when the port exposes no job listing
155
+ * or the listing cannot be read, so an unavailable listing never hides the
156
+ * seeded catalogue.
157
+ */
158
+ private deploymentDefinesJob;
123
159
  /**
124
160
  * Reads an EXISTING Dagster run's terminal record through the client port.
125
161
  *
@@ -0,0 +1,231 @@
1
+ /**
2
+ * @module as-graph/dagster/DagsterGraphQLClient
3
+ * @summary Real, read-only Dagster GraphQL client implementing the driver's
4
+ * `DagsterClient` port (SAA-306, SAA-706).
5
+ * @description A thin transport that implements the production `DagsterClient`
6
+ * port against a real `dagster-webserver` GraphQL endpoint. It is the only piece
7
+ * of the host that talks to Dagster, so a bootable Dagster host (see
8
+ * `@decaf-ts/as-graph/nest`) can list and inspect an already-deployed deployment.
9
+ * It exposes **no authoring method**: it
10
+ * never emits Python and never registers a job/op. It does implement the port's
11
+ * gated execution surface (`launchRun` of an already-deployed job and
12
+ * `replayRun` of an existing run via Dagster's `launchRunReexecution`), exactly as
13
+ * a host would wire its own transport; the production driver only calls those when
14
+ * its explicit `executionEnabled` gate is on.
15
+ *
16
+ * The client maps the raw GraphQL event vocabulary onto the driver's documented
17
+ * `DagsterEventRecord` contract. Dagster emits far more step-scoped telemetry
18
+ * (`STEP_WORKER_STARTING`, `RESOURCE_INIT_STARTED`, `LOADED_INPUT`, ...) than
19
+ * the canonical event map the driver consumes; those non-graph-transition events
20
+ * are engine telemetry and are intentionally not forwarded, matching the driver's
21
+ * allowlist posture. Only the documented graph-transition event types
22
+ * (`STEP_START`/`STEP_SUCCESS`/`STEP_FAILURE`/`STEP_SKIPPED`/`STEP_OUTPUT` and
23
+ * the run-level terminal events) are surfaced.
24
+ */
25
+ import type { DagsterClient, DagsterEventRecord, DagsterJobRecord, DagsterJobSummary, DagsterLaunchedRun, DagsterLaunchRunRequest, DagsterReplayRunRequest, DagsterRunRecord, DagsterRunSubscription, DagsterRunSubscriptionOptions } from "./DagsterTypes.d.cts";
26
+ /**
27
+ * The fetch implementation a {@link DagsterGraphQLClient} transport is constructed
28
+ * with: the global `fetch` signature. It is named so the type is expressible in
29
+ * JSDoc — a bare `typeof fetch` member type is not parseable — and so a host can
30
+ * inject a stub in tests without changing the transport.
31
+ */
32
+ export type FetchImpl = typeof fetch;
33
+ /** Options for constructing a {@link DagsterGraphQLClient}. */
34
+ export interface DagsterGraphQLClientOptions {
35
+ /** Absolute GraphQL endpoint URL, e.g. `http://127.0.0.1:3300/graphql`. */
36
+ url: string;
37
+ /** Fetch implementation; defaults to the global `fetch`. */
38
+ fetchImpl?: FetchImpl;
39
+ /** Per-request timeout in milliseconds. Defaults to `15000`. */
40
+ requestTimeoutMs?: number;
41
+ /** Repository (code location) selector name. Defaults to `__repository__`. */
42
+ repositoryName?: string;
43
+ /** Repository location name. Defaults to `definitions.py`. */
44
+ repositoryLocationName?: string;
45
+ }
46
+ /**
47
+ * Real, read-only Dagster GraphQL client implementing the production
48
+ * `DagsterClient` port. It never authors a workflow or launches a run.
49
+ */
50
+ export declare class DagsterGraphQLClient implements DagsterClient {
51
+ private readonly url;
52
+ private readonly fetchImpl;
53
+ private readonly requestTimeoutMs;
54
+ private readonly repositoryName;
55
+ private readonly repositoryLocationName;
56
+ /**
57
+ * @param options - Endpoint URL, fetch implementation, timeout, and repository
58
+ * selector.
59
+ */
60
+ constructor(options: DagsterGraphQLClientOptions);
61
+ /**
62
+ * Sends a GraphQL operation and unwraps the `data` envelope, failing loudly
63
+ * on transport, HTTP, or GraphQL errors.
64
+ *
65
+ * @typeParam T - The expected `data` shape.
66
+ * @param query - The GraphQL document.
67
+ * @param variables - Optional operation variables.
68
+ * @param signal - Optional caller signal composed with the request timeout.
69
+ * @returns The response `data`.
70
+ */
71
+ private request;
72
+ /**
73
+ * Lists every already-deployed Dagster job across the served repositories.
74
+ *
75
+ * @returns The deployed job summaries.
76
+ */
77
+ listJobs(): Promise<DagsterJobSummary[]>;
78
+ /**
79
+ * Reads a single already-deployed Dagster job, including its real graph
80
+ * structure (ops, dependencies, asset keys, schedules, sensors).
81
+ *
82
+ * @param jobName - The Dagster job name.
83
+ * @returns The inspected job record.
84
+ */
85
+ getJob(jobName: string): Promise<DagsterJobRecord>;
86
+ /**
87
+ * Replays the recorded event stream of an EXISTING Dagster run and invokes the
88
+ * handler for every documented graph-transition event. The client never launches
89
+ * a run; it only reads a run that already exists.
90
+ *
91
+ * @param runId - The Dagster run id.
92
+ * @param handler - The per-event callback.
93
+ * @param options - Optional signal/event/page bounds.
94
+ * @returns A subscription handle.
95
+ * @throws {GraphExecutionError} `GRAPH_DAGSTER_OBSERVE_ABORTED` when the signal
96
+ * is already aborted before or during the event replay,
97
+ * `GRAPH_DAGSTER_PAGE_LIMIT_EXCEEDED` when the page cap is hit, or
98
+ * `GRAPH_DAGSTER_EVENT_LIMIT_EXCEEDED` when the event cap is hit.
99
+ */
100
+ subscribeRun(runId: string, handler: (event: DagsterEventRecord) => void, options?: DagsterRunSubscriptionOptions): Promise<DagsterRunSubscription>;
101
+ /**
102
+ * Terminates an EXISTING Dagster run through the GraphQL mutation.
103
+ *
104
+ * @param runId - The Dagster run id.
105
+ * @param reason - Optional termination reason (unused by Dagster).
106
+ */
107
+ terminateRun(runId: string, reason?: string): Promise<void>;
108
+ /**
109
+ * Launches a run of an ALREADY-DEPLOYED Dagster job through the real GraphQL
110
+ * `launchRun` mutation. The job must already exist in the deployment; no job or
111
+ * op is authored and no Python is emitted.
112
+ *
113
+ * @param request - The job name, optional raw run config, and optional tags.
114
+ * @returns The launched run's id and initial status.
115
+ */
116
+ launchRun(request: DagsterLaunchRunRequest): Promise<DagsterLaunchedRun>;
117
+ /**
118
+ * Re-executes an EXISTING Dagster run from its run id through the real GraphQL
119
+ * `launchRunReexecution` mutation (Dagster's re-execution surface). The parent
120
+ * run must already exist; no job or op is authored and no Python is emitted.
121
+ *
122
+ * @param request - The parent run id, its job name, and optional tags.
123
+ * @returns The re-executed run's id and initial status.
124
+ */
125
+ replayRun(request: DagsterReplayRunRequest): Promise<DagsterLaunchedRun>;
126
+ /**
127
+ * Builds the GraphQL `ExecutionParams` for a launch/re-execution: the job
128
+ * selector, optional raw run config, and optional run tags.
129
+ *
130
+ * @param jobName - The already-deployed job name.
131
+ * @param runConfig - Optional raw Dagster run config (forwarded verbatim).
132
+ * @param tags - Optional run tags.
133
+ * @returns The `ExecutionParams` input object.
134
+ */
135
+ private executionParams;
136
+ /**
137
+ * Unwraps a launch/re-execution result union into a run handle, failing loudly
138
+ * on a launch error.
139
+ *
140
+ * @param result - The raw launch result union.
141
+ * @param jobName - The job name, for error context.
142
+ * @returns The launched run's id and initial status.
143
+ */
144
+ private toLaunchedRun;
145
+ /**
146
+ * Reads an EXISTING Dagster run's terminal record.
147
+ *
148
+ * @param runId - The Dagster run id.
149
+ * @returns The terminal run record.
150
+ */
151
+ getRun(runId: string): Promise<DagsterRunRecord>;
152
+ /**
153
+ * Harness-only helper: lists the runs for a job (or every run when no job name
154
+ * is given) with their raw Dagster status. Not part of the `DagsterClient` port;
155
+ * it exists so the suite can discover a pre-existing terminal run (e.g. the
156
+ * `etl_pipeline` run materialized at startup) without launching one, and can
157
+ * count runs before/after an operation to prove no run was created.
158
+ *
159
+ * @param jobName - Optional Dagster job name filter.
160
+ * @returns The runs, with raw Dagster run status.
161
+ */
162
+ listRuns(jobName?: string): Promise<{
163
+ runId: string;
164
+ jobName: string;
165
+ status: string;
166
+ }[]>;
167
+ /**
168
+ * Harness-only helper: lists the ids of runs for a job (or every run when no
169
+ * job name is given). Not part of the `DagsterClient` port; it exists so the
170
+ * suite can discover a pre-existing run without launching one.
171
+ *
172
+ * @param jobName - Optional Dagster job name filter.
173
+ * @returns The run ids.
174
+ */
175
+ listRunIds(jobName?: string): Promise<string[]>;
176
+ /** Disposes the client; the fetch transport holds no resources. */
177
+ dispose(): void;
178
+ /**
179
+ * Paginates the run's recorded event stream, bounded by `maxPages` and
180
+ * `maxEvents` so a gateway whose `eventConnection` never reports
181
+ * `hasMore: false` cannot page or buffer without limit.
182
+ *
183
+ * @param runId - The Dagster run id.
184
+ * @param options - Optional signal/event/page bounds.
185
+ * @returns The raw events, in order.
186
+ * @throws {GraphExecutionError} `GRAPH_DAGSTER_PAGE_LIMIT_EXCEEDED` when the
187
+ * page cap is hit, or `GRAPH_DAGSTER_EVENT_LIMIT_EXCEEDED` when the event cap
188
+ * is hit.
189
+ */
190
+ private fetchRunEvents;
191
+ /**
192
+ * Maps a raw Dagster event onto the driver's documented `DagsterEventRecord`
193
+ * contract, filtering out non-graph-transition telemetry.
194
+ *
195
+ * @param event - The raw event.
196
+ * @returns The driver event record, or `undefined` when the event is engine
197
+ * telemetry the read-only driver does not consume.
198
+ */
199
+ private toEventRecord;
200
+ /**
201
+ * Maps a raw `Run` onto the driver's `DagsterRunRecord` contract.
202
+ *
203
+ * @param run - The raw run.
204
+ * @returns The driver run record.
205
+ */
206
+ private toRunRecord;
207
+ /**
208
+ * Maps a Dagster `RunStatus` onto the driver's terminal run status.
209
+ *
210
+ * @param status - The raw Dagster run status.
211
+ * @returns The driver run status.
212
+ */
213
+ private toRunStatus;
214
+ /**
215
+ * Maps a raw job plus its repository context onto the driver's
216
+ * `DagsterJobRecord` contract.
217
+ *
218
+ * @param job - The raw job.
219
+ * @param repository - The raw repository the job belongs to.
220
+ * @returns The inspected job record.
221
+ */
222
+ private toJobRecord;
223
+ /**
224
+ * Resolves the asset keys a job produces from the repository's asset nodes.
225
+ *
226
+ * @param jobName - The Dagster job name.
227
+ * @param assetNodes - The repository asset nodes.
228
+ * @returns The dotted asset keys.
229
+ */
230
+ private assetKeysFor;
231
+ }
@@ -0,0 +1,231 @@
1
+ /**
2
+ * @module as-graph/dagster/DagsterGraphQLClient
3
+ * @summary Real, read-only Dagster GraphQL client implementing the driver's
4
+ * `DagsterClient` port (SAA-306, SAA-706).
5
+ * @description A thin transport that implements the production `DagsterClient`
6
+ * port against a real `dagster-webserver` GraphQL endpoint. It is the only piece
7
+ * of the host that talks to Dagster, so a bootable Dagster host (see
8
+ * `@decaf-ts/as-graph/nest`) can list and inspect an already-deployed deployment.
9
+ * It exposes **no authoring method**: it
10
+ * never emits Python and never registers a job/op. It does implement the port's
11
+ * gated execution surface (`launchRun` of an already-deployed job and
12
+ * `replayRun` of an existing run via Dagster's `launchRunReexecution`), exactly as
13
+ * a host would wire its own transport; the production driver only calls those when
14
+ * its explicit `executionEnabled` gate is on.
15
+ *
16
+ * The client maps the raw GraphQL event vocabulary onto the driver's documented
17
+ * `DagsterEventRecord` contract. Dagster emits far more step-scoped telemetry
18
+ * (`STEP_WORKER_STARTING`, `RESOURCE_INIT_STARTED`, `LOADED_INPUT`, ...) than
19
+ * the canonical event map the driver consumes; those non-graph-transition events
20
+ * are engine telemetry and are intentionally not forwarded, matching the driver's
21
+ * allowlist posture. Only the documented graph-transition event types
22
+ * (`STEP_START`/`STEP_SUCCESS`/`STEP_FAILURE`/`STEP_SKIPPED`/`STEP_OUTPUT` and
23
+ * the run-level terminal events) are surfaced.
24
+ */
25
+ import type { DagsterClient, DagsterEventRecord, DagsterJobRecord, DagsterJobSummary, DagsterLaunchedRun, DagsterLaunchRunRequest, DagsterReplayRunRequest, DagsterRunRecord, DagsterRunSubscription, DagsterRunSubscriptionOptions } from "./DagsterTypes.d.mts";
26
+ /**
27
+ * The fetch implementation a {@link DagsterGraphQLClient} transport is constructed
28
+ * with: the global `fetch` signature. It is named so the type is expressible in
29
+ * JSDoc — a bare `typeof fetch` member type is not parseable — and so a host can
30
+ * inject a stub in tests without changing the transport.
31
+ */
32
+ export type FetchImpl = typeof fetch;
33
+ /** Options for constructing a {@link DagsterGraphQLClient}. */
34
+ export interface DagsterGraphQLClientOptions {
35
+ /** Absolute GraphQL endpoint URL, e.g. `http://127.0.0.1:3300/graphql`. */
36
+ url: string;
37
+ /** Fetch implementation; defaults to the global `fetch`. */
38
+ fetchImpl?: FetchImpl;
39
+ /** Per-request timeout in milliseconds. Defaults to `15000`. */
40
+ requestTimeoutMs?: number;
41
+ /** Repository (code location) selector name. Defaults to `__repository__`. */
42
+ repositoryName?: string;
43
+ /** Repository location name. Defaults to `definitions.py`. */
44
+ repositoryLocationName?: string;
45
+ }
46
+ /**
47
+ * Real, read-only Dagster GraphQL client implementing the production
48
+ * `DagsterClient` port. It never authors a workflow or launches a run.
49
+ */
50
+ export declare class DagsterGraphQLClient implements DagsterClient {
51
+ private readonly url;
52
+ private readonly fetchImpl;
53
+ private readonly requestTimeoutMs;
54
+ private readonly repositoryName;
55
+ private readonly repositoryLocationName;
56
+ /**
57
+ * @param options - Endpoint URL, fetch implementation, timeout, and repository
58
+ * selector.
59
+ */
60
+ constructor(options: DagsterGraphQLClientOptions);
61
+ /**
62
+ * Sends a GraphQL operation and unwraps the `data` envelope, failing loudly
63
+ * on transport, HTTP, or GraphQL errors.
64
+ *
65
+ * @typeParam T - The expected `data` shape.
66
+ * @param query - The GraphQL document.
67
+ * @param variables - Optional operation variables.
68
+ * @param signal - Optional caller signal composed with the request timeout.
69
+ * @returns The response `data`.
70
+ */
71
+ private request;
72
+ /**
73
+ * Lists every already-deployed Dagster job across the served repositories.
74
+ *
75
+ * @returns The deployed job summaries.
76
+ */
77
+ listJobs(): Promise<DagsterJobSummary[]>;
78
+ /**
79
+ * Reads a single already-deployed Dagster job, including its real graph
80
+ * structure (ops, dependencies, asset keys, schedules, sensors).
81
+ *
82
+ * @param jobName - The Dagster job name.
83
+ * @returns The inspected job record.
84
+ */
85
+ getJob(jobName: string): Promise<DagsterJobRecord>;
86
+ /**
87
+ * Replays the recorded event stream of an EXISTING Dagster run and invokes the
88
+ * handler for every documented graph-transition event. The client never launches
89
+ * a run; it only reads a run that already exists.
90
+ *
91
+ * @param runId - The Dagster run id.
92
+ * @param handler - The per-event callback.
93
+ * @param options - Optional signal/event/page bounds.
94
+ * @returns A subscription handle.
95
+ * @throws {GraphExecutionError} `GRAPH_DAGSTER_OBSERVE_ABORTED` when the signal
96
+ * is already aborted before or during the event replay,
97
+ * `GRAPH_DAGSTER_PAGE_LIMIT_EXCEEDED` when the page cap is hit, or
98
+ * `GRAPH_DAGSTER_EVENT_LIMIT_EXCEEDED` when the event cap is hit.
99
+ */
100
+ subscribeRun(runId: string, handler: (event: DagsterEventRecord) => void, options?: DagsterRunSubscriptionOptions): Promise<DagsterRunSubscription>;
101
+ /**
102
+ * Terminates an EXISTING Dagster run through the GraphQL mutation.
103
+ *
104
+ * @param runId - The Dagster run id.
105
+ * @param reason - Optional termination reason (unused by Dagster).
106
+ */
107
+ terminateRun(runId: string, reason?: string): Promise<void>;
108
+ /**
109
+ * Launches a run of an ALREADY-DEPLOYED Dagster job through the real GraphQL
110
+ * `launchRun` mutation. The job must already exist in the deployment; no job or
111
+ * op is authored and no Python is emitted.
112
+ *
113
+ * @param request - The job name, optional raw run config, and optional tags.
114
+ * @returns The launched run's id and initial status.
115
+ */
116
+ launchRun(request: DagsterLaunchRunRequest): Promise<DagsterLaunchedRun>;
117
+ /**
118
+ * Re-executes an EXISTING Dagster run from its run id through the real GraphQL
119
+ * `launchRunReexecution` mutation (Dagster's re-execution surface). The parent
120
+ * run must already exist; no job or op is authored and no Python is emitted.
121
+ *
122
+ * @param request - The parent run id, its job name, and optional tags.
123
+ * @returns The re-executed run's id and initial status.
124
+ */
125
+ replayRun(request: DagsterReplayRunRequest): Promise<DagsterLaunchedRun>;
126
+ /**
127
+ * Builds the GraphQL `ExecutionParams` for a launch/re-execution: the job
128
+ * selector, optional raw run config, and optional run tags.
129
+ *
130
+ * @param jobName - The already-deployed job name.
131
+ * @param runConfig - Optional raw Dagster run config (forwarded verbatim).
132
+ * @param tags - Optional run tags.
133
+ * @returns The `ExecutionParams` input object.
134
+ */
135
+ private executionParams;
136
+ /**
137
+ * Unwraps a launch/re-execution result union into a run handle, failing loudly
138
+ * on a launch error.
139
+ *
140
+ * @param result - The raw launch result union.
141
+ * @param jobName - The job name, for error context.
142
+ * @returns The launched run's id and initial status.
143
+ */
144
+ private toLaunchedRun;
145
+ /**
146
+ * Reads an EXISTING Dagster run's terminal record.
147
+ *
148
+ * @param runId - The Dagster run id.
149
+ * @returns The terminal run record.
150
+ */
151
+ getRun(runId: string): Promise<DagsterRunRecord>;
152
+ /**
153
+ * Harness-only helper: lists the runs for a job (or every run when no job name
154
+ * is given) with their raw Dagster status. Not part of the `DagsterClient` port;
155
+ * it exists so the suite can discover a pre-existing terminal run (e.g. the
156
+ * `etl_pipeline` run materialized at startup) without launching one, and can
157
+ * count runs before/after an operation to prove no run was created.
158
+ *
159
+ * @param jobName - Optional Dagster job name filter.
160
+ * @returns The runs, with raw Dagster run status.
161
+ */
162
+ listRuns(jobName?: string): Promise<{
163
+ runId: string;
164
+ jobName: string;
165
+ status: string;
166
+ }[]>;
167
+ /**
168
+ * Harness-only helper: lists the ids of runs for a job (or every run when no
169
+ * job name is given). Not part of the `DagsterClient` port; it exists so the
170
+ * suite can discover a pre-existing run without launching one.
171
+ *
172
+ * @param jobName - Optional Dagster job name filter.
173
+ * @returns The run ids.
174
+ */
175
+ listRunIds(jobName?: string): Promise<string[]>;
176
+ /** Disposes the client; the fetch transport holds no resources. */
177
+ dispose(): void;
178
+ /**
179
+ * Paginates the run's recorded event stream, bounded by `maxPages` and
180
+ * `maxEvents` so a gateway whose `eventConnection` never reports
181
+ * `hasMore: false` cannot page or buffer without limit.
182
+ *
183
+ * @param runId - The Dagster run id.
184
+ * @param options - Optional signal/event/page bounds.
185
+ * @returns The raw events, in order.
186
+ * @throws {GraphExecutionError} `GRAPH_DAGSTER_PAGE_LIMIT_EXCEEDED` when the
187
+ * page cap is hit, or `GRAPH_DAGSTER_EVENT_LIMIT_EXCEEDED` when the event cap
188
+ * is hit.
189
+ */
190
+ private fetchRunEvents;
191
+ /**
192
+ * Maps a raw Dagster event onto the driver's documented `DagsterEventRecord`
193
+ * contract, filtering out non-graph-transition telemetry.
194
+ *
195
+ * @param event - The raw event.
196
+ * @returns The driver event record, or `undefined` when the event is engine
197
+ * telemetry the read-only driver does not consume.
198
+ */
199
+ private toEventRecord;
200
+ /**
201
+ * Maps a raw `Run` onto the driver's `DagsterRunRecord` contract.
202
+ *
203
+ * @param run - The raw run.
204
+ * @returns The driver run record.
205
+ */
206
+ private toRunRecord;
207
+ /**
208
+ * Maps a Dagster `RunStatus` onto the driver's terminal run status.
209
+ *
210
+ * @param status - The raw Dagster run status.
211
+ * @returns The driver run status.
212
+ */
213
+ private toRunStatus;
214
+ /**
215
+ * Maps a raw job plus its repository context onto the driver's
216
+ * `DagsterJobRecord` contract.
217
+ *
218
+ * @param job - The raw job.
219
+ * @param repository - The raw repository the job belongs to.
220
+ * @returns The inspected job record.
221
+ */
222
+ private toJobRecord;
223
+ /**
224
+ * Resolves the asset keys a job produces from the repository's asset nodes.
225
+ *
226
+ * @param jobName - The Dagster job name.
227
+ * @param assetNodes - The repository asset nodes.
228
+ * @returns The dotted asset keys.
229
+ */
230
+ private assetKeysFor;
231
+ }
@@ -9,6 +9,7 @@
9
9
  export * from "./constants.d.cts";
10
10
  export * from "./DagsterTypes.d.cts";
11
11
  export * from "./capabilities.d.cts";
12
+ export * from "./DagsterGraphQLClient.d.cts";
12
13
  export * from "./DagsterGraphEventBridge.d.cts";
13
14
  export * from "./DagsterResultMapper.d.cts";
14
15
  export * from "./DagsterGraphExecutionBackend.d.cts";
@@ -9,6 +9,7 @@
9
9
  export * from "./constants.d.mts";
10
10
  export * from "./DagsterTypes.d.mts";
11
11
  export * from "./capabilities.d.mts";
12
+ export * from "./DagsterGraphQLClient.d.mts";
12
13
  export * from "./DagsterGraphEventBridge.d.mts";
13
14
  export * from "./DagsterResultMapper.d.mts";
14
15
  export * from "./DagsterGraphExecutionBackend.d.mts";