@symbo.ls/sdk 2.34.35 → 3.1.2

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.
Files changed (187) hide show
  1. package/README.md +2 -143
  2. package/dist/cjs/config/environment.js +30 -98
  3. package/dist/cjs/index.js +24 -144
  4. package/dist/cjs/services/AIService.js +155 -0
  5. package/dist/cjs/services/AuthService.js +305 -738
  6. package/dist/cjs/services/BaseService.js +6 -158
  7. package/dist/cjs/services/BasedService.js +1185 -0
  8. package/dist/cjs/services/CoreService.js +1751 -0
  9. package/dist/cjs/services/SocketIOService.js +307 -0
  10. package/dist/cjs/services/SocketService.js +161 -0
  11. package/dist/cjs/services/SymstoryService.js +571 -0
  12. package/dist/cjs/services/index.js +16 -64
  13. package/dist/cjs/utils/TokenManager.js +30 -78
  14. package/dist/cjs/utils/basedQuerys.js +181 -0
  15. package/dist/cjs/utils/services.js +103 -301
  16. package/dist/cjs/utils/symstoryClient.js +259 -0
  17. package/dist/cjs/utils/validation.js +3 -0
  18. package/dist/esm/config/environment.js +30 -98
  19. package/dist/esm/index.js +8797 -49416
  20. package/dist/esm/services/AIService.js +185 -0
  21. package/dist/esm/services/AuthService.js +386 -1493
  22. package/dist/esm/services/BaseService.js +6 -757
  23. package/dist/esm/services/BasedService.js +5278 -0
  24. package/dist/esm/services/CoreService.js +2264 -0
  25. package/dist/esm/services/SocketIOService.js +470 -0
  26. package/dist/esm/services/SocketService.js +191 -0
  27. package/dist/esm/services/SymstoryService.js +7041 -0
  28. package/dist/esm/services/index.js +8690 -49015
  29. package/dist/esm/utils/TokenManager.js +30 -78
  30. package/dist/esm/utils/basedQuerys.js +163 -0
  31. package/dist/esm/utils/services.js +103 -301
  32. package/dist/esm/utils/symstoryClient.js +370 -0
  33. package/dist/esm/utils/validation.js +7 -4
  34. package/dist/node/config/environment.js +30 -98
  35. package/dist/node/index.js +32 -175
  36. package/dist/node/services/AIService.js +136 -0
  37. package/dist/node/services/AuthService.js +310 -742
  38. package/dist/node/services/BaseService.js +6 -148
  39. package/dist/node/services/BasedService.js +1156 -0
  40. package/dist/node/services/CoreService.js +1722 -0
  41. package/dist/node/services/SocketIOService.js +278 -0
  42. package/dist/node/services/SocketService.js +142 -0
  43. package/dist/node/services/SymstoryService.js +542 -0
  44. package/dist/node/services/index.js +16 -64
  45. package/dist/node/utils/TokenManager.js +30 -78
  46. package/dist/node/utils/basedQuerys.js +162 -0
  47. package/dist/node/utils/services.js +103 -301
  48. package/dist/node/utils/symstoryClient.js +230 -0
  49. package/dist/node/utils/validation.js +3 -0
  50. package/package.json +16 -35
  51. package/src/config/environment.js +28 -99
  52. package/src/index.js +36 -181
  53. package/src/services/AIService.js +150 -0
  54. package/src/services/AuthService.js +328 -874
  55. package/src/services/BaseService.js +6 -166
  56. package/src/services/BasedService.js +1301 -0
  57. package/src/services/CoreService.js +1943 -0
  58. package/src/services/SocketIOService.js +334 -0
  59. package/src/services/SocketService.js +168 -0
  60. package/src/services/SymstoryService.js +649 -0
  61. package/src/services/index.js +13 -80
  62. package/src/utils/TokenManager.js +33 -88
  63. package/src/utils/basedQuerys.js +164 -0
  64. package/src/utils/services.js +107 -326
  65. package/src/utils/symstoryClient.js +252 -0
  66. package/src/utils/validation.js +3 -0
  67. package/dist/cjs/services/AdminService.js +0 -351
  68. package/dist/cjs/services/BranchService.js +0 -484
  69. package/dist/cjs/services/CollabService.js +0 -743
  70. package/dist/cjs/services/DnsService.js +0 -340
  71. package/dist/cjs/services/FeatureFlagService.js +0 -175
  72. package/dist/cjs/services/FileService.js +0 -201
  73. package/dist/cjs/services/IntegrationService.js +0 -538
  74. package/dist/cjs/services/MetricsService.js +0 -62
  75. package/dist/cjs/services/PaymentService.js +0 -271
  76. package/dist/cjs/services/PlanService.js +0 -426
  77. package/dist/cjs/services/ProjectService.js +0 -1207
  78. package/dist/cjs/services/PullRequestService.js +0 -503
  79. package/dist/cjs/services/ScreenshotService.js +0 -304
  80. package/dist/cjs/services/SubscriptionService.js +0 -396
  81. package/dist/cjs/services/TrackingService.js +0 -661
  82. package/dist/cjs/services/WaitlistService.js +0 -148
  83. package/dist/cjs/state/RootStateManager.js +0 -65
  84. package/dist/cjs/state/rootEventBus.js +0 -74
  85. package/dist/cjs/utils/CollabClient.js +0 -223
  86. package/dist/cjs/utils/changePreprocessor.js +0 -199
  87. package/dist/cjs/utils/jsonDiff.js +0 -145
  88. package/dist/cjs/utils/ordering.js +0 -309
  89. package/dist/esm/services/AdminService.js +0 -1132
  90. package/dist/esm/services/BranchService.js +0 -1265
  91. package/dist/esm/services/CollabService.js +0 -26838
  92. package/dist/esm/services/DnsService.js +0 -1121
  93. package/dist/esm/services/FeatureFlagService.js +0 -956
  94. package/dist/esm/services/FileService.js +0 -982
  95. package/dist/esm/services/IntegrationService.js +0 -1319
  96. package/dist/esm/services/MetricsService.js +0 -843
  97. package/dist/esm/services/PaymentService.js +0 -1052
  98. package/dist/esm/services/PlanService.js +0 -1207
  99. package/dist/esm/services/ProjectService.js +0 -2526
  100. package/dist/esm/services/PullRequestService.js +0 -1284
  101. package/dist/esm/services/ScreenshotService.js +0 -1085
  102. package/dist/esm/services/SubscriptionService.js +0 -1177
  103. package/dist/esm/services/TrackingService.js +0 -18343
  104. package/dist/esm/services/WaitlistService.js +0 -929
  105. package/dist/esm/state/RootStateManager.js +0 -90
  106. package/dist/esm/state/rootEventBus.js +0 -56
  107. package/dist/esm/utils/CollabClient.js +0 -18901
  108. package/dist/esm/utils/changePreprocessor.js +0 -542
  109. package/dist/esm/utils/jsonDiff.js +0 -7011
  110. package/dist/esm/utils/ordering.js +0 -291
  111. package/dist/node/services/AdminService.js +0 -332
  112. package/dist/node/services/BranchService.js +0 -465
  113. package/dist/node/services/CollabService.js +0 -724
  114. package/dist/node/services/DnsService.js +0 -321
  115. package/dist/node/services/FeatureFlagService.js +0 -156
  116. package/dist/node/services/FileService.js +0 -182
  117. package/dist/node/services/IntegrationService.js +0 -519
  118. package/dist/node/services/MetricsService.js +0 -43
  119. package/dist/node/services/PaymentService.js +0 -252
  120. package/dist/node/services/PlanService.js +0 -407
  121. package/dist/node/services/ProjectService.js +0 -1188
  122. package/dist/node/services/PullRequestService.js +0 -484
  123. package/dist/node/services/ScreenshotService.js +0 -285
  124. package/dist/node/services/SubscriptionService.js +0 -377
  125. package/dist/node/services/TrackingService.js +0 -632
  126. package/dist/node/services/WaitlistService.js +0 -129
  127. package/dist/node/state/RootStateManager.js +0 -36
  128. package/dist/node/state/rootEventBus.js +0 -55
  129. package/dist/node/utils/CollabClient.js +0 -194
  130. package/dist/node/utils/changePreprocessor.js +0 -180
  131. package/dist/node/utils/jsonDiff.js +0 -116
  132. package/dist/node/utils/ordering.js +0 -290
  133. package/src/services/AdminService.js +0 -374
  134. package/src/services/BranchService.js +0 -536
  135. package/src/services/CollabService.js +0 -900
  136. package/src/services/DnsService.js +0 -366
  137. package/src/services/FeatureFlagService.js +0 -174
  138. package/src/services/FileService.js +0 -213
  139. package/src/services/IntegrationService.js +0 -548
  140. package/src/services/MetricsService.js +0 -40
  141. package/src/services/PaymentService.js +0 -287
  142. package/src/services/PlanService.js +0 -468
  143. package/src/services/ProjectService.js +0 -1366
  144. package/src/services/PullRequestService.js +0 -537
  145. package/src/services/ScreenshotService.js +0 -258
  146. package/src/services/SubscriptionService.js +0 -425
  147. package/src/services/TrackingService.js +0 -853
  148. package/src/services/WaitlistService.js +0 -130
  149. package/src/services/tests/BranchService/createBranch.test.js +0 -153
  150. package/src/services/tests/BranchService/deleteBranch.test.js +0 -173
  151. package/src/services/tests/BranchService/getBranchChanges.test.js +0 -146
  152. package/src/services/tests/BranchService/listBranches.test.js +0 -87
  153. package/src/services/tests/BranchService/mergeBranch.test.js +0 -210
  154. package/src/services/tests/BranchService/publishVersion.test.js +0 -183
  155. package/src/services/tests/BranchService/renameBranch.test.js +0 -240
  156. package/src/services/tests/BranchService/resetBranch.test.js +0 -152
  157. package/src/services/tests/FeatureFlagService/adminFeatureFlags.test.js +0 -67
  158. package/src/services/tests/FeatureFlagService/getFeatureFlags.test.js +0 -75
  159. package/src/services/tests/FileService/createFileFormData.test.js +0 -74
  160. package/src/services/tests/FileService/getFileUrl.test.js +0 -69
  161. package/src/services/tests/FileService/updateProjectIcon.test.js +0 -109
  162. package/src/services/tests/FileService/uploadDocument.test.js +0 -36
  163. package/src/services/tests/FileService/uploadFile.test.js +0 -78
  164. package/src/services/tests/FileService/uploadFileWithValidation.test.js +0 -114
  165. package/src/services/tests/FileService/uploadImage.test.js +0 -36
  166. package/src/services/tests/FileService/uploadMultipleFiles.test.js +0 -111
  167. package/src/services/tests/FileService/validateFile.test.js +0 -63
  168. package/src/services/tests/PlanService/createPlan.test.js +0 -104
  169. package/src/services/tests/PlanService/createPlanWithValidation.test.js +0 -523
  170. package/src/services/tests/PlanService/deletePlan.test.js +0 -92
  171. package/src/services/tests/PlanService/getActivePlans.test.js +0 -123
  172. package/src/services/tests/PlanService/getAdminPlans.test.js +0 -84
  173. package/src/services/tests/PlanService/getPlan.test.js +0 -50
  174. package/src/services/tests/PlanService/getPlanByKey.test.js +0 -109
  175. package/src/services/tests/PlanService/getPlanWithValidation.test.js +0 -85
  176. package/src/services/tests/PlanService/getPlans.test.js +0 -53
  177. package/src/services/tests/PlanService/getPlansByPriceRange.test.js +0 -109
  178. package/src/services/tests/PlanService/getPlansWithValidation.test.js +0 -48
  179. package/src/services/tests/PlanService/initializePlans.test.js +0 -75
  180. package/src/services/tests/PlanService/updatePlan.test.js +0 -111
  181. package/src/services/tests/PlanService/updatePlanWithValidation.test.js +0 -556
  182. package/src/state/RootStateManager.js +0 -76
  183. package/src/state/rootEventBus.js +0 -67
  184. package/src/utils/CollabClient.js +0 -248
  185. package/src/utils/changePreprocessor.js +0 -239
  186. package/src/utils/jsonDiff.js +0 -144
  187. package/src/utils/ordering.js +0 -271
@@ -0,0 +1,370 @@
1
+ // src/config/environment.js
2
+ import { isDevelopment } from "@domql/utils";
3
+ var CONFIG = {
4
+ // Common defaults for all environments
5
+ common: {
6
+ // NOTE: Google client id for google auth, need to configure URLs for each environment in Google console
7
+ googleClientId: "686286207466-bvd2fqs31rlm64fgich7rtpnc8ns2tqg.apps.googleusercontent.com",
8
+ // Feature toggles that apply across all environments by default
9
+ features: {
10
+ newUserOnboarding: true,
11
+ betaFeatures: false
12
+ }
13
+ },
14
+ // Environment-specific configurations
15
+ local: {
16
+ // local
17
+ baseUrl: "http://localhost:8080",
18
+ // For symstory api
19
+ socketUrl: "http://localhost:8080",
20
+ // For socket api
21
+ routerUrl: "http://localhost:8080",
22
+ // For router api
23
+ apiUrl: "http://localhost:8080",
24
+ // For server api
25
+ basedEnv: "development",
26
+ // For based api
27
+ basedProject: "platform-v2-sm",
28
+ // For based api
29
+ basedOrg: "symbols",
30
+ // For based api
31
+ githubClientId: "Ov23liHxyWFBxS8f1gnF",
32
+ // For github api
33
+ // Environment-specific feature toggles (override common)
34
+ features: {
35
+ betaFeatures: true
36
+ // Enable beta features in local dev
37
+ }
38
+ },
39
+ development: {
40
+ baseUrl: "https://dev.api.symbols.app",
41
+ socketUrl: "https://dev.api.symbols.app",
42
+ routerUrl: "https://dev.api.symbols.app",
43
+ apiUrl: "https://dev.api.symbols.app",
44
+ basedEnv: "development",
45
+ basedProject: "platform-v2-sm",
46
+ basedOrg: "symbols",
47
+ githubClientId: "Ov23liHxyWFBxS8f1gnF"
48
+ },
49
+ testing: {
50
+ baseUrl: "https://test.api.symbols.app",
51
+ socketUrl: "https://test.api.symbols.app",
52
+ routerUrl: "https://test.api.symbols.app",
53
+ apiUrl: "https://test.api.symbols.app",
54
+ basedEnv: "testing",
55
+ basedProject: "platform-v2-sm",
56
+ basedOrg: "symbols",
57
+ githubClientId: "Ov23liHxyWFBxS8f1gnF"
58
+ },
59
+ staging: {
60
+ baseUrl: "https://staging.api.symbols.app",
61
+ socketUrl: "https://staging.api.symbols.app",
62
+ routerUrl: "https://staging.api.symbols.app",
63
+ apiUrl: "https://staging.api.symbols.app",
64
+ basedEnv: "staging",
65
+ basedProject: "platform-v2-sm",
66
+ basedOrg: "symbols",
67
+ githubClientId: "Ov23ligwZDQVD0VfuWNa"
68
+ },
69
+ production: {
70
+ baseUrl: "https://api.symbols.app",
71
+ socketUrl: "https://api.symbols.app",
72
+ routerUrl: "https://api.symbols.app",
73
+ apiUrl: "https://api.symbols.app",
74
+ basedEnv: "production",
75
+ basedProject: "platform-v2-sm",
76
+ basedOrg: "symbols",
77
+ githubClientId: "Ov23liFAlOEIXtX3dBtR"
78
+ }
79
+ };
80
+ var getEnvironment = () => {
81
+ const env = process.env.SYMBOLS_APP_ENV || process.env.NODE_ENV;
82
+ if (!CONFIG[env]) {
83
+ throw new Error(`Unknown environment "${env}"`);
84
+ }
85
+ return env;
86
+ };
87
+ var getConfig = () => {
88
+ try {
89
+ const env = getEnvironment();
90
+ const envConfig = { ...CONFIG.common, ...CONFIG[env] };
91
+ const finalConfig = {
92
+ ...envConfig,
93
+ baseUrl: process.env.SYMBOLS_APP_BASE_URL || envConfig.baseUrl,
94
+ socketUrl: process.env.SYMBOLS_APP_SOCKET_URL || envConfig.socketUrl,
95
+ routerUrl: process.env.SYMBOLS_APP_ROUTER_URL || envConfig.routerUrl,
96
+ apiUrl: process.env.SYMBOLS_APP_API_URL || envConfig.apiUrl,
97
+ basedEnv: process.env.SYMBOLS_APP_BASED_ENV || envConfig.basedEnv,
98
+ basedProject: process.env.SYMBOLS_APP_BASED_PROJECT || envConfig.basedProject,
99
+ basedOrg: process.env.SYMBOLS_APP_BASED_ORG || envConfig.basedOrg,
100
+ githubClientId: process.env.SYMBOLS_APP_GITHUB_CLIENT_ID || envConfig.githubClientId,
101
+ isDevelopment: isDevelopment(env),
102
+ isTesting: env === "testing",
103
+ isStaging: env === "staging",
104
+ isProduction: env === "production"
105
+ // Store all environment variables for potential future use
106
+ };
107
+ const requiredFields = [
108
+ "baseUrl",
109
+ "socketUrl",
110
+ "apiUrl",
111
+ "basedEnv",
112
+ "basedProject",
113
+ "basedOrg",
114
+ "githubClientId",
115
+ "googleClientId"
116
+ ];
117
+ const missingFields = requiredFields.filter((field) => !finalConfig[field]);
118
+ if (missingFields.length > 0) {
119
+ console.error(
120
+ `Missing required configuration: ${missingFields.join(", ")}`
121
+ );
122
+ }
123
+ if (finalConfig.isDevelopment) {
124
+ console.log(
125
+ "environment in SDK:",
126
+ env || process.env.NODE_ENV || process.env.NODE_ENV
127
+ );
128
+ console.log(finalConfig);
129
+ }
130
+ return finalConfig;
131
+ } catch (error) {
132
+ console.error("Failed to load environment configuration:", error);
133
+ return {
134
+ ...CONFIG.development
135
+ };
136
+ }
137
+ };
138
+ var environment_default = getConfig();
139
+
140
+ // src/utils/symstoryClient.js
141
+ var DEFAULT_OPTIONS = {
142
+ baseUrl: environment_default.baseUrl
143
+ };
144
+ var SymstoryClient = class {
145
+ /**
146
+ * Creates an instance of SymstoryClient.
147
+ * @param {string} appKey - The application key.
148
+ * @param {object} [options={}] - The options for the client.
149
+ */
150
+ constructor(appKey, options = {}) {
151
+ if (!appKey) {
152
+ throw new Error("AppKey is required");
153
+ }
154
+ this.appKey = appKey;
155
+ this.options = { ...DEFAULT_OPTIONS, ...options };
156
+ this.headers = {
157
+ "Content-Type": "application/json",
158
+ ...this.options.headers,
159
+ "X-AppKey": appKey
160
+ };
161
+ }
162
+ /**
163
+ * Makes a request to the Symstory service.
164
+ * @param {string} [path=''] - The request path.
165
+ * @param {object} [options={}] - The request options.
166
+ * @returns {Promise<any>} - The response data.
167
+ */
168
+ async request(path = "", options = {}) {
169
+ const url = `${this.options.baseUrl}/symstory/${this.appKey}${path}`;
170
+ const response = await fetch(url, {
171
+ ...options,
172
+ headers: { ...this.headers, ...options.headers }
173
+ });
174
+ if (!response.ok) {
175
+ const error = await response.json();
176
+ throw new Error(error.message || error.error || "Request failed");
177
+ }
178
+ return response.status === 204 ? null : response.json();
179
+ }
180
+ /**
181
+ * Fetches project data.
182
+ * @param {object} query - The query object to filter data.
183
+ * @param {string|null} [branch=null] - The branch name.
184
+ * @param {string|null} [version=null] - The version number.
185
+ * @returns {Promise<any>} - The project data.
186
+ */
187
+ get(query, branch = null, version = null) {
188
+ const params = new URLSearchParams({
189
+ ...branch && { branch },
190
+ ...version ? { version } : { cacheId: Math.random() },
191
+ ...query && { query: JSON.stringify(query) }
192
+ });
193
+ return this.request(`?${params}`);
194
+ }
195
+ /**
196
+ * Sets a value at the specified path.
197
+ * @param {string} path - The path where the value should be set.
198
+ * @param {any} value - The value to set.
199
+ * @returns {Promise<any>} - The response data.
200
+ */
201
+ set(path, value) {
202
+ return this.request("", {
203
+ method: "POST",
204
+ body: JSON.stringify({ changes: [["update", path, value]] })
205
+ });
206
+ }
207
+ /**
208
+ * Updates project data.
209
+ * @param {Array} changes - The changes to apply.
210
+ * @param {object} [options={}] - The update options.
211
+ * @param {string} [options.type='patch'] - The type of update.
212
+ * @param {string} [options.message=''] - A message describing the update.
213
+ * @param {string} [options.branch='main'] - The branch name.
214
+ * @returns {Promise<any>} - The response data.
215
+ */
216
+ async update(changes, { type = "patch", message = "", branch = "main" } = {}) {
217
+ return await this.request("", {
218
+ method: "POST",
219
+ body: JSON.stringify({ changes, type, message, branch })
220
+ });
221
+ }
222
+ /**
223
+ * Retrieves all branches of the project.
224
+ * @returns {Promise<any>} - The branches data.
225
+ */
226
+ getBranches() {
227
+ return this.request("/branches");
228
+ }
229
+ /**
230
+ * Creates a new branch.
231
+ * @param {string} branch - The name of the new branch.
232
+ * @param {object} [options={}] - The branch creation options.
233
+ * @param {string} [options.message] - A message describing the branch creation.
234
+ * @param {string} [options.source='main'] - The source branch.
235
+ * @param {string} [options.version] - The version number.
236
+ * @returns {Promise<any>} - The response data.
237
+ */
238
+ createBranch(branch, { message, source = "main", version } = {}) {
239
+ return this.request("/branch", {
240
+ method: "POST",
241
+ body: JSON.stringify({ branch, message, source, version })
242
+ });
243
+ }
244
+ /**
245
+ * Edit an existing branch. (For now only supports branch renaming)
246
+ * @param {string} branch - The current name of the branch to edit.
247
+ * @param {object} [options={}] - The branch edit options.
248
+ * @param {string} [options.name] - New name for the branch
249
+ * @returns {Promise<any>} - The response data.
250
+ */
251
+ editBranch(branch, { name } = {}) {
252
+ return this.request("/branch", {
253
+ method: "PATCH",
254
+ body: JSON.stringify({ branch, name })
255
+ });
256
+ }
257
+ /**
258
+ * Delete an existing branch.
259
+ * @param {string} branch - The name of the branch to delete.
260
+ * @returns {Promise<any>} - The response data.
261
+ */
262
+ deleteBranch(branch) {
263
+ return this.request("/branch", {
264
+ method: "DELETE",
265
+ body: JSON.stringify({ branch })
266
+ });
267
+ }
268
+ /**
269
+ * Merges a branch into the target branch.
270
+ * @param {string} target - The target branch.
271
+ * @param {object} [options={}] - The merge options.
272
+ * @param {string} [options.message] - A message describing the merge.
273
+ * @param {string} [options.source='main'] - The source branch.
274
+ * @param {string} [options.type='patch'] - The type of merge.
275
+ * @param {string} [options.version] - The version number.
276
+ * @param {boolean} [options.commit='false'] - Whether to commit the merge.
277
+ * @param {Array} [options.changes] - The changes to apply during the merge.
278
+ * @returns {Promise<any>} - The response data.
279
+ */
280
+ mergeBranch(target, {
281
+ message,
282
+ source = "main",
283
+ type = "patch",
284
+ version,
285
+ commit = "false",
286
+ changes
287
+ } = {}) {
288
+ return this.request("/merge", {
289
+ method: "POST",
290
+ body: JSON.stringify({
291
+ target,
292
+ source,
293
+ message,
294
+ type,
295
+ version,
296
+ commit,
297
+ changes
298
+ })
299
+ });
300
+ }
301
+ /**
302
+ * Restores an older version of the project.
303
+ * @param {string} version - The version number to restore.
304
+ * @param {object} [options={}] - The restore options.
305
+ * @param {string} [options.branch='main'] - The branch name.
306
+ * @param {string} [options.type='patch'] - The type of restore.
307
+ * @param {string} [options.message] - A message describing the restore.
308
+ * @returns {Promise<any>} - The response data.
309
+ */
310
+ restoreVersion(version, { branch = "main", type = "patch", message } = {}) {
311
+ return this.request("/restore", {
312
+ method: "POST",
313
+ body: JSON.stringify({ branch, version, type, message })
314
+ });
315
+ }
316
+ /**
317
+ * Publishes an existing version of the project.
318
+ * @param {string} version - The version ID/number to publish.
319
+ * @param {object} [options={}] - The publishing options.
320
+ * @param {string} [options.branch='main'] - The branch name. (Only if version number is provided)
321
+ * @returns {Promise<any>} - The response data.
322
+ */
323
+ publishVersion(version, { branch = "main" } = {}) {
324
+ return this.request("/publish", {
325
+ method: "POST",
326
+ body: JSON.stringify({ version })
327
+ });
328
+ }
329
+ /**
330
+ * Retrieves all changes after a specific version.
331
+ * @param {object} [options={}] - The changes options.
332
+ * @param {string} [options.versionId] - The version ID to publish.
333
+ * @param {string} [options.versionValue] - The version ID to publish. (alternative to versionId)
334
+ * @param {string} [options.branch] - The branch to publish (Only in combination to versionValue)
335
+ * @returns {Promise<any>} - The changes data.
336
+ */
337
+ getChanges({ versionId, versionValue, branch } = {}) {
338
+ return this.request(
339
+ "/changes?" + new URLSearchParams({
340
+ ...versionId ? { versionId } : {},
341
+ ...versionValue ? { versionValue } : {},
342
+ ...branch ? { branch } : {}
343
+ }).toString(),
344
+ {}
345
+ );
346
+ }
347
+ };
348
+ var symstoryClient_default = {
349
+ /**
350
+ * Creates a new SymstoryClient instance.
351
+ * @param {string} appKey - The application key.
352
+ * @param {object} options - The options for the client.
353
+ * @returns {SymstoryClient} - The SymstoryClient instance.
354
+ */
355
+ create: (appKey, options) => new SymstoryClient(appKey, options),
356
+ /**
357
+ * Initializes the Symstory client.
358
+ * @param {string} appKey - The application key.
359
+ * @param {object} options - The options for the client.
360
+ * @returns {SymstoryClient} - The initialized SymstoryClient instance.
361
+ */
362
+ init(appKey, options) {
363
+ this.client = this.create(appKey, options);
364
+ return this;
365
+ }
366
+ };
367
+ export {
368
+ symstoryClient_default as default
369
+ };
370
+ // @preserve-env
@@ -219,12 +219,12 @@ var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
219
219
  var ref = Object.prototype;
220
220
  var hasOwnProperty = ref.hasOwnProperty;
221
221
  var toString = ref.toString;
222
- var hasOwn = Object.hasOwn || (function(obj, propName) {
222
+ var hasOwn = Object.hasOwn || function(obj, propName) {
223
223
  return hasOwnProperty.call(obj, propName);
224
- });
225
- var isArray = Array.isArray || (function(obj) {
224
+ };
225
+ var isArray = Array.isArray || function(obj) {
226
226
  return toString.call(obj) === "[object Array]";
227
- });
227
+ };
228
228
  var regexpCache = /* @__PURE__ */ Object.create(null);
229
229
  function wordsRegexp(words) {
230
230
  return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
@@ -6059,6 +6059,9 @@ var validateParams = {
6059
6059
  if (!data2.key) {
6060
6060
  throw new Error("Data must contain a key property");
6061
6061
  }
6062
+ if (!data2.value) {
6063
+ throw new Error("Data must contain a value property");
6064
+ }
6062
6065
  if (CODE_TYPES.includes(type)) {
6063
6066
  if (RESERVED_KEYWORDS.includes(data2.key)) {
6064
6067
  throw new Error(
@@ -7,16 +7,18 @@ const CONFIG = {
7
7
  // Feature toggles that apply across all environments by default
8
8
  features: {
9
9
  newUserOnboarding: true,
10
- betaFeatures: false,
11
- // Tracking is enabled by default unless overridden per environment
12
- trackingEnabled: true
10
+ betaFeatures: false
13
11
  }
14
12
  },
15
13
  // Environment-specific configurations
16
14
  local: {
17
15
  // local
16
+ baseUrl: "http://localhost:8080",
17
+ // For symstory api
18
18
  socketUrl: "http://localhost:8080",
19
19
  // For socket api
20
+ routerUrl: "http://localhost:8080",
21
+ // For router api
20
22
  apiUrl: "http://localhost:8080",
21
23
  // For server api
22
24
  basedEnv: "development",
@@ -25,115 +27,53 @@ const CONFIG = {
25
27
  // For based api
26
28
  basedOrg: "symbols",
27
29
  // For based api
28
- githubClientId: "Ov23liAFrsR0StbAO6PO",
30
+ githubClientId: "Ov23liHxyWFBxS8f1gnF",
29
31
  // For github api
30
- grafanaUrl: "",
31
- // For grafana tracing
32
- grafanaAppName: "Symbols Localhost",
33
32
  // Environment-specific feature toggles (override common)
34
33
  features: {
35
- // Disable tracking by default on localhost/dev machines
36
- trackingEnabled: false,
34
+ betaFeatures: true
37
35
  // Enable beta features in local dev
38
- betaFeatures: true,
39
- // Preserve common defaults explicitly for local
40
- newUserOnboarding: true
41
- },
42
- typesenseCollectionName: "docs",
43
- typesenseApiKey: "vZya3L2zpq8L6iI5WWMUZJZABvT63VDb",
44
- typesenseHost: "localhost",
45
- typesensePort: "8108",
46
- typesenseProtocol: "http"
36
+ }
47
37
  },
48
38
  development: {
39
+ baseUrl: "https://dev.api.symbols.app",
49
40
  socketUrl: "https://dev.api.symbols.app",
41
+ routerUrl: "https://dev.api.symbols.app",
50
42
  apiUrl: "https://dev.api.symbols.app",
51
- githubClientId: "Ov23liHxyWFBxS8f1gnF",
52
- grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8",
53
- // For grafana tracing
54
- grafanaAppName: "Symbols Dev",
55
- typesenseCollectionName: "docs",
56
- typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
57
- typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
58
- typesensePort: "443",
59
- typesenseProtocol: "https"
43
+ basedEnv: "development",
44
+ basedProject: "platform-v2-sm",
45
+ basedOrg: "symbols",
46
+ githubClientId: "Ov23liHxyWFBxS8f1gnF"
60
47
  },
61
48
  testing: {
49
+ baseUrl: "https://test.api.symbols.app",
62
50
  socketUrl: "https://test.api.symbols.app",
51
+ routerUrl: "https://test.api.symbols.app",
63
52
  apiUrl: "https://test.api.symbols.app",
64
53
  basedEnv: "testing",
65
54
  basedProject: "platform-v2-sm",
66
55
  basedOrg: "symbols",
67
- githubClientId: "Ov23liHxyWFBxS8f1gnF",
68
- grafanaUrl: "",
69
- // For grafana tracing
70
- grafanaAppName: "Symbols Test",
71
- typesenseCollectionName: "docs",
72
- typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
73
- typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
74
- typesensePort: "443",
75
- typesenseProtocol: "https"
76
- },
77
- upcoming: {
78
- socketUrl: "https://upcoming.api.symbols.app",
79
- apiUrl: "https://upcoming.api.symbols.app",
80
- githubClientId: "Ov23liWF7NvdZ056RV5J",
81
- grafanaUrl: "",
82
- // For grafana tracing
83
- grafanaAppName: "Symbols Upcoming",
84
- typesenseCollectionName: "docs",
85
- typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
86
- typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
87
- typesensePort: "443",
88
- typesenseProtocol: "https"
56
+ githubClientId: "Ov23liHxyWFBxS8f1gnF"
89
57
  },
90
58
  staging: {
59
+ baseUrl: "https://staging.api.symbols.app",
91
60
  socketUrl: "https://staging.api.symbols.app",
61
+ routerUrl: "https://staging.api.symbols.app",
92
62
  apiUrl: "https://staging.api.symbols.app",
93
63
  basedEnv: "staging",
94
64
  basedProject: "platform-v2-sm",
95
65
  basedOrg: "symbols",
96
- githubClientId: "Ov23ligwZDQVD0VfuWNa",
97
- grafanaUrl: "",
98
- // For grafana tracing
99
- grafanaAppName: "Symbols Staging",
100
- typesenseCollectionName: "docs",
101
- typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
102
- typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
103
- typesensePort: "443",
104
- typesenseProtocol: "https"
105
- },
106
- preview: {
107
- socketUrl: "https://api.symbols.app",
108
- apiUrl: "https://api.symbols.app",
109
- basedEnv: "production",
110
- basedProject: "platform-v2-sm",
111
- basedOrg: "symbols",
112
- githubClientId: "Ov23liFAlOEIXtX3dBtR",
113
- grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/5c1089f3c3eea4ec5658e05c3f53baae",
114
- // For grafana tracing
115
- grafanaAppName: "Symbols Preview",
116
- typesenseCollectionName: "docs",
117
- typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
118
- typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
119
- typesensePort: "443",
120
- typesenseProtocol: "https"
66
+ githubClientId: "Ov23ligwZDQVD0VfuWNa"
121
67
  },
122
68
  production: {
69
+ baseUrl: "https://api.symbols.app",
123
70
  socketUrl: "https://api.symbols.app",
71
+ routerUrl: "https://api.symbols.app",
124
72
  apiUrl: "https://api.symbols.app",
125
73
  basedEnv: "production",
126
74
  basedProject: "platform-v2-sm",
127
75
  basedOrg: "symbols",
128
- githubClientId: "Ov23liFAlOEIXtX3dBtR",
129
- grafanaUrl: "https://faro-collector-prod-us-east-0.grafana.net/collect/5c1089f3c3eea4ec5658e05c3f53baae",
130
- // For grafana tracing
131
- grafanaAppName: "Symbols",
132
- typesenseCollectionName: "docs",
133
- typesenseApiKey: "awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA",
134
- typesenseHost: "tl2qpnwxev4cjm36p-1.a1.typesense.net",
135
- typesensePort: "443",
136
- typesenseProtocol: "https"
76
+ githubClientId: "Ov23liFAlOEIXtX3dBtR"
137
77
  }
138
78
  };
139
79
  const getEnvironment = () => {
@@ -150,33 +90,27 @@ const getConfig = () => {
150
90
  const envConfig = { ...CONFIG.common, ...CONFIG[env] };
151
91
  const finalConfig = {
152
92
  ...envConfig,
153
- // Deep-merge feature flags so env-specific overrides don't drop common defaults
154
- features: {
155
- ...CONFIG.common.features || {},
156
- ...CONFIG[env] && CONFIG[env].features || {}
157
- },
93
+ baseUrl: process.env.SYMBOLS_APP_BASE_URL || envConfig.baseUrl,
158
94
  socketUrl: process.env.SYMBOLS_APP_SOCKET_URL || envConfig.socketUrl,
95
+ routerUrl: process.env.SYMBOLS_APP_ROUTER_URL || envConfig.routerUrl,
159
96
  apiUrl: process.env.SYMBOLS_APP_API_URL || envConfig.apiUrl,
160
97
  basedEnv: process.env.SYMBOLS_APP_BASED_ENV || envConfig.basedEnv,
161
98
  basedProject: process.env.SYMBOLS_APP_BASED_PROJECT || envConfig.basedProject,
162
99
  basedOrg: process.env.SYMBOLS_APP_BASED_ORG || envConfig.basedOrg,
163
100
  githubClientId: process.env.SYMBOLS_APP_GITHUB_CLIENT_ID || envConfig.githubClientId,
164
- grafanaUrl: process.env.SYMBOLS_APP_GRAFANA_URL || envConfig.grafanaUrl,
165
- typesenseCollectionName: process.env.TYPESENSE_COLLECTION_NAME || envConfig.typesenseCollectionName,
166
- typesenseApiKey: process.env.TYPESENSE_API_KEY || envConfig.typesenseApiKey,
167
- typesenseHost: process.env.TYPESENSE_HOST || envConfig.typesenseHost,
168
- typesensePort: process.env.TYPESENSE_PORT || envConfig.typesensePort,
169
- typesenseProtocol: process.env.TYPESENSE_PROTOCOL || envConfig.typesenseProtocol,
170
101
  isDevelopment: isDevelopment(env),
171
102
  isTesting: env === "testing",
172
103
  isStaging: env === "staging",
173
- isPreview: env === "preview",
174
104
  isProduction: env === "production"
175
105
  // Store all environment variables for potential future use
176
106
  };
177
107
  const requiredFields = [
108
+ "baseUrl",
178
109
  "socketUrl",
179
110
  "apiUrl",
111
+ "basedEnv",
112
+ "basedProject",
113
+ "basedOrg",
180
114
  "githubClientId",
181
115
  "googleClientId"
182
116
  ];
@@ -187,13 +121,11 @@ const getConfig = () => {
187
121
  );
188
122
  }
189
123
  if (finalConfig.isDevelopment) {
190
- console.warn(
124
+ console.log(
191
125
  "environment in SDK:",
192
126
  env || process.env.NODE_ENV || process.env.NODE_ENV
193
127
  );
194
128
  console.log(finalConfig);
195
- } else if (global.window) {
196
- global.window.finalConfig = finalConfig;
197
129
  }
198
130
  return finalConfig;
199
131
  } catch (error) {