@marktiderman/genesis-cli 1.12.1 → 1.13.1

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,7 +1,7 @@
1
1
  {
2
2
  "packages": {
3
3
  "@marktiderman/genesis-chat": {
4
- "version": "0.3.2",
4
+ "version": "0.3.3",
5
5
  "blocks": {
6
6
  "chat": {
7
7
  "feature": {
@@ -52,8 +52,11 @@
52
52
  }
53
53
  }
54
54
  },
55
+ "@marktiderman/genesis-collab": {
56
+ "version": "0.1.0"
57
+ },
55
58
  "@marktiderman/genesis-core": {
56
- "version": "1.12.0"
59
+ "version": "1.14.0"
57
60
  },
58
61
  "@marktiderman/genesis-switchboard": {
59
62
  "version": "2.1.0"
@@ -68,7 +71,7 @@
68
71
  "version": "0.6.0"
69
72
  },
70
73
  "@marktiderman/genesis-forms": {
71
- "version": "0.9.2"
74
+ "version": "0.9.3"
72
75
  },
73
76
  "@marktiderman/genesis-forms-builder": {
74
77
  "version": "0.6.4"
@@ -77,25 +80,25 @@
77
80
  "version": "0.1.2"
78
81
  },
79
82
  "@marktiderman/genesis-forms-native": {
80
- "version": "0.1.1"
83
+ "version": "0.2.0"
81
84
  },
82
85
  "@marktiderman/genesis-forms-react": {
83
86
  "version": "0.3.1"
84
87
  },
85
88
  "@marktiderman/genesis-forms-studio": {
86
- "version": "0.5.1"
89
+ "version": "0.6.0"
87
90
  },
88
91
  "@marktiderman/genesis-forms-web": {
89
92
  "version": "0.6.3"
90
93
  },
91
94
  "@marktiderman/genesis": {
92
- "version": "0.9.12"
95
+ "version": "0.9.14"
93
96
  },
94
97
  "@marktiderman/genesis-cli": {
95
- "version": "1.12.1"
98
+ "version": "1.13.1"
96
99
  },
97
100
  "@marktiderman/genesis-native": {
98
- "version": "0.4.4",
101
+ "version": "0.5.0",
99
102
  "blocks": {
100
103
  "push": {
101
104
  "feature": {
@@ -273,7 +276,7 @@
273
276
  }
274
277
  },
275
278
  "@marktiderman/genesis-notifications": {
276
- "version": "0.2.2",
279
+ "version": "0.3.0",
277
280
  "blocks": {
278
281
  "notifications": {
279
282
  "feature": {
@@ -328,6 +331,9 @@
328
331
  }
329
332
  }
330
333
  },
334
+ "@marktiderman/genesis-product": {
335
+ "version": "0.0.5"
336
+ },
331
337
  "@marktiderman/genesis-sites": {
332
338
  "version": "0.3.3",
333
339
  "blocks": {
@@ -373,13 +379,13 @@
373
379
  }
374
380
  },
375
381
  "@marktiderman/genesis-studio": {
376
- "version": "0.2.0"
382
+ "version": "0.2.1"
377
383
  },
378
384
  "@marktiderman/genesis-studio-server": {
379
- "version": "0.3.1"
385
+ "version": "0.4.0"
380
386
  },
381
387
  "@marktiderman/genesis-supabase": {
382
- "version": "0.6.2",
388
+ "version": "0.8.0",
383
389
  "blocks": {
384
390
  "account": {
385
391
  "feature": {
@@ -502,10 +508,83 @@
502
508
  {
503
509
  "file": "migrations/0008_genesis_feature_registry.sql",
504
510
  "test": "migrations/tests/0008_genesis_feature_registry.test.sql"
511
+ },
512
+ {
513
+ "file": "migrations/0014_genesis_feature_registry_hardening.sql",
514
+ "test": "migrations/tests/0014_genesis_feature_registry_hardening.test.sql"
505
515
  }
506
516
  ],
507
517
  "steps": [
508
- "Sync the registry on every deploy with the service key: syncFeatureRegistry(admin, features.json, { version: BUILD_TIME }). Grant paid features by writing feature_entitlements from your billing webhook."
518
+ "Sync the registry on every deploy with the service key: syncFeatureRegistry(admin, features.json, { version: BUILD_TIME } (the build time, from a production deployment only)). Grant paid features by writing feature_entitlements from your billing webhook."
519
+ ]
520
+ },
521
+ "owner-access": {
522
+ "feature": {
523
+ "name": "Owner access",
524
+ "summary": "The owner-access contract: fail-closed wrappers (genesis_owner_readable, genesis_owner_allows) over the app's two hooks, for every Genesis block whose rows belong to a person, a team or the tenant.",
525
+ "keywords": [
526
+ "access",
527
+ "owners",
528
+ "row level security",
529
+ "tenants",
530
+ "teams"
531
+ ],
532
+ "audience": [
533
+ "developer"
534
+ ]
535
+ },
536
+ "platforms": [
537
+ "web",
538
+ "native"
539
+ ],
540
+ "requires": [
541
+ "tenant-features"
542
+ ],
543
+ "migrations": [
544
+ {
545
+ "file": "migrations/0009_genesis_owner_access.sql",
546
+ "test": "migrations/tests/0009_genesis_owner_access.test.sql"
547
+ }
548
+ ],
549
+ "install": [
550
+ "@supabase/supabase-js@^2.118.0"
551
+ ],
552
+ "steps": [
553
+ "Define private.genesis_owner_can(tenant, viewer, person_id, team_id, organization_id, action) and private.genesis_readable_owners(viewer) in your own migration, as the header of 0009 shows. Without them the wrappers answer no."
554
+ ]
555
+ },
556
+ "web-handoff": {
557
+ "feature": {
558
+ "name": "Continue on the web",
559
+ "summary": "A native app opens a web page signed in as the same person: a single-use, 60-second link minted by the server for the person's own account, confirmed on the page unless that browser is already signed in as them.",
560
+ "keywords": [
561
+ "handoff",
562
+ "open on web",
563
+ "magic link",
564
+ "single sign-on",
565
+ "continue on web"
566
+ ],
567
+ "audience": [
568
+ "person"
569
+ ]
570
+ },
571
+ "platforms": [
572
+ "web",
573
+ "native"
574
+ ],
575
+ "migrations": [
576
+ {
577
+ "file": "migrations/0015_genesis_web_handoff.sql",
578
+ "test": "migrations/tests/0015_genesis_web_handoff.test.sql"
579
+ }
580
+ ],
581
+ "install": [
582
+ "@supabase/supabase-js@^2.118.0"
583
+ ],
584
+ "steps": [
585
+ "Add two POST routes with createWebHandoff from @marktiderman/genesis-supabase/web-handoff/server (mint at /api/auth/handoff, redeem at /api/auth/redeem-handoff), using the service-role client on the server.",
586
+ "Add the /auth/handoff page: call takeWebHandoffFragment before analytics or error reporting load, then completeWebHandoff; send Referrer-Policy: no-referrer and frame-ancestors 'none' for it.",
587
+ "In the native app, call openOnWeb from @marktiderman/genesis-native/web-handoff with the mint route, the session's access token and expo-web-browser."
509
588
  ]
510
589
  }
511
590
  }
@@ -701,10 +780,243 @@
701
780
  }
702
781
  },
703
782
  "@marktiderman/genesis-ui": {
704
- "version": "2.17.1"
783
+ "version": "2.19.0"
705
784
  },
706
785
  "@marktiderman/genesis-ui-native": {
707
- "version": "2.5.0"
786
+ "version": "2.7.0"
787
+ },
788
+ "@marktiderman/genesis-work": {
789
+ "version": "0.2.0",
790
+ "blocks": {
791
+ "pursuits": {
792
+ "feature": {
793
+ "name": "Pursuits",
794
+ "summary": "Goals and projects (one table, either or both) with tasks, issues and milestones, owned by a person, a team or the tenant; who reads and writes is the app's hook.",
795
+ "keywords": [
796
+ "goals",
797
+ "projects",
798
+ "tasks",
799
+ "issues",
800
+ "milestones",
801
+ "quarterly priorities"
802
+ ],
803
+ "audience": [
804
+ "person",
805
+ "developer"
806
+ ]
807
+ },
808
+ "platforms": [
809
+ "web",
810
+ "native"
811
+ ],
812
+ "requires": [
813
+ "owner-access"
814
+ ],
815
+ "migrations": [
816
+ {
817
+ "file": "migrations/0001_genesis_work_pursuits.sql",
818
+ "test": "migrations/tests/0001_genesis_work_pursuits.test.sql"
819
+ }
820
+ ],
821
+ "install": [
822
+ "@supabase/supabase-js@^2.118.0"
823
+ ],
824
+ "steps": [
825
+ "Define private.genesis_readable_owners(viewer) and private.genesis_owner_can(tenant, viewer, person_id, team_id, organization_id, action) in a migration, as the header of 0009 shows. Without them nobody signed in reads or writes.",
826
+ "Add genesis_work to your API's exposed schemas (supabase/config.toml [api] schemas)."
827
+ ]
828
+ },
829
+ "metrics": {
830
+ "feature": {
831
+ "name": "Metrics",
832
+ "summary": "Numbers tracked over time (a scorecard, a habit, a profit margin), one value per period, goals that change over time, owned by a person, a team or the tenant.",
833
+ "keywords": [
834
+ "metrics",
835
+ "kpi",
836
+ "scorecard",
837
+ "habits",
838
+ "trend"
839
+ ],
840
+ "audience": [
841
+ "person",
842
+ "developer"
843
+ ]
844
+ },
845
+ "platforms": [
846
+ "web",
847
+ "native"
848
+ ],
849
+ "requires": [
850
+ "pursuits"
851
+ ],
852
+ "migrations": [
853
+ {
854
+ "file": "migrations/0002_genesis_work_metrics.sql",
855
+ "test": "migrations/tests/0002_genesis_work_metrics.test.sql"
856
+ }
857
+ ],
858
+ "install": [
859
+ "@supabase/supabase-js@^2.118.0"
860
+ ],
861
+ "steps": [
862
+ "Uses the owner-access block's hooks: private.genesis_readable_owners(viewer) and private.genesis_owner_can(...). Without them nobody signed in reads or writes.",
863
+ "Add genesis_work to your API's exposed schemas (supabase/config.toml [api] schemas)."
864
+ ]
865
+ },
866
+ "status-updates": {
867
+ "feature": {
868
+ "name": "Status updates",
869
+ "summary": "Dated updates (health and a note) on goals, projects, tasks, issues and metrics, and requests to a person for an update by a due time, answered by posting one.",
870
+ "keywords": [
871
+ "status update",
872
+ "check-in",
873
+ "update request",
874
+ "health",
875
+ "overdue"
876
+ ],
877
+ "audience": [
878
+ "person",
879
+ "developer"
880
+ ]
881
+ },
882
+ "platforms": [
883
+ "web",
884
+ "native"
885
+ ],
886
+ "requires": [
887
+ "pursuits",
888
+ "metrics"
889
+ ],
890
+ "migrations": [
891
+ {
892
+ "file": "migrations/0003_genesis_work_updates.sql",
893
+ "test": "migrations/tests/0003_genesis_work_updates.test.sql"
894
+ }
895
+ ],
896
+ "install": [
897
+ "@supabase/supabase-js@^2.118.0"
898
+ ],
899
+ "steps": [
900
+ "Needs the pursuits and metrics blocks and their hooks. For reminders, schedule a job (the jobs block) that reads update_requests_due and sends one notification per request.",
901
+ "Add genesis_work to your API's exposed schemas (supabase/config.toml [api] schemas)."
902
+ ]
903
+ },
904
+ "sessions": {
905
+ "feature": {
906
+ "name": "Sessions",
907
+ "summary": "Sessions of any kind (a meeting, workshop, presentation, coaching call, one-on-one, class or planning day): types with agendas, a schedule and calendar event, the agenda copied at start, the live step, notes and recordings; attendees with presence and a 1-to-10 rating; links to pre-work and collaboration spaces.",
908
+ "keywords": [
909
+ "sessions",
910
+ "meetings",
911
+ "workshops",
912
+ "coaching calls",
913
+ "agenda",
914
+ "rating",
915
+ "attendance"
916
+ ],
917
+ "audience": [
918
+ "person",
919
+ "developer"
920
+ ]
921
+ },
922
+ "platforms": [
923
+ "web",
924
+ "native"
925
+ ],
926
+ "requires": [
927
+ "pursuits"
928
+ ],
929
+ "migrations": [
930
+ {
931
+ "file": "migrations/0004_genesis_work_sessions.sql",
932
+ "test": "migrations/tests/0004_genesis_work_sessions.test.sql"
933
+ }
934
+ ],
935
+ "install": [
936
+ "@supabase/supabase-js@^2.118.0"
937
+ ],
938
+ "steps": [
939
+ "Uses the owner-access block (genesis-supabase) and its app hooks. To share pre-work or a live worksheet with attendees, register private.genesis_session_members(session) as a collaboration audience.",
940
+ "Add genesis_work to your API's exposed schemas (supabase/config.toml [api] schemas)."
941
+ ]
942
+ },
943
+ "custom-fields": {
944
+ "feature": {
945
+ "name": "Custom fields",
946
+ "summary": "A tenant's own fields on goals, projects, tasks, issues, metrics and sessions, with no code or migration: genesis-forms field types, values in a custom jsonb checked by shape, app and content-pack fields that only server code writes.",
947
+ "keywords": [
948
+ "custom fields",
949
+ "extend",
950
+ "metafields",
951
+ "properties"
952
+ ],
953
+ "audience": [
954
+ "admin",
955
+ "developer"
956
+ ]
957
+ },
958
+ "platforms": [
959
+ "web",
960
+ "native"
961
+ ],
962
+ "requires": [
963
+ "pursuits",
964
+ "metrics",
965
+ "sessions"
966
+ ],
967
+ "migrations": [
968
+ {
969
+ "file": "migrations/0005_genesis_work_fields.sql",
970
+ "test": "migrations/tests/0005_genesis_work_fields.test.sql"
971
+ }
972
+ ],
973
+ "install": [
974
+ "@supabase/supabase-js@^2.118.0"
975
+ ],
976
+ "steps": [
977
+ "Validate custom values on the server with the genesis-forms engine before writing; the database checks only their shape and that a field exists."
978
+ ]
979
+ },
980
+ "content-pack-install": {
981
+ "feature": {
982
+ "name": "Content pack install",
983
+ "summary": "Install a content pack (session types, metric templates, custom fields, labels) into a tenant's own editable rows; updates are additive and keep what the tenant changed; uninstalling removes only untouched, unused items.",
984
+ "keywords": [
985
+ "content packs",
986
+ "templates",
987
+ "starter content",
988
+ "install",
989
+ "taxonomy"
990
+ ],
991
+ "audience": [
992
+ "admin",
993
+ "developer"
994
+ ]
995
+ },
996
+ "platforms": [
997
+ "web",
998
+ "native",
999
+ "server"
1000
+ ],
1001
+ "requires": [
1002
+ "sessions",
1003
+ "metrics",
1004
+ "custom-fields"
1005
+ ],
1006
+ "migrations": [
1007
+ {
1008
+ "file": "migrations/0006_genesis_work_packs.sql",
1009
+ "test": "migrations/tests/0006_genesis_work_packs.test.sql"
1010
+ }
1011
+ ],
1012
+ "install": [
1013
+ "@supabase/supabase-js@^2.118.0"
1014
+ ],
1015
+ "steps": [
1016
+ "Install packs from server code: check that a tenant admin asked, then call genesis_work.install_content_pack(tenant, manifest, person) with the service role. Forms and roadmap templates in a manifest are the app's to install."
1017
+ ]
1018
+ }
1019
+ }
708
1020
  }
709
1021
  }
710
1022
  }
package/dist/index.d.ts CHANGED
@@ -38,12 +38,19 @@ interface FieldSettings {
38
38
  label?: string;
39
39
  description?: string;
40
40
  widget?: string;
41
+ /** Server-owned: clients never write it. */
42
+ readonly?: boolean;
43
+ /** Left out of lists, exports and previews unless a screen asks. */
44
+ sensitive?: boolean;
41
45
  }
42
46
  /** What a table comment's `@genesis {...}` may set. */
43
47
  interface TableSettings {
44
48
  label?: string;
45
49
  labelField?: string;
46
50
  description?: string;
51
+ /** What one row is called ("brand"), and several when not `noun` + "s". */
52
+ noun?: string;
53
+ nounPlural?: string;
47
54
  }
48
55
 
49
56
  type Sql = postgres.Sql;
@@ -83,6 +90,9 @@ interface EmitOptions {
83
90
  /** Where the contract came from, for the header. Never include a secret. */
84
91
  source: string;
85
92
  }
93
+ /** Thrown when the contract can't be emitted as asked (a name clash, a labelField that isn't a column). */
94
+ declare class EmitError extends Error {
95
+ }
86
96
  declare function emitContracts(tables: readonly IntrospectedTable[], options: EmitOptions): string;
87
97
 
88
98
  interface ParsedComment<S> {
@@ -140,4 +150,4 @@ interface InitPlan {
140
150
  declare function detectHost(facts: ProjectFacts): StudioHost;
141
151
  declare function planStudioInit(facts: ProjectFacts, options?: InitOptions): InitPlan;
142
152
 
143
- export { CommentSettingsError, type EmitOptions, type FieldSettings, type InitOptions, type InitPlan, type IntrospectedColumn, type IntrospectedTable, type OpenApiDocument, type PlannedFile, type ProjectFacts, type StorageType, type StudioHost, type TableSettings, detectHost, emitContracts, introspectOpenApi, introspectPostgres, parseColumnComment, parseTableComment, planStudioInit };
153
+ export { CommentSettingsError, EmitError, type EmitOptions, type FieldSettings, type InitOptions, type InitPlan, type IntrospectedColumn, type IntrospectedTable, type OpenApiDocument, type PlannedFile, type ProjectFacts, type StorageType, type StudioHost, type TableSettings, detectHost, emitContracts, introspectOpenApi, introspectPostgres, parseColumnComment, parseTableComment, planStudioInit };
package/dist/index.js CHANGED
@@ -325,8 +325,8 @@ This consumer was bootstrapped with \`@marktiderman/genesis-cli init ${consumer}
325
325
 
326
326
  // src/introspect/comments.ts
327
327
  var MARKER = "@genesis";
328
- var TABLE_KEYS = ["label", "labelField", "description"];
329
- var FIELD_KEYS = ["label", "description", "widget"];
328
+ var TABLE_KEYS = { label: "string", labelField: "string", description: "string", noun: "string", nounPlural: "string" };
329
+ var FIELD_KEYS = { label: "string", description: "string", widget: "string", readonly: "boolean", sensitive: "boolean" };
330
330
  var CommentSettingsError = class extends Error {
331
331
  };
332
332
  function parse(comment, keys, where) {
@@ -346,13 +346,17 @@ function parse(comment, keys, where) {
346
346
  }
347
347
  const settings = {};
348
348
  for (const [key2, v] of Object.entries(value)) {
349
- if (!keys.includes(key2)) {
350
- throw new CommentSettingsError(`${where}: unknown ${MARKER} setting "${key2}". Allowed: ${keys.join(", ")}.`);
349
+ const kind = keys[key2];
350
+ if (!kind) {
351
+ throw new CommentSettingsError(`${where}: unknown ${MARKER} setting "${key2}". Allowed: ${Object.keys(keys).join(", ")}.`);
351
352
  }
352
- if (typeof v !== "string") throw new CommentSettingsError(`${where}: ${MARKER} "${key2}" must be a string.`);
353
+ if (typeof v !== kind) throw new CommentSettingsError(`${where}: ${MARKER} "${key2}" must be a ${kind}.`);
353
354
  settings[key2] = v;
354
355
  }
355
- return { ...description ? { description } : {}, ...Object.keys(settings).length ? { settings } : {} };
356
+ return {
357
+ ...description ? { description } : {},
358
+ ...Object.keys(settings).length ? { settings } : {}
359
+ };
356
360
  }
357
361
  function parseTableComment(comment, table) {
358
362
  return parse(comment, TABLE_KEYS, table);
@@ -526,12 +530,16 @@ function typeName(table) {
526
530
  const pascal = `${table.schema}_${table.table}`.split(/[^A-Za-z0-9]+/).filter(Boolean).map((p) => p[0].toUpperCase() + p.slice(1)).join("");
527
531
  return `${/^[0-9]/.test(pascal) ? "T" : ""}${pascal}Row`;
528
532
  }
533
+ function constName(table) {
534
+ const row = typeName(table).replace(/Row$/, "");
535
+ return row[0].toLowerCase() + row.slice(1);
536
+ }
529
537
  function tsType(column) {
530
538
  const base = column.enumValues?.length ? column.enumValues.map(quote).join(" | ") : TS_TYPE[column.type];
531
539
  const element = column.array ? base.includes("|") ? `(${base})[]` : `${base}[]` : base;
532
540
  return column.nullable ? `${element} | null` : element;
533
541
  }
534
- function field(column) {
542
+ function field(column, indent) {
535
543
  const parts = [`name: ${quote(column.name)}`, `type: ${quote(column.type)}`, `dbType: ${quote(column.dbType)}`];
536
544
  if (column.array) parts.push("array: true");
537
545
  if (column.nullable) parts.push("nullable: true");
@@ -547,10 +555,25 @@ function field(column) {
547
555
  if (label) parts.push(`label: ${quote(label)}`);
548
556
  if (description) parts.push(`description: ${quote(description)}`);
549
557
  if (column.settings?.widget) parts.push(`widget: ${quote(column.settings.widget)}`);
550
- return ` { ${parts.join(", ")} },`;
558
+ if (column.settings?.readonly) parts.push("readOnly: true");
559
+ if (column.settings?.sensitive) parts.push("sensitive: true");
560
+ return `${indent}{ ${parts.join(", ")} },`;
551
561
  }
562
+ var EmitError = class extends Error {
563
+ };
552
564
  function emitContracts(tables, options) {
553
565
  const sorted = [...tables].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
566
+ const seen = /* @__PURE__ */ new Map();
567
+ for (const table of sorted) {
568
+ const id = typeName(table);
569
+ const other = seen.get(id);
570
+ if (other) throw new EmitError(`${other} and ${table.name} would both be named ${id}; rename one, or introspect them separately.`);
571
+ seen.set(id, table.name);
572
+ const labelField = table.settings?.labelField;
573
+ if (labelField && !table.columns.some((c) => c.name === labelField)) {
574
+ throw new EmitError(`${table.name}: @genesis labelField "${labelField}" isn't one of its columns.`);
575
+ }
576
+ }
554
577
  const out = [
555
578
  "// Generated by `genesis introspect` \u2014 do not edit by hand.",
556
579
  `// Source: ${options.source}`,
@@ -559,31 +582,42 @@ function emitContracts(tables, options) {
559
582
  "// Labels, widgets and descriptions come from `@genesis {...}` settings in",
560
583
  "// table and column comments. Pass `contracts` to createStudioHandler: it",
561
584
  "// wins over discovery for presentation, while types, keys and every",
562
- "// permission still come from the live database.",
585
+ "// permission still come from the live database. Each contract goes through",
586
+ "// defineResource, so a bad @genesis setting fails to compile and views read the",
587
+ "// row type with RowOf<typeof contract>.",
563
588
  "",
564
- "export const contracts = {"
589
+ 'import { defineResource } from "@marktiderman/genesis-core";',
590
+ ""
565
591
  ];
566
592
  for (const table of sorted) {
567
- out.push(` ${quote(table.name)}: {`);
568
- out.push(` name: ${quote(table.name)},`);
569
- out.push(` key: ${table.key.length === 1 ? quote(table.key[0]) : `[${table.key.map(quote).join(", ")}]`},`);
570
- if (table.settings?.label) out.push(` label: ${quote(table.settings.label)},`);
571
- if (table.settings?.labelField) out.push(` labelField: ${quote(table.settings.labelField)},`);
593
+ const row = typeName(table);
594
+ out.push(`/** \`${table.name}\`. */`);
595
+ out.push(`export const ${constName(table)} = defineResource<${row}>()({`);
596
+ out.push(` name: ${quote(table.name)},`);
597
+ out.push(` key: ${table.key.length === 1 ? quote(table.key[0]) : `[${table.key.map(quote).join(", ")}]`},`);
598
+ if (table.settings?.label) out.push(` label: ${quote(table.settings.label)},`);
599
+ if (table.settings?.labelField) out.push(` labelField: ${quote(table.settings.labelField)},`);
600
+ if (table.settings?.noun) out.push(` noun: ${quote(table.settings.noun)},`);
601
+ if (table.settings?.nounPlural) out.push(` nounPlural: ${quote(table.settings.nounPlural)},`);
572
602
  const description = table.settings?.description ?? table.description;
573
- if (description) out.push(` description: ${quote(description)},`);
574
- out.push(" fields: [");
575
- for (const column of table.columns) out.push(field(column));
576
- out.push(" ],");
577
- out.push(" },");
578
- }
603
+ if (description) out.push(` description: ${quote(description)},`);
604
+ out.push(" fields: [");
605
+ for (const column of table.columns) out.push(field(column, " "));
606
+ out.push(" ],");
607
+ out.push("});", "");
608
+ }
609
+ out.push("export const contracts = {");
610
+ for (const table of sorted) out.push(` ${quote(table.name)}: ${constName(table)},`);
579
611
  out.push("} as const;", "");
580
612
  out.push("/** Every resource in this contract, `schema.table`. */");
581
613
  out.push("export type GenesisResource = keyof typeof contracts;", "");
582
614
  for (const table of sorted) {
583
615
  out.push(`/** A row of \`${table.name}\`, as the studio handler returns it. */`);
584
- out.push(`export interface ${typeName(table)} {`);
616
+ out.push(`export type ${typeName(table)} = {`);
585
617
  for (const column of table.columns) out.push(` ${propKey(column.name)}: ${tsType(column)};`);
586
- out.push("}", "");
618
+ out.push("};", "");
619
+ out.push(`/** The field names of \`${table.name}\`. */`);
620
+ out.push(`export type ${typeName(table).replace(/Row$/, "Field")} = keyof ${typeName(table)};`, "");
587
621
  }
588
622
  out.push("/** Row types by resource. */");
589
623
  out.push("export interface GenesisRows {");
@@ -2518,7 +2552,7 @@ function namedImportsFrom(code, pkg) {
2518
2552
  // src/doctor/native.ts
2519
2553
  var SCRIPT_EXTS3 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
2520
2554
  var JSX_EXTS3 = /* @__PURE__ */ new Set([".tsx", ".jsx"]);
2521
- var LAYOUT_NAME = /(?:Page|Screen|ScreenContainer)$/;
2555
+ var LAYOUT_NAME = /(?:Page|Screen|ScreenContainer)$|^NativeResourceView$/;
2522
2556
  var NON_SCREEN_ROUTE = /(?:^|\/)(?:_layout|\+html|\+native-intent|\+middleware)\.[jt]sx?$|\+api\.[jt]sx?$/;
2523
2557
  var PART_HEADER = /(?:Section|List|Card|Dialog|Table|Group|Column|Row|Cell|Accordion|Sheet|Drawer|Modal|Popover|Menu|Panel|Form)Header$/;
2524
2558
  var HIDES_HEADER = /\bheaderShown\s*(?::|=\s*\{)\s*false\b/;
@@ -4357,8 +4391,9 @@ var CONTAINER = /(?:Card|CardContent|Dialog|DialogContent|Sheet|SheetContent|Dra
4357
4391
  var SWITCHER = /<(TabsList|SubNavTabs)(?=[\s>/])/g;
4358
4392
  var SHELL = /<AppShell(?=[\s>/])/;
4359
4393
  var GENESIS_PACKAGE2 = /^@marktiderman\/genesis(?:-[\w-]+)?(?:\/|$)/;
4360
- var PAGE_LAYOUT = /^(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell)$/;
4361
- var PACKAGE_SCREEN = /^(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell|Screen|Workspace)$/;
4394
+ var PAGE_LAYOUT = /^(?:(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell)|ResourceView)$/;
4395
+ var EMBEDDED_RESOURCE_VIEW = /<ResourceView\b[^>]*?\blayout\s*=\s*(?:(["'`]) {8}\1|\{\s*(["'`]) {8}\2\s*\})[^>]*>/g;
4396
+ var PACKAGE_SCREEN = /^(?:(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell|Screen|Workspace)|ResourceView)$/;
4362
4397
  var isNative = (ctx) => ctx.config.packs?.includes("native") ?? false;
4363
4398
  var rendersRe = (names) => {
4364
4399
  const list = [...names];
@@ -4472,7 +4507,7 @@ function checkPageLayouts(ctx) {
4472
4507
  const rendersLayout = (code) => {
4473
4508
  const names = new Set(layouts);
4474
4509
  for (const n of namedImportsFrom(code, GENESIS_PACKAGE2)) if (PACKAGE_SCREEN.test(n)) names.add(n);
4475
- return rendersRe(names)?.test(code) ?? false;
4510
+ return rendersRe(names)?.test(code.replace(EMBEDDED_RESOURCE_VIEW, "")) ?? false;
4476
4511
  };
4477
4512
  const cache2 = /* @__PURE__ */ new Map();
4478
4513
  const provides = (r) => {
@@ -4630,6 +4665,6 @@ function formatReport(result) {
4630
4665
  return lines.join("\n");
4631
4666
  }
4632
4667
 
4633
- export { CommentSettingsError, DoctorConfigError, GenesisConfigError, defineDoctorPlugin, detectHost, emitContracts, formatReport, introspectOpenApi, introspectPostgres, parseColumnComment, parseTableComment, planScaffold, planStudioInit, readGenesisConfig, runDoctor, runScaffold, validateConsumerName, validateLinks };
4668
+ export { CommentSettingsError, DoctorConfigError, EmitError, GenesisConfigError, defineDoctorPlugin, detectHost, emitContracts, formatReport, introspectOpenApi, introspectPostgres, parseColumnComment, parseTableComment, planScaffold, planStudioInit, readGenesisConfig, runDoctor, runScaffold, validateConsumerName, validateLinks };
4634
4669
  //# sourceMappingURL=index.js.map
4635
4670
  //# sourceMappingURL=index.js.map