@floegence/redevplugin-ui 0.1.6 → 0.2.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/LICENSE +21 -0
- package/dist/contracts.gen.d.ts +130 -0
- package/dist/contracts.gen.js +145 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.js +69 -0
- package/dist/http.d.ts +30 -0
- package/dist/http.js +45 -0
- package/dist/index.d.ts +1 -724
- package/dist/index.js +1 -875
- package/dist/local-import.d.ts +3 -1
- package/dist/local-import.js +13 -57
- package/dist/opaque-surface-policy.gen.d.ts +34 -0
- package/dist/opaque-surface-policy.gen.js +207 -0
- package/dist/platform.d.ts +466 -0
- package/dist/platform.js +142 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +1 -0
- package/dist/surface-scope.d.ts +8 -0
- package/dist/surface-scope.js +31 -0
- package/dist/surface.d.ts +328 -0
- package/dist/surface.js +2073 -0
- package/dist/trusted-parent.d.ts +7 -0
- package/dist/trusted-parent.js +5 -0
- package/package.json +10 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Floegence
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export declare const pluginUIProtocolVersion: "plugin-ui-v2";
|
|
2
|
+
export declare const pluginHostProtocolVersion: "plugin-host-v2";
|
|
3
|
+
export declare const bridgeSchemaVersion: "bridge-v2";
|
|
4
|
+
export declare const tokenTicketSchemaVersion: "token-ticket-v2";
|
|
5
|
+
export declare const redevPluginContractVersions: {
|
|
6
|
+
readonly plugin_ui_protocol_version: "plugin-ui-v2";
|
|
7
|
+
readonly plugin_host_protocol_version: "plugin-host-v2";
|
|
8
|
+
readonly rust_ipc_version: "rust-ipc-v1";
|
|
9
|
+
readonly wasm_abi_version: "redevplugin-wasm-worker-v1";
|
|
10
|
+
readonly manifest_schema_version: "manifest-v2";
|
|
11
|
+
readonly package_signature_schema_version: "package-signature-v1";
|
|
12
|
+
readonly release_metadata_schema_version: "release-metadata-v2";
|
|
13
|
+
readonly source_policy_schema_version: "source-policy-v1";
|
|
14
|
+
readonly source_revocations_schema_version: "source-revocations-v1";
|
|
15
|
+
readonly token_ticket_schema_version: "token-ticket-v2";
|
|
16
|
+
readonly bridge_schema_version: "bridge-v2";
|
|
17
|
+
readonly opaque_surface_document_schema_version: "opaque-surface-document-v1";
|
|
18
|
+
readonly opaque_surface_transport_schema_version: "opaque-surface-transport-v1";
|
|
19
|
+
readonly target_classifier_version: "target-classifier-v1";
|
|
20
|
+
readonly network_grant_schema_version: "network-grant-v1";
|
|
21
|
+
readonly plugin_platform_openapi_version: "plugin-platform-v2";
|
|
22
|
+
readonly compatibility_manifest_version: "redevplugin.compatibility.v2";
|
|
23
|
+
readonly compatibility_schema_version: "compatibility-manifest-v2";
|
|
24
|
+
readonly release_manifest_schema_version: "release-manifest-v2";
|
|
25
|
+
readonly worker_invocation_schema_version: "worker-invocation-v1";
|
|
26
|
+
readonly error_codes_schema_version: "error-codes-v1";
|
|
27
|
+
readonly contract_registry_version: "contract-registry-v1";
|
|
28
|
+
};
|
|
29
|
+
export type ReDevPluginContractArtifact = {
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly path: string;
|
|
32
|
+
readonly version: string;
|
|
33
|
+
readonly sha256: string;
|
|
34
|
+
};
|
|
35
|
+
export declare const redevPluginContractArtifacts: readonly [{
|
|
36
|
+
readonly id: "plugin-platform-openapi";
|
|
37
|
+
readonly path: "spec/openapi/plugin-platform-v2.yaml";
|
|
38
|
+
readonly version: "plugin-platform-v2";
|
|
39
|
+
readonly sha256: "5d6006831c3e55cd9232ad8f9decdc932059193538f9f0ff2b3934d81a6b9aaa";
|
|
40
|
+
}, {
|
|
41
|
+
readonly id: "manifest-schema";
|
|
42
|
+
readonly path: "spec/plugin/manifest-v2.schema.json";
|
|
43
|
+
readonly version: "manifest-v2";
|
|
44
|
+
readonly sha256: "ba2f782e0e47694484d4112da00d92689187e3bbd1e2f08aca2d9d680e554d51";
|
|
45
|
+
}, {
|
|
46
|
+
readonly id: "package-signature-schema";
|
|
47
|
+
readonly path: "spec/plugin/package-signature-v1.schema.json";
|
|
48
|
+
readonly version: "package-signature-v1";
|
|
49
|
+
readonly sha256: "13951c0f6831ba28647774368c76a817868aeb7984628e2cf3dc4ad1b54f8284";
|
|
50
|
+
}, {
|
|
51
|
+
readonly id: "release-metadata-schema";
|
|
52
|
+
readonly path: "spec/plugin/release-metadata-v2.schema.json";
|
|
53
|
+
readonly version: "release-metadata-v2";
|
|
54
|
+
readonly sha256: "6f985f9b0f009151b41e878c68f217058f7dd892f7f6471b2e5d24f54d858567";
|
|
55
|
+
}, {
|
|
56
|
+
readonly id: "source-policy-schema";
|
|
57
|
+
readonly path: "spec/plugin/source-policy-v1.schema.json";
|
|
58
|
+
readonly version: "source-policy-v1";
|
|
59
|
+
readonly sha256: "b5f3094402bdbfdda1671b46e5f64a69ad7dc2ba9501030439fafa87acd2923e";
|
|
60
|
+
}, {
|
|
61
|
+
readonly id: "source-revocations-schema";
|
|
62
|
+
readonly path: "spec/plugin/source-revocations-v1.schema.json";
|
|
63
|
+
readonly version: "source-revocations-v1";
|
|
64
|
+
readonly sha256: "4c4132879a51b31e99775c979ca3ab43c2ee4c5c885f3ff1e7b43cd5ce8bc83d";
|
|
65
|
+
}, {
|
|
66
|
+
readonly id: "token-ticket-schema";
|
|
67
|
+
readonly path: "spec/plugin/token-ticket-v2.schema.json";
|
|
68
|
+
readonly version: "token-ticket-v2";
|
|
69
|
+
readonly sha256: "f2fa0d5948318a7a61a3e52d1487b308891d65578259d5958b26c59adef0f351";
|
|
70
|
+
}, {
|
|
71
|
+
readonly id: "iframe-bridge-schema";
|
|
72
|
+
readonly path: "spec/plugin/bridge-v2.schema.json";
|
|
73
|
+
readonly version: "bridge-v2";
|
|
74
|
+
readonly sha256: "6a6f33381503d67fd7c3098e5e73b8d01ba80b0145190bdd034f85fd43528f23";
|
|
75
|
+
}, {
|
|
76
|
+
readonly id: "opaque-surface-document-schema";
|
|
77
|
+
readonly path: "spec/plugin/opaque-surface-document-v1.schema.json";
|
|
78
|
+
readonly version: "opaque-surface-document-v1";
|
|
79
|
+
readonly sha256: "78ca8f1fb161dd5cdd54d192eb3e147d6f0e6a8b9de01652ecd4b255600ea9b7";
|
|
80
|
+
}, {
|
|
81
|
+
readonly id: "opaque-surface-transport-schema";
|
|
82
|
+
readonly path: "spec/plugin/opaque-surface-transport-v1.schema.json";
|
|
83
|
+
readonly version: "opaque-surface-transport-v1";
|
|
84
|
+
readonly sha256: "36cd3378393fc8b59da0e3beb345d56db9a52548604177f0adc36e40d4d2b29b";
|
|
85
|
+
}, {
|
|
86
|
+
readonly id: "compatibility-manifest-schema";
|
|
87
|
+
readonly path: "spec/plugin/compatibility-manifest-v2.schema.json";
|
|
88
|
+
readonly version: "compatibility-manifest-v2";
|
|
89
|
+
readonly sha256: "924c117966bfc322b643e2987d1387f15ebd5222f328171c66eb56d24d281e21";
|
|
90
|
+
}, {
|
|
91
|
+
readonly id: "release-manifest-schema";
|
|
92
|
+
readonly path: "spec/plugin/release-manifest-v2.schema.json";
|
|
93
|
+
readonly version: "release-manifest-v2";
|
|
94
|
+
readonly sha256: "4406be65353d6d6e059cc0bd279c6ffc53c4250dd5407e7435b30b2fd6a0f582";
|
|
95
|
+
}, {
|
|
96
|
+
readonly id: "worker-invocation-schema";
|
|
97
|
+
readonly path: "spec/plugin/worker-invocation-v1.schema.json";
|
|
98
|
+
readonly version: "worker-invocation-v1";
|
|
99
|
+
readonly sha256: "cbbef78febae6d13d914bf382d22f2d9785d0bac158eb92d18a2815d5c70dbe6";
|
|
100
|
+
}, {
|
|
101
|
+
readonly id: "error-codes-schema";
|
|
102
|
+
readonly path: "spec/plugin/error-codes-v1.schema.json";
|
|
103
|
+
readonly version: "error-codes-v1";
|
|
104
|
+
readonly sha256: "89c95342f689b0ad486631f85ce73d4ffc86babe4e827ac6c2337e50bddc536e";
|
|
105
|
+
}, {
|
|
106
|
+
readonly id: "rust-ipc-schema";
|
|
107
|
+
readonly path: "spec/plugin/ipc-v1.schema.json";
|
|
108
|
+
readonly version: "rust-ipc-v1";
|
|
109
|
+
readonly sha256: "4e3a9556392b06b805f36fe80c5690408d702a72d71ac6f6e3edcb31f2fd0e91";
|
|
110
|
+
}, {
|
|
111
|
+
readonly id: "wasm-worker-schema";
|
|
112
|
+
readonly path: "spec/plugin/wasm-worker-v1.schema.json";
|
|
113
|
+
readonly version: "redevplugin-wasm-worker-v1";
|
|
114
|
+
readonly sha256: "ff0a37ea972db7d8be89b529e03d890af00aab3f2d9461c2db3a3d58c664b775";
|
|
115
|
+
}, {
|
|
116
|
+
readonly id: "network-grant-schema";
|
|
117
|
+
readonly path: "spec/plugin/network-grant-v1.schema.json";
|
|
118
|
+
readonly version: "network-grant-v1";
|
|
119
|
+
readonly sha256: "e3ba8e7aa42267596b5570c1de60994a0912b125ea78427776db8092c2b3ea7b";
|
|
120
|
+
}, {
|
|
121
|
+
readonly id: "target-classifier-fixture";
|
|
122
|
+
readonly path: "spec/plugin/target-classifier-v1.json";
|
|
123
|
+
readonly version: "target-classifier-v1";
|
|
124
|
+
readonly sha256: "7e9367d624c22d575ae5c118063c1cb0f0de6b5b0081eabcfc51c0357e4d14d7";
|
|
125
|
+
}, {
|
|
126
|
+
readonly id: "contract-registry";
|
|
127
|
+
readonly path: "spec/plugin/contract-registry-v1.json";
|
|
128
|
+
readonly version: "contract-registry-v1";
|
|
129
|
+
readonly sha256: "753d9e86abc10957ee2a80ae87b5ebf1b83af70370afc1c4e838efa6854eb8f9";
|
|
130
|
+
}];
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Code generated by scripts/generate_contract_registry.mjs; DO NOT EDIT.
|
|
2
|
+
export const pluginUIProtocolVersion = "plugin-ui-v2";
|
|
3
|
+
export const pluginHostProtocolVersion = "plugin-host-v2";
|
|
4
|
+
export const bridgeSchemaVersion = "bridge-v2";
|
|
5
|
+
export const tokenTicketSchemaVersion = "token-ticket-v2";
|
|
6
|
+
export const redevPluginContractVersions = {
|
|
7
|
+
"plugin_ui_protocol_version": "plugin-ui-v2",
|
|
8
|
+
"plugin_host_protocol_version": "plugin-host-v2",
|
|
9
|
+
"rust_ipc_version": "rust-ipc-v1",
|
|
10
|
+
"wasm_abi_version": "redevplugin-wasm-worker-v1",
|
|
11
|
+
"manifest_schema_version": "manifest-v2",
|
|
12
|
+
"package_signature_schema_version": "package-signature-v1",
|
|
13
|
+
"release_metadata_schema_version": "release-metadata-v2",
|
|
14
|
+
"source_policy_schema_version": "source-policy-v1",
|
|
15
|
+
"source_revocations_schema_version": "source-revocations-v1",
|
|
16
|
+
"token_ticket_schema_version": "token-ticket-v2",
|
|
17
|
+
"bridge_schema_version": "bridge-v2",
|
|
18
|
+
"opaque_surface_document_schema_version": "opaque-surface-document-v1",
|
|
19
|
+
"opaque_surface_transport_schema_version": "opaque-surface-transport-v1",
|
|
20
|
+
"target_classifier_version": "target-classifier-v1",
|
|
21
|
+
"network_grant_schema_version": "network-grant-v1",
|
|
22
|
+
"plugin_platform_openapi_version": "plugin-platform-v2",
|
|
23
|
+
"compatibility_manifest_version": "redevplugin.compatibility.v2",
|
|
24
|
+
"compatibility_schema_version": "compatibility-manifest-v2",
|
|
25
|
+
"release_manifest_schema_version": "release-manifest-v2",
|
|
26
|
+
"worker_invocation_schema_version": "worker-invocation-v1",
|
|
27
|
+
"error_codes_schema_version": "error-codes-v1",
|
|
28
|
+
"contract_registry_version": "contract-registry-v1",
|
|
29
|
+
};
|
|
30
|
+
export const redevPluginContractArtifacts = [
|
|
31
|
+
{
|
|
32
|
+
id: "plugin-platform-openapi",
|
|
33
|
+
path: "spec/openapi/plugin-platform-v2.yaml",
|
|
34
|
+
version: "plugin-platform-v2",
|
|
35
|
+
sha256: "5d6006831c3e55cd9232ad8f9decdc932059193538f9f0ff2b3934d81a6b9aaa",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "manifest-schema",
|
|
39
|
+
path: "spec/plugin/manifest-v2.schema.json",
|
|
40
|
+
version: "manifest-v2",
|
|
41
|
+
sha256: "ba2f782e0e47694484d4112da00d92689187e3bbd1e2f08aca2d9d680e554d51",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "package-signature-schema",
|
|
45
|
+
path: "spec/plugin/package-signature-v1.schema.json",
|
|
46
|
+
version: "package-signature-v1",
|
|
47
|
+
sha256: "13951c0f6831ba28647774368c76a817868aeb7984628e2cf3dc4ad1b54f8284",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "release-metadata-schema",
|
|
51
|
+
path: "spec/plugin/release-metadata-v2.schema.json",
|
|
52
|
+
version: "release-metadata-v2",
|
|
53
|
+
sha256: "6f985f9b0f009151b41e878c68f217058f7dd892f7f6471b2e5d24f54d858567",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "source-policy-schema",
|
|
57
|
+
path: "spec/plugin/source-policy-v1.schema.json",
|
|
58
|
+
version: "source-policy-v1",
|
|
59
|
+
sha256: "b5f3094402bdbfdda1671b46e5f64a69ad7dc2ba9501030439fafa87acd2923e",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "source-revocations-schema",
|
|
63
|
+
path: "spec/plugin/source-revocations-v1.schema.json",
|
|
64
|
+
version: "source-revocations-v1",
|
|
65
|
+
sha256: "4c4132879a51b31e99775c979ca3ab43c2ee4c5c885f3ff1e7b43cd5ce8bc83d",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "token-ticket-schema",
|
|
69
|
+
path: "spec/plugin/token-ticket-v2.schema.json",
|
|
70
|
+
version: "token-ticket-v2",
|
|
71
|
+
sha256: "f2fa0d5948318a7a61a3e52d1487b308891d65578259d5958b26c59adef0f351",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "iframe-bridge-schema",
|
|
75
|
+
path: "spec/plugin/bridge-v2.schema.json",
|
|
76
|
+
version: "bridge-v2",
|
|
77
|
+
sha256: "6a6f33381503d67fd7c3098e5e73b8d01ba80b0145190bdd034f85fd43528f23",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "opaque-surface-document-schema",
|
|
81
|
+
path: "spec/plugin/opaque-surface-document-v1.schema.json",
|
|
82
|
+
version: "opaque-surface-document-v1",
|
|
83
|
+
sha256: "78ca8f1fb161dd5cdd54d192eb3e147d6f0e6a8b9de01652ecd4b255600ea9b7",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "opaque-surface-transport-schema",
|
|
87
|
+
path: "spec/plugin/opaque-surface-transport-v1.schema.json",
|
|
88
|
+
version: "opaque-surface-transport-v1",
|
|
89
|
+
sha256: "36cd3378393fc8b59da0e3beb345d56db9a52548604177f0adc36e40d4d2b29b",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "compatibility-manifest-schema",
|
|
93
|
+
path: "spec/plugin/compatibility-manifest-v2.schema.json",
|
|
94
|
+
version: "compatibility-manifest-v2",
|
|
95
|
+
sha256: "924c117966bfc322b643e2987d1387f15ebd5222f328171c66eb56d24d281e21",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "release-manifest-schema",
|
|
99
|
+
path: "spec/plugin/release-manifest-v2.schema.json",
|
|
100
|
+
version: "release-manifest-v2",
|
|
101
|
+
sha256: "4406be65353d6d6e059cc0bd279c6ffc53c4250dd5407e7435b30b2fd6a0f582",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "worker-invocation-schema",
|
|
105
|
+
path: "spec/plugin/worker-invocation-v1.schema.json",
|
|
106
|
+
version: "worker-invocation-v1",
|
|
107
|
+
sha256: "cbbef78febae6d13d914bf382d22f2d9785d0bac158eb92d18a2815d5c70dbe6",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "error-codes-schema",
|
|
111
|
+
path: "spec/plugin/error-codes-v1.schema.json",
|
|
112
|
+
version: "error-codes-v1",
|
|
113
|
+
sha256: "89c95342f689b0ad486631f85ce73d4ffc86babe4e827ac6c2337e50bddc536e",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "rust-ipc-schema",
|
|
117
|
+
path: "spec/plugin/ipc-v1.schema.json",
|
|
118
|
+
version: "rust-ipc-v1",
|
|
119
|
+
sha256: "4e3a9556392b06b805f36fe80c5690408d702a72d71ac6f6e3edcb31f2fd0e91",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "wasm-worker-schema",
|
|
123
|
+
path: "spec/plugin/wasm-worker-v1.schema.json",
|
|
124
|
+
version: "redevplugin-wasm-worker-v1",
|
|
125
|
+
sha256: "ff0a37ea972db7d8be89b529e03d890af00aab3f2d9461c2db3a3d58c664b775",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: "network-grant-schema",
|
|
129
|
+
path: "spec/plugin/network-grant-v1.schema.json",
|
|
130
|
+
version: "network-grant-v1",
|
|
131
|
+
sha256: "e3ba8e7aa42267596b5570c1de60994a0912b125ea78427776db8092c2b3ea7b",
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: "target-classifier-fixture",
|
|
135
|
+
path: "spec/plugin/target-classifier-v1.json",
|
|
136
|
+
version: "target-classifier-v1",
|
|
137
|
+
sha256: "7e9367d624c22d575ae5c118063c1cb0f0de6b5b0081eabcfc51c0357e4d14d7",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "contract-registry",
|
|
141
|
+
path: "spec/plugin/contract-registry-v1.json",
|
|
142
|
+
version: "contract-registry-v1",
|
|
143
|
+
sha256: "753d9e86abc10957ee2a80ae87b5ebf1b83af70370afc1c4e838efa6854eb8f9",
|
|
144
|
+
},
|
|
145
|
+
];
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const pluginPlatformErrorCodes: readonly ["PLUGIN_INVALID_REQUEST", "PLUGIN_MANIFEST_INVALID", "PLUGIN_PACKAGE_INVALID", "PLUGIN_PACKAGE_TOO_LARGE", "PLUGIN_PACKAGE_PATH_FORBIDDEN", "PLUGIN_SIGNATURE_INVALID", "PLUGIN_TRUST_STATE_DENIED", "PLUGIN_TRUST_VERIFICATION_REQUIRED", "PLUGIN_TRUST_VERIFICATION_INVALID", "PLUGIN_RELEASE_REF_VERIFICATION_FAILED", "PLUGIN_RELEASE_REF_POLICY_DENIED", "PLUGIN_DISABLED", "PLUGIN_DISABLED_BY_POLICY", "PLUGIN_PERMISSION_DENIED", "PLUGIN_CONFIRMATION_REQUIRED", "PLUGIN_CONFIRMATION_INVALID", "PLUGIN_TOKEN_EXPIRED", "PLUGIN_TOKEN_REPLAY", "PLUGIN_GATEWAY_TOKEN_INVALID", "PLUGIN_GATEWAY_TOKEN_REPLAYED", "PLUGIN_GATEWAY_TOKEN_CHANNEL_MISMATCH", "PLUGIN_ASSET_TICKET_INVALID", "PLUGIN_ASSET_SESSION_INVALID", "PLUGIN_STREAM_TICKET_INVALID", "PLUGIN_STREAM_CANCELLED", "PLUGIN_LEASE_INVALID", "PLUGIN_LEASE_REPLAYED", "PLUGIN_GRANT_INVALID", "PLUGIN_STORAGE_QUOTA_EXCEEDED", "PLUGIN_OPERATION_BLOCKED", "PLUGIN_OPERATION_NOT_FOUND", "PLUGIN_OPERATION_NOT_CANCELABLE", "PLUGIN_NETWORK_TARGET_DENIED", "PLUGIN_NETWORK_RATE_LIMITED", "PLUGIN_RUNTIME_UNAVAILABLE", "PLUGIN_RUNTIME_VERSION_MISMATCH", "PLUGIN_JSON_LIMIT_EXCEEDED", "PLUGIN_CONTRACT_MISMATCH", "PLUGIN_STATE_VERSION_MISMATCH", "PLUGIN_CSRF_REQUIRED", "PLUGIN_RETAINED_DATA_CLEANUP_FAILED", "PLUGIN_RETAINED_DATA_BIND_FAILED"];
|
|
2
|
+
export declare const pluginBridgeErrorCodes: readonly ["PLUGIN_INVALID_REQUEST", "PLUGIN_MANIFEST_INVALID", "PLUGIN_PACKAGE_INVALID", "PLUGIN_PACKAGE_TOO_LARGE", "PLUGIN_PACKAGE_PATH_FORBIDDEN", "PLUGIN_SIGNATURE_INVALID", "PLUGIN_TRUST_STATE_DENIED", "PLUGIN_TRUST_VERIFICATION_REQUIRED", "PLUGIN_TRUST_VERIFICATION_INVALID", "PLUGIN_RELEASE_REF_VERIFICATION_FAILED", "PLUGIN_RELEASE_REF_POLICY_DENIED", "PLUGIN_DISABLED", "PLUGIN_DISABLED_BY_POLICY", "PLUGIN_PERMISSION_DENIED", "PLUGIN_CONFIRMATION_REQUIRED", "PLUGIN_CONFIRMATION_INVALID", "PLUGIN_TOKEN_EXPIRED", "PLUGIN_TOKEN_REPLAY", "PLUGIN_GATEWAY_TOKEN_INVALID", "PLUGIN_GATEWAY_TOKEN_REPLAYED", "PLUGIN_GATEWAY_TOKEN_CHANNEL_MISMATCH", "PLUGIN_ASSET_TICKET_INVALID", "PLUGIN_ASSET_SESSION_INVALID", "PLUGIN_STREAM_TICKET_INVALID", "PLUGIN_STREAM_CANCELLED", "PLUGIN_LEASE_INVALID", "PLUGIN_LEASE_REPLAYED", "PLUGIN_GRANT_INVALID", "PLUGIN_STORAGE_QUOTA_EXCEEDED", "PLUGIN_OPERATION_BLOCKED", "PLUGIN_OPERATION_NOT_FOUND", "PLUGIN_OPERATION_NOT_CANCELABLE", "PLUGIN_NETWORK_TARGET_DENIED", "PLUGIN_NETWORK_RATE_LIMITED", "PLUGIN_RUNTIME_UNAVAILABLE", "PLUGIN_RUNTIME_VERSION_MISMATCH", "PLUGIN_JSON_LIMIT_EXCEEDED", "PLUGIN_CONTRACT_MISMATCH", "PLUGIN_STATE_VERSION_MISMATCH", "PLUGIN_CSRF_REQUIRED", "PLUGIN_RETAINED_DATA_CLEANUP_FAILED", "PLUGIN_RETAINED_DATA_BIND_FAILED", "PLUGIN_CONFIRMATION_REJECTED", "PLUGIN_BRIDGE_TIMEOUT", "PLUGIN_BRIDGE_DISPOSED", "PLUGIN_BRIDGE_HANDSHAKE_FAILED", "PLUGIN_BRIDGE_HANDSHAKE_REQUIRED"];
|
|
3
|
+
export declare const pluginClientErrorCodes: readonly ["PLUGIN_INVALID_REQUEST", "PLUGIN_MANIFEST_INVALID", "PLUGIN_PACKAGE_INVALID", "PLUGIN_PACKAGE_TOO_LARGE", "PLUGIN_PACKAGE_PATH_FORBIDDEN", "PLUGIN_SIGNATURE_INVALID", "PLUGIN_TRUST_STATE_DENIED", "PLUGIN_TRUST_VERIFICATION_REQUIRED", "PLUGIN_TRUST_VERIFICATION_INVALID", "PLUGIN_RELEASE_REF_VERIFICATION_FAILED", "PLUGIN_RELEASE_REF_POLICY_DENIED", "PLUGIN_DISABLED", "PLUGIN_DISABLED_BY_POLICY", "PLUGIN_PERMISSION_DENIED", "PLUGIN_CONFIRMATION_REQUIRED", "PLUGIN_CONFIRMATION_INVALID", "PLUGIN_TOKEN_EXPIRED", "PLUGIN_TOKEN_REPLAY", "PLUGIN_GATEWAY_TOKEN_INVALID", "PLUGIN_GATEWAY_TOKEN_REPLAYED", "PLUGIN_GATEWAY_TOKEN_CHANNEL_MISMATCH", "PLUGIN_ASSET_TICKET_INVALID", "PLUGIN_ASSET_SESSION_INVALID", "PLUGIN_STREAM_TICKET_INVALID", "PLUGIN_STREAM_CANCELLED", "PLUGIN_LEASE_INVALID", "PLUGIN_LEASE_REPLAYED", "PLUGIN_GRANT_INVALID", "PLUGIN_STORAGE_QUOTA_EXCEEDED", "PLUGIN_OPERATION_BLOCKED", "PLUGIN_OPERATION_NOT_FOUND", "PLUGIN_OPERATION_NOT_CANCELABLE", "PLUGIN_NETWORK_TARGET_DENIED", "PLUGIN_NETWORK_RATE_LIMITED", "PLUGIN_RUNTIME_UNAVAILABLE", "PLUGIN_RUNTIME_VERSION_MISMATCH", "PLUGIN_JSON_LIMIT_EXCEEDED", "PLUGIN_CONTRACT_MISMATCH", "PLUGIN_STATE_VERSION_MISMATCH", "PLUGIN_CSRF_REQUIRED", "PLUGIN_RETAINED_DATA_CLEANUP_FAILED", "PLUGIN_RETAINED_DATA_BIND_FAILED", "PLUGIN_CONFIRMATION_REJECTED", "PLUGIN_BRIDGE_TIMEOUT", "PLUGIN_BRIDGE_DISPOSED", "PLUGIN_BRIDGE_HANDSHAKE_FAILED", "PLUGIN_BRIDGE_HANDSHAKE_REQUIRED", "PLUGIN_PLATFORM_REQUEST_FAILED", "PLUGIN_STREAM_FAILED"];
|
|
4
|
+
export type PluginPlatformErrorCode = typeof pluginPlatformErrorCodes[number];
|
|
5
|
+
export type PluginBridgeErrorCode = typeof pluginBridgeErrorCodes[number];
|
|
6
|
+
export type PluginClientErrorCode = typeof pluginClientErrorCodes[number];
|
|
7
|
+
export declare class PluginBridgeError extends Error {
|
|
8
|
+
readonly errorCode: string;
|
|
9
|
+
readonly data?: unknown;
|
|
10
|
+
readonly details?: unknown;
|
|
11
|
+
constructor(errorCode: string, message: string, data?: unknown, details?: unknown);
|
|
12
|
+
}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export const pluginPlatformErrorCodes = [
|
|
2
|
+
"PLUGIN_INVALID_REQUEST",
|
|
3
|
+
"PLUGIN_MANIFEST_INVALID",
|
|
4
|
+
"PLUGIN_PACKAGE_INVALID",
|
|
5
|
+
"PLUGIN_PACKAGE_TOO_LARGE",
|
|
6
|
+
"PLUGIN_PACKAGE_PATH_FORBIDDEN",
|
|
7
|
+
"PLUGIN_SIGNATURE_INVALID",
|
|
8
|
+
"PLUGIN_TRUST_STATE_DENIED",
|
|
9
|
+
"PLUGIN_TRUST_VERIFICATION_REQUIRED",
|
|
10
|
+
"PLUGIN_TRUST_VERIFICATION_INVALID",
|
|
11
|
+
"PLUGIN_RELEASE_REF_VERIFICATION_FAILED",
|
|
12
|
+
"PLUGIN_RELEASE_REF_POLICY_DENIED",
|
|
13
|
+
"PLUGIN_DISABLED",
|
|
14
|
+
"PLUGIN_DISABLED_BY_POLICY",
|
|
15
|
+
"PLUGIN_PERMISSION_DENIED",
|
|
16
|
+
"PLUGIN_CONFIRMATION_REQUIRED",
|
|
17
|
+
"PLUGIN_CONFIRMATION_INVALID",
|
|
18
|
+
"PLUGIN_TOKEN_EXPIRED",
|
|
19
|
+
"PLUGIN_TOKEN_REPLAY",
|
|
20
|
+
"PLUGIN_GATEWAY_TOKEN_INVALID",
|
|
21
|
+
"PLUGIN_GATEWAY_TOKEN_REPLAYED",
|
|
22
|
+
"PLUGIN_GATEWAY_TOKEN_CHANNEL_MISMATCH",
|
|
23
|
+
"PLUGIN_ASSET_TICKET_INVALID",
|
|
24
|
+
"PLUGIN_ASSET_SESSION_INVALID",
|
|
25
|
+
"PLUGIN_STREAM_TICKET_INVALID",
|
|
26
|
+
"PLUGIN_STREAM_CANCELLED",
|
|
27
|
+
"PLUGIN_LEASE_INVALID",
|
|
28
|
+
"PLUGIN_LEASE_REPLAYED",
|
|
29
|
+
"PLUGIN_GRANT_INVALID",
|
|
30
|
+
"PLUGIN_STORAGE_QUOTA_EXCEEDED",
|
|
31
|
+
"PLUGIN_OPERATION_BLOCKED",
|
|
32
|
+
"PLUGIN_OPERATION_NOT_FOUND",
|
|
33
|
+
"PLUGIN_OPERATION_NOT_CANCELABLE",
|
|
34
|
+
"PLUGIN_NETWORK_TARGET_DENIED",
|
|
35
|
+
"PLUGIN_NETWORK_RATE_LIMITED",
|
|
36
|
+
"PLUGIN_RUNTIME_UNAVAILABLE",
|
|
37
|
+
"PLUGIN_RUNTIME_VERSION_MISMATCH",
|
|
38
|
+
"PLUGIN_JSON_LIMIT_EXCEEDED",
|
|
39
|
+
"PLUGIN_CONTRACT_MISMATCH",
|
|
40
|
+
"PLUGIN_STATE_VERSION_MISMATCH",
|
|
41
|
+
"PLUGIN_CSRF_REQUIRED",
|
|
42
|
+
"PLUGIN_RETAINED_DATA_CLEANUP_FAILED",
|
|
43
|
+
"PLUGIN_RETAINED_DATA_BIND_FAILED",
|
|
44
|
+
];
|
|
45
|
+
export const pluginBridgeErrorCodes = [
|
|
46
|
+
...pluginPlatformErrorCodes,
|
|
47
|
+
"PLUGIN_CONFIRMATION_REJECTED",
|
|
48
|
+
"PLUGIN_BRIDGE_TIMEOUT",
|
|
49
|
+
"PLUGIN_BRIDGE_DISPOSED",
|
|
50
|
+
"PLUGIN_BRIDGE_HANDSHAKE_FAILED",
|
|
51
|
+
"PLUGIN_BRIDGE_HANDSHAKE_REQUIRED",
|
|
52
|
+
];
|
|
53
|
+
export const pluginClientErrorCodes = [
|
|
54
|
+
...pluginBridgeErrorCodes,
|
|
55
|
+
"PLUGIN_PLATFORM_REQUEST_FAILED",
|
|
56
|
+
"PLUGIN_STREAM_FAILED",
|
|
57
|
+
];
|
|
58
|
+
export class PluginBridgeError extends Error {
|
|
59
|
+
errorCode;
|
|
60
|
+
data;
|
|
61
|
+
details;
|
|
62
|
+
constructor(errorCode, message, data, details) {
|
|
63
|
+
super(message);
|
|
64
|
+
this.name = "PluginBridgeError";
|
|
65
|
+
this.errorCode = errorCode;
|
|
66
|
+
this.data = data;
|
|
67
|
+
this.details = details ?? data;
|
|
68
|
+
}
|
|
69
|
+
}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type FetchLike = (input: string, init: FetchInitLike) => Promise<FetchResponseLike>;
|
|
2
|
+
export type FetchInitLike = {
|
|
3
|
+
method: string;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
body?: string;
|
|
6
|
+
credentials?: "same-origin" | "include" | "omit";
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
keepalive?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type FetchResponseLike = {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
status: number;
|
|
13
|
+
json(): Promise<unknown>;
|
|
14
|
+
};
|
|
15
|
+
export type HostEnvelope<T> = {
|
|
16
|
+
ok: true;
|
|
17
|
+
data?: T;
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
data?: unknown;
|
|
21
|
+
error?: string;
|
|
22
|
+
error_code?: string;
|
|
23
|
+
error_details?: Record<string, unknown>;
|
|
24
|
+
};
|
|
25
|
+
export declare function defaultFetch(): FetchLike;
|
|
26
|
+
export declare function trimTrailingSlash(value: string): string;
|
|
27
|
+
export declare function readHostEnvelope<T>(response: FetchResponseLike, fallbackCode: string): Promise<T>;
|
|
28
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
29
|
+
export declare function hasExactKeys(value: unknown, keys: readonly string[]): value is Record<string, unknown>;
|
|
30
|
+
export declare function hasAllowedKeys(value: unknown, keys: readonly string[]): value is Record<string, unknown>;
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { PluginBridgeError } from "./errors.js";
|
|
2
|
+
export function defaultFetch() {
|
|
3
|
+
const fetchLike = globalThis.fetch;
|
|
4
|
+
if (!fetchLike) {
|
|
5
|
+
throw new Error("fetch is required when globalThis.fetch is unavailable");
|
|
6
|
+
}
|
|
7
|
+
return fetchLike.bind(globalThis);
|
|
8
|
+
}
|
|
9
|
+
export function trimTrailingSlash(value) {
|
|
10
|
+
return value.endsWith("/") ? value.slice(0, -1) : value;
|
|
11
|
+
}
|
|
12
|
+
export async function readHostEnvelope(response, fallbackCode) {
|
|
13
|
+
const raw = await response.json();
|
|
14
|
+
if (!isHostEnvelope(raw)) {
|
|
15
|
+
throw new PluginBridgeError("PLUGIN_CONTRACT_MISMATCH", `Plugin platform endpoint returned an invalid envelope with HTTP ${response.status}`);
|
|
16
|
+
}
|
|
17
|
+
if (!raw.ok) {
|
|
18
|
+
throw new PluginBridgeError(raw.error_code ?? fallbackCode, raw.error ?? `Plugin platform endpoint failed with HTTP ${response.status}`, raw.data, raw.error_details ?? raw.data);
|
|
19
|
+
}
|
|
20
|
+
return raw.data;
|
|
21
|
+
}
|
|
22
|
+
export function isRecord(value) {
|
|
23
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24
|
+
}
|
|
25
|
+
export function hasExactKeys(value, keys) {
|
|
26
|
+
if (!isRecord(value))
|
|
27
|
+
return false;
|
|
28
|
+
const actual = Object.keys(value).sort();
|
|
29
|
+
const expected = [...keys].sort();
|
|
30
|
+
return actual.length === expected.length && actual.every((key, index) => key === expected[index]);
|
|
31
|
+
}
|
|
32
|
+
export function hasAllowedKeys(value, keys) {
|
|
33
|
+
return isRecord(value) && Object.keys(value).every((key) => keys.includes(key));
|
|
34
|
+
}
|
|
35
|
+
function isHostEnvelope(value) {
|
|
36
|
+
if (!isRecord(value) || typeof value.ok !== "boolean") {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (value.ok) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return (value.error == null || typeof value.error === "string") &&
|
|
43
|
+
(value.error_code == null || typeof value.error_code === "string") &&
|
|
44
|
+
(value.error_details == null || isRecord(value.error_details));
|
|
45
|
+
}
|