@vibeorm/generator 2.0.0-alpha.9 → 2.0.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.
package/README.md CHANGED
@@ -5,10 +5,10 @@
5
5
  Turns a `SchemaIR` into a client module directory: plain JavaScript plus a declaration file that is written as text rather than inferred by `tsc`. It is a separate package because the schema-to-client emission is used by the CLI, by build tooling and by tests, none of which want the runtime or the migration engine in scope.
6
6
 
7
7
  ```bash
8
- bun add @vibeorm/generator@alpha
8
+ bun add @vibeorm/generator
9
9
  ```
10
10
 
11
- > **Pre-release.** `2.0.0-alpha.x`, published under the `alpha` dist-tag. `npm i vibeorm` still resolves to the stable v1 line.
11
+ > **Stable.** `2.0.0`, published under the `latest` dist-tag. The v1 line stays installable as `vibeorm@1`.
12
12
 
13
13
  Most users never install this directly — it ships as a dependency of [`vibeorm`](https://www.npmjs.com/package/vibeorm) and of the generated client. Reach for it when you are writing an adapter or tooling against the runtime.
14
14
 
@@ -15,6 +15,14 @@
15
15
  import type { ComputedManifestEntry } from "@vibeorm/schema";
16
16
  import type { BakedExtensions } from "./extension-bake.ts";
17
17
  import type { SchemaView } from "./schema-view.ts";
18
+ /**
19
+ * Emit enums.d.ts: every enum's constant, literal union and flat validator
20
+ * type, plus the grouped `enumValidators`. Fully pre-resolved — no generics,
21
+ * no imports — and independent of the client surface in index.d.ts.
22
+ */
23
+ export declare function emitEnumsDts(params: {
24
+ view: SchemaView;
25
+ }): string;
18
26
  /** Emit the full index.d.ts for a resolved schema view. */
19
27
  export declare function emitDts(params: {
20
28
  view: SchemaView;
@@ -1 +1 @@
1
- {"version":3,"file":"emit-dts.d.ts","sourceRoot":"","sources":["../src/emit-dts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAgD,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA66CjG,2DAA2D;AAC3D,wBAAgB,OAAO,CAAC,MAAM,EAAE;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAC7C,GAAG,MAAM,CAuET"}
1
+ {"version":3,"file":"emit-dts.d.ts","sourceRoot":"","sources":["../src/emit-dts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAoB,MAAM,iBAAiB,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAgD,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA4VjG;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,MAAM,CAejE;AAogDD,2DAA2D;AAC3D,wBAAgB,OAAO,CAAC,MAAM,EAAE;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAC7C,GAAG,MAAM,CA8ET"}
package/dist/emit-js.d.ts CHANGED
@@ -2,13 +2,29 @@
2
2
  * Emits the generated client's index.js — runtime glue ONLY. All typing lives
3
3
  * in the directly-written index.d.ts (see emit-dts.ts); this file embeds the
4
4
  * normalized Schema IR as plain data (no `as const` inference trees), exports
5
- * enums as frozen plain objects and wires `VibeClient()` to the dynamic client
6
- * in @vibeorm/runtime. Import specifiers stay bare — the consumer resolves
7
- * @vibeorm/runtime and @vibeorm/schema from its own node_modules.
5
+ * re-exports the enum constants and `enumValidators` from the lightweight
6
+ * enums.js entry (emitted here too, by `emitEnumsJs`) and wires `VibeClient()`
7
+ * to the dynamic client in @vibeorm/runtime. Import specifiers stay bare — the
8
+ * consumer resolves @vibeorm/runtime and @vibeorm/schema from its own
9
+ * node_modules.
8
10
  */
9
11
  import type { ComputedManifestEntry } from "@vibeorm/schema";
10
12
  import type { BakedExtensions } from "./extension-bake.ts";
11
13
  import type { SchemaView } from "./schema-view.ts";
14
+ /** The names index.js / index.d.ts re-export from the enums entry (enum constants + the parser group). */
15
+ export declare function enumEntryExports(params: {
16
+ view: SchemaView;
17
+ }): readonly string[];
18
+ /**
19
+ * Emit the lightweight enums.js entry: one frozen constant object per enum
20
+ * (the SAME declaration index.js re-exports — one source of truth) and the
21
+ * grouped `enumValidators` boundary parsers. Depends on `@vibeorm/schema`
22
+ * (for the typed `VibeError`) and nothing else — never on the runtime
23
+ * client or the application schema module, so a frontend can import it.
24
+ */
25
+ export declare function emitEnumsJs(params: {
26
+ view: SchemaView;
27
+ }): string;
12
28
  /** Emit the full index.js for a resolved schema view. */
13
29
  export declare function emitJs(params: {
14
30
  view: SchemaView;
@@ -1 +1 @@
1
- {"version":3,"file":"emit-js.d.ts","sourceRoot":"","sources":["../src/emit-js.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,yDAAyD;AACzD,wBAAgB,MAAM,CAAC,MAAM,EAAE;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAC7C,GAAG,MAAM,CA8ET"}
1
+ {"version":3,"file":"emit-js.d.ts","sourceRoot":"","sources":["../src/emit-js.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAOnD,0GAA0G;AAC1G,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,SAAS,MAAM,EAAE,CAEhF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,MAAM,CA0DhE;AAmDD,yDAAyD;AACzD,wBAAgB,MAAM,CAAC,MAAM,EAAE;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAC7C,GAAG,MAAM,CA0ET"}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * The generator's public entry point: SchemaIR → a consumable client module
3
- * directory (index.js + directly-written index.d.ts + README.md).
3
+ * directory (index.js + directly-written index.d.ts, the lightweight enums.js +
4
+ * enums.d.ts entry index re-exports from, and README.md).
4
5
  *
5
6
  * Output is byte-identical for structurally identical IR: models, enums and
6
7
  * extensions are sorted by name, object keys are serialized sorted, and every
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAyB,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMtG,mCAAmC;AACnC,MAAM,MAAM,cAAc,GAAG;IAC3B,qEAAqE;IACrE,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAOF;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAC3C,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,UAAU,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IACtC,qFAAqF;IACrF,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,GAAG,OAAO,CAAC,cAAc,CAAC,CAyB1B"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAyB,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMtG,mCAAmC;AACnC,MAAM,MAAM,cAAc,GAAG;IAC3B,qEAAqE;IACrE,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAOF;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAC3C,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,UAAU,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IACtC,qFAAqF;IACrF,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,GAAG,OAAO,CAAC,cAAc,CAAC,CA2B1B"}