@indigoai-us/hq-cloud 6.18.107 → 6.18.109

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 (118) hide show
  1. package/dist/bin/sync-runner-company.d.ts +1 -0
  2. package/dist/bin/sync-runner-company.d.ts.map +1 -1
  3. package/dist/bin/sync-runner-company.js +29 -8
  4. package/dist/bin/sync-runner-company.js.map +1 -1
  5. package/dist/bin/sync-runner-manifest.d.ts +27 -0
  6. package/dist/bin/sync-runner-manifest.d.ts.map +1 -1
  7. package/dist/bin/sync-runner-manifest.js +104 -0
  8. package/dist/bin/sync-runner-manifest.js.map +1 -1
  9. package/dist/bin/sync-runner-planning.d.ts +48 -0
  10. package/dist/bin/sync-runner-planning.d.ts.map +1 -1
  11. package/dist/bin/sync-runner-planning.js +140 -0
  12. package/dist/bin/sync-runner-planning.js.map +1 -1
  13. package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
  14. package/dist/bin/sync-runner-watch-loop.js +8 -2
  15. package/dist/bin/sync-runner-watch-loop.js.map +1 -1
  16. package/dist/bin/sync-runner.d.ts +1 -0
  17. package/dist/bin/sync-runner.d.ts.map +1 -1
  18. package/dist/bin/sync-runner.js +24 -1
  19. package/dist/bin/sync-runner.js.map +1 -1
  20. package/dist/cli/rescue-core.d.ts +64 -1
  21. package/dist/cli/rescue-core.d.ts.map +1 -1
  22. package/dist/cli/rescue-core.js +272 -125
  23. package/dist/cli/rescue-core.js.map +1 -1
  24. package/dist/cli/rescue-git.d.ts +47 -0
  25. package/dist/cli/rescue-git.d.ts.map +1 -0
  26. package/dist/cli/rescue-git.js +126 -0
  27. package/dist/cli/rescue-git.js.map +1 -0
  28. package/dist/cli/rescue-native-copy.d.ts +88 -0
  29. package/dist/cli/rescue-native-copy.d.ts.map +1 -0
  30. package/dist/cli/rescue-native-copy.js +823 -0
  31. package/dist/cli/rescue-native-copy.js.map +1 -0
  32. package/dist/cli/rescue-snapshot.d.ts +22 -0
  33. package/dist/cli/rescue-snapshot.d.ts.map +1 -1
  34. package/dist/cli/rescue-snapshot.js +27 -0
  35. package/dist/cli/rescue-snapshot.js.map +1 -1
  36. package/dist/cli/rescue.d.ts +21 -1
  37. package/dist/cli/rescue.d.ts.map +1 -1
  38. package/dist/cli/rescue.js +68 -2
  39. package/dist/cli/rescue.js.map +1 -1
  40. package/dist/cli/share.d.ts +14 -0
  41. package/dist/cli/share.d.ts.map +1 -1
  42. package/dist/cli/share.js +19 -8
  43. package/dist/cli/share.js.map +1 -1
  44. package/dist/cli/sync.d.ts +8 -0
  45. package/dist/cli/sync.d.ts.map +1 -1
  46. package/dist/cli/sync.js +5 -5
  47. package/dist/cli/sync.js.map +1 -1
  48. package/dist/cognito-auth.d.ts +57 -0
  49. package/dist/cognito-auth.d.ts.map +1 -1
  50. package/dist/cognito-auth.js +182 -3
  51. package/dist/cognito-auth.js.map +1 -1
  52. package/dist/ignore.d.ts +5 -1
  53. package/dist/ignore.d.ts.map +1 -1
  54. package/dist/ignore.js +32 -2
  55. package/dist/ignore.js.map +1 -1
  56. package/dist/index.d.ts +3 -2
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +6 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/manifest/leg-skip-store.d.ts +59 -0
  61. package/dist/manifest/leg-skip-store.d.ts.map +1 -0
  62. package/dist/manifest/leg-skip-store.js +140 -0
  63. package/dist/manifest/leg-skip-store.js.map +1 -0
  64. package/dist/manifest/upload-manifest.d.ts +11 -0
  65. package/dist/manifest/upload-manifest.d.ts.map +1 -1
  66. package/dist/manifest/upload-manifest.js +30 -1
  67. package/dist/manifest/upload-manifest.js.map +1 -1
  68. package/dist/manifest-folder-alias.d.ts +70 -0
  69. package/dist/manifest-folder-alias.d.ts.map +1 -0
  70. package/dist/manifest-folder-alias.js +139 -0
  71. package/dist/manifest-folder-alias.js.map +1 -0
  72. package/dist/manifest-reconcile.d.ts +5 -0
  73. package/dist/manifest-reconcile.d.ts.map +1 -1
  74. package/dist/manifest-reconcile.js +14 -2
  75. package/dist/manifest-reconcile.js.map +1 -1
  76. package/dist/outposts/billing.d.ts +0 -2
  77. package/dist/outposts/billing.d.ts.map +1 -1
  78. package/dist/outposts/billing.js +0 -2
  79. package/dist/outposts/billing.js.map +1 -1
  80. package/dist/outposts/cli-billing.d.ts +8 -2
  81. package/dist/outposts/cli-billing.d.ts.map +1 -1
  82. package/dist/outposts/cli-billing.js +13 -8
  83. package/dist/outposts/cli-billing.js.map +1 -1
  84. package/dist/outposts/client.d.ts +6 -3
  85. package/dist/outposts/client.d.ts.map +1 -1
  86. package/dist/outposts/client.js +12 -8
  87. package/dist/outposts/client.js.map +1 -1
  88. package/dist/outposts/command.d.ts +30 -0
  89. package/dist/outposts/command.d.ts.map +1 -1
  90. package/dist/outposts/command.js +79 -13
  91. package/dist/outposts/command.js.map +1 -1
  92. package/dist/outposts/company-outposts.d.ts +2 -2
  93. package/dist/outposts/company-outposts.d.ts.map +1 -1
  94. package/dist/outposts/company-outposts.js +5 -4
  95. package/dist/outposts/company-outposts.js.map +1 -1
  96. package/dist/outposts/hq-pro-routes.d.ts +15 -0
  97. package/dist/outposts/hq-pro-routes.d.ts.map +1 -0
  98. package/dist/outposts/hq-pro-routes.js +21 -0
  99. package/dist/outposts/hq-pro-routes.js.map +1 -0
  100. package/dist/outposts/index.d.ts +3 -1
  101. package/dist/outposts/index.d.ts.map +1 -1
  102. package/dist/outposts/index.js +2 -1
  103. package/dist/outposts/index.js.map +1 -1
  104. package/dist/outposts/sizes.d.ts +56 -0
  105. package/dist/outposts/sizes.d.ts.map +1 -0
  106. package/dist/outposts/sizes.js +120 -0
  107. package/dist/outposts/sizes.js.map +1 -0
  108. package/dist/outposts/types.d.ts +3 -0
  109. package/dist/outposts/types.d.ts.map +1 -1
  110. package/dist/outposts/types.js +0 -11
  111. package/dist/outposts/types.js.map +1 -1
  112. package/dist/sync/pull-scope.d.ts +1 -1
  113. package/dist/sync/pull-scope.d.ts.map +1 -1
  114. package/dist/sync/pull-scope.js +8 -3
  115. package/dist/sync/pull-scope.js.map +1 -1
  116. package/dist/types.d.ts +7 -0
  117. package/dist/types.d.ts.map +1 -1
  118. package/package.json +1 -1
@@ -0,0 +1,47 @@
1
+ /** Oldest git whose `clone` accepts `--filter=blob:none`. */
2
+ export declare const RESCUE_MIN_GIT_VERSION = "2.19";
3
+ /** Timeout for one `git --version` probe. */
4
+ export declare const GIT_VERSION_PROBE_TIMEOUT_MS = 10000;
5
+ export type RescueGitChoice =
6
+ /** Use PATH unchanged: its first git is new enough, or no version was readable. */
7
+ {
8
+ kind: "keep";
9
+ }
10
+ /** The first git is too old; `git` (later on PATH) is new enough. */
11
+ | {
12
+ kind: "pin";
13
+ git: string;
14
+ version: string;
15
+ skipped: string;
16
+ skippedVersion: string;
17
+ }
18
+ /** Every readable git on PATH is too old. `git` is the first one. */
19
+ | {
20
+ kind: "too-old";
21
+ git: string;
22
+ version: string;
23
+ };
24
+ /** Parse `git version 2.50.1 (Apple Git-155)` → `2.50.1`. */
25
+ export declare function parseGitVersion(output: string): string | null;
26
+ /** Whether a parsed `major.minor.patch` version supports `--filter=blob:none`. */
27
+ export declare function gitVersionIsSupported(version: string): boolean;
28
+ /** Every executable `git` on `pathValue`, once each, in PATH order. */
29
+ export declare function gitCandidatesOnPath(pathValue: string): string[];
30
+ /**
31
+ * Decide which git the rescue runs. `readVersion` is injectable for tests; it
32
+ * returns null when a candidate's version cannot be read. Windows keeps PATH
33
+ * unchanged: its git lookup also matches `git.exe`/`git.cmd`, so a candidate
34
+ * list built from bare `git` would be incomplete there.
35
+ */
36
+ export declare function chooseRescueGit(vars: NodeJS.ProcessEnv, readVersion?: (git: string) => string | null, platform?: NodeJS.Platform): RescueGitChoice;
37
+ /**
38
+ * Link `git` into `pinDir` and return a copy of `vars` whose PATH lists
39
+ * `pinDir` first. Nothing else on PATH changes order.
40
+ */
41
+ export declare function pinGitFirstOnPath(vars: NodeJS.ProcessEnv, pinDir: string, git: string): NodeJS.ProcessEnv;
42
+ /** What the rescue prints when no git on PATH is new enough. */
43
+ export declare function gitTooOldMessage(choice: {
44
+ git: string;
45
+ version: string;
46
+ }): string;
47
+ //# sourceMappingURL=rescue-git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rescue-git.d.ts","sourceRoot":"","sources":["../../src/cli/rescue-git.ts"],"names":[],"mappings":"AAoBA,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAI7C,6CAA6C;AAC7C,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD,MAAM,MAAM,eAAe;AACzB,mFAAmF;AACjF;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;AAClB,qEAAqE;GACnE;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE;AACxF,qEAAqE;GACnE;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD,6DAA6D;AAC7D,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI7D;AAED,kFAAkF;AAClF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAK9D;AAkBD,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAS/D;AAYD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,CAAC,UAAU,EACvB,WAAW,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAA0C,EACjF,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,eAAe,CAajB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,CAAC,UAAU,EACvB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV,MAAM,CAAC,UAAU,CAQnB;AAED,gEAAgE;AAChE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAUjF"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Git version preflight for `hq rescue`.
3
+ *
4
+ * The rescue clones the release with `git clone --filter=blob:none`, which
5
+ * needs git 2.19 or newer. A stale git earlier on PATH (a 2017
6
+ * `/usr/local/bin/git` 2.15 ahead of Apple's `/usr/bin/git`, say) used to fail
7
+ * the clone with `unknown option 'filter=blob:none'` and a usage dump.
8
+ *
9
+ * The rescue now checks the first git on PATH before it clones. When that git
10
+ * is too old but a supported one sits later on the same PATH, it links the
11
+ * supported git into a one-entry directory and puts that directory first, so
12
+ * only `git` moves and every other tool keeps its PATH order. This matches the
13
+ * HQ desktop app's Core update (indigoai-us/hq-desktop-app#1842). When no git
14
+ * on PATH is new enough, the rescue stops with a plain message and the same
15
+ * `git_too_old` failure kind the desktop app already reports.
16
+ */
17
+ import { spawnSync } from "child_process";
18
+ import * as fs from "fs";
19
+ import * as path from "path";
20
+ /** Oldest git whose `clone` accepts `--filter=blob:none`. */
21
+ export const RESCUE_MIN_GIT_VERSION = "2.19";
22
+ const MIN_GIT = [2, 19];
23
+ /** Timeout for one `git --version` probe. */
24
+ export const GIT_VERSION_PROBE_TIMEOUT_MS = 10_000;
25
+ /** Parse `git version 2.50.1 (Apple Git-155)` → `2.50.1`. */
26
+ export function parseGitVersion(output) {
27
+ const match = /git version (\d+)\.(\d+)(?:\.(\d+))?/.exec(output);
28
+ if (!match)
29
+ return null;
30
+ return [match[1], match[2], match[3] ?? "0"].join(".");
31
+ }
32
+ /** Whether a parsed `major.minor.patch` version supports `--filter=blob:none`. */
33
+ export function gitVersionIsSupported(version) {
34
+ const [major, minor] = version.split(".").map(Number);
35
+ if (major === undefined || minor === undefined)
36
+ return false;
37
+ if (!Number.isFinite(major) || !Number.isFinite(minor))
38
+ return false;
39
+ return major > MIN_GIT[0] || (major === MIN_GIT[0] && minor >= MIN_GIT[1]);
40
+ }
41
+ /** The PATH variable's actual key (Windows spells it `Path`) and value. */
42
+ function pathEntry(vars) {
43
+ const key = Object.keys(vars).find((name) => name.toUpperCase() === "PATH") ?? "PATH";
44
+ return { key, value: vars[key] ?? "" };
45
+ }
46
+ function isExecutableFile(candidate) {
47
+ try {
48
+ if (!fs.statSync(candidate).isFile())
49
+ return false;
50
+ fs.accessSync(candidate, fs.constants.X_OK);
51
+ return true;
52
+ }
53
+ catch {
54
+ return false;
55
+ }
56
+ }
57
+ /** Every executable `git` on `pathValue`, once each, in PATH order. */
58
+ export function gitCandidatesOnPath(pathValue) {
59
+ const out = [];
60
+ for (const dir of pathValue.split(path.delimiter)) {
61
+ if (!dir)
62
+ continue;
63
+ const candidate = path.join(dir, "git");
64
+ if (out.includes(candidate) || !isExecutableFile(candidate))
65
+ continue;
66
+ out.push(candidate);
67
+ }
68
+ return out;
69
+ }
70
+ function probeGitVersion(git, vars) {
71
+ const res = spawnSync(git, ["--version"], {
72
+ env: vars,
73
+ encoding: "utf-8",
74
+ timeout: GIT_VERSION_PROBE_TIMEOUT_MS,
75
+ });
76
+ if (res.error || res.status !== 0)
77
+ return null;
78
+ return parseGitVersion(res.stdout ?? "");
79
+ }
80
+ /**
81
+ * Decide which git the rescue runs. `readVersion` is injectable for tests; it
82
+ * returns null when a candidate's version cannot be read. Windows keeps PATH
83
+ * unchanged: its git lookup also matches `git.exe`/`git.cmd`, so a candidate
84
+ * list built from bare `git` would be incomplete there.
85
+ */
86
+ export function chooseRescueGit(vars, readVersion = (git) => probeGitVersion(git, vars), platform = process.platform) {
87
+ if (platform === "win32")
88
+ return { kind: "keep" };
89
+ const [first, ...rest] = gitCandidatesOnPath(pathEntry(vars).value);
90
+ if (!first)
91
+ return { kind: "keep" };
92
+ const firstVersion = readVersion(first);
93
+ if (firstVersion === null || gitVersionIsSupported(firstVersion))
94
+ return { kind: "keep" };
95
+ for (const git of rest) {
96
+ const version = readVersion(git);
97
+ if (version !== null && gitVersionIsSupported(version)) {
98
+ return { kind: "pin", git, version, skipped: first, skippedVersion: firstVersion };
99
+ }
100
+ }
101
+ return { kind: "too-old", git: first, version: firstVersion };
102
+ }
103
+ /**
104
+ * Link `git` into `pinDir` and return a copy of `vars` whose PATH lists
105
+ * `pinDir` first. Nothing else on PATH changes order.
106
+ */
107
+ export function pinGitFirstOnPath(vars, pinDir, git) {
108
+ fs.mkdirSync(pinDir, { recursive: true });
109
+ const link = path.join(pinDir, "git");
110
+ fs.rmSync(link, { force: true });
111
+ fs.symlinkSync(git, link);
112
+ const { key, value } = pathEntry(vars);
113
+ const rest = value.split(path.delimiter).filter((entry) => entry && entry !== pinDir);
114
+ return { ...vars, [key]: [pinDir, ...rest].join(path.delimiter) };
115
+ }
116
+ /** What the rescue prints when no git on PATH is new enough. */
117
+ export function gitTooOldMessage(choice) {
118
+ return (`error: updating HQ core needs Git ${RESCUE_MIN_GIT_VERSION} or newer, but the git on your PATH ` +
119
+ `(${choice.git}) is ${choice.version}.\n` +
120
+ " Install a newer Git (on a Mac: `xcode-select --install` or `brew install git`), " +
121
+ "or remove the old one from your PATH, then run the update again.\n" +
122
+ "HQ_RESCUE_FAILURE_KIND=git_too_old\n" +
123
+ `git_version=${choice.version}\n` +
124
+ `required_git_version=${RESCUE_MIN_GIT_VERSION}\n`);
125
+ }
126
+ //# sourceMappingURL=rescue-git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rescue-git.js","sourceRoot":"","sources":["../../src/cli/rescue-git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OA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B,IAAuB,EACvB,MAAc,EACd,GAAW;IAEX,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC1B,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC;IACtF,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;AACpE,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,gBAAgB,CAAC,MAAwC;IACvE,OAAO,CACL,qCAAqC,sBAAsB,sCAAsC;QACjG,IAAI,MAAM,CAAC,GAAG,QAAQ,MAAM,CAAC,OAAO,KAAK;QACzC,yFAAyF;QACzF,oEAAoE;QACpE,sCAAsC;QACtC,eAAe,MAAM,CAAC,OAAO,IAAI;QACjC,wBAAwB,sBAAsB,IAAI,CACnD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,88 @@
1
+ /** One `--include=`/`--exclude=` rule, in command-line order. */
2
+ export interface OverlayFilterRule {
3
+ include: boolean;
4
+ pattern: string;
5
+ }
6
+ /** A compiled pattern: does it match this path (relative, no leading slash)? */
7
+ type CompiledPattern = (rel: string, isDir: boolean) => boolean;
8
+ /**
9
+ * Compile one rsync `--include=`/`--exclude=` pattern, following rsync's
10
+ * `rule_matches`:
11
+ * - a trailing `/` matches directories only;
12
+ * - a leading `/` anchors the pattern at the transfer root;
13
+ * - a pattern with no `/` and no `**` matches the last path element;
14
+ * - any other unanchored pattern matches at a path-element boundary;
15
+ * - a pattern that starts with `**` and a slash also matches at the
16
+ * start of the path (rsync puts a slash in front of the name), so
17
+ * `**` + `/cache/` + `**` matches `cache/x`;
18
+ * - `dir/***` matches the directory `dir` itself and everything below it;
19
+ * - backslash escapes apply only when the pattern holds a wildcard
20
+ * (`*`, `?` or `[`); without one the pattern is compared literally.
21
+ */
22
+ export declare function compileRsyncPattern(rawPattern: string): CompiledPattern;
23
+ /** Whether one rsync filter pattern matches `rel`. See {@link compileRsyncPattern}. */
24
+ export declare function rsyncFilterRuleMatches(rawPattern: string, rel: string, isDir: boolean): boolean;
25
+ interface CompiledRule {
26
+ include: boolean;
27
+ matches: CompiledPattern;
28
+ }
29
+ /**
30
+ * Compile a filter list once for a whole walk. A run of plain anchored
31
+ * paths with the same action (the protect list holds one per unchanged
32
+ * file) becomes one set lookup; first-match order is unchanged because
33
+ * every rule in the run has the same action.
34
+ */
35
+ export declare function compileOverlayRules(rules: OverlayFilterRule[]): CompiledRule[];
36
+ /** Whether rsync's filter list admits this one entry (its parents admitted). */
37
+ export declare function overlayRulesAdmitEntry(rules: CompiledRule[], rel: string, isDir: boolean): boolean;
38
+ /** Options the built-in copy reads from the rsync argument vector. */
39
+ export interface NativeOverlayOptions {
40
+ rules: OverlayFilterRule[];
41
+ dryRun: boolean;
42
+ checksum: boolean;
43
+ times: boolean;
44
+ perms: boolean;
45
+ itemize: boolean;
46
+ }
47
+ /**
48
+ * Read the overlay options from an rsync argument vector, without the two
49
+ * trailing source/destination paths. Throws on an option the built-in copy
50
+ * does not implement, so a new rsync flag cannot be silently dropped.
51
+ */
52
+ export declare function nativeOverlayOptionsFromRsyncArgs(args: string[], readFile?: (file: string) => Buffer): NativeOverlayOptions;
53
+ /** Filesystem calls the built-in copy makes that tests may replace. */
54
+ export interface NativeOverlayOps {
55
+ symlink(target: string, destination: string, type: "file" | "dir"): void;
56
+ /** Defaults to `fs.renameSync`. */
57
+ rename?(from: string, to: string): void;
58
+ /** Defaults to a blocking wait. */
59
+ sleep?(ms: number): void;
60
+ }
61
+ /**
62
+ * Temp files are `<prefix><8 hex>` in the destination folder. The name is
63
+ * short so a long release file name cannot push it past the file system's
64
+ * name limit. Nothing else uses this prefix, so a file with exactly this
65
+ * shape is a leftover from a killed copy and is removed, never kept as a
66
+ * user file.
67
+ */
68
+ export declare const NATIVE_COPY_TEMP_PREFIX = ".hq-rescue-tmp-";
69
+ /**
70
+ * Waits between rename attempts on Windows, where Defender, the search
71
+ * indexer, OneDrive or an editor can hold a just-written file or its target
72
+ * for a moment (EPERM, EBUSY, EACCES). About 1.6 s in total.
73
+ */
74
+ export declare const WINDOWS_RENAME_RETRY_DELAYS_MS: number[];
75
+ export interface NativeOverlayResult {
76
+ status: number;
77
+ stdout: string;
78
+ stderr: string;
79
+ }
80
+ /**
81
+ * Copy `sourceRoot` onto `destinationRoot` as `rsync -a <args> src/ dst/`
82
+ * would. `args` is the rsync argument vector without the two paths. Returns
83
+ * rsync-style status: 0, 23 when some entries could not be copied (the rest
84
+ * were), or 1 when the copy could not start.
85
+ */
86
+ export declare function runNativeOverlay(sourceRoot: string, destinationRoot: string, args: string[], platform?: NodeJS.Platform, ops?: NativeOverlayOps): NativeOverlayResult;
87
+ export {};
88
+ //# sourceMappingURL=rescue-native-copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rescue-native-copy.d.ts","sourceRoot":"","sources":["../../src/cli/rescue-native-copy.ts"],"names":[],"mappings":"AA2CA,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAiGD,gFAAgF;AAChF,KAAK,eAAe,GAAG,CAAC,GAA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