@limrun/api 0.79.5 → 0.80.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.
Files changed (148) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/client.d.mts +4 -1
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +4 -1
  5. package/client.d.ts.map +1 -1
  6. package/client.js +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +1 -1
  9. package/client.mjs.map +1 -1
  10. package/exec-client.d.mts +64 -15
  11. package/exec-client.d.mts.map +1 -1
  12. package/exec-client.d.ts +64 -15
  13. package/exec-client.d.ts.map +1 -1
  14. package/exec-client.js.map +1 -1
  15. package/exec-client.mjs.map +1 -1
  16. package/folder-sync.d.mts +2 -0
  17. package/folder-sync.d.mts.map +1 -1
  18. package/folder-sync.d.ts +2 -0
  19. package/folder-sync.d.ts.map +1 -1
  20. package/folder-sync.js +1 -1
  21. package/folder-sync.js.map +1 -1
  22. package/folder-sync.mjs +1 -1
  23. package/folder-sync.mjs.map +1 -1
  24. package/gradle-snapshot.d.mts +2 -0
  25. package/gradle-snapshot.d.mts.map +1 -1
  26. package/gradle-snapshot.d.ts +2 -0
  27. package/gradle-snapshot.d.ts.map +1 -1
  28. package/gradle-snapshot.js.map +1 -1
  29. package/gradle-snapshot.mjs.map +1 -1
  30. package/index.d.mts +2 -2
  31. package/index.d.mts.map +1 -1
  32. package/index.d.ts +2 -2
  33. package/index.d.ts.map +1 -1
  34. package/index.js.map +1 -1
  35. package/index.mjs.map +1 -1
  36. package/instance-client.d.mts +7 -2
  37. package/instance-client.d.mts.map +1 -1
  38. package/instance-client.d.ts +7 -2
  39. package/instance-client.d.ts.map +1 -1
  40. package/instance-client.js +27 -55
  41. package/instance-client.js.map +1 -1
  42. package/instance-client.mjs +27 -55
  43. package/instance-client.mjs.map +1 -1
  44. package/internal/asset-source.d.mts +11 -0
  45. package/internal/asset-source.d.mts.map +1 -0
  46. package/internal/asset-source.d.ts +11 -0
  47. package/internal/asset-source.d.ts.map +1 -0
  48. package/internal/asset-source.js +15 -0
  49. package/internal/asset-source.js.map +1 -0
  50. package/internal/asset-source.mjs +12 -0
  51. package/internal/asset-source.mjs.map +1 -0
  52. package/internal/file-transfer.d.mts +43 -0
  53. package/internal/file-transfer.d.mts.map +1 -0
  54. package/internal/file-transfer.d.ts +43 -0
  55. package/internal/file-transfer.d.ts.map +1 -0
  56. package/internal/file-transfer.js +270 -0
  57. package/internal/file-transfer.js.map +1 -0
  58. package/internal/file-transfer.mjs +261 -0
  59. package/internal/file-transfer.mjs.map +1 -0
  60. package/ios-client.d.mts +47 -5
  61. package/ios-client.d.mts.map +1 -1
  62. package/ios-client.d.ts +47 -5
  63. package/ios-client.d.ts.map +1 -1
  64. package/ios-client.js +44 -2
  65. package/ios-client.js.map +1 -1
  66. package/ios-client.mjs +43 -2
  67. package/ios-client.mjs.map +1 -1
  68. package/lib/workload-credentials.d.mts +2 -1
  69. package/lib/workload-credentials.d.mts.map +1 -1
  70. package/lib/workload-credentials.d.ts +2 -1
  71. package/lib/workload-credentials.d.ts.map +1 -1
  72. package/lib/workload-credentials.js +3 -0
  73. package/lib/workload-credentials.js.map +1 -1
  74. package/lib/workload-credentials.mjs +3 -0
  75. package/lib/workload-credentials.mjs.map +1 -1
  76. package/package.json +2 -1
  77. package/resources/access-tokens.d.mts +17 -0
  78. package/resources/access-tokens.d.mts.map +1 -1
  79. package/resources/access-tokens.d.ts +17 -0
  80. package/resources/access-tokens.d.ts.map +1 -1
  81. package/resources/access-tokens.js +39 -3
  82. package/resources/access-tokens.js.map +1 -1
  83. package/resources/access-tokens.mjs +36 -2
  84. package/resources/access-tokens.mjs.map +1 -1
  85. package/resources/index.d.mts +1 -1
  86. package/resources/index.d.mts.map +1 -1
  87. package/resources/index.d.ts +1 -1
  88. package/resources/index.d.ts.map +1 -1
  89. package/resources/index.js.map +1 -1
  90. package/resources/index.mjs.map +1 -1
  91. package/resources/macos-instances-helpers.d.mts +100 -0
  92. package/resources/macos-instances-helpers.d.mts.map +1 -1
  93. package/resources/macos-instances-helpers.d.ts +100 -0
  94. package/resources/macos-instances-helpers.d.ts.map +1 -1
  95. package/resources/macos-instances-helpers.js +107 -0
  96. package/resources/macos-instances-helpers.js.map +1 -1
  97. package/resources/macos-instances-helpers.mjs +106 -0
  98. package/resources/macos-instances-helpers.mjs.map +1 -1
  99. package/resources/scoped-tokens.d.mts +2 -2
  100. package/resources/scoped-tokens.d.mts.map +1 -1
  101. package/resources/scoped-tokens.d.ts +2 -2
  102. package/resources/scoped-tokens.d.ts.map +1 -1
  103. package/resources/scoped-tokens.js +9 -2
  104. package/resources/scoped-tokens.js.map +1 -1
  105. package/resources/scoped-tokens.mjs +9 -2
  106. package/resources/scoped-tokens.mjs.map +1 -1
  107. package/resources/snapshots.d.mts +2 -0
  108. package/resources/snapshots.d.mts.map +1 -1
  109. package/resources/snapshots.d.ts +2 -0
  110. package/resources/snapshots.d.ts.map +1 -1
  111. package/resources/snapshots.js.map +1 -1
  112. package/resources/snapshots.mjs.map +1 -1
  113. package/resources/xcode-instances-helpers.d.mts +33 -18
  114. package/resources/xcode-instances-helpers.d.mts.map +1 -1
  115. package/resources/xcode-instances-helpers.d.ts +33 -18
  116. package/resources/xcode-instances-helpers.d.ts.map +1 -1
  117. package/resources/xcode-instances-helpers.js +5 -2
  118. package/resources/xcode-instances-helpers.js.map +1 -1
  119. package/resources/xcode-instances-helpers.mjs +5 -2
  120. package/resources/xcode-instances-helpers.mjs.map +1 -1
  121. package/src/client.ts +5 -2
  122. package/src/exec-client.ts +77 -22
  123. package/src/folder-sync.ts +3 -1
  124. package/src/gradle-snapshot.ts +2 -0
  125. package/src/index.ts +9 -0
  126. package/src/instance-client.ts +38 -59
  127. package/src/internal/asset-source.ts +13 -0
  128. package/src/internal/file-transfer.ts +284 -0
  129. package/src/ios-client.ts +96 -7
  130. package/src/lib/workload-credentials.ts +6 -1
  131. package/src/resources/access-tokens.ts +39 -2
  132. package/src/resources/index.ts +4 -0
  133. package/src/resources/macos-instances-helpers.ts +236 -0
  134. package/src/resources/scoped-tokens.ts +14 -3
  135. package/src/resources/snapshots.ts +2 -0
  136. package/src/resources/xcode-instances-helpers.ts +49 -19
  137. package/src/version.ts +1 -1
  138. package/src/xcode-snapshot.ts +2 -0
  139. package/version.d.mts +1 -1
  140. package/version.d.ts +1 -1
  141. package/version.js +1 -1
  142. package/version.mjs +1 -1
  143. package/xcode-snapshot.d.mts +2 -0
  144. package/xcode-snapshot.d.mts.map +1 -1
  145. package/xcode-snapshot.d.ts +2 -0
  146. package/xcode-snapshot.d.ts.map +1 -1
  147. package/xcode-snapshot.js.map +1 -1
  148. package/xcode-snapshot.mjs.map +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-source.d.mts","sourceRoot":"","sources":["../src/internal/asset-source.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEtE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAS9F"}
@@ -0,0 +1,11 @@
1
+ /** A download URL, or an asset the instance has delegated permission to read. */
2
+ export type AssetSource = string | {
3
+ assetName: string;
4
+ url?: never;
5
+ };
6
+ export declare function assetSourceFields(source: AssetSource): {
7
+ url: string;
8
+ } | {
9
+ assetName: string;
10
+ };
11
+ //# sourceMappingURL=asset-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-source.d.ts","sourceRoot":"","sources":["../src/internal/asset-source.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEtE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAS9F"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assetSourceFields = assetSourceFields;
4
+ function assetSourceFields(source) {
5
+ if (typeof source === 'string') {
6
+ if (!source)
7
+ throw new Error('url must not be empty');
8
+ return { url: source };
9
+ }
10
+ if (!source || typeof source.assetName !== 'string' || !source.assetName || 'url' in source) {
11
+ throw new Error('Provide a URL string or { assetName: <non-empty name> }');
12
+ }
13
+ return { assetName: source.assetName };
14
+ }
15
+ //# sourceMappingURL=asset-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-source.js","sourceRoot":"","sources":["../src/internal/asset-source.ts"],"names":[],"mappings":";;AAGA,8CASC;AATD,SAAgB,iBAAiB,CAAC,MAAmB;IACnD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACtD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IACzB,CAAC;IACD,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5F,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export function assetSourceFields(source) {
2
+ if (typeof source === 'string') {
3
+ if (!source)
4
+ throw new Error('url must not be empty');
5
+ return { url: source };
6
+ }
7
+ if (!source || typeof source.assetName !== 'string' || !source.assetName || 'url' in source) {
8
+ throw new Error('Provide a URL string or { assetName: <non-empty name> }');
9
+ }
10
+ return { assetName: source.assetName };
11
+ }
12
+ //# sourceMappingURL=asset-source.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-source.mjs","sourceRoot":"","sources":["../src/internal/asset-source.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,iBAAiB,CAAC,MAAmB;IACnD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACtD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IACzB,CAAC;IACD,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5F,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,43 @@
1
+ /** The Content-Type of a folder an instance sends as a tar. */
2
+ export declare const TAR_CONTENT_TYPE = "application/x-tar";
3
+ /**
4
+ * The header saying a pull's body is zstd-compressed. A pull asks for it with `compression=zstd`;
5
+ * a server that predates it sends neither. It is not Content-Encoding, so fetch never decodes the
6
+ * body on its own.
7
+ */
8
+ export declare const COMPRESSION_HEADER = "x-limrun-compression";
9
+ /** pullQuery is the query a pull adds to its URL: a folder as a tar, compressed when Node can read it. */
10
+ export declare function pullQuery(): string;
11
+ /**
12
+ * pushFile PUTs a local file to `url`, compressed with zstd as it is read when `compress` is set
13
+ * and Node has zstd, and returns the `path` the instance answers with.
14
+ */
15
+ export declare function pushFile(url: string, token: string, localPath: string, compress: boolean): Promise<string>;
16
+ /** What a pull wrote. */
17
+ export type PullResult = {
18
+ /** The absolute local path of the file or folder written. */
19
+ path: string;
20
+ /** True when the remote was a folder, unpacked into `path`. */
21
+ isDirectory: boolean;
22
+ };
23
+ /**
24
+ * pullTarget is where a pull of `remote` into `local` writes: `local`, or `remote`'s base name
25
+ * inside it when `local` is an existing folder. Without `local`, the base name in the current
26
+ * directory.
27
+ */
28
+ export declare function pullTarget(remote: string, local?: string): Promise<string>;
29
+ /**
30
+ * pullToLocalPath GETs `url`, whose query ends with {@link pullQuery}, and writes the answer to `target`: a
31
+ * tar is unpacked into the folder `target`, anything else is written to the file `target` through
32
+ * a temporary file renamed into place.
33
+ */
34
+ export declare function pullToLocalPath(url: string, token: string, remote: string, target: string): Promise<PullResult>;
35
+ /**
36
+ * unpackTar extracts a tar into `dir`, an existing folder. Entries are relative to `dir`: an
37
+ * absolute name or one with a `..` component fails the unpack. Symlinks keep their targets, as tar
38
+ * keeps them, wherever they point: they are created after every file and folder, and nothing is
39
+ * written through a symlink, so a target outside `dir` is never written to. Entries other than
40
+ * files, folders and symlinks are skipped.
41
+ */
42
+ export declare function unpackTar(source: AsyncIterable<Buffer>, dir: string): Promise<void>;
43
+ //# sourceMappingURL=file-transfer.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-transfer.d.mts","sourceRoot":"","sources":["../src/internal/file-transfer.ts"],"names":[],"mappings":"AAQA,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AAQzD,0GAA0G;AAC1G,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,MAAM,CAAC,CAkCjB;AAED,yBAAyB;AACzB,MAAM,MAAM,UAAU,GAAG;IACvB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBhF;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CA+BrB;AAuBD;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CzF"}
@@ -0,0 +1,43 @@
1
+ /** The Content-Type of a folder an instance sends as a tar. */
2
+ export declare const TAR_CONTENT_TYPE = "application/x-tar";
3
+ /**
4
+ * The header saying a pull's body is zstd-compressed. A pull asks for it with `compression=zstd`;
5
+ * a server that predates it sends neither. It is not Content-Encoding, so fetch never decodes the
6
+ * body on its own.
7
+ */
8
+ export declare const COMPRESSION_HEADER = "x-limrun-compression";
9
+ /** pullQuery is the query a pull adds to its URL: a folder as a tar, compressed when Node can read it. */
10
+ export declare function pullQuery(): string;
11
+ /**
12
+ * pushFile PUTs a local file to `url`, compressed with zstd as it is read when `compress` is set
13
+ * and Node has zstd, and returns the `path` the instance answers with.
14
+ */
15
+ export declare function pushFile(url: string, token: string, localPath: string, compress: boolean): Promise<string>;
16
+ /** What a pull wrote. */
17
+ export type PullResult = {
18
+ /** The absolute local path of the file or folder written. */
19
+ path: string;
20
+ /** True when the remote was a folder, unpacked into `path`. */
21
+ isDirectory: boolean;
22
+ };
23
+ /**
24
+ * pullTarget is where a pull of `remote` into `local` writes: `local`, or `remote`'s base name
25
+ * inside it when `local` is an existing folder. Without `local`, the base name in the current
26
+ * directory.
27
+ */
28
+ export declare function pullTarget(remote: string, local?: string): Promise<string>;
29
+ /**
30
+ * pullToLocalPath GETs `url`, whose query ends with {@link pullQuery}, and writes the answer to `target`: a
31
+ * tar is unpacked into the folder `target`, anything else is written to the file `target` through
32
+ * a temporary file renamed into place.
33
+ */
34
+ export declare function pullToLocalPath(url: string, token: string, remote: string, target: string): Promise<PullResult>;
35
+ /**
36
+ * unpackTar extracts a tar into `dir`, an existing folder. Entries are relative to `dir`: an
37
+ * absolute name or one with a `..` component fails the unpack. Symlinks keep their targets, as tar
38
+ * keeps them, wherever they point: they are created after every file and folder, and nothing is
39
+ * written through a symlink, so a target outside `dir` is never written to. Entries other than
40
+ * files, folders and symlinks are skipped.
41
+ */
42
+ export declare function unpackTar(source: AsyncIterable<Buffer>, dir: string): Promise<void>;
43
+ //# sourceMappingURL=file-transfer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-transfer.d.ts","sourceRoot":"","sources":["../src/internal/file-transfer.ts"],"names":[],"mappings":"AAQA,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AAQzD,0GAA0G;AAC1G,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,MAAM,CAAC,CAkCjB;AAED,yBAAyB;AACzB,MAAM,MAAM,UAAU,GAAG;IACvB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBhF;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CA+BrB;AAuBD;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CzF"}
@@ -0,0 +1,270 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.COMPRESSION_HEADER = exports.TAR_CONTENT_TYPE = void 0;
4
+ exports.pullQuery = pullQuery;
5
+ exports.pushFile = pushFile;
6
+ exports.pullTarget = pullTarget;
7
+ exports.pullToLocalPath = pullToLocalPath;
8
+ exports.unpackTar = unpackTar;
9
+ const tslib_1 = require("./tslib.js");
10
+ const fs_1 = tslib_1.__importDefault(require("fs"));
11
+ const path_1 = tslib_1.__importDefault(require("path"));
12
+ const stream_1 = require("stream");
13
+ const zlib = tslib_1.__importStar(require("zlib"));
14
+ const tarStream = tslib_1.__importStar(require("tar-stream"));
15
+ const proxy_transport_1 = require("./proxy-transport.js");
16
+ /** The Content-Type of a folder an instance sends as a tar. */
17
+ exports.TAR_CONTENT_TYPE = 'application/x-tar';
18
+ /**
19
+ * The header saying a pull's body is zstd-compressed. A pull asks for it with `compression=zstd`;
20
+ * a server that predates it sends neither. It is not Content-Encoding, so fetch never decodes the
21
+ * body on its own.
22
+ */
23
+ exports.COMPRESSION_HEADER = 'x-limrun-compression';
24
+ // Node has zstd from 22.15; an older Node pulls and pushes uncompressed.
25
+ const zstdCompress = zlib.createZstdCompress;
26
+ const zstdDecompress = zlib.createZstdDecompress;
27
+ /** pullQuery is the query a pull adds to its URL: a folder as a tar, compressed when Node can read it. */
28
+ function pullQuery() {
29
+ return zstdDecompress ? 'archive=tar&compression=zstd' : 'archive=tar';
30
+ }
31
+ /**
32
+ * pushFile PUTs a local file to `url`, compressed with zstd as it is read when `compress` is set
33
+ * and Node has zstd, and returns the `path` the instance answers with.
34
+ */
35
+ async function pushFile(url, token, localPath, compress) {
36
+ const size = (await fs_1.default.promises.stat(localPath)).size;
37
+ const file = fs_1.default.createReadStream(localPath);
38
+ const zstd = compress && zstdCompress ?
39
+ zstdCompress({ params: { [zlib.constants.ZSTD_c_compressionLevel]: 3 } })
40
+ : undefined;
41
+ const headers = {
42
+ 'Content-Type': 'application/octet-stream',
43
+ Authorization: `Bearer ${token}`,
44
+ };
45
+ let body = file;
46
+ if (zstd) {
47
+ headers['Content-Encoding'] = 'zstd';
48
+ file.on('error', (err) => zstd.destroy(err));
49
+ body = file.pipe(zstd);
50
+ }
51
+ else {
52
+ headers['Content-Length'] = String(size);
53
+ }
54
+ try {
55
+ const response = await proxy_transport_1.nodeProxyTransport.fetch(url, {
56
+ method: 'PUT',
57
+ headers,
58
+ body: body,
59
+ duplex: 'half',
60
+ });
61
+ if (!response.ok) {
62
+ const errorBody = await response.text();
63
+ throw new Error(`Upload of '${localPath}' failed: ${response.status} ${errorBody}`);
64
+ }
65
+ return (await response.json()).path;
66
+ }
67
+ finally {
68
+ file.destroy();
69
+ }
70
+ }
71
+ /**
72
+ * pullTarget is where a pull of `remote` into `local` writes: `local`, or `remote`'s base name
73
+ * inside it when `local` is an existing folder. Without `local`, the base name in the current
74
+ * directory.
75
+ */
76
+ async function pullTarget(remote, local) {
77
+ const name = path_1.default.posix.basename(remote.replace(/\/+$/, ''));
78
+ const nameless = name === '' || name === '.' || name === '..' || name === '~';
79
+ if (local === undefined || local === '') {
80
+ if (nameless)
81
+ throw new Error(`"${remote}" has no name to save it under; pass the local path to write to`);
82
+ return path_1.default.resolve(name);
83
+ }
84
+ const target = path_1.default.resolve(local);
85
+ const stat = await fs_1.default.promises.stat(target).catch(() => null);
86
+ if (!stat?.isDirectory())
87
+ return target;
88
+ if (nameless) {
89
+ throw new Error(`${target} is a folder and "${remote}" has no name to put inside it; pass the local path to write to`);
90
+ }
91
+ return path_1.default.join(target, name);
92
+ }
93
+ /**
94
+ * pullToLocalPath GETs `url`, whose query ends with {@link pullQuery}, and writes the answer to `target`: a
95
+ * tar is unpacked into the folder `target`, anything else is written to the file `target` through
96
+ * a temporary file renamed into place.
97
+ */
98
+ async function pullToLocalPath(url, token, remote, target) {
99
+ const response = await proxy_transport_1.nodeProxyTransport.fetch(url, {
100
+ method: 'GET',
101
+ headers: { Authorization: `Bearer ${token}` },
102
+ });
103
+ if (!response.ok) {
104
+ const errorBody = await response.text();
105
+ throw new Error(`Pull of '${remote}' failed: ${response.status} ${errorBody}`);
106
+ }
107
+ if (!response.body)
108
+ throw new Error(`Pull of '${remote}' failed: the response has no body`);
109
+ let source = stream_1.Readable.fromWeb(response.body);
110
+ const compression = response.headers.get(exports.COMPRESSION_HEADER);
111
+ if (compression) {
112
+ if (compression !== 'zstd' || !zstdDecompress) {
113
+ throw new Error(`Pull of '${remote}' failed: the body is compressed with ${compression}, which this Node cannot read`);
114
+ }
115
+ const raw = source;
116
+ const decompress = zstdDecompress();
117
+ raw.on('error', (err) => decompress.destroy(err));
118
+ source = raw.pipe(decompress);
119
+ }
120
+ const mediaType = (response.headers.get('content-type') ?? '').split(';')[0].trim().toLowerCase();
121
+ if (mediaType === exports.TAR_CONTENT_TYPE) {
122
+ await fs_1.default.promises.mkdir(target, { recursive: true });
123
+ await unpackTar(source, target);
124
+ return { path: target, isDirectory: true };
125
+ }
126
+ await writeFileAtomically(source, target);
127
+ return { path: target, isDirectory: false };
128
+ }
129
+ async function writeFileAtomically(source, target) {
130
+ const dir = path_1.default.dirname(target);
131
+ await fs_1.default.promises.mkdir(dir, { recursive: true });
132
+ const temporary = path_1.default.join(dir, `.lim-pull-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
133
+ const handle = await fs_1.default.promises.open(temporary, 'wx', 0o644);
134
+ try {
135
+ try {
136
+ for await (const chunk of source)
137
+ await handle.write(chunk);
138
+ }
139
+ finally {
140
+ await handle.close();
141
+ }
142
+ await fs_1.default.promises.rename(temporary, target);
143
+ }
144
+ catch (err) {
145
+ await fs_1.default.promises.rm(temporary, { force: true });
146
+ throw err;
147
+ }
148
+ }
149
+ /**
150
+ * unpackTar extracts a tar into `dir`, an existing folder. Entries are relative to `dir`: an
151
+ * absolute name or one with a `..` component fails the unpack. Symlinks keep their targets, as tar
152
+ * keeps them, wherever they point: they are created after every file and folder, and nothing is
153
+ * written through a symlink, so a target outside `dir` is never written to. Entries other than
154
+ * files, folders and symlinks are skipped.
155
+ */
156
+ async function unpackTar(source, dir) {
157
+ const extract = tarStream.extract();
158
+ const input = stream_1.Readable.from(source);
159
+ input.on('error', (err) => extract.destroy(err));
160
+ input.pipe(extract);
161
+ const links = [];
162
+ const folders = [];
163
+ try {
164
+ for await (const entry of extract) {
165
+ const header = entry.header;
166
+ const name = entryName(header.name);
167
+ const dst = name === '' ? dir : path_1.default.join(dir, ...name.split('/'));
168
+ const mode = (header.mode ?? 0o644) & 0o7777;
169
+ if (header.type === 'file' || header.type === 'contiguous-file') {
170
+ if (name === '')
171
+ throw new Error('the tar has a file entry for its own folder');
172
+ await makeDirs(dir, path_1.default.posix.dirname(name));
173
+ await writeEntry(dst, entry, mode, header.mtime);
174
+ continue;
175
+ }
176
+ entry.resume();
177
+ if (name === '')
178
+ continue;
179
+ if (header.type === 'directory') {
180
+ await makeDirs(dir, name);
181
+ folders.push({ path: dst, mode, mtime: header.mtime });
182
+ }
183
+ else if (header.type === 'symlink') {
184
+ if (!header.linkname)
185
+ throw new Error(`the tar has a symlink "${name}" without a target`);
186
+ links.push({ name, target: header.linkname });
187
+ }
188
+ }
189
+ }
190
+ finally {
191
+ input.unpipe(extract);
192
+ input.destroy();
193
+ }
194
+ for (const link of links) {
195
+ await makeDirs(dir, path_1.default.posix.dirname(link.name));
196
+ const dst = path_1.default.join(dir, ...link.name.split('/'));
197
+ await removeEntry(dst);
198
+ await fs_1.default.promises.symlink(link.target, dst);
199
+ }
200
+ // Folders get their modes and times last: writing into them changes their times, and a
201
+ // read-only folder could not be written into.
202
+ for (const folder of folders.reverse()) {
203
+ await fs_1.default.promises.chmod(folder.path, folder.mode | 0o700);
204
+ if (folder.mtime)
205
+ await fs_1.default.promises.utimes(folder.path, folder.mtime, folder.mtime).catch(() => { });
206
+ }
207
+ }
208
+ /** entryName returns an entry's name as a clean relative slash path, '' for the folder itself. */
209
+ function entryName(raw) {
210
+ if (raw.startsWith('/') || path_1.default.isAbsolute(raw) || /^[A-Za-z]:/.test(raw)) {
211
+ throw new Error(`the tar has an absolute entry "${raw}"`);
212
+ }
213
+ const parts = raw.split('/');
214
+ if (parts.includes('..') || raw.includes('\\'))
215
+ throw new Error(`the tar has an entry outside its folder: "${raw}"`);
216
+ return parts.filter((part) => part !== '' && part !== '.').join('/');
217
+ }
218
+ /** makeDirs creates the folders of `rel` under `root` one at a time, refusing links and files. */
219
+ async function makeDirs(root, rel) {
220
+ if (rel === '' || rel === '.')
221
+ return;
222
+ let current = root;
223
+ for (const part of rel.split('/')) {
224
+ current = path_1.default.join(current, part);
225
+ const stat = await fs_1.default.promises.lstat(current).catch((err) => {
226
+ if (err.code === 'ENOENT')
227
+ return null;
228
+ throw err;
229
+ });
230
+ if (!stat) {
231
+ await fs_1.default.promises.mkdir(current, 0o755);
232
+ }
233
+ else if (stat.isSymbolicLink()) {
234
+ throw new Error(`refusing to write through the symlink ${current}`);
235
+ }
236
+ else if (!stat.isDirectory()) {
237
+ throw new Error(`${current} is a file, not a folder`);
238
+ }
239
+ }
240
+ }
241
+ /** removeEntry removes a file or symlink so a new entry replaces it rather than writing through it. */
242
+ async function removeEntry(dst) {
243
+ const stat = await fs_1.default.promises.lstat(dst).catch((err) => {
244
+ if (err.code === 'ENOENT')
245
+ return null;
246
+ throw err;
247
+ });
248
+ if (!stat)
249
+ return;
250
+ if (stat.isDirectory())
251
+ throw new Error(`${dst} is a folder, not a file`);
252
+ await fs_1.default.promises.rm(dst);
253
+ }
254
+ async function writeEntry(dst, chunks, mode, mtime) {
255
+ await removeEntry(dst);
256
+ // 'wx' fails rather than follow a symlink that appeared at dst.
257
+ const handle = await fs_1.default.promises.open(dst, 'wx', mode | 0o200);
258
+ try {
259
+ for await (const chunk of chunks)
260
+ await handle.write(chunk);
261
+ }
262
+ finally {
263
+ await handle.close();
264
+ }
265
+ if ((mode & 0o200) === 0)
266
+ await fs_1.default.promises.chmod(dst, mode);
267
+ if (mtime)
268
+ await fs_1.default.promises.utimes(dst, mtime, mtime).catch(() => { });
269
+ }
270
+ //# sourceMappingURL=file-transfer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-transfer.js","sourceRoot":"","sources":["../src/internal/file-transfer.ts"],"names":[],"mappings":";;;AAyBA,8BAEC;AAMD,4BAuCC;AAeD,gCAiBC;AAOD,0CAoCC;AA8BD,8BA8CC;;AA/ND,oDAAoB;AACpB,wDAAwB;AACxB,mCAAkC;AAClC,mDAA6B;AAC7B,8DAAwC;AAExC,0DAAuD;AAEvD,+DAA+D;AAClD,QAAA,gBAAgB,GAAG,mBAAmB,CAAC;AAEpD;;;;GAIG;AACU,QAAA,kBAAkB,GAAG,sBAAsB,CAAC;AAEzD,yEAAyE;AACzE,MAAM,YAAY,GAAI,IAAY,CAAC,kBAEtB,CAAC;AACd,MAAM,cAAc,GAAI,IAAY,CAAC,oBAAkE,CAAC;AAExG,0GAA0G;AAC1G,SAAgB,SAAS;IACvB,OAAO,cAAc,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,aAAa,CAAC;AACzE,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,QAAQ,CAC5B,GAAW,EACX,KAAa,EACb,SAAiB,EACjB,QAAiB;IAEjB,MAAM,IAAI,GAAG,CAAC,MAAM,YAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IACtD,MAAM,IAAI,GAAG,YAAE,C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