@poe-platform/safe-bash 0.1.809 → 0.1.810

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 (109) hide show
  1. package/dist/audio-ast/index.d.ts +1 -1
  2. package/dist/audio-ast/index.js +6 -0
  3. package/dist/audio-ast/wav-source.d.ts +7 -1
  4. package/dist/image-ast/index.js +1 -1
  5. package/dist/pdf-ast/cos/mutable-object-store.d.ts +3 -0
  6. package/dist/pdf-ast/cos/qpdf-json-document.d.ts +42 -0
  7. package/dist/pdf-ast/cos/qpdf-json-values.d.ts +7 -0
  8. package/dist/pdf-ast/index.d.ts +1 -0
  9. package/dist/pdf-ast/index.js +508 -37
  10. package/dist/pdf-ast/retained-document.d.ts +3 -1
  11. package/dist/safe-bash/chunks/{chunk-RQCK77SC.js → chunk-65TFMAZU.js} +2 -2
  12. package/dist/safe-bash/chunks/{chunk-SOFBGDXG.js → chunk-HHSOUC3Z.js} +32 -0
  13. package/dist/safe-bash/chunks/{chunk-WAZEELYB.js → chunk-ZA5FQ34E.js} +10 -5
  14. package/dist/safe-bash/command-chunks/biff-ORSHM4YX-QYPGRDAZ.js +4937 -0
  15. package/dist/safe-bash/command-chunks/{chunk-62ZAHKFS.js → chunk-2VCKUNDZ.js} +130 -14
  16. package/dist/safe-bash/command-chunks/{chunk-GLVD3JJG.js → chunk-BYZUOF6X.js} +2858 -2816
  17. package/dist/safe-bash/command-chunks/{chunk-6OKH4X67.js → chunk-CAXJ4RLF.js} +264 -1
  18. package/dist/safe-bash/command-chunks/{chunk-YJJBGN7U.js → chunk-CHR2OD2U.js} +9 -9
  19. package/dist/safe-bash/command-chunks/{chunk-D7XBUF76.js → chunk-D2ASPM7R.js} +109 -23
  20. package/dist/safe-bash/command-chunks/chunk-D5AYP2UM.js +816 -0
  21. package/dist/safe-bash/command-chunks/{chunk-WFDG3N5R.js → chunk-ECDEPKKW.js} +1 -1
  22. package/dist/safe-bash/command-chunks/{chunk-OQCJGUI6.js → chunk-HARUYHH7.js} +10 -10
  23. package/dist/safe-bash/command-chunks/{chunk-NVBUC644.js → chunk-HKGNBH7Z.js} +2 -2
  24. package/dist/safe-bash/command-chunks/chunk-MGBHGZEX.js +12 -0
  25. package/dist/safe-bash/command-chunks/{chunk-4557HE3J.js → chunk-PMWW7KSB.js} +161 -42
  26. package/dist/safe-bash/command-chunks/{chunk-JW3KIZU6.js → chunk-RUXY7GN5.js} +1 -1
  27. package/dist/safe-bash/command-chunks/{chunk-KELMIFVV.js → chunk-TI52LKLL.js} +1 -1
  28. package/dist/safe-bash/command-chunks/{chunk-JJQ72P3V.js → chunk-VCML4T5D.js} +1 -1
  29. package/dist/safe-bash/command-chunks/{chunk-5HGEXQVD.js → chunk-WC2OCF4H.js} +1 -1
  30. package/dist/safe-bash/command-chunks/chunk-WH3TIOTS.js +326 -0
  31. package/dist/safe-bash/command-chunks/{chunk-45FI2IPY.js → chunk-WQ6ABTJU.js} +3 -6
  32. package/dist/safe-bash/command-chunks/{chunk-NB7JO7FE.js → chunk-YTFWPJ3F.js} +1 -1
  33. package/dist/safe-bash/command-chunks/{chunk-GKYCV6BU.js → chunk-ZEPDT6I5.js} +482 -168
  34. package/dist/safe-bash/command-chunks/{command-engine-P5DFM4OU.js → command-engine-BEWABZ75.js} +10 -3
  35. package/dist/safe-bash/command-chunks/{engine-RU4OFLPO-CPLFYD67.js → engine-MEPOXIXT-WZMRHACG.js} +1 -1
  36. package/dist/safe-bash/command-chunks/pdf-LOZAXXS6-ERI57IAV.js +557 -0
  37. package/dist/safe-bash/commands/audio/index.browser.js +2 -14
  38. package/dist/safe-bash/commands/diff-patch/index.js +0 -2
  39. package/dist/safe-bash/commands/ffprobe/index.browser.js +2 -5
  40. package/dist/safe-bash/commands/pandoc/index.browser.js +3 -1
  41. package/dist/safe-bash/commands/text.js +10 -1
  42. package/dist/safe-bash/core.d.ts +2 -2
  43. package/dist/safe-bash/core.js +2 -2
  44. package/dist/safe-bash/full-core.browser.js +18 -22
  45. package/dist/safe-bash/lazy-optional.d.ts +9 -0
  46. package/dist/safe-bash/lazy-optional.js +24 -0
  47. package/dist/safe-bash/plugins/index.browser.js +5 -3
  48. package/dist/safe-bash/registry-entry.browser.js +1 -1
  49. package/dist/safe-bash-command-apply-patch/apply.js +2 -2
  50. package/dist/safe-bash-command-apply-patch/index.js +2 -2
  51. package/dist/safe-bash-command-apply-patch/parser.d.ts +20 -1
  52. package/dist/safe-bash-command-apply-patch/parser.js +1 -1
  53. package/dist/safe-bash-command-ffprobe/index.js +2 -1
  54. package/dist/safe-bash-command-ffprobe/media.js +2 -1
  55. package/dist/safe-bash-command-ffprobe/options.d.ts +15 -0
  56. package/dist/safe-bash-command-ffprobe/options.js +7 -0
  57. package/dist/safe-bash-command-media/index.js +2 -2
  58. package/dist/safe-bash-command-media/plugin.js +1 -1
  59. package/dist/safe-bash-command-media/remote.js +2 -2
  60. package/dist/safe-bash-command-pandoc/command.js +6 -6
  61. package/dist/safe-bash-command-pandoc/index.js +31 -31
  62. package/dist/safe-bash-command-patch/index.js +2 -2
  63. package/dist/safe-bash-command-patch/patch-publication.d.ts +2 -2
  64. package/dist/safe-bash-command-patch/patch-publication.js +1 -1
  65. package/dist/safe-bash-command-patch/patch.js +2 -2
  66. package/dist/safe-bash-command-pptx/engine.js +1 -1
  67. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  68. package/dist/safe-bash-command-xmllint/index.js +137 -30
  69. package/dist/safe-bash-compression-engine/bounded-codec.js +2 -2
  70. package/dist/safe-bash-compression-engine/codec-loader.js +1 -1
  71. package/dist/safe-bash-compression-engine/files.js +5 -5
  72. package/dist/safe-bash-compression-engine/index.js +4 -4
  73. package/dist/safe-bash-compression-engine/operand.js +5 -5
  74. package/dist/safe-bash-compression-engine/stream.js +4 -4
  75. package/dist/safe-bash-compression-engine/zstd-decode.js +3 -3
  76. package/dist/safe-bash-media-engine/imagemagick.d.ts +2 -0
  77. package/dist/safe-bash-media-engine/index.js +162 -72
  78. package/dist/safe-bash-network-engine/body.d.ts +1 -0
  79. package/dist/safe-bash-network-engine/body.js +1 -1
  80. package/dist/safe-bash-network-engine/transfer.js +11 -3
  81. package/dist/safe-bash-presentation-engine/command-placeholder.js +4 -3
  82. package/dist/safe-bash-presentation-engine/index.d.ts +1 -1
  83. package/dist/safe-bash-presentation-engine/index.js +9 -4
  84. package/dist/safe-bash-presentation-engine/presentation-model.js +3 -2
  85. package/dist/safe-bash-presentation-engine/retained-text.js +3 -3
  86. package/dist/safe-bash-presentation-engine/retained-xml-parts.d.ts +26 -0
  87. package/dist/safe-bash-presentation-engine/xml-parts.d.ts +1 -0
  88. package/dist/safe-bash-presentation-engine/xml-parts.js +7 -1
  89. package/dist/safe-bash-xml-engine/document.js +1 -1
  90. package/dist/safe-bash-xml-engine/index.js +1 -1
  91. package/dist/spreadsheet-engine/rendering/print/tab-layout.d.ts +11 -0
  92. package/dist/spreadsheet-engine/rendering/print/tab-layout.js +15 -0
  93. package/dist/spreadsheet-engine/rendering/print/text-lines.d.ts +2 -2
  94. package/dist/spreadsheet-engine/rendering/print/text-lines.js +3 -3
  95. package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +4 -0
  96. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +137 -56
  97. package/dist/spreadsheet-format-xls/biff-encryption.d.ts +1 -1
  98. package/dist/spreadsheet-format-xls/biff-encryption.js +8 -3
  99. package/dist/spreadsheet-format-xls/biff-property-bytes.d.ts +1 -1
  100. package/dist/spreadsheet-format-xls/biff-property-bytes.js +2 -2
  101. package/dist/spreadsheet-format-xls/biff.js +11 -3
  102. package/package.json +3 -2
  103. package/dist/safe-bash/chunks/chunk-I2A5ZCPD.js +0 -17
  104. package/dist/safe-bash/chunks/chunk-PQTT2EZP.js +0 -8
  105. package/dist/safe-bash/command-chunks/biff-DS263V2K-2GP4GZT7.js +0 -4868
  106. package/dist/safe-bash/command-chunks/chunk-6ZFYWT3U.js +0 -581
  107. package/dist/safe-bash/command-chunks/chunk-S244SWDH.js +0 -153
  108. package/dist/safe-bash/command-chunks/pdf-T7AWYZGQ-KNAYJ7YF.js +0 -552
  109. /package/dist/safe-bash/command-chunks/{chunk-EMMSXKEJ.js → chunk-4Q4R3VZU.js} +0 -0
@@ -1,153 +0,0 @@
1
- // packages/safe-bash-command-patch/src/patch-publication.ts
2
- import { compareCopyIdentity } from "../../safe-bash-contracts/filesystem-identity.js";
3
- import { retainFileSystemCleanup } from "@poe-platform/safe-fs/core";
4
- import { dirname, FsError, isFsError } from "../../safe-bash-contracts/index.js";
5
- import { host, ToolError } from "../../safe-bash-diff-engine/shared.js";
6
- import { encodeBytes } from "../../safe-bash-io-engine/byte-encoding.js";
7
- var PatchPublication = class {
8
- constructor(context, trusted = false) {
9
- this.context = context;
10
- this.trusted = trusted;
11
- }
12
- context;
13
- trusted;
14
- directories = /* @__PURE__ */ new Map();
15
- removals = /* @__PURE__ */ new Map();
16
- pruning = /* @__PURE__ */ new Map();
17
- async capture(path, prune = []) {
18
- const paths = [];
19
- for (let parent = dirname(path); ; parent = dirname(parent)) {
20
- paths.unshift(parent);
21
- if (parent === "/") break;
22
- }
23
- for (const parent of paths) {
24
- if (this.directories.has(parent)) continue;
25
- let stat;
26
- try {
27
- stat = await host(this.context, () => this.context.fs.lstat(parent, { signal: this.context.signal }));
28
- } catch (error) {
29
- if (isFsError(error, "ENOENT")) break;
30
- throw error;
31
- }
32
- if (stat.type !== "directory") throw new ToolError(`unsafe patch parent: ${parent}`);
33
- this.directories.set(parent, stat);
34
- }
35
- if (this.trusted) return;
36
- if (this.directories.has(dirname(path)) && !this.removals.has(path)) {
37
- this.removals.set(path, await host(this.context, () => this.context.fs.confineExtraction([dirname(path)], { signal: this.context.signal })));
38
- }
39
- const parents = prune.filter((parent) => this.directories.has(parent) && !this.pruning.has(parent));
40
- if (this.directories.has(dirname(path)) && parents.length) {
41
- const view = await host(this.context, () => this.context.fs.confineExtraction([dirname(path), parents.at(-1)], { signal: this.context.signal }));
42
- for (const parent of parents) this.pruning.set(parent, view);
43
- }
44
- }
45
- async validate(path) {
46
- const parents = [];
47
- for (let parent = dirname(path); ; parent = dirname(parent)) {
48
- parents.unshift(parent);
49
- if (parent === "/") break;
50
- }
51
- for (const parent of parents) {
52
- const expected = this.directories.get(parent);
53
- const current = await host(this.context, () => this.context.fs.lstat(parent, { signal: this.context.signal }));
54
- if (current.type !== "directory" || compareCopyIdentity(current, expected) !== "same") {
55
- throw new FsError("EAGAIN", { syscall: "patch", path: parent });
56
- }
57
- }
58
- }
59
- async mkdir(path) {
60
- await this.capture(path);
61
- await this.validate(path);
62
- const stat = await host(this.context, () => this.context.fs.prepareDirectory(path, {
63
- parent: this.directories.get(dirname(path)),
64
- expected: null,
65
- signal: this.context.signal
66
- }));
67
- this.directories.set(path, stat);
68
- }
69
- async write(path, text, destination, mode, mtimeMs) {
70
- await this.capture(path);
71
- const ancestors = [];
72
- for (let parent2 = dirname(path); ; parent2 = dirname(parent2)) {
73
- const stat = this.directories.get(parent2);
74
- if (!stat) throw new ToolError(`patch parent does not exist: ${parent2}`);
75
- ancestors.unshift({ path: parent2, stat });
76
- if (parent2 === "/") break;
77
- }
78
- const context = this.context;
79
- const parent = ancestors[ancestors.length - 1].stat;
80
- let staging;
81
- let operation;
82
- let closed = false;
83
- const release = retainFileSystemCleanup(context.fs, async (view) => {
84
- await operation?.catch(() => {
85
- });
86
- if (staging) await view.removeStagedFile(staging);
87
- }, { maxOperations: 1 });
88
- const cleanup = () => {
89
- closed = true;
90
- return release();
91
- };
92
- context.registerCleanup?.(cleanup);
93
- try {
94
- operation = Promise.resolve().then(async () => {
95
- context.signal.throwIfAborted();
96
- if (closed) throw new ToolError("patch publication is closed");
97
- if (this.trusted) await this.validate(path);
98
- staging = await context.fs.createStagedFile(`${dirname(path) === "/" ? "" : dirname(path)}/.patch-${globalThis.crypto.randomUUID()}`, "file", {
99
- type: "file",
100
- data: encodeBytes(text)
101
- }, {
102
- parent,
103
- signal: context.signal,
104
- ...mode === void 0 ? {} : { mode },
105
- ...mtimeMs === void 0 ? {} : { atimeMs: mtimeMs, mtimeMs }
106
- });
107
- context.signal.throwIfAborted();
108
- if (closed) throw new ToolError("patch publication is closed");
109
- if (this.trusted) await this.validate(path);
110
- await context.fs.publishStagedFile(staging, path, {
111
- parent,
112
- destination: destination ?? null,
113
- ...this.trusted ? {} : { ancestors },
114
- signal: context.signal
115
- });
116
- });
117
- await host(context, () => operation);
118
- } finally {
119
- await cleanup();
120
- }
121
- }
122
- async remove(path, expected) {
123
- if (this.trusted) {
124
- await this.validate(path);
125
- await host(this.context, () => this.context.fs.removeFileConditional(path, {
126
- parent: this.directories.get(dirname(path)),
127
- expected,
128
- signal: this.context.signal
129
- }));
130
- return;
131
- }
132
- const fs = this.removals.get(path);
133
- if (!fs) throw new ToolError(`patch removal was not admitted: ${path}`);
134
- await host(this.context, () => fs.rm(path, { signal: this.context.signal }));
135
- }
136
- async prune(path) {
137
- if (this.trusted) {
138
- await this.validate(`${path}/.patch-prune`);
139
- if (!this.context.fs.rmdir) throw new FsError("ENOTSUP", { syscall: "rmdir", path });
140
- await host(this.context, () => this.context.fs.rmdir(path, { signal: this.context.signal }));
141
- this.directories.delete(path);
142
- return;
143
- }
144
- const fs = this.pruning.get(path);
145
- if (!fs) throw new ToolError(`patch directory pruning was not admitted: ${path}`);
146
- if (!fs.rmdir) throw new FsError("ENOTSUP", { syscall: "rmdir", path });
147
- await host(this.context, () => fs.rmdir(path, { signal: this.context.signal }));
148
- }
149
- };
150
-
151
- export {
152
- PatchPublication
153
- };