@zyno-io/ts-server-foundation 26.1111.100 → 26.1111.744
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/src/app/base.d.ts.map +1 -1
- package/dist/src/app/base.js +2 -0
- package/dist/src/app/base.js.map +1 -1
- package/dist/src/database/migration/create/comparator.js +13 -2
- package/dist/src/database/migration/create/comparator.js.map +1 -1
- package/dist/src/di/module.js +1 -1
- package/dist/src/helpers/async/process.d.ts +5 -0
- package/dist/src/helpers/async/process.d.ts.map +1 -1
- package/dist/src/helpers/async/process.js +49 -5
- package/dist/src/helpers/async/process.js.map +1 -1
- package/dist/src/helpers/index.d.ts +1 -0
- package/dist/src/helpers/index.d.ts.map +1 -1
- package/dist/src/helpers/index.js +2 -1
- package/dist/src/helpers/index.js.map +1 -1
- package/dist/src/helpers/io/temporary-files.d.ts +47 -0
- package/dist/src/helpers/io/temporary-files.d.ts.map +1 -0
- package/dist/src/helpers/io/temporary-files.js +326 -0
- package/dist/src/helpers/io/temporary-files.js.map +1 -0
- package/dist/src/http/index.d.ts +1 -0
- package/dist/src/http/index.d.ts.map +1 -1
- package/dist/src/http/index.js +2 -1
- package/dist/src/http/index.js.map +1 -1
- package/dist/src/http/response.js +1 -1
- package/dist/src/http/router.js +1 -1
- package/dist/src/http/router.js.map +1 -1
- package/dist/src/http/temporary-workspace.d.ts +10 -0
- package/dist/src/http/temporary-workspace.d.ts.map +1 -0
- package/dist/src/http/temporary-workspace.js +52 -0
- package/dist/src/http/temporary-workspace.js.map +1 -0
- package/dist/src/http/uploads.d.ts +3 -0
- package/dist/src/http/uploads.d.ts.map +1 -1
- package/dist/src/http/uploads.js +20 -18
- package/dist/src/http/uploads.js.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/reflection/annotations.js +1 -1
- package/dist/src/reflection/conversion.js +1 -1
- package/dist/src/reflection/deserializer.js +1 -1
- package/dist/src/reflection/errors.js +1 -1
- package/dist/src/reflection/index.js +1 -1
- package/dist/src/reflection/metadata-store.js +1 -1
- package/dist/src/reflection/model.js +1 -1
- package/dist/src/reflection/primitive-conversion.js +1 -1
- package/dist/src/reflection/reflection-class.js +1 -1
- package/dist/src/reflection/type-utils.js +1 -1
- package/dist/src/services/index.d.ts +1 -0
- package/dist/src/services/index.d.ts.map +1 -1
- package/dist/src/services/index.js +1 -0
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/temporary-files.d.ts +9 -0
- package/dist/src/services/temporary-files.d.ts.map +1 -0
- package/dist/src/services/temporary-files.js +58 -0
- package/dist/src/services/temporary-files.js.map +1 -0
- package/dist/src/types/index.js +1 -1
- package/dist/src/types/primitives.js +1 -1
- package/dist/src/types/type-annotations.js +1 -1
- package/docs/.vitepress/config.mts +1 -0
- package/docs/content/temporary-files.md +133 -0
- package/docs/content/uploads.md +4 -0
- package/package.json +2 -2
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__tsfTypeAliases = exports.temporaryFiles = exports.TemporaryFiles = exports.TemporaryWorkspace = void 0;
|
|
4
|
+
exports.withTemporaryWorkspace = withTemporaryWorkspace;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const _a = tslib_1.__importStar(require("@zyno-io/ts-reflection/type-metadata-runtime"));
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const promises_1 = require("node:fs/promises");
|
|
9
|
+
const node_os_1 = require("node:os");
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
|
+
const promises_2 = require("node:stream/promises");
|
|
12
|
+
const __tsf_metadata_type = _a.createCompactMetadataRegistryV2("[2,[{\"kind\":2},{\"kind\":6},{\"kind\":22,\"type\":{\"kind\":3}},{\"kind\":18,\"typeName\":\"TemporaryWorkspaceOptions\",\"types\":[{\"kind\":20,\"name\":\"replayable\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true}]},{\"kind\":2,\"typeName\":\"(workspace: TemporaryWorkspace) =\\u003e Promise\\u003cT\\u003e\"},{\"kind\":22,\"type\":{\"kind\":2,\"typeName\":\"T\"}},{\"kind\":22,\"type\":{\"kind\":6}},{\"kind\":22,\"type\":{\"kind\":18,\"typeName\":\"TemporaryFileCleanupResult\",\"types\":[{\"kind\":20,\"name\":\"scanned\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"removed\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"retained\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"failed\",\"type\":{\"kind\":7},\"optional\":false}]}}],[]]", []);
|
|
13
|
+
const PREFIX = 'tsf-temp-v1-';
|
|
14
|
+
const DIRECTORY_NAME = /^tsf-temp-v1-[a-zA-Z0-9]{6}$/;
|
|
15
|
+
const STALE_AFTER_MS = 60 * 60 * 1000;
|
|
16
|
+
const MAX_RECOVERY_FILES = 64;
|
|
17
|
+
let _TemporaryWorkspaceMetadata_1;
|
|
18
|
+
/** Owns every generated file within a private directory. Dispose only after its users have settled. */
|
|
19
|
+
class TemporaryWorkspace {
|
|
20
|
+
directory;
|
|
21
|
+
files;
|
|
22
|
+
constructor(directory, files) {
|
|
23
|
+
this.directory = directory;
|
|
24
|
+
this.files = files;
|
|
25
|
+
}
|
|
26
|
+
/** Allocate a name before starting a writer; the writer may require a nonexistent output file. */
|
|
27
|
+
path(name = 'data') {
|
|
28
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,199}$/.test(name) || ['owner.json', 'released'].includes(name)) {
|
|
29
|
+
throw new Error('Temporary workspace paths must be ordinary leaf filenames');
|
|
30
|
+
}
|
|
31
|
+
return (0, node_path_1.join)(this.directory, name);
|
|
32
|
+
}
|
|
33
|
+
async setReplayable() {
|
|
34
|
+
await this.files.markReplayable(this.directory);
|
|
35
|
+
}
|
|
36
|
+
async dispose() {
|
|
37
|
+
await this.files.releaseWorkspace(this.directory);
|
|
38
|
+
}
|
|
39
|
+
static __tsfType = _TemporaryWorkspaceMetadata_1 = _a.decodeCompactMetadataV2("[2,{\"kind\":16,\"name\":\"TemporaryWorkspace\",\"typeName\":\"TemporaryWorkspace\",\"classType\":{\"$tsf\":0},\"properties\":[],\"methods\":[{\"name\":\"path\",\"parameters\":[{\"name\":\"name\",\"type\":{\"$tsfType\":0},\"optional\":true,\"default\":true}],\"returnType\":{\"$tsfType\":1},\"description\":\"Allocate a name before starting a writer; the writer may require a nonexistent output file.\"},{\"name\":\"setReplayable\",\"parameters\":[],\"returnType\":{\"$tsfType\":2}},{\"name\":\"dispose\",\"parameters\":[],\"returnType\":{\"$tsfType\":2}}],\"hasConstructor\":true,\"constructorParameters\":[{\"name\":\"directory\",\"type\":{\"$tsfType\":1},\"optional\":false,\"default\":false},{\"name\":\"files\",\"type\":{\"kind\":16,\"typeName\":\"TemporaryFiles\",\"classType\":{\"$tsf\":1}},\"optional\":false,\"default\":false}]},[]]", [() => TemporaryWorkspace, () => (typeof TemporaryFiles !== "undefined" ? TemporaryFiles : (typeof exports !== "undefined" ? exports.TemporaryFiles : undefined))], __tsf_metadata_type);
|
|
40
|
+
}
|
|
41
|
+
exports.TemporaryWorkspace = TemporaryWorkspace;
|
|
42
|
+
_TemporaryWorkspaceMetadata_1.classType = TemporaryWorkspace;
|
|
43
|
+
TemporaryWorkspace.__tsfType = _TemporaryWorkspaceMetadata_1;
|
|
44
|
+
let _TemporaryFilesMetadata_1;
|
|
45
|
+
/** Process-local staging, never durable storage. Unknown and potentially sole-copy leftovers fail closed. */
|
|
46
|
+
class TemporaryFiles {
|
|
47
|
+
root;
|
|
48
|
+
directory;
|
|
49
|
+
sweeping;
|
|
50
|
+
constructor(root = (0, node_os_1.tmpdir)()) {
|
|
51
|
+
this.root = (0, node_path_1.resolve)(root);
|
|
52
|
+
}
|
|
53
|
+
async createWorkspace(options = {}) {
|
|
54
|
+
return this.allocateWorkspace(options, 'workspace');
|
|
55
|
+
}
|
|
56
|
+
async allocateWorkspace(options, kind) {
|
|
57
|
+
const directory = await (0, promises_1.mkdtemp)((0, node_path_1.join)(this.root, PREFIX));
|
|
58
|
+
try {
|
|
59
|
+
const identity = await processIdentity(process.pid);
|
|
60
|
+
const owner = {
|
|
61
|
+
...identity,
|
|
62
|
+
kind,
|
|
63
|
+
pid: process.pid,
|
|
64
|
+
host: (0, node_os_1.hostname)(),
|
|
65
|
+
createdAt: Date.now(),
|
|
66
|
+
replayable: options.replayable === true
|
|
67
|
+
};
|
|
68
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(directory, 'owner.json'), JSON.stringify(owner), { flag: 'wx', mode: 0o600 });
|
|
69
|
+
return new TemporaryWorkspace(directory, this);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
await (0, promises_1.rm)(directory, { recursive: true, force: true }).catch(() => { });
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async withWorkspace(fn, options = {}) {
|
|
77
|
+
const workspace = await this.createWorkspace(options);
|
|
78
|
+
try {
|
|
79
|
+
return await fn(workspace);
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
// Cleanup failure must not replace the operation's outcome; the release marker permits retry.
|
|
83
|
+
await workspace.dispose().catch(() => { });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** A reserved single-file workspace. Successful return transfers its lifetime to the caller. */
|
|
87
|
+
async create(replayable = false) {
|
|
88
|
+
const workspace = await this.allocateWorkspace({ replayable }, 'file');
|
|
89
|
+
try {
|
|
90
|
+
const file = await (0, promises_1.open)(workspace.path(), 'wx', 0o600);
|
|
91
|
+
await file.close();
|
|
92
|
+
return workspace.path();
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
await workspace.dispose().catch(() => { });
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** Both pipeline ends settle before a failed/aborted partial output is released. */
|
|
100
|
+
async fromStream(source, replayable = false, signal) {
|
|
101
|
+
let path;
|
|
102
|
+
let earlyError;
|
|
103
|
+
const rememberError = (error) => {
|
|
104
|
+
earlyError = error;
|
|
105
|
+
};
|
|
106
|
+
source.on('error', rememberError);
|
|
107
|
+
try {
|
|
108
|
+
path = await this.create(replayable);
|
|
109
|
+
if (earlyError)
|
|
110
|
+
throw earlyError;
|
|
111
|
+
await (0, promises_2.pipeline)(source, (0, node_fs_1.createWriteStream)(path, { mode: 0o600 }), { signal });
|
|
112
|
+
return path;
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
source.destroy();
|
|
116
|
+
if (path)
|
|
117
|
+
await this.remove(path).catch(() => { });
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
source.off('error', rememberError);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** Explicit release by the caller, never a filename/age-based ownership inference. */
|
|
125
|
+
async remove(path) {
|
|
126
|
+
const directory = (0, node_path_1.dirname)(path);
|
|
127
|
+
let singleFile = false;
|
|
128
|
+
if ((0, node_path_1.basename)(path) === 'data' && this.ownsDirectory(directory)) {
|
|
129
|
+
try {
|
|
130
|
+
const content = await (0, promises_1.readFile)((0, node_path_1.join)(directory, 'owner.json'), 'utf8');
|
|
131
|
+
const owner = JSON.parse(content);
|
|
132
|
+
singleFile = owner.kind === 'file';
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
/* Unknown workspace ownership never permits disposing its siblings. */
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (!singleFile) {
|
|
139
|
+
await (0, promises_1.unlink)(path).catch(error => {
|
|
140
|
+
if (!isMissing(error))
|
|
141
|
+
throw error;
|
|
142
|
+
});
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
await this.releaseWorkspace(directory);
|
|
146
|
+
}
|
|
147
|
+
async releaseWorkspace(directory) {
|
|
148
|
+
if (!this.ownsDirectory(directory))
|
|
149
|
+
throw new Error('Not a managed temporary workspace');
|
|
150
|
+
const info = await (0, promises_1.lstat)(directory).catch(error => {
|
|
151
|
+
if (!isMissing(error))
|
|
152
|
+
throw error;
|
|
153
|
+
return undefined;
|
|
154
|
+
});
|
|
155
|
+
if (!info)
|
|
156
|
+
return;
|
|
157
|
+
const uid = process.getuid?.();
|
|
158
|
+
if (!info.isDirectory() || (uid !== undefined && (info.uid !== uid || (info.mode & 0o077) !== 0))) {
|
|
159
|
+
throw new Error('Unsafe temporary workspace');
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(directory, 'released'), '', { flag: 'wx', mode: 0o600 });
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
if (isMissing(error))
|
|
166
|
+
return;
|
|
167
|
+
// A full disk can block the marker write; still try to release owned bytes immediately.
|
|
168
|
+
}
|
|
169
|
+
// Explicit scope disposal owns the entire directory, including partial/unregistered outputs.
|
|
170
|
+
await (0, promises_1.rm)(directory, { recursive: true, force: true });
|
|
171
|
+
}
|
|
172
|
+
async markReplayable(directory) {
|
|
173
|
+
if (!this.ownsDirectory(directory))
|
|
174
|
+
throw new Error('Not a managed temporary workspace');
|
|
175
|
+
const content = await (0, promises_1.readFile)((0, node_path_1.join)(directory, 'owner.json'), 'utf8');
|
|
176
|
+
const owner = JSON.parse(content);
|
|
177
|
+
const identity = await processIdentity(process.pid);
|
|
178
|
+
if (owner.host !== (0, node_os_1.hostname)() ||
|
|
179
|
+
owner.pid !== process.pid ||
|
|
180
|
+
owner.start !== identity.start ||
|
|
181
|
+
owner.boot !== identity.boot ||
|
|
182
|
+
owner.namespace !== identity.namespace) {
|
|
183
|
+
throw new Error("Cannot change another process's temporary workspace");
|
|
184
|
+
}
|
|
185
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(directory, 'owner.json'), JSON.stringify({ ...owner, replayable: true }), { mode: 0o600 });
|
|
186
|
+
}
|
|
187
|
+
sweep() {
|
|
188
|
+
return (this.sweeping ??= this.sweepBatch().finally(() => {
|
|
189
|
+
this.sweeping = undefined;
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
async close() {
|
|
193
|
+
await this.sweeping;
|
|
194
|
+
await this.directory?.close();
|
|
195
|
+
this.directory = undefined;
|
|
196
|
+
}
|
|
197
|
+
ownsDirectory(directory) {
|
|
198
|
+
return (0, node_path_1.dirname)(directory) === this.root && DIRECTORY_NAME.test((0, node_path_1.basename)(directory));
|
|
199
|
+
}
|
|
200
|
+
async sweepBatch() {
|
|
201
|
+
const result = { scanned: 0, removed: 0, retained: 0, failed: 0 };
|
|
202
|
+
this.directory ??= await (0, promises_1.opendir)(this.root);
|
|
203
|
+
while (result.scanned < 100 && result.removed < 25) {
|
|
204
|
+
const entry = await this.directory.read();
|
|
205
|
+
if (!entry) {
|
|
206
|
+
await this.directory.close();
|
|
207
|
+
this.directory = undefined;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
result.scanned++;
|
|
211
|
+
if (!entry.isDirectory() || !DIRECTORY_NAME.test(entry.name))
|
|
212
|
+
continue;
|
|
213
|
+
const directory = (0, node_path_1.join)(this.root, entry.name);
|
|
214
|
+
try {
|
|
215
|
+
const files = await this.recoverableFiles(directory);
|
|
216
|
+
if (!files) {
|
|
217
|
+
result.retained++;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
// No recursive recovery: bound directory entries and never follow links or foreign children.
|
|
221
|
+
for (const name of files.filter(name => name !== 'owner.json' && name !== 'released'))
|
|
222
|
+
await (0, promises_1.unlink)((0, node_path_1.join)(directory, name));
|
|
223
|
+
for (const name of ['owner.json', 'released'])
|
|
224
|
+
await (0, promises_1.unlink)((0, node_path_1.join)(directory, name)).catch(error => {
|
|
225
|
+
if (!isMissing(error))
|
|
226
|
+
throw error;
|
|
227
|
+
});
|
|
228
|
+
await (0, promises_1.rmdir)(directory);
|
|
229
|
+
result.removed++;
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
if (!isMissing(error))
|
|
233
|
+
result.failed++;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return result;
|
|
237
|
+
}
|
|
238
|
+
async recoverableFiles(directory) {
|
|
239
|
+
const info = await (0, promises_1.lstat)(directory);
|
|
240
|
+
if (!info.isDirectory() || (info.mode & 0o077) !== 0 || info.uid !== process.getuid?.())
|
|
241
|
+
return;
|
|
242
|
+
const entries = await (0, promises_1.opendir)(directory);
|
|
243
|
+
const files = [];
|
|
244
|
+
try {
|
|
245
|
+
for (let count = 0; count <= MAX_RECOVERY_FILES; count++) {
|
|
246
|
+
const entry = await entries.read();
|
|
247
|
+
if (!entry)
|
|
248
|
+
break;
|
|
249
|
+
if (count === MAX_RECOVERY_FILES)
|
|
250
|
+
return;
|
|
251
|
+
const stat = await (0, promises_1.lstat)((0, node_path_1.join)(directory, entry.name));
|
|
252
|
+
if (!stat.isFile() || stat.nlink !== 1)
|
|
253
|
+
return;
|
|
254
|
+
files.push(entry.name);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
finally {
|
|
258
|
+
await entries.close();
|
|
259
|
+
}
|
|
260
|
+
if (files.includes('released'))
|
|
261
|
+
return files;
|
|
262
|
+
const metadata = await (0, promises_1.lstat)((0, node_path_1.join)(directory, 'owner.json'));
|
|
263
|
+
if (metadata.size > 2048)
|
|
264
|
+
return;
|
|
265
|
+
const content = await (0, promises_1.readFile)((0, node_path_1.join)(directory, 'owner.json'), 'utf8');
|
|
266
|
+
const owner = JSON.parse(content);
|
|
267
|
+
if (!owner ||
|
|
268
|
+
!['file', 'workspace'].includes(owner.kind) ||
|
|
269
|
+
!Number.isSafeInteger(owner.pid) ||
|
|
270
|
+
owner.pid <= 0 ||
|
|
271
|
+
owner.host !== (0, node_os_1.hostname)() ||
|
|
272
|
+
typeof owner.replayable !== 'boolean' ||
|
|
273
|
+
![owner.boot, owner.namespace, owner.start].every(value => value === null || typeof value === 'string') ||
|
|
274
|
+
(process.platform === 'linux' && (!owner.boot || !owner.namespace || typeof owner.start !== 'string' || !/^\d+$/.test(owner.start))) ||
|
|
275
|
+
typeof owner.createdAt !== 'number' ||
|
|
276
|
+
!Number.isFinite(owner.createdAt) ||
|
|
277
|
+
owner.createdAt < 0 ||
|
|
278
|
+
Date.now() - owner.createdAt < STALE_AFTER_MS)
|
|
279
|
+
return;
|
|
280
|
+
const exited = await ownerExited(owner);
|
|
281
|
+
if (!exited)
|
|
282
|
+
return;
|
|
283
|
+
return owner.replayable || files.length === 1 ? files : undefined;
|
|
284
|
+
}
|
|
285
|
+
static __tsfType = _TemporaryFilesMetadata_1 = _a.decodeCompactMetadataV2("[2,{\"kind\":16,\"name\":\"TemporaryFiles\",\"typeName\":\"TemporaryFiles\",\"classType\":{\"$tsf\":0},\"properties\":[],\"methods\":[{\"name\":\"createWorkspace\",\"parameters\":[{\"$tsfNode\":0}],\"returnType\":{\"kind\":22,\"type\":{\"kind\":16,\"typeName\":\"TemporaryWorkspace\",\"classType\":{\"$tsf\":1}}}},{\"name\":\"withWorkspace\",\"parameters\":[{\"name\":\"fn\",\"type\":{\"$tsfType\":4},\"optional\":false,\"default\":false},{\"$tsfNode\":0}],\"returnType\":{\"$tsfType\":5}},{\"name\":\"create\",\"parameters\":[{\"$tsfNode\":1}],\"returnType\":{\"$tsfType\":6},\"description\":\"A reserved single-file workspace. Successful return transfers its lifetime to the caller.\"},{\"name\":\"fromStream\",\"parameters\":[{\"name\":\"source\",\"type\":{\"$tsfAlias\":[2,\"node:stream\",\"Readable\",\"Readable\"]},\"optional\":false,\"default\":false},{\"$tsfNode\":1},{\"name\":\"signal\",\"type\":{\"kind\":16,\"typeName\":\"AbortSignal\",\"classType\":{\"$tsf\":3}},\"optional\":true,\"default\":false}],\"returnType\":{\"$tsfType\":6},\"description\":\"Both pipeline ends settle before a failed/aborted partial output is released.\"},{\"name\":\"remove\",\"parameters\":[{\"name\":\"path\",\"type\":{\"$tsfType\":1},\"optional\":false,\"default\":false}],\"returnType\":{\"$tsfType\":2},\"description\":\"Explicit release by the caller, never a filename/age-based ownership inference.\"},{\"name\":\"releaseWorkspace\",\"parameters\":{\"$tsfNode\":2},\"returnType\":{\"$tsfType\":2}},{\"name\":\"markReplayable\",\"parameters\":{\"$tsfNode\":2},\"returnType\":{\"$tsfType\":2}},{\"name\":\"sweep\",\"parameters\":[],\"returnType\":{\"$tsfType\":7}},{\"name\":\"close\",\"parameters\":[],\"returnType\":{\"$tsfType\":2}}],\"hasConstructor\":true,\"constructorParameters\":[{\"name\":\"root\",\"type\":{\"$tsfType\":0},\"optional\":true,\"default\":true}]},[{\"name\":\"options\",\"type\":{\"$tsfType\":3},\"optional\":true,\"default\":true},{\"name\":\"replayable\",\"type\":{\"$tsfType\":0},\"optional\":true,\"default\":true},[{\"$tsfNode\":3}],{\"name\":\"directory\",\"type\":{\"$tsfType\":1},\"optional\":false,\"default\":false}]]", [() => TemporaryFiles, () => (typeof TemporaryWorkspace !== "undefined" ? TemporaryWorkspace : (typeof exports !== "undefined" ? exports.TemporaryWorkspace : undefined)), require, () => (typeof AbortSignal !== "undefined" ? AbortSignal : (typeof exports !== "undefined" ? exports.AbortSignal : undefined))], __tsf_metadata_type);
|
|
286
|
+
}
|
|
287
|
+
exports.TemporaryFiles = TemporaryFiles;
|
|
288
|
+
_TemporaryFilesMetadata_1.classType = TemporaryFiles;
|
|
289
|
+
TemporaryFiles.__tsfType = _TemporaryFilesMetadata_1;
|
|
290
|
+
async function processIdentity(pid) {
|
|
291
|
+
if (process.platform !== 'linux')
|
|
292
|
+
return { boot: null, namespace: null, start: null };
|
|
293
|
+
const boot = await (0, promises_1.readFile)('/proc/sys/kernel/random/boot_id', 'utf8');
|
|
294
|
+
const namespace = await (0, promises_1.readlink)('/proc/self/ns/pid');
|
|
295
|
+
const stat = await (0, promises_1.readFile)(`/proc/${pid}/stat`, 'utf8');
|
|
296
|
+
const start = stat.slice(stat.lastIndexOf(')') + 2).split(' ')[19];
|
|
297
|
+
if (!start)
|
|
298
|
+
throw new Error('Missing process start identity');
|
|
299
|
+
return { boot: boot.trim(), namespace, start };
|
|
300
|
+
}
|
|
301
|
+
async function ownerExited(owner) {
|
|
302
|
+
try {
|
|
303
|
+
const current = await processIdentity(process.pid);
|
|
304
|
+
if (owner.boot !== current.boot || owner.namespace !== current.namespace)
|
|
305
|
+
return false;
|
|
306
|
+
process.kill(owner.pid, 0);
|
|
307
|
+
if (process.platform !== 'linux')
|
|
308
|
+
return false;
|
|
309
|
+
const identity = await processIdentity(owner.pid);
|
|
310
|
+
// A reused PID can only have a later start tick in this same boot/namespace.
|
|
311
|
+
// Future/impossible metadata is not proof that an owner exited.
|
|
312
|
+
return typeof owner.start === 'string' && identity.start !== null && BigInt(owner.start) < BigInt(identity.start);
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
return error.code === 'ESRCH';
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function isMissing(error) {
|
|
319
|
+
return error.code === 'ENOENT';
|
|
320
|
+
}
|
|
321
|
+
exports.temporaryFiles = new TemporaryFiles();
|
|
322
|
+
function withTemporaryWorkspace(fn, options = {}) {
|
|
323
|
+
return exports.temporaryFiles.withWorkspace(fn, options);
|
|
324
|
+
}
|
|
325
|
+
exports.__tsfTypeAliases = _a.decodeCompactMetadataV2("[2,{\"TemporaryFileCleanupResult\":{\"kind\":18,\"typeName\":\"TemporaryFileCleanupResult\",\"types\":[{\"kind\":20,\"name\":\"scanned\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"removed\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"retained\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"failed\",\"type\":{\"kind\":7},\"optional\":false}]},\"TemporaryWorkspaceOptions\":{\"kind\":18,\"typeName\":\"TemporaryWorkspaceOptions\",\"types\":[{\"kind\":20,\"name\":\"replayable\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true}]}},[]]", [], __tsf_metadata_type);
|
|
326
|
+
//# sourceMappingURL=temporary-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temporary-files.js","sourceRoot":"","sources":["../../../../src/helpers/io/temporary-files.ts"],"names":[],"mappings":";;;;;;AAGA,qCAA4C;AAC5C,+CAAmH;AACnH,qCAA2C;AAC3C,yCAA6D;AAC7D,mDAAgD;;AAEhD,MAAM,MAAM,GAAG,cAAc,CAAC;AAC9B,MAAM,cAAc,GAAG,8BAA8B,CAAC;AACtD,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACtC,MAAM,kBAAkB,GAAG,EAAE,CAAC;;AAyB9B,uGAAuG;AACvG;IAEiB,SAAS;IACD,KAAK;IAF1B,YACa,SAAiB,EACT,KAAqB;yBAD7B,SAAS;qBACD,KAAK;IACvB,CAAC;IAEJ,kGAAkG;IAClG,IAAI,CAAC,IAAI,GAAG,MAAM;QACd,IAAI,CAAC,oCAAoC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAChG,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QACjF,CAAC;QACD,OAAO,IAAA,gBAAI,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,aAAa;QACf,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;;CACJ;;;;;AAED,6GAA6G;AAC7G;IACqB,IAAI,CAAS;IACtB,SAAS,CAAO;IAChB,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IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAQ,KAA+B,CAAC,IAAI,KAAK,OAAO,CAAC;IAC7D,CAAC;AACL,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC7B,OAAQ,KAA+B,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9D,CAAC;AAEY,QAAA,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;AAEnD,gCAA0C,EAAiD,EAAE,OAAO,GAA8B,EAAE;IAChI,OAAO,QAAA,cAAc,CAAC,aAAa,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC"}
|
package/dist/src/http/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './auth';
|
|
|
12
12
|
export * from './base';
|
|
13
13
|
export * from './context';
|
|
14
14
|
export * from './uploads';
|
|
15
|
+
export * from './temporary-workspace';
|
|
15
16
|
export * from './request-logging';
|
|
16
17
|
export * from './query-redaction';
|
|
17
18
|
export * from './payload-redaction';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,c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,CAAC;AAE3B,eAAO,MAAM,UAAU;IAAK,EAAE;CAAQ,CAAC;AACvC,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAC/C,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1C,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AACvC,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC"}
|
package/dist/src/http/index.js
CHANGED
|
@@ -16,6 +16,7 @@ tslib_1.__exportStar(require("./auth"), exports);
|
|
|
16
16
|
tslib_1.__exportStar(require("./base"), exports);
|
|
17
17
|
tslib_1.__exportStar(require("./context"), exports);
|
|
18
18
|
tslib_1.__exportStar(require("./uploads"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./temporary-workspace"), exports);
|
|
19
20
|
tslib_1.__exportStar(require("./request-logging"), exports);
|
|
20
21
|
tslib_1.__exportStar(require("./query-redaction"), exports);
|
|
21
22
|
tslib_1.__exportStar(require("./payload-redaction"), exports);
|
|
@@ -25,5 +26,5 @@ tslib_1.__exportStar(require("./static-files"), exports);
|
|
|
25
26
|
tslib_1.__exportStar(require("./upgrade"), exports);
|
|
26
27
|
tslib_1.__exportStar(require("./workflow"), exports);
|
|
27
28
|
exports.OkResponse = { ok: true };
|
|
28
|
-
exports.__tsfTypeAliases = _a.decodeCompactMetadataV2("[2,{\"AnyResponse\":{\"kind\":22,\"type\":{\"kind\":1},\"typeName\":\"AnyResponse\"},\"ControllerMetadata\":{\"$tsfAlias\":[0,\"./decorators.js\",\"ControllerMetadata\",\"ControllerMetadata\"]},\"EmptyResponse\":{\"kind\":22,\"type\":{\"kind\":3},\"typeName\":\"EmptyResponse\"},\"EntityValidator\":{\"$tsfAlias\":[0,\"./auth.js\",\"EntityValidator\",\"EntityValidator\"]},\"FallbackControllerMetadata\":{\"$tsfAlias\":[0,\"./decorators.js\",\"FallbackControllerMetadata\",\"FallbackControllerMetadata\"]},\"FileUploadAllowedTypes\":{\"$tsfAlias\":[0,\"./uploads.js\",\"FileUploadAllowedTypes\",\"FileUploadAllowedTypes\"]},\"FileUploadOptions\":{\"$tsfAlias\":[0,\"./uploads.js\",\"FileUploadOptions\",\"FileUploadOptions\"]},\"FileUploadPolicy\":{\"$tsfAlias\":[0,\"./uploads.js\",\"FileUploadPolicy\",\"FileUploadPolicy\"]},\"HttpControllerWorkflowEvent\":{\"$tsfAlias\":[0,\"./workflow.js\",\"HttpControllerWorkflowEvent\",\"HttpControllerWorkflowEvent\"]},\"HttpFallbackController\":{\"$tsfAlias\":[0,\"./decorators.js\",\"HttpFallbackController\",\"HttpFallbackController\"]},\"HttpHeaderInput\":{\"$tsfAlias\":[0,\"./request.js\",\"HttpHeaderInput\",\"HttpHeaderInput\"]},\"HttpHeaderOutput\":{\"$tsfAlias\":[0,\"./response.js\",\"HttpHeaderOutput\",\"HttpHeaderOutput\"]},\"HttpMethod\":{\"$tsfAlias\":[0,\"./request.js\",\"HttpMethod\",\"HttpMethod\"]},\"HttpMiddlewareFunction\":{\"$tsfAlias\":[0,\"./middleware.js\",\"HttpMiddlewareFunction\",\"HttpMiddlewareFunction\"]},\"HttpMiddlewareInput\":{\"$tsfAlias\":[0,\"./middleware.js\",\"HttpMiddlewareInput\",\"HttpMiddlewareInput\"]},\"HttpMiddlewareResult\":{\"$tsfAlias\":[0,\"./middleware.js\",\"HttpMiddlewareResult\",\"HttpMiddlewareResult\"]},\"HttpRequestBodyCapture\":{\"$tsfAlias\":[0,\"./request.js\",\"HttpRequestBodyCapture\",\"HttpRequestBodyCapture\"]},\"HttpRequestBodyLimits\":{\"$tsfAlias\":[0,\"./request.js\",\"HttpRequestBodyLimits\",\"HttpRequestBodyLimits\"]},\"HttpRequestHeaders\":{\"$tsfAlias\":[0,\"./request.js\",\"HttpRequestHeaders\",\"HttpRequestHeaders\"]},\"HttpRequestLoggingOptions\":{\"$tsfAlias\":[0,\"./request-logging.js\",\"HttpRequestLoggingOptions\",\"HttpRequestLoggingOptions\"]},\"HttpRequestObservation\":{\"$tsfAlias\":[0,\"./base.js\",\"HttpRequestObservation\",\"HttpRequestObservation\"]},\"HttpRequestObserver\":{\"$tsfAlias\":[0,\"./base.js\",\"HttpRequestObserver\",\"HttpRequestObserver\"]},\"HttpRequestObserverOptions\":{\"$tsfAlias\":[0,\"./base.js\",\"HttpRequestObserverOptions\",\"HttpRequestObserverOptions\"]},\"HttpResponseResult\":{\"$tsfAlias\":[0,\"./response.js\",\"HttpResponseResult\",\"HttpResponseResult\"]},\"HttpResponseWorkflowEvent\":{\"$tsfAlias\":[0,\"./workflow.js\",\"HttpResponseWorkflowEvent\",\"HttpResponseWorkflowEvent\"]},\"HttpRouteNotFoundWorkflowEvent\":{\"$tsfAlias\":[0,\"./workflow.js\",\"HttpRouteNotFoundWorkflowEvent\",\"HttpRouteNotFoundWorkflowEvent\"]},\"HttpRouteParameterPlan\":{\"$tsfAlias\":[0,\"./router.js\",\"HttpRouteParameterPlan\",\"HttpRouteParameterPlan\"]},\"HttpRoutePlan\":{\"$tsfAlias\":[0,\"./router.js\",\"HttpRoutePlan\",\"HttpRoutePlan\"]},\"HttpRouteWorkflowEvent\":{\"$tsfAlias\":[0,\"./workflow.js\",\"HttpRouteWorkflowEvent\",\"HttpRouteWorkflowEvent\"]},\"HttpServerListenHooks\":{\"$tsfAlias\":[0,\"./base.js\",\"HttpServerListenHooks\",\"HttpServerListenHooks\"]},\"HttpServerRuntimeOptions\":{\"$tsfAlias\":[0,\"./base.js\",\"HttpServerRuntimeOptions\",\"HttpServerRuntimeOptions\"]},\"HttpUpgradeHandler\":{\"$tsfAlias\":[0,\"./upgrade.js\",\"HttpUpgradeHandler\",\"HttpUpgradeHandler\"]},\"HttpWorkflowEvent\":{\"$tsfAlias\":[0,\"./workflow.js\",\"HttpWorkflowEvent\",\"HttpWorkflowEvent\"]},\"HttpWriteHeadHeaders\":{\"$tsfAlias\":[0,\"./response.js\",\"HttpWriteHeadHeaders\",\"HttpWriteHeadHeaders\"]},\"IRedactedRequestBodyLog\":{\"$tsfAlias\":[0,\"./payload-redaction.js\",\"IRedactedRequestBodyLog\",\"IRedactedRequestBodyLog\"]},\"InstallWebSocketUpgradeHandlerOptions\":{\"$tsfAlias\":[0,\"./upgrade.js\",\"InstallWebSocketUpgradeHandlerOptions\",\"InstallWebSocketUpgradeHandlerOptions\"]},\"KnownHttpMethod\":{\"$tsfAlias\":[0,\"./request.js\",\"KnownHttpMethod\",\"KnownHttpMethod\"]},\"MultipartRequestPart\":{\"$tsfAlias\":[0,\"./request.js\",\"MultipartRequestPart\",\"MultipartRequestPart\"]},\"MultipartRequestPolicy\":{\"$tsfAlias\":[0,\"./uploads.js\",\"MultipartRequestPolicy\",\"MultipartRequestPolicy\"]},\"OkResponse\":{\"kind\":22,\"type\":{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"ok\",\"type\":{\"kind\":10,\"literal\":true},\"optional\":false}]},\"typeName\":\"OkResponse\"},\"ParsedMultipartBody\":{\"$tsfAlias\":[0,\"./uploads.js\",\"ParsedMultipartBody\",\"ParsedMultipartBody\"]},\"PayloadRedactionPolicy\":{\"$tsfAlias\":[0,\"./payload-redaction.js\",\"PayloadRedactionPolicy\",\"PayloadRedactionPolicy\"]},\"QueryKeyMatcher\":{\"$tsfAlias\":[0,\"./query-redaction.js\",\"QueryKeyMatcher\",\"QueryKeyMatcher\"]},\"RedactQueryKeys\":{\"$tsfAlias\":[0,\"./query-redaction.js\",\"RedactQueryKeys\",\"RedactQueryKeys\"]},\"RedirectResponse\":{\"kind\":22,\"type\":{\"kind\":3},\"typeName\":\"RedirectResponse\"},\"RequestBuilder\":{\"kind\":16,\"typeName\":\"HttpRequest\",\"classType\":{\"$tsfImport\":[0,\"./request\",\"HttpRequest\"]},\"typeName\":\"RequestBuilder\"},\"ResolvedStaticFilesOptions\":{\"$tsfAlias\":[0,\"./static-files.js\",\"ResolvedStaticFilesOptions\",\"ResolvedStaticFilesOptions\"]},\"RouteMetadata\":{\"$tsfAlias\":[0,\"./decorators.js\",\"RouteMetadata\",\"RouteMetadata\"]},\"RouteParameterResolver\":{\"$tsfAlias\":[0,\"./decorators.js\",\"RouteParameterResolver\",\"RouteParameterResolver\"]},\"RouteParameterResolverContext\":{\"$tsfAlias\":[0,\"./decorators.js\",\"RouteParameterResolverContext\",\"RouteParameterResolverContext\"]},\"RouteParameterResolverMetadata\":{\"$tsfAlias\":[0,\"./decorators.js\",\"RouteParameterResolverMetadata\",\"RouteParameterResolverMetadata\"]},\"RouteParameterResolverRegistry\":{\"$tsfAlias\":[0,\"./decorators.js\",\"RouteParameterResolverRegistry\",\"RouteParameterResolverRegistry\"]},\"StaticFilesOptions\":{\"$tsfAlias\":[0,\"./static-files.js\",\"StaticFilesOptions\",\"StaticFilesOptions\"]},\"UploadedFiles\":{\"$tsfAlias\":[0,\"./uploads.js\",\"UploadedFiles\",\"UploadedFiles\"]},\"VerifyClientFn\":{\"$tsfAlias\":[0,\"./upgrade.js\",\"VerifyClientFn\",\"VerifyClientFn\"]},\"WebSocketUpgradeHandlerOptions\":{\"$tsfAlias\":[0,\"./upgrade.js\",\"WebSocketUpgradeHandlerOptions\",\"WebSocketUpgradeHandlerOptions\"]}},[]]", [require]);
|
|
29
|
+
exports.__tsfTypeAliases = _a.decodeCompactMetadataV2("[2,{\"AnyResponse\":{\"kind\":22,\"type\":{\"kind\":1},\"typeName\":\"AnyResponse\"},\"ControllerMetadata\":{\"$tsfAlias\":[0,\"./decorators.js\",\"ControllerMetadata\",\"ControllerMetadata\"]},\"EmptyResponse\":{\"kind\":22,\"type\":{\"kind\":3},\"typeName\":\"EmptyResponse\"},\"EntityValidator\":{\"$tsfAlias\":[0,\"./auth.js\",\"EntityValidator\",\"EntityValidator\"]},\"FallbackControllerMetadata\":{\"$tsfAlias\":[0,\"./decorators.js\",\"FallbackControllerMetadata\",\"FallbackControllerMetadata\"]},\"FileUploadAllowedTypes\":{\"$tsfAlias\":[0,\"./uploads.js\",\"FileUploadAllowedTypes\",\"FileUploadAllowedTypes\"]},\"FileUploadOptions\":{\"$tsfAlias\":[0,\"./uploads.js\",\"FileUploadOptions\",\"FileUploadOptions\"]},\"FileUploadPolicy\":{\"$tsfAlias\":[0,\"./uploads.js\",\"FileUploadPolicy\",\"FileUploadPolicy\"]},\"HttpControllerWorkflowEvent\":{\"$tsfAlias\":[0,\"./workflow.js\",\"HttpControllerWorkflowEvent\",\"HttpControllerWorkflowEvent\"]},\"HttpFallbackController\":{\"$tsfAlias\":[0,\"./decorators.js\",\"HttpFallbackController\",\"HttpFallbackController\"]},\"HttpHeaderInput\":{\"$tsfAlias\":[0,\"./request.js\",\"HttpHeaderInput\",\"HttpHeaderInput\"]},\"HttpHeaderOutput\":{\"$tsfAlias\":[0,\"./response.js\",\"HttpHeaderOutput\",\"HttpHeaderOutput\"]},\"HttpMethod\":{\"$tsfAlias\":[0,\"./request.js\",\"HttpMethod\",\"HttpMethod\"]},\"HttpMiddlewareFunction\":{\"$tsfAlias\":[0,\"./middleware.js\",\"HttpMiddlewareFunction\",\"HttpMiddlewareFunction\"]},\"HttpMiddlewareInput\":{\"$tsfAlias\":[0,\"./middleware.js\",\"HttpMiddlewareInput\",\"HttpMiddlewareInput\"]},\"HttpMiddlewareResult\":{\"$tsfAlias\":[0,\"./middleware.js\",\"HttpMiddlewareResult\",\"HttpMiddlewareResult\"]},\"HttpRequestBodyCapture\":{\"$tsfAlias\":[0,\"./request.js\",\"HttpRequestBodyCapture\",\"HttpRequestBodyCapture\"]},\"HttpRequestBodyLimits\":{\"$tsfAlias\":[0,\"./request.js\",\"HttpRequestBodyLimits\",\"HttpRequestBodyLimits\"]},\"HttpRequestHeaders\":{\"$tsfAlias\":[0,\"./request.js\",\"HttpRequestHeaders\",\"HttpRequestHeaders\"]},\"HttpRequestLoggingOptions\":{\"$tsfAlias\":[0,\"./request-logging.js\",\"HttpRequestLoggingOptions\",\"HttpRequestLoggingOptions\"]},\"HttpRequestObservation\":{\"$tsfAlias\":[0,\"./base.js\",\"HttpRequestObservation\",\"HttpRequestObservation\"]},\"HttpRequestObserver\":{\"$tsfAlias\":[0,\"./base.js\",\"HttpRequestObserver\",\"HttpRequestObserver\"]},\"HttpRequestObserverOptions\":{\"$tsfAlias\":[0,\"./base.js\",\"HttpRequestObserverOptions\",\"HttpRequestObserverOptions\"]},\"HttpResponseResult\":{\"$tsfAlias\":[0,\"./response.js\",\"HttpResponseResult\",\"HttpResponseResult\"]},\"HttpResponseWorkflowEvent\":{\"$tsfAlias\":[0,\"./workflow.js\",\"HttpResponseWorkflowEvent\",\"HttpResponseWorkflowEvent\"]},\"HttpRouteNotFoundWorkflowEvent\":{\"$tsfAlias\":[0,\"./workflow.js\",\"HttpRouteNotFoundWorkflowEvent\",\"HttpRouteNotFoundWorkflowEvent\"]},\"HttpRouteParameterPlan\":{\"$tsfAlias\":[0,\"./router.js\",\"HttpRouteParameterPlan\",\"HttpRouteParameterPlan\"]},\"HttpRoutePlan\":{\"$tsfAlias\":[0,\"./router.js\",\"HttpRoutePlan\",\"HttpRoutePlan\"]},\"HttpRouteWorkflowEvent\":{\"$tsfAlias\":[0,\"./workflow.js\",\"HttpRouteWorkflowEvent\",\"HttpRouteWorkflowEvent\"]},\"HttpServerListenHooks\":{\"$tsfAlias\":[0,\"./base.js\",\"HttpServerListenHooks\",\"HttpServerListenHooks\"]},\"HttpServerRuntimeOptions\":{\"$tsfAlias\":[0,\"./base.js\",\"HttpServerRuntimeOptions\",\"HttpServerRuntimeOptions\"]},\"HttpUpgradeHandler\":{\"$tsfAlias\":[0,\"./upgrade.js\",\"HttpUpgradeHandler\",\"HttpUpgradeHandler\"]},\"HttpWorkflowEvent\":{\"$tsfAlias\":[0,\"./workflow.js\",\"HttpWorkflowEvent\",\"HttpWorkflowEvent\"]},\"HttpWriteHeadHeaders\":{\"$tsfAlias\":[0,\"./response.js\",\"HttpWriteHeadHeaders\",\"HttpWriteHeadHeaders\"]},\"IRedactedRequestBodyLog\":{\"$tsfAlias\":[0,\"./payload-redaction.js\",\"IRedactedRequestBodyLog\",\"IRedactedRequestBodyLog\"]},\"InstallWebSocketUpgradeHandlerOptions\":{\"$tsfAlias\":[0,\"./upgrade.js\",\"InstallWebSocketUpgradeHandlerOptions\",\"InstallWebSocketUpgradeHandlerOptions\"]},\"KnownHttpMethod\":{\"$tsfAlias\":[0,\"./request.js\",\"KnownHttpMethod\",\"KnownHttpMethod\"]},\"MultipartRequestPart\":{\"$tsfAlias\":[0,\"./request.js\",\"MultipartRequestPart\",\"MultipartRequestPart\"]},\"MultipartRequestPolicy\":{\"$tsfAlias\":[0,\"./uploads.js\",\"MultipartRequestPolicy\",\"MultipartRequestPolicy\"]},\"OkResponse\":{\"kind\":22,\"type\":{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"ok\",\"type\":{\"kind\":10,\"literal\":true},\"optional\":false}]},\"typeName\":\"OkResponse\"},\"ParsedMultipartBody\":{\"$tsfAlias\":[0,\"./uploads.js\",\"ParsedMultipartBody\",\"ParsedMultipartBody\"]},\"PayloadRedactionPolicy\":{\"$tsfAlias\":[0,\"./payload-redaction.js\",\"PayloadRedactionPolicy\",\"PayloadRedactionPolicy\"]},\"QueryKeyMatcher\":{\"$tsfAlias\":[0,\"./query-redaction.js\",\"QueryKeyMatcher\",\"QueryKeyMatcher\"]},\"RedactQueryKeys\":{\"$tsfAlias\":[0,\"./query-redaction.js\",\"RedactQueryKeys\",\"RedactQueryKeys\"]},\"RedirectResponse\":{\"kind\":22,\"type\":{\"kind\":3},\"typeName\":\"RedirectResponse\"},\"RequestBuilder\":{\"kind\":16,\"typeName\":\"HttpRequest\",\"classType\":{\"$tsfImport\":[0,\"./request\",\"HttpRequest\"]},\"typeName\":\"RequestBuilder\"},\"RequestTemporaryWorkspaceOptions\":{\"$tsfAlias\":[0,\"./temporary-workspace.js\",\"RequestTemporaryWorkspaceOptions\",\"RequestTemporaryWorkspaceOptions\"]},\"ResolvedStaticFilesOptions\":{\"$tsfAlias\":[0,\"./static-files.js\",\"ResolvedStaticFilesOptions\",\"ResolvedStaticFilesOptions\"]},\"RouteMetadata\":{\"$tsfAlias\":[0,\"./decorators.js\",\"RouteMetadata\",\"RouteMetadata\"]},\"RouteParameterResolver\":{\"$tsfAlias\":[0,\"./decorators.js\",\"RouteParameterResolver\",\"RouteParameterResolver\"]},\"RouteParameterResolverContext\":{\"$tsfAlias\":[0,\"./decorators.js\",\"RouteParameterResolverContext\",\"RouteParameterResolverContext\"]},\"RouteParameterResolverMetadata\":{\"$tsfAlias\":[0,\"./decorators.js\",\"RouteParameterResolverMetadata\",\"RouteParameterResolverMetadata\"]},\"RouteParameterResolverRegistry\":{\"$tsfAlias\":[0,\"./decorators.js\",\"RouteParameterResolverRegistry\",\"RouteParameterResolverRegistry\"]},\"StaticFilesOptions\":{\"$tsfAlias\":[0,\"./static-files.js\",\"StaticFilesOptions\",\"StaticFilesOptions\"]},\"UploadedFiles\":{\"$tsfAlias\":[0,\"./uploads.js\",\"UploadedFiles\",\"UploadedFiles\"]},\"VerifyClientFn\":{\"$tsfAlias\":[0,\"./upgrade.js\",\"VerifyClientFn\",\"VerifyClientFn\"]},\"WebSocketUpgradeHandlerOptions\":{\"$tsfAlias\":[0,\"./upgrade.js\",\"WebSocketUpgradeHandlerOptions\",\"WebSocketUpgradeHandlerOptions\"]}},[]]", [require]);
|
|
29
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":";;;;;AAEA,uDAA6B;AAC7B,iDAAuB;AACvB,mDAAyB;AACzB,uDAA6B;AAC7B,oDAA0B;AAC1B,qDAA2B;AAC3B,mDAAyB;AACzB,kDAAwB;AACxB,kDAAwB;AACxB,iDAAuB;AACvB,iDAAuB;AACvB,oDAA0B;AAC1B,oDAA0B;AAC1B,4DAAkC;AAClC,4DAAkC;AAClC,8DAAoC;AACpC,gEAAsC;AACtC,4DAAkC;AAClC,yDAA+B;AAC/B,oDAA0B;AAC1B,qDAA2B;AAEd,QAAA,UAAU,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":";;;;;AAEA,uDAA6B;AAC7B,iDAAuB;AACvB,mDAAyB;AACzB,uDAA6B;AAC7B,oDAA0B;AAC1B,qDAA2B;AAC3B,mDAAyB;AACzB,kDAAwB;AACxB,kDAAwB;AACxB,iDAAuB;AACvB,iDAAuB;AACvB,oDAA0B;AAC1B,oDAA0B;AAC1B,gEAAsC;AACtC,4DAAkC;AAClC,4DAAkC;AAClC,8DAAoC;AACpC,gEAAsC;AACtC,4DAAkC;AAClC,yDAA+B;AAC/B,oDAA0B;AAC1B,qDAA2B;AAEd,QAAA,UAAU,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -10,7 +10,7 @@ const tslib_1 = require("tslib");
|
|
|
10
10
|
const _a = tslib_1.__importStar(require("@zyno-io/ts-reflection/type-metadata-runtime"));
|
|
11
11
|
const node_stream_1 = require("node:stream");
|
|
12
12
|
const node_response_write_1 = require("./node-response-write");
|
|
13
|
-
const __tsf_metadata_type = _a.createCompactMetadataRegistryV2("[2,[{\"kind\":7},{\"kind\":2,\"typeName\":\"Map\",\"typeArguments\":[{\"kind\":6},{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":14,\"type\":{\"kind\":6}}]}]},{\"kind\":6},{\"$tsfNode\":0},{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":14,\"type\":{\"kind\":6}},{\"kind\":4}]},{\"$tsfNode\":1},{\"kind\":12,\"types\":[{\"kind\":6},{\"$tsfNode\":1}]},{\"kind\":3},{\"kind\":2},{\"kind\":2,\"typeName\":\"(error?: Error | null) =\\u003e void\"},{\"kind\":1},{\"kind\":8},{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"statusCode\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"contentType\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"headers\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"typeName\":\"Record\",\"utilityType\":\"Record\",\"typeArguments\":{\"$tsfNode\":2},\"index\":{\"$tsfNode\":0},\"types\":[]},{\"kind\":4}]},\"optional\":true}]}],[{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":7},{\"kind\":14,\"type\":{\"kind\":6}}]},{\"kind\":12,\"types\":{\"$tsfNode\":3},\"typeName\":\"HttpWriteHeadHeaders\"},[{\"kind\":6},{\"$tsfNode\":0}],[{\"$tsfNode\":4},{\"$tsfNode\":5}],{\"kind\":
|
|
13
|
+
const __tsf_metadata_type = _a.createCompactMetadataRegistryV2("[2,[{\"kind\":7},{\"kind\":2,\"typeName\":\"Map\",\"typeArguments\":[{\"kind\":6},{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":14,\"type\":{\"kind\":6}}]}]},{\"kind\":6},{\"$tsfNode\":0},{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":14,\"type\":{\"kind\":6}},{\"kind\":4}]},{\"$tsfNode\":1},{\"kind\":12,\"types\":[{\"kind\":6},{\"$tsfNode\":1}]},{\"kind\":3},{\"kind\":2},{\"kind\":2,\"typeName\":\"(error?: Error | null) =\\u003e void\"},{\"kind\":1},{\"kind\":8},{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"statusCode\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"contentType\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"headers\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"typeName\":\"Record\",\"utilityType\":\"Record\",\"typeArguments\":{\"$tsfNode\":2},\"index\":{\"$tsfNode\":0},\"types\":[]},{\"kind\":4}]},\"optional\":true}]}],[{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":7},{\"kind\":14,\"type\":{\"kind\":6}}]},{\"kind\":12,\"types\":{\"$tsfNode\":3},\"typeName\":\"HttpWriteHeadHeaders\"},[{\"kind\":6},{\"$tsfNode\":0}],[{\"$tsfNode\":4},{\"$tsfNode\":5}],{\"kind\":18,\"typeName\":\"Record\",\"utilityType\":\"Record\",\"typeArguments\":{\"$tsfNode\":2},\"index\":{\"$tsfNode\":0},\"types\":[],\"typeName\":\"HttpHeaderOutput\"},{\"kind\":14,\"type\":{\"$tsfNode\":6}},{\"kind\":15,\"types\":{\"$tsfNode\":7}},[{\"type\":{\"kind\":6}},{\"$tsfNode\":8}],{\"type\":{\"$tsfNode\":0}}]]", []);
|
|
14
14
|
let _HttpResponseMetadata_1;
|
|
15
15
|
class HttpResponse extends node_stream_1.Writable {
|
|
16
16
|
statusCodeValue = 200;
|
package/dist/src/http/router.js
CHANGED
|
@@ -145,7 +145,7 @@ class HttpRouter {
|
|
|
145
145
|
resolvedParameters[name] = value;
|
|
146
146
|
}
|
|
147
147
|
const result = await controller[route.propertyKey](...args);
|
|
148
|
-
if (!response.writableEnded && !response.headersSent)
|
|
148
|
+
if (!response.destroyed && !response.writableEnded && !response.headersSent)
|
|
149
149
|
this.writeResult(response, result, route);
|
|
150
150
|
}
|
|
151
151
|
catch (error) {
|