@poe-platform/safe-bash 0.1.816 → 0.1.817
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/pdf-ast/content/evaluator.d.ts +4 -0
- package/dist/pdf-ast/cos/value-parser.d.ts +2 -0
- package/dist/pdf-ast/fonts/resolve.d.ts +5 -1
- package/dist/pdf-ast/index.js +172 -165
- package/dist/safe-bash/command-chunks/biff-KLS4T7FP-UO3CXFFF.js +5581 -0
- package/dist/safe-bash/command-chunks/chunk-2J4OQT3F.js +153 -0
- package/dist/safe-bash/command-chunks/{chunk-K7VDCBXW.js → chunk-ABL2DPJI.js} +20 -20
- package/dist/safe-bash/command-chunks/{chunk-RINR7XPR.js → chunk-E64ZI2YB.js} +121 -4
- package/dist/safe-bash/command-chunks/{chunk-GEDO5V32.js → chunk-FSG6UC2N.js} +243 -105
- package/dist/safe-bash/command-chunks/{chunk-4QEJPP3K.js → chunk-S5X7PBO4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IHLZ6HNQ.js → chunk-TSKJNCKD.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-DBZCTL7C.js → chunk-UYZ6EFZE.js} +20 -18
- package/dist/safe-bash/command-chunks/{chunk-B2C3UPJS.js → chunk-W42SUPD6.js} +13 -1
- package/dist/safe-bash/command-chunks/chunk-ZHHALBM7.js +398 -0
- package/dist/safe-bash/command-chunks/{command-engine-GHE6QUHU.js → command-engine-2QXVRRH3.js} +8 -4
- package/dist/safe-bash/command-chunks/{engine-RG6HQCCB-FXYZS264.js → engine-T4GP6QOK-ECFKMR5V.js} +1 -1
- package/dist/safe-bash/command-chunks/odf-SL5TG4B3-XI3FNOTN.js +3041 -0
- package/dist/safe-bash/command-chunks/{xlsx-RE54MFCS-IQ6OXXKK.js → xlsx-RE54MFCS-4UZ5W3U7.js} +1 -1
- package/dist/safe-bash-command-apply-patch/apply.js +1 -1
- package/dist/safe-bash-command-apply-patch/index.js +1 -1
- package/dist/safe-bash-command-csvkit/index.js +1 -1
- package/dist/safe-bash-command-diff/diff.js +1 -1
- package/dist/safe-bash-command-diff/index.js +1 -1
- package/dist/safe-bash-command-pptx/engine.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +5 -5
- package/dist/safe-bash-presentation-engine/index.js +1 -1
- package/dist/safe-bash-presentation-engine/retained-tags.d.ts +20 -0
- package/dist/safe-bash-presentation-engine/tags.d.ts +2 -0
- package/dist/safe-bash-presentation-engine/tags.js +11 -3
- package/dist/safe-bash-xml-engine/document.js +2 -2
- package/dist/safe-bash-xml-engine/index.js +2 -2
- package/dist/safe-bash-xml-engine/stored-document.d.ts +2 -0
- package/dist/safe-bash-xml-engine/stored-document.js +1 -1
- package/dist/safe-bash-xml-engine/stored-evaluate.js +2 -2
- package/dist/safe-bash-xml-engine/stored-namespaces.d.ts +21 -0
- package/dist/safe-bash-zip-engine/zip/safety.js +1 -1
- package/dist/safe-bash-zip-engine/zip/volumes.js +1 -1
- package/dist/spreadsheet-format-xls/biff-properties-merge.js +3 -3
- package/dist/spreadsheet-format-xls/biff-properties.d.ts +4 -2
- package/dist/spreadsheet-format-xls/biff-properties.js +141 -122
- package/dist/spreadsheet-format-xls/biff-property-names.d.ts +24 -0
- package/dist/spreadsheet-format-xls/biff-property-names.js +167 -0
- package/dist/xlsx-ast/comment-geometry.js +1 -1
- package/package.json +3 -2
- package/dist/safe-bash/command-chunks/biff-UBP2BZLK-JPODPKS3.js +0 -5448
- package/dist/safe-bash/command-chunks/chunk-O2HNOQQG.js +0 -161
- package/dist/safe-bash/command-chunks/chunk-ZUP5TBRG.js +0 -99
- package/dist/safe-bash/command-chunks/odf-3EA3EVSD-7B5GVNTC.js +0 -3097
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type CapabilityContext } from "../spreadsheet-engine/contracts.js";
|
|
2
|
+
/** Exact UTF-16 identity, including empty names and embedded NULs. Calls are sequential.
|
|
3
|
+
* A bounded hash index points to name records; collisions use exact bounded comparisons. */
|
|
4
|
+
export declare class BiffPropertyNames {
|
|
5
|
+
private readonly context;
|
|
6
|
+
private readonly charge;
|
|
7
|
+
private readonly storage;
|
|
8
|
+
private readonly index;
|
|
9
|
+
private readonly fallback;
|
|
10
|
+
private initialized;
|
|
11
|
+
private pending;
|
|
12
|
+
private closed;
|
|
13
|
+
private closing;
|
|
14
|
+
constructor(context: CapabilityContext, charge: (amount: number) => void);
|
|
15
|
+
private check;
|
|
16
|
+
private io;
|
|
17
|
+
private allocate;
|
|
18
|
+
private read;
|
|
19
|
+
private fingerprint;
|
|
20
|
+
private contains;
|
|
21
|
+
has(name: string): Promise<boolean>;
|
|
22
|
+
add(name: string): Promise<void>;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { sha256 } from '@noble/hashes/sha2.js';
|
|
2
|
+
import { IntegerTable } from "@poe-platform/safe-fs/storage";
|
|
3
|
+
import { SsconvertError } from "../spreadsheet-engine/contracts.js";
|
|
4
|
+
/** Exact UTF-16 identity, including empty names and embedded NULs. Calls are sequential.
|
|
5
|
+
* A bounded hash index points to name records; collisions use exact bounded comparisons. */
|
|
6
|
+
export class BiffPropertyNames {
|
|
7
|
+
context;
|
|
8
|
+
charge;
|
|
9
|
+
storage;
|
|
10
|
+
index;
|
|
11
|
+
fallback;
|
|
12
|
+
initialized = false;
|
|
13
|
+
pending = Promise.resolve();
|
|
14
|
+
closed = false;
|
|
15
|
+
closing;
|
|
16
|
+
constructor(context, charge) {
|
|
17
|
+
this.context = context;
|
|
18
|
+
this.charge = charge;
|
|
19
|
+
this.storage = context.createWorkingStorage?.();
|
|
20
|
+
if (this.storage)
|
|
21
|
+
this.index = new IntegerTable({ allocate: length => this.allocate(length),
|
|
22
|
+
read: (at, length) => this.read(at, length),
|
|
23
|
+
write: async (at, bytes) => {
|
|
24
|
+
const owned = new Uint8Array(bytes);
|
|
25
|
+
try {
|
|
26
|
+
await this.io(() => this.storage.write(at, owned));
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
owned.fill(0);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, 64);
|
|
33
|
+
else
|
|
34
|
+
this.fallback = new Set();
|
|
35
|
+
context.own(() => this.close());
|
|
36
|
+
}
|
|
37
|
+
check() {
|
|
38
|
+
this.context.signal.throwIfAborted();
|
|
39
|
+
if (this.closed)
|
|
40
|
+
throw new SsconvertError('invalid-request', 'BIFF property name index is closed');
|
|
41
|
+
}
|
|
42
|
+
io(action) {
|
|
43
|
+
const result = this.pending.then(async () => { this.check(); const value = await action(); this.check(); return value; });
|
|
44
|
+
this.pending = result.then(() => undefined, () => undefined);
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
allocate(length) {
|
|
48
|
+
this.check();
|
|
49
|
+
const position = this.storage.allocate(length);
|
|
50
|
+
this.check();
|
|
51
|
+
return position;
|
|
52
|
+
}
|
|
53
|
+
read(at, length) {
|
|
54
|
+
return this.io(async () => {
|
|
55
|
+
const bytes = await this.storage.read(at, length);
|
|
56
|
+
if (bytes.length !== length)
|
|
57
|
+
throw new SsconvertError('io', 'Truncated BIFF property name index');
|
|
58
|
+
return new Uint8Array(bytes);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
fingerprint(name) {
|
|
62
|
+
const hash = sha256.create(), buffer = new Uint8Array(Math.min(16384, name.length * 2)), view = new DataView(buffer.buffer);
|
|
63
|
+
try {
|
|
64
|
+
for (let at = 0; at < name.length;) {
|
|
65
|
+
this.check();
|
|
66
|
+
const count = Math.min(buffer.length / 2, name.length - at);
|
|
67
|
+
for (let i = 0; i < count; i++)
|
|
68
|
+
view.setUint16(i * 2, name.charCodeAt(at + i), true);
|
|
69
|
+
hash.update(buffer.subarray(0, count * 2));
|
|
70
|
+
at += count;
|
|
71
|
+
}
|
|
72
|
+
const digest = hash.digest();
|
|
73
|
+
return new DataView(digest.buffer, digest.byteOffset, digest.byteLength).getBigUint64(0, true);
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
buffer.fill(0);
|
|
77
|
+
hash.destroy();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async contains(name, head) {
|
|
81
|
+
let position = Number(head ?? 0n);
|
|
82
|
+
while (position) {
|
|
83
|
+
this.charge(1);
|
|
84
|
+
const record = new DataView((await this.read(position, 24)).buffer);
|
|
85
|
+
position = record.getFloat64(0, true);
|
|
86
|
+
if (record.getFloat64(8, true) !== name.length)
|
|
87
|
+
continue;
|
|
88
|
+
const start = record.getFloat64(16, true);
|
|
89
|
+
let same = true;
|
|
90
|
+
for (let at = 0; at < name.length;) {
|
|
91
|
+
const count = Math.min(8192, name.length - at);
|
|
92
|
+
this.charge(count);
|
|
93
|
+
const bytes = await this.read(start + at * 2, count * 2);
|
|
94
|
+
const view = new DataView(bytes.buffer);
|
|
95
|
+
for (let i = 0; i < count; i++)
|
|
96
|
+
if (view.getUint16(i * 2, true) !== name.charCodeAt(at + i)) {
|
|
97
|
+
same = false;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (!same)
|
|
101
|
+
break;
|
|
102
|
+
at += count;
|
|
103
|
+
}
|
|
104
|
+
if (same)
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
async has(name) {
|
|
110
|
+
this.check();
|
|
111
|
+
this.charge(name.length + 1);
|
|
112
|
+
if (this.fallback)
|
|
113
|
+
return this.fallback.has(name);
|
|
114
|
+
const head = await this.index.get(this.fingerprint(name));
|
|
115
|
+
this.check();
|
|
116
|
+
return this.contains(name, head);
|
|
117
|
+
}
|
|
118
|
+
async add(name) {
|
|
119
|
+
this.check();
|
|
120
|
+
this.charge(name.length + 1);
|
|
121
|
+
if (this.fallback) {
|
|
122
|
+
this.fallback.add(name);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (!this.initialized) {
|
|
126
|
+
this.allocate(8);
|
|
127
|
+
this.check();
|
|
128
|
+
this.initialized = true;
|
|
129
|
+
}
|
|
130
|
+
const key = this.fingerprint(name), head = await this.index.get(key);
|
|
131
|
+
this.check();
|
|
132
|
+
if (await this.contains(name, head))
|
|
133
|
+
return;
|
|
134
|
+
const start = this.allocate(name.length * 2), buffer = new Uint8Array(Math.min(16384, name.length * 2));
|
|
135
|
+
const view = new DataView(buffer.buffer);
|
|
136
|
+
try {
|
|
137
|
+
for (let at = 0; at < name.length;) {
|
|
138
|
+
const count = Math.min(buffer.length / 2, name.length - at);
|
|
139
|
+
for (let i = 0; i < count; i++)
|
|
140
|
+
view.setUint16(i * 2, name.charCodeAt(at + i), true);
|
|
141
|
+
await this.io(() => this.storage.write(start + at * 2, buffer.subarray(0, count * 2)));
|
|
142
|
+
at += count;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
buffer.fill(0);
|
|
147
|
+
}
|
|
148
|
+
const record = new Uint8Array(24), descriptor = new DataView(record.buffer);
|
|
149
|
+
descriptor.setFloat64(0, Number(head ?? 0n), true);
|
|
150
|
+
descriptor.setFloat64(8, name.length, true);
|
|
151
|
+
descriptor.setFloat64(16, start, true);
|
|
152
|
+
const position = this.allocate(record.length);
|
|
153
|
+
try {
|
|
154
|
+
await this.io(() => this.storage.write(position, record));
|
|
155
|
+
}
|
|
156
|
+
finally {
|
|
157
|
+
record.fill(0);
|
|
158
|
+
}
|
|
159
|
+
await this.index.set(key, BigInt(position));
|
|
160
|
+
this.check();
|
|
161
|
+
}
|
|
162
|
+
close() {
|
|
163
|
+
this.closed = true;
|
|
164
|
+
this.fallback?.clear();
|
|
165
|
+
return this.closing ??= this.pending.then(async () => { await this.storage?.close(); });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -57,7 +57,7 @@ export function readCommentGeometry(roots, charge) {
|
|
|
57
57
|
style[name] = value;
|
|
58
58
|
}
|
|
59
59
|
const flags = [];
|
|
60
|
-
for (const name of ["MoveWithCells", "SizeWithCells", "Visible", "AutoFill"]) {
|
|
60
|
+
for (const name of ["MoveWithCells", "SizeWithCells", "Visible", "AutoFill", "Locked", "LockText"]) {
|
|
61
61
|
const field = fields.get(name);
|
|
62
62
|
if (!field)
|
|
63
63
|
continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-bash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.817",
|
|
4
4
|
"description": "Extensible virtual shell with pluggable filesystems and streaming commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1407,7 +1407,7 @@
|
|
|
1407
1407
|
"access": "public"
|
|
1408
1408
|
},
|
|
1409
1409
|
"dependencies": {
|
|
1410
|
-
"@poe-platform/safe-fs": "0.1.
|
|
1410
|
+
"@poe-platform/safe-fs": "0.1.817",
|
|
1411
1411
|
"pdf-lib": "1.17.1",
|
|
1412
1412
|
"@types/node": "^25.2.2",
|
|
1413
1413
|
"@formatjs/intl-numberformat": "9.4.0",
|
|
@@ -2843,6 +2843,7 @@
|
|
|
2843
2843
|
"./dist/spreadsheet-format-xls/biff-property-dictionary.js",
|
|
2844
2844
|
"./dist/spreadsheet-format-xls/biff-property-index.js",
|
|
2845
2845
|
"./dist/spreadsheet-format-xls/biff-property-name.js",
|
|
2846
|
+
"./dist/spreadsheet-format-xls/biff-property-names.js",
|
|
2846
2847
|
"./dist/spreadsheet-format-xls/biff-property-range.js",
|
|
2847
2848
|
"./dist/spreadsheet-format-xls/biff-property-text.js",
|
|
2848
2849
|
"./dist/spreadsheet-format-xls/biff-property-transcode.js",
|