@symbo.ls/sdk 2.32.6 → 2.32.8
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/cjs/config/environment.js +19 -0
- package/dist/cjs/services/AuthService.js +4 -2
- package/dist/cjs/services/CollabService.js +214 -64
- package/dist/cjs/services/ProjectService.js +19 -10
- package/dist/cjs/utils/CollabClient.js +46 -9
- package/dist/esm/config/environment.js +19 -0
- package/dist/esm/index.js +302 -85
- package/dist/esm/services/AdminService.js +19 -0
- package/dist/esm/services/AuthService.js +23 -2
- package/dist/esm/services/BaseService.js +19 -0
- package/dist/esm/services/BranchService.js +19 -0
- package/dist/esm/services/CollabService.js +279 -73
- package/dist/esm/services/CoreService.js +19 -0
- package/dist/esm/services/DnsService.js +19 -0
- package/dist/esm/services/FileService.js +19 -0
- package/dist/esm/services/PaymentService.js +19 -0
- package/dist/esm/services/PlanService.js +19 -0
- package/dist/esm/services/ProjectService.js +38 -10
- package/dist/esm/services/PullRequestService.js +19 -0
- package/dist/esm/services/ScreenshotService.js +19 -0
- package/dist/esm/services/SubscriptionService.js +19 -0
- package/dist/esm/services/index.js +302 -85
- package/dist/esm/utils/CollabClient.js +65 -9
- package/dist/node/config/environment.js +19 -0
- package/dist/node/services/AuthService.js +4 -2
- package/dist/node/services/CollabService.js +214 -64
- package/dist/node/services/ProjectService.js +19 -10
- package/dist/node/utils/CollabClient.js +46 -9
- package/package.json +6 -6
- package/src/config/environment.js +20 -1
- package/src/services/AuthService.js +7 -2
- package/src/services/CollabService.js +258 -77
- package/src/services/ProjectService.js +19 -10
- package/src/utils/CollabClient.js +51 -8
|
@@ -14113,6 +14113,9 @@ var CONFIG = {
|
|
|
14113
14113
|
// For based api
|
|
14114
14114
|
githubClientId: "Ov23liAFrsR0StbAO6PO",
|
|
14115
14115
|
// For github api
|
|
14116
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/aef64330db80bdfeaac084317bf72f99",
|
|
14117
|
+
// For grafana tracing
|
|
14118
|
+
grafanaAppName: "Localhost Symbols",
|
|
14116
14119
|
// Environment-specific feature toggles (override common)
|
|
14117
14120
|
features: {
|
|
14118
14121
|
betaFeatures: true
|
|
@@ -14128,6 +14131,9 @@ var CONFIG = {
|
|
|
14128
14131
|
socketUrl: "https://dev.api.symbols.app",
|
|
14129
14132
|
apiUrl: "https://dev.api.symbols.app",
|
|
14130
14133
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
14134
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
14135
|
+
// For grafana tracing
|
|
14136
|
+
grafanaAppName: "Symbols Dev",
|
|
14131
14137
|
typesenseCollectionName: "docs",
|
|
14132
14138
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
14133
14139
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -14141,6 +14147,9 @@ var CONFIG = {
|
|
|
14141
14147
|
basedProject: "platform-v2-sm",
|
|
14142
14148
|
basedOrg: "symbols",
|
|
14143
14149
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
14150
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
14151
|
+
// For grafana tracing
|
|
14152
|
+
grafanaAppName: "Symbols Test",
|
|
14144
14153
|
typesenseCollectionName: "docs",
|
|
14145
14154
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
14146
14155
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -14151,6 +14160,9 @@ var CONFIG = {
|
|
|
14151
14160
|
socketUrl: "https://upcoming.api.symbols.app",
|
|
14152
14161
|
apiUrl: "https://upcoming.api.symbols.app",
|
|
14153
14162
|
githubClientId: "Ov23liWF7NvdZ056RV5J",
|
|
14163
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
14164
|
+
// For grafana tracing
|
|
14165
|
+
grafanaAppName: "Symbols Upcoming",
|
|
14154
14166
|
typesenseCollectionName: "docs",
|
|
14155
14167
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
14156
14168
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -14164,6 +14176,9 @@ var CONFIG = {
|
|
|
14164
14176
|
basedProject: "platform-v2-sm",
|
|
14165
14177
|
basedOrg: "symbols",
|
|
14166
14178
|
githubClientId: "Ov23ligwZDQVD0VfuWNa",
|
|
14179
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
14180
|
+
// For grafana tracing
|
|
14181
|
+
grafanaAppName: "Symbols Staging",
|
|
14167
14182
|
typesenseCollectionName: "docs",
|
|
14168
14183
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
14169
14184
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -14177,6 +14192,9 @@ var CONFIG = {
|
|
|
14177
14192
|
basedProject: "platform-v2-sm",
|
|
14178
14193
|
basedOrg: "symbols",
|
|
14179
14194
|
githubClientId: "Ov23liFAlOEIXtX3dBtR",
|
|
14195
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/5c1089f3c3eea4ec5658e05c3f53baae",
|
|
14196
|
+
// For grafana tracing
|
|
14197
|
+
grafanaAppName: "Symbols",
|
|
14180
14198
|
typesenseCollectionName: "docs",
|
|
14181
14199
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
14182
14200
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -14203,6 +14221,7 @@ var getConfig = () => {
|
|
|
14203
14221
|
basedProject: process.env.SYMBOLS_APP_BASED_PROJECT || envConfig.basedProject,
|
|
14204
14222
|
basedOrg: process.env.SYMBOLS_APP_BASED_ORG || envConfig.basedOrg,
|
|
14205
14223
|
githubClientId: process.env.SYMBOLS_APP_GITHUB_CLIENT_ID || envConfig.githubClientId,
|
|
14224
|
+
grafanaUrl: process.env.SYMBOLS_APP_GRAFANA_URL || envConfig.grafanaUrl,
|
|
14206
14225
|
typesenseCollectionName: process.env.TYPESENSE_COLLECTION_NAME || envConfig.typesenseCollectionName,
|
|
14207
14226
|
typesenseApiKey: process.env.TYPESENSE_API_KEY || envConfig.typesenseApiKey,
|
|
14208
14227
|
typesenseHost: process.env.TYPESENSE_HOST || envConfig.typesenseHost,
|
|
@@ -18292,8 +18311,8 @@ var CollabClient = class {
|
|
|
18292
18311
|
__publicField(this, "_buffer", []);
|
|
18293
18312
|
__publicField(this, "_flushTimer", null);
|
|
18294
18313
|
__publicField(this, "_clientId", nanoid());
|
|
18295
|
-
__publicField(this, "_outboxStore",
|
|
18296
|
-
// Dexie table
|
|
18314
|
+
__publicField(this, "_outboxStore", createMemoryOutbox());
|
|
18315
|
+
// Dexie table fallback
|
|
18297
18316
|
__publicField(this, "_readyResolve");
|
|
18298
18317
|
__publicField(this, "ready", new Promise((res) => this._readyResolve = res));
|
|
18299
18318
|
/* ---------- private handlers ---------- */
|
|
@@ -18335,6 +18354,12 @@ var CollabClient = class {
|
|
|
18335
18354
|
await this._outboxStore.clear();
|
|
18336
18355
|
}
|
|
18337
18356
|
});
|
|
18357
|
+
__publicField(this, "_onLiveMode", (flag) => {
|
|
18358
|
+
this.live = flag;
|
|
18359
|
+
});
|
|
18360
|
+
__publicField(this, "_onError", (e) => {
|
|
18361
|
+
console.warn("[collab] socket error", e);
|
|
18362
|
+
});
|
|
18338
18363
|
Object.assign(this, { jwt, projectId, branch, live });
|
|
18339
18364
|
this.ydoc = new Doc();
|
|
18340
18365
|
const hasIndexedDB = typeof globalThis.indexedDB !== "undefined";
|
|
@@ -18347,14 +18372,11 @@ var CollabClient = class {
|
|
|
18347
18372
|
console.warn("[CollabClient] Failed to load IndexeddbPersistence:", err);
|
|
18348
18373
|
});
|
|
18349
18374
|
}
|
|
18350
|
-
if (typeof window
|
|
18351
|
-
this._outboxStore = createMemoryOutbox();
|
|
18352
|
-
} else {
|
|
18375
|
+
if (typeof window !== "undefined" && hasIndexedDB) {
|
|
18353
18376
|
createDexieOutbox(`${projectId}:${branch}`).then((outboxStore) => {
|
|
18354
18377
|
this._outboxStore = outboxStore;
|
|
18355
18378
|
}).catch((err) => {
|
|
18356
18379
|
console.warn("[CollabClient] Failed to load Dexie:", err);
|
|
18357
|
-
this._outboxStore = createMemoryOutbox();
|
|
18358
18380
|
});
|
|
18359
18381
|
}
|
|
18360
18382
|
this.socket = lookup2(environment_default.socketUrl, {
|
|
@@ -18364,9 +18386,7 @@ var CollabClient = class {
|
|
|
18364
18386
|
reconnectionAttempts: Infinity,
|
|
18365
18387
|
reconnectionDelayMax: 4e3
|
|
18366
18388
|
});
|
|
18367
|
-
this.socket.on("snapshot", this._onSnapshot).on("ops", this._onOps).on("commit", this._onCommit).on("liveMode", (
|
|
18368
|
-
this.live = flag;
|
|
18369
|
-
}).on("connect", this._onConnect).on("error", (e) => console.warn("[collab] socket error", e));
|
|
18389
|
+
this.socket.on("snapshot", this._onSnapshot).on("ops", this._onOps).on("commit", this._onCommit).on("liveMode", this._onLiveMode).on("connect", this._onConnect).on("error", this._onError);
|
|
18370
18390
|
this._prevJson = this.ydoc.getMap("root").toJSON();
|
|
18371
18391
|
this.ydoc.on("afterTransaction", (tr) => {
|
|
18372
18392
|
if (tr.origin === "remote") {
|
|
@@ -18413,6 +18433,42 @@ var CollabClient = class {
|
|
|
18413
18433
|
});
|
|
18414
18434
|
this._buffer.length = 0;
|
|
18415
18435
|
}
|
|
18436
|
+
dispose() {
|
|
18437
|
+
var _a;
|
|
18438
|
+
clearTimeout(this._flushTimer);
|
|
18439
|
+
this._flushTimer = null;
|
|
18440
|
+
this._buffer.length = 0;
|
|
18441
|
+
if ((_a = this._outboxStore) == null ? void 0 : _a.clear) {
|
|
18442
|
+
try {
|
|
18443
|
+
const result = this._outboxStore.clear();
|
|
18444
|
+
if (result && typeof result.catch === "function") {
|
|
18445
|
+
result.catch(() => {
|
|
18446
|
+
});
|
|
18447
|
+
}
|
|
18448
|
+
} catch (error) {
|
|
18449
|
+
console.warn("[CollabClient] Failed to clear outbox store during dispose:", error);
|
|
18450
|
+
}
|
|
18451
|
+
}
|
|
18452
|
+
if (this.socket) {
|
|
18453
|
+
this.socket.off("snapshot", this._onSnapshot);
|
|
18454
|
+
this.socket.off("ops", this._onOps);
|
|
18455
|
+
this.socket.off("commit", this._onCommit);
|
|
18456
|
+
this.socket.off("liveMode", this._onLiveMode);
|
|
18457
|
+
this.socket.off("connect", this._onConnect);
|
|
18458
|
+
this.socket.off("error", this._onError);
|
|
18459
|
+
this.socket.removeAllListeners();
|
|
18460
|
+
this.socket.disconnect();
|
|
18461
|
+
this.socket = null;
|
|
18462
|
+
}
|
|
18463
|
+
if (this.ydoc) {
|
|
18464
|
+
this.ydoc.destroy();
|
|
18465
|
+
this.ydoc = null;
|
|
18466
|
+
}
|
|
18467
|
+
if (typeof this._readyResolve === "function") {
|
|
18468
|
+
this._readyResolve();
|
|
18469
|
+
this._readyResolve = null;
|
|
18470
|
+
}
|
|
18471
|
+
}
|
|
18416
18472
|
};
|
|
18417
18473
|
function createMemoryOutbox() {
|
|
18418
18474
|
const store = /* @__PURE__ */ new Map();
|
|
@@ -24971,12 +25027,20 @@ var CollabService = class extends BaseService {
|
|
|
24971
25027
|
this._client = null;
|
|
24972
25028
|
this._stateManager = null;
|
|
24973
25029
|
this._connected = false;
|
|
25030
|
+
this._connecting = false;
|
|
25031
|
+
this._connectPromise = null;
|
|
25032
|
+
this._connectionMeta = null;
|
|
25033
|
+
this._pendingConnectReject = null;
|
|
24974
25034
|
this._undoStack = [];
|
|
24975
25035
|
this._redoStack = [];
|
|
24976
25036
|
this._isUndoRedo = false;
|
|
24977
25037
|
this._pendingOps = [];
|
|
25038
|
+
this._onSocketConnect = this._onSocketConnect.bind(this);
|
|
25039
|
+
this._onSocketDisconnect = this._onSocketDisconnect.bind(this);
|
|
25040
|
+
this._onSocketError = this._onSocketError.bind(this);
|
|
24978
25041
|
}
|
|
24979
25042
|
init({ context }) {
|
|
25043
|
+
super.init({ context });
|
|
24980
25044
|
if (context == null ? void 0 : context.state) {
|
|
24981
25045
|
try {
|
|
24982
25046
|
this._stateManager = new RootStateManager(context.state);
|
|
@@ -25040,86 +25104,196 @@ var CollabService = class extends BaseService {
|
|
|
25040
25104
|
}
|
|
25041
25105
|
/* ---------- Connection Management ---------- */
|
|
25042
25106
|
async connect(options = {}) {
|
|
25043
|
-
|
|
25044
|
-
|
|
25045
|
-
const {
|
|
25046
|
-
authToken: jwt,
|
|
25047
|
-
projectId,
|
|
25048
|
-
branch = "main",
|
|
25049
|
-
pro
|
|
25050
|
-
} = {
|
|
25051
|
-
...this._context,
|
|
25052
|
-
...options
|
|
25053
|
-
};
|
|
25054
|
-
if (!projectId) {
|
|
25055
|
-
const state = (_a = this._stateManager) == null ? void 0 : _a.root;
|
|
25056
|
-
const el = state.__element;
|
|
25057
|
-
el.call("openNotification", {
|
|
25058
|
-
type: "error",
|
|
25059
|
-
title: "projectId is required",
|
|
25060
|
-
message: "projectId is required for CollabService connection"
|
|
25061
|
-
});
|
|
25062
|
-
throw new Error("projectId is required for CollabService connection");
|
|
25063
|
-
}
|
|
25064
|
-
if (this._client) {
|
|
25065
|
-
await this.disconnect();
|
|
25107
|
+
if (this._connectPromise) {
|
|
25108
|
+
return this._connectPromise;
|
|
25066
25109
|
}
|
|
25067
|
-
this.
|
|
25068
|
-
|
|
25069
|
-
|
|
25070
|
-
|
|
25071
|
-
|
|
25072
|
-
|
|
25073
|
-
|
|
25074
|
-
|
|
25075
|
-
|
|
25076
|
-
|
|
25077
|
-
|
|
25078
|
-
|
|
25110
|
+
this._connectPromise = (async () => {
|
|
25111
|
+
var _a;
|
|
25112
|
+
this._connecting = true;
|
|
25113
|
+
this._connected = false;
|
|
25114
|
+
this._ensureStateManager();
|
|
25115
|
+
const mergedOptions = {
|
|
25116
|
+
...this._context,
|
|
25117
|
+
...options
|
|
25118
|
+
};
|
|
25119
|
+
let { authToken: jwt } = mergedOptions;
|
|
25120
|
+
const {
|
|
25121
|
+
projectId,
|
|
25122
|
+
branch = "main",
|
|
25123
|
+
pro
|
|
25124
|
+
} = mergedOptions;
|
|
25125
|
+
if (!jwt && this._tokenManager) {
|
|
25126
|
+
try {
|
|
25127
|
+
jwt = await this._tokenManager.ensureValidToken();
|
|
25128
|
+
} catch (error) {
|
|
25129
|
+
console.warn("[CollabService] Failed to obtain auth token from token manager", error);
|
|
25130
|
+
}
|
|
25131
|
+
if (!jwt && typeof this._tokenManager.getAccessToken === "function") {
|
|
25132
|
+
jwt = this._tokenManager.getAccessToken();
|
|
25133
|
+
}
|
|
25079
25134
|
}
|
|
25080
|
-
|
|
25081
|
-
|
|
25082
|
-
console.log(`ops event`);
|
|
25083
|
-
this._stateManager.applyChanges(changes, { fromSocket: true });
|
|
25084
|
-
});
|
|
25085
|
-
(_c = this._client.socket) == null ? void 0 : _c.on("commit", ({ version: version2 }) => {
|
|
25086
|
-
if (version2) {
|
|
25087
|
-
this._stateManager.setVersion(version2);
|
|
25135
|
+
if (!jwt) {
|
|
25136
|
+
throw new Error("[CollabService] Cannot connect without auth token");
|
|
25088
25137
|
}
|
|
25089
|
-
|
|
25090
|
-
|
|
25091
|
-
|
|
25092
|
-
|
|
25093
|
-
|
|
25094
|
-
|
|
25095
|
-
|
|
25096
|
-
|
|
25097
|
-
|
|
25098
|
-
|
|
25099
|
-
|
|
25100
|
-
|
|
25101
|
-
|
|
25102
|
-
|
|
25103
|
-
|
|
25104
|
-
|
|
25105
|
-
|
|
25138
|
+
this._context = {
|
|
25139
|
+
...this._context,
|
|
25140
|
+
authToken: jwt,
|
|
25141
|
+
projectId,
|
|
25142
|
+
branch,
|
|
25143
|
+
pro
|
|
25144
|
+
};
|
|
25145
|
+
if (!projectId) {
|
|
25146
|
+
const state = (_a = this._stateManager) == null ? void 0 : _a.root;
|
|
25147
|
+
const el = state.__element;
|
|
25148
|
+
el.call("openNotification", {
|
|
25149
|
+
type: "error",
|
|
25150
|
+
title: "projectId is required",
|
|
25151
|
+
message: "projectId is required for CollabService connection"
|
|
25152
|
+
});
|
|
25153
|
+
throw new Error("projectId is required for CollabService connection");
|
|
25154
|
+
}
|
|
25155
|
+
if (this._client) {
|
|
25156
|
+
await this.disconnect();
|
|
25157
|
+
}
|
|
25158
|
+
this._client = new CollabClient({
|
|
25159
|
+
jwt,
|
|
25160
|
+
projectId,
|
|
25161
|
+
branch,
|
|
25162
|
+
live: Boolean(pro)
|
|
25106
25163
|
});
|
|
25107
|
-
|
|
25164
|
+
const { socket } = this._client;
|
|
25165
|
+
try {
|
|
25166
|
+
await new Promise((resolve, reject) => {
|
|
25167
|
+
if (!socket) {
|
|
25168
|
+
reject(new Error("[CollabService] Socket instance missing"));
|
|
25169
|
+
return;
|
|
25170
|
+
}
|
|
25171
|
+
if (socket.connected) {
|
|
25172
|
+
resolve();
|
|
25173
|
+
return;
|
|
25174
|
+
}
|
|
25175
|
+
const cleanup = () => {
|
|
25176
|
+
socket.off("connect", handleConnect);
|
|
25177
|
+
socket.off("connect_error", handleError);
|
|
25178
|
+
socket.off("error", handleError);
|
|
25179
|
+
socket.off("disconnect", handleDisconnect);
|
|
25180
|
+
if (this._pendingConnectReject === handleError) {
|
|
25181
|
+
this._pendingConnectReject = null;
|
|
25182
|
+
}
|
|
25183
|
+
};
|
|
25184
|
+
const handleConnect = () => {
|
|
25185
|
+
cleanup();
|
|
25186
|
+
resolve();
|
|
25187
|
+
};
|
|
25188
|
+
const handleError = (error) => {
|
|
25189
|
+
cleanup();
|
|
25190
|
+
reject(
|
|
25191
|
+
error instanceof Error ? error : new Error(String(error || "Unknown connection error"))
|
|
25192
|
+
);
|
|
25193
|
+
};
|
|
25194
|
+
const handleDisconnect = (reason) => {
|
|
25195
|
+
handleError(
|
|
25196
|
+
reason instanceof Error ? reason : new Error(
|
|
25197
|
+
`[CollabService] Socket disconnected before connect: ${reason || "unknown"}`
|
|
25198
|
+
)
|
|
25199
|
+
);
|
|
25200
|
+
};
|
|
25201
|
+
this._pendingConnectReject = handleError;
|
|
25202
|
+
socket.once("connect", handleConnect);
|
|
25203
|
+
socket.once("connect_error", handleError);
|
|
25204
|
+
socket.once("error", handleError);
|
|
25205
|
+
socket.once("disconnect", handleDisconnect);
|
|
25206
|
+
});
|
|
25207
|
+
} catch (error) {
|
|
25208
|
+
socket == null ? void 0 : socket.disconnect();
|
|
25209
|
+
this._client = null;
|
|
25210
|
+
this._connectionMeta = null;
|
|
25211
|
+
throw error;
|
|
25212
|
+
}
|
|
25213
|
+
this._attachSocketLifecycleListeners();
|
|
25214
|
+
if (socket == null ? void 0 : socket.connected) {
|
|
25215
|
+
this._onSocketConnect();
|
|
25216
|
+
}
|
|
25217
|
+
socket == null ? void 0 : socket.on("ops", ({ changes }) => {
|
|
25218
|
+
console.log(`ops event`);
|
|
25219
|
+
this._stateManager.applyChanges(changes, { fromSocket: true });
|
|
25220
|
+
});
|
|
25221
|
+
socket == null ? void 0 : socket.on("commit", ({ version: version2 }) => {
|
|
25222
|
+
if (version2) {
|
|
25223
|
+
this._stateManager.setVersion(version2);
|
|
25224
|
+
}
|
|
25225
|
+
rootBus.emit("checkpoint:done", { version: version2, origin: "auto" });
|
|
25226
|
+
});
|
|
25227
|
+
socket == null ? void 0 : socket.on("clients", this._handleClientsEvent.bind(this));
|
|
25228
|
+
socket == null ? void 0 : socket.on(
|
|
25229
|
+
"bundle:done",
|
|
25230
|
+
this._handleBundleDoneEvent.bind(this)
|
|
25231
|
+
);
|
|
25232
|
+
socket == null ? void 0 : socket.on(
|
|
25233
|
+
"bundle:error",
|
|
25234
|
+
this._handleBundleErrorEvent.bind(this)
|
|
25235
|
+
);
|
|
25236
|
+
if (this._pendingOps.length) {
|
|
25237
|
+
console.log(
|
|
25238
|
+
`[CollabService] Flushing ${this._pendingOps.length} offline operation batch(es)`
|
|
25239
|
+
);
|
|
25240
|
+
this._pendingOps.forEach(({ changes, granularChanges, orders }) => {
|
|
25241
|
+
this.socket.emit("ops", { changes, granularChanges, orders, ts: Date.now() });
|
|
25242
|
+
});
|
|
25243
|
+
this._pendingOps.length = 0;
|
|
25244
|
+
}
|
|
25245
|
+
await this._client.ready;
|
|
25246
|
+
this._connectionMeta = {
|
|
25247
|
+
projectId,
|
|
25248
|
+
branch,
|
|
25249
|
+
live: Boolean(pro)
|
|
25250
|
+
};
|
|
25251
|
+
return this.getConnectionInfo();
|
|
25252
|
+
})();
|
|
25253
|
+
try {
|
|
25254
|
+
return await this._connectPromise;
|
|
25255
|
+
} finally {
|
|
25256
|
+
this._connecting = false;
|
|
25257
|
+
this._connectPromise = null;
|
|
25108
25258
|
}
|
|
25109
|
-
this._connected = true;
|
|
25110
25259
|
}
|
|
25111
25260
|
disconnect() {
|
|
25112
25261
|
var _a;
|
|
25113
25262
|
if ((_a = this._client) == null ? void 0 : _a.socket) {
|
|
25114
|
-
this.
|
|
25263
|
+
if (this._pendingConnectReject) {
|
|
25264
|
+
this._pendingConnectReject(new Error("[CollabService] Connection attempt aborted"));
|
|
25265
|
+
this._pendingConnectReject = null;
|
|
25266
|
+
}
|
|
25267
|
+
this._detachSocketLifecycleListeners();
|
|
25268
|
+
if (typeof this._client.dispose === "function") {
|
|
25269
|
+
this._client.dispose();
|
|
25270
|
+
} else {
|
|
25271
|
+
this._client.socket.disconnect();
|
|
25272
|
+
}
|
|
25115
25273
|
}
|
|
25116
25274
|
this._client = null;
|
|
25117
25275
|
this._connected = false;
|
|
25276
|
+
this._connecting = false;
|
|
25277
|
+
this._connectionMeta = null;
|
|
25278
|
+
this._pendingConnectReject = null;
|
|
25118
25279
|
console.log("[CollabService] Disconnected");
|
|
25119
25280
|
}
|
|
25120
25281
|
isConnected() {
|
|
25121
25282
|
var _a, _b;
|
|
25122
|
-
return this._connected && ((_b = (_a = this._client) == null ? void 0 : _a.socket) == null ? void 0 : _b.connected);
|
|
25283
|
+
return Boolean(this._connected && ((_b = (_a = this._client) == null ? void 0 : _a.socket) == null ? void 0 : _b.connected));
|
|
25284
|
+
}
|
|
25285
|
+
getConnectionInfo() {
|
|
25286
|
+
var _a, _b, _c, _d, _e, _f;
|
|
25287
|
+
return {
|
|
25288
|
+
connected: this.isConnected(),
|
|
25289
|
+
connecting: this._connecting,
|
|
25290
|
+
projectId: (_b = (_a = this._connectionMeta) == null ? void 0 : _a.projectId) != null ? _b : null,
|
|
25291
|
+
branch: (_d = (_c = this._connectionMeta) == null ? void 0 : _c.branch) != null ? _d : null,
|
|
25292
|
+
live: (_f = (_e = this._connectionMeta) == null ? void 0 : _e.live) != null ? _f : null,
|
|
25293
|
+
pendingOps: this._pendingOps.length,
|
|
25294
|
+
undoStackSize: this.getUndoStackSize(),
|
|
25295
|
+
redoStackSize: this.getRedoStackSize()
|
|
25296
|
+
};
|
|
25123
25297
|
}
|
|
25124
25298
|
/* convenient shortcuts */
|
|
25125
25299
|
get ydoc() {
|
|
@@ -25486,6 +25660,38 @@ var CollabService = class extends BaseService {
|
|
|
25486
25660
|
rootBus.emit("bundle:error", { project, ticket, error });
|
|
25487
25661
|
}
|
|
25488
25662
|
/* ---------- Manual checkpoint ---------- */
|
|
25663
|
+
_attachSocketLifecycleListeners() {
|
|
25664
|
+
var _a;
|
|
25665
|
+
const socket = (_a = this._client) == null ? void 0 : _a.socket;
|
|
25666
|
+
if (!socket) {
|
|
25667
|
+
return;
|
|
25668
|
+
}
|
|
25669
|
+
socket.on("connect", this._onSocketConnect);
|
|
25670
|
+
socket.on("disconnect", this._onSocketDisconnect);
|
|
25671
|
+
socket.on("connect_error", this._onSocketError);
|
|
25672
|
+
}
|
|
25673
|
+
_detachSocketLifecycleListeners() {
|
|
25674
|
+
var _a;
|
|
25675
|
+
const socket = (_a = this._client) == null ? void 0 : _a.socket;
|
|
25676
|
+
if (!socket) {
|
|
25677
|
+
return;
|
|
25678
|
+
}
|
|
25679
|
+
socket.off("connect", this._onSocketConnect);
|
|
25680
|
+
socket.off("disconnect", this._onSocketDisconnect);
|
|
25681
|
+
socket.off("connect_error", this._onSocketError);
|
|
25682
|
+
}
|
|
25683
|
+
_onSocketConnect() {
|
|
25684
|
+
this._connected = true;
|
|
25685
|
+
}
|
|
25686
|
+
_onSocketDisconnect(reason) {
|
|
25687
|
+
this._connected = false;
|
|
25688
|
+
if (reason && reason !== "io client disconnect") {
|
|
25689
|
+
console.warn("[CollabService] Socket disconnected", reason);
|
|
25690
|
+
}
|
|
25691
|
+
}
|
|
25692
|
+
_onSocketError(error) {
|
|
25693
|
+
console.warn("[CollabService] Socket connection error", error);
|
|
25694
|
+
}
|
|
25489
25695
|
/**
|
|
25490
25696
|
* Manually request a checkpoint / commit of buffered operations on the server.
|
|
25491
25697
|
* Resolves with the new version number once the backend confirms via the
|
|
@@ -30,6 +30,9 @@ var CONFIG = {
|
|
|
30
30
|
// For based api
|
|
31
31
|
githubClientId: "Ov23liAFrsR0StbAO6PO",
|
|
32
32
|
// For github api
|
|
33
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/aef64330db80bdfeaac084317bf72f99",
|
|
34
|
+
// For grafana tracing
|
|
35
|
+
grafanaAppName: "Localhost Symbols",
|
|
33
36
|
// Environment-specific feature toggles (override common)
|
|
34
37
|
features: {
|
|
35
38
|
betaFeatures: true
|
|
@@ -45,6 +48,9 @@ var CONFIG = {
|
|
|
45
48
|
socketUrl: "https://dev.api.symbols.app",
|
|
46
49
|
apiUrl: "https://dev.api.symbols.app",
|
|
47
50
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
51
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
52
|
+
// For grafana tracing
|
|
53
|
+
grafanaAppName: "Symbols Dev",
|
|
48
54
|
typesenseCollectionName: "docs",
|
|
49
55
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
50
56
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -58,6 +64,9 @@ var CONFIG = {
|
|
|
58
64
|
basedProject: "platform-v2-sm",
|
|
59
65
|
basedOrg: "symbols",
|
|
60
66
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
67
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
68
|
+
// For grafana tracing
|
|
69
|
+
grafanaAppName: "Symbols Test",
|
|
61
70
|
typesenseCollectionName: "docs",
|
|
62
71
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
63
72
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -68,6 +77,9 @@ var CONFIG = {
|
|
|
68
77
|
socketUrl: "https://upcoming.api.symbols.app",
|
|
69
78
|
apiUrl: "https://upcoming.api.symbols.app",
|
|
70
79
|
githubClientId: "Ov23liWF7NvdZ056RV5J",
|
|
80
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
81
|
+
// For grafana tracing
|
|
82
|
+
grafanaAppName: "Symbols Upcoming",
|
|
71
83
|
typesenseCollectionName: "docs",
|
|
72
84
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
73
85
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -81,6 +93,9 @@ var CONFIG = {
|
|
|
81
93
|
basedProject: "platform-v2-sm",
|
|
82
94
|
basedOrg: "symbols",
|
|
83
95
|
githubClientId: "Ov23ligwZDQVD0VfuWNa",
|
|
96
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
97
|
+
// For grafana tracing
|
|
98
|
+
grafanaAppName: "Symbols Staging",
|
|
84
99
|
typesenseCollectionName: "docs",
|
|
85
100
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
86
101
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -94,6 +109,9 @@ var CONFIG = {
|
|
|
94
109
|
basedProject: "platform-v2-sm",
|
|
95
110
|
basedOrg: "symbols",
|
|
96
111
|
githubClientId: "Ov23liFAlOEIXtX3dBtR",
|
|
112
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/5c1089f3c3eea4ec5658e05c3f53baae",
|
|
113
|
+
// For grafana tracing
|
|
114
|
+
grafanaAppName: "Symbols",
|
|
97
115
|
typesenseCollectionName: "docs",
|
|
98
116
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
99
117
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -120,6 +138,7 @@ var getConfig = () => {
|
|
|
120
138
|
basedProject: process.env.SYMBOLS_APP_BASED_PROJECT || envConfig.basedProject,
|
|
121
139
|
basedOrg: process.env.SYMBOLS_APP_BASED_ORG || envConfig.basedOrg,
|
|
122
140
|
githubClientId: process.env.SYMBOLS_APP_GITHUB_CLIENT_ID || envConfig.githubClientId,
|
|
141
|
+
grafanaUrl: process.env.SYMBOLS_APP_GRAFANA_URL || envConfig.grafanaUrl,
|
|
123
142
|
typesenseCollectionName: process.env.TYPESENSE_COLLECTION_NAME || envConfig.typesenseCollectionName,
|
|
124
143
|
typesenseApiKey: process.env.TYPESENSE_API_KEY || envConfig.typesenseApiKey,
|
|
125
144
|
typesenseHost: process.env.TYPESENSE_HOST || envConfig.typesenseHost,
|
|
@@ -30,6 +30,9 @@ var CONFIG = {
|
|
|
30
30
|
// For based api
|
|
31
31
|
githubClientId: "Ov23liAFrsR0StbAO6PO",
|
|
32
32
|
// For github api
|
|
33
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/aef64330db80bdfeaac084317bf72f99",
|
|
34
|
+
// For grafana tracing
|
|
35
|
+
grafanaAppName: "Localhost Symbols",
|
|
33
36
|
// Environment-specific feature toggles (override common)
|
|
34
37
|
features: {
|
|
35
38
|
betaFeatures: true
|
|
@@ -45,6 +48,9 @@ var CONFIG = {
|
|
|
45
48
|
socketUrl: "https://dev.api.symbols.app",
|
|
46
49
|
apiUrl: "https://dev.api.symbols.app",
|
|
47
50
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
51
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
52
|
+
// For grafana tracing
|
|
53
|
+
grafanaAppName: "Symbols Dev",
|
|
48
54
|
typesenseCollectionName: "docs",
|
|
49
55
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
50
56
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -58,6 +64,9 @@ var CONFIG = {
|
|
|
58
64
|
basedProject: "platform-v2-sm",
|
|
59
65
|
basedOrg: "symbols",
|
|
60
66
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
67
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
68
|
+
// For grafana tracing
|
|
69
|
+
grafanaAppName: "Symbols Test",
|
|
61
70
|
typesenseCollectionName: "docs",
|
|
62
71
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
63
72
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -68,6 +77,9 @@ var CONFIG = {
|
|
|
68
77
|
socketUrl: "https://upcoming.api.symbols.app",
|
|
69
78
|
apiUrl: "https://upcoming.api.symbols.app",
|
|
70
79
|
githubClientId: "Ov23liWF7NvdZ056RV5J",
|
|
80
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
81
|
+
// For grafana tracing
|
|
82
|
+
grafanaAppName: "Symbols Upcoming",
|
|
71
83
|
typesenseCollectionName: "docs",
|
|
72
84
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
73
85
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -81,6 +93,9 @@ var CONFIG = {
|
|
|
81
93
|
basedProject: "platform-v2-sm",
|
|
82
94
|
basedOrg: "symbols",
|
|
83
95
|
githubClientId: "Ov23ligwZDQVD0VfuWNa",
|
|
96
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
97
|
+
// For grafana tracing
|
|
98
|
+
grafanaAppName: "Symbols Staging",
|
|
84
99
|
typesenseCollectionName: "docs",
|
|
85
100
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
86
101
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -94,6 +109,9 @@ var CONFIG = {
|
|
|
94
109
|
basedProject: "platform-v2-sm",
|
|
95
110
|
basedOrg: "symbols",
|
|
96
111
|
githubClientId: "Ov23liFAlOEIXtX3dBtR",
|
|
112
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/5c1089f3c3eea4ec5658e05c3f53baae",
|
|
113
|
+
// For grafana tracing
|
|
114
|
+
grafanaAppName: "Symbols",
|
|
97
115
|
typesenseCollectionName: "docs",
|
|
98
116
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
99
117
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -120,6 +138,7 @@ var getConfig = () => {
|
|
|
120
138
|
basedProject: process.env.SYMBOLS_APP_BASED_PROJECT || envConfig.basedProject,
|
|
121
139
|
basedOrg: process.env.SYMBOLS_APP_BASED_ORG || envConfig.basedOrg,
|
|
122
140
|
githubClientId: process.env.SYMBOLS_APP_GITHUB_CLIENT_ID || envConfig.githubClientId,
|
|
141
|
+
grafanaUrl: process.env.SYMBOLS_APP_GRAFANA_URL || envConfig.grafanaUrl,
|
|
123
142
|
typesenseCollectionName: process.env.TYPESENSE_COLLECTION_NAME || envConfig.typesenseCollectionName,
|
|
124
143
|
typesenseApiKey: process.env.TYPESENSE_API_KEY || envConfig.typesenseApiKey,
|
|
125
144
|
typesenseHost: process.env.TYPESENSE_HOST || envConfig.typesenseHost,
|
|
@@ -30,6 +30,9 @@ var CONFIG = {
|
|
|
30
30
|
// For based api
|
|
31
31
|
githubClientId: "Ov23liAFrsR0StbAO6PO",
|
|
32
32
|
// For github api
|
|
33
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/aef64330db80bdfeaac084317bf72f99",
|
|
34
|
+
// For grafana tracing
|
|
35
|
+
grafanaAppName: "Localhost Symbols",
|
|
33
36
|
// Environment-specific feature toggles (override common)
|
|
34
37
|
features: {
|
|
35
38
|
betaFeatures: true
|
|
@@ -45,6 +48,9 @@ var CONFIG = {
|
|
|
45
48
|
socketUrl: "https://dev.api.symbols.app",
|
|
46
49
|
apiUrl: "https://dev.api.symbols.app",
|
|
47
50
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
51
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
52
|
+
// For grafana tracing
|
|
53
|
+
grafanaAppName: "Symbols Dev",
|
|
48
54
|
typesenseCollectionName: "docs",
|
|
49
55
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
50
56
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -58,6 +64,9 @@ var CONFIG = {
|
|
|
58
64
|
basedProject: "platform-v2-sm",
|
|
59
65
|
basedOrg: "symbols",
|
|
60
66
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
67
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
68
|
+
// For grafana tracing
|
|
69
|
+
grafanaAppName: "Symbols Test",
|
|
61
70
|
typesenseCollectionName: "docs",
|
|
62
71
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
63
72
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -68,6 +77,9 @@ var CONFIG = {
|
|
|
68
77
|
socketUrl: "https://upcoming.api.symbols.app",
|
|
69
78
|
apiUrl: "https://upcoming.api.symbols.app",
|
|
70
79
|
githubClientId: "Ov23liWF7NvdZ056RV5J",
|
|
80
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
81
|
+
// For grafana tracing
|
|
82
|
+
grafanaAppName: "Symbols Upcoming",
|
|
71
83
|
typesenseCollectionName: "docs",
|
|
72
84
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
73
85
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -81,6 +93,9 @@ var CONFIG = {
|
|
|
81
93
|
basedProject: "platform-v2-sm",
|
|
82
94
|
basedOrg: "symbols",
|
|
83
95
|
githubClientId: "Ov23ligwZDQVD0VfuWNa",
|
|
96
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
|
|
97
|
+
// For grafana tracing
|
|
98
|
+
grafanaAppName: "Symbols Staging",
|
|
84
99
|
typesenseCollectionName: "docs",
|
|
85
100
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
86
101
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -94,6 +109,9 @@ var CONFIG = {
|
|
|
94
109
|
basedProject: "platform-v2-sm",
|
|
95
110
|
basedOrg: "symbols",
|
|
96
111
|
githubClientId: "Ov23liFAlOEIXtX3dBtR",
|
|
112
|
+
grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/5c1089f3c3eea4ec5658e05c3f53baae",
|
|
113
|
+
// For grafana tracing
|
|
114
|
+
grafanaAppName: "Symbols",
|
|
97
115
|
typesenseCollectionName: "docs",
|
|
98
116
|
typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
|
|
99
117
|
typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
|
|
@@ -120,6 +138,7 @@ var getConfig = () => {
|
|
|
120
138
|
basedProject: process.env.SYMBOLS_APP_BASED_PROJECT || envConfig.basedProject,
|
|
121
139
|
basedOrg: process.env.SYMBOLS_APP_BASED_ORG || envConfig.basedOrg,
|
|
122
140
|
githubClientId: process.env.SYMBOLS_APP_GITHUB_CLIENT_ID || envConfig.githubClientId,
|
|
141
|
+
grafanaUrl: process.env.SYMBOLS_APP_GRAFANA_URL || envConfig.grafanaUrl,
|
|
123
142
|
typesenseCollectionName: process.env.TYPESENSE_COLLECTION_NAME || envConfig.typesenseCollectionName,
|
|
124
143
|
typesenseApiKey: process.env.TYPESENSE_API_KEY || envConfig.typesenseApiKey,
|
|
125
144
|
typesenseHost: process.env.TYPESENSE_HOST || envConfig.typesenseHost,
|