@dudousxd/nestjs-catalog 0.30.0 → 0.31.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.
@@ -9,6 +9,72 @@ import type { CatalogObjectQuery, CatalogObjectTypeDef } from './catalog.types';
9
9
  * the application's own tables, a separate warehouse schema, or a column store,
10
10
  * without the screens above it changing.
11
11
  */
12
+ /**
13
+ * Where a snapshot's rows have been copied to, outside the database.
14
+ *
15
+ * **Vocabulary only — this package writes none of these and reads none of them.**
16
+ * It is declared here because it belongs on {@link SnapshotRef}, and a
17
+ * `SnapshotRef` is what every screen and every caller already holds. The
18
+ * machinery that produces an archive lives in
19
+ * `@dudousxd/nestjs-catalog-pipeline`, which is the package already allowed to
20
+ * know what a bucket is; the catalog itself stays unable to name one.
21
+ *
22
+ * ## What its presence means, and what it does not
23
+ *
24
+ * Present means *a verified copy of this snapshot exists at `path`*. It says
25
+ * nothing about whether the rows are still in the database — those are two
26
+ * independent facts and a caller that conflates them gets the dangerous reading
27
+ * in both directions. The three states a console has to tell apart are:
28
+ *
29
+ * - **no `archive`** — the snapshot is in the database and nowhere else.
30
+ * - **`archive` present, rows still in the table** — copied, not moved. Reads
31
+ * are unchanged and cost what they always did.
32
+ * - **`archive` present, rows gone** — the snapshot lives in object storage.
33
+ * Still readable, still identified, and **not** the same price as a read of a
34
+ * hot snapshot. {@link bytes} is here so a screen can say which it is about
35
+ * to do rather than presenting the two as one click.
36
+ *
37
+ * A snapshot with no `SnapshotRef` at all is the fourth state, and it is the
38
+ * only one that means *gone*.
39
+ */
40
+ export interface SnapshotArchiveRef {
41
+ /** The only format written today. Named rather than assumed, so a second one can arrive. */
42
+ format: 'parquet';
43
+ /**
44
+ * The disk the bytes went to, when a host named one.
45
+ *
46
+ * Absent means `path` is resolved by whatever wrote it — a filesystem path in
47
+ * a test, a bucket a host configured. The disk is recorded rather than
48
+ * inferred because a deployment may mount several and "which one" is not
49
+ * recoverable from the path.
50
+ */
51
+ disk?: string;
52
+ /** The directory holding this snapshot's parts and its manifest, without a trailing slash. */
53
+ path: string;
54
+ /** Rows in the archive. Compared against the snapshot's own count when it was written. */
55
+ rowCount: number;
56
+ /** Size on the far end, for a screen that has to say what a read will cost. */
57
+ bytes: number;
58
+ /**
59
+ * SHA-256 over the row stream in `_row` order, as the manifest records it.
60
+ *
61
+ * A row count catches a truncated archive and nothing else: an archive with
62
+ * every row present and one value corrupted has exactly the right count. This
63
+ * is the check that fails for that, and it is only meaningful because the
64
+ * stream is ordered — see the store's `streamSnapshot`.
65
+ */
66
+ checksum: string;
67
+ writtenAt: string;
68
+ /**
69
+ * When the archive was last read back and found to match.
70
+ *
71
+ * Separate from {@link writtenAt} because they answer different questions and
72
+ * a caller about to delete rows needs the second one. Absent means written but
73
+ * not confirmed readable, which is exactly the state in which nothing may be
74
+ * deleted.
75
+ */
76
+ verifiedAt?: string;
77
+ }
12
78
  /** A point-in-time view of one object type. */
13
79
  export interface SnapshotRef {
14
80
  /**
@@ -27,6 +93,14 @@ export interface SnapshotRef {
27
93
  principalId: string;
28
94
  /** Free-form provenance: which base, which file, which workflow run. */
29
95
  labels?: Record<string, string>;
96
+ /**
97
+ * Where this snapshot's rows have been copied to, if anywhere.
98
+ *
99
+ * Optional, and absent is the answer for every snapshot in every deployment
100
+ * that archives nothing — which is all of them until a host asks. See
101
+ * {@link SnapshotArchiveRef} for the three states its presence distinguishes.
102
+ */
103
+ archive?: SnapshotArchiveRef;
30
104
  }
31
105
  /**
32
106
  * How a store holds history. One list, so nothing narrows a stored or
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export { type AuditQuery, CATALOG_REVISION_LIMIT, CATALOG_TRACE_OUTCOMES, CATALO
23
23
  export { CATALOG_PRINCIPAL_RESOLVER, type CatalogActor, type CatalogGrants, type CatalogPrincipal, type CatalogPrincipalResolver, type CatalogScope, composePrincipalId, delegatePrincipal, expandScopes, hasScope, parsePrincipalId, PRINCIPAL_ACTOR_SEPARATOR, maySeeClassification, mayRead, mayWrite, readableObjectPage, StaticKeyPrincipalResolver, } from './catalog.principal';
24
24
  export * from './catalog.access';
25
25
  export * from './catalog.filters';
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';
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 SnapshotArchiveRef, 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
29
  export { isRelationKind, RELATION_KINDS } from './catalog.types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-catalog",
3
- "version": "0.30.0",
3
+ "version": "0.31.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",