@hop-top/kit 0.5.0-alpha.11 → 0.5.0-alpha.13
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/CHANGELOG.md +47 -0
- package/README.md +5 -5
- package/dist/bus-D2bAOPYz.d.ts +55 -0
- package/dist/bus.d.ts +1 -0
- package/dist/bus.js +13 -0
- package/dist/chunk-74E6RNOI.js +82 -0
- package/dist/chunk-B7XTFDBB.js +17 -0
- package/dist/chunk-CAONBSPO.js +497 -0
- package/dist/chunk-F7RSL4N4.js +88 -0
- package/dist/chunk-I6XDPSXQ.js +75 -0
- package/dist/chunk-IDM6YZXN.js +204 -0
- package/dist/chunk-P3Y46PYF.js +138 -0
- package/dist/chunk-VKQCOVKI.js +880 -0
- package/dist/cli.js +3 -3
- package/dist/id/index.d.ts +1 -1
- package/dist/id/index.js +4 -2
- package/dist/index-BqZ7WGQf.d.ts +731 -0
- package/dist/{index-VLDcI5NF.d.ts → index-D9zpUrpE.d.ts} +18 -6
- package/dist/index.d.ts +5 -2
- package/dist/index.js +27 -13
- package/dist/upgrade/drivers/configfile.d.ts +45 -0
- package/dist/upgrade/drivers/configfile.js +78 -0
- package/dist/upgrade/drivers/fsdir.d.ts +61 -0
- package/dist/upgrade/drivers/fsdir.js +170 -0
- package/dist/upgrade/drivers/postgres.d.ts +121 -0
- package/dist/upgrade/drivers/postgres.js +195 -0
- package/dist/upgrade/drivers/sqlite.d.ts +101 -0
- package/dist/upgrade/drivers/sqlite.js +241 -0
- package/dist/upgrade/index.d.ts +2 -0
- package/dist/upgrade/index.js +73 -0
- package/dist/uri-IJ_AoY3d.d.ts +144 -0
- package/dist/uri.d.ts +1 -0
- package/dist/uri.js +37 -0
- package/dist/version-DEJ3pbiO.d.ts +10 -0
- package/dist/wizard-Bf_qHc31.d.ts +159 -0
- package/dist/wizard.d.ts +1 -0
- package/dist/wizard.js +39 -0
- package/package.json +78 -19
- package/skills/hop-top-kit-ts/.claude-plugin/plugin.json +19 -0
- package/skills/hop-top-kit-ts/SKILL.md +117 -0
- package/skills/hop-top-kit-ts/assets/snippets/mcp/mcp.expected +2 -0
- package/skills/hop-top-kit-ts/assets/snippets/mcp/mcp.ts +20 -0
- package/skills/hop-top-kit-ts/assets/snippets/quickstart/quickstart.expected +13 -0
- package/skills/hop-top-kit-ts/assets/snippets/quickstart/quickstart.ts +26 -0
- package/skills/hop-top-kit-ts/gym.json +5 -0
- package/skills/hop-top-kit-ts/references/ai-and-agents.md +45 -0
- package/skills/hop-top-kit-ts/references/cli-and-console.md +63 -0
- package/skills/hop-top-kit-ts/references/coverage.md +56 -0
- package/skills/hop-top-kit-ts/references/guardrails-and-trust.md +60 -0
- package/skills/hop-top-kit-ts/references/other-ports.md +31 -0
- package/skills/hop-top-kit-ts/references/serving-and-transports.md +49 -0
- package/skills/hop-top-kit-ts/scripts/detect-port.sh +168 -0
- package/src/id/README.md +2 -2
- package/src/id/contract.test.ts +11 -8
- package/src/id/differential.test.ts +54 -0
- package/src/id/index.ts +123 -17
- package/src/index.test.ts +48 -2
- package/src/index.ts +6 -1
- package/src/published-types.test.ts +8 -0
- package/src/serve.stopped-order.test.ts +156 -0
- package/src/upgrade/README.md +42 -0
- package/src/upgrade/backup.ts +174 -0
- package/src/upgrade/conformance.test.ts +310 -0
- package/src/upgrade/document.ts +229 -0
- package/src/upgrade/driver.ts +66 -0
- package/src/upgrade/drivers/README.md +47 -0
- package/src/upgrade/drivers/configfile.test.ts +112 -0
- package/src/upgrade/drivers/configfile.ts +107 -0
- package/src/upgrade/drivers/fsdir.test.ts +188 -0
- package/src/upgrade/drivers/fsdir.ts +216 -0
- package/src/upgrade/drivers/isolation.test.ts +18 -0
- package/src/upgrade/drivers/postgres.integration.test.ts +395 -0
- package/src/upgrade/drivers/postgres.test.ts +272 -0
- package/src/upgrade/drivers/postgres.ts +284 -0
- package/src/upgrade/drivers/sqlite.integration.test.ts +492 -0
- package/src/upgrade/drivers/sqlite.ts +300 -0
- package/src/upgrade/drivers/version.ts +21 -0
- package/src/upgrade/errors.ts +117 -0
- package/src/upgrade/events.ts +117 -0
- package/src/{upgrade.test.ts → upgrade/index.test.ts} +102 -1
- package/src/{upgrade.ts → upgrade/index.ts} +96 -27
- package/src/upgrade/migration.ts +89 -0
- package/src/upgrade/migrator.test.ts +391 -0
- package/src/upgrade/migrator.ts +527 -0
- package/src/upgrade/options.ts +59 -0
- package/src/upgrade/semver.ts +90 -0
- package/test/skill-snippets.test.ts +60 -0
- package/test/upgrade/conformance-migrator.ts +439 -0
- package/test/upgrade/conformance-support.ts +44 -0
- package/test/upgrade/driver-support.ts +44 -0
- package/test/upgrade/pg-container.ts +64 -0
- package/test/upgrade/pg-race-worker.ts +48 -0
- package/test/upgrade/race-helper.ts +36 -0
- package/test/upgrade/sqlite-support.ts +41 -0
- package/test/upgrade/testdata/go-fsdir-mydata.tar.gz +0 -0
- package/vitest.config.ts +26 -0
- package/dist/chunk-4GPCWBBA.js +0 -143
- package/dist/chunk-L23O2FFE.js +0 -51
- package/dist/upgrade-C3RWGwRi.d.ts +0 -125
- package/dist/upgrade.d.ts +0 -1
- package/dist/upgrade.js +0 -7
- package/dist/{chunk-MFVUENZR.js → chunk-KV7FYEAF.js} +2 -2
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
import { E as Event } from './bus-D2bAOPYz.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Lenient semver for migration versions, ported from Go `core/upgrade`.
|
|
5
|
+
*
|
|
6
|
+
* Not the strict `semver` package: a leading `v` is dropped, build metadata
|
|
7
|
+
* after `+` is ignored, and each of major, minor and patch is the leading
|
|
8
|
+
* decimal digits of its dot-separated part (missing or non-numeric is 0;
|
|
9
|
+
* anything after the third dot belongs to patch and is ignored). A release
|
|
10
|
+
* sorts above its pre-releases; pre-release identifiers compare left to
|
|
11
|
+
* right, a numeric identifier (decimal, no leading zero) below an
|
|
12
|
+
* alphanumeric one, numbers by value, text bytewise, and a shorter list of
|
|
13
|
+
* equal identifiers first. Nothing here throws: any string parses.
|
|
14
|
+
*/
|
|
15
|
+
/** A parsed lenient version. `pre` is empty for a release. */
|
|
16
|
+
interface Semver {
|
|
17
|
+
major: number;
|
|
18
|
+
minor: number;
|
|
19
|
+
patch: number;
|
|
20
|
+
pre: string;
|
|
21
|
+
}
|
|
22
|
+
/** Parses `s` leniently. A leading `v` is NOT dropped here; see {@link compareVersions}. */
|
|
23
|
+
declare function parseSemver(s: string): Semver;
|
|
24
|
+
/** Orders two parsed versions: -1, 0 or 1. */
|
|
25
|
+
declare function compareSemver(a: Semver, b: Semver): -1 | 0 | 1;
|
|
26
|
+
/** Orders two version strings after dropping one leading `v`: -1, 0 or 1. */
|
|
27
|
+
declare function compareVersions(a: string, b: string): -1 | 0 | 1;
|
|
28
|
+
/** Drops one leading `v`. */
|
|
29
|
+
declare function trimV(s: string): string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Versioned schema migrations and the registry that holds them, ported
|
|
33
|
+
* from Go `core/upgrade`. The registry selects what is pending between two
|
|
34
|
+
* versions; running them is the Migrator's job.
|
|
35
|
+
*/
|
|
36
|
+
/** A versioned schema migration. */
|
|
37
|
+
interface Migration {
|
|
38
|
+
/** Semver, pre-release allowed. A leading `v` is dropped when ordering. */
|
|
39
|
+
version: string;
|
|
40
|
+
/** Matches the schema driver's name. */
|
|
41
|
+
schema: string;
|
|
42
|
+
/**
|
|
43
|
+
* A failed `up` is an applied step that cannot be downed: the run
|
|
44
|
+
* restores the backup it took (none on a server database or a handle:
|
|
45
|
+
* the run ends not restored), so keep an `up` atomic where there is none.
|
|
46
|
+
*/
|
|
47
|
+
up(signal?: AbortSignal): void | Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Undoes a completed `up` (after a failed `verify`, version record or
|
|
50
|
+
* final verify). Never called for a step whose own `up` failed. Absent
|
|
51
|
+
* means the rollback falls back to the backup.
|
|
52
|
+
*/
|
|
53
|
+
down?(signal?: AbortSignal): void | Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* When set, runs after `up` and before the version is recorded. A failure
|
|
56
|
+
* counts as a failed step and the rollback includes this migration.
|
|
57
|
+
*/
|
|
58
|
+
verify?(signal?: AbortSignal): void | Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Holds migrations for one or more Migrators. {@link registerMigration}
|
|
62
|
+
* feeds {@link defaultRegistry}; a Migrator reads that one unless given
|
|
63
|
+
* another, made with `new Registry()`.
|
|
64
|
+
*/
|
|
65
|
+
declare class Registry {
|
|
66
|
+
private migrations;
|
|
67
|
+
/** Adds a migration. Throws a TypeError when `up` is not a function. */
|
|
68
|
+
register(m: Migration): void;
|
|
69
|
+
/** Empties the registry. */
|
|
70
|
+
reset(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Migrations of `schema` whose version v satisfies from < v <= to,
|
|
73
|
+
* ascending by version, versions as registered. Equal versions have no
|
|
74
|
+
* defined order.
|
|
75
|
+
*/
|
|
76
|
+
pending(schema: string, from: string, to: string): Migration[];
|
|
77
|
+
}
|
|
78
|
+
/** The registry {@link registerMigration} adds to. */
|
|
79
|
+
declare function defaultRegistry(): Registry;
|
|
80
|
+
/** Adds a migration to the default registry. */
|
|
81
|
+
declare function registerMigration(m: Migration): void;
|
|
82
|
+
/** Clears the default registry. For tests only. */
|
|
83
|
+
declare function resetRegistryForTest(): void;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* In-memory JSON document migrator, ported from Go `upgrade.MigrateDocument`.
|
|
87
|
+
* A document is a JSON object with an integer version at `versionField`
|
|
88
|
+
* (dotted path). Steps move it `from -> to`; the chain follows versions, not
|
|
89
|
+
* the order of steps. No I/O; the caller's input is never modified.
|
|
90
|
+
*
|
|
91
|
+
* Same shape as Go with two TypeScript differences: JSON numbers are JS
|
|
92
|
+
* numbers (integers past 2^53 lose exactness), and the re-encoded document
|
|
93
|
+
* keeps key insertion order where Go sorts keys.
|
|
94
|
+
*/
|
|
95
|
+
/** A decoded JSON object. */
|
|
96
|
+
type JsonObject = {
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Moves a document from version `from` to `to` (to > from). `apply` gets a
|
|
101
|
+
* private copy and may mutate it in place; it returns the migrated document.
|
|
102
|
+
* The version field is set to `to` after `apply`, so `apply` need not touch it.
|
|
103
|
+
*/
|
|
104
|
+
interface DocStep {
|
|
105
|
+
from: number;
|
|
106
|
+
to: number;
|
|
107
|
+
apply(doc: JsonObject): JsonObject;
|
|
108
|
+
/** Optional; runs on `apply`'s result. Throw to fail the step. */
|
|
109
|
+
verify?(doc: JsonObject): void;
|
|
110
|
+
note?: string;
|
|
111
|
+
}
|
|
112
|
+
interface DocOptions {
|
|
113
|
+
/** Dotted path of the integer version; `version` when empty. */
|
|
114
|
+
versionField?: string;
|
|
115
|
+
/** The version this build writes; 0 or absent means the highest `to`. */
|
|
116
|
+
latest?: number;
|
|
117
|
+
/** Read a missing or non-integer version as 0 instead of failing. */
|
|
118
|
+
missingIsZero?: boolean;
|
|
119
|
+
}
|
|
120
|
+
interface DocApplied {
|
|
121
|
+
from: number;
|
|
122
|
+
to: number;
|
|
123
|
+
note: string;
|
|
124
|
+
}
|
|
125
|
+
/** Says what the migration did. */
|
|
126
|
+
interface DocReport {
|
|
127
|
+
from: number;
|
|
128
|
+
to: number;
|
|
129
|
+
applied: DocApplied[];
|
|
130
|
+
}
|
|
131
|
+
/** Why a document migration failed. */
|
|
132
|
+
type DocKind = 'newer' | 'version' | 'gap' | 'step' | 'verify' | 'invalid';
|
|
133
|
+
/** Every failure of the document migrator; `kind` says which. `cause` is the step's own error, when there is one. */
|
|
134
|
+
declare class DocError extends Error {
|
|
135
|
+
readonly kind: DocKind;
|
|
136
|
+
constructor(kind: DocKind, message: string, cause?: unknown);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Migrates one JSON document given as text or UTF-8 bytes. When it is
|
|
140
|
+
* already at the latest version the input is returned as it is, byte for
|
|
141
|
+
* byte; otherwise the result is re-encoded. The result has the type of the
|
|
142
|
+
* input. Throws {@link DocError}; the input is untouched either way.
|
|
143
|
+
*/
|
|
144
|
+
declare function migrateDocument<T extends string | Uint8Array>(doc: T, steps: DocStep[], opts?: DocOptions): {
|
|
145
|
+
doc: T;
|
|
146
|
+
report: DocReport;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* {@link migrateDocument} on a decoded document. The caller's object is
|
|
150
|
+
* never modified; steps work on a deep copy. Throws {@link DocError}.
|
|
151
|
+
*/
|
|
152
|
+
declare function migrateDocumentValue(doc: JsonObject, steps: DocStep[], opts?: DocOptions): {
|
|
153
|
+
doc: JsonObject;
|
|
154
|
+
report: DocReport;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Errors of the Migrator, ported from Go `core/upgrade`. Go matches them
|
|
159
|
+
* with `errors.Is` through wrapped errors; here a wrapped error keeps its
|
|
160
|
+
* cause in `cause` (and in `errors` when two failures are reported
|
|
161
|
+
* together), and the type guards walk that chain.
|
|
162
|
+
*/
|
|
163
|
+
/** Text of an unknown thrown value: a message for an Error, else String(). */
|
|
164
|
+
declare function errorText(e: unknown): string;
|
|
165
|
+
/**
|
|
166
|
+
* A Migrator error that wraps what caused it. `cause` is the first
|
|
167
|
+
* underlying failure; `errors` lists every one when a run failed and its
|
|
168
|
+
* rollback failed too.
|
|
169
|
+
*/
|
|
170
|
+
declare class UpgradeError extends Error {
|
|
171
|
+
readonly errors: readonly unknown[];
|
|
172
|
+
constructor(message: string, cause?: unknown, errors?: readonly unknown[]);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* What a driver's `backup` or `restore` throws when kit cannot back up or
|
|
176
|
+
* restore its store (a server database, a file under a live connection
|
|
177
|
+
* pool). A `backup` that throws it is not a failure: the run goes on with
|
|
178
|
+
* no backup. A `restore` that throws it restores nothing. Wrap it with
|
|
179
|
+
* `cause` to keep it matchable: {@link isBackupUnsupported}.
|
|
180
|
+
*/
|
|
181
|
+
declare class BackupUnsupportedError extends Error {
|
|
182
|
+
constructor(message?: string, options?: {
|
|
183
|
+
cause?: unknown;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* A rollback that could not undo a failed run: a `down` was missing or
|
|
188
|
+
* failed, or the newest step's `up` failed (it cannot be downed), and no
|
|
189
|
+
* backup could restore the schema, so the stored version stays at the last
|
|
190
|
+
* step still applied. The run's error carries it in its
|
|
191
|
+
* chain: {@link isNotRestored}. No `reverted` event is published for it.
|
|
192
|
+
* `message` is the text the vectors pin; `cause` is typically a
|
|
193
|
+
* {@link BackupUnsupportedError}.
|
|
194
|
+
*/
|
|
195
|
+
declare class NotRestoredError extends Error {
|
|
196
|
+
constructor(message: string, options?: {
|
|
197
|
+
cause?: unknown;
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* A failed `Migration.verify` or final verify check. Keeps the check's own
|
|
202
|
+
* text and carries its error as `cause`: {@link isVerifyError}. The
|
|
203
|
+
* document migrator's `DocError` of kind `verify` is a different thing.
|
|
204
|
+
*/
|
|
205
|
+
declare class VerifyError extends Error {
|
|
206
|
+
constructor(cause: unknown);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The run's signal was aborted. The text is Go's `context canceled`, or
|
|
210
|
+
* `context deadline exceeded` when the abort reason is a `TimeoutError`
|
|
211
|
+
* (`AbortSignal.timeout`); `cause` is the signal's reason.
|
|
212
|
+
*/
|
|
213
|
+
declare class CanceledError extends Error {
|
|
214
|
+
constructor(signal: AbortSignal);
|
|
215
|
+
}
|
|
216
|
+
/** The error a driver's `lock` rejects with when its signal aborts while it waits. */
|
|
217
|
+
declare function abortError(signal: AbortSignal): CanceledError;
|
|
218
|
+
/** Whether `err` is, or wraps, a {@link BackupUnsupportedError}. */
|
|
219
|
+
declare function isBackupUnsupported(err: unknown): boolean;
|
|
220
|
+
/** Whether `err` is, or wraps, a {@link NotRestoredError}. */
|
|
221
|
+
declare function isNotRestored(err: unknown): boolean;
|
|
222
|
+
/** Whether `err` is, or wraps, a {@link VerifyError}. */
|
|
223
|
+
declare function isVerifyError(err: unknown): boolean;
|
|
224
|
+
/** Whether `err` is, or wraps, a {@link CanceledError}. */
|
|
225
|
+
declare function isCanceled(err: unknown): boolean;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* The seam between the Migrator and a data store, ported from Go
|
|
229
|
+
* `core/upgrade` `SchemaDriver`.
|
|
230
|
+
*
|
|
231
|
+
* Every method may return a value or a Promise: a driver for a server
|
|
232
|
+
* database is async, one over `better-sqlite3` or a file is sync, and the
|
|
233
|
+
* Migrator awaits either. Capabilities are optional members the Migrator
|
|
234
|
+
* detects by shape, so a later driver adds one without any change to the
|
|
235
|
+
* Migrator: `lock` (a method) and `storesVersion` (a flag).
|
|
236
|
+
*/
|
|
237
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
238
|
+
/** Releases a lock taken by {@link SchemaDriver.lock}. */
|
|
239
|
+
type Unlock = () => MaybePromise<void>;
|
|
240
|
+
interface SchemaDriver {
|
|
241
|
+
/** The schema identifier, matched against `Migration.schema`. */
|
|
242
|
+
name(): string;
|
|
243
|
+
/** The applied version, or `""` when none is stored. */
|
|
244
|
+
version(): MaybePromise<string>;
|
|
245
|
+
/**
|
|
246
|
+
* Records a version: after each applied migration, and the earlier one
|
|
247
|
+
* again after a rollback or restore. For a driver without
|
|
248
|
+
* `storesVersion`, called after the Migrator wrote the version file.
|
|
249
|
+
*/
|
|
250
|
+
setVersion(version: string): MaybePromise<void>;
|
|
251
|
+
/**
|
|
252
|
+
* Copies the current state into the existing directory `dest`. Resolve
|
|
253
|
+
* only when it really did; throw {@link BackupUnsupportedError} (or an
|
|
254
|
+
* error whose cause chain has one) when it cannot; any other throw is a
|
|
255
|
+
* failure that stops the run.
|
|
256
|
+
*/
|
|
257
|
+
backup(dest: string): MaybePromise<void>;
|
|
258
|
+
/**
|
|
259
|
+
* Replaces the current state from the backup directory `src`. Same
|
|
260
|
+
* contract as `backup`: resolve only when it really restored.
|
|
261
|
+
*/
|
|
262
|
+
restore(src: string): MaybePromise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Optional, for a store several processes can migrate at once. The
|
|
265
|
+
* Migrator calls it before it reads the version and holds the lock for
|
|
266
|
+
* the whole run of that schema (version read, baseline, backup, every
|
|
267
|
+
* `up`, every version record, rollback, prune), then calls the returned
|
|
268
|
+
* unlock, on every path.
|
|
269
|
+
*
|
|
270
|
+
* Wait until the lock is acquired or `signal` aborts; in the second
|
|
271
|
+
* case reject with `abortError(signal)` and hold nothing. A rejection
|
|
272
|
+
* fails the schema before anything else (`lock: <message>`, no unlock).
|
|
273
|
+
* An unlock failure is only a warning. `RollbackLatest` locks too;
|
|
274
|
+
* `status` never does.
|
|
275
|
+
*/
|
|
276
|
+
lock?(signal?: AbortSignal): MaybePromise<Unlock>;
|
|
277
|
+
/**
|
|
278
|
+
* Optional: `true` when the driver keeps its version itself (a database
|
|
279
|
+
* table). The Migrator then calls only `setVersion` to record a version
|
|
280
|
+
* and writes no version file; `version()` is the one authority.
|
|
281
|
+
*/
|
|
282
|
+
readonly storesVersion?: boolean;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Migration lifecycle events, ported from Go `core/upgrade/migrate_events.go`.
|
|
287
|
+
* Published as kit bus `Event`s (the `Bus` of the SDK's bus module):
|
|
288
|
+
* pass any object with `publish(event)`, typically a `Bus`. Payload keys
|
|
289
|
+
* are the Go JSON names.
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
/** Anything events can be published to; a kit `Bus` fits. */
|
|
293
|
+
interface EventPublisher {
|
|
294
|
+
publish(event: Event): void;
|
|
295
|
+
}
|
|
296
|
+
/** Source set on every published event. */
|
|
297
|
+
declare const PUBLISH_SOURCE = "core.upgrade";
|
|
298
|
+
/**
|
|
299
|
+
* Topics a Migrator publishes on. Run level: `runStarted`, then
|
|
300
|
+
* `runCompleted` or `runFailed`. `baselined` follows a baseline stamp,
|
|
301
|
+
* before that schema's migrations. Per migration: `started`, then
|
|
302
|
+
* `applied` and `verified`, or `failed`; `reverted` follows a rollback
|
|
303
|
+
* that succeeded. The final verify publishes `verified` with
|
|
304
|
+
* `final: true`, or `failed` with stage `final`.
|
|
305
|
+
*/
|
|
306
|
+
interface MigrationTopics {
|
|
307
|
+
runStarted: string;
|
|
308
|
+
runCompleted: string;
|
|
309
|
+
runFailed: string;
|
|
310
|
+
started: string;
|
|
311
|
+
applied: string;
|
|
312
|
+
verified: string;
|
|
313
|
+
failed: string;
|
|
314
|
+
reverted: string;
|
|
315
|
+
baselined: string;
|
|
316
|
+
}
|
|
317
|
+
/** `kit.core.migration.<action>`. */
|
|
318
|
+
declare const DEFAULT_MIGRATION_TOPICS: MigrationTopics;
|
|
319
|
+
/** Every topic from a 3-segment prefix (`myapp.core.migration`). Throws a TypeError otherwise. */
|
|
320
|
+
declare function topicsFromPrefix(prefix: string): MigrationTopics;
|
|
321
|
+
/** Payload of run_started, run_completed and run_failed. */
|
|
322
|
+
interface MigrationRunPayload {
|
|
323
|
+
tool: string;
|
|
324
|
+
to: string;
|
|
325
|
+
applied?: number;
|
|
326
|
+
schema?: string;
|
|
327
|
+
error?: string;
|
|
328
|
+
duration_ms?: number;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Payload of the per-migration events. `from` is the version before the
|
|
332
|
+
* step, `to` the step's version. For `reverted`, `from` is the version
|
|
333
|
+
* being attempted and `to` the stored version restored. For `baselined`,
|
|
334
|
+
* `from` is `""` and `to` the version the store was stamped at.
|
|
335
|
+
*/
|
|
336
|
+
interface MigrationPayload {
|
|
337
|
+
tool: string;
|
|
338
|
+
schema: string;
|
|
339
|
+
from: string;
|
|
340
|
+
to: string;
|
|
341
|
+
/** failed: up, verify, record, final, canceled. */
|
|
342
|
+
stage?: string;
|
|
343
|
+
/** reverted: down, restore. */
|
|
344
|
+
method?: string;
|
|
345
|
+
/** verified by the final verify. */
|
|
346
|
+
final?: boolean;
|
|
347
|
+
error?: string;
|
|
348
|
+
duration_ms?: number;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** Options and result types of the {@link Migrator}. */
|
|
352
|
+
|
|
353
|
+
/** Options of a {@link Migrator}. */
|
|
354
|
+
interface MigratorOptions {
|
|
355
|
+
/** Disables automatic rollback on failure; enables `rollbackLatest`. */
|
|
356
|
+
manualRollback?: boolean;
|
|
357
|
+
/** Recent backups kept per schema (default 5). */
|
|
358
|
+
backupRetention?: number;
|
|
359
|
+
/** Migrations to read instead of the default registry. */
|
|
360
|
+
registry?: Registry;
|
|
361
|
+
/**
|
|
362
|
+
* Where version files and backups live instead of
|
|
363
|
+
* `<xdg data dir>/hop/<tool>`. Drivers that read the version file need
|
|
364
|
+
* the same dir (`readVersionFile`).
|
|
365
|
+
*/
|
|
366
|
+
dataDir?: string;
|
|
367
|
+
/**
|
|
368
|
+
* Checks each schema's final state after its last pending migration,
|
|
369
|
+
* once that migration's version is recorded. A failure rolls back every
|
|
370
|
+
* migration applied to that schema in the run.
|
|
371
|
+
*/
|
|
372
|
+
verify?: (schema: string, version: string, signal?: AbortSignal) => void | Promise<void>;
|
|
373
|
+
/**
|
|
374
|
+
* What an unversioned store is already at. Called when a driver's
|
|
375
|
+
* `version()` is `""`, before pending selection; a non-empty result is
|
|
376
|
+
* recorded like any version (event `baselined`) and the migrations at or
|
|
377
|
+
* below it are not applied. An error fails that schema's run
|
|
378
|
+
* (`baseline: ...`) before any backup or `up`. Never called when a
|
|
379
|
+
* version is stored, when reading it failed, or by `status`.
|
|
380
|
+
*/
|
|
381
|
+
baseline?: (schema: string, signal?: AbortSignal) => string | undefined | Promise<string | undefined>;
|
|
382
|
+
/** Receives the lifecycle events (a kit `Bus` fits). Without it a Migrator is silent. */
|
|
383
|
+
publisher?: EventPublisher;
|
|
384
|
+
/** Replaces individual topics; others keep their `kit.core.migration.*` value. */
|
|
385
|
+
topics?: Partial<MigrationTopics>;
|
|
386
|
+
/** Sets every topic from a 3-segment prefix (`myapp.core.migration`); `topics` wins per field. */
|
|
387
|
+
topicPrefix?: string;
|
|
388
|
+
/** Receives warnings (an unlock or a prune that failed). Default `console.warn`. */
|
|
389
|
+
warn?: (message: string) => void;
|
|
390
|
+
}
|
|
391
|
+
/** A successfully applied migration. */
|
|
392
|
+
interface AppliedMigration {
|
|
393
|
+
version: string;
|
|
394
|
+
schema: string;
|
|
395
|
+
}
|
|
396
|
+
/** Migration state of one schema. */
|
|
397
|
+
interface SchemaStatus {
|
|
398
|
+
schema: string;
|
|
399
|
+
current: string;
|
|
400
|
+
target: string;
|
|
401
|
+
pending: number;
|
|
402
|
+
/** Set when the driver's `version()` failed; `current` is then `""`. */
|
|
403
|
+
error?: Error;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* The migration runner, ported from Go `core/upgrade/migrate.go`: per
|
|
408
|
+
* schema driver, lock, read the version, baseline, pending selection,
|
|
409
|
+
* backup, each `up` then `verify` then the version record, final verify,
|
|
410
|
+
* rollback, prune, unlock.
|
|
411
|
+
*/
|
|
412
|
+
|
|
413
|
+
/** Orchestrates versioned migrations across schema drivers. */
|
|
414
|
+
declare class Migrator {
|
|
415
|
+
readonly tool: string;
|
|
416
|
+
private readonly drivers;
|
|
417
|
+
private readonly applied;
|
|
418
|
+
private readonly target;
|
|
419
|
+
private readonly opts;
|
|
420
|
+
private readonly registry;
|
|
421
|
+
private readonly topics;
|
|
422
|
+
private readonly warn;
|
|
423
|
+
constructor(tool: string, version: string, options?: MigratorOptions);
|
|
424
|
+
/** The target version, without a leading `v`. */
|
|
425
|
+
get version(): string;
|
|
426
|
+
/** Registers a schema driver; drivers run in the order added. */
|
|
427
|
+
addDriver(d: SchemaDriver): void;
|
|
428
|
+
/** Migrations applied by this Migrator so far, cumulative. */
|
|
429
|
+
history(): AppliedMigration[];
|
|
430
|
+
/**
|
|
431
|
+
* Executes pending migrations for every driver. Per schema: take the
|
|
432
|
+
* driver's lock (held until the schema's run ends, rollback included),
|
|
433
|
+
* read the version (when none is stored, ask `baseline` and record its
|
|
434
|
+
* answer), select pending, back up (and save the version the run starts
|
|
435
|
+
* at beside it), then per migration `up`, `verify` and the version
|
|
436
|
+
* record, then the final verify. An unsupported backup lets the run go
|
|
437
|
+
* on with no backup. On failure in auto mode: roll back (`down` in
|
|
438
|
+
* reverse, recording the version before each, else `restore` and record
|
|
439
|
+
* the starting version). A migration whose `up` failed counts as applied
|
|
440
|
+
* but cannot be downed (its `down` is never called): the run restores
|
|
441
|
+
* the backup at once and no older `down` runs. When a `down` is missing
|
|
442
|
+
* or fails, or the `up` failed, and no backup can restore the schema,
|
|
443
|
+
* nothing is reverted and the error matches `isNotRestored`; the stored
|
|
444
|
+
* version stays at the last step still applied. An aborted `signal`
|
|
445
|
+
* stops before the next `up` (`up <v> canceled: context canceled`).
|
|
446
|
+
* Rejects with the first failing schema's error, `migrate <schema>: ...`.
|
|
447
|
+
*/
|
|
448
|
+
run(signal?: AbortSignal): Promise<void>;
|
|
449
|
+
/** Pending migration counts per driver. Takes no lock and never baselines. */
|
|
450
|
+
status(): Promise<SchemaStatus[]>;
|
|
451
|
+
/**
|
|
452
|
+
* Restores the latest backup of each driver, then records the version
|
|
453
|
+
* the run that took it started at (saved beside the backup). A backup
|
|
454
|
+
* without that record is still restored, the version is left as it is
|
|
455
|
+
* and the error says so. A driver with `lock` is locked while its schema
|
|
456
|
+
* is rolled back (lock, backup lookup, restore, record, unlock); the
|
|
457
|
+
* version is not read and no events are published. A schema with no
|
|
458
|
+
* backup, or whose `restore` is unsupported, fails with an error that
|
|
459
|
+
* matches `isNotRestored`; nothing is recorded for it. Manual mode only.
|
|
460
|
+
*/
|
|
461
|
+
rollbackLatest(): Promise<void>;
|
|
462
|
+
private baseDir;
|
|
463
|
+
private backups;
|
|
464
|
+
/**
|
|
465
|
+
* Takes the driver's lock when it has one and returns what releases it.
|
|
466
|
+
* The release never throws: a failed unlock is a warning.
|
|
467
|
+
*/
|
|
468
|
+
private lockDriver;
|
|
469
|
+
private rollbackLatestOne;
|
|
470
|
+
private runSchema;
|
|
471
|
+
private runLocked;
|
|
472
|
+
/**
|
|
473
|
+
* Makes the backup directory (named after the first pending version),
|
|
474
|
+
* has the driver fill it and saves beside it the version the run starts
|
|
475
|
+
* at. A backup that is unsupported is no failure: the directory this
|
|
476
|
+
* call created is removed again, no version is saved and the run goes on.
|
|
477
|
+
*/
|
|
478
|
+
private takeBackup;
|
|
479
|
+
/** Asks `baseline` what the unversioned store is at and records a non-empty answer. */
|
|
480
|
+
private stampBaseline;
|
|
481
|
+
/** `up`, `verify` and the version record per pending migration, then the final verify. */
|
|
482
|
+
private applyAll;
|
|
483
|
+
/**
|
|
484
|
+
* Rolls back (auto mode) and builds the schema's error. The undo list is
|
|
485
|
+
* empty only when nothing ran: a canceled run before the first `up`.
|
|
486
|
+
*/
|
|
487
|
+
private fail;
|
|
488
|
+
/**
|
|
489
|
+
* Runs `down` in reverse order, recording the version before each
|
|
490
|
+
* migration once its `down` succeeded; falls back to `restore` (and
|
|
491
|
+
* records the starting version) if a `down` is missing or fails. Returns
|
|
492
|
+
* which of the two undid the changes. When `upFailed`, the newest step's
|
|
493
|
+
* `up` failed: its `down` is never called (a `down` assumes a completed
|
|
494
|
+
* `up`), so the rollback restores at once and no older `down` runs. A
|
|
495
|
+
* failed record stops the rollback. With no backup, or a `restore` that
|
|
496
|
+
* is unsupported, nothing is restored: a NotRestoredError, and the
|
|
497
|
+
* version stays at the last record, the step whose `down` was missing,
|
|
498
|
+
* failed or not callable. Runs without the run's signal, so a canceled
|
|
499
|
+
* run still rolls back.
|
|
500
|
+
*/
|
|
501
|
+
private rollback;
|
|
502
|
+
/**
|
|
503
|
+
* Records a version for the driver. A driver with `storesVersion` owns
|
|
504
|
+
* its version: only `setVersion` is called, no version file is touched.
|
|
505
|
+
* Any other driver gets the version file first (the canonical copy) and
|
|
506
|
+
* then `setVersion` as a notification, so a refused `setVersion` leaves
|
|
507
|
+
* the file at the new version.
|
|
508
|
+
*/
|
|
509
|
+
private setVersion;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/** The default data dir of a tool: `<xdg data dir>/hop/<tool>`. */
|
|
513
|
+
declare function defaultDataDir(tool: string): string;
|
|
514
|
+
/**
|
|
515
|
+
* Reads `<dataDir>/<schema>/version`, trimmed. Resolves `""` when the file
|
|
516
|
+
* does not exist. For drivers that read what the Migrator recorded.
|
|
517
|
+
*/
|
|
518
|
+
declare function readVersionFile(dataDir: string, schema: string): Promise<string>;
|
|
519
|
+
/** Writes `<dataDir>/<schema>/version`, creating the directory. */
|
|
520
|
+
declare function writeVersionFile(dataDir: string, schema: string, version: string): Promise<void>;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* @packageDocumentation
|
|
524
|
+
*
|
|
525
|
+
* Version check and notify — compares the running tool version against the
|
|
526
|
+
* latest GitHub release and writes a human-readable upgrade notice to any
|
|
527
|
+
* {@link https://nodejs.org/api/stream.html#class-streamwritable | Writable}
|
|
528
|
+
* stream when a newer release is available.
|
|
529
|
+
*
|
|
530
|
+
* ### Cache behaviour
|
|
531
|
+
* Results are persisted to `{stateDir}/.upgrade-{name}-cache.json`.
|
|
532
|
+
* The cache stores `{ version, checkedAt }`. On the next call within `cacheTTL`
|
|
533
|
+
* milliseconds the remote API is not contacted; the cached version is used
|
|
534
|
+
* directly. After the TTL expires the cache is refreshed on the next call.
|
|
535
|
+
* Cache I/O errors are swallowed — a stale or missing cache simply causes a
|
|
536
|
+
* fresh fetch.
|
|
537
|
+
*
|
|
538
|
+
* ### Error handling philosophy
|
|
539
|
+
* Version checking is a best-effort, non-critical operation. Any failure —
|
|
540
|
+
* network error, bad JSON, HTTP error, filesystem error, invalid semver — is
|
|
541
|
+
* silently discarded by `notifyIfAvailable`, which always resolves without
|
|
542
|
+
* throwing. `check()` is the strict variant: it rejects with an
|
|
543
|
+
* {@link UpgradeCheckError} so callers (e.g. `upgrade --check`) can tell a
|
|
544
|
+
* failed lookup from "up to date".
|
|
545
|
+
*
|
|
546
|
+
* ### Notice format
|
|
547
|
+
* ```
|
|
548
|
+
* \nA new release of {name} is available: v{current} → v{latest}\nhttps://github.com/{owner}/{repo}/releases/latest\n
|
|
549
|
+
* ```
|
|
550
|
+
*
|
|
551
|
+
* ### Component tags and prereleases
|
|
552
|
+
* By default the check reads `releases/latest` and strips a leading `v`.
|
|
553
|
+
* Set `tagPrefix` (e.g. `xray/v`) for a monorepo whose tags carry a
|
|
554
|
+
* component: releases are listed, tags without the prefix are ignored, and
|
|
555
|
+
* the notice links to the matching release. Set `includePrereleases` to
|
|
556
|
+
* consider prereleases; without it, prereleases are never offered. Both
|
|
557
|
+
* options list at most 3 pages of 100 releases, newest first, drafts
|
|
558
|
+
* skipped; the highest semver wins.
|
|
559
|
+
*
|
|
560
|
+
* ### Usage example
|
|
561
|
+
* ```ts
|
|
562
|
+
* import { createChecker } from '@hop-top/kit/upgrade';
|
|
563
|
+
*
|
|
564
|
+
* const checker = createChecker({
|
|
565
|
+
* name: 'my-cli',
|
|
566
|
+
* currentVersion: '1.2.3',
|
|
567
|
+
* owner: 'myorg',
|
|
568
|
+
* repo: 'my-cli',
|
|
569
|
+
* });
|
|
570
|
+
*
|
|
571
|
+
* // At the end of your CLI command:
|
|
572
|
+
* await checker.notifyIfAvailable(process.stderr);
|
|
573
|
+
* ```
|
|
574
|
+
*/
|
|
575
|
+
/**
|
|
576
|
+
* Static configuration for a version {@link Checker}.
|
|
577
|
+
*/
|
|
578
|
+
interface CheckerOptions {
|
|
579
|
+
/** Human-readable tool name shown in the upgrade notice. */
|
|
580
|
+
name: string;
|
|
581
|
+
/** Currently running version string (semver, without leading `v`). */
|
|
582
|
+
currentVersion: string;
|
|
583
|
+
/** GitHub organisation or username that owns the repository. */
|
|
584
|
+
owner: string;
|
|
585
|
+
/** GitHub repository name. */
|
|
586
|
+
repo: string;
|
|
587
|
+
/**
|
|
588
|
+
* How long (ms) a cached result stays valid before a fresh fetch is made.
|
|
589
|
+
* @defaultValue 86_400_000 (24 hours)
|
|
590
|
+
*/
|
|
591
|
+
cacheTTL?: number;
|
|
592
|
+
/**
|
|
593
|
+
* Directory used to store the cache file.
|
|
594
|
+
* @defaultValue `os.tmpdir()`
|
|
595
|
+
*/
|
|
596
|
+
stateDir?: string;
|
|
597
|
+
/**
|
|
598
|
+
* HTTP request timeout in milliseconds.
|
|
599
|
+
* @defaultValue 10_000
|
|
600
|
+
*/
|
|
601
|
+
timeout?: number;
|
|
602
|
+
/**
|
|
603
|
+
* Tag prefix identifying this tool's releases, stripped before the semver
|
|
604
|
+
* comparison (e.g. `'xray/v'` for tags like `xray/v0.2.0`). Tags without
|
|
605
|
+
* the prefix are not candidates. Setting it lists releases instead of
|
|
606
|
+
* reading `releases/latest`, which may belong to another component.
|
|
607
|
+
* @defaultValue `''` (no prefix; `releases/latest`)
|
|
608
|
+
*/
|
|
609
|
+
tagPrefix?: string;
|
|
610
|
+
/**
|
|
611
|
+
* Offer prereleases (e.g. `0.1.0-rc.1`) as upgrades. Setting it lists
|
|
612
|
+
* releases instead of reading `releases/latest`, which skips prereleases.
|
|
613
|
+
* @defaultValue false
|
|
614
|
+
*/
|
|
615
|
+
includePrereleases?: boolean;
|
|
616
|
+
}
|
|
617
|
+
/** Outcome of {@link Checker.check}. */
|
|
618
|
+
interface UpgradeCheckResult {
|
|
619
|
+
/** Running version, as configured. */
|
|
620
|
+
current: string;
|
|
621
|
+
/** Latest release version (no leading `v` / tag prefix). */
|
|
622
|
+
latest: string;
|
|
623
|
+
/** True when `latest` is strictly greater than `current`. */
|
|
624
|
+
updateAvailable: boolean;
|
|
625
|
+
/** Release page to link to. */
|
|
626
|
+
url: string;
|
|
627
|
+
}
|
|
628
|
+
/** Rejection of {@link Checker.check}; the underlying error is in `cause`. */
|
|
629
|
+
declare class UpgradeCheckError extends Error {
|
|
630
|
+
constructor(message: string, options?: {
|
|
631
|
+
cause?: unknown;
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Returned by {@link createChecker}. Call {@link Checker.notifyIfAvailable}
|
|
636
|
+
* at the end of a CLI command to surface upgrade notices non-intrusively.
|
|
637
|
+
*/
|
|
638
|
+
interface Checker {
|
|
639
|
+
/**
|
|
640
|
+
* Looks up the latest release and resolves with the outcome. Unlike
|
|
641
|
+
* {@link Checker.notifyIfAvailable} it never swallows failures: network,
|
|
642
|
+
* HTTP, parse and "no matching release" errors reject with an
|
|
643
|
+
* {@link UpgradeCheckError}, so callers can tell a failed lookup from
|
|
644
|
+
* "up to date". Honours `tagPrefix`, `includePrereleases` and the cache;
|
|
645
|
+
* pass `cacheTTL: 0` to bypass the cache.
|
|
646
|
+
*/
|
|
647
|
+
check(): Promise<UpgradeCheckResult>;
|
|
648
|
+
/**
|
|
649
|
+
* Checks for a newer GitHub release and writes a one-line notice to `out`
|
|
650
|
+
* if one is available. Silently swallows all errors.
|
|
651
|
+
*
|
|
652
|
+
* @param out - Any Node.js writable stream (e.g. `process.stderr`).
|
|
653
|
+
*/
|
|
654
|
+
notifyIfAvailable(out: NodeJS.WritableStream): Promise<void>;
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Creates a {@link Checker} configured with the provided options.
|
|
658
|
+
*
|
|
659
|
+
* The checker is stateless beyond what is persisted in the cache file; it is
|
|
660
|
+
* safe to create multiple instances with the same options.
|
|
661
|
+
*
|
|
662
|
+
* @param opts - Configuration options; see {@link CheckerOptions}.
|
|
663
|
+
* @returns A {@link Checker} ready to call.
|
|
664
|
+
*/
|
|
665
|
+
declare function createChecker(opts: CheckerOptions): Checker;
|
|
666
|
+
|
|
667
|
+
type index_AppliedMigration = AppliedMigration;
|
|
668
|
+
type index_BackupUnsupportedError = BackupUnsupportedError;
|
|
669
|
+
declare const index_BackupUnsupportedError: typeof BackupUnsupportedError;
|
|
670
|
+
type index_CanceledError = CanceledError;
|
|
671
|
+
declare const index_CanceledError: typeof CanceledError;
|
|
672
|
+
type index_Checker = Checker;
|
|
673
|
+
type index_CheckerOptions = CheckerOptions;
|
|
674
|
+
declare const index_DEFAULT_MIGRATION_TOPICS: typeof DEFAULT_MIGRATION_TOPICS;
|
|
675
|
+
type index_DocApplied = DocApplied;
|
|
676
|
+
type index_DocError = DocError;
|
|
677
|
+
declare const index_DocError: typeof DocError;
|
|
678
|
+
type index_DocKind = DocKind;
|
|
679
|
+
type index_DocOptions = DocOptions;
|
|
680
|
+
type index_DocReport = DocReport;
|
|
681
|
+
type index_DocStep = DocStep;
|
|
682
|
+
type index_EventPublisher = EventPublisher;
|
|
683
|
+
type index_JsonObject = JsonObject;
|
|
684
|
+
type index_Migration = Migration;
|
|
685
|
+
type index_MigrationPayload = MigrationPayload;
|
|
686
|
+
type index_MigrationRunPayload = MigrationRunPayload;
|
|
687
|
+
type index_MigrationTopics = MigrationTopics;
|
|
688
|
+
type index_Migrator = Migrator;
|
|
689
|
+
declare const index_Migrator: typeof Migrator;
|
|
690
|
+
type index_MigratorOptions = MigratorOptions;
|
|
691
|
+
type index_NotRestoredError = NotRestoredError;
|
|
692
|
+
declare const index_NotRestoredError: typeof NotRestoredError;
|
|
693
|
+
declare const index_PUBLISH_SOURCE: typeof PUBLISH_SOURCE;
|
|
694
|
+
type index_Registry = Registry;
|
|
695
|
+
declare const index_Registry: typeof Registry;
|
|
696
|
+
type index_SchemaDriver = SchemaDriver;
|
|
697
|
+
type index_SchemaStatus = SchemaStatus;
|
|
698
|
+
type index_Semver = Semver;
|
|
699
|
+
type index_Unlock = Unlock;
|
|
700
|
+
type index_UpgradeCheckError = UpgradeCheckError;
|
|
701
|
+
declare const index_UpgradeCheckError: typeof UpgradeCheckError;
|
|
702
|
+
type index_UpgradeCheckResult = UpgradeCheckResult;
|
|
703
|
+
type index_UpgradeError = UpgradeError;
|
|
704
|
+
declare const index_UpgradeError: typeof UpgradeError;
|
|
705
|
+
type index_VerifyError = VerifyError;
|
|
706
|
+
declare const index_VerifyError: typeof VerifyError;
|
|
707
|
+
declare const index_abortError: typeof abortError;
|
|
708
|
+
declare const index_compareSemver: typeof compareSemver;
|
|
709
|
+
declare const index_compareVersions: typeof compareVersions;
|
|
710
|
+
declare const index_createChecker: typeof createChecker;
|
|
711
|
+
declare const index_defaultDataDir: typeof defaultDataDir;
|
|
712
|
+
declare const index_defaultRegistry: typeof defaultRegistry;
|
|
713
|
+
declare const index_errorText: typeof errorText;
|
|
714
|
+
declare const index_isBackupUnsupported: typeof isBackupUnsupported;
|
|
715
|
+
declare const index_isCanceled: typeof isCanceled;
|
|
716
|
+
declare const index_isNotRestored: typeof isNotRestored;
|
|
717
|
+
declare const index_isVerifyError: typeof isVerifyError;
|
|
718
|
+
declare const index_migrateDocument: typeof migrateDocument;
|
|
719
|
+
declare const index_migrateDocumentValue: typeof migrateDocumentValue;
|
|
720
|
+
declare const index_parseSemver: typeof parseSemver;
|
|
721
|
+
declare const index_readVersionFile: typeof readVersionFile;
|
|
722
|
+
declare const index_registerMigration: typeof registerMigration;
|
|
723
|
+
declare const index_resetRegistryForTest: typeof resetRegistryForTest;
|
|
724
|
+
declare const index_topicsFromPrefix: typeof topicsFromPrefix;
|
|
725
|
+
declare const index_trimV: typeof trimV;
|
|
726
|
+
declare const index_writeVersionFile: typeof writeVersionFile;
|
|
727
|
+
declare namespace index {
|
|
728
|
+
export { type index_AppliedMigration as AppliedMigration, index_BackupUnsupportedError as BackupUnsupportedError, index_CanceledError as CanceledError, type index_Checker as Checker, type index_CheckerOptions as CheckerOptions, index_DEFAULT_MIGRATION_TOPICS as DEFAULT_MIGRATION_TOPICS, type index_DocApplied as DocApplied, index_DocError as DocError, type index_DocKind as DocKind, type index_DocOptions as DocOptions, type index_DocReport as DocReport, type index_DocStep as DocStep, type index_EventPublisher as EventPublisher, type index_JsonObject as JsonObject, type index_Migration as Migration, type index_MigrationPayload as MigrationPayload, type index_MigrationRunPayload as MigrationRunPayload, type index_MigrationTopics as MigrationTopics, index_Migrator as Migrator, type index_MigratorOptions as MigratorOptions, index_NotRestoredError as NotRestoredError, index_PUBLISH_SOURCE as PUBLISH_SOURCE, index_Registry as Registry, type index_SchemaDriver as SchemaDriver, type index_SchemaStatus as SchemaStatus, type index_Semver as Semver, type index_Unlock as Unlock, index_UpgradeCheckError as UpgradeCheckError, type index_UpgradeCheckResult as UpgradeCheckResult, index_UpgradeError as UpgradeError, index_VerifyError as VerifyError, index_abortError as abortError, index_compareSemver as compareSemver, index_compareVersions as compareVersions, index_createChecker as createChecker, index_defaultDataDir as defaultDataDir, index_defaultRegistry as defaultRegistry, index_errorText as errorText, index_isBackupUnsupported as isBackupUnsupported, index_isCanceled as isCanceled, index_isNotRestored as isNotRestored, index_isVerifyError as isVerifyError, index_migrateDocument as migrateDocument, index_migrateDocumentValue as migrateDocumentValue, index_parseSemver as parseSemver, index_readVersionFile as readVersionFile, index_registerMigration as registerMigration, index_resetRegistryForTest as resetRegistryForTest, index_topicsFromPrefix as topicsFromPrefix, index_trimV as trimV, index_writeVersionFile as writeVersionFile };
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export { type AppliedMigration as A, BackupUnsupportedError as B, CanceledError as C, DEFAULT_MIGRATION_TOPICS as D, type EventPublisher as E, isBackupUnsupported as F, isCanceled as G, isNotRestored as H, isVerifyError as I, type JsonObject as J, migrateDocument as K, migrateDocumentValue as L, type Migration as M, NotRestoredError as N, parseSemver as O, PUBLISH_SOURCE as P, readVersionFile as Q, Registry as R, type SchemaDriver as S, registerMigration as T, type Unlock as U, VerifyError as V, resetRegistryForTest as W, topicsFromPrefix as X, trimV as Y, writeVersionFile as Z, type Checker as a, type CheckerOptions as b, type DocApplied as c, DocError as d, type DocKind as e, type DocOptions as f, type DocReport as g, type DocStep as h, index as i, type MigrationPayload as j, type MigrationRunPayload as k, type MigrationTopics as l, Migrator as m, type MigratorOptions as n, type SchemaStatus as o, type Semver as p, UpgradeCheckError as q, type UpgradeCheckResult as r, UpgradeError as s, abortError as t, compareSemver as u, compareVersions as v, createChecker as w, defaultDataDir as x, defaultRegistry as y, errorText as z };
|