@zaflun/lumio-protocol 0.2.4 → 0.9.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/CHANGELOG.md +129 -1
- package/README.md +1 -1
- package/dist/chunk-746VSR4E.js +51 -0
- package/dist/index.d.ts +1409 -12
- package/dist/index.js +729 -9
- package/dist/origin.d.ts +24 -0
- package/dist/origin.js +14 -0
- package/package.json +6 -2
package/dist/origin.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Placeholder that a runtime origin template carries in place of the label. */
|
|
2
|
+
declare const EXTENSION_RUNTIME_LABEL_PLACEHOLDER = "{label}";
|
|
3
|
+
/**
|
|
4
|
+
* The runtime host label for an extension: its UUID as 32 lowercase hex
|
|
5
|
+
* characters. Returns `null` unless `extensionId` is a canonical lowercase,
|
|
6
|
+
* hyphenated UUID.
|
|
7
|
+
*/
|
|
8
|
+
declare function extensionRuntimeLabel(extensionId: string): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* The runtime origin for an extension under a template such as
|
|
11
|
+
* `https://{label}.lumio.ext.staging.zaflun.dev`. Returns `null` for an invalid
|
|
12
|
+
* extension id or an invalid template.
|
|
13
|
+
*/
|
|
14
|
+
declare function extensionRuntimeOrigin(extensionId: string, template: string): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* If `origin` is a runtime origin under `template`, returns its 32-hex label;
|
|
17
|
+
* otherwise `null`. Used where the extension id is not known, e.g. the runtime
|
|
18
|
+
* checking its own `location.origin`.
|
|
19
|
+
*/
|
|
20
|
+
declare function extensionRuntimeOriginLabel(origin: string, template: string): string | null;
|
|
21
|
+
/** Whether `template` is a usable runtime origin template. */
|
|
22
|
+
declare function isValidExtensionRuntimeOriginTemplate(template: string): boolean;
|
|
23
|
+
|
|
24
|
+
export { EXTENSION_RUNTIME_LABEL_PLACEHOLDER, extensionRuntimeLabel, extensionRuntimeOrigin, extensionRuntimeOriginLabel, isValidExtensionRuntimeOriginTemplate };
|
package/dist/origin.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EXTENSION_RUNTIME_LABEL_PLACEHOLDER,
|
|
3
|
+
extensionRuntimeLabel,
|
|
4
|
+
extensionRuntimeOrigin,
|
|
5
|
+
extensionRuntimeOriginLabel,
|
|
6
|
+
isValidExtensionRuntimeOriginTemplate
|
|
7
|
+
} from "./chunk-746VSR4E.js";
|
|
8
|
+
export {
|
|
9
|
+
EXTENSION_RUNTIME_LABEL_PLACEHOLDER,
|
|
10
|
+
extensionRuntimeLabel,
|
|
11
|
+
extensionRuntimeOrigin,
|
|
12
|
+
extensionRuntimeOriginLabel,
|
|
13
|
+
isValidExtensionRuntimeOriginTemplate
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zaflun/lumio-protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Wire-format types for Lumio extension iframe-to-host communication",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"import": "./dist/index.js",
|
|
11
11
|
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./origin": {
|
|
14
|
+
"import": "./dist/origin.js",
|
|
15
|
+
"types": "./dist/origin.d.ts"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"publishConfig": {
|
|
@@ -42,7 +46,7 @@
|
|
|
42
46
|
"email": "developers@zaflun.com"
|
|
43
47
|
},
|
|
44
48
|
"scripts": {
|
|
45
|
-
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
49
|
+
"build": "tsup src/index.ts src/origin.ts --format esm --dts --clean",
|
|
46
50
|
"typecheck": "tsc --noEmit",
|
|
47
51
|
"lint": "eslint src/",
|
|
48
52
|
"test": "vitest run"
|