@floegence/redevplugin-ui 0.4.2 → 0.5.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/dist/bridge-capability.d.ts +7 -0
- package/dist/bridge-capability.js +8 -0
- package/dist/capability-client.d.ts +27 -7
- package/dist/capability-client.js +25 -19
- package/dist/contracts.gen.d.ts +84 -66
- package/dist/contracts.gen.js +87 -66
- package/dist/error-codes.gen.d.ts +4 -0
- package/dist/error-codes.gen.js +206 -0
- package/dist/errors.d.ts +22 -4
- package/dist/errors.js +42 -60
- package/dist/http.d.ts +16 -8
- package/dist/http.js +151 -15
- package/dist/local-import.d.ts +6 -11
- package/dist/local-import.js +58 -13
- package/dist/opaque-surface-policy.gen.d.ts +4 -3
- package/dist/opaque-surface-policy.gen.js +4 -2
- package/dist/openapi.gen.d.ts +3745 -0
- package/dist/openapi.gen.js +5 -0
- package/dist/platform.d.ts +148 -529
- package/dist/platform.js +250 -81
- package/dist/plugin.d.ts +2 -2
- package/dist/surface-scope.d.ts +2 -2
- package/dist/surface-scope.js +22 -6
- package/dist/surface.d.ts +64 -31
- package/dist/surface.js +1430 -200
- package/dist/trusted-parent.d.ts +3 -3
- package/dist/trusted-parent.js +1 -1
- package/dist/ui-patch-validator.d.ts +67 -0
- package/dist/ui-patch-validator.js +125 -0
- package/dist/ui-reconciler.d.ts +10 -0
- package/dist/ui-reconciler.js +283 -0
- package/package.json +1 -1
package/dist/local-import.js
CHANGED
|
@@ -1,32 +1,77 @@
|
|
|
1
|
-
import { defaultFetch,
|
|
1
|
+
import { assertMutationDispatchable, defaultFetch, dispatchMutationRequest, readMutationPlatformResponse, trimTrailingSlash, } from "./http.js";
|
|
2
|
+
import { PluginMutationLifecycleError, pluginMutationOutcome, } from "./errors.js";
|
|
2
3
|
import { defaultPluginSurfaceScope, disposePluginSurfaceScope, } from "./surface-scope.js";
|
|
3
4
|
export class PluginLocalImportClient {
|
|
4
5
|
#fetch;
|
|
5
6
|
#apiBaseURL;
|
|
6
7
|
#surfaceScope;
|
|
8
|
+
#onMutationOutcomeUnknown;
|
|
7
9
|
constructor(options = {}) {
|
|
8
10
|
this.#fetch = options.fetch ?? defaultFetch();
|
|
9
11
|
this.#apiBaseURL = trimTrailingSlash(options.apiBaseURL ?? "");
|
|
10
12
|
this.#surfaceScope = options.surfaceScope ?? defaultPluginSurfaceScope;
|
|
13
|
+
this.#onMutationOutcomeUnknown = options.onMutationOutcomeUnknown;
|
|
11
14
|
}
|
|
12
|
-
importLocalPackage(
|
|
13
|
-
|
|
15
|
+
importLocalPackage(pluginInstanceId, packageBlob, options = {}) {
|
|
16
|
+
const canonicalPluginInstanceId = pluginInstanceId.trim();
|
|
17
|
+
if (!canonicalPluginInstanceId) {
|
|
18
|
+
throw new TypeError("pluginInstanceId is required");
|
|
19
|
+
}
|
|
20
|
+
return this.#requestMutation(`/_redevplugin/api/plugins/local-imports?plugin_instance_id=${encodeURIComponent(canonicalPluginInstanceId)}`, packageBlob, options);
|
|
14
21
|
}
|
|
15
|
-
async updateLocalPackage(
|
|
16
|
-
const
|
|
17
|
-
|
|
22
|
+
async updateLocalPackage(pluginInstanceId, expectedManagementRevision, packageBlob, options = {}) {
|
|
23
|
+
const canonicalPluginInstanceId = pluginInstanceId.trim();
|
|
24
|
+
if (!canonicalPluginInstanceId) {
|
|
25
|
+
throw new TypeError("pluginInstanceId is required");
|
|
26
|
+
}
|
|
27
|
+
let plugin;
|
|
28
|
+
try {
|
|
29
|
+
plugin = await this.#requestMutation(`/_redevplugin/api/plugins/${encodeURIComponent(canonicalPluginInstanceId)}/local-import?expected_management_revision=${encodeURIComponent(String(expectedManagementRevision))}`, packageBlob, options);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (pluginMutationOutcome(error) !== "not_committed") {
|
|
33
|
+
const lifecycleErrors = [];
|
|
34
|
+
try {
|
|
35
|
+
await disposePluginSurfaceScope(this.#surfaceScope, canonicalPluginInstanceId);
|
|
36
|
+
}
|
|
37
|
+
catch (caught) {
|
|
38
|
+
lifecycleErrors.push(caught);
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
this.#onMutationOutcomeUnknown?.(canonicalPluginInstanceId);
|
|
42
|
+
}
|
|
43
|
+
catch (caught) {
|
|
44
|
+
lifecycleErrors.push(caught);
|
|
45
|
+
}
|
|
46
|
+
if (lifecycleErrors.length > 0) {
|
|
47
|
+
throw new PluginMutationLifecycleError("Local plugin update and surface teardown failed", error, lifecycleErrors);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
await disposePluginSurfaceScope(this.#surfaceScope, canonicalPluginInstanceId);
|
|
18
53
|
return plugin;
|
|
19
54
|
}
|
|
20
|
-
async #
|
|
21
|
-
|
|
22
|
-
|
|
55
|
+
async #requestMutation(path, body, options) {
|
|
56
|
+
if (!(body instanceof Blob)) {
|
|
57
|
+
throw new TypeError("package upload must be a Blob");
|
|
58
|
+
}
|
|
59
|
+
const method = path.includes("/local-import?") ? "PUT" : "POST";
|
|
60
|
+
const operation = `${method} ${path}`;
|
|
61
|
+
assertMutationDispatchable(options.signal, operation);
|
|
62
|
+
options.onProgress?.(0, body.size);
|
|
63
|
+
const response = await dispatchMutationRequest(this.#fetch, this.#apiBaseURL + path, {
|
|
64
|
+
method,
|
|
23
65
|
headers: {
|
|
24
66
|
"Accept": "application/json",
|
|
25
|
-
"Content-Type": "application/
|
|
67
|
+
"Content-Type": "application/vnd.redevplugin.package+zip",
|
|
26
68
|
},
|
|
27
|
-
body
|
|
69
|
+
body,
|
|
28
70
|
credentials: "same-origin",
|
|
29
|
-
|
|
30
|
-
|
|
71
|
+
signal: options.signal,
|
|
72
|
+
}, operation);
|
|
73
|
+
const result = await readMutationPlatformResponse(response);
|
|
74
|
+
options.onProgress?.(body.size, body.size);
|
|
75
|
+
return result;
|
|
31
76
|
}
|
|
32
77
|
}
|
|
@@ -4,7 +4,7 @@ export declare const opaqueSurfaceGlobalAttributes: readonly ["id", "class", "ro
|
|
|
4
4
|
export declare const opaqueSurfaceTagAttributes: {
|
|
5
5
|
readonly button: readonly ["type", "name", "value", "disabled", "aria-pressed", "aria-expanded"];
|
|
6
6
|
readonly input: readonly ["type", "name", "value", "checked", "disabled", "readonly", "required", "placeholder", "min", "max", "step", "autocomplete"];
|
|
7
|
-
readonly textarea: readonly ["name", "disabled", "readonly", "required", "placeholder", "rows", "cols", "maxlength"];
|
|
7
|
+
readonly textarea: readonly ["name", "value", "disabled", "readonly", "required", "placeholder", "rows", "cols", "maxlength"];
|
|
8
8
|
readonly select: readonly ["name", "disabled", "required", "multiple", "size"];
|
|
9
9
|
readonly option: readonly ["value", "selected", "disabled", "label"];
|
|
10
10
|
readonly label: readonly ["for"];
|
|
@@ -23,11 +23,12 @@ export declare const opaqueSurfaceTagAttributes: {
|
|
|
23
23
|
};
|
|
24
24
|
export declare const opaqueSurfaceSafeInputTypes: readonly ["text", "search", "number", "checkbox", "radio", "button", "submit", "reset"];
|
|
25
25
|
export declare const opaqueSurfaceRenderLimits: {
|
|
26
|
-
readonly max_message_bytes:
|
|
26
|
+
readonly max_message_bytes: 524288;
|
|
27
27
|
readonly max_in_flight_requests: 256;
|
|
28
|
-
readonly max_renders_per_second:
|
|
28
|
+
readonly max_renders_per_second: 60;
|
|
29
29
|
readonly max_render_depth: 32;
|
|
30
30
|
readonly max_render_nodes: 4096;
|
|
31
|
+
readonly max_patch_operations: 1024;
|
|
31
32
|
readonly max_attributes_per_element: 64;
|
|
32
33
|
readonly max_text_length: 65536;
|
|
33
34
|
readonly max_attribute_value_length: 4096;
|
|
@@ -100,6 +100,7 @@ export const opaqueSurfaceTagAttributes = {
|
|
|
100
100
|
],
|
|
101
101
|
"textarea": [
|
|
102
102
|
"name",
|
|
103
|
+
"value",
|
|
103
104
|
"disabled",
|
|
104
105
|
"readonly",
|
|
105
106
|
"required",
|
|
@@ -203,11 +204,12 @@ export const opaqueSurfaceSafeInputTypes = [
|
|
|
203
204
|
"reset"
|
|
204
205
|
];
|
|
205
206
|
export const opaqueSurfaceRenderLimits = {
|
|
206
|
-
"max_message_bytes":
|
|
207
|
+
"max_message_bytes": 524288,
|
|
207
208
|
"max_in_flight_requests": 256,
|
|
208
|
-
"max_renders_per_second":
|
|
209
|
+
"max_renders_per_second": 60,
|
|
209
210
|
"max_render_depth": 32,
|
|
210
211
|
"max_render_nodes": 4096,
|
|
212
|
+
"max_patch_operations": 1024,
|
|
211
213
|
"max_attributes_per_element": 64,
|
|
212
214
|
"max_text_length": 65536,
|
|
213
215
|
"max_attribute_value_length": 4096,
|