@aglyn/aglyn 1.15.0 → 1.15.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.
- package/package.json +11 -11
- package/src/lib/app-utils/buy-now-pay-later.d.ts +45 -0
- package/src/lib/app-utils/buy-now-pay-later.js +68 -0
- package/src/lib/app-utils/buy-now-pay-later.js.map +1 -0
- package/src/lib/app-utils/contexts.d.ts +1 -0
- package/src/lib/app-utils/contexts.js +1 -0
- package/src/lib/app-utils/contexts.js.map +1 -1
- package/src/lib/app-utils/docs-help-sections.generated.js +2 -0
- package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
- package/src/lib/app-utils/docs-help.generated.d.ts +3 -3
- package/src/lib/app-utils/docs-help.generated.js +9 -0
- package/src/lib/app-utils/docs-help.generated.js.map +1 -1
- package/src/lib/app-utils/docs-index.generated.js +4 -4
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/plan-entitlements.d.ts +127 -75
- package/src/lib/app-utils/plan-entitlements.js +120 -77
- package/src/lib/app-utils/plan-entitlements.js.map +1 -1
- package/src/lib/app-utils/plugin-bundle-checks.d.ts +14 -2
- package/src/lib/app-utils/plugin-bundle-checks.js +82 -7
- package/src/lib/app-utils/plugin-bundle-checks.js.map +1 -1
- package/src/lib/app-utils/plugin-connection-editor.d.ts +48 -0
- package/src/lib/app-utils/plugin-connection-editor.js +46 -0
- package/src/lib/app-utils/plugin-connection-editor.js.map +1 -0
- package/src/lib/app-utils/plugin-connection-record.d.ts +42 -0
- package/src/lib/app-utils/plugin-connection-record.js +48 -0
- package/src/lib/app-utils/plugin-connection-record.js.map +1 -0
- package/src/lib/app-utils/plugin-connection-records-context.d.ts +23 -0
- package/src/lib/app-utils/plugin-connection-records-context.js +29 -0
- package/src/lib/app-utils/plugin-connection-records-context.js.map +1 -0
- package/src/lib/app-utils/plugin-connection-records.d.ts +42 -0
- package/src/lib/app-utils/plugin-connection-records.js +56 -0
- package/src/lib/app-utils/plugin-connection-records.js.map +1 -0
- package/src/lib/app-utils/plugin-connections.d.ts +320 -0
- package/src/lib/app-utils/plugin-connections.js +895 -0
- package/src/lib/app-utils/plugin-connections.js.map +1 -0
- package/src/lib/app-utils/plugin-elements.d.ts +104 -0
- package/src/lib/app-utils/plugin-elements.js +128 -0
- package/src/lib/app-utils/plugin-elements.js.map +1 -0
- package/src/lib/app-utils/plugin-manifest.d.ts +20 -75
- package/src/lib/app-utils/plugin-manifest.js +65 -100
- package/src/lib/app-utils/plugin-manifest.js.map +1 -1
- package/src/lib/app-utils/realm-elements-context.d.ts +16 -0
- package/src/lib/app-utils/realm-elements-context.js +16 -0
- package/src/lib/app-utils/realm-elements-context.js.map +1 -1
- package/src/lib/app-utils/realm-host-surface.generated.js +1 -0
- package/src/lib/app-utils/realm-host-surface.generated.js.map +1 -1
- package/src/lib/app-utils/release-flags.d.ts +1 -1
- package/src/lib/app-utils/release-flags.js +11 -0
- package/src/lib/app-utils/release-flags.js.map +1 -1
- package/src/lib/app-utils/server.d.ts +1 -0
- package/src/lib/app-utils/server.js +2 -0
- package/src/lib/app-utils/server.js.map +1 -1
- package/src/lib/plugin-manager/feature-plugins.d.ts +25 -0
- package/src/lib/plugin-manager/feature-plugins.js +10 -0
- package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
- package/src/lib/plugin-manager/first-party-plugins.generated.js +11 -0
- package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
- package/src/lib/plugin-manager/index.d.ts +1 -0
- package/src/lib/plugin-manager/index.js +1 -0
- package/src/lib/plugin-manager/index.js.map +1 -1
- package/src/lib/plugin-manager/plugin-artifact-inventory.d.ts +5 -0
- package/src/lib/plugin-manager/plugin-artifact-inventory.js.map +1 -1
- package/src/lib/plugin-manager/plugin-site-csp.d.ts +36 -0
- package/src/lib/plugin-manager/plugin-site-csp.js +50 -1
- package/src/lib/plugin-manager/plugin-site-csp.js.map +1 -1
- package/src/lib/plugin-manager/realm-host-aglyn.generated.js +61 -59
- package/src/lib/plugin-manager/realm-host-aglyn.generated.js.map +1 -1
- package/src/lib/plugin-manager/site-page-enricher-services.d.ts +35 -0
- package/src/lib/plugin-manager/site-page-enricher-services.js +35 -0
- package/src/lib/plugin-manager/site-page-enricher-services.js.map +1 -0
- package/src/lib/plugin-manager/site-page-hooks.js +16 -3
- package/src/lib/plugin-manager/site-page-hooks.js.map +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
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 { PluginConnectionRecordsPageData, PluginConnectionSiteRecord } from './plugin-connection-records';
|
|
18
|
+
/** One `{{var:…}}` a connection's record gives the site, as the binding picker lists it. */
|
|
19
|
+
export interface EditorConnectionVariable {
|
|
20
|
+
/** The variable id (`pluginConnectionVariableId`): what the token carries. */
|
|
21
|
+
id: string;
|
|
22
|
+
/** What a person reads: the connection's label and the field's name, never the id. */
|
|
23
|
+
label: string;
|
|
24
|
+
/** The value the last sync wrote, as the published page would print it, or `null` before one. */
|
|
25
|
+
value: string | null;
|
|
26
|
+
}
|
|
27
|
+
/** What the editor knows of the site's declared connections. */
|
|
28
|
+
export interface EditorPluginConnections {
|
|
29
|
+
/** The listing whose namespace `componentId` is in (`<identity>.<role>`), or `null`. */
|
|
30
|
+
listingFor(componentId: string): string | null;
|
|
31
|
+
/** Listing id → connection id → the record its last sync wrote. */
|
|
32
|
+
records: Readonly<Record<string, Readonly<Record<string, PluginConnectionSiteRecord>>>>;
|
|
33
|
+
/** Every summary field of every declared connection, as site variables. */
|
|
34
|
+
variables: readonly EditorConnectionVariable[];
|
|
35
|
+
}
|
|
36
|
+
export declare const EditorPluginConnectionsContext: import("react").Context<EditorPluginConnections>;
|
|
37
|
+
/** An editor node, as far as attributing it to a listing needs. */
|
|
38
|
+
export interface EditorConnectionNode {
|
|
39
|
+
$id?: unknown;
|
|
40
|
+
componentId?: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The `PluginConnectionRecordsContext` value for `nodes` (a page's, or one
|
|
44
|
+
* element's), attributed the way the published page's enricher attributes
|
|
45
|
+
* them: a node whose component id is in a listing's namespace, and only when
|
|
46
|
+
* that listing holds a record. `undefined` when none is.
|
|
47
|
+
*/
|
|
48
|
+
export declare function editorConnectionRecordsPageData(connections: EditorPluginConnections | undefined, nodes: Iterable<EditorConnectionNode | null | undefined>): PluginConnectionRecordsPageData | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { createContext } from "react";
|
|
18
|
+
export const EditorPluginConnectionsContext = createContext(undefined);
|
|
19
|
+
EditorPluginConnectionsContext.displayName = 'EditorPluginConnectionsContext';
|
|
20
|
+
/**
|
|
21
|
+
* The `PluginConnectionRecordsContext` value for `nodes` (a page's, or one
|
|
22
|
+
* element's), attributed the way the published page's enricher attributes
|
|
23
|
+
* them: a node whose component id is in a listing's namespace, and only when
|
|
24
|
+
* that listing holds a record. `undefined` when none is.
|
|
25
|
+
*/ export function editorConnectionRecordsPageData(connections, nodes) {
|
|
26
|
+
if (!connections) return undefined;
|
|
27
|
+
const attributed = {};
|
|
28
|
+
const records = {};
|
|
29
|
+
for (const node of nodes){
|
|
30
|
+
const nodeId = node == null ? void 0 : node.$id;
|
|
31
|
+
const componentId = node == null ? void 0 : node.componentId;
|
|
32
|
+
if (typeof nodeId !== 'string' || !nodeId || typeof componentId !== 'string' || !componentId.includes('.')) continue;
|
|
33
|
+
const listingId = connections.listingFor(componentId);
|
|
34
|
+
if (!listingId) continue;
|
|
35
|
+
const held = connections.records[listingId];
|
|
36
|
+
if (!held || !Object.keys(held).length) continue;
|
|
37
|
+
attributed[nodeId] = listingId;
|
|
38
|
+
records[listingId] = _extends({}, held);
|
|
39
|
+
}
|
|
40
|
+
return Object.keys(attributed).length ? {
|
|
41
|
+
nodes: attributed,
|
|
42
|
+
records
|
|
43
|
+
} : undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=plugin-connection-editor.js.map
|
|
@@ -0,0 +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'\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/** 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\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;AA2CrC,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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 PluginConnectionSiteRecord } from './plugin-connection-records';
|
|
18
|
+
export type { PluginConnectionRecordValue, PluginConnectionSiteRecord, } from './plugin-connection-records';
|
|
19
|
+
/**
|
|
20
|
+
* THE CONNECTION RECORD A SIGNED PLUGIN'S SITE ELEMENT READS (AGL-4195).
|
|
21
|
+
*
|
|
22
|
+
* On the realm host surface: a bundle reads it as `aglyn.usePluginConnectionRecord`.
|
|
23
|
+
*
|
|
24
|
+
* ```js
|
|
25
|
+
* const record = usePluginConnectionRecord('reviews')
|
|
26
|
+
* if (!record) return null // not connected yet, or not synced: render nothing
|
|
27
|
+
* return h('p', null, `${record.fields.rating} from ${record.fields.reviewCount} reviews`)
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* `connectionId` is a connection the plugin's OWN manifest declares; the
|
|
31
|
+
* listing is never an argument. It is the listing whose namespace the asking
|
|
32
|
+
* element is in, which the renderer knows and the bundle cannot change, so an
|
|
33
|
+
* element can only ever read its own plugin's record.
|
|
34
|
+
*
|
|
35
|
+
* On a published page the record arrives with the page, server-rendered, and
|
|
36
|
+
* this hook only looks it up: no fetch, no effect, the same answer on the
|
|
37
|
+
* server and in the browser. `null` when the site has not connected or no sync
|
|
38
|
+
* has finished, when the workspace's plan does not include connections, and on
|
|
39
|
+
* every surface that hands no records (the editor, Preview). The element
|
|
40
|
+
* decides what `null` looks like; rendering nothing is the usual answer.
|
|
41
|
+
*/
|
|
42
|
+
export declare function usePluginConnectionRecord(connectionId: string): PluginConnectionSiteRecord | null;
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
*/ import { useContext } from "react";
|
|
17
|
+
import { pluginConnectionRecordFor } from "./plugin-connection-records.js";
|
|
18
|
+
import { PluginConnectionRecordsContext } from "./plugin-connection-records-context.js";
|
|
19
|
+
import { RealmElementNodeContext } from "./realm-elements-context.js";
|
|
20
|
+
/**
|
|
21
|
+
* THE CONNECTION RECORD A SIGNED PLUGIN'S SITE ELEMENT READS (AGL-4195).
|
|
22
|
+
*
|
|
23
|
+
* On the realm host surface: a bundle reads it as `aglyn.usePluginConnectionRecord`.
|
|
24
|
+
*
|
|
25
|
+
* ```js
|
|
26
|
+
* const record = usePluginConnectionRecord('reviews')
|
|
27
|
+
* if (!record) return null // not connected yet, or not synced: render nothing
|
|
28
|
+
* return h('p', null, `${record.fields.rating} from ${record.fields.reviewCount} reviews`)
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* `connectionId` is a connection the plugin's OWN manifest declares; the
|
|
32
|
+
* listing is never an argument. It is the listing whose namespace the asking
|
|
33
|
+
* element is in, which the renderer knows and the bundle cannot change, so an
|
|
34
|
+
* element can only ever read its own plugin's record.
|
|
35
|
+
*
|
|
36
|
+
* On a published page the record arrives with the page, server-rendered, and
|
|
37
|
+
* this hook only looks it up: no fetch, no effect, the same answer on the
|
|
38
|
+
* server and in the browser. `null` when the site has not connected or no sync
|
|
39
|
+
* has finished, when the workspace's plan does not include connections, and on
|
|
40
|
+
* every surface that hands no records (the editor, Preview). The element
|
|
41
|
+
* decides what `null` looks like; rendering nothing is the usual answer.
|
|
42
|
+
*/ export function usePluginConnectionRecord(connectionId) {
|
|
43
|
+
const nodeId = useContext(RealmElementNodeContext);
|
|
44
|
+
const records = useContext(PluginConnectionRecordsContext);
|
|
45
|
+
return pluginConnectionRecordFor(records, nodeId, connectionId);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=plugin-connection-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/plugin-connection-record.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 { useContext } from 'react'\nimport { pluginConnectionRecordFor, type PluginConnectionSiteRecord } from './plugin-connection-records'\nimport { PluginConnectionRecordsContext } from './plugin-connection-records-context'\nimport { RealmElementNodeContext } from './realm-elements-context'\n\nexport type {\n PluginConnectionRecordValue,\n PluginConnectionSiteRecord,\n} from './plugin-connection-records'\n\n/**\n * THE CONNECTION RECORD A SIGNED PLUGIN'S SITE ELEMENT READS (AGL-4195).\n *\n * On the realm host surface: a bundle reads it as `aglyn.usePluginConnectionRecord`.\n *\n * ```js\n * const record = usePluginConnectionRecord('reviews')\n * if (!record) return null // not connected yet, or not synced: render nothing\n * return h('p', null, `${record.fields.rating} from ${record.fields.reviewCount} reviews`)\n * ```\n *\n * `connectionId` is a connection the plugin's OWN manifest declares; the\n * listing is never an argument. It is the listing whose namespace the asking\n * element is in, which the renderer knows and the bundle cannot change, so an\n * element can only ever read its own plugin's record.\n *\n * On a published page the record arrives with the page, server-rendered, and\n * this hook only looks it up: no fetch, no effect, the same answer on the\n * server and in the browser. `null` when the site has not connected or no sync\n * has finished, when the workspace's plan does not include connections, and on\n * every surface that hands no records (the editor, Preview). The element\n * decides what `null` looks like; rendering nothing is the usual answer.\n */\nexport function usePluginConnectionRecord(connectionId: string): PluginConnectionSiteRecord | null {\n const nodeId = useContext(RealmElementNodeContext)\n const records = useContext(PluginConnectionRecordsContext)\n return pluginConnectionRecordFor(records, nodeId, connectionId)\n}\n"],"names":["useContext","pluginConnectionRecordFor","PluginConnectionRecordsContext","RealmElementNodeContext","usePluginConnectionRecord","connectionId","nodeId","records"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,UAAU,QAAQ,QAAO;AAClC,SAASC,yBAAyB,QAAyC,iCAA6B;AACxG,SAASC,8BAA8B,QAAQ,yCAAqC;AACpF,SAASC,uBAAuB,QAAQ,8BAA0B;AAOlE;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,SAASC,0BAA0BC,YAAoB;IAC5D,MAAMC,SAASN,WAAWG;IAC1B,MAAMI,UAAUP,WAAWE;IAC3B,OAAOD,0BAA0BM,SAASD,QAAQD;AACpD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { PluginConnectionRecordsPageData } from './plugin-connection-records';
|
|
18
|
+
/**
|
|
19
|
+
* The page's records. The published page provides its prop; a surface with
|
|
20
|
+
* none (the Besigner, Preview, an email) provides nothing, and every element
|
|
21
|
+
* reads `null` — the same answer as a site that has not connected yet.
|
|
22
|
+
*/
|
|
23
|
+
export declare const PluginConnectionRecordsContext: import("react").Context<PluginConnectionRecordsPageData>;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
*/ import { createContext } from "react";
|
|
17
|
+
/*
|
|
18
|
+
* The React half of `plugin-connection-records.ts` (AGL-4195), apart so the
|
|
19
|
+
* server enricher that writes the page prop never loads a module that calls
|
|
20
|
+
* `createContext` (AGL-405). Not on the realm host surface: a bundle reads the
|
|
21
|
+
* records through `usePluginConnectionRecord` alone.
|
|
22
|
+
*/ /**
|
|
23
|
+
* The page's records. The published page provides its prop; a surface with
|
|
24
|
+
* none (the Besigner, Preview, an email) provides nothing, and every element
|
|
25
|
+
* reads `null` — the same answer as a site that has not connected yet.
|
|
26
|
+
*/ export const PluginConnectionRecordsContext = createContext(undefined);
|
|
27
|
+
PluginConnectionRecordsContext.displayName = 'PluginConnectionRecordsContext';
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=plugin-connection-records-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/plugin-connection-records-context.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 } from './plugin-connection-records'\n\n/*\n * The React half of `plugin-connection-records.ts` (AGL-4195), apart so the\n * server enricher that writes the page prop never loads a module that calls\n * `createContext` (AGL-405). Not on the realm host surface: a bundle reads the\n * records through `usePluginConnectionRecord` alone.\n */\n\n/**\n * The page's records. The published page provides its prop; a surface with\n * none (the Besigner, Preview, an email) provides nothing, and every element\n * reads `null` — the same answer as a site that has not connected yet.\n */\nexport const PluginConnectionRecordsContext = createContext<PluginConnectionRecordsPageData | undefined>(undefined)\nPluginConnectionRecordsContext.displayName = 'PluginConnectionRecordsContext'\n\n"],"names":["createContext","PluginConnectionRecordsContext","undefined","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,aAAa,QAAQ,QAAO;AAGrC;;;;;CAKC,GAED;;;;CAIC,GACD,OAAO,MAAMC,iCAAiCD,cAA2DE,WAAU;AACnHD,+BAA+BE,WAAW,GAAG"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
/** One value of a record, as the declaration typed it (`datetime` is epoch ms). */
|
|
18
|
+
export type PluginConnectionRecordValue = string | number | boolean | null;
|
|
19
|
+
/** What an element is handed: the record its connection's last sync wrote for this site. */
|
|
20
|
+
export interface PluginConnectionSiteRecord {
|
|
21
|
+
/** The declared summary fields (`sync.record.fields`). */
|
|
22
|
+
fields: Record<string, PluginConnectionRecordValue>;
|
|
23
|
+
/** The declared list (`sync.record.items`), already capped to its `maxItems`. */
|
|
24
|
+
items: Array<Record<string, PluginConnectionRecordValue>>;
|
|
25
|
+
/** When the sync that wrote it finished, epoch ms. */
|
|
26
|
+
syncedAtMs: number;
|
|
27
|
+
}
|
|
28
|
+
/** The page prop the records ride on, from the enricher to the page's provider. */
|
|
29
|
+
export declare const PLUGIN_CONNECTION_RECORDS_PROP = "pluginConnectionRecords";
|
|
30
|
+
/** The page prop: which listing owns each signed element on the page, and each listing's records. */
|
|
31
|
+
export interface PluginConnectionRecordsPageData {
|
|
32
|
+
/** Node id of a signed element → the listing whose namespace it is in. */
|
|
33
|
+
nodes: Record<string, string>;
|
|
34
|
+
/** Listing id → connection id → record. */
|
|
35
|
+
records: Record<string, Record<string, PluginConnectionSiteRecord>>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The record `nodeId`'s own listing holds for `connectionId`, or `null`.
|
|
39
|
+
* `null` for a node the page does not attribute to a listing, a listing with
|
|
40
|
+
* no record for that connection, and every malformed input.
|
|
41
|
+
*/
|
|
42
|
+
export declare function pluginConnectionRecordFor(data: PluginConnectionRecordsPageData | null | undefined, nodeId: string | null | undefined, connectionId: string): PluginConnectionSiteRecord | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
* WHAT A SIGNED PLUGIN'S ELEMENT READS OF ITS DECLARED CONNECTION (AGL-4195).
|
|
18
|
+
*
|
|
19
|
+
* A marketplace plugin declares a connection in its manifest
|
|
20
|
+
* (`plugin-connections.ts`); the platform runs it and keeps, per site, the
|
|
21
|
+
* small public record the declared sync last mapped. The element shows that
|
|
22
|
+
* record. It never fetches it: the page's server enricher (the distributing
|
|
23
|
+
* plugin's) reads the records of the elements on the page and hands them
|
|
24
|
+
* over as one page prop, so the element renders in the page's HTML.
|
|
25
|
+
*
|
|
26
|
+
* The prop is keyed by ELEMENT, not by plugin: `nodes` names, for each node
|
|
27
|
+
* id of a signed element on the page, the listing whose namespace owns it,
|
|
28
|
+
* and `records` holds each of those listings' records by connection id. The
|
|
29
|
+
* hook (`usePluginConnectionRecord`) looks up the asking element's own node
|
|
30
|
+
* (`RealmElementNodeContext`, provided by the renderer, not the bundle), so
|
|
31
|
+
* an element is only ever handed its own listing's record: the cross-listing
|
|
32
|
+
* read the contract forbids has no key to ask with.
|
|
33
|
+
*
|
|
34
|
+
* Nothing here is on the realm host surface: only the hook is. A bundle
|
|
35
|
+
* cannot provide this context, or read the map whole.
|
|
36
|
+
*/ /** One value of a record, as the declaration typed it (`datetime` is epoch ms). */ /** The page prop the records ride on, from the enricher to the page's provider. */ export const PLUGIN_CONNECTION_RECORDS_PROP = 'pluginConnectionRecords';
|
|
37
|
+
const own = (value, key)=>Object.prototype.hasOwnProperty.call(value, key);
|
|
38
|
+
/**
|
|
39
|
+
* The record `nodeId`'s own listing holds for `connectionId`, or `null`.
|
|
40
|
+
* `null` for a node the page does not attribute to a listing, a listing with
|
|
41
|
+
* no record for that connection, and every malformed input.
|
|
42
|
+
*/ export function pluginConnectionRecordFor(data, nodeId, connectionId) {
|
|
43
|
+
var _byConnection_connectionId;
|
|
44
|
+
if (!data || !nodeId || typeof connectionId !== 'string' || !connectionId) return null;
|
|
45
|
+
const nodes = data.nodes;
|
|
46
|
+
const records = data.records;
|
|
47
|
+
if (!nodes || typeof nodes !== 'object' || !records || typeof records !== 'object') return null;
|
|
48
|
+
if (!own(nodes, nodeId)) return null;
|
|
49
|
+
const listingId = nodes[nodeId];
|
|
50
|
+
if (typeof listingId !== 'string' || !own(records, listingId)) return null;
|
|
51
|
+
const byConnection = records[listingId];
|
|
52
|
+
if (!byConnection || typeof byConnection !== 'object' || !own(byConnection, connectionId)) return null;
|
|
53
|
+
return (_byConnection_connectionId = byConnection[connectionId]) != null ? _byConnection_connectionId : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=plugin-connection-records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/plugin-connection-records.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\n\n/*\n * WHAT A SIGNED PLUGIN'S ELEMENT READS OF ITS DECLARED CONNECTION (AGL-4195).\n *\n * A marketplace plugin declares a connection in its manifest\n * (`plugin-connections.ts`); the platform runs it and keeps, per site, the\n * small public record the declared sync last mapped. The element shows that\n * record. It never fetches it: the page's server enricher (the distributing\n * plugin's) reads the records of the elements on the page and hands them\n * over as one page prop, so the element renders in the page's HTML.\n *\n * The prop is keyed by ELEMENT, not by plugin: `nodes` names, for each node\n * id of a signed element on the page, the listing whose namespace owns it,\n * and `records` holds each of those listings' records by connection id. The\n * hook (`usePluginConnectionRecord`) looks up the asking element's own node\n * (`RealmElementNodeContext`, provided by the renderer, not the bundle), so\n * an element is only ever handed its own listing's record: the cross-listing\n * read the contract forbids has no key to ask with.\n *\n * Nothing here is on the realm host surface: only the hook is. A bundle\n * cannot provide this context, or read the map whole.\n */\n\n/** One value of a record, as the declaration typed it (`datetime` is epoch ms). */\nexport type PluginConnectionRecordValue = string | number | boolean | null\n\n/** What an element is handed: the record its connection's last sync wrote for this site. */\nexport interface PluginConnectionSiteRecord {\n /** The declared summary fields (`sync.record.fields`). */\n fields: Record<string, PluginConnectionRecordValue>\n /** The declared list (`sync.record.items`), already capped to its `maxItems`. */\n items: Array<Record<string, PluginConnectionRecordValue>>\n /** When the sync that wrote it finished, epoch ms. */\n syncedAtMs: number\n}\n\n/** The page prop the records ride on, from the enricher to the page's provider. */\nexport const PLUGIN_CONNECTION_RECORDS_PROP = 'pluginConnectionRecords'\n\n/** The page prop: which listing owns each signed element on the page, and each listing's records. */\nexport interface PluginConnectionRecordsPageData {\n /** Node id of a signed element → the listing whose namespace it is in. */\n nodes: Record<string, string>\n /** Listing id → connection id → record. */\n records: Record<string, Record<string, PluginConnectionSiteRecord>>\n}\n\nconst own = (value: object, key: string): boolean => Object.prototype.hasOwnProperty.call(value, key)\n\n/**\n * The record `nodeId`'s own listing holds for `connectionId`, or `null`.\n * `null` for a node the page does not attribute to a listing, a listing with\n * no record for that connection, and every malformed input.\n */\nexport function pluginConnectionRecordFor(\n data: PluginConnectionRecordsPageData | null | undefined,\n nodeId: string | null | undefined,\n connectionId: string,\n): PluginConnectionSiteRecord | null {\n if (!data || !nodeId || typeof connectionId !== 'string' || !connectionId) return null\n const nodes = data.nodes\n const records = data.records\n if (!nodes || typeof nodes !== 'object' || !records || typeof records !== 'object') return null\n if (!own(nodes, nodeId)) return null\n const listingId = nodes[nodeId]\n if (typeof listingId !== 'string' || !own(records, listingId)) return null\n const byConnection = records[listingId]\n if (!byConnection || typeof byConnection !== 'object' || !own(byConnection, connectionId)) return null\n return byConnection[connectionId] ?? null\n}\n"],"names":["PLUGIN_CONNECTION_RECORDS_PROP","own","value","key","Object","prototype","hasOwnProperty","call","pluginConnectionRecordFor","data","nodeId","connectionId","byConnection","nodes","records","listingId"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD;;;;;;;;;;;;;;;;;;;;CAoBC,GAED,iFAAiF,GAajF,iFAAiF,GACjF,OAAO,MAAMA,iCAAiC,0BAAyB;AAUvE,MAAMC,MAAM,CAACC,OAAeC,MAAyBC,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACL,OAAOC;AAEjG;;;;CAIC,GACD,OAAO,SAASK,0BACdC,IAAwD,EACxDC,MAAiC,EACjCC,YAAoB;QAWbC;IATP,IAAI,CAACH,QAAQ,CAACC,UAAU,OAAOC,iBAAiB,YAAY,CAACA,cAAc,OAAO;IAClF,MAAME,QAAQJ,KAAKI,KAAK;IACxB,MAAMC,UAAUL,KAAKK,OAAO;IAC5B,IAAI,CAACD,SAAS,OAAOA,UAAU,YAAY,CAACC,WAAW,OAAOA,YAAY,UAAU,OAAO;IAC3F,IAAI,CAACb,IAAIY,OAAOH,SAAS,OAAO;IAChC,MAAMK,YAAYF,KAAK,CAACH,OAAO;IAC/B,IAAI,OAAOK,cAAc,YAAY,CAACd,IAAIa,SAASC,YAAY,OAAO;IACtE,MAAMH,eAAeE,OAAO,CAACC,UAAU;IACvC,IAAI,CAACH,gBAAgB,OAAOA,iBAAiB,YAAY,CAACX,IAAIW,cAAcD,eAAe,OAAO;IAClG,QAAOC,6BAAAA,YAAY,CAACD,aAAa,YAA1BC,6BAA8B;AACvC"}
|