@aglyn/aglyn 1.20.2 → 1.20.3

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.
@@ -24,6 +24,12 @@ export interface EditorConnectionVariable {
24
24
  label: string;
25
25
  /** The value the last sync wrote, as the published page would print it, or `null` before one. */
26
26
  value: string | null;
27
+ /**
28
+ * Whether the connection has synced at all, so an empty `value` reads as
29
+ * "the service has nothing there" rather than "not synced yet" (a Google
30
+ * profile with no reviews has no rating). Absent from an older provider.
31
+ */
32
+ synced?: boolean;
27
33
  }
28
34
  /**
29
35
  * One declared connection an element can repeat over (AGL-4212): what the
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/plugin-connection-editor.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 { createContext } from 'react'\nimport type { PluginConnectionRecordsPageData, PluginConnectionSiteRecord } from './plugin-connection-records'\nimport type { PluginConnectionFieldTypes } from './plugin-connection-repeat'\n\n/*\n * DECLARED CONNECTIONS IN THE EDITOR (AGL-4196).\n *\n * A published page hands each signed element its connection's record with\n * the page (`plugin-connection-records.ts`), and binds each record's summary\n * fields as `{{var:<listingId>__<connectionId>-<field>}}`. The Besigner and\n * Preview render in the console, where there is no page render to ride, so\n * the plugin that runs the connections (the marketplace) provides THIS\n * context to every editor surface instead: which listing a component id's\n * namespace belongs to, each listing's records, and the variables the\n * records give the site. The surfaces turn it into the same\n * `PluginConnectionRecordsContext` value the published page provides, so an\n * element reads its record through the same hook, and the binding picker\n * lists the variables by name.\n *\n * Core declares the seam and never names the plugin that fills it. Absent,\n * every element reads `null` and the picker lists nothing extra: the same\n * answer as a site that has not connected.\n */\n\n/** One `{{var:…}}` a connection's record gives the site, as the binding picker lists it. */\nexport interface EditorConnectionVariable {\n /** The variable id (`pluginConnectionVariableId`): what the token carries. */\n id: string\n /** What a person reads: the connection's label and the field's name, never the id. */\n label: string\n /** The value the last sync wrote, as the published page would print it, or `null` before one. */\n value: string | null\n}\n\n/**\n * One declared connection an element can repeat over (AGL-4212): what the\n * Attributes panel's picker lists, what a `repeatConnection` value's\n * identity resolves to, and the fields its `{{item.*}}` tokens can name.\n */\nexport interface EditorConnectionRepeatable {\n /** `<publisher handle>.<manifest id>`: what a `repeatConnection` value names. */\n identity: string\n listingId: string\n connectionId: string\n /** The connection's own label, as the site's connections card shows it. */\n label: string\n /** The declared type of each summary field and each item field. */\n types: PluginConnectionFieldTypes\n}\n\n/** What the editor knows of the site's declared connections. */\nexport interface EditorPluginConnections {\n /** The listing whose namespace `componentId` is in (`<identity>.<role>`), or `null`. */\n listingFor(componentId: string): string | null\n /** Listing id → connection id → the record its last sync wrote. */\n records: Readonly<Record<string, Readonly<Record<string, PluginConnectionSiteRecord>>>>\n /** Every summary field of every declared connection, as site variables. */\n variables: readonly EditorConnectionVariable[]\n /**\n * Every declared connection of a namespaced install that writes a record,\n * for a repeat over it (AGL-4212). Absent from a provider that predates it,\n * which offers no such repeat.\n */\n repeatables?: readonly EditorConnectionRepeatable[]\n}\n\nexport const EditorPluginConnectionsContext = createContext<EditorPluginConnections | undefined>(undefined)\nEditorPluginConnectionsContext.displayName = 'EditorPluginConnectionsContext'\n\n/** An editor node, as far as attributing it to a listing needs. */\nexport interface EditorConnectionNode {\n $id?: unknown\n componentId?: unknown\n}\n\n/**\n * The `PluginConnectionRecordsContext` value for `nodes` (a page's, or one\n * element's), attributed the way the published page's enricher attributes\n * them: a node whose component id is in a listing's namespace, and only when\n * that listing holds a record. `undefined` when none is.\n */\nexport function editorConnectionRecordsPageData(\n connections: EditorPluginConnections | undefined,\n nodes: Iterable<EditorConnectionNode | null | undefined>,\n): PluginConnectionRecordsPageData | undefined {\n if (!connections) return undefined\n const attributed: Record<string, string> = {}\n const records: PluginConnectionRecordsPageData['records'] = {}\n for (const node of nodes) {\n const nodeId = node?.$id\n const componentId = node?.componentId\n if (typeof nodeId !== 'string' || !nodeId || typeof componentId !== 'string' || !componentId.includes('.')) continue\n const listingId = connections.listingFor(componentId)\n if (!listingId) continue\n const held = connections.records[listingId]\n if (!held || !Object.keys(held).length) continue\n attributed[nodeId] = listingId\n records[listingId] = { ...held }\n }\n return Object.keys(attributed).length ? { nodes: attributed, records } : undefined\n}\n"],"names":["createContext","EditorPluginConnectionsContext","undefined","displayName","editorConnectionRecordsPageData","connections","nodes","attributed","records","node","nodeId","$id","componentId","includes","listingId","listingFor","held","Object","keys","length"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,aAAa,QAAQ,QAAO;AAkErC,OAAO,MAAMC,iCAAiCD,cAAmDE,WAAU;AAC3GD,+BAA+BE,WAAW,GAAG;AAQ7C;;;;;CAKC,GACD,OAAO,SAASC,gCACdC,WAAgD,EAChDC,KAAwD;IAExD,IAAI,CAACD,aAAa,OAAOH;IACzB,MAAMK,aAAqC,CAAC;IAC5C,MAAMC,UAAsD,CAAC;IAC7D,KAAK,MAAMC,QAAQH,MAAO;QACxB,MAAMI,SAASD,wBAAAA,KAAME,GAAG;QACxB,MAAMC,cAAcH,wBAAAA,KAAMG,WAAW;QACrC,IAAI,OAAOF,WAAW,YAAY,CAACA,UAAU,OAAOE,gBAAgB,YAAY,CAACA,YAAYC,QAAQ,CAAC,MAAM;QAC5G,MAAMC,YAAYT,YAAYU,UAAU,CAACH;QACzC,IAAI,CAACE,WAAW;QAChB,MAAME,OAAOX,YAAYG,OAAO,CAACM,UAAU;QAC3C,IAAI,CAACE,QAAQ,CAACC,OAAOC,IAAI,CAACF,MAAMG,MAAM,EAAE;QACxCZ,UAAU,CAACG,OAAO,GAAGI;QACrBN,OAAO,CAACM,UAAU,GAAG,aAAKE;IAC5B;IACA,OAAOC,OAAOC,IAAI,CAACX,YAAYY,MAAM,GAAG;QAAEb,OAAOC;QAAYC;IAAQ,IAAIN;AAC3E"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/plugin-connection-editor.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 { createContext } from 'react'\nimport type { PluginConnectionRecordsPageData, PluginConnectionSiteRecord } from './plugin-connection-records'\nimport type { PluginConnectionFieldTypes } from './plugin-connection-repeat'\n\n/*\n * DECLARED CONNECTIONS IN THE EDITOR (AGL-4196).\n *\n * A published page hands each signed element its connection's record with\n * the page (`plugin-connection-records.ts`), and binds each record's summary\n * fields as `{{var:<listingId>__<connectionId>-<field>}}`. The Besigner and\n * Preview render in the console, where there is no page render to ride, so\n * the plugin that runs the connections (the marketplace) provides THIS\n * context to every editor surface instead: which listing a component id's\n * namespace belongs to, each listing's records, and the variables the\n * records give the site. The surfaces turn it into the same\n * `PluginConnectionRecordsContext` value the published page provides, so an\n * element reads its record through the same hook, and the binding picker\n * lists the variables by name.\n *\n * Core declares the seam and never names the plugin that fills it. Absent,\n * every element reads `null` and the picker lists nothing extra: the same\n * answer as a site that has not connected.\n */\n\n/** One `{{var:…}}` a connection's record gives the site, as the binding picker lists it. */\nexport interface EditorConnectionVariable {\n /** The variable id (`pluginConnectionVariableId`): what the token carries. */\n id: string\n /** What a person reads: the connection's label and the field's name, never the id. */\n label: string\n /** The value the last sync wrote, as the published page would print it, or `null` before one. */\n value: string | null\n /**\n * Whether the connection has synced at all, so an empty `value` reads as\n * \"the service has nothing there\" rather than \"not synced yet\" (a Google\n * profile with no reviews has no rating). Absent from an older provider.\n */\n synced?: boolean\n}\n\n/**\n * One declared connection an element can repeat over (AGL-4212): what the\n * Attributes panel's picker lists, what a `repeatConnection` value's\n * identity resolves to, and the fields its `{{item.*}}` tokens can name.\n */\nexport interface EditorConnectionRepeatable {\n /** `<publisher handle>.<manifest id>`: what a `repeatConnection` value names. */\n identity: string\n listingId: string\n connectionId: string\n /** The connection's own label, as the site's connections card shows it. */\n label: string\n /** The declared type of each summary field and each item field. */\n types: PluginConnectionFieldTypes\n}\n\n/** What the editor knows of the site's declared connections. */\nexport interface EditorPluginConnections {\n /** The listing whose namespace `componentId` is in (`<identity>.<role>`), or `null`. */\n listingFor(componentId: string): string | null\n /** Listing id → connection id → the record its last sync wrote. */\n records: Readonly<Record<string, Readonly<Record<string, PluginConnectionSiteRecord>>>>\n /** Every summary field of every declared connection, as site variables. */\n variables: readonly EditorConnectionVariable[]\n /**\n * Every declared connection of a namespaced install that writes a record,\n * for a repeat over it (AGL-4212). Absent from a provider that predates it,\n * which offers no such repeat.\n */\n repeatables?: readonly EditorConnectionRepeatable[]\n}\n\nexport const EditorPluginConnectionsContext = createContext<EditorPluginConnections | undefined>(undefined)\nEditorPluginConnectionsContext.displayName = 'EditorPluginConnectionsContext'\n\n/** An editor node, as far as attributing it to a listing needs. */\nexport interface EditorConnectionNode {\n $id?: unknown\n componentId?: unknown\n}\n\n/**\n * The `PluginConnectionRecordsContext` value for `nodes` (a page's, or one\n * element's), attributed the way the published page's enricher attributes\n * them: a node whose component id is in a listing's namespace, and only when\n * that listing holds a record. `undefined` when none is.\n */\nexport function editorConnectionRecordsPageData(\n connections: EditorPluginConnections | undefined,\n nodes: Iterable<EditorConnectionNode | null | undefined>,\n): PluginConnectionRecordsPageData | undefined {\n if (!connections) return undefined\n const attributed: Record<string, string> = {}\n const records: PluginConnectionRecordsPageData['records'] = {}\n for (const node of nodes) {\n const nodeId = node?.$id\n const componentId = node?.componentId\n if (typeof nodeId !== 'string' || !nodeId || typeof componentId !== 'string' || !componentId.includes('.')) continue\n const listingId = connections.listingFor(componentId)\n if (!listingId) continue\n const held = connections.records[listingId]\n if (!held || !Object.keys(held).length) continue\n attributed[nodeId] = listingId\n records[listingId] = { ...held }\n }\n return Object.keys(attributed).length ? { nodes: attributed, records } : undefined\n}\n"],"names":["createContext","EditorPluginConnectionsContext","undefined","displayName","editorConnectionRecordsPageData","connections","nodes","attributed","records","node","nodeId","$id","componentId","includes","listingId","listingFor","held","Object","keys","length"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,aAAa,QAAQ,QAAO;AAwErC,OAAO,MAAMC,iCAAiCD,cAAmDE,WAAU;AAC3GD,+BAA+BE,WAAW,GAAG;AAQ7C;;;;;CAKC,GACD,OAAO,SAASC,gCACdC,WAAgD,EAChDC,KAAwD;IAExD,IAAI,CAACD,aAAa,OAAOH;IACzB,MAAMK,aAAqC,CAAC;IAC5C,MAAMC,UAAsD,CAAC;IAC7D,KAAK,MAAMC,QAAQH,MAAO;QACxB,MAAMI,SAASD,wBAAAA,KAAME,GAAG;QACxB,MAAMC,cAAcH,wBAAAA,KAAMG,WAAW;QACrC,IAAI,OAAOF,WAAW,YAAY,CAACA,UAAU,OAAOE,gBAAgB,YAAY,CAACA,YAAYC,QAAQ,CAAC,MAAM;QAC5G,MAAMC,YAAYT,YAAYU,UAAU,CAACH;QACzC,IAAI,CAACE,WAAW;QAChB,MAAME,OAAOX,YAAYG,OAAO,CAACM,UAAU;QAC3C,IAAI,CAACE,QAAQ,CAACC,OAAOC,IAAI,CAACF,MAAMG,MAAM,EAAE;QACxCZ,UAAU,CAACG,OAAO,GAAGI;QACrBN,OAAO,CAACM,UAAU,GAAG,aAAKE;IAC5B;IACA,OAAOC,OAAOC,IAAI,CAACX,YAAYY,MAAM,GAAG;QAAEb,OAAOC;QAAYC;IAAQ,IAAIN;AAC3E"}