@ai-matrx/records 0.81.1 → 0.81.2

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,5 +1,5 @@
1
1
  import { b as RecordsDataSource, a as RecordsConfig } from '../ports-y1QNfM80.cjs';
2
- import { T as TemplateSpec } from '../types-yBZLtxrZ.cjs';
2
+ import { T as TemplateSpec } from '../types-B4nQMkQT.cjs';
3
3
  import { P as PgError } from '../record-1yDCn169.cjs';
4
4
  import '../subscription-B_WaT-kr.cjs';
5
5
  import '../types-BJGTxu3Y.cjs';
@@ -119,6 +119,8 @@ interface MemoryForm {
119
119
  questions: Json[];
120
120
  presentation: Json;
121
121
  booking: Json | null;
122
+ /** True once an anon_publish step opened it (a declared form is a draft until then). */
123
+ published?: boolean;
122
124
  }
123
125
  interface MemoryDashboard {
124
126
  dashboard_id: string;
@@ -1,5 +1,5 @@
1
1
  import { b as RecordsDataSource, a as RecordsConfig } from '../ports-Y5gLbCXe.js';
2
- import { T as TemplateSpec } from '../types-CU_Tn2Np.js';
2
+ import { T as TemplateSpec } from '../types-BtXYdZGh.js';
3
3
  import { P as PgError } from '../record-1yDCn169.js';
4
4
  import '../subscription-CUok1vAm.js';
5
5
  import '../types-C5-AaPa6.js';
@@ -119,6 +119,8 @@ interface MemoryForm {
119
119
  questions: Json[];
120
120
  presentation: Json;
121
121
  booking: Json | null;
122
+ /** True once an anon_publish step opened it (a declared form is a draft until then). */
123
+ published?: boolean;
122
124
  }
123
125
  interface MemoryDashboard {
124
126
  dashboard_id: string;
@@ -1979,6 +1979,13 @@ function compileInstallPlan(written) {
1979
1979
  save: { [`forms.${f.token}`]: [] },
1980
1980
  made: [{ kind: "form", ref: `forms.${f.token}`, title: f.name, table: `tables.${f.table}` }]
1981
1981
  });
1982
+ if (spec.publishForms !== false) {
1983
+ steps.push({
1984
+ label: `forms.${f.token}.publish`,
1985
+ door: "anon_publish",
1986
+ args: { p_organization_id: "${org}", p_form_id: ref(`forms.${f.token}`), p_published: true }
1987
+ });
1988
+ }
1982
1989
  }
1983
1990
  const actionsByTable = /* @__PURE__ */ new Map();
1984
1991
  const formRefs = Object.fromEntries(spec.forms.map((f) => [f.token, ref(`forms.${f.token}`)]));
@@ -2427,6 +2434,12 @@ function templateWorld(spec, options = {}) {
2427
2434
  });
2428
2435
  break;
2429
2436
  }
2437
+ case "anon_publish": {
2438
+ const id = String(args["p_form_id"] ?? "");
2439
+ const form = world.forms.find((f) => f.form_id === id);
2440
+ if (form) form.published = args["p_published"] !== false;
2441
+ break;
2442
+ }
2430
2443
  case "dashboard_declare": {
2431
2444
  if (!tableId) break;
2432
2445
  const save = step.save ? Object.keys(step.save)[0] : step.label;