@aglyn/tenant-feature-instance 1.31.0 → 1.33.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/tenant-feature-instance",
3
- "version": "1.31.0",
3
+ "version": "1.33.0",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,15 +25,15 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.31.0",
29
- "@aglyn/shared-data-enums": "1.31.0",
30
- "@aglyn/shared-ui-jsx": "1.31.0",
31
- "@aglyn/shared-util-email": "1.31.0",
32
- "@aglyn/shared-util-http": "1.31.0",
33
- "@aglyn/shared-util-timestamp": "1.31.0",
28
+ "@aglyn/aglyn": "1.33.0",
29
+ "@aglyn/shared-data-enums": "1.33.0",
30
+ "@aglyn/shared-ui-jsx": "1.33.0",
31
+ "@aglyn/shared-util-email": "1.33.0",
32
+ "@aglyn/shared-util-http": "1.33.0",
33
+ "@aglyn/shared-util-timestamp": "1.33.0",
34
34
  "@swc/helpers": "0.5.24",
35
35
  "lodash-es": "^4.18.1",
36
- "mobx": "^7.1.6"
36
+ "mobx": "^7.1.8"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@mui/material": "^9.3.1",
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type DocumentData, type DocumentReference, type Firestore, type UpdateData } from 'firebase/firestore';
18
+ /** The signed-in uid on `firestore`'s app, or `null` when nobody is signed in. */
19
+ export declare function signedInUid(firestore: Firestore): string | null;
20
+ /** `{ updatedBy, updatedVia: null }` for the signed-in person, or `{}` when signed out. */
21
+ export declare function clientEditActor(firestore: Firestore): {
22
+ updatedBy?: string;
23
+ updatedVia?: null;
24
+ };
25
+ /**
26
+ * The actor fields a write to `path` carries: the edit actor for a tracked
27
+ * content document, nothing for any other path.
28
+ */
29
+ export declare function clientEditActorForPath(firestore: Firestore, path: string): {
30
+ updatedBy?: string;
31
+ updatedVia?: null;
32
+ };
33
+ /** What a browser publish writes on the version that went live: edit + publish stamps. */
34
+ export declare function clientVersionPublishFields(firestore: Firestore): Record<string, unknown>;
35
+ /** What a browser publish writes on the screen, layout or component: edit + publish stamps. */
36
+ export declare function clientParentPublishFields(firestore: Firestore): Record<string, unknown>;
37
+ /**
38
+ * `data` with the writer added when `ref` is a tracked content document.
39
+ * For a write staged into a batch or transaction by hand.
40
+ */
41
+ export declare function withContentActor<D extends object>(ref: DocumentReference<unknown>, data: D): D;
42
+ /**
43
+ * `updateDoc` that names its writer on a tracked content document (a screen,
44
+ * layout or component, or a version or draft of one), which the rules refuse
45
+ * without it. Any other path is written exactly as `updateDoc` writes it.
46
+ */
47
+ export declare function updateContentDoc(ref: DocumentReference<unknown>, data: UpdateData<DocumentData>): Promise<void>;
48
+ /**
49
+ * Records who published: the publish stamp on the screen, layout or component
50
+ * and on the version that went live.
51
+ *
52
+ * Neither write moves `updatedAt`. The editor's concurrent-edit guard
53
+ * compares a version's `updatedAt` with the stamp it loaded, so a publish
54
+ * that restamped it would read as somebody else's save on the next one.
55
+ *
56
+ * Best effort by design, like the activity row the publish also writes: the
57
+ * publish has already happened by the time this runs, and a failure here
58
+ * must not report it as failed. A rejection is logged, not thrown.
59
+ */
60
+ export declare function recordClientPublish(refs: {
61
+ parent: DocumentReference<unknown>;
62
+ version?: DocumentReference<unknown> | null;
63
+ }): Promise<void>;
@@ -0,0 +1,111 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ import { isTrackedContentPath, parentPublishStamp, versionPublishStamp } from "@aglyn/aglyn/app-utils/content-write-stamp";
18
+ import { getAuth } from "firebase/auth";
19
+ import { serverTimestamp, updateDoc } from "firebase/firestore";
20
+ /*
21
+ * THE BROWSER'S HALF OF THE CONTENT WRITE STAMP.
22
+ *
23
+ * A browser write to a screen, layout or component (or a version or draft of
24
+ * one) names its writer as the signed-in uid, which is the one value the
25
+ * Firestore rules accept for `updatedBy` there. It is read from the auth
26
+ * instance at the moment of the write rather than threaded through every
27
+ * caller, so a surface added later stamps without knowing it has to.
28
+ */ /** The signed-in uid on `firestore`'s app, or `null` when nobody is signed in. */ export function signedInUid(firestore) {
29
+ try {
30
+ var _ref;
31
+ var _getAuth_currentUser;
32
+ return (_ref = (_getAuth_currentUser = getAuth(firestore.app).currentUser) == null ? void 0 : _getAuth_currentUser.uid) != null ? _ref : null;
33
+ } catch (unused) {
34
+ return null;
35
+ }
36
+ }
37
+ /** `{ updatedBy, updatedVia: null }` for the signed-in person, or `{}` when signed out. */ export function clientEditActor(firestore) {
38
+ const uid = signedInUid(firestore);
39
+ return uid ? {
40
+ updatedBy: uid,
41
+ updatedVia: null
42
+ } : {};
43
+ }
44
+ /**
45
+ * The actor fields a write to `path` carries: the edit actor for a tracked
46
+ * content document, nothing for any other path.
47
+ */ export function clientEditActorForPath(firestore, path) {
48
+ return isTrackedContentPath(path) ? clientEditActor(firestore) : {};
49
+ }
50
+ /** What a browser publish writes on the version that went live: edit + publish stamps. */ export function clientVersionPublishFields(firestore) {
51
+ const uid = signedInUid(firestore);
52
+ if (!uid) return {};
53
+ return _extends({
54
+ updatedBy: uid,
55
+ updatedVia: null
56
+ }, versionPublishStamp({
57
+ uid
58
+ }, serverTimestamp()));
59
+ }
60
+ /** What a browser publish writes on the screen, layout or component: edit + publish stamps. */ export function clientParentPublishFields(firestore) {
61
+ const uid = signedInUid(firestore);
62
+ if (!uid) return {};
63
+ return _extends({
64
+ updatedBy: uid,
65
+ updatedVia: null
66
+ }, parentPublishStamp({
67
+ uid
68
+ }, serverTimestamp()));
69
+ }
70
+ /**
71
+ * `data` with the writer added when `ref` is a tracked content document.
72
+ * For a write staged into a batch or transaction by hand.
73
+ */ export function withContentActor(ref, data) {
74
+ return _extends({}, data, clientEditActorForPath(ref.firestore, ref.path));
75
+ }
76
+ /**
77
+ * `updateDoc` that names its writer on a tracked content document (a screen,
78
+ * layout or component, or a version or draft of one), which the rules refuse
79
+ * without it. Any other path is written exactly as `updateDoc` writes it.
80
+ */ export function updateContentDoc(ref, data) {
81
+ return updateDoc(ref, withContentActor(ref, data));
82
+ }
83
+ /**
84
+ * Records who published: the publish stamp on the screen, layout or component
85
+ * and on the version that went live.
86
+ *
87
+ * Neither write moves `updatedAt`. The editor's concurrent-edit guard
88
+ * compares a version's `updatedAt` with the stamp it loaded, so a publish
89
+ * that restamped it would read as somebody else's save on the next one.
90
+ *
91
+ * Best effort by design, like the activity row the publish also writes: the
92
+ * publish has already happened by the time this runs, and a failure here
93
+ * must not report it as failed. A rejection is logged, not thrown.
94
+ */ export async function recordClientPublish(refs) {
95
+ const firestore = refs.parent.firestore;
96
+ // Each write wrapped so one that throws before it returns a promise is
97
+ // reported like one that rejects, never as the publish failing.
98
+ const write = async (ref, data)=>updateDoc(ref, data);
99
+ const writes = [
100
+ write(refs.parent, clientParentPublishFields(firestore))
101
+ ];
102
+ if (refs.version) writes.push(write(refs.version, clientVersionPublishFields(firestore)));
103
+ const results = await Promise.allSettled(writes);
104
+ for (const result of results){
105
+ if (result.status === 'rejected') {
106
+ console.warn('[publish] who published could not be recorded', result.reason);
107
+ }
108
+ }
109
+ }
110
+
111
+ //# sourceMappingURL=content-write-actor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../libs/tenant/feature/instance/src/lib/hooks/helpers/content-write-actor.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n isTrackedContentPath,\n parentPublishStamp,\n versionPublishStamp,\n} from '@aglyn/aglyn/app-utils/content-write-stamp'\nimport { getAuth } from 'firebase/auth'\nimport {\n type DocumentData,\n type DocumentReference,\n type Firestore,\n serverTimestamp,\n type UpdateData,\n updateDoc,\n} from 'firebase/firestore'\n\n/*\n * THE BROWSER'S HALF OF THE CONTENT WRITE STAMP.\n *\n * A browser write to a screen, layout or component (or a version or draft of\n * one) names its writer as the signed-in uid, which is the one value the\n * Firestore rules accept for `updatedBy` there. It is read from the auth\n * instance at the moment of the write rather than threaded through every\n * caller, so a surface added later stamps without knowing it has to.\n */\n\n/** The signed-in uid on `firestore`'s app, or `null` when nobody is signed in. */\nexport function signedInUid(firestore: Firestore): string | null {\n try {\n return getAuth(firestore.app).currentUser?.uid ?? null\n } catch {\n return null\n }\n}\n\n/** `{ updatedBy, updatedVia: null }` for the signed-in person, or `{}` when signed out. */\nexport function clientEditActor(firestore: Firestore): { updatedBy?: string; updatedVia?: null } {\n const uid = signedInUid(firestore)\n return uid ? { updatedBy: uid, updatedVia: null } : {}\n}\n\n/**\n * The actor fields a write to `path` carries: the edit actor for a tracked\n * content document, nothing for any other path.\n */\nexport function clientEditActorForPath(\n firestore: Firestore,\n path: string,\n): { updatedBy?: string; updatedVia?: null } {\n return isTrackedContentPath(path) ? clientEditActor(firestore) : {}\n}\n\n/** What a browser publish writes on the version that went live: edit + publish stamps. */\nexport function clientVersionPublishFields(firestore: Firestore): Record<string, unknown> {\n const uid = signedInUid(firestore)\n if (!uid) return {}\n return { updatedBy: uid, updatedVia: null, ...versionPublishStamp({ uid }, serverTimestamp()) }\n}\n\n/** What a browser publish writes on the screen, layout or component: edit + publish stamps. */\nexport function clientParentPublishFields(firestore: Firestore): Record<string, unknown> {\n const uid = signedInUid(firestore)\n if (!uid) return {}\n return { updatedBy: uid, updatedVia: null, ...parentPublishStamp({ uid }, serverTimestamp()) }\n}\n\n/**\n * `data` with the writer added when `ref` is a tracked content document.\n * For a write staged into a batch or transaction by hand.\n */\nexport function withContentActor<D extends object>(ref: DocumentReference<unknown>, data: D): D {\n return { ...data, ...clientEditActorForPath(ref.firestore, ref.path) }\n}\n\n/**\n * `updateDoc` that names its writer on a tracked content document (a screen,\n * layout or component, or a version or draft of one), which the rules refuse\n * without it. Any other path is written exactly as `updateDoc` writes it.\n */\nexport function updateContentDoc(\n ref: DocumentReference<unknown>,\n data: UpdateData<DocumentData>,\n): Promise<void> {\n return updateDoc(ref as DocumentReference<DocumentData>, withContentActor(ref, data as object) as UpdateData<DocumentData>)\n}\n\n/**\n * Records who published: the publish stamp on the screen, layout or component\n * and on the version that went live.\n *\n * Neither write moves `updatedAt`. The editor's concurrent-edit guard\n * compares a version's `updatedAt` with the stamp it loaded, so a publish\n * that restamped it would read as somebody else's save on the next one.\n *\n * Best effort by design, like the activity row the publish also writes: the\n * publish has already happened by the time this runs, and a failure here\n * must not report it as failed. A rejection is logged, not thrown.\n */\nexport async function recordClientPublish(refs: {\n parent: DocumentReference<unknown>\n version?: DocumentReference<unknown> | null\n}): Promise<void> {\n const firestore = refs.parent.firestore\n // Each write wrapped so one that throws before it returns a promise is\n // reported like one that rejects, never as the publish failing.\n const write = async (ref: DocumentReference<unknown>, data: Record<string, unknown>) =>\n updateDoc(ref as DocumentReference<DocumentData>, data)\n const writes: Promise<void>[] = [write(refs.parent, clientParentPublishFields(firestore))]\n if (refs.version) writes.push(write(refs.version, clientVersionPublishFields(firestore)))\n const results = await Promise.allSettled(writes)\n for (const result of results) {\n if (result.status === 'rejected') {\n console.warn('[publish] who published could not be recorded', result.reason)\n }\n }\n}\n"],"names":["isTrackedContentPath","parentPublishStamp","versionPublishStamp","getAuth","serverTimestamp","updateDoc","signedInUid","firestore","app","currentUser","uid","clientEditActor","updatedBy","updatedVia","clientEditActorForPath","path","clientVersionPublishFields","clientParentPublishFields","withContentActor","ref","data","updateContentDoc","recordClientPublish","refs","parent","write","writes","version","push","results","Promise","allSettled","result","status","console","warn","reason"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,oBAAoB,EACpBC,kBAAkB,EAClBC,mBAAmB,QACd,6CAA4C;AACnD,SAASC,OAAO,QAAQ,gBAAe;AACvC,SAIEC,eAAe,EAEfC,SAAS,QACJ,qBAAoB;AAE3B;;;;;;;;CAQC,GAED,gFAAgF,GAChF,OAAO,SAASC,YAAYC,SAAoB;IAC9C,IAAI;;YACKJ;QAAP,gBAAOA,uBAAAA,QAAQI,UAAUC,GAAG,EAAEC,WAAW,qBAAlCN,qBAAoCO,GAAG,mBAAI;IACpD,EAAE,eAAM;QACN,OAAO;IACT;AACF;AAEA,yFAAyF,GACzF,OAAO,SAASC,gBAAgBJ,SAAoB;IAClD,MAAMG,MAAMJ,YAAYC;IACxB,OAAOG,MAAM;QAAEE,WAAWF;QAAKG,YAAY;IAAK,IAAI,CAAC;AACvD;AAEA;;;CAGC,GACD,OAAO,SAASC,uBACdP,SAAoB,EACpBQ,IAAY;IAEZ,OAAOf,qBAAqBe,QAAQJ,gBAAgBJ,aAAa,CAAC;AACpE;AAEA,wFAAwF,GACxF,OAAO,SAASS,2BAA2BT,SAAoB;IAC7D,MAAMG,MAAMJ,YAAYC;IACxB,IAAI,CAACG,KAAK,OAAO,CAAC;IAClB,OAAO;QAAEE,WAAWF;QAAKG,YAAY;OAASX,oBAAoB;QAAEQ;IAAI,GAAGN;AAC7E;AAEA,6FAA6F,GAC7F,OAAO,SAASa,0BAA0BV,SAAoB;IAC5D,MAAMG,MAAMJ,YAAYC;IACxB,IAAI,CAACG,KAAK,OAAO,CAAC;IAClB,OAAO;QAAEE,WAAWF;QAAKG,YAAY;OAASZ,mBAAmB;QAAES;IAAI,GAAGN;AAC5E;AAEA;;;CAGC,GACD,OAAO,SAASc,iBAAmCC,GAA+B,EAAEC,IAAO;IACzF,OAAO,aAAKA,MAASN,uBAAuBK,IAAIZ,SAAS,EAAEY,IAAIJ,IAAI;AACrE;AAEA;;;;CAIC,GACD,OAAO,SAASM,iBACdF,GAA+B,EAC/BC,IAA8B;IAE9B,OAAOf,UAAUc,KAAwCD,iBAAiBC,KAAKC;AACjF;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,eAAeE,oBAAoBC,IAGzC;IACC,MAAMhB,YAAYgB,KAAKC,MAAM,CAACjB,SAAS;IACvC,uEAAuE;IACvE,gEAAgE;IAChE,MAAMkB,QAAQ,OAAON,KAAiCC,OACpDf,UAAUc,KAAwCC;IACpD,MAAMM,SAA0B;QAACD,MAAMF,KAAKC,MAAM,EAAEP,0BAA0BV;KAAY;IAC1F,IAAIgB,KAAKI,OAAO,EAAED,OAAOE,IAAI,CAACH,MAAMF,KAAKI,OAAO,EAAEX,2BAA2BT;IAC7E,MAAMsB,UAAU,MAAMC,QAAQC,UAAU,CAACL;IACzC,KAAK,MAAMM,UAAUH,QAAS;QAC5B,IAAIG,OAAOC,MAAM,KAAK,YAAY;YAChCC,QAAQC,IAAI,CAAC,iDAAiDH,OAAOI,MAAM;QAC7E;IACF;AACF"}
@@ -1,3 +1,4 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
1
2
  /**
2
3
  * @license
3
4
  * Copyright 2026 Aglyn LLC
@@ -16,6 +17,7 @@
16
17
  */ import { ConcurrentEditError, hasConcurrentWrite, versionStamp } from "@aglyn/aglyn";
17
18
  import { runTransaction } from "firebase/firestore";
18
19
  import isEqual from "lodash-es/isEqual.js";
20
+ import { clientEditActorForPath } from "./content-write-actor.js";
19
21
  /**
20
22
  * Persists a besigner node map only if the stored document still matches the
21
23
  * baseline the editor loaded (AGL-1301).
@@ -79,7 +81,8 @@ import isEqual from "lodash-es/isEqual.js";
79
81
  throw new ConcurrentEditError();
80
82
  }
81
83
  }
82
- transaction.set(ref, data, {
84
+ // The writer rides the same write as the nodes (see `content-write-stamp`).
85
+ transaction.set(ref, _extends({}, data, clientEditActorForPath(ref.firestore, ref.path)), {
83
86
  merge: true
84
87
  });
85
88
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../libs/tenant/feature/instance/src/lib/hooks/helpers/guarded-nodes-save.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ConcurrentEditError,\n hasConcurrentWrite,\n versionStamp,\n} from '@aglyn/aglyn'\nimport { runTransaction, type DocumentReference } from 'firebase/firestore'\nimport isEqual from 'lodash-es/isEqual.js'\n\n/**\n * What the editor believes the stored document looked like when it last\n * agreed with it. Both fields optional: an absent baseline means \"never\n * established\", which must not refuse the save (see `hasConcurrentWrite`).\n */\nexport interface NodesSaveBaseline {\n /** `versionStamp(...)` of the document's `updatedAt` at load/last save. */\n baseStamp?: string | null\n /** The stored nodes as of that agreement, in STORED shape. */\n baseNodes?: unknown\n}\n\n/**\n * Persists a besigner node map only if the stored document still matches the\n * baseline the editor loaded (AGL-1301).\n *\n * The AGL-674 guard is listener-based, so a save clicked in the window\n * between another writer's commit and the local snapshot's delivery still\n * overwrote it — the guard had simply not heard yet. Running the same check\n * inside a Firestore transaction closes that window: the `get` is served by\n * the backend (never the local cache), the check runs against what is\n * actually stored, and the write only commits if nothing moved. Contention\n * during the transaction re-runs it against fresh data, so the late writer\n * aborts rather than winning by timing.\n *\n * TWO preconditions, deliberately:\n *\n * - The `updatedAt` stamp, same equality-only comparison as the listener\n * guard.\n * - The stored `nodes` content itself. `updatedAt` is an app-level FIELD\n * that a writer can forget — admin backfills have updated `nodes` without\n * touching it, and such a write was invisible to the stamp and got\n * clobbered. The web client SDK exposes no server-side `updateTime` on a\n * snapshot (`snapshot.metadata` carries only `hasPendingWrites` /\n * `fromCache`; document update times are Admin-SDK-only), so comparing\n * the content is the strongest check actually available to this client —\n * and it is exact: this save only ever writes `nodes` (+ stamp), so\n * \"did `nodes` change under me\" is precisely the conflict that loses work.\n *\n * Aborts by throwing `ConcurrentEditError`, which `useBesignerDocument`\n * surfaces through the existing refusal UX. A converter on `ref` applies as\n * usual, so compressed-at-rest documents stay compressed and keep stamping\n * `updatedAt` on write.\n *\n * Trade-off, accepted: a transaction requires the backend, so this save no\n * longer queues offline. A conflict guard that consults a local cache would\n * be theatre — the AGL-674 refusal already implies \"the server has spoken\".\n *\n * ## Why this did NOT change when the client relaxed (AGL-2486)\n *\n * The client no longer refuses merely because the stored version moved: with\n * the co-edit mirror running it usually already holds what the other writer\n * stored, so its own write is a superset (`incorporatesStoredNodes`). What\n * it does with that evidence is advance its BASELINE onto the write it has\n * incorporated — and this precondition is what makes that safe. It is\n * unchanged and strictly stricter: the baseline the client presents must\n * still match what is actually stored when the transaction reads it, so\n * anything that lands between the client's decision and this commit moves\n * `nodes` away from it and aborts. The docs' promise that \"even a save\n * racing the conflict by milliseconds is refused\" therefore holds exactly as\n * before; the client simply stopped refusing saves this would have accepted.\n */\nexport async function saveNodesGuarded<T>(\n ref: DocumentReference<T>,\n data: Partial<T>,\n baseline?: NodesSaveBaseline,\n): Promise<void> {\n await runTransaction(ref.firestore, async (transaction) => {\n const snapshot = await transaction.get(ref)\n const stored = snapshot.data() as\n | { updatedAt?: unknown; nodes?: unknown }\n | undefined\n if (stored) {\n const storedStamp = versionStamp(stored.updatedAt)\n if (hasConcurrentWrite(baseline?.baseStamp ?? null, storedStamp)) {\n throw new ConcurrentEditError()\n }\n if (\n baseline?.baseNodes != null &&\n stored.nodes != null &&\n !isEqual(stored.nodes, baseline.baseNodes)\n ) {\n throw new ConcurrentEditError()\n }\n }\n transaction.set(ref, data, { merge: true })\n })\n}\n\nexport default saveNodesGuarded\n"],"names":["ConcurrentEditError","hasConcurrentWrite","versionStamp","runTransaction","isEqual","saveNodesGuarded","ref","data","baseline","firestore","transaction","snapshot","get","stored","storedStamp","updatedAt","baseStamp","baseNodes","nodes","set","merge"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,mBAAmB,EACnBC,kBAAkB,EAClBC,YAAY,QACP,eAAc;AACrB,SAASC,cAAc,QAAgC,qBAAoB;AAC3E,OAAOC,aAAa,uBAAsB;AAc1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDC,GACD,OAAO,eAAeC,iBACpBC,GAAyB,EACzBC,IAAgB,EAChBC,QAA4B;IAE5B,MAAML,eAAeG,IAAIG,SAAS,EAAE,OAAOC;QACzC,MAAMC,WAAW,MAAMD,YAAYE,GAAG,CAACN;QACvC,MAAMO,SAASF,SAASJ,IAAI;QAG5B,IAAIM,QAAQ;;YACV,MAAMC,cAAcZ,aAAaW,OAAOE,SAAS;YACjD,IAAId,2BAAmBO,4BAAAA,SAAUQ,SAAS,mBAAI,MAAMF,cAAc;gBAChE,MAAM,IAAId;YACZ;YACA,IACEQ,CAAAA,4BAAAA,SAAUS,SAAS,KAAI,QACvBJ,OAAOK,KAAK,IAAI,QAChB,CAACd,QAAQS,OAAOK,KAAK,EAAEV,SAASS,SAAS,GACzC;gBACA,MAAM,IAAIjB;YACZ;QACF;QACAU,YAAYS,GAAG,CAACb,KAAKC,MAAM;YAAEa,OAAO;QAAK;IAC3C;AACF;AAEA,eAAef,iBAAgB"}
1
+ {"version":3,"sources":["../../../../../../../../../libs/tenant/feature/instance/src/lib/hooks/helpers/guarded-nodes-save.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ConcurrentEditError,\n hasConcurrentWrite,\n versionStamp,\n} from '@aglyn/aglyn'\nimport { runTransaction, type DocumentReference } from 'firebase/firestore'\nimport isEqual from 'lodash-es/isEqual.js'\nimport { clientEditActorForPath } from './content-write-actor'\n\n/**\n * What the editor believes the stored document looked like when it last\n * agreed with it. Both fields optional: an absent baseline means \"never\n * established\", which must not refuse the save (see `hasConcurrentWrite`).\n */\nexport interface NodesSaveBaseline {\n /** `versionStamp(...)` of the document's `updatedAt` at load/last save. */\n baseStamp?: string | null\n /** The stored nodes as of that agreement, in STORED shape. */\n baseNodes?: unknown\n}\n\n/**\n * Persists a besigner node map only if the stored document still matches the\n * baseline the editor loaded (AGL-1301).\n *\n * The AGL-674 guard is listener-based, so a save clicked in the window\n * between another writer's commit and the local snapshot's delivery still\n * overwrote it — the guard had simply not heard yet. Running the same check\n * inside a Firestore transaction closes that window: the `get` is served by\n * the backend (never the local cache), the check runs against what is\n * actually stored, and the write only commits if nothing moved. Contention\n * during the transaction re-runs it against fresh data, so the late writer\n * aborts rather than winning by timing.\n *\n * TWO preconditions, deliberately:\n *\n * - The `updatedAt` stamp, same equality-only comparison as the listener\n * guard.\n * - The stored `nodes` content itself. `updatedAt` is an app-level FIELD\n * that a writer can forget — admin backfills have updated `nodes` without\n * touching it, and such a write was invisible to the stamp and got\n * clobbered. The web client SDK exposes no server-side `updateTime` on a\n * snapshot (`snapshot.metadata` carries only `hasPendingWrites` /\n * `fromCache`; document update times are Admin-SDK-only), so comparing\n * the content is the strongest check actually available to this client —\n * and it is exact: this save only ever writes `nodes` (+ stamp), so\n * \"did `nodes` change under me\" is precisely the conflict that loses work.\n *\n * Aborts by throwing `ConcurrentEditError`, which `useBesignerDocument`\n * surfaces through the existing refusal UX. A converter on `ref` applies as\n * usual, so compressed-at-rest documents stay compressed and keep stamping\n * `updatedAt` on write.\n *\n * Trade-off, accepted: a transaction requires the backend, so this save no\n * longer queues offline. A conflict guard that consults a local cache would\n * be theatre — the AGL-674 refusal already implies \"the server has spoken\".\n *\n * ## Why this did NOT change when the client relaxed (AGL-2486)\n *\n * The client no longer refuses merely because the stored version moved: with\n * the co-edit mirror running it usually already holds what the other writer\n * stored, so its own write is a superset (`incorporatesStoredNodes`). What\n * it does with that evidence is advance its BASELINE onto the write it has\n * incorporated — and this precondition is what makes that safe. It is\n * unchanged and strictly stricter: the baseline the client presents must\n * still match what is actually stored when the transaction reads it, so\n * anything that lands between the client's decision and this commit moves\n * `nodes` away from it and aborts. The docs' promise that \"even a save\n * racing the conflict by milliseconds is refused\" therefore holds exactly as\n * before; the client simply stopped refusing saves this would have accepted.\n */\nexport async function saveNodesGuarded<T>(\n ref: DocumentReference<T>,\n data: Partial<T>,\n baseline?: NodesSaveBaseline,\n): Promise<void> {\n await runTransaction(ref.firestore, async (transaction) => {\n const snapshot = await transaction.get(ref)\n const stored = snapshot.data() as\n | { updatedAt?: unknown; nodes?: unknown }\n | undefined\n if (stored) {\n const storedStamp = versionStamp(stored.updatedAt)\n if (hasConcurrentWrite(baseline?.baseStamp ?? null, storedStamp)) {\n throw new ConcurrentEditError()\n }\n if (\n baseline?.baseNodes != null &&\n stored.nodes != null &&\n !isEqual(stored.nodes, baseline.baseNodes)\n ) {\n throw new ConcurrentEditError()\n }\n }\n // The writer rides the same write as the nodes (see `content-write-stamp`).\n transaction.set(\n ref,\n { ...data, ...clientEditActorForPath(ref.firestore, ref.path) } as Partial<T>,\n { merge: true },\n )\n })\n}\n\nexport default saveNodesGuarded\n"],"names":["ConcurrentEditError","hasConcurrentWrite","versionStamp","runTransaction","isEqual","clientEditActorForPath","saveNodesGuarded","ref","data","baseline","firestore","transaction","snapshot","get","stored","storedStamp","updatedAt","baseStamp","baseNodes","nodes","set","path","merge"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,mBAAmB,EACnBC,kBAAkB,EAClBC,YAAY,QACP,eAAc;AACrB,SAASC,cAAc,QAAgC,qBAAoB;AAC3E,OAAOC,aAAa,uBAAsB;AAC1C,SAASC,sBAAsB,QAAQ,2BAAuB;AAc9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDC,GACD,OAAO,eAAeC,iBACpBC,GAAyB,EACzBC,IAAgB,EAChBC,QAA4B;IAE5B,MAAMN,eAAeI,IAAIG,SAAS,EAAE,OAAOC;QACzC,MAAMC,WAAW,MAAMD,YAAYE,GAAG,CAACN;QACvC,MAAMO,SAASF,SAASJ,IAAI;QAG5B,IAAIM,QAAQ;;YACV,MAAMC,cAAcb,aAAaY,OAAOE,SAAS;YACjD,IAAIf,2BAAmBQ,4BAAAA,SAAUQ,SAAS,mBAAI,MAAMF,cAAc;gBAChE,MAAM,IAAIf;YACZ;YACA,IACES,CAAAA,4BAAAA,SAAUS,SAAS,KAAI,QACvBJ,OAAOK,KAAK,IAAI,QAChB,CAACf,QAAQU,OAAOK,KAAK,EAAEV,SAASS,SAAS,GACzC;gBACA,MAAM,IAAIlB;YACZ;QACF;QACA,4EAA4E;QAC5EW,YAAYS,GAAG,CACbb,KACA,aAAKC,MAASH,uBAAuBE,IAAIG,SAAS,EAAEH,IAAIc,IAAI,IAC5D;YAAEC,OAAO;QAAK;IAElB;AACF;AAEA,eAAehB,iBAAgB"}
@@ -18,6 +18,7 @@ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_wi
18
18
  */ import { HOST_UNPERSISTED_FIELDS, ORG_UNPERSISTED_FIELDS } from "@aglyn/aglyn";
19
19
  import { serverTimestamp, setDoc, updateDoc, writeBatch } from "firebase/firestore";
20
20
  import { useCallback } from "react";
21
+ import { clientEditActorForPath } from "./content-write-actor.js";
21
22
  /**
22
23
  * Every UI write stamps `updatedAt` (AGL-455) — the "last updated" columns
23
24
  * read it, and callers historically forgot it. Spread order lets a caller's
@@ -27,6 +28,15 @@ import { useCallback } from "react";
27
28
  updatedAt: serverTimestamp()
28
29
  }, data);
29
30
  }
31
+ /**
32
+ * `stampUpdatedAt` plus the writer, on the documents that record one: a
33
+ * screen, layout or component and their versions and drafts carry
34
+ * `updatedBy`/`updatedVia` (see `content-write-stamp`), and the rules refuse
35
+ * a write to them that leaves it out. Written after the caller's fields, so a
36
+ * payload cannot name somebody else.
37
+ */ function stampWrite(ref, data) {
38
+ return _extends({}, stampUpdatedAt(data), clientEditActorForPath(ref.firestore, ref.path));
39
+ }
30
40
  /**
31
41
  * Keys that are never document fields, taken from where that is written down
32
42
  * (AGL-1429). `HOST_UNPERSISTED_FIELDS` and `ORG_UNPERSISTED_FIELDS` each
@@ -77,12 +87,12 @@ function getUnpersistedFields() {
77
87
  // match. Pin the call to the single-overload signature actually used.
78
88
  const typedUpdateDoc = updateDoc;
79
89
  export function useUpdateDocCallback(ref) {
80
- return useCallback((data)=>typedUpdateDoc(ref, stampUpdatedAt(dropUnpersistedFields(data))), [
90
+ return useCallback((data)=>typedUpdateDoc(ref, stampWrite(ref, dropUnpersistedFields(data))), [
81
91
  ref
82
92
  ]);
83
93
  }
84
94
  export function useSetDocCallback(ref) {
85
- return useCallback((data, options)=>setDoc(ref, stampUpdatedAt(dropUnpersistedFields(data)), options != null ? options : {}), [
95
+ return useCallback((data, options)=>setDoc(ref, stampWrite(ref, dropUnpersistedFields(data)), options != null ? options : {}), [
86
96
  ref
87
97
  ]);
88
98
  }
@@ -107,7 +117,7 @@ export function useModifyDocCallback(ref) {
107
117
  ]);
108
118
  void _flag;
109
119
  const batch = writeBatch(ref.firestore);
110
- const payload = stampUpdatedAt(dropUnpersistedFields(data));
120
+ const payload = stampWrite(ref, dropUnpersistedFields(data));
111
121
  // `batch.set` applies the ref's converter exactly as `setDoc` does,
112
122
  // and `batch.update` skips it exactly as `updateDoc` does — so the
113
123
  // batched write stores what the unbatched one would have.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../libs/tenant/feature/instance/src/lib/hooks/helpers/use-modify-doc-callback.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { HOST_UNPERSISTED_FIELDS, ORG_UNPERSISTED_FIELDS } from '@aglyn/aglyn'\nimport {\n type DocumentData,\n type DocumentReference,\n type Firestore,\n serverTimestamp,\n setDoc,\n type SetOptions,\n type UpdateData,\n updateDoc,\n type WriteBatch,\n writeBatch,\n} from 'firebase/firestore'\nimport { useCallback } from 'react'\n\n/**\n * Every UI write stamps `updatedAt` (AGL-455) — the \"last updated\" columns\n * read it, and callers historically forgot it. Spread order lets a caller's\n * explicit `updatedAt` win (backfills, imports).\n */\nfunction stampUpdatedAt<D extends object>(data: D): D {\n return { updatedAt: serverTimestamp(), ...data }\n}\n\n/**\n * Keys that are never document fields, taken from where that is written down\n * (AGL-1429). `HOST_UNPERSISTED_FIELDS` and `ORG_UNPERSISTED_FIELDS` each\n * declare the synthetic `$id` the readers attach; the INTERSECTION is used\n * deliberately, so this generic boundary only ever strips a key that every\n * declaration agrees is unpersisted. A key added to one map alone is not\n * silently stripped from the other collection's writes — the spec's drift\n * assertion fires instead, and someone decides.\n */\n/*\n * Resolved on first use, not at module scope. Computing it eagerly made this\n * module — and therefore every consumer of the write callbacks — fail to LOAD\n * in any suite that mocks the `@aglyn/aglyn` barrel without re-exporting both\n * maps, which two console specs do. A write-boundary guard that cannot be\n * imported is worse than the leak it prevents.\n */\nlet unpersistedFields: readonly string[] | undefined\n\nfunction getUnpersistedFields(): readonly string[] {\n if (unpersistedFields) return unpersistedFields\n const host = HOST_UNPERSISTED_FIELDS ?? {}\n const org = ORG_UNPERSISTED_FIELDS ?? {}\n unpersistedFields = Object.freeze(\n Object.keys(host).filter((key) => key in org),\n )\n return unpersistedFields\n}\n\n/**\n * Drop the reader-injected keys before the payload leaves for Firestore.\n *\n * This has to happen here rather than in the refs' converters, which is where\n * it used to live alone (`503f197ca` added the `$id` strip to `useHostRef`'s\n * `toFirestore`). `updateDoc` never applies a converter — `setDoc` calls\n * `applyFirestoreDataConverter` and `updateDoc` does not — so a converter\n * strip is a guarantee about ONE of the two SDK calls, and which one a write\n * gets is decided by whether its caller happened to pass `merge`. That is how\n * `hosts/-MtN17_cpfPPLwWjE6z4` came to hold a persisted `$id` (AGL-1423).\n *\n * Only exact top-level keys are removed. Dotted `updateDoc` paths address\n * nested maps, and besigner node maps legitimately store a `$id` per node —\n * matching those would be the same over-broad scan AGL-1423 warned about.\n */\nfunction dropUnpersistedFields<D extends object>(data: D): D {\n const keys = getUnpersistedFields()\n if (!keys.some((key) => key in data)) return data\n const rest = { ...data } as Record<string, unknown>\n for (const key of keys) delete rest[key]\n return rest as D\n}\n\n\nexport type UpdateDocCallback<T> = (data: UpdateData<T>) => Promise<void>\nexport type SetDocCallback<T> = (\n data: Partial<T>,\n options?: SetOptions,\n) => Promise<void>\nexport type ModifyDocOptions = SetOptions & {\n shouldSet?: boolean\n /**\n * Other writes that must land in the SAME commit as this one, or not at\n * all. Given, the write goes through a batch — the same stamp, strip and\n * converter as without it — with whatever this stages beside it. The\n * console uses it to write a site-wide cache drop down durably next to a\n * settings save (AGL-3386).\n */\n alongside?: (batch: WriteBatch, firestore: Firestore) => void\n}\nexport type ModifyDocCallback<T> = (\n data: UpdateData<T> | Partial<T>,\n options?: ModifyDocOptions,\n) => Promise<void>\n\n// `updateDoc`'s overload resolution keys off `DocumentReference`'s\n// `DbModelType` param, which defaults to the generic `DocumentData` when a\n// caller only supplies `AppModelType` (as every hook here does) — that\n// makes TS widen `UpdateData<T>` for unconstrained `T` and reject the\n// match. Pin the call to the single-overload signature actually used.\nconst typedUpdateDoc = updateDoc as <T>(\n ref: DocumentReference<T>,\n data: UpdateData<T>,\n) => Promise<void>\n\nexport function useUpdateDocCallback<T>(\n ref: DocumentReference<T>,\n): UpdateDocCallback<T> {\n return useCallback(\n (data: UpdateData<T>) =>\n typedUpdateDoc(\n ref,\n stampUpdatedAt(dropUnpersistedFields(data as object)) as UpdateData<T>,\n ),\n [ref],\n )\n}\n\nexport function useSetDocCallback<T>(\n ref: DocumentReference<T>,\n): SetDocCallback<T> {\n return useCallback(\n (data: Partial<T>, options?: SetOptions) =>\n setDoc(\n ref,\n stampUpdatedAt(dropUnpersistedFields(data as object)) as Partial<T>,\n options ?? {},\n ),\n [ref],\n )\n}\n\nexport function useModifyDocCallback<T>(\n ref: DocumentReference<T>,\n): ModifyDocCallback<T> {\n const updateDocCb = useUpdateDocCallback(ref)\n const setDocCb = useSetDocCallback(ref)\n return useCallback(\n (data: UpdateData<T> | Partial<T>, options?: ModifyDocOptions) => {\n // SetOptions semantics (merge/mergeFields) require setDoc: updateDoc\n // ignores them and, critically, bypasses the ref's withConverter\n // serialization (e.g. screen-version node compression) — and with it\n // EVERY strip the converter performs, including `$id` (AGL-1429).\n //\n // Nothing downstream of this line may therefore be relied on to clean\n // a payload. Anything that must hold for both branches belongs above\n // it, which is where `dropUnpersistedFields` now runs.\n const shouldSet =\n options?.shouldSet ||\n (options && 'merge' in options) ||\n (options && 'mergeFields' in options)\n if (options?.alongside) {\n // `shouldSet` is this hook's own flag, never a Firestore option.\n const { alongside, shouldSet: _flag, ...setOptions } = options\n void _flag\n const batch = writeBatch(ref.firestore)\n const payload = stampUpdatedAt(dropUnpersistedFields(data as object))\n // `batch.set` applies the ref's converter exactly as `setDoc` does,\n // and `batch.update` skips it exactly as `updateDoc` does — so the\n // batched write stores what the unbatched one would have.\n if (shouldSet) batch.set(ref, payload as Partial<T>, setOptions)\n // Pinned to the untyped overload for the reason `typedUpdateDoc` is.\n else batch.update(ref as DocumentReference, payload as UpdateData<DocumentData>)\n alongside(batch, ref.firestore)\n return batch.commit()\n }\n if (shouldSet) return setDocCb(data as Partial<T>, options)\n return updateDocCb(data as UpdateData<T>)\n },\n [ref, updateDocCb, setDocCb],\n )\n}\n\n\nexport type UseModifyDocCallback<T> = typeof useModifyDocCallback<T>\n\nexport default useModifyDocCallback\n"],"names":["HOST_UNPERSISTED_FIELDS","ORG_UNPERSISTED_FIELDS","serverTimestamp","setDoc","updateDoc","writeBatch","useCallback","stampUpdatedAt","data","updatedAt","unpersistedFields","getUnpersistedFields","host","org","Object","freeze","keys","filter","key","dropUnpersistedFields","some","rest","typedUpdateDoc","useUpdateDocCallback","ref","useSetDocCallback","options","useModifyDocCallback","updateDocCb","setDocCb","shouldSet","alongside","_flag","setOptions","batch","firestore","payload","set","update","commit"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,uBAAuB,EAAEC,sBAAsB,QAAQ,eAAc;AAC9E,SAIEC,eAAe,EACfC,MAAM,EAGNC,SAAS,EAETC,UAAU,QACL,qBAAoB;AAC3B,SAASC,WAAW,QAAQ,QAAO;AAEnC;;;;CAIC,GACD,SAASC,eAAiCC,IAAO;IAC/C,OAAO;QAAEC,WAAWP;OAAsBM;AAC5C;AAEA;;;;;;;;CAQC,GACD;;;;;;CAMC,GACD,IAAIE;AAEJ,SAASC;IACP,IAAID,mBAAmB,OAAOA;IAC9B,MAAME,OAAOZ,kCAAAA,0BAA2B,CAAC;IACzC,MAAMa,MAAMZ,iCAAAA,yBAA0B,CAAC;IACvCS,oBAAoBI,OAAOC,MAAM,CAC/BD,OAAOE,IAAI,CAACJ,MAAMK,MAAM,CAAC,CAACC,MAAQA,OAAOL;IAE3C,OAAOH;AACT;AAEA;;;;;;;;;;;;;;CAcC,GACD,SAASS,sBAAwCX,IAAO;IACtD,MAAMQ,OAAOL;IACb,IAAI,CAACK,KAAKI,IAAI,CAAC,CAACF,MAAQA,OAAOV,OAAO,OAAOA;IAC7C,MAAMa,OAAO,aAAKb;IAClB,KAAK,MAAMU,OAAOF,KAAM,OAAOK,IAAI,CAACH,IAAI;IACxC,OAAOG;AACT;AAwBA,mEAAmE;AACnE,2EAA2E;AAC3E,uEAAuE;AACvE,sEAAsE;AACtE,sEAAsE;AACtE,MAAMC,iBAAiBlB;AAKvB,OAAO,SAASmB,qBACdC,GAAyB;IAEzB,OAAOlB,YACL,CAACE,OACCc,eACEE,KACAjB,eAAeY,sBAAsBX,SAEzC;QAACgB;KAAI;AAET;AAEA,OAAO,SAASC,kBACdD,GAAyB;IAEzB,OAAOlB,YACL,CAACE,MAAkBkB,UACjBvB,OACEqB,KACAjB,eAAeY,sBAAsBX,QACrCkB,kBAAAA,UAAW,CAAC,IAEhB;QAACF;KAAI;AAET;AAEA,OAAO,SAASG,qBACdH,GAAyB;IAEzB,MAAMI,cAAcL,qBAAqBC;IACzC,MAAMK,WAAWJ,kBAAkBD;IACnC,OAAOlB,YACL,CAACE,MAAkCkB;QACjC,qEAAqE;QACrE,iEAAiE;QACjE,qEAAqE;QACrE,kEAAkE;QAClE,EAAE;QACF,sEAAsE;QACtE,qEAAqE;QACrE,uDAAuD;QACvD,MAAMI,YACJJ,CAAAA,2BAAAA,QAASI,SAAS,KACjBJ,WAAW,WAAWA,WACtBA,WAAW,iBAAiBA;QAC/B,IAAIA,2BAAAA,QAASK,SAAS,EAAE;YACtB,iEAAiE;YACjE,MAAM,EAAEA,SAAS,EAAED,WAAWE,KAAK,EAAiB,GAAGN,SAAfO,8CAAeP;;;;YACvD,KAAKM;YACL,MAAME,QAAQ7B,WAAWmB,IAAIW,SAAS;YACtC,MAAMC,UAAU7B,eAAeY,sBAAsBX;YACrD,oEAAoE;YACpE,mEAAmE;YACnE,0DAA0D;YAC1D,IAAIsB,WAAWI,MAAMG,GAAG,CAACb,KAAKY,SAAuBH;iBAEhDC,MAAMI,MAAM,CAACd,KAA0BY;YAC5CL,UAAUG,OAAOV,IAAIW,SAAS;YAC9B,OAAOD,MAAMK,MAAM;QACrB;QACA,IAAIT,WAAW,OAAOD,SAASrB,MAAoBkB;QACnD,OAAOE,YAAYpB;IACrB,GACA;QAACgB;QAAKI;QAAaC;KAAS;AAEhC;AAKA,eAAeF,qBAAoB"}
1
+ {"version":3,"sources":["../../../../../../../../../libs/tenant/feature/instance/src/lib/hooks/helpers/use-modify-doc-callback.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { HOST_UNPERSISTED_FIELDS, ORG_UNPERSISTED_FIELDS } from '@aglyn/aglyn'\nimport {\n type DocumentData,\n type DocumentReference,\n type Firestore,\n serverTimestamp,\n setDoc,\n type SetOptions,\n type UpdateData,\n updateDoc,\n type WriteBatch,\n writeBatch,\n} from 'firebase/firestore'\nimport { useCallback } from 'react'\nimport { clientEditActorForPath } from './content-write-actor'\n\n/**\n * Every UI write stamps `updatedAt` (AGL-455) — the \"last updated\" columns\n * read it, and callers historically forgot it. Spread order lets a caller's\n * explicit `updatedAt` win (backfills, imports).\n */\nfunction stampUpdatedAt<D extends object>(data: D): D {\n return { updatedAt: serverTimestamp(), ...data }\n}\n\n/**\n * `stampUpdatedAt` plus the writer, on the documents that record one: a\n * screen, layout or component and their versions and drafts carry\n * `updatedBy`/`updatedVia` (see `content-write-stamp`), and the rules refuse\n * a write to them that leaves it out. Written after the caller's fields, so a\n * payload cannot name somebody else.\n */\nfunction stampWrite<D extends object>(ref: DocumentReference<unknown>, data: D): D {\n return { ...stampUpdatedAt(data), ...clientEditActorForPath(ref.firestore, ref.path) }\n}\n\n/**\n * Keys that are never document fields, taken from where that is written down\n * (AGL-1429). `HOST_UNPERSISTED_FIELDS` and `ORG_UNPERSISTED_FIELDS` each\n * declare the synthetic `$id` the readers attach; the INTERSECTION is used\n * deliberately, so this generic boundary only ever strips a key that every\n * declaration agrees is unpersisted. A key added to one map alone is not\n * silently stripped from the other collection's writes — the spec's drift\n * assertion fires instead, and someone decides.\n */\n/*\n * Resolved on first use, not at module scope. Computing it eagerly made this\n * module — and therefore every consumer of the write callbacks — fail to LOAD\n * in any suite that mocks the `@aglyn/aglyn` barrel without re-exporting both\n * maps, which two console specs do. A write-boundary guard that cannot be\n * imported is worse than the leak it prevents.\n */\nlet unpersistedFields: readonly string[] | undefined\n\nfunction getUnpersistedFields(): readonly string[] {\n if (unpersistedFields) return unpersistedFields\n const host = HOST_UNPERSISTED_FIELDS ?? {}\n const org = ORG_UNPERSISTED_FIELDS ?? {}\n unpersistedFields = Object.freeze(\n Object.keys(host).filter((key) => key in org),\n )\n return unpersistedFields\n}\n\n/**\n * Drop the reader-injected keys before the payload leaves for Firestore.\n *\n * This has to happen here rather than in the refs' converters, which is where\n * it used to live alone (`503f197ca` added the `$id` strip to `useHostRef`'s\n * `toFirestore`). `updateDoc` never applies a converter — `setDoc` calls\n * `applyFirestoreDataConverter` and `updateDoc` does not — so a converter\n * strip is a guarantee about ONE of the two SDK calls, and which one a write\n * gets is decided by whether its caller happened to pass `merge`. That is how\n * `hosts/-MtN17_cpfPPLwWjE6z4` came to hold a persisted `$id` (AGL-1423).\n *\n * Only exact top-level keys are removed. Dotted `updateDoc` paths address\n * nested maps, and besigner node maps legitimately store a `$id` per node —\n * matching those would be the same over-broad scan AGL-1423 warned about.\n */\nfunction dropUnpersistedFields<D extends object>(data: D): D {\n const keys = getUnpersistedFields()\n if (!keys.some((key) => key in data)) return data\n const rest = { ...data } as Record<string, unknown>\n for (const key of keys) delete rest[key]\n return rest as D\n}\n\n\nexport type UpdateDocCallback<T> = (data: UpdateData<T>) => Promise<void>\nexport type SetDocCallback<T> = (\n data: Partial<T>,\n options?: SetOptions,\n) => Promise<void>\nexport type ModifyDocOptions = SetOptions & {\n shouldSet?: boolean\n /**\n * Other writes that must land in the SAME commit as this one, or not at\n * all. Given, the write goes through a batch — the same stamp, strip and\n * converter as without it — with whatever this stages beside it. The\n * console uses it to write a site-wide cache drop down durably next to a\n * settings save (AGL-3386).\n */\n alongside?: (batch: WriteBatch, firestore: Firestore) => void\n}\nexport type ModifyDocCallback<T> = (\n data: UpdateData<T> | Partial<T>,\n options?: ModifyDocOptions,\n) => Promise<void>\n\n// `updateDoc`'s overload resolution keys off `DocumentReference`'s\n// `DbModelType` param, which defaults to the generic `DocumentData` when a\n// caller only supplies `AppModelType` (as every hook here does) — that\n// makes TS widen `UpdateData<T>` for unconstrained `T` and reject the\n// match. Pin the call to the single-overload signature actually used.\nconst typedUpdateDoc = updateDoc as <T>(\n ref: DocumentReference<T>,\n data: UpdateData<T>,\n) => Promise<void>\n\nexport function useUpdateDocCallback<T>(\n ref: DocumentReference<T>,\n): UpdateDocCallback<T> {\n return useCallback(\n (data: UpdateData<T>) =>\n typedUpdateDoc(\n ref,\n stampWrite(ref, dropUnpersistedFields(data as object)) as UpdateData<T>,\n ),\n [ref],\n )\n}\n\nexport function useSetDocCallback<T>(\n ref: DocumentReference<T>,\n): SetDocCallback<T> {\n return useCallback(\n (data: Partial<T>, options?: SetOptions) =>\n setDoc(\n ref,\n stampWrite(ref, dropUnpersistedFields(data as object)) as Partial<T>,\n options ?? {},\n ),\n [ref],\n )\n}\n\nexport function useModifyDocCallback<T>(\n ref: DocumentReference<T>,\n): ModifyDocCallback<T> {\n const updateDocCb = useUpdateDocCallback(ref)\n const setDocCb = useSetDocCallback(ref)\n return useCallback(\n (data: UpdateData<T> | Partial<T>, options?: ModifyDocOptions) => {\n // SetOptions semantics (merge/mergeFields) require setDoc: updateDoc\n // ignores them and, critically, bypasses the ref's withConverter\n // serialization (e.g. screen-version node compression) — and with it\n // EVERY strip the converter performs, including `$id` (AGL-1429).\n //\n // Nothing downstream of this line may therefore be relied on to clean\n // a payload. Anything that must hold for both branches belongs above\n // it, which is where `dropUnpersistedFields` now runs.\n const shouldSet =\n options?.shouldSet ||\n (options && 'merge' in options) ||\n (options && 'mergeFields' in options)\n if (options?.alongside) {\n // `shouldSet` is this hook's own flag, never a Firestore option.\n const { alongside, shouldSet: _flag, ...setOptions } = options\n void _flag\n const batch = writeBatch(ref.firestore)\n const payload = stampWrite(ref, dropUnpersistedFields(data as object))\n // `batch.set` applies the ref's converter exactly as `setDoc` does,\n // and `batch.update` skips it exactly as `updateDoc` does — so the\n // batched write stores what the unbatched one would have.\n if (shouldSet) batch.set(ref, payload as Partial<T>, setOptions)\n // Pinned to the untyped overload for the reason `typedUpdateDoc` is.\n else batch.update(ref as DocumentReference, payload as UpdateData<DocumentData>)\n alongside(batch, ref.firestore)\n return batch.commit()\n }\n if (shouldSet) return setDocCb(data as Partial<T>, options)\n return updateDocCb(data as UpdateData<T>)\n },\n [ref, updateDocCb, setDocCb],\n )\n}\n\n\nexport type UseModifyDocCallback<T> = typeof useModifyDocCallback<T>\n\nexport default useModifyDocCallback\n"],"names":["HOST_UNPERSISTED_FIELDS","ORG_UNPERSISTED_FIELDS","serverTimestamp","setDoc","updateDoc","writeBatch","useCallback","clientEditActorForPath","stampUpdatedAt","data","updatedAt","stampWrite","ref","firestore","path","unpersistedFields","getUnpersistedFields","host","org","Object","freeze","keys","filter","key","dropUnpersistedFields","some","rest","typedUpdateDoc","useUpdateDocCallback","useSetDocCallback","options","useModifyDocCallback","updateDocCb","setDocCb","shouldSet","alongside","_flag","setOptions","batch","payload","set","update","commit"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,uBAAuB,EAAEC,sBAAsB,QAAQ,eAAc;AAC9E,SAIEC,eAAe,EACfC,MAAM,EAGNC,SAAS,EAETC,UAAU,QACL,qBAAoB;AAC3B,SAASC,WAAW,QAAQ,QAAO;AACnC,SAASC,sBAAsB,QAAQ,2BAAuB;AAE9D;;;;CAIC,GACD,SAASC,eAAiCC,IAAO;IAC/C,OAAO;QAAEC,WAAWR;OAAsBO;AAC5C;AAEA;;;;;;CAMC,GACD,SAASE,WAA6BC,GAA+B,EAAEH,IAAO;IAC5E,OAAO,aAAKD,eAAeC,OAAUF,uBAAuBK,IAAIC,SAAS,EAAED,IAAIE,IAAI;AACrF;AAEA;;;;;;;;CAQC,GACD;;;;;;CAMC,GACD,IAAIC;AAEJ,SAASC;IACP,IAAID,mBAAmB,OAAOA;IAC9B,MAAME,OAAOjB,kCAAAA,0BAA2B,CAAC;IACzC,MAAMkB,MAAMjB,iCAAAA,yBAA0B,CAAC;IACvCc,oBAAoBI,OAAOC,MAAM,CAC/BD,OAAOE,IAAI,CAACJ,MAAMK,MAAM,CAAC,CAACC,MAAQA,OAAOL;IAE3C,OAAOH;AACT;AAEA;;;;;;;;;;;;;;CAcC,GACD,SAASS,sBAAwCf,IAAO;IACtD,MAAMY,OAAOL;IACb,IAAI,CAACK,KAAKI,IAAI,CAAC,CAACF,MAAQA,OAAOd,OAAO,OAAOA;IAC7C,MAAMiB,OAAO,aAAKjB;IAClB,KAAK,MAAMc,OAAOF,KAAM,OAAOK,IAAI,CAACH,IAAI;IACxC,OAAOG;AACT;AAwBA,mEAAmE;AACnE,2EAA2E;AAC3E,uEAAuE;AACvE,sEAAsE;AACtE,sEAAsE;AACtE,MAAMC,iBAAiBvB;AAKvB,OAAO,SAASwB,qBACdhB,GAAyB;IAEzB,OAAON,YACL,CAACG,OACCkB,eACEf,KACAD,WAAWC,KAAKY,sBAAsBf,SAE1C;QAACG;KAAI;AAET;AAEA,OAAO,SAASiB,kBACdjB,GAAyB;IAEzB,OAAON,YACL,CAACG,MAAkBqB,UACjB3B,OACES,KACAD,WAAWC,KAAKY,sBAAsBf,QACtCqB,kBAAAA,UAAW,CAAC,IAEhB;QAAClB;KAAI;AAET;AAEA,OAAO,SAASmB,qBACdnB,GAAyB;IAEzB,MAAMoB,cAAcJ,qBAAqBhB;IACzC,MAAMqB,WAAWJ,kBAAkBjB;IACnC,OAAON,YACL,CAACG,MAAkCqB;QACjC,qEAAqE;QACrE,iEAAiE;QACjE,qEAAqE;QACrE,kEAAkE;QAClE,EAAE;QACF,sEAAsE;QACtE,qEAAqE;QACrE,uDAAuD;QACvD,MAAMI,YACJJ,CAAAA,2BAAAA,QAASI,SAAS,KACjBJ,WAAW,WAAWA,WACtBA,WAAW,iBAAiBA;QAC/B,IAAIA,2BAAAA,QAASK,SAAS,EAAE;YACtB,iEAAiE;YACjE,MAAM,EAAEA,SAAS,EAAED,WAAWE,KAAK,EAAiB,GAAGN,SAAfO,8CAAeP;;;;YACvD,KAAKM;YACL,MAAME,QAAQjC,WAAWO,IAAIC,SAAS;YACtC,MAAM0B,UAAU5B,WAAWC,KAAKY,sBAAsBf;YACtD,oEAAoE;YACpE,mEAAmE;YACnE,0DAA0D;YAC1D,IAAIyB,WAAWI,MAAME,GAAG,CAAC5B,KAAK2B,SAAuBF;iBAEhDC,MAAMG,MAAM,CAAC7B,KAA0B2B;YAC5CJ,UAAUG,OAAO1B,IAAIC,SAAS;YAC9B,OAAOyB,MAAMI,MAAM;QACrB;QACA,IAAIR,WAAW,OAAOD,SAASxB,MAAoBqB;QACnD,OAAOE,YAAYvB;IACrB,GACA;QAACG;QAAKoB;QAAaC;KAAS;AAEhC;AAKA,eAAeF,qBAAoB"}
@@ -30,6 +30,12 @@ export declare const useLayoutRef: ({ hostId, layoutId, }: {
30
30
  description?: string;
31
31
  layoutId?: Aglyn.LayoutUid;
32
32
  createdAt?: import("@aglyn/shared-util-timestamp").ITimestamp;
33
+ lastPublishedAt?: import("@aglyn/shared-util-timestamp").ITimestamp;
34
+ createdBy?: string;
35
+ updatedBy?: string;
36
+ updatedVia?: string | null;
37
+ publishedBy?: string;
38
+ publishedVia?: string | null;
33
39
  }>;
34
40
  export declare const useLayout: (data: {
35
41
  hostId: Aglyn.HostUid;
@@ -57,6 +57,12 @@ export declare const useScreenRef: ({ hostId, screenId }: {
57
57
  };
58
58
  visibility?: Aglyn.HostScreenVisibility;
59
59
  layoutId?: Aglyn.LayoutUid;
60
+ lastPublishedAt?: import("@aglyn/shared-util-timestamp").ITimestamp;
61
+ createdBy?: string;
62
+ updatedBy?: string;
63
+ updatedVia?: string | null;
64
+ publishedBy?: string;
65
+ publishedVia?: string | null;
60
66
  }>;
61
67
  export declare const useScreen: (data: {
62
68
  hostId: Aglyn.HostUid;
@@ -28,6 +28,7 @@ export * from './hooks/helpers/use-doc';
28
28
  export * from './hooks/helpers/use-modify-doc-callback';
29
29
  export * from './hooks/helpers/besigner-nodes-converter';
30
30
  export * from './hooks/helpers/guarded-nodes-save';
31
+ export * from './hooks/helpers/content-write-actor';
31
32
  export * from './hooks/helpers/guarded-seed-write';
32
33
  export * from './hooks/use-seed-edits';
33
34
  export * from './hooks/firestore-denial-reporter';
package/src/lib/tenant.js CHANGED
@@ -27,6 +27,7 @@ export * from "./hooks/helpers/use-doc.js";
27
27
  export * from "./hooks/helpers/use-modify-doc-callback.js";
28
28
  export * from "./hooks/helpers/besigner-nodes-converter.js";
29
29
  export * from "./hooks/helpers/guarded-nodes-save.js";
30
+ export * from "./hooks/helpers/content-write-actor.js";
30
31
  export * from "./hooks/helpers/guarded-seed-write.js";
31
32
  export * from "./hooks/use-seed-edits.js";
32
33
  export * from "./hooks/firestore-denial-reporter.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/tenant/feature/instance/src/lib/tenant.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './constants/mock-data'\nexport * from './constants/site-paths'\nexport * from './constants/firebase-config'\nexport * from './constants/firebase-emulator-hosts'\n\nexport * from './hooks/firebase/app-check-recaptcha-container'\nexport * from './hooks/firebase/auth-persistence'\nexport * from './hooks/firebase/firebase-services'\nexport * from './hooks/firebase/firestore-cache'\nexport * from './hooks/firebase/firestore-stall-recovery'\nexport * from './hooks/firebase/firestore-bounded-read'\nexport * from './hooks/helpers/use-doc'\nexport * from './hooks/helpers/use-modify-doc-callback'\nexport * from './hooks/helpers/besigner-nodes-converter'\nexport * from './hooks/helpers/guarded-nodes-save'\nexport * from './hooks/helpers/guarded-seed-write'\nexport * from './hooks/use-seed-edits'\n\nexport * from './hooks/firestore-denial-reporter'\nexport * from './hooks/use-firestore-collection'\nexport * from './hooks/use-paged-collection'\nexport * from './hooks/use-sorted-paged-collection'\nexport * from './hooks/sorted-collection-window'\nexport * from './hooks/host-collection-queries'\nexport * from './hooks/list-filter-constraints'\nexport * from './hooks/use-firestore-doc'\nexport * from './hooks/use-switcher-collection'\nexport * from './hooks/use-host-activity-logger'\nexport * from './hooks/use-live-artifact-count'\nexport * from './hooks/use-component'\nexport * from './hooks/use-component-version'\nexport * from './hooks/use-host-document-version'\nexport * from './hooks/use-host-template'\nexport * from './hooks/use-console-host-route'\nexport * from './hooks/use-host-org-id'\nexport * from './hooks/use-container-options'\nexport * from './hooks/use-org-member-options'\nexport * from './hooks/use-org-plan'\nexport * from './hooks/use-merchant-payments'\nexport * from './hooks/plan-feature-lock'\nexport * from './hooks/use-plan-feature'\nexport * from './hooks/use-scope-tokens'\nexport * from './hooks/use-host-resource-api'\nexport * from './hooks/use-host-version-api'\nexport * from './hooks/use-duplicate-resource-api'\nexport * from './hooks/use-plugin-api-post'\nexport * from './components/duplicate-resource-dialog'\nexport * from './hooks/use-plugin-config'\nexport * from './hooks/use-host'\nexport * from './hooks/use-layout'\nexport * from './hooks/use-layout-version'\nexport * from './hooks/use-screen'\nexport * from './hooks/use-screen-version'\nexport * from './hooks/use-user-name'\nexport * from './hooks/use-user-photo'\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,cAAc,2BAAuB;AACrC,cAAc,4BAAwB;AACtC,cAAc,iCAA6B;AAC3C,cAAc,yCAAqC;AAEnD,cAAc,oDAAgD;AAC9D,cAAc,uCAAmC;AACjD,cAAc,wCAAoC;AAClD,cAAc,sCAAkC;AAChD,cAAc,+CAA2C;AACzD,cAAc,6CAAyC;AACvD,cAAc,6BAAyB;AACvC,cAAc,6CAAyC;AACvD,cAAc,8CAA0C;AACxD,cAAc,wCAAoC;AAClD,cAAc,wCAAoC;AAClD,cAAc,4BAAwB;AAEtC,cAAc,uCAAmC;AACjD,cAAc,sCAAkC;AAChD,cAAc,kCAA8B;AAC5C,cAAc,yCAAqC;AACnD,cAAc,sCAAkC;AAChD,cAAc,qCAAiC;AAC/C,cAAc,qCAAiC;AAC/C,cAAc,+BAA2B;AACzC,cAAc,qCAAiC;AAC/C,cAAc,sCAAkC;AAChD,cAAc,qCAAiC;AAC/C,cAAc,2BAAuB;AACrC,cAAc,mCAA+B;AAC7C,cAAc,uCAAmC;AACjD,cAAc,+BAA2B;AACzC,cAAc,oCAAgC;AAC9C,cAAc,6BAAyB;AACvC,cAAc,mCAA+B;AAC7C,cAAc,oCAAgC;AAC9C,cAAc,0BAAsB;AACpC,cAAc,mCAA+B;AAC7C,cAAc,+BAA2B;AACzC,cAAc,8BAA0B;AACxC,cAAc,8BAA0B;AACxC,cAAc,mCAA+B;AAC7C,cAAc,kCAA8B;AAC5C,cAAc,wCAAoC;AAClD,cAAc,iCAA6B;AAC3C,cAAc,4CAAwC;AACtD,cAAc,+BAA2B;AACzC,cAAc,sBAAkB;AAChC,cAAc,wBAAoB;AAClC,cAAc,gCAA4B;AAC1C,cAAc,wBAAoB;AAClC,cAAc,gCAA4B;AAC1C,cAAc,2BAAuB;AACrC,cAAc,4BAAwB"}
1
+ {"version":3,"sources":["../../../../../../../libs/tenant/feature/instance/src/lib/tenant.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './constants/mock-data'\nexport * from './constants/site-paths'\nexport * from './constants/firebase-config'\nexport * from './constants/firebase-emulator-hosts'\n\nexport * from './hooks/firebase/app-check-recaptcha-container'\nexport * from './hooks/firebase/auth-persistence'\nexport * from './hooks/firebase/firebase-services'\nexport * from './hooks/firebase/firestore-cache'\nexport * from './hooks/firebase/firestore-stall-recovery'\nexport * from './hooks/firebase/firestore-bounded-read'\nexport * from './hooks/helpers/use-doc'\nexport * from './hooks/helpers/use-modify-doc-callback'\nexport * from './hooks/helpers/besigner-nodes-converter'\nexport * from './hooks/helpers/guarded-nodes-save'\nexport * from './hooks/helpers/content-write-actor'\nexport * from './hooks/helpers/guarded-seed-write'\nexport * from './hooks/use-seed-edits'\n\nexport * from './hooks/firestore-denial-reporter'\nexport * from './hooks/use-firestore-collection'\nexport * from './hooks/use-paged-collection'\nexport * from './hooks/use-sorted-paged-collection'\nexport * from './hooks/sorted-collection-window'\nexport * from './hooks/host-collection-queries'\nexport * from './hooks/list-filter-constraints'\nexport * from './hooks/use-firestore-doc'\nexport * from './hooks/use-switcher-collection'\nexport * from './hooks/use-host-activity-logger'\nexport * from './hooks/use-live-artifact-count'\nexport * from './hooks/use-component'\nexport * from './hooks/use-component-version'\nexport * from './hooks/use-host-document-version'\nexport * from './hooks/use-host-template'\nexport * from './hooks/use-console-host-route'\nexport * from './hooks/use-host-org-id'\nexport * from './hooks/use-container-options'\nexport * from './hooks/use-org-member-options'\nexport * from './hooks/use-org-plan'\nexport * from './hooks/use-merchant-payments'\nexport * from './hooks/plan-feature-lock'\nexport * from './hooks/use-plan-feature'\nexport * from './hooks/use-scope-tokens'\nexport * from './hooks/use-host-resource-api'\nexport * from './hooks/use-host-version-api'\nexport * from './hooks/use-duplicate-resource-api'\nexport * from './hooks/use-plugin-api-post'\nexport * from './components/duplicate-resource-dialog'\nexport * from './hooks/use-plugin-config'\nexport * from './hooks/use-host'\nexport * from './hooks/use-layout'\nexport * from './hooks/use-layout-version'\nexport * from './hooks/use-screen'\nexport * from './hooks/use-screen-version'\nexport * from './hooks/use-user-name'\nexport * from './hooks/use-user-photo'\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,cAAc,2BAAuB;AACrC,cAAc,4BAAwB;AACtC,cAAc,iCAA6B;AAC3C,cAAc,yCAAqC;AAEnD,cAAc,oDAAgD;AAC9D,cAAc,uCAAmC;AACjD,cAAc,wCAAoC;AAClD,cAAc,sCAAkC;AAChD,cAAc,+CAA2C;AACzD,cAAc,6CAAyC;AACvD,cAAc,6BAAyB;AACvC,cAAc,6CAAyC;AACvD,cAAc,8CAA0C;AACxD,cAAc,wCAAoC;AAClD,cAAc,yCAAqC;AACnD,cAAc,wCAAoC;AAClD,cAAc,4BAAwB;AAEtC,cAAc,uCAAmC;AACjD,cAAc,sCAAkC;AAChD,cAAc,kCAA8B;AAC5C,cAAc,yCAAqC;AACnD,cAAc,sCAAkC;AAChD,cAAc,qCAAiC;AAC/C,cAAc,qCAAiC;AAC/C,cAAc,+BAA2B;AACzC,cAAc,qCAAiC;AAC/C,cAAc,sCAAkC;AAChD,cAAc,qCAAiC;AAC/C,cAAc,2BAAuB;AACrC,cAAc,mCAA+B;AAC7C,cAAc,uCAAmC;AACjD,cAAc,+BAA2B;AACzC,cAAc,oCAAgC;AAC9C,cAAc,6BAAyB;AACvC,cAAc,mCAA+B;AAC7C,cAAc,oCAAgC;AAC9C,cAAc,0BAAsB;AACpC,cAAc,mCAA+B;AAC7C,cAAc,+BAA2B;AACzC,cAAc,8BAA0B;AACxC,cAAc,8BAA0B;AACxC,cAAc,mCAA+B;AAC7C,cAAc,kCAA8B;AAC5C,cAAc,wCAAoC;AAClD,cAAc,iCAA6B;AAC3C,cAAc,4CAAwC;AACtD,cAAc,+BAA2B;AACzC,cAAc,sBAAkB;AAChC,cAAc,wBAAoB;AAClC,cAAc,gCAA4B;AAC1C,cAAc,wBAAoB;AAClC,cAAc,gCAA4B;AAC1C,cAAc,2BAAuB;AACrC,cAAc,4BAAwB"}