@danceroutine/tango-core 1.11.1 → 1.11.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.
- package/dist/{TangoError-DdQVQNZU.js → TangoError-Cvgnm026.js} +8 -4
- package/dist/TangoError-Cvgnm026.js.map +1 -0
- package/dist/TangoError-ptR2iApz.d.ts +45 -0
- package/dist/chunk-D7D4PA-g.js +13 -0
- package/dist/errors/index.d.ts +3 -15
- package/dist/errors/index.js +3 -5
- package/dist/{errors-VacGsSaj.js → errors-DpI5Dxmr.js} +45 -36
- package/dist/errors-DpI5Dxmr.js.map +1 -0
- package/dist/http/index.d.ts +2 -10
- package/dist/http/index.js +2 -5
- package/dist/{http-63cMANMG.js → http-6e0y_vd6.js} +95 -79
- package/dist/{http-63cMANMG.js.map → http-6e0y_vd6.js.map} +1 -1
- package/dist/index-B5PoK4LH.d.ts +86 -0
- package/dist/index-D8o4DOOG.d.ts +824 -0
- package/dist/index-DFWodYLS.d.ts +161 -0
- package/dist/index-DPABSINz.d.ts +114 -0
- package/dist/index-MZzjIxgD.d.ts +59 -0
- package/dist/index.d.ts +7 -20
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -0
- package/dist/logging/index.d.ts +2 -3
- package/dist/logging/index.js +2 -3
- package/dist/logging-UC5uXHET.js +68 -0
- package/dist/logging-UC5uXHET.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -14
- package/dist/runtime/index.js +2 -3
- package/dist/{runtime-B8KkgD3R.js → runtime-BAG_EKuM.js} +44 -35
- package/dist/runtime-BAG_EKuM.js.map +1 -0
- package/dist/sql/index.d.ts +2 -13
- package/dist/sql/index.js +2 -3
- package/dist/{sql-BI3ptL9-.js → sql-CIPnuTYO.js} +21 -16
- package/dist/{sql-BI3ptL9-.js.map → sql-CIPnuTYO.js.map} +1 -1
- package/package.json +2 -2
- package/dist/TangoError-DdQVQNZU.js.map +0 -1
- package/dist/chunk-BkvOhyD0.js +0 -12
- package/dist/errors/AuthenticationError.d.ts +0 -15
- package/dist/errors/ConflictError.d.ts +0 -15
- package/dist/errors/HttpError.d.ts +0 -7
- package/dist/errors/MultipleObjectsReturned.d.ts +0 -11
- package/dist/errors/NotFoundError.d.ts +0 -15
- package/dist/errors/PermissionDenied.d.ts +0 -15
- package/dist/errors/TangoError.d.ts +0 -33
- package/dist/errors/ValidationError.d.ts +0 -14
- package/dist/errors/factories/HttpErrorFactory.d.ts +0 -59
- package/dist/errors/factories/index.d.ts +0 -4
- package/dist/errors-VacGsSaj.js.map +0 -1
- package/dist/http/TangoBody.d.ts +0 -110
- package/dist/http/TangoHeaders.d.ts +0 -191
- package/dist/http/TangoQueryParams.d.ts +0 -81
- package/dist/http/TangoRequest.d.ts +0 -130
- package/dist/http/TangoResponse.d.ts +0 -305
- package/dist/logging/ConsoleLogger.d.ts +0 -15
- package/dist/logging/Logger.d.ts +0 -13
- package/dist/logging/getLogger.d.ts +0 -23
- package/dist/logging-BWeD4HOO.js +0 -48
- package/dist/logging-BWeD4HOO.js.map +0 -1
- package/dist/runtime/binary/index.d.ts +0 -6
- package/dist/runtime/binary/isArrayBuffer.d.ts +0 -4
- package/dist/runtime/binary/isBlob.d.ts +0 -4
- package/dist/runtime/binary/isUint8Array.d.ts +0 -4
- package/dist/runtime/date/index.d.ts +0 -4
- package/dist/runtime/date/isDate.d.ts +0 -4
- package/dist/runtime/error/index.d.ts +0 -4
- package/dist/runtime/error/isError.d.ts +0 -4
- package/dist/runtime/internal/hasTag.d.ts +0 -1
- package/dist/runtime/object/index.d.ts +0 -5
- package/dist/runtime/object/isNil.d.ts +0 -4
- package/dist/runtime/object/isObject.d.ts +0 -4
- package/dist/runtime/web/index.d.ts +0 -7
- package/dist/runtime/web/isFile.d.ts +0 -4
- package/dist/runtime/web/isFormData.d.ts +0 -4
- package/dist/runtime/web/isReadableStream.d.ts +0 -4
- package/dist/runtime/web/isURLSearchParams.d.ts +0 -4
- package/dist/runtime-B8KkgD3R.js.map +0 -1
- package/dist/sql/SqlDialect.d.ts +0 -5
- package/dist/sql/SqlIdentifierRole.d.ts +0 -13
- package/dist/sql/SqlSafetyEngine.d.ts +0 -50
- package/dist/sql/TrustedSqlFragment.d.ts +0 -5
- package/dist/sql/ValidatedSqlIdentifier.d.ts +0 -7
- package/dist/sql/isTrustedSqlFragment.d.ts +0 -5
- package/dist/sql/quoteSqlIdentifier.d.ts +0 -6
- package/dist/sql/trustedSql.d.ts +0 -5
- package/dist/sql/validateSqlIdentifier.d.ts +0 -6
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import { TangoError, type ErrorDetails, type ProblemDetails } from '../errors/TangoError';
|
|
2
|
-
import { TangoHeaders } from '../http/TangoHeaders';
|
|
3
|
-
import { type JsonValue } from './TangoBody';
|
|
4
|
-
type TangoResponseInit = {
|
|
5
|
-
body?: BodyInit | JsonValue | null;
|
|
6
|
-
headers?: HeadersInit;
|
|
7
|
-
ok?: boolean;
|
|
8
|
-
redirected?: boolean;
|
|
9
|
-
status?: number;
|
|
10
|
-
statusText?: string;
|
|
11
|
-
type?: ResponseType;
|
|
12
|
-
url?: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Framework response wrapper with fetch-compatible surface plus ergonomic helpers.
|
|
16
|
-
*/
|
|
17
|
-
export declare class TangoResponse implements Response {
|
|
18
|
-
static readonly BRAND: "tango.http.response";
|
|
19
|
-
readonly __tangoBrand: typeof TangoResponse.BRAND;
|
|
20
|
-
readonly headers: TangoHeaders;
|
|
21
|
-
readonly redirected: boolean;
|
|
22
|
-
readonly status: number;
|
|
23
|
-
readonly statusText: string;
|
|
24
|
-
readonly type: ResponseType;
|
|
25
|
-
readonly url: string;
|
|
26
|
-
readonly body: Response['body'];
|
|
27
|
-
private tangoBody;
|
|
28
|
-
private okValue;
|
|
29
|
-
constructor(init?: TangoResponseInit);
|
|
30
|
-
/**
|
|
31
|
-
* Narrow an unknown value to `TangoResponse`.
|
|
32
|
-
*/
|
|
33
|
-
static isTangoResponse(value: unknown): value is TangoResponse;
|
|
34
|
-
/**
|
|
35
|
-
* Create a JSON response with sensible content headers.
|
|
36
|
-
*/
|
|
37
|
-
static json(data: JsonValue, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
|
|
38
|
-
headers?: HeadersInit;
|
|
39
|
-
}): TangoResponse;
|
|
40
|
-
/**
|
|
41
|
-
* Create a plain-text response with sensible content headers.
|
|
42
|
-
*/
|
|
43
|
-
static text(text: string, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
|
|
44
|
-
headers?: HeadersInit;
|
|
45
|
-
}): TangoResponse;
|
|
46
|
-
/**
|
|
47
|
-
* Create an HTML response with sensible content headers.
|
|
48
|
-
*/
|
|
49
|
-
static html(html: string, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
|
|
50
|
-
headers?: HeadersInit;
|
|
51
|
-
}): TangoResponse;
|
|
52
|
-
/**
|
|
53
|
-
* Create a streaming response without buffering the payload in memory.
|
|
54
|
-
*/
|
|
55
|
-
static stream(stream: ReadableStream<Uint8Array>, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
|
|
56
|
-
headers?: HeadersInit;
|
|
57
|
-
}): TangoResponse;
|
|
58
|
-
/**
|
|
59
|
-
* Create a redirect response and set the `Location` header.
|
|
60
|
-
*/
|
|
61
|
-
static redirect(url: string, status?: number, init?: Omit<TangoResponseInit, 'body' | 'headers' | 'status'> & {
|
|
62
|
-
headers?: HeadersInit;
|
|
63
|
-
}): TangoResponse;
|
|
64
|
-
/**
|
|
65
|
-
* Create an empty `204 No Content` response.
|
|
66
|
-
*/
|
|
67
|
-
static noContent(init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
|
|
68
|
-
headers?: HeadersInit;
|
|
69
|
-
}): TangoResponse;
|
|
70
|
-
/**
|
|
71
|
-
* Create a `201 Created` response and optionally attach a location or body.
|
|
72
|
-
*/
|
|
73
|
-
static created(location?: string, body?: JsonValue, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
|
|
74
|
-
headers?: HeadersInit;
|
|
75
|
-
}): TangoResponse;
|
|
76
|
-
/**
|
|
77
|
-
* Create a `405 Method Not Allowed` response and optionally populate `Allow`.
|
|
78
|
-
*/
|
|
79
|
-
static methodNotAllowed(allow?: readonly string[], detail?: string, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
|
|
80
|
-
headers?: HeadersInit;
|
|
81
|
-
}): TangoResponse;
|
|
82
|
-
/**
|
|
83
|
-
* Normalize a Tango error or problem-details object into an error response.
|
|
84
|
-
*/
|
|
85
|
-
static error<TDetails extends ErrorDetails = null>(error: TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
|
|
86
|
-
headers?: HeadersInit;
|
|
87
|
-
}): TangoResponse;
|
|
88
|
-
/**
|
|
89
|
-
* Create a `400 Bad Request` response from a string or structured error.
|
|
90
|
-
*/
|
|
91
|
-
static badRequest<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
|
|
92
|
-
headers?: HeadersInit;
|
|
93
|
-
}): TangoResponse;
|
|
94
|
-
/**
|
|
95
|
-
* Create a `401 Unauthorized` response from a string or structured error.
|
|
96
|
-
*/
|
|
97
|
-
static unauthorized<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
|
|
98
|
-
headers?: HeadersInit;
|
|
99
|
-
}): TangoResponse;
|
|
100
|
-
/**
|
|
101
|
-
* Create a `403 Forbidden` response from a string or structured error.
|
|
102
|
-
*/
|
|
103
|
-
static forbidden<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
|
|
104
|
-
headers?: HeadersInit;
|
|
105
|
-
}): TangoResponse;
|
|
106
|
-
/**
|
|
107
|
-
* Create a `404 Not Found` response from a string or structured error.
|
|
108
|
-
*/
|
|
109
|
-
static notFound<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
|
|
110
|
-
headers?: HeadersInit;
|
|
111
|
-
}): TangoResponse;
|
|
112
|
-
/**
|
|
113
|
-
* Create a `409 Conflict` response from a string or structured error.
|
|
114
|
-
*/
|
|
115
|
-
static conflict<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
|
|
116
|
-
headers?: HeadersInit;
|
|
117
|
-
}): TangoResponse;
|
|
118
|
-
/**
|
|
119
|
-
* Create a `422 Unprocessable Entity` response from a string or structured error.
|
|
120
|
-
*/
|
|
121
|
-
static unprocessableEntity<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
|
|
122
|
-
headers?: HeadersInit;
|
|
123
|
-
}): TangoResponse;
|
|
124
|
-
/**
|
|
125
|
-
* Create a `429 Too Many Requests` response from a string or structured error.
|
|
126
|
-
*/
|
|
127
|
-
static tooManyRequests<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
|
|
128
|
-
headers?: HeadersInit;
|
|
129
|
-
}): TangoResponse;
|
|
130
|
-
/**
|
|
131
|
-
* Create a problem-details style error response with Tango's envelope shape.
|
|
132
|
-
*/
|
|
133
|
-
static problem<TDetails extends ErrorDetails = null>(problem?: string | TangoError | ProblemDetails<TDetails> | unknown, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
|
|
134
|
-
headers?: HeadersInit;
|
|
135
|
-
status?: number;
|
|
136
|
-
}): TangoResponse;
|
|
137
|
-
/**
|
|
138
|
-
* Returns a response for serving a file.
|
|
139
|
-
*/
|
|
140
|
-
static file(file: Blob | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | string, opts?: {
|
|
141
|
-
filename?: string;
|
|
142
|
-
contentType?: string;
|
|
143
|
-
init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
|
|
144
|
-
headers?: HeadersInit;
|
|
145
|
-
};
|
|
146
|
-
}): TangoResponse;
|
|
147
|
-
/**
|
|
148
|
-
* Returns a response that prompts the user to download the file.
|
|
149
|
-
*/
|
|
150
|
-
static download(file: Blob | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | string, opts?: {
|
|
151
|
-
filename?: string;
|
|
152
|
-
contentType?: string;
|
|
153
|
-
init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
|
|
154
|
-
headers?: HeadersInit;
|
|
155
|
-
};
|
|
156
|
-
}): TangoResponse;
|
|
157
|
-
private static normalizeWebBody;
|
|
158
|
-
/**
|
|
159
|
-
* Expose the original body source for cloning and adapter integration.
|
|
160
|
-
*/
|
|
161
|
-
get bodySource(): BodyInit | JsonValue | null;
|
|
162
|
-
/**
|
|
163
|
-
* Report whether the status code falls inside the 2xx range.
|
|
164
|
-
*/
|
|
165
|
-
get ok(): boolean;
|
|
166
|
-
/**
|
|
167
|
-
* Report whether the body has been consumed.
|
|
168
|
-
*/
|
|
169
|
-
get bodyUsed(): boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Replace a header value on the response.
|
|
172
|
-
*/
|
|
173
|
-
setHeader(name: string, value: string): void;
|
|
174
|
-
/**
|
|
175
|
-
* Append another value for a repeated response header.
|
|
176
|
-
*/
|
|
177
|
-
appendHeader(name: string, value: string): void;
|
|
178
|
-
/**
|
|
179
|
-
* Read a response header value.
|
|
180
|
-
*/
|
|
181
|
-
getHeader(name: string): string | null;
|
|
182
|
-
/**
|
|
183
|
-
* Check whether a response header is present.
|
|
184
|
-
*/
|
|
185
|
-
hasHeader(name: string): boolean;
|
|
186
|
-
/**
|
|
187
|
-
* Remove a response header.
|
|
188
|
-
*/
|
|
189
|
-
deleteHeader(name: string): void;
|
|
190
|
-
/**
|
|
191
|
-
* Merge one or more values into the `Vary` header.
|
|
192
|
-
*/
|
|
193
|
-
vary(...fields: string[]): void;
|
|
194
|
-
/**
|
|
195
|
-
* Add a `Set-Cookie` header that replaces prior application intent.
|
|
196
|
-
*/
|
|
197
|
-
setCookie(name: string, value: string, options?: Parameters<TangoHeaders['setCookie']>[2]): void;
|
|
198
|
-
/**
|
|
199
|
-
* Append another `Set-Cookie` header.
|
|
200
|
-
*/
|
|
201
|
-
appendCookie(name: string, value: string, options?: Parameters<TangoHeaders['appendCookie']>[2]): void;
|
|
202
|
-
/**
|
|
203
|
-
* Expire a cookie by issuing a matching deletion cookie header.
|
|
204
|
-
*/
|
|
205
|
-
deleteCookie(name: string, options?: Parameters<TangoHeaders['deleteCookie']>[1]): void;
|
|
206
|
-
/**
|
|
207
|
-
* Set the `Cache-Control` header through Tango's higher-level helper.
|
|
208
|
-
*/
|
|
209
|
-
cacheControl(control: Parameters<TangoHeaders['cacheControl']>[0]): void;
|
|
210
|
-
/**
|
|
211
|
-
* Set the `Location` header on the response.
|
|
212
|
-
*/
|
|
213
|
-
location(url: string): void;
|
|
214
|
-
/**
|
|
215
|
-
* Set the response content type.
|
|
216
|
-
*/
|
|
217
|
-
contentType(mime: string): void;
|
|
218
|
-
/**
|
|
219
|
-
* Set the X-Request-Id header (request correlation).
|
|
220
|
-
* Returns this for fluent chaining.
|
|
221
|
-
*/
|
|
222
|
-
withRequestId(requestId: string | undefined | null): this;
|
|
223
|
-
/**
|
|
224
|
-
* Set the traceparent header (W3C Trace Context propagation).
|
|
225
|
-
* Returns this for fluent chaining.
|
|
226
|
-
*/
|
|
227
|
-
withTraceparent(traceparent: string | undefined | null): this;
|
|
228
|
-
/**
|
|
229
|
-
* Set the Server-Timing header.
|
|
230
|
-
* Accepts a string or array of timing metrics.
|
|
231
|
-
* Returns this for fluent chaining.
|
|
232
|
-
*/
|
|
233
|
-
withServerTiming(timing: string | string[]): this;
|
|
234
|
-
/**
|
|
235
|
-
* Set the X-Response-Time header (in ms).
|
|
236
|
-
* Numeric or formatted string (e.g. "76ms").
|
|
237
|
-
* Returns this for fluent chaining.
|
|
238
|
-
*/
|
|
239
|
-
withResponseTime(time: number | string): this;
|
|
240
|
-
/**
|
|
241
|
-
* Propagate common tracing/correlation headers from provided Headers, TangoHeaders, or plain object.
|
|
242
|
-
* Known headers: x-request-id, traceparent, server-timing
|
|
243
|
-
* Returns this for fluent chaining.
|
|
244
|
-
*/
|
|
245
|
-
propagateTraceHeaders(input: HeadersInit): this;
|
|
246
|
-
/**
|
|
247
|
-
* Clone the response so its body can be consumed independently.
|
|
248
|
-
*/
|
|
249
|
-
clone(): TangoResponse;
|
|
250
|
-
/**
|
|
251
|
-
* Convert this Tango-owned response into a native web `Response`.
|
|
252
|
-
*
|
|
253
|
-
* Adapters use this at the host-framework boundary so Tango can standardize
|
|
254
|
-
* on `TangoResponse` internally while Next.js and other hosts still receive
|
|
255
|
-
* a platform-native response object.
|
|
256
|
-
*/
|
|
257
|
-
toWebResponse(): Response;
|
|
258
|
-
/**
|
|
259
|
-
* Read the response body as an array buffer.
|
|
260
|
-
*/
|
|
261
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
262
|
-
/**
|
|
263
|
-
* Read the response body as a blob.
|
|
264
|
-
*/
|
|
265
|
-
blob(): Promise<Blob>;
|
|
266
|
-
/**
|
|
267
|
-
* Read the response body as bytes.
|
|
268
|
-
*/
|
|
269
|
-
bytes(): Promise<Uint8Array<ArrayBuffer>>;
|
|
270
|
-
/**
|
|
271
|
-
* Read the response body as form data.
|
|
272
|
-
*/
|
|
273
|
-
formData(): Promise<FormData>;
|
|
274
|
-
/**
|
|
275
|
-
* Parse the response body as JSON.
|
|
276
|
-
*/
|
|
277
|
-
json<T = unknown>(): Promise<T>;
|
|
278
|
-
/**
|
|
279
|
-
* Read the response body as text.
|
|
280
|
-
*/
|
|
281
|
-
text(): Promise<string>;
|
|
282
|
-
/**
|
|
283
|
-
* Returns a plain object debug representation of this response: { status, headers: { ... }, bodyType: ... }.
|
|
284
|
-
* Intended for testing and debug tooling.
|
|
285
|
-
*/
|
|
286
|
-
toJSON(): {
|
|
287
|
-
status: number;
|
|
288
|
-
headers: Record<string, string>;
|
|
289
|
-
bodyType: string;
|
|
290
|
-
};
|
|
291
|
-
/**
|
|
292
|
-
* Returns the original body for test/debug purposes *without* consuming the stream.
|
|
293
|
-
*
|
|
294
|
-
* @throws {Error} if called in a production environment. Provided only for test or debug.
|
|
295
|
-
* @remarks
|
|
296
|
-
* This method gives direct access to the original body as provided to the constructor,
|
|
297
|
-
* before consumption. It is primarily intended for use in test code, introspection, or
|
|
298
|
-
* advanced debug tools. **Do not rely on this in production.**
|
|
299
|
-
* In production (`process.env.NODE_ENV === 'production'`), using this method will throw.
|
|
300
|
-
*
|
|
301
|
-
* This method is _not_ part of the web Response interface, and is intentionally private/internal.
|
|
302
|
-
*/
|
|
303
|
-
__peekBodyForTestOnly(): BodyInit | JsonValue | null;
|
|
304
|
-
}
|
|
305
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Logger } from './Logger';
|
|
2
|
-
/**
|
|
3
|
-
* Default `Logger` implementation that delegates to `console.*`.
|
|
4
|
-
*
|
|
5
|
-
* Each message is prefixed with the scope string so log output is
|
|
6
|
-
* filterable by origin (e.g. `[tango.adapter.next] Adapter error: …`).
|
|
7
|
-
*/
|
|
8
|
-
export declare class ConsoleLogger implements Logger {
|
|
9
|
-
private readonly scope;
|
|
10
|
-
constructor(scope: string);
|
|
11
|
-
error(message: string, ...args: unknown[]): void;
|
|
12
|
-
warn(message: string, ...args: unknown[]): void;
|
|
13
|
-
info(message: string, ...args: unknown[]): void;
|
|
14
|
-
debug(message: string, ...args: unknown[]): void;
|
|
15
|
-
}
|
package/dist/logging/Logger.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal logging interface for the Tango framework.
|
|
3
|
-
*
|
|
4
|
-
* Consumers may provide their own implementation (Pino, Winston, etc.)
|
|
5
|
-
* via `TangoConfig.logger`. The framework never makes assumptions about
|
|
6
|
-
* transports, formatting, or log levels beyond these four methods.
|
|
7
|
-
*/
|
|
8
|
-
export interface Logger {
|
|
9
|
-
error(message: string, ...args: unknown[]): void;
|
|
10
|
-
warn(message: string, ...args: unknown[]): void;
|
|
11
|
-
info(message: string, ...args: unknown[]): void;
|
|
12
|
-
debug(message: string, ...args: unknown[]): void;
|
|
13
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Logger } from './Logger';
|
|
2
|
-
type LoggerFactory = (scope: string) => Logger;
|
|
3
|
-
/**
|
|
4
|
-
* Return a `Logger` bound to the given scope name.
|
|
5
|
-
*
|
|
6
|
-
* By default loggers are `ConsoleLogger` instances. Call
|
|
7
|
-
* `setLoggerFactory` to redirect all framework logging
|
|
8
|
-
* to a custom implementation (Pino, Winston, etc.).
|
|
9
|
-
*/
|
|
10
|
-
export declare function getLogger(scope: string): Logger;
|
|
11
|
-
/**
|
|
12
|
-
* Replace the global logger factory used by `getLogger`.
|
|
13
|
-
*
|
|
14
|
-
* Typically called once during application bootstrap from
|
|
15
|
-
* the resolved `TangoConfig.logger` value.
|
|
16
|
-
*/
|
|
17
|
-
export declare function setLoggerFactory(custom: LoggerFactory | Logger): void;
|
|
18
|
-
/**
|
|
19
|
-
* Reset the logger factory to the default `ConsoleLogger`.
|
|
20
|
-
* Primarily useful in tests.
|
|
21
|
-
*/
|
|
22
|
-
export declare function resetLoggerFactory(): void;
|
|
23
|
-
export {};
|
package/dist/logging-BWeD4HOO.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { __export } from "./chunk-BkvOhyD0.js";
|
|
2
|
-
|
|
3
|
-
//#region src/logging/ConsoleLogger.ts
|
|
4
|
-
var ConsoleLogger = class {
|
|
5
|
-
constructor(scope) {
|
|
6
|
-
this.scope = scope;
|
|
7
|
-
}
|
|
8
|
-
error(message, ...args) {
|
|
9
|
-
console.error(`[${this.scope}]`, message, ...args);
|
|
10
|
-
}
|
|
11
|
-
warn(message, ...args) {
|
|
12
|
-
console.warn(`[${this.scope}]`, message, ...args);
|
|
13
|
-
}
|
|
14
|
-
info(message, ...args) {
|
|
15
|
-
console.info(`[${this.scope}]`, message, ...args);
|
|
16
|
-
}
|
|
17
|
-
debug(message, ...args) {
|
|
18
|
-
console.debug(`[${this.scope}]`, message, ...args);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/logging/getLogger.ts
|
|
24
|
-
let factory = (scope) => new ConsoleLogger(scope);
|
|
25
|
-
function getLogger(scope) {
|
|
26
|
-
return factory(scope);
|
|
27
|
-
}
|
|
28
|
-
function setLoggerFactory(custom) {
|
|
29
|
-
if (typeof custom === "function") factory = custom;
|
|
30
|
-
else factory = () => custom;
|
|
31
|
-
}
|
|
32
|
-
function resetLoggerFactory() {
|
|
33
|
-
factory = (scope) => new ConsoleLogger(scope);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/logging/index.ts
|
|
38
|
-
var logging_exports = {};
|
|
39
|
-
__export(logging_exports, {
|
|
40
|
-
ConsoleLogger: () => ConsoleLogger,
|
|
41
|
-
getLogger: () => getLogger,
|
|
42
|
-
resetLoggerFactory: () => resetLoggerFactory,
|
|
43
|
-
setLoggerFactory: () => setLoggerFactory
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
export { ConsoleLogger, getLogger, logging_exports, resetLoggerFactory, setLoggerFactory };
|
|
48
|
-
//# sourceMappingURL=logging-BWeD4HOO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logging-BWeD4HOO.js","names":["scope: string","message: string","factory: LoggerFactory","scope: string","custom: LoggerFactory | Logger"],"sources":["../src/logging/ConsoleLogger.ts","../src/logging/getLogger.ts","../src/logging/index.ts"],"sourcesContent":["import type { Logger } from './Logger';\n\n/**\n * Default `Logger` implementation that delegates to `console.*`.\n *\n * Each message is prefixed with the scope string so log output is\n * filterable by origin (e.g. `[tango.adapter.next] Adapter error: …`).\n */\nexport class ConsoleLogger implements Logger {\n constructor(private readonly scope: string) {}\n\n error(message: string, ...args: unknown[]): void {\n console.error(`[${this.scope}]`, message, ...args);\n }\n\n warn(message: string, ...args: unknown[]): void {\n console.warn(`[${this.scope}]`, message, ...args);\n }\n\n info(message: string, ...args: unknown[]): void {\n console.info(`[${this.scope}]`, message, ...args);\n }\n\n debug(message: string, ...args: unknown[]): void {\n console.debug(`[${this.scope}]`, message, ...args);\n }\n}\n","import type { Logger } from './Logger';\nimport { ConsoleLogger } from './ConsoleLogger';\n\ntype LoggerFactory = (scope: string) => Logger;\n\nlet factory: LoggerFactory = (scope) => new ConsoleLogger(scope);\n\n/**\n * Return a `Logger` bound to the given scope name.\n *\n * By default loggers are `ConsoleLogger` instances. Call\n * `setLoggerFactory` to redirect all framework logging\n * to a custom implementation (Pino, Winston, etc.).\n */\nexport function getLogger(scope: string): Logger {\n return factory(scope);\n}\n\n/**\n * Replace the global logger factory used by `getLogger`.\n *\n * Typically called once during application bootstrap from\n * the resolved `TangoConfig.logger` value.\n */\nexport function setLoggerFactory(custom: LoggerFactory | Logger): void {\n if (typeof custom === 'function') {\n factory = custom;\n } else {\n factory = () => custom;\n }\n}\n\n/**\n * Reset the logger factory to the default `ConsoleLogger`.\n * Primarily useful in tests.\n */\nexport function resetLoggerFactory(): void {\n factory = (scope) => new ConsoleLogger(scope);\n}\n","export type { Logger } from './Logger';\nexport { ConsoleLogger } from './ConsoleLogger';\nexport { getLogger, setLoggerFactory, resetLoggerFactory } from './getLogger';\n"],"mappings":";;;IAQa,gBAAN,MAAsC;CACzC,YAA6BA,OAAe;AAAA,OAAf,QAAA;CAAiB;CAE9C,MAAMC,SAAiB,GAAG,MAAuB;AAC7C,UAAQ,OAAO,GAAG,KAAK,MAAM,IAAI,SAAS,GAAG,KAAK;CACrD;CAED,KAAKA,SAAiB,GAAG,MAAuB;AAC5C,UAAQ,MAAM,GAAG,KAAK,MAAM,IAAI,SAAS,GAAG,KAAK;CACpD;CAED,KAAKA,SAAiB,GAAG,MAAuB;AAC5C,UAAQ,MAAM,GAAG,KAAK,MAAM,IAAI,SAAS,GAAG,KAAK;CACpD;CAED,MAAMA,SAAiB,GAAG,MAAuB;AAC7C,UAAQ,OAAO,GAAG,KAAK,MAAM,IAAI,SAAS,GAAG,KAAK;CACrD;AACJ;;;;ACrBD,IAAIC,UAAyB,CAAC,UAAU,IAAI,cAAc;AASnD,SAAS,UAAUC,OAAuB;AAC7C,QAAO,QAAQ,MAAM;AACxB;AAQM,SAAS,iBAAiBC,QAAsC;AACnE,YAAW,WAAW,WAClB,WAAU;IAEV,WAAU,MAAM;AAEvB;AAMM,SAAS,qBAA2B;AACvC,WAAU,CAAC,UAAU,IAAI,cAAc;AAC1C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function hasTag(value: unknown, tag: string): boolean;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain boundary barrel: centralizes this subdomain's public contract.
|
|
3
|
-
*/
|
|
4
|
-
export { isFormData } from './isFormData';
|
|
5
|
-
export { isURLSearchParams } from './isURLSearchParams';
|
|
6
|
-
export { isReadableStream } from './isReadableStream';
|
|
7
|
-
export { isFile } from './isFile';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-B8KkgD3R.js","names":["value: unknown","value: unknown","tag: string","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown"],"sources":["../src/runtime/object/isNil.ts","../src/runtime/internal/hasTag.ts","../src/runtime/binary/isArrayBuffer.ts","../src/runtime/binary/isUint8Array.ts","../src/runtime/binary/isBlob.ts","../src/runtime/binary/index.ts","../src/runtime/web/isFormData.ts","../src/runtime/web/isURLSearchParams.ts","../src/runtime/web/isReadableStream.ts","../src/runtime/web/isFile.ts","../src/runtime/web/index.ts","../src/runtime/object/isObject.ts","../src/runtime/object/index.ts","../src/runtime/error/isError.ts","../src/runtime/error/index.ts","../src/runtime/date/isDate.ts","../src/runtime/date/index.ts","../src/runtime/index.ts"],"sourcesContent":["/**\n * Return true when a value is `null` or `undefined`.\n */\nexport function isNil(value: unknown): value is null | undefined {\n return value === null || value === undefined;\n}\n","import { isNil } from '../object/isNil';\n\nexport function hasTag(value: unknown, tag: string): boolean {\n return !isNil(value) && Object.prototype.toString.call(value) === `[object ${tag}]`;\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is an `ArrayBuffer`.\n */\nexport function isArrayBuffer(value: unknown): value is ArrayBuffer {\n return hasTag(value, 'ArrayBuffer');\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is a `Uint8Array`.\n */\nexport function isUint8Array(value: unknown): value is Uint8Array<ArrayBuffer> {\n return hasTag(value, 'Uint8Array');\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is a `Blob`.\n */\nexport function isBlob(value: unknown): value is Blob {\n return hasTag(value, 'Blob');\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { isArrayBuffer } from './isArrayBuffer';\nexport { isUint8Array } from './isUint8Array';\nexport { isBlob } from './isBlob';\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is `FormData`.\n */\nexport function isFormData(value: unknown): value is FormData {\n return hasTag(value, 'FormData');\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is `URLSearchParams`.\n */\nexport function isURLSearchParams(value: unknown): value is URLSearchParams {\n return hasTag(value, 'URLSearchParams');\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is a readable web stream.\n */\nexport function isReadableStream(value: unknown): value is ReadableStream<Uint8Array<ArrayBuffer>> {\n return hasTag(value, 'ReadableStream');\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is a web `File`.\n */\nexport function isFile(value: unknown): value is File {\n return hasTag(value, 'File');\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { isFormData } from './isFormData';\nexport { isURLSearchParams } from './isURLSearchParams';\nexport { isReadableStream } from './isReadableStream';\nexport { isFile } from './isFile';\n","/**\n * Return true when a value is a non-null object.\n */\nexport function isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { isObject } from './isObject';\nexport { isNil } from './isNil';\n","import { isObject } from '../object/isObject';\n\n/**\n * Return true when a value looks like an `Error`.\n */\nexport function isError(value: unknown): value is Error {\n return (\n isObject(value) &&\n typeof (value as { name?: unknown }).name === 'string' &&\n typeof (value as { message?: unknown }).message === 'string'\n );\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { isError } from './isError';\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is a `Date`.\n */\nexport function isDate(value: unknown): value is Date {\n return hasTag(value, 'Date');\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { isDate } from './isDate';\n","/**\n * Domain boundary barrel: exposes namespaced exports for Django-style drill-down\n * imports and curated flat exports for TS-native ergonomics.\n */\n\nexport * as binary from './binary/index';\nexport * as web from './web/index';\nexport * as object from './object/index';\nexport * as error from './error/index';\nexport * as date from './date/index';\n\nexport { isArrayBuffer, isBlob, isUint8Array } from './binary/index';\nexport { isFile, isFormData, isReadableStream, isURLSearchParams } from './web/index';\nexport { isNil, isObject } from './object/index';\nexport { isError } from './error/index';\nexport { isDate } from './date/index';\n"],"mappings":";;;AAGO,SAAS,MAAMA,OAA2C;AAC7D,QAAO,UAAU,QAAQ,UAAU;AACtC;;;;ACHM,SAAS,OAAOC,OAAgBC,KAAsB;AACzD,SAAQ,MAAM,MAAM,IAAI,OAAO,UAAU,SAAS,KAAK,MAAM,MAAM,UAAU,IAAI;AACpF;;;;ACCM,SAAS,cAAcC,OAAsC;AAChE,QAAO,OAAO,OAAO,cAAc;AACtC;;;;ACFM,SAAS,aAAaC,OAAkD;AAC3E,QAAO,OAAO,OAAO,aAAa;AACrC;;;;ACFM,SAAS,OAAOC,OAA+B;AAClD,QAAO,OAAO,OAAO,OAAO;AAC/B;;;;;;;;;;;;;ACFM,SAAS,WAAWC,OAAmC;AAC1D,QAAO,OAAO,OAAO,WAAW;AACnC;;;;ACFM,SAAS,kBAAkBC,OAA0C;AACxE,QAAO,OAAO,OAAO,kBAAkB;AAC1C;;;;ACFM,SAAS,iBAAiBC,OAAkE;AAC/F,QAAO,OAAO,OAAO,iBAAiB;AACzC;;;;ACFM,SAAS,OAAOC,OAA+B;AAClD,QAAO,OAAO,OAAO,OAAO;AAC/B;;;;;;;;;;;;;;ACJM,SAAS,SAASC,OAAkD;AACvE,eAAc,UAAU,YAAY,UAAU;AACjD;;;;;;;;;;;;ACAM,SAAS,QAAQC,OAAgC;AACpD,QACI,SAAS,MAAM,WACP,MAA6B,SAAS,mBACtC,MAAgC,YAAY;AAE3D;;;;;;;;;ACNM,SAAS,OAAOC,OAA+B;AAClD,QAAO,OAAO,OAAO,OAAO;AAC/B"}
|
package/dist/sql/SqlDialect.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const InternalSqlIdentifierRole: {
|
|
2
|
-
readonly TABLE: "table";
|
|
3
|
-
readonly COLUMN: "column";
|
|
4
|
-
readonly PRIMARY_KEY: "primaryKey";
|
|
5
|
-
readonly INDEX: "index";
|
|
6
|
-
readonly ALIAS: "alias";
|
|
7
|
-
readonly CONSTRAINT: "constraint";
|
|
8
|
-
readonly SCHEMA: "schema";
|
|
9
|
-
readonly RELATION_TABLE: "relationTable";
|
|
10
|
-
readonly RELATION_FOREIGN_KEY: "relationForeignKey";
|
|
11
|
-
readonly RELATION_TARGET_PRIMARY_KEY: "relationTargetPrimaryKey";
|
|
12
|
-
};
|
|
13
|
-
export type SqlIdentifierRole = (typeof InternalSqlIdentifierRole)[keyof typeof InternalSqlIdentifierRole];
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { SqlDialect } from './SqlDialect';
|
|
2
|
-
import type { SqlIdentifierRole } from './SqlIdentifierRole';
|
|
3
|
-
import type { TrustedSqlFragment } from './TrustedSqlFragment';
|
|
4
|
-
import type { ValidatedSqlIdentifier } from './ValidatedSqlIdentifier';
|
|
5
|
-
export type SqlIdentifierRequest = {
|
|
6
|
-
key: string;
|
|
7
|
-
role: SqlIdentifierRole;
|
|
8
|
-
value: string;
|
|
9
|
-
allowlist?: readonly string[];
|
|
10
|
-
};
|
|
11
|
-
export type SqlLookupTokenRequest = {
|
|
12
|
-
key: string;
|
|
13
|
-
lookup: string;
|
|
14
|
-
allowed: readonly string[];
|
|
15
|
-
};
|
|
16
|
-
export type SqlRawFragmentRequest = {
|
|
17
|
-
key: string;
|
|
18
|
-
value: TrustedSqlFragment;
|
|
19
|
-
};
|
|
20
|
-
export type SqlSafetyRequest = {
|
|
21
|
-
dialect?: SqlDialect;
|
|
22
|
-
identifiers?: readonly SqlIdentifierRequest[];
|
|
23
|
-
lookupTokens?: readonly SqlLookupTokenRequest[];
|
|
24
|
-
rawFragments?: readonly SqlRawFragmentRequest[];
|
|
25
|
-
};
|
|
26
|
-
export type ValidatedSqlLookupToken = {
|
|
27
|
-
lookup: string;
|
|
28
|
-
};
|
|
29
|
-
export type ValidatedSqlSafetyResult = {
|
|
30
|
-
identifiers: Record<string, ValidatedSqlIdentifier>;
|
|
31
|
-
lookupTokens: Record<string, ValidatedSqlLookupToken>;
|
|
32
|
-
rawFragments: Record<string, TrustedSqlFragment>;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Canonical SQL safety policy engine shared across Tango packages.
|
|
36
|
-
*/
|
|
37
|
-
export declare class SqlSafetyEngine {
|
|
38
|
-
static readonly BRAND: "tango.core.sql_safety_engine";
|
|
39
|
-
readonly __tangoBrand: typeof SqlSafetyEngine.BRAND;
|
|
40
|
-
/**
|
|
41
|
-
* Narrow an unknown value to `SqlSafetyEngine`.
|
|
42
|
-
*/
|
|
43
|
-
static isSqlSafetyEngine(value: unknown): value is SqlSafetyEngine;
|
|
44
|
-
/**
|
|
45
|
-
* Validate a canonical SQL safety request and return trusted tokens.
|
|
46
|
-
*/
|
|
47
|
-
validate(request: SqlSafetyRequest): ValidatedSqlSafetyResult;
|
|
48
|
-
private validateLookupToken;
|
|
49
|
-
private validateRawFragment;
|
|
50
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { SqlIdentifierRole } from './SqlIdentifierRole';
|
|
2
|
-
export declare const VALIDATED_SQL_IDENTIFIER_BRAND: "tango.core.validated_sql_identifier";
|
|
3
|
-
export type ValidatedSqlIdentifier = {
|
|
4
|
-
readonly __tangoBrand: typeof VALIDATED_SQL_IDENTIFIER_BRAND;
|
|
5
|
-
readonly role: SqlIdentifierRole;
|
|
6
|
-
readonly value: string;
|
|
7
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { SqlDialect } from './SqlDialect';
|
|
2
|
-
import type { ValidatedSqlIdentifier } from './ValidatedSqlIdentifier';
|
|
3
|
-
/**
|
|
4
|
-
* Quote a validated identifier for the target SQL dialect.
|
|
5
|
-
*/
|
|
6
|
-
export declare function quoteSqlIdentifier(identifier: ValidatedSqlIdentifier, _dialect: SqlDialect): string;
|