@wippy-fe/types-global-proxy 0.0.31 → 0.0.34
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/index.d.ts +65 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -533,6 +533,46 @@ interface AppConfigOverrides {
|
|
|
533
533
|
apiRoutes?: ApiRoutesOverride;
|
|
534
534
|
}
|
|
535
535
|
|
|
536
|
+
/**
|
|
537
|
+
* Wippy package metadata types.
|
|
538
|
+
*
|
|
539
|
+
* **Layer boundary**: package.json is the **FE-author's view**. It is
|
|
540
|
+
* source-relative and BE/router/FS agnostic. It describes the build
|
|
541
|
+
* artifact (e.g. `browser: "dist/index.js"`, `wippy.path: "dist/app.html"`)
|
|
542
|
+
* without knowing where the operator will serve it.
|
|
543
|
+
*
|
|
544
|
+
* The YAML registry entry (`wippy/views`) is the **operator's view**. It
|
|
545
|
+
* is deployment-aware and owns paths that depend on the served layout.
|
|
546
|
+
* YAML's `meta.entry_point` overrides the bundled wippy.path / browser
|
|
547
|
+
* when the operator's serving pipeline reshapes the URL space (e.g.
|
|
548
|
+
* `vite --outDir <static-dir>` flattens away the `dist/` prefix).
|
|
549
|
+
*
|
|
550
|
+
* YAML wins on every field. Bundled meta is the fallback. See
|
|
551
|
+
* `wippy-framework/src/views/README.md` for the per-field mapping table.
|
|
552
|
+
*
|
|
553
|
+
* The consumer's `package.json` `wippy` block is the canonical FE-source
|
|
554
|
+
* declaration. At build time the `@wippy-fe/vite-plugin` plugins resolve
|
|
555
|
+
* any `file://<relative-path>` references inside the wippy block (file
|
|
556
|
+
* contents replace the URI string) and emit `dist/wippy-meta.json` with
|
|
557
|
+
* the resolved package.json.
|
|
558
|
+
*
|
|
559
|
+
* `wippy-meta.json` is the MANDATORY contract between consumers and
|
|
560
|
+
* `wippy/views` ≥ 0.5.0. Without it, `views` falls back to its legacy
|
|
561
|
+
* YAML-synthesis path (deprecated; exists only for migration). See
|
|
562
|
+
* `web_components.spec.md` § "Package metadata: source of truth".
|
|
563
|
+
*
|
|
564
|
+
* Convention for `file://`-referenced files: name them
|
|
565
|
+
* `<field-name-kebab>.do-not-link.<ext>` — the basename IS the kebab-case
|
|
566
|
+
* spelling of the wippy block field the file populates. Examples:
|
|
567
|
+
* - `wippy.configOverrides.customization.customCSS` → `custom-css.do-not-link.css`
|
|
568
|
+
* - `wippy.description` → `description.do-not-link.md`
|
|
569
|
+
* - `wippy.<future-field>` → `<future-field-kebab>.do-not-link.<ext>`
|
|
570
|
+
* The `.do-not-link.` infix is an imperative directive that consistently
|
|
571
|
+
* prevents AI agents from `<link>`/`<script>`-ing the file directly in
|
|
572
|
+
* app.html — empirically verified via blind tests. The proxy injects the
|
|
573
|
+
* file's content at runtime from the resolved package metadata.
|
|
574
|
+
*/
|
|
575
|
+
|
|
536
576
|
interface ProxyConfig {
|
|
537
577
|
enabled: boolean;
|
|
538
578
|
injections: {
|
|
@@ -559,6 +599,15 @@ interface SanitizeOptions {
|
|
|
559
599
|
extraTags?: Record<string, string[]>;
|
|
560
600
|
}
|
|
561
601
|
|
|
602
|
+
interface BridgeRequestOptions {
|
|
603
|
+
timeoutMs?: number;
|
|
604
|
+
}
|
|
605
|
+
interface ProxyBridgeApi {
|
|
606
|
+
post: (channel: string, payload?: unknown) => void;
|
|
607
|
+
request: <T = unknown>(channel: string, payload?: unknown, options?: BridgeRequestOptions) => Promise<T>;
|
|
608
|
+
on: (channel: string, handler: (payload: unknown) => unknown | Promise<unknown>) => () => void;
|
|
609
|
+
}
|
|
610
|
+
|
|
562
611
|
declare namespace UploadApi {
|
|
563
612
|
interface Meta {
|
|
564
613
|
filename: string;
|
|
@@ -1125,6 +1174,19 @@ type Events = {
|
|
|
1125
1174
|
};
|
|
1126
1175
|
declare function createEvents(): <T extends string>(topicPattern: T, callback: T extends KnownTopics ? Events[T] : Events["@message"]) => nanoevents.Unsubscribe;
|
|
1127
1176
|
|
|
1177
|
+
interface HtmlInjectOptions {
|
|
1178
|
+
baseUrl?: string;
|
|
1179
|
+
resourceId?: string;
|
|
1180
|
+
resourceType?: AppConfig['context']['resourceType'];
|
|
1181
|
+
route?: string;
|
|
1182
|
+
isNavOwner?: boolean;
|
|
1183
|
+
configOverrides?: AppConfigOverrides;
|
|
1184
|
+
proxyConfig?: ProxyConfig;
|
|
1185
|
+
}
|
|
1186
|
+
interface ProxyHtmlApi {
|
|
1187
|
+
inject: (sourceHtml: string, options?: HtmlInjectOptions) => Promise<string>;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1128
1190
|
/**
|
|
1129
1191
|
* Link classifier — decides whether an href targets:
|
|
1130
1192
|
* - `host-nav` host-level route claimed by a view page or system route
|
|
@@ -1280,6 +1342,7 @@ interface ProxyApiInstance {
|
|
|
1280
1342
|
* host will be dropped silently by the parent.
|
|
1281
1343
|
*/
|
|
1282
1344
|
layout: LayoutApi;
|
|
1345
|
+
bridge: ProxyBridgeApi;
|
|
1283
1346
|
logout: () => void;
|
|
1284
1347
|
};
|
|
1285
1348
|
api: AxiosInstance;
|
|
@@ -1302,6 +1365,7 @@ interface ProxyApiInstance {
|
|
|
1302
1365
|
logger: LoggerApi;
|
|
1303
1366
|
state: StateApi;
|
|
1304
1367
|
ws: ProxyWsApi;
|
|
1368
|
+
html: ProxyHtmlApi;
|
|
1305
1369
|
loadWebComponent: (componentId: string, tagName?: string) => Promise<void>;
|
|
1306
1370
|
/**
|
|
1307
1371
|
* Resolve a registered `view.component`'s custom-element tag name to its
|
|
@@ -1390,6 +1454,7 @@ declare global {
|
|
|
1390
1454
|
loadWebComponent: () => Promise<ProxyApiInstance['loadWebComponent']>;
|
|
1391
1455
|
loadByTagName: () => Promise<ProxyApiInstance['loadByTagName']>;
|
|
1392
1456
|
sanitize: () => Promise<ProxyApiInstance['sanitize']>;
|
|
1457
|
+
html: () => Promise<ProxyApiInstance['html']>;
|
|
1393
1458
|
};
|
|
1394
1459
|
tailwind?: {
|
|
1395
1460
|
config: Partial<typeof _default>;
|
package/package.json
CHANGED