@veryfront/ext-content-mdx 0.1.1185 → 0.1.1188

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/esm/_dnt.polyfills.d.ts +6 -6
  2. package/esm/_dnt.polyfills.d.ts.map +1 -1
  3. package/esm/deno.d.ts +34 -0
  4. package/esm/deno.js +50 -9
  5. package/esm/src/config/defaults.d.ts +31 -24
  6. package/esm/src/config/defaults.d.ts.map +1 -1
  7. package/esm/src/config/defaults.js +25 -18
  8. package/esm/src/errors/diagnostic-policy.d.ts +35 -0
  9. package/esm/src/errors/diagnostic-policy.d.ts.map +1 -0
  10. package/esm/src/errors/diagnostic-policy.js +100 -0
  11. package/esm/src/errors/error-registry/boundary.d.ts +2 -0
  12. package/esm/src/errors/error-registry/boundary.d.ts.map +1 -1
  13. package/esm/src/errors/error-registry/boundary.js +8 -0
  14. package/esm/src/errors/error-registry/config.d.ts.map +1 -1
  15. package/esm/src/errors/error-registry/config.js +3 -3
  16. package/esm/src/errors/error-registry/deploy.js +1 -1
  17. package/esm/src/errors/error-registry/server.d.ts +2 -0
  18. package/esm/src/errors/error-registry/server.d.ts.map +1 -1
  19. package/esm/src/errors/error-registry/server.js +8 -0
  20. package/esm/src/errors/error-registry-helpers.d.ts +11 -2
  21. package/esm/src/errors/error-registry-helpers.d.ts.map +1 -1
  22. package/esm/src/errors/error-registry-helpers.js +70 -1
  23. package/esm/src/errors/error-registry.d.ts +87 -75
  24. package/esm/src/errors/error-registry.d.ts.map +1 -1
  25. package/esm/src/errors/error-registry.js +2 -14
  26. package/esm/src/errors/types.d.ts +44 -5
  27. package/esm/src/errors/types.d.ts.map +1 -1
  28. package/esm/src/errors/types.js +148 -24
  29. package/esm/src/errors/veryfront-error.d.ts +25 -2
  30. package/esm/src/errors/veryfront-error.d.ts.map +1 -1
  31. package/esm/src/errors/veryfront-error.js +638 -28
  32. package/esm/src/observability/limits.d.ts +20 -0
  33. package/esm/src/observability/limits.d.ts.map +1 -0
  34. package/esm/src/observability/limits.js +19 -0
  35. package/esm/src/observability/telemetry-error.d.ts +22 -0
  36. package/esm/src/observability/telemetry-error.d.ts.map +1 -0
  37. package/esm/src/observability/telemetry-error.js +377 -0
  38. package/esm/src/observability/tracing/api-shim.d.ts +39 -0
  39. package/esm/src/observability/tracing/api-shim.d.ts.map +1 -1
  40. package/esm/src/observability/tracing/api-shim.js +196 -69
  41. package/esm/src/observability/tracing/context-callback.d.ts +14 -0
  42. package/esm/src/observability/tracing/context-callback.d.ts.map +1 -0
  43. package/esm/src/observability/tracing/context-callback.js +111 -0
  44. package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -1
  45. package/esm/src/observability/tracing/otlp-setup.js +190 -46
  46. package/esm/src/platform/adapters/base.d.ts +63 -1
  47. package/esm/src/platform/adapters/base.d.ts.map +1 -1
  48. package/esm/src/platform/adapters/base.js +4 -2
  49. package/esm/src/platform/adapters/bounded-file-read.d.ts +43 -0
  50. package/esm/src/platform/adapters/bounded-file-read.d.ts.map +1 -0
  51. package/esm/src/platform/adapters/bounded-file-read.js +185 -0
  52. package/esm/src/platform/adapters/file-snapshot-error.d.ts +8 -0
  53. package/esm/src/platform/adapters/file-snapshot-error.d.ts.map +1 -0
  54. package/esm/src/platform/adapters/file-snapshot-error.js +13 -0
  55. package/esm/src/platform/adapters/file-system-capabilities.d.ts +74 -0
  56. package/esm/src/platform/adapters/file-system-capabilities.d.ts.map +1 -0
  57. package/esm/src/platform/adapters/file-system-capabilities.js +508 -0
  58. package/esm/src/platform/adapters/native-file-system-provenance.d.ts +6 -0
  59. package/esm/src/platform/adapters/native-file-system-provenance.d.ts.map +1 -0
  60. package/esm/src/platform/adapters/native-file-system-provenance.js +15 -0
  61. package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.d.ts +45 -0
  62. package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.d.ts.map +1 -0
  63. package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.js +291 -0
  64. package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.d.ts +71 -0
  65. package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.d.ts.map +1 -0
  66. package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.js +471 -0
  67. package/esm/src/platform/adapters/runtime/shared/shared-watcher.d.ts +16 -0
  68. package/esm/src/platform/adapters/runtime/shared/shared-watcher.d.ts.map +1 -0
  69. package/esm/src/platform/adapters/runtime/shared/shared-watcher.js +140 -0
  70. package/esm/src/platform/adapters/runtime/shared/temp-dir.d.ts +2 -0
  71. package/esm/src/platform/adapters/runtime/shared/temp-dir.d.ts.map +1 -0
  72. package/esm/src/platform/adapters/runtime/shared/temp-dir.js +10 -0
  73. package/esm/src/platform/adapters/runtime/shared/watcher-queue.d.ts +5 -0
  74. package/esm/src/platform/adapters/runtime/shared/watcher-queue.d.ts.map +1 -0
  75. package/esm/src/platform/adapters/runtime/shared/watcher-queue.js +75 -0
  76. package/esm/src/platform/compat/abort-signal.d.ts +20 -0
  77. package/esm/src/platform/compat/abort-signal.d.ts.map +1 -0
  78. package/esm/src/platform/compat/abort-signal.js +64 -0
  79. package/esm/src/platform/compat/constants.d.ts +2 -2
  80. package/esm/src/platform/compat/constants.d.ts.map +1 -1
  81. package/esm/src/platform/compat/constants.js +2 -2
  82. package/esm/src/platform/compat/error-introspection.d.ts +37 -0
  83. package/esm/src/platform/compat/error-introspection.d.ts.map +1 -0
  84. package/esm/src/platform/compat/error-introspection.js +258 -0
  85. package/esm/src/platform/compat/fs.d.ts +33 -8
  86. package/esm/src/platform/compat/fs.d.ts.map +1 -1
  87. package/esm/src/platform/compat/fs.js +144 -42
  88. package/esm/src/platform/compat/native-brand-checks.d.ts +14 -0
  89. package/esm/src/platform/compat/native-brand-checks.d.ts.map +1 -0
  90. package/esm/src/platform/compat/native-brand-checks.js +68 -0
  91. package/esm/src/platform/compat/not-found-error.d.ts +12 -0
  92. package/esm/src/platform/compat/not-found-error.d.ts.map +1 -0
  93. package/esm/src/platform/compat/not-found-error.js +174 -0
  94. package/esm/src/platform/compat/path/security.d.ts.map +1 -1
  95. package/esm/src/platform/compat/path/security.js +3 -5
  96. package/esm/src/platform/compat/process/command.d.ts +24 -1
  97. package/esm/src/platform/compat/process/command.d.ts.map +1 -1
  98. package/esm/src/platform/compat/process/command.js +393 -78
  99. package/esm/src/platform/compat/process/env.d.ts +11 -0
  100. package/esm/src/platform/compat/process/env.d.ts.map +1 -1
  101. package/esm/src/platform/compat/process/env.js +28 -38
  102. package/esm/src/platform/compat/process/global-error.d.ts +19 -0
  103. package/esm/src/platform/compat/process/global-error.d.ts.map +1 -0
  104. package/esm/src/platform/compat/process/global-error.js +57 -0
  105. package/esm/src/platform/compat/process/lifecycle.d.ts +10 -3
  106. package/esm/src/platform/compat/process/lifecycle.d.ts.map +1 -1
  107. package/esm/src/platform/compat/process/lifecycle.js +74 -23
  108. package/esm/src/platform/compat/process/project-env-contract.d.ts +19 -0
  109. package/esm/src/platform/compat/process/project-env-contract.d.ts.map +1 -0
  110. package/esm/src/platform/compat/process/project-env-contract.js +19 -0
  111. package/esm/src/platform/compat/process.d.ts +1 -1
  112. package/esm/src/platform/compat/runtime.d.ts +14 -5
  113. package/esm/src/platform/compat/runtime.d.ts.map +1 -1
  114. package/esm/src/platform/compat/runtime.js +34 -9
  115. package/esm/src/platform/compat/std/front-matter-yaml.d.ts +12 -0
  116. package/esm/src/platform/compat/std/front-matter-yaml.d.ts.map +1 -1
  117. package/esm/src/platform/compat/std/front-matter-yaml.js +35 -3
  118. package/esm/src/platform/compat/temp-directory-prefix.d.ts +8 -0
  119. package/esm/src/platform/compat/temp-directory-prefix.d.ts.map +1 -0
  120. package/esm/src/platform/compat/temp-directory-prefix.js +15 -0
  121. package/esm/src/utils/abort.d.ts +10 -0
  122. package/esm/src/utils/abort.d.ts.map +1 -0
  123. package/esm/src/utils/abort.js +35 -0
  124. package/esm/src/utils/constants/build.d.ts +12 -0
  125. package/esm/src/utils/constants/build.d.ts.map +1 -1
  126. package/esm/src/utils/constants/build.js +13 -0
  127. package/esm/src/utils/constants/cache.d.ts +21 -0
  128. package/esm/src/utils/constants/cache.d.ts.map +1 -1
  129. package/esm/src/utils/constants/cache.js +101 -39
  130. package/esm/src/utils/constants/css.d.ts +20 -0
  131. package/esm/src/utils/constants/css.d.ts.map +1 -0
  132. package/esm/src/utils/constants/css.js +19 -0
  133. package/esm/src/utils/constants/index.d.ts +1 -1
  134. package/esm/src/utils/constants/index.d.ts.map +1 -1
  135. package/esm/src/utils/constants/index.js +1 -1
  136. package/esm/src/utils/constants/limits.d.ts +4 -0
  137. package/esm/src/utils/constants/limits.d.ts.map +1 -1
  138. package/esm/src/utils/constants/limits.js +4 -0
  139. package/esm/src/utils/constants/project-identity.d.ts +5 -0
  140. package/esm/src/utils/constants/project-identity.d.ts.map +1 -0
  141. package/esm/src/utils/constants/project-identity.js +4 -0
  142. package/esm/src/utils/constants/retry.d.ts +18 -0
  143. package/esm/src/utils/constants/retry.d.ts.map +1 -1
  144. package/esm/src/utils/constants/retry.js +18 -0
  145. package/esm/src/utils/constants/security.d.ts +4 -0
  146. package/esm/src/utils/constants/security.d.ts.map +1 -1
  147. package/esm/src/utils/constants/security.js +4 -0
  148. package/esm/src/utils/css-artifact-identity.d.ts +23 -0
  149. package/esm/src/utils/css-artifact-identity.d.ts.map +1 -0
  150. package/esm/src/utils/css-artifact-identity.js +77 -0
  151. package/esm/src/utils/index.d.ts +4 -1
  152. package/esm/src/utils/index.d.ts.map +1 -1
  153. package/esm/src/utils/index.js +4 -1
  154. package/esm/src/utils/logger/core.d.ts +5 -0
  155. package/esm/src/utils/logger/core.d.ts.map +1 -1
  156. package/esm/src/utils/logger/core.js +67 -2
  157. package/esm/src/utils/logger/redact.d.ts +36 -13
  158. package/esm/src/utils/logger/redact.d.ts.map +1 -1
  159. package/esm/src/utils/logger/redact.js +573 -83
  160. package/esm/src/utils/parallel.d.ts.map +1 -1
  161. package/esm/src/utils/parallel.js +11 -1
  162. package/esm/src/utils/project-identity.d.ts +11 -0
  163. package/esm/src/utils/project-identity.d.ts.map +1 -0
  164. package/esm/src/utils/project-identity.js +69 -0
  165. package/esm/src/utils/version-constant.d.ts +1 -1
  166. package/esm/src/utils/version-constant.js +1 -1
  167. package/package.json +3 -3
@@ -0,0 +1,185 @@
1
+ const apply = Reflect.apply;
2
+ const arrayPush = Array.prototype.push;
3
+ const minimum = Math.min;
4
+ const numberIsSafeInteger = Number.isSafeInteger;
5
+ const NativeUint8Array = Uint8Array;
6
+ const typedArrayPrototype = Object.getPrototypeOf(NativeUint8Array.prototype);
7
+ const typedArrayByteLengthGetterCandidate = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byteLength")?.get;
8
+ const typedArrayBufferGetterCandidate = Object.getOwnPropertyDescriptor(typedArrayPrototype, "buffer")?.get;
9
+ const typedArrayByteOffsetGetterCandidate = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byteOffset")?.get;
10
+ const setBytes = NativeUint8Array.prototype.set;
11
+ if (typeof typedArrayByteLengthGetterCandidate !== "function" ||
12
+ typeof typedArrayBufferGetterCandidate !== "function" ||
13
+ typeof typedArrayByteOffsetGetterCandidate !== "function") {
14
+ throw new TypeError("Required Uint8Array intrinsics are unavailable");
15
+ }
16
+ const typedArrayByteLengthGetter = typedArrayByteLengthGetterCandidate;
17
+ const typedArrayBufferGetter = typedArrayBufferGetterCandidate;
18
+ const typedArrayByteOffsetGetter = typedArrayByteOffsetGetterCandidate;
19
+ function byteLengthOf(value) {
20
+ const byteLength = apply(typedArrayByteLengthGetter, value, []);
21
+ if (!numberIsSafeInteger(byteLength) || byteLength < 0) {
22
+ throw new TypeError("Filesystem read buffer has an invalid byte length");
23
+ }
24
+ return byteLength;
25
+ }
26
+ function allocateBytes(byteLength) {
27
+ const bytes = new NativeUint8Array(byteLength);
28
+ if (byteLengthOf(bytes) !== byteLength) {
29
+ throw new TypeError("Filesystem byte buffer allocation returned an invalid size");
30
+ }
31
+ return bytes;
32
+ }
33
+ function viewBytes(value, start, byteLength) {
34
+ const sourceByteLength = byteLengthOf(value);
35
+ if (!numberIsSafeInteger(start) || start < 0 ||
36
+ !numberIsSafeInteger(byteLength) || byteLength < 0 ||
37
+ start > sourceByteLength - byteLength) {
38
+ throw new RangeError("Filesystem byte view is outside its source buffer");
39
+ }
40
+ const buffer = apply(typedArrayBufferGetter, value, []);
41
+ const byteOffset = apply(typedArrayByteOffsetGetter, value, []);
42
+ const view = new NativeUint8Array(buffer, byteOffset + start, byteLength);
43
+ if (byteLengthOf(view) !== byteLength) {
44
+ throw new TypeError("Filesystem byte view allocation returned an invalid size");
45
+ }
46
+ return view;
47
+ }
48
+ // Keep a large caller-supplied limit from becoming an equally large eager
49
+ // allocation when the source is small. The aggregate returned data remains
50
+ // bounded by the caller's limit.
51
+ const BOUNDED_FILE_READ_CHUNK_BYTES = 64 * 1024;
52
+ /**
53
+ * Run one operation against one opened file handle, then close it exactly once.
54
+ *
55
+ * When the operation and cleanup both fail, the aggregate retains the primary
56
+ * operation failure first and the cleanup failure second.
57
+ */
58
+ export async function withFileHandle(openHandle, operation, aggregateFailureMessage) {
59
+ const handle = await openHandle();
60
+ let result;
61
+ let primaryFailure;
62
+ let primaryFailed = false;
63
+ try {
64
+ result = await operation(handle);
65
+ }
66
+ catch (error) {
67
+ primaryFailed = true;
68
+ primaryFailure = error;
69
+ }
70
+ try {
71
+ await handle.close();
72
+ }
73
+ catch (cleanupFailure) {
74
+ if (primaryFailed) {
75
+ throw new AggregateError([primaryFailure, cleanupFailure], aggregateFailureMessage);
76
+ }
77
+ throw cleanupFailure;
78
+ }
79
+ if (primaryFailed)
80
+ throw primaryFailure;
81
+ return result;
82
+ }
83
+ export function requireBoundedFileReadLimit(byteLimit) {
84
+ if (!numberIsSafeInteger(byteLimit) || byteLimit <= 0) {
85
+ throw new RangeError("Filesystem byteLimit must be a positive safe integer");
86
+ }
87
+ return byteLimit;
88
+ }
89
+ /**
90
+ * Read at most `byteLimit` bytes without first materializing the whole file.
91
+ *
92
+ * A full-length result is intentionally ambiguous: callers that need to
93
+ * distinguish an exact-size file from an oversized file request their accepted
94
+ * maximum plus one byte.
95
+ */
96
+ export async function readBoundedFilePrefix(openHandle, byteLimit) {
97
+ const boundedLimit = requireBoundedFileReadLimit(byteLimit);
98
+ return await withFileHandle(openHandle, (handle) => readBoundedFileHandlePrefix(handle, boundedLimit), "Filesystem read and handle cleanup both failed");
99
+ }
100
+ /**
101
+ * Read the complete file only when it fits within `byteLimit`.
102
+ *
103
+ * Unlike a prefix read, reaching the limit triggers one additional EOF probe.
104
+ * The probe reuses the final byte of the accepted buffer, so the helper never
105
+ * retains more than `byteLimit` bytes from the source.
106
+ */
107
+ export async function readFileWithinLimit(openHandle, byteLimit) {
108
+ const boundedLimit = requireBoundedFileReadLimit(byteLimit);
109
+ return await withFileHandle(openHandle, (handle) => readFileHandleWithinLimit(handle, boundedLimit), "Filesystem read and handle cleanup both failed");
110
+ }
111
+ /** Read a bounded prefix while leaving ownership of the open handle to the caller. */
112
+ export async function readBoundedFileHandlePrefix(reader, byteLimit) {
113
+ const boundedLimit = requireBoundedFileReadLimit(byteLimit);
114
+ const chunks = [];
115
+ let byteLength = 0;
116
+ let reachedEnd = false;
117
+ while (byteLength < boundedLimit) {
118
+ const chunk = allocateBytes(minimum(BOUNDED_FILE_READ_CHUNK_BYTES, boundedLimit - byteLength));
119
+ let chunkLength = 0;
120
+ const chunkByteLength = byteLengthOf(chunk);
121
+ while (chunkLength < chunkByteLength) {
122
+ const remaining = viewBytes(chunk, chunkLength, chunkByteLength - chunkLength);
123
+ const bytesRead = await reader.read(remaining);
124
+ if (bytesRead === null || bytesRead === 0) {
125
+ reachedEnd = true;
126
+ break;
127
+ }
128
+ if (!numberIsSafeInteger(bytesRead) ||
129
+ bytesRead < 0 ||
130
+ bytesRead > byteLengthOf(remaining)) {
131
+ throw new TypeError("Filesystem read returned an invalid byte count");
132
+ }
133
+ chunkLength += bytesRead;
134
+ byteLength += bytesRead;
135
+ }
136
+ if (chunkLength > 0) {
137
+ // Copy a short final chunk so a tiny result does not retain the entire
138
+ // fixed-size read buffer.
139
+ if (chunkLength === chunkByteLength) {
140
+ apply(arrayPush, chunks, [chunk]);
141
+ }
142
+ else {
143
+ const shortChunk = allocateBytes(chunkLength);
144
+ apply(setBytes, shortChunk, [viewBytes(chunk, 0, chunkLength)]);
145
+ apply(arrayPush, chunks, [shortChunk]);
146
+ }
147
+ }
148
+ if (reachedEnd)
149
+ break;
150
+ }
151
+ if (chunks.length === 0)
152
+ return allocateBytes(0);
153
+ if (chunks.length === 1)
154
+ return chunks[0];
155
+ const bytes = allocateBytes(byteLength);
156
+ let offset = 0;
157
+ for (let index = 0; index < chunks.length; index++) {
158
+ const chunk = chunks[index];
159
+ apply(setBytes, bytes, [chunk, offset]);
160
+ offset += byteLengthOf(chunk);
161
+ }
162
+ return bytes;
163
+ }
164
+ /** Read a complete bounded file while leaving ownership of the handle to the caller. */
165
+ export async function readFileHandleWithinLimit(reader, byteLimit) {
166
+ const boundedLimit = requireBoundedFileReadLimit(byteLimit);
167
+ const bytes = await readBoundedFileHandlePrefix(reader, boundedLimit);
168
+ if (byteLengthOf(bytes) < boundedLimit)
169
+ return bytes;
170
+ // Reuse the final accepted byte as the EOF probe instead of allocating or
171
+ // retaining a maximum-plus-one buffer. Restore it when the file ends exactly
172
+ // at the limit; on overflow the result is discarded.
173
+ const finalIndex = boundedLimit - 1;
174
+ const acceptedFinalByte = bytes[finalIndex];
175
+ const probe = viewBytes(bytes, finalIndex, 1);
176
+ const bytesRead = await reader.read(probe);
177
+ if (bytesRead === null || bytesRead === 0) {
178
+ bytes[finalIndex] = acceptedFinalByte;
179
+ return bytes;
180
+ }
181
+ if (!numberIsSafeInteger(bytesRead) || bytesRead < 0 || bytesRead > byteLengthOf(probe)) {
182
+ throw new TypeError("Filesystem read returned an invalid byte count");
183
+ }
184
+ throw new RangeError(`File exceeds byte limit of ${boundedLimit} ${boundedLimit === 1 ? "byte" : "bytes"}`);
185
+ }
@@ -0,0 +1,8 @@
1
+ /** Error raised when a file changes while a stable snapshot is being read. */
2
+ export declare class FileSnapshotChangedError extends Error {
3
+ readonly name = "FileSnapshotChangedError";
4
+ constructor(message?: string);
5
+ }
6
+ /** Return whether a value is a framework-created file snapshot change error. */
7
+ export declare function isFileSnapshotChangedError(value: unknown): value is FileSnapshotChangedError;
8
+ //# sourceMappingURL=file-snapshot-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-snapshot-error.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/adapters/file-snapshot-error.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,SAAkB,IAAI,8BAA8B;gBAExC,OAAO,SAA0C;CAI9D;AAED,gFAAgF;AAChF,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,wBAAwB,CAEnC"}
@@ -0,0 +1,13 @@
1
+ const changedErrors = new WeakSet();
2
+ /** Error raised when a file changes while a stable snapshot is being read. */
3
+ export class FileSnapshotChangedError extends Error {
4
+ name = "FileSnapshotChangedError";
5
+ constructor(message = "File snapshot changed during the read") {
6
+ super(message);
7
+ changedErrors.add(this);
8
+ }
9
+ }
10
+ /** Return whether a value is a framework-created file snapshot change error. */
11
+ export function isFileSnapshotChangedError(value) {
12
+ return typeof value === "object" && value !== null && changedErrors.has(value);
13
+ }
@@ -0,0 +1,74 @@
1
+ type ByteReader = (path: string) => Promise<Uint8Array>;
2
+ type BoundedByteReader = (path: string, byteLimit: number) => Promise<Uint8Array>;
3
+ type ByteWriter = (path: string, content: Uint8Array) => Promise<void>;
4
+ export interface CapturedWholeFileReader {
5
+ readonly maximumBytes: number;
6
+ readonly read: ByteReader;
7
+ }
8
+ export interface CapturedFileSystemCapabilities {
9
+ readonly readFileBytes?: ByteReader;
10
+ readonly readFileBytesBounded?: BoundedByteReader;
11
+ readonly readFileBytesWithinLimit?: BoundedByteReader;
12
+ readonly writeFileBytes?: ByteWriter;
13
+ readonly wholeFileReader?: CapturedWholeFileReader;
14
+ }
15
+ /** Compatibility view used by existing filesystem wrappers and adapters. */
16
+ export interface CapturedByteReaders {
17
+ readonly unbounded?: ByteReader;
18
+ readonly whole?: CapturedWholeFileReader;
19
+ readonly prefix?: BoundedByteReader;
20
+ readonly exact?: BoundedByteReader;
21
+ }
22
+ export interface CapturedSnapshotReader {
23
+ read(path: string, containmentRoot: string, byteLimit: number): Promise<Uint8Array>;
24
+ }
25
+ export interface CapturedExclusiveCreator {
26
+ create(path: string, content: Uint8Array): Promise<void>;
27
+ }
28
+ export interface CapturedStaticReaders {
29
+ snapshot?: CapturedSnapshotReader;
30
+ virtual?: {
31
+ generation(): Promise<number>;
32
+ exact?: (path: string, byteLimit: number) => Promise<Uint8Array>;
33
+ whole?: {
34
+ maximumBytes: number;
35
+ read(path: string): Promise<Uint8Array>;
36
+ };
37
+ };
38
+ }
39
+ /**
40
+ * Admit an untrusted byte result before copying it into an immutable-size,
41
+ * tightly allocated ArrayBuffer. The maximum is checked from the intrinsic
42
+ * Uint8Array byte length before allocating the defensive copy.
43
+ */
44
+ export declare function copyFixedUint8ArrayWithinLimit(value: unknown, maximumBytes: number, label: string): Uint8Array;
45
+ /**
46
+ * Extract the ArrayBuffer from an admitted tight fixed Uint8Array without
47
+ * consulting mutable global constructors or configurable typed-array getters.
48
+ */
49
+ export declare function getFixedUint8ArrayBuffer(value: unknown, label: string): ArrayBuffer;
50
+ /** Read the intrinsic byte length only after verifying a tight fixed buffer. */
51
+ export declare function getFixedUint8ArrayByteLength(value: unknown, label: string): number;
52
+ /**
53
+ * Preserve the broad legacy capture temporarily for its scheduled consumers.
54
+ * Bounded text passes the narrow purpose so writer and prefix fields are never
55
+ * inspected.
56
+ */
57
+ export declare function captureFileSystemCapabilities(value: unknown, label?: string, purpose?: "legacy" | "bounded-text" | "byte-read"): CapturedFileSystemCapabilities;
58
+ /**
59
+ * Capture the established byte-reader surface while defensively admitting
60
+ * every result. New purpose-specific code should prefer the narrower capture
61
+ * functions above.
62
+ */
63
+ export declare function captureByteReadCapabilities(value: unknown, label?: string): CapturedByteReaders;
64
+ /**
65
+ * Capture legacy byte capabilities after genuine snapshot authority has been
66
+ * proven independently. Malformed optional fields are omitted one at a time;
67
+ * unsafe object or prototype provenance still rejects the adapter.
68
+ */
69
+ export declare function captureLegacyFileSystemCapabilitiesForSnapshot(value: unknown, label?: string): CapturedFileSystemCapabilities;
70
+ export declare function captureSnapshotReadCapability(value: unknown, label?: string, allowExplicitUndefined?: boolean): CapturedSnapshotReader | undefined;
71
+ export declare function captureExclusiveCreateCapability(value: unknown, label?: string): CapturedExclusiveCreator | undefined;
72
+ export declare function captureStaticReadCapabilities(value: unknown, label?: string): CapturedStaticReaders;
73
+ export {};
74
+ //# sourceMappingURL=file-system-capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system-capabilities.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/adapters/file-system-capabilities.ts"],"names":[],"mappings":"AA8EA,KAAK,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AACxD,KAAK,iBAAiB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAMlF,KAAK,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAGvE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC;IACpC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,iBAAiB,CAAC;I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