@dudousxd/nestjs-catalog 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog.events.d.ts +14 -0
- package/dist/catalog.pipeline.d.ts +1124 -75
- package/dist/catalog.pipeline.js +1150 -14
- package/dist/catalog.stage-encoding.d.ts +185 -0
- package/dist/catalog.stage-encoding.js +314 -0
- package/dist/client.d.ts +14 -4
- package/dist/client.js +85 -12
- package/dist/index.d.ts +2 -1
- package/dist/index.js +48 -3
- package/dist/transform-runner.d.ts +19 -1
- package/dist/transform-runner.js +63 -7
- package/package.json +6 -6
- package/LICENSE +0 -21
package/dist/client.js
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* types are.
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports.isWorkflowFilterValue = exports.isWorkflowFilterPredicateKind = exports.isWorkflowFilterPredicate = exports.isWorkflowFilterOperator = exports.isWorkflowBranchLabel = exports.WORKFLOW_SKIP_REASONS = exports.WORKFLOW_FILTER_PREDICATE_KINDS = exports.WORKFLOW_FILTER_OPERATORS = exports.WORKFLOW_FILTER_MAX_VALUES = exports.WORKFLOW_FILTER_MAX_DEPTH = exports.WORKFLOW_FILTER_COLUMN_PATTERN = exports.WORKFLOW_PREDICATE_KINDS = exports.WORKFLOW_BRANCH_LABELS = exports.WORKFLOW_NODE_KINDS = exports.WORKFLOW_NODE_ID_PATTERN = exports.WORKFLOW_ISSUE_CODES = exports.WORKFLOW_EXECUTION_MODES = exports.validateWorkflow = exports.workflowRowY = exports.workflowColumnX = exports.WORKFLOW_ROW_GAP = exports.WORKFLOW_NODE_WIDTH = exports.WORKFLOW_NODE_HEIGHT = exports.WORKFLOW_COLUMN_GAP = exports.WORKFLOW_CALL_CONTRACT = exports.readWorkflowCallOutput = exports.TRANSFORM_LANGUAGES = exports.REDACTED_SECRET = exports.isWorkflowNode = exports.isWorkflowEdge = exports.isTransformLanguage = exports.isConnectorKind = exports.CONNECTOR_KINDS = exports.catalogRoutes = exports.UnsafeIdentifierError = exports.physicalColumn = exports.outputAlias = exports.isSafeIdentifier = exports.VALUELESS_FILTER_OPERATORS = exports.resolveObjectFilters = exports.parseObjectFilter = exports.offeredFilterOperators = exports.isCatalogFilterOperator = exports.filterOperatorsFor = exports.filterOperatorTakesValue = exports.encodeObjectFilter = exports.coerceFilterValue = exports.CATALOG_FILTER_OPERATORS = exports.CATALOG_FILTER_LIMIT = exports.CATALOG_REVISION_LIMIT = void 0;
|
|
15
|
+
exports.DELETE_RECONCILIATION_STRATEGIES = exports.callableWorkflowBlock = exports.isWorkflowStatus = exports.isWorkflowNodeKind = exports.isWorkflowExecutionMode = exports.workflowRunOrder = exports.workflowGraphHash = exports.WORKFLOW_STATUSES = exports.unreachablePredicateKind = exports.unreachableNodeKind = exports.unreachableFilterPredicateKind = exports.unreachableFilterOperator = exports.workflowNodeRuns = exports.workflowNarrowedTypes = exports.workflowFilterMatches = exports.isWorkflowSkipReason = exports.isWorkflowPredicateKind = exports.isWorkflowIfPredicate = void 0;
|
|
15
16
|
exports.isDeleteReconciliationStrategy = isDeleteReconciliationStrategy;
|
|
16
17
|
exports.pipelineExpectationRoutes = pipelineExpectationRoutes;
|
|
17
18
|
// A value, not a type: a screen saying how far back the history goes should read
|
|
@@ -140,6 +141,11 @@ Object.defineProperty(exports, "isTransformLanguage", { enumerable: true, get: f
|
|
|
140
141
|
// drift this entry point exists to prevent.
|
|
141
142
|
Object.defineProperty(exports, "isWorkflowEdge", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowEdge; } });
|
|
142
143
|
Object.defineProperty(exports, "isWorkflowNode", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowNode; } });
|
|
144
|
+
// What a redacted password reads as. A form that lets somebody paste an
|
|
145
|
+
// address has to recognise the string a read showed them, or it posts the
|
|
146
|
+
// placeholder back as the password on a connection that has no stored row to
|
|
147
|
+
// restore the real one from.
|
|
148
|
+
Object.defineProperty(exports, "REDACTED_SECRET", { enumerable: true, get: function () { return catalog_pipeline_1.REDACTED_SECRET; } });
|
|
143
149
|
Object.defineProperty(exports, "TRANSFORM_LANGUAGES", { enumerable: true, get: function () { return catalog_pipeline_1.TRANSFORM_LANGUAGES; } });
|
|
144
150
|
// A screen that shows what a call node got back narrows it the same way the
|
|
145
151
|
// runner does, so the two cannot disagree about what "no rows" looks like.
|
|
@@ -162,24 +168,91 @@ Object.defineProperty(exports, "WORKFLOW_CALL_CONTRACT", { enumerable: true, get
|
|
|
162
168
|
* `WORKFLOW_NODE_ID_PATTERN` and `WORKFLOW_NODE_KINDS` are what a palette and an
|
|
163
169
|
* id field should be built from rather than from a second copy that drifts.
|
|
164
170
|
*/
|
|
171
|
+
/**
|
|
172
|
+
* The canvas's geometry, from the same place the server lays a graph out.
|
|
173
|
+
*
|
|
174
|
+
* On this entry point rather than only on the package root because the two
|
|
175
|
+
* things that must agree are a browser component and a store: the node draws
|
|
176
|
+
* itself {@link WORKFLOW_NODE_WIDTH} wide, and `adoptConnector` spaces columns
|
|
177
|
+
* with {@link workflowColumnX}. A second copy of either number is how a graph
|
|
178
|
+
* ends up drawn with its boxes overlapping — which is exactly what happened.
|
|
179
|
+
*/
|
|
165
180
|
var catalog_pipeline_2 = require("./catalog.pipeline");
|
|
166
|
-
Object.defineProperty(exports, "
|
|
167
|
-
Object.defineProperty(exports, "
|
|
168
|
-
Object.defineProperty(exports, "
|
|
169
|
-
Object.defineProperty(exports, "
|
|
170
|
-
Object.defineProperty(exports, "
|
|
181
|
+
Object.defineProperty(exports, "WORKFLOW_COLUMN_GAP", { enumerable: true, get: function () { return catalog_pipeline_2.WORKFLOW_COLUMN_GAP; } });
|
|
182
|
+
Object.defineProperty(exports, "WORKFLOW_NODE_HEIGHT", { enumerable: true, get: function () { return catalog_pipeline_2.WORKFLOW_NODE_HEIGHT; } });
|
|
183
|
+
Object.defineProperty(exports, "WORKFLOW_NODE_WIDTH", { enumerable: true, get: function () { return catalog_pipeline_2.WORKFLOW_NODE_WIDTH; } });
|
|
184
|
+
Object.defineProperty(exports, "WORKFLOW_ROW_GAP", { enumerable: true, get: function () { return catalog_pipeline_2.WORKFLOW_ROW_GAP; } });
|
|
185
|
+
Object.defineProperty(exports, "workflowColumnX", { enumerable: true, get: function () { return catalog_pipeline_2.workflowColumnX; } });
|
|
186
|
+
Object.defineProperty(exports, "workflowRowY", { enumerable: true, get: function () { return catalog_pipeline_2.workflowRowY; } });
|
|
187
|
+
var catalog_pipeline_3 = require("./catalog.pipeline");
|
|
188
|
+
Object.defineProperty(exports, "validateWorkflow", { enumerable: true, get: function () { return catalog_pipeline_3.validateWorkflow; } });
|
|
189
|
+
Object.defineProperty(exports, "WORKFLOW_EXECUTION_MODES", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_EXECUTION_MODES; } });
|
|
190
|
+
Object.defineProperty(exports, "WORKFLOW_ISSUE_CODES", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_ISSUE_CODES; } });
|
|
191
|
+
Object.defineProperty(exports, "WORKFLOW_NODE_ID_PATTERN", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_NODE_ID_PATTERN; } });
|
|
192
|
+
Object.defineProperty(exports, "WORKFLOW_NODE_KINDS", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_NODE_KINDS; } });
|
|
193
|
+
// The branch vocabulary, for the same reason as the kinds beside it: a canvas
|
|
194
|
+
// that has to draw a then and an else must read the two labels from here, or
|
|
195
|
+
// it keeps a copy and the copy is what eventually spells one of them wrong —
|
|
196
|
+
// which is a subtree that silently never runs.
|
|
197
|
+
Object.defineProperty(exports, "WORKFLOW_BRANCH_LABELS", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_BRANCH_LABELS; } });
|
|
198
|
+
// The predicate vocabulary, same argument one level down: an inspector that
|
|
199
|
+
// offers "environment variable" or "row count" has to offer exactly the kinds
|
|
200
|
+
// the validator and the runner know, and the exhaustiveness helper is what
|
|
201
|
+
// makes a form missing one a build failure rather than a gate somebody can
|
|
202
|
+
// save with nothing to decide on.
|
|
203
|
+
Object.defineProperty(exports, "WORKFLOW_PREDICATE_KINDS", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_PREDICATE_KINDS; } });
|
|
204
|
+
// The filter language, same argument again and for higher stakes: an
|
|
205
|
+
// inspector that offers an operator the runner cannot evaluate is a graph
|
|
206
|
+
// somebody saves and a step that throws mid-load, and one that quietly omits
|
|
207
|
+
// an operator is a filter nobody can express. The bounds travel with them
|
|
208
|
+
// because the form has to refuse a too-deep tree or a too-long list *before*
|
|
209
|
+
// the server does, and a second copy of the numbers is what drifts.
|
|
210
|
+
Object.defineProperty(exports, "WORKFLOW_FILTER_COLUMN_PATTERN", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_FILTER_COLUMN_PATTERN; } });
|
|
211
|
+
Object.defineProperty(exports, "WORKFLOW_FILTER_MAX_DEPTH", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_FILTER_MAX_DEPTH; } });
|
|
212
|
+
Object.defineProperty(exports, "WORKFLOW_FILTER_MAX_VALUES", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_FILTER_MAX_VALUES; } });
|
|
213
|
+
Object.defineProperty(exports, "WORKFLOW_FILTER_OPERATORS", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_FILTER_OPERATORS; } });
|
|
214
|
+
Object.defineProperty(exports, "WORKFLOW_FILTER_PREDICATE_KINDS", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_FILTER_PREDICATE_KINDS; } });
|
|
215
|
+
Object.defineProperty(exports, "WORKFLOW_SKIP_REASONS", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_SKIP_REASONS; } });
|
|
216
|
+
Object.defineProperty(exports, "isWorkflowBranchLabel", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowBranchLabel; } });
|
|
217
|
+
Object.defineProperty(exports, "isWorkflowFilterOperator", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowFilterOperator; } });
|
|
218
|
+
Object.defineProperty(exports, "isWorkflowFilterPredicate", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowFilterPredicate; } });
|
|
219
|
+
Object.defineProperty(exports, "isWorkflowFilterPredicateKind", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowFilterPredicateKind; } });
|
|
220
|
+
Object.defineProperty(exports, "isWorkflowFilterValue", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowFilterValue; } });
|
|
221
|
+
Object.defineProperty(exports, "isWorkflowIfPredicate", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowIfPredicate; } });
|
|
222
|
+
Object.defineProperty(exports, "isWorkflowPredicateKind", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowPredicateKind; } });
|
|
223
|
+
Object.defineProperty(exports, "isWorkflowSkipReason", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowSkipReason; } });
|
|
224
|
+
// The row test itself, so the inspector can describe — and a host can preview
|
|
225
|
+
// — exactly what a load will keep, from the function that decides it.
|
|
226
|
+
Object.defineProperty(exports, "workflowFilterMatches", { enumerable: true, get: function () { return catalog_pipeline_3.workflowFilterMatches; } });
|
|
227
|
+
// Which published types a filter stands in front of. The console has to offer
|
|
228
|
+
// the same acknowledgements the validator requires, and a canvas computing its
|
|
229
|
+
// own answer would offer a set the server then refuses.
|
|
230
|
+
Object.defineProperty(exports, "workflowNarrowedTypes", { enumerable: true, get: function () { return catalog_pipeline_3.workflowNarrowedTypes; } });
|
|
231
|
+
// Exported so a screen can answer "would this node have run" from a recorded
|
|
232
|
+
// run exactly the way the runner decided it, rather than approximating.
|
|
233
|
+
Object.defineProperty(exports, "workflowNodeRuns", { enumerable: true, get: function () { return catalog_pipeline_3.workflowNodeRuns; } });
|
|
234
|
+
Object.defineProperty(exports, "unreachableFilterOperator", { enumerable: true, get: function () { return catalog_pipeline_3.unreachableFilterOperator; } });
|
|
235
|
+
Object.defineProperty(exports, "unreachableFilterPredicateKind", { enumerable: true, get: function () { return catalog_pipeline_3.unreachableFilterPredicateKind; } });
|
|
236
|
+
Object.defineProperty(exports, "unreachableNodeKind", { enumerable: true, get: function () { return catalog_pipeline_3.unreachableNodeKind; } });
|
|
237
|
+
Object.defineProperty(exports, "unreachablePredicateKind", { enumerable: true, get: function () { return catalog_pipeline_3.unreachablePredicateKind; } });
|
|
171
238
|
// The draft/ready pair, for the same reason as the list above: a canvas that
|
|
172
239
|
// cannot see it restates it, and the copy is what drifts. Without this the
|
|
173
240
|
// editor could not tell a graph it is allowed to store from one the server
|
|
174
241
|
// would refuse — so it told everybody the second, which is wrong for every
|
|
175
242
|
// draft and is exactly the kind of confident-and-false sentence this codebase
|
|
176
243
|
// keeps removing.
|
|
177
|
-
Object.defineProperty(exports, "WORKFLOW_STATUSES", { enumerable: true, get: function () { return
|
|
178
|
-
Object.defineProperty(exports, "workflowGraphHash", { enumerable: true, get: function () { return
|
|
179
|
-
Object.defineProperty(exports, "workflowRunOrder", { enumerable: true, get: function () { return
|
|
180
|
-
Object.defineProperty(exports, "isWorkflowExecutionMode", { enumerable: true, get: function () { return
|
|
181
|
-
Object.defineProperty(exports, "isWorkflowNodeKind", { enumerable: true, get: function () { return
|
|
182
|
-
Object.defineProperty(exports, "isWorkflowStatus", { enumerable: true, get: function () { return
|
|
244
|
+
Object.defineProperty(exports, "WORKFLOW_STATUSES", { enumerable: true, get: function () { return catalog_pipeline_3.WORKFLOW_STATUSES; } });
|
|
245
|
+
Object.defineProperty(exports, "workflowGraphHash", { enumerable: true, get: function () { return catalog_pipeline_3.workflowGraphHash; } });
|
|
246
|
+
Object.defineProperty(exports, "workflowRunOrder", { enumerable: true, get: function () { return catalog_pipeline_3.workflowRunOrder; } });
|
|
247
|
+
Object.defineProperty(exports, "isWorkflowExecutionMode", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowExecutionMode; } });
|
|
248
|
+
Object.defineProperty(exports, "isWorkflowNodeKind", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowNodeKind; } });
|
|
249
|
+
Object.defineProperty(exports, "isWorkflowStatus", { enumerable: true, get: function () { return catalog_pipeline_3.isWorkflowStatus; } });
|
|
250
|
+
// The rule that decides whether an announced workflow may be committed onto a
|
|
251
|
+
// call node, for the same reason `validateWorkflow` is here: the picker greys
|
|
252
|
+
// an option out and the server reasons about the same list, and a picker with
|
|
253
|
+
// its own copy of the rule is one that eventually offers an entry the rest of
|
|
254
|
+
// the system considers unusable.
|
|
255
|
+
Object.defineProperty(exports, "callableWorkflowBlock", { enumerable: true, get: function () { return catalog_pipeline_3.callableWorkflowBlock; } });
|
|
183
256
|
/**
|
|
184
257
|
* The three answers to "how do deletions at the source reach this type", as a
|
|
185
258
|
* value.
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ export { type CatalogOverlayStore, FileCatalogOverlayStore, InMemoryCatalogOverl
|
|
|
8
8
|
export { CATALOG_OVERLAY_STORE } from './catalog.overlay-store.token';
|
|
9
9
|
export { MikroOrmCatalogRegistry } from './catalog.registry';
|
|
10
10
|
export { CatalogRegistry } from './catalog.registry.base';
|
|
11
|
-
export { CATALOG_PIPELINE_STORE, type CatalogConnection, type CatalogConnector, type ConnectionCheck, CONNECTOR_KINDS, type CatalogLoadExpectations, type CatalogLoadExpectationStore, type CatalogPipelineStore, type CatalogStageStore, type CatalogTransform, type CatalogWorkflow, type CatalogWorkflowCapabilities, type CatalogWorkflowStore, type CallableWorkflowRef, type ConnectorKind, type ConnectorRun, type DeleteReconciliation, isConnectorKind, isPipelineStore, isTransformLanguage, type LoadExpectation, type RowCountBound, type StoredLoadExpectation, readWorkflowCallOutput, supportsLoadExpectations, supportsTransformRevisions, isWorkflowEdge, isWorkflowExecutionMode, isWorkflowNode, isWorkflowNodeKind, isWorkflowStatus, supportsWorkflows, supportsWorkflowStages, TRANSFORM_RUNNER, TRANSFORM_LANGUAGES, type TransformLanguage, type TransformResult, type TransformRunner, validateWorkflow, WORKFLOW_CALL_CONTRACT, WORKFLOW_EXECUTION_MODES, WORKFLOW_ISSUE_CODES, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, WORKFLOW_STATUSES, type WorkflowCallEnvelope, type WorkflowCallNode, type WorkflowCallOutput, type WorkflowEdge, type WorkflowExecutionMode, type WorkflowGraph, workflowGraphHash, type WorkflowIssueCode, type WorkflowNode, type WorkflowNodeKind, type WorkflowNodeOutcome, type WorkflowNodeStepInput, type WorkflowNodeStepOutput, workflowRunOrder, type WorkflowSinkNode, type WorkflowSourceNode, type WorkflowStageRef, type WorkflowStatus, type WorkflowTransformNode, type WorkflowValidationIssue, } from './catalog.pipeline';
|
|
11
|
+
export { CATALOG_PIPELINE_STORE, CODE_CONTEXT_CONTRACT, type CatalogCodeContext, type CatalogConnection, type CatalogConnector, type ConnectionCheck, CONNECTOR_KINDS, type CatalogLoadExpectations, type CatalogLoadExpectationStore, type CatalogPipelineStore, type CatalogStageStore, type CatalogTransform, type CatalogWorkflow, type CatalogWorkflowCapabilities, type CatalogWorkflowStore, type CallableWorkflowBlock, type CallableWorkflowDisagreement, type CallableWorkflowRef, callableWorkflowBlock, type ConnectorKind, type ConnectorRun, type DeleteReconciliation, isConnectorKind, isPipelineStore, isTransformLanguage, type LoadExpectation, type RowCountBound, type StoredLoadExpectation, readWorkflowCallOutput, REDACTED_SECRET, supportsLoadExpectations, supportsTransformRevisions, isWorkflowBranchLabel, isWorkflowEdge, isWorkflowExecutionMode, isWorkflowFilterOperator, isWorkflowFilterPredicate, isWorkflowFilterPredicateKind, isWorkflowFilterValue, isWorkflowIfPredicate, isWorkflowNode, isWorkflowNodeKind, isWorkflowPredicateKind, isWorkflowSkipReason, isWorkflowStatus, supportsWorkflows, supportsWorkflowStages, TRANSFORM_RUNNER, TRANSFORM_LANGUAGES, type TransformLanguage, type TransformResult, type TransformRunner, unreachableFilterOperator, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, validateWorkflow, WORKFLOW_BRANCH_LABELS, WORKFLOW_CALL_CONTRACT, WORKFLOW_COLUMN_GAP, WORKFLOW_EXECUTION_MODES, WORKFLOW_FILTER_COLUMN_PATTERN, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_FILTER_PREDICATE_KINDS, WORKFLOW_ISSUE_CODES, WORKFLOW_NODE_HEIGHT, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, WORKFLOW_NODE_WIDTH, WORKFLOW_PREDICATE_KINDS, WORKFLOW_ROW_GAP, WORKFLOW_SKIP_REASONS, WORKFLOW_STATUSES, type WorkflowBranchLabel, workflowColumnX, workflowRowY, type WorkflowCallEnvelope, type WorkflowCallNode, type WorkflowCallOutput, type WorkflowEdge, type WorkflowExecutionMode, type WorkflowFilterAll, type WorkflowFilterAny, type WorkflowFilterComparison, type WorkflowFilterGroup, workflowFilterMatches, type WorkflowFilterNode, type WorkflowFilterOneOf, type WorkflowFilterOperator, type WorkflowFilterPredicate, type WorkflowFilterPredicateKind, type WorkflowFilterPresence, type WorkflowFilterValue, type WorkflowGraph, workflowGraphHash, type WorkflowEnvPredicate, type WorkflowIfNode, type WorkflowIfPredicate, type WorkflowIssueCode, type WorkflowNode, type WorkflowNodeKind, workflowNarrowedTypes, type WorkflowNodeOutcome, workflowNodeRuns, type WorkflowNodeStepInput, type WorkflowNodeStepOutput, workflowRunOrder, type WorkflowRunOrderEntry, type WorkflowPredicateKind, type WorkflowRowCountPredicate, type WorkflowSinkNode, type WorkflowSkipReason, type WorkflowSourceNode, type WorkflowStageRef, type WorkflowStatus, type WorkflowTransformNode, type WorkflowValidationIssue, } from './catalog.pipeline';
|
|
12
|
+
export { type ColumnarStageBatch, STAGE_ENCODING, STAGE_ENCODING_VERSION, type StagePayload, classifyStagePayload, decodeStageRows, encodeStageRows, isColumnarStageBatch, } from './catalog.stage-encoding';
|
|
12
13
|
export * from './catalog.environment';
|
|
13
14
|
export { QueryCache } from './catalog.query-cache';
|
|
14
15
|
export { type CsvRow, csvCell, csvLines, guardFormula, toCsv } from './catalog.csv';
|
package/dist/index.js
CHANGED
|
@@ -14,9 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.RequireScopes = exports.RequireHuman = exports.REQUIRES_HUMAN = exports.REQUIRED_SCOPES = void 0;
|
|
17
|
+
exports.unreachableFilterOperator = exports.TRANSFORM_LANGUAGES = exports.TRANSFORM_RUNNER = exports.supportsWorkflowStages = exports.supportsWorkflows = exports.isWorkflowStatus = exports.isWorkflowSkipReason = exports.isWorkflowPredicateKind = exports.isWorkflowNodeKind = exports.isWorkflowNode = exports.isWorkflowIfPredicate = exports.isWorkflowFilterValue = exports.isWorkflowFilterPredicateKind = exports.isWorkflowFilterPredicate = exports.isWorkflowFilterOperator = exports.isWorkflowExecutionMode = exports.isWorkflowEdge = exports.isWorkflowBranchLabel = exports.supportsTransformRevisions = exports.supportsLoadExpectations = exports.REDACTED_SECRET = exports.readWorkflowCallOutput = exports.isTransformLanguage = exports.isPipelineStore = exports.isConnectorKind = exports.callableWorkflowBlock = exports.CONNECTOR_KINDS = exports.CODE_CONTEXT_CONTRACT = exports.CATALOG_PIPELINE_STORE = exports.CatalogRegistry = exports.MikroOrmCatalogRegistry = exports.CATALOG_OVERLAY_STORE = exports.InMemoryCatalogOverlayStore = exports.FileCatalogOverlayStore = exports.CATALOG_OPTIONS = exports.isStreamingQueryStore = exports.isQueryStore = exports.assertReadOnlyShape = exports.CatalogModule = exports.emitCatalog = exports.curationActor = exports.channelNameFor = exports.catalogEventPhase = exports.UNATTRIBUTED_PRINCIPAL_ID = exports.CATALOG_LIB = exports.CATALOG_EVENTS = exports.CATALOG_EVENT_PHASE_FALLBACK = exports.CATALOG_EVENT_PHASE = exports.CatalogType = exports.CatalogProperty = void 0;
|
|
18
|
+
exports.CATALOG_REVISION_LIMIT = exports.visibleToPrincipal = exports.searchCatalog = exports.maySearch = exports.emptySearch = exports.bestMatch = exports.MAX_SEARCH_LIMIT = exports.DEFAULT_SEARCH_LIMIT = exports.CatalogService = exports.SubprocessTransformRunner = exports.toCsv = exports.guardFormula = exports.csvLines = exports.csvCell = exports.QueryCache = exports.isColumnarStageBatch = exports.encodeStageRows = exports.decodeStageRows = exports.classifyStagePayload = exports.STAGE_ENCODING_VERSION = exports.STAGE_ENCODING = exports.workflowRunOrder = exports.workflowNodeRuns = exports.workflowNarrowedTypes = exports.workflowGraphHash = exports.workflowFilterMatches = exports.workflowRowY = exports.workflowColumnX = exports.WORKFLOW_STATUSES = exports.WORKFLOW_SKIP_REASONS = exports.WORKFLOW_ROW_GAP = exports.WORKFLOW_PREDICATE_KINDS = exports.WORKFLOW_NODE_WIDTH = exports.WORKFLOW_NODE_KINDS = exports.WORKFLOW_NODE_ID_PATTERN = exports.WORKFLOW_NODE_HEIGHT = exports.WORKFLOW_ISSUE_CODES = exports.WORKFLOW_FILTER_PREDICATE_KINDS = exports.WORKFLOW_FILTER_OPERATORS = exports.WORKFLOW_FILTER_MAX_VALUES = exports.WORKFLOW_FILTER_MAX_DEPTH = exports.WORKFLOW_FILTER_COLUMN_PATTERN = exports.WORKFLOW_EXECUTION_MODES = exports.WORKFLOW_COLUMN_GAP = exports.WORKFLOW_CALL_CONTRACT = exports.WORKFLOW_BRANCH_LABELS = exports.validateWorkflow = exports.unreachablePredicateKind = exports.unreachableNodeKind = exports.unreachableFilterPredicateKind = void 0;
|
|
19
|
+
exports.RequireScopes = exports.RequireHuman = exports.REQUIRES_HUMAN = exports.REQUIRED_SCOPES = exports.MikroOrmReadStore = exports.UnsafeIdentifierError = exports.supportsCarryForward = exports.physicalColumn = exports.outputAlias = exports.isWriteStore = exports.isSafeIdentifier = exports.isReservedColumn = exports.isCatalogStoreCapabilities = exports.findColumnCollisions = exports.supportsObjectFilters = exports.CatalogColumnCollisionError = exports.CATALOG_STORE = exports.CATALOG_SNAPSHOT_MODES = exports.CATALOG_RESERVED_COLUMNS = exports.assertSafeIdentifier = exports.assertNoColumnCollisions = exports.StaticKeyPrincipalResolver = exports.readableObjectPage = exports.mayWrite = exports.mayRead = exports.maySeeClassification = exports.PRINCIPAL_ACTOR_SEPARATOR = exports.parsePrincipalId = exports.hasScope = exports.expandScopes = exports.delegatePrincipal = exports.composePrincipalId = exports.CATALOG_PRINCIPAL_RESOLVER = exports.traceOutcomeFilter = exports.supportsSavedQueryRevisions = exports.isWorkspaceStore = exports.isTraceStore = exports.isCatalogTraceOutcome = exports.embeddedVisualization = exports.CATALOG_WORKSPACE_STORE = exports.CATALOG_TRACE_STORE = exports.CATALOG_TRACE_OUTCOMES = void 0;
|
|
20
20
|
var catalog_decorators_1 = require("./catalog.decorators");
|
|
21
21
|
Object.defineProperty(exports, "CatalogProperty", { enumerable: true, get: function () { return catalog_decorators_1.CatalogProperty; } });
|
|
22
22
|
Object.defineProperty(exports, "CatalogType", { enumerable: true, get: function () { return catalog_decorators_1.CatalogType; } });
|
|
@@ -57,31 +57,76 @@ var catalog_registry_base_1 = require("./catalog.registry.base");
|
|
|
57
57
|
Object.defineProperty(exports, "CatalogRegistry", { enumerable: true, get: function () { return catalog_registry_base_1.CatalogRegistry; } });
|
|
58
58
|
var catalog_pipeline_1 = require("./catalog.pipeline");
|
|
59
59
|
Object.defineProperty(exports, "CATALOG_PIPELINE_STORE", { enumerable: true, get: function () { return catalog_pipeline_1.CATALOG_PIPELINE_STORE; } });
|
|
60
|
+
Object.defineProperty(exports, "CODE_CONTEXT_CONTRACT", { enumerable: true, get: function () { return catalog_pipeline_1.CODE_CONTEXT_CONTRACT; } });
|
|
60
61
|
Object.defineProperty(exports, "CONNECTOR_KINDS", { enumerable: true, get: function () { return catalog_pipeline_1.CONNECTOR_KINDS; } });
|
|
62
|
+
Object.defineProperty(exports, "callableWorkflowBlock", { enumerable: true, get: function () { return catalog_pipeline_1.callableWorkflowBlock; } });
|
|
61
63
|
Object.defineProperty(exports, "isConnectorKind", { enumerable: true, get: function () { return catalog_pipeline_1.isConnectorKind; } });
|
|
62
64
|
Object.defineProperty(exports, "isPipelineStore", { enumerable: true, get: function () { return catalog_pipeline_1.isPipelineStore; } });
|
|
63
65
|
Object.defineProperty(exports, "isTransformLanguage", { enumerable: true, get: function () { return catalog_pipeline_1.isTransformLanguage; } });
|
|
64
66
|
Object.defineProperty(exports, "readWorkflowCallOutput", { enumerable: true, get: function () { return catalog_pipeline_1.readWorkflowCallOutput; } });
|
|
67
|
+
Object.defineProperty(exports, "REDACTED_SECRET", { enumerable: true, get: function () { return catalog_pipeline_1.REDACTED_SECRET; } });
|
|
65
68
|
Object.defineProperty(exports, "supportsLoadExpectations", { enumerable: true, get: function () { return catalog_pipeline_1.supportsLoadExpectations; } });
|
|
66
69
|
Object.defineProperty(exports, "supportsTransformRevisions", { enumerable: true, get: function () { return catalog_pipeline_1.supportsTransformRevisions; } });
|
|
70
|
+
Object.defineProperty(exports, "isWorkflowBranchLabel", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowBranchLabel; } });
|
|
67
71
|
Object.defineProperty(exports, "isWorkflowEdge", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowEdge; } });
|
|
68
72
|
Object.defineProperty(exports, "isWorkflowExecutionMode", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowExecutionMode; } });
|
|
73
|
+
Object.defineProperty(exports, "isWorkflowFilterOperator", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowFilterOperator; } });
|
|
74
|
+
Object.defineProperty(exports, "isWorkflowFilterPredicate", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowFilterPredicate; } });
|
|
75
|
+
Object.defineProperty(exports, "isWorkflowFilterPredicateKind", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowFilterPredicateKind; } });
|
|
76
|
+
Object.defineProperty(exports, "isWorkflowFilterValue", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowFilterValue; } });
|
|
77
|
+
Object.defineProperty(exports, "isWorkflowIfPredicate", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowIfPredicate; } });
|
|
69
78
|
Object.defineProperty(exports, "isWorkflowNode", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowNode; } });
|
|
70
79
|
Object.defineProperty(exports, "isWorkflowNodeKind", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowNodeKind; } });
|
|
80
|
+
Object.defineProperty(exports, "isWorkflowPredicateKind", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowPredicateKind; } });
|
|
81
|
+
Object.defineProperty(exports, "isWorkflowSkipReason", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowSkipReason; } });
|
|
71
82
|
Object.defineProperty(exports, "isWorkflowStatus", { enumerable: true, get: function () { return catalog_pipeline_1.isWorkflowStatus; } });
|
|
72
83
|
Object.defineProperty(exports, "supportsWorkflows", { enumerable: true, get: function () { return catalog_pipeline_1.supportsWorkflows; } });
|
|
73
84
|
Object.defineProperty(exports, "supportsWorkflowStages", { enumerable: true, get: function () { return catalog_pipeline_1.supportsWorkflowStages; } });
|
|
74
85
|
Object.defineProperty(exports, "TRANSFORM_RUNNER", { enumerable: true, get: function () { return catalog_pipeline_1.TRANSFORM_RUNNER; } });
|
|
75
86
|
Object.defineProperty(exports, "TRANSFORM_LANGUAGES", { enumerable: true, get: function () { return catalog_pipeline_1.TRANSFORM_LANGUAGES; } });
|
|
87
|
+
Object.defineProperty(exports, "unreachableFilterOperator", { enumerable: true, get: function () { return catalog_pipeline_1.unreachableFilterOperator; } });
|
|
88
|
+
Object.defineProperty(exports, "unreachableFilterPredicateKind", { enumerable: true, get: function () { return catalog_pipeline_1.unreachableFilterPredicateKind; } });
|
|
89
|
+
Object.defineProperty(exports, "unreachableNodeKind", { enumerable: true, get: function () { return catalog_pipeline_1.unreachableNodeKind; } });
|
|
90
|
+
Object.defineProperty(exports, "unreachablePredicateKind", { enumerable: true, get: function () { return catalog_pipeline_1.unreachablePredicateKind; } });
|
|
76
91
|
Object.defineProperty(exports, "validateWorkflow", { enumerable: true, get: function () { return catalog_pipeline_1.validateWorkflow; } });
|
|
92
|
+
Object.defineProperty(exports, "WORKFLOW_BRANCH_LABELS", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_BRANCH_LABELS; } });
|
|
77
93
|
Object.defineProperty(exports, "WORKFLOW_CALL_CONTRACT", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_CALL_CONTRACT; } });
|
|
94
|
+
Object.defineProperty(exports, "WORKFLOW_COLUMN_GAP", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_COLUMN_GAP; } });
|
|
78
95
|
Object.defineProperty(exports, "WORKFLOW_EXECUTION_MODES", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_EXECUTION_MODES; } });
|
|
96
|
+
Object.defineProperty(exports, "WORKFLOW_FILTER_COLUMN_PATTERN", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_FILTER_COLUMN_PATTERN; } });
|
|
97
|
+
Object.defineProperty(exports, "WORKFLOW_FILTER_MAX_DEPTH", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_FILTER_MAX_DEPTH; } });
|
|
98
|
+
Object.defineProperty(exports, "WORKFLOW_FILTER_MAX_VALUES", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_FILTER_MAX_VALUES; } });
|
|
99
|
+
Object.defineProperty(exports, "WORKFLOW_FILTER_OPERATORS", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_FILTER_OPERATORS; } });
|
|
100
|
+
Object.defineProperty(exports, "WORKFLOW_FILTER_PREDICATE_KINDS", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_FILTER_PREDICATE_KINDS; } });
|
|
79
101
|
Object.defineProperty(exports, "WORKFLOW_ISSUE_CODES", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_ISSUE_CODES; } });
|
|
102
|
+
Object.defineProperty(exports, "WORKFLOW_NODE_HEIGHT", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_NODE_HEIGHT; } });
|
|
80
103
|
Object.defineProperty(exports, "WORKFLOW_NODE_ID_PATTERN", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_NODE_ID_PATTERN; } });
|
|
81
104
|
Object.defineProperty(exports, "WORKFLOW_NODE_KINDS", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_NODE_KINDS; } });
|
|
105
|
+
Object.defineProperty(exports, "WORKFLOW_NODE_WIDTH", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_NODE_WIDTH; } });
|
|
106
|
+
Object.defineProperty(exports, "WORKFLOW_PREDICATE_KINDS", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_PREDICATE_KINDS; } });
|
|
107
|
+
Object.defineProperty(exports, "WORKFLOW_ROW_GAP", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_ROW_GAP; } });
|
|
108
|
+
Object.defineProperty(exports, "WORKFLOW_SKIP_REASONS", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_SKIP_REASONS; } });
|
|
82
109
|
Object.defineProperty(exports, "WORKFLOW_STATUSES", { enumerable: true, get: function () { return catalog_pipeline_1.WORKFLOW_STATUSES; } });
|
|
110
|
+
Object.defineProperty(exports, "workflowColumnX", { enumerable: true, get: function () { return catalog_pipeline_1.workflowColumnX; } });
|
|
111
|
+
Object.defineProperty(exports, "workflowRowY", { enumerable: true, get: function () { return catalog_pipeline_1.workflowRowY; } });
|
|
112
|
+
Object.defineProperty(exports, "workflowFilterMatches", { enumerable: true, get: function () { return catalog_pipeline_1.workflowFilterMatches; } });
|
|
83
113
|
Object.defineProperty(exports, "workflowGraphHash", { enumerable: true, get: function () { return catalog_pipeline_1.workflowGraphHash; } });
|
|
114
|
+
Object.defineProperty(exports, "workflowNarrowedTypes", { enumerable: true, get: function () { return catalog_pipeline_1.workflowNarrowedTypes; } });
|
|
115
|
+
Object.defineProperty(exports, "workflowNodeRuns", { enumerable: true, get: function () { return catalog_pipeline_1.workflowNodeRuns; } });
|
|
84
116
|
Object.defineProperty(exports, "workflowRunOrder", { enumerable: true, get: function () { return catalog_pipeline_1.workflowRunOrder; } });
|
|
117
|
+
// How a staged batch is written down. Exported because `CatalogStageStore` is a
|
|
118
|
+
// seam a host can implement — a stage kept in object storage or a columnar
|
|
119
|
+
// warehouse rather than the catalog database is the case the interface exists
|
|
120
|
+
// for — and such a host needs the codec, not a description of it. Two stores
|
|
121
|
+
// encoding the same batch differently would be a run that cannot resume across
|
|
122
|
+
// a deployment that changed its mind about where stages live.
|
|
123
|
+
var catalog_stage_encoding_1 = require("./catalog.stage-encoding");
|
|
124
|
+
Object.defineProperty(exports, "STAGE_ENCODING", { enumerable: true, get: function () { return catalog_stage_encoding_1.STAGE_ENCODING; } });
|
|
125
|
+
Object.defineProperty(exports, "STAGE_ENCODING_VERSION", { enumerable: true, get: function () { return catalog_stage_encoding_1.STAGE_ENCODING_VERSION; } });
|
|
126
|
+
Object.defineProperty(exports, "classifyStagePayload", { enumerable: true, get: function () { return catalog_stage_encoding_1.classifyStagePayload; } });
|
|
127
|
+
Object.defineProperty(exports, "decodeStageRows", { enumerable: true, get: function () { return catalog_stage_encoding_1.decodeStageRows; } });
|
|
128
|
+
Object.defineProperty(exports, "encodeStageRows", { enumerable: true, get: function () { return catalog_stage_encoding_1.encodeStageRows; } });
|
|
129
|
+
Object.defineProperty(exports, "isColumnarStageBatch", { enumerable: true, get: function () { return catalog_stage_encoding_1.isColumnarStageBatch; } });
|
|
85
130
|
// The environment surface: which catalog database a call is served from, and
|
|
86
131
|
// how a connector or a transform is promoted between them.
|
|
87
132
|
__exportStar(require("./catalog.environment"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CatalogCodeContext, type CatalogTransform, type TransformLanguage, type TransformResult, type TransformRunner } from './catalog.pipeline';
|
|
2
2
|
export interface TransformRunnerOptions {
|
|
3
3
|
/**
|
|
4
4
|
* A Python virtualenv whose interpreter runs transforms.
|
|
@@ -46,6 +46,23 @@ export interface TransformRunnerOptions {
|
|
|
46
46
|
*
|
|
47
47
|
* `node:vm` was the other option and is worse on both counts: it is famously
|
|
48
48
|
* not an isolation boundary either, and it cannot be killed mid-loop.
|
|
49
|
+
*
|
|
50
|
+
* ## The environment the code is *given*, as opposed to the one it can reach
|
|
51
|
+
*
|
|
52
|
+
* Everything above says the trimmed `env` is a guard rail and not a boundary.
|
|
53
|
+
* The corollary matters for {@link CatalogCodeContext}: since the child can
|
|
54
|
+
* reach every variable anyway through `/proc`, `context.env` is not a
|
|
55
|
+
* confinement mechanism and is not offered as one. It is the **supported**
|
|
56
|
+
* route — the one that works on Windows, the one that survives a `TransformRunner`
|
|
57
|
+
* swapped for a container, and the one whose contents a deployment declares on
|
|
58
|
+
* purpose through the credential allow-list rather than by whatever happened to
|
|
59
|
+
* be exported into the pod.
|
|
60
|
+
*
|
|
61
|
+
* That distinction is what makes the allow-list worth applying here at all. A
|
|
62
|
+
* host that genuinely needs code not to read `DATABASE_URL` needs a different
|
|
63
|
+
* runner; a host that needs its own operators to declare, once, which
|
|
64
|
+
* credentials the pipeline is *meant* to use gets exactly that, in the same
|
|
65
|
+
* list that already governs connectors.
|
|
49
66
|
*/
|
|
50
67
|
export declare class SubprocessTransformRunner implements TransformRunner {
|
|
51
68
|
private readonly options;
|
|
@@ -64,6 +81,7 @@ export declare class SubprocessTransformRunner implements TransformRunner {
|
|
|
64
81
|
pythonPackages(): Promise<string[]>;
|
|
65
82
|
run(transform: Pick<CatalogTransform, 'language' | 'code'>, records: unknown[], options?: {
|
|
66
83
|
timeoutMs?: number;
|
|
84
|
+
context?: CatalogCodeContext;
|
|
67
85
|
}): Promise<TransformResult>;
|
|
68
86
|
private spawn;
|
|
69
87
|
/** Cached, including the negative answer — probing on every run is wasteful. */
|
package/dist/transform-runner.js
CHANGED
|
@@ -16,6 +16,7 @@ const node_fs_1 = require("node:fs");
|
|
|
16
16
|
const node_os_1 = require("node:os");
|
|
17
17
|
const node_path_1 = require("node:path");
|
|
18
18
|
const common_1 = require("@nestjs/common");
|
|
19
|
+
const catalog_pipeline_1 = require("./catalog.pipeline");
|
|
19
20
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
20
21
|
const MAX_OUTPUT_BYTES = 32 * 1024 * 1024;
|
|
21
22
|
/**
|
|
@@ -144,6 +145,23 @@ const REPORTED_PACKAGES = ['pandas', 'numpy', 'pyarrow', 'requests'];
|
|
|
144
145
|
*
|
|
145
146
|
* `node:vm` was the other option and is worse on both counts: it is famously
|
|
146
147
|
* not an isolation boundary either, and it cannot be killed mid-loop.
|
|
148
|
+
*
|
|
149
|
+
* ## The environment the code is *given*, as opposed to the one it can reach
|
|
150
|
+
*
|
|
151
|
+
* Everything above says the trimmed `env` is a guard rail and not a boundary.
|
|
152
|
+
* The corollary matters for {@link CatalogCodeContext}: since the child can
|
|
153
|
+
* reach every variable anyway through `/proc`, `context.env` is not a
|
|
154
|
+
* confinement mechanism and is not offered as one. It is the **supported**
|
|
155
|
+
* route — the one that works on Windows, the one that survives a `TransformRunner`
|
|
156
|
+
* swapped for a container, and the one whose contents a deployment declares on
|
|
157
|
+
* purpose through the credential allow-list rather than by whatever happened to
|
|
158
|
+
* be exported into the pod.
|
|
159
|
+
*
|
|
160
|
+
* That distinction is what makes the allow-list worth applying here at all. A
|
|
161
|
+
* host that genuinely needs code not to read `DATABASE_URL` needs a different
|
|
162
|
+
* runner; a host that needs its own operators to declare, once, which
|
|
163
|
+
* credentials the pipeline is *meant* to use gets exactly that, in the same
|
|
164
|
+
* list that already governs connectors.
|
|
147
165
|
*/
|
|
148
166
|
let SubprocessTransformRunner = SubprocessTransformRunner_1 = class SubprocessTransformRunner {
|
|
149
167
|
options;
|
|
@@ -192,6 +210,14 @@ let SubprocessTransformRunner = SubprocessTransformRunner_1 = class SubprocessTr
|
|
|
192
210
|
async run(transform, records, options = {}) {
|
|
193
211
|
const started = Date.now();
|
|
194
212
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
213
|
+
// Never `undefined` past this line. A caller may legitimately have no
|
|
214
|
+
// context to give — a spec, a host driving the runner directly — and the
|
|
215
|
+
// one thing user code must not have to write is `context?.env?.X`, because
|
|
216
|
+
// the optional chain is the spelling that silently reads nothing when the
|
|
217
|
+
// caller *did* have a context and got the shape wrong. So the absence is
|
|
218
|
+
// resolved here, once, into a context that says plainly there is no run and
|
|
219
|
+
// no admitted credential.
|
|
220
|
+
const context = options.context ?? contextlessRun(records.length);
|
|
195
221
|
const python = transform.language === 'python';
|
|
196
222
|
const interpreter = python ? await this.resolvePython() : process.execPath;
|
|
197
223
|
if (!interpreter) {
|
|
@@ -209,7 +235,12 @@ let SubprocessTransformRunner = SubprocessTransformRunner_1 = class SubprocessTr
|
|
|
209
235
|
'-e',
|
|
210
236
|
script,
|
|
211
237
|
];
|
|
212
|
-
|
|
238
|
+
// An envelope rather than the bare array stdin used to carry. The context
|
|
239
|
+
// travels beside the records rather than in the child's `env`, and that is
|
|
240
|
+
// the deliberate half of it: the child's own environment stays
|
|
241
|
+
// `{PATH, NODE_ENV}`, so nothing about what a transform may read changes by
|
|
242
|
+
// accident when somebody edits the spawn options later.
|
|
243
|
+
const { stdout, stderr } = await this.spawn(interpreter, args, JSON.stringify({ records, context }), timeoutMs);
|
|
213
244
|
let parsed;
|
|
214
245
|
try {
|
|
215
246
|
// The harness prints exactly one JSON line last; anything the code wrote
|
|
@@ -338,6 +369,19 @@ exports.SubprocessTransformRunner = SubprocessTransformRunner = SubprocessTransf
|
|
|
338
369
|
(0, common_1.Injectable)(),
|
|
339
370
|
__metadata("design:paramtypes", [Object])
|
|
340
371
|
], SubprocessTransformRunner);
|
|
372
|
+
/**
|
|
373
|
+
* The context for a run that has none: a spec, or a host driving the runner by
|
|
374
|
+
* hand.
|
|
375
|
+
*
|
|
376
|
+
* Empty rather than absent, so `context.env.ANYTHING` is `undefined` instead of
|
|
377
|
+
* a `TypeError` and code written for a real run degrades to reading nothing.
|
|
378
|
+
* `runId` is left off rather than filled with a placeholder — the field's whole
|
|
379
|
+
* documented meaning is "there is a run and this is it", and a fabricated id
|
|
380
|
+
* would be the one lie a reader could not detect.
|
|
381
|
+
*/
|
|
382
|
+
function contextlessRun(rowCount) {
|
|
383
|
+
return { contract: catalog_pipeline_1.CODE_CONTEXT_CONTRACT, rowCount, inputs: [], env: {} };
|
|
384
|
+
}
|
|
341
385
|
/**
|
|
342
386
|
* Stop the transform, and everything the transform started.
|
|
343
387
|
*
|
|
@@ -441,9 +485,15 @@ process.stdin.setEncoding("utf8");
|
|
|
441
485
|
for await (const chunk of process.stdin) input += chunk;
|
|
442
486
|
|
|
443
487
|
try {
|
|
444
|
-
const
|
|
445
|
-
const
|
|
446
|
-
|
|
488
|
+
const payload = JSON.parse(input || "{}");
|
|
489
|
+
const records = Array.isArray(payload.records) ? payload.records : [];
|
|
490
|
+
// Frozen, and one level down as well, so that a transform assigning to
|
|
491
|
+
// \`context.env.TOKEN\` fails loudly here rather than appearing to work and
|
|
492
|
+
// then confusing whoever reads the next node's code. Nothing propagates out
|
|
493
|
+
// of this process either way; the freeze buys the honest error, not safety.
|
|
494
|
+
const context = Object.freeze({ ...payload.context, env: Object.freeze({ ...payload.context?.env }) });
|
|
495
|
+
const transform = async (records, context) => { ${code} };
|
|
496
|
+
const rows = await transform(records, context);
|
|
447
497
|
process.stdout.write(JSON.stringify({ rows: rows ?? [], logs: captured() }));
|
|
448
498
|
} catch (error) {
|
|
449
499
|
process.stdout.write(JSON.stringify({
|
|
@@ -568,7 +618,7 @@ sink = Sink()
|
|
|
568
618
|
def log(*args):
|
|
569
619
|
print(*args)
|
|
570
620
|
|
|
571
|
-
def transform(records):
|
|
621
|
+
def transform(records, context):
|
|
572
622
|
${indented || ' return records'}
|
|
573
623
|
|
|
574
624
|
def to_rows(result):
|
|
@@ -592,11 +642,17 @@ def captured():
|
|
|
592
642
|
|
|
593
643
|
try:
|
|
594
644
|
raw = sys.stdin.read()
|
|
595
|
-
|
|
645
|
+
payload = json.loads(raw) if raw.strip() else {}
|
|
646
|
+
records = payload.get("records") or []
|
|
647
|
+
# A plain dict, not an object with attributes. \`context["env"]["TOKEN"]\`
|
|
648
|
+
# is the same expression in every Python transform anybody has written
|
|
649
|
+
# against a JSON payload, and a bespoke wrapper would buy dotted access at
|
|
650
|
+
# the cost of a KeyError that reads like a bug in the catalog.
|
|
651
|
+
context = payload.get("context") or {}
|
|
596
652
|
# \`to_rows\` is inside the redirect as well: a lazily-evaluated return value
|
|
597
653
|
# does its printing here, not before.
|
|
598
654
|
with contextlib.redirect_stdout(sink), contextlib.redirect_stderr(sink):
|
|
599
|
-
rows = to_rows(transform(records))
|
|
655
|
+
rows = to_rows(transform(records, context))
|
|
600
656
|
# Back on the real stdout by now — the context manager restores on the way
|
|
601
657
|
# out, including out of an exception — so this is the only thing on it.
|
|
602
658
|
out = captured()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudousxd/nestjs-catalog",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "A metadata registry for NestJS: object types, properties and relations, derived from your ORM and enriched with decorators.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Davide Carvalho",
|
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
"files": [
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc -p tsconfig.json",
|
|
35
|
+
"dev": "tsc -p tsconfig.json --watch"
|
|
36
|
+
},
|
|
33
37
|
"peerDependencies": {
|
|
34
38
|
"@mikro-orm/core": ">=6",
|
|
35
39
|
"@nestjs/common": ">=10",
|
|
@@ -46,9 +50,5 @@
|
|
|
46
50
|
},
|
|
47
51
|
"dependencies": {
|
|
48
52
|
"@dudousxd/nestjs-diagnostics": "0.7.0"
|
|
49
|
-
},
|
|
50
|
-
"scripts": {
|
|
51
|
-
"build": "tsc -p tsconfig.json",
|
|
52
|
-
"dev": "tsc -p tsconfig.json --watch"
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Davide Carvalho
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|