@symbo.ls/sdk 2.34.35 → 3.1.1
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 +13 -315
- package/dist/cjs/config/environment.js +50 -124
- package/dist/cjs/index.js +22 -169
- package/dist/cjs/services/AIService.js +155 -0
- package/dist/cjs/services/AuthService.js +277 -751
- package/dist/cjs/services/BaseService.js +6 -158
- package/dist/cjs/services/BasedService.js +679 -0
- package/dist/cjs/services/SocketIOService.js +309 -0
- package/dist/cjs/services/SocketService.js +161 -0
- package/dist/cjs/services/SymstoryService.js +485 -0
- package/dist/cjs/services/index.js +16 -64
- package/dist/cjs/utils/basedQuerys.js +61 -0
- package/dist/cjs/utils/permission.js +4 -4
- package/dist/cjs/utils/services.js +80 -301
- package/dist/cjs/utils/symstoryClient.js +228 -0
- package/dist/cjs/utils/validation.js +3 -0
- package/dist/esm/config/environment.js +50 -124
- package/dist/esm/index.js +11282 -49789
- package/dist/esm/services/AIService.js +185 -0
- package/dist/esm/services/AuthService.js +358 -1506
- package/dist/esm/services/BaseService.js +6 -757
- package/dist/esm/services/BasedService.js +4651 -0
- package/dist/esm/services/SocketIOService.js +467 -0
- package/dist/esm/services/SocketService.js +191 -0
- package/dist/esm/services/SymstoryService.js +6849 -0
- package/dist/esm/services/index.js +11188 -49352
- package/dist/esm/utils/basedQuerys.js +43 -0
- package/dist/esm/utils/permission.js +4 -4
- package/dist/esm/utils/services.js +80 -301
- package/dist/esm/utils/symstoryClient.js +334 -0
- package/dist/esm/utils/validation.js +26 -93
- package/dist/node/config/environment.js +50 -124
- package/dist/node/index.js +26 -202
- package/dist/node/services/AIService.js +136 -0
- package/dist/node/services/AuthService.js +278 -751
- package/dist/node/services/BaseService.js +6 -148
- package/dist/node/services/BasedService.js +650 -0
- package/dist/node/services/SocketIOService.js +280 -0
- package/dist/node/services/SocketService.js +142 -0
- package/dist/node/services/SymstoryService.js +456 -0
- package/dist/node/services/index.js +16 -64
- package/dist/node/utils/basedQuerys.js +42 -0
- package/dist/node/utils/permission.js +4 -4
- package/dist/node/utils/services.js +80 -301
- package/dist/node/utils/symstoryClient.js +199 -0
- package/dist/node/utils/validation.js +3 -0
- package/package.json +21 -43
- package/src/config/environment.js +50 -126
- package/src/index.js +24 -208
- package/src/services/AIService.js +150 -0
- package/src/services/AuthService.js +298 -893
- package/src/services/BaseService.js +6 -166
- package/src/services/BasedService.js +722 -0
- package/src/services/SocketIOService.js +356 -0
- package/src/services/SocketService.js +168 -0
- package/src/services/SymstoryService.js +563 -0
- package/src/services/index.js +13 -80
- package/src/utils/basedQuerys.js +41 -0
- package/src/utils/permission.js +4 -4
- package/src/utils/services.js +83 -325
- package/src/utils/symstoryClient.js +218 -0
- package/src/utils/validation.js +3 -0
- package/dist/cjs/services/AdminService.js +0 -351
- package/dist/cjs/services/BranchService.js +0 -484
- package/dist/cjs/services/CollabService.js +0 -743
- package/dist/cjs/services/DnsService.js +0 -340
- package/dist/cjs/services/FeatureFlagService.js +0 -175
- package/dist/cjs/services/FileService.js +0 -201
- package/dist/cjs/services/IntegrationService.js +0 -538
- package/dist/cjs/services/MetricsService.js +0 -62
- package/dist/cjs/services/PaymentService.js +0 -271
- package/dist/cjs/services/PlanService.js +0 -426
- package/dist/cjs/services/ProjectService.js +0 -1207
- package/dist/cjs/services/PullRequestService.js +0 -503
- package/dist/cjs/services/ScreenshotService.js +0 -304
- package/dist/cjs/services/SubscriptionService.js +0 -396
- package/dist/cjs/services/TrackingService.js +0 -661
- package/dist/cjs/services/WaitlistService.js +0 -148
- package/dist/cjs/state/RootStateManager.js +0 -65
- package/dist/cjs/state/rootEventBus.js +0 -74
- package/dist/cjs/utils/CollabClient.js +0 -223
- package/dist/cjs/utils/TokenManager.js +0 -422
- package/dist/cjs/utils/changePreprocessor.js +0 -199
- package/dist/cjs/utils/jsonDiff.js +0 -145
- package/dist/cjs/utils/ordering.js +0 -309
- package/dist/esm/services/AdminService.js +0 -1132
- package/dist/esm/services/BranchService.js +0 -1265
- package/dist/esm/services/CollabService.js +0 -26838
- package/dist/esm/services/DnsService.js +0 -1121
- package/dist/esm/services/FeatureFlagService.js +0 -956
- package/dist/esm/services/FileService.js +0 -982
- package/dist/esm/services/IntegrationService.js +0 -1319
- package/dist/esm/services/MetricsService.js +0 -843
- package/dist/esm/services/PaymentService.js +0 -1052
- package/dist/esm/services/PlanService.js +0 -1207
- package/dist/esm/services/ProjectService.js +0 -2526
- package/dist/esm/services/PullRequestService.js +0 -1284
- package/dist/esm/services/ScreenshotService.js +0 -1085
- package/dist/esm/services/SubscriptionService.js +0 -1177
- package/dist/esm/services/TrackingService.js +0 -18343
- package/dist/esm/services/WaitlistService.js +0 -929
- package/dist/esm/state/RootStateManager.js +0 -90
- package/dist/esm/state/rootEventBus.js +0 -56
- package/dist/esm/utils/CollabClient.js +0 -18901
- package/dist/esm/utils/TokenManager.js +0 -408
- package/dist/esm/utils/changePreprocessor.js +0 -542
- package/dist/esm/utils/jsonDiff.js +0 -7011
- package/dist/esm/utils/ordering.js +0 -291
- package/dist/node/services/AdminService.js +0 -332
- package/dist/node/services/BranchService.js +0 -465
- package/dist/node/services/CollabService.js +0 -724
- package/dist/node/services/DnsService.js +0 -321
- package/dist/node/services/FeatureFlagService.js +0 -156
- package/dist/node/services/FileService.js +0 -182
- package/dist/node/services/IntegrationService.js +0 -519
- package/dist/node/services/MetricsService.js +0 -43
- package/dist/node/services/PaymentService.js +0 -252
- package/dist/node/services/PlanService.js +0 -407
- package/dist/node/services/ProjectService.js +0 -1188
- package/dist/node/services/PullRequestService.js +0 -484
- package/dist/node/services/ScreenshotService.js +0 -285
- package/dist/node/services/SubscriptionService.js +0 -377
- package/dist/node/services/TrackingService.js +0 -632
- package/dist/node/services/WaitlistService.js +0 -129
- package/dist/node/state/RootStateManager.js +0 -36
- package/dist/node/state/rootEventBus.js +0 -55
- package/dist/node/utils/CollabClient.js +0 -194
- package/dist/node/utils/TokenManager.js +0 -403
- package/dist/node/utils/changePreprocessor.js +0 -180
- package/dist/node/utils/jsonDiff.js +0 -116
- package/dist/node/utils/ordering.js +0 -290
- package/src/services/AdminService.js +0 -374
- package/src/services/BranchService.js +0 -536
- package/src/services/CollabService.js +0 -900
- package/src/services/DnsService.js +0 -366
- package/src/services/FeatureFlagService.js +0 -174
- package/src/services/FileService.js +0 -213
- package/src/services/IntegrationService.js +0 -548
- package/src/services/MetricsService.js +0 -40
- package/src/services/PaymentService.js +0 -287
- package/src/services/PlanService.js +0 -468
- package/src/services/ProjectService.js +0 -1366
- package/src/services/PullRequestService.js +0 -537
- package/src/services/ScreenshotService.js +0 -258
- package/src/services/SubscriptionService.js +0 -425
- package/src/services/TrackingService.js +0 -853
- package/src/services/WaitlistService.js +0 -130
- package/src/services/tests/BranchService/createBranch.test.js +0 -153
- package/src/services/tests/BranchService/deleteBranch.test.js +0 -173
- package/src/services/tests/BranchService/getBranchChanges.test.js +0 -146
- package/src/services/tests/BranchService/listBranches.test.js +0 -87
- package/src/services/tests/BranchService/mergeBranch.test.js +0 -210
- package/src/services/tests/BranchService/publishVersion.test.js +0 -183
- package/src/services/tests/BranchService/renameBranch.test.js +0 -240
- package/src/services/tests/BranchService/resetBranch.test.js +0 -152
- package/src/services/tests/FeatureFlagService/adminFeatureFlags.test.js +0 -67
- package/src/services/tests/FeatureFlagService/getFeatureFlags.test.js +0 -75
- package/src/services/tests/FileService/createFileFormData.test.js +0 -74
- package/src/services/tests/FileService/getFileUrl.test.js +0 -69
- package/src/services/tests/FileService/updateProjectIcon.test.js +0 -109
- package/src/services/tests/FileService/uploadDocument.test.js +0 -36
- package/src/services/tests/FileService/uploadFile.test.js +0 -78
- package/src/services/tests/FileService/uploadFileWithValidation.test.js +0 -114
- package/src/services/tests/FileService/uploadImage.test.js +0 -36
- package/src/services/tests/FileService/uploadMultipleFiles.test.js +0 -111
- package/src/services/tests/FileService/validateFile.test.js +0 -63
- package/src/services/tests/PlanService/createPlan.test.js +0 -104
- package/src/services/tests/PlanService/createPlanWithValidation.test.js +0 -523
- package/src/services/tests/PlanService/deletePlan.test.js +0 -92
- package/src/services/tests/PlanService/getActivePlans.test.js +0 -123
- package/src/services/tests/PlanService/getAdminPlans.test.js +0 -84
- package/src/services/tests/PlanService/getPlan.test.js +0 -50
- package/src/services/tests/PlanService/getPlanByKey.test.js +0 -109
- package/src/services/tests/PlanService/getPlanWithValidation.test.js +0 -85
- package/src/services/tests/PlanService/getPlans.test.js +0 -53
- package/src/services/tests/PlanService/getPlansByPriceRange.test.js +0 -109
- package/src/services/tests/PlanService/getPlansWithValidation.test.js +0 -48
- package/src/services/tests/PlanService/initializePlans.test.js +0 -75
- package/src/services/tests/PlanService/updatePlan.test.js +0 -111
- package/src/services/tests/PlanService/updatePlanWithValidation.test.js +0 -556
- package/src/state/RootStateManager.js +0 -76
- package/src/state/rootEventBus.js +0 -67
- package/src/utils/CollabClient.js +0 -248
- package/src/utils/TokenManager.js +0 -479
- package/src/utils/changePreprocessor.js +0 -239
- package/src/utils/jsonDiff.js +0 -144
- package/src/utils/ordering.js +0 -271
package/src/utils/permission.js
CHANGED
|
@@ -84,11 +84,12 @@ export const PERMISSION_MAP = {
|
|
|
84
84
|
|
|
85
85
|
export const ROLE_PERMISSIONS = {
|
|
86
86
|
guest: ['viewPublicProjects'],
|
|
87
|
-
user: ['viewPublicProjects'],
|
|
88
|
-
admin: ['viewPublicProjects', '
|
|
87
|
+
user: ['viewPublicProjects', 'createProject'],
|
|
88
|
+
admin: ['viewPublicProjects', 'createProject', 'manageUsers'],
|
|
89
89
|
superAdmin: [
|
|
90
90
|
'viewPublicProjects',
|
|
91
|
-
'
|
|
91
|
+
'createProject',
|
|
92
|
+
'manageUsers',
|
|
92
93
|
'managePlatform'
|
|
93
94
|
]
|
|
94
95
|
}
|
|
@@ -186,7 +187,6 @@ export const TIER_FEATURES = {
|
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
export const PROJECT_ROLE_PERMISSIONS = {
|
|
189
|
-
unauthenticated: ['platformSettings', 'showContent'],
|
|
190
190
|
guest: ['platformSettings', 'showContent'],
|
|
191
191
|
editor: [
|
|
192
192
|
'platformSettings',
|
package/src/utils/services.js
CHANGED
|
@@ -1,333 +1,91 @@
|
|
|
1
1
|
export const SERVICE_METHODS = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// Collab service methods
|
|
6
|
-
connect: 'collab',
|
|
7
|
-
disconnect: 'collab',
|
|
8
|
-
isConnected: 'collab',
|
|
9
|
-
updateData: 'collab',
|
|
10
|
-
addItem: 'collab',
|
|
11
|
-
addMultipleItems: 'collab',
|
|
12
|
-
updateItem: 'collab',
|
|
13
|
-
deleteItem: 'collab',
|
|
14
|
-
undo: 'collab',
|
|
15
|
-
redo: 'collab',
|
|
16
|
-
checkpoint: 'collab',
|
|
17
|
-
|
|
18
|
-
// Realtime collaboration helper methods
|
|
19
|
-
sendCursor: 'collab',
|
|
20
|
-
sendPresence: 'collab',
|
|
21
|
-
toggleLive: 'collab',
|
|
22
|
-
|
|
23
|
-
// Core service methods (new - replaces most based/auth functionality)
|
|
24
|
-
// Auth methods
|
|
25
|
-
getStoredAuthState: 'auth',
|
|
26
|
-
getAuthToken: 'auth',
|
|
27
|
-
register: 'auth',
|
|
2
|
+
// Auth service methods
|
|
3
|
+
auth: 'auth',
|
|
28
4
|
login: 'auth',
|
|
29
|
-
|
|
30
|
-
refreshToken: 'auth',
|
|
5
|
+
register: 'auth',
|
|
31
6
|
googleAuth: 'auth',
|
|
32
|
-
googleAuthCallback: 'auth',
|
|
33
7
|
githubAuth: 'auth',
|
|
8
|
+
confirmRegistration: 'auth',
|
|
9
|
+
logout: 'auth',
|
|
10
|
+
updateUserRole: 'auth',
|
|
11
|
+
hasPermission: 'auth',
|
|
12
|
+
getProjectMembers: 'auth',
|
|
13
|
+
inviteMember: 'auth',
|
|
14
|
+
acceptInvite: 'auth',
|
|
15
|
+
updateMemberRole: 'auth',
|
|
16
|
+
removeMember: 'auth',
|
|
17
|
+
updateProjectTier: 'auth',
|
|
34
18
|
requestPasswordReset: 'auth',
|
|
35
19
|
confirmPasswordReset: 'auth',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
confirmPasswordChange: 'auth',
|
|
39
|
-
getMe: 'auth',
|
|
40
|
-
getTokenDebugInfo: 'auth',
|
|
41
|
-
|
|
42
|
-
getMyProjectRoleByKey: 'auth',
|
|
43
|
-
getProjectRoleWithFallback: 'auth',
|
|
44
|
-
getProjectRoleByKeyWithFallback: 'auth',
|
|
45
|
-
|
|
46
|
-
// User methods
|
|
47
|
-
getUserProfile: 'auth',
|
|
48
|
-
updateUserProfile: 'auth',
|
|
49
|
-
getUserProjects: 'auth',
|
|
50
|
-
getUser: 'auth',
|
|
51
|
-
getUserByEmail: 'auth',
|
|
52
|
-
|
|
53
|
-
// Project methods (moved to project service)
|
|
54
|
-
createProject: 'project',
|
|
55
|
-
getProjects: 'project',
|
|
56
|
-
getProject: 'project',
|
|
57
|
-
getProjectByKey: 'project',
|
|
58
|
-
getProjectDataByKey: 'project',
|
|
59
|
-
getPublicProject: 'project',
|
|
60
|
-
listPublicProjects: 'project',
|
|
61
|
-
listProjects: 'project',
|
|
62
|
-
updateProject: 'project',
|
|
63
|
-
updateProjectComponents: 'project',
|
|
64
|
-
updateProjectSettings: 'project',
|
|
65
|
-
updateProjectName: 'project',
|
|
66
|
-
updateProjectPackage: 'project',
|
|
67
|
-
duplicateProject: 'project',
|
|
68
|
-
removeProject: 'project',
|
|
69
|
-
checkProjectKeyAvailability: 'project',
|
|
70
|
-
getProjectRolePermissionsConfig: 'project',
|
|
71
|
-
updateProjectRolePermissionsConfig: 'project',
|
|
72
|
-
listEnvironments: 'project',
|
|
73
|
-
activateMultipleEnvironments: 'project',
|
|
74
|
-
upsertEnvironment: 'project',
|
|
75
|
-
updateEnvironment: 'project',
|
|
76
|
-
publishToEnvironment: 'project',
|
|
77
|
-
deleteEnvironment: 'project',
|
|
78
|
-
promoteEnvironment: 'project',
|
|
79
|
-
|
|
80
|
-
// Project member methods (moved to project service)
|
|
81
|
-
getProjectMembers: 'project',
|
|
82
|
-
inviteMember: 'project',
|
|
83
|
-
acceptInvite: 'project',
|
|
84
|
-
createMagicInviteLink: 'project',
|
|
85
|
-
updateMemberRole: 'project',
|
|
86
|
-
removeMember: 'project',
|
|
87
|
-
|
|
88
|
-
// Project library methods (moved to project service)
|
|
89
|
-
getAvailableLibraries: 'project',
|
|
90
|
-
getProjectLibraries: 'project',
|
|
91
|
-
addProjectLibraries: 'project',
|
|
92
|
-
removeProjectLibraries: 'project',
|
|
93
|
-
|
|
94
|
-
// Project data methods (moved to project service)
|
|
95
|
-
applyProjectChanges: 'project',
|
|
96
|
-
getProjectData: 'project',
|
|
97
|
-
getProjectVersions: 'project',
|
|
98
|
-
restoreProjectVersion: 'project',
|
|
99
|
-
updateProjectItem: 'project',
|
|
100
|
-
deleteProjectItem: 'project',
|
|
101
|
-
setProjectValue: 'project',
|
|
102
|
-
addProjectItems: 'project',
|
|
103
|
-
getProjectItemByPath: 'project',
|
|
104
|
-
setProjectAccess: 'project',
|
|
105
|
-
setProjectVisibility: 'project',
|
|
106
|
-
|
|
107
|
-
// Favorite project methods (moved to project service)
|
|
108
|
-
getFavoriteProjects: 'project',
|
|
109
|
-
addFavoriteProject: 'project',
|
|
110
|
-
removeFavoriteProject: 'project',
|
|
111
|
-
|
|
112
|
-
// Recent project methods (moved to project service)
|
|
113
|
-
getRecentProjects: 'project',
|
|
114
|
-
|
|
115
|
-
// Plan methods (moved to plan service)
|
|
116
|
-
getPlans: 'plan',
|
|
117
|
-
getPlan: 'plan',
|
|
118
|
-
getAdminPlans: 'plan',
|
|
119
|
-
createPlan: 'plan',
|
|
120
|
-
updatePlan: 'plan',
|
|
121
|
-
deletePlan: 'plan',
|
|
122
|
-
initializePlans: 'plan',
|
|
123
|
-
getPlansWithValidation: 'plan',
|
|
124
|
-
getPlanWithValidation: 'plan',
|
|
125
|
-
createPlanWithValidation: 'plan',
|
|
126
|
-
updatePlanWithValidation: 'plan',
|
|
127
|
-
getActivePlans: 'plan',
|
|
128
|
-
getPlansByPriceRange: 'plan',
|
|
129
|
-
getPlanByKey: 'plan',
|
|
130
|
-
getPlansWithPricing: 'plan',
|
|
131
|
-
|
|
132
|
-
// Subscription methods (moved to subscription service)
|
|
133
|
-
createSubscription: 'subscription',
|
|
134
|
-
getProjectStatus: 'subscription',
|
|
135
|
-
getUsage: 'subscription',
|
|
136
|
-
cancelSubscription: 'subscription',
|
|
137
|
-
listInvoices: 'subscription',
|
|
138
|
-
getPortalUrl: 'subscription',
|
|
139
|
-
createSubscriptionWithValidation: 'subscription',
|
|
140
|
-
hasActiveSubscription: 'subscription',
|
|
141
|
-
getProjectSubscription: 'subscription',
|
|
142
|
-
getProjectUsage: 'subscription',
|
|
143
|
-
getInvoicesWithPagination: 'subscription',
|
|
144
|
-
isSubscriptionActive: 'subscription',
|
|
145
|
-
getSubscriptionLimits: 'subscription',
|
|
146
|
-
changeSubscription: 'subscription',
|
|
147
|
-
downgrade: 'subscription',
|
|
148
|
-
changeSubscriptionWithValidation: 'subscription',
|
|
149
|
-
downgradeWithValidation: 'subscription',
|
|
150
|
-
|
|
151
|
-
// File methods (moved to file service)
|
|
152
|
-
uploadFile: 'file',
|
|
153
|
-
updateProjectIcon: 'file',
|
|
154
|
-
uploadFileWithValidation: 'file',
|
|
155
|
-
uploadImage: 'file',
|
|
156
|
-
uploadDocument: 'file',
|
|
157
|
-
getFileUrl: 'file',
|
|
158
|
-
validateFile: 'file',
|
|
159
|
-
createFileFormData: 'file',
|
|
160
|
-
uploadMultipleFiles: 'file',
|
|
161
|
-
|
|
162
|
-
// Payment methods (Use subscription service instead)
|
|
163
|
-
checkout: 'payment',
|
|
164
|
-
getSubscriptionStatus: 'payment',
|
|
165
|
-
checkoutWithValidation: 'payment',
|
|
166
|
-
getSubscriptionStatusWithValidation: 'payment',
|
|
167
|
-
getSubscriptionDetails: 'payment',
|
|
168
|
-
checkoutForPlan: 'payment',
|
|
169
|
-
checkoutForTeam: 'payment',
|
|
170
|
-
validateSubscriptionStatus: 'payment',
|
|
171
|
-
formatSubscriptionAmount: 'payment',
|
|
172
|
-
getSubscriptionSummary: 'payment',
|
|
173
|
-
|
|
174
|
-
// DNS methods (moved to dns service)
|
|
175
|
-
createDnsRecord: 'dns',
|
|
176
|
-
getDnsRecord: 'dns',
|
|
177
|
-
removeDnsRecord: 'dns',
|
|
178
|
-
getCustomHost: 'dns',
|
|
179
|
-
addProjectCustomDomains: 'dns',
|
|
180
|
-
validateDomain: 'dns',
|
|
181
|
-
createDnsRecordWithValidation: 'dns',
|
|
182
|
-
getDnsRecordWithValidation: 'dns',
|
|
183
|
-
removeDnsRecordWithValidation: 'dns',
|
|
184
|
-
addProjectCustomDomainsWithValidation: 'dns',
|
|
185
|
-
isDomainAvailable: 'dns',
|
|
186
|
-
getDomainStatus: 'dns',
|
|
187
|
-
verifyDomainOwnership: 'dns',
|
|
188
|
-
getProjectDomains: 'dns',
|
|
189
|
-
removeProjectCustomDomain: 'dns',
|
|
190
|
-
formatDomain: 'dns',
|
|
191
|
-
extractDomainFromUrl: 'dns',
|
|
192
|
-
|
|
193
|
-
// Branch Management methods (moved to branch service)
|
|
194
|
-
listBranches: 'branch',
|
|
195
|
-
createBranch: 'branch',
|
|
196
|
-
deleteBranch: 'branch',
|
|
197
|
-
renameBranch: 'branch',
|
|
198
|
-
getBranchChanges: 'branch',
|
|
199
|
-
mergeBranch: 'branch',
|
|
200
|
-
resetBranch: 'branch',
|
|
201
|
-
publishVersion: 'branch',
|
|
202
|
-
createBranchWithValidation: 'branch',
|
|
203
|
-
branchExists: 'branch',
|
|
204
|
-
previewMerge: 'branch',
|
|
205
|
-
commitMerge: 'branch',
|
|
206
|
-
createFeatureBranch: 'branch',
|
|
207
|
-
createHotfixBranch: 'branch',
|
|
208
|
-
getBranchStatus: 'branch',
|
|
209
|
-
deleteBranchSafely: 'branch',
|
|
210
|
-
getBranchesWithStatus: 'branch',
|
|
211
|
-
validateBranchName: 'branch',
|
|
212
|
-
sanitizeBranchName: 'branch',
|
|
213
|
-
|
|
214
|
-
// Pull Request methods (moved to pullRequest service)
|
|
215
|
-
createPullRequest: 'pullRequest',
|
|
216
|
-
listPullRequests: 'pullRequest',
|
|
217
|
-
getPullRequest: 'pullRequest',
|
|
218
|
-
reviewPullRequest: 'pullRequest',
|
|
219
|
-
addPullRequestComment: 'pullRequest',
|
|
220
|
-
mergePullRequest: 'pullRequest',
|
|
221
|
-
getPullRequestDiff: 'pullRequest',
|
|
222
|
-
createPullRequestWithValidation: 'pullRequest',
|
|
223
|
-
approvePullRequest: 'pullRequest',
|
|
224
|
-
requestPullRequestChanges: 'pullRequest',
|
|
225
|
-
getOpenPullRequests: 'pullRequest',
|
|
226
|
-
getClosedPullRequests: 'pullRequest',
|
|
227
|
-
getMergedPullRequests: 'pullRequest',
|
|
228
|
-
isPullRequestMergeable: 'pullRequest',
|
|
229
|
-
getPullRequestStatusSummary: 'pullRequest',
|
|
230
|
-
validatePullRequestData: 'pullRequest',
|
|
231
|
-
validateReviewData: 'pullRequest',
|
|
232
|
-
getPullRequestStats: 'pullRequest',
|
|
233
|
-
closePullRequest: 'pullRequest',
|
|
234
|
-
reopenPullRequest: 'pullRequest',
|
|
235
|
-
|
|
236
|
-
// Admin methods (moved to admin service)
|
|
237
|
-
getAdminUsers: 'admin',
|
|
238
|
-
assignProjectsToUser: 'admin',
|
|
239
|
-
updateUser: 'admin',
|
|
240
|
-
searchAdminUsers: 'admin',
|
|
241
|
-
getAdminUsersByEmails: 'admin',
|
|
242
|
-
getAdminUsersByIds: 'admin',
|
|
243
|
-
assignSpecificProjectsToUser: 'admin',
|
|
244
|
-
assignAllProjectsToUser: 'admin',
|
|
245
|
-
validateUserData: 'admin',
|
|
246
|
-
updateUserWithValidation: 'admin',
|
|
247
|
-
getUserStats: 'admin',
|
|
248
|
-
bulkUpdateUsers: 'admin',
|
|
249
|
-
getUsersByRole: 'admin',
|
|
250
|
-
getUsersByStatus: 'admin',
|
|
251
|
-
activateUser: 'admin',
|
|
252
|
-
deactivateUser: 'admin',
|
|
253
|
-
suspendUser: 'admin',
|
|
254
|
-
promoteToAdmin: 'admin',
|
|
255
|
-
demoteFromAdmin: 'admin',
|
|
256
|
-
|
|
257
|
-
// Screenshot methods
|
|
258
|
-
createScreenshotProject: 'screenshot',
|
|
259
|
-
getProjectScreenshots: 'screenshot',
|
|
260
|
-
reprocessProjectScreenshots: 'screenshot',
|
|
261
|
-
recreateProjectScreenshots: 'screenshot',
|
|
262
|
-
deleteProjectScreenshots: 'screenshot',
|
|
263
|
-
getThumbnailCandidate: 'screenshot',
|
|
264
|
-
updateProjectThumbnail: 'screenshot',
|
|
265
|
-
getPageScreenshot: 'screenshot',
|
|
266
|
-
getComponentScreenshot: 'screenshot',
|
|
267
|
-
getScreenshotByKey: 'screenshot',
|
|
268
|
-
getQueueStatistics: 'screenshot',
|
|
269
|
-
refreshThumbnail: 'screenshot',
|
|
270
|
-
|
|
271
|
-
// Tracking methods
|
|
272
|
-
configureTracking: 'tracking',
|
|
273
|
-
trackEvent: 'tracking',
|
|
274
|
-
trackError: 'tracking',
|
|
275
|
-
captureException: 'tracking',
|
|
276
|
-
logMessage: 'tracking',
|
|
277
|
-
logDebug: 'tracking',
|
|
278
|
-
logInfo: 'tracking',
|
|
279
|
-
logWarning: 'tracking',
|
|
280
|
-
logWarn: 'tracking',
|
|
281
|
-
logErrorMessage: 'tracking',
|
|
282
|
-
logError: 'tracking',
|
|
283
|
-
addBreadcrumb: 'tracking',
|
|
284
|
-
trackMeasurement: 'tracking',
|
|
285
|
-
trackView: 'tracking',
|
|
286
|
-
setUser: 'tracking',
|
|
287
|
-
clearUser: 'tracking',
|
|
288
|
-
setSession: 'tracking',
|
|
289
|
-
clearSession: 'tracking',
|
|
290
|
-
setGlobalAttributes: 'tracking',
|
|
291
|
-
setGlobalAttribute: 'tracking',
|
|
292
|
-
removeGlobalAttribute: 'tracking',
|
|
293
|
-
flushQueue: 'tracking',
|
|
294
|
-
getClient: 'tracking',
|
|
295
|
-
isEnabled: 'tracking',
|
|
296
|
-
isInitialized: 'tracking',
|
|
297
|
-
|
|
298
|
-
// Waitlist methods
|
|
299
|
-
joinWaitlist: 'waitlist',
|
|
300
|
-
listWaitlistEntries: 'waitlist',
|
|
301
|
-
updateWaitlistEntry: 'waitlist',
|
|
302
|
-
inviteWaitlistEntry: 'waitlist',
|
|
303
|
-
|
|
304
|
-
// Metrics methods
|
|
305
|
-
getContributions: 'metrics',
|
|
306
|
-
|
|
307
|
-
// Integration methods
|
|
308
|
-
integrationWhoami: 'integration',
|
|
309
|
-
listIntegrations: 'integration',
|
|
310
|
-
createIntegration: 'integration',
|
|
311
|
-
updateIntegration: 'integration',
|
|
312
|
-
createIntegrationApiKey: 'integration',
|
|
313
|
-
listIntegrationApiKeys: 'integration',
|
|
314
|
-
revokeIntegrationApiKey: 'integration',
|
|
315
|
-
createIntegrationWebhook: 'integration',
|
|
316
|
-
listIntegrationWebhooks: 'integration',
|
|
317
|
-
updateIntegrationWebhook: 'integration',
|
|
318
|
-
deleteIntegrationWebhook: 'integration',
|
|
319
|
-
listIntegrationWebhookDeliveries: 'integration',
|
|
320
|
-
replayIntegrationWebhookDelivery: 'integration',
|
|
321
|
-
listGitHubConnectors: 'integration',
|
|
322
|
-
createGitHubConnector: 'integration',
|
|
323
|
-
updateGitHubConnector: 'integration',
|
|
324
|
-
deleteGitHubConnector: 'integration',
|
|
20
|
+
subscribeToAuthChanges: 'auth',
|
|
21
|
+
getStoredAuthState: 'auth',
|
|
325
22
|
|
|
326
|
-
//
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
23
|
+
// AI service methods
|
|
24
|
+
prompt: 'ai',
|
|
25
|
+
|
|
26
|
+
// Based service methods
|
|
27
|
+
query: 'based',
|
|
28
|
+
setProject: 'based',
|
|
29
|
+
setUser: 'based',
|
|
30
|
+
subscribe: 'based',
|
|
31
|
+
call: 'based',
|
|
32
|
+
getProject: 'based',
|
|
33
|
+
getProjectByKey: 'based',
|
|
34
|
+
createProject: 'based',
|
|
35
|
+
fetchUser: 'based',
|
|
36
|
+
fetchProject: 'based',
|
|
37
|
+
setBucket: 'based',
|
|
38
|
+
getUser: 'based',
|
|
39
|
+
getUserByEmail: 'based',
|
|
40
|
+
setProjectDomains: 'based',
|
|
41
|
+
checkProjectKeyAvailability: 'based',
|
|
42
|
+
removeProject: 'based',
|
|
43
|
+
getAvailableLibraries: 'based',
|
|
44
|
+
addProjectLibraries: 'based',
|
|
45
|
+
removeProjectLibraries: 'based',
|
|
46
|
+
getProjectLibraries: 'based',
|
|
47
|
+
checkout: 'based',
|
|
48
|
+
uploadFile: 'based',
|
|
49
|
+
updateProjectIcon: 'based',
|
|
50
|
+
updateProject: 'based',
|
|
51
|
+
updateProjectSettings: 'based',
|
|
52
|
+
updateProjectComponents: 'based',
|
|
53
|
+
updateProjectName: 'based',
|
|
54
|
+
updateProjectPackage: 'based',
|
|
55
|
+
createDnsRecord: 'based',
|
|
56
|
+
getDnsRecord: 'based',
|
|
57
|
+
removeDnsRecord: 'based',
|
|
58
|
+
createStorageBucket: 'based',
|
|
59
|
+
getStorageBucket: 'based',
|
|
60
|
+
removeStorageBucket: 'based',
|
|
61
|
+
requestPasswordChange: 'based',
|
|
62
|
+
confirmPasswordChange: 'based',
|
|
63
|
+
updateUserProfile: 'based',
|
|
64
|
+
duplicateProject: 'based',
|
|
65
|
+
|
|
66
|
+
// Symstory service methods
|
|
67
|
+
set: 'symstory',
|
|
68
|
+
getData: 'symstory',
|
|
69
|
+
updateData: 'symstory',
|
|
70
|
+
getBranches: 'symstory',
|
|
71
|
+
createBranch: 'symstory',
|
|
72
|
+
editBranch: 'symstory',
|
|
73
|
+
deleteBranch: 'symstory',
|
|
74
|
+
mergeBranch: 'symstory',
|
|
75
|
+
restoreVersion: 'symstory',
|
|
76
|
+
getItem: 'symstory',
|
|
77
|
+
addItem: 'symstory',
|
|
78
|
+
updateItem: 'symstory',
|
|
79
|
+
deleteItem: 'symstory',
|
|
80
|
+
switchVersion: 'symstory',
|
|
81
|
+
switchBranch: 'symstory',
|
|
82
|
+
undo: 'symstory',
|
|
83
|
+
redo: 'symstory',
|
|
84
|
+
|
|
85
|
+
// Socket service methods
|
|
86
|
+
send: 'socket',
|
|
87
|
+
subscribeChannel: 'socket',
|
|
88
|
+
connect: 'socket',
|
|
89
|
+
reconnect: 'socket',
|
|
90
|
+
destroy: 'socket'
|
|
333
91
|
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import config from '../config/environment.js'
|
|
2
|
+
|
|
3
|
+
const DEFAULT_OPTIONS = {
|
|
4
|
+
baseUrl: config.baseUrl
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
class SymstoryClient {
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of SymstoryClient.
|
|
10
|
+
* @param {string} appKey - The application key.
|
|
11
|
+
* @param {object} [options={}] - The options for the client.
|
|
12
|
+
*/
|
|
13
|
+
constructor (appKey, options = {}) {
|
|
14
|
+
if (!appKey) {
|
|
15
|
+
throw new Error('AppKey is required')
|
|
16
|
+
}
|
|
17
|
+
this.appKey = appKey
|
|
18
|
+
this.options = { ...DEFAULT_OPTIONS, ...options }
|
|
19
|
+
this.headers = {
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
...this.options.headers,
|
|
22
|
+
'X-AppKey': appKey
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Makes a request to the Symstory service.
|
|
28
|
+
* @param {string} [path=''] - The request path.
|
|
29
|
+
* @param {object} [options={}] - The request options.
|
|
30
|
+
* @returns {Promise<any>} - The response data.
|
|
31
|
+
*/
|
|
32
|
+
async request (path = '', options = {}) {
|
|
33
|
+
const url = `${this.options.baseUrl}/${this.appKey}${path}`
|
|
34
|
+
const response = await fetch(url, {
|
|
35
|
+
...options,
|
|
36
|
+
headers: { ...this.headers, ...options.headers }
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
const error = await response.json()
|
|
41
|
+
throw new Error(error.message || error.error || 'Request failed')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return response.status === 204 ? null : response.json()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Fetches project data.
|
|
49
|
+
* @param {object} query - The query object to filter data.
|
|
50
|
+
* @param {string|null} [branch=null] - The branch name.
|
|
51
|
+
* @param {string|null} [version=null] - The version number.
|
|
52
|
+
* @returns {Promise<any>} - The project data.
|
|
53
|
+
*/
|
|
54
|
+
get (query, branch = null, version = null) {
|
|
55
|
+
const params = new URLSearchParams({
|
|
56
|
+
...(branch && { branch }),
|
|
57
|
+
...(version ? { version } : { cacheId: Math.random() }),
|
|
58
|
+
...(query && { query: JSON.stringify(query) })
|
|
59
|
+
})
|
|
60
|
+
return this.request(`?${params}`)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Sets a value at the specified path.
|
|
65
|
+
* @param {string} path - The path where the value should be set.
|
|
66
|
+
* @param {any} value - The value to set.
|
|
67
|
+
* @returns {Promise<any>} - The response data.
|
|
68
|
+
*/
|
|
69
|
+
set (path, value) {
|
|
70
|
+
return this.request('', {
|
|
71
|
+
method: 'POST',
|
|
72
|
+
body: JSON.stringify({ changes: [['update', path, value]] })
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Updates project data.
|
|
78
|
+
* @param {Array} changes - The changes to apply.
|
|
79
|
+
* @param {object} [options={}] - The update options.
|
|
80
|
+
* @param {string} [options.type='patch'] - The type of update.
|
|
81
|
+
* @param {string} [options.message=''] - A message describing the update.
|
|
82
|
+
* @param {string} [options.branch='main'] - The branch name.
|
|
83
|
+
* @returns {Promise<any>} - The response data.
|
|
84
|
+
*/
|
|
85
|
+
async update (
|
|
86
|
+
changes,
|
|
87
|
+
{ type = 'patch', message = '', branch = 'main' } = {}
|
|
88
|
+
) {
|
|
89
|
+
return await this.request('', {
|
|
90
|
+
method: 'POST',
|
|
91
|
+
body: JSON.stringify({ changes, type, message, branch })
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Retrieves all branches of the project.
|
|
97
|
+
* @returns {Promise<any>} - The branches data.
|
|
98
|
+
*/
|
|
99
|
+
getBranches () {
|
|
100
|
+
return this.request('/branches')
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Creates a new branch.
|
|
105
|
+
* @param {string} branch - The name of the new branch.
|
|
106
|
+
* @param {object} [options={}] - The branch creation options.
|
|
107
|
+
* @param {string} [options.message] - A message describing the branch creation.
|
|
108
|
+
* @param {string} [options.source='main'] - The source branch.
|
|
109
|
+
* @param {string} [options.version] - The version number.
|
|
110
|
+
* @returns {Promise<any>} - The response data.
|
|
111
|
+
*/
|
|
112
|
+
createBranch (branch, { message, source = 'main', version } = {}) {
|
|
113
|
+
return this.request('/branch', {
|
|
114
|
+
method: 'POST',
|
|
115
|
+
body: JSON.stringify({ branch, message, source, version })
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Edit an existing branch. (For now only supports branch renaming)
|
|
121
|
+
* @param {string} branch - The current name of the branch to edit.
|
|
122
|
+
* @param {object} [options={}] - The branch edit options.
|
|
123
|
+
* @param {string} [options.name] - New name for the branch
|
|
124
|
+
* @returns {Promise<any>} - The response data.
|
|
125
|
+
*/
|
|
126
|
+
editBranch (branch, { name } = {}) {
|
|
127
|
+
return this.request('/branch', {
|
|
128
|
+
method: 'PATCH',
|
|
129
|
+
body: JSON.stringify({ branch, name })
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Delete an existing branch.
|
|
135
|
+
* @param {string} branch - The name of the branch to delete.
|
|
136
|
+
* @returns {Promise<any>} - The response data.
|
|
137
|
+
*/
|
|
138
|
+
deleteBranch (branch) {
|
|
139
|
+
return this.request('/branch', {
|
|
140
|
+
method: 'DELETE',
|
|
141
|
+
body: JSON.stringify({ branch })
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Merges a branch into the target branch.
|
|
147
|
+
* @param {string} target - The target branch.
|
|
148
|
+
* @param {object} [options={}] - The merge options.
|
|
149
|
+
* @param {string} [options.message] - A message describing the merge.
|
|
150
|
+
* @param {string} [options.source='main'] - The source branch.
|
|
151
|
+
* @param {string} [options.type='patch'] - The type of merge.
|
|
152
|
+
* @param {string} [options.version] - The version number.
|
|
153
|
+
* @param {boolean} [options.commit='false'] - Whether to commit the merge.
|
|
154
|
+
* @param {Array} [options.changes] - The changes to apply during the merge.
|
|
155
|
+
* @returns {Promise<any>} - The response data.
|
|
156
|
+
*/
|
|
157
|
+
mergeBranch (
|
|
158
|
+
target,
|
|
159
|
+
{
|
|
160
|
+
message,
|
|
161
|
+
source = 'main',
|
|
162
|
+
type = 'patch',
|
|
163
|
+
version,
|
|
164
|
+
commit = 'false',
|
|
165
|
+
changes
|
|
166
|
+
} = {}
|
|
167
|
+
) {
|
|
168
|
+
return this.request('/merge', {
|
|
169
|
+
method: 'POST',
|
|
170
|
+
body: JSON.stringify({
|
|
171
|
+
target,
|
|
172
|
+
source,
|
|
173
|
+
message,
|
|
174
|
+
type,
|
|
175
|
+
version,
|
|
176
|
+
commit,
|
|
177
|
+
changes
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Restores an older version of the project.
|
|
184
|
+
* @param {string} version - The version number to restore.
|
|
185
|
+
* @param {object} [options={}] - The restore options.
|
|
186
|
+
* @param {string} [options.branch='main'] - The branch name.
|
|
187
|
+
* @param {string} [options.type='patch'] - The type of restore.
|
|
188
|
+
* @param {string} [options.message] - A message describing the restore.
|
|
189
|
+
* @returns {Promise<any>} - The response data.
|
|
190
|
+
*/
|
|
191
|
+
restoreVersion (version, { branch = 'main', type = 'patch', message } = {}) {
|
|
192
|
+
return this.request('/restore', {
|
|
193
|
+
method: 'POST',
|
|
194
|
+
body: JSON.stringify({ branch, version, type, message })
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export default {
|
|
200
|
+
/**
|
|
201
|
+
* Creates a new SymstoryClient instance.
|
|
202
|
+
* @param {string} appKey - The application key.
|
|
203
|
+
* @param {object} options - The options for the client.
|
|
204
|
+
* @returns {SymstoryClient} - The SymstoryClient instance.
|
|
205
|
+
*/
|
|
206
|
+
create: (appKey, options) => new SymstoryClient(appKey, options),
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Initializes the Symstory client.
|
|
210
|
+
* @param {string} appKey - The application key.
|
|
211
|
+
* @param {object} options - The options for the client.
|
|
212
|
+
* @returns {SymstoryClient} - The initialized SymstoryClient instance.
|
|
213
|
+
*/
|
|
214
|
+
init (appKey, options) {
|
|
215
|
+
this.client = this.create(appKey, options)
|
|
216
|
+
return this
|
|
217
|
+
}
|
|
218
|
+
}
|
package/src/utils/validation.js
CHANGED
|
@@ -185,6 +185,9 @@ export const validateParams = {
|
|
|
185
185
|
if (!data.key) {
|
|
186
186
|
throw new Error('Data must contain a key property')
|
|
187
187
|
}
|
|
188
|
+
if (!data.value) {
|
|
189
|
+
throw new Error('Data must contain a value property')
|
|
190
|
+
}
|
|
188
191
|
|
|
189
192
|
// Check key against reserved keywords for code-related types
|
|
190
193
|
if (CODE_TYPES.includes(type)) {
|