@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
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
// src/config/environment.js
|
|
2
|
+
var CONFIG = {
|
|
3
|
+
// Common defaults for all environments
|
|
4
|
+
common: {
|
|
5
|
+
// NOTE: Google client id for google auth, need to configure URLs for each environment in Google console
|
|
6
|
+
googleClientId: "686286207466-bvd2fqs31rlm64fgich7rtpnc8ns2tqg.apps.googleusercontent.com",
|
|
7
|
+
// Feature toggles that apply across all environments by default
|
|
8
|
+
features: {
|
|
9
|
+
newUserOnboarding: true,
|
|
10
|
+
betaFeatures: false
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
// Environment-specific configurations
|
|
14
|
+
local: {
|
|
15
|
+
baseUrl: "http://localhost:3000",
|
|
16
|
+
// For symstory api
|
|
17
|
+
socketUrl: "http://localhost:8080",
|
|
18
|
+
// For socket api
|
|
19
|
+
routerUrl: "http://localhost:3090",
|
|
20
|
+
// For router api
|
|
21
|
+
apiUrl: "http://localhost:13335",
|
|
22
|
+
// For server api
|
|
23
|
+
basedEnv: "development",
|
|
24
|
+
// For based api
|
|
25
|
+
basedProject: "platform-v2",
|
|
26
|
+
// For based api
|
|
27
|
+
basedOrg: "symbols",
|
|
28
|
+
// For based api
|
|
29
|
+
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
30
|
+
// For github api
|
|
31
|
+
// Environment-specific feature toggles (override common)
|
|
32
|
+
features: {
|
|
33
|
+
betaFeatures: true
|
|
34
|
+
// Enable beta features in local dev
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
development: {
|
|
38
|
+
baseUrl: "https://story.symbo.ls",
|
|
39
|
+
socketUrl: "https://socket.symbols.app",
|
|
40
|
+
routerUrl: "https://router.symbols.app",
|
|
41
|
+
apiUrl: "https://api.symbols.app",
|
|
42
|
+
basedEnv: "development",
|
|
43
|
+
basedProject: "platform-v2",
|
|
44
|
+
basedOrg: "symbols",
|
|
45
|
+
githubClientId: "Ov23liHxyWFBxS8f1gnF"
|
|
46
|
+
},
|
|
47
|
+
staging: {
|
|
48
|
+
baseUrl: "https://staging.story.symbo.ls",
|
|
49
|
+
socketUrl: "https://staging.socket.symbols.app",
|
|
50
|
+
routerUrl: "https://staging.router.symbols.app",
|
|
51
|
+
apiUrl: "https://staging.api.symbols.app",
|
|
52
|
+
basedEnv: "staging",
|
|
53
|
+
basedProject: "platform-v2",
|
|
54
|
+
basedOrg: "symbols",
|
|
55
|
+
githubClientId: "Ov23ligwZDQVD0VfuWNa"
|
|
56
|
+
},
|
|
57
|
+
production: {
|
|
58
|
+
baseUrl: "https://story.symbo.ls",
|
|
59
|
+
socketUrl: "https://socket.symbols.app",
|
|
60
|
+
routerUrl: "https://router.symbols.app",
|
|
61
|
+
apiUrl: "https://api.symbols.app",
|
|
62
|
+
basedEnv: "production",
|
|
63
|
+
basedProject: "platform-v2",
|
|
64
|
+
basedOrg: "symbols",
|
|
65
|
+
githubClientId: "Ov23liFAlOEIXtX3dBtR"
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var getEnvironment = () => {
|
|
69
|
+
const env = process.env.SYMBOLS_APP_ENV || "" || "development";
|
|
70
|
+
if (!CONFIG[env]) {
|
|
71
|
+
console.warn(`Unknown environment "${env}", falling back to development`);
|
|
72
|
+
return "development";
|
|
73
|
+
}
|
|
74
|
+
return env;
|
|
75
|
+
};
|
|
76
|
+
var getConfig = () => {
|
|
77
|
+
try {
|
|
78
|
+
const env = getEnvironment();
|
|
79
|
+
const envConfig = { ...CONFIG.common, ...CONFIG[env] };
|
|
80
|
+
const finalConfig = {
|
|
81
|
+
...envConfig,
|
|
82
|
+
baseUrl: process.env.SYMBOLS_APP_BASE_URL || envConfig.baseUrl,
|
|
83
|
+
socketUrl: process.env.SYMBOLS_APP_SOCKET_URL || envConfig.socketUrl,
|
|
84
|
+
routerUrl: process.env.SYMBOLS_APP_ROUTER_URL || envConfig.routerUrl,
|
|
85
|
+
apiUrl: process.env.SYMBOLS_APP_API_URL || envConfig.apiUrl,
|
|
86
|
+
basedEnv: process.env.SYMBOLS_APP_BASED_ENV || envConfig.basedEnv,
|
|
87
|
+
basedProject: process.env.SYMBOLS_APP_BASED_PROJECT || envConfig.basedProject,
|
|
88
|
+
basedOrg: process.env.SYMBOLS_APP_BASED_ORG || envConfig.basedOrg,
|
|
89
|
+
githubClientId: process.env.SYMBOLS_APP_GITHUB_CLIENT_ID || envConfig.githubClientId,
|
|
90
|
+
isDevelopment: env === "development" || env === "local",
|
|
91
|
+
isStaging: env === "staging",
|
|
92
|
+
isProduction: env === "production"
|
|
93
|
+
};
|
|
94
|
+
const requiredFields = [
|
|
95
|
+
"baseUrl",
|
|
96
|
+
"socketUrl",
|
|
97
|
+
"apiUrl",
|
|
98
|
+
"basedEnv",
|
|
99
|
+
"basedProject",
|
|
100
|
+
"basedOrg",
|
|
101
|
+
"githubClientId",
|
|
102
|
+
"googleClientId"
|
|
103
|
+
];
|
|
104
|
+
const missingFields = requiredFields.filter((field) => !finalConfig[field]);
|
|
105
|
+
if (missingFields.length > 0) {
|
|
106
|
+
console.error(
|
|
107
|
+
`Missing required configuration: ${missingFields.join(", ")}`
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
if (finalConfig.isDevelopment) {
|
|
111
|
+
console.log(
|
|
112
|
+
"environment in SDK:",
|
|
113
|
+
env,
|
|
114
|
+
"",
|
|
115
|
+
process.env.SYMBOLS_APP_ENV
|
|
116
|
+
);
|
|
117
|
+
console.log(finalConfig);
|
|
118
|
+
}
|
|
119
|
+
return finalConfig;
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.error("Failed to load environment configuration:", error);
|
|
122
|
+
return {
|
|
123
|
+
baseUrl: "https://story.symbo.ls",
|
|
124
|
+
socketUrl: "https://socket.symbols.app",
|
|
125
|
+
routerUrl: "https://router.symbols.app",
|
|
126
|
+
apiUrl: "https://api.symbols.app",
|
|
127
|
+
basedEnv: "development",
|
|
128
|
+
basedProject: "platform-v2",
|
|
129
|
+
basedOrg: "symbols",
|
|
130
|
+
githubClientId: "Ov23liHxyWFBxS8f1gnF"
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
var environment_default = getConfig();
|
|
135
|
+
|
|
136
|
+
// src/utils/symstoryClient.js
|
|
137
|
+
var DEFAULT_OPTIONS = {
|
|
138
|
+
baseUrl: environment_default.baseUrl
|
|
139
|
+
};
|
|
140
|
+
var SymstoryClient = class {
|
|
141
|
+
/**
|
|
142
|
+
* Creates an instance of SymstoryClient.
|
|
143
|
+
* @param {string} appKey - The application key.
|
|
144
|
+
* @param {object} [options={}] - The options for the client.
|
|
145
|
+
*/
|
|
146
|
+
constructor(appKey, options = {}) {
|
|
147
|
+
if (!appKey) {
|
|
148
|
+
throw new Error("AppKey is required");
|
|
149
|
+
}
|
|
150
|
+
this.appKey = appKey;
|
|
151
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
152
|
+
this.headers = {
|
|
153
|
+
"Content-Type": "application/json",
|
|
154
|
+
...this.options.headers,
|
|
155
|
+
"X-AppKey": appKey
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Makes a request to the Symstory service.
|
|
160
|
+
* @param {string} [path=''] - The request path.
|
|
161
|
+
* @param {object} [options={}] - The request options.
|
|
162
|
+
* @returns {Promise<any>} - The response data.
|
|
163
|
+
*/
|
|
164
|
+
async request(path = "", options = {}) {
|
|
165
|
+
const url = `${this.options.baseUrl}/${this.appKey}${path}`;
|
|
166
|
+
const response = await fetch(url, {
|
|
167
|
+
...options,
|
|
168
|
+
headers: { ...this.headers, ...options.headers }
|
|
169
|
+
});
|
|
170
|
+
if (!response.ok) {
|
|
171
|
+
const error = await response.json();
|
|
172
|
+
throw new Error(error.message || error.error || "Request failed");
|
|
173
|
+
}
|
|
174
|
+
return response.status === 204 ? null : response.json();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Fetches project data.
|
|
178
|
+
* @param {object} query - The query object to filter data.
|
|
179
|
+
* @param {string|null} [branch=null] - The branch name.
|
|
180
|
+
* @param {string|null} [version=null] - The version number.
|
|
181
|
+
* @returns {Promise<any>} - The project data.
|
|
182
|
+
*/
|
|
183
|
+
get(query, branch = null, version = null) {
|
|
184
|
+
const params = new URLSearchParams({
|
|
185
|
+
...branch && { branch },
|
|
186
|
+
...version ? { version } : { cacheId: Math.random() },
|
|
187
|
+
...query && { query: JSON.stringify(query) }
|
|
188
|
+
});
|
|
189
|
+
return this.request(`?${params}`);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Sets a value at the specified path.
|
|
193
|
+
* @param {string} path - The path where the value should be set.
|
|
194
|
+
* @param {any} value - The value to set.
|
|
195
|
+
* @returns {Promise<any>} - The response data.
|
|
196
|
+
*/
|
|
197
|
+
set(path, value) {
|
|
198
|
+
return this.request("", {
|
|
199
|
+
method: "POST",
|
|
200
|
+
body: JSON.stringify({ changes: [["update", path, value]] })
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Updates project data.
|
|
205
|
+
* @param {Array} changes - The changes to apply.
|
|
206
|
+
* @param {object} [options={}] - The update options.
|
|
207
|
+
* @param {string} [options.type='patch'] - The type of update.
|
|
208
|
+
* @param {string} [options.message=''] - A message describing the update.
|
|
209
|
+
* @param {string} [options.branch='main'] - The branch name.
|
|
210
|
+
* @returns {Promise<any>} - The response data.
|
|
211
|
+
*/
|
|
212
|
+
async update(changes, { type = "patch", message = "", branch = "main" } = {}) {
|
|
213
|
+
return await this.request("", {
|
|
214
|
+
method: "POST",
|
|
215
|
+
body: JSON.stringify({ changes, type, message, branch })
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Retrieves all branches of the project.
|
|
220
|
+
* @returns {Promise<any>} - The branches data.
|
|
221
|
+
*/
|
|
222
|
+
getBranches() {
|
|
223
|
+
return this.request("/branches");
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Creates a new branch.
|
|
227
|
+
* @param {string} branch - The name of the new branch.
|
|
228
|
+
* @param {object} [options={}] - The branch creation options.
|
|
229
|
+
* @param {string} [options.message] - A message describing the branch creation.
|
|
230
|
+
* @param {string} [options.source='main'] - The source branch.
|
|
231
|
+
* @param {string} [options.version] - The version number.
|
|
232
|
+
* @returns {Promise<any>} - The response data.
|
|
233
|
+
*/
|
|
234
|
+
createBranch(branch, { message, source = "main", version } = {}) {
|
|
235
|
+
return this.request("/branch", {
|
|
236
|
+
method: "POST",
|
|
237
|
+
body: JSON.stringify({ branch, message, source, version })
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Edit an existing branch. (For now only supports branch renaming)
|
|
242
|
+
* @param {string} branch - The current name of the branch to edit.
|
|
243
|
+
* @param {object} [options={}] - The branch edit options.
|
|
244
|
+
* @param {string} [options.name] - New name for the branch
|
|
245
|
+
* @returns {Promise<any>} - The response data.
|
|
246
|
+
*/
|
|
247
|
+
editBranch(branch, { name } = {}) {
|
|
248
|
+
return this.request("/branch", {
|
|
249
|
+
method: "PATCH",
|
|
250
|
+
body: JSON.stringify({ branch, name })
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Delete an existing branch.
|
|
255
|
+
* @param {string} branch - The name of the branch to delete.
|
|
256
|
+
* @returns {Promise<any>} - The response data.
|
|
257
|
+
*/
|
|
258
|
+
deleteBranch(branch) {
|
|
259
|
+
return this.request("/branch", {
|
|
260
|
+
method: "DELETE",
|
|
261
|
+
body: JSON.stringify({ branch })
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Merges a branch into the target branch.
|
|
266
|
+
* @param {string} target - The target branch.
|
|
267
|
+
* @param {object} [options={}] - The merge options.
|
|
268
|
+
* @param {string} [options.message] - A message describing the merge.
|
|
269
|
+
* @param {string} [options.source='main'] - The source branch.
|
|
270
|
+
* @param {string} [options.type='patch'] - The type of merge.
|
|
271
|
+
* @param {string} [options.version] - The version number.
|
|
272
|
+
* @param {boolean} [options.commit='false'] - Whether to commit the merge.
|
|
273
|
+
* @param {Array} [options.changes] - The changes to apply during the merge.
|
|
274
|
+
* @returns {Promise<any>} - The response data.
|
|
275
|
+
*/
|
|
276
|
+
mergeBranch(target, {
|
|
277
|
+
message,
|
|
278
|
+
source = "main",
|
|
279
|
+
type = "patch",
|
|
280
|
+
version,
|
|
281
|
+
commit = "false",
|
|
282
|
+
changes
|
|
283
|
+
} = {}) {
|
|
284
|
+
return this.request("/merge", {
|
|
285
|
+
method: "POST",
|
|
286
|
+
body: JSON.stringify({
|
|
287
|
+
target,
|
|
288
|
+
source,
|
|
289
|
+
message,
|
|
290
|
+
type,
|
|
291
|
+
version,
|
|
292
|
+
commit,
|
|
293
|
+
changes
|
|
294
|
+
})
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Restores an older version of the project.
|
|
299
|
+
* @param {string} version - The version number to restore.
|
|
300
|
+
* @param {object} [options={}] - The restore options.
|
|
301
|
+
* @param {string} [options.branch='main'] - The branch name.
|
|
302
|
+
* @param {string} [options.type='patch'] - The type of restore.
|
|
303
|
+
* @param {string} [options.message] - A message describing the restore.
|
|
304
|
+
* @returns {Promise<any>} - The response data.
|
|
305
|
+
*/
|
|
306
|
+
restoreVersion(version, { branch = "main", type = "patch", message } = {}) {
|
|
307
|
+
return this.request("/restore", {
|
|
308
|
+
method: "POST",
|
|
309
|
+
body: JSON.stringify({ branch, version, type, message })
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
var symstoryClient_default = {
|
|
314
|
+
/**
|
|
315
|
+
* Creates a new SymstoryClient instance.
|
|
316
|
+
* @param {string} appKey - The application key.
|
|
317
|
+
* @param {object} options - The options for the client.
|
|
318
|
+
* @returns {SymstoryClient} - The SymstoryClient instance.
|
|
319
|
+
*/
|
|
320
|
+
create: (appKey, options) => new SymstoryClient(appKey, options),
|
|
321
|
+
/**
|
|
322
|
+
* Initializes the Symstory client.
|
|
323
|
+
* @param {string} appKey - The application key.
|
|
324
|
+
* @param {object} options - The options for the client.
|
|
325
|
+
* @returns {SymstoryClient} - The initialized SymstoryClient instance.
|
|
326
|
+
*/
|
|
327
|
+
init(appKey, options) {
|
|
328
|
+
this.client = this.create(appKey, options);
|
|
329
|
+
return this;
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
export {
|
|
333
|
+
symstoryClient_default as default
|
|
334
|
+
};
|
|
@@ -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 ||
|
|
222
|
+
var hasOwn = Object.hasOwn || function(obj, propName) {
|
|
223
223
|
return hasOwnProperty.call(obj, propName);
|
|
224
|
-
}
|
|
225
|
-
var isArray = Array.isArray ||
|
|
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, "|") + ")$"));
|
|
@@ -741,44 +741,6 @@ pp$8.isAsyncFunction = function() {
|
|
|
741
741
|
var next = this.pos + skip[0].length, after;
|
|
742
742
|
return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 55295 && after < 56320));
|
|
743
743
|
};
|
|
744
|
-
pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
|
|
745
|
-
if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? "await" : "using")) {
|
|
746
|
-
return false;
|
|
747
|
-
}
|
|
748
|
-
skipWhiteSpace.lastIndex = this.pos;
|
|
749
|
-
var skip = skipWhiteSpace.exec(this.input);
|
|
750
|
-
var next = this.pos + skip[0].length;
|
|
751
|
-
if (lineBreak.test(this.input.slice(this.pos, next))) {
|
|
752
|
-
return false;
|
|
753
|
-
}
|
|
754
|
-
if (isAwaitUsing) {
|
|
755
|
-
var awaitEndPos = next + 5, after;
|
|
756
|
-
if (this.input.slice(next, awaitEndPos) !== "using" || awaitEndPos === this.input.length || isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) || after > 55295 && after < 56320) {
|
|
757
|
-
return false;
|
|
758
|
-
}
|
|
759
|
-
skipWhiteSpace.lastIndex = awaitEndPos;
|
|
760
|
-
var skipAfterUsing = skipWhiteSpace.exec(this.input);
|
|
761
|
-
if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) {
|
|
762
|
-
return false;
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
if (isFor) {
|
|
766
|
-
var ofEndPos = next + 2, after$1;
|
|
767
|
-
if (this.input.slice(next, ofEndPos) === "of") {
|
|
768
|
-
if (ofEndPos === this.input.length || !isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 55295 && after$1 < 56320)) {
|
|
769
|
-
return false;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
var ch = this.input.charCodeAt(next);
|
|
774
|
-
return isIdentifierStart(ch, true) || ch === 92;
|
|
775
|
-
};
|
|
776
|
-
pp$8.isAwaitUsing = function(isFor) {
|
|
777
|
-
return this.isUsingKeyword(true, isFor);
|
|
778
|
-
};
|
|
779
|
-
pp$8.isUsing = function(isFor) {
|
|
780
|
-
return this.isUsingKeyword(false, isFor);
|
|
781
|
-
};
|
|
782
744
|
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
783
745
|
var starttype = this.type, node = this.startNode(), kind;
|
|
784
746
|
if (this.isLet(context)) {
|
|
@@ -862,22 +824,6 @@ pp$8.parseStatement = function(context, topLevel, exports) {
|
|
|
862
824
|
this.next();
|
|
863
825
|
return this.parseFunctionStatement(node, true, !context);
|
|
864
826
|
}
|
|
865
|
-
var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null;
|
|
866
|
-
if (usingKind) {
|
|
867
|
-
if (topLevel && this.options.sourceType === "script") {
|
|
868
|
-
this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`");
|
|
869
|
-
}
|
|
870
|
-
if (usingKind === "await using") {
|
|
871
|
-
if (!this.canAwait) {
|
|
872
|
-
this.raise(this.start, "Await using cannot appear outside of async function");
|
|
873
|
-
}
|
|
874
|
-
this.next();
|
|
875
|
-
}
|
|
876
|
-
this.next();
|
|
877
|
-
this.parseVar(node, false, usingKind);
|
|
878
|
-
this.semicolon();
|
|
879
|
-
return this.finishNode(node, "VariableDeclaration");
|
|
880
|
-
}
|
|
881
827
|
var maybeName = this.value, expr = this.parseExpression();
|
|
882
828
|
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) {
|
|
883
829
|
return this.parseLabeledStatement(node, maybeName, expr, context);
|
|
@@ -951,20 +897,24 @@ pp$8.parseForStatement = function(node) {
|
|
|
951
897
|
this.next();
|
|
952
898
|
this.parseVar(init$1, true, kind);
|
|
953
899
|
this.finishNode(init$1, "VariableDeclaration");
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
900
|
+
if ((this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init$1.declarations.length === 1) {
|
|
901
|
+
if (this.options.ecmaVersion >= 9) {
|
|
902
|
+
if (this.type === types$1._in) {
|
|
903
|
+
if (awaitAt > -1) {
|
|
904
|
+
this.unexpected(awaitAt);
|
|
905
|
+
}
|
|
906
|
+
} else {
|
|
907
|
+
node.await = awaitAt > -1;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return this.parseForIn(node, init$1);
|
|
963
911
|
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
912
|
+
if (awaitAt > -1) {
|
|
913
|
+
this.unexpected(awaitAt);
|
|
914
|
+
}
|
|
915
|
+
return this.parseFor(node, init$1);
|
|
967
916
|
}
|
|
917
|
+
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
968
918
|
var containsEsc = this.containsEsc;
|
|
969
919
|
var refDestructuringErrors = new DestructuringErrors();
|
|
970
920
|
var initPos = this.start;
|
|
@@ -996,24 +946,6 @@ pp$8.parseForStatement = function(node) {
|
|
|
996
946
|
}
|
|
997
947
|
return this.parseFor(node, init);
|
|
998
948
|
};
|
|
999
|
-
pp$8.parseForAfterInit = function(node, init, awaitAt) {
|
|
1000
|
-
if ((this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init.declarations.length === 1) {
|
|
1001
|
-
if (this.options.ecmaVersion >= 9) {
|
|
1002
|
-
if (this.type === types$1._in) {
|
|
1003
|
-
if (awaitAt > -1) {
|
|
1004
|
-
this.unexpected(awaitAt);
|
|
1005
|
-
}
|
|
1006
|
-
} else {
|
|
1007
|
-
node.await = awaitAt > -1;
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
return this.parseForIn(node, init);
|
|
1011
|
-
}
|
|
1012
|
-
if (awaitAt > -1) {
|
|
1013
|
-
this.unexpected(awaitAt);
|
|
1014
|
-
}
|
|
1015
|
-
return this.parseFor(node, init);
|
|
1016
|
-
};
|
|
1017
949
|
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
1018
950
|
this.next();
|
|
1019
951
|
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
|
|
@@ -1239,8 +1171,6 @@ pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
|
|
|
1239
1171
|
decl.init = this.parseMaybeAssign(isFor);
|
|
1240
1172
|
} else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
1241
1173
|
this.unexpected();
|
|
1242
|
-
} else if (!allowMissingInitializer && (kind === "using" || kind === "await using") && this.options.ecmaVersion >= 17 && this.type !== types$1._in && !this.isContextual("of")) {
|
|
1243
|
-
this.raise(this.lastTokEnd, "Missing initializer in " + kind + " declaration");
|
|
1244
1174
|
} else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
1245
1175
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
1246
1176
|
} else {
|
|
@@ -1254,7 +1184,7 @@ pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
|
|
|
1254
1184
|
return node;
|
|
1255
1185
|
};
|
|
1256
1186
|
pp$8.parseVarId = function(decl, kind) {
|
|
1257
|
-
decl.id =
|
|
1187
|
+
decl.id = this.parseBindingAtom();
|
|
1258
1188
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
1259
1189
|
};
|
|
1260
1190
|
var FUNC_STATEMENT = 1;
|
|
@@ -2724,7 +2654,7 @@ pp$5.parseLiteral = function(value) {
|
|
|
2724
2654
|
node.value = value;
|
|
2725
2655
|
node.raw = this.input.slice(this.start, this.end);
|
|
2726
2656
|
if (node.raw.charCodeAt(node.raw.length - 1) === 110) {
|
|
2727
|
-
node.bigint = node.
|
|
2657
|
+
node.bigint = node.raw.slice(0, -1).replace(/_/g, "");
|
|
2728
2658
|
}
|
|
2729
2659
|
this.next();
|
|
2730
2660
|
return this.finishNode(node, "Literal");
|
|
@@ -5584,7 +5514,7 @@ pp.readWord = function() {
|
|
|
5584
5514
|
}
|
|
5585
5515
|
return this.finishToken(type, word);
|
|
5586
5516
|
};
|
|
5587
|
-
var version = "8.
|
|
5517
|
+
var version = "8.14.1";
|
|
5588
5518
|
Parser.acorn = {
|
|
5589
5519
|
Parser,
|
|
5590
5520
|
version,
|
|
@@ -6059,6 +5989,9 @@ var validateParams = {
|
|
|
6059
5989
|
if (!data2.key) {
|
|
6060
5990
|
throw new Error("Data must contain a key property");
|
|
6061
5991
|
}
|
|
5992
|
+
if (!data2.value) {
|
|
5993
|
+
throw new Error("Data must contain a value property");
|
|
5994
|
+
}
|
|
6062
5995
|
if (CODE_TYPES.includes(type)) {
|
|
6063
5996
|
if (RESERVED_KEYWORDS.includes(data2.key)) {
|
|
6064
5997
|
throw new Error(
|