toilscript 0.1.36 → 0.1.37
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/cli.generated.d.ts +39 -1
- package/dist/cli.js +75 -12
- package/dist/cli.js.map +3 -3
- package/dist/importmap.json +2 -2
- package/dist/toilscript.generated.d.ts +39 -1
- package/dist/toilscript.js +64 -62
- package/dist/toilscript.js.map +3 -3
- package/dist/web.js +3 -3
- package/package.json +1 -1
- package/std/assembly/bindings/dom.ts +1 -1
- package/std/assembly/bindings/toildb.ts +27 -0
- package/std/assembly/date.ts +2 -2
- package/std/assembly/index.d.ts +1 -1
- package/std/assembly/toildb.ts +40 -4
package/dist/importmap.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
3
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.37/dist/toilscript.js",
|
|
4
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.37/dist/cli.js",
|
|
5
5
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@130.0.0-nightly.20260609/index.js",
|
|
6
6
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
7
7
|
}
|
|
@@ -2994,8 +2994,30 @@ declare module "types:toilscript/src/parser" {
|
|
|
2994
2994
|
/** Finishes parsing. */
|
|
2995
2995
|
finish(): void;
|
|
2996
2996
|
weaveDataMigrations(): void;
|
|
2997
|
-
/**
|
|
2997
|
+
/** Enforce the migration-file convention (folder AND extension): every `@migrate`
|
|
2998
|
+
* must live in a `*.migration.ts` file under a `migrations/` directory. Keeping
|
|
2999
|
+
* migrations in one discoverable place is what lets the build auto-parse them and
|
|
3000
|
+
* the weave inject the cross-file imports; a stray `@migrate` elsewhere would not
|
|
3001
|
+
* be discovered (silently never run), so it is a hard error. */
|
|
3002
|
+
private checkMigrationLocations;
|
|
3003
|
+
/** Replace `target`'s generated `decodeInto` with a version-dispatching one: a
|
|
3004
|
+
* row at any chain-reachable old version is decoded as its shape and run forward
|
|
3005
|
+
* through every transform until it reaches `target`. */
|
|
2998
3006
|
private weaveDecodeInto;
|
|
3007
|
+
/** Record that `sym` (an old `@data` shape or a transform fn) must be imported
|
|
3008
|
+
* into the value type's source from `srcPath`. A blank or same-file source is a
|
|
3009
|
+
* no-op (the symbol is already in scope). Deduped per source via parallel arrays. */
|
|
3010
|
+
private addMigrationImport;
|
|
3011
|
+
/** Internal path of the source declaring the `@data` class `name`, or "" if it
|
|
3012
|
+
* isn't a known `@data` type (then there is nothing to import). */
|
|
3013
|
+
private typeSourcePath;
|
|
3014
|
+
/** A `"./.."`-style module specifier from importing file `fromInternal` to target
|
|
3015
|
+
* module `toInternal` (both extension-less internal paths), e.g.
|
|
3016
|
+
* `("models/User","migrations/User.migration") -> "../migrations/User.migration"`. */
|
|
3017
|
+
private relativeModulePath;
|
|
3018
|
+
/** Copy the fields a delta-step's old and new layouts SHARE (same name + type +
|
|
3019
|
+
* array-ness) from `prevVar` into `nextVar`. */
|
|
3020
|
+
private migrationCarry;
|
|
2999
3021
|
private checkToilDbKinds;
|
|
3000
3022
|
/** Map every `@database` class (incl. inside namespaces) to its
|
|
3001
3023
|
* collection-name -> handle-family-name. */
|
|
@@ -4314,17 +4336,33 @@ declare module "types:toilscript/src/dbcatalog" {
|
|
|
4314
4336
|
fnName: string;
|
|
4315
4337
|
oldVersion: number;
|
|
4316
4338
|
delta: boolean;
|
|
4339
|
+
sourceInternalPath: string;
|
|
4317
4340
|
}
|
|
4318
4341
|
/** Every `@migrate` function across the (non-library) sources. `layouts` maps a
|
|
4319
4342
|
* `@data` class name to its field layout, for the old-version hash. A migration
|
|
4320
4343
|
* whose param/return is not a single named type, or whose old type has no
|
|
4321
4344
|
* layout, is skipped. */
|
|
4322
4345
|
export function collectMigrations(sources: Source[], layouts: Map<string, FieldLayout[]>): DataMigration[];
|
|
4346
|
+
/** A resolved chain that migrates a stored OLD value all the way to a target
|
|
4347
|
+
* type: decode `oldType`, then apply `steps` in order (each `@migrate`). For a
|
|
4348
|
+
* direct migration `steps` has one entry; a chain `V0 -> V1 -> V2` has two. */
|
|
4349
|
+
export class MigrationChain {
|
|
4350
|
+
oldType: string;
|
|
4351
|
+
oldVersion: number;
|
|
4352
|
+
steps: DataMigration[];
|
|
4353
|
+
}
|
|
4354
|
+
/** Every old type that reaches `target` through a chain of `@migrate` edges, with
|
|
4355
|
+
* the ordered transforms to apply. A backward breadth-first walk of the migration
|
|
4356
|
+
* graph (edges OLD -> NEW), so the SHORTEST chain wins and cycles terminate; a
|
|
4357
|
+
* direct migration is just a one-step chain. This is what lets a row written under
|
|
4358
|
+
* version 0 reach the current version 2 via `0->1` then `1->2`. */
|
|
4359
|
+
export function chainsTo(target: string, migrations: DataMigration[]): MigrationChain[];
|
|
4323
4360
|
/**
|
|
4324
4361
|
* Build the `toildb.catalog` section bytes, or `null` if the program declares
|
|
4325
4362
|
* no `@database`.
|
|
4326
4363
|
*/
|
|
4327
4364
|
export function buildToilDbCatalog(program: Program): Uint8Array | null;
|
|
4365
|
+
export function buildToilDbTypes(program: Program): Uint8Array | null;
|
|
4328
4366
|
}
|
|
4329
4367
|
declare module "types:toilscript/src/passes/pass" {
|
|
4330
4368
|
/**
|