@symbo.ls/sdk 2.32.0 → 2.32.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.
- package/dist/cjs/config/environment.js +8 -43
- package/dist/cjs/index.js +4 -12
- package/dist/cjs/services/AdminService.js +4 -4
- package/dist/cjs/services/AuthService.js +149 -36
- package/dist/cjs/services/BaseService.js +18 -5
- package/dist/cjs/services/BranchService.js +10 -10
- package/dist/cjs/services/CollabService.js +18 -114
- package/dist/cjs/services/CoreService.js +19 -19
- package/dist/cjs/services/DnsService.js +4 -4
- package/dist/cjs/services/FileService.js +2 -2
- package/dist/cjs/services/PaymentService.js +2 -2
- package/dist/cjs/services/PlanService.js +12 -12
- package/dist/cjs/services/ProjectService.js +34 -39
- package/dist/cjs/services/PullRequestService.js +7 -7
- package/dist/cjs/services/SubscriptionService.js +14 -14
- package/dist/cjs/services/index.js +0 -4
- package/dist/cjs/utils/TokenManager.js +5 -16
- package/dist/cjs/utils/services.js +1 -14
- package/dist/esm/config/environment.js +8 -43
- package/dist/esm/index.js +300 -907
- package/dist/esm/services/AdminService.js +35 -68
- package/dist/esm/services/AuthService.js +168 -100
- package/dist/esm/services/BaseService.js +31 -64
- package/dist/esm/services/BranchService.js +41 -74
- package/dist/esm/services/CollabService.js +50 -452
- package/dist/esm/services/CoreService.js +50 -83
- package/dist/esm/services/DnsService.js +35 -68
- package/dist/esm/services/FileService.js +33 -66
- package/dist/esm/services/PaymentService.js +33 -66
- package/dist/esm/services/PlanService.js +43 -76
- package/dist/esm/services/ProjectService.js +65 -375
- package/dist/esm/services/PullRequestService.js +38 -71
- package/dist/esm/services/SubscriptionService.js +45 -78
- package/dist/esm/services/index.js +295 -884
- package/dist/esm/utils/CollabClient.js +8 -43
- package/dist/esm/utils/TokenManager.js +5 -16
- package/dist/esm/utils/services.js +1 -14
- package/dist/node/config/environment.js +8 -43
- package/dist/node/index.js +5 -14
- package/dist/node/services/AdminService.js +4 -4
- package/dist/node/services/AuthService.js +139 -36
- package/dist/node/services/BaseService.js +18 -5
- package/dist/node/services/BranchService.js +10 -10
- package/dist/node/services/CollabService.js +19 -115
- package/dist/node/services/CoreService.js +19 -19
- package/dist/node/services/DnsService.js +4 -4
- package/dist/node/services/FileService.js +2 -2
- package/dist/node/services/PaymentService.js +2 -2
- package/dist/node/services/PlanService.js +12 -12
- package/dist/node/services/ProjectService.js +34 -39
- package/dist/node/services/PullRequestService.js +7 -7
- package/dist/node/services/SubscriptionService.js +14 -14
- package/dist/node/services/index.js +0 -4
- package/dist/node/utils/TokenManager.js +5 -16
- package/dist/node/utils/services.js +1 -14
- package/package.json +6 -7
- package/src/config/environment.js +9 -48
- package/src/index.js +22 -38
- package/src/services/AdminService.js +4 -4
- package/src/services/AuthService.js +175 -42
- package/src/services/BaseService.js +24 -7
- package/src/services/BranchService.js +10 -10
- package/src/services/CollabService.js +19 -142
- package/src/services/CoreService.js +19 -19
- package/src/services/DnsService.js +4 -4
- package/src/services/FileService.js +2 -2
- package/src/services/PaymentService.js +2 -2
- package/src/services/PlanService.js +12 -12
- package/src/services/ProjectService.js +34 -41
- package/src/services/PullRequestService.js +7 -7
- package/src/services/SubscriptionService.js +14 -14
- package/src/services/index.js +1 -6
- package/src/utils/TokenManager.js +5 -19
- package/src/utils/services.js +1 -15
- package/dist/cjs/services/ScreenshotService.js +0 -304
- package/dist/cjs/utils/ordering.js +0 -295
- package/dist/esm/services/ScreenshotService.js +0 -992
- package/dist/esm/utils/ordering.js +0 -277
- package/dist/node/services/ScreenshotService.js +0 -285
- package/dist/node/utils/ordering.js +0 -276
- package/src/services/ScreenshotService.js +0 -258
- package/src/utils/ordering.js +0 -240
package/src/utils/ordering.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-continue */
|
|
2
|
-
// Utilities to compute stable key ordering for parent objects impacted by changes
|
|
3
|
-
|
|
4
|
-
function isObjectLike (val) {
|
|
5
|
-
return val && typeof val === 'object' && !Array.isArray(val)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function normalizePath (path) {
|
|
9
|
-
if (Array.isArray(path)) {return path}
|
|
10
|
-
if (typeof path === 'string') {return [path]}
|
|
11
|
-
return []
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function getParentPathsFromTuples (tuples = []) {
|
|
15
|
-
const seen = new Set()
|
|
16
|
-
const parents = []
|
|
17
|
-
const META_KEYS = new Set([
|
|
18
|
-
'style', 'class', 'text', 'html', 'content', 'data', 'attr', 'state', 'scope',
|
|
19
|
-
'props', 'define', 'on', 'extend', 'extends', 'childExtend', 'childExtends',
|
|
20
|
-
'childProps', 'children', 'component', 'context', 'tag', 'key', '__order', 'if'
|
|
21
|
-
])
|
|
22
|
-
|
|
23
|
-
for (let i = 0; i < tuples.length; i++) {
|
|
24
|
-
const tuple = tuples[i]
|
|
25
|
-
if (!Array.isArray(tuple) || tuple.length < 2) {continue}
|
|
26
|
-
const path = normalizePath(tuple[1])
|
|
27
|
-
if (!path.length) {continue}
|
|
28
|
-
// Ignore schema containers entirely for parent order targets
|
|
29
|
-
if (path[0] === 'schema') {continue}
|
|
30
|
-
const immediateParent = path.slice(0, -1)
|
|
31
|
-
if (immediateParent.length) {
|
|
32
|
-
const key = JSON.stringify(immediateParent)
|
|
33
|
-
if (!seen.has(key)) {
|
|
34
|
-
seen.add(key)
|
|
35
|
-
parents.push(immediateParent)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// If the tuple points to a meta key (e.g. props/text), also include the container parent
|
|
40
|
-
const last = path[path.length - 1]
|
|
41
|
-
if (META_KEYS.has(last) && path.length >= 2) {
|
|
42
|
-
const containerParent = path.slice(0, -2)
|
|
43
|
-
if (containerParent.length) {
|
|
44
|
-
const key2 = JSON.stringify(containerParent)
|
|
45
|
-
if (!seen.has(key2)) {
|
|
46
|
-
seen.add(key2)
|
|
47
|
-
parents.push(containerParent)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// Additionally include container parents for any meta segment in the path
|
|
52
|
-
for (let j = 0; j < path.length; j++) {
|
|
53
|
-
const seg = path[j]
|
|
54
|
-
if (!META_KEYS.has(seg)) { continue }
|
|
55
|
-
const containerParent2 = path.slice(0, j)
|
|
56
|
-
if (!containerParent2.length) { continue }
|
|
57
|
-
const key3 = JSON.stringify(containerParent2)
|
|
58
|
-
if (!seen.has(key3)) {
|
|
59
|
-
seen.add(key3)
|
|
60
|
-
parents.push(containerParent2)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return parents
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Compute ordered key arrays for each parent path using the provided root state's getByPath.
|
|
70
|
-
*
|
|
71
|
-
* @param {Object} root - Root state with a getByPath(pathArray) method
|
|
72
|
-
* @param {Array<Array<string>>} parentPaths - Array of parent paths to inspect
|
|
73
|
-
* @returns {Array<{ path: string[], keys: string[] }>} orders
|
|
74
|
-
*/
|
|
75
|
-
export function computeOrdersFromState (root, parentPaths = []) {
|
|
76
|
-
if (!root || typeof root.getByPath !== 'function') {return []}
|
|
77
|
-
|
|
78
|
-
const orders = []
|
|
79
|
-
const EXCLUDE_KEYS = new Set(['__order'])
|
|
80
|
-
|
|
81
|
-
for (let i = 0; i < parentPaths.length; i++) {
|
|
82
|
-
const parentPath = parentPaths[i]
|
|
83
|
-
const obj = (() => {
|
|
84
|
-
try { return root.getByPath(parentPath) } catch { return null }
|
|
85
|
-
})()
|
|
86
|
-
|
|
87
|
-
if (!isObjectLike(obj)) {continue}
|
|
88
|
-
|
|
89
|
-
const keys = Object.keys(obj).filter(k => !EXCLUDE_KEYS.has(k))
|
|
90
|
-
orders.push({ path: parentPath, keys })
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return orders
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Convenience helper to derive orders directly from tuples and a root state.
|
|
98
|
-
*/
|
|
99
|
-
// --- Schema `code` parsing helpers ---
|
|
100
|
-
function normaliseSchemaCode (code) {
|
|
101
|
-
if (typeof code !== 'string' || !code.length) { return '' }
|
|
102
|
-
// Replace custom placeholders back to actual characters
|
|
103
|
-
return code
|
|
104
|
-
.replaceAll('/////n', '\n')
|
|
105
|
-
.replaceAll('/////tilde', '`')
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function extractTopLevelKeysFromCode (code) {
|
|
109
|
-
const src = normaliseSchemaCode(code)
|
|
110
|
-
if (!src) { return [] }
|
|
111
|
-
|
|
112
|
-
const idx = src.indexOf('export default')
|
|
113
|
-
if (idx === -1) { return [] }
|
|
114
|
-
let i = src.indexOf('{', idx)
|
|
115
|
-
if (i === -1) { return [] }
|
|
116
|
-
|
|
117
|
-
const keys = []
|
|
118
|
-
let depth = 0
|
|
119
|
-
let inStr = false
|
|
120
|
-
let strCh = ''
|
|
121
|
-
let inEsc = false
|
|
122
|
-
|
|
123
|
-
for (; i < src.length; i++) {
|
|
124
|
-
const ch = src[i]
|
|
125
|
-
if (inStr) {
|
|
126
|
-
if (inEsc) {
|
|
127
|
-
inEsc = false
|
|
128
|
-
} else if (ch === '\\') {
|
|
129
|
-
inEsc = true
|
|
130
|
-
} else if (ch === strCh) {
|
|
131
|
-
inStr = false
|
|
132
|
-
strCh = ''
|
|
133
|
-
}
|
|
134
|
-
continue
|
|
135
|
-
}
|
|
136
|
-
if (ch === '"' || ch === '\'' || ch === '`') { inStr = true; strCh = ch; continue }
|
|
137
|
-
if (ch === '{') { depth++; continue }
|
|
138
|
-
if (ch === '}') { depth--; if (depth === 0) { break } continue }
|
|
139
|
-
if (depth !== 1) { continue }
|
|
140
|
-
|
|
141
|
-
if (/[A-Za-z_$]/u.test(ch)) {
|
|
142
|
-
let j = i
|
|
143
|
-
while (j < src.length && /[A-Za-z0-9_$]/u.test(src[j])) { j++ }
|
|
144
|
-
let k = j
|
|
145
|
-
while (k < src.length && /\s/u.test(src[k])) { k++ }
|
|
146
|
-
if (src[k] === ':') {
|
|
147
|
-
const key = src.slice(i, j)
|
|
148
|
-
keys.push(key)
|
|
149
|
-
}
|
|
150
|
-
i = j
|
|
151
|
-
continue
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (!keys.length) {
|
|
156
|
-
const bodyStart = src.indexOf('{', idx)
|
|
157
|
-
const bodyEnd = src.lastIndexOf('}')
|
|
158
|
-
if (bodyStart === -1 || bodyEnd === -1 || bodyEnd <= bodyStart) {
|
|
159
|
-
return Array.from(new Set(keys))
|
|
160
|
-
}
|
|
161
|
-
const body = src.slice(bodyStart + 1, bodyEnd)
|
|
162
|
-
const re = /(?:[A-Za-z_$][A-Za-z0-9_$]*|"[^"]+"|'[^']+')\s*:/gu
|
|
163
|
-
for (const m of body.matchAll(re)) {
|
|
164
|
-
const raw = m[0].split(':')[0].trim()
|
|
165
|
-
const key = (raw[0] === '"' || raw[0] === '\'') ? raw.slice(1, -1) : raw
|
|
166
|
-
keys.push(key)
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return Array.from(new Set(keys))
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export function computeOrdersForTuples (root, tuples = []) {
|
|
174
|
-
// 1) Prefer code-derived order for corresponding data container when schema 'code' present
|
|
175
|
-
const preferredOrderMap = new Map()
|
|
176
|
-
for (let i = 0; i < tuples.length; i++) {
|
|
177
|
-
const t = tuples[i]
|
|
178
|
-
if (!Array.isArray(t)) {continue}
|
|
179
|
-
const [action, path, value] = t
|
|
180
|
-
const p = normalizePath(path)
|
|
181
|
-
if (action !== 'update' || !Array.isArray(p) || p.length < 3) {continue}
|
|
182
|
-
if (p[0] !== 'schema') {continue}
|
|
183
|
-
const [, type, key] = p
|
|
184
|
-
const containerPath = [type, key]
|
|
185
|
-
const uses = value && Array.isArray(value.uses) ? value.uses : null
|
|
186
|
-
const code = value && value.code
|
|
187
|
-
|
|
188
|
-
// Resolve present keys from state
|
|
189
|
-
const obj = (() => {
|
|
190
|
-
try { return root && typeof root.getByPath === 'function' ? root.getByPath(containerPath) : null } catch { return null }
|
|
191
|
-
})()
|
|
192
|
-
if (!obj) {continue}
|
|
193
|
-
const present = new Set(Object.keys(obj))
|
|
194
|
-
const EXCLUDE_KEYS = new Set(['__order'])
|
|
195
|
-
|
|
196
|
-
// Try to parse key order from schema.code
|
|
197
|
-
const codeKeys = extractTopLevelKeysFromCode(code)
|
|
198
|
-
let resolved = []
|
|
199
|
-
if (Array.isArray(codeKeys) && codeKeys.length) {
|
|
200
|
-
resolved = codeKeys.filter(k => present.has(k) && !EXCLUDE_KEYS.has(k))
|
|
201
|
-
}
|
|
202
|
-
if (resolved.length && Array.isArray(uses) && uses.length) {
|
|
203
|
-
for (let u = 0; u < uses.length; u++) {
|
|
204
|
-
const keyName = uses[u]
|
|
205
|
-
if (present.has(keyName) && !EXCLUDE_KEYS.has(keyName) && !resolved.includes(keyName)) {
|
|
206
|
-
resolved.push(keyName)
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (resolved.length) {
|
|
212
|
-
preferredOrderMap.set(JSON.stringify(containerPath), { path: containerPath, keys: resolved })
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// 2) Include immediate parent paths from tuples (excluding schema paths)
|
|
217
|
-
const parents = getParentPathsFromTuples(tuples)
|
|
218
|
-
|
|
219
|
-
// 3) Build final orders: prefer schema-derived order when available, otherwise infer from state
|
|
220
|
-
const orders = []
|
|
221
|
-
const seen = new Set()
|
|
222
|
-
|
|
223
|
-
// Add preferred orders first
|
|
224
|
-
preferredOrderMap.forEach(v => {
|
|
225
|
-
const k = JSON.stringify(v.path)
|
|
226
|
-
if (!seen.has(k)) { seen.add(k); orders.push(v) }
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
// Add remaining parents with state-derived order
|
|
230
|
-
const fallbackOrders = computeOrdersFromState(root, parents)
|
|
231
|
-
for (let i = 0; i < fallbackOrders.length; i++) {
|
|
232
|
-
const v = fallbackOrders[i]
|
|
233
|
-
const k = JSON.stringify(v.path)
|
|
234
|
-
if (!seen.has(k)) { seen.add(k); orders.push(v) }
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return orders
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|