@venizia/ignis-worker 0.2.0-10
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/cjs/applications/index.d.ts +2 -0
- package/dist/cjs/applications/index.d.ts.map +1 -0
- package/dist/cjs/applications/index.js +18 -0
- package/dist/cjs/applications/index.js.map +1 -0
- package/dist/cjs/applications/worker.d.ts +67 -0
- package/dist/cjs/applications/worker.d.ts.map +1 -0
- package/dist/cjs/applications/worker.js +175 -0
- package/dist/cjs/applications/worker.js.map +1 -0
- package/dist/cjs/envelope/encode.d.ts +61 -0
- package/dist/cjs/envelope/encode.d.ts.map +1 -0
- package/dist/cjs/envelope/encode.js +116 -0
- package/dist/cjs/envelope/encode.js.map +1 -0
- package/dist/cjs/envelope/index.d.ts +3 -0
- package/dist/cjs/envelope/index.d.ts.map +1 -0
- package/dist/cjs/envelope/index.js +19 -0
- package/dist/cjs/envelope/index.js.map +1 -0
- package/dist/cjs/envelope/types.d.ts +37 -0
- package/dist/cjs/envelope/types.d.ts.map +1 -0
- package/dist/cjs/envelope/types.js +3 -0
- package/dist/cjs/envelope/types.js.map +1 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/transport/common/index.d.ts +2 -0
- package/dist/cjs/transport/common/index.d.ts.map +1 -0
- package/dist/cjs/transport/common/index.js +18 -0
- package/dist/cjs/transport/common/index.js.map +1 -0
- package/dist/cjs/transport/common/types.d.ts +6 -0
- package/dist/cjs/transport/common/types.d.ts.map +1 -0
- package/dist/cjs/transport/common/types.js +3 -0
- package/dist/cjs/transport/common/types.js.map +1 -0
- package/dist/cjs/transport/fetch-bridge.d.ts +35 -0
- package/dist/cjs/transport/fetch-bridge.d.ts.map +1 -0
- package/dist/cjs/transport/fetch-bridge.js +95 -0
- package/dist/cjs/transport/fetch-bridge.js.map +1 -0
- package/dist/cjs/transport/in-process.d.ts +23 -0
- package/dist/cjs/transport/in-process.d.ts.map +1 -0
- package/dist/cjs/transport/in-process.js +47 -0
- package/dist/cjs/transport/in-process.js.map +1 -0
- package/dist/cjs/transport/index.d.ts +6 -0
- package/dist/cjs/transport/index.d.ts.map +1 -0
- package/dist/cjs/transport/index.js +22 -0
- package/dist/cjs/transport/index.js.map +1 -0
- package/dist/cjs/transport/shared.d.ts +102 -0
- package/dist/cjs/transport/shared.d.ts.map +1 -0
- package/dist/cjs/transport/shared.js +396 -0
- package/dist/cjs/transport/shared.js.map +1 -0
- package/dist/cjs/transport/worker.d.ts +62 -0
- package/dist/cjs/transport/worker.d.ts.map +1 -0
- package/dist/cjs/transport/worker.js +223 -0
- package/dist/cjs/transport/worker.js.map +1 -0
- package/dist/esm/applications/index.d.ts +2 -0
- package/dist/esm/applications/index.d.ts.map +1 -0
- package/dist/esm/applications/index.js +2 -0
- package/dist/esm/applications/index.js.map +1 -0
- package/dist/esm/applications/worker.d.ts +67 -0
- package/dist/esm/applications/worker.d.ts.map +1 -0
- package/dist/esm/applications/worker.js +171 -0
- package/dist/esm/applications/worker.js.map +1 -0
- package/dist/esm/envelope/encode.d.ts +61 -0
- package/dist/esm/envelope/encode.d.ts.map +1 -0
- package/dist/esm/envelope/encode.js +112 -0
- package/dist/esm/envelope/encode.js.map +1 -0
- package/dist/esm/envelope/index.d.ts +3 -0
- package/dist/esm/envelope/index.d.ts.map +1 -0
- package/dist/esm/envelope/index.js +3 -0
- package/dist/esm/envelope/index.js.map +1 -0
- package/dist/esm/envelope/types.d.ts +37 -0
- package/dist/esm/envelope/types.d.ts.map +1 -0
- package/dist/esm/envelope/types.js +2 -0
- package/dist/esm/envelope/types.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/transport/common/index.d.ts +2 -0
- package/dist/esm/transport/common/index.d.ts.map +1 -0
- package/dist/esm/transport/common/index.js +2 -0
- package/dist/esm/transport/common/index.js.map +1 -0
- package/dist/esm/transport/common/types.d.ts +6 -0
- package/dist/esm/transport/common/types.d.ts.map +1 -0
- package/dist/esm/transport/common/types.js +2 -0
- package/dist/esm/transport/common/types.js.map +1 -0
- package/dist/esm/transport/fetch-bridge.d.ts +35 -0
- package/dist/esm/transport/fetch-bridge.d.ts.map +1 -0
- package/dist/esm/transport/fetch-bridge.js +91 -0
- package/dist/esm/transport/fetch-bridge.js.map +1 -0
- package/dist/esm/transport/in-process.d.ts +23 -0
- package/dist/esm/transport/in-process.d.ts.map +1 -0
- package/dist/esm/transport/in-process.js +43 -0
- package/dist/esm/transport/in-process.js.map +1 -0
- package/dist/esm/transport/index.d.ts +6 -0
- package/dist/esm/transport/index.d.ts.map +1 -0
- package/dist/esm/transport/index.js +6 -0
- package/dist/esm/transport/index.js.map +1 -0
- package/dist/esm/transport/shared.d.ts +102 -0
- package/dist/esm/transport/shared.d.ts.map +1 -0
- package/dist/esm/transport/shared.js +391 -0
- package/dist/esm/transport/shared.js.map +1 -0
- package/dist/esm/transport/worker.d.ts +62 -0
- package/dist/esm/transport/worker.d.ts.map +1 -0
- package/dist/esm/transport/worker.js +219 -0
- package/dist/esm/transport/worker.js.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { BaseHelper, getError } from '@venizia/ignis-helpers/core';
|
|
2
|
+
import { RequestIdGenerator } from '@venizia/ignis-helpers/core';
|
|
3
|
+
import { BffEnvelope } from '../envelope/encode.js';
|
|
4
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
5
|
+
/** How long a still-serving worker gets to answer after it reports an error - see `handleWorkerError`. */
|
|
6
|
+
const WORKER_ERROR_GRACE_MS = 250;
|
|
7
|
+
const isErrorEnvelope = (data) => {
|
|
8
|
+
return 'error' in data;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* UI-side half of the BFF: posts an encoded request to a real `Worker` and resolves the matching
|
|
12
|
+
* response by `id` - the far side of `WorkerApplication.listen()`.
|
|
13
|
+
*
|
|
14
|
+
* The three worker listeners are attached ONCE, in the constructor, and every request is tracked in
|
|
15
|
+
* `pendingRequests` instead. Registering them per request looks equivalent and is not: they are
|
|
16
|
+
* scoped to the shared `Worker`, so a single `messageerror` - which means exactly one message
|
|
17
|
+
* failed to deserialise - would fire every in-flight request's handler, rejecting nine healthy
|
|
18
|
+
* requests that are about to be answered normally.
|
|
19
|
+
*/
|
|
20
|
+
export class WorkerBffTransport extends BaseHelper {
|
|
21
|
+
constructor(opts) {
|
|
22
|
+
super({ scope: WorkerBffTransport.name });
|
|
23
|
+
this.requestIdGenerator = new RequestIdGenerator({
|
|
24
|
+
scope: WorkerBffTransport.name,
|
|
25
|
+
});
|
|
26
|
+
this.pendingRequests = new Map();
|
|
27
|
+
/** Set by `close()`, so a later `fetch()` is refused instead of reaching a worker nothing listens to. */
|
|
28
|
+
this.isClosed = false;
|
|
29
|
+
/** Outstanding `handleWorkerError` grace timers, cleared by `close()` so none outlives the transport. */
|
|
30
|
+
this.graceTimers = new Set();
|
|
31
|
+
/** Removes a pending request from the map and releases its timer and abort listener, so nothing can settle it twice. */
|
|
32
|
+
this.takePending = (opts) => {
|
|
33
|
+
const pending = this.pendingRequests.get(opts.id);
|
|
34
|
+
if (!pending) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
this.pendingRequests.delete(opts.id);
|
|
38
|
+
pending.release();
|
|
39
|
+
return pending;
|
|
40
|
+
};
|
|
41
|
+
this.handleMessage = (event) => {
|
|
42
|
+
// `event.data` is untyped (`any`) until narrowed below - a worker posts to this page for its own
|
|
43
|
+
// reasons too (a dev-server ping, a library handshake), and none of those carry an `id` this
|
|
44
|
+
// transport is waiting on.
|
|
45
|
+
const data = event.data;
|
|
46
|
+
if (!data?.id) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const pending = this.takePending({ id: data.id });
|
|
50
|
+
if (!pending) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (isErrorEnvelope(data)) {
|
|
54
|
+
pending.reject(BffEnvelope.decodeError({ envelope: data }));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// Settled inside its own try: `decodeResponse` throws a `RangeError` for a status outside
|
|
58
|
+
// 200-599 and a `TypeError` on a malformed header tuple, and by this point the timer and the
|
|
59
|
+
// listeners are already gone - a throw that escaped here would leave the promise with nothing
|
|
60
|
+
// left to settle it, ever.
|
|
61
|
+
try {
|
|
62
|
+
pending.resolve(BffEnvelope.decodeResponse({ envelope: data }));
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
pending.reject(getError({
|
|
66
|
+
message: `[WorkerBffTransport] Failed to decode the response envelope | id: ${data.id} | error: ${error}`,
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* An `error` event does NOT mean the worker is dead.
|
|
72
|
+
*
|
|
73
|
+
* Measured in Chromium: a synchronous uncaught throw anywhere in the worker - a third-party timer,
|
|
74
|
+
* say - fires this event while the worker keeps serving, and the genuine responses to the
|
|
75
|
+
* in-flight requests arrive a moment later. Rejecting immediately reported a committed POST as
|
|
76
|
+
* failed and then dropped its real 200 on the floor, because nothing was left waiting for it.
|
|
77
|
+
*
|
|
78
|
+
* So the event is logged at once and the requests are given a grace window. Whatever the worker
|
|
79
|
+
* still answers inside it settles normally; whatever is left after it really is lost, and is
|
|
80
|
+
* rejected with the diagnostics rather than left to run out its own timeout.
|
|
81
|
+
*/
|
|
82
|
+
this.handleWorkerError = (event) => {
|
|
83
|
+
// `String(event)` is always `[object ErrorEvent]` - it says nothing. Read the fields a browser
|
|
84
|
+
// actually populates, so the log names the file and line that failed.
|
|
85
|
+
const detail = this.describeErrorEvent(event);
|
|
86
|
+
this.logger
|
|
87
|
+
.for('handleWorkerError')
|
|
88
|
+
.error('Worker reported an error | pending: %s | detail: %s', this.pendingRequests.size, detail);
|
|
89
|
+
const affected = [...this.pendingRequests.keys()];
|
|
90
|
+
// Held so `close()` can clear it. A grace timer that outlives the transport keeps the process
|
|
91
|
+
// (or a test runner) awake and fires against a map nobody is watching any more.
|
|
92
|
+
const timer = setTimeout(() => {
|
|
93
|
+
this.graceTimers.delete(timer);
|
|
94
|
+
for (const id of affected) {
|
|
95
|
+
// `takePending` answers undefined for anything the worker managed to settle in the window.
|
|
96
|
+
this.takePending({ id })?.reject(getError({
|
|
97
|
+
message: `[WorkerBffTransport] Worker failed while awaiting a response | id: ${id} | detail: ${detail}`,
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
}, WORKER_ERROR_GRACE_MS);
|
|
101
|
+
this.graceTimers.add(timer);
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* `messageerror` means exactly ONE posted message failed to deserialise, and the event carries
|
|
105
|
+
* nothing that says which. With a single request in flight that is unambiguous, so it settles
|
|
106
|
+
* now; with several, the lost answer belongs to one of them and rejecting the rest would be a
|
|
107
|
+
* lie - each then ends on its own timeout, under its own id.
|
|
108
|
+
*/
|
|
109
|
+
this.handleMessageError = (event) => {
|
|
110
|
+
if (this.pendingRequests.size !== 1) {
|
|
111
|
+
this.logger
|
|
112
|
+
.for(this.handleMessageError.name)
|
|
113
|
+
.warn('A worker message could not be deserialised and no single request owns it | inFlight: %d | event: %s', this.pendingRequests.size, String(event));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const [id] = [...this.pendingRequests.keys()];
|
|
117
|
+
this.takePending({ id: id })?.reject(getError({
|
|
118
|
+
message: `[WorkerBffTransport] The worker's response could not be deserialised | id: ${id} | event: ${String(event)}`,
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
this.worker = opts.worker;
|
|
122
|
+
this.timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
123
|
+
this.worker.addEventListener('message', this.handleMessage);
|
|
124
|
+
this.worker.addEventListener('error', this.handleWorkerError);
|
|
125
|
+
this.worker.addEventListener('messageerror', this.handleMessageError);
|
|
126
|
+
}
|
|
127
|
+
/** `ErrorEvent` carries the useful fields; a plain `Event` does not, so both shapes are handled. */
|
|
128
|
+
describeErrorEvent(event) {
|
|
129
|
+
const candidate = event;
|
|
130
|
+
if (!candidate.message) {
|
|
131
|
+
return event.type;
|
|
132
|
+
}
|
|
133
|
+
return `${candidate.message} (${candidate.filename ?? 'unknown'}:${candidate.lineno ?? 0}:${candidate.colno ?? 0})`;
|
|
134
|
+
}
|
|
135
|
+
async fetch(opts) {
|
|
136
|
+
const { request } = opts;
|
|
137
|
+
const { signal } = request;
|
|
138
|
+
// Refused, not queued. `close()` detaches the message listener, so a request posted after it
|
|
139
|
+
// still reached the worker - which EXECUTED it, writes included - while the answer had nowhere
|
|
140
|
+
// to land and the caller waited out the full timeout.
|
|
141
|
+
if (this.isClosed) {
|
|
142
|
+
throw getError({
|
|
143
|
+
message: '[WorkerBffTransport] The transport is closed | open a new one to make requests',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (signal?.aborted) {
|
|
147
|
+
throw this.toAbortError({ signal });
|
|
148
|
+
}
|
|
149
|
+
const id = this.requestIdGenerator.nextId();
|
|
150
|
+
// The URL is overridden rather than the request rebuilt: rebuilding reads the body once here
|
|
151
|
+
// and once inside `encodeRequest`, and it silently drops `signal` on the way.
|
|
152
|
+
const requestEnvelope = await BffEnvelope.encodeRequest({
|
|
153
|
+
request,
|
|
154
|
+
id,
|
|
155
|
+
url: BffEnvelope.toSyntheticUrl({ url: request.url }),
|
|
156
|
+
});
|
|
157
|
+
return new Promise((resolve, reject) => {
|
|
158
|
+
const timer = setTimeout(() => {
|
|
159
|
+
this.takePending({ id })?.reject(getError({
|
|
160
|
+
message: `[WorkerBffTransport] Timed out waiting for a response | id: ${id} | timeoutMs: ${this.timeoutMs}`,
|
|
161
|
+
}));
|
|
162
|
+
}, this.timeoutMs);
|
|
163
|
+
const handleAbort = () => {
|
|
164
|
+
this.takePending({ id })?.reject(this.toAbortError({ signal }));
|
|
165
|
+
};
|
|
166
|
+
signal?.addEventListener('abort', handleAbort);
|
|
167
|
+
this.pendingRequests.set(id, {
|
|
168
|
+
resolve,
|
|
169
|
+
reject,
|
|
170
|
+
release: () => {
|
|
171
|
+
clearTimeout(timer);
|
|
172
|
+
signal?.removeEventListener('abort', handleAbort);
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
// Buffering the body took an await, and `addEventListener('abort')` never fires on a signal
|
|
176
|
+
// that aborted before it was attached - without this re-read that window loses the abort and
|
|
177
|
+
// the caller waits out the whole timeout.
|
|
178
|
+
if (signal?.aborted) {
|
|
179
|
+
handleAbort();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
// `close()` can land during that same await. The entry guard above is then stale, and posting
|
|
183
|
+
// reaches a worker that EXECUTES the request - writes included - while the answer has nowhere
|
|
184
|
+
// to land, because `close()` already detached the listener.
|
|
185
|
+
if (this.isClosed) {
|
|
186
|
+
this.takePending({ id })?.reject(getError({
|
|
187
|
+
message: `[WorkerBffTransport] The transport closed while the request was being encoded | id: ${id}`,
|
|
188
|
+
}));
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
this.worker.postMessage(requestEnvelope, requestEnvelope.body ? [requestEnvelope.body] : []);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/** `signal.reason` first, the way `globalThis.fetch` rejects, so `controller.abort(myReason)` still reaches the caller. */
|
|
195
|
+
toAbortError(opts) {
|
|
196
|
+
return (opts.signal?.reason ??
|
|
197
|
+
getError({ message: '[WorkerBffTransport] The request was aborted by its caller' }));
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Detaches the three worker listeners and fails whatever is still in flight. The worker itself is
|
|
201
|
+
* left alone - this transport did not create it, and a page may hand the same one to another.
|
|
202
|
+
*/
|
|
203
|
+
close() {
|
|
204
|
+
this.isClosed = true;
|
|
205
|
+
for (const timer of this.graceTimers) {
|
|
206
|
+
clearTimeout(timer);
|
|
207
|
+
}
|
|
208
|
+
this.graceTimers.clear();
|
|
209
|
+
this.worker.removeEventListener('message', this.handleMessage);
|
|
210
|
+
this.worker.removeEventListener('error', this.handleWorkerError);
|
|
211
|
+
this.worker.removeEventListener('messageerror', this.handleMessageError);
|
|
212
|
+
for (const id of [...this.pendingRequests.keys()]) {
|
|
213
|
+
this.takePending({ id })?.reject(getError({
|
|
214
|
+
message: `[WorkerBffTransport] The transport was closed while awaiting a response | id: ${id}`,
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/transport/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,0GAA0G;AAC1G,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,MAAM,eAAe,GAAG,CACtB,IAA8C,EACnB,EAAE;IAC7B,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC,CAAC;AASF;;;;;;;;;GASG;AACH,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IAchD,YAAY,IAA4C;QACtD,KAAK,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC;QAZ3B,uBAAkB,GAAG,IAAI,kBAAkB,CAAC;YAC3D,KAAK,EAAE,kBAAkB,CAAC,IAAI;SAC/B,CAAC,CAAC;QACc,oBAAe,GAAG,IAAI,GAAG,EAA2B,CAAC;QAEtE,yGAAyG;QACjG,aAAQ,GA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;QACD,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC/D,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACjE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEzE,KAAK,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;YAClD,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,CAC9B,QAAQ,CAAC;gBACP,OAAO,EAAE,iFAAiF,EAAE,EAAE;aAC/F,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@venizia/ignis-worker",
|
|
3
|
+
"version": "0.2.0-10",
|
|
4
|
+
"description": "Browser Web Worker host for the IGNIS framework: the request/response envelope, the transport contract, and WorkerApplication - the layer that listens on `onmessage` instead of a socket, so a RestApplication can serve its controllers with no server anywhere.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"browser",
|
|
7
|
+
"bun",
|
|
8
|
+
"envelope",
|
|
9
|
+
"hono",
|
|
10
|
+
"ignis",
|
|
11
|
+
"loopback",
|
|
12
|
+
"loopback4",
|
|
13
|
+
"rest",
|
|
14
|
+
"transport",
|
|
15
|
+
"typescript",
|
|
16
|
+
"venizia",
|
|
17
|
+
"worker"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://ignis.venizia.ai",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/VENIZIA-AI/ignis.git",
|
|
23
|
+
"directory": "packages/core-worker"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/VENIZIA-AI/ignis/issues"
|
|
27
|
+
},
|
|
28
|
+
"author": {
|
|
29
|
+
"name": "VENIZIA AI Developer",
|
|
30
|
+
"email": "developer@venizia.ai",
|
|
31
|
+
"url": "https://venizia.ai"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"engines": {
|
|
35
|
+
"bun": ">=1.3"
|
|
36
|
+
},
|
|
37
|
+
"main": "./dist/cjs/index.js",
|
|
38
|
+
"module": "./dist/esm/index.js",
|
|
39
|
+
"types": "./dist/cjs/index.d.ts",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/cjs/index.d.ts",
|
|
43
|
+
"import": "./dist/esm/index.js",
|
|
44
|
+
"require": "./dist/cjs/index.js",
|
|
45
|
+
"default": "./dist/cjs/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./package.json": "./package.json"
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"README.md",
|
|
51
|
+
"LICENSE.md",
|
|
52
|
+
"dist",
|
|
53
|
+
"!/**/__tests__",
|
|
54
|
+
"!**/*.tsbuildinfo"
|
|
55
|
+
],
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"sideEffects": [
|
|
60
|
+
"./dist/cjs/index.js",
|
|
61
|
+
"./dist/esm/index.js"
|
|
62
|
+
],
|
|
63
|
+
"scripts": {
|
|
64
|
+
"force-update": "sh ./scripts/force-update.sh",
|
|
65
|
+
"build": "sh ./scripts/build.sh",
|
|
66
|
+
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.build.json",
|
|
67
|
+
"clean": "sh ./scripts/clean.sh",
|
|
68
|
+
"rebuild": "sh ./scripts/rebuild.sh no-version",
|
|
69
|
+
"eslint": "eslint --report-unused-disable-directives .",
|
|
70
|
+
"lint": "bun run eslint && bun run prettier:cli",
|
|
71
|
+
"lint:fix": "bun run eslint --fix && bun run prettier:fix",
|
|
72
|
+
"prettier:cli": "prettier \"**/*.{js,ts}\" -l",
|
|
73
|
+
"prettier:fix": "bun run prettier:cli --write",
|
|
74
|
+
"prepublishOnly": "bun run rebuild"
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@venizia/ignis-helpers": "^0.2.0-7",
|
|
78
|
+
"@venizia/ignis-inversion": "^0.2.0-3",
|
|
79
|
+
"@venizia/ignis-kernel": "^0.2.0-9",
|
|
80
|
+
"reflect-metadata": "^0.2.2"
|
|
81
|
+
},
|
|
82
|
+
"peerDependencies": {
|
|
83
|
+
"@hono/zod-openapi": "^1.5.1",
|
|
84
|
+
"hono": "^4.12.30"
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@types/bun": "^1.3.14",
|
|
88
|
+
"@venizia/dev-configs": "^0.2.0-3",
|
|
89
|
+
"eslint": "^10.7.0",
|
|
90
|
+
"prettier": "^3.9.5",
|
|
91
|
+
"tsc-alias": "^1.9.1",
|
|
92
|
+
"typescript": "^6.0.3"
|
|
93
|
+
}
|
|
94
|
+
}
|