@symbo.ls/sdk 2.32.19 → 2.32.25
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/services/AuthService.js +6 -0
- package/dist/cjs/services/BaseService.js +1 -1
- package/dist/cjs/services/CollabService.js +24 -6
- package/dist/cjs/utils/changePreprocessor.js +58 -2
- package/dist/cjs/utils/services.js +1 -0
- package/dist/esm/index.js +887 -806
- package/dist/esm/services/AdminService.js +1 -1
- package/dist/esm/services/AuthService.js +7 -1
- package/dist/esm/services/BaseService.js +1 -1
- package/dist/esm/services/BranchService.js +1 -1
- package/dist/esm/services/CollabService.js +180 -106
- package/dist/esm/services/DnsService.js +1 -1
- package/dist/esm/services/FileService.js +1 -1
- package/dist/esm/services/PaymentService.js +1 -1
- package/dist/esm/services/PlanService.js +1 -1
- package/dist/esm/services/ProjectService.js +59 -3
- package/dist/esm/services/PullRequestService.js +1 -1
- package/dist/esm/services/ScreenshotService.js +1 -1
- package/dist/esm/services/SubscriptionService.js +1 -1
- package/dist/esm/services/TrackingService.js +701 -701
- package/dist/esm/services/index.js +886 -806
- package/dist/esm/utils/CollabClient.js +95 -95
- package/dist/esm/utils/changePreprocessor.js +58 -2
- package/dist/esm/utils/jsonDiff.js +26 -26
- package/dist/esm/utils/services.js +1 -0
- package/dist/esm/utils/validation.js +2 -2
- package/dist/node/services/AuthService.js +6 -0
- package/dist/node/services/BaseService.js +1 -1
- package/dist/node/services/CollabService.js +24 -6
- package/dist/node/utils/changePreprocessor.js +58 -2
- package/dist/node/utils/services.js +1 -0
- package/package.json +6 -6
- package/src/services/AuthService.js +7 -0
- package/src/services/BaseService.js +1 -1
- package/src/services/CollabService.js +27 -6
- package/src/utils/changePreprocessor.js +76 -2
- package/src/utils/services.js +1 -0
|
@@ -11,6 +11,65 @@ function getByPathSafe (root, path) {
|
|
|
11
11
|
try { return root.getByPath(path) } catch { return null }
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
// Given the original high-level tuples and a fully qualified path, resolve the
|
|
15
|
+
// "next" value that the change set intends to write at that path.
|
|
16
|
+
// This walks tuples from last to first so that later changes win, and supports
|
|
17
|
+
// nested paths where the tuple only targets a parent container, e.g.:
|
|
18
|
+
// ['update', ['components', 'CanvasLogoDropdown'], { ... }]
|
|
19
|
+
// for a granular path like:
|
|
20
|
+
// ['components', 'CanvasLogoDropdown', 'ProjectNav', 'ListInDropdown', 'children']
|
|
21
|
+
function resolveNextValueFromTuples (tuples, path) {
|
|
22
|
+
if (!Array.isArray(tuples) || !Array.isArray(path)) { return null }
|
|
23
|
+
|
|
24
|
+
// Walk from the end to honour the latest change
|
|
25
|
+
for (let i = tuples.length - 1; i >= 0; i--) {
|
|
26
|
+
const t = tuples[i]
|
|
27
|
+
if (!Array.isArray(t) || t.length < 3) {
|
|
28
|
+
// eslint-disable-next-line no-continue
|
|
29
|
+
continue
|
|
30
|
+
}
|
|
31
|
+
const [action, tuplePath, tupleValue] = t
|
|
32
|
+
if ((action !== 'update' && action !== 'set') || !Array.isArray(tuplePath)) {
|
|
33
|
+
// eslint-disable-next-line no-continue
|
|
34
|
+
continue
|
|
35
|
+
}
|
|
36
|
+
if (tuplePath.length > path.length) {
|
|
37
|
+
// eslint-disable-next-line no-continue
|
|
38
|
+
continue
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Ensure tuplePath is a prefix of the requested path
|
|
42
|
+
let isPrefix = true
|
|
43
|
+
for (let j = 0; j < tuplePath.length; j++) {
|
|
44
|
+
if (tuplePath[j] !== path[j]) {
|
|
45
|
+
isPrefix = false
|
|
46
|
+
break
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (!isPrefix) {
|
|
50
|
+
// eslint-disable-next-line no-continue
|
|
51
|
+
continue
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Direct match: the tuple already targets the exact path
|
|
55
|
+
if (tuplePath.length === path.length) {
|
|
56
|
+
return tupleValue
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Nested match: drill into the tuple value using the remaining segments
|
|
60
|
+
let current = tupleValue
|
|
61
|
+
for (let j = tuplePath.length; j < path.length; j++) {
|
|
62
|
+
if (current == null) { return null }
|
|
63
|
+
current = current[path[j]]
|
|
64
|
+
}
|
|
65
|
+
if (current !== null) {
|
|
66
|
+
return current
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
72
|
+
|
|
14
73
|
/**
|
|
15
74
|
* Preprocess broad project changes into granular changes and ordering metadata.
|
|
16
75
|
* - Expands top-level object updates (e.g. ['update', ['components'], {...}])
|
|
@@ -121,8 +180,23 @@ export function preprocessChanges (root, tuples = [], options = {}) {
|
|
|
121
180
|
}
|
|
122
181
|
})()
|
|
123
182
|
|
|
183
|
+
const hydratedGranularChanges = granularChanges.map(t => {
|
|
184
|
+
if (!Array.isArray(t) || t.length < 3) { return t }
|
|
185
|
+
const [action, path] = t
|
|
186
|
+
if ((action !== 'update' && action !== 'set') || !Array.isArray(path)) {
|
|
187
|
+
return t
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const nextValue = resolveNextValueFromTuples(tuples, path)
|
|
191
|
+
if (nextValue === null) {
|
|
192
|
+
return t
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return [action, path, nextValue]
|
|
196
|
+
})
|
|
197
|
+
|
|
124
198
|
// Base orders from granular changes/state
|
|
125
|
-
const baseOrders = computeOrdersForTuples(root,
|
|
199
|
+
const baseOrders = computeOrdersForTuples(root, hydratedGranularChanges)
|
|
126
200
|
|
|
127
201
|
// Prefer explicit order for containers updated via ['update', [type], value] or ['update', [type, key], value]
|
|
128
202
|
const preferOrdersMap = new Map()
|
|
@@ -161,5 +235,5 @@ export function preprocessChanges (root, tuples = [], options = {}) {
|
|
|
161
235
|
if (!seen.has(k)) { seen.add(k); mergedOrders.push(v) }
|
|
162
236
|
}
|
|
163
237
|
|
|
164
|
-
return { granularChanges, orders: mergedOrders }
|
|
238
|
+
return { granularChanges: hydratedGranularChanges, orders: mergedOrders }
|
|
165
239
|
}
|
package/src/utils/services.js
CHANGED