@openclaw/fs-safe 0.15.0 → 0.16.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 (184) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +28 -6
  3. package/dist/advanced.d.ts +1 -0
  4. package/dist/advanced.d.ts.map +1 -1
  5. package/dist/advanced.js +1 -0
  6. package/dist/archive-kind.d.ts +0 -1
  7. package/dist/archive-kind.d.ts.map +1 -1
  8. package/dist/archive-kind.js +5 -17
  9. package/dist/archive-parser.wasm +0 -0
  10. package/dist/archive-read.d.ts.map +1 -1
  11. package/dist/archive-read.js +6 -7
  12. package/dist/archive-tar-stream.d.ts +3 -0
  13. package/dist/archive-tar-stream.d.ts.map +1 -1
  14. package/dist/archive-tar-stream.js +56 -37
  15. package/dist/archive-tar-wasm.d.ts +16 -4
  16. package/dist/archive-tar-wasm.d.ts.map +1 -1
  17. package/dist/archive-tar-wasm.js +134 -34
  18. package/dist/archive.d.ts.map +1 -1
  19. package/dist/archive.js +5 -6
  20. package/dist/clone-metadata.d.ts +1 -0
  21. package/dist/clone-metadata.d.ts.map +1 -1
  22. package/dist/clone-metadata.js +6 -2
  23. package/dist/create-directory.d.ts +20 -0
  24. package/dist/create-directory.d.ts.map +1 -0
  25. package/dist/create-directory.js +130 -0
  26. package/dist/create-file-async.d.ts +7 -0
  27. package/dist/create-file-async.d.ts.map +1 -0
  28. package/dist/create-file-async.js +121 -0
  29. package/dist/create-file.d.ts +8 -0
  30. package/dist/create-file.d.ts.map +1 -0
  31. package/dist/create-file.js +190 -0
  32. package/dist/create-owned-file.d.ts +8 -0
  33. package/dist/create-owned-file.d.ts.map +1 -0
  34. package/dist/create-owned-file.js +16 -0
  35. package/dist/create.d.ts +4 -0
  36. package/dist/create.d.ts.map +1 -0
  37. package/dist/create.js +2 -0
  38. package/dist/creation-darwin.d.ts +7 -0
  39. package/dist/creation-darwin.d.ts.map +1 -0
  40. package/dist/creation-darwin.js +79 -0
  41. package/dist/creation-file-state.d.ts +19 -0
  42. package/dist/creation-file-state.d.ts.map +1 -0
  43. package/dist/creation-file-state.js +118 -0
  44. package/dist/creation-path.d.ts +21 -0
  45. package/dist/creation-path.d.ts.map +1 -0
  46. package/dist/creation-path.js +71 -0
  47. package/dist/creation-permissions.d.ts +19 -0
  48. package/dist/creation-permissions.d.ts.map +1 -0
  49. package/dist/creation-permissions.js +125 -0
  50. package/dist/directory-durability.d.ts +1 -1
  51. package/dist/directory-durability.d.ts.map +1 -1
  52. package/dist/directory-durability.js +22 -80
  53. package/dist/directory-guard.d.ts +3 -0
  54. package/dist/directory-guard.d.ts.map +1 -1
  55. package/dist/directory-mode-node.d.ts +2 -0
  56. package/dist/directory-mode-node.d.ts.map +1 -1
  57. package/dist/directory-mode-node.js +8 -0
  58. package/dist/directory-receipt.d.ts +24 -0
  59. package/dist/directory-receipt.d.ts.map +1 -0
  60. package/dist/directory-receipt.js +127 -0
  61. package/dist/file-cleanup.d.ts +19 -0
  62. package/dist/file-cleanup.d.ts.map +1 -0
  63. package/dist/file-cleanup.js +78 -0
  64. package/dist/file-observation.d.ts +1 -1
  65. package/dist/file-observation.d.ts.map +1 -1
  66. package/dist/file-store-boundary.d.ts +2 -6
  67. package/dist/file-store-boundary.d.ts.map +1 -1
  68. package/dist/file-store-boundary.js +3 -9
  69. package/dist/file-store-sync-write.d.ts.map +1 -1
  70. package/dist/file-store-sync-write.js +2 -5
  71. package/dist/guarded-mkdir.d.ts +1 -0
  72. package/dist/guarded-mkdir.d.ts.map +1 -1
  73. package/dist/guarded-mkdir.js +36 -7
  74. package/dist/move-path.js +1 -1
  75. package/dist/native-binding.d.ts +11 -1
  76. package/dist/native-binding.d.ts.map +1 -1
  77. package/dist/native-fallback-warning.d.ts +4 -0
  78. package/dist/native-fallback-warning.d.ts.map +1 -0
  79. package/dist/native-fallback-warning.js +11 -0
  80. package/dist/native-operations.d.ts +0 -2
  81. package/dist/native-operations.d.ts.map +1 -1
  82. package/dist/native-operations.js +0 -24
  83. package/dist/native-parent-admission.d.ts +2 -0
  84. package/dist/native-parent-admission.d.ts.map +1 -1
  85. package/dist/native-parent-admission.js +3 -2
  86. package/dist/native-pinned-write-windows.d.ts +1 -1
  87. package/dist/native-pinned-write-windows.d.ts.map +1 -1
  88. package/dist/native-pinned-write-windows.js +173 -28
  89. package/dist/native-pinned-write.d.ts.map +1 -1
  90. package/dist/native-pinned-write.js +19 -3
  91. package/dist/native-policy-parent-windows.d.ts.map +1 -1
  92. package/dist/native-policy-parent-windows.js +15 -6
  93. package/dist/native-staged-file.d.ts +3 -2
  94. package/dist/native-staged-file.d.ts.map +1 -1
  95. package/dist/native-staged-file.js +86 -39
  96. package/dist/owner-dacl.d.ts.map +1 -1
  97. package/dist/owner-dacl.js +10 -4
  98. package/dist/pinned-write-input.d.ts +4 -0
  99. package/dist/pinned-write-input.d.ts.map +1 -0
  100. package/dist/pinned-write-input.js +25 -0
  101. package/dist/pinned-write-mode.d.ts +5 -0
  102. package/dist/pinned-write-mode.d.ts.map +1 -0
  103. package/dist/pinned-write-mode.js +24 -0
  104. package/dist/pinned-write-staged.d.ts +6 -0
  105. package/dist/pinned-write-staged.d.ts.map +1 -0
  106. package/dist/pinned-write-staged.js +187 -0
  107. package/dist/pinned-write-types.d.ts +3 -0
  108. package/dist/pinned-write-types.d.ts.map +1 -1
  109. package/dist/pinned-write.d.ts.map +1 -1
  110. package/dist/pinned-write.js +35 -145
  111. package/dist/private-directory.d.ts.map +1 -1
  112. package/dist/private-directory.js +18 -4
  113. package/dist/private-producer-handoff-sync.d.ts +14 -0
  114. package/dist/private-producer-handoff-sync.d.ts.map +1 -0
  115. package/dist/private-producer-handoff-sync.js +114 -0
  116. package/dist/private-producer-handoff.d.ts +22 -4
  117. package/dist/private-producer-handoff.d.ts.map +1 -1
  118. package/dist/private-producer-handoff.js +140 -77
  119. package/dist/publish-copy-stage.d.ts +2 -1
  120. package/dist/publish-copy-stage.d.ts.map +1 -1
  121. package/dist/publish-copy-stage.js +16 -7
  122. package/dist/publish-file.d.ts.map +1 -1
  123. package/dist/publish-file.js +2 -2
  124. package/dist/replace-file-temp-owner.d.ts +0 -7
  125. package/dist/replace-file-temp-owner.d.ts.map +1 -1
  126. package/dist/replace-file-temp-owner.js +3 -54
  127. package/dist/root-create-input.d.ts +2 -1
  128. package/dist/root-create-input.d.ts.map +1 -1
  129. package/dist/root-create-input.js +13 -4
  130. package/dist/root-directory-creation.d.ts +3 -3
  131. package/dist/root-directory-creation.d.ts.map +1 -1
  132. package/dist/root-directory-creation.js +15 -3
  133. package/dist/root-impl.d.ts.map +1 -1
  134. package/dist/root-impl.js +28 -7
  135. package/dist/root-move-noreplace.d.ts.map +1 -1
  136. package/dist/root-move-noreplace.js +22 -13
  137. package/dist/root-options.d.ts +12 -4
  138. package/dist/root-options.d.ts.map +1 -1
  139. package/dist/root-path-stat.d.ts.map +1 -1
  140. package/dist/root-path-stat.js +59 -7
  141. package/dist/root-write-publication.js +1 -1
  142. package/dist/secret-file.d.ts.map +1 -1
  143. package/dist/secret-file.js +1 -0
  144. package/dist/secure-file-windows.d.ts +6 -0
  145. package/dist/secure-file-windows.d.ts.map +1 -1
  146. package/dist/secure-file-windows.js +34 -117
  147. package/dist/secure-file.js +2 -2
  148. package/dist/sidecar-lock-root.d.ts.map +1 -1
  149. package/dist/sidecar-lock-root.js +2 -1
  150. package/dist/staged-directory.d.ts.map +1 -1
  151. package/dist/staged-directory.js +6 -6
  152. package/dist/staged-file-settlement.d.ts +17 -0
  153. package/dist/staged-file-settlement.d.ts.map +1 -0
  154. package/dist/staged-file-settlement.js +57 -0
  155. package/dist/windows-owner.d.ts.map +1 -1
  156. package/dist/windows-owner.js +2 -1
  157. package/dist/windows-security-bridge.cs +336 -0
  158. package/dist/windows-security-bridge.ps1 +15 -0
  159. package/dist/windows-security-command.d.ts +26 -0
  160. package/dist/windows-security-command.d.ts.map +1 -0
  161. package/dist/windows-security-command.js +363 -0
  162. package/dist/windows-security-facts.d.ts +6 -0
  163. package/dist/windows-security-facts.d.ts.map +1 -0
  164. package/dist/windows-security-facts.js +108 -0
  165. package/docs/advanced.md +3 -1
  166. package/docs/archive.md +61 -37
  167. package/docs/config.md +6 -2
  168. package/docs/contributing.md +44 -4
  169. package/docs/copy.md +2 -0
  170. package/docs/creation.md +128 -0
  171. package/docs/durability.md +24 -0
  172. package/docs/install.md +31 -7
  173. package/docs/migrating-to-0.5.md +15 -6
  174. package/docs/migrating-to-0.6.md +9 -4
  175. package/docs/native-helper.md +22 -9
  176. package/docs/native.md +38 -7
  177. package/docs/permissions.md +37 -14
  178. package/docs/root.md +34 -0
  179. package/docs/secret-file.md +11 -2
  180. package/docs/secure-file.md +9 -4
  181. package/docs/sidecar-lock.md +5 -4
  182. package/docs/staged-file.md +5 -0
  183. package/docs/writing.md +71 -5
  184. package/package.json +18 -15
@@ -0,0 +1,190 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import fs, {} from "node:fs";
3
+ import fsAsync, {} from "node:fs/promises";
4
+ import path from "node:path";
5
+ import { createDirectoryWithReceiptSync } from "./create-directory.js";
6
+ import { ownFileDescriptorSync } from "./create-owned-file.js";
7
+ import { assertDirectoryIdentitySync } from "./directory-guard.js";
8
+ import { FsSafeError } from "./errors.js";
9
+ import { assertSynchronousCallbackResult } from "./mutation-authority.js";
10
+ import { assertPrivateFileCreationAvailable, inspectCreationDirectorySync, protectCreatedFileSync, resolveCreationPermissions, verifyCreatedFileSync, } from "./creation-permissions.js";
11
+ import { creationCollision, prepareCreationPath, removeCreationDirectory } from "./creation-path.js";
12
+ import { handoffCreatedFileSync } from "./private-producer-handoff-sync.js";
13
+ import { resolveReadOpenFlags } from "./read-open-flags.js";
14
+ import { assertCreationFile, assertPrivateCreationFile, creationPublicationAfterFailure, privateFileSettlementFailure, rethrowPrivateStageCreationFailure, removeRecordedCreationFileSync, } from "./creation-file-state.js";
15
+ import { createPrivateWindowsFileHandle } from "./create-file-async.js";
16
+ import { assertDarwinCreationDirectoryAcl } from "./creation-darwin.js";
17
+ function createPrivateWindowsFile(selected, options, mode) {
18
+ const assertion = options.assertBeforeMutation;
19
+ if (fs.lstatSync(selected.target, { throwIfNoEntry: false })) {
20
+ throw new FsSafeError("already-exists", "creation target already exists");
21
+ }
22
+ const parentIdentity = inspectCreationDirectorySync(selected.parent.dir, false);
23
+ selected.assertParent();
24
+ const stageDirectory = path.join(selected.parent.dir, `.fs-safe-create-${randomUUID()}`);
25
+ let stage;
26
+ try {
27
+ stage = createDirectoryWithReceiptSync(stageDirectory, { private: true, assertBeforeMutation: assertion }, {
28
+ expectedParentIdentity: selected.parent.stat,
29
+ });
30
+ }
31
+ catch (error) {
32
+ rethrowPrivateStageCreationFailure(error, selected.target, stageDirectory);
33
+ }
34
+ const stageIdentity = stage.windowsIdentity;
35
+ const stagePath = path.join(stageDirectory, "file");
36
+ const assertStage = () => {
37
+ selected.assertParent();
38
+ assertDirectoryIdentitySync(stageDirectory, stage.stat);
39
+ };
40
+ let file;
41
+ let identity;
42
+ let windowsIdentity;
43
+ let publication = "not-published";
44
+ try {
45
+ if (inspectCreationDirectorySync(stageDirectory, true) !== stageIdentity) {
46
+ throw new FsSafeError("path-mismatch", "private staging directory changed before file creation");
47
+ }
48
+ assertSynchronousCallbackResult(assertion?.(), "assertBeforeMutation");
49
+ assertStage();
50
+ file = ownFileDescriptorSync(fs.openSync(stagePath, fs.constants.O_RDWR | fs.constants.O_CREAT |
51
+ fs.constants.O_EXCL | resolveReadOpenFlags(), 0o600));
52
+ identity = assertCreationFile(file.fd, stagePath);
53
+ // The inherited ACL must already be restrictive. This freezes that policy;
54
+ // the bridge refuses to repair broad access on an exposed file.
55
+ assertSynchronousCallbackResult(assertion?.(), "assertBeforeMutation");
56
+ assertStage();
57
+ assertCreationFile(file.fd, stagePath, identity);
58
+ windowsIdentity = protectCreatedFileSync(file.fd, stagePath, stageIdentity);
59
+ assertStage();
60
+ file = handoffCreatedFileSync({
61
+ source: file, sourcePath: stagePath, targetPath: selected.target, identity,
62
+ assertSourceParent: assertStage, assertTargetParent: selected.assertParent,
63
+ assertBeforeMutation: assertion,
64
+ verifyDescriptor: (fd, pathname, links) => verifyCreatedFileSync(fd, pathname, windowsIdentity, pathname === stagePath ? stageIdentity : parentIdentity, links),
65
+ onPublished: () => { publication = "published"; },
66
+ });
67
+ // Windows may clear the read-only attribute while retiring the stage name.
68
+ // Finalize it only after the published-name descriptor owns the file.
69
+ fs.fchmodSync(file.fd, mode);
70
+ selected.assertParent();
71
+ identity = assertCreationFile(file.fd, selected.target, identity);
72
+ verifyCreatedFileSync(file.fd, selected.target, windowsIdentity, parentIdentity);
73
+ removeCreationDirectory(stageDirectory, stage.stat, selected.assertParent);
74
+ return file;
75
+ }
76
+ catch (primary) {
77
+ publication = creationPublicationAfterFailure(primary, publication);
78
+ const cleanup = [];
79
+ if (file) {
80
+ try {
81
+ file.close();
82
+ }
83
+ catch (error) {
84
+ cleanup.push(error);
85
+ }
86
+ }
87
+ if (publication !== "indeterminate") {
88
+ if (identity) {
89
+ try {
90
+ removeRecordedCreationFileSync(stagePath, identity, assertStage);
91
+ }
92
+ catch (error) {
93
+ cleanup.push(error);
94
+ }
95
+ }
96
+ try {
97
+ removeCreationDirectory(stageDirectory, stage.stat, selected.assertParent);
98
+ }
99
+ catch (error) {
100
+ cleanup.push(error);
101
+ }
102
+ }
103
+ if (publication === "not-published" && cleanup.length === 0)
104
+ throw creationCollision(primary);
105
+ throw privateFileSettlementFailure({ primary, cleanup, publication, path: selected.target, stageDirectory });
106
+ }
107
+ }
108
+ function createFileCore(targetPath, options, admission) {
109
+ const permissions = resolveCreationPermissions(options, false);
110
+ const assertion = options.assertBeforeMutation;
111
+ const selected = prepareCreationPath(targetPath, admission.expectedParentIdentity);
112
+ if (permissions.private && process.platform === "win32") {
113
+ assertPrivateFileCreationAvailable();
114
+ return createPrivateWindowsFile(selected, { ...permissions, assertBeforeMutation: assertion }, permissions.mode);
115
+ }
116
+ if (permissions.private)
117
+ assertDarwinCreationDirectoryAcl(selected.parent.dir, selected.parent.stat, "file");
118
+ assertSynchronousCallbackResult(assertion?.(), "assertBeforeMutation");
119
+ selected.assertParent();
120
+ if (permissions.private)
121
+ assertDarwinCreationDirectoryAcl(selected.parent.dir, selected.parent.stat, "file");
122
+ let file;
123
+ try {
124
+ file = ownFileDescriptorSync(fs.openSync(selected.target, fs.constants.O_RDWR | fs.constants.O_CREAT |
125
+ fs.constants.O_EXCL | resolveReadOpenFlags(), permissions.mode ?? 0o666));
126
+ }
127
+ catch (error) {
128
+ throw creationCollision(error);
129
+ }
130
+ try {
131
+ const identity = assertCreationFile(file.fd, selected.target);
132
+ selected.assertParent();
133
+ if (permissions.private)
134
+ assertPrivateCreationFile(identity, file.fd);
135
+ return file;
136
+ }
137
+ catch (primary) {
138
+ let failure = primary;
139
+ try {
140
+ file.close();
141
+ }
142
+ catch (closeError) {
143
+ failure = new AggregateError([primary, closeError], "created file admission and close failed");
144
+ }
145
+ throw new FsSafeError("helper-failed", "created file admission failed", {
146
+ cause: failure, details: { publication: { status: "published" }, path: selected.target, cleanup: "preserved" },
147
+ });
148
+ }
149
+ }
150
+ export function createFileSync(targetPath, options = {}) {
151
+ return createFileCore(targetPath, options, {});
152
+ }
153
+ /** Internal async writer; Windows preparation uses the nonblocking stage owner. */
154
+ export async function createFileHandle(targetPath, options = {}, admission = {}) {
155
+ const permissions = resolveCreationPermissions(options, false);
156
+ const assertion = options.assertBeforeMutation;
157
+ if (process.platform !== "win32" || !permissions.private) {
158
+ const selected = prepareCreationPath(targetPath, admission.expectedParentIdentity);
159
+ if (permissions.private)
160
+ assertDarwinCreationDirectoryAcl(selected.parent.dir, selected.parent.stat, "file");
161
+ assertSynchronousCallbackResult(assertion?.(), "assertBeforeMutation");
162
+ selected.assertParent();
163
+ if (permissions.private)
164
+ assertDarwinCreationDirectoryAcl(selected.parent.dir, selected.parent.stat, "file");
165
+ const handle = await fsAsync.open(selected.target, fs.constants.O_RDWR | fs.constants.O_CREAT |
166
+ fs.constants.O_EXCL | resolveReadOpenFlags(), permissions.mode ?? 0o666)
167
+ .catch(error => { throw creationCollision(error); });
168
+ try {
169
+ const identity = assertCreationFile(handle.fd, selected.target);
170
+ selected.assertParent();
171
+ if (permissions.private)
172
+ assertPrivateCreationFile(identity, handle.fd);
173
+ return handle;
174
+ }
175
+ catch (primary) {
176
+ let failure = primary;
177
+ try {
178
+ await handle.close();
179
+ }
180
+ catch (closeError) {
181
+ failure = new AggregateError([primary, closeError], "created file admission and close failed");
182
+ }
183
+ throw new FsSafeError("helper-failed", "created file handle admission failed", {
184
+ cause: failure, details: { publication: { status: "published" }, path: selected.target, cleanup: "preserved" },
185
+ });
186
+ }
187
+ }
188
+ assertPrivateFileCreationAvailable();
189
+ return await createPrivateWindowsFileHandle(prepareCreationPath(targetPath, admission.expectedParentIdentity), { mode: permissions.mode, assertBeforeMutation: assertion });
190
+ }
@@ -0,0 +1,8 @@
1
+ export type OwnedFileDescriptorSync = {
2
+ readonly fd: number;
3
+ close(): void;
4
+ [Symbol.dispose](): void;
5
+ };
6
+ /** Capture the descriptor's creator-owned closer before it can be reused. */
7
+ export declare function ownFileDescriptorSync(fd: number, closeFd?: (fd: number) => void): OwnedFileDescriptorSync;
8
+ //# sourceMappingURL=create-owned-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-owned-file.d.ts","sourceRoot":"","sources":["../src/create-owned-file.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,KAAK,IAAI,IAAI,CAAC;IACd,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;CAC1B,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAmB,GAC3C,uBAAuB,CAYzB"}
@@ -0,0 +1,16 @@
1
+ import fs from "node:fs";
2
+ /** Capture the descriptor's creator-owned closer before it can be reused. */
3
+ export function ownFileDescriptorSync(fd, closeFd = fs.closeSync) {
4
+ let open = true;
5
+ const owner = {
6
+ fd,
7
+ close() {
8
+ if (!open)
9
+ return;
10
+ open = false;
11
+ closeFd(fd);
12
+ },
13
+ [Symbol.dispose]() { owner.close(); },
14
+ };
15
+ return Object.freeze(owner);
16
+ }
@@ -0,0 +1,4 @@
1
+ export { createDirectory, createDirectorySync, createDirectoryWithAdmission, createDirectorySyncWithAdmission, type CreateDirectoryOptions, type CreationAdmission, } from "./create-directory.js";
2
+ export { createFileSync, createFileHandle, type CreateFileOptions } from "./create-file.js";
3
+ export type { OwnedFileDescriptorSync } from "./create-owned-file.js";
4
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAAE,mBAAmB,EACpC,4BAA4B,EAAE,gCAAgC,EAC9D,KAAK,sBAAsB,EAAE,KAAK,iBAAiB,GACpD,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC5F,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/create.js ADDED
@@ -0,0 +1,2 @@
1
+ export { createDirectory, createDirectorySync, createDirectoryWithAdmission, createDirectorySyncWithAdmission, } from "./create-directory.js";
2
+ export { createFileSync, createFileHandle } from "./create-file.js";
@@ -0,0 +1,7 @@
1
+ import { type BigIntStats } from "node:fs";
2
+ export declare function assertDarwinPrivateCreationAvailable(): void;
3
+ export declare function assertDarwinPrivateDirectoryMode(mode: number): void;
4
+ export declare function assertDarwinCreationAcl(fd: number, inheritanceTarget?: "file" | "directory"): void;
5
+ export declare function assertDarwinCreationDirectoryAcl(pathname: string, expected: BigIntStats, inheritanceTarget?: "file" | "directory"): void;
6
+ export declare function privateFileMutationAssertion(fd: number, assertion?: () => void): (() => void) | undefined;
7
+ //# sourceMappingURL=creation-darwin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creation-darwin.d.ts","sourceRoot":"","sources":["../src/creation-darwin.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAgB/C,wBAAgB,oCAAoC,IAAI,IAAI,CAE3D;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAInE;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAYlG;AAED,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,WAAW,GAChF,IAAI,CAqBN;AAED,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAMzG"}
@@ -0,0 +1,79 @@
1
+ import fs, {} from "node:fs";
2
+ import { inspectDirectoryIdentitySync } from "./directory-guard.js";
3
+ import { nodeDarwinDirectoryMetadataFlags, nodeDirectorySearchOnlyFlags } from "./directory-mode-node.js";
4
+ import { FsSafeError } from "./errors.js";
5
+ import { assertSynchronousCallbackResult } from "./mutation-authority.js";
6
+ import { getNativeBinding } from "./native.js";
7
+ import { inspectFileIdentitySync } from "./strict-file-identity.js";
8
+ function inspector() {
9
+ const native = getNativeBinding();
10
+ if (typeof native?.inspectDarwinAcl !== "function") {
11
+ throw new FsSafeError("helper-unavailable", "private Darwin creation requires native descriptor ACL inspection");
12
+ }
13
+ return native.inspectDarwinAcl.bind(native);
14
+ }
15
+ export function assertDarwinPrivateCreationAvailable() {
16
+ if (process.platform === "darwin")
17
+ inspector();
18
+ }
19
+ export function assertDarwinPrivateDirectoryMode(mode) {
20
+ if (process.platform === "darwin" && ((mode & ~process.umask()) & 0o500) === 0) {
21
+ throw new FsSafeError("helper-unavailable", "private Darwin directory ACL inspection requires owner read or search permission");
22
+ }
23
+ }
24
+ export function assertDarwinCreationAcl(fd, inheritanceTarget) {
25
+ if (process.platform !== "darwin")
26
+ return;
27
+ const inspect = inspector();
28
+ const state = inspect(fd, inheritanceTarget)?.state;
29
+ if (state === "present") {
30
+ throw new FsSafeError("insecure-permissions", inheritanceTarget
31
+ ? "private creation parent has inheritable Darwin ACL entries"
32
+ : "private creation object has Darwin ACL entries");
33
+ }
34
+ if (state !== "absent" && state !== "empty") {
35
+ throw new FsSafeError("helper-unavailable", "native Darwin ACL inspection returned incomplete facts");
36
+ }
37
+ }
38
+ export function assertDarwinCreationDirectoryAcl(pathname, expected, inheritanceTarget) {
39
+ if (process.platform !== "darwin")
40
+ return;
41
+ assertDarwinPrivateCreationAvailable();
42
+ let fd;
43
+ try {
44
+ fd = fs.openSync(pathname, nodeDarwinDirectoryMetadataFlags());
45
+ }
46
+ catch (error) {
47
+ if (error.code !== "EACCES")
48
+ throw error;
49
+ const search = nodeDirectorySearchOnlyFlags();
50
+ if (!search)
51
+ throw error;
52
+ try {
53
+ fd = fs.openSync(pathname, search.flags | fs.constants.O_DIRECTORY | fs.constants.O_NOFOLLOW | fs.constants.O_NONBLOCK);
54
+ }
55
+ catch (cause) {
56
+ if (cause.code !== "EACCES")
57
+ throw cause;
58
+ throw new FsSafeError("helper-unavailable", "private Darwin directory ACL inspection requires owner read or search permission", { cause });
59
+ }
60
+ }
61
+ try {
62
+ const opened = inspectFileIdentitySync(() => fs.fstatSync(fd, { bigint: true }), expected);
63
+ if (!opened.isDirectory())
64
+ throw new FsSafeError("path-mismatch", "ACL target is not the admitted directory");
65
+ assertDarwinCreationAcl(fd, inheritanceTarget);
66
+ inspectDirectoryIdentitySync(pathname, expected);
67
+ }
68
+ finally {
69
+ fs.closeSync(fd);
70
+ }
71
+ }
72
+ export function privateFileMutationAssertion(fd, assertion) {
73
+ if (process.platform !== "darwin")
74
+ return assertion;
75
+ return () => {
76
+ assertSynchronousCallbackResult(assertion?.(), "assertBeforeMutation");
77
+ assertDarwinCreationAcl(fd);
78
+ };
79
+ }
@@ -0,0 +1,19 @@
1
+ import { type BigIntStats } from "node:fs";
2
+ import { FsSafeError } from "./errors.js";
3
+ export type CreationPublicationStatus = "not-published" | "published" | "indeterminate";
4
+ export declare function assertCreationFile(fd: number, pathname: string, expected?: BigIntStats): BigIntStats;
5
+ export declare function assertPrivateCreationFile(stat: BigIntStats, fd: number): void;
6
+ export declare function removeRecordedCreationFileSync(pathname: string, identity: BigIntStats, assertParent: () => void): void;
7
+ export declare function removeRecordedCreationFile(pathname: string, identity: BigIntStats, assertParent: () => void): Promise<void>;
8
+ export declare function creationPublicationAfterFailure(error: unknown, recorded: CreationPublicationStatus): CreationPublicationStatus;
9
+ export declare function hasPreservedCreationArtifacts(error: unknown): boolean;
10
+ export declare function rethrowPrivateStageCreationFailure(error: unknown, path: string, stageDirectory: string): never;
11
+ export declare function privateFileSettlementFailure(params: {
12
+ primary: unknown;
13
+ cleanup: readonly unknown[];
14
+ publication: CreationPublicationStatus;
15
+ path: string;
16
+ stageDirectory: string;
17
+ preserved?: boolean;
18
+ }): FsSafeError;
19
+ //# sourceMappingURL=creation-file-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creation-file-state.d.ts","sourceRoot":"","sources":["../src/creation-file-state.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1C,MAAM,MAAM,yBAAyB,GAAG,eAAe,GAAG,WAAW,GAAG,eAAe,CAAC;AAExF,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,WAAW,CAOpG;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAS7E;AAQD,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,GAAG,IAAI,CAUtH;AAED,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,GAChE,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,yBAAyB,GAClD,yBAAyB,CAO3B;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMrE;AAED,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,KAAK,CAuB9G;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;IAC5B,WAAW,EAAE,yBAAyB,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,WAAW,CAUd"}
@@ -0,0 +1,118 @@
1
+ import fs, {} from "node:fs";
2
+ import fsAsync from "node:fs/promises";
3
+ import { FsSafeError } from "./errors.js";
4
+ import { sameFileIdentityForCleanup } from "./file-identity.js";
5
+ import { inspectFileIdentitySync } from "./strict-file-identity.js";
6
+ import { hasUnsettledWindowsSecurityCommand } from "./windows-security-command.js";
7
+ import { assertDarwinCreationAcl } from "./creation-darwin.js";
8
+ export function assertCreationFile(fd, pathname, expected) {
9
+ const opened = inspectFileIdentitySync(() => fs.fstatSync(fd, { bigint: true }), expected);
10
+ const named = inspectFileIdentitySync(() => fs.lstatSync(pathname, { bigint: true }), opened);
11
+ if (!opened.isFile() || !named.isFile() || named.isSymbolicLink() || opened.nlink !== 1n || named.nlink !== 1n) {
12
+ throw new FsSafeError("path-mismatch", "created file is not the expected single-linked regular file");
13
+ }
14
+ return opened;
15
+ }
16
+ export function assertPrivateCreationFile(stat, fd) {
17
+ if (process.platform === "win32")
18
+ return;
19
+ if (typeof process.getuid !== "function" || stat.uid !== BigInt(process.getuid())) {
20
+ throw new FsSafeError("not-owned", "created private file must belong to the current user");
21
+ }
22
+ if ((stat.mode & 3647n) !== 0n) {
23
+ throw new FsSafeError("insecure-permissions", "created private file is not owner-only");
24
+ }
25
+ assertDarwinCreationAcl(fd);
26
+ }
27
+ function assertRecordedFile(current, identity) {
28
+ if (!current.isFile() || current.isSymbolicLink() || !sameFileIdentityForCleanup(current, identity)) {
29
+ throw new FsSafeError("path-mismatch", "created file cleanup preserved a replacement");
30
+ }
31
+ }
32
+ export function removeRecordedCreationFileSync(pathname, identity, assertParent) {
33
+ assertParent();
34
+ let current;
35
+ try {
36
+ current = fs.lstatSync(pathname, { bigint: true });
37
+ }
38
+ catch (error) {
39
+ if (error?.code === "ENOENT")
40
+ return;
41
+ throw error;
42
+ }
43
+ assertRecordedFile(current, identity);
44
+ fs.unlinkSync(pathname);
45
+ }
46
+ export async function removeRecordedCreationFile(pathname, identity, assertParent) {
47
+ assertParent();
48
+ let current;
49
+ try {
50
+ current = await fsAsync.lstat(pathname, { bigint: true });
51
+ }
52
+ catch (error) {
53
+ if (error?.code === "ENOENT")
54
+ return;
55
+ throw error;
56
+ }
57
+ assertParent();
58
+ assertRecordedFile(current, identity);
59
+ // Recheck after the awaited observation before dispatching the unlink.
60
+ assertRecordedFile(fs.lstatSync(pathname, { bigint: true }), identity);
61
+ await fsAsync.unlink(pathname);
62
+ }
63
+ export function creationPublicationAfterFailure(error, recorded) {
64
+ if (error instanceof FsSafeError) {
65
+ const publication = error.details?.publication;
66
+ if (publication && typeof publication === "object" && "status" in publication &&
67
+ publication.status === "indeterminate")
68
+ return "indeterminate";
69
+ }
70
+ return recorded;
71
+ }
72
+ export function hasPreservedCreationArtifacts(error) {
73
+ if (!(error instanceof FsSafeError))
74
+ return false;
75
+ if (error.details?.cleanup === "preserved" || error.details?.cleanup === "failed")
76
+ return true;
77
+ const publication = error.details?.publication;
78
+ return publication !== null && typeof publication === "object" && "status" in publication &&
79
+ (publication.status === "published" || publication.status === "indeterminate");
80
+ }
81
+ export function rethrowPrivateStageCreationFailure(error, path, stageDirectory) {
82
+ if (error instanceof FsSafeError && error.code === "already-exists") {
83
+ throw new FsSafeError("helper-failed", "private file staging path already exists", {
84
+ cause: error, details: { publication: { status: "not-published" }, path, stageDirectory },
85
+ });
86
+ }
87
+ const publication = error instanceof FsSafeError ? error.details?.publication : undefined;
88
+ const created = error instanceof FsSafeError && error.details?.path === stageDirectory &&
89
+ publication !== null && typeof publication === "object" && "status" in publication &&
90
+ publication.status === "published";
91
+ let unconfirmed = hasUnsettledWindowsSecurityCommand(error);
92
+ if (error !== null && (typeof error === "object" || typeof error === "function")) {
93
+ try {
94
+ const outcome = Object.getOwnPropertyDescriptor(error, "creationOutcome");
95
+ unconfirmed ||= Boolean(outcome && "value" in outcome && outcome.value === "unconfirmed");
96
+ }
97
+ catch {
98
+ unconfirmed = true;
99
+ }
100
+ }
101
+ if (created || unconfirmed) {
102
+ throw privateFileSettlementFailure({
103
+ primary: error, cleanup: [], publication: "not-published", path, stageDirectory, preserved: true,
104
+ });
105
+ }
106
+ throw error;
107
+ }
108
+ export function privateFileSettlementFailure(params) {
109
+ return new FsSafeError("helper-failed", "file creation or staging settlement failed", {
110
+ cause: params.cleanup.length
111
+ ? new AggregateError([params.primary, ...params.cleanup], "file creation and cleanup failed")
112
+ : params.primary,
113
+ details: {
114
+ publication: { status: params.publication }, path: params.path, stageDirectory: params.stageDirectory,
115
+ cleanup: params.preserved || params.publication === "indeterminate" ? "preserved" : params.cleanup.length ? "failed" : "removed",
116
+ },
117
+ });
118
+ }
@@ -0,0 +1,21 @@
1
+ import { type BigIntStats } from "node:fs";
2
+ import { type AsyncDirectoryGuard, type AnyAsyncDirectoryGuard } from "./directory-guard.js";
3
+ export type CreationParentIdentity = Readonly<{
4
+ dev: bigint;
5
+ ino: bigint;
6
+ realPath?: string;
7
+ }>;
8
+ export type CreationPath = {
9
+ target: string;
10
+ parent: AsyncDirectoryGuard<BigIntStats>;
11
+ assertParent(): void;
12
+ };
13
+ export declare function creationAdmissionFromParent(parent: AnyAsyncDirectoryGuard): {
14
+ expectedParentIdentity: CreationParentIdentity;
15
+ };
16
+ export declare function prepareCreationPath(input: string, expectedParent?: CreationParentIdentity): CreationPath;
17
+ export declare function creationCollision(error: unknown): unknown;
18
+ /** Remove only the recorded empty stage; never traverse a replaced directory. */
19
+ export declare function removeCreationDirectory(directory: string, identity: BigIntStats, assertParent: () => void): void;
20
+ export declare function removeCreationDirectoryAsync(directory: string, identity: BigIntStats, assertParent: () => void): Promise<void>;
21
+ //# sourceMappingURL=creation-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creation-path.d.ts","sourceRoot":"","sources":["../src/creation-path.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAM9B,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACzC,YAAY,IAAI,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,sBAAsB,GAAG;IAAE,sBAAsB,EAAE,sBAAsB,CAAA;CAAE,CAO9H;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,sBAAsB,GAAG,YAAY,CAuBxG;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKzD;AAED,iFAAiF;AACjF,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,GAAG,IAAI,CAQhH;AAED,wBAAsB,4BAA4B,CAChD,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,GACjE,OAAO,CAAC,IAAI,CAAC,CAQf"}
@@ -0,0 +1,71 @@
1
+ import fs, {} from "node:fs";
2
+ import fsAsync from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { assertDirectoryIdentitySync, inspectDirectoryIdentitySync, } from "./directory-guard.js";
5
+ import { FsSafeError } from "./errors.js";
6
+ import { assertNoNulPathInput } from "./path.js";
7
+ import { realpathSync } from "./realpath.js";
8
+ import { assertNoWindowsPathAlias, resolvePathPreservingWindowsRoot } from "./windows-path-alias.js";
9
+ export function creationAdmissionFromParent(parent) {
10
+ const { dev, ino } = parent.stat;
11
+ if (typeof dev !== "bigint" || typeof ino !== "bigint") {
12
+ throw new FsSafeError("path-mismatch", "private creation requires an exact parent identity");
13
+ }
14
+ const identity = inspectDirectoryIdentitySync(parent.dir, { dev, ino });
15
+ return { expectedParentIdentity: { dev: identity.dev, ino: identity.ino, realPath: parent.realPath } };
16
+ }
17
+ export function prepareCreationPath(input, expectedParent) {
18
+ expectedParent = expectedParent && { dev: expectedParent.dev, ino: expectedParent.ino, realPath: expectedParent.realPath };
19
+ assertNoNulPathInput(input);
20
+ assertNoWindowsPathAlias(input, "filesystem");
21
+ if (process.platform === "win32" && input.replaceAll("/", "\\").split("\\")
22
+ .some(component => component.endsWith(".") || component.endsWith(" "))) {
23
+ throw new FsSafeError("invalid-path", "creation path contains an ambiguous Windows component");
24
+ }
25
+ const target = resolvePathPreservingWindowsRoot(input);
26
+ const directory = path.dirname(target);
27
+ if (target === directory || input.length === 0) {
28
+ throw new FsSafeError("invalid-path", "creation requires a child name");
29
+ }
30
+ if (expectedParent)
31
+ assertDirectoryIdentitySync(directory, expectedParent);
32
+ const stat = inspectDirectoryIdentitySync(directory);
33
+ const realPath = realpathSync.native(directory);
34
+ const parent = { dir: directory, realPath, stat };
35
+ const assertParent = () => {
36
+ assertDirectoryIdentitySync(directory, { dev: stat.dev, ino: stat.ino, realPath });
37
+ if (expectedParent)
38
+ assertDirectoryIdentitySync(directory, expectedParent);
39
+ };
40
+ assertParent();
41
+ return { target, parent, assertParent };
42
+ }
43
+ export function creationCollision(error) {
44
+ if (error?.code === "EEXIST") {
45
+ return new FsSafeError("already-exists", "creation target already exists", { cause: error });
46
+ }
47
+ return error;
48
+ }
49
+ /** Remove only the recorded empty stage; never traverse a replaced directory. */
50
+ export function removeCreationDirectory(directory, identity, assertParent) {
51
+ assertParent();
52
+ try {
53
+ assertDirectoryIdentitySync(directory, identity);
54
+ fs.rmdirSync(directory);
55
+ }
56
+ catch (error) {
57
+ if (error?.code !== "ENOENT")
58
+ throw error;
59
+ }
60
+ }
61
+ export async function removeCreationDirectoryAsync(directory, identity, assertParent) {
62
+ assertParent();
63
+ try {
64
+ assertDirectoryIdentitySync(directory, identity);
65
+ await fsAsync.rmdir(directory);
66
+ }
67
+ catch (error) {
68
+ if (error?.code !== "ENOENT")
69
+ throw error;
70
+ }
71
+ }
@@ -0,0 +1,19 @@
1
+ export type CreationPermissions = {
2
+ private?: boolean;
3
+ mode?: number;
4
+ };
5
+ export declare function resolveCreationPermissions(options: CreationPermissions, directory: boolean): {
6
+ private: boolean;
7
+ mode: number | undefined;
8
+ };
9
+ export declare function assertPrivateFileCreationAvailable(): void;
10
+ /** Full Windows identity, with security validation when requested; no repairs. */
11
+ export declare function inspectCreationDirectorySync(targetPath: string, privatePath: boolean): string;
12
+ export declare function inspectCreationDirectory(targetPath: string, privatePath: boolean): Promise<string>;
13
+ export declare function assertPrivateDirectorySync(targetPath: string): void;
14
+ export declare function assertPrivateDirectory(targetPath: string): Promise<void>;
15
+ export declare function protectCreatedFileSync(fd: number, targetPath: string, parentIdentity: string): string;
16
+ export declare function protectCreatedFile(fd: number, targetPath: string, parentIdentity: string): Promise<string>;
17
+ export declare function verifyCreatedFileSync(fd: number, targetPath: string, identity: string, parentIdentity: string, links?: number): void;
18
+ export declare function verifyCreatedFile(fd: number, targetPath: string, identity: string, parentIdentity: string, links?: number): Promise<void>;
19
+ //# sourceMappingURL=creation-permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creation-permissions.d.ts","sourceRoot":"","sources":["../src/creation-permissions.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,mBAAmB,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,OAAO,GACjB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAehD;AAeD,wBAAgB,kCAAkC,IAAI,IAAI,CAOzD;AAOD,kFAAkF;AAClF,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CAQ7F;AAED,wBAAsB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxG;AAED,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAQnE;AAED,wBAAsB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ9E;AAED,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAOrG;AAED,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOhH;AAED,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,SAAI,GAClF,IAAI,CAQN;AAED,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,SAAI,GAClF,OAAO,CAAC,IAAI,CAAC,CAQf"}