@verentis/sdk 0.2.2 → 0.2.4
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/README.md +24 -0
- package/dist/index.cjs +168 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -5
- package/dist/index.d.ts +98 -5
- package/dist/index.js +168 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -62,6 +62,70 @@ interface VerentisTokenRefreshedMessage extends VerentisMessage {
|
|
|
62
62
|
requestId: string;
|
|
63
63
|
token: TokenInfo;
|
|
64
64
|
}
|
|
65
|
+
/** Single-use credential for the installation's independently registered backend. */
|
|
66
|
+
interface AppBackendCredential {
|
|
67
|
+
delegationId: string;
|
|
68
|
+
backendClientId: string;
|
|
69
|
+
launchCredential: string;
|
|
70
|
+
expiresAt: string;
|
|
71
|
+
}
|
|
72
|
+
interface VerentisBackendCredentialRequest extends VerentisMessage {
|
|
73
|
+
type: 'verentis:backend:request';
|
|
74
|
+
requestId: string;
|
|
75
|
+
sessionId: string;
|
|
76
|
+
}
|
|
77
|
+
interface VerentisBackendCredentialResponse extends VerentisMessage {
|
|
78
|
+
type: 'verentis:backend:response';
|
|
79
|
+
requestId: string;
|
|
80
|
+
sessionId: string;
|
|
81
|
+
credential?: AppBackendCredential;
|
|
82
|
+
error?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Nonsecret active-document metadata. CODE already holds its own scoped credential. */
|
|
85
|
+
interface WopiContinuation {
|
|
86
|
+
sessionId: string;
|
|
87
|
+
workspaceId: string;
|
|
88
|
+
branch: string;
|
|
89
|
+
nodeId: string;
|
|
90
|
+
accessTokenTtl: number;
|
|
91
|
+
fileId: string;
|
|
92
|
+
format: string;
|
|
93
|
+
readOnly: boolean;
|
|
94
|
+
name: string;
|
|
95
|
+
}
|
|
96
|
+
/** Initial document-scoped collaboration authority, never a platform OAuth credential. */
|
|
97
|
+
interface WopiLaunch extends WopiContinuation {
|
|
98
|
+
action: string;
|
|
99
|
+
accessToken: string;
|
|
100
|
+
editorOrigin: string;
|
|
101
|
+
wopiSource: string;
|
|
102
|
+
}
|
|
103
|
+
interface WopiSaveCheckpoint {
|
|
104
|
+
generation: number;
|
|
105
|
+
correlation: string;
|
|
106
|
+
revision?: string | null;
|
|
107
|
+
}
|
|
108
|
+
interface WopiSaveStatus {
|
|
109
|
+
state: string;
|
|
110
|
+
revision: string;
|
|
111
|
+
readOnly: boolean;
|
|
112
|
+
receipt: WopiSaveCheckpoint | null;
|
|
113
|
+
continuationAvailable?: boolean;
|
|
114
|
+
}
|
|
115
|
+
interface VerentisWopiRequest extends VerentisMessage {
|
|
116
|
+
type: 'verentis:wopi:request';
|
|
117
|
+
requestId: string;
|
|
118
|
+
sessionId: string;
|
|
119
|
+
operation: 'launch' | 'status' | 'save' | 'close' | 'continue';
|
|
120
|
+
generation?: number;
|
|
121
|
+
}
|
|
122
|
+
interface VerentisWopiResponse extends VerentisMessage {
|
|
123
|
+
type: 'verentis:wopi:response';
|
|
124
|
+
requestId: string;
|
|
125
|
+
sessionId: string;
|
|
126
|
+
result?: WopiLaunch | WopiContinuation | WopiSaveCheckpoint | WopiSaveStatus | null;
|
|
127
|
+
error?: string;
|
|
128
|
+
}
|
|
65
129
|
interface VerentisFileChangedMessage extends VerentisMessage {
|
|
66
130
|
type: 'verentis:file:changed';
|
|
67
131
|
path: string;
|
|
@@ -99,13 +163,19 @@ interface VerentisDirtyMessage extends VerentisMessage {
|
|
|
99
163
|
type: 'verentis:dirty';
|
|
100
164
|
isDirty: boolean;
|
|
101
165
|
}
|
|
102
|
-
type HostToAppMessage = VerentisInitMessage | VerentisActionInvokeMessage | VerentisTokenRefreshedMessage | VerentisFileChangedMessage | VerentisThemeMessage;
|
|
103
|
-
type AppToHostMessage = VerentisReadyMessage | VerentisActionsSetMessage | VerentisActionResultMessage | VerentisTokenRefreshMessage | VerentisNavigateMessage | VerentisResizeMessage | VerentisTitleMessage | VerentisDirtyMessage;
|
|
166
|
+
type HostToAppMessage = VerentisInitMessage | VerentisActionInvokeMessage | VerentisTokenRefreshedMessage | VerentisFileChangedMessage | VerentisThemeMessage | VerentisBackendCredentialResponse | VerentisWopiResponse;
|
|
167
|
+
type AppToHostMessage = VerentisReadyMessage | VerentisActionsSetMessage | VerentisActionResultMessage | VerentisTokenRefreshMessage | VerentisNavigateMessage | VerentisResizeMessage | VerentisTitleMessage | VerentisDirtyMessage | VerentisBackendCredentialRequest | VerentisWopiRequest;
|
|
104
168
|
type AppSurface = 'file' | 'workspace';
|
|
105
169
|
interface AppContextBase {
|
|
106
170
|
workspace: WorkspaceInfo;
|
|
107
171
|
entryPoint?: EntryPointInfo;
|
|
108
172
|
apiUrl: string;
|
|
173
|
+
installation?: {
|
|
174
|
+
id: string;
|
|
175
|
+
backendClientId?: string;
|
|
176
|
+
authorizationGeneration?: string;
|
|
177
|
+
wopiEnabled?: boolean;
|
|
178
|
+
};
|
|
109
179
|
}
|
|
110
180
|
/** Context for an application opened against a workspace file. */
|
|
111
181
|
interface FileAppContext extends AppContextBase {
|
|
@@ -138,6 +208,8 @@ interface WorkspaceInfo {
|
|
|
138
208
|
name: string;
|
|
139
209
|
}
|
|
140
210
|
interface FileInfo {
|
|
211
|
+
nodeId?: string;
|
|
212
|
+
branch?: string;
|
|
141
213
|
path: string;
|
|
142
214
|
name: string;
|
|
143
215
|
mimeType: string;
|
|
@@ -994,8 +1066,11 @@ type BridgeListener = (data: HostToAppMessage) => void;
|
|
|
994
1066
|
* and app-to-host events (navigate, resize, dirty, etc.).
|
|
995
1067
|
*/
|
|
996
1068
|
declare class Bridge {
|
|
1069
|
+
private readonly expectedHostOrigin?;
|
|
997
1070
|
private listeners;
|
|
998
1071
|
private _initResolve;
|
|
1072
|
+
private _initReject;
|
|
1073
|
+
private _initTimer;
|
|
999
1074
|
private _initPromise;
|
|
1000
1075
|
private _hostOrigin;
|
|
1001
1076
|
private _messageHandler;
|
|
@@ -1003,7 +1078,9 @@ declare class Bridge {
|
|
|
1003
1078
|
private sessionId;
|
|
1004
1079
|
private actions;
|
|
1005
1080
|
private requests;
|
|
1006
|
-
|
|
1081
|
+
private backendRequests;
|
|
1082
|
+
private wopiRequests;
|
|
1083
|
+
constructor(expectedHostOrigin?: string | undefined);
|
|
1007
1084
|
/** Post `verentis:ready` to the host to start the handshake */
|
|
1008
1085
|
sendReady(capabilities?: string[]): void;
|
|
1009
1086
|
/** Wait for the host to send `verentis:init` with context and token */
|
|
@@ -1031,6 +1108,16 @@ declare class Bridge {
|
|
|
1031
1108
|
setTitle(title: string): void;
|
|
1032
1109
|
/** Signal unsaved changes to the host */
|
|
1033
1110
|
setDirty(isDirty: boolean): void;
|
|
1111
|
+
/** The host, not the app, selects the installation, file, branch and permission ceiling. */
|
|
1112
|
+
requestBackendCredential(): Promise<AppBackendCredential>;
|
|
1113
|
+
/** The trusted parent selects the approved installation, document and action. */
|
|
1114
|
+
requestWopiLaunch(): Promise<WopiLaunch>;
|
|
1115
|
+
/** Recover only the target selected by a completed server-owned derived operation. */
|
|
1116
|
+
requestWopiContinuation(): Promise<WopiContinuation>;
|
|
1117
|
+
getWopiStatus(): Promise<WopiSaveStatus>;
|
|
1118
|
+
requestWopiSave(generation: number): Promise<WopiSaveCheckpoint>;
|
|
1119
|
+
closeWopiSession(): Promise<void>;
|
|
1120
|
+
private requestWopi;
|
|
1034
1121
|
registerAction(descriptor: HeaderAction, handler: HeaderActionHandler): HeaderActionRegistration;
|
|
1035
1122
|
private publishActions;
|
|
1036
1123
|
private invokeAction;
|
|
@@ -1119,13 +1206,18 @@ declare class TokenAuth implements AuthStrategy {
|
|
|
1119
1206
|
* by requesting a new token from the host when nearing expiry.
|
|
1120
1207
|
*/
|
|
1121
1208
|
declare class BridgeAuth implements AuthStrategy {
|
|
1122
|
-
private
|
|
1209
|
+
private hostOrigin;
|
|
1123
1210
|
private _token;
|
|
1124
1211
|
private _expiresAt;
|
|
1125
1212
|
private _refreshTimer;
|
|
1126
1213
|
private _pendingRefresh;
|
|
1127
1214
|
private _messageHandler;
|
|
1215
|
+
private _requestId;
|
|
1216
|
+
private _refreshReject;
|
|
1217
|
+
private _requestTimer;
|
|
1218
|
+
private _destroyed;
|
|
1128
1219
|
constructor(hostOrigin: string);
|
|
1220
|
+
setHostOrigin(origin: string): void;
|
|
1129
1221
|
/** Set the initial token received from the host's `verentis:init` message */
|
|
1130
1222
|
setToken(info: TokenInfo): void;
|
|
1131
1223
|
getAuthHeader(): Promise<string | null>;
|
|
@@ -1135,6 +1227,7 @@ declare class BridgeAuth implements AuthStrategy {
|
|
|
1135
1227
|
private requestRefresh;
|
|
1136
1228
|
private handleMessage;
|
|
1137
1229
|
private scheduleRefresh;
|
|
1230
|
+
private failRefresh;
|
|
1138
1231
|
}
|
|
1139
1232
|
|
|
1140
1233
|
/**
|
|
@@ -1164,4 +1257,4 @@ declare class BridgeAuth implements AuthStrategy {
|
|
|
1164
1257
|
*/
|
|
1165
1258
|
declare function createVerentisClient(options?: VerentisClientOptions): VerentisClient;
|
|
1166
1259
|
|
|
1167
|
-
export { ApiError, ApiKeyAuth, type AppContext, type AppSurface, type AppToHostMessage, type ApplicationDisplayOptions, type ApplicationEntryPoint, type ApplicationFileType, type ApplicationLaunchConfig, type ApplicationManifest, type ApplicationSpec, type ArchiveFormat, type AuthOptions, type AuthStrategy, Bridge, BridgeAuth, type CatalogImage, ContextModule, type DeleteFileOptions, type EngineFileType, type EngineRuntime, type EngineTool, EnginesModule, type EntryPointInfo, type ExecuteEngineOptions, type Execution, type ExecutionEngine, type ExecutionEngineListOptions, type ExecutionListOptions, type ExecutionLogs, type ExecutionMode, type ExecutionResult, type ExecutionScopedOptions, type ExecutionStatus, type ExecutionTrigger, ExecutionsModule, type ExtractUploadOptions, type FileAppContext, type FileEntry, type FileInfo, FilesModule, type GetFileOptions, type HeaderAction, type HeaderActionHandler, type HeaderActionRegistration, type HeaderActionResult, type HostToAppMessage, HttpTransport, type Installation, type InstallationDetail, type InstallationLifecycleResult, type InstallationListOptions, type InstallationMode, type InstallationScopedOptions, type InstallationStatus, InstallationsModule, type InstalledPackageDescriptor, type InstalledPackagePayload, type ManifestMetadata, type MimeTypeBinding, type MoveFileOptions, type NamespacedSettings, type NavigateOptions, type OAuthConfig, type PagedResult, type ReadArchiveOptions, type RequestOptions, type ResolveInstallationOptions, type ResourceMimeTypeBinding, type ResourceRegistration, type ResourceScopedOptions, ResourcesModule, type RunFileOptions, type SandboxOptions, type SettingDeclaration, type SettingDeclarationType, type SettingGroup, type SettingItem, type SettingOption, type SettingPresence, SettingsModule, type SettingsScopedOptions, TokenAuth, type TokenInfo, type UpdateInstallationOptions, type VerentisActionInvokeMessage, type VerentisActionResultMessage, type VerentisActionsSetMessage, VerentisClient, type VerentisClientOptions, type VerentisDirtyMessage, type VerentisFileChangedMessage, type VerentisInitMessage, type VerentisMessage, type VerentisNavigateMessage, type VerentisReadyMessage, type VerentisResizeMessage, type VerentisThemeMessage, type VerentisTitleMessage, type VerentisTokenRefreshMessage, type VerentisTokenRefreshedMessage, type WaitOptions, type WorkspaceAppContext, type WorkspaceInfo, type WriteFileOptions, createVerentisClient, findBestMatch, isHeaderAction, isTerminalStatus, matchMimeType };
|
|
1260
|
+
export { ApiError, ApiKeyAuth, type AppBackendCredential, type AppContext, type AppSurface, type AppToHostMessage, type ApplicationDisplayOptions, type ApplicationEntryPoint, type ApplicationFileType, type ApplicationLaunchConfig, type ApplicationManifest, type ApplicationSpec, type ArchiveFormat, type AuthOptions, type AuthStrategy, Bridge, BridgeAuth, type CatalogImage, ContextModule, type DeleteFileOptions, type EngineFileType, type EngineRuntime, type EngineTool, EnginesModule, type EntryPointInfo, type ExecuteEngineOptions, type Execution, type ExecutionEngine, type ExecutionEngineListOptions, type ExecutionListOptions, type ExecutionLogs, type ExecutionMode, type ExecutionResult, type ExecutionScopedOptions, type ExecutionStatus, type ExecutionTrigger, ExecutionsModule, type ExtractUploadOptions, type FileAppContext, type FileEntry, type FileInfo, FilesModule, type GetFileOptions, type HeaderAction, type HeaderActionHandler, type HeaderActionRegistration, type HeaderActionResult, type HostToAppMessage, HttpTransport, type Installation, type InstallationDetail, type InstallationLifecycleResult, type InstallationListOptions, type InstallationMode, type InstallationScopedOptions, type InstallationStatus, InstallationsModule, type InstalledPackageDescriptor, type InstalledPackagePayload, type ManifestMetadata, type MimeTypeBinding, type MoveFileOptions, type NamespacedSettings, type NavigateOptions, type OAuthConfig, type PagedResult, type ReadArchiveOptions, type RequestOptions, type ResolveInstallationOptions, type ResourceMimeTypeBinding, type ResourceRegistration, type ResourceScopedOptions, ResourcesModule, type RunFileOptions, type SandboxOptions, type SettingDeclaration, type SettingDeclarationType, type SettingGroup, type SettingItem, type SettingOption, type SettingPresence, SettingsModule, type SettingsScopedOptions, TokenAuth, type TokenInfo, type UpdateInstallationOptions, type VerentisActionInvokeMessage, type VerentisActionResultMessage, type VerentisActionsSetMessage, type VerentisBackendCredentialRequest, type VerentisBackendCredentialResponse, VerentisClient, type VerentisClientOptions, type VerentisDirtyMessage, type VerentisFileChangedMessage, type VerentisInitMessage, type VerentisMessage, type VerentisNavigateMessage, type VerentisReadyMessage, type VerentisResizeMessage, type VerentisThemeMessage, type VerentisTitleMessage, type VerentisTokenRefreshMessage, type VerentisTokenRefreshedMessage, type VerentisWopiRequest, type VerentisWopiResponse, type WaitOptions, type WopiContinuation, type WopiLaunch, type WopiSaveCheckpoint, type WopiSaveStatus, type WorkspaceAppContext, type WorkspaceInfo, type WriteFileOptions, createVerentisClient, findBestMatch, isHeaderAction, isTerminalStatus, matchMimeType };
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,70 @@ interface VerentisTokenRefreshedMessage extends VerentisMessage {
|
|
|
62
62
|
requestId: string;
|
|
63
63
|
token: TokenInfo;
|
|
64
64
|
}
|
|
65
|
+
/** Single-use credential for the installation's independently registered backend. */
|
|
66
|
+
interface AppBackendCredential {
|
|
67
|
+
delegationId: string;
|
|
68
|
+
backendClientId: string;
|
|
69
|
+
launchCredential: string;
|
|
70
|
+
expiresAt: string;
|
|
71
|
+
}
|
|
72
|
+
interface VerentisBackendCredentialRequest extends VerentisMessage {
|
|
73
|
+
type: 'verentis:backend:request';
|
|
74
|
+
requestId: string;
|
|
75
|
+
sessionId: string;
|
|
76
|
+
}
|
|
77
|
+
interface VerentisBackendCredentialResponse extends VerentisMessage {
|
|
78
|
+
type: 'verentis:backend:response';
|
|
79
|
+
requestId: string;
|
|
80
|
+
sessionId: string;
|
|
81
|
+
credential?: AppBackendCredential;
|
|
82
|
+
error?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Nonsecret active-document metadata. CODE already holds its own scoped credential. */
|
|
85
|
+
interface WopiContinuation {
|
|
86
|
+
sessionId: string;
|
|
87
|
+
workspaceId: string;
|
|
88
|
+
branch: string;
|
|
89
|
+
nodeId: string;
|
|
90
|
+
accessTokenTtl: number;
|
|
91
|
+
fileId: string;
|
|
92
|
+
format: string;
|
|
93
|
+
readOnly: boolean;
|
|
94
|
+
name: string;
|
|
95
|
+
}
|
|
96
|
+
/** Initial document-scoped collaboration authority, never a platform OAuth credential. */
|
|
97
|
+
interface WopiLaunch extends WopiContinuation {
|
|
98
|
+
action: string;
|
|
99
|
+
accessToken: string;
|
|
100
|
+
editorOrigin: string;
|
|
101
|
+
wopiSource: string;
|
|
102
|
+
}
|
|
103
|
+
interface WopiSaveCheckpoint {
|
|
104
|
+
generation: number;
|
|
105
|
+
correlation: string;
|
|
106
|
+
revision?: string | null;
|
|
107
|
+
}
|
|
108
|
+
interface WopiSaveStatus {
|
|
109
|
+
state: string;
|
|
110
|
+
revision: string;
|
|
111
|
+
readOnly: boolean;
|
|
112
|
+
receipt: WopiSaveCheckpoint | null;
|
|
113
|
+
continuationAvailable?: boolean;
|
|
114
|
+
}
|
|
115
|
+
interface VerentisWopiRequest extends VerentisMessage {
|
|
116
|
+
type: 'verentis:wopi:request';
|
|
117
|
+
requestId: string;
|
|
118
|
+
sessionId: string;
|
|
119
|
+
operation: 'launch' | 'status' | 'save' | 'close' | 'continue';
|
|
120
|
+
generation?: number;
|
|
121
|
+
}
|
|
122
|
+
interface VerentisWopiResponse extends VerentisMessage {
|
|
123
|
+
type: 'verentis:wopi:response';
|
|
124
|
+
requestId: string;
|
|
125
|
+
sessionId: string;
|
|
126
|
+
result?: WopiLaunch | WopiContinuation | WopiSaveCheckpoint | WopiSaveStatus | null;
|
|
127
|
+
error?: string;
|
|
128
|
+
}
|
|
65
129
|
interface VerentisFileChangedMessage extends VerentisMessage {
|
|
66
130
|
type: 'verentis:file:changed';
|
|
67
131
|
path: string;
|
|
@@ -99,13 +163,19 @@ interface VerentisDirtyMessage extends VerentisMessage {
|
|
|
99
163
|
type: 'verentis:dirty';
|
|
100
164
|
isDirty: boolean;
|
|
101
165
|
}
|
|
102
|
-
type HostToAppMessage = VerentisInitMessage | VerentisActionInvokeMessage | VerentisTokenRefreshedMessage | VerentisFileChangedMessage | VerentisThemeMessage;
|
|
103
|
-
type AppToHostMessage = VerentisReadyMessage | VerentisActionsSetMessage | VerentisActionResultMessage | VerentisTokenRefreshMessage | VerentisNavigateMessage | VerentisResizeMessage | VerentisTitleMessage | VerentisDirtyMessage;
|
|
166
|
+
type HostToAppMessage = VerentisInitMessage | VerentisActionInvokeMessage | VerentisTokenRefreshedMessage | VerentisFileChangedMessage | VerentisThemeMessage | VerentisBackendCredentialResponse | VerentisWopiResponse;
|
|
167
|
+
type AppToHostMessage = VerentisReadyMessage | VerentisActionsSetMessage | VerentisActionResultMessage | VerentisTokenRefreshMessage | VerentisNavigateMessage | VerentisResizeMessage | VerentisTitleMessage | VerentisDirtyMessage | VerentisBackendCredentialRequest | VerentisWopiRequest;
|
|
104
168
|
type AppSurface = 'file' | 'workspace';
|
|
105
169
|
interface AppContextBase {
|
|
106
170
|
workspace: WorkspaceInfo;
|
|
107
171
|
entryPoint?: EntryPointInfo;
|
|
108
172
|
apiUrl: string;
|
|
173
|
+
installation?: {
|
|
174
|
+
id: string;
|
|
175
|
+
backendClientId?: string;
|
|
176
|
+
authorizationGeneration?: string;
|
|
177
|
+
wopiEnabled?: boolean;
|
|
178
|
+
};
|
|
109
179
|
}
|
|
110
180
|
/** Context for an application opened against a workspace file. */
|
|
111
181
|
interface FileAppContext extends AppContextBase {
|
|
@@ -138,6 +208,8 @@ interface WorkspaceInfo {
|
|
|
138
208
|
name: string;
|
|
139
209
|
}
|
|
140
210
|
interface FileInfo {
|
|
211
|
+
nodeId?: string;
|
|
212
|
+
branch?: string;
|
|
141
213
|
path: string;
|
|
142
214
|
name: string;
|
|
143
215
|
mimeType: string;
|
|
@@ -994,8 +1066,11 @@ type BridgeListener = (data: HostToAppMessage) => void;
|
|
|
994
1066
|
* and app-to-host events (navigate, resize, dirty, etc.).
|
|
995
1067
|
*/
|
|
996
1068
|
declare class Bridge {
|
|
1069
|
+
private readonly expectedHostOrigin?;
|
|
997
1070
|
private listeners;
|
|
998
1071
|
private _initResolve;
|
|
1072
|
+
private _initReject;
|
|
1073
|
+
private _initTimer;
|
|
999
1074
|
private _initPromise;
|
|
1000
1075
|
private _hostOrigin;
|
|
1001
1076
|
private _messageHandler;
|
|
@@ -1003,7 +1078,9 @@ declare class Bridge {
|
|
|
1003
1078
|
private sessionId;
|
|
1004
1079
|
private actions;
|
|
1005
1080
|
private requests;
|
|
1006
|
-
|
|
1081
|
+
private backendRequests;
|
|
1082
|
+
private wopiRequests;
|
|
1083
|
+
constructor(expectedHostOrigin?: string | undefined);
|
|
1007
1084
|
/** Post `verentis:ready` to the host to start the handshake */
|
|
1008
1085
|
sendReady(capabilities?: string[]): void;
|
|
1009
1086
|
/** Wait for the host to send `verentis:init` with context and token */
|
|
@@ -1031,6 +1108,16 @@ declare class Bridge {
|
|
|
1031
1108
|
setTitle(title: string): void;
|
|
1032
1109
|
/** Signal unsaved changes to the host */
|
|
1033
1110
|
setDirty(isDirty: boolean): void;
|
|
1111
|
+
/** The host, not the app, selects the installation, file, branch and permission ceiling. */
|
|
1112
|
+
requestBackendCredential(): Promise<AppBackendCredential>;
|
|
1113
|
+
/** The trusted parent selects the approved installation, document and action. */
|
|
1114
|
+
requestWopiLaunch(): Promise<WopiLaunch>;
|
|
1115
|
+
/** Recover only the target selected by a completed server-owned derived operation. */
|
|
1116
|
+
requestWopiContinuation(): Promise<WopiContinuation>;
|
|
1117
|
+
getWopiStatus(): Promise<WopiSaveStatus>;
|
|
1118
|
+
requestWopiSave(generation: number): Promise<WopiSaveCheckpoint>;
|
|
1119
|
+
closeWopiSession(): Promise<void>;
|
|
1120
|
+
private requestWopi;
|
|
1034
1121
|
registerAction(descriptor: HeaderAction, handler: HeaderActionHandler): HeaderActionRegistration;
|
|
1035
1122
|
private publishActions;
|
|
1036
1123
|
private invokeAction;
|
|
@@ -1119,13 +1206,18 @@ declare class TokenAuth implements AuthStrategy {
|
|
|
1119
1206
|
* by requesting a new token from the host when nearing expiry.
|
|
1120
1207
|
*/
|
|
1121
1208
|
declare class BridgeAuth implements AuthStrategy {
|
|
1122
|
-
private
|
|
1209
|
+
private hostOrigin;
|
|
1123
1210
|
private _token;
|
|
1124
1211
|
private _expiresAt;
|
|
1125
1212
|
private _refreshTimer;
|
|
1126
1213
|
private _pendingRefresh;
|
|
1127
1214
|
private _messageHandler;
|
|
1215
|
+
private _requestId;
|
|
1216
|
+
private _refreshReject;
|
|
1217
|
+
private _requestTimer;
|
|
1218
|
+
private _destroyed;
|
|
1128
1219
|
constructor(hostOrigin: string);
|
|
1220
|
+
setHostOrigin(origin: string): void;
|
|
1129
1221
|
/** Set the initial token received from the host's `verentis:init` message */
|
|
1130
1222
|
setToken(info: TokenInfo): void;
|
|
1131
1223
|
getAuthHeader(): Promise<string | null>;
|
|
@@ -1135,6 +1227,7 @@ declare class BridgeAuth implements AuthStrategy {
|
|
|
1135
1227
|
private requestRefresh;
|
|
1136
1228
|
private handleMessage;
|
|
1137
1229
|
private scheduleRefresh;
|
|
1230
|
+
private failRefresh;
|
|
1138
1231
|
}
|
|
1139
1232
|
|
|
1140
1233
|
/**
|
|
@@ -1164,4 +1257,4 @@ declare class BridgeAuth implements AuthStrategy {
|
|
|
1164
1257
|
*/
|
|
1165
1258
|
declare function createVerentisClient(options?: VerentisClientOptions): VerentisClient;
|
|
1166
1259
|
|
|
1167
|
-
export { ApiError, ApiKeyAuth, type AppContext, type AppSurface, type AppToHostMessage, type ApplicationDisplayOptions, type ApplicationEntryPoint, type ApplicationFileType, type ApplicationLaunchConfig, type ApplicationManifest, type ApplicationSpec, type ArchiveFormat, type AuthOptions, type AuthStrategy, Bridge, BridgeAuth, type CatalogImage, ContextModule, type DeleteFileOptions, type EngineFileType, type EngineRuntime, type EngineTool, EnginesModule, type EntryPointInfo, type ExecuteEngineOptions, type Execution, type ExecutionEngine, type ExecutionEngineListOptions, type ExecutionListOptions, type ExecutionLogs, type ExecutionMode, type ExecutionResult, type ExecutionScopedOptions, type ExecutionStatus, type ExecutionTrigger, ExecutionsModule, type ExtractUploadOptions, type FileAppContext, type FileEntry, type FileInfo, FilesModule, type GetFileOptions, type HeaderAction, type HeaderActionHandler, type HeaderActionRegistration, type HeaderActionResult, type HostToAppMessage, HttpTransport, type Installation, type InstallationDetail, type InstallationLifecycleResult, type InstallationListOptions, type InstallationMode, type InstallationScopedOptions, type InstallationStatus, InstallationsModule, type InstalledPackageDescriptor, type InstalledPackagePayload, type ManifestMetadata, type MimeTypeBinding, type MoveFileOptions, type NamespacedSettings, type NavigateOptions, type OAuthConfig, type PagedResult, type ReadArchiveOptions, type RequestOptions, type ResolveInstallationOptions, type ResourceMimeTypeBinding, type ResourceRegistration, type ResourceScopedOptions, ResourcesModule, type RunFileOptions, type SandboxOptions, type SettingDeclaration, type SettingDeclarationType, type SettingGroup, type SettingItem, type SettingOption, type SettingPresence, SettingsModule, type SettingsScopedOptions, TokenAuth, type TokenInfo, type UpdateInstallationOptions, type VerentisActionInvokeMessage, type VerentisActionResultMessage, type VerentisActionsSetMessage, VerentisClient, type VerentisClientOptions, type VerentisDirtyMessage, type VerentisFileChangedMessage, type VerentisInitMessage, type VerentisMessage, type VerentisNavigateMessage, type VerentisReadyMessage, type VerentisResizeMessage, type VerentisThemeMessage, type VerentisTitleMessage, type VerentisTokenRefreshMessage, type VerentisTokenRefreshedMessage, type WaitOptions, type WorkspaceAppContext, type WorkspaceInfo, type WriteFileOptions, createVerentisClient, findBestMatch, isHeaderAction, isTerminalStatus, matchMimeType };
|
|
1260
|
+
export { ApiError, ApiKeyAuth, type AppBackendCredential, type AppContext, type AppSurface, type AppToHostMessage, type ApplicationDisplayOptions, type ApplicationEntryPoint, type ApplicationFileType, type ApplicationLaunchConfig, type ApplicationManifest, type ApplicationSpec, type ArchiveFormat, type AuthOptions, type AuthStrategy, Bridge, BridgeAuth, type CatalogImage, ContextModule, type DeleteFileOptions, type EngineFileType, type EngineRuntime, type EngineTool, EnginesModule, type EntryPointInfo, type ExecuteEngineOptions, type Execution, type ExecutionEngine, type ExecutionEngineListOptions, type ExecutionListOptions, type ExecutionLogs, type ExecutionMode, type ExecutionResult, type ExecutionScopedOptions, type ExecutionStatus, type ExecutionTrigger, ExecutionsModule, type ExtractUploadOptions, type FileAppContext, type FileEntry, type FileInfo, FilesModule, type GetFileOptions, type HeaderAction, type HeaderActionHandler, type HeaderActionRegistration, type HeaderActionResult, type HostToAppMessage, HttpTransport, type Installation, type InstallationDetail, type InstallationLifecycleResult, type InstallationListOptions, type InstallationMode, type InstallationScopedOptions, type InstallationStatus, InstallationsModule, type InstalledPackageDescriptor, type InstalledPackagePayload, type ManifestMetadata, type MimeTypeBinding, type MoveFileOptions, type NamespacedSettings, type NavigateOptions, type OAuthConfig, type PagedResult, type ReadArchiveOptions, type RequestOptions, type ResolveInstallationOptions, type ResourceMimeTypeBinding, type ResourceRegistration, type ResourceScopedOptions, ResourcesModule, type RunFileOptions, type SandboxOptions, type SettingDeclaration, type SettingDeclarationType, type SettingGroup, type SettingItem, type SettingOption, type SettingPresence, SettingsModule, type SettingsScopedOptions, TokenAuth, type TokenInfo, type UpdateInstallationOptions, type VerentisActionInvokeMessage, type VerentisActionResultMessage, type VerentisActionsSetMessage, type VerentisBackendCredentialRequest, type VerentisBackendCredentialResponse, VerentisClient, type VerentisClientOptions, type VerentisDirtyMessage, type VerentisFileChangedMessage, type VerentisInitMessage, type VerentisMessage, type VerentisNavigateMessage, type VerentisReadyMessage, type VerentisResizeMessage, type VerentisThemeMessage, type VerentisTitleMessage, type VerentisTokenRefreshMessage, type VerentisTokenRefreshedMessage, type VerentisWopiRequest, type VerentisWopiResponse, type WaitOptions, type WopiContinuation, type WopiLaunch, type WopiSaveCheckpoint, type WopiSaveStatus, type WorkspaceAppContext, type WorkspaceInfo, type WriteFileOptions, createVerentisClient, findBestMatch, isHeaderAction, isTerminalStatus, matchMimeType };
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,14 @@ var BridgeAuth = class {
|
|
|
28
28
|
_refreshTimer = null;
|
|
29
29
|
_pendingRefresh = null;
|
|
30
30
|
_messageHandler;
|
|
31
|
+
_requestId = null;
|
|
32
|
+
_refreshReject = null;
|
|
33
|
+
_requestTimer = null;
|
|
34
|
+
_destroyed = false;
|
|
35
|
+
setHostOrigin(origin) {
|
|
36
|
+
if (!origin || origin === "*" || origin === "null") throw new Error("A trusted host origin is required.");
|
|
37
|
+
this.hostOrigin = origin;
|
|
38
|
+
}
|
|
31
39
|
/** Set the initial token received from the host's `verentis:init` message */
|
|
32
40
|
setToken(info) {
|
|
33
41
|
this._token = info.accessToken;
|
|
@@ -42,7 +50,9 @@ var BridgeAuth = class {
|
|
|
42
50
|
return `Bearer ${this._token}`;
|
|
43
51
|
}
|
|
44
52
|
destroy() {
|
|
53
|
+
this._destroyed = true;
|
|
45
54
|
if (this._refreshTimer) clearTimeout(this._refreshTimer);
|
|
55
|
+
this.failRefresh("Authentication has been destroyed.");
|
|
46
56
|
if (typeof window !== "undefined") {
|
|
47
57
|
window.removeEventListener("message", this._messageHandler);
|
|
48
58
|
}
|
|
@@ -52,11 +62,16 @@ var BridgeAuth = class {
|
|
|
52
62
|
}
|
|
53
63
|
_refreshResolve = null;
|
|
54
64
|
requestRefresh() {
|
|
65
|
+
if (this._destroyed || this.hostOrigin === "*")
|
|
66
|
+
return Promise.reject(new Error("Authentication is not initialized."));
|
|
55
67
|
if (this._pendingRefresh) return this._pendingRefresh;
|
|
56
68
|
const requestId = crypto.randomUUID();
|
|
57
|
-
this.
|
|
69
|
+
this._requestId = requestId;
|
|
70
|
+
this._pendingRefresh = new Promise((resolve, reject) => {
|
|
58
71
|
this._refreshResolve = resolve;
|
|
72
|
+
this._refreshReject = reject;
|
|
59
73
|
});
|
|
74
|
+
this._requestTimer = setTimeout(() => this.failRefresh("Token refresh timed out."), 2e4);
|
|
60
75
|
const message = {
|
|
61
76
|
type: "verentis:token:refresh",
|
|
62
77
|
version: 1,
|
|
@@ -66,21 +81,35 @@ var BridgeAuth = class {
|
|
|
66
81
|
return this._pendingRefresh;
|
|
67
82
|
}
|
|
68
83
|
handleMessage(event) {
|
|
69
|
-
if (event.origin !== this.hostOrigin) return;
|
|
84
|
+
if (this._destroyed || event.origin !== this.hostOrigin || event.source !== window.parent) return;
|
|
70
85
|
const data = event.data;
|
|
71
|
-
if (data?.type !== "verentis:token:refreshed") return;
|
|
86
|
+
if (data?.version !== 1 || data?.type !== "verentis:token:refreshed" || !this._requestId || data.requestId !== this._requestId || typeof data.token?.accessToken !== "string" || !Number.isFinite(Date.parse(data.token.expiresAt)) || Date.parse(data.token.expiresAt) <= Date.now() + SKEW_MS) return;
|
|
87
|
+
if (this._requestTimer) clearTimeout(this._requestTimer);
|
|
88
|
+
this._requestTimer = null;
|
|
89
|
+
this._requestId = null;
|
|
72
90
|
this._token = data.token.accessToken;
|
|
73
91
|
this._expiresAt = new Date(data.token.expiresAt).getTime();
|
|
74
92
|
this._pendingRefresh = null;
|
|
75
93
|
this._refreshResolve?.();
|
|
76
94
|
this._refreshResolve = null;
|
|
95
|
+
this._refreshReject = null;
|
|
77
96
|
this.scheduleRefresh();
|
|
78
97
|
}
|
|
79
98
|
scheduleRefresh() {
|
|
80
99
|
if (this._refreshTimer) clearTimeout(this._refreshTimer);
|
|
81
100
|
if (this._expiresAt === 0) return;
|
|
82
101
|
const delay2 = Math.max(0, this._expiresAt - Date.now() - SKEW_MS);
|
|
83
|
-
this._refreshTimer = setTimeout(() => void this.requestRefresh()
|
|
102
|
+
this._refreshTimer = setTimeout(() => void this.requestRefresh().catch(() => {
|
|
103
|
+
}), delay2);
|
|
104
|
+
}
|
|
105
|
+
failRefresh(message) {
|
|
106
|
+
if (this._requestTimer) clearTimeout(this._requestTimer);
|
|
107
|
+
this._requestTimer = null;
|
|
108
|
+
this._requestId = null;
|
|
109
|
+
this._pendingRefresh = null;
|
|
110
|
+
this._refreshReject?.(new Error(message));
|
|
111
|
+
this._refreshReject = null;
|
|
112
|
+
this._refreshResolve = null;
|
|
84
113
|
}
|
|
85
114
|
};
|
|
86
115
|
|
|
@@ -752,8 +781,24 @@ function isHeaderAction(value) {
|
|
|
752
781
|
|
|
753
782
|
// src/transport/bridge.transport.ts
|
|
754
783
|
var Bridge = class {
|
|
784
|
+
constructor(expectedHostOrigin) {
|
|
785
|
+
this.expectedHostOrigin = expectedHostOrigin;
|
|
786
|
+
this._initPromise = new Promise((resolve, reject) => {
|
|
787
|
+
this._initResolve = resolve;
|
|
788
|
+
this._initReject = reject;
|
|
789
|
+
});
|
|
790
|
+
void this._initPromise.catch(() => {
|
|
791
|
+
});
|
|
792
|
+
this._messageHandler = this.handleMessage.bind(this);
|
|
793
|
+
if (typeof window !== "undefined") {
|
|
794
|
+
window.addEventListener("message", this._messageHandler);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
expectedHostOrigin;
|
|
755
798
|
listeners = /* @__PURE__ */ new Map();
|
|
756
799
|
_initResolve;
|
|
800
|
+
_initReject;
|
|
801
|
+
_initTimer;
|
|
757
802
|
_initPromise;
|
|
758
803
|
_hostOrigin = null;
|
|
759
804
|
_messageHandler;
|
|
@@ -761,15 +806,8 @@ var Bridge = class {
|
|
|
761
806
|
sessionId = null;
|
|
762
807
|
actions = /* @__PURE__ */ new Map();
|
|
763
808
|
requests = /* @__PURE__ */ new Set();
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
this._initResolve = resolve;
|
|
767
|
-
});
|
|
768
|
-
this._messageHandler = this.handleMessage.bind(this);
|
|
769
|
-
if (typeof window !== "undefined") {
|
|
770
|
-
window.addEventListener("message", this._messageHandler);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
809
|
+
backendRequests = /* @__PURE__ */ new Map();
|
|
810
|
+
wopiRequests = /* @__PURE__ */ new Map();
|
|
773
811
|
/** Post `verentis:ready` to the host to start the handshake */
|
|
774
812
|
sendReady(capabilities) {
|
|
775
813
|
console.info("[Verentis SDK] Sending verentis:ready to host");
|
|
@@ -778,10 +816,16 @@ var Bridge = class {
|
|
|
778
816
|
version: 1,
|
|
779
817
|
capabilities
|
|
780
818
|
};
|
|
781
|
-
window.parent.postMessage(message, "*");
|
|
819
|
+
window.parent.postMessage(message, this.expectedHostOrigin ?? "*");
|
|
782
820
|
}
|
|
783
821
|
/** Wait for the host to send `verentis:init` with context and token */
|
|
784
822
|
waitForInit() {
|
|
823
|
+
if (!this._hostOrigin && !this._destroyed && !this._initTimer) {
|
|
824
|
+
this._initTimer = setTimeout(() => {
|
|
825
|
+
this._initReject(new Error("Workspace handshake timed out."));
|
|
826
|
+
this.destroy();
|
|
827
|
+
}, 2e4);
|
|
828
|
+
}
|
|
785
829
|
return this._initPromise;
|
|
786
830
|
}
|
|
787
831
|
/** Get the host origin (available after init) */
|
|
@@ -825,6 +869,75 @@ var Bridge = class {
|
|
|
825
869
|
setDirty(isDirty) {
|
|
826
870
|
this.postToHost({ type: "verentis:dirty", version: 1, isDirty });
|
|
827
871
|
}
|
|
872
|
+
/** The host, not the app, selects the installation, file, branch and permission ceiling. */
|
|
873
|
+
requestBackendCredential() {
|
|
874
|
+
if (this._destroyed || !this.sessionId || !this._hostOrigin)
|
|
875
|
+
return Promise.reject(new Error("An initialized workspace host is required."));
|
|
876
|
+
if (this.backendRequests.size >= 4)
|
|
877
|
+
return Promise.reject(new Error("A backend credential request is already pending."));
|
|
878
|
+
const requestId = crypto.randomUUID();
|
|
879
|
+
return new Promise((resolve, reject) => {
|
|
880
|
+
const timer = setTimeout(() => {
|
|
881
|
+
this.backendRequests.delete(requestId);
|
|
882
|
+
reject(new Error("Backend authorization timed out."));
|
|
883
|
+
}, 2e4);
|
|
884
|
+
this.backendRequests.set(requestId, { resolve, reject, timer });
|
|
885
|
+
try {
|
|
886
|
+
this.postToHost({ type: "verentis:backend:request", version: 1, requestId, sessionId: this.sessionId });
|
|
887
|
+
} catch {
|
|
888
|
+
clearTimeout(timer);
|
|
889
|
+
this.backendRequests.delete(requestId);
|
|
890
|
+
reject(new Error("The workspace host is unavailable."));
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
/** The trusted parent selects the approved installation, document and action. */
|
|
895
|
+
requestWopiLaunch() {
|
|
896
|
+
return this.requestWopi("launch");
|
|
897
|
+
}
|
|
898
|
+
/** Recover only the target selected by a completed server-owned derived operation. */
|
|
899
|
+
requestWopiContinuation() {
|
|
900
|
+
return this.requestWopi("continue");
|
|
901
|
+
}
|
|
902
|
+
getWopiStatus() {
|
|
903
|
+
return this.requestWopi("status");
|
|
904
|
+
}
|
|
905
|
+
requestWopiSave(generation) {
|
|
906
|
+
if (!Number.isSafeInteger(generation) || generation < 0)
|
|
907
|
+
return Promise.reject(new Error("Invalid edit generation."));
|
|
908
|
+
return this.requestWopi("save", generation);
|
|
909
|
+
}
|
|
910
|
+
closeWopiSession() {
|
|
911
|
+
return this.requestWopi("close");
|
|
912
|
+
}
|
|
913
|
+
requestWopi(operation, generation) {
|
|
914
|
+
if (this._destroyed || !this.sessionId || !this._hostOrigin)
|
|
915
|
+
return Promise.reject(new Error("An initialized workspace host is required."));
|
|
916
|
+
if (this.wopiRequests.size >= 4)
|
|
917
|
+
return Promise.reject(new Error("Too many collaboration requests."));
|
|
918
|
+
const requestId = crypto.randomUUID();
|
|
919
|
+
return new Promise((resolve, reject) => {
|
|
920
|
+
const timer = setTimeout(() => {
|
|
921
|
+
this.wopiRequests.delete(requestId);
|
|
922
|
+
reject(new Error("Collaboration authorization timed out."));
|
|
923
|
+
}, 3e4);
|
|
924
|
+
this.wopiRequests.set(requestId, { resolve, reject, timer });
|
|
925
|
+
try {
|
|
926
|
+
this.postToHost({
|
|
927
|
+
type: "verentis:wopi:request",
|
|
928
|
+
version: 1,
|
|
929
|
+
requestId,
|
|
930
|
+
sessionId: this.sessionId,
|
|
931
|
+
operation,
|
|
932
|
+
...generation === void 0 ? {} : { generation }
|
|
933
|
+
});
|
|
934
|
+
} catch {
|
|
935
|
+
clearTimeout(timer);
|
|
936
|
+
this.wopiRequests.delete(requestId);
|
|
937
|
+
reject(new Error("The workspace host is unavailable."));
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
}
|
|
828
941
|
registerAction(descriptor, handler) {
|
|
829
942
|
if (!this.sessionId || this._destroyed) throw new Error("Header actions require an initialized workspace host.");
|
|
830
943
|
if (!isHeaderAction(descriptor)) throw new Error("Invalid header action.");
|
|
@@ -901,9 +1014,22 @@ var Bridge = class {
|
|
|
901
1014
|
/** Clean up event listeners */
|
|
902
1015
|
destroy() {
|
|
903
1016
|
this._destroyed = true;
|
|
1017
|
+
clearTimeout(this._initTimer);
|
|
1018
|
+
this._initTimer = void 0;
|
|
1019
|
+
if (!this._hostOrigin) this._initReject(new Error("Bridge has been destroyed."));
|
|
904
1020
|
this.actions.clear();
|
|
905
1021
|
this.requests.clear();
|
|
906
1022
|
this.listeners.clear();
|
|
1023
|
+
for (const pending of this.backendRequests.values()) {
|
|
1024
|
+
clearTimeout(pending.timer);
|
|
1025
|
+
pending.reject(new Error("Bridge has been destroyed."));
|
|
1026
|
+
}
|
|
1027
|
+
this.backendRequests.clear();
|
|
1028
|
+
for (const pending of this.wopiRequests.values()) {
|
|
1029
|
+
clearTimeout(pending.timer);
|
|
1030
|
+
pending.reject(new Error("Bridge has been destroyed."));
|
|
1031
|
+
}
|
|
1032
|
+
this.wopiRequests.clear();
|
|
907
1033
|
if (typeof window !== "undefined") {
|
|
908
1034
|
window.removeEventListener("message", this._messageHandler);
|
|
909
1035
|
}
|
|
@@ -913,8 +1039,12 @@ var Bridge = class {
|
|
|
913
1039
|
const data = event.data;
|
|
914
1040
|
if (event.source !== window.parent || data?.version !== 1 || typeof data?.type !== "string" || !data.type.startsWith("verentis:")) return;
|
|
915
1041
|
if (this._hostOrigin && event.origin !== this._hostOrigin) return;
|
|
1042
|
+
if (this.expectedHostOrigin && event.origin !== this.expectedHostOrigin) return;
|
|
916
1043
|
if (data.type === "verentis:init") {
|
|
917
1044
|
if (this._hostOrigin) return;
|
|
1045
|
+
if (!data.context?.workspace?.id || !data.token || event.origin === "null") return;
|
|
1046
|
+
clearTimeout(this._initTimer);
|
|
1047
|
+
this._initTimer = void 0;
|
|
918
1048
|
this._hostOrigin = event.origin;
|
|
919
1049
|
this.sessionId = typeof data.sessionId === "string" ? data.sessionId : null;
|
|
920
1050
|
console.info("[Verentis SDK] Received verentis:init from host", {
|
|
@@ -925,6 +1055,29 @@ var Bridge = class {
|
|
|
925
1055
|
const initData = data;
|
|
926
1056
|
this._initResolve({ context: initData.context, token: initData.token });
|
|
927
1057
|
}
|
|
1058
|
+
if (data.type === "verentis:backend:response") {
|
|
1059
|
+
if (!this._hostOrigin || data.sessionId !== this.sessionId) return;
|
|
1060
|
+
const pending = this.backendRequests.get(data.requestId);
|
|
1061
|
+
if (!pending) return;
|
|
1062
|
+
clearTimeout(pending.timer);
|
|
1063
|
+
this.backendRequests.delete(data.requestId);
|
|
1064
|
+
const value = data.credential;
|
|
1065
|
+
if (data.error || !value || typeof value.launchCredential !== "string" || value.launchCredential.length > 512 || !value.launchCredential || typeof value.delegationId !== "string" || typeof value.backendClientId !== "string" || !Number.isFinite(Date.parse(value.expiresAt)) || Date.parse(value.expiresAt) <= Date.now())
|
|
1066
|
+
pending.reject(new Error("Backend authorization was denied or is not configured."));
|
|
1067
|
+
else pending.resolve(value);
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
if (data.type === "verentis:wopi:response") {
|
|
1071
|
+
if (!this._hostOrigin || data.sessionId !== this.sessionId) return;
|
|
1072
|
+
const pending = this.wopiRequests.get(data.requestId);
|
|
1073
|
+
if (!pending) return;
|
|
1074
|
+
clearTimeout(pending.timer);
|
|
1075
|
+
this.wopiRequests.delete(data.requestId);
|
|
1076
|
+
if (data.error || !Object.hasOwn(data, "result"))
|
|
1077
|
+
pending.reject(new Error("Collaboration authorization is unavailable."));
|
|
1078
|
+
else pending.resolve(data.result);
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
928
1081
|
if (data.type === "verentis:action:invoke") {
|
|
929
1082
|
void this.invokeAction(data);
|
|
930
1083
|
return;
|
|
@@ -1110,7 +1263,7 @@ var VerentisClient = class {
|
|
|
1110
1263
|
this.bridge.sendReady();
|
|
1111
1264
|
const { context, token } = await this.bridge.waitForInit();
|
|
1112
1265
|
const hostOrigin = this.bridge.hostOrigin;
|
|
1113
|
-
|
|
1266
|
+
bridgeAuth.setHostOrigin(hostOrigin);
|
|
1114
1267
|
bridgeAuth.setToken(token);
|
|
1115
1268
|
this.context.setFromAppContext(context);
|
|
1116
1269
|
const http = new HttpTransport(
|