@dudousxd/nestjs-catalog 0.28.0 → 0.29.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.
@@ -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.29.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",