@floegence/redevplugin-ui 0.0.0-dev → 0.1.6
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/index.d.ts +72 -13
- package/dist/index.js +8 -9
- package/dist/local-import.d.ts +15 -0
- package/dist/local-import.js +76 -0
- package/package.json +14 -2
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export type BridgeLifecycleEvent = {
|
|
|
7
7
|
} | {
|
|
8
8
|
type: "dispose";
|
|
9
9
|
};
|
|
10
|
-
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_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_CSRF_REQUIRED", "PLUGIN_RETAINED_DATA_CLEANUP_FAILED", "PLUGIN_RETAINED_DATA_BIND_FAILED"];
|
|
11
|
-
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_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_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"];
|
|
12
|
-
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_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_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"];
|
|
10
|
+
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_CSRF_REQUIRED", "PLUGIN_RETAINED_DATA_CLEANUP_FAILED", "PLUGIN_RETAINED_DATA_BIND_FAILED"];
|
|
11
|
+
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_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"];
|
|
12
|
+
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_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"];
|
|
13
13
|
export type PluginPlatformErrorCode = typeof pluginPlatformErrorCodes[number];
|
|
14
14
|
export type PluginBridgeErrorCode = typeof pluginBridgeErrorCodes[number];
|
|
15
15
|
export type PluginClientErrorCode = typeof pluginClientErrorCodes[number];
|
|
@@ -281,6 +281,9 @@ export type PluginCompatibilityMatrix = {
|
|
|
281
281
|
wasm_abi_version: string;
|
|
282
282
|
manifest_schema_version: string;
|
|
283
283
|
package_signature_schema_version: string;
|
|
284
|
+
release_metadata_schema_version: string;
|
|
285
|
+
source_policy_schema_version: string;
|
|
286
|
+
source_revocations_schema_version: string;
|
|
284
287
|
token_ticket_schema_version: string;
|
|
285
288
|
bridge_schema_version: string;
|
|
286
289
|
target_classifier_version: string;
|
|
@@ -304,10 +307,50 @@ export type PluginCompatibilityManifest = {
|
|
|
304
307
|
contracts: PluginContractArtifact[];
|
|
305
308
|
[key: string]: unknown;
|
|
306
309
|
};
|
|
307
|
-
export type PluginTrustState = "
|
|
310
|
+
export type PluginTrustState = "verified" | "unsigned_local" | "untrusted" | "needs_review" | "trust_unavailable" | "blocked_security";
|
|
308
311
|
export type PluginEnableState = "disabled" | "enabled" | "disabled_by_policy";
|
|
309
312
|
export type PluginRetainedDataRecordState = "retained" | "expired" | "bound" | "deleted" | "delete_failed_retryable";
|
|
310
313
|
export type PluginRetainedDataState = "none" | PluginRetainedDataRecordState;
|
|
314
|
+
export type PluginTrustHashSet = {
|
|
315
|
+
package_sha256: string;
|
|
316
|
+
manifest_sha256: string;
|
|
317
|
+
entries_sha256: string;
|
|
318
|
+
};
|
|
319
|
+
export type PluginVerifiedSignature = {
|
|
320
|
+
algorithm: string;
|
|
321
|
+
key_id: string;
|
|
322
|
+
};
|
|
323
|
+
export type PluginTrustAssessment = {
|
|
324
|
+
trust_state: PluginTrustState | string;
|
|
325
|
+
reason_codes?: string[];
|
|
326
|
+
verified_hashes: PluginTrustHashSet;
|
|
327
|
+
verified_signature?: PluginVerifiedSignature;
|
|
328
|
+
trust_assessment_epoch?: string;
|
|
329
|
+
policy_epoch?: string;
|
|
330
|
+
revocation_epoch?: string;
|
|
331
|
+
metadata?: Record<string, string>;
|
|
332
|
+
};
|
|
333
|
+
export type PluginLocalImportProvenance = {
|
|
334
|
+
import_id: string;
|
|
335
|
+
distribution: "local_import" | string;
|
|
336
|
+
policy_epoch: string;
|
|
337
|
+
unsigned_policy: "dev_only" | "review_required" | "block" | string;
|
|
338
|
+
assessed_at: string;
|
|
339
|
+
};
|
|
340
|
+
export type PluginVersionRecord = {
|
|
341
|
+
version: string;
|
|
342
|
+
active_fingerprint: string;
|
|
343
|
+
package_hash: string;
|
|
344
|
+
manifest_hash: string;
|
|
345
|
+
entries_hash: string;
|
|
346
|
+
trust_state: PluginTrustState | string;
|
|
347
|
+
trust_assessment: PluginTrustAssessment;
|
|
348
|
+
source_policy_snapshot_hash?: string;
|
|
349
|
+
source_policy_snapshot?: Record<string, unknown>;
|
|
350
|
+
local_import_provenance?: PluginLocalImportProvenance;
|
|
351
|
+
metadata?: Record<string, string>;
|
|
352
|
+
[key: string]: unknown;
|
|
353
|
+
};
|
|
311
354
|
export type PluginRecord = {
|
|
312
355
|
plugin_instance_id: string;
|
|
313
356
|
publisher_id?: string;
|
|
@@ -318,6 +361,10 @@ export type PluginRecord = {
|
|
|
318
361
|
manifest_hash?: string;
|
|
319
362
|
entries_hash?: string;
|
|
320
363
|
trust_state: PluginTrustState | string;
|
|
364
|
+
trust_assessment: PluginTrustAssessment;
|
|
365
|
+
source_policy_snapshot_hash?: string;
|
|
366
|
+
source_policy_snapshot?: Record<string, unknown>;
|
|
367
|
+
local_import_provenance?: PluginLocalImportProvenance;
|
|
321
368
|
enable_state: PluginEnableState | string;
|
|
322
369
|
disabled_reason?: string;
|
|
323
370
|
retained_data_state?: PluginRetainedDataState | string;
|
|
@@ -326,7 +373,7 @@ export type PluginRecord = {
|
|
|
326
373
|
revoke_epoch?: number;
|
|
327
374
|
manifest?: Record<string, unknown>;
|
|
328
375
|
package_entries?: Array<Record<string, unknown>>;
|
|
329
|
-
version_history?:
|
|
376
|
+
version_history?: PluginVersionRecord[];
|
|
330
377
|
installed_at?: string;
|
|
331
378
|
enabled_at?: string;
|
|
332
379
|
updated_at?: string;
|
|
@@ -334,15 +381,27 @@ export type PluginRecord = {
|
|
|
334
381
|
metadata?: Record<string, string>;
|
|
335
382
|
[key: string]: unknown;
|
|
336
383
|
};
|
|
337
|
-
export type
|
|
338
|
-
|
|
339
|
-
|
|
384
|
+
export type PluginPackageHashSet = {
|
|
385
|
+
package_sha256: string;
|
|
386
|
+
manifest_sha256: string;
|
|
387
|
+
entries_sha256: string;
|
|
388
|
+
};
|
|
389
|
+
export type PluginReleaseRef = {
|
|
390
|
+
source_id: string;
|
|
391
|
+
release_metadata_ref: string;
|
|
392
|
+
release_metadata_sha256: string;
|
|
393
|
+
publisher_id: string;
|
|
394
|
+
plugin_id: string;
|
|
395
|
+
version: string;
|
|
396
|
+
expected_hashes: PluginPackageHashSet;
|
|
397
|
+
};
|
|
398
|
+
export type PluginInstallReleaseRefRequest = {
|
|
399
|
+
release_ref: PluginReleaseRef;
|
|
340
400
|
plugin_instance_id?: string;
|
|
341
401
|
};
|
|
342
|
-
export type
|
|
402
|
+
export type PluginUpdateReleaseRefRequest = {
|
|
343
403
|
plugin_instance_id: string;
|
|
344
|
-
|
|
345
|
-
trust_state?: PluginTrustState | string;
|
|
404
|
+
release_ref: PluginReleaseRef;
|
|
346
405
|
};
|
|
347
406
|
export type PluginDowngradeRequest = {
|
|
348
407
|
plugin_instance_id: string;
|
|
@@ -618,8 +677,8 @@ export declare class PluginPlatformClient {
|
|
|
618
677
|
constructor(options?: PluginPlatformClientOptions);
|
|
619
678
|
catalog(): Promise<PluginCatalogResult>;
|
|
620
679
|
getCompatibility(): Promise<PluginCompatibilityManifest>;
|
|
621
|
-
|
|
622
|
-
|
|
680
|
+
installReleaseRef(request: PluginInstallReleaseRefRequest): Promise<PluginRecord>;
|
|
681
|
+
updateReleaseRef(request: PluginUpdateReleaseRefRequest): Promise<PluginRecord>;
|
|
623
682
|
downgradePlugin(request: PluginDowngradeRequest): Promise<PluginRecord>;
|
|
624
683
|
enablePlugin(pluginInstanceIdOrRequest: string | PluginEnableRequest): Promise<PluginRecord>;
|
|
625
684
|
disablePlugin(request: PluginDisableRequest): Promise<PluginRecord>;
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ export const pluginPlatformErrorCodes = [
|
|
|
8
8
|
"PLUGIN_TRUST_STATE_DENIED",
|
|
9
9
|
"PLUGIN_TRUST_VERIFICATION_REQUIRED",
|
|
10
10
|
"PLUGIN_TRUST_VERIFICATION_INVALID",
|
|
11
|
+
"PLUGIN_RELEASE_REF_VERIFICATION_FAILED",
|
|
12
|
+
"PLUGIN_RELEASE_REF_POLICY_DENIED",
|
|
11
13
|
"PLUGIN_DISABLED",
|
|
12
14
|
"PLUGIN_DISABLED_BY_POLICY",
|
|
13
15
|
"PLUGIN_PERMISSION_DENIED",
|
|
@@ -241,7 +243,7 @@ export class PluginBridgeClient {
|
|
|
241
243
|
this.#lifecycleHandlers.clear();
|
|
242
244
|
}
|
|
243
245
|
#handleMessage(event) {
|
|
244
|
-
if (this.#disposed || event.origin !== this.bootstrap.parentOrigin) {
|
|
246
|
+
if (this.#disposed || event.origin !== this.bootstrap.parentOrigin || event.source !== this.#target) {
|
|
245
247
|
return;
|
|
246
248
|
}
|
|
247
249
|
const data = event.data;
|
|
@@ -297,11 +299,11 @@ export class PluginPlatformClient {
|
|
|
297
299
|
getCompatibility() {
|
|
298
300
|
return this.#getJSON("/_redevplugin/api/plugins/platform/compatibility");
|
|
299
301
|
}
|
|
300
|
-
|
|
301
|
-
return this.#postJSON("/_redevplugin/api/plugins/install", request);
|
|
302
|
+
installReleaseRef(request) {
|
|
303
|
+
return this.#postJSON("/_redevplugin/api/plugins/install-release-ref", request);
|
|
302
304
|
}
|
|
303
|
-
|
|
304
|
-
return this.#postJSON("/_redevplugin/api/plugins/update", request);
|
|
305
|
+
updateReleaseRef(request) {
|
|
306
|
+
return this.#postJSON("/_redevplugin/api/plugins/update-release-ref", request);
|
|
305
307
|
}
|
|
306
308
|
downgradePlugin(request) {
|
|
307
309
|
return this.#postJSON("/_redevplugin/api/plugins/downgrade", request);
|
|
@@ -503,10 +505,7 @@ export class PluginSurfaceHost {
|
|
|
503
505
|
this.#postToIframe({ type: "redevplugin.bridge.lifecycle", event: { type: "dispose" } });
|
|
504
506
|
}
|
|
505
507
|
async #handleMessage(event) {
|
|
506
|
-
if (this.#disposed || event.origin !== this.iframeOrigin) {
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
if (event.source != null && event.source !== this.#iframeWindow) {
|
|
508
|
+
if (this.#disposed || event.origin !== this.iframeOrigin || event.source !== this.#iframeWindow) {
|
|
510
509
|
return;
|
|
511
510
|
}
|
|
512
511
|
const data = event.data;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type PluginPlatformClientOptions, type PluginRecord } from "./index.js";
|
|
2
|
+
export type PluginImportLocalPackageRequest = {
|
|
3
|
+
package_base64: string;
|
|
4
|
+
plugin_instance_id?: string;
|
|
5
|
+
};
|
|
6
|
+
export type PluginUpdateLocalPackageRequest = {
|
|
7
|
+
plugin_instance_id: string;
|
|
8
|
+
package_base64: string;
|
|
9
|
+
};
|
|
10
|
+
export declare class PluginLocalImportClient {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(options?: PluginPlatformClientOptions);
|
|
13
|
+
importLocalPackage(request: PluginImportLocalPackageRequest): Promise<PluginRecord>;
|
|
14
|
+
updateLocalPackage(request: PluginUpdateLocalPackageRequest): Promise<PluginRecord>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { PluginBridgeError, } from "./index.js";
|
|
2
|
+
export class PluginLocalImportClient {
|
|
3
|
+
#fetch;
|
|
4
|
+
#apiBaseURL;
|
|
5
|
+
#ownerSessionHashHeader;
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
this.#fetch = options.fetch ?? defaultFetch();
|
|
8
|
+
this.#apiBaseURL = trimTrailingSlash(options.apiBaseURL ?? "");
|
|
9
|
+
this.#ownerSessionHashHeader = options.ownerSessionHashHeader;
|
|
10
|
+
}
|
|
11
|
+
importLocalPackage(request) {
|
|
12
|
+
return this.#postJSON("/_redevplugin/api/plugins/local-import/install", request);
|
|
13
|
+
}
|
|
14
|
+
updateLocalPackage(request) {
|
|
15
|
+
return this.#postJSON("/_redevplugin/api/plugins/local-import/update", request);
|
|
16
|
+
}
|
|
17
|
+
async #postJSON(path, body) {
|
|
18
|
+
const response = await this.#fetch(this.#apiBaseURL + path, {
|
|
19
|
+
method: "POST",
|
|
20
|
+
headers: this.#headers(),
|
|
21
|
+
body: JSON.stringify(body),
|
|
22
|
+
credentials: "same-origin",
|
|
23
|
+
});
|
|
24
|
+
return readHostEnvelope(response);
|
|
25
|
+
}
|
|
26
|
+
#headers() {
|
|
27
|
+
const headers = {
|
|
28
|
+
"Accept": "application/json",
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
};
|
|
31
|
+
if (this.#ownerSessionHashHeader) {
|
|
32
|
+
headers["X-ReDevPlugin-Owner-Session-Hash"] = this.#ownerSessionHashHeader;
|
|
33
|
+
}
|
|
34
|
+
return headers;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function defaultFetch() {
|
|
38
|
+
const fetchLike = globalThis.fetch;
|
|
39
|
+
if (!fetchLike) {
|
|
40
|
+
throw new Error("fetch is required when globalThis.fetch is unavailable");
|
|
41
|
+
}
|
|
42
|
+
return fetchLike.bind(globalThis);
|
|
43
|
+
}
|
|
44
|
+
function trimTrailingSlash(value) {
|
|
45
|
+
return value.endsWith("/") ? value.slice(0, -1) : value;
|
|
46
|
+
}
|
|
47
|
+
async function readHostEnvelope(response) {
|
|
48
|
+
const raw = await response.json();
|
|
49
|
+
if (!isHostEnvelope(raw)) {
|
|
50
|
+
throw new PluginBridgeError("PLUGIN_CONTRACT_MISMATCH", `Plugin platform endpoint returned an invalid envelope with HTTP ${response.status}`);
|
|
51
|
+
}
|
|
52
|
+
const envelope = raw;
|
|
53
|
+
if (response.ok && envelope.ok) {
|
|
54
|
+
return envelope.data;
|
|
55
|
+
}
|
|
56
|
+
if (envelope.ok) {
|
|
57
|
+
throw new PluginBridgeError("PLUGIN_PLATFORM_REQUEST_FAILED", `Plugin platform request failed with HTTP ${response.status}`, envelope.data);
|
|
58
|
+
}
|
|
59
|
+
const errorCode = envelope.error_code ?? "PLUGIN_PLATFORM_REQUEST_FAILED";
|
|
60
|
+
const message = envelope.error ?? "Plugin platform request failed";
|
|
61
|
+
throw new PluginBridgeError(errorCode, message, envelope.data, envelope.error_details ?? envelope.data);
|
|
62
|
+
}
|
|
63
|
+
function isHostEnvelope(value) {
|
|
64
|
+
if (!isRecord(value) || typeof value.ok !== "boolean") {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (value.ok) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return ((value.error === undefined || typeof value.error === "string") &&
|
|
71
|
+
(value.error_code === undefined || typeof value.error_code === "string") &&
|
|
72
|
+
(value.error_details === undefined || isRecord(value.error_details)));
|
|
73
|
+
}
|
|
74
|
+
function isRecord(value) {
|
|
75
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floegence/redevplugin-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,19 @@
|
|
|
9
9
|
},
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
12
|
-
"
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./local-import": {
|
|
18
|
+
"types": "./dist/local-import.d.ts",
|
|
19
|
+
"default": "./dist/local-import.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
13
25
|
"publishConfig": {
|
|
14
26
|
"access": "public"
|
|
15
27
|
},
|