@rool-dev/sdk 0.10.2-dev.9df035a → 0.10.2-dev.a0fe230
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 +437 -1108
- package/dist/channel.d.ts +29 -61
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js +92 -133
- package/dist/channel.js.map +1 -1
- package/dist/client.d.ts +0 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +0 -8
- package/dist/client.js.map +1 -1
- package/dist/graphql.d.ts +1 -2
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +20 -42
- package/dist/graphql.js.map +1 -1
- package/dist/index.d.ts +3 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/path.d.ts +6 -0
- package/dist/path.d.ts.map +1 -0
- package/dist/path.js +47 -0
- package/dist/path.js.map +1 -0
- package/dist/reroute.d.ts +22 -0
- package/dist/reroute.d.ts.map +1 -0
- package/dist/reroute.js +61 -0
- package/dist/reroute.js.map +1 -0
- package/dist/rest.d.ts +1 -1
- package/dist/rest.d.ts.map +1 -1
- package/dist/rest.js +14 -25
- package/dist/rest.js.map +1 -1
- package/dist/space.d.ts +2 -3
- package/dist/space.d.ts.map +1 -1
- package/dist/space.js +7 -15
- package/dist/space.js.map +1 -1
- package/dist/subscription.js +0 -2
- package/dist/subscription.js.map +1 -1
- package/dist/types.d.ts +14 -41
- package/dist/types.d.ts.map +1 -1
- package/dist/webdav.d.ts +21 -21
- package/dist/webdav.d.ts.map +1 -1
- package/dist/webdav.js +37 -101
- package/dist/webdav.js.map +1 -1
- package/package.json +1 -1
- package/dist/locations.d.ts +0 -29
- package/dist/locations.d.ts.map +0 -1
- package/dist/locations.js +0 -78
- package/dist/locations.js.map +0 -1
- package/dist/machine.d.ts +0 -16
- package/dist/machine.d.ts.map +0 -1
- package/dist/machine.js +0 -51
- package/dist/machine.js.map +0 -1
package/dist/locations.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// =============================================================================
|
|
2
|
-
// Object location helpers
|
|
3
|
-
//
|
|
4
|
-
// An object lives at a "location" — a path of the form
|
|
5
|
-
// `/space/<collection>/<basename>.json`. The collection is the parent
|
|
6
|
-
// directory; the basename is the filename without `.json`. The two together
|
|
7
|
-
// fully identify the object inside its space.
|
|
8
|
-
//
|
|
9
|
-
// Functions here normalize user-provided strings, parse locations into their
|
|
10
|
-
// parts, and build canonical locations from validated parts.
|
|
11
|
-
// =============================================================================
|
|
12
|
-
const COLLECTION_RE = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
|
|
13
|
-
const BASENAME_RE = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;
|
|
14
|
-
const FULL_LOCATION_RE = /^\/space\/([^/]+)\/([^/]+)\.json$/;
|
|
15
|
-
/**
|
|
16
|
-
* Build a canonical location string from a collection and basename.
|
|
17
|
-
* Validates both parts. Throws on invalid input.
|
|
18
|
-
*/
|
|
19
|
-
export function loc(collection, basename) {
|
|
20
|
-
if (!COLLECTION_RE.test(collection)) {
|
|
21
|
-
throw new Error(`Invalid collection "${collection}". Must start with a letter and contain only alphanumeric characters, hyphens, and underscores.`);
|
|
22
|
-
}
|
|
23
|
-
if (!BASENAME_RE.test(basename)) {
|
|
24
|
-
throw new Error(`Invalid basename "${basename}". Must start with an alphanumeric character and contain only alphanumeric characters, hyphens, and underscores.`);
|
|
25
|
-
}
|
|
26
|
-
return `/space/${collection}/${basename}.json`;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Parse a canonical location string into its collection and basename.
|
|
30
|
-
* Throws on malformed input. Use {@link normalizeLocation} first if the
|
|
31
|
-
* input might be a short form like `"article/welcome"`.
|
|
32
|
-
*/
|
|
33
|
-
export function parseLocation(location) {
|
|
34
|
-
const match = FULL_LOCATION_RE.exec(location);
|
|
35
|
-
if (!match)
|
|
36
|
-
throw new Error(`Invalid location "${location}". Expected /space/<collection>/<basename>.json.`);
|
|
37
|
-
const [, collection, basename] = match;
|
|
38
|
-
if (!COLLECTION_RE.test(collection) || !BASENAME_RE.test(basename)) {
|
|
39
|
-
throw new Error(`Invalid location "${location}".`);
|
|
40
|
-
}
|
|
41
|
-
return { collection, basename };
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Normalize a user-provided location to the canonical full form.
|
|
45
|
-
*
|
|
46
|
-
* Accepts:
|
|
47
|
-
* - `/space/<collection>/<basename>.json` — canonical
|
|
48
|
-
* - `<collection>/<basename>` — short form
|
|
49
|
-
* - `<collection>/<basename>.json` — short form with extension
|
|
50
|
-
*
|
|
51
|
-
* Always returns the canonical form. Throws on malformed input.
|
|
52
|
-
*/
|
|
53
|
-
export function normalizeLocation(input) {
|
|
54
|
-
if (input.startsWith('/space/')) {
|
|
55
|
-
parseLocation(input); // validate
|
|
56
|
-
return input;
|
|
57
|
-
}
|
|
58
|
-
// Short form: "collection/basename" or "collection/basename.json"
|
|
59
|
-
const stripped = input.endsWith('.json') ? input.slice(0, -5) : input;
|
|
60
|
-
const slash = stripped.indexOf('/');
|
|
61
|
-
if (slash <= 0 || stripped.indexOf('/', slash + 1) !== -1) {
|
|
62
|
-
throw new Error(`Invalid location "${input}". Expected /space/<collection>/<basename>.json or <collection>/<basename>.`);
|
|
63
|
-
}
|
|
64
|
-
return loc(stripped.slice(0, slash), stripped.slice(slash + 1));
|
|
65
|
-
}
|
|
66
|
-
/** Return true if `input` is a syntactically valid (full or short) location. */
|
|
67
|
-
export function isLocation(input) {
|
|
68
|
-
if (typeof input !== 'string')
|
|
69
|
-
return false;
|
|
70
|
-
try {
|
|
71
|
-
normalizeLocation(input);
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=locations.js.map
|
package/dist/locations.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"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|
|
4
|
-
} | {
|
|
5
|
-
kind: 'file';
|
|
6
|
-
path: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Resolve a Rool machine resource from either a canonical `rool-machine:/...`
|
|
10
|
-
* URI or a bare machine path such as `/rool-drive/...`.
|
|
11
|
-
*
|
|
12
|
-
* Returns null for ordinary strings, malformed machine paths, and unsupported
|
|
13
|
-
* machine areas.
|
|
14
|
-
*/
|
|
15
|
-
export declare function resolveMachineResource(input: string): MachineResource | null;
|
|
16
|
-
//# sourceMappingURL=machine.d.ts.map
|
package/dist/machine.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../src/machine.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAa5E"}
|
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
|
package/dist/machine.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"machine.js","sourceRoot":"","sources":["../src/machine.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,gCAAgC,CAAC;AACxD,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAMzC;;;;;;GAMG;AACH,MAAM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