@standardserver/core 0.0.0 → 0.0.2

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.
@@ -0,0 +1,79 @@
1
+ interface EventStreamMessageMeta {
2
+ /**
3
+ * Event identifier, sent back by the client as `lastEventId` for reconnection attempts.
4
+ *
5
+ * @warning id cannot contain newline characters (`\n`)
6
+ */
7
+ id?: string | undefined;
8
+ /**
9
+ * The number of milliseconds the client should wait before attempting to reconnect.
10
+ */
11
+ retry?: number | undefined;
12
+ /**
13
+ * Comments associated with the event.
14
+ *
15
+ * @warning Comments must not contain newline characters (`\n`).
16
+ */
17
+ comments?: readonly string[] | undefined;
18
+ }
19
+ interface EventStreamMessage extends EventStreamMessageMeta {
20
+ /**
21
+ * Event name (e.g., `message`, `error`).
22
+ */
23
+ event?: string | undefined;
24
+ /**
25
+ * Event data, typically JSON-encoded.
26
+ */
27
+ data?: string | undefined;
28
+ }
29
+
30
+ declare function decodeEventStreamMessage(encoded: string): EventStreamMessage;
31
+ declare class EventStreamDecoder {
32
+ private readonly onEvent;
33
+ private incomplete;
34
+ constructor(onEvent: (event: EventStreamMessage) => void);
35
+ feed(chunk: string): void;
36
+ end(): void;
37
+ }
38
+ declare class EventStreamDecoderStream extends TransformStream<string, EventStreamMessage> {
39
+ constructor();
40
+ }
41
+
42
+ declare function assertEventStreamMessageId(id: string): void;
43
+ declare function assertEventStreamMessageName(event: string): void;
44
+ declare function assertEventStreamMessageRetry(retry: number): void;
45
+ declare function assertEventStreamMessageComment(comment: string): void;
46
+ declare function encodeEventStreamMessageData(data: string | undefined): string;
47
+ declare function encodeEventStreamMessageComments(comments: readonly string[] | undefined): string;
48
+ declare function encodeEventStreamMessage(message: EventStreamMessage): string;
49
+
50
+ declare class EventStreamEncoderError extends TypeError {
51
+ }
52
+ declare class EventStreamDecoderError extends TypeError {
53
+ }
54
+ interface EventIteratorErrorEventOptions extends ErrorOptions {
55
+ message?: string;
56
+ }
57
+ declare class EventIteratorErrorEvent extends Error {
58
+ readonly data: unknown;
59
+ constructor(data: unknown, options?: EventIteratorErrorEventOptions);
60
+ }
61
+
62
+ declare const EVENT_META_SYMBOL: symbol;
63
+ /**
64
+ * Attaches event meta information to the provided container.
65
+ *
66
+ * @info The returned container is a proxy that intercepts access to the meta symbol.
67
+ */
68
+ declare function withEventIteratorEventMeta<T extends object>(container: T, meta: EventStreamMessageMeta): T;
69
+ /**
70
+ * Resolves the event meta information from the provided container.
71
+ */
72
+ declare function resolveEventIteratorEvent<T>(container: T): [data: T, meta: EventStreamMessageMeta | undefined];
73
+ /**
74
+ * Retrieves event meta information from the provided container.
75
+ */
76
+ declare function getEventIteratorEventMeta(container: unknown): EventStreamMessageMeta | undefined;
77
+
78
+ export { EVENT_META_SYMBOL, EventIteratorErrorEvent, EventStreamDecoder, EventStreamDecoderError, EventStreamDecoderStream, EventStreamEncoderError, assertEventStreamMessageComment, assertEventStreamMessageId, assertEventStreamMessageName, assertEventStreamMessageRetry, decodeEventStreamMessage, encodeEventStreamMessage, encodeEventStreamMessageComments, encodeEventStreamMessageData, getEventIteratorEventMeta, resolveEventIteratorEvent, withEventIteratorEventMeta };
79
+ export type { EventIteratorErrorEventOptions, EventStreamMessage, EventStreamMessageMeta };
@@ -0,0 +1,79 @@
1
+ interface EventStreamMessageMeta {
2
+ /**
3
+ * Event identifier, sent back by the client as `lastEventId` for reconnection attempts.
4
+ *
5
+ * @warning id cannot contain newline characters (`\n`)
6
+ */
7
+ id?: string | undefined;
8
+ /**
9
+ * The number of milliseconds the client should wait before attempting to reconnect.
10
+ */
11
+ retry?: number | undefined;
12
+ /**
13
+ * Comments associated with the event.
14
+ *
15
+ * @warning Comments must not contain newline characters (`\n`).
16
+ */
17
+ comments?: readonly string[] | undefined;
18
+ }
19
+ interface EventStreamMessage extends EventStreamMessageMeta {
20
+ /**
21
+ * Event name (e.g., `message`, `error`).
22
+ */
23
+ event?: string | undefined;
24
+ /**
25
+ * Event data, typically JSON-encoded.
26
+ */
27
+ data?: string | undefined;
28
+ }
29
+
30
+ declare function decodeEventStreamMessage(encoded: string): EventStreamMessage;
31
+ declare class EventStreamDecoder {
32
+ private readonly onEvent;
33
+ private incomplete;
34
+ constructor(onEvent: (event: EventStreamMessage) => void);
35
+ feed(chunk: string): void;
36
+ end(): void;
37
+ }
38
+ declare class EventStreamDecoderStream extends TransformStream<string, EventStreamMessage> {
39
+ constructor();
40
+ }
41
+
42
+ declare function assertEventStreamMessageId(id: string): void;
43
+ declare function assertEventStreamMessageName(event: string): void;
44
+ declare function assertEventStreamMessageRetry(retry: number): void;
45
+ declare function assertEventStreamMessageComment(comment: string): void;
46
+ declare function encodeEventStreamMessageData(data: string | undefined): string;
47
+ declare function encodeEventStreamMessageComments(comments: readonly string[] | undefined): string;
48
+ declare function encodeEventStreamMessage(message: EventStreamMessage): string;
49
+
50
+ declare class EventStreamEncoderError extends TypeError {
51
+ }
52
+ declare class EventStreamDecoderError extends TypeError {
53
+ }
54
+ interface EventIteratorErrorEventOptions extends ErrorOptions {
55
+ message?: string;
56
+ }
57
+ declare class EventIteratorErrorEvent extends Error {
58
+ readonly data: unknown;
59
+ constructor(data: unknown, options?: EventIteratorErrorEventOptions);
60
+ }
61
+
62
+ declare const EVENT_META_SYMBOL: symbol;
63
+ /**
64
+ * Attaches event meta information to the provided container.
65
+ *
66
+ * @info The returned container is a proxy that intercepts access to the meta symbol.
67
+ */
68
+ declare function withEventIteratorEventMeta<T extends object>(container: T, meta: EventStreamMessageMeta): T;
69
+ /**
70
+ * Resolves the event meta information from the provided container.
71
+ */
72
+ declare function resolveEventIteratorEvent<T>(container: T): [data: T, meta: EventStreamMessageMeta | undefined];
73
+ /**
74
+ * Retrieves event meta information from the provided container.
75
+ */
76
+ declare function getEventIteratorEventMeta(container: unknown): EventStreamMessageMeta | undefined;
77
+
78
+ export { EVENT_META_SYMBOL, EventIteratorErrorEvent, EventStreamDecoder, EventStreamDecoderError, EventStreamDecoderStream, EventStreamEncoderError, assertEventStreamMessageComment, assertEventStreamMessageId, assertEventStreamMessageName, assertEventStreamMessageRetry, decodeEventStreamMessage, encodeEventStreamMessage, encodeEventStreamMessageComments, encodeEventStreamMessageData, getEventIteratorEventMeta, resolveEventIteratorEvent, withEventIteratorEventMeta };
79
+ export type { EventIteratorErrorEventOptions, EventStreamMessage, EventStreamMessageMeta };
@@ -0,0 +1,197 @@
1
+ import { getPackageSymbol, createEnhancedProxy, isTypescriptObject, getEnhancedProxyTarget } from '@standardserver/shared';
2
+
3
+ class EventStreamEncoderError extends TypeError {
4
+ }
5
+ class EventStreamDecoderError extends TypeError {
6
+ }
7
+ class EventIteratorErrorEvent extends Error {
8
+ constructor(data, options = {}) {
9
+ super(options?.message ?? "Error Event", options);
10
+ this.data = data;
11
+ }
12
+ }
13
+
14
+ function decodeEventStreamMessage(encoded) {
15
+ const lines = encoded.replace(/\n+$/, "").split(/\n/);
16
+ const message = {};
17
+ for (const line of lines) {
18
+ const index = line.indexOf(":");
19
+ const key = index === -1 ? line : line.slice(0, index);
20
+ const value = index === -1 ? "" : line.slice(index + 1).replace(/^\s/, "");
21
+ if (index === 0) {
22
+ message.comments ??= [];
23
+ message.comments.push(value);
24
+ } else if (key === "data") {
25
+ if (message.data !== void 0) {
26
+ message.data += `
27
+ ${value}`;
28
+ } else {
29
+ message.data = value;
30
+ }
31
+ } else if (key === "event") {
32
+ message.event = value;
33
+ } else if (key === "id") {
34
+ message.id = value;
35
+ } else if (key === "retry") {
36
+ const maybeInteger = Number.parseInt(value);
37
+ if (Number.isInteger(maybeInteger) && maybeInteger >= 0 && maybeInteger.toString() === value) {
38
+ message.retry = maybeInteger;
39
+ }
40
+ }
41
+ }
42
+ return message;
43
+ }
44
+ class EventStreamDecoder {
45
+ constructor(onEvent) {
46
+ this.onEvent = onEvent;
47
+ }
48
+ incomplete = "";
49
+ feed(chunk) {
50
+ this.incomplete += chunk;
51
+ const lastCompleteIndex = this.incomplete.lastIndexOf("\n\n");
52
+ if (lastCompleteIndex === -1) {
53
+ return;
54
+ }
55
+ const completes = this.incomplete.slice(0, lastCompleteIndex).split(/\n\n/);
56
+ this.incomplete = this.incomplete.slice(lastCompleteIndex + 2);
57
+ for (const encoded of completes) {
58
+ const message = decodeEventStreamMessage(`${encoded}
59
+
60
+ `);
61
+ this.onEvent(message);
62
+ }
63
+ }
64
+ end() {
65
+ if (this.incomplete) {
66
+ throw new EventStreamDecoderError("Event Stream ended before complete");
67
+ }
68
+ }
69
+ }
70
+ class EventStreamDecoderStream extends TransformStream {
71
+ constructor() {
72
+ let decoder;
73
+ super({
74
+ start(controller) {
75
+ decoder = new EventStreamDecoder((event) => {
76
+ controller.enqueue(event);
77
+ });
78
+ },
79
+ transform(chunk) {
80
+ decoder.feed(chunk);
81
+ },
82
+ flush() {
83
+ decoder.end();
84
+ }
85
+ });
86
+ }
87
+ }
88
+
89
+ function assertEventStreamMessageId(id) {
90
+ if (id.includes("\n")) {
91
+ throw new EventStreamEncoderError("Event's id must not contain a newline character");
92
+ }
93
+ }
94
+ function assertEventStreamMessageName(event) {
95
+ if (event.includes("\n")) {
96
+ throw new EventStreamEncoderError("Event's event must not contain a newline character");
97
+ }
98
+ }
99
+ function assertEventStreamMessageRetry(retry) {
100
+ if (!Number.isInteger(retry) || retry < 0) {
101
+ throw new EventStreamEncoderError("Event's retry must be a integer and >= 0");
102
+ }
103
+ }
104
+ function assertEventStreamMessageComment(comment) {
105
+ if (comment.includes("\n")) {
106
+ throw new EventStreamEncoderError("Event's comment must not contain a newline character");
107
+ }
108
+ }
109
+ function encodeEventStreamMessageData(data) {
110
+ const lines = data?.split(/\n/) ?? [];
111
+ let output = "";
112
+ for (const line of lines) {
113
+ output += `data: ${line}
114
+ `;
115
+ }
116
+ return output;
117
+ }
118
+ function encodeEventStreamMessageComments(comments) {
119
+ let output = "";
120
+ for (const comment of comments ?? []) {
121
+ assertEventStreamMessageComment(comment);
122
+ output += `: ${comment}
123
+ `;
124
+ }
125
+ return output;
126
+ }
127
+ function encodeEventStreamMessage(message) {
128
+ let output = "";
129
+ output += encodeEventStreamMessageComments(message.comments);
130
+ if (message.event !== void 0) {
131
+ assertEventStreamMessageName(message.event);
132
+ output += `event: ${message.event}
133
+ `;
134
+ }
135
+ if (message.retry !== void 0) {
136
+ assertEventStreamMessageRetry(message.retry);
137
+ output += `retry: ${message.retry}
138
+ `;
139
+ }
140
+ if (message.id !== void 0) {
141
+ assertEventStreamMessageId(message.id);
142
+ output += `id: ${message.id}
143
+ `;
144
+ }
145
+ output += encodeEventStreamMessageData(message.data);
146
+ output += "\n";
147
+ return output;
148
+ }
149
+
150
+ const EVENT_META_SYMBOL = getPackageSymbol("EVENT_META");
151
+ function withEventIteratorEventMeta(container, meta) {
152
+ let assertedMeta;
153
+ if (meta.id !== void 0) {
154
+ assertEventStreamMessageId(meta.id);
155
+ assertedMeta ??= {};
156
+ assertedMeta.id = meta.id;
157
+ }
158
+ if (meta.retry !== void 0) {
159
+ assertEventStreamMessageRetry(meta.retry);
160
+ assertedMeta ??= {};
161
+ assertedMeta.retry = meta.retry;
162
+ }
163
+ if (meta.comments !== void 0) {
164
+ for (const comment of meta.comments) {
165
+ assertEventStreamMessageComment(comment);
166
+ }
167
+ assertedMeta ??= {};
168
+ assertedMeta.comments = meta.comments;
169
+ }
170
+ if (!assertedMeta) {
171
+ return container;
172
+ }
173
+ return createEnhancedProxy(container, {
174
+ get(_target, prop, _receiver, fallback) {
175
+ if (prop === EVENT_META_SYMBOL) {
176
+ return assertedMeta;
177
+ }
178
+ return fallback();
179
+ }
180
+ });
181
+ }
182
+ function resolveEventIteratorEvent(container) {
183
+ if (!isTypescriptObject(container)) {
184
+ return [container, void 0];
185
+ }
186
+ const meta = Reflect.get(container, EVENT_META_SYMBOL);
187
+ const target = getEnhancedProxyTarget(container);
188
+ return [target, meta];
189
+ }
190
+ function getEventIteratorEventMeta(container) {
191
+ if (!isTypescriptObject(container)) {
192
+ return void 0;
193
+ }
194
+ return Reflect.get(container, EVENT_META_SYMBOL);
195
+ }
196
+
197
+ export { EVENT_META_SYMBOL, EventIteratorErrorEvent, EventStreamDecoder, EventStreamDecoderError, EventStreamDecoderStream, EventStreamEncoderError, assertEventStreamMessageComment, assertEventStreamMessageId, assertEventStreamMessageName, assertEventStreamMessageRetry, decodeEventStreamMessage, encodeEventStreamMessage, encodeEventStreamMessageComments, encodeEventStreamMessageData, getEventIteratorEventMeta, resolveEventIteratorEvent, withEventIteratorEventMeta };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,73 @@
1
- declare const author = "unnoq";
1
+ type StandardMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | (string & {});
2
+ type StandardUrl = `/${string}` | `/${string}?${string}` | `/${string}#${string}` | `/${string}?${string}#${string}`;
3
+ interface StandardHeaders {
4
+ [key: string]: string | string[] | undefined;
5
+ }
6
+ type StandardBodyHint = 'json' | 'form-data' | 'url-search-params' | 'event-stream' | 'octet-stream' | 'file' | 'none';
7
+ type StandardBody = unknown | URLSearchParams | FormData | AsyncIterator<unknown | void, unknown | void, undefined> | ReadableStream<Uint8Array<ArrayBuffer>> | Blob | undefined;
8
+ interface StandardRequest {
9
+ /**
10
+ * @example 'GET', 'POST', etc.
11
+ */
12
+ method: StandardMethod;
13
+ /**
14
+ * @example `/example`, `/example?query=param#fragment`
15
+ */
16
+ url: StandardUrl;
17
+ /**
18
+ * @example { 'content-type': 'application/json' }
19
+ */
20
+ headers: StandardHeaders;
21
+ /**
22
+ * The body has been parsed based on the content headers.
23
+ */
24
+ body?: StandardBody | undefined;
25
+ /**
26
+ * An AbortSignal to communicate aborting of request.
27
+ */
28
+ signal?: AbortSignal | undefined;
29
+ }
30
+ interface StandardLazyRequest extends Omit<StandardRequest, 'body'> {
31
+ /**
32
+ * Lazily resolves the body.
33
+ *
34
+ * The body is parsed on first call based on the `Content-Type` header
35
+ * or the provided hint.
36
+ *
37
+ * Calling this method may consume the underlying stream.
38
+ */
39
+ resolveBody: (hint?: StandardBodyHint | undefined) => Promise<StandardBody>;
40
+ }
41
+ interface StandardResponse {
42
+ /**
43
+ * @example 200, 404, 500, etc.
44
+ */
45
+ status: number;
46
+ /**
47
+ * @example { 'set-cookie': ['sessionId=abc123; HttpOnly'] }
48
+ */
49
+ headers: StandardHeaders;
50
+ /**
51
+ * The body has been parsed based on the content headers.
52
+ */
53
+ body?: StandardBody | undefined;
54
+ }
55
+ interface StandardLazyResponse extends Omit<StandardResponse, 'body'> {
56
+ /**
57
+ * Lazily resolves the body.
58
+ *
59
+ * The body is parsed on first call based on the `Content-Type` header
60
+ * or the provided hint.
61
+ *
62
+ * Calling this method may consume the underlying stream.
63
+ */
64
+ resolveBody: (hint?: StandardBodyHint | undefined) => Promise<StandardBody>;
65
+ }
2
66
 
3
- export { author };
67
+ declare function generateContentDisposition(filename: string): string;
68
+ declare function getFilenameFromContentDisposition(contentDisposition: string): string | undefined;
69
+ declare function flattenStandardHeader(header: string | readonly string[] | undefined): string | undefined;
70
+ declare function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders;
71
+
72
+ export { flattenStandardHeader, generateContentDisposition, getFilenameFromContentDisposition, mergeStandardHeaders };
73
+ export type { StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,73 @@
1
- declare const author = "unnoq";
1
+ type StandardMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | (string & {});
2
+ type StandardUrl = `/${string}` | `/${string}?${string}` | `/${string}#${string}` | `/${string}?${string}#${string}`;
3
+ interface StandardHeaders {
4
+ [key: string]: string | string[] | undefined;
5
+ }
6
+ type StandardBodyHint = 'json' | 'form-data' | 'url-search-params' | 'event-stream' | 'octet-stream' | 'file' | 'none';
7
+ type StandardBody = unknown | URLSearchParams | FormData | AsyncIterator<unknown | void, unknown | void, undefined> | ReadableStream<Uint8Array<ArrayBuffer>> | Blob | undefined;
8
+ interface StandardRequest {
9
+ /**
10
+ * @example 'GET', 'POST', etc.
11
+ */
12
+ method: StandardMethod;
13
+ /**
14
+ * @example `/example`, `/example?query=param#fragment`
15
+ */
16
+ url: StandardUrl;
17
+ /**
18
+ * @example { 'content-type': 'application/json' }
19
+ */
20
+ headers: StandardHeaders;
21
+ /**
22
+ * The body has been parsed based on the content headers.
23
+ */
24
+ body?: StandardBody | undefined;
25
+ /**
26
+ * An AbortSignal to communicate aborting of request.
27
+ */
28
+ signal?: AbortSignal | undefined;
29
+ }
30
+ interface StandardLazyRequest extends Omit<StandardRequest, 'body'> {
31
+ /**
32
+ * Lazily resolves the body.
33
+ *
34
+ * The body is parsed on first call based on the `Content-Type` header
35
+ * or the provided hint.
36
+ *
37
+ * Calling this method may consume the underlying stream.
38
+ */
39
+ resolveBody: (hint?: StandardBodyHint | undefined) => Promise<StandardBody>;
40
+ }
41
+ interface StandardResponse {
42
+ /**
43
+ * @example 200, 404, 500, etc.
44
+ */
45
+ status: number;
46
+ /**
47
+ * @example { 'set-cookie': ['sessionId=abc123; HttpOnly'] }
48
+ */
49
+ headers: StandardHeaders;
50
+ /**
51
+ * The body has been parsed based on the content headers.
52
+ */
53
+ body?: StandardBody | undefined;
54
+ }
55
+ interface StandardLazyResponse extends Omit<StandardResponse, 'body'> {
56
+ /**
57
+ * Lazily resolves the body.
58
+ *
59
+ * The body is parsed on first call based on the `Content-Type` header
60
+ * or the provided hint.
61
+ *
62
+ * Calling this method may consume the underlying stream.
63
+ */
64
+ resolveBody: (hint?: StandardBodyHint | undefined) => Promise<StandardBody>;
65
+ }
2
66
 
3
- export { author };
67
+ declare function generateContentDisposition(filename: string): string;
68
+ declare function getFilenameFromContentDisposition(contentDisposition: string): string | undefined;
69
+ declare function flattenStandardHeader(header: string | readonly string[] | undefined): string | undefined;
70
+ declare function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders;
71
+
72
+ export { flattenStandardHeader, generateContentDisposition, getFilenameFromContentDisposition, mergeStandardHeaders };
73
+ export type { StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl };
package/dist/index.mjs CHANGED
@@ -1,3 +1,45 @@
1
- const author = "unnoq";
1
+ import { tryDecodeURIComponent, toArray } from '@standardserver/shared';
2
2
 
3
- export { author };
3
+ function generateContentDisposition(filename) {
4
+ const escapedFileName = filename.replace(/"/g, '\\"');
5
+ const encodedFilenameStar = encodeURIComponent(filename).replace(/['()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%(7C|60|5E)/g, (str, hex) => String.fromCharCode(Number.parseInt(hex, 16)));
6
+ return `inline; filename="${escapedFileName}"; filename*=utf-8''${encodedFilenameStar}`;
7
+ }
8
+ function getFilenameFromContentDisposition(contentDisposition) {
9
+ const encodedFilenameStarMatch = contentDisposition.match(/filename\*=(UTF-8'')?([^;]*)/i);
10
+ if (encodedFilenameStarMatch && typeof encodedFilenameStarMatch[2] === "string") {
11
+ return tryDecodeURIComponent(encodedFilenameStarMatch[2]);
12
+ }
13
+ const encodedFilenameMatch = contentDisposition.match(/filename="((?:\\"|[^"])*)"/i);
14
+ if (encodedFilenameMatch && typeof encodedFilenameMatch[1] === "string") {
15
+ return encodedFilenameMatch[1].replace(/\\"/g, '"');
16
+ }
17
+ }
18
+ function flattenStandardHeader(header) {
19
+ if (typeof header === "string" || header === void 0) {
20
+ return header;
21
+ }
22
+ if (header.length === 0) {
23
+ return void 0;
24
+ }
25
+ return header.join(", ");
26
+ }
27
+ function mergeStandardHeaders(a, b) {
28
+ const merged = { ...a };
29
+ for (const key in b) {
30
+ if (Array.isArray(b[key])) {
31
+ merged[key] = [...toArray(merged[key]), ...b[key]];
32
+ } else if (b[key] !== void 0) {
33
+ if (Array.isArray(merged[key])) {
34
+ merged[key] = [...merged[key], b[key]];
35
+ } else if (merged[key] !== void 0) {
36
+ merged[key] = [merged[key], b[key]];
37
+ } else {
38
+ merged[key] = b[key];
39
+ }
40
+ }
41
+ }
42
+ return merged;
43
+ }
44
+
45
+ export { flattenStandardHeader, generateContentDisposition, getFilenameFromContentDisposition, mergeStandardHeaders };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@standardserver/core",
3
3
  "type": "module",
4
- "version": "0.0.0",
4
+ "version": "0.0.2",
5
5
  "license": "MIT",
6
6
  "homepage": "https://standardserver.dev",
7
7
  "repository": {
@@ -14,11 +14,19 @@
14
14
  "types": "./dist/index.d.mts",
15
15
  "import": "./dist/index.mjs",
16
16
  "default": "./dist/index.mjs"
17
+ },
18
+ "./event-stream": {
19
+ "types": "./dist/event-stream/index.d.mts",
20
+ "import": "./dist/event-stream/index.mjs",
21
+ "default": "./dist/event-stream/index.mjs"
17
22
  }
18
23
  },
19
24
  "files": [
20
25
  "dist"
21
26
  ],
27
+ "dependencies": {
28
+ "@standardserver/shared": "0.0.2"
29
+ },
22
30
  "scripts": {
23
31
  "build": "unbuild",
24
32
  "type:check": "tsc -b"