@d2m/april 0.0.0-stage → 0.1.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.d.ts +116 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +1046 -0
- package/dist/bridge.js.map +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +188 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +18 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +85 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/initialization.d.ts +46 -0
- package/dist/internal/initialization.d.ts.map +1 -0
- package/dist/internal/initialization.js +569 -0
- package/dist/internal/initialization.js.map +1 -0
- package/dist/internal/modules.d.ts +54 -0
- package/dist/internal/modules.d.ts.map +1 -0
- package/dist/internal/modules.js +318 -0
- package/dist/internal/modules.js.map +1 -0
- package/dist/internal/mount.d.ts +21 -0
- package/dist/internal/mount.d.ts.map +1 -0
- package/dist/internal/mount.js +305 -0
- package/dist/internal/mount.js.map +1 -0
- package/dist/internal/shell-core-entry.d.ts +2 -0
- package/dist/internal/shell-core-entry.d.ts.map +1 -0
- package/dist/internal/shell-core-entry.js +63 -0
- package/dist/internal/shell-core-entry.js.map +1 -0
- package/dist/internal/shell-core-modules.d.ts +6 -0
- package/dist/internal/shell-core-modules.d.ts.map +1 -0
- package/dist/internal/shell-core-modules.js +218 -0
- package/dist/internal/shell-core-modules.js.map +1 -0
- package/dist/internal/shell-core.d.ts +17 -0
- package/dist/internal/shell-core.d.ts.map +1 -0
- package/dist/internal/shell-core.js +2 -0
- package/dist/internal/shell-core.js.map +1 -0
- package/dist/internal/shell-transport.d.ts +12 -0
- package/dist/internal/shell-transport.d.ts.map +1 -0
- package/dist/internal/shell-transport.js +33 -0
- package/dist/internal/shell-transport.js.map +1 -0
- package/dist/types.d.ts +123 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +21 -3
- package/README.md +0 -3
package/dist/bridge.d.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type AprilLocale } from "./errors.js";
|
|
2
|
+
import type { AprilCapabilityDescriptor, AprilError, AprilShellConfiguration, AprilSubscription, AprilSubscriptionObserver } from "./types.js";
|
|
3
|
+
import type { AprilBridgeSession } from "./internal/initialization.js";
|
|
4
|
+
export type AprilCoreModuleOperation = "openRegistry" | "inspectRegistry" | "closeRegistry" | "install" | "abortInstall" | "openFinalization" | "finalize" | "abortFinalization" | "dispose";
|
|
5
|
+
export interface AprilCoreModuleCapabilityReference {
|
|
6
|
+
readonly capability: string;
|
|
7
|
+
readonly action: string;
|
|
8
|
+
readonly contractVersion: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AprilCoreModuleMount {
|
|
11
|
+
readonly target: "april";
|
|
12
|
+
readonly path: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AprilCoreModuleCommand {
|
|
15
|
+
readonly operation: AprilCoreModuleOperation;
|
|
16
|
+
readonly moduleId?: string;
|
|
17
|
+
readonly pluginCode?: string;
|
|
18
|
+
readonly pluginVersion?: string;
|
|
19
|
+
readonly mounts?: readonly AprilCoreModuleMount[];
|
|
20
|
+
readonly dependsOn?: readonly string[];
|
|
21
|
+
readonly capabilities?: readonly AprilCoreModuleCapabilityReference[];
|
|
22
|
+
readonly effectiveLocale?: AprilLocale;
|
|
23
|
+
}
|
|
24
|
+
export interface AprilCoreModuleCommandResult {
|
|
25
|
+
readonly operation: AprilCoreModuleOperation;
|
|
26
|
+
readonly succeeded: boolean;
|
|
27
|
+
readonly error?: AprilError;
|
|
28
|
+
readonly moduleId?: string;
|
|
29
|
+
}
|
|
30
|
+
export type AprilShellCommandOperation = "configure" | "minimize" | "close" | "refresh";
|
|
31
|
+
export type AprilCoreModuleCommandHandler = (command: AprilCoreModuleCommand) => Promise<AprilCoreModuleCommandResult>;
|
|
32
|
+
export interface AprilBridgeMessage {
|
|
33
|
+
readonly protocolVersion: string;
|
|
34
|
+
readonly bridgeId: string;
|
|
35
|
+
readonly sender: "page" | "shell";
|
|
36
|
+
readonly pageSequence: number;
|
|
37
|
+
readonly shellSequence: number;
|
|
38
|
+
readonly callId?: string;
|
|
39
|
+
readonly kind: "coreReady" | "coreReadyResult" | "coreModuleCommand" | "coreModuleResult" | "shellCommand" | "shellCommandResult" | "call" | "subscribe" | "unsubscribe" | "cancel" | "accepted" | "result" | "event" | "complete" | "error" | "bridgeClosed";
|
|
40
|
+
readonly invocationKind?: "call" | "connect";
|
|
41
|
+
readonly correlationId?: string;
|
|
42
|
+
readonly bridgeToken?: string;
|
|
43
|
+
readonly capability?: string;
|
|
44
|
+
readonly action?: string;
|
|
45
|
+
readonly contractVersion?: string;
|
|
46
|
+
readonly payload?: unknown;
|
|
47
|
+
readonly connectionRef?: string;
|
|
48
|
+
readonly requestKind?: "call" | "subscribe" | "unsubscribe" | "cancel";
|
|
49
|
+
readonly sessionId?: string;
|
|
50
|
+
readonly pageContextId?: string;
|
|
51
|
+
readonly eventName?: string;
|
|
52
|
+
readonly succeeded?: boolean;
|
|
53
|
+
readonly error?: unknown;
|
|
54
|
+
readonly completed?: boolean;
|
|
55
|
+
readonly reason?: string;
|
|
56
|
+
readonly operation?: AprilCoreModuleOperation | AprilShellCommandOperation;
|
|
57
|
+
readonly moduleId?: string;
|
|
58
|
+
readonly pluginCode?: string;
|
|
59
|
+
readonly pluginVersion?: string;
|
|
60
|
+
readonly mounts?: readonly AprilCoreModuleMount[];
|
|
61
|
+
readonly dependsOn?: readonly string[];
|
|
62
|
+
readonly capabilities?: readonly AprilCoreModuleCapabilityReference[];
|
|
63
|
+
readonly effectiveLocale?: AprilLocale;
|
|
64
|
+
readonly configuration?: AprilShellConfiguration;
|
|
65
|
+
}
|
|
66
|
+
export declare class AprilBridgeClient {
|
|
67
|
+
private readonly session;
|
|
68
|
+
private readonly effectiveLocale;
|
|
69
|
+
private readonly coreModuleCommandHandler?;
|
|
70
|
+
private readonly calls;
|
|
71
|
+
private readonly subscriptions;
|
|
72
|
+
private readonly inbound;
|
|
73
|
+
private readonly removeMessageListener;
|
|
74
|
+
private closed;
|
|
75
|
+
private pageSequence;
|
|
76
|
+
private lastDeliveredPageSequence;
|
|
77
|
+
private shellSequence;
|
|
78
|
+
private lastAcknowledgedPageSequence;
|
|
79
|
+
private outbound;
|
|
80
|
+
private coreReadyPending;
|
|
81
|
+
private readonly shellCommands;
|
|
82
|
+
constructor(session: AprilBridgeSession, effectiveLocale: AprilLocale, inboundQueueCapacity?: number, coreModuleCommandHandler?: AprilCoreModuleCommandHandler | undefined);
|
|
83
|
+
call<TPayload, TResult>(descriptor: AprilCapabilityDescriptor, payload: TPayload, signal: AbortSignal | undefined, connectionRef: string | undefined): Promise<TResult>;
|
|
84
|
+
sendShellCommand(operation: AprilShellCommandOperation, configuration?: AprilShellConfiguration): Promise<void>;
|
|
85
|
+
ensureCoreReady(): Promise<void>;
|
|
86
|
+
connect<TPayload, TResult>(descriptor: AprilCapabilityDescriptor, payload: TPayload, signal: AbortSignal | undefined): Promise<AprilBridgeConnectionResult<TResult>>;
|
|
87
|
+
private startCall;
|
|
88
|
+
subscribe<TPayload, TEvent>(descriptor: AprilCapabilityDescriptor, payload: TPayload, observer: AprilSubscriptionObserver<TEvent>, signal: AbortSignal | undefined, connectionRef: string | undefined): Promise<AprilSubscription>;
|
|
89
|
+
dispose(error?: AprilError): Promise<void>;
|
|
90
|
+
private sendRequest;
|
|
91
|
+
private sendCancellation;
|
|
92
|
+
private sendUnsubscribe;
|
|
93
|
+
private cancelSubscriptionFromPage;
|
|
94
|
+
private send;
|
|
95
|
+
private deliver;
|
|
96
|
+
private receive;
|
|
97
|
+
private isValidInboundMessage;
|
|
98
|
+
private acceptRequest;
|
|
99
|
+
private completeCoreReady;
|
|
100
|
+
private completeCoreModuleCommand;
|
|
101
|
+
private completeShellCommand;
|
|
102
|
+
private completeResult;
|
|
103
|
+
private completeError;
|
|
104
|
+
private publishEvent;
|
|
105
|
+
private completeSubscription;
|
|
106
|
+
private closeInvalidInbound;
|
|
107
|
+
private createSubscription;
|
|
108
|
+
private finishSubscription;
|
|
109
|
+
private close;
|
|
110
|
+
}
|
|
111
|
+
interface AprilBridgeConnectionResult<TResult> {
|
|
112
|
+
readonly value: TResult;
|
|
113
|
+
readonly connectionRef: string;
|
|
114
|
+
}
|
|
115
|
+
export {};
|
|
116
|
+
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuD,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAEpG,OAAO,KAAK,EACV,yBAAyB,EACzB,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAwCvE,MAAM,MAAM,wBAAwB,GAChC,cAAc,GACd,iBAAiB,GACjB,eAAe,GACf,SAAS,GACT,cAAc,GACd,kBAAkB,GAClB,UAAU,GACV,mBAAmB,GACnB,SAAS,CAAC;AAEd,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC;IA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