@persona/layout-editor-remote-module 0.5.2 → 0.5.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.
- package/README.md +5 -2
- package/dist/bridge-frame.d.mts +1 -1
- package/dist/bridge-frame.mjs +1 -1
- package/dist/bridge-host.d.mts +1 -1
- package/dist/bridge-host.mjs +1 -1
- package/dist/{define-C-3P4CFz.d.mts → define-D0nvEX_B.d.mts} +2 -1
- package/dist/index.d.mts +1 -1
- package/dist/{protocol-Dz3ZX59L.mjs → protocol-BgGlnuFn.mjs} +16 -11
- package/dist/{protocol-edoRdXpF.d.mts → protocol-BljV-Zhi.d.mts} +2 -6
- package/dist/vite-plugin.d.mts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,8 +139,11 @@ The bridge's security model is intentionally narrow:
|
|
|
139
139
|
first trusted origin for the lifetime of the bridge.
|
|
140
140
|
- The iframe derives the ready target from `ancestorOrigins` or the referrer, and the host retries
|
|
141
141
|
`init` until the frame answers.
|
|
142
|
-
- Messages use a
|
|
143
|
-
|
|
142
|
+
- Messages use a versioned protocol that stays compatible with frames built against older releases
|
|
143
|
+
(from the release after 0.5.1): receivers ignore message types they don't know and strip keys they
|
|
144
|
+
don't know, and fields are never removed, renamed or narrowed. `context.layoutType` and
|
|
145
|
+
`defaultConfig`'s `layoutType` can be layout types added later, so handle values you don't know.
|
|
146
|
+
Credentials remain in the iframe URL and are never handled through bridge messages.
|
|
144
147
|
- `extraParams` rejects reserved names and credential-like keys.
|
|
145
148
|
|
|
146
149
|
### Consuming a manifest
|
package/dist/bridge-frame.d.mts
CHANGED
package/dist/bridge-frame.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as resolveAllowedHostOrigins, n as SOURCE, o as candidateParentOrigin, r as parseHostToModuleMessage, s as personaDashboardHostOrigins, t as PROTOCOL_VERSION } from "./protocol-
|
|
1
|
+
import { c as resolveAllowedHostOrigins, n as SOURCE, o as candidateParentOrigin, r as parseHostToModuleMessage, s as personaDashboardHostOrigins, t as PROTOCOL_VERSION } from "./protocol-BgGlnuFn.mjs";
|
|
2
2
|
import { Component, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
package/dist/bridge-host.d.mts
CHANGED
package/dist/bridge-host.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as assertNotSelfOrigin, i as parseModuleToHostMessage, n as SOURCE, t as PROTOCOL_VERSION } from "./protocol-
|
|
1
|
+
import { a as assertNotSelfOrigin, i as parseModuleToHostMessage, n as SOURCE, t as PROTOCOL_VERSION } from "./protocol-BgGlnuFn.mjs";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -95,7 +95,8 @@ type ModuleCategory = z.infer<typeof moduleCategorySchema>;
|
|
|
95
95
|
* modules.
|
|
96
96
|
*/
|
|
97
97
|
interface RemoteModuleDefaultConfigOptions {
|
|
98
|
-
|
|
98
|
+
/** Can be a layout type added after the module's release; handle values you don't know. */
|
|
99
|
+
layoutType: LayoutType | (string & {});
|
|
99
100
|
position?: {
|
|
100
101
|
x: number;
|
|
101
102
|
y: number;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as JsonSchemaObject, c as ModuleCategory, d as RemoteModuleExports, f as RemoteModuleRegistrationManifestV1, i as Json, l as RemoteModuleDefaultConfigOptions, m as remoteModuleRegistrationManifestV1Schema, n as LayoutModuleEntry, o as LayoutType, p as RemoteModuleRegistrationManifestV1Schema, r as defineLayoutModule, s as ModuleBadge, t as LayoutModuleDefinitionInput, u as RemoteModuleDelivery } from "./define-
|
|
1
|
+
import { a as JsonSchemaObject, c as ModuleCategory, d as RemoteModuleExports, f as RemoteModuleRegistrationManifestV1, i as Json, l as RemoteModuleDefaultConfigOptions, m as remoteModuleRegistrationManifestV1Schema, n as LayoutModuleEntry, o as LayoutType, p as RemoteModuleRegistrationManifestV1Schema, r as defineLayoutModule, s as ModuleBadge, t as LayoutModuleDefinitionInput, u as RemoteModuleDelivery } from "./define-D0nvEX_B.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/manifest-path.d.ts
|
|
@@ -122,41 +122,46 @@ const variableMapSchema = z.record(z.string(), z.union([z.string(), z.number()])
|
|
|
122
122
|
const readySchema = z.object({
|
|
123
123
|
...envelopeSchema,
|
|
124
124
|
type: z.literal("ready")
|
|
125
|
-
})
|
|
125
|
+
});
|
|
126
126
|
const requestDataSchema = z.object({
|
|
127
127
|
...envelopeSchema,
|
|
128
128
|
type: z.literal("request-data"),
|
|
129
129
|
requestId: requestIdSchema
|
|
130
|
-
})
|
|
130
|
+
});
|
|
131
131
|
const setHeightSchema = z.object({
|
|
132
132
|
...envelopeSchema,
|
|
133
133
|
type: z.literal("set-height"),
|
|
134
134
|
height: z.number()
|
|
135
|
-
})
|
|
135
|
+
});
|
|
136
136
|
const renderErrorSchema = z.object({
|
|
137
137
|
...envelopeSchema,
|
|
138
138
|
type: z.literal("render-error"),
|
|
139
139
|
message: z.string()
|
|
140
|
-
})
|
|
140
|
+
});
|
|
141
141
|
const resolveDataPathSchema = z.object({
|
|
142
142
|
...envelopeSchema,
|
|
143
143
|
type: z.literal("resolve-data-path"),
|
|
144
144
|
requestId: requestIdSchema,
|
|
145
145
|
dataPath: z.string(),
|
|
146
146
|
variableMap: variableMapSchema.optional()
|
|
147
|
-
})
|
|
147
|
+
});
|
|
148
|
+
/**
|
|
149
|
+
* Accepts layout types added after this release, so a module should handle a `layoutType` it
|
|
150
|
+
* doesn't know.
|
|
151
|
+
*/
|
|
152
|
+
const contextLayoutTypeSchema = z.union([layoutTypeSchema, z.string()]);
|
|
148
153
|
/**
|
|
149
154
|
* Runtime facts about where the module is rendered, owned by the host and not
|
|
150
155
|
* derivable by the module itself. Distinct from `data`, which is the module's
|
|
151
156
|
* persisted config.
|
|
152
157
|
*/
|
|
153
158
|
const remoteModuleContextSchema = z.object({
|
|
154
|
-
layoutType:
|
|
159
|
+
layoutType: contextLayoutTypeSchema,
|
|
155
160
|
layoutObjectId: z.string().nullable(),
|
|
156
161
|
isReadOnly: z.boolean(),
|
|
157
162
|
isInEditor: z.boolean(),
|
|
158
163
|
isUsingStubData: z.boolean()
|
|
159
|
-
})
|
|
164
|
+
});
|
|
160
165
|
const moduleToHostMessageSchema = z.discriminatedUnion("type", [
|
|
161
166
|
readySchema,
|
|
162
167
|
requestDataSchema,
|
|
@@ -169,25 +174,25 @@ const initSchema = z.object({
|
|
|
169
174
|
type: z.literal("init"),
|
|
170
175
|
data: jsonSchema,
|
|
171
176
|
context: remoteModuleContextSchema
|
|
172
|
-
})
|
|
177
|
+
});
|
|
173
178
|
const dataSchema = z.object({
|
|
174
179
|
...envelopeSchema,
|
|
175
180
|
type: z.literal("data"),
|
|
176
181
|
requestId: requestIdSchema.optional(),
|
|
177
182
|
data: jsonSchema
|
|
178
|
-
})
|
|
183
|
+
});
|
|
179
184
|
const contextSchema = z.object({
|
|
180
185
|
...envelopeSchema,
|
|
181
186
|
type: z.literal("context"),
|
|
182
187
|
context: remoteModuleContextSchema
|
|
183
|
-
})
|
|
188
|
+
});
|
|
184
189
|
const dataPathResultSchema = z.object({
|
|
185
190
|
...envelopeSchema,
|
|
186
191
|
type: z.literal("data-path-result"),
|
|
187
192
|
requestId: requestIdSchema,
|
|
188
193
|
result: jsonSchema.optional(),
|
|
189
194
|
error: z.string().optional()
|
|
190
|
-
}).
|
|
195
|
+
}).refine(({ result, error }) => result === void 0 !== (error === void 0));
|
|
191
196
|
const hostToModuleMessageSchema = z.discriminatedUnion("type", [
|
|
192
197
|
initSchema,
|
|
193
198
|
dataSchema,
|
|
@@ -15,16 +15,12 @@ type JsonValue = Json;
|
|
|
15
15
|
* persisted config.
|
|
16
16
|
*/
|
|
17
17
|
declare const remoteModuleContextSchema: z.ZodObject<{
|
|
18
|
-
layoutType: z.
|
|
19
|
-
account: "account";
|
|
20
|
-
case: "case";
|
|
21
|
-
transaction: "transaction";
|
|
22
|
-
}>;
|
|
18
|
+
layoutType: z.ZodType<"account" | "case" | "transaction" | (string & {}), unknown, z.core.$ZodTypeInternals<"account" | "case" | "transaction" | (string & {}), unknown>>;
|
|
23
19
|
layoutObjectId: z.ZodNullable<z.ZodString>;
|
|
24
20
|
isReadOnly: z.ZodBoolean;
|
|
25
21
|
isInEditor: z.ZodBoolean;
|
|
26
22
|
isUsingStubData: z.ZodBoolean;
|
|
27
|
-
}, z.core.$
|
|
23
|
+
}, z.core.$strip>;
|
|
28
24
|
type RemoteModuleContext = z.infer<typeof remoteModuleContextSchema>;
|
|
29
25
|
//#endregion
|
|
30
26
|
export { Json as n, RemoteModuleContext as t };
|
package/dist/vite-plugin.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as LayoutModuleEntry, r as defineLayoutModule, t as LayoutModuleDefinitionInput } from "./define-
|
|
1
|
+
import { n as LayoutModuleEntry, r as defineLayoutModule, t as LayoutModuleDefinitionInput } from "./define-D0nvEX_B.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/vite-plugin.d.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@persona/layout-editor-remote-module",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Shared manifest format, Vite plugin, and host/iframe bridge for remotely-defined dashboard layout modules in Persona dashboard apps.",
|
|
5
5
|
"license": "SEE LICENSE",
|
|
6
6
|
"type": "module",
|