@dudousxd/nestjs-catalog 0.28.0 → 0.30.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.
@@ -3872,14 +3872,36 @@ export declare function readWorkflowCallOutput(value: unknown): WorkflowCallOutp
3872
3872
  */
3873
3873
  export interface CallableWorkflowRef {
3874
3874
  name: string;
3875
+ /**
3876
+ * How strong the fleet's claim about this entry is, mirroring durable core's
3877
+ * `AnnouncementEvidence` rather than re-deriving it.
3878
+ *
3879
+ * - `'declared'` — a live worker published a descriptor naming this workflow,
3880
+ * so everything populated here was stated by that worker.
3881
+ * - `'observed'` — nobody described it. What exists is a live routing token of
3882
+ * this name, which is exactly the condition convention routing uses, so the
3883
+ * name IS reachable — and nothing else is known: no version, no origin, no
3884
+ * runtime, and no assurance the token serves a workflow rather than a step
3885
+ * handler of the same name. A live queue, not a promise.
3886
+ *
3887
+ * Carried because the two tiers answer a question a picker cannot otherwise
3888
+ * put: **will a pin on this name mean anything?** An `'observed'` entry never
3889
+ * declares a version, so a version typed against it is compared, at run time,
3890
+ * against the engine's routing default — the run comes back tagged
3891
+ * `version:undeclared` and `checkCall` reports the pin as unverified rather
3892
+ * than kept. Absent when the deployment answering predates the distinction.
3893
+ */
3894
+ evidence?: 'declared' | 'observed';
3875
3895
  /**
3876
3896
  * The version to pin, and **absent is a real answer**.
3877
3897
  *
3878
3898
  * A worker that has not been upgraded announces a bare name with no version
3879
- * and no group. Silence is not a claim, so no version is invented for it from
3880
- * another announcer's and an entry without one cannot satisfy the pin, which
3881
- * is why {@link callableWorkflowBlock} refuses it rather than letting a picker
3882
- * offer a name that would run whatever is newest on the day it runs.
3899
+ * and no group or announces nothing at all and is here on its heartbeat
3900
+ * alone ({@link evidence} `'observed'`). Silence is not a claim, so no version
3901
+ * is invented for it from another announcer's and an entry without one
3902
+ * cannot satisfy the pin, which is why {@link callableWorkflowBlock} refuses
3903
+ * it rather than letting a picker offer a name that would run whatever is
3904
+ * newest on the day it runs.
3883
3905
  */
3884
3906
  version?: string;
3885
3907
  /** What it does, if the deployment publishes one. Shown beside the name. */
@@ -3931,11 +3953,17 @@ export interface CallableWorkflowDisagreement {
3931
3953
  * Two refusals, and they are refusals rather than warnings because in both cases
3932
3954
  * committing the entry would write a node whose meaning nobody can state:
3933
3955
  *
3934
- * - `no-version` — an un-upgraded worker announced a bare name. The call node's
3935
- * whole point is the pin; a node holding a name and no version follows
3936
- * whatever gets deployed next, which is the failure the version field exists
3937
- * to prevent. The name is still perfectly typeable by hand *with* a version
3938
- * the author knows, so this refuses the one-click commit and not the workflow.
3956
+ * - `no-version` — nothing live states a version for this name, either because an
3957
+ * un-upgraded worker announced a bare name or because nobody described it at
3958
+ * all and it is here on its heartbeat ({@link CallableWorkflowRef.evidence}
3959
+ * `'observed'`). The call node's whole point is the pin; a node holding a name
3960
+ * and no version follows whatever gets deployed next, which is the failure the
3961
+ * version field exists to prevent. The name is still perfectly typeable by hand
3962
+ * *with* a version the author knows — and the message says what that costs,
3963
+ * because a version typed against a callee that declares none is compared at run
3964
+ * time against the engine's routing default and comes back reported as
3965
+ * unverified, not as kept. That is the one thing an author choosing a pin from
3966
+ * this list could not otherwise find out until a load ran.
3939
3967
  * - `ambiguous-group` — two live workers claim this exact `name@version` from
3940
3968
  * different groups. Two groups means two queues, and nothing here can know
3941
3969
  * which one a run would land on, so the two bodies may not even be the same
@@ -2381,9 +2381,16 @@ function describeCount(value) {
2381
2381
  function callableWorkflowBlock(ref) {
2382
2382
  const version = typeof ref.version === 'string' ? ref.version.trim() : '';
2383
2383
  if (version.length === 0) {
2384
+ // The two tiers differ in what they can even be asked, so they get their own
2385
+ // sentence rather than one that fits neither: an `'observed'` entry has no
2386
+ // descriptor at all behind it, and calling that "not upgraded to publish its
2387
+ // registrations in full" would overstate what was seen.
2388
+ const seen = ref.evidence === 'observed'
2389
+ ? `Nothing describes "${ref.name}" — it is here because a live queue of that name exists, which is what an engine routes a call on and all it knows. No version, no origin and no runtime were stated, and not even that the queue serves a workflow rather than a step handler of the same name.`
2390
+ : `A live worker announces "${ref.name}" without saying which version it runs, which is what a worker announces before it has been upgraded to publish its registrations in full.`;
2384
2391
  return {
2385
2392
  code: 'no-version',
2386
- message: `A live worker announces "${ref.name}" without saying which version it runs, which is what a worker announces before it has been upgraded to publish its registrations in full. A name with no version cannot be pinned, so this cannot be chosen type the name and the version you mean.`,
2393
+ message: `${seen} A name with no version cannot be pinned, so this cannot be chosen type the name and the version you mean. Be aware of what that pin is worth: with nothing declaring a version, a run of it carries the engine's routing default and the load reports the pin as unverified rather than kept, until the worker serving it publishes one.`,
2387
2394
  };
2388
2395
  }
2389
2396
  const groups = ref.disagreements?.find((entry) => entry.axis === 'group')?.values ?? [];
@@ -23,10 +23,11 @@ const catalog_events_1 = require("./catalog.events");
23
23
  const catalog_options_1 = require("./catalog.options");
24
24
  const catalog_overlay_store_token_1 = require("./catalog.overlay-store.token");
25
25
  const catalog_registry_base_1 = require("./catalog.registry.base");
26
- const RELATION_KINDS = ['1:1', '1:m', 'm:1', 'm:n'];
27
- function isRelationKind(kind) {
28
- return RELATION_KINDS.includes(kind);
29
- }
26
+ // The one list of the four kinds, shared with the stored registry's read-time
27
+ // narrowing and the publish route's refusal. This file used to hold its own
28
+ // copy — three copies of a closed set, and the one here needed a cast to check
29
+ // against it.
30
+ const catalog_types_1 = require("./catalog.types");
30
31
  /**
31
32
  * Which end of the link holds the key.
32
33
  *
@@ -318,7 +319,7 @@ let MikroOrmCatalogRegistry = MikroOrmCatalogRegistry_1 = class MikroOrmCatalogR
318
319
  const fromDecorator = declaredProps[prop.name];
319
320
  const fromOverlay = overlayProps[prop.name];
320
321
  const { displayName, description, hidden, order } = resolveFieldPresentation(prop.name, index, fromDecorator, fromOverlay);
321
- if (isRelationKind(prop.kind)) {
322
+ if ((0, catalog_types_1.isRelationKind)(prop.kind)) {
322
323
  const targetType = prop.targetMeta?.className ?? String(prop.type);
323
324
  relations.push({
324
325
  name: prop.name,
@@ -17,7 +17,28 @@
17
17
  */
18
18
  import type { CatalogFilterOperator } from './catalog.filters';
19
19
  export type ScalarType = 'string' | 'number' | 'boolean' | 'date' | 'json' | 'uuid' | 'unknown';
20
- export type RelationKind = '1:1' | '1:m' | 'm:1' | 'm:n';
20
+ /**
21
+ * The four shapes a link can have. **One list, and everything that needs to
22
+ * know the four reads it.**
23
+ *
24
+ * A const rather than a bare union because two places have to decide whether a
25
+ * *runtime* string is one of them, and until this existed they each held their
26
+ * own copy of the four: the stored registry narrows what came out of a JSON
27
+ * column on the way to a def, and the publish path refuses a payload that names
28
+ * a kind nothing can draw. Two copies of a closed set is the shape of a bug
29
+ * where a fifth kind is added to one of them, and the symptom is a link that
30
+ * publishes cleanly and then renders as something else entirely.
31
+ */
32
+ export declare const RELATION_KINDS: readonly ["1:1", "1:m", "m:1", "m:n"];
33
+ export type RelationKind = (typeof RELATION_KINDS)[number];
34
+ /**
35
+ * Whether a runtime value is one of the four.
36
+ *
37
+ * Same shape as {@link isReusableNodeKind} in `catalog.pipeline.ts` and for the
38
+ * same reason: a narrowing that reads the list rather than restating it cannot
39
+ * disagree with the list.
40
+ */
41
+ export declare function isRelationKind(value: unknown): value is RelationKind;
21
42
  /** A single scalar field on an object type. */
22
43
  export interface CatalogPropertyDef {
23
44
  /** Code name, as written in the entity. Stable — the overlay never changes it. */
@@ -17,3 +17,28 @@
17
17
  * it safe to hand the editor to a non-engineer.
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.RELATION_KINDS = void 0;
21
+ exports.isRelationKind = isRelationKind;
22
+ /**
23
+ * The four shapes a link can have. **One list, and everything that needs to
24
+ * know the four reads it.**
25
+ *
26
+ * A const rather than a bare union because two places have to decide whether a
27
+ * *runtime* string is one of them, and until this existed they each held their
28
+ * own copy of the four: the stored registry narrows what came out of a JSON
29
+ * column on the way to a def, and the publish path refuses a payload that names
30
+ * a kind nothing can draw. Two copies of a closed set is the shape of a bug
31
+ * where a fifth kind is added to one of them, and the symptom is a link that
32
+ * publishes cleanly and then renders as something else entirely.
33
+ */
34
+ exports.RELATION_KINDS = ['1:1', '1:m', 'm:1', 'm:n'];
35
+ /**
36
+ * Whether a runtime value is one of the four.
37
+ *
38
+ * Same shape as {@link isReusableNodeKind} in `catalog.pipeline.ts` and for the
39
+ * same reason: a narrowing that reads the list rather than restating it cannot
40
+ * disagree with the list.
41
+ */
42
+ function isRelationKind(value) {
43
+ return exports.RELATION_KINDS.some((kind) => kind === value);
44
+ }
package/dist/index.d.ts CHANGED
@@ -26,4 +26,5 @@ export * from './catalog.filters';
26
26
  export { assertNoColumnCollisions, assertSafeIdentifier, CATALOG_RESERVED_COLUMNS, CATALOG_SNAPSHOT_MODES, CATALOG_STORE, type CarryForwardResult, type CatalogColumnCollision, CatalogColumnCollisionError, type CatalogFilteringReadStore, supportsObjectFilters, type CatalogMergeStore, type CatalogReadQuery, type CatalogReadResult, type CatalogReadStore, type CatalogReservedColumn, type CatalogSnapshotMode, type CatalogSnapshotStreamStore, type CatalogStoreCapabilities, type CatalogWriteStore, type ColumnCollisionOptions, findColumnCollisions, isCatalogStoreCapabilities, isReservedColumn, isSafeIdentifier, isWriteStore, outputAlias, physicalColumn, type SnapshotRef, supportsCarryForward, supportsSnapshotStreams, UnsafeIdentifierError, } from './catalog.store';
27
27
  export { MikroOrmReadStore } from './stores/mikro-orm-read.store';
28
28
  export type { CatalogGraph, CatalogObjectPage, CatalogObjectQuery, CatalogObjectTypeDef, CatalogOverlay, CatalogPropertyDef, CatalogRelationDef, CatalogSnapshot, RelationKind, ScalarType, } from './catalog.types';
29
+ export { isRelationKind, RELATION_KINDS } from './catalog.types';
29
30
  export { REQUIRED_SCOPES, REQUIRES_HUMAN, RequireHuman, RequireScopes, } from './catalog.route-auth';
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ exports.unreachableReusableNodeKind = exports.reusableNodeBodyOf = exports.REUSA
18
18
  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_MODES = exports.WORKFLOW_CALL_CONTRACT = exports.WORKFLOW_BRANCH_LABELS = exports.validateWorkflow = exports.unreachableRenameUnnamed = exports.unreachableLookupUnmatched = exports.unreachablePredicateKind = exports.unreachableNodeKind = exports.unreachableConnectorKind = exports.unreachableCallMode = exports.unreachableFilterPredicateKind = exports.unreachableTransformMode = exports.unreachableFilterOperator = exports.transformMode = exports.recordModeRefusal = exports.TRANSFORM_MODES = exports.TRANSFORM_LANGUAGES = exports.TRANSFORM_RUNNER = exports.supportsStagePayloads = exports.supportsWorkflowStages = exports.supportsWorkflows = exports.supportsWorkflowReleases = exports.liveWorkflowVersion = exports.isWorkflowStatus = exports.isWorkflowSkipReason = exports.isWorkflowRenameUnnamed = exports.isWorkflowRenameColumns = exports.isWorkflowLookupUnmatched = exports.isWorkflowLookupFields = exports.isWorkflowPredicateKind = exports.isWorkflowNodeKind = exports.isWorkflowCallMode = exports.isWorkflowNode = exports.isWorkflowIfPredicate = exports.isWorkflowFilterValue = exports.isWorkflowFilterPredicateKind = exports.isWorkflowFilterPredicate = exports.isWorkflowFilterOperator = exports.isWorkflowExecutionMode = exports.isWorkflowEdge = exports.isWorkflowBranchLabel = void 0;
19
19
  exports.aggregateInputColumns = exports.AggregateTable = exports.workflowAggregateSeparator = exports.workflowAggregateOutputColumns = exports.workflowAggregateNeedsColumn = exports.workflowAggregateMaxGroups = exports.workflowAggregateJoinMaxLength = exports.workflowAggregateColumns = exports.WORKFLOW_AGGREGATE_MAX_SEPARATOR = exports.WORKFLOW_AGGREGATE_MAX_GROUPS = exports.WORKFLOW_AGGREGATE_MAX_GROUP_BY = exports.WORKFLOW_AGGREGATE_MAX_AGGREGATES = exports.WORKFLOW_AGGREGATE_JOIN_MAX_LENGTH = exports.WORKFLOW_AGGREGATE_JOIN_LENGTH_CEILING = exports.WORKFLOW_AGGREGATE_GROUPS_CEILING = exports.WORKFLOW_AGGREGATE_FUNCTIONS = exports.WORKFLOW_AGGREGATE_DEFAULT_SEPARATOR = exports.unreachableAggregateFunction = exports.isWorkflowAggregates = exports.isWorkflowAggregateFunction = exports.aggregateRefusals = exports.workflowRenameUnnamed = exports.renameColumnRefusals = exports.WORKFLOW_LOOKUP_UNMATCHED = exports.WORKFLOW_LOOKUP_MAX_REFERENCE_ROWS = exports.WORKFLOW_LOOKUP_MAX_FIELDS = exports.workflowLookupUnmatched = exports.workflowLookupKey = exports.workflowLookupColumns = exports.lookupConfigRefusals = exports.workflowRunOrder = exports.workflowNodeRuns = exports.workflowSourceObjectType = exports.workflowNarrowedTypes = exports.workflowKnownColumns = exports.workflowGraphHash = exports.workflowFilterMatches = exports.workflowFilterColumns = exports.workflowCallMode = exports.workflowRowY = exports.workflowColumnX = exports.WORKFLOW_STATUSES = exports.WORKFLOW_SKIP_REASONS = exports.WORKFLOW_ROW_GAP = exports.WORKFLOW_RENAME_UNNAMED = exports.WORKFLOW_RENAME_MAX_COLUMNS = exports.WORKFLOW_PREDICATE_KINDS = exports.WORKFLOW_NODE_WIDTH = exports.WORKFLOW_NODE_KINDS = exports.WORKFLOW_NODE_ID_PATTERN = void 0;
20
20
  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 = 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.transformShapeHint = exports.transformShape = exports.transformDeclaresModule = exports.SubprocessTransformRunner = exports.toCsv = exports.guardFormula = exports.csvLines = exports.csvCell = exports.QueryCache = exports.renameStagePayload = exports.isColumnarStageBatch = exports.encodeStageRows = exports.decodeStageRows = exports.classifyStagePayload = exports.STAGE_ENCODING_VERSION = exports.STAGE_ENCODING = exports.WorkflowAggregateError = void 0;
21
- exports.RequireScopes = exports.RequireHuman = exports.REQUIRES_HUMAN = exports.REQUIRED_SCOPES = exports.MikroOrmReadStore = exports.UnsafeIdentifierError = exports.supportsSnapshotStreams = 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 = void 0;
21
+ exports.RequireScopes = exports.RequireHuman = exports.REQUIRES_HUMAN = exports.REQUIRED_SCOPES = exports.RELATION_KINDS = exports.isRelationKind = exports.MikroOrmReadStore = exports.UnsafeIdentifierError = exports.supportsSnapshotStreams = 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 = void 0;
22
22
  var catalog_decorators_1 = require("./catalog.decorators");
23
23
  Object.defineProperty(exports, "CatalogProperty", { enumerable: true, get: function () { return catalog_decorators_1.CatalogProperty; } });
24
24
  Object.defineProperty(exports, "CatalogType", { enumerable: true, get: function () { return catalog_decorators_1.CatalogType; } });
@@ -310,6 +310,9 @@ Object.defineProperty(exports, "supportsSnapshotStreams", { enumerable: true, ge
310
310
  Object.defineProperty(exports, "UnsafeIdentifierError", { enumerable: true, get: function () { return catalog_store_1.UnsafeIdentifierError; } });
311
311
  var mikro_orm_read_store_1 = require("./stores/mikro-orm-read.store");
312
312
  Object.defineProperty(exports, "MikroOrmReadStore", { enumerable: true, get: function () { return mikro_orm_read_store_1.MikroOrmReadStore; } });
313
+ var catalog_types_1 = require("./catalog.types");
314
+ Object.defineProperty(exports, "isRelationKind", { enumerable: true, get: function () { return catalog_types_1.isRelationKind; } });
315
+ Object.defineProperty(exports, "RELATION_KINDS", { enumerable: true, get: function () { return catalog_types_1.RELATION_KINDS; } });
313
316
  var catalog_route_auth_1 = require("./catalog.route-auth");
314
317
  Object.defineProperty(exports, "REQUIRED_SCOPES", { enumerable: true, get: function () { return catalog_route_auth_1.REQUIRED_SCOPES; } });
315
318
  Object.defineProperty(exports, "REQUIRES_HUMAN", { enumerable: true, get: function () { return catalog_route_auth_1.REQUIRES_HUMAN; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-catalog",
3
- "version": "0.28.0",
3
+ "version": "0.30.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",