@metaobjectsdev/codegen-ts-react 0.7.0 → 0.8.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.
@@ -1 +1 @@
1
- {"version":3,"file":"form-file.d.ts","sourceRoot":"","sources":["../src/form-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAA6B,KAAK,gBAAgB,EAAoB,MAAM,4BAA4B,CAAC;AAGhH,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAoBhB,gBAAgB,CAAC,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"form-file.d.ts","sourceRoot":"","sources":["../src/form-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAA6B,KAAK,gBAAgB,EAAyC,MAAM,4BAA4B,CAAC;AAGrI,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAuBhB,gBAAgB,CAAC,YAAY,CAAC,CAAC"}
package/dist/form-file.js CHANGED
@@ -1,4 +1,4 @@
1
- import { perEntity, entityOutputPath } from "@metaobjectsdev/codegen-ts";
1
+ import { perEntity, entityOutputPath, emitsWriteArtifacts } from "@metaobjectsdev/codegen-ts";
2
2
  import { renderFormFile } from "./templates/form-file.js";
3
3
  /**
4
4
  * Forms are opt-in: a user must add `formFile()` to config.generators.
@@ -9,8 +9,11 @@ export const formFile = function formFile(opts) {
9
9
  const userFilter = opts?.filter ?? (() => true);
10
10
  const generator = {
11
11
  name: "form-file",
12
- // Always set: AND-composes metadata opt-out with optional user filter.
13
- filter: (e) => e.ownAttr("emitForm") !== false && userFilter(e),
12
+ // Always set: AND-composes the framework write-artifact guard
13
+ // (skips abstract types no instance — and read-only projections —
14
+ // instantiable for read, never for write), the metadata opt-out, and
15
+ // the optional user filter.
16
+ filter: (e) => emitsWriteArtifacts(e) && e.ownAttr("emitForm") !== false && userFilter(e),
14
17
  generate: perEntity((entity, ctx) => {
15
18
  if (!ctx.renderContext) {
16
19
  throw new Error("form-file: renderContext is required (provided by runGen)");
@@ -1 +1 @@
1
- {"version":3,"file":"form-file.js","sourceRoot":"","sources":["../src/form-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAyC,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAChH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAO1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,QAAQ,CAAC,IAAmB;IAC3D,MAAM,UAAU,GAAG,IAAI,EAAE,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,SAAS,GAAc;QAC3B,IAAI,EAAE,WAAW;QACjB,uEAAuE;QACvE,MAAM,EAAE,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC;QAC3E,QAAQ,EAAE,SAAS,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;YAClC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;YAC/E,CAAC;YACD,OAAO;gBACL,IAAI,EAAE,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,GAAG,M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CAAC,IAAI,WAAW,CAAC;gBACpG,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC;aACnD,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;IACF,IAAI,IAAI,EAAE,MAAM,EAAE,CAAC;QACjB,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACjC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAmC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaobjectsdev/codegen-ts-react",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "React codegen for metaobjects — emits <Entity>.form.tsx files using react-hook-form and @metaobjectsdev/react helpers.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,8 +34,8 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@metaobjectsdev/metadata": "0.7.0",
38
- "@metaobjectsdev/codegen-ts": "0.7.0",
37
+ "@metaobjectsdev/metadata": "0.8.0",
38
+ "@metaobjectsdev/codegen-ts": "0.8.0",
39
39
  "ts-poet": "^6.10.0"
40
40
  },
41
41
  "peerDependencies": {
package/src/form-file.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { MetaObject } from "@metaobjectsdev/metadata";
2
- import { perEntity, type Generator, type GeneratorFactory, entityOutputPath } from "@metaobjectsdev/codegen-ts";
2
+ import { perEntity, type Generator, type GeneratorFactory, entityOutputPath, emitsWriteArtifacts } from "@metaobjectsdev/codegen-ts";
3
3
  import { renderFormFile } from "./templates/form-file.js";
4
4
 
5
5
  export interface FormFileOpts {
@@ -16,8 +16,11 @@ export const formFile = function formFile(opts?: FormFileOpts): Generator {
16
16
  const userFilter = opts?.filter ?? (() => true);
17
17
  const generator: Generator = {
18
18
  name: "form-file",
19
- // Always set: AND-composes metadata opt-out with optional user filter.
20
- filter: (e: MetaObject) => e.ownAttr("emitForm") !== false && userFilter(e),
19
+ // Always set: AND-composes the framework write-artifact guard
20
+ // (skips abstract types no instance and read-only projections —
21
+ // instantiable for read, never for write), the metadata opt-out, and
22
+ // the optional user filter.
23
+ filter: (e: MetaObject) => emitsWriteArtifacts(e) && e.ownAttr("emitForm") !== false && userFilter(e),
21
24
  generate: perEntity((entity, ctx) => {
22
25
  if (!ctx.renderContext) {
23
26
  throw new Error("form-file: renderContext is required (provided by runGen)");