@rool-dev/sdk 0.10.2-dev.58d3ca8 → 0.10.2-dev.7a2da99

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/machine.js DELETED
@@ -1,51 +0,0 @@
1
- const MACHINE_URI_RE = /^rool-machine(?::|%3A)(\/.+)$/i;
2
- const ROOL_DRIVE_PREFIX = '/rool-drive/';
3
- /**
4
- * Resolve a Rool machine resource from either a canonical `rool-machine:/...`
5
- * URI or a bare machine path such as `/rool-drive/...`.
6
- *
7
- * Returns null for ordinary strings, malformed machine paths, and unsupported
8
- * machine areas.
9
- */
10
- export function resolveMachineResource(input) {
11
- const path = machinePathFromInput(input);
12
- if (!path)
13
- return null;
14
- if (path.startsWith(ROOL_DRIVE_PREFIX)) {
15
- return { kind: 'file', path };
16
- }
17
- if (isObjectPath(path)) {
18
- return { kind: 'object', path };
19
- }
20
- return null;
21
- }
22
- function machinePathFromInput(input) {
23
- const match = MACHINE_URI_RE.exec(input);
24
- const encodedPath = match ? match[1] : input.startsWith('/') ? input : null;
25
- if (!encodedPath)
26
- return null;
27
- try {
28
- const path = encodedPath.split('/').map(decodeURIComponent).join('/');
29
- validateMachinePath(path);
30
- return path;
31
- }
32
- catch {
33
- return null;
34
- }
35
- }
36
- function isObjectPath(path) {
37
- return /^\/space\/[a-zA-Z][a-zA-Z0-9_-]*\/[a-zA-Z0-9][a-zA-Z0-9_-]*\.json$/.test(path);
38
- }
39
- function validateMachinePath(path) {
40
- if (!path.startsWith('/'))
41
- throw new Error('Invalid machine path');
42
- if (path.includes('\\'))
43
- throw new Error('Invalid machine path');
44
- if (/[\x00-\x1f\x7f]/.test(path))
45
- throw new Error('Invalid machine path');
46
- const parts = path.split('/').slice(1);
47
- if (parts.some((part) => part === '' || part === '.' || part === '..')) {
48
- throw new Error('Invalid machine path');
49
- }
50
- }
51
- //# sourceMappingURL=machine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"machine.js","sour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