@limrun/api 0.18.2 → 0.19.0
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/CHANGELOG.md +23 -0
- package/LICENSE +1 -1
- package/README.md +3 -1
- package/folder-sync-watcher.d.mts +17 -0
- package/folder-sync-watcher.d.mts.map +1 -0
- package/folder-sync-watcher.d.ts +17 -0
- package/folder-sync-watcher.d.ts.map +1 -0
- package/folder-sync-watcher.js +91 -0
- package/folder-sync-watcher.js.map +1 -0
- package/folder-sync-watcher.mjs +87 -0
- package/folder-sync-watcher.mjs.map +1 -0
- package/folder-sync.d.mts +23 -0
- package/folder-sync.d.mts.map +1 -0
- package/folder-sync.d.ts +23 -0
- package/folder-sync.d.ts.map +1 -0
- package/folder-sync.js +447 -0
- package/folder-sync.js.map +1 -0
- package/folder-sync.mjs +442 -0
- package/folder-sync.mjs.map +1 -0
- package/ios-client.d.mts +96 -0
- package/ios-client.d.mts.map +1 -1
- package/ios-client.d.ts +96 -0
- package/ios-client.d.ts.map +1 -1
- package/ios-client.js +89 -1
- package/ios-client.js.map +1 -1
- package/ios-client.mjs +89 -1
- package/ios-client.mjs.map +1 -1
- package/package.json +21 -1
- package/resources/android-instances.d.mts +2 -2
- package/resources/android-instances.d.ts +2 -2
- package/resources/assets.d.mts +9 -0
- package/resources/assets.d.mts.map +1 -1
- package/resources/assets.d.ts +9 -0
- package/resources/assets.d.ts.map +1 -1
- package/resources/ios-instances.d.mts +2 -2
- package/resources/ios-instances.d.ts +2 -2
- package/src/folder-sync-watcher.ts +99 -0
- package/src/folder-sync.ts +557 -0
- package/src/ios-client.ts +221 -4
- package/src/resources/android-instances.ts +2 -2
- package/src/resources/assets.ts +11 -0
- package/src/resources/ios-instances.ts +2 -2
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.19.0 (2026-01-16)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.18.3...v0.19.0](https://github.com/limrun-inc/typescript-sdk/compare/v0.18.3...v0.19.0)
|
|
6
|
+
|
|
7
|
+
### Chores
|
|
8
|
+
|
|
9
|
+
* fix typo in descriptions ([44e45d6](https://github.com/limrun-inc/typescript-sdk/commit/44e45d66651ac606e308de2f910e98e2872708d4))
|
|
10
|
+
* **internal:** upgrade babel, qs, js-yaml ([f6ebf0c](https://github.com/limrun-inc/typescript-sdk/commit/f6ebf0c6aed2199cc404bf52853b10018b17b6b1))
|
|
11
|
+
|
|
12
|
+
## 0.18.3 (2026-01-07)
|
|
13
|
+
|
|
14
|
+
Full Changelog: [v0.18.2...v0.18.3](https://github.com/limrun-inc/typescript-sdk/compare/v0.18.2...v0.18.3)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **api:** add displayName to asset ([e641747](https://github.com/limrun-inc/typescript-sdk/commit/e6417478ea5e6e21005ebce9b28466fb11a880d2))
|
|
19
|
+
* **api:** add optional os field to assets ([4b24ab8](https://github.com/limrun-inc/typescript-sdk/commit/4b24ab8c8eefc9ba1c7050ca2f2dc0534d8d2a81))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Chores
|
|
23
|
+
|
|
24
|
+
* break long lines in snippets into multiline ([3ce0f46](https://github.com/limrun-inc/typescript-sdk/commit/3ce0f46875d62a9b285d4c2ddf797728381a1604))
|
|
25
|
+
|
|
3
26
|
## 0.18.2 (2025-12-24)
|
|
4
27
|
|
|
5
28
|
Full Changelog: [v0.18.1...v0.18.2](https://github.com/limrun-inc/typescript-sdk/compare/v0.18.1...v0.18.2)
|
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright 2026 Limrun
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -171,7 +171,9 @@ const response = await client.androidInstances.create().asResponse();
|
|
|
171
171
|
console.log(response.headers.get('X-My-Header'));
|
|
172
172
|
console.log(response.statusText); // access the underlying Response object
|
|
173
173
|
|
|
174
|
-
const { data: androidInstance, response: raw } = await client.androidInstances
|
|
174
|
+
const { data: androidInstance, response: raw } = await client.androidInstances
|
|
175
|
+
.create()
|
|
176
|
+
.withResponse();
|
|
175
177
|
console.log(raw.headers.get('X-My-Header'));
|
|
176
178
|
console.log(androidInstance.metadata);
|
|
177
179
|
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type FolderSyncWatcherOptions = {
|
|
2
|
+
rootPath: string;
|
|
3
|
+
log?: (level: 'debug' | 'info' | 'warn' | 'error', msg: string) => void;
|
|
4
|
+
onChange: (reason: string) => void;
|
|
5
|
+
};
|
|
6
|
+
type WatcherHandle = {
|
|
7
|
+
close: () => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Watch a folder tree for changes. Uses recursive watch when supported (macOS),
|
|
11
|
+
* otherwise falls back to watching each directory. Debounced.
|
|
12
|
+
*
|
|
13
|
+
* Returns a handle that can be closed to stop watching.
|
|
14
|
+
*/
|
|
15
|
+
export declare function watchFolderTree(opts: FolderSyncWatcherOptions): Promise<WatcherHandle>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=folder-sync-watcher.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folder-sync-watcher.d.mts","sourceRoot":"","sources":["src/folder-sync-watcher.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,KAAK,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAyB3C;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CA0D5F"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type FolderSyncWatcherOptions = {
|
|
2
|
+
rootPath: string;
|
|
3
|
+
log?: (level: 'debug' | 'info' | 'warn' | 'error', msg: string) => void;
|
|
4
|
+
onChange: (reason: string) => void;
|
|
5
|
+
};
|
|
6
|
+
type WatcherHandle = {
|
|
7
|
+
close: () => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Watch a folder tree for changes. Uses recursive watch when supported (macOS),
|
|
11
|
+
* otherwise falls back to watching each directory. Debounced.
|
|
12
|
+
*
|
|
13
|
+
* Returns a handle that can be closed to stop watching.
|
|
14
|
+
*/
|
|
15
|
+
export declare function watchFolderTree(opts: FolderSyncWatcherOptions): Promise<WatcherHandle>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=folder-sync-watcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folder-sync-watcher.d.ts","sourceRoot":"","sources":["src/folder-sync-watcher.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,KAAK,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAyB3C;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CA0D5F"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.watchFolderTree = watchFolderTree;
|
|
4
|
+
const tslib_1 = require("./internal/tslib.js");
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
+
const noopLogger = (_level, _msg) => { };
|
|
8
|
+
async function listDirsRecursive(root) {
|
|
9
|
+
const dirs = [root];
|
|
10
|
+
const queue = [root];
|
|
11
|
+
while (queue.length) {
|
|
12
|
+
const dir = queue.pop();
|
|
13
|
+
let entries;
|
|
14
|
+
try {
|
|
15
|
+
entries = await fs_1.default.promises.readdir(dir, { withFileTypes: true });
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
for (const ent of entries) {
|
|
21
|
+
if (!ent.isDirectory())
|
|
22
|
+
continue;
|
|
23
|
+
const full = path_1.default.join(dir, ent.name);
|
|
24
|
+
dirs.push(full);
|
|
25
|
+
queue.push(full);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return dirs;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Watch a folder tree for changes. Uses recursive watch when supported (macOS),
|
|
32
|
+
* otherwise falls back to watching each directory. Debounced.
|
|
33
|
+
*
|
|
34
|
+
* Returns a handle that can be closed to stop watching.
|
|
35
|
+
*/
|
|
36
|
+
async function watchFolderTree(opts) {
|
|
37
|
+
const log = opts.log ?? noopLogger;
|
|
38
|
+
const debounceMs = 500;
|
|
39
|
+
const rootPath = opts.rootPath;
|
|
40
|
+
if (!fs_1.default.existsSync(rootPath)) {
|
|
41
|
+
throw new Error(`watchFolderTree root does not exist: ${rootPath}`);
|
|
42
|
+
}
|
|
43
|
+
let timer;
|
|
44
|
+
const schedule = (reason) => {
|
|
45
|
+
if (timer)
|
|
46
|
+
clearTimeout(timer);
|
|
47
|
+
timer = setTimeout(() => opts.onChange(reason), debounceMs);
|
|
48
|
+
};
|
|
49
|
+
// Preferred: recursive watch
|
|
50
|
+
try {
|
|
51
|
+
const watcher = fs_1.default.watch(rootPath, { recursive: true }, (_eventType, filename) => {
|
|
52
|
+
schedule(filename ? `change:${filename.toString()}` : 'change');
|
|
53
|
+
});
|
|
54
|
+
log('info', `watchFolderTree(recursive): ${rootPath}`);
|
|
55
|
+
return { close: () => watcher.close() };
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
log('warn', `watchFolderTree: recursive unsupported, using per-directory watches: ${err.message}`);
|
|
59
|
+
}
|
|
60
|
+
// Fallback: watch every directory. Also re-scan on any event to pick up newly-created dirs.
|
|
61
|
+
const watchers = new Map();
|
|
62
|
+
const ensureWatched = async () => {
|
|
63
|
+
const dirs = await listDirsRecursive(rootPath);
|
|
64
|
+
for (const d of dirs) {
|
|
65
|
+
if (watchers.has(d))
|
|
66
|
+
continue;
|
|
67
|
+
try {
|
|
68
|
+
const w = fs_1.default.watch(d, (_eventType, filename) => {
|
|
69
|
+
schedule(filename ? `change:${filename.toString()}` : 'change');
|
|
70
|
+
void ensureWatched();
|
|
71
|
+
});
|
|
72
|
+
watchers.set(d, w);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// ignore dirs we can't watch
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
await ensureWatched();
|
|
80
|
+
log('info', `watchFolderTree(per-dir): ${rootPath} dirs=${watchers.size}`);
|
|
81
|
+
return {
|
|
82
|
+
close: () => {
|
|
83
|
+
if (timer)
|
|
84
|
+
clearTimeout(timer);
|
|
85
|
+
for (const w of watchers.values())
|
|
86
|
+
w.close();
|
|
87
|
+
watchers.clear();
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=folder-sync-watcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folder-sync-watcher.js","sourceRoot":"","sources":["src/folder-sync-watcher.ts"],"names":[],"mappings":";;AAwCA,0CA0DC;;AAlGD,oDAAoB;AACpB,wDAAwB;AAUxB,MAAM,UAAU,GAAG,CAAC,MAA2C,EAAE,IAAY,EAAE,EAAE,GAAE,CAAC,CAAC;AAErF,KAAK,UAAU,iBAAiB,CAAC,IAAY;IAC3C,MAAM,IAAI,GAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAa,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAG,CAAC;QACzB,IAAI,OAAoB,CAAC;QACzB,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QACpE,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE;gBAAE,SAAS;YACjC,MAAM,IAAI,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CAAC,IAA8B;IAClE,MAAM,GA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C/B,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC/C,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACrB,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;gBAAE,SAAS;YAC9B,IAAI,CAAC;gBACH,MAAM,CAAC,GAAG,YAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE;oBAC7C,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;oBAChE,KAAK,aAAa,EAAE,CAAC;gBACvB,CAAC,CAAC,CAAC;gBACH,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACrB,CAAC;YAAC,MAAM,CAAC;gBACP,6BAA6B;YAC/B,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,aAAa,EAAE,CAAC;IACtB,GAAG,CAAC,MAAM,EAAE,6BAA6B,QAAQ,SAAS,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAE3E,OAAO;QACL,KAAK,EAAE,GAAG,EAAE;YACV,IAAI,KAAK;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YAC/B,KAAK,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE;gBAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YAC7C,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
const noopLogger = (_level, _msg) => { };
|
|
4
|
+
async function listDirsRecursive(root) {
|
|
5
|
+
const dirs = [root];
|
|
6
|
+
const queue = [root];
|
|
7
|
+
while (queue.length) {
|
|
8
|
+
const dir = queue.pop();
|
|
9
|
+
let entries;
|
|
10
|
+
try {
|
|
11
|
+
entries = await fs.promises.readdir(dir, { withFileTypes: true });
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
for (const ent of entries) {
|
|
17
|
+
if (!ent.isDirectory())
|
|
18
|
+
continue;
|
|
19
|
+
const full = path.join(dir, ent.name);
|
|
20
|
+
dirs.push(full);
|
|
21
|
+
queue.push(full);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return dirs;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Watch a folder tree for changes. Uses recursive watch when supported (macOS),
|
|
28
|
+
* otherwise falls back to watching each directory. Debounced.
|
|
29
|
+
*
|
|
30
|
+
* Returns a handle that can be closed to stop watching.
|
|
31
|
+
*/
|
|
32
|
+
export async function watchFolderTree(opts) {
|
|
33
|
+
const log = opts.log ?? noopLogger;
|
|
34
|
+
const debounceMs = 500;
|
|
35
|
+
const rootPath = opts.rootPath;
|
|
36
|
+
if (!fs.existsSync(rootPath)) {
|
|
37
|
+
throw new Error(`watchFolderTree root does not exist: ${rootPath}`);
|
|
38
|
+
}
|
|
39
|
+
let timer;
|
|
40
|
+
const schedule = (reason) => {
|
|
41
|
+
if (timer)
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
timer = setTimeout(() => opts.onChange(reason), debounceMs);
|
|
44
|
+
};
|
|
45
|
+
// Preferred: recursive watch
|
|
46
|
+
try {
|
|
47
|
+
const watcher = fs.watch(rootPath, { recursive: true }, (_eventType, filename) => {
|
|
48
|
+
schedule(filename ? `change:${filename.toString()}` : 'change');
|
|
49
|
+
});
|
|
50
|
+
log('info', `watchFolderTree(recursive): ${rootPath}`);
|
|
51
|
+
return { close: () => watcher.close() };
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
log('warn', `watchFolderTree: recursive unsupported, using per-directory watches: ${err.message}`);
|
|
55
|
+
}
|
|
56
|
+
// Fallback: watch every directory. Also re-scan on any event to pick up newly-created dirs.
|
|
57
|
+
const watchers = new Map();
|
|
58
|
+
const ensureWatched = async () => {
|
|
59
|
+
const dirs = await listDirsRecursive(rootPath);
|
|
60
|
+
for (const d of dirs) {
|
|
61
|
+
if (watchers.has(d))
|
|
62
|
+
continue;
|
|
63
|
+
try {
|
|
64
|
+
const w = fs.watch(d, (_eventType, filename) => {
|
|
65
|
+
schedule(filename ? `change:${filename.toString()}` : 'change');
|
|
66
|
+
void ensureWatched();
|
|
67
|
+
});
|
|
68
|
+
watchers.set(d, w);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// ignore dirs we can't watch
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
await ensureWatched();
|
|
76
|
+
log('info', `watchFolderTree(per-dir): ${rootPath} dirs=${watchers.size}`);
|
|
77
|
+
return {
|
|
78
|
+
close: () => {
|
|
79
|
+
if (timer)
|
|
80
|
+
clearTimeout(timer);
|
|
81
|
+
for (const w of watchers.values())
|
|
82
|
+
w.close();
|
|
83
|
+
watchers.clear();
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=folder-sync-watcher.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folder-sync-watcher.mjs","sourceRoot":"","sources":["src/folder-sync-watcher.ts"],"names":[],"mappings":"OAAO,EAAE,MAAM,IAAI;OACZ,IAAI,MAAM,MAAM;AAUvB,MAAM,UAAU,GAAG,CAAC,MAA2C,EAAE,IAAY,EAAE,EAAE,GAAE,CAAC,CAAC;AAErF,KAAK,UAAU,iBAAiB,CAAC,IAAY;IAC3C,MAAM,IAAI,GAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAa,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC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C/B,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,aAAa,EAAE,CAAC;IACtB,GAAG,CAAC,MAAM,EAAE,6BAA6B,QAAQ,SAAS,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAE3E,OAAO;QACL,KAAK,EAAE,GAAG,EAAE;YACV,IAAI,KAAK;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YAC/B,KAAK,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE;gBAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YAC7C,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type FolderSyncOptions = {
|
|
2
|
+
apiUrl: string;
|
|
3
|
+
token: string;
|
|
4
|
+
udid: string;
|
|
5
|
+
install?: boolean;
|
|
6
|
+
launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning' | 'FailIfRunning';
|
|
7
|
+
/** If true, watch the folder and re-sync on any changes (debounced, single-flight). */
|
|
8
|
+
watch?: boolean;
|
|
9
|
+
/** Max patch size (bytes) to send as delta before falling back to full upload. */
|
|
10
|
+
maxPatchBytes?: number;
|
|
11
|
+
/** Controls logging verbosity */
|
|
12
|
+
log?: (level: 'debug' | 'info' | 'warn' | 'error', msg: string) => void;
|
|
13
|
+
};
|
|
14
|
+
export type SyncFolderResult = {
|
|
15
|
+
installedAppPath?: string;
|
|
16
|
+
installedBundleId?: string;
|
|
17
|
+
/** Present only when watch=true; call to stop watching. */
|
|
18
|
+
stopWatching?: () => void;
|
|
19
|
+
};
|
|
20
|
+
export type SyncAppResult = SyncFolderResult;
|
|
21
|
+
export declare function syncApp(localFolderPath: string, opts: FolderSyncOptions): Promise<SyncFolderResult>;
|
|
22
|
+
export declare function syncFolder(localFolderPath: string, opts: FolderSyncOptions): Promise<SyncFolderResult>;
|
|
23
|
+
//# sourceMappingURL=folder-sync.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folder-sync.d.mts","sourceRoot":"","sources":["src/folder-sync.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,qBAAqB,GAAG,mBAAmB,GAAG,eAAe,CAAC;IAC3E,uFAAuF;IACvF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACzE,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,CAAC;AAwQF,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAE7C,wBAAsB,OAAO,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2CzG;AAGD,wBAAsB,UAAU,CAC9B,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAE3B"}
|
package/folder-sync.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type FolderSyncOptions = {
|
|
2
|
+
apiUrl: string;
|
|
3
|
+
token: string;
|
|
4
|
+
udid: string;
|
|
5
|
+
install?: boolean;
|
|
6
|
+
launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning' | 'FailIfRunning';
|
|
7
|
+
/** If true, watch the folder and re-sync on any changes (debounced, single-flight). */
|
|
8
|
+
watch?: boolean;
|
|
9
|
+
/** Max patch size (bytes) to send as delta before falling back to full upload. */
|
|
10
|
+
maxPatchBytes?: number;
|
|
11
|
+
/** Controls logging verbosity */
|
|
12
|
+
log?: (level: 'debug' | 'info' | 'warn' | 'error', msg: string) => void;
|
|
13
|
+
};
|
|
14
|
+
export type SyncFolderResult = {
|
|
15
|
+
installedAppPath?: string;
|
|
16
|
+
installedBundleId?: string;
|
|
17
|
+
/** Present only when watch=true; call to stop watching. */
|
|
18
|
+
stopWatching?: () => void;
|
|
19
|
+
};
|
|
20
|
+
export type SyncAppResult = SyncFolderResult;
|
|
21
|
+
export declare function syncApp(localFolderPath: string, opts: FolderSyncOptions): Promise<SyncFolderResult>;
|
|
22
|
+
export declare function syncFolder(localFolderPath: string, opts: FolderSyncOptions): Promise<SyncFolderResult>;
|
|
23
|
+
//# sourceMappingURL=folder-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folder-sync.d.ts","sourceRoot":"","sources":["src/folder-sync.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,qBAAqB,GAAG,mBAAmB,GAAG,eAAe,CAAC;IAC3E,uFAAuF;IACvF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACzE,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,CAAC;AAwQF,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAE7C,wBAAsB,OAAO,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2CzG;AAGD,wBAAsB,UAAU,CAC9B,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAE3B"}
|