@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/sdk",
3
- "version": "2.34.35",
3
+ "version": "3.1.2",
4
4
  "type": "module",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -30,50 +30,31 @@
30
30
  "build": "rimraf dist; npm run build:esm; npm run build:node; npm run build:cjs",
31
31
  "// prepublish": "rimraf -I dist; npm run build; npm run copy:package:cjs; npm run test",
32
32
  "prepublish": "rimraf -I dist; npm run build; npm run copy:package:cjs;",
33
- "test:all": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/*.test.js | tap-spec",
34
- "test:smoke": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/smoke/*.test.js | tap-spec",
35
- "test:auth": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/auth/*.test.js | tap-spec",
36
- "test:branch": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/branch/*.test.js | tap-spec",
37
- "test:dataset": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/dataset/*.test.js | tap-spec",
38
- "test:external": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/external/*.test.js | tap-spec",
39
- "test:member": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/member/*.test.js | tap-spec",
40
- "test:password": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/password/*.test.js | tap-spec",
41
- "test:project": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/project/*.test.js | tap-spec",
42
- "test:get-project": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/get-project/*.test.js | tap-spec",
43
- "test:update-project": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/update-project/*.test.js | tap-spec",
44
- "test:favorite-project": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/favorite-project/*.test.js | tap-spec",
45
- "test:collab": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/collab/*.test.js | tap-spec",
46
- "test:user": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/user/*.test.js | tap-spec",
47
- "test:unit-all": "cross-env NODE_ENV=$NODE_ENV npx tape src/services/tests/**/*.test.js | tap-spec"
33
+ "test:all": "cross-env NODE_ENV=testing npx tape integration-tests/index.js integration-tests/*.test.js | tap-spec",
34
+ "test:specific": "cross-env NODE_ENV=testing npx tape integration-tests/index.js integration-tests/$npm_config_testname.test.js | tap-spec"
48
35
  },
49
36
  "dependencies": {
50
- "@domql/element": "^2.34.35",
51
- "@domql/utils": "^2.34.35",
52
- "@grafana/faro-web-sdk": "^1.19.0",
53
- "@grafana/faro-web-tracing": "^1.19.0",
54
- "@symbo.ls/router": "^2.34.35",
55
- "@symbo.ls/socket": "^2.34.35",
37
+ "@based/cli": "5.1.1",
38
+ "@based/client": "^6.11.1",
39
+ "@based/errors": "^1.4.0",
40
+ "@based/functions": "^3.0.2",
41
+ "@domql/element": "^3.1.2",
42
+ "@symbo.ls/router": "^3.1.2",
43
+ "@symbo.ls/socket": "^3.1.2",
56
44
  "acorn": "^8.14.0",
57
45
  "acorn-walk": "^8.3.4",
58
- "dexie": "^4.0.11",
59
46
  "dotenv": "^16.4.7",
60
- "nanoid": "^5.1.5",
61
- "node-fetch": "^3.3.2",
62
- "socket.io-client": "^4.8.1",
63
- "y-indexeddb": "^9.0.12",
64
- "yjs": "^13.6.27"
47
+ "node-fetch": "^3.3.2"
65
48
  },
66
49
  "devDependencies": {
67
50
  "@faker-js/faker": "^9.5.1",
68
51
  "cross-env": "^7.0.3",
69
- "esbuild": "^0.26.0",
52
+ "esbuild": "^0.25.1",
70
53
  "esbuild-plugins-node-modules-polyfill": "^1.6.8",
71
- "glob": "^12.0.0",
54
+ "glob": "^11.0.0",
72
55
  "jsdom": "^26.1.0",
73
- "sinon": "^21.0.0",
74
- "tap-parser": "^18.0.0",
75
- "tap-spec": "^5.0.0",
76
- "tape": "^5.9.0"
56
+ "tap-spec": "^2.2.2",
57
+ "tape": "5.9.0"
77
58
  },
78
- "gitHead": "0be12bcdd99c265fdeded6d756a1a3616a943ffc"
59
+ "gitHead": "429b36616aa04c8587a26ce3c129815115e35897"
79
60
  }
@@ -10,9 +10,7 @@ const CONFIG = {
10
10
  // Feature toggles that apply across all environments by default
11
11
  features: {
12
12
  newUserOnboarding: true,
13
- betaFeatures: false,
14
- // Tracking is enabled by default unless overridden per environment
15
- trackingEnabled: true
13
+ betaFeatures: false
16
14
  }
17
15
  },
18
16
 
@@ -20,115 +18,58 @@ const CONFIG = {
20
18
 
21
19
  local: {
22
20
  // local
21
+ baseUrl: 'http://localhost:8080', // For symstory api
23
22
  socketUrl: 'http://localhost:8080', // For socket api
23
+ routerUrl: 'http://localhost:8080', // For router api
24
24
  apiUrl: 'http://localhost:8080', // For server api
25
25
  basedEnv: 'development', // For based api
26
26
  basedProject: 'platform-v2-sm', // For based api
27
27
  basedOrg: 'symbols', // For based api
28
- githubClientId: 'Ov23liAFrsR0StbAO6PO', // For github api
29
- grafanaUrl: '', // For grafana tracing
30
- grafanaAppName: 'Symbols Localhost',
28
+ githubClientId: 'Ov23liHxyWFBxS8f1gnF', // For github api
31
29
  // Environment-specific feature toggles (override common)
32
30
  features: {
33
- // Disable tracking by default on localhost/dev machines
34
- trackingEnabled: false,
35
- // Enable beta features in local dev
36
- betaFeatures: true,
37
- // Preserve common defaults explicitly for local
38
- newUserOnboarding: true
39
- },
40
- typesenseCollectionName: 'docs',
41
- typesenseApiKey: 'vZya3L2zpq8L6iI5WWMUZJZABvT63VDb',
42
- typesenseHost: 'localhost',
43
- typesensePort: '8108',
44
- typesenseProtocol: 'http'
31
+ betaFeatures: true // Enable beta features in local dev
32
+ }
45
33
  },
46
34
  development: {
35
+ baseUrl: 'https://dev.api.symbols.app',
47
36
  socketUrl: 'https://dev.api.symbols.app',
37
+ routerUrl: 'https://dev.api.symbols.app',
48
38
  apiUrl: 'https://dev.api.symbols.app',
49
- githubClientId: 'Ov23liHxyWFBxS8f1gnF',
50
- grafanaUrl:
51
- 'https://faro-collector-prod-us-east-0.grafana.net/collect/7a3ba473cee2025c68513667024316b8', // For grafana tracing
52
- grafanaAppName: 'Symbols Dev',
53
- typesenseCollectionName: 'docs',
54
- typesenseApiKey: 'awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA',
55
- typesenseHost: 'tl2qpnwxev4cjm36p-1.a1.typesense.net',
56
- typesensePort: '443',
57
- typesenseProtocol: 'https'
39
+ basedEnv: 'development',
40
+ basedProject: 'platform-v2-sm',
41
+ basedOrg: 'symbols',
42
+ githubClientId: 'Ov23liHxyWFBxS8f1gnF'
58
43
  },
59
44
  testing: {
45
+ baseUrl: 'https://test.api.symbols.app',
60
46
  socketUrl: 'https://test.api.symbols.app',
47
+ routerUrl: 'https://test.api.symbols.app',
61
48
  apiUrl: 'https://test.api.symbols.app',
62
49
  basedEnv: 'testing',
63
50
  basedProject: 'platform-v2-sm',
64
51
  basedOrg: 'symbols',
65
- githubClientId: 'Ov23liHxyWFBxS8f1gnF',
66
- grafanaUrl: '', // For grafana tracing
67
- grafanaAppName: 'Symbols Test',
68
- typesenseCollectionName: 'docs',
69
- typesenseApiKey: 'awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA',
70
- typesenseHost: 'tl2qpnwxev4cjm36p-1.a1.typesense.net',
71
- typesensePort: '443',
72
- typesenseProtocol: 'https'
73
- },
74
- upcoming: {
75
- socketUrl: 'https://upcoming.api.symbols.app',
76
- apiUrl: 'https://upcoming.api.symbols.app',
77
- githubClientId: 'Ov23liWF7NvdZ056RV5J',
78
- grafanaUrl: '', // For grafana tracing
79
- grafanaAppName: 'Symbols Upcoming',
80
- typesenseCollectionName: 'docs',
81
- typesenseApiKey: 'awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA',
82
- typesenseHost: 'tl2qpnwxev4cjm36p-1.a1.typesense.net',
83
- typesensePort: '443',
84
- typesenseProtocol: 'https'
52
+ githubClientId: 'Ov23liHxyWFBxS8f1gnF'
85
53
  },
86
54
  staging: {
55
+ baseUrl: 'https://staging.api.symbols.app',
87
56
  socketUrl: 'https://staging.api.symbols.app',
57
+ routerUrl: 'https://staging.api.symbols.app',
88
58
  apiUrl: 'https://staging.api.symbols.app',
89
59
  basedEnv: 'staging',
90
60
  basedProject: 'platform-v2-sm',
91
61
  basedOrg: 'symbols',
92
- githubClientId: 'Ov23ligwZDQVD0VfuWNa',
93
- grafanaUrl: '', // For grafana tracing
94
- grafanaAppName: 'Symbols Staging',
95
- typesenseCollectionName: 'docs',
96
- typesenseApiKey: 'awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA',
97
- typesenseHost: 'tl2qpnwxev4cjm36p-1.a1.typesense.net',
98
- typesensePort: '443',
99
- typesenseProtocol: 'https'
100
- },
101
- preview: {
102
- socketUrl: 'https://api.symbols.app',
103
- apiUrl: 'https://api.symbols.app',
104
- basedEnv: 'production',
105
- basedProject: 'platform-v2-sm',
106
- basedOrg: 'symbols',
107
- githubClientId: 'Ov23liFAlOEIXtX3dBtR',
108
- grafanaUrl:
109
- 'https://faro-collector-prod-us-east-0.grafana.net/collect/5c1089f3c3eea4ec5658e05c3f53baae', // For grafana tracing
110
- grafanaAppName: 'Symbols Preview',
111
- typesenseCollectionName: 'docs',
112
- typesenseApiKey: 'awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA',
113
- typesenseHost: 'tl2qpnwxev4cjm36p-1.a1.typesense.net',
114
- typesensePort: '443',
115
- typesenseProtocol: 'https'
62
+ githubClientId: 'Ov23ligwZDQVD0VfuWNa'
116
63
  },
117
64
  production: {
65
+ baseUrl: 'https://api.symbols.app',
118
66
  socketUrl: 'https://api.symbols.app',
67
+ routerUrl: 'https://api.symbols.app',
119
68
  apiUrl: 'https://api.symbols.app',
120
69
  basedEnv: 'production',
121
70
  basedProject: 'platform-v2-sm',
122
71
  basedOrg: 'symbols',
123
- githubClientId: 'Ov23liFAlOEIXtX3dBtR',
124
- grafanaUrl:
125
- 'https://faro-collector-prod-us-east-0.grafana.net/collect/5c1089f3c3eea4ec5658e05c3f53baae', // For grafana tracing
126
- grafanaAppName: 'Symbols',
127
- typesenseCollectionName: 'docs',
128
- typesenseApiKey: 'awmcVpbWqZi9IUgmvslp1C5LKDU8tMjA',
129
- typesenseHost: 'tl2qpnwxev4cjm36p-1.a1.typesense.net',
130
- typesensePort: '443',
131
- typesenseProtocol: 'https'
72
+ githubClientId: 'Ov23liFAlOEIXtX3dBtR'
132
73
  }
133
74
  }
134
75
 
@@ -154,12 +95,9 @@ export const getConfig = () => {
154
95
  // Create the final config with environment variable overrides
155
96
  const finalConfig = {
156
97
  ...envConfig,
157
- // Deep-merge feature flags so env-specific overrides don't drop common defaults
158
- features: {
159
- ...(CONFIG.common.features || {}),
160
- ...((CONFIG[env] && CONFIG[env].features) || {})
161
- },
98
+ baseUrl: process.env.SYMBOLS_APP_BASE_URL || envConfig.baseUrl,
162
99
  socketUrl: process.env.SYMBOLS_APP_SOCKET_URL || envConfig.socketUrl,
100
+ routerUrl: process.env.SYMBOLS_APP_ROUTER_URL || envConfig.routerUrl,
163
101
  apiUrl: process.env.SYMBOLS_APP_API_URL || envConfig.apiUrl,
164
102
  basedEnv: process.env.SYMBOLS_APP_BASED_ENV || envConfig.basedEnv,
165
103
  basedProject:
@@ -167,28 +105,21 @@ export const getConfig = () => {
167
105
  basedOrg: process.env.SYMBOLS_APP_BASED_ORG || envConfig.basedOrg,
168
106
  githubClientId:
169
107
  process.env.SYMBOLS_APP_GITHUB_CLIENT_ID || envConfig.githubClientId,
170
- grafanaUrl: process.env.SYMBOLS_APP_GRAFANA_URL || envConfig.grafanaUrl,
171
- typesenseCollectionName:
172
- process.env.TYPESENSE_COLLECTION_NAME ||
173
- envConfig.typesenseCollectionName,
174
- typesenseApiKey:
175
- process.env.TYPESENSE_API_KEY || envConfig.typesenseApiKey,
176
- typesenseHost: process.env.TYPESENSE_HOST || envConfig.typesenseHost,
177
- typesensePort: process.env.TYPESENSE_PORT || envConfig.typesensePort,
178
- typesenseProtocol:
179
- process.env.TYPESENSE_PROTOCOL || envConfig.typesenseProtocol,
180
108
  isDevelopment: isDevelopment(env),
181
109
  isTesting: env === 'testing',
182
110
  isStaging: env === 'staging',
183
- isPreview: env === 'preview',
184
111
  isProduction: env === 'production'
185
112
  // Store all environment variables for potential future use
186
113
  }
187
114
 
188
115
  // Validate critical configuration values
189
116
  const requiredFields = [
117
+ 'baseUrl',
190
118
  'socketUrl',
191
119
  'apiUrl',
120
+ 'basedEnv',
121
+ 'basedProject',
122
+ 'basedOrg',
192
123
  'githubClientId',
193
124
  'googleClientId'
194
125
  ]
@@ -202,13 +133,11 @@ export const getConfig = () => {
202
133
  }
203
134
 
204
135
  if (finalConfig.isDevelopment) {
205
- console.warn(
136
+ console.log(
206
137
  'environment in SDK:',
207
138
  env || process.env.NODE_ENV || process.env.NODE_ENV
208
139
  )
209
140
  console.log(finalConfig)
210
- } else if (global.window) {
211
- global.window.finalConfig = finalConfig
212
141
  }
213
142
 
214
143
  return finalConfig
package/src/index.js CHANGED
@@ -1,36 +1,14 @@
1
1
  import {
2
+ createSymstoryService,
2
3
  createAuthService,
3
- createCollabService,
4
- createProjectService,
5
- createPlanService,
6
- createFileService,
7
- createPaymentService,
8
- createDnsService,
9
- createBranchService,
10
- createPullRequestService,
11
- createAdminService,
12
- createSubscriptionService,
13
- createScreenshotService,
14
- createTrackingService,
15
- createWaitlistService,
16
- createMetricsService,
17
- createIntegrationService,
18
- createFeatureFlagService
4
+ createAIService,
5
+ createSocketService,
6
+ createCoreService
19
7
  } from './services/index.js'
20
8
 
21
9
  import { SERVICE_METHODS } from './utils/services.js'
10
+ import { SymstoryService } from './services/SymstoryService.js'
22
11
  import environment from './config/environment.js'
23
- import { rootBus } from './state/rootEventBus.js'
24
-
25
- const isBrowserEnvironment = () => typeof window !== 'undefined'
26
-
27
- export const isLocalhost = () => {
28
- if (!isBrowserEnvironment()) {
29
- return false
30
- }
31
- const host = window.location && window.location.hostname
32
- return host === 'localhost' || host === '127.0.0.1' || host === '::1' || host === '' || !host
33
- }
34
12
 
35
13
  export class SDK {
36
14
  constructor (options = {}) {
@@ -38,12 +16,6 @@ export class SDK {
38
16
  this._context = {}
39
17
  this._options = this._validateOptions(options)
40
18
 
41
- // Expose resolved environment config on SDK instance
42
- this.environment = environment
43
-
44
- // Expose root event bus on SDK instance
45
- this.rootBus = rootBus
46
-
47
19
  // Create proxy methods for direct service access
48
20
  this._createServiceProxies()
49
21
  }
@@ -66,114 +38,29 @@ export class SDK {
66
38
  })
67
39
  ),
68
40
  this._initService(
69
- 'collab',
70
- createCollabService({
71
- context: this._context,
72
- options: this._options
73
- })
74
- ),
75
- // Initialize new modular services
76
- this._initService(
77
- 'project',
78
- createProjectService({
79
- context: this._context,
80
- options: this._options
81
- })
82
- ),
83
- this._initService(
84
- 'plan',
85
- createPlanService({
86
- context: this._context,
87
- options: this._options
88
- })
89
- ),
90
- this._initService(
91
- 'subscription',
92
- createSubscriptionService({
93
- context: this._context,
94
- options: this._options
95
- })
96
- ),
97
- this._initService(
98
- 'file',
99
- createFileService({
41
+ 'socket',
42
+ createSocketService({
100
43
  context: this._context,
101
44
  options: this._options
102
45
  })
103
46
  ),
104
47
  this._initService(
105
- 'payment',
106
- createPaymentService({
48
+ 'symstory',
49
+ createSymstoryService({
107
50
  context: this._context,
108
51
  options: this._options
109
52
  })
110
53
  ),
111
54
  this._initService(
112
- 'dns',
113
- createDnsService({
55
+ 'ai',
56
+ createAIService({
114
57
  context: this._context,
115
58
  options: this._options
116
59
  })
117
60
  ),
118
61
  this._initService(
119
- 'branch',
120
- createBranchService({
121
- context: this._context,
122
- options: this._options
123
- })
124
- ),
125
- this._initService(
126
- 'pullRequest',
127
- createPullRequestService({
128
- context: this._context,
129
- options: this._options
130
- })
131
- ),
132
- this._initService(
133
- 'admin',
134
- createAdminService({
135
- context: this._context,
136
- options: this._options
137
- })
138
- ),
139
- this._initService(
140
- 'screenshot',
141
- createScreenshotService({
142
- context: this._context,
143
- options: this._options
144
- })
145
- ),
146
- this._initService(
147
- 'tracking',
148
- createTrackingService({
149
- context: this._context,
150
- options: this._options
151
- })
152
- ),
153
- this._initService(
154
- 'waitlist',
155
- createWaitlistService({
156
- context: this._context,
157
- options: this._options
158
- })
159
- ),
160
- this._initService(
161
- 'metrics',
162
- createMetricsService({
163
- context: this._context,
164
- options: this._options
165
- })
166
- ),
167
- this._initService(
168
- 'integration',
169
- createIntegrationService({
170
- context: this._context,
171
- options: this._options
172
- })
173
- ),
174
- this._initService(
175
- 'featureFlag',
176
- createFeatureFlagService({
62
+ 'core',
63
+ createCoreService({
177
64
  context: this._context,
178
65
  options: this._options
179
66
  })
@@ -201,36 +88,16 @@ export class SDK {
201
88
  }
202
89
 
203
90
  _validateOptions (options) {
204
- const onLocalhost = isLocalhost()
205
- const hasGrafanaUrl = Boolean(environment.grafanaUrl)
206
91
  const defaults = {
207
92
  useNewServices: true, // Use new service implementations by default
208
- apiUrl: environment.apiUrl,
93
+ baseUrl: environment.baseUrl,
209
94
  socketUrl: environment.socketUrl,
210
95
  timeout: 30000,
211
96
  retryAttempts: 3,
212
- debug: false,
213
- tracking: {
214
- // Force-disabled on localhost or when no Grafana URL is configured
215
- enabled: onLocalhost ? false : (hasGrafanaUrl ? environment.features.trackingEnabled : false)
216
- }
97
+ debug: false
217
98
  }
218
99
 
219
- const merged = {
220
- ...defaults,
221
- ...options,
222
- tracking: {
223
- ...defaults.tracking,
224
- ...(options.tracking || {})
225
- }
226
- }
227
-
228
- // Enforce disabled tracking on localhost or when no Grafana URL configured, even if overridden
229
- if (onLocalhost || !hasGrafanaUrl) {
230
- merged.tracking.enabled = false
231
- }
232
-
233
- return merged
100
+ return { ...defaults, ...options }
234
101
  }
235
102
 
236
103
  // Get service instance
@@ -243,26 +110,25 @@ export class SDK {
243
110
 
244
111
  // Update context
245
112
  updateContext (newContext) {
246
- // Do not persist authToken in SDK context; TokenManager is the source of truth
247
- const { ...sanitized } = newContext || {}
248
-
249
113
  this._context = {
250
114
  ...this._context,
251
- ...sanitized
115
+ ...newContext
252
116
  }
253
117
 
254
118
  // Update context for all services
255
119
  for (const service of this._services.values()) {
256
120
  service.updateContext(this._context)
121
+ if (service instanceof SymstoryService) {
122
+ service.init()
123
+ }
257
124
  }
258
125
  }
259
126
 
260
127
  // Check if SDK is ready
261
128
  isReady () {
262
129
  const sdkServices = Array.from(this._services.values())
263
- return (
264
- sdkServices.length > 0 &&
265
- sdkServices.every((service) => service.isReady())
130
+ return sdkServices.length > 0 && sdkServices.every(service =>
131
+ service.isReady()
266
132
  )
267
133
  }
268
134
 
@@ -301,26 +167,26 @@ export class SDK {
301
167
  * Destroys all services and cleans up resources
302
168
  * @returns {Promise<boolean>} Returns true when cleanup is complete
303
169
  */
304
- async destroy () {
170
+ async destroy() {
305
171
  try {
306
172
  // Call destroy on all services
307
173
  const destroyPromises = Array.from(this._services.entries())
308
174
  .filter(([, service]) => typeof service.destroy === 'function')
309
175
  .map(async ([name, service]) => {
310
- await service.destroy()
311
- console.log(`Service ${name} destroyed successfully`)
312
- })
176
+ await service.destroy();
177
+ console.log(`Service ${name} destroyed successfully`);
178
+ });
313
179
 
314
- await Promise.all(destroyPromises)
180
+ await Promise.all(destroyPromises);
315
181
 
316
182
  // Clear services and reset state
317
- this._services.clear()
318
- this._context = {}
183
+ this._services.clear();
184
+ this._context = {};
319
185
 
320
- return true
186
+ return true;
321
187
  } catch (error) {
322
- console.error('Error during SDK destruction:', error)
323
- throw error
188
+ console.error('Error during SDK destruction:', error);
189
+ throw error;
324
190
  }
325
191
  }
326
192
  }
@@ -329,22 +195,11 @@ export default SDK
329
195
 
330
196
  // Export services for direct usage
331
197
  export {
198
+ createSymstoryService,
332
199
  createAuthService,
333
- createCollabService,
334
- createProjectService,
335
- createPlanService,
336
- createFileService,
337
- createPaymentService,
338
- createDnsService,
339
- createBranchService,
340
- createPullRequestService,
341
- createAdminService,
342
- createSubscriptionService,
343
- createTrackingService,
344
- createWaitlistService,
345
- createMetricsService,
346
- createIntegrationService,
347
- createFeatureFlagService
200
+ createAIService,
201
+ createSocketService,
202
+ createCoreService
348
203
  } from './services/index.js'
349
204
 
350
205
  // Export environment configuration