@univerjs-pro/collaboration-worktree-client 1.0.0-insiders.20260727-46ed76c
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/config.d.ts +20 -0
- package/dist/config.js +1 -0
- package/dist/http.d.ts +16 -0
- package/dist/http.js +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -0
- package/dist/management.d.ts +6 -0
- package/dist/management.js +1 -0
- package/dist/merge-preview-snapshot-server.d.ts +29 -0
- package/dist/merge-preview-snapshot-server.js +1 -0
- package/dist/url.d.ts +3 -0
- package/dist/url.js +1 -0
- package/dist/worktree-client.d.ts +22 -0
- package/dist/worktree-client.js +1 -0
- package/dist/worktree-event-client.d.ts +31 -0
- package/dist/worktree-event-client.js +1 -0
- package/dist/worktree-snapshot-server.d.ts +11 -0
- package/dist/worktree-snapshot-server.js +1 -0
- package/package.json +32 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IUniverCollaborationClientConfig } from "@univerjs-pro/collaboration-client";
|
|
2
|
+
import type { DependencyOverride } from "@univerjs/core";
|
|
3
|
+
import type { SaveSnapshotInput } from "@univerjs-pro/collaboration-service";
|
|
4
|
+
import type { WorktreeFetch } from "./http.js";
|
|
5
|
+
export interface CreateWorktreeCollaborationConfigOptions {
|
|
6
|
+
readonly origin: string;
|
|
7
|
+
readonly worktreeID: string;
|
|
8
|
+
readonly override?: DependencyOverride;
|
|
9
|
+
}
|
|
10
|
+
export type WorktreeCollaborationConfig = Pick<IUniverCollaborationClientConfig, "snapshotServerUrl" | "collabSubmitChangesetUrl" | "collabWebSocketUrl" | "wsSessionTicketUrl" | "override">;
|
|
11
|
+
export interface CreateWorktreeMergePreviewConfigOptions {
|
|
12
|
+
readonly origin: string;
|
|
13
|
+
readonly worktreeID: string;
|
|
14
|
+
readonly preview: SaveSnapshotInput;
|
|
15
|
+
readonly fetch?: WorktreeFetch;
|
|
16
|
+
readonly override?: DependencyOverride;
|
|
17
|
+
}
|
|
18
|
+
export type WorktreeMergePreviewConfig = Pick<IUniverCollaborationClientConfig, "enableCollaboration" | "snapshotServerUrl" | "override">;
|
|
19
|
+
export declare function createWorktreeCollaborationConfig(options: CreateWorktreeCollaborationConfigOptions): WorktreeCollaborationConfig;
|
|
20
|
+
export declare function createWorktreeMergePreviewConfig(options: CreateWorktreeMergePreviewConfigOptions): WorktreeMergePreviewConfig;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x475d(_0xdd56b,_0x4042c3){_0xdd56b=_0xdd56b-0x113;const _0x419da5=_0x419d();let _0x475d7f=_0x419da5[_0xdd56b];return _0x475d7f;}(function(_0x57dc01,_0x222c77){const _0x4f8178=_0x475d,_0x4f441b=_0x57dc01();while(!![]){try{const _0xbd28d2=-parseInt(_0x4f8178(0x113))/0x1+parseInt(_0x4f8178(0x115))/0x2+-parseInt(_0x4f8178(0x114))/0x3+-parseInt(_0x4f8178(0x119))/0x4*(-parseInt(_0x4f8178(0x11f))/0x5)+-parseInt(_0x4f8178(0x11d))/0x6*(parseInt(_0x4f8178(0x117))/0x7)+-parseInt(_0x4f8178(0x116))/0x8*(-parseInt(_0x4f8178(0x11b))/0x9)+parseInt(_0x4f8178(0x124))/0xa*(parseInt(_0x4f8178(0x11a))/0xb);if(_0xbd28d2===_0x222c77)break;else _0x4f441b['push'](_0x4f441b['shift']());}catch(_0x20baf8){_0x4f441b['push'](_0x4f441b['shift']());}}}(_0x419d,0xf24c9));function _0x419d(){const _0x2bc716=['11740311mEBDoU','4202739lrGDgU','/snapshot','731826uyAftj','preview','150YhtNXl','worktreeID','/universer-api/user/session-ticket','fetch','override','30SUyjQJ','1492599fznpYY','3651186UqQdMh','2770040kcenPa','8EddlsX','112QiiUOy','origin','79968jmnynz'];_0x419d=function(){return _0x2bc716;};return _0x419d();}import{ISnapshotServerService}from'@univerjs-pro/collaboration';import{WorktreeSnapshotServerOverHTTPService}from'./worktree-snapshot-server.js';import{WorktreeMergePreviewSnapshotService}from'./merge-preview-snapshot-server.js';import{normalizeOrigin,worktreeBaseUrl,worktreeWebSocketBaseUrl}from'./url.js';export function createWorktreeCollaborationConfig(_0x56cb20){const _0x140180=_0x475d,_0x31f872=normalizeOrigin(_0x56cb20[_0x140180(0x118)]),_0x53fde8=worktreeBaseUrl(_0x31f872,_0x56cb20[_0x140180(0x120)]),_0x2c0671=worktreeWebSocketBaseUrl(_0x31f872,_0x56cb20[_0x140180(0x120)]);return{'snapshotServerUrl':_0x53fde8+_0x140180(0x11c),'collabSubmitChangesetUrl':_0x53fde8+'/comb','collabWebSocketUrl':_0x2c0671+'/comb/connect','wsSessionTicketUrl':_0x31f872+_0x140180(0x121),'override':[[ISnapshotServerService,{'useClass':WorktreeSnapshotServerOverHTTPService}],..._0x56cb20[_0x140180(0x123)]??[]]};}export function createWorktreeMergePreviewConfig(_0x2c23f5){const _0x32a7f1=_0x475d,_0x25349d=normalizeOrigin(_0x2c23f5[_0x32a7f1(0x118)]),_0x317ed4=worktreeBaseUrl(_0x25349d,_0x2c23f5[_0x32a7f1(0x120)]);return{'enableCollaboration':![],'snapshotServerUrl':_0x317ed4+_0x32a7f1(0x11c),'override':[[ISnapshotServerService,{'useValue':new WorktreeMergePreviewSnapshotService({'origin':_0x25349d,'worktreeID':_0x2c23f5[_0x32a7f1(0x120)],'preview':_0x2c23f5[_0x32a7f1(0x11e)],..._0x2c23f5['fetch']===undefined?{}:{'fetch':_0x2c23f5[_0x32a7f1(0x122)]}})}],..._0x2c23f5[_0x32a7f1(0x123)]??[]]};}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WorktreeData, WorktreeUnitMergeEvaluation } from "@univerjs-pro/collaboration-worktree-service";
|
|
2
|
+
export type WorktreeFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
3
|
+
export interface WorktreeHttpOptions {
|
|
4
|
+
readonly fetch?: WorktreeFetch;
|
|
5
|
+
}
|
|
6
|
+
export declare class WorktreeClientError extends Error {
|
|
7
|
+
readonly status: number;
|
|
8
|
+
readonly code: string | number;
|
|
9
|
+
readonly retryable?: boolean | undefined;
|
|
10
|
+
constructor(status: number, code: string | number, message: string, retryable?: boolean | undefined);
|
|
11
|
+
}
|
|
12
|
+
export declare function requestWorktree(fetcher: WorktreeFetch, url: string, init?: RequestInit): Promise<WorktreeData>;
|
|
13
|
+
export declare function requestTicket(fetcher: WorktreeFetch, url: string): Promise<string>;
|
|
14
|
+
export declare function requestWorktreeUnitMergeEvaluation(fetcher: WorktreeFetch, url: string): Promise<WorktreeUnitMergeEvaluation>;
|
|
15
|
+
export declare function jsonRequest(body?: unknown): RequestInit;
|
|
16
|
+
export declare function defaultFetch(): WorktreeFetch;
|
package/dist/http.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x8688ea=_0x57cc;(function(_0xf8cb56,_0x3d429b){const _0x4c8000=_0x57cc,_0x1cc1f0=_0xf8cb56();while(!![]){try{const _0x1dd1d8=-parseInt(_0x4c8000(0xbd))/0x1+parseInt(_0x4c8000(0xa7))/0x2*(parseInt(_0x4c8000(0xaf))/0x3)+-parseInt(_0x4c8000(0xad))/0x4+-parseInt(_0x4c8000(0x9d))/0x5+-parseInt(_0x4c8000(0x98))/0x6+parseInt(_0x4c8000(0xa4))/0x7+parseInt(_0x4c8000(0xb1))/0x8;if(_0x1dd1d8===_0x3d429b)break;else _0x1cc1f0['push'](_0x1cc1f0['shift']());}catch(_0x55fd54){_0x1cc1f0['push'](_0x1cc1f0['shift']());}}}(_0xe318,0x3a061));export class WorktreeClientError extends Error{[_0x8688ea(0xae)];[_0x8688ea(0xa2)];[_0x8688ea(0xa0)];constructor(_0x25d271,_0x30b2a7,_0x5e2c8f,_0x552a86){const _0x45f0ff=_0x8688ea;super(_0x5e2c8f),this[_0x45f0ff(0xae)]=_0x25d271,this['code']=_0x30b2a7,this[_0x45f0ff(0xa0)]=_0x552a86,this['name']=_0x45f0ff(0xac);}}export async function requestWorktree(_0x2c9d61,_0x22d7a4,_0x21289f){const _0x484e83=_0x8688ea,_0xab4b7a=await _0x2c9d61(_0x22d7a4,_0x21289f),_0x3fd388=await readJson(_0xab4b7a);if(!_0xab4b7a['ok'])throw toClientError(_0xab4b7a['status'],_0x3fd388);if(!isRecord(_0x3fd388)||!isRecord(_0x3fd388['worktree']))throw new WorktreeClientError(_0xab4b7a[_0x484e83(0xae)],_0x484e83(0xa9),_0x484e83(0xa3));return _0x3fd388[_0x484e83(0x9a)];}export async function requestTicket(_0x246110,_0x518187){const _0x289816=_0x8688ea,_0x5efa67=await _0x246110(_0x518187),_0x4dd866=await readJson(_0x5efa67);if(!_0x5efa67['ok'])throw toClientError(_0x5efa67[_0x289816(0xae)],_0x4dd866);if(!isRecord(_0x4dd866)||typeof _0x4dd866[_0x289816(0xbc)]!==_0x289816(0xbe)||!_0x4dd866['ticket'])throw new WorktreeClientError(_0x5efa67['status'],'INVALID_RESPONSE',_0x289816(0xa8));return _0x4dd866[_0x289816(0xbc)];}export async function requestWorktreeUnitMergeEvaluation(_0x53d1b0,_0x2c9d07){const _0x2ce7a0=_0x8688ea,_0xeaaf9b=await _0x53d1b0(_0x2c9d07),_0x5d5f0f=await readJson(_0xeaaf9b);if(!_0xeaaf9b['ok'])throw toClientError(_0xeaaf9b['status'],_0x5d5f0f);if(!isRecord(_0x5d5f0f)||!isRecord(_0x5d5f0f[_0x2ce7a0(0xb2)]))throw new WorktreeClientError(_0xeaaf9b[_0x2ce7a0(0xae)],_0x2ce7a0(0xa9),'Worktree\x20response\x20is\x20missing\x20merge\x20evaluation');const _0xd6a5e4=_0x5d5f0f['evaluation'];if(_0xd6a5e4[_0x2ce7a0(0xae)]==='preview'&&isRecord(_0xd6a5e4[_0x2ce7a0(0xb4)])&&isRecord(_0xd6a5e4[_0x2ce7a0(0xb4)][_0x2ce7a0(0xc2)])){decodeSnapshotBytes(_0xd6a5e4[_0x2ce7a0(0xb4)][_0x2ce7a0(0xc2)]);if(Array[_0x2ce7a0(0x9f)](_0xd6a5e4[_0x2ce7a0(0xb4)][_0x2ce7a0(0x9c)]))for(const _0x599fc2 of _0xd6a5e4[_0x2ce7a0(0xb4)][_0x2ce7a0(0x9c)]){if(!isRecord(_0x599fc2))throw invalidPreviewResponse(_0xeaaf9b['status']);_0x599fc2[_0x2ce7a0(0xa6)]=base64ToBytes(_0x599fc2[_0x2ce7a0(0xa6)],_0xeaaf9b['status']);}}if(typeof _0xd6a5e4['status']!==_0x2ce7a0(0xbe)||typeof _0xd6a5e4['worktreeID']!==_0x2ce7a0(0xbe)||typeof _0xd6a5e4[_0x2ce7a0(0xb0)]!=='string')throw invalidPreviewResponse(_0xeaaf9b['status']);return _0xd6a5e4;}function _0x57cc(_0x5d3dee,_0x4ac74e){_0x5d3dee=_0x5d3dee-0x98;const _0xe31859=_0xe318();let _0x57ccae=_0xe31859[_0x5d3dee];return _0x57ccae;}export function jsonRequest(_0x446b7f){const _0x14a143=_0x8688ea;return{'method':_0x14a143(0xba),..._0x446b7f===undefined?{}:{'headers':{'content-type':_0x14a143(0xb6)},'body':JSON[_0x14a143(0xb7)](_0x446b7f,(_0x3a0fd0,_0x4cc740)=>_0x4cc740 instanceof Uint8Array?bytesToBase64(_0x4cc740):_0x4cc740)}};}function _0xe318(){const _0x59ee0a=['374949DEEKyf','string','error','message','sheets','snapshot','1942854HmvFUn','workbook','worktree','fetch','sheetBlocks','789060tfcwqv','charCodeAt','isArray','retryable','boolean','code','Worktree\x20response\x20is\x20missing\x20worktree\x20data','281029ykTDri','bind','data','521592JWwxje','Session\x20ticket\x20response\x20is\x20missing\x20ticket','INVALID_RESPONSE','Worktree\x20request\x20failed\x20with\x20HTTP\x20','values','WorktreeClientError','285712clRMHP','status','3bDPfYL','unitID','6917760dApQuo','evaluation','json','preview','originalMeta','application/json','stringify','doc','HTTP_ERROR','POST','A\x20fetch\x20implementation\x20is\x20required','ticket'];_0xe318=function(){return _0x59ee0a;};return _0xe318();}export function defaultFetch(){const _0x583e78=_0x8688ea;if(typeof globalThis[_0x583e78(0x9b)]!=='function')throw new TypeError(_0x583e78(0xbb));return globalThis[_0x583e78(0x9b)][_0x583e78(0xa5)](globalThis);}async function readJson(_0x211f92){const _0x524975=_0x8688ea;try{return await _0x211f92[_0x524975(0xb3)]();}catch{throw new WorktreeClientError(_0x211f92[_0x524975(0xae)],_0x524975(0xa9),'Server\x20returned\x20invalid\x20JSON');}}function toClientError(_0x24f2c9,_0x4aed5a){const _0x4d66d4=_0x8688ea,_0x5dc1d8=isRecord(_0x4aed5a)&&isRecord(_0x4aed5a[_0x4d66d4(0xbf)])?_0x4aed5a[_0x4d66d4(0xbf)]:{};return new WorktreeClientError(_0x24f2c9,typeof _0x5dc1d8[_0x4d66d4(0xa2)]==='string'||typeof _0x5dc1d8['code']==='number'?_0x5dc1d8['code']:_0x4d66d4(0xb9),typeof _0x5dc1d8[_0x4d66d4(0xc0)]===_0x4d66d4(0xbe)?_0x5dc1d8[_0x4d66d4(0xc0)]:_0x4d66d4(0xaa)+_0x24f2c9,typeof _0x5dc1d8['retryable']===_0x4d66d4(0xa1)?_0x5dc1d8[_0x4d66d4(0xa0)]:undefined);}function bytesToBase64(_0x1f8457){let _0x840473='';for(const _0x11914b of _0x1f8457)_0x840473+=String['fromCharCode'](_0x11914b);return btoa(_0x840473);}function decodeSnapshotBytes(_0x31c2de){const _0xd90f4=_0x8688ea,_0x340a78=_0x31c2de[_0xd90f4(0x99)]??_0x31c2de[_0xd90f4(0xb8)]??_0x31c2de['slide']??_0x31c2de['board'];if(!_0x340a78)return;_0x340a78['originalMeta']=base64ToBytes(_0x340a78[_0xd90f4(0xb5)],0xc8);if(_0x31c2de[_0xd90f4(0x99)])for(const _0x2ca040 of Object[_0xd90f4(0xab)](_0x31c2de[_0xd90f4(0x99)][_0xd90f4(0xc1)])){_0x2ca040['originalMeta']=base64ToBytes(_0x2ca040[_0xd90f4(0xb5)],0xc8);}}function base64ToBytes(_0x506a06,_0x167b1a){const _0x169b0d=_0x8688ea;if(_0x506a06 instanceof Uint8Array)return _0x506a06;if(typeof _0x506a06!==_0x169b0d(0xbe))throw invalidPreviewResponse(_0x167b1a);try{const _0x553e91=atob(_0x506a06);return Uint8Array['from'](_0x553e91,_0x53feca=>_0x53feca[_0x169b0d(0x9e)](0x0));}catch{throw invalidPreviewResponse(_0x167b1a);}}function invalidPreviewResponse(_0x325d02){const _0x3e788d=_0x8688ea;return new WorktreeClientError(_0x325d02,_0x3e788d(0xa9),'Server\x20returned\x20an\x20invalid\x20merge\x20preview');}function isRecord(_0xb7f06){const _0x2ebe27=_0x8688ea;return!!_0xb7f06&&typeof _0xb7f06==='object'&&!Array[_0x2ebe27(0x9f)](_0xb7f06);}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createWorktreeCollaborationConfig, createWorktreeMergePreviewConfig, } from "./config.js";
|
|
2
|
+
export type { CreateWorktreeMergePreviewConfigOptions, CreateWorktreeCollaborationConfigOptions, WorktreeCollaborationConfig, WorktreeMergePreviewConfig, } from "./config.js";
|
|
3
|
+
export type { WorktreeClientOptions, WorktreeEventClientOptions, WorktreeEventSubscription, WorktreeFetch, } from "./management.js";
|
|
4
|
+
export { WorktreeClient, WorktreeClientError, WorktreeEventClient, } from "./management.js";
|
|
5
|
+
export { WorktreeSnapshotServerOverHTTPService } from "./worktree-snapshot-server.js";
|
|
6
|
+
export { WorktreeMergePreviewSnapshotService } from "./merge-preview-snapshot-server.js";
|
|
7
|
+
export type { WorktreeMergePreviewSnapshotServiceOptions } from "./merge-preview-snapshot-server.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x55e02f,_0x7794bb){var _0x349032=_0x90b0,_0x285be=_0x55e02f();while(!![]){try{var _0x333a94=parseInt(_0x349032(0xf5))/0x1*(parseInt(_0x349032(0xf0))/0x2)+-parseInt(_0x349032(0xf7))/0x3*(-parseInt(_0x349032(0xf1))/0x4)+parseInt(_0x349032(0xf3))/0x5*(parseInt(_0x349032(0xf4))/0x6)+-parseInt(_0x349032(0xed))/0x7*(parseInt(_0x349032(0xec))/0x8)+-parseInt(_0x349032(0xef))/0x9+-parseInt(_0x349032(0xee))/0xa*(parseInt(_0x349032(0xeb))/0xb)+-parseInt(_0x349032(0xf2))/0xc*(-parseInt(_0x349032(0xf6))/0xd);if(_0x333a94===_0x7794bb)break;else _0x285be['push'](_0x285be['shift']());}catch(_0x134dab){_0x285be['push'](_0x285be['shift']());}}}(_0xc670,0x5ecf7));function _0xc670(){var _0x5bf135=['12mfZqVN','3588985AMjEjd','6ukKQFG','2885CGBsEK','1262651LcPkWh','174UTEOUs','11OoZeiz','16khMRpS','2152192lHALRD','1427810rCAPSh','1064475oyBqQW','278jkmxOM','3336zfcTvI'];_0xc670=function(){return _0x5bf135;};return _0xc670();}function _0x90b0(_0x16c3b7,_0x63215e){_0x16c3b7=_0x16c3b7-0xeb;var _0xc6704c=_0xc670();var _0x90b084=_0xc6704c[_0x16c3b7];return _0x90b084;}export{createWorktreeCollaborationConfig,createWorktreeMergePreviewConfig}from'./config.js';export{WorktreeClient,WorktreeClientError,WorktreeEventClient}from'./management.js';export{WorktreeSnapshotServerOverHTTPService}from'./worktree-snapshot-server.js';export{WorktreeMergePreviewSnapshotService}from'./merge-preview-snapshot-server.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { WorktreeClientError } from "./http.js";
|
|
2
|
+
export type { WorktreeFetch } from "./http.js";
|
|
3
|
+
export { WorktreeClient } from "./worktree-client.js";
|
|
4
|
+
export type { WorktreeClientOptions } from "./worktree-client.js";
|
|
5
|
+
export { WorktreeEventClient } from "./worktree-event-client.js";
|
|
6
|
+
export type { WorktreeEventClientOptions, WorktreeEventSubscription, } from "./worktree-event-client.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x51b4(_0x49ad31,_0x1fd3a2){_0x49ad31=_0x49ad31-0x110;var _0x353223=_0x3532();var _0x51b423=_0x353223[_0x49ad31];return _0x51b423;}(function(_0x2fba01,_0x462dad){var _0x181050=_0x51b4,_0xb77fc1=_0x2fba01();while(!![]){try{var _0x374d3e=parseInt(_0x181050(0x111))/0x1+-parseInt(_0x181050(0x119))/0x2+-parseInt(_0x181050(0x11a))/0x3+parseInt(_0x181050(0x110))/0x4*(-parseInt(_0x181050(0x118))/0x5)+-parseInt(_0x181050(0x113))/0x6*(-parseInt(_0x181050(0x112))/0x7)+-parseInt(_0x181050(0x117))/0x8*(-parseInt(_0x181050(0x115))/0x9)+-parseInt(_0x181050(0x114))/0xa*(parseInt(_0x181050(0x116))/0xb);if(_0x374d3e===_0x462dad)break;else _0xb77fc1['push'](_0xb77fc1['shift']());}catch(_0x343c91){_0xb77fc1['push'](_0xb77fc1['shift']());}}}(_0x3532,0xa808d));export{WorktreeClientError}from'./http.js';function _0x3532(){var _0x19b1f0=['1548HtSCfd','11RGCYGq','49712koXMiH','5OUmvsJ','665008BRfwTC','3717585TsdFzy','1459516jEDTBm','1163870cWZbvE','3336571ntPrpi','12xtfiGP','5611370UHzrrZ'];_0x3532=function(){return _0x19b1f0;};return _0x3532();}export{WorktreeClient}from'./worktree-client.js';export{WorktreeEventClient}from'./worktree-event-client.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ILogContext, ISnapshotServerService } from "@univerjs-pro/collaboration";
|
|
2
|
+
import type { SaveSnapshotInput } from "@univerjs-pro/collaboration-service";
|
|
3
|
+
import type { IFetchMissingChangesetsRequest, IFetchMissingChangesetsResponse, IGetDeserializedSheetBlockResponse, IGetResourcesRequest, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevRequest, IGetUnitOnRevResponse } from "@univerjs/protocol";
|
|
4
|
+
import { type WorktreeFetch } from "./http.js";
|
|
5
|
+
export interface WorktreeMergePreviewSnapshotServiceOptions {
|
|
6
|
+
readonly origin: string;
|
|
7
|
+
readonly worktreeID: string;
|
|
8
|
+
readonly preview: SaveSnapshotInput;
|
|
9
|
+
readonly fetch?: WorktreeFetch;
|
|
10
|
+
}
|
|
11
|
+
export declare class WorktreeMergePreviewSnapshotService implements ISnapshotServerService {
|
|
12
|
+
private readonly _origin;
|
|
13
|
+
private readonly _worktreeID;
|
|
14
|
+
private readonly _preview;
|
|
15
|
+
private readonly _fetch;
|
|
16
|
+
constructor(options: WorktreeMergePreviewSnapshotServiceOptions);
|
|
17
|
+
getUnitOnRev(_context: ILogContext, params: IGetUnitOnRevRequest): Promise<IGetUnitOnRevResponse>;
|
|
18
|
+
getSheetBlock(_context: ILogContext, params: IGetSheetBlockRequest): Promise<IGetSheetBlockResponse>;
|
|
19
|
+
getDeserializedSheetBlock(context: ILogContext, params: IGetSheetBlockRequest): Promise<IGetDeserializedSheetBlockResponse | IGetSheetBlockResponse>;
|
|
20
|
+
fetchMissingChangesets(_context: ILogContext, params: IFetchMissingChangesetsRequest): Promise<IFetchMissingChangesetsResponse>;
|
|
21
|
+
getResourcesRequest(_context: ILogContext, params: IGetResourcesRequest): Promise<IGetResourcesResponse>;
|
|
22
|
+
saveSnapshot(): Promise<never>;
|
|
23
|
+
updateSnapshot(): Promise<never>;
|
|
24
|
+
saveSheetBlock(): Promise<never>;
|
|
25
|
+
saveChangeset(): Promise<never>;
|
|
26
|
+
copyFileMeta(): Promise<never>;
|
|
27
|
+
getLatestCsReqIdBySid(): Promise<never>;
|
|
28
|
+
private _validateIdentity;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x20f4(){const _0x2bc40d=['getDeserializedSheetBlock','/snapshot','10uoFRzj','reject','_origin','resources','8362026mMMAuf','filter','3484755gCnjVK','31770paFfnj','Merge\x20preview\x20block\x20','sheetBlocks','worktreeID','unitID','preview','363113RjBKJR','getResourcesRequest','resolve','getUnitOnRev','1291770mYHbKz','type','getLatestCsReqIdBySid','origin','104CpYSwe','2fyXeKD','saveSnapshot','blockID','saveChangeset','Merge\x20preview\x20resources\x20response\x20is\x20invalid','resourceIDs','\x20is\x20missing','json','_fetch','_validateIdentity','updateSnapshot','_worktreeID','stringify','232GdpQiF','length','saveSheetBlock','11pvqEem','Merge\x20preview\x20Unit\x20identity\x20does\x20not\x20match','_preview','getSheetBlock','/resources?resourceId=','10996704uPMTAP','map','13412LZtEVd','fetch','Merge\x20preview\x20snapshot\x20service\x20is\x20read-only','snapshot','fetchMissingChangesets'];_0x20f4=function(){return _0x2bc40d;};return _0x20f4();}const _0x55811d=_0x5b9c;(function(_0xe5d09d,_0x4cd797){const _0x4e8d5c=_0x5b9c,_0x4c2a4b=_0xe5d09d();while(!![]){try{const _0x45a476=parseInt(_0x4e8d5c(0xa1))/0x1*(-parseInt(_0x4e8d5c(0xaa))/0x2)+-parseInt(_0x4e8d5c(0x9b))/0x3*(-parseInt(_0x4e8d5c(0xa9))/0x4)+-parseInt(_0x4e8d5c(0x9a))/0x5+-parseInt(_0x4e8d5c(0xa5))/0x6+-parseInt(_0x4e8d5c(0x8d))/0x7*(parseInt(_0x4e8d5c(0x83))/0x8)+parseInt(_0x4e8d5c(0x98))/0x9*(parseInt(_0x4e8d5c(0x94))/0xa)+parseInt(_0x4e8d5c(0x86))/0xb*(parseInt(_0x4e8d5c(0x8b))/0xc);if(_0x45a476===_0x4cd797)break;else _0x4c2a4b['push'](_0x4c2a4b['shift']());}catch(_0x577586){_0x4c2a4b['push'](_0x4c2a4b['shift']());}}}(_0x20f4,0xc0da3));import{defaultFetch}from'./http.js';import{normalizeOrigin,worktreeBaseUrl}from'./url.js';export class WorktreeMergePreviewSnapshotService{[_0x55811d(0x96)];[_0x55811d(0x81)];['_preview'];[_0x55811d(0x7e)];constructor(_0x536efb){const _0x3ecc0a=_0x55811d;this[_0x3ecc0a(0x96)]=normalizeOrigin(_0x536efb[_0x3ecc0a(0xa8)]),this['_worktreeID']=_0x536efb[_0x3ecc0a(0x9e)],this['_preview']=_0x536efb[_0x3ecc0a(0xa0)],this[_0x3ecc0a(0x7e)]=_0x536efb[_0x3ecc0a(0x8e)]??defaultFetch();}[_0x55811d(0xa4)](_0x48b9b3,_0x1e7ee6){const _0x145769=_0x55811d;return this[_0x145769(0x7f)](_0x1e7ee6['unitID'],_0x1e7ee6[_0x145769(0xa6)]),Promise['resolve']({'error':undefined,'snapshot':this[_0x145769(0x88)][_0x145769(0x90)],'changesets':[]});}[_0x55811d(0x89)](_0x2fecad,_0x408b67){const _0x14ad98=_0x55811d;this['_validateIdentity'](_0x408b67[_0x14ad98(0x9f)],_0x408b67['type']);const _0xfb5f49=this[_0x14ad98(0x88)][_0x14ad98(0x9d)]?.['find'](_0x22d10e=>_0x22d10e['id']===_0x408b67[_0x14ad98(0x78)]);if(!_0xfb5f49)return Promise[_0x14ad98(0x95)](new Error(_0x14ad98(0x9c)+_0x408b67[_0x14ad98(0x78)]+_0x14ad98(0x7c)));return Promise['resolve']({'error':undefined,'block':_0xfb5f49});}[_0x55811d(0x92)](_0x593d52,_0x1f5b4f){const _0x46c9c0=_0x55811d;return this[_0x46c9c0(0x89)](_0x593d52,_0x1f5b4f);}[_0x55811d(0x91)](_0x579799,_0x58eab1){const _0x3f4682=_0x55811d;return this[_0x3f4682(0x7f)](_0x58eab1[_0x3f4682(0x9f)],_0x58eab1[_0x3f4682(0xa6)]),Promise[_0x3f4682(0xa3)]({'error':undefined,'changesets':[],'latestRevision':this[_0x3f4682(0x88)][_0x3f4682(0x90)]['rev']});}async[_0x55811d(0xa2)](_0x58adbd,_0xb9ccf0){const _0x3152d6=_0x55811d;this['_validateIdentity'](_0xb9ccf0[_0x3152d6(0x9f)],_0xb9ccf0[_0x3152d6(0xa6)]);const _0x5a9406=this[_0x3152d6(0x88)][_0x3152d6(0x97)]??{},_0x4e03a9=Object['fromEntries'](_0xb9ccf0[_0x3152d6(0x7b)][_0x3152d6(0x99)](_0x4bfe95=>_0x5a9406[_0x4bfe95]!==undefined)[_0x3152d6(0x8c)](_0x5503ce=>[_0x5503ce,_0x5a9406[_0x5503ce]])),_0x1a8f21=_0xb9ccf0[_0x3152d6(0x7b)]['filter'](_0x2a06b9=>_0x5a9406[_0x2a06b9]===undefined);if(_0x1a8f21[_0x3152d6(0x84)]===0x0)return{'error':undefined,'resources':_0x4e03a9};const _0x48689a=worktreeBaseUrl(this['_origin'],this[_0x3152d6(0x81)])+_0x3152d6(0x93),_0x5ba149=_0x48689a+'/'+_0xb9ccf0[_0x3152d6(0xa6)]+'/unit/'+encodeURIComponent(_0xb9ccf0[_0x3152d6(0x9f)])+_0x3152d6(0x8a)+encodeURIComponent(JSON[_0x3152d6(0x82)](_0x1a8f21)),_0x40a5c6=await this[_0x3152d6(0x7e)](_0x5ba149);if(!_0x40a5c6['ok'])throw new Error('Merge\x20preview\x20resources\x20request\x20failed\x20with\x20HTTP\x20'+_0x40a5c6['status']);const _0x1b90a0=await _0x40a5c6[_0x3152d6(0x7d)]();if(!_0x1b90a0[_0x3152d6(0x97)]||typeof _0x1b90a0['resources']!=='object')throw new Error(_0x3152d6(0x7a));return{'error':undefined,'resources':{..._0x4e03a9,..._0x1b90a0[_0x3152d6(0x97)]}};}[_0x55811d(0xab)](){return readOnlyFailure();}[_0x55811d(0x80)](){return readOnlyFailure();}[_0x55811d(0x85)](){return readOnlyFailure();}[_0x55811d(0x79)](){return readOnlyFailure();}['copyFileMeta'](){return readOnlyFailure();}[_0x55811d(0xa7)](){return readOnlyFailure();}[_0x55811d(0x7f)](_0x5ca234,_0x4841f8){const _0x26256a=_0x55811d;if(_0x5ca234!==this[_0x26256a(0x88)][_0x26256a(0x90)]['unitID']||_0x4841f8!==this['_preview'][_0x26256a(0x90)][_0x26256a(0xa6)])throw new Error(_0x26256a(0x87));}}function _0x5b9c(_0x36e269,_0x234938){_0x36e269=_0x36e269-0x78;const _0x20f48b=_0x20f4();let _0x5b9cca=_0x20f48b[_0x36e269];return _0x5b9cca;}function readOnlyFailure(){const _0x231ff2=_0x55811d;return Promise[_0x231ff2(0x95)](new Error(_0x231ff2(0x8f)));}
|
package/dist/url.d.ts
ADDED
package/dist/url.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x3ce200,_0x29f60f){const _0xa90228=_0x33dd,_0x3718b4=_0x3ce200();while(!![]){try{const _0x52d03b=parseInt(_0xa90228(0x80))/0x1+-parseInt(_0xa90228(0x7f))/0x2+-parseInt(_0xa90228(0x8b))/0x3+-parseInt(_0xa90228(0x78))/0x4*(parseInt(_0xa90228(0x77))/0x5)+-parseInt(_0xa90228(0x88))/0x6+-parseInt(_0xa90228(0x7c))/0x7+parseInt(_0xa90228(0x7a))/0x8;if(_0x52d03b===_0x29f60f)break;else _0x3718b4['push'](_0x3718b4['shift']());}catch(_0x4fdf92){_0x3718b4['push'](_0x3718b4['shift']());}}}(_0x3e8b,0x599dd));export function normalizeOrigin(_0x51f33d){const _0x180ce6=_0x33dd;let _0x690452;try{_0x690452=new URL(_0x51f33d);}catch{throw new TypeError(_0x180ce6(0x83));}if(_0x690452['protocol']!=='http:'&&_0x690452[_0x180ce6(0x76)]!==_0x180ce6(0x8a))throw new TypeError(_0x180ce6(0x87));if(_0x690452[_0x180ce6(0x86)]!=='/'||_0x690452[_0x180ce6(0x85)]||_0x690452['hash']||_0x690452[_0x180ce6(0x79)]||_0x690452['password'])throw new TypeError(_0x180ce6(0x82));return _0x690452[_0x180ce6(0x89)];}export function worktreeBaseUrl(_0x2fe1c6,_0x51ced9){const _0x1e05fa=_0x33dd;if(!_0x51ced9)throw new TypeError(_0x1e05fa(0x8c));return _0x2fe1c6+_0x1e05fa(0x81)+encodeURIComponent(_0x51ced9);}function _0x33dd(_0x13f5f5,_0x210afc){_0x13f5f5=_0x13f5f5-0x76;const _0x3e8b6=_0x3e8b();let _0x33dd7e=_0x3e8b6[_0x13f5f5];return _0x33dd7e;}export function worktreeWebSocketBaseUrl(_0x436feb,_0x1f4430){const _0x3adc9a=_0x33dd,_0x247a53=new URL(worktreeBaseUrl(_0x436feb,_0x1f4430));return _0x247a53[_0x3adc9a(0x76)]=_0x247a53[_0x3adc9a(0x76)]==='https:'?_0x3adc9a(0x7d):_0x3adc9a(0x7b),_0x247a53[_0x3adc9a(0x7e)]()[_0x3adc9a(0x84)](/\/$/,'');}function _0x3e8b(){const _0x4dcf63=['origin\x20must\x20be\x20an\x20absolute\x20HTTP(S)\x20URL','replace','search','pathname','origin\x20must\x20use\x20HTTP\x20or\x20HTTPS','3649008BzQkqp','origin','https:','1383897yHuHRQ','worktreeID\x20is\x20required','protocol','1813590zoqgUL','8elACwI','username','22416448txdSXe','ws:','4717524YHaoSk','wss:','toString','564568cItJJB','316132QQwNPS','/universer-api/worktrees/','origin\x20cannot\x20contain\x20path,\x20credentials\x20or\x20query'];_0x3e8b=function(){return _0x4dcf63;};return _0x3e8b();}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CreateUnitFromDataInput, CreateUnitInput } from "@univerjs-pro/collaboration-service";
|
|
2
|
+
import type { CreateWorktreeInput, WorktreeData, WorktreeUnitMergeEvaluation } from "@univerjs-pro/collaboration-worktree-service";
|
|
3
|
+
import { type WorktreeHttpOptions } from "./http.js";
|
|
4
|
+
export interface WorktreeClientOptions extends WorktreeHttpOptions {
|
|
5
|
+
readonly origin: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class WorktreeClient {
|
|
8
|
+
private readonly _origin;
|
|
9
|
+
private readonly _fetch;
|
|
10
|
+
constructor(options: WorktreeClientOptions);
|
|
11
|
+
createWorktree(input: CreateWorktreeInput): Promise<WorktreeData>;
|
|
12
|
+
getWorktree(worktreeID: string): Promise<WorktreeData>;
|
|
13
|
+
evaluateUnitMerge(worktreeID: string, unitID: string): Promise<WorktreeUnitMergeEvaluation>;
|
|
14
|
+
addUnit(worktreeID: string, unitID: string): Promise<WorktreeData>;
|
|
15
|
+
createUnit(worktreeID: string, input: CreateUnitInput): Promise<WorktreeData>;
|
|
16
|
+
createUnitFromData(worktreeID: string, input: CreateUnitFromDataInput): Promise<WorktreeData>;
|
|
17
|
+
markReady(worktreeID: string): Promise<WorktreeData>;
|
|
18
|
+
reopenWorktree(worktreeID: string): Promise<WorktreeData>;
|
|
19
|
+
discardWorktree(worktreeID: string): Promise<WorktreeData>;
|
|
20
|
+
mergeWorktree(worktreeID: string): Promise<WorktreeData>;
|
|
21
|
+
private _post;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _0x46eb38=_0x42a0;(function(_0x6877d3,_0x31a952){var _0x53bb0e=_0x42a0,_0x9a413e=_0x6877d3();while(!![]){try{var _0x10160f=parseInt(_0x53bb0e(0x19f))/0x1*(parseInt(_0x53bb0e(0x191))/0x2)+-parseInt(_0x53bb0e(0x193))/0x3*(-parseInt(_0x53bb0e(0x1a2))/0x4)+-parseInt(_0x53bb0e(0x194))/0x5*(-parseInt(_0x53bb0e(0x187))/0x6)+parseInt(_0x53bb0e(0x1a4))/0x7*(parseInt(_0x53bb0e(0x195))/0x8)+-parseInt(_0x53bb0e(0x18e))/0x9*(parseInt(_0x53bb0e(0x189))/0xa)+parseInt(_0x53bb0e(0x18d))/0xb*(parseInt(_0x53bb0e(0x1a9))/0xc)+-parseInt(_0x53bb0e(0x18a))/0xd;if(_0x10160f===_0x31a952)break;else _0x9a413e['push'](_0x9a413e['shift']());}catch(_0x7a7ac9){_0x9a413e['push'](_0x9a413e['shift']());}}}(_0x2445,0x468be));import{defaultFetch,jsonRequest,requestWorktree,requestWorktreeUnitMergeEvaluation}from'./http.js';function _0x42a0(_0x20e38e,_0x3ea71a){_0x20e38e=_0x20e38e-0x187;var _0x2445f9=_0x2445();var _0x42a0a8=_0x2445f9[_0x20e38e];return _0x42a0a8;}function _0x2445(){var _0xdc61d=['createUnitFromData','origin','createUnit','discard','merge','mergeWorktree','discardWorktree','addUnit','1765IPoney','createWorktree','units','48oNxqFp','/units/','100394wbIlBN','reopenWorktree','_origin','_post','getWorktree','96QtoxET','48DcxpOL','evaluateUnitMerge','870nPBKMZ','6563908IgGvmx','reopen','/universer-api/worktrees','465971LERSfj','6939xlRYjj','units/from-snapshot','units/from-data','134KRUQZC','_fetch','54657ABIVlb','97810RwYwLY','16oWyVfE','ready'];_0x2445=function(){return _0xdc61d;};return _0x2445();}import{normalizeOrigin,worktreeBaseUrl}from'./url.js';export class WorktreeClient{[_0x46eb38(0x1a6)];[_0x46eb38(0x192)];constructor(_0x1a43f3){var _0x420e15=_0x46eb38;this[_0x420e15(0x1a6)]=normalizeOrigin(_0x1a43f3[_0x420e15(0x198)]),this['_fetch']=_0x1a43f3['fetch']??defaultFetch();}[_0x46eb38(0x1a0)](_0x5e81b7){var _0x3586ea=_0x46eb38;return requestWorktree(this[_0x3586ea(0x192)],this[_0x3586ea(0x1a6)]+_0x3586ea(0x18c),jsonRequest(_0x5e81b7));}[_0x46eb38(0x1a8)](_0x5aff01){var _0x3776ed=_0x46eb38;return requestWorktree(this['_fetch'],worktreeBaseUrl(this[_0x3776ed(0x1a6)],_0x5aff01));}[_0x46eb38(0x188)](_0x263832,_0x560305){var _0x2a9354=_0x46eb38;return requestWorktreeUnitMergeEvaluation(this[_0x2a9354(0x192)],worktreeBaseUrl(this['_origin'],_0x263832)+_0x2a9354(0x1a3)+encodeURIComponent(_0x560305)+'/merge-preview');}[_0x46eb38(0x19e)](_0x2064df,_0x241ae6){var _0x3c3caa=_0x46eb38;return this['_post'](_0x2064df,_0x3c3caa(0x1a1),{'unitID':_0x241ae6});}[_0x46eb38(0x199)](_0x1e0fd0,_0x12e2cc){var _0x2f88cc=_0x46eb38;return this[_0x2f88cc(0x1a7)](_0x1e0fd0,_0x2f88cc(0x18f),_0x12e2cc);}[_0x46eb38(0x197)](_0x6308a3,_0x5f5bff){var _0x13e9c2=_0x46eb38;return this['_post'](_0x6308a3,_0x13e9c2(0x190),_0x5f5bff);}['markReady'](_0x750d6f){var _0x54419d=_0x46eb38;return this[_0x54419d(0x1a7)](_0x750d6f,_0x54419d(0x196));}[_0x46eb38(0x1a5)](_0x19cca4){var _0x58a77e=_0x46eb38;return this[_0x58a77e(0x1a7)](_0x19cca4,_0x58a77e(0x18b));}[_0x46eb38(0x19d)](_0x4b54f8){var _0x4d69a8=_0x46eb38;return this['_post'](_0x4b54f8,_0x4d69a8(0x19a));}[_0x46eb38(0x19c)](_0x555626){var _0x12066c=_0x46eb38;return this[_0x12066c(0x1a7)](_0x555626,_0x12066c(0x19b));}['_post'](_0x2d87a9,_0xe3d013,_0xf40f9c){var _0x5864d3=_0x46eb38;return requestWorktree(this['_fetch'],worktreeBaseUrl(this[_0x5864d3(0x1a6)],_0x2d87a9)+'/'+_0xe3d013,jsonRequest(_0xf40f9c));}}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { WorktreeData } from "@univerjs-pro/collaboration-worktree-service";
|
|
2
|
+
import { type WorktreeHttpOptions } from "./http.js";
|
|
3
|
+
export interface WorktreeEventClientOptions extends WorktreeHttpOptions {
|
|
4
|
+
readonly origin: string;
|
|
5
|
+
readonly worktreeID: string;
|
|
6
|
+
readonly reconnectDelayMs?: number;
|
|
7
|
+
readonly createWebSocket?: (url: string) => WebSocket;
|
|
8
|
+
}
|
|
9
|
+
export interface WorktreeEventSubscription {
|
|
10
|
+
dispose(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class WorktreeEventClient {
|
|
13
|
+
private readonly _origin;
|
|
14
|
+
private readonly _worktreeID;
|
|
15
|
+
private readonly _fetch;
|
|
16
|
+
private readonly _reconnectDelayMs;
|
|
17
|
+
private readonly _createWebSocket;
|
|
18
|
+
private readonly _listeners;
|
|
19
|
+
private _socket;
|
|
20
|
+
private _reconnectTimer;
|
|
21
|
+
private _current;
|
|
22
|
+
private _disposed;
|
|
23
|
+
private _connectedOnce;
|
|
24
|
+
constructor(options: WorktreeEventClientOptions);
|
|
25
|
+
get current(): WorktreeData | undefined;
|
|
26
|
+
onChange(listener: (worktree: WorktreeData) => void): WorktreeEventSubscription;
|
|
27
|
+
connect(): Promise<WorktreeData>;
|
|
28
|
+
dispose(): void;
|
|
29
|
+
private _open;
|
|
30
|
+
private _scheduleReconnect;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x5e6fb3=_0x3300;(function(_0x389ae0,_0x54aed9){const _0x52c3ca=_0x3300,_0x1f7b61=_0x389ae0();while(!![]){try{const _0x540b16=-parseInt(_0x52c3ca(0x88))/0x1*(-parseInt(_0x52c3ca(0x86))/0x2)+parseInt(_0x52c3ca(0x90))/0x3*(-parseInt(_0x52c3ca(0x9d))/0x4)+-parseInt(_0x52c3ca(0x7f))/0x5+-parseInt(_0x52c3ca(0x91))/0x6+parseInt(_0x52c3ca(0xa1))/0x7+-parseInt(_0x52c3ca(0xab))/0x8*(parseInt(_0x52c3ca(0x7d))/0x9)+-parseInt(_0x52c3ca(0x9f))/0xa*(-parseInt(_0x52c3ca(0xb1))/0xb);if(_0x540b16===_0x54aed9)break;else _0x1f7b61['push'](_0x1f7b61['shift']());}catch(_0x45b0bd){_0x1f7b61['push'](_0x1f7b61['shift']());}}}(_0x40c4,0xb9bb0));function _0x3300(_0x4b65db,_0x2b17fc){_0x4b65db=_0x4b65db-0x7d;const _0x40c496=_0x40c4();let _0x330072=_0x40c496[_0x4b65db];return _0x330072;}import{defaultFetch,requestTicket}from'./http.js';import{normalizeOrigin,worktreeWebSocketBaseUrl}from'./url.js';export class WorktreeEventClient{[_0x5e6fb3(0x95)];[_0x5e6fb3(0x7e)];['_fetch'];[_0x5e6fb3(0xad)];[_0x5e6fb3(0x80)];[_0x5e6fb3(0xa7)]=new Set();[_0x5e6fb3(0xb0)];[_0x5e6fb3(0x93)];[_0x5e6fb3(0x83)];['_disposed']=![];[_0x5e6fb3(0x8b)]=![];constructor(_0x55014e){const _0x522f20=_0x5e6fb3;this[_0x522f20(0x95)]=normalizeOrigin(_0x55014e[_0x522f20(0x99)]);if(!_0x55014e['worktreeID'])throw new TypeError(_0x522f20(0xa4));this[_0x522f20(0x7e)]=_0x55014e[_0x522f20(0x8c)],this['_fetch']=_0x55014e[_0x522f20(0xae)]??defaultFetch(),this[_0x522f20(0xad)]=_0x55014e[_0x522f20(0x98)]??0x3e8;if(!Number['isSafeInteger'](this['_reconnectDelayMs'])||this[_0x522f20(0xad)]<0x0)throw new TypeError('reconnectDelayMs\x20must\x20be\x20a\x20non-negative\x20integer');this[_0x522f20(0x80)]=_0x55014e[_0x522f20(0xa3)]??(_0x596a78=>{const _0x5611d9=_0x522f20;if(typeof globalThis[_0x5611d9(0x97)]!=='function')throw new TypeError(_0x5611d9(0x96));return new globalThis[(_0x5611d9(0x97))](_0x596a78);});}get[_0x5e6fb3(0x82)](){return this['_current'];}[_0x5e6fb3(0xa9)](_0x1c1b57){const _0x265dd6=_0x5e6fb3;return this[_0x265dd6(0xa7)][_0x265dd6(0x81)](_0x1c1b57),{'dispose':()=>this[_0x265dd6(0xa7)]['delete'](_0x1c1b57)};}async[_0x5e6fb3(0x9b)](){const _0x3c36a8=_0x5e6fb3;if(this[_0x3c36a8(0x9e)])throw new Error(_0x3c36a8(0x8d));if(this[_0x3c36a8(0x83)])return this[_0x3c36a8(0x83)];return this[_0x3c36a8(0xb2)](![]);}['dispose'](){const _0x58721f=_0x5e6fb3;if(this[_0x58721f(0x9e)])return;this[_0x58721f(0x9e)]=!![];if(this['_reconnectTimer'])clearTimeout(this[_0x58721f(0x93)]);this[_0x58721f(0xb0)]?.['close'](0x3e8,_0x58721f(0xa5)),this[_0x58721f(0xb0)]=undefined,this['_listeners'][_0x58721f(0xa8)]();}async['_open'](_0x15c327){const _0x411aac=_0x5e6fb3,_0x22b252=await requestTicket(this[_0x411aac(0x8f)],this[_0x411aac(0x95)]+'/universer-api/user/session-ticket');if(this[_0x411aac(0x9e)])throw new Error(_0x411aac(0x8d));const _0x52d436=worktreeWebSocketBaseUrl(this[_0x411aac(0x95)],this[_0x411aac(0x7e)])+_0x411aac(0xac)+encodeURIComponent(_0x22b252);return new Promise((_0x15787c,_0x318427)=>{const _0x37f900=_0x411aac;let _0x4f1af8=![];const _0x1b189e=this[_0x37f900(0x80)](_0x52d436);this['_socket']=_0x1b189e,_0x1b189e[_0x37f900(0xa6)](_0x37f900(0x8e),_0x34d335=>{const _0xe17484=_0x37f900;try{const _0x5c0449=parseChangedMessage(_0x34d335[_0xe17484(0x8a)]);_0x4f1af8=!![],this[_0xe17484(0x8b)]=!![],this[_0xe17484(0x83)]=_0x5c0449;for(const _0x1600e6 of[...this[_0xe17484(0xa7)]]){try{_0x1600e6(_0x5c0449);}catch{}}_0x15787c(_0x5c0449);}catch(_0x4e70ed){_0x1b189e[_0xe17484(0x84)](0x3eb,_0xe17484(0x94));if(!_0x4f1af8)_0x318427(_0x4e70ed);}}),_0x1b189e[_0x37f900(0xa6)](_0x37f900(0x92),()=>{const _0x17dd3e=_0x37f900;if(!_0x4f1af8)_0x318427(new Error(_0x17dd3e(0x9c)));}),_0x1b189e[_0x37f900(0xa6)](_0x37f900(0x84),()=>{const _0x3df387=_0x37f900;if(this[_0x3df387(0xb0)]===_0x1b189e)this[_0x3df387(0xb0)]=undefined;!_0x4f1af8&&!_0x15c327&&_0x318427(new Error('Worktree\x20event\x20connection\x20closed'));if(this[_0x3df387(0x8b)])this[_0x3df387(0x85)]();});});}[_0x5e6fb3(0x85)](){const _0x3867cc=_0x5e6fb3;if(this['_disposed']||this[_0x3867cc(0x93)])return;this[_0x3867cc(0x93)]=setTimeout(()=>{const _0x15ea76=_0x3867cc;this[_0x15ea76(0x93)]=undefined,void this[_0x15ea76(0xb2)](!![])[_0x15ea76(0xb3)](()=>this[_0x15ea76(0x85)]());},this[_0x3867cc(0xad)]);}}function _0x40c4(){const _0x548e30=['_origin','A\x20WebSocket\x20implementation\x20is\x20required','WebSocket','reconnectDelayMs','origin','decode','connect','Worktree\x20event\x20connection\x20failed','40nHQboD','_disposed','20vBoDrY','object','9247609JzJlVW','parse','createWebSocket','worktreeID\x20is\x20required','Client\x20disposed','addEventListener','_listeners','clear','onChange','Invalid\x20Worktree\x20event\x20message','1086104GsFmkt','/events?sessionTicket=','_reconnectDelayMs','fetch','event','_socket','15963508DwMdlC','_open','catch','72eMMxVO','_worktreeID','4549315zWKfgK','_createWebSocket','add','current','_current','close','_scheduleReconnect','1742764nZKGHC','string','1oyyKbM','worktree','data','_connectedOnce','worktreeID','WorktreeEventClient\x20is\x20disposed','message','_fetch','310656dDCxtI','7816116jtvEON','error','_reconnectTimer','Invalid\x20Worktree\x20event'];_0x40c4=function(){return _0x548e30;};return _0x40c4();}function parseChangedMessage(_0x5708fa){const _0x356090=_0x5e6fb3,_0x58edb3=typeof _0x5708fa===_0x356090(0x87)?JSON[_0x356090(0xa2)](_0x5708fa):_0x5708fa instanceof Blob?undefined:JSON[_0x356090(0xa2)](new TextDecoder()[_0x356090(0x9a)](_0x5708fa));if(!_0x58edb3||typeof _0x58edb3!==_0x356090(0xa0)||_0x58edb3[_0x356090(0xaf)]!=='worktreeChanged'||!_0x58edb3['worktree']||typeof _0x58edb3[_0x356090(0x89)]!=='object')throw new Error(_0x356090(0xaa));return _0x58edb3['worktree'];}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ILogContext } from "@univerjs-pro/collaboration";
|
|
2
|
+
import { SnapshotServerOverHTTPService } from "@univerjs-pro/collaboration-client";
|
|
3
|
+
import { IConfigService } from "@univerjs/core";
|
|
4
|
+
import { HTTPService } from "@univerjs/network";
|
|
5
|
+
import type { IGetResourcesRequest, IGetResourcesResponse } from "@univerjs/protocol";
|
|
6
|
+
export declare class WorktreeSnapshotServerOverHTTPService extends SnapshotServerOverHTTPService {
|
|
7
|
+
private readonly _worktreeConfigService;
|
|
8
|
+
private readonly _worktreeHttpService;
|
|
9
|
+
constructor(_worktreeConfigService: IConfigService, _worktreeHttpService: HTTPService);
|
|
10
|
+
getResourcesRequest(_context: ILogContext, params: IGetResourcesRequest): Promise<IGetResourcesResponse>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x8df8(_0x3892eb,_0x2ddd16){_0x3892eb=_0x3892eb-0x19e;var _0x2e5545=_0x2e55();var _0x8df802=_0x2e5545[_0x3892eb];return _0x8df802;}var _0x2fcb72=_0x8df8;function _0x2e55(){var _0x527033=['__param','stringify','type','getOwnPropertyDescriptor','1034831QqqUdg','6YOeRAL','resourceIDs','1431940jLBOWY','332pzXOMg','11499vvIwGd','1042145IynURb','_worktreeConfigService','/resources','snapshotServerUrl','2547wzJXUy','object','defineProperty','__decorate','/unit/','unitID','_worktreeHttpService','get','getResourcesRequest','function','5848LUWMJQ','length','887692DlOAzX','42760WIbXTd','getConfig','decorate'];_0x2e55=function(){return _0x527033;};return _0x2e55();}(function(_0x2e6a29,_0x1cc1f4){var _0x53e9f3=_0x8df8,_0x438e8c=_0x2e6a29();while(!![]){try{var _0x8e2406=-parseInt(_0x53e9f3(0x1b1))/0x1+-parseInt(_0x53e9f3(0x19e))/0x2*(-parseInt(_0x53e9f3(0x19f))/0x3)+-parseInt(_0x53e9f3(0x1b0))/0x4+parseInt(_0x53e9f3(0x1a0))/0x5*(parseInt(_0x53e9f3(0x1b9))/0x6)+parseInt(_0x53e9f3(0x1b8))/0x7+-parseInt(_0x53e9f3(0x1ae))/0x8*(parseInt(_0x53e9f3(0x1a4))/0x9)+-parseInt(_0x53e9f3(0x1bb))/0xa;if(_0x8e2406===_0x1cc1f4)break;else _0x438e8c['push'](_0x438e8c['shift']());}catch(_0x21893c){_0x438e8c['push'](_0x438e8c['shift']());}}}(_0x2e55,0x5c3be));var __decorate=this&&this[_0x2fcb72(0x1a7)]||function(_0x3be3c9,_0x5c38d1,_0x229770,_0x366fac){var _0xb5ba3c=_0x2fcb72,_0x3efdd8=arguments[_0xb5ba3c(0x1af)],_0x2686c5=_0x3efdd8<0x3?_0x5c38d1:_0x366fac===null?_0x366fac=Object[_0xb5ba3c(0x1b7)](_0x5c38d1,_0x229770):_0x366fac,_0xabc523;if(typeof Reflect===_0xb5ba3c(0x1a5)&&typeof Reflect[_0xb5ba3c(0x1b3)]===_0xb5ba3c(0x1ad))_0x2686c5=Reflect['decorate'](_0x3be3c9,_0x5c38d1,_0x229770,_0x366fac);else{for(var _0x93b8f5=_0x3be3c9['length']-0x1;_0x93b8f5>=0x0;_0x93b8f5--)if(_0xabc523=_0x3be3c9[_0x93b8f5])_0x2686c5=(_0x3efdd8<0x3?_0xabc523(_0x2686c5):_0x3efdd8>0x3?_0xabc523(_0x5c38d1,_0x229770,_0x2686c5):_0xabc523(_0x5c38d1,_0x229770))||_0x2686c5;}return _0x3efdd8>0x3&&_0x2686c5&&Object[_0xb5ba3c(0x1a6)](_0x5c38d1,_0x229770,_0x2686c5),_0x2686c5;},__param=this&&this[_0x2fcb72(0x1b4)]||function(_0x35b83b,_0x18d0db){return function(_0x337d4a,_0x30e910){_0x18d0db(_0x337d4a,_0x30e910,_0x35b83b);};};import{SnapshotServerOverHTTPService}from'@univerjs-pro/collaboration-client';import{COLLABORATION_CLIENT_PLUGIN_CONFIG_KEY}from'@univerjs-pro/collaboration-client';import{IConfigService,Inject}from'@univerjs/core';import{HTTPService}from'@univerjs/network';let WorktreeSnapshotServerOverHTTPService=class WorktreeSnapshotServerOverHTTPService extends SnapshotServerOverHTTPService{['_worktreeConfigService'];[_0x2fcb72(0x1aa)];constructor(_0x491940,_0x3ba256){var _0x37153b=_0x2fcb72;super(_0x491940,_0x3ba256),this[_0x37153b(0x1a1)]=_0x491940,this[_0x37153b(0x1aa)]=_0x3ba256;}async['getResourcesRequest'](_0x3d3883,_0x3a3d6b){var _0x52406f=_0x2fcb72;const _0x5079cf=this[_0x52406f(0x1a1)][_0x52406f(0x1b2)](COLLABORATION_CLIENT_PLUGIN_CONFIG_KEY),_0x26981a=_0x5079cf?.[_0x52406f(0x1a3)];if(!_0x26981a)return super[_0x52406f(0x1ac)](_0x3d3883,_0x3a3d6b);const _0x68bb6e=await this[_0x52406f(0x1aa)][_0x52406f(0x1ab)](_0x26981a+'/'+_0x3a3d6b[_0x52406f(0x1b6)]+_0x52406f(0x1a8)+_0x3a3d6b[_0x52406f(0x1a9)]+_0x52406f(0x1a2),{'params':{'resourceId':JSON[_0x52406f(0x1b5)](_0x3a3d6b[_0x52406f(0x1ba)])}});return _0x68bb6e['body'];}};WorktreeSnapshotServerOverHTTPService=__decorate([__param(0x0,IConfigService),__param(0x1,Inject(HTTPService))],WorktreeSnapshotServerOverHTTPService);export{WorktreeSnapshotServerOverHTTPService};
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@univerjs-pro/collaboration-worktree-client",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./management": {
|
|
12
|
+
"types": "./dist/management.d.ts",
|
|
13
|
+
"import": "./dist/management.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"version": "1.0.0-insiders.20260727-46ed76c",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@univerjs-pro/collaboration": "1.0.0-insiders.20260727-46ed76c",
|
|
22
|
+
"@univerjs-pro/collaboration-client": "1.0.0-insiders.20260727-46ed76c",
|
|
23
|
+
"@univerjs-pro/collaboration-service": "1.0.0-insiders.20260727-46ed76c",
|
|
24
|
+
"@univerjs-pro/collaboration-worktree-service": "1.0.0-insiders.20260727-46ed76c",
|
|
25
|
+
"@univerjs/core": "1.0.0-insiders.20260727-46ed76c",
|
|
26
|
+
"@univerjs/network": "1.0.0-insiders.20260727-46ed76c",
|
|
27
|
+
"@univerjs/protocol": "1.0.0-insiders.20260727-46ed76c"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
}
|
|
32
|
+
}
|