@symbo.ls/sdk 3.1.2 → 3.2.3
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 +2 -2
- package/dist/cjs/config/environment.js +5 -21
- package/dist/cjs/index.js +6 -26
- package/dist/cjs/services/AIService.js +3 -3
- package/dist/cjs/services/CollabService.js +420 -0
- package/dist/cjs/services/CoreService.js +651 -107
- package/dist/cjs/services/SocketService.js +207 -59
- package/dist/cjs/services/index.js +5 -13
- package/dist/cjs/state/RootStateManager.js +86 -0
- package/dist/cjs/state/rootEventBus.js +65 -0
- package/dist/cjs/utils/CollabClient.js +157 -0
- package/dist/cjs/utils/TokenManager.js +62 -27
- package/dist/cjs/utils/jsonDiff.js +103 -0
- package/dist/cjs/utils/services.js +129 -88
- package/dist/cjs/utils/symstoryClient.js +5 -5
- package/dist/esm/config/environment.js +5 -21
- package/dist/esm/index.js +20459 -9286
- package/dist/esm/services/AIService.js +3 -3
- package/dist/esm/services/BasedService.js +5 -21
- package/dist/esm/services/CollabService.js +18028 -0
- package/dist/esm/services/CoreService.js +718 -155
- package/dist/esm/services/SocketService.js +323 -58
- package/dist/esm/services/SymstoryService.js +10 -26
- package/dist/esm/services/index.js +20305 -9158
- package/dist/esm/state/RootStateManager.js +102 -0
- package/dist/esm/state/rootEventBus.js +47 -0
- package/dist/esm/utils/CollabClient.js +17483 -0
- package/dist/esm/utils/TokenManager.js +62 -27
- package/dist/esm/utils/jsonDiff.js +6096 -0
- package/dist/esm/utils/services.js +129 -88
- package/dist/esm/utils/symstoryClient.js +10 -26
- package/dist/node/config/environment.js +5 -21
- package/dist/node/index.js +10 -34
- package/dist/node/services/AIService.js +3 -3
- package/dist/node/services/CollabService.js +401 -0
- package/dist/node/services/CoreService.js +651 -107
- package/dist/node/services/SocketService.js +197 -59
- package/dist/node/services/index.js +5 -13
- package/dist/node/state/RootStateManager.js +57 -0
- package/dist/node/state/rootEventBus.js +46 -0
- package/dist/node/utils/CollabClient.js +128 -0
- package/dist/node/utils/TokenManager.js +62 -27
- package/dist/node/utils/jsonDiff.js +74 -0
- package/dist/node/utils/services.js +129 -88
- package/dist/node/utils/symstoryClient.js +5 -5
- package/package.json +12 -6
- package/src/config/environment.js +5 -19
- package/src/index.js +9 -31
- package/src/services/AIService.js +3 -3
- package/src/services/BasedService.js +1 -0
- package/src/services/CollabService.js +491 -0
- package/src/services/CoreService.js +715 -110
- package/src/services/SocketService.js +227 -59
- package/src/services/index.js +6 -13
- package/src/state/RootStateManager.js +71 -0
- package/src/state/rootEventBus.js +48 -0
- package/src/utils/CollabClient.js +161 -0
- package/src/utils/TokenManager.js +68 -30
- package/src/utils/jsonDiff.js +109 -0
- package/src/utils/services.js +140 -88
- package/src/utils/symstoryClient.js +5 -5
- package/dist/cjs/services/SocketIOService.js +0 -307
- package/dist/esm/services/SocketIOService.js +0 -470
- package/dist/node/services/SocketIOService.js +0 -278
- package/src/services/SocketIOService.js +0 -334
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
function isPlainObject(o) {
|
|
2
|
+
return o && typeof o === "object" && !Array.isArray(o);
|
|
3
|
+
}
|
|
4
|
+
function deepEqual(a, b) {
|
|
5
|
+
try {
|
|
6
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
7
|
+
} catch (err) {
|
|
8
|
+
console.warn("deepEqual error", err);
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
import * as Y from "yjs";
|
|
13
|
+
function getRootMap(ydoc) {
|
|
14
|
+
return ydoc.getMap("root");
|
|
15
|
+
}
|
|
16
|
+
function diffJson(prev, next, prefix = []) {
|
|
17
|
+
const ops = [];
|
|
18
|
+
const _prefix = Array.isArray(prefix) ? prefix : [];
|
|
19
|
+
for (const key in prev) {
|
|
20
|
+
if (Object.hasOwn(prev, key) && !(key in next)) {
|
|
21
|
+
ops.push({ action: "del", path: [..._prefix, key] });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
for (const key in next) {
|
|
25
|
+
if (Object.hasOwn(next, key)) {
|
|
26
|
+
const pVal = prev == null ? void 0 : prev[key];
|
|
27
|
+
const nVal = next[key];
|
|
28
|
+
if (isPlainObject(pVal) && isPlainObject(nVal)) {
|
|
29
|
+
ops.push(...diffJson(pVal, nVal, [..._prefix, key]));
|
|
30
|
+
} else if (!deepEqual(pVal, nVal)) {
|
|
31
|
+
ops.push({ action: "set", path: [..._prefix, key], value: nVal });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return ops;
|
|
36
|
+
}
|
|
37
|
+
function applyOpsToJson(ops, ydoc) {
|
|
38
|
+
if (!ydoc || !Array.isArray(ops) || !ops.length) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
ydoc.transact(() => {
|
|
42
|
+
const root = getRootMap(ydoc);
|
|
43
|
+
ops.forEach((op) => {
|
|
44
|
+
const { action, path = [], value } = op || {};
|
|
45
|
+
if (!path.length) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
let target = root;
|
|
49
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
50
|
+
const key = path[i];
|
|
51
|
+
let next = target.get(key);
|
|
52
|
+
if (!(next instanceof Y.Map)) {
|
|
53
|
+
const fresh = new Y.Map();
|
|
54
|
+
if (isPlainObject(next)) {
|
|
55
|
+
Object.entries(next).forEach(([k, v]) => fresh.set(k, v));
|
|
56
|
+
}
|
|
57
|
+
target.set(key, fresh);
|
|
58
|
+
next = fresh;
|
|
59
|
+
}
|
|
60
|
+
target = next;
|
|
61
|
+
}
|
|
62
|
+
const last = path[path.length - 1];
|
|
63
|
+
if (action === "set") {
|
|
64
|
+
target.set(last, value);
|
|
65
|
+
} else if (action === "del") {
|
|
66
|
+
target.delete(last);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}, "remote");
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
applyOpsToJson,
|
|
73
|
+
diffJson
|
|
74
|
+
};
|
|
@@ -19,94 +19,135 @@ const SERVICE_METHODS = {
|
|
|
19
19
|
updateProjectTier: "auth",
|
|
20
20
|
subscribeToAuthChanges: "auth",
|
|
21
21
|
getStoredAuthState: "core",
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
22
|
+
// Collab service methods
|
|
23
|
+
connect: "collab",
|
|
24
|
+
disconnect: "collab",
|
|
25
|
+
isConnected: "collab",
|
|
26
|
+
updateData: "collab",
|
|
27
|
+
addItem: "collab",
|
|
28
|
+
addMultipleItems: "collab",
|
|
29
|
+
updateItem: "collab",
|
|
30
|
+
deleteItem: "collab",
|
|
31
|
+
undo: "collab",
|
|
32
|
+
redo: "collab",
|
|
33
|
+
checkpoint: "collab",
|
|
34
|
+
// Realtime collaboration helper methods
|
|
35
|
+
sendCursor: "collab",
|
|
36
|
+
sendPresence: "collab",
|
|
37
|
+
toggleLive: "collab",
|
|
38
|
+
// Core service methods (new - replaces most based/auth functionality)
|
|
39
|
+
// Auth methods
|
|
40
|
+
register: "core",
|
|
41
|
+
login: "core",
|
|
42
|
+
logout: "core",
|
|
43
|
+
refreshToken: "core",
|
|
44
|
+
googleAuth: "core",
|
|
45
|
+
googleAuthCallback: "core",
|
|
46
|
+
githubAuth: "core",
|
|
47
|
+
requestPasswordReset: "core",
|
|
48
|
+
confirmPasswordReset: "core",
|
|
49
|
+
confirmRegistration: "core",
|
|
50
|
+
requestPasswordChange: "core",
|
|
51
|
+
confirmPasswordChange: "core",
|
|
52
|
+
getMe: "core",
|
|
53
|
+
// User methods
|
|
54
|
+
getUserProfile: "core",
|
|
55
|
+
updateUserProfile: "core",
|
|
56
|
+
getUserProjects: "core",
|
|
57
|
+
getUser: "core",
|
|
58
|
+
getUserByEmail: "core",
|
|
59
|
+
// Project methods
|
|
60
|
+
createProject: "core",
|
|
61
|
+
getProjects: "core",
|
|
62
|
+
getProject: "core",
|
|
63
|
+
getProjectByKey: "core",
|
|
64
|
+
getPublicProject: "core",
|
|
65
|
+
listPublicProjects: "core",
|
|
66
|
+
listProjects: "core",
|
|
67
|
+
updateProject: "core",
|
|
68
|
+
updateProjectComponents: "core",
|
|
69
|
+
updateProjectSettings: "core",
|
|
70
|
+
updateProjectName: "core",
|
|
71
|
+
updateProjectPackage: "core",
|
|
72
|
+
duplicateProject: "core",
|
|
73
|
+
removeProject: "core",
|
|
74
|
+
checkProjectKeyAvailability: "core",
|
|
75
|
+
// Project member methods
|
|
76
|
+
getProjectMembers: "core",
|
|
77
|
+
inviteMember: "core",
|
|
78
|
+
acceptInvite: "core",
|
|
79
|
+
updateMemberRole: "core",
|
|
80
|
+
removeMember: "core",
|
|
81
|
+
// Project library methods
|
|
82
|
+
getAvailableLibraries: "core",
|
|
83
|
+
getProjectLibraries: "core",
|
|
84
|
+
addProjectLibraries: "core",
|
|
85
|
+
removeProjectLibraries: "core",
|
|
86
|
+
// File methods
|
|
87
|
+
uploadFile: "core",
|
|
88
|
+
updateProjectIcon: "core",
|
|
89
|
+
// Payment methods
|
|
90
|
+
checkout: "core",
|
|
91
|
+
getSubscriptionStatus: "core",
|
|
92
|
+
// DNS methods
|
|
93
|
+
createDnsRecord: "core",
|
|
94
|
+
getDnsRecord: "core",
|
|
95
|
+
removeDnsRecord: "core",
|
|
96
|
+
setProjectDomains: "core",
|
|
97
|
+
// Utility methods
|
|
98
|
+
getHealthStatus: "core",
|
|
99
|
+
getTokenDebugInfo: "core",
|
|
100
|
+
// Project Data methods (Symstory replacement)
|
|
101
|
+
applyProjectChanges: "core",
|
|
102
|
+
getProjectData: "core",
|
|
103
|
+
getProjectVersions: "core",
|
|
104
|
+
restoreProjectVersion: "core",
|
|
105
|
+
updateProjectItem: "core",
|
|
106
|
+
deleteProjectItem: "core",
|
|
107
|
+
setProjectValue: "core",
|
|
108
|
+
addProjectItems: "core",
|
|
109
|
+
getProjectItemByPath: "core",
|
|
110
|
+
// Pull Request methods
|
|
111
|
+
createPullRequest: "core",
|
|
112
|
+
listPullRequests: "core",
|
|
113
|
+
getPullRequest: "core",
|
|
114
|
+
reviewPullRequest: "core",
|
|
115
|
+
addPullRequestComment: "core",
|
|
116
|
+
mergePullRequest: "core",
|
|
117
|
+
getPullRequestDiff: "core",
|
|
118
|
+
createPullRequestWithValidation: "core",
|
|
119
|
+
approvePullRequest: "core",
|
|
120
|
+
requestPullRequestChanges: "core",
|
|
121
|
+
getOpenPullRequests: "core",
|
|
122
|
+
getClosedPullRequests: "core",
|
|
123
|
+
getMergedPullRequests: "core",
|
|
124
|
+
isPullRequestMergeable: "core",
|
|
125
|
+
getPullRequestStatusSummary: "core",
|
|
126
|
+
// Branch Management methods
|
|
127
|
+
listBranches: "core",
|
|
128
|
+
createBranch: "core",
|
|
129
|
+
deleteBranch: "core",
|
|
130
|
+
renameBranch: "core",
|
|
131
|
+
getBranchChanges: "core",
|
|
132
|
+
mergeBranch: "core",
|
|
133
|
+
resetBranch: "core",
|
|
134
|
+
publishVersion: "core",
|
|
135
|
+
createBranchWithValidation: "core",
|
|
136
|
+
branchExists: "core",
|
|
137
|
+
previewMerge: "core",
|
|
138
|
+
commitMerge: "core",
|
|
139
|
+
createFeatureBranch: "core",
|
|
140
|
+
createHotfixBranch: "core",
|
|
141
|
+
getBranchStatus: "core",
|
|
142
|
+
deleteBranchSafely: "core",
|
|
143
|
+
// Admin methods
|
|
144
|
+
getAdminUsers: "core",
|
|
145
|
+
assignProjectsToUser: "core",
|
|
146
|
+
searchAdminUsers: "core",
|
|
147
|
+
getAdminUsersByEmails: "core",
|
|
148
|
+
getAdminUsersByIds: "core",
|
|
149
|
+
assignSpecificProjectsToUser: "core",
|
|
150
|
+
assignAllProjectsToUser: "core"
|
|
110
151
|
};
|
|
111
152
|
export {
|
|
112
153
|
SERVICE_METHODS
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import config from "../config/environment.js";
|
|
2
2
|
const DEFAULT_OPTIONS = {
|
|
3
|
-
|
|
3
|
+
apiUrl: config.apiUrl
|
|
4
4
|
};
|
|
5
5
|
class SymstoryClient {
|
|
6
6
|
/**
|
|
@@ -27,7 +27,7 @@ class SymstoryClient {
|
|
|
27
27
|
* @returns {Promise<any>} - The response data.
|
|
28
28
|
*/
|
|
29
29
|
async request(path = "", options = {}) {
|
|
30
|
-
const url = `${this.options.
|
|
30
|
+
const url = `${this.options.apiUrl}/symstory/${this.appKey}${path}`;
|
|
31
31
|
const response = await fetch(url, {
|
|
32
32
|
...options,
|
|
33
33
|
headers: { ...this.headers, ...options.headers }
|
|
@@ -181,7 +181,7 @@ class SymstoryClient {
|
|
|
181
181
|
* @param {string} [options.branch='main'] - The branch name. (Only if version number is provided)
|
|
182
182
|
* @returns {Promise<any>} - The response data.
|
|
183
183
|
*/
|
|
184
|
-
publishVersion(version
|
|
184
|
+
publishVersion(version) {
|
|
185
185
|
return this.request("/publish", {
|
|
186
186
|
method: "POST",
|
|
187
187
|
body: JSON.stringify({ version })
|
|
@@ -197,11 +197,11 @@ class SymstoryClient {
|
|
|
197
197
|
*/
|
|
198
198
|
getChanges({ versionId, versionValue, branch } = {}) {
|
|
199
199
|
return this.request(
|
|
200
|
-
|
|
200
|
+
`/changes?${new URLSearchParams({
|
|
201
201
|
...versionId ? { versionId } : {},
|
|
202
202
|
...versionValue ? { versionValue } : {},
|
|
203
203
|
...branch ? { branch } : {}
|
|
204
|
-
}).toString()
|
|
204
|
+
}).toString()}`,
|
|
205
205
|
{}
|
|
206
206
|
);
|
|
207
207
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -38,13 +38,19 @@
|
|
|
38
38
|
"@based/client": "^6.11.1",
|
|
39
39
|
"@based/errors": "^1.4.0",
|
|
40
40
|
"@based/functions": "^3.0.2",
|
|
41
|
-
"@domql/element": "^3.
|
|
42
|
-
"@
|
|
43
|
-
"@symbo.ls/
|
|
41
|
+
"@domql/element": "^3.2.3",
|
|
42
|
+
"@domql/utils": "^3.2.3",
|
|
43
|
+
"@symbo.ls/router": "^3.2.3",
|
|
44
|
+
"@symbo.ls/socket": "^3.2.3",
|
|
44
45
|
"acorn": "^8.14.0",
|
|
45
46
|
"acorn-walk": "^8.3.4",
|
|
47
|
+
"dexie": "^4.0.11",
|
|
46
48
|
"dotenv": "^16.4.7",
|
|
47
|
-
"
|
|
49
|
+
"nanoid": "^5.1.5",
|
|
50
|
+
"node-fetch": "^3.3.2",
|
|
51
|
+
"socket.io-client": "^4.8.1",
|
|
52
|
+
"y-indexeddb": "^9.0.12",
|
|
53
|
+
"yjs": "^13.6.27"
|
|
48
54
|
},
|
|
49
55
|
"devDependencies": {
|
|
50
56
|
"@faker-js/faker": "^9.5.1",
|
|
@@ -56,5 +62,5 @@
|
|
|
56
62
|
"tap-spec": "^2.2.2",
|
|
57
63
|
"tape": "5.9.0"
|
|
58
64
|
},
|
|
59
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681"
|
|
60
66
|
}
|
|
@@ -18,9 +18,7 @@ const CONFIG = {
|
|
|
18
18
|
|
|
19
19
|
local: {
|
|
20
20
|
// local
|
|
21
|
-
baseUrl: 'http://localhost:8080', // For symstory api
|
|
22
21
|
socketUrl: 'http://localhost:8080', // For socket api
|
|
23
|
-
routerUrl: 'http://localhost:8080', // For router api
|
|
24
22
|
apiUrl: 'http://localhost:8080', // For server api
|
|
25
23
|
basedEnv: 'development', // For based api
|
|
26
24
|
basedProject: 'platform-v2-sm', // For based api
|
|
@@ -32,29 +30,25 @@ const CONFIG = {
|
|
|
32
30
|
}
|
|
33
31
|
},
|
|
34
32
|
development: {
|
|
35
|
-
baseUrl: 'https://dev.api.symbols.app',
|
|
36
33
|
socketUrl: 'https://dev.api.symbols.app',
|
|
37
|
-
routerUrl: 'https://dev.api.symbols.app',
|
|
38
34
|
apiUrl: 'https://dev.api.symbols.app',
|
|
39
|
-
basedEnv: 'development',
|
|
40
|
-
basedProject: 'platform-v2-sm',
|
|
41
|
-
basedOrg: 'symbols',
|
|
42
35
|
githubClientId: 'Ov23liHxyWFBxS8f1gnF'
|
|
43
36
|
},
|
|
44
37
|
testing: {
|
|
45
|
-
baseUrl: 'https://test.api.symbols.app',
|
|
46
38
|
socketUrl: 'https://test.api.symbols.app',
|
|
47
|
-
routerUrl: 'https://test.api.symbols.app',
|
|
48
39
|
apiUrl: 'https://test.api.symbols.app',
|
|
49
40
|
basedEnv: 'testing',
|
|
50
41
|
basedProject: 'platform-v2-sm',
|
|
51
42
|
basedOrg: 'symbols',
|
|
52
43
|
githubClientId: 'Ov23liHxyWFBxS8f1gnF'
|
|
53
44
|
},
|
|
45
|
+
upcoming: {
|
|
46
|
+
socketUrl: 'https://upcoming.api.symbols.app',
|
|
47
|
+
apiUrl: 'https://upcoming.api.symbols.app',
|
|
48
|
+
githubClientId: 'Ov23liWF7NvdZ056RV5J'
|
|
49
|
+
},
|
|
54
50
|
staging: {
|
|
55
|
-
baseUrl: 'https://staging.api.symbols.app',
|
|
56
51
|
socketUrl: 'https://staging.api.symbols.app',
|
|
57
|
-
routerUrl: 'https://staging.api.symbols.app',
|
|
58
52
|
apiUrl: 'https://staging.api.symbols.app',
|
|
59
53
|
basedEnv: 'staging',
|
|
60
54
|
basedProject: 'platform-v2-sm',
|
|
@@ -62,9 +56,7 @@ const CONFIG = {
|
|
|
62
56
|
githubClientId: 'Ov23ligwZDQVD0VfuWNa'
|
|
63
57
|
},
|
|
64
58
|
production: {
|
|
65
|
-
baseUrl: 'https://api.symbols.app',
|
|
66
59
|
socketUrl: 'https://api.symbols.app',
|
|
67
|
-
routerUrl: 'https://api.symbols.app',
|
|
68
60
|
apiUrl: 'https://api.symbols.app',
|
|
69
61
|
basedEnv: 'production',
|
|
70
62
|
basedProject: 'platform-v2-sm',
|
|
@@ -95,9 +87,7 @@ export const getConfig = () => {
|
|
|
95
87
|
// Create the final config with environment variable overrides
|
|
96
88
|
const finalConfig = {
|
|
97
89
|
...envConfig,
|
|
98
|
-
baseUrl: process.env.SYMBOLS_APP_BASE_URL || envConfig.baseUrl,
|
|
99
90
|
socketUrl: process.env.SYMBOLS_APP_SOCKET_URL || envConfig.socketUrl,
|
|
100
|
-
routerUrl: process.env.SYMBOLS_APP_ROUTER_URL || envConfig.routerUrl,
|
|
101
91
|
apiUrl: process.env.SYMBOLS_APP_API_URL || envConfig.apiUrl,
|
|
102
92
|
basedEnv: process.env.SYMBOLS_APP_BASED_ENV || envConfig.basedEnv,
|
|
103
93
|
basedProject:
|
|
@@ -114,12 +104,8 @@ export const getConfig = () => {
|
|
|
114
104
|
|
|
115
105
|
// Validate critical configuration values
|
|
116
106
|
const requiredFields = [
|
|
117
|
-
'baseUrl',
|
|
118
107
|
'socketUrl',
|
|
119
108
|
'apiUrl',
|
|
120
|
-
'basedEnv',
|
|
121
|
-
'basedProject',
|
|
122
|
-
'basedOrg',
|
|
123
109
|
'githubClientId',
|
|
124
110
|
'googleClientId'
|
|
125
111
|
]
|
package/src/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createSymstoryService,
|
|
3
2
|
createAuthService,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
createCoreService
|
|
3
|
+
createCoreService,
|
|
4
|
+
createCollabService
|
|
7
5
|
} from './services/index.js'
|
|
8
6
|
|
|
9
7
|
import { SERVICE_METHODS } from './utils/services.js'
|
|
10
|
-
import { SymstoryService } from './services/SymstoryService.js'
|
|
11
8
|
import environment from './config/environment.js'
|
|
12
9
|
|
|
13
10
|
export class SDK {
|
|
@@ -38,29 +35,15 @@ export class SDK {
|
|
|
38
35
|
})
|
|
39
36
|
),
|
|
40
37
|
this._initService(
|
|
41
|
-
'
|
|
42
|
-
|
|
43
|
-
context: this._context,
|
|
44
|
-
options: this._options
|
|
45
|
-
})
|
|
46
|
-
),
|
|
47
|
-
this._initService(
|
|
48
|
-
'symstory',
|
|
49
|
-
createSymstoryService({
|
|
50
|
-
context: this._context,
|
|
51
|
-
options: this._options
|
|
52
|
-
})
|
|
53
|
-
),
|
|
54
|
-
this._initService(
|
|
55
|
-
'ai',
|
|
56
|
-
createAIService({
|
|
38
|
+
'core',
|
|
39
|
+
createCoreService({
|
|
57
40
|
context: this._context,
|
|
58
41
|
options: this._options
|
|
59
42
|
})
|
|
60
43
|
),
|
|
61
44
|
this._initService(
|
|
62
|
-
'
|
|
63
|
-
|
|
45
|
+
'collab',
|
|
46
|
+
createCollabService({
|
|
64
47
|
context: this._context,
|
|
65
48
|
options: this._options
|
|
66
49
|
})
|
|
@@ -90,7 +73,7 @@ export class SDK {
|
|
|
90
73
|
_validateOptions (options) {
|
|
91
74
|
const defaults = {
|
|
92
75
|
useNewServices: true, // Use new service implementations by default
|
|
93
|
-
|
|
76
|
+
apiUrl: environment.apiUrl,
|
|
94
77
|
socketUrl: environment.socketUrl,
|
|
95
78
|
timeout: 30000,
|
|
96
79
|
retryAttempts: 3,
|
|
@@ -118,9 +101,6 @@ export class SDK {
|
|
|
118
101
|
// Update context for all services
|
|
119
102
|
for (const service of this._services.values()) {
|
|
120
103
|
service.updateContext(this._context)
|
|
121
|
-
if (service instanceof SymstoryService) {
|
|
122
|
-
service.init()
|
|
123
|
-
}
|
|
124
104
|
}
|
|
125
105
|
}
|
|
126
106
|
|
|
@@ -195,11 +175,9 @@ export default SDK
|
|
|
195
175
|
|
|
196
176
|
// Export services for direct usage
|
|
197
177
|
export {
|
|
198
|
-
createSymstoryService,
|
|
199
178
|
createAuthService,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
createCoreService
|
|
179
|
+
createCoreService,
|
|
180
|
+
createCollabService
|
|
203
181
|
} from './services/index.js'
|
|
204
182
|
|
|
205
183
|
// Export environment configuration
|
|
@@ -6,7 +6,7 @@ export class AIService extends BaseService {
|
|
|
6
6
|
this._client = null
|
|
7
7
|
this._initialized = false
|
|
8
8
|
this._defaultConfig = {
|
|
9
|
-
|
|
9
|
+
apiUrl: 'https://api.openai.com/v1/engines/text-curie/completions',
|
|
10
10
|
temperature: 0.0,
|
|
11
11
|
maxTokens: 2000,
|
|
12
12
|
headers: {
|
|
@@ -57,7 +57,7 @@ export class AIService extends BaseService {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
validateConfig (config = {}) {
|
|
60
|
-
const requiredFields = ['
|
|
60
|
+
const requiredFields = ['apiUrl', 'temperature', 'maxTokens']
|
|
61
61
|
const missingFields = requiredFields.filter(field => !config[field])
|
|
62
62
|
|
|
63
63
|
if (missingFields.length > 0) {
|
|
@@ -89,7 +89,7 @@ export class AIService extends BaseService {
|
|
|
89
89
|
})
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
const response = await this._request(config.
|
|
92
|
+
const response = await this._request(config.apiUrl, options)
|
|
93
93
|
return response
|
|
94
94
|
} catch (error) {
|
|
95
95
|
throw new Error(`AI prompt failed: ${error.message}`)
|