@poe-platform/safe-bash 0.1.811 → 0.1.812
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.
- package/dist/audio-ast/index.d.ts +1 -0
- package/dist/audio-ast/index.js +6 -1
- package/dist/audio-ast/vorbis.d.ts +14 -0
- package/dist/image-ast/index.js +1 -1
- package/dist/pdf-ast/cos/value-parser.d.ts +23 -2
- package/dist/pdf-ast/extract/retained-form-field-details.d.ts +20 -0
- package/dist/pdf-ast/extract/retained-form-fields.d.ts +17 -4
- package/dist/pdf-ast/index.d.ts +1 -0
- package/dist/pdf-ast/index.js +701 -336
- package/dist/pdf-ast/retained-document.d.ts +4 -0
- package/dist/safe-bash/audio-ast.browser.js +2 -1
- package/dist/safe-bash/command-chunks/{biff-3EFLKBAH-NYWZOYQS.js → biff-YKPDH35C-MVQIWNKV.js} +2309 -2277
- package/dist/safe-bash/command-chunks/{chunk-VU3EQF7F.js → chunk-2JSDKQ4J.js} +110 -31
- package/dist/safe-bash/command-chunks/{chunk-72C3TZ2U.js → chunk-3Q247UDJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-HARUYHH7.js → chunk-5HUICAWD.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2VCKUNDZ.js → chunk-B2C3UPJS.js} +27 -17
- package/dist/safe-bash/command-chunks/{chunk-5LI2DLNZ.js → chunk-CJQSAATC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ZHRGYR7B.js → chunk-FDCIPJBQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5MB64DWR.js → chunk-HWQ2UHMT.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-5OO2P27R.js → chunk-NARD63DY.js} +98 -1
- package/dist/safe-bash/command-chunks/{chunk-Z5QOVRVH.js → chunk-SU26FZLJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-DPR5CYQV.js → chunk-XITDDJFT.js} +2 -0
- package/dist/safe-bash/command-chunks/{chunk-YSY6R6AS.js → chunk-XVLWZTPY.js} +230 -28
- package/dist/safe-bash/command-chunks/{chunk-WH3TIOTS.js → chunk-ZEGNRZV2.js} +9 -2
- package/dist/safe-bash/command-chunks/{chunk-KL3OIBKB.js → chunk-ZEX53S5I.js} +1892 -1878
- package/dist/safe-bash/command-chunks/{command-engine-BEWABZ75.js → command-engine-BCUQGJJ4.js} +58 -21
- package/dist/safe-bash/command-chunks/{engine-AXXFTGCL-QBQNBI6K.js → engine-LAUEWYSQ-DQCEI5HE.js} +1 -1
- package/dist/safe-bash-command-apply-patch/apply.js +4 -4
- package/dist/safe-bash-command-apply-patch/index.js +4 -4
- package/dist/safe-bash-command-apply-patch/matcher.js +2 -2
- package/dist/safe-bash-command-apply-patch/parser.js +2 -2
- package/dist/safe-bash-command-apply-patch/shared.d.ts +2 -0
- package/dist/safe-bash-command-apply-patch/shared.js +1 -1
- package/dist/safe-bash-command-ffmpeg/index.js +1 -1
- package/dist/safe-bash-command-ffprobe/index.js +2 -2
- package/dist/safe-bash-command-ffprobe/media.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +1 -1
- package/dist/safe-bash-command-pandoc/index.js +1 -1
- package/dist/safe-bash-command-patch/index.js +2 -2
- package/dist/safe-bash-command-patch/patch-publication.js +1 -1
- package/dist/safe-bash-command-patch/patch.js +2 -2
- package/dist/safe-bash-command-pdftk/index.js +35 -2
- package/dist/safe-bash-command-pptx/command-engine.d.ts +12 -3
- package/dist/safe-bash-command-pptx/engine.d.ts +2 -2
- package/dist/safe-bash-command-pptx/engine.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +2 -2
- package/dist/safe-bash-diff-engine/document.d.ts +2 -1
- package/dist/safe-bash-diff-engine/document.js +7 -4
- package/dist/safe-bash-presentation-engine/command-placeholder.js +4 -3
- package/dist/safe-bash-presentation-engine/index.d.ts +1 -1
- package/dist/safe-bash-presentation-engine/index.js +9 -7
- package/dist/safe-bash-presentation-engine/presentation-model.js +3 -2
- package/dist/safe-bash-presentation-engine/retained-slide-publication.d.ts +24 -0
- package/dist/safe-bash-presentation-engine/slides.d.ts +1 -0
- package/dist/safe-bash-presentation-engine/slides.js +6 -3
- package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +2 -2
- package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +46 -13
- package/dist/spreadsheet-format-xls/biff-metadata.d.ts +1 -0
- package/dist/spreadsheet-format-xls/biff-metadata.js +2 -2
- package/dist/spreadsheet-format-xls/biff-write-metadata.js +10 -1
- package/package.json +2 -2
package/dist/safe-bash/command-chunks/{command-engine-BEWABZ75.js → command-engine-BCUQGJJ4.js}
RENAMED
|
@@ -8781,7 +8781,8 @@ import {
|
|
|
8781
8781
|
import { createPresentation } from "../../safe-bash-presentation-engine/creation.js";
|
|
8782
8782
|
import {
|
|
8783
8783
|
addSlide,
|
|
8784
|
-
mutateSlides
|
|
8784
|
+
mutateSlides,
|
|
8785
|
+
stageRetainedSlideSettings
|
|
8785
8786
|
} from "../../safe-bash-presentation-engine/slides.js";
|
|
8786
8787
|
import { duplicateSlides } from "../../safe-bash-presentation-engine/slide-copy.js";
|
|
8787
8788
|
import { importSlides } from "../../safe-bash-presentation-engine/slide-import.js";
|
|
@@ -11683,7 +11684,7 @@ var declaredOperations = {
|
|
|
11683
11684
|
"xml.set": xmlSetSchema,
|
|
11684
11685
|
capabilities: capabilitiesSchema
|
|
11685
11686
|
};
|
|
11686
|
-
async function
|
|
11687
|
+
async function executeRequest(request, options2, owned) {
|
|
11687
11688
|
if (request.args?.[0] instanceof Uint8Array && request.args[0].length === 4 && request.args[0].every((byte, index) => byte === [100, 105, 102, 102][index]))
|
|
11688
11689
|
return executeDiffCommand(request, options2);
|
|
11689
11690
|
const output3 = { json: false, operation: "help" };
|
|
@@ -11727,7 +11728,24 @@ async function execute(request, options2) {
|
|
|
11727
11728
|
output3.json = args.json;
|
|
11728
11729
|
output3.operation = args.operation;
|
|
11729
11730
|
const operation2 = args.operation;
|
|
11730
|
-
if (
|
|
11731
|
+
if (args.operation === "slides.set" && request.streaming) {
|
|
11732
|
+
if (args.token) decodeSelectionToken2(args.token);
|
|
11733
|
+
const input = await request.streaming.openInput(args.input, Math.min(options2.context.limits.maxBytes, options2.context.archiveLimits.maxArchiveBytes));
|
|
11734
|
+
const destination = args.inPlace ? args.input : args.output;
|
|
11735
|
+
const dryRun = args.dryRun ?? false;
|
|
11736
|
+
const staged = await stageRetainedSlideSettings(input, {
|
|
11737
|
+
...args.mutation,
|
|
11738
|
+
selection: args.selection ?? (args.token ? { token: args.token } : { kind: "slide", ...args.slide === void 0 ? {} : { position: { coordinateSystem: "one-based", value: args.slide } }, ...args.all ? { all: true } : {} }),
|
|
11739
|
+
allowEmpty: args.allowEmpty ?? false
|
|
11740
|
+
}, { ...options2.context, signal: request.signal, workingStorage: request.streaming.workingStorage }, { json: args.json, dryRun, ...destination === void 0 ? {} : { destination }, maxOutputBytes: options2.maxOutputBytes });
|
|
11741
|
+
owned.push(staged);
|
|
11742
|
+
stagedOutput = staged.output;
|
|
11743
|
+
if (destination && destination !== "-") {
|
|
11744
|
+
if (!request.publishOutput) throw Object.assign(new Error("Output publication capability is unavailable."), { code: "publication-unsupported" });
|
|
11745
|
+
publication = { inputPath: args.input, outputPath: destination, bytes: staged.bytes(), originalBytes: input, inPlace: args.inPlace ?? false, force: args.force ?? false, dryRun };
|
|
11746
|
+
}
|
|
11747
|
+
result = success(operation2, null);
|
|
11748
|
+
} else if ((args.operation === "inspect" || args.operation === "text.get" || args.operation === "fields.list" || args.operation === "fields.get" || args.operation === "xml.get") && request.streaming) {
|
|
11731
11749
|
if (args.token) decodeSelectionToken2(args.token);
|
|
11732
11750
|
const input = await request.streaming.openInput(args.input, Math.min(options2.context.limits.maxBytes, options2.context.archiveLimits.maxArchiveBytes));
|
|
11733
11751
|
const hash = sha2564.create();
|
|
@@ -13778,6 +13796,7 @@ ${xml.xml}
|
|
|
13778
13796
|
await stagedOutput?.close().catch(() => {
|
|
13779
13797
|
});
|
|
13780
13798
|
stagedOutput = void 0;
|
|
13799
|
+
if (error instanceof OfficeError16 && error.code === "resource-limit" && error.phase === "publish") return outputLimitFailure(output3.operation, output3.json);
|
|
13781
13800
|
if (request.signal.aborted)
|
|
13782
13801
|
return { exitCode: 130, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
13783
13802
|
const office = error instanceof OfficeError16 ? error : void 0;
|
|
@@ -13806,24 +13825,8 @@ ${xml.xml}
|
|
|
13806
13825
|
human = `pptx: ${diagnostic.code}: ${diagnostic.message}
|
|
13807
13826
|
`;
|
|
13808
13827
|
}
|
|
13809
|
-
if (stagedOutput) {
|
|
13810
|
-
let failed = false;
|
|
13811
|
-
try {
|
|
13812
|
-
await stagedOutput.write(request.streaming.stdout);
|
|
13813
|
-
} catch (error) {
|
|
13814
|
-
failed = true;
|
|
13815
|
-
throw error;
|
|
13816
|
-
} finally {
|
|
13817
|
-
try {
|
|
13818
|
-
await stagedOutput.close();
|
|
13819
|
-
} catch (error) {
|
|
13820
|
-
if (!failed) await Promise.reject(error);
|
|
13821
|
-
}
|
|
13822
|
-
}
|
|
13823
|
-
return { exitCode: 0, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
13824
|
-
}
|
|
13825
13828
|
const { json, operation } = output3;
|
|
13826
|
-
const encoded = binary ?? new TextEncoder().encode(
|
|
13829
|
+
const encoded = (stagedOutput ? new Uint8Array() : binary) ?? new TextEncoder().encode(
|
|
13827
13830
|
json ? `${JSON.stringify(result)}
|
|
13828
13831
|
` : human ?? `${JSON.stringify(result.data, null, 2)}
|
|
13829
13832
|
`
|
|
@@ -13893,7 +13896,8 @@ ${JSON.stringify(failure.data)}
|
|
|
13893
13896
|
if (publication && result.ok) {
|
|
13894
13897
|
try {
|
|
13895
13898
|
request.signal.throwIfAborted();
|
|
13896
|
-
await request.publishOutput(publication);
|
|
13899
|
+
if (publication.bytes instanceof Uint8Array) await request.publishOutput(publication);
|
|
13900
|
+
else if (request.streaming) await request.publishOutput(publication);
|
|
13897
13901
|
} catch (error) {
|
|
13898
13902
|
if (request.signal.aborted)
|
|
13899
13903
|
return { exitCode: 130, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
@@ -13933,6 +13937,22 @@ ${JSON.stringify(failure.data)}
|
|
|
13933
13937
|
};
|
|
13934
13938
|
}
|
|
13935
13939
|
}
|
|
13940
|
+
if (stagedOutput) {
|
|
13941
|
+
let failed = false;
|
|
13942
|
+
try {
|
|
13943
|
+
await stagedOutput.write(request.streaming.stdout);
|
|
13944
|
+
} catch (error) {
|
|
13945
|
+
failed = true;
|
|
13946
|
+
throw error;
|
|
13947
|
+
} finally {
|
|
13948
|
+
try {
|
|
13949
|
+
await stagedOutput.close();
|
|
13950
|
+
} catch (error) {
|
|
13951
|
+
if (!failed) await Promise.reject(error);
|
|
13952
|
+
}
|
|
13953
|
+
}
|
|
13954
|
+
return { exitCode: 0, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
13955
|
+
}
|
|
13936
13956
|
if (operation === "validate" && request.streaming) {
|
|
13937
13957
|
request.signal.throwIfAborted();
|
|
13938
13958
|
await (json || result.ok ? request.streaming.stdout : request.streaming.stderr).write(encoded);
|
|
@@ -13945,6 +13965,23 @@ ${JSON.stringify(failure.data)}
|
|
|
13945
13965
|
stderr: json || result.ok ? new Uint8Array() : encoded
|
|
13946
13966
|
};
|
|
13947
13967
|
}
|
|
13968
|
+
async function execute(request, options2) {
|
|
13969
|
+
const owned = [];
|
|
13970
|
+
let failed = false;
|
|
13971
|
+
try {
|
|
13972
|
+
const result = await executeRequest(request, options2, owned);
|
|
13973
|
+
failed = result.exitCode !== 0;
|
|
13974
|
+
return result;
|
|
13975
|
+
} catch (error) {
|
|
13976
|
+
failed = true;
|
|
13977
|
+
throw error;
|
|
13978
|
+
} finally {
|
|
13979
|
+
const results = await Promise.allSettled(owned.map((value) => value.close()));
|
|
13980
|
+
if (!failed) {
|
|
13981
|
+
for (const result of results) if (result.status === "rejected") await Promise.reject(result.reason);
|
|
13982
|
+
}
|
|
13983
|
+
}
|
|
13984
|
+
}
|
|
13948
13985
|
function createPptxCommandEngine(settings = {}) {
|
|
13949
13986
|
const context = resourceContext(settings.context);
|
|
13950
13987
|
const options2 = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
execute
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
4
|
-
import "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-B2C3UPJS.js";
|
|
4
|
+
import "../safe-bash/command-chunks/chunk-SU26FZLJ.js";
|
|
5
5
|
import "../safe-bash/command-chunks/chunk-66QPYWEF.js";
|
|
6
|
-
import "../safe-bash/command-chunks/chunk-
|
|
7
|
-
import "../safe-bash/command-chunks/chunk-
|
|
6
|
+
import "../safe-bash/command-chunks/chunk-5HUICAWD.js";
|
|
7
|
+
import "../safe-bash/command-chunks/chunk-XITDDJFT.js";
|
|
8
8
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
9
9
|
export {
|
|
10
10
|
execute
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
execute
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
4
|
-
import "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-B2C3UPJS.js";
|
|
4
|
+
import "../safe-bash/command-chunks/chunk-SU26FZLJ.js";
|
|
5
5
|
import {
|
|
6
6
|
settings
|
|
7
7
|
} from "../safe-bash/command-chunks/chunk-66QPYWEF.js";
|
|
8
|
-
import "../safe-bash/command-chunks/chunk-
|
|
9
|
-
import "../safe-bash/command-chunks/chunk-
|
|
8
|
+
import "../safe-bash/command-chunks/chunk-5HUICAWD.js";
|
|
9
|
+
import "../safe-bash/command-chunks/chunk-XITDDJFT.js";
|
|
10
10
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
11
11
|
|
|
12
12
|
// packages/safe-bash-command-apply-patch/src/index.ts
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
contents,
|
|
3
3
|
normalized,
|
|
4
4
|
normalizedCharacter
|
|
5
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
6
|
-
import "../safe-bash/command-chunks/chunk-
|
|
5
|
+
} from "../safe-bash/command-chunks/chunk-SU26FZLJ.js";
|
|
6
|
+
import "../safe-bash/command-chunks/chunk-XITDDJFT.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
8
8
|
export {
|
|
9
9
|
contents,
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
parse,
|
|
3
3
|
parseRecords,
|
|
4
4
|
targetPath
|
|
5
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
6
|
-
import "../safe-bash/command-chunks/chunk-
|
|
5
|
+
} from "../safe-bash/command-chunks/chunk-5HUICAWD.js";
|
|
6
|
+
import "../safe-bash/command-chunks/chunk-XITDDJFT.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
8
8
|
export {
|
|
9
9
|
parse,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PagedStorageCache } from "@poe-platform/safe-fs/storage";
|
|
1
2
|
import { type CommandContext, type FsError } from "../safe-bash-contracts/index.js";
|
|
2
3
|
import type { ApplyPatchLimits } from "./options.js";
|
|
3
4
|
export declare class PatchError extends Error {
|
|
@@ -12,6 +13,7 @@ export declare class FileFailure extends Error {
|
|
|
12
13
|
export declare class Work {
|
|
13
14
|
readonly context: CommandContext;
|
|
14
15
|
readonly limits: ApplyPatchLimits;
|
|
16
|
+
readonly documentCache: PagedStorageCache;
|
|
15
17
|
private units;
|
|
16
18
|
private nextYield;
|
|
17
19
|
private closed;
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
sliceMp4,
|
|
21
21
|
srtAst,
|
|
22
22
|
webvttAst
|
|
23
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
23
|
+
} from "../safe-bash/command-chunks/chunk-2JSDKQ4J.js";
|
|
24
24
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
25
25
|
|
|
26
26
|
// packages/safe-bash-command-ffmpeg/src/index.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createFfprobeCommand
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-XVLWZTPY.js";
|
|
4
4
|
import "../safe-bash/command-chunks/chunk-MGBHGZEX.js";
|
|
5
|
-
import "../safe-bash/command-chunks/chunk-
|
|
5
|
+
import "../safe-bash/command-chunks/chunk-2JSDKQ4J.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
7
7
|
|
|
8
8
|
// packages/safe-bash-command-ffprobe/src/index.ts
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
loadManifestResources,
|
|
11
11
|
resolvePath,
|
|
12
12
|
rethrowRuntimeError
|
|
13
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
13
|
+
} from "../safe-bash/command-chunks/chunk-XVLWZTPY.js";
|
|
14
14
|
import "../safe-bash/command-chunks/chunk-MGBHGZEX.js";
|
|
15
|
-
import "../safe-bash/command-chunks/chunk-
|
|
15
|
+
import "../safe-bash/command-chunks/chunk-2JSDKQ4J.js";
|
|
16
16
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
17
17
|
export {
|
|
18
18
|
createFfprobeCommand,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
eR,
|
|
3
3
|
iR,
|
|
4
4
|
jh
|
|
5
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
5
|
+
} from "../safe-bash/command-chunks/chunk-ZEX53S5I.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-7QRIAJEQ.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-IOEUZ4EA.js";
|
|
8
8
|
import "../safe-bash/command-chunks/chunk-E6SK3OU2.js";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
tl,
|
|
25
25
|
tr,
|
|
26
26
|
vP
|
|
27
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
27
|
+
} from "../safe-bash/command-chunks/chunk-ZEX53S5I.js";
|
|
28
28
|
import "../safe-bash/command-chunks/chunk-7QRIAJEQ.js";
|
|
29
29
|
import "../safe-bash/command-chunks/chunk-IOEUZ4EA.js";
|
|
30
30
|
import "../safe-bash/command-chunks/chunk-E6SK3OU2.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
patchCommand
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
4
|
-
import "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-3Q247UDJ.js";
|
|
4
|
+
import "../safe-bash/command-chunks/chunk-ZEGNRZV2.js";
|
|
5
5
|
import {
|
|
6
6
|
evalSyncPatch
|
|
7
7
|
} from "../safe-bash/command-chunks/chunk-KSY3QHLY.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
patchCommand
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
4
|
-
import "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-3Q247UDJ.js";
|
|
4
|
+
import "../safe-bash/command-chunks/chunk-ZEGNRZV2.js";
|
|
5
5
|
import "../safe-bash/command-chunks/chunk-JKLOBSMP.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-2VLAXKTS.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-MOZD7RUY.js";
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
2
2
|
|
|
3
|
+
// packages/safe-bash-command-pdftk/src/retained-fields.ts
|
|
4
|
+
async function* retainedFieldReport(document, utf8, signal) {
|
|
5
|
+
const encoder = new TextEncoder();
|
|
6
|
+
let work = 0;
|
|
7
|
+
async function* line(prefix, value) {
|
|
8
|
+
let part = prefix;
|
|
9
|
+
for (const char of String(value)) {
|
|
10
|
+
const code = char.codePointAt(0);
|
|
11
|
+
part += !utf8 && code > 127 ? `&#${code};` : char;
|
|
12
|
+
if (part.length >= 4096) {
|
|
13
|
+
signal.throwIfAborted();
|
|
14
|
+
if (++work % 16 === 0) await new Promise((resolve) => setTimeout(resolve, 0));
|
|
15
|
+
yield encoder.encode(part);
|
|
16
|
+
part = "";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
signal.throwIfAborted();
|
|
20
|
+
yield encoder.encode(part + "\n");
|
|
21
|
+
}
|
|
22
|
+
for await (const field of document.formFieldDetails()) {
|
|
23
|
+
yield encoder.encode("---\n");
|
|
24
|
+
yield* line("FieldType: ", field.type === "checkbox" ? "Button" : field.type === "choice" ? "Choice" : "Text");
|
|
25
|
+
yield* line("FieldName: ", field.name);
|
|
26
|
+
if (field.altName) yield* line("FieldNameAlt: ", field.altName);
|
|
27
|
+
yield* line("FieldFlags: ", field.flags);
|
|
28
|
+
for await (const value of field.values()) yield* line("FieldValue: ", value);
|
|
29
|
+
if (field.defaultValue !== void 0 && field.defaultValue !== "") yield* line("FieldValueDefault: ", field.defaultValue);
|
|
30
|
+
yield* line("FieldJustification: ", field.justification);
|
|
31
|
+
for await (const option of field.options()) yield* line("FieldStateOption: ", option);
|
|
32
|
+
if (field.maxLength !== void 0) yield* line("FieldMaxLength: ", field.maxLength);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
3
36
|
// packages/safe-bash-command-pdftk/src/retained.ts
|
|
4
37
|
import { PdfError, PdfFileSource, PdfRetainedDocument, retainedCosObjects } from "../pdf-ast/index.js";
|
|
5
38
|
import { FsError } from "../safe-bash-contracts/errors.js";
|
|
@@ -284,7 +317,7 @@ async function executeRetainedPdftk(context, options) {
|
|
|
284
317
|
}
|
|
285
318
|
const primary = options.inputs[0];
|
|
286
319
|
document = await PdfRetainedDocument.open(inputs.get(primary.file), storage, { signal, recovery: "strict", ...primary.password ? { password: primary.password } : {} });
|
|
287
|
-
output = await PdfFileSource.fromStream(context.fs, storage.directory, retainedAnnotationReport(document, storage, options.operation.endsWith("_utf8"), signal), { signal });
|
|
320
|
+
output = await PdfFileSource.fromStream(context.fs, storage.directory, options.operation === "dump_data_fields" || options.operation === "dump_data_fields_utf8" ? retainedFieldReport(document, options.operation.endsWith("_utf8"), signal) : retainedAnnotationReport(document, storage, options.operation.endsWith("_utf8"), signal), { signal });
|
|
288
321
|
const destination = options.outputTarget;
|
|
289
322
|
if (!destination || destination === "-") for await (const bytes of output.stream(0, output.size, signal)) await writeBytes(context.stdout, bytes, signal);
|
|
290
323
|
else {
|
|
@@ -2155,7 +2188,7 @@ async function executePdftk(context) {
|
|
|
2155
2188
|
const carrier = getCommandArguments(context);
|
|
2156
2189
|
const argv = [...carrier.args];
|
|
2157
2190
|
const parsed = await drainSteps(parsePdftkArgumentsSteps(argv), invocation.signal);
|
|
2158
|
-
if (parsed.options && ["dump_data_annots", "dump_data_annots_utf8"].includes(parsed.options.operation)) {
|
|
2191
|
+
if (parsed.options && ["dump_data_annots", "dump_data_annots_utf8", "dump_data_fields", "dump_data_fields_utf8"].includes(parsed.options.operation)) {
|
|
2159
2192
|
return await executeRetainedPdftk({ ...context, signal: invocation.signal, stdout: invocation.child(context.stdout).output }, parsed.options);
|
|
2160
2193
|
}
|
|
2161
2194
|
const vfsFiles = /* @__PURE__ */ new Map();
|
|
@@ -17,9 +17,11 @@ export interface AdmittedCommandEngineOptions {
|
|
|
17
17
|
}
|
|
18
18
|
import type { PptxPublicationRequest } from "../safe-bash-presentation-engine/publication.js";
|
|
19
19
|
export type { PptxPublicationRequest } from "../safe-bash-presentation-engine/publication.js";
|
|
20
|
-
export
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
20
|
+
export type PptxStreamPublicationRequest = Omit<PptxPublicationRequest, "bytes" | "originalBytes"> & {
|
|
21
|
+
readonly bytes: import("../safe-bash-contracts/index.js").ByteSource;
|
|
22
|
+
readonly originalBytes: import("./streaming-inputs.js").PptxRetainedInput;
|
|
23
|
+
};
|
|
24
|
+
interface PptxRequestBase {
|
|
23
25
|
readonly preflightOutput?: (publication: PptxPublicationRequest) => Promise<void>;
|
|
24
26
|
/** Trusted adapter transaction: either every requested file is published or none is. */
|
|
25
27
|
readonly publishOutputs?: (publications: readonly PptxPublicationRequest[]) => Promise<void>;
|
|
@@ -27,6 +29,13 @@ export interface PptxCommandRequest {
|
|
|
27
29
|
readonly signal: AbortSignal;
|
|
28
30
|
readonly readInput: (path: string, maxBytes: number) => Promise<Uint8Array>;
|
|
29
31
|
}
|
|
32
|
+
export type PptxCommandRequest = PptxRequestBase & ({
|
|
33
|
+
readonly streaming?: undefined;
|
|
34
|
+
readonly publishOutput?: (publication: PptxPublicationRequest) => Promise<void>;
|
|
35
|
+
} | {
|
|
36
|
+
readonly streaming: import("./streaming-inputs.js").PptxStreamingIO;
|
|
37
|
+
readonly publishOutput?: (publication: PptxPublicationRequest | PptxStreamPublicationRequest) => Promise<void>;
|
|
38
|
+
});
|
|
30
39
|
export interface PptxCommandOutput {
|
|
31
40
|
readonly exitCode: number;
|
|
32
41
|
readonly stdout: Uint8Array;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from "../safe-bash-presentation-engine/index.js";
|
|
2
|
-
import type { PptxCommandEngine, PptxCommandEngineOptions, PptxCommandRequest, PptxCommandOutput, PptxPublicationRequest } from "./command-engine.js";
|
|
3
|
-
export type { PptxCommandEngine, PptxCommandEngineOptions, PptxCommandRequest, PptxCommandOutput, PptxPublicationRequest };
|
|
2
|
+
import type { PptxCommandEngine, PptxCommandEngineOptions, PptxCommandRequest, PptxCommandOutput, PptxPublicationRequest, PptxStreamPublicationRequest } from "./command-engine.js";
|
|
3
|
+
export type { PptxCommandEngine, PptxCommandEngineOptions, PptxCommandRequest, PptxCommandOutput, PptxPublicationRequest, PptxStreamPublicationRequest };
|
|
4
4
|
export declare function createPptxCommandEngine(settings?: PptxCommandEngineOptions): PptxCommandEngine;
|
|
@@ -27,7 +27,7 @@ function createPptxCommandEngine(settings = {}) {
|
|
|
27
27
|
};
|
|
28
28
|
return Object.freeze({
|
|
29
29
|
async execute(request) {
|
|
30
|
-
const mod = await (cachedPptxEngineMod ??= import("../safe-bash/command-chunks/command-engine-
|
|
30
|
+
const mod = await (cachedPptxEngineMod ??= import("../safe-bash/command-chunks/command-engine-BCUQGJJ4.js"));
|
|
31
31
|
return mod.createPptxCommandEngine(ownedSettings).execute(request);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
gt,
|
|
11
11
|
j,
|
|
12
12
|
oe
|
|
13
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
13
|
+
} from "../safe-bash/command-chunks/chunk-HWQ2UHMT.js";
|
|
14
14
|
import {
|
|
15
15
|
a,
|
|
16
16
|
g,
|
|
@@ -719,7 +719,7 @@ var le;
|
|
|
719
719
|
function wr(...u) {
|
|
720
720
|
return le ??= V({ read: readZipArchiveEntries, write: createStoredZipArchive }), le(...u);
|
|
721
721
|
}
|
|
722
|
-
var H = de(async (u) => (await import("../safe-bash/command-chunks/engine-
|
|
722
|
+
var H = de(async (u) => (await import("../safe-bash/command-chunks/engine-LAUEWYSQ-DQCEI5HE.js")).createEngine(u), true, wr);
|
|
723
723
|
var Do = H.createSsconvertCommand;
|
|
724
724
|
var To = H.createSsconvertCommands;
|
|
725
725
|
var Uo = H.ssconvertCommands;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PagedStorage } from "@poe-platform/safe-fs/storage";
|
|
1
|
+
import { PagedStorage, type PagedStorageCache } from "@poe-platform/safe-fs/storage";
|
|
2
2
|
import { type ByteSource, type CommandContext } from "../safe-bash-contracts/index.js";
|
|
3
3
|
export interface DocumentBudget {
|
|
4
4
|
readonly context: CommandContext;
|
|
5
|
+
readonly documentCache?: PagedStorageCache;
|
|
5
6
|
step(amount?: number): void;
|
|
6
7
|
checkpoint(): void | Promise<void>;
|
|
7
8
|
}
|
|
@@ -11,8 +11,8 @@ async function closeDocumentResources(resources) {
|
|
|
11
11
|
var IndexedDocument = class {
|
|
12
12
|
constructor(budget, pages = 16) {
|
|
13
13
|
this.budget = budget;
|
|
14
|
-
this.data = new PagedStorage(budget.context, pages);
|
|
15
|
-
this.index = new PagedStorage(budget.context, pages);
|
|
14
|
+
this.data = new PagedStorage(budget.context, pages, budget.documentCache);
|
|
15
|
+
this.index = new PagedStorage(budget.context, pages, budget.documentCache);
|
|
16
16
|
budget.context.registerCleanup?.(() => this.close());
|
|
17
17
|
}
|
|
18
18
|
budget;
|
|
@@ -87,8 +87,10 @@ var IndexedDocument = class {
|
|
|
87
87
|
const bytes = await this.index.read(8 + position * 24, 24);
|
|
88
88
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
89
89
|
const line = { start: view.getFloat64(0, true), end: view.getFloat64(8, true), hash: view.getUint32(16, true) };
|
|
90
|
-
if (this.
|
|
91
|
-
|
|
90
|
+
if (!this.budget.documentCache) {
|
|
91
|
+
if (this.cache.size === 256) this.cache.delete(this.cache.keys().next().value);
|
|
92
|
+
this.cache.set(position, line);
|
|
93
|
+
}
|
|
92
94
|
return line;
|
|
93
95
|
}
|
|
94
96
|
async equal(position, other, otherPosition) {
|
|
@@ -110,6 +112,7 @@ var IndexedDocument = class {
|
|
|
110
112
|
return true;
|
|
111
113
|
}
|
|
112
114
|
retainComparison(position, line, bytes) {
|
|
115
|
+
if (this.budget.documentCache) return;
|
|
113
116
|
if (this.comparisons.has(position)) return;
|
|
114
117
|
if (this.comparisons.size === 512) this.comparisons.delete(this.comparisons.keys().next().value);
|
|
115
118
|
this.comparisons.set(position, { line, bytes });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
insertPlaceholder
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
4
|
-
import "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-FDCIPJBQ.js";
|
|
4
|
+
import "../safe-bash/command-chunks/chunk-CJQSAATC.js";
|
|
5
5
|
import "../safe-bash/command-chunks/chunk-KJ4XXZIL.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-ATTWQVR2.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-LXLLA4PM.js";
|
|
@@ -15,7 +15,8 @@ import "../safe-bash/command-chunks/chunk-EHSM5ZQS.js";
|
|
|
15
15
|
import "../safe-bash/command-chunks/chunk-2CORNDGF.js";
|
|
16
16
|
import "../safe-bash/command-chunks/chunk-PMAM4N33.js";
|
|
17
17
|
import "../safe-bash/command-chunks/chunk-456PHA3L.js";
|
|
18
|
-
import "../safe-bash/command-chunks/chunk-
|
|
18
|
+
import "../safe-bash/command-chunks/chunk-NARD63DY.js";
|
|
19
|
+
import "../safe-bash/command-chunks/chunk-ZXR6LXV5.js";
|
|
19
20
|
import "../safe-bash/command-chunks/chunk-L5MCW6CM.js";
|
|
20
21
|
import "../safe-bash/command-chunks/chunk-6M6TM5Z5.js";
|
|
21
22
|
import "../safe-bash/command-chunks/chunk-B5LDP7AA.js";
|
|
@@ -27,7 +27,7 @@ export type { PartView, PackageView, PartRelationship } from "./package-view.js"
|
|
|
27
27
|
export type { XmlElementView } from "./xml-view.js";
|
|
28
28
|
export { Presentation, type PresentationModel, type PresentationContext, type PresentationPublication } from "./presentation-model.js";
|
|
29
29
|
export { createPresentation, type CreatePresentationOptions, type PresentationProperties, type PresentationSlideInput, type PresentationTextShape } from "./creation.js";
|
|
30
|
-
export { addSlide, mutateSlides, openRetainedSlideSettings, type RetainedSlideSettings, type MutateSlidesOptions, type AddSlideOptions, type PlaceholderText } from "./slides.js";
|
|
30
|
+
export { addSlide, mutateSlides, openRetainedSlideSettings, stageRetainedSlideSettings, type RetainedSlideSettings, type MutateSlidesOptions, type AddSlideOptions, type PlaceholderText } from "./slides.js";
|
|
31
31
|
export { removeSlides, type RemoveSlidesOptions } from "./slide-removal.js";
|
|
32
32
|
export { listLinks, setLink, removeLink, openLinkSession, type LinkAction, type LinkOptions, type SetLinkOptions, type LinkSession, type LinkData } from "./links.js";
|
|
33
33
|
export { ActionSetting, Hyperlink, _Hyperlink, PP_ACTION, PP_ACTION_TYPE, LinkShape, LinkRun, type ActionValue, type LinkModelOwner, type LinkShapeIdentity } from "./links-model.js";
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
openPackageArchive
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-ZXR6LXV5.js";
|
|
4
1
|
import {
|
|
5
2
|
mutateTags,
|
|
6
3
|
readTags
|
|
@@ -95,7 +92,7 @@ import {
|
|
|
95
92
|
} from "../safe-bash/command-chunks/chunk-JFYWVQ4V.js";
|
|
96
93
|
import {
|
|
97
94
|
insertPlaceholder
|
|
98
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
95
|
+
} from "../safe-bash/command-chunks/chunk-FDCIPJBQ.js";
|
|
99
96
|
import {
|
|
100
97
|
sanitize
|
|
101
98
|
} from "../safe-bash/command-chunks/chunk-M7QE2MN7.js";
|
|
@@ -149,7 +146,7 @@ import {
|
|
|
149
146
|
Presentation,
|
|
150
147
|
SlideLayout,
|
|
151
148
|
SlideLayouts
|
|
152
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
149
|
+
} from "../safe-bash/command-chunks/chunk-CJQSAATC.js";
|
|
153
150
|
import {
|
|
154
151
|
getXmlPart,
|
|
155
152
|
openRetainedXmlPart,
|
|
@@ -281,8 +278,12 @@ import {
|
|
|
281
278
|
import {
|
|
282
279
|
addSlide,
|
|
283
280
|
mutateSlides,
|
|
284
|
-
openRetainedSlideSettings
|
|
285
|
-
|
|
281
|
+
openRetainedSlideSettings,
|
|
282
|
+
stageRetainedSlideSettings
|
|
283
|
+
} from "../safe-bash/command-chunks/chunk-NARD63DY.js";
|
|
284
|
+
import {
|
|
285
|
+
openPackageArchive
|
|
286
|
+
} from "../safe-bash/command-chunks/chunk-ZXR6LXV5.js";
|
|
286
287
|
import "../safe-bash/command-chunks/chunk-L5MCW6CM.js";
|
|
287
288
|
import {
|
|
288
289
|
CoreProperties,
|
|
@@ -780,6 +781,7 @@ export {
|
|
|
780
781
|
shapePathXml,
|
|
781
782
|
shapePresets,
|
|
782
783
|
splitSlides,
|
|
784
|
+
stageRetainedSlideSettings,
|
|
783
785
|
stageRetainedXmlPart,
|
|
784
786
|
textCapitalizationStyles,
|
|
785
787
|
textStrikeStyles,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Presentation
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-CJQSAATC.js";
|
|
4
4
|
import "../safe-bash/command-chunks/chunk-KJ4XXZIL.js";
|
|
5
5
|
import "../safe-bash/command-chunks/chunk-ATTWQVR2.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-LXLLA4PM.js";
|
|
@@ -14,7 +14,8 @@ import "../safe-bash/command-chunks/chunk-EHSM5ZQS.js";
|
|
|
14
14
|
import "../safe-bash/command-chunks/chunk-2CORNDGF.js";
|
|
15
15
|
import "../safe-bash/command-chunks/chunk-PMAM4N33.js";
|
|
16
16
|
import "../safe-bash/command-chunks/chunk-456PHA3L.js";
|
|
17
|
-
import "../safe-bash/command-chunks/chunk-
|
|
17
|
+
import "../safe-bash/command-chunks/chunk-NARD63DY.js";
|
|
18
|
+
import "../safe-bash/command-chunks/chunk-ZXR6LXV5.js";
|
|
18
19
|
import "../safe-bash/command-chunks/chunk-L5MCW6CM.js";
|
|
19
20
|
import "../safe-bash/command-chunks/chunk-6M6TM5Z5.js";
|
|
20
21
|
import "../safe-bash/command-chunks/chunk-B5LDP7AA.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ByteSource } from './contracts.js';
|
|
2
|
+
import { type RetainedPackageContext } from './retained-package.js';
|
|
3
|
+
import type { MutateSlidesOptions } from './slides.js';
|
|
4
|
+
import { type StagedOutput } from './retained-output.js';
|
|
5
|
+
export interface RetainedSlideSource {
|
|
6
|
+
readonly size: number;
|
|
7
|
+
read(position: number, maximum: number, options: {
|
|
8
|
+
readonly signal: AbortSignal;
|
|
9
|
+
}): Promise<Uint8Array>;
|
|
10
|
+
stream(): ByteSource;
|
|
11
|
+
}
|
|
12
|
+
/** Owns archive and response staging; borrows the caller's immutable input. */
|
|
13
|
+
export declare function stageRetainedSlideSettings(input: RetainedSlideSource, options: Omit<MutateSlidesOptions, 'position'>, settings: RetainedPackageContext, output: {
|
|
14
|
+
json: boolean;
|
|
15
|
+
dryRun: boolean;
|
|
16
|
+
destination?: string;
|
|
17
|
+
maxOutputBytes: number;
|
|
18
|
+
}): Promise<Readonly<{
|
|
19
|
+
bytes: () => ByteSource;
|
|
20
|
+
size: number;
|
|
21
|
+
fingerprint: string;
|
|
22
|
+
output: StagedOutput;
|
|
23
|
+
close: () => Promise<void>;
|
|
24
|
+
}>>;
|
|
@@ -33,3 +33,4 @@ export declare function prepareSlideInsertion(reader: PackageReader, options: Ad
|
|
|
33
33
|
export declare function prepareSlideMutationOptions(options: MutateSlidesOptions, context: SelectionContext): readonly SelectionQuery[];
|
|
34
34
|
export declare function mutateSlides(input: BinaryInput, options: MutateSlidesOptions, context: SelectionContext): Promise<Uint8Array>;
|
|
35
35
|
export { openRetainedSlideSettings, type RetainedSlideSettings } from './retained-slide-settings.js';
|
|
36
|
+
export { stageRetainedSlideSettings } from "./retained-slide-publication.js";
|
|
@@ -3,8 +3,10 @@ import {
|
|
|
3
3
|
mutateSlides,
|
|
4
4
|
openRetainedSlideSettings,
|
|
5
5
|
prepareSlideInsertion,
|
|
6
|
-
prepareSlideMutationOptions
|
|
7
|
-
|
|
6
|
+
prepareSlideMutationOptions,
|
|
7
|
+
stageRetainedSlideSettings
|
|
8
|
+
} from "../safe-bash/command-chunks/chunk-NARD63DY.js";
|
|
9
|
+
import "../safe-bash/command-chunks/chunk-ZXR6LXV5.js";
|
|
8
10
|
import "../safe-bash/command-chunks/chunk-L5MCW6CM.js";
|
|
9
11
|
import "../safe-bash/command-chunks/chunk-DM2CPMB4.js";
|
|
10
12
|
import "../safe-bash/command-chunks/chunk-X7FA7ZD5.js";
|
|
@@ -29,5 +31,6 @@ export {
|
|
|
29
31
|
mutateSlides,
|
|
30
32
|
openRetainedSlideSettings,
|
|
31
33
|
prepareSlideInsertion,
|
|
32
|
-
prepareSlideMutationOptions
|
|
34
|
+
prepareSlideMutationOptions,
|
|
35
|
+
stageRetainedSlideSettings
|
|
33
36
|
};
|