toilscript 0.1.32 → 0.1.34
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 +59 -9
- package/dist/cli.js +44 -1
- package/dist/cli.js.map +2 -2
- package/dist/importmap.json +2 -2
- package/dist/toilscript.generated.d.ts +51 -1
- package/dist/toilscript.js +74 -74
- package/dist/toilscript.js.map +4 -4
- package/dist/web.js +3 -3
- package/package.json +3 -2
- package/std/assembly/bindings/toildb.ts +16 -0
- package/std/assembly/toildb.ts +27 -0
- package/std/assembly/toilscript.d.ts +7 -1
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.34/dist/toilscript.js",
|
|
4
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.34/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
|
}
|
|
@@ -2962,6 +2962,15 @@ declare module "types:toilscript/src/parser" {
|
|
|
2962
2962
|
ratelimitRouteCounter: number;
|
|
2963
2963
|
/** An array of parsed sources. */
|
|
2964
2964
|
sources: Source[];
|
|
2965
|
+
/** A `@data` value type's generated field reads (the `decodeFrom` body, `__o.`
|
|
2966
|
+
* form) keyed by class name, captured so `finish()` can regenerate `decodeInto`
|
|
2967
|
+
* with a `@migrate` version-dispatch prefix. */
|
|
2968
|
+
toildbCodecReads: Map<string, string>;
|
|
2969
|
+
/** A `@data` value type's declaration, keyed by class name (to find/replace its
|
|
2970
|
+
* `decodeInto` member when weaving migrations). */
|
|
2971
|
+
toildbCodecClasses: Map<string, ClassDeclaration>;
|
|
2972
|
+
/** Guards `weaveDataMigrations` so it runs exactly once (before element creation). */
|
|
2973
|
+
toildbWoven: boolean;
|
|
2965
2974
|
/** Current overridden module name. */
|
|
2966
2975
|
currentModuleName: string | null;
|
|
2967
2976
|
/** Compiler options. */
|
|
@@ -2984,6 +2993,9 @@ declare module "types:toilscript/src/parser" {
|
|
|
2984
2993
|
getDependee(dependent: string): string | null;
|
|
2985
2994
|
/** Finishes parsing. */
|
|
2986
2995
|
finish(): void;
|
|
2996
|
+
weaveDataMigrations(): void;
|
|
2997
|
+
/** Replace `newType`'s generated `decodeInto` with a version-dispatching one. */
|
|
2998
|
+
private weaveDecodeInto;
|
|
2987
2999
|
private checkToilDbKinds;
|
|
2988
3000
|
/** Map every `@database` class (incl. inside namespaces) to its
|
|
2989
3001
|
* collection-name -> handle-family-name. */
|
|
@@ -4270,6 +4282,43 @@ declare module "types:toilscript/src/program" {
|
|
|
4270
4282
|
}
|
|
4271
4283
|
declare module "types:toilscript/src/dbcatalog" {
|
|
4272
4284
|
import { Program } from "types:toilscript/src/program";
|
|
4285
|
+
import { Source } from "types:toilscript/src/ast";
|
|
4286
|
+
import { ClassDeclaration } from "types:toilscript/src/ast";
|
|
4287
|
+
/** FNV-1a 32-bit hash, matching `dataTypeId` in the parser. */
|
|
4288
|
+
export function fnv1a(name: string): number;
|
|
4289
|
+
/** One field of a `@data` value type, in declaration order. */
|
|
4290
|
+
export class FieldLayout {
|
|
4291
|
+
name: string;
|
|
4292
|
+
typeName: string;
|
|
4293
|
+
isArray: boolean;
|
|
4294
|
+
}
|
|
4295
|
+
/**
|
|
4296
|
+
* `schema_version`: a hash over the ORDERED field layout (name, type, is_array),
|
|
4297
|
+
* NOT the value-type name. Adding, removing, retyping, or REORDERING a field
|
|
4298
|
+
* changes it - so the runtime can tell a compatible (append-only) change from a
|
|
4299
|
+
* breaking one, instead of silently misreading old rows. (Flat, like toildb's
|
|
4300
|
+
* `SchemaDescriptor::layout_hash`: a change to a NESTED `@data` type's own fields
|
|
4301
|
+
* does not bump the parent - that lands with recursive layouts later.)
|
|
4302
|
+
*/
|
|
4303
|
+
export function layoutHash(fields: FieldLayout[]): number;
|
|
4304
|
+
/** Extract the encoded field layout of a `@data` class, in declaration order,
|
|
4305
|
+
* mirroring `injectDataCodec` (skip static; `Array<T>` -> element + array flag;
|
|
4306
|
+
* else scalar/string/`Uint8Array`/nested-`@data` by its type name). */
|
|
4307
|
+
export function dataFields(cls: ClassDeclaration): FieldLayout[];
|
|
4308
|
+
/** A `@migrate` free function `fn(old: OldType): NewType`. `oldVersion` is the
|
|
4309
|
+
* layout hash of `OldType` - i.e. the `schema_version` the old rows were written
|
|
4310
|
+
* under - so a read can dispatch on it and run the transform (lazy migration). */
|
|
4311
|
+
export class DataMigration {
|
|
4312
|
+
oldType: string;
|
|
4313
|
+
newType: string;
|
|
4314
|
+
fnName: string;
|
|
4315
|
+
oldVersion: number;
|
|
4316
|
+
}
|
|
4317
|
+
/** Every `@migrate` function across the (non-library) sources. `layouts` maps a
|
|
4318
|
+
* `@data` class name to its field layout, for the old-version hash. A migration
|
|
4319
|
+
* whose param/return is not a single named type, or whose old type has no
|
|
4320
|
+
* layout, is skipped. */
|
|
4321
|
+
export function collectMigrations(sources: Source[], layouts: Map<string, FieldLayout[]>): DataMigration[];
|
|
4273
4322
|
/**
|
|
4274
4323
|
* Build the `toildb.catalog` section bytes, or `null` if the program declares
|
|
4275
4324
|
* no `@database`.
|
|
@@ -7883,7 +7932,8 @@ declare module "types:toilscript/src/ast" {
|
|
|
7883
7932
|
Action = 34,
|
|
7884
7933
|
Job = 35,
|
|
7885
7934
|
Derive = 36,
|
|
7886
|
-
|
|
7935
|
+
Migrate = 37,
|
|
7936
|
+
Admin = 38
|
|
7887
7937
|
}
|
|
7888
7938
|
export namespace DecoratorKind {
|
|
7889
7939
|
/** Returns the kind of the specified decorator name node. Defaults to {@link DecoratorKind.CUSTOM}. */
|