@confect/cli 1.0.0-next.1 → 1.0.0-next.2

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 (53) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/FunctionPaths.mjs +3 -3
  3. package/dist/FunctionPaths.mjs.map +1 -1
  4. package/dist/cliApp.mjs +1 -1
  5. package/dist/confect/dev.mjs.map +1 -1
  6. package/dist/index.mjs +2 -3
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/package.mjs +6 -0
  9. package/dist/package.mjs.map +1 -0
  10. package/dist/services/ProjectRoot.mjs +2 -2
  11. package/dist/services/ProjectRoot.mjs.map +1 -1
  12. package/dist/utils.mjs +7 -7
  13. package/dist/utils.mjs.map +1 -1
  14. package/package.json +21 -18
  15. package/dist/_virtual/rolldown_runtime.mjs +0 -28
  16. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.mjs +0 -12
  17. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.mjs.map +0 -1
  18. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.mjs +0 -15
  19. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.mjs.map +0 -1
  20. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodePath.mjs +0 -25
  21. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodePath.mjs.map +0 -1
  22. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeRuntime.mjs +0 -12
  23. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeRuntime.mjs.map +0 -1
  24. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.mjs +0 -17
  25. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.mjs.map +0 -1
  26. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.mjs +0 -129
  27. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.mjs.map +0 -1
  28. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/error.mjs +0 -43
  29. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/error.mjs.map +0 -1
  30. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.mjs +0 -329
  31. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.mjs.map +0 -1
  32. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/path.mjs +0 -51
  33. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/path.mjs.map +0 -1
  34. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/runtime.mjs +0 -31
  35. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/runtime.mjs.map +0 -1
  36. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/sink.mjs +0 -24
  37. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/sink.mjs.map +0 -1
  38. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/stream.mjs +0 -91
  39. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/stream.mjs.map +0 -1
  40. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/terminal.mjs +0 -75
  41. package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/terminal.mjs.map +0 -1
  42. package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeContext.mjs +0 -21
  43. package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeContext.mjs.map +0 -1
  44. package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeFileSystem.mjs +0 -15
  45. package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeFileSystem.mjs.map +0 -1
  46. package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeRuntime.mjs +0 -15
  47. package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeRuntime.mjs.map +0 -1
  48. package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeWorker.mjs +0 -27
  49. package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeWorker.mjs.map +0 -1
  50. package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/internal/worker.mjs +0 -71
  51. package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/internal/worker.mjs.map +0 -1
  52. package/dist/packages/cli/package.mjs +0 -6
  53. package/dist/packages/cli/package.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeTerminal.mjs","names":["InternalTerminal.make","InternalTerminal.layer"],"sources":["../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.js"],"sourcesContent":["import * as InternalTerminal from \"./internal/terminal.js\";\n/**\n * @since 1.0.0\n * @category constructors\n */\nexport const make = InternalTerminal.make;\n/**\n * @since 1.0.0\n * @category layer\n */\nexport const layer = InternalTerminal.layer;\n//# sourceMappingURL=NodeTerminal.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAKA,MAAa,OAAOA;;;;;AAKpB,MAAa,QAAQC"}
@@ -1,129 +0,0 @@
1
- import { handleErrnoException } from "./error.mjs";
2
- import { fromReadable } from "./stream.mjs";
3
- import { fromWritable } from "./sink.mjs";
4
- import * as Effect from "effect/Effect";
5
- import { constUndefined, identity, pipe } from "effect/Function";
6
- import * as Layer from "effect/Layer";
7
- import * as Option from "effect/Option";
8
- import * as Stream from "effect/Stream";
9
- import * as Deferred from "effect/Deferred";
10
- import * as Inspectable from "effect/Inspectable";
11
- import * as FileSystem from "@effect/platform/FileSystem";
12
- import * as Sink from "effect/Sink";
13
- import * as Command from "@effect/platform/Command";
14
- import * as CommandExecutor from "@effect/platform/CommandExecutor";
15
- import * as ChildProcess from "node:child_process";
16
-
17
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js
18
- const inputToStdioOption = (stdin) => typeof stdin === "string" ? stdin : "pipe";
19
- const outputToStdioOption = (output) => typeof output === "string" ? output : "pipe";
20
- const toError = (err) => err instanceof globalThis.Error ? err : new globalThis.Error(String(err));
21
- const toPlatformError = (method, error, command) => {
22
- const flattened = Command.flatten(command).reduce((acc, curr) => {
23
- const command$1 = `${curr.command} ${curr.args.join(" ")}`;
24
- return acc.length === 0 ? command$1 : `${acc} | ${command$1}`;
25
- }, "");
26
- return handleErrnoException("Command", method)(error, [flattened]);
27
- };
28
- const ProcessProto = {
29
- [CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,
30
- ...Inspectable.BaseProto,
31
- toJSON() {
32
- return {
33
- _id: "@effect/platform/CommandExecutor/Process",
34
- pid: this.pid
35
- };
36
- }
37
- };
38
- const runCommand = (fileSystem) => (command) => {
39
- switch (command._tag) {
40
- case "StandardCommand": {
41
- const spawn = Effect.flatMap(Deferred.make(), (exitCode) => Effect.async((resume) => {
42
- const handle = ChildProcess.spawn(command.command, command.args, {
43
- stdio: [
44
- inputToStdioOption(command.stdin),
45
- outputToStdioOption(command.stdout),
46
- outputToStdioOption(command.stderr)
47
- ],
48
- cwd: Option.getOrElse(command.cwd, constUndefined),
49
- shell: command.shell,
50
- env: {
51
- ...process.env,
52
- ...Object.fromEntries(command.env)
53
- },
54
- detached: process.platform !== "win32"
55
- });
56
- handle.on("error", (err) => {
57
- resume(Effect.fail(toPlatformError("spawn", err, command)));
58
- });
59
- handle.on("exit", (...args) => {
60
- Deferred.unsafeDone(exitCode, Effect.succeed(args));
61
- });
62
- handle.on("spawn", () => {
63
- resume(Effect.succeed([handle, exitCode]));
64
- });
65
- return Effect.sync(() => {
66
- handle.kill("SIGTERM");
67
- });
68
- }));
69
- const killProcessGroup = process.platform === "win32" ? (handle, _) => Effect.async((resume) => {
70
- ChildProcess.exec(`taskkill /pid ${handle.pid} /T /F`, (error) => {
71
- if (error) resume(Effect.fail(toPlatformError("kill", toError(error), command)));
72
- else resume(Effect.void);
73
- });
74
- }) : (handle, signal) => Effect.try({
75
- try: () => process.kill(-handle.pid, signal),
76
- catch: (error) => toPlatformError("kill", toError(error), command)
77
- });
78
- const killProcess = (handle, signal) => Effect.suspend(() => handle.kill(signal) ? Effect.void : Effect.fail(toPlatformError("kill", new globalThis.Error("Failed to kill process"), command)));
79
- return pipe(Option.match(command.cwd, {
80
- onNone: () => Effect.void,
81
- onSome: (dir) => fileSystem.access(dir)
82
- }), Effect.zipRight(Effect.acquireRelease(spawn, ([handle, exitCode]) => Effect.flatMap(Deferred.isDone(exitCode), (done) => {
83
- if (!done) return killProcessGroup(handle, "SIGTERM").pipe(Effect.orElse(() => killProcess(handle, "SIGTERM")), Effect.zipRight(Deferred.await(exitCode)), Effect.ignore);
84
- return Effect.flatMap(Deferred.await(exitCode), ([code]) => {
85
- if (code !== 0 && code !== null) return killProcessGroup(handle, "SIGTERM").pipe(Effect.ignore);
86
- return Effect.void;
87
- });
88
- }))), Effect.map(([handle, exitCodeDeferred]) => {
89
- let stdin = Sink.drain;
90
- if (handle.stdin !== null) stdin = fromWritable(() => handle.stdin, (err) => toPlatformError("toWritable", toError(err), command));
91
- const exitCode = Effect.flatMap(Deferred.await(exitCodeDeferred), ([code, signal]) => {
92
- if (code !== null) return Effect.succeed(CommandExecutor.ExitCode(code));
93
- return Effect.fail(toPlatformError("exitCode", new globalThis.Error(`Process interrupted due to receipt of signal: ${signal}`), command));
94
- });
95
- const isRunning = Effect.negate(Deferred.isDone(exitCodeDeferred));
96
- const kill = (signal = "SIGTERM") => killProcessGroup(handle, signal).pipe(Effect.orElse(() => killProcess(handle, signal)), Effect.zipRight(Effect.asVoid(Deferred.await(exitCodeDeferred))));
97
- const pid = CommandExecutor.ProcessId(handle.pid);
98
- const stderr = fromReadable(() => handle.stderr, (err) => toPlatformError("fromReadable(stderr)", toError(err), command));
99
- let stdout = fromReadable(() => handle.stdout, (err) => toPlatformError("fromReadable(stdout)", toError(err), command));
100
- if (typeof command.stdout !== "string") stdout = Stream.transduce(stdout, command.stdout);
101
- return Object.assign(Object.create(ProcessProto), {
102
- pid,
103
- exitCode,
104
- isRunning,
105
- kill,
106
- stdin,
107
- stderr,
108
- stdout
109
- });
110
- }), typeof command.stdin === "string" ? identity : Effect.tap((process$1) => Effect.forkDaemon(Stream.run(command.stdin, process$1.stdin))));
111
- }
112
- case "PipedCommand": {
113
- const flattened = Command.flatten(command);
114
- if (flattened.length === 1) return pipe(flattened[0], runCommand(fileSystem));
115
- const head = flattened[0];
116
- const tail = flattened.slice(1);
117
- const initial = tail.slice(0, tail.length - 1);
118
- const last = tail[tail.length - 1];
119
- const stream = initial.reduce((stdin, command$1) => pipe(Command.stdin(command$1, stdin), runCommand(fileSystem), Effect.map((process$1) => process$1.stdout), Stream.unwrapScoped), pipe(runCommand(fileSystem)(head), Effect.map((process$1) => process$1.stdout), Stream.unwrapScoped));
120
- return pipe(Command.stdin(last, stream), runCommand(fileSystem));
121
- }
122
- }
123
- };
124
- /** @internal */
125
- const layer = /* @__PURE__ */ Layer.effect(CommandExecutor.CommandExecutor, /* @__PURE__ */ pipe(FileSystem.FileSystem, /* @__PURE__ */ Effect.map((fileSystem) => CommandExecutor.makeExecutor(runCommand(fileSystem)))));
126
-
127
- //#endregion
128
- export { layer };
129
- //# sourceMappingURL=commandExecutor.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandExecutor.mjs","names":["command","process"],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js"],"sourcesContent":["import * as Command from \"@effect/platform/Command\";\nimport * as CommandExecutor from \"@effect/platform/CommandExecutor\";\nimport * as FileSystem from \"@effect/platform/FileSystem\";\nimport * as Deferred from \"effect/Deferred\";\nimport * as Effect from \"effect/Effect\";\nimport { constUndefined, identity, pipe } from \"effect/Function\";\nimport * as Inspectable from \"effect/Inspectable\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Sink from \"effect/Sink\";\nimport * as Stream from \"effect/Stream\";\nimport * as ChildProcess from \"node:child_process\";\nimport { handleErrnoException } from \"./error.js\";\nimport { fromWritable } from \"./sink.js\";\nimport { fromReadable } from \"./stream.js\";\nconst inputToStdioOption = stdin => typeof stdin === \"string\" ? stdin : \"pipe\";\nconst outputToStdioOption = output => typeof output === \"string\" ? output : \"pipe\";\nconst toError = err => err instanceof globalThis.Error ? err : new globalThis.Error(String(err));\nconst toPlatformError = (method, error, command) => {\n const flattened = Command.flatten(command).reduce((acc, curr) => {\n const command = `${curr.command} ${curr.args.join(\" \")}`;\n return acc.length === 0 ? command : `${acc} | ${command}`;\n }, \"\");\n return handleErrnoException(\"Command\", method)(error, [flattened]);\n};\nconst ProcessProto = {\n [CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"@effect/platform/CommandExecutor/Process\",\n pid: this.pid\n };\n }\n};\nconst runCommand = fileSystem => command => {\n switch (command._tag) {\n case \"StandardCommand\":\n {\n const spawn = Effect.flatMap(Deferred.make(), exitCode => Effect.async(resume => {\n const handle = ChildProcess.spawn(command.command, command.args, {\n stdio: [inputToStdioOption(command.stdin), outputToStdioOption(command.stdout), outputToStdioOption(command.stderr)],\n cwd: Option.getOrElse(command.cwd, constUndefined),\n shell: command.shell,\n env: {\n ...process.env,\n ...Object.fromEntries(command.env)\n },\n detached: process.platform !== \"win32\"\n });\n handle.on(\"error\", err => {\n resume(Effect.fail(toPlatformError(\"spawn\", err, command)));\n });\n handle.on(\"exit\", (...args) => {\n Deferred.unsafeDone(exitCode, Effect.succeed(args));\n });\n handle.on(\"spawn\", () => {\n resume(Effect.succeed([handle, exitCode]));\n });\n return Effect.sync(() => {\n handle.kill(\"SIGTERM\");\n });\n }));\n const killProcessGroup = process.platform === \"win32\" ? (handle, _) => Effect.async(resume => {\n ChildProcess.exec(`taskkill /pid ${handle.pid} /T /F`, error => {\n if (error) {\n resume(Effect.fail(toPlatformError(\"kill\", toError(error), command)));\n } else {\n resume(Effect.void);\n }\n });\n }) : (handle, signal) => Effect.try({\n try: () => process.kill(-handle.pid, signal),\n catch: error => toPlatformError(\"kill\", toError(error), command)\n });\n const killProcess = (handle, signal) => Effect.suspend(() => handle.kill(signal) ? Effect.void : Effect.fail(toPlatformError(\"kill\", new globalThis.Error(\"Failed to kill process\"), command)));\n return pipe(\n // Validate that the directory is accessible\n Option.match(command.cwd, {\n onNone: () => Effect.void,\n onSome: dir => fileSystem.access(dir)\n }), Effect.zipRight(Effect.acquireRelease(spawn, ([handle, exitCode]) => Effect.flatMap(Deferred.isDone(exitCode), done => {\n if (!done) {\n // Process is still running, kill it\n return killProcessGroup(handle, \"SIGTERM\").pipe(Effect.orElse(() => killProcess(handle, \"SIGTERM\")), Effect.zipRight(Deferred.await(exitCode)), Effect.ignore);\n }\n // Process has already exited, check if we need to clean up children\n return Effect.flatMap(Deferred.await(exitCode), ([code]) => {\n if (code !== 0 && code !== null) {\n // Non-zero exit code, attempt to clean up process group\n return killProcessGroup(handle, \"SIGTERM\").pipe(Effect.ignore);\n }\n return Effect.void;\n });\n }))), Effect.map(([handle, exitCodeDeferred]) => {\n let stdin = Sink.drain;\n if (handle.stdin !== null) {\n stdin = fromWritable(() => handle.stdin, err => toPlatformError(\"toWritable\", toError(err), command));\n }\n const exitCode = Effect.flatMap(Deferred.await(exitCodeDeferred), ([code, signal]) => {\n if (code !== null) {\n return Effect.succeed(CommandExecutor.ExitCode(code));\n }\n // If code is `null`, then `signal` must be defined. See the NodeJS\n // documentation for the `\"exit\"` event on a `child_process`.\n // https://nodejs.org/api/child_process.html#child_process_event_exit\n return Effect.fail(toPlatformError(\"exitCode\", new globalThis.Error(`Process interrupted due to receipt of signal: ${signal}`), command));\n });\n const isRunning = Effect.negate(Deferred.isDone(exitCodeDeferred));\n const kill = (signal = \"SIGTERM\") => killProcessGroup(handle, signal).pipe(Effect.orElse(() => killProcess(handle, signal)), Effect.zipRight(Effect.asVoid(Deferred.await(exitCodeDeferred))));\n const pid = CommandExecutor.ProcessId(handle.pid);\n const stderr = fromReadable(() => handle.stderr, err => toPlatformError(\"fromReadable(stderr)\", toError(err), command));\n let stdout = fromReadable(() => handle.stdout, err => toPlatformError(\"fromReadable(stdout)\", toError(err), command));\n // TODO: add Sink.isSink\n if (typeof command.stdout !== \"string\") {\n stdout = Stream.transduce(stdout, command.stdout);\n }\n return Object.assign(Object.create(ProcessProto), {\n pid,\n exitCode,\n isRunning,\n kill,\n stdin,\n stderr,\n stdout\n });\n }), typeof command.stdin === \"string\" ? identity : Effect.tap(process => Effect.forkDaemon(Stream.run(command.stdin, process.stdin))));\n }\n case \"PipedCommand\":\n {\n const flattened = Command.flatten(command);\n if (flattened.length === 1) {\n return pipe(flattened[0], runCommand(fileSystem));\n }\n const head = flattened[0];\n const tail = flattened.slice(1);\n const initial = tail.slice(0, tail.length - 1);\n const last = tail[tail.length - 1];\n const stream = initial.reduce((stdin, command) => pipe(Command.stdin(command, stdin), runCommand(fileSystem), Effect.map(process => process.stdout), Stream.unwrapScoped), pipe(runCommand(fileSystem)(head), Effect.map(process => process.stdout), Stream.unwrapScoped));\n return pipe(Command.stdin(last, stream), runCommand(fileSystem));\n }\n }\n};\n/** @internal */\nexport const layer = /*#__PURE__*/Layer.effect(CommandExecutor.CommandExecutor, /*#__PURE__*/pipe(FileSystem.FileSystem, /*#__PURE__*/Effect.map(fileSystem => CommandExecutor.makeExecutor(runCommand(fileSystem)))));\n//# sourceMappingURL=commandExecutor.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAM,sBAAqB,UAAS,OAAO,UAAU,WAAW,QAAQ;AACxE,MAAM,uBAAsB,WAAU,OAAO,WAAW,WAAW,SAAS;AAC5E,MAAM,WAAU,QAAO,eAAe,WAAW,QAAQ,MAAM,IAAI,WAAW,MAAM,OAAO,IAAI,CAAC;AAChG,MAAM,m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MAAM,OAAO,UAAU;GACvB,MAAM,OAAO,UAAU,MAAM,EAAE;GAC/B,MAAM,UAAU,KAAK,MAAM,GAAG,KAAK,SAAS,EAAE;GAC9C,MAAM,OAAO,KAAK,KAAK,SAAS;GAChC,MAAM,SAAS,QAAQ,QAAQ,OAAO,cAAY,KAAK,QAAQ,MAAMD,WAAS,MAAM,EAAE,WAAW,WAAW,EAAE,OAAO,KAAI,cAAWC,UAAQ,OAAO,EAAE,OAAO,aAAa,EAAE,KAAK,WAAW,WAAW,CAAC,KAAK,EAAE,OAAO,KAAI,cAAWA,UAAQ,OAAO,EAAE,OAAO,aAAa,CAAC;AAC1Q,UAAO,KAAK,QAAQ,MAAM,MAAM,OAAO,EAAE,WAAW,WAAW,CAAC;;;;;AAKxE,MAAa,QAAqB,sBAAM,OAAO,gBAAgB,iBAA8B,qBAAK,WAAW,YAAyB,uBAAO,KAAI,eAAc,gBAAgB,aAAa,WAAW,WAAW,CAAC,CAAC,CAAC,CAAC"}
@@ -1,43 +0,0 @@
1
- import { SystemError } from "@effect/platform/Error";
2
-
3
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/error.js
4
- /** @internal */
5
- const handleErrnoException = (module, method) => (err, [path]) => {
6
- let reason = "Unknown";
7
- switch (err.code) {
8
- case "ENOENT":
9
- reason = "NotFound";
10
- break;
11
- case "EACCES":
12
- reason = "PermissionDenied";
13
- break;
14
- case "EEXIST":
15
- reason = "AlreadyExists";
16
- break;
17
- case "EISDIR":
18
- reason = "BadResource";
19
- break;
20
- case "ENOTDIR":
21
- reason = "BadResource";
22
- break;
23
- case "EBUSY":
24
- reason = "Busy";
25
- break;
26
- case "ELOOP":
27
- reason = "BadResource";
28
- break;
29
- }
30
- return new SystemError({
31
- reason,
32
- module,
33
- method,
34
- pathOrDescriptor: path,
35
- syscall: err.syscall,
36
- description: err.message,
37
- cause: err
38
- });
39
- };
40
-
41
- //#endregion
42
- export { handleErrnoException };
43
- //# sourceMappingURL=error.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/error.js"],"sourcesContent":["import { SystemError } from \"@effect/platform/Error\";\n/** @internal */\nexport const handleErrnoException = (module, method) => (err, [path]) => {\n let reason = \"Unknown\";\n switch (err.code) {\n case \"ENOENT\":\n reason = \"NotFound\";\n break;\n case \"EACCES\":\n reason = \"PermissionDenied\";\n break;\n case \"EEXIST\":\n reason = \"AlreadyExists\";\n break;\n case \"EISDIR\":\n reason = \"BadResource\";\n break;\n case \"ENOTDIR\":\n reason = \"BadResource\";\n break;\n case \"EBUSY\":\n reason = \"Busy\";\n break;\n case \"ELOOP\":\n reason = \"BadResource\";\n break;\n }\n return new SystemError({\n reason,\n module,\n method,\n pathOrDescriptor: path,\n syscall: err.syscall,\n description: err.message,\n cause: err\n });\n};\n//# sourceMappingURL=error.js.map"],"x_google_ignoreList":[0],"mappings":";;;;AAEA,MAAa,wBAAwB,QAAQ,YAAY,KAAK,CAAC,UAAU;CACvE,IAAI,SAAS;AACb,SAAQ,IAAI,MAAZ;EACE,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;;AAEJ,QAAO,IAAI,YAAY;EACrB;EACA;EACA;EACA,kBAAkB;EAClB,SAAS,IAAI;EACb,aAAa,IAAI;EACjB,OAAO;EACR,CAAC"}
@@ -1,329 +0,0 @@
1
- import { handleErrnoException } from "./error.mjs";
2
- import * as Effect from "effect/Effect";
3
- import { pipe } from "effect/Function";
4
- import * as Layer from "effect/Layer";
5
- import * as Option from "effect/Option";
6
- import * as Stream from "effect/Stream";
7
- import * as FileSystem from "@effect/platform/FileSystem";
8
- import { effectify } from "@effect/platform/Effectify";
9
- import * as Error from "@effect/platform/Error";
10
- import * as Crypto from "node:crypto";
11
- import * as NFS from "node:fs";
12
- import * as OS from "node:os";
13
- import * as Path from "node:path";
14
-
15
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.js
16
- const handleBadArgument = (method) => (cause) => new Error.BadArgument({
17
- module: "FileSystem",
18
- method,
19
- cause
20
- });
21
- const access = /* @__PURE__ */ (() => {
22
- const nodeAccess = /* @__PURE__ */ effectify(NFS.access, /* @__PURE__ */ handleErrnoException("FileSystem", "access"), /* @__PURE__ */ handleBadArgument("access"));
23
- return (path, options) => {
24
- let mode = NFS.constants.F_OK;
25
- if (options?.readable) mode |= NFS.constants.R_OK;
26
- if (options?.writable) mode |= NFS.constants.W_OK;
27
- return nodeAccess(path, mode);
28
- };
29
- })();
30
- const copy = /* @__PURE__ */ (() => {
31
- const nodeCp = /* @__PURE__ */ effectify(NFS.cp, /* @__PURE__ */ handleErrnoException("FileSystem", "copy"), /* @__PURE__ */ handleBadArgument("copy"));
32
- return (fromPath, toPath, options) => nodeCp(fromPath, toPath, {
33
- force: options?.overwrite ?? false,
34
- preserveTimestamps: options?.preserveTimestamps ?? false,
35
- recursive: true
36
- });
37
- })();
38
- const copyFile = /* @__PURE__ */ (() => {
39
- const nodeCopyFile = /* @__PURE__ */ effectify(NFS.copyFile, /* @__PURE__ */ handleErrnoException("FileSystem", "copyFile"), /* @__PURE__ */ handleBadArgument("copyFile"));
40
- return (fromPath, toPath) => nodeCopyFile(fromPath, toPath);
41
- })();
42
- const chmod = /* @__PURE__ */ (() => {
43
- const nodeChmod = /* @__PURE__ */ effectify(NFS.chmod, /* @__PURE__ */ handleErrnoException("FileSystem", "chmod"), /* @__PURE__ */ handleBadArgument("chmod"));
44
- return (path, mode) => nodeChmod(path, mode);
45
- })();
46
- const chown = /* @__PURE__ */ (() => {
47
- const nodeChown = /* @__PURE__ */ effectify(NFS.chown, /* @__PURE__ */ handleErrnoException("FileSystem", "chown"), /* @__PURE__ */ handleBadArgument("chown"));
48
- return (path, uid, gid) => nodeChown(path, uid, gid);
49
- })();
50
- const link = /* @__PURE__ */ (() => {
51
- const nodeLink = /* @__PURE__ */ effectify(NFS.link, /* @__PURE__ */ handleErrnoException("FileSystem", "link"), /* @__PURE__ */ handleBadArgument("link"));
52
- return (existingPath, newPath) => nodeLink(existingPath, newPath);
53
- })();
54
- const makeDirectory = /* @__PURE__ */ (() => {
55
- const nodeMkdir = /* @__PURE__ */ effectify(NFS.mkdir, /* @__PURE__ */ handleErrnoException("FileSystem", "makeDirectory"), /* @__PURE__ */ handleBadArgument("makeDirectory"));
56
- return (path, options) => nodeMkdir(path, {
57
- recursive: options?.recursive ?? false,
58
- mode: options?.mode
59
- });
60
- })();
61
- const makeTempDirectoryFactory = (method) => {
62
- const nodeMkdtemp = effectify(NFS.mkdtemp, handleErrnoException("FileSystem", method), handleBadArgument(method));
63
- return (options) => Effect.suspend(() => {
64
- const prefix = options?.prefix ?? "";
65
- const directory = typeof options?.directory === "string" ? Path.join(options.directory, ".") : OS.tmpdir();
66
- return nodeMkdtemp(prefix ? Path.join(directory, prefix) : directory + "/");
67
- });
68
- };
69
- const makeTempDirectory = /* @__PURE__ */ makeTempDirectoryFactory("makeTempDirectory");
70
- const removeFactory = (method) => {
71
- const nodeRm = effectify(NFS.rm, handleErrnoException("FileSystem", method), handleBadArgument(method));
72
- return (path, options) => nodeRm(path, {
73
- recursive: options?.recursive ?? false,
74
- force: options?.force ?? false
75
- });
76
- };
77
- const remove = /* @__PURE__ */ removeFactory("remove");
78
- const makeTempDirectoryScoped = /* @__PURE__ */ (() => {
79
- const makeDirectory$1 = /* @__PURE__ */ makeTempDirectoryFactory("makeTempDirectoryScoped");
80
- const removeDirectory = /* @__PURE__ */ removeFactory("makeTempDirectoryScoped");
81
- return (options) => Effect.acquireRelease(makeDirectory$1(options), (directory) => Effect.orDie(removeDirectory(directory, { recursive: true })));
82
- })();
83
- const openFactory = (method) => {
84
- const nodeOpen = effectify(NFS.open, handleErrnoException("FileSystem", method), handleBadArgument(method));
85
- const nodeClose = effectify(NFS.close, handleErrnoException("FileSystem", method), handleBadArgument(method));
86
- return (path, options) => pipe(Effect.acquireRelease(nodeOpen(path, options?.flag ?? "r", options?.mode), (fd) => Effect.orDie(nodeClose(fd))), Effect.map((fd) => makeFile(FileSystem.FileDescriptor(fd), options?.flag?.startsWith("a") ?? false)));
87
- };
88
- const open = /* @__PURE__ */ openFactory("open");
89
- const makeFile = /* @__PURE__ */ (() => {
90
- const nodeReadFactory = (method) => effectify(NFS.read, handleErrnoException("FileSystem", method), handleBadArgument(method));
91
- const nodeRead = /* @__PURE__ */ nodeReadFactory("read");
92
- const nodeReadAlloc = /* @__PURE__ */ nodeReadFactory("readAlloc");
93
- const nodeStat = /* @__PURE__ */ effectify(NFS.fstat, /* @__PURE__ */ handleErrnoException("FileSystem", "stat"), /* @__PURE__ */ handleBadArgument("stat"));
94
- const nodeTruncate = /* @__PURE__ */ effectify(NFS.ftruncate, /* @__PURE__ */ handleErrnoException("FileSystem", "truncate"), /* @__PURE__ */ handleBadArgument("truncate"));
95
- const nodeSync = /* @__PURE__ */ effectify(NFS.fsync, /* @__PURE__ */ handleErrnoException("FileSystem", "sync"), /* @__PURE__ */ handleBadArgument("sync"));
96
- const nodeWriteFactory = (method) => effectify(NFS.write, handleErrnoException("FileSystem", method), handleBadArgument(method));
97
- const nodeWrite = /* @__PURE__ */ nodeWriteFactory("write");
98
- const nodeWriteAll = /* @__PURE__ */ nodeWriteFactory("writeAll");
99
- class FileImpl {
100
- fd;
101
- append;
102
- [FileSystem.FileTypeId];
103
- semaphore = /* @__PURE__ */ Effect.unsafeMakeSemaphore(1);
104
- position = 0n;
105
- constructor(fd, append) {
106
- this.fd = fd;
107
- this.append = append;
108
- this[FileSystem.FileTypeId] = FileSystem.FileTypeId;
109
- }
110
- get stat() {
111
- return Effect.map(nodeStat(this.fd), makeFileInfo);
112
- }
113
- get sync() {
114
- return nodeSync(this.fd);
115
- }
116
- seek(offset, from) {
117
- const offsetSize = FileSystem.Size(offset);
118
- return this.semaphore.withPermits(1)(Effect.sync(() => {
119
- if (from === "start") this.position = offsetSize;
120
- else if (from === "current") this.position = this.position + offsetSize;
121
- return this.position;
122
- }));
123
- }
124
- read(buffer) {
125
- return this.semaphore.withPermits(1)(Effect.map(Effect.suspend(() => nodeRead(this.fd, {
126
- buffer,
127
- position: this.position
128
- })), (bytesRead) => {
129
- const sizeRead = FileSystem.Size(bytesRead);
130
- this.position = this.position + sizeRead;
131
- return sizeRead;
132
- }));
133
- }
134
- readAlloc(size) {
135
- const sizeNumber = Number(size);
136
- return this.semaphore.withPermits(1)(Effect.flatMap(Effect.sync(() => Buffer.allocUnsafeSlow(sizeNumber)), (buffer) => Effect.map(nodeReadAlloc(this.fd, {
137
- buffer,
138
- position: this.position
139
- }), (bytesRead) => {
140
- if (bytesRead === 0) return Option.none();
141
- this.position = this.position + BigInt(bytesRead);
142
- if (bytesRead === sizeNumber) return Option.some(buffer);
143
- const dst = Buffer.allocUnsafeSlow(bytesRead);
144
- buffer.copy(dst, 0, 0, bytesRead);
145
- return Option.some(dst);
146
- })));
147
- }
148
- truncate(length) {
149
- return this.semaphore.withPermits(1)(Effect.map(nodeTruncate(this.fd, length ? Number(length) : void 0), () => {
150
- if (!this.append) {
151
- const len = BigInt(length ?? 0);
152
- if (this.position > len) this.position = len;
153
- }
154
- }));
155
- }
156
- write(buffer) {
157
- return this.semaphore.withPermits(1)(Effect.map(Effect.suspend(() => nodeWrite(this.fd, buffer, void 0, void 0, this.append ? void 0 : Number(this.position))), (bytesWritten) => {
158
- const sizeWritten = FileSystem.Size(bytesWritten);
159
- if (!this.append) this.position = this.position + sizeWritten;
160
- return sizeWritten;
161
- }));
162
- }
163
- writeAllChunk(buffer) {
164
- return Effect.flatMap(Effect.suspend(() => nodeWriteAll(this.fd, buffer, void 0, void 0, this.append ? void 0 : Number(this.position))), (bytesWritten) => {
165
- if (bytesWritten === 0) return Effect.fail(new Error.SystemError({
166
- module: "FileSystem",
167
- method: "writeAll",
168
- reason: "WriteZero",
169
- pathOrDescriptor: this.fd,
170
- description: "write returned 0 bytes written"
171
- }));
172
- if (!this.append) this.position = this.position + BigInt(bytesWritten);
173
- return bytesWritten < buffer.length ? this.writeAllChunk(buffer.subarray(bytesWritten)) : Effect.void;
174
- });
175
- }
176
- writeAll(buffer) {
177
- return this.semaphore.withPermits(1)(this.writeAllChunk(buffer));
178
- }
179
- }
180
- return (fd, append) => new FileImpl(fd, append);
181
- })();
182
- const makeTempFileFactory = (method) => {
183
- const makeDirectory$1 = makeTempDirectoryFactory(method);
184
- const open$1 = openFactory(method);
185
- const randomHexString = (bytes) => Effect.sync(() => Crypto.randomBytes(bytes).toString("hex"));
186
- return (options) => pipe(Effect.zip(makeDirectory$1(options), randomHexString(6)), Effect.map(([directory, random]) => Path.join(directory, random + (options?.suffix ?? ""))), Effect.tap((path) => Effect.scoped(open$1(path, { flag: "w+" }))));
187
- };
188
- const makeTempFile = /* @__PURE__ */ makeTempFileFactory("makeTempFile");
189
- const makeTempFileScoped = /* @__PURE__ */ (() => {
190
- const makeFile$1 = /* @__PURE__ */ makeTempFileFactory("makeTempFileScoped");
191
- const removeDirectory = /* @__PURE__ */ removeFactory("makeTempFileScoped");
192
- return (options) => Effect.acquireRelease(makeFile$1(options), (file) => Effect.orDie(removeDirectory(Path.dirname(file), { recursive: true })));
193
- })();
194
- const readDirectory = (path, options) => Effect.tryPromise({
195
- try: () => NFS.promises.readdir(path, options),
196
- catch: (err) => handleErrnoException("FileSystem", "readDirectory")(err, [path])
197
- });
198
- const readFile = (path) => Effect.async((resume, signal) => {
199
- try {
200
- NFS.readFile(path, { signal }, (err, data) => {
201
- if (err) resume(Effect.fail(handleErrnoException("FileSystem", "readFile")(err, [path])));
202
- else resume(Effect.succeed(data));
203
- });
204
- } catch (err) {
205
- resume(Effect.fail(handleBadArgument("readFile")(err)));
206
- }
207
- });
208
- const readLink = /* @__PURE__ */ (() => {
209
- const nodeReadLink = /* @__PURE__ */ effectify(NFS.readlink, /* @__PURE__ */ handleErrnoException("FileSystem", "readLink"), /* @__PURE__ */ handleBadArgument("readLink"));
210
- return (path) => nodeReadLink(path);
211
- })();
212
- const realPath = /* @__PURE__ */ (() => {
213
- const nodeRealPath = /* @__PURE__ */ effectify(NFS.realpath, /* @__PURE__ */ handleErrnoException("FileSystem", "realPath"), /* @__PURE__ */ handleBadArgument("realPath"));
214
- return (path) => nodeRealPath(path);
215
- })();
216
- const rename = /* @__PURE__ */ (() => {
217
- const nodeRename = /* @__PURE__ */ effectify(NFS.rename, /* @__PURE__ */ handleErrnoException("FileSystem", "rename"), /* @__PURE__ */ handleBadArgument("rename"));
218
- return (oldPath, newPath) => nodeRename(oldPath, newPath);
219
- })();
220
- const makeFileInfo = (stat$1) => ({
221
- type: stat$1.isFile() ? "File" : stat$1.isDirectory() ? "Directory" : stat$1.isSymbolicLink() ? "SymbolicLink" : stat$1.isBlockDevice() ? "BlockDevice" : stat$1.isCharacterDevice() ? "CharacterDevice" : stat$1.isFIFO() ? "FIFO" : stat$1.isSocket() ? "Socket" : "Unknown",
222
- mtime: Option.fromNullable(stat$1.mtime),
223
- atime: Option.fromNullable(stat$1.atime),
224
- birthtime: Option.fromNullable(stat$1.birthtime),
225
- dev: stat$1.dev,
226
- rdev: Option.fromNullable(stat$1.rdev),
227
- ino: Option.fromNullable(stat$1.ino),
228
- mode: stat$1.mode,
229
- nlink: Option.fromNullable(stat$1.nlink),
230
- uid: Option.fromNullable(stat$1.uid),
231
- gid: Option.fromNullable(stat$1.gid),
232
- size: FileSystem.Size(stat$1.size),
233
- blksize: Option.map(Option.fromNullable(stat$1.blksize), FileSystem.Size),
234
- blocks: Option.fromNullable(stat$1.blocks)
235
- });
236
- const stat = /* @__PURE__ */ (() => {
237
- const nodeStat = /* @__PURE__ */ effectify(NFS.stat, /* @__PURE__ */ handleErrnoException("FileSystem", "stat"), /* @__PURE__ */ handleBadArgument("stat"));
238
- return (path) => Effect.map(nodeStat(path), makeFileInfo);
239
- })();
240
- const symlink = /* @__PURE__ */ (() => {
241
- const nodeSymlink = /* @__PURE__ */ effectify(NFS.symlink, /* @__PURE__ */ handleErrnoException("FileSystem", "symlink"), /* @__PURE__ */ handleBadArgument("symlink"));
242
- return (target, path) => nodeSymlink(target, path);
243
- })();
244
- const truncate = /* @__PURE__ */ (() => {
245
- const nodeTruncate = /* @__PURE__ */ effectify(NFS.truncate, /* @__PURE__ */ handleErrnoException("FileSystem", "truncate"), /* @__PURE__ */ handleBadArgument("truncate"));
246
- return (path, length) => nodeTruncate(path, length !== void 0 ? Number(length) : void 0);
247
- })();
248
- const utimes = /* @__PURE__ */ (() => {
249
- const nodeUtimes = /* @__PURE__ */ effectify(NFS.utimes, /* @__PURE__ */ handleErrnoException("FileSystem", "utime"), /* @__PURE__ */ handleBadArgument("utime"));
250
- return (path, atime, mtime) => nodeUtimes(path, atime, mtime);
251
- })();
252
- const watchNode = (path, options) => Stream.asyncScoped((emit) => Effect.acquireRelease(Effect.sync(() => {
253
- const watcher = NFS.watch(path, { recursive: options?.recursive }, (event, path$1) => {
254
- if (!path$1) return;
255
- switch (event) {
256
- case "rename":
257
- emit.fromEffect(Effect.matchEffect(stat(path$1), {
258
- onSuccess: (_) => Effect.succeed(FileSystem.WatchEventCreate({ path: path$1 })),
259
- onFailure: (err) => err._tag === "SystemError" && err.reason === "NotFound" ? Effect.succeed(FileSystem.WatchEventRemove({ path: path$1 })) : Effect.fail(err)
260
- }));
261
- return;
262
- case "change":
263
- emit.single(FileSystem.WatchEventUpdate({ path: path$1 }));
264
- return;
265
- }
266
- });
267
- watcher.on("error", (error) => {
268
- emit.fail(new Error.SystemError({
269
- module: "FileSystem",
270
- reason: "Unknown",
271
- method: "watch",
272
- pathOrDescriptor: path,
273
- cause: error
274
- }));
275
- });
276
- watcher.on("close", () => {
277
- emit.end();
278
- });
279
- return watcher;
280
- }), (watcher) => Effect.sync(() => watcher.close())));
281
- const watch = (backend, path, options) => stat(path).pipe(Effect.map((stat$1) => backend.pipe(Option.flatMap((_) => _.register(path, stat$1, options)), Option.getOrElse(() => watchNode(path, options)))), Stream.unwrap);
282
- const writeFile = (path, data, options) => Effect.async((resume, signal) => {
283
- try {
284
- NFS.writeFile(path, data, {
285
- signal,
286
- flag: options?.flag,
287
- mode: options?.mode
288
- }, (err) => {
289
- if (err) resume(Effect.fail(handleErrnoException("FileSystem", "writeFile")(err, [path])));
290
- else resume(Effect.void);
291
- });
292
- } catch (err) {
293
- resume(Effect.fail(handleBadArgument("writeFile")(err)));
294
- }
295
- });
296
- const makeFileSystem = /* @__PURE__ */ Effect.map(/* @__PURE__ */ Effect.serviceOption(FileSystem.WatchBackend), (backend) => FileSystem.make({
297
- access,
298
- chmod,
299
- chown,
300
- copy,
301
- copyFile,
302
- link,
303
- makeDirectory,
304
- makeTempDirectory,
305
- makeTempDirectoryScoped,
306
- makeTempFile,
307
- makeTempFileScoped,
308
- open,
309
- readDirectory,
310
- readFile,
311
- readLink,
312
- realPath,
313
- remove,
314
- rename,
315
- stat,
316
- symlink,
317
- truncate,
318
- utimes,
319
- watch(path, options) {
320
- return watch(backend, path, options);
321
- },
322
- writeFile
323
- }));
324
- /** @internal */
325
- const layer = /* @__PURE__ */ Layer.effect(FileSystem.FileSystem, makeFileSystem);
326
-
327
- //#endregion
328
- export { layer };
329
- //# sourceMappingURL=fileSystem.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fileSystem.mjs","names":["makeDirectory","open","makeFile","stat","path"],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.js"],"sourcesContent":["import { effectify } from \"@effect/platform/Effectify\";\nimport * as Error from \"@effect/platform/Error\";\nimport * as FileSystem from \"@effect/platform/FileSystem\";\nimport * as Effect from \"effect/Effect\";\nimport { pipe } from \"effect/Function\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Stream from \"effect/Stream\";\nimport * as Crypto from \"node:crypto\";\nimport * as NFS from \"node:fs\";\nimport * as OS from \"node:os\";\nimport * as Path from \"node:path\";\nimport { handleErrnoException } from \"./error.js\";\nconst handleBadArgument = method => cause => new Error.BadArgument({\n module: \"FileSystem\",\n method,\n cause\n});\n// == access\nconst access = /*#__PURE__*/(() => {\n const nodeAccess = /*#__PURE__*/effectify(NFS.access, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"access\"), /*#__PURE__*/handleBadArgument(\"access\"));\n return (path, options) => {\n let mode = NFS.constants.F_OK;\n if (options?.readable) {\n mode |= NFS.constants.R_OK;\n }\n if (options?.writable) {\n mode |= NFS.constants.W_OK;\n }\n return nodeAccess(path, mode);\n };\n})();\n// == copy\nconst copy = /*#__PURE__*/(() => {\n const nodeCp = /*#__PURE__*/effectify(NFS.cp, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"copy\"), /*#__PURE__*/handleBadArgument(\"copy\"));\n return (fromPath, toPath, options) => nodeCp(fromPath, toPath, {\n force: options?.overwrite ?? false,\n preserveTimestamps: options?.preserveTimestamps ?? false,\n recursive: true\n });\n})();\n// == copyFile\nconst copyFile = /*#__PURE__*/(() => {\n const nodeCopyFile = /*#__PURE__*/effectify(NFS.copyFile, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"copyFile\"), /*#__PURE__*/handleBadArgument(\"copyFile\"));\n return (fromPath, toPath) => nodeCopyFile(fromPath, toPath);\n})();\n// == chmod\nconst chmod = /*#__PURE__*/(() => {\n const nodeChmod = /*#__PURE__*/effectify(NFS.chmod, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"chmod\"), /*#__PURE__*/handleBadArgument(\"chmod\"));\n return (path, mode) => nodeChmod(path, mode);\n})();\n// == chown\nconst chown = /*#__PURE__*/(() => {\n const nodeChown = /*#__PURE__*/effectify(NFS.chown, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"chown\"), /*#__PURE__*/handleBadArgument(\"chown\"));\n return (path, uid, gid) => nodeChown(path, uid, gid);\n})();\n// == link\nconst link = /*#__PURE__*/(() => {\n const nodeLink = /*#__PURE__*/effectify(NFS.link, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"link\"), /*#__PURE__*/handleBadArgument(\"link\"));\n return (existingPath, newPath) => nodeLink(existingPath, newPath);\n})();\n// == makeDirectory\nconst makeDirectory = /*#__PURE__*/(() => {\n const nodeMkdir = /*#__PURE__*/effectify(NFS.mkdir, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"makeDirectory\"), /*#__PURE__*/handleBadArgument(\"makeDirectory\"));\n return (path, options) => nodeMkdir(path, {\n recursive: options?.recursive ?? false,\n mode: options?.mode\n });\n})();\n// == makeTempDirectory\nconst makeTempDirectoryFactory = method => {\n const nodeMkdtemp = effectify(NFS.mkdtemp, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n return options => Effect.suspend(() => {\n const prefix = options?.prefix ?? \"\";\n const directory = typeof options?.directory === \"string\" ? Path.join(options.directory, \".\") : OS.tmpdir();\n return nodeMkdtemp(prefix ? Path.join(directory, prefix) : directory + \"/\");\n });\n};\nconst makeTempDirectory = /*#__PURE__*/makeTempDirectoryFactory(\"makeTempDirectory\");\n// == remove\nconst removeFactory = method => {\n const nodeRm = effectify(NFS.rm, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n return (path, options) => nodeRm(path, {\n recursive: options?.recursive ?? false,\n force: options?.force ?? false\n });\n};\nconst remove = /*#__PURE__*/removeFactory(\"remove\");\n// == makeTempDirectoryScoped\nconst makeTempDirectoryScoped = /*#__PURE__*/(() => {\n const makeDirectory = /*#__PURE__*/makeTempDirectoryFactory(\"makeTempDirectoryScoped\");\n const removeDirectory = /*#__PURE__*/removeFactory(\"makeTempDirectoryScoped\");\n return options => Effect.acquireRelease(makeDirectory(options), directory => Effect.orDie(removeDirectory(directory, {\n recursive: true\n })));\n})();\n// == open\nconst openFactory = method => {\n const nodeOpen = effectify(NFS.open, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n const nodeClose = effectify(NFS.close, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n return (path, options) => pipe(Effect.acquireRelease(nodeOpen(path, options?.flag ?? \"r\", options?.mode), fd => Effect.orDie(nodeClose(fd))), Effect.map(fd => makeFile(FileSystem.FileDescriptor(fd), options?.flag?.startsWith(\"a\") ?? false)));\n};\nconst open = /*#__PURE__*/openFactory(\"open\");\nconst makeFile = /*#__PURE__*/(() => {\n const nodeReadFactory = method => effectify(NFS.read, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n const nodeRead = /*#__PURE__*/nodeReadFactory(\"read\");\n const nodeReadAlloc = /*#__PURE__*/nodeReadFactory(\"readAlloc\");\n const nodeStat = /*#__PURE__*/effectify(NFS.fstat, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"stat\"), /*#__PURE__*/handleBadArgument(\"stat\"));\n const nodeTruncate = /*#__PURE__*/effectify(NFS.ftruncate, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"truncate\"), /*#__PURE__*/handleBadArgument(\"truncate\"));\n const nodeSync = /*#__PURE__*/effectify(NFS.fsync, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"sync\"), /*#__PURE__*/handleBadArgument(\"sync\"));\n const nodeWriteFactory = method => effectify(NFS.write, handleErrnoException(\"FileSystem\", method), handleBadArgument(method));\n const nodeWrite = /*#__PURE__*/nodeWriteFactory(\"write\");\n const nodeWriteAll = /*#__PURE__*/nodeWriteFactory(\"writeAll\");\n class FileImpl {\n fd;\n append;\n [FileSystem.FileTypeId];\n semaphore = /*#__PURE__*/Effect.unsafeMakeSemaphore(1);\n position = 0n;\n constructor(fd, append) {\n this.fd = fd;\n this.append = append;\n this[FileSystem.FileTypeId] = FileSystem.FileTypeId;\n }\n get stat() {\n return Effect.map(nodeStat(this.fd), makeFileInfo);\n }\n get sync() {\n return nodeSync(this.fd);\n }\n seek(offset, from) {\n const offsetSize = FileSystem.Size(offset);\n return this.semaphore.withPermits(1)(Effect.sync(() => {\n if (from === \"start\") {\n this.position = offsetSize;\n } else if (from === \"current\") {\n this.position = this.position + offsetSize;\n }\n return this.position;\n }));\n }\n read(buffer) {\n return this.semaphore.withPermits(1)(Effect.map(Effect.suspend(() => nodeRead(this.fd, {\n buffer,\n position: this.position\n })), bytesRead => {\n const sizeRead = FileSystem.Size(bytesRead);\n this.position = this.position + sizeRead;\n return sizeRead;\n }));\n }\n readAlloc(size) {\n const sizeNumber = Number(size);\n return this.semaphore.withPermits(1)(Effect.flatMap(Effect.sync(() => Buffer.allocUnsafeSlow(sizeNumber)), buffer => Effect.map(nodeReadAlloc(this.fd, {\n buffer,\n position: this.position\n }), bytesRead => {\n if (bytesRead === 0) {\n return Option.none();\n }\n this.position = this.position + BigInt(bytesRead);\n if (bytesRead === sizeNumber) {\n return Option.some(buffer);\n }\n const dst = Buffer.allocUnsafeSlow(bytesRead);\n buffer.copy(dst, 0, 0, bytesRead);\n return Option.some(dst);\n })));\n }\n truncate(length) {\n return this.semaphore.withPermits(1)(Effect.map(nodeTruncate(this.fd, length ? Number(length) : undefined), () => {\n if (!this.append) {\n const len = BigInt(length ?? 0);\n if (this.position > len) {\n this.position = len;\n }\n }\n }));\n }\n write(buffer) {\n return this.semaphore.withPermits(1)(Effect.map(Effect.suspend(() => nodeWrite(this.fd, buffer, undefined, undefined, this.append ? undefined : Number(this.position))), bytesWritten => {\n const sizeWritten = FileSystem.Size(bytesWritten);\n if (!this.append) {\n this.position = this.position + sizeWritten;\n }\n return sizeWritten;\n }));\n }\n writeAllChunk(buffer) {\n return Effect.flatMap(Effect.suspend(() => nodeWriteAll(this.fd, buffer, undefined, undefined, this.append ? undefined : Number(this.position))), bytesWritten => {\n if (bytesWritten === 0) {\n return Effect.fail(new Error.SystemError({\n module: \"FileSystem\",\n method: \"writeAll\",\n reason: \"WriteZero\",\n pathOrDescriptor: this.fd,\n description: \"write returned 0 bytes written\"\n }));\n }\n if (!this.append) {\n this.position = this.position + BigInt(bytesWritten);\n }\n return bytesWritten < buffer.length ? this.writeAllChunk(buffer.subarray(bytesWritten)) : Effect.void;\n });\n }\n writeAll(buffer) {\n return this.semaphore.withPermits(1)(this.writeAllChunk(buffer));\n }\n }\n return (fd, append) => new FileImpl(fd, append);\n})();\n// == makeTempFile\nconst makeTempFileFactory = method => {\n const makeDirectory = makeTempDirectoryFactory(method);\n const open = openFactory(method);\n const randomHexString = bytes => Effect.sync(() => Crypto.randomBytes(bytes).toString(\"hex\"));\n return options => pipe(Effect.zip(makeDirectory(options), randomHexString(6)), Effect.map(([directory, random]) => Path.join(directory, random + (options?.suffix ?? \"\"))), Effect.tap(path => Effect.scoped(open(path, {\n flag: \"w+\"\n }))));\n};\nconst makeTempFile = /*#__PURE__*/makeTempFileFactory(\"makeTempFile\");\n// == makeTempFileScoped\nconst makeTempFileScoped = /*#__PURE__*/(() => {\n const makeFile = /*#__PURE__*/makeTempFileFactory(\"makeTempFileScoped\");\n const removeDirectory = /*#__PURE__*/removeFactory(\"makeTempFileScoped\");\n return options => Effect.acquireRelease(makeFile(options), file => Effect.orDie(removeDirectory(Path.dirname(file), {\n recursive: true\n })));\n})();\n// == readDirectory\nconst readDirectory = (path, options) => Effect.tryPromise({\n try: () => NFS.promises.readdir(path, options),\n catch: err => handleErrnoException(\"FileSystem\", \"readDirectory\")(err, [path])\n});\n// == readFile\nconst readFile = path => Effect.async((resume, signal) => {\n try {\n NFS.readFile(path, {\n signal\n }, (err, data) => {\n if (err) {\n resume(Effect.fail(handleErrnoException(\"FileSystem\", \"readFile\")(err, [path])));\n } else {\n resume(Effect.succeed(data));\n }\n });\n } catch (err) {\n resume(Effect.fail(handleBadArgument(\"readFile\")(err)));\n }\n});\n// == readLink\nconst readLink = /*#__PURE__*/(() => {\n const nodeReadLink = /*#__PURE__*/effectify(NFS.readlink, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"readLink\"), /*#__PURE__*/handleBadArgument(\"readLink\"));\n return path => nodeReadLink(path);\n})();\n// == realPath\nconst realPath = /*#__PURE__*/(() => {\n const nodeRealPath = /*#__PURE__*/effectify(NFS.realpath, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"realPath\"), /*#__PURE__*/handleBadArgument(\"realPath\"));\n return path => nodeRealPath(path);\n})();\n// == rename\nconst rename = /*#__PURE__*/(() => {\n const nodeRename = /*#__PURE__*/effectify(NFS.rename, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"rename\"), /*#__PURE__*/handleBadArgument(\"rename\"));\n return (oldPath, newPath) => nodeRename(oldPath, newPath);\n})();\n// == stat\nconst makeFileInfo = stat => ({\n type: stat.isFile() ? \"File\" : stat.isDirectory() ? \"Directory\" : stat.isSymbolicLink() ? \"SymbolicLink\" : stat.isBlockDevice() ? \"BlockDevice\" : stat.isCharacterDevice() ? \"CharacterDevice\" : stat.isFIFO() ? \"FIFO\" : stat.isSocket() ? \"Socket\" : \"Unknown\",\n mtime: Option.fromNullable(stat.mtime),\n atime: Option.fromNullable(stat.atime),\n birthtime: Option.fromNullable(stat.birthtime),\n dev: stat.dev,\n rdev: Option.fromNullable(stat.rdev),\n ino: Option.fromNullable(stat.ino),\n mode: stat.mode,\n nlink: Option.fromNullable(stat.nlink),\n uid: Option.fromNullable(stat.uid),\n gid: Option.fromNullable(stat.gid),\n size: FileSystem.Size(stat.size),\n blksize: Option.map(Option.fromNullable(stat.blksize), FileSystem.Size),\n blocks: Option.fromNullable(stat.blocks)\n});\nconst stat = /*#__PURE__*/(() => {\n const nodeStat = /*#__PURE__*/effectify(NFS.stat, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"stat\"), /*#__PURE__*/handleBadArgument(\"stat\"));\n return path => Effect.map(nodeStat(path), makeFileInfo);\n})();\n// == symlink\nconst symlink = /*#__PURE__*/(() => {\n const nodeSymlink = /*#__PURE__*/effectify(NFS.symlink, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"symlink\"), /*#__PURE__*/handleBadArgument(\"symlink\"));\n return (target, path) => nodeSymlink(target, path);\n})();\n// == truncate\nconst truncate = /*#__PURE__*/(() => {\n const nodeTruncate = /*#__PURE__*/effectify(NFS.truncate, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"truncate\"), /*#__PURE__*/handleBadArgument(\"truncate\"));\n return (path, length) => nodeTruncate(path, length !== undefined ? Number(length) : undefined);\n})();\n// == utimes\nconst utimes = /*#__PURE__*/(() => {\n const nodeUtimes = /*#__PURE__*/effectify(NFS.utimes, /*#__PURE__*/handleErrnoException(\"FileSystem\", \"utime\"), /*#__PURE__*/handleBadArgument(\"utime\"));\n return (path, atime, mtime) => nodeUtimes(path, atime, mtime);\n})();\n// == watch\nconst watchNode = (path, options) => Stream.asyncScoped(emit => Effect.acquireRelease(Effect.sync(() => {\n const watcher = NFS.watch(path, {\n recursive: options?.recursive\n }, (event, path) => {\n if (!path) return;\n switch (event) {\n case \"rename\":\n {\n emit.fromEffect(Effect.matchEffect(stat(path), {\n onSuccess: _ => Effect.succeed(FileSystem.WatchEventCreate({\n path\n })),\n onFailure: err => err._tag === \"SystemError\" && err.reason === \"NotFound\" ? Effect.succeed(FileSystem.WatchEventRemove({\n path\n })) : Effect.fail(err)\n }));\n return;\n }\n case \"change\":\n {\n emit.single(FileSystem.WatchEventUpdate({\n path\n }));\n return;\n }\n }\n });\n watcher.on(\"error\", error => {\n emit.fail(new Error.SystemError({\n module: \"FileSystem\",\n reason: \"Unknown\",\n method: \"watch\",\n pathOrDescriptor: path,\n cause: error\n }));\n });\n watcher.on(\"close\", () => {\n emit.end();\n });\n return watcher;\n}), watcher => Effect.sync(() => watcher.close())));\nconst watch = (backend, path, options) => stat(path).pipe(Effect.map(stat => backend.pipe(Option.flatMap(_ => _.register(path, stat, options)), Option.getOrElse(() => watchNode(path, options)))), Stream.unwrap);\n// == writeFile\nconst writeFile = (path, data, options) => Effect.async((resume, signal) => {\n try {\n NFS.writeFile(path, data, {\n signal,\n flag: options?.flag,\n mode: options?.mode\n }, err => {\n if (err) {\n resume(Effect.fail(handleErrnoException(\"FileSystem\", \"writeFile\")(err, [path])));\n } else {\n resume(Effect.void);\n }\n });\n } catch (err) {\n resume(Effect.fail(handleBadArgument(\"writeFile\")(err)));\n }\n});\nconst makeFileSystem = /*#__PURE__*/Effect.map(/*#__PURE__*/Effect.serviceOption(FileSystem.WatchBackend), backend => FileSystem.make({\n access,\n chmod,\n chown,\n copy,\n copyFile,\n link,\n makeDirectory,\n makeTempDirectory,\n makeTempDirectoryScoped,\n makeTempFile,\n makeTempFileScoped,\n open,\n readDirectory,\n readFile,\n readLink,\n realPath,\n remove,\n rename,\n stat,\n symlink,\n truncate,\n utimes,\n watch(path, options) {\n return watch(backend, path, options);\n },\n writeFile\n}));\n/** @internal */\nexport const layer = /*#__PURE__*/Layer.effect(FileSystem.FileSystem, makeFileSystem);\n//# sourceMappingURL=fileSystem.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,qBAAoB,YAAU,UAAS,IAAI,MAAM,YAAY;CACjE,QAAQ;CACR;CACA;CACD,CAAC;AAEF,MAAM,SAAsB,uBAAO;CACjC,MAAM,aAA0B,0BAAU,IAAI,QAAqB,qCAAqB,cAAc,SAAS,EAAe,kCAAkB,SAAS,CAAC;AAC1J,SAAQ,MAAM,YAAY;EACxB,IAAI,OAAO,IAAI,UAAU;AACzB,MAAI,SAAS,SACX,SAAQ,IAAI,UAAU;AAExB,MAAI,SAAS,SACX,SAAQ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