@oddington/sdk 0.1.0 → 0.1.1
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/README.md +0 -8
- package/dist/index.js +128 -330
- package/dist/types/packages/sdk/src/public.d.ts +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,11 +59,3 @@ installation. Customer manifests cannot replace the runner-owned SDK. The runner
|
|
|
59
59
|
selects the approved code revision and handler, and supplies only scoped capability
|
|
60
60
|
transport. The package contains public runtime code, declarations, this README and
|
|
61
61
|
its license; it has no executable, operator/server code or infrastructure credentials.
|
|
62
|
-
|
|
63
|
-
From the product checkout, run `bun run --filter @oddington/sdk build`, then
|
|
64
|
-
`bun run --filter @oddington/sdk verify:package`. Verification installs the actual
|
|
65
|
-
tarball offline into a temporary consumer without the CLI, imports and typechecks
|
|
66
|
-
through `@oddington/sdk`, and exercises retained evidence, handlerless publication
|
|
67
|
-
and guarded repository calls. Set `PACKAGE_VERIFY_NODE` to the Node 22.12.0
|
|
68
|
-
executable for supported-baseline proof. The CLI's corresponding verifier installs
|
|
69
|
-
both local tarballs, checks `os --help` and refuses the removed subpath.
|
package/dist/index.js
CHANGED
|
@@ -553,37 +553,37 @@ var require_strings = __commonJS((exports) => {
|
|
|
553
553
|
exports.escapeRegExp = function(str) {
|
|
554
554
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
555
555
|
};
|
|
556
|
-
exports.cleanText = function(
|
|
557
|
-
return
|
|
556
|
+
exports.cleanText = function(text2) {
|
|
557
|
+
return text2.replace(/\t|\u0085|\u2028|\u2029/g, " ").replace(/[\b\v]/g, "");
|
|
558
558
|
};
|
|
559
559
|
exports.escapedNewlineChars = ["\\n", "\\f", "\\r", "\\u000B"];
|
|
560
560
|
exports.newlineChars = [`
|
|
561
561
|
`, "\f", "\r", "\v"];
|
|
562
|
-
exports.isNewlineChar = function(
|
|
563
|
-
return /^[\n\f\r\u000B]$/.test(
|
|
562
|
+
exports.isNewlineChar = function(text2) {
|
|
563
|
+
return /^[\n\f\r\u000B]$/.test(text2);
|
|
564
564
|
};
|
|
565
|
-
exports.lineSplit = function(
|
|
566
|
-
return
|
|
565
|
+
exports.lineSplit = function(text2) {
|
|
566
|
+
return text2.split(/[\n\f\r\u000B]/);
|
|
567
567
|
};
|
|
568
|
-
exports.mergeLines = function(
|
|
569
|
-
return
|
|
568
|
+
exports.mergeLines = function(text2) {
|
|
569
|
+
return text2.replace(/[\n\f\r\u000B]/g, " ");
|
|
570
570
|
};
|
|
571
|
-
exports.charAtIndex = function(
|
|
572
|
-
var cuFirst =
|
|
571
|
+
exports.charAtIndex = function(text2, index) {
|
|
572
|
+
var cuFirst = text2.charCodeAt(index);
|
|
573
573
|
var cuSecond;
|
|
574
574
|
var nextIndex = index + 1;
|
|
575
575
|
var length = 1;
|
|
576
|
-
if (cuFirst >= 55296 && cuFirst <= 56319 &&
|
|
577
|
-
cuSecond =
|
|
576
|
+
if (cuFirst >= 55296 && cuFirst <= 56319 && text2.length > nextIndex) {
|
|
577
|
+
cuSecond = text2.charCodeAt(nextIndex);
|
|
578
578
|
if (cuSecond >= 56320 && cuSecond <= 57343)
|
|
579
579
|
length = 2;
|
|
580
580
|
}
|
|
581
|
-
return [
|
|
581
|
+
return [text2.slice(index, index + length), length];
|
|
582
582
|
};
|
|
583
|
-
exports.charSplit = function(
|
|
583
|
+
exports.charSplit = function(text2) {
|
|
584
584
|
var chars = [];
|
|
585
|
-
for (var idx = 0, len =
|
|
586
|
-
var _a = exports.charAtIndex(
|
|
585
|
+
for (var idx = 0, len = text2.length;idx < len; ) {
|
|
586
|
+
var _a = exports.charAtIndex(text2, idx), c = _a[0], cLen = _a[1];
|
|
587
587
|
chars.push(c);
|
|
588
588
|
idx += cLen;
|
|
589
589
|
}
|
|
@@ -602,9 +602,9 @@ var require_strings = __commonJS((exports) => {
|
|
|
602
602
|
var breakRules = escapedRules.join("|");
|
|
603
603
|
return new RegExp("(" + newlineCharUnion + ")|((.*?)(" + breakRules + "))", "gm");
|
|
604
604
|
};
|
|
605
|
-
exports.breakTextIntoLines = function(
|
|
605
|
+
exports.breakTextIntoLines = function(text2, wordBreaks, maxWidth, computeWidthOfText) {
|
|
606
606
|
var regex = buildWordBreakRegex(wordBreaks);
|
|
607
|
-
var words = exports.cleanText(
|
|
607
|
+
var words = exports.cleanText(text2).match(regex);
|
|
608
608
|
var currLine = "";
|
|
609
609
|
var currWidth = 0;
|
|
610
610
|
var lines = [];
|
|
@@ -6135,21 +6135,21 @@ var require_PDFArray = __commonJS((exports) => {
|
|
|
6135
6135
|
PDFArray2.prototype.size = function() {
|
|
6136
6136
|
return this.array.length;
|
|
6137
6137
|
};
|
|
6138
|
-
PDFArray2.prototype.push = function(
|
|
6139
|
-
this.array.push(
|
|
6138
|
+
PDFArray2.prototype.push = function(object2) {
|
|
6139
|
+
this.array.push(object2);
|
|
6140
6140
|
};
|
|
6141
|
-
PDFArray2.prototype.insert = function(index,
|
|
6142
|
-
this.array.splice(index, 0,
|
|
6141
|
+
PDFArray2.prototype.insert = function(index, object2) {
|
|
6142
|
+
this.array.splice(index, 0, object2);
|
|
6143
6143
|
};
|
|
6144
|
-
PDFArray2.prototype.indexOf = function(
|
|
6145
|
-
var index = this.array.indexOf(
|
|
6144
|
+
PDFArray2.prototype.indexOf = function(object2) {
|
|
6145
|
+
var index = this.array.indexOf(object2);
|
|
6146
6146
|
return index === -1 ? undefined : index;
|
|
6147
6147
|
};
|
|
6148
6148
|
PDFArray2.prototype.remove = function(index) {
|
|
6149
6149
|
this.array.splice(index, 1);
|
|
6150
6150
|
};
|
|
6151
|
-
PDFArray2.prototype.set = function(idx,
|
|
6152
|
-
this.array[idx] =
|
|
6151
|
+
PDFArray2.prototype.set = function(idx, object2) {
|
|
6152
|
+
this.array[idx] = object2;
|
|
6153
6153
|
};
|
|
6154
6154
|
PDFArray2.prototype.get = function(index) {
|
|
6155
6155
|
return this.array[index];
|
|
@@ -7111,8 +7111,8 @@ var require_PDFContext = __commonJS((exports) => {
|
|
|
7111
7111
|
this.indirectObjects = new Map;
|
|
7112
7112
|
this.rng = rng_1.SimpleRNG.withSeed(1);
|
|
7113
7113
|
}
|
|
7114
|
-
PDFContext2.prototype.assign = function(ref,
|
|
7115
|
-
this.indirectObjects.set(ref,
|
|
7114
|
+
PDFContext2.prototype.assign = function(ref, object2) {
|
|
7115
|
+
this.indirectObjects.set(ref, object2);
|
|
7116
7116
|
if (ref.objectNumber > this.largestObjectNumber) {
|
|
7117
7117
|
this.largestObjectNumber = ref.objectNumber;
|
|
7118
7118
|
}
|
|
@@ -7121,9 +7121,9 @@ var require_PDFContext = __commonJS((exports) => {
|
|
|
7121
7121
|
this.largestObjectNumber += 1;
|
|
7122
7122
|
return PDFRef_1.default.of(this.largestObjectNumber);
|
|
7123
7123
|
};
|
|
7124
|
-
PDFContext2.prototype.register = function(
|
|
7124
|
+
PDFContext2.prototype.register = function(object2) {
|
|
7125
7125
|
var ref = this.nextRef();
|
|
7126
|
-
this.assign(ref,
|
|
7126
|
+
this.assign(ref, object2);
|
|
7127
7127
|
return ref;
|
|
7128
7128
|
};
|
|
7129
7129
|
PDFContext2.prototype.delete = function(ref) {
|
|
@@ -7173,8 +7173,8 @@ var require_PDFContext = __commonJS((exports) => {
|
|
|
7173
7173
|
PDFContext2.prototype.getObjectRef = function(pdfObject) {
|
|
7174
7174
|
var entries = Array.from(this.indirectObjects.entries());
|
|
7175
7175
|
for (var idx = 0, len = entries.length;idx < len; idx++) {
|
|
7176
|
-
var _a = entries[idx], ref = _a[0],
|
|
7177
|
-
if (
|
|
7176
|
+
var _a = entries[idx], ref = _a[0], object2 = _a[1];
|
|
7177
|
+
if (object2 === pdfObject) {
|
|
7178
7178
|
return ref;
|
|
7179
7179
|
}
|
|
7180
7180
|
}
|
|
@@ -7492,8 +7492,8 @@ var require_PDFObjectCopier = __commonJS((exports) => {
|
|
|
7492
7492
|
function PDFObjectCopier2(src, dest) {
|
|
7493
7493
|
var _this = this;
|
|
7494
7494
|
this.traversedObjects = new Map;
|
|
7495
|
-
this.copy = function(
|
|
7496
|
-
return
|
|
7495
|
+
this.copy = function(object2) {
|
|
7496
|
+
return object2 instanceof PDFPageLeaf_1.default ? _this.copyPDFPage(object2) : object2 instanceof PDFDict_1.default ? _this.copyPDFDict(object2) : object2 instanceof PDFArray_1.default ? _this.copyPDFArray(object2) : object2 instanceof PDFStream_1.default ? _this.copyPDFStream(object2) : object2 instanceof PDFRef_1.default ? _this.copyPDFIndirectObject(object2) : object2.clone();
|
|
7497
7497
|
};
|
|
7498
7498
|
this.copyPDFPage = function(originalPage) {
|
|
7499
7499
|
var clonedPage = originalPage.clone();
|
|
@@ -7812,8 +7812,8 @@ var require_PDFObjectStream = __commonJS((exports) => {
|
|
|
7812
7812
|
PDFObjectStream2.prototype.getContentsString = function() {
|
|
7813
7813
|
var value = this.offsetsString;
|
|
7814
7814
|
for (var idx = 0, len = this.objects.length;idx < len; idx++) {
|
|
7815
|
-
var _a = this.objects[idx],
|
|
7816
|
-
value +=
|
|
7815
|
+
var _a = this.objects[idx], object2 = _a[1];
|
|
7816
|
+
value += object2 + `
|
|
7817
7817
|
`;
|
|
7818
7818
|
}
|
|
7819
7819
|
return value;
|
|
@@ -7822,8 +7822,8 @@ var require_PDFObjectStream = __commonJS((exports) => {
|
|
|
7822
7822
|
var buffer = new Uint8Array(this.getUnencodedContentsSize());
|
|
7823
7823
|
var offset = utils_1.copyStringIntoBuffer(this.offsetsString, buffer, 0);
|
|
7824
7824
|
for (var idx = 0, len = this.objects.length;idx < len; idx++) {
|
|
7825
|
-
var _a = this.objects[idx],
|
|
7826
|
-
offset +=
|
|
7825
|
+
var _a = this.objects[idx], object2 = _a[1];
|
|
7826
|
+
offset += object2.copyBytesInto(buffer, offset);
|
|
7827
7827
|
buffer[offset++] = CharCodes_1.default.Newline;
|
|
7828
7828
|
}
|
|
7829
7829
|
return buffer;
|
|
@@ -7843,9 +7843,9 @@ var require_PDFObjectStream = __commonJS((exports) => {
|
|
|
7843
7843
|
var offset = 0;
|
|
7844
7844
|
var offsets = new Array(this.objects.length);
|
|
7845
7845
|
for (var idx = 0, len = this.objects.length;idx < len; idx++) {
|
|
7846
|
-
var _a = this.objects[idx], ref = _a[0],
|
|
7846
|
+
var _a = this.objects[idx], ref = _a[0], object2 = _a[1];
|
|
7847
7847
|
offsets[idx] = [ref.objectNumber, offset];
|
|
7848
|
-
offset +=
|
|
7848
|
+
offset += object2.sizeInBytes() + 1;
|
|
7849
7849
|
}
|
|
7850
7850
|
return offsets;
|
|
7851
7851
|
};
|
|
@@ -7884,7 +7884,7 @@ var require_PDFWriter = __commonJS((exports) => {
|
|
|
7884
7884
|
}
|
|
7885
7885
|
PDFWriter2.prototype.serializeToBuffer = function() {
|
|
7886
7886
|
return tslib_1.__awaiter(this, undefined, undefined, function() {
|
|
7887
|
-
var _a, size, header, indirectObjects, xref, trailerDict, trailer, offset, buffer, idx, len, _b, ref,
|
|
7887
|
+
var _a, size, header, indirectObjects, xref, trailerDict, trailer, offset, buffer, idx, len, _b, ref, object2, objectNumber, generationNumber, n;
|
|
7888
7888
|
return tslib_1.__generator(this, function(_c) {
|
|
7889
7889
|
switch (_c.label) {
|
|
7890
7890
|
case 0:
|
|
@@ -7901,7 +7901,7 @@ var require_PDFWriter = __commonJS((exports) => {
|
|
|
7901
7901
|
case 2:
|
|
7902
7902
|
if (!(idx < len))
|
|
7903
7903
|
return [3, 5];
|
|
7904
|
-
_b = indirectObjects[idx], ref = _b[0],
|
|
7904
|
+
_b = indirectObjects[idx], ref = _b[0], object2 = _b[1];
|
|
7905
7905
|
objectNumber = String(ref.objectNumber);
|
|
7906
7906
|
offset += utils_1.copyStringIntoBuffer(objectNumber, buffer, offset);
|
|
7907
7907
|
buffer[offset++] = CharCodes_1.default.Space;
|
|
@@ -7912,7 +7912,7 @@ var require_PDFWriter = __commonJS((exports) => {
|
|
|
7912
7912
|
buffer[offset++] = CharCodes_1.default.b;
|
|
7913
7913
|
buffer[offset++] = CharCodes_1.default.j;
|
|
7914
7914
|
buffer[offset++] = CharCodes_1.default.Newline;
|
|
7915
|
-
offset +=
|
|
7915
|
+
offset += object2.copyBytesInto(buffer, offset);
|
|
7916
7916
|
buffer[offset++] = CharCodes_1.default.Newline;
|
|
7917
7917
|
buffer[offset++] = CharCodes_1.default.e;
|
|
7918
7918
|
buffer[offset++] = CharCodes_1.default.n;
|
|
@@ -7922,7 +7922,7 @@ var require_PDFWriter = __commonJS((exports) => {
|
|
|
7922
7922
|
buffer[offset++] = CharCodes_1.default.j;
|
|
7923
7923
|
buffer[offset++] = CharCodes_1.default.Newline;
|
|
7924
7924
|
buffer[offset++] = CharCodes_1.default.Newline;
|
|
7925
|
-
n =
|
|
7925
|
+
n = object2 instanceof PDFObjectStream_1.default ? object2.getObjectsCount() : 1;
|
|
7926
7926
|
if (!this.shouldWaitForTick(n))
|
|
7927
7927
|
return [3, 4];
|
|
7928
7928
|
return [4, utils_1.waitForTick()];
|
|
@@ -7949,9 +7949,9 @@ var require_PDFWriter = __commonJS((exports) => {
|
|
|
7949
7949
|
});
|
|
7950
7950
|
};
|
|
7951
7951
|
PDFWriter2.prototype.computeIndirectObjectSize = function(_a) {
|
|
7952
|
-
var ref = _a[0],
|
|
7952
|
+
var ref = _a[0], object2 = _a[1];
|
|
7953
7953
|
var refSize = ref.sizeInBytes() + 3;
|
|
7954
|
-
var objectSize =
|
|
7954
|
+
var objectSize = object2.sizeInBytes() + 9;
|
|
7955
7955
|
return refSize + objectSize;
|
|
7956
7956
|
};
|
|
7957
7957
|
PDFWriter2.prototype.createTrailerDict = function() {
|
|
@@ -8258,7 +8258,7 @@ var require_PDFStreamWriter = __commonJS((exports) => {
|
|
|
8258
8258
|
}
|
|
8259
8259
|
PDFStreamWriter2.prototype.computeBufferSize = function() {
|
|
8260
8260
|
return tslib_1.__awaiter(this, undefined, undefined, function() {
|
|
8261
|
-
var objectNumber, header, size, xrefStream, uncompressedObjects, compressedObjects, objectStreamRefs, indirectObjects, idx, len, indirectObject, ref,
|
|
8261
|
+
var objectNumber, header, size, xrefStream, uncompressedObjects, compressedObjects, objectStreamRefs, indirectObjects, idx, len, indirectObject, ref, object2, shouldNotCompress, chunk, objectStreamRef, idx, len, chunk, ref, objectStream, xrefStreamRef, xrefOffset, trailer;
|
|
8262
8262
|
return tslib_1.__generator(this, function(_a) {
|
|
8263
8263
|
switch (_a.label) {
|
|
8264
8264
|
case 0:
|
|
@@ -8276,8 +8276,8 @@ var require_PDFStreamWriter = __commonJS((exports) => {
|
|
|
8276
8276
|
if (!(idx < len))
|
|
8277
8277
|
return [3, 6];
|
|
8278
8278
|
indirectObject = indirectObjects[idx];
|
|
8279
|
-
ref = indirectObject[0],
|
|
8280
|
-
shouldNotCompress = ref === this.context.trailerInfo.Encrypt ||
|
|
8279
|
+
ref = indirectObject[0], object2 = indirectObject[1];
|
|
8280
|
+
shouldNotCompress = ref === this.context.trailerInfo.Encrypt || object2 instanceof PDFStream_1.default || object2 instanceof PDFInvalidObject_1.default || ref.generationNumber !== 0;
|
|
8281
8281
|
if (!shouldNotCompress)
|
|
8282
8282
|
return [3, 4];
|
|
8283
8283
|
uncompressedObjects.push(indirectObject);
|
|
@@ -8391,10 +8391,10 @@ var require_PDFHexString = __commonJS((exports) => {
|
|
|
8391
8391
|
return utils_1.pdfDocEncodingDecode(bytes);
|
|
8392
8392
|
};
|
|
8393
8393
|
PDFHexString2.prototype.decodeDate = function() {
|
|
8394
|
-
var
|
|
8395
|
-
var date = utils_1.parseDate(
|
|
8394
|
+
var text2 = this.decodeText();
|
|
8395
|
+
var date = utils_1.parseDate(text2);
|
|
8396
8396
|
if (!date)
|
|
8397
|
-
throw new errors_1.InvalidPDFDateStringError(
|
|
8397
|
+
throw new errors_1.InvalidPDFDateStringError(text2);
|
|
8398
8398
|
return date;
|
|
8399
8399
|
};
|
|
8400
8400
|
PDFHexString2.prototype.asString = function() {
|
|
@@ -8445,16 +8445,16 @@ var require_StandardFontEmbedder = __commonJS((exports) => {
|
|
|
8445
8445
|
this.fontName = this.font.FontName;
|
|
8446
8446
|
this.customName = customName;
|
|
8447
8447
|
}
|
|
8448
|
-
StandardFontEmbedder2.prototype.encodeText = function(
|
|
8449
|
-
var glyphs = this.encodeTextAsGlyphs(
|
|
8448
|
+
StandardFontEmbedder2.prototype.encodeText = function(text2) {
|
|
8449
|
+
var glyphs = this.encodeTextAsGlyphs(text2);
|
|
8450
8450
|
var hexCodes = new Array(glyphs.length);
|
|
8451
8451
|
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
8452
8452
|
hexCodes[idx] = utils_1.toHexString(glyphs[idx].code);
|
|
8453
8453
|
}
|
|
8454
8454
|
return PDFHexString_1.default.of(hexCodes.join(""));
|
|
8455
8455
|
};
|
|
8456
|
-
StandardFontEmbedder2.prototype.widthOfTextAtSize = function(
|
|
8457
|
-
var glyphs = this.encodeTextAsGlyphs(
|
|
8456
|
+
StandardFontEmbedder2.prototype.widthOfTextAtSize = function(text2, size) {
|
|
8457
|
+
var glyphs = this.encodeTextAsGlyphs(text2);
|
|
8458
8458
|
var totalWidth = 0;
|
|
8459
8459
|
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
8460
8460
|
var left = glyphs[idx].name;
|
|
@@ -8501,8 +8501,8 @@ var require_StandardFontEmbedder = __commonJS((exports) => {
|
|
|
8501
8501
|
StandardFontEmbedder2.prototype.widthOfGlyph = function(glyphName) {
|
|
8502
8502
|
return this.font.getWidthOfGlyph(glyphName) || 250;
|
|
8503
8503
|
};
|
|
8504
|
-
StandardFontEmbedder2.prototype.encodeTextAsGlyphs = function(
|
|
8505
|
-
var codePoints = Array.from(
|
|
8504
|
+
StandardFontEmbedder2.prototype.encodeTextAsGlyphs = function(text2) {
|
|
8505
|
+
var codePoints = Array.from(text2);
|
|
8506
8506
|
var glyphs = new Array(codePoints.length);
|
|
8507
8507
|
for (var idx = 0, len = codePoints.length;idx < len; idx++) {
|
|
8508
8508
|
var codePoint = utils_1.toCodePoint(codePoints[idx]);
|
|
@@ -8700,10 +8700,10 @@ var require_PDFString = __commonJS((exports) => {
|
|
|
8700
8700
|
return utils_1.pdfDocEncodingDecode(bytes);
|
|
8701
8701
|
};
|
|
8702
8702
|
PDFString2.prototype.decodeDate = function() {
|
|
8703
|
-
var
|
|
8704
|
-
var date = utils_1.parseDate(
|
|
8703
|
+
var text2 = this.decodeText();
|
|
8704
|
+
var date = utils_1.parseDate(text2);
|
|
8705
8705
|
if (!date)
|
|
8706
|
-
throw new errors_1.InvalidPDFDateStringError(
|
|
8706
|
+
throw new errors_1.InvalidPDFDateStringError(text2);
|
|
8707
8707
|
return date;
|
|
8708
8708
|
};
|
|
8709
8709
|
PDFString2.prototype.asString = function() {
|
|
@@ -8786,16 +8786,16 @@ var require_CustomFontEmbedder = __commonJS((exports) => {
|
|
|
8786
8786
|
});
|
|
8787
8787
|
});
|
|
8788
8788
|
};
|
|
8789
|
-
CustomFontEmbedder2.prototype.encodeText = function(
|
|
8790
|
-
var glyphs = this.font.layout(
|
|
8789
|
+
CustomFontEmbedder2.prototype.encodeText = function(text2) {
|
|
8790
|
+
var glyphs = this.font.layout(text2, this.fontFeatures).glyphs;
|
|
8791
8791
|
var hexCodes = new Array(glyphs.length);
|
|
8792
8792
|
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
8793
8793
|
hexCodes[idx] = utils_1.toHexStringOfMinLength(glyphs[idx].id, 4);
|
|
8794
8794
|
}
|
|
8795
8795
|
return PDFHexString_1.default.of(hexCodes.join(""));
|
|
8796
8796
|
};
|
|
8797
|
-
CustomFontEmbedder2.prototype.widthOfTextAtSize = function(
|
|
8798
|
-
var glyphs = this.font.layout(
|
|
8797
|
+
CustomFontEmbedder2.prototype.widthOfTextAtSize = function(text2, size) {
|
|
8798
|
+
var glyphs = this.font.layout(text2, this.fontFeatures).glyphs;
|
|
8799
8799
|
var totalWidth = 0;
|
|
8800
8800
|
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
8801
8801
|
totalWidth += glyphs[idx].advanceWidth * this.scale;
|
|
@@ -9006,8 +9006,8 @@ var require_CustomFontSubsetEmbedder = __commonJS((exports) => {
|
|
|
9006
9006
|
});
|
|
9007
9007
|
});
|
|
9008
9008
|
};
|
|
9009
|
-
CustomFontSubsetEmbedder2.prototype.encodeText = function(
|
|
9010
|
-
var glyphs = this.font.layout(
|
|
9009
|
+
CustomFontSubsetEmbedder2.prototype.encodeText = function(text2) {
|
|
9010
|
+
var glyphs = this.font.layout(text2, this.fontFeatures).glyphs;
|
|
9011
9011
|
var hexCodes = new Array(glyphs.length);
|
|
9012
9012
|
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
9013
9013
|
var glyph = glyphs[idx];
|
|
@@ -9463,8 +9463,8 @@ var require_UPNG = __commonJS((exports) => {
|
|
|
9463
9463
|
out.tabs[type] = {};
|
|
9464
9464
|
var nz = bin.nextZero(data, offset);
|
|
9465
9465
|
var keyw = bin.readASCII(data, offset, nz - offset);
|
|
9466
|
-
var
|
|
9467
|
-
out.tabs[type][keyw] =
|
|
9466
|
+
var text2 = bin.readASCII(data, nz + 1, offset + len - nz - 1);
|
|
9467
|
+
out.tabs[type][keyw] = text2;
|
|
9468
9468
|
} else if (type == "iTXt") {
|
|
9469
9469
|
if (out.tabs[type] == null)
|
|
9470
9470
|
out.tabs[type] = {};
|
|
@@ -9480,8 +9480,8 @@ var require_UPNG = __commonJS((exports) => {
|
|
|
9480
9480
|
nz = bin.nextZero(data, off);
|
|
9481
9481
|
var tkeyw = bin.readUTF8(data, off, nz - off);
|
|
9482
9482
|
off = nz + 1;
|
|
9483
|
-
var
|
|
9484
|
-
out.tabs[type][keyw] =
|
|
9483
|
+
var text2 = bin.readUTF8(data, off, len - (off - offset));
|
|
9484
|
+
out.tabs[type][keyw] = text2;
|
|
9485
9485
|
} else if (type == "PLTE") {
|
|
9486
9486
|
out.tabs[type] = bin.readBytes(data, offset, len);
|
|
9487
9487
|
} else if (type == "hIST") {
|
|
@@ -14974,7 +14974,7 @@ var require_PDFObjectStreamParser = __commonJS((exports) => {
|
|
|
14974
14974
|
}
|
|
14975
14975
|
PDFObjectStreamParser2.prototype.parseIntoContext = function() {
|
|
14976
14976
|
return tslib_1.__awaiter(this, undefined, undefined, function() {
|
|
14977
|
-
var offsetsAndObjectNumbers, idx, len, _a, objectNumber, offset,
|
|
14977
|
+
var offsetsAndObjectNumbers, idx, len, _a, objectNumber, offset, object2, ref;
|
|
14978
14978
|
return tslib_1.__generator(this, function(_b) {
|
|
14979
14979
|
switch (_b.label) {
|
|
14980
14980
|
case 0:
|
|
@@ -14990,9 +14990,9 @@ var require_PDFObjectStreamParser = __commonJS((exports) => {
|
|
|
14990
14990
|
return [3, 4];
|
|
14991
14991
|
_a = offsetsAndObjectNumbers[idx], objectNumber = _a.objectNumber, offset = _a.offset;
|
|
14992
14992
|
this.bytes.moveTo(this.firstOffset + offset);
|
|
14993
|
-
|
|
14993
|
+
object2 = this.parseObject();
|
|
14994
14994
|
ref = PDFRef_1.default.of(objectNumber, 0);
|
|
14995
|
-
this.context.assign(ref,
|
|
14995
|
+
this.context.assign(ref, object2);
|
|
14996
14996
|
if (!this.shouldWaitForTick())
|
|
14997
14997
|
return [3, 3];
|
|
14998
14998
|
return [4, utils_1.waitForTick()];
|
|
@@ -15203,8 +15203,8 @@ var require_PDFParser = __commonJS((exports) => {
|
|
|
15203
15203
|
if (!isValidCatalog(catalog)) {
|
|
15204
15204
|
var indirectObjects = this.context.enumerateIndirectObjects();
|
|
15205
15205
|
for (var idx = 0, len = indirectObjects.length;idx < len; idx++) {
|
|
15206
|
-
var _a = indirectObjects[idx], ref = _a[0],
|
|
15207
|
-
if (isValidCatalog(
|
|
15206
|
+
var _a = indirectObjects[idx], ref = _a[0], object2 = _a[1];
|
|
15207
|
+
if (isValidCatalog(object2)) {
|
|
15208
15208
|
this.context.trailerInfo.Root = ref;
|
|
15209
15209
|
}
|
|
15210
15210
|
}
|
|
@@ -15247,26 +15247,26 @@ var require_PDFParser = __commonJS((exports) => {
|
|
|
15247
15247
|
};
|
|
15248
15248
|
PDFParser2.prototype.parseIndirectObject = function() {
|
|
15249
15249
|
return tslib_1.__awaiter(this, undefined, undefined, function() {
|
|
15250
|
-
var ref,
|
|
15250
|
+
var ref, object2;
|
|
15251
15251
|
return tslib_1.__generator(this, function(_a) {
|
|
15252
15252
|
switch (_a.label) {
|
|
15253
15253
|
case 0:
|
|
15254
15254
|
ref = this.parseIndirectObjectHeader();
|
|
15255
15255
|
this.skipWhitespaceAndComments();
|
|
15256
|
-
|
|
15256
|
+
object2 = this.parseObject();
|
|
15257
15257
|
this.skipWhitespaceAndComments();
|
|
15258
15258
|
this.matchKeyword(Keywords_1.Keywords.endobj);
|
|
15259
|
-
if (!(
|
|
15259
|
+
if (!(object2 instanceof PDFRawStream_1.default && object2.dict.lookup(PDFName_1.default.of("Type")) === PDFName_1.default.of("ObjStm")))
|
|
15260
15260
|
return [3, 2];
|
|
15261
|
-
return [4, PDFObjectStreamParser_1.default.forStream(
|
|
15261
|
+
return [4, PDFObjectStreamParser_1.default.forStream(object2, this.shouldWaitForTick).parseIntoContext()];
|
|
15262
15262
|
case 1:
|
|
15263
15263
|
_a.sent();
|
|
15264
15264
|
return [3, 3];
|
|
15265
15265
|
case 2:
|
|
15266
|
-
if (
|
|
15267
|
-
PDFXRefStreamParser_1.default.forStream(
|
|
15266
|
+
if (object2 instanceof PDFRawStream_1.default && object2.dict.lookup(PDFName_1.default.of("Type")) === PDFName_1.default.of("XRef")) {
|
|
15267
|
+
PDFXRefStreamParser_1.default.forStream(object2).parseIntoContext();
|
|
15268
15268
|
} else {
|
|
15269
|
-
this.context.assign(ref,
|
|
15269
|
+
this.context.assign(ref, object2);
|
|
15270
15270
|
}
|
|
15271
15271
|
_a.label = 3;
|
|
15272
15272
|
case 3:
|
|
@@ -15297,8 +15297,8 @@ var require_PDFParser = __commonJS((exports) => {
|
|
|
15297
15297
|
if (failed)
|
|
15298
15298
|
throw new errors_1.PDFInvalidObjectParsingError(startPos);
|
|
15299
15299
|
var end = this.bytes.offset() - Keywords_1.Keywords.endobj.length;
|
|
15300
|
-
var
|
|
15301
|
-
this.context.assign(ref,
|
|
15300
|
+
var object2 = PDFInvalidObject_1.default.of(this.bytes.slice(start, end));
|
|
15301
|
+
this.context.assign(ref, object2);
|
|
15302
15302
|
return ref;
|
|
15303
15303
|
};
|
|
15304
15304
|
PDFParser2.prototype.parseIndirectObjects = function() {
|
|
@@ -15921,8 +15921,8 @@ var require_operators = __commonJS((exports) => {
|
|
|
15921
15921
|
exports.moveText = function(x, y) {
|
|
15922
15922
|
return core_1.PDFOperator.of(core_1.PDFOperatorNames.MoveText, [objects_1.asPDFNumber(x), objects_1.asPDFNumber(y)]);
|
|
15923
15923
|
};
|
|
15924
|
-
exports.showText = function(
|
|
15925
|
-
return core_1.PDFOperator.of(core_1.PDFOperatorNames.ShowText, [
|
|
15924
|
+
exports.showText = function(text2) {
|
|
15925
|
+
return core_1.PDFOperator.of(core_1.PDFOperatorNames.ShowText, [text2]);
|
|
15926
15926
|
};
|
|
15927
15927
|
exports.beginText = function() {
|
|
15928
15928
|
return core_1.PDFOperator.of(core_1.PDFOperatorNames.BeginText);
|
|
@@ -17143,9 +17143,9 @@ var require_layout = __commonJS((exports) => {
|
|
|
17143
17143
|
remainder: undefined
|
|
17144
17144
|
};
|
|
17145
17145
|
};
|
|
17146
|
-
exports.layoutMultilineText = function(
|
|
17146
|
+
exports.layoutMultilineText = function(text2, _a) {
|
|
17147
17147
|
var { alignment, fontSize, font, bounds } = _a;
|
|
17148
|
-
var lines = utils_1.lineSplit(utils_1.cleanText(
|
|
17148
|
+
var lines = utils_1.lineSplit(utils_1.cleanText(text2));
|
|
17149
17149
|
if (fontSize === undefined || fontSize === 0) {
|
|
17150
17150
|
fontSize = computeFontSize(lines, font, bounds, true);
|
|
17151
17151
|
}
|
|
@@ -17187,9 +17187,9 @@ var require_layout = __commonJS((exports) => {
|
|
|
17187
17187
|
}
|
|
17188
17188
|
};
|
|
17189
17189
|
};
|
|
17190
|
-
exports.layoutCombedText = function(
|
|
17190
|
+
exports.layoutCombedText = function(text2, _a) {
|
|
17191
17191
|
var { fontSize, font, bounds, cellCount } = _a;
|
|
17192
|
-
var line = utils_1.mergeLines(utils_1.cleanText(
|
|
17192
|
+
var line = utils_1.mergeLines(utils_1.cleanText(text2));
|
|
17193
17193
|
if (line.length > cellCount) {
|
|
17194
17194
|
throw new errors_1.CombedTextLayoutError(line.length, cellCount);
|
|
17195
17195
|
}
|
|
@@ -17235,9 +17235,9 @@ var require_layout = __commonJS((exports) => {
|
|
|
17235
17235
|
}
|
|
17236
17236
|
};
|
|
17237
17237
|
};
|
|
17238
|
-
exports.layoutSinglelineText = function(
|
|
17238
|
+
exports.layoutSinglelineText = function(text2, _a) {
|
|
17239
17239
|
var { alignment, fontSize, font, bounds } = _a;
|
|
17240
|
-
var line = utils_1.mergeLines(utils_1.cleanText(
|
|
17240
|
+
var line = utils_1.mergeLines(utils_1.cleanText(text2));
|
|
17241
17241
|
if (fontSize === undefined || fontSize === 0) {
|
|
17242
17242
|
fontSize = computeFontSize([line], font, bounds);
|
|
17243
17243
|
}
|
|
@@ -17461,7 +17461,7 @@ var require_appearances = __commonJS((exports) => {
|
|
|
17461
17461
|
var rectangle = widget.getRectangle();
|
|
17462
17462
|
var ap = widget.getAppearanceCharacteristics();
|
|
17463
17463
|
var bs = widget.getBorderStyle();
|
|
17464
|
-
var
|
|
17464
|
+
var text2 = (_a = textField.getText()) !== null && _a !== undefined ? _a : "";
|
|
17465
17465
|
var borderWidth = (_b = bs === null || bs === undefined ? undefined : bs.getWidth()) !== null && _b !== undefined ? _b : 0;
|
|
17466
17466
|
var rotation = rotations_1.reduceRotation(ap === null || ap === undefined ? undefined : ap.getRotation());
|
|
17467
17467
|
var _e = rotations_1.adjustDimsForRotation(rectangle, rotation), width = _e.width, height = _e.height;
|
|
@@ -17479,7 +17479,7 @@ var require_appearances = __commonJS((exports) => {
|
|
|
17479
17479
|
height: height - (borderWidth + padding) * 2
|
|
17480
17480
|
};
|
|
17481
17481
|
if (textField.isMultiline()) {
|
|
17482
|
-
var layout = layout_1.layoutMultilineText(
|
|
17482
|
+
var layout = layout_1.layoutMultilineText(text2, {
|
|
17483
17483
|
alignment: textField.getAlignment(),
|
|
17484
17484
|
fontSize: widgetFontSize !== null && widgetFontSize !== undefined ? widgetFontSize : fieldFontSize,
|
|
17485
17485
|
font,
|
|
@@ -17488,7 +17488,7 @@ var require_appearances = __commonJS((exports) => {
|
|
|
17488
17488
|
textLines = layout.lines;
|
|
17489
17489
|
fontSize = layout.fontSize;
|
|
17490
17490
|
} else if (textField.isCombed()) {
|
|
17491
|
-
var layout = layout_1.layoutCombedText(
|
|
17491
|
+
var layout = layout_1.layoutCombedText(text2, {
|
|
17492
17492
|
fontSize: widgetFontSize !== null && widgetFontSize !== undefined ? widgetFontSize : fieldFontSize,
|
|
17493
17493
|
font,
|
|
17494
17494
|
bounds,
|
|
@@ -17497,7 +17497,7 @@ var require_appearances = __commonJS((exports) => {
|
|
|
17497
17497
|
textLines = layout.cells;
|
|
17498
17498
|
fontSize = layout.fontSize;
|
|
17499
17499
|
} else {
|
|
17500
|
-
var layout = layout_1.layoutSinglelineText(
|
|
17500
|
+
var layout = layout_1.layoutSinglelineText(text2, {
|
|
17501
17501
|
alignment: textField.getAlignment(),
|
|
17502
17502
|
fontSize: widgetFontSize !== null && widgetFontSize !== undefined ? widgetFontSize : fieldFontSize,
|
|
17503
17503
|
font,
|
|
@@ -17537,7 +17537,7 @@ var require_appearances = __commonJS((exports) => {
|
|
|
17537
17537
|
var rectangle = widget.getRectangle();
|
|
17538
17538
|
var ap = widget.getAppearanceCharacteristics();
|
|
17539
17539
|
var bs = widget.getBorderStyle();
|
|
17540
|
-
var
|
|
17540
|
+
var text2 = (_a = dropdown.getSelected()[0]) !== null && _a !== undefined ? _a : "";
|
|
17541
17541
|
var borderWidth = (_b = bs === null || bs === undefined ? undefined : bs.getWidth()) !== null && _b !== undefined ? _b : 0;
|
|
17542
17542
|
var rotation = rotations_1.reduceRotation(ap === null || ap === undefined ? undefined : ap.getRotation());
|
|
17543
17543
|
var _d = rotations_1.adjustDimsForRotation(rectangle, rotation), width = _d.width, height = _d.height;
|
|
@@ -17552,7 +17552,7 @@ var require_appearances = __commonJS((exports) => {
|
|
|
17552
17552
|
width: width - (borderWidth + padding) * 2,
|
|
17553
17553
|
height: height - (borderWidth + padding) * 2
|
|
17554
17554
|
};
|
|
17555
|
-
var _e = layout_1.layoutSinglelineText(
|
|
17555
|
+
var _e = layout_1.layoutSinglelineText(text2, {
|
|
17556
17556
|
alignment: alignment_1.TextAlignment.Left,
|
|
17557
17557
|
fontSize: widgetFontSize !== null && widgetFontSize !== undefined ? widgetFontSize : fieldFontSize,
|
|
17558
17558
|
font,
|
|
@@ -17600,11 +17600,11 @@ var require_appearances = __commonJS((exports) => {
|
|
|
17600
17600
|
var selected = optionList.getSelected();
|
|
17601
17601
|
if (optionList.isSorted())
|
|
17602
17602
|
options.sort();
|
|
17603
|
-
var
|
|
17603
|
+
var text2 = "";
|
|
17604
17604
|
for (var idx = 0, len = options.length;idx < len; idx++) {
|
|
17605
|
-
|
|
17605
|
+
text2 += options[idx];
|
|
17606
17606
|
if (idx < len - 1)
|
|
17607
|
-
|
|
17607
|
+
text2 += `
|
|
17608
17608
|
`;
|
|
17609
17609
|
}
|
|
17610
17610
|
var padding = 1;
|
|
@@ -17614,7 +17614,7 @@ var require_appearances = __commonJS((exports) => {
|
|
|
17614
17614
|
width: width - (borderWidth + padding) * 2,
|
|
17615
17615
|
height: height - (borderWidth + padding) * 2
|
|
17616
17616
|
};
|
|
17617
|
-
var _d = layout_1.layoutMultilineText(
|
|
17617
|
+
var _d = layout_1.layoutMultilineText(text2, {
|
|
17618
17618
|
alignment: alignment_1.TextAlignment.Left,
|
|
17619
17619
|
fontSize: widgetFontSize !== null && widgetFontSize !== undefined ? widgetFontSize : fieldFontSize,
|
|
17620
17620
|
font,
|
|
@@ -17726,15 +17726,15 @@ var require_PDFFont = __commonJS((exports) => {
|
|
|
17726
17726
|
this.name = embedder.fontName;
|
|
17727
17727
|
this.embedder = embedder;
|
|
17728
17728
|
}
|
|
17729
|
-
PDFFont2.prototype.encodeText = function(
|
|
17730
|
-
utils_1.assertIs(
|
|
17729
|
+
PDFFont2.prototype.encodeText = function(text2) {
|
|
17730
|
+
utils_1.assertIs(text2, "text", ["string"]);
|
|
17731
17731
|
this.modified = true;
|
|
17732
|
-
return this.embedder.encodeText(
|
|
17732
|
+
return this.embedder.encodeText(text2);
|
|
17733
17733
|
};
|
|
17734
|
-
PDFFont2.prototype.widthOfTextAtSize = function(
|
|
17735
|
-
utils_1.assertIs(
|
|
17734
|
+
PDFFont2.prototype.widthOfTextAtSize = function(text2, size) {
|
|
17735
|
+
utils_1.assertIs(text2, "text", ["string"]);
|
|
17736
17736
|
utils_1.assertIs(size, "size", ["number"]);
|
|
17737
|
-
return this.embedder.widthOfTextAtSize(
|
|
17737
|
+
return this.embedder.widthOfTextAtSize(text2, size);
|
|
17738
17738
|
};
|
|
17739
17739
|
PDFFont2.prototype.heightAtSize = function(size, options) {
|
|
17740
17740
|
var _a;
|
|
@@ -18817,16 +18817,16 @@ var require_PDFTextField = __commonJS((exports) => {
|
|
|
18817
18817
|
}
|
|
18818
18818
|
return value === null || value === undefined ? undefined : value.decodeText();
|
|
18819
18819
|
};
|
|
18820
|
-
PDFTextField2.prototype.setText = function(
|
|
18821
|
-
utils_1.assertOrUndefined(
|
|
18820
|
+
PDFTextField2.prototype.setText = function(text2) {
|
|
18821
|
+
utils_1.assertOrUndefined(text2, "text", ["string"]);
|
|
18822
18822
|
var maxLength = this.getMaxLength();
|
|
18823
|
-
if (maxLength !== undefined &&
|
|
18824
|
-
throw new errors_1.ExceededMaxLengthError(
|
|
18823
|
+
if (maxLength !== undefined && text2 && text2.length > maxLength) {
|
|
18824
|
+
throw new errors_1.ExceededMaxLengthError(text2.length, maxLength, this.getName());
|
|
18825
18825
|
}
|
|
18826
18826
|
this.markAsDirty();
|
|
18827
18827
|
this.disableRichFormatting();
|
|
18828
|
-
if (
|
|
18829
|
-
this.acroField.setValue(core_1.PDFHexString.fromText(
|
|
18828
|
+
if (text2) {
|
|
18829
|
+
this.acroField.setValue(core_1.PDFHexString.fromText(text2));
|
|
18830
18830
|
} else {
|
|
18831
18831
|
this.acroField.removeValue();
|
|
18832
18832
|
}
|
|
@@ -18849,9 +18849,9 @@ var require_PDFTextField = __commonJS((exports) => {
|
|
|
18849
18849
|
if (maxLength === undefined) {
|
|
18850
18850
|
this.acroField.removeMaxLength();
|
|
18851
18851
|
} else {
|
|
18852
|
-
var
|
|
18853
|
-
if (
|
|
18854
|
-
throw new errors_1.InvalidMaxLengthError(
|
|
18852
|
+
var text2 = this.getText();
|
|
18853
|
+
if (text2 && text2.length > maxLength) {
|
|
18854
|
+
throw new errors_1.InvalidMaxLengthError(text2.length, maxLength, this.getName());
|
|
18855
18855
|
}
|
|
18856
18856
|
this.acroField.setMaxLength(maxLength);
|
|
18857
18857
|
}
|
|
@@ -19210,10 +19210,10 @@ var require_PDFForm = __commonJS((exports) => {
|
|
|
19210
19210
|
utils_1.assertIs(name, "name", ["string"]);
|
|
19211
19211
|
var nameParts = splitFieldName(name);
|
|
19212
19212
|
var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal);
|
|
19213
|
-
var
|
|
19214
|
-
|
|
19215
|
-
addFieldToParent(parent, [
|
|
19216
|
-
return PDFTextField_1.default.of(
|
|
19213
|
+
var text2 = core_1.PDFAcroText.create(this.doc.context);
|
|
19214
|
+
text2.setPartialName(nameParts.terminal);
|
|
19215
|
+
addFieldToParent(parent, [text2, text2.ref], nameParts.terminal);
|
|
19216
|
+
return PDFTextField_1.default.of(text2, text2.ref, this.doc);
|
|
19217
19217
|
};
|
|
19218
19218
|
PDFForm2.prototype.flatten = function(options) {
|
|
19219
19219
|
if (options === undefined) {
|
|
@@ -20608,12 +20608,12 @@ var require_PDFPage = __commonJS((exports) => {
|
|
|
20608
20608
|
var contentStream = this.getContentStream();
|
|
20609
20609
|
contentStream.push.apply(contentStream, operator);
|
|
20610
20610
|
};
|
|
20611
|
-
PDFPage2.prototype.drawText = function(
|
|
20611
|
+
PDFPage2.prototype.drawText = function(text2, options) {
|
|
20612
20612
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
20613
20613
|
if (options === undefined) {
|
|
20614
20614
|
options = {};
|
|
20615
20615
|
}
|
|
20616
|
-
utils_1.assertIs(
|
|
20616
|
+
utils_1.assertIs(text2, "text", ["string"]);
|
|
20617
20617
|
utils_1.assertOrUndefined(options.color, "options.color", [[Object, "Color"]]);
|
|
20618
20618
|
utils_1.assertRangeOrUndefined(options.opacity, "opacity.opacity", 0, 1);
|
|
20619
20619
|
utils_1.assertOrUndefined(options.font, "options.font", [[PDFFont_1.default, "PDFFont"]]);
|
|
@@ -20633,7 +20633,7 @@ var require_PDFPage = __commonJS((exports) => {
|
|
|
20633
20633
|
var textWidth = function(t) {
|
|
20634
20634
|
return newFont.widthOfTextAtSize(t, fontSize);
|
|
20635
20635
|
};
|
|
20636
|
-
var lines = options.maxWidth === undefined ? utils_1.lineSplit(utils_1.cleanText(
|
|
20636
|
+
var lines = options.maxWidth === undefined ? utils_1.lineSplit(utils_1.cleanText(text2)) : utils_1.breakTextIntoLines(text2, wordBreaks, options.maxWidth, textWidth);
|
|
20637
20637
|
var encodedLines = new Array(lines.length);
|
|
20638
20638
|
for (var idx = 0, len = lines.length;idx < len; idx++) {
|
|
20639
20639
|
encodedLines[idx] = newFont.encodeText(lines[idx]);
|
|
@@ -21063,9 +21063,9 @@ var require_PDFButton = __commonJS((exports) => {
|
|
|
21063
21063
|
this.acroField.setFontSize(fontSize);
|
|
21064
21064
|
this.markAsDirty();
|
|
21065
21065
|
};
|
|
21066
|
-
PDFButton2.prototype.addToPage = function(
|
|
21066
|
+
PDFButton2.prototype.addToPage = function(text2, page, options) {
|
|
21067
21067
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
21068
|
-
utils_1.assertOrUndefined(
|
|
21068
|
+
utils_1.assertOrUndefined(text2, "text", ["string"]);
|
|
21069
21069
|
utils_1.assertOrUndefined(page, "page", [[PDFPage_1.default, "PDFPage"]]);
|
|
21070
21070
|
PDFField_1.assertFieldAppearanceOptions(options);
|
|
21071
21071
|
var widget = this.createWidget({
|
|
@@ -21078,7 +21078,7 @@ var require_PDFButton = __commonJS((exports) => {
|
|
|
21078
21078
|
borderColor: options === null || options === undefined ? undefined : options.borderColor,
|
|
21079
21079
|
borderWidth: (_j = options === null || options === undefined ? undefined : options.borderWidth) !== null && _j !== undefined ? _j : 0,
|
|
21080
21080
|
rotate: (_k = options === null || options === undefined ? undefined : options.rotate) !== null && _k !== undefined ? _k : rotations_1.degrees(0),
|
|
21081
|
-
caption:
|
|
21081
|
+
caption: text2,
|
|
21082
21082
|
hidden: options === null || options === undefined ? undefined : options.hidden,
|
|
21083
21083
|
page: page.ref
|
|
21084
21084
|
});
|
|
@@ -21549,27 +21549,6 @@ function validateResponseDefinition(value) {
|
|
|
21549
21549
|
return fail("Unsupported option source");
|
|
21550
21550
|
}
|
|
21551
21551
|
}
|
|
21552
|
-
function validateResponse(definition, value) {
|
|
21553
|
-
const saved = validateResponseDefinition(definition);
|
|
21554
|
-
const response = object(value, "response");
|
|
21555
|
-
if (saved.source.type === "records") {
|
|
21556
|
-
keys(response, ["selection"], "response");
|
|
21557
|
-
const record = validateRecordReference(response.selection);
|
|
21558
|
-
if (record.repository !== saved.source.collection.repository)
|
|
21559
|
-
fail("Record belongs to another repository");
|
|
21560
|
-
return { selection: record };
|
|
21561
|
-
}
|
|
21562
|
-
keys(response, ["selection", "note"], "response");
|
|
21563
|
-
const choice = id(response.selection, "response selection");
|
|
21564
|
-
const option = saved.source.options.find((option2) => option2.value === choice);
|
|
21565
|
-
if (!option)
|
|
21566
|
-
fail("Choice was not published");
|
|
21567
|
-
if (option.note)
|
|
21568
|
-
return { selection: choice, note: text(response.note, "required note").trim() };
|
|
21569
|
-
if (Object.hasOwn(response, "note"))
|
|
21570
|
-
fail("This choice does not accept a note");
|
|
21571
|
-
return { selection: choice };
|
|
21572
|
-
}
|
|
21573
21552
|
function handlerReference(value) {
|
|
21574
21553
|
const source = object(value, "handler reference");
|
|
21575
21554
|
keys(source, ["id", "input"], "handler reference");
|
|
@@ -21662,12 +21641,6 @@ function validatePublication(value) {
|
|
|
21662
21641
|
recipients: [...new Set([...extra, ...questions.flatMap((entry) => [entry.to, ...entry.allowedResponders])])]
|
|
21663
21642
|
};
|
|
21664
21643
|
}
|
|
21665
|
-
function recipientPresentation(value) {
|
|
21666
|
-
const publication = validatePublication(value);
|
|
21667
|
-
if (publication.kind === "digest")
|
|
21668
|
-
return publication;
|
|
21669
|
-
return { ...publication, questions: publication.questions.map(({ handler: _private, ...question2 }) => question2) };
|
|
21670
|
-
}
|
|
21671
21644
|
function oddington(value) {
|
|
21672
21645
|
const source = object(value, "Oddington assignment");
|
|
21673
21646
|
keys(source, ["reason"], "Oddington assignment");
|
|
@@ -21694,23 +21667,6 @@ function resolution(value) {
|
|
|
21694
21667
|
function resolveAsk(value) {
|
|
21695
21668
|
return { type: "resolve", ...resolution(value) };
|
|
21696
21669
|
}
|
|
21697
|
-
function validateHandlerTransition(value, state) {
|
|
21698
|
-
const source = object(value, "transition");
|
|
21699
|
-
if (source.type === "resolve") {
|
|
21700
|
-
keys(source, ["type", "outcome", "evidence"], "transition");
|
|
21701
|
-
return resolveAsk({
|
|
21702
|
-
outcome: source.outcome,
|
|
21703
|
-
...source.evidence === undefined ? {} : { evidence: source.evidence }
|
|
21704
|
-
});
|
|
21705
|
-
}
|
|
21706
|
-
if (source.type !== "continue")
|
|
21707
|
-
fail("Unsupported handler transition");
|
|
21708
|
-
keys(source, ["type", "assignTo"], "transition");
|
|
21709
|
-
const transition = continueAsk(source.assignTo === undefined ? {} : { assignTo: source.assignTo });
|
|
21710
|
-
if (transition.type === "continue" && !transition.assignTo && !state.hasOtherViableWork)
|
|
21711
|
-
fail("continueAsk would strand the ask without viable work");
|
|
21712
|
-
return transition;
|
|
21713
|
-
}
|
|
21714
21670
|
function validateResolution(value) {
|
|
21715
21671
|
const source = object(value, "published resolution");
|
|
21716
21672
|
keys(source, ["expectedRevision", "outcome", "evidence"], "published resolution");
|
|
@@ -21842,146 +21798,6 @@ function validateRoutineRecordWrite(value) {
|
|
|
21842
21798
|
function validCreatePath(value) {
|
|
21843
21799
|
return value === value.trim() && value.endsWith(".md") && !value.startsWith("/") && value.split("/").every((segment) => !!segment && ![".", ".."].includes(segment) && /^[a-zA-Z0-9_.-]+$/.test(segment));
|
|
21844
21800
|
}
|
|
21845
|
-
// ../../shared/inbox-views.ts
|
|
21846
|
-
function validateCapturedRecordTableInput(value) {
|
|
21847
|
-
const input = validateRecordTableInput(value);
|
|
21848
|
-
if (!input.repository)
|
|
21849
|
-
fail2("Repository capture is required");
|
|
21850
|
-
return input;
|
|
21851
|
-
}
|
|
21852
|
-
var commonViews = [
|
|
21853
|
-
{ name: "common/record", implementation: "common/record@1", workspaces: "*", validate: validateRecordViewInput },
|
|
21854
|
-
{ name: "common/record-table", implementation: "common/record-table@1", workspaces: "*", validate: validateRecordTableInput }
|
|
21855
|
-
];
|
|
21856
|
-
function fail2(message) {
|
|
21857
|
-
throw new InboxContractError(message);
|
|
21858
|
-
}
|
|
21859
|
-
function object2(value, fields2, required, label) {
|
|
21860
|
-
const copy = serializable(value);
|
|
21861
|
-
if (!copy || typeof copy !== "object" || Array.isArray(copy) || Object.keys(copy).some((key) => !fields2.includes(key)) || required.some((key) => !Object.hasOwn(copy, key)))
|
|
21862
|
-
fail2(`Invalid ${label} fields`);
|
|
21863
|
-
return copy;
|
|
21864
|
-
}
|
|
21865
|
-
function text2(value) {
|
|
21866
|
-
return typeof value === "string" && !!value.trim() && value === value.trim();
|
|
21867
|
-
}
|
|
21868
|
-
function readable(value) {
|
|
21869
|
-
return typeof value === "string" && !!value.trim();
|
|
21870
|
-
}
|
|
21871
|
-
function recordFields(value) {
|
|
21872
|
-
if (!Array.isArray(value) || !value.length)
|
|
21873
|
-
fail2("Record fields must not be empty");
|
|
21874
|
-
const labels = new Set;
|
|
21875
|
-
for (const entry of value) {
|
|
21876
|
-
const field = object2(entry, ["label", "value"], ["label", "value"], "record field");
|
|
21877
|
-
if (!text2(field.label) || labels.has(field.label))
|
|
21878
|
-
fail2("Record field labels must be distinct");
|
|
21879
|
-
labels.add(field.label);
|
|
21880
|
-
recordValue(field.value);
|
|
21881
|
-
}
|
|
21882
|
-
}
|
|
21883
|
-
function recordValue(value) {
|
|
21884
|
-
const kind = value && typeof value === "object" ? value.kind : undefined;
|
|
21885
|
-
switch (kind) {
|
|
21886
|
-
case "text": {
|
|
21887
|
-
const v = object2(value, ["kind", "text"], ["kind", "text"], "text value");
|
|
21888
|
-
if (!readable(v.text))
|
|
21889
|
-
fail2("Record text must be readable");
|
|
21890
|
-
break;
|
|
21891
|
-
}
|
|
21892
|
-
case "missing": {
|
|
21893
|
-
const v = object2(value, ["kind", "label"], ["kind", "label"], "missing value");
|
|
21894
|
-
if (!text2(v.label))
|
|
21895
|
-
fail2("Missing information requires a label");
|
|
21896
|
-
break;
|
|
21897
|
-
}
|
|
21898
|
-
case "record": {
|
|
21899
|
-
const v = object2(value, ["kind", "ref", "label", "recordType"], ["kind", "ref", "label"], "record link");
|
|
21900
|
-
if (!text2(v.ref) || !text2(v.label) || v.recordType !== undefined && !text2(v.recordType))
|
|
21901
|
-
fail2("Invalid supplied record link");
|
|
21902
|
-
break;
|
|
21903
|
-
}
|
|
21904
|
-
case "list": {
|
|
21905
|
-
const v = object2(value, ["kind", "items", "remaining"], ["kind", "items"], "list value");
|
|
21906
|
-
if (!Array.isArray(v.items) || !v.items.length || v.remaining !== undefined && (!Number.isSafeInteger(v.remaining) || v.remaining < 0))
|
|
21907
|
-
fail2("Invalid Record list or remaining count");
|
|
21908
|
-
v.items.forEach(recordValue);
|
|
21909
|
-
break;
|
|
21910
|
-
}
|
|
21911
|
-
case "object": {
|
|
21912
|
-
const v = object2(value, ["kind", "fields"], ["kind", "fields"], "object value");
|
|
21913
|
-
recordFields(v.fields);
|
|
21914
|
-
break;
|
|
21915
|
-
}
|
|
21916
|
-
default:
|
|
21917
|
-
fail2("Unknown Record value");
|
|
21918
|
-
}
|
|
21919
|
-
}
|
|
21920
|
-
function validateRecordViewInput(value) {
|
|
21921
|
-
const v = object2(value, ["record", "related"], ["record"], "Record View");
|
|
21922
|
-
if (v.related !== undefined && !Array.isArray(v.related))
|
|
21923
|
-
fail2("Related records must be an array");
|
|
21924
|
-
const refs = new Set;
|
|
21925
|
-
for (const entry of [v.record, ...v.related ?? []]) {
|
|
21926
|
-
const r = object2(entry, ["ref", "title", "recordType", "fields", "body"], ["ref", "title", "fields"], "record");
|
|
21927
|
-
if (!text2(r.ref) || !text2(r.title) || refs.has(r.ref) || r.recordType !== undefined && !text2(r.recordType))
|
|
21928
|
-
fail2("Invalid or duplicate Record reference");
|
|
21929
|
-
refs.add(r.ref);
|
|
21930
|
-
recordFields(r.fields);
|
|
21931
|
-
if (r.body !== undefined) {
|
|
21932
|
-
const body = object2(r.body, ["label", "markdown"], ["label", "markdown"], "Record body");
|
|
21933
|
-
if (!text2(body.label) || !readable(body.markdown))
|
|
21934
|
-
fail2("Invalid Record body");
|
|
21935
|
-
}
|
|
21936
|
-
}
|
|
21937
|
-
return v;
|
|
21938
|
-
}
|
|
21939
|
-
function validDate(value) {
|
|
21940
|
-
const parsed = new Date(`${value}T00:00:00Z`);
|
|
21941
|
-
return !value.startsWith("0000-") && Number.isFinite(parsed.getTime()) && parsed.toISOString().slice(0, 10) === value;
|
|
21942
|
-
}
|
|
21943
|
-
function validateRecordTableInput(value) {
|
|
21944
|
-
const v = object2(value, ["repository", "commit", "columns", "rows", "metadata"], ["columns", "rows"], "record table");
|
|
21945
|
-
const captured = v.repository !== undefined;
|
|
21946
|
-
if ((captured ? !validRepositoryAlias(v.repository) || !/^[0-9a-f]{40}$/.test(v.commit) : v.commit !== undefined) || !Array.isArray(v.columns) || !v.columns.length || !Array.isArray(v.rows) || !v.rows.length)
|
|
21947
|
-
fail2("Invalid record-table capture");
|
|
21948
|
-
const ids = new Set;
|
|
21949
|
-
for (const entry of v.columns) {
|
|
21950
|
-
const c = object2(entry, ["id", "label", "type", "unit", "values", "missing", "missingLabel"], ["id", "label", "type", "missing"], "column");
|
|
21951
|
-
if (!text2(c.id) || !text2(c.label) || ids.has(c.id) || c.missing !== "reject" || !["string", "date", "integer", "number", "boolean", "enum", "nullable-enum", "link"].includes(c.type) || (["integer", "number"].includes(c.type) ? !text2(c.unit) : c.unit !== undefined) || (c.type === "nullable-enum" ? !text2(c.missingLabel) : c.missingLabel !== undefined))
|
|
21952
|
-
fail2("Invalid column definition or units");
|
|
21953
|
-
if (["enum", "nullable-enum"].includes(c.type)) {
|
|
21954
|
-
if (!Array.isArray(c.values) || !c.values.length || c.values.some((s) => !text2(s)) || new Set(c.values).size !== c.values.length)
|
|
21955
|
-
fail2("Enum columns require distinct values");
|
|
21956
|
-
} else if (c.values !== undefined)
|
|
21957
|
-
fail2("Only enum columns accept values");
|
|
21958
|
-
ids.add(c.id);
|
|
21959
|
-
}
|
|
21960
|
-
const refs = new Set;
|
|
21961
|
-
for (const entry of v.rows) {
|
|
21962
|
-
const r = object2(entry, ["ref", "version", "values"], ["ref", "values"], "row");
|
|
21963
|
-
if (!text2(r.ref) || !/^[a-zA-Z0-9][a-zA-Z0-9._/-]*$/.test(r.ref) || r.ref.split("/").some((s) => !s || s === "." || s === "..") || refs.has(r.ref) || (captured ? !/^record-v1:[0-9a-f]{64}$/.test(r.version) : r.version !== undefined))
|
|
21964
|
-
fail2("Invalid stable record reference or reviewed version");
|
|
21965
|
-
const values = object2(r.values, [...ids], [...ids], "projected values");
|
|
21966
|
-
for (const c of v.columns) {
|
|
21967
|
-
const cell = values[c.id];
|
|
21968
|
-
const valid = c.type === "nullable-enum" && cell === null || ["string", "enum", "nullable-enum", "link", "date"].includes(c.type) && typeof cell === "string" && (!c.values || c.values.includes(cell)) && (c.type !== "link" || /^\[\[[a-zA-Z0-9][a-zA-Z0-9._/-]*\]\]$/.test(cell)) && (c.type !== "date" || /^\d{4}-\d{2}-\d{2}$/.test(cell) && validDate(cell)) || ["integer", "number"].includes(c.type) && typeof cell === "number" && Number.isFinite(cell) && (c.type !== "integer" || Number.isSafeInteger(cell)) || c.type === "boolean" && typeof cell === "boolean";
|
|
21969
|
-
if (!valid)
|
|
21970
|
-
fail2(`Invalid projected value: ${c.id}`);
|
|
21971
|
-
}
|
|
21972
|
-
refs.add(r.ref);
|
|
21973
|
-
}
|
|
21974
|
-
if (v.metadata !== undefined && (!v.metadata || typeof v.metadata !== "object" || Array.isArray(v.metadata)))
|
|
21975
|
-
fail2("Metadata must be an object");
|
|
21976
|
-
return v;
|
|
21977
|
-
}
|
|
21978
|
-
var registeredViews = commonViews;
|
|
21979
|
-
function resolveInboxView(view, workspace) {
|
|
21980
|
-
const entry = registeredViews.find((entry2) => entry2.name === view.view && (entry2.workspaces === "*" || entry2.workspaces.includes(workspace)));
|
|
21981
|
-
if (!entry)
|
|
21982
|
-
fail2("View is unknown or unavailable to this workspace");
|
|
21983
|
-
return { ...view, input: serializable(entry.validate(view.input)), implementation: entry.implementation };
|
|
21984
|
-
}
|
|
21985
21801
|
// ../../shared/delimited-text.ts
|
|
21986
21802
|
function delimiterFor(value) {
|
|
21987
21803
|
const counts = new Map([
|
|
@@ -22374,36 +22190,18 @@ function routinePublicationClient(options = {}) {
|
|
|
22374
22190
|
};
|
|
22375
22191
|
}
|
|
22376
22192
|
export {
|
|
22377
|
-
validateResponseDefinition,
|
|
22378
|
-
validateResponse,
|
|
22379
|
-
validateResolution,
|
|
22380
|
-
validateRecordViewInput,
|
|
22381
|
-
validateRecordTableInput,
|
|
22382
|
-
validateRecordSource,
|
|
22383
|
-
validateRecordReference,
|
|
22384
|
-
validatePublication,
|
|
22385
|
-
validateInboxFile,
|
|
22386
|
-
validateHandlerTransition,
|
|
22387
|
-
validateCapturedRecordTableInput,
|
|
22388
|
-
validateBlock,
|
|
22389
|
-
serializable,
|
|
22390
22193
|
selection,
|
|
22391
22194
|
routinePublicationClient,
|
|
22392
22195
|
richTextBlock,
|
|
22393
22196
|
respond,
|
|
22394
|
-
resolveInboxView,
|
|
22395
22197
|
resolveAsk,
|
|
22396
|
-
registeredViews,
|
|
22397
22198
|
recordsBlock,
|
|
22398
22199
|
recordBlock,
|
|
22399
|
-
recipientPresentation,
|
|
22400
22200
|
question,
|
|
22401
22201
|
oddington,
|
|
22402
22202
|
fileBlock,
|
|
22403
22203
|
defineHandler,
|
|
22404
|
-
createInboxPublisher,
|
|
22405
22204
|
continueAsk,
|
|
22406
|
-
commonViews,
|
|
22407
22205
|
asksBlock,
|
|
22408
22206
|
RoutineRecordWriteError,
|
|
22409
22207
|
InboxContractError
|
|
@@ -2,8 +2,12 @@ import type { AskInput, CapturedRecords, DigestInput, InboxFile, PublicationRequ
|
|
|
2
2
|
import type { FileAddOptions } from '../../../shared/inbox-files.js';
|
|
3
3
|
import type { RecordReadInput } from '../../../shared/record-capture.js';
|
|
4
4
|
import type { RecordDeleteRequest, RecordUpdateRequest, RecordWriteRequest } from '../../../shared/record-write.js';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export { InboxContractError, asksBlock, continueAsk, defineHandler, fileBlock, oddington, question, recordBlock, recordsBlock, resolveAsk, respond, richTextBlock, selection, } from '../../../shared/inbox-contract.js';
|
|
6
|
+
export type { AskInput, AuthoredSource, CapturedRecords, CsvDetails, DigestInput, Handler, HandlerReference, HandlerRuntime, HandlerTransition, InboxBlock, InboxFile, JsonObject, JsonValue, OddingtonAssignment, PresentedField, PresentedRecord, PresentedRecordSummary, PublishedAsk, PublishedDigest, PublishedView, PublicationRequest, Question, QuestionInput, QuestionResponse, RecordCreate, RecordDelete, RecordReference, RecordSource, RecordUpdate, RepositoryCapabilities, RepositoryReceipt, Resolution, ResolutionInput, ResponseDefinition, } from '../../../shared/inbox-contract.js';
|
|
7
|
+
export type { CapturedRecordTableInput, RecordField, RecordTableInput, RecordValue, RecordViewInput, TableColumn, ViewRecord, } from '../../../shared/inbox-views.js';
|
|
8
|
+
export type { FileAddOptions } from '../../../shared/inbox-files.js';
|
|
9
|
+
export type { RecordReadInput } from '../../../shared/record-capture.js';
|
|
10
|
+
export type { RecordDeleteRequest, RecordUpdateRequest, RecordWriteRequest } from '../../../shared/record-write.js';
|
|
7
11
|
export { RoutineRecordWriteError } from '../../../shared/record-write.js';
|
|
8
12
|
export type InboxRequester = (path: string, init?: RequestInit) => Promise<Response>;
|
|
9
13
|
export type RoutinePublicationClientOptions = {
|