encore.dev 1.44.9-beta.2 → 1.44.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/api/mod.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  /* eslint-disable */
2
2
 
3
3
  import type { IncomingMessage, ServerResponse } from "http";
4
+ import { RequestMeta, currentRequest } from "../mod";
5
+ import { RawResponse } from "./mod";
6
+ import { RawRequest } from "./mod";
7
+ import { Sink, Stream, Socket } from "../internal/runtime/mod";
8
+ import { InternalHandlerResponse } from "../internal/appinit/mod";
4
9
  export { RawRequest, RawResponse } from "../internal/api/node_http";
5
10
 
6
11
  export type Method =
@@ -141,21 +146,21 @@ export interface StreamOut<Response> {
141
146
 
142
147
  export type StreamInOutHandlerFn<HandshakeData, Request, Response> =
143
148
  HandshakeData extends void
144
- ? (stream: StreamInOut<Request, Response>) => Promise<void>
145
- : (
146
- data: HandshakeData,
147
- stream: StreamInOut<Request, Response>
148
- ) => Promise<void>;
149
+ ? (stream: StreamInOut<Request, Response>) => Promise<void>
150
+ : (
151
+ data: HandshakeData,
152
+ stream: StreamInOut<Request, Response>
153
+ ) => Promise<void>;
149
154
 
150
155
  export type StreamOutHandlerFn<HandshakeData, Response> =
151
156
  HandshakeData extends void
152
- ? (stream: StreamOut<Response>) => Promise<void>
153
- : (data: HandshakeData, stream: StreamOut<Response>) => Promise<void>;
157
+ ? (stream: StreamOut<Response>) => Promise<void>
158
+ : (data: HandshakeData, stream: StreamOut<Response>) => Promise<void>;
154
159
 
155
160
  export type StreamInHandlerFn<HandshakeData, Request, Response> =
156
161
  HandshakeData extends void
157
- ? (stream: StreamIn<Request>) => Promise<Response>
158
- : (data: HandshakeData, stream: StreamIn<Request>) => Promise<Response>;
162
+ ? (stream: StreamIn<Request>) => Promise<Response>
163
+ : (data: HandshakeData, stream: StreamIn<Request>) => Promise<Response>;
159
164
 
160
165
  export type StreamInOut<Request, Response> = StreamIn<Request> &
161
166
  StreamOut<Response>;
@@ -261,5 +266,180 @@ api.static = function staticAssets(options: StaticOptions) {
261
266
  return new StaticAssets(options);
262
267
  };
263
268
 
269
+ export interface MiddlewareOptions {
270
+ /**
271
+ * Configuration for what endpoints that should be targeted by the middleware
272
+ */
273
+ target?: {
274
+ /**
275
+ * If set, only run middleware on endpoints that are either exposed or not
276
+ * exposed.
277
+ */
278
+ expose?: boolean;
279
+
280
+ /**
281
+ * If set, only run middleware on endpoints that either require or not
282
+ * requires auth.
283
+ */
284
+ auth?: boolean;
285
+
286
+ /**
287
+ * If set, only run middleware on endpoints that are raw endpoints.
288
+ */
289
+ isRaw?: boolean;
290
+
291
+ /**
292
+ * If set, only run middleware on endpoints that are stream endpoints.
293
+ */
294
+ isStream?: boolean;
295
+ };
296
+ }
297
+
298
+ export class MiddlewareRequest {
299
+ private _reqMeta?: RequestMeta;
300
+ private _stream?: Sink | Stream | Socket;
301
+ private _rawReq?: RawRequest;
302
+ private _rawResp?: RawResponse;
303
+
304
+ constructor(
305
+ stream?: Sink | Stream | Socket,
306
+ rawReq?: RawRequest,
307
+ rawResp?: RawResponse
308
+ ) {
309
+ this._stream = stream;
310
+ this._rawReq = rawReq;
311
+ this._rawResp = rawResp;
312
+ }
313
+
314
+ /**
315
+ * requestMeta is set when the handler is a typed handler or a stream handler.
316
+ * for raw handlers, see rawRequest and rawResponse.
317
+ */
318
+ public get requestMeta(): RequestMeta | undefined {
319
+ return this._reqMeta || (this._reqMeta = currentRequest());
320
+ }
321
+
322
+ /**
323
+ * stream is set when the handler is a stream handler.
324
+ */
325
+ public get stream(): Sink | Stream | Socket | undefined {
326
+ return this._stream;
327
+ }
328
+
329
+ /**
330
+ * rawRequest is set when the handler is a raw request handler.
331
+ */
332
+ public get rawRequest(): RawRequest | undefined {
333
+ return this._rawReq;
334
+ }
335
+
336
+ /**
337
+ * rawResponse is set when the handler is a raw request handler.
338
+ */
339
+ public get rawResponse(): RawResponse | undefined {
340
+ return this._rawResp;
341
+ }
342
+ }
343
+
344
+ export class ResponseHeader {
345
+ headers: Record<string, string | string[]>;
346
+
347
+ constructor() {
348
+ this.headers = {};
349
+ }
350
+
351
+ /**
352
+ * set will set a header value for a key, if a previous middleware has
353
+ * already set a value, it will be overridden.
354
+ */
355
+ public set(key: string, value: string | string[]) {
356
+ this.headers[key] = value;
357
+ }
358
+
359
+ /**
360
+ * add adds a header value to a key, if a previous middleware has
361
+ * already set a value, they will be appended.
362
+ */
363
+ public add(key: string, value: string | string[]) {
364
+ const prev = this.headers[key];
365
+
366
+ if (prev === undefined) {
367
+ this.headers[key] = value;
368
+ } else {
369
+ this.headers[key] = [prev, value].flat();
370
+ }
371
+ }
372
+ }
373
+
374
+ export class HandlerResponse {
375
+ /**
376
+ * The payload returned by the handler when the handler is either
377
+ * a typed handler or stream handler.
378
+ */
379
+ payload: any;
380
+
381
+ private _headers?: ResponseHeader;
382
+
383
+ constructor(payload: any) {
384
+ this.payload = payload;
385
+ }
386
+
387
+ /**
388
+ * header can be used by middlewares to set headers to the
389
+ * response. This only works for typed handler. For raw handlers
390
+ * see MiddlewareRequest.rawResponse.
391
+ */
392
+ public get header(): ResponseHeader {
393
+ if (this._headers === undefined) {
394
+ this._headers = new ResponseHeader();
395
+ }
396
+
397
+ return this._headers;
398
+ }
399
+
400
+ /**
401
+ * __internalToResponse converts a response to the internal representation
402
+ */
403
+ __internalToResponse(): InternalHandlerResponse {
404
+ return {
405
+ payload: this.payload,
406
+ extraHeaders: this._headers?.headers
407
+ };
408
+ }
409
+ }
410
+
411
+ export type Next = (req: MiddlewareRequest) => Promise<HandlerResponse>;
412
+
413
+ export type MiddlewareFn = (
414
+ req: MiddlewareRequest,
415
+ next: Next
416
+ ) => Promise<HandlerResponse>;
417
+
418
+ export interface Middleware extends MiddlewareFn {
419
+ options?: MiddlewareOptions;
420
+ }
421
+
422
+ export function middleware(m: MiddlewareFn): Middleware;
423
+ export function middleware(
424
+ options: MiddlewareOptions,
425
+ fn: MiddlewareFn
426
+ ): Middleware;
427
+
428
+ export function middleware(
429
+ a: MiddlewareFn | MiddlewareOptions,
430
+ b?: MiddlewareFn
431
+ ): Middleware {
432
+ if (b === undefined) {
433
+ return a as Middleware;
434
+ } else {
435
+ const opts = a as MiddlewareOptions;
436
+ const mw = b as Middleware;
437
+ mw.options = opts;
438
+
439
+ return mw;
440
+ }
441
+ }
442
+
264
443
  export { APIError, ErrCode } from "./error";
265
444
  export { Gateway, type GatewayConfig } from "./gateway";
445
+ export { Sink, Stream, Socket } from "../internal/runtime/mod";
package/dist/api/mod.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  /// <reference types="node" />
2
2
  import type { IncomingMessage, ServerResponse } from "http";
3
+ import { RequestMeta } from "../mod.js";
4
+ import { RawResponse } from "./mod.js";
5
+ import { RawRequest } from "./mod.js";
6
+ import { Sink, Stream, Socket } from "../internal/runtime/mod.js";
7
+ import { InternalHandlerResponse } from "../internal/appinit/mod.js";
3
8
  export { RawRequest, RawResponse } from "../internal/api/node_http.js";
4
9
  export type Method = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE" | "CONNECT";
5
10
  export type Header<TypeOrName extends string | number | boolean | Date = string, Name extends string = ""> = TypeOrName extends string ? string : TypeOrName;
@@ -146,5 +151,95 @@ export declare class StaticAssets {
146
151
  readonly options: StaticOptions;
147
152
  constructor(options: StaticOptions);
148
153
  }
154
+ export interface MiddlewareOptions {
155
+ /**
156
+ * Configuration for what endpoints that should be targeted by the middleware
157
+ */
158
+ target?: {
159
+ /**
160
+ * If set, only run middleware on endpoints that are either exposed or not
161
+ * exposed.
162
+ */
163
+ expose?: boolean;
164
+ /**
165
+ * If set, only run middleware on endpoints that either require or not
166
+ * requires auth.
167
+ */
168
+ auth?: boolean;
169
+ /**
170
+ * If set, only run middleware on endpoints that are raw endpoints.
171
+ */
172
+ isRaw?: boolean;
173
+ /**
174
+ * If set, only run middleware on endpoints that are stream endpoints.
175
+ */
176
+ isStream?: boolean;
177
+ };
178
+ }
179
+ export declare class MiddlewareRequest {
180
+ private _reqMeta?;
181
+ private _stream?;
182
+ private _rawReq?;
183
+ private _rawResp?;
184
+ constructor(stream?: Sink | Stream | Socket, rawReq?: RawRequest, rawResp?: RawResponse);
185
+ /**
186
+ * requestMeta is set when the handler is a typed handler or a stream handler.
187
+ * for raw handlers, see rawRequest and rawResponse.
188
+ */
189
+ get requestMeta(): RequestMeta | undefined;
190
+ /**
191
+ * stream is set when the handler is a stream handler.
192
+ */
193
+ get stream(): Sink | Stream | Socket | undefined;
194
+ /**
195
+ * rawRequest is set when the handler is a raw request handler.
196
+ */
197
+ get rawRequest(): RawRequest | undefined;
198
+ /**
199
+ * rawResponse is set when the handler is a raw request handler.
200
+ */
201
+ get rawResponse(): RawResponse | undefined;
202
+ }
203
+ export declare class ResponseHeader {
204
+ headers: Record<string, string | string[]>;
205
+ constructor();
206
+ /**
207
+ * set will set a header value for a key, if a previous middleware has
208
+ * already set a value, it will be overridden.
209
+ */
210
+ set(key: string, value: string | string[]): void;
211
+ /**
212
+ * add adds a header value to a key, if a previous middleware has
213
+ * already set a value, they will be appended.
214
+ */
215
+ add(key: string, value: string | string[]): void;
216
+ }
217
+ export declare class HandlerResponse {
218
+ /**
219
+ * The payload returned by the handler when the handler is either
220
+ * a typed handler or stream handler.
221
+ */
222
+ payload: any;
223
+ private _headers?;
224
+ constructor(payload: any);
225
+ /**
226
+ * header can be used by middlewares to set headers to the
227
+ * response. This only works for typed handler. For raw handlers
228
+ * see MiddlewareRequest.rawResponse.
229
+ */
230
+ get header(): ResponseHeader;
231
+ /**
232
+ * __internalToResponse converts a response to the internal representation
233
+ */
234
+ __internalToResponse(): InternalHandlerResponse;
235
+ }
236
+ export type Next = (req: MiddlewareRequest) => Promise<HandlerResponse>;
237
+ export type MiddlewareFn = (req: MiddlewareRequest, next: Next) => Promise<HandlerResponse>;
238
+ export interface Middleware extends MiddlewareFn {
239
+ options?: MiddlewareOptions;
240
+ }
241
+ export declare function middleware(m: MiddlewareFn): Middleware;
242
+ export declare function middleware(options: MiddlewareOptions, fn: MiddlewareFn): Middleware;
149
243
  export { APIError, ErrCode } from "./error.js";
150
244
  export { Gateway, type GatewayConfig } from "./gateway.js";
245
+ export { Sink, Stream, Socket } from "../internal/runtime/mod.js";
package/dist/api/mod.js CHANGED
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable */
2
+ import { currentRequest } from "../mod.js";
2
3
  export { RawRequest, RawResponse } from "../internal/api/node_http.js";
3
4
  export function api(options, fn) {
4
5
  return fn;
@@ -27,6 +28,111 @@ export class StaticAssets {
27
28
  api.static = function staticAssets(options) {
28
29
  return new StaticAssets(options);
29
30
  };
31
+ export class MiddlewareRequest {
32
+ _reqMeta;
33
+ _stream;
34
+ _rawReq;
35
+ _rawResp;
36
+ constructor(stream, rawReq, rawResp) {
37
+ this._stream = stream;
38
+ this._rawReq = rawReq;
39
+ this._rawResp = rawResp;
40
+ }
41
+ /**
42
+ * requestMeta is set when the handler is a typed handler or a stream handler.
43
+ * for raw handlers, see rawRequest and rawResponse.
44
+ */
45
+ get requestMeta() {
46
+ return this._reqMeta || (this._reqMeta = currentRequest());
47
+ }
48
+ /**
49
+ * stream is set when the handler is a stream handler.
50
+ */
51
+ get stream() {
52
+ return this._stream;
53
+ }
54
+ /**
55
+ * rawRequest is set when the handler is a raw request handler.
56
+ */
57
+ get rawRequest() {
58
+ return this._rawReq;
59
+ }
60
+ /**
61
+ * rawResponse is set when the handler is a raw request handler.
62
+ */
63
+ get rawResponse() {
64
+ return this._rawResp;
65
+ }
66
+ }
67
+ export class ResponseHeader {
68
+ headers;
69
+ constructor() {
70
+ this.headers = {};
71
+ }
72
+ /**
73
+ * set will set a header value for a key, if a previous middleware has
74
+ * already set a value, it will be overridden.
75
+ */
76
+ set(key, value) {
77
+ this.headers[key] = value;
78
+ }
79
+ /**
80
+ * add adds a header value to a key, if a previous middleware has
81
+ * already set a value, they will be appended.
82
+ */
83
+ add(key, value) {
84
+ const prev = this.headers[key];
85
+ if (prev === undefined) {
86
+ this.headers[key] = value;
87
+ }
88
+ else {
89
+ this.headers[key] = [prev, value].flat();
90
+ }
91
+ }
92
+ }
93
+ export class HandlerResponse {
94
+ /**
95
+ * The payload returned by the handler when the handler is either
96
+ * a typed handler or stream handler.
97
+ */
98
+ payload;
99
+ _headers;
100
+ constructor(payload) {
101
+ this.payload = payload;
102
+ }
103
+ /**
104
+ * header can be used by middlewares to set headers to the
105
+ * response. This only works for typed handler. For raw handlers
106
+ * see MiddlewareRequest.rawResponse.
107
+ */
108
+ get header() {
109
+ if (this._headers === undefined) {
110
+ this._headers = new ResponseHeader();
111
+ }
112
+ return this._headers;
113
+ }
114
+ /**
115
+ * __internalToResponse converts a response to the internal representation
116
+ */
117
+ __internalToResponse() {
118
+ return {
119
+ payload: this.payload,
120
+ extraHeaders: this._headers?.headers
121
+ };
122
+ }
123
+ }
124
+ export function middleware(a, b) {
125
+ if (b === undefined) {
126
+ return a;
127
+ }
128
+ else {
129
+ const opts = a;
130
+ const mw = b;
131
+ mw.options = opts;
132
+ return mw;
133
+ }
134
+ }
30
135
  export { APIError, ErrCode } from "./error.js";
31
136
  export { Gateway } from "./gateway.js";
137
+ export { Sink, Stream, Socket } from "../internal/runtime/mod.js";
32
138
  //# sourceMappingURL=mod.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../api/mod.ts"],"names":[],"mappings":"AAAA,oBAAoB;AAGpB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAmHpE,MAAM,UAAU,GAAG,CAAC,OAAmB,EAAE,EAAO;IAC9C,OAAO,EAAE,CAAC;AACZ,CAAC;AAID,GAAG,CAAC,GAAG,GAAG,SAAS,GAAG,CAAC,OAAmB,EAAE,EAAc;IACxD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AA+CF,SAAS,WAAW,CAAC,OAAsB,EAAE,EAAO;IAClD,OAAO,EAAE,CAAC;AACZ,CAA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,CAAC;IACZ,CAAC;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAsB,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,7 +1,23 @@
1
1
  import { Gateway } from "../../api/gateway.js";
2
+ import { Middleware } from "../../api/mod.js";
2
3
  import * as runtime from "../runtime/mod.js";
3
- export type Handler = runtime.ApiRoute;
4
+ export type Handler = {
5
+ apiRoute: runtime.ApiRoute;
6
+ middlewares: Middleware[];
7
+ endpointOptions: EndpointOptions;
8
+ };
4
9
  export declare function registerHandlers(handlers: Handler[]): void;
5
10
  export declare function registerTestHandler(handler: Handler): void;
6
11
  export declare function registerGateways(gateways: Gateway[]): void;
7
12
  export declare function run(): Promise<void>;
13
+ interface EndpointOptions {
14
+ expose: boolean;
15
+ auth: boolean;
16
+ isRaw: boolean;
17
+ isStream: boolean;
18
+ }
19
+ export interface InternalHandlerResponse {
20
+ payload: any;
21
+ extraHeaders?: Record<string, string | string[]>;
22
+ }
23
+ export {};
@@ -1,3 +1,4 @@
1
+ import { MiddlewareRequest, HandlerResponse } from "../../api/mod.js";
1
2
  import { RawRequest, RawResponse } from "../api/node_http.js";
2
3
  import { setCurrentRequest } from "../reqtrack/mod.js";
3
4
  import * as runtime from "../runtime/mod.js";
@@ -58,10 +59,56 @@ class IterableSocket {
58
59
  }
59
60
  }
60
61
  }
62
+ // recursively calls all middlewares
63
+ async function invokeMiddlewareChain(req, chain, handler) {
64
+ const execute = async (index, req) => {
65
+ const currentMiddleware = chain.at(index);
66
+ // no more middlewares, execute the handler
67
+ if (currentMiddleware === undefined) {
68
+ return new HandlerResponse(await handler());
69
+ }
70
+ // execute current middleware
71
+ return currentMiddleware(req, (req) => {
72
+ return execute(index + 1, req);
73
+ });
74
+ };
75
+ return (await execute(0, req)).__internalToResponse();
76
+ }
77
+ // calculate what middlewares should run for an endpoint
78
+ function calculateMiddlewareChain(endpointOptions, ms) {
79
+ let middlewares = [];
80
+ for (const m of ms) {
81
+ if (m.options === undefined || m.options.target === undefined) {
82
+ middlewares.push(m);
83
+ }
84
+ else {
85
+ const target = m.options.target;
86
+ // check if options are set and if they match the endpoint options
87
+ if (target.auth !== undefined && target.auth !== endpointOptions.auth) {
88
+ continue;
89
+ }
90
+ if (target.expose !== undefined &&
91
+ target.expose !== endpointOptions.expose) {
92
+ continue;
93
+ }
94
+ if (target.isRaw !== undefined &&
95
+ target.isRaw !== endpointOptions.isRaw) {
96
+ continue;
97
+ }
98
+ if (target.isStream !== undefined &&
99
+ target.isStream !== endpointOptions.isStream) {
100
+ continue;
101
+ }
102
+ middlewares.push(m);
103
+ }
104
+ }
105
+ return middlewares;
106
+ }
61
107
  function transformHandler(h) {
62
- if (h.streamingResponse || h.streamingRequest) {
108
+ const middlewares = calculateMiddlewareChain(h.endpointOptions, h.middlewares);
109
+ if (h.apiRoute.streamingResponse || h.apiRoute.streamingRequest) {
63
110
  return {
64
- ...h,
111
+ ...h.apiRoute,
65
112
  // req is the upgrade request.
66
113
  // stream is either a bidirectional stream, in stream or out stream.
67
114
  handler: (req, stream) => {
@@ -73,32 +120,69 @@ function transformHandler(h) {
73
120
  if (stream instanceof runtime.Socket) {
74
121
  stream = new IterableSocket(stream);
75
122
  }
76
- // handshake payload
77
- const payload = req.payload();
78
- return payload !== null
79
- ? h.handler(payload, stream)
80
- : h.handler(stream);
123
+ if (middlewares.length === 0) {
124
+ const payload = req.payload();
125
+ return toResponse(payload !== null
126
+ ? h.apiRoute.handler(payload, stream)
127
+ : h.apiRoute.handler(stream));
128
+ }
129
+ const handler = async () => {
130
+ // handshake payload
131
+ const payload = req.payload();
132
+ return payload !== null
133
+ ? h.apiRoute.handler(payload, stream)
134
+ : h.apiRoute.handler(stream);
135
+ };
136
+ const mwRequest = new MiddlewareRequest(stream, undefined, undefined);
137
+ return invokeMiddlewareChain(mwRequest, middlewares, handler);
81
138
  }
82
139
  };
83
140
  }
84
- if (h.raw) {
141
+ if (h.apiRoute.raw) {
85
142
  return {
86
- ...h,
143
+ ...h.apiRoute,
87
144
  handler: (req, resp, body) => {
88
145
  setCurrentRequest(req);
89
146
  const rawReq = new RawRequest(req, body);
90
147
  const rawResp = new RawResponse(rawReq, resp);
91
- return h.handler(rawReq, rawResp);
148
+ if (middlewares.length === 0) {
149
+ return toResponse(h.apiRoute.handler(rawReq, rawResp));
150
+ }
151
+ const handler = async () => {
152
+ return h.apiRoute.handler(rawReq, rawResp);
153
+ };
154
+ const mwRequest = new MiddlewareRequest(undefined, rawReq, rawResp);
155
+ return invokeMiddlewareChain(mwRequest, middlewares, handler);
92
156
  }
93
157
  };
94
158
  }
95
159
  return {
96
- ...h,
160
+ ...h.apiRoute,
97
161
  handler: (req) => {
98
162
  setCurrentRequest(req);
99
- const payload = req.payload();
100
- return payload !== null ? h.handler(payload) : h.handler();
163
+ if (middlewares.length === 0) {
164
+ const payload = req.payload();
165
+ return toResponse(payload !== null ? h.apiRoute.handler(payload) : h.apiRoute.handler());
166
+ }
167
+ const handler = async () => {
168
+ const payload = req.payload();
169
+ return payload !== null
170
+ ? h.apiRoute.handler(payload)
171
+ : h.apiRoute.handler();
172
+ };
173
+ const mwRequest = new MiddlewareRequest(undefined, undefined, undefined);
174
+ return invokeMiddlewareChain(mwRequest, middlewares, handler);
101
175
  }
102
176
  };
103
177
  }
178
+ function toResponse(payload) {
179
+ if (payload instanceof Promise) {
180
+ return payload.then((payload) => {
181
+ return new HandlerResponse(payload).__internalToResponse();
182
+ });
183
+ }
184
+ else {
185
+ return new HandlerResponse(payload).__internalToResponse();
186
+ }
187
+ }
104
188
  //# sourceMappingURL=mod.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../internal/appinit/mod.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,k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EAAE,SAAS,CAAC,CAAC;YACzE,OAAO,qBAAqB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QAChE,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CACjB,OAAY;IAEZ,IAAI,OAAO,YAAY,OAAO,EAAE,CAAC;QAC/B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,oBAAoB,EAAE,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,oBAAoB,EAAE,CAAC;IAC7D,CAAC;AACH,CAAC"}
@@ -1,7 +1,9 @@
1
+ import { isMainThread } from "node:worker_threads";
1
2
  import { Runtime } from "./napi/napi.cjs";
2
3
  export * from "./napi/napi.cjs";
3
4
  const testMode = process.env.NODE_ENV === "test";
4
5
  export const RT = new Runtime({
5
6
  testMode,
7
+ isWorker: !isMainThread && !testMode,
6
8
  });
7
9
  //# sourceMappingURL=mod.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../internal/runtime/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,cAAc,iBAAiB,CAAC;AAEhC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC;AAEjD,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,OAAO,CAAC;IAC5B,QAAQ;CACT,CAAC,CAAC"}
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../internal/runtime/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,cAAc,iBAAiB,CAAC;AAEhC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC;AAEjD,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,OAAO,CAAC;IAC5B,QAAQ;IACR,QAAQ,EAAE,CAAC,YAAY,IAAI,CAAC,QAAQ;CACrC,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  // The version of the runtime this JS bundle was generated for.
2
- const version = "v1.44.9-beta.2";
2
+ const version = "v1.44.10";
3
3
 
4
4
  // Load the native module.
5
5
  const nativeModulePath = process.env.ENCORE_RUNTIME_LIB;
@@ -23,6 +23,7 @@ export interface ApiDesc {
23
23
  service: string
24
24
  endpoint: string
25
25
  raw: boolean
26
+ requiresAuth: boolean
26
27
  }
27
28
 
28
29
  export interface ApiRoute {
@@ -247,6 +248,7 @@ export class Runtime {
247
248
 
248
249
  export interface RuntimeOptions {
249
250
  testMode?: boolean
251
+ isWorker?: boolean
250
252
  }
251
253
 
252
254
  export class Secret {
@@ -6,6 +6,8 @@ export interface APIDesc {
6
6
  endpoint: string;
7
7
  /** Whether the endpoint is a raw endpoint. */
8
8
  raw: boolean;
9
+ /** Whether the endpoint requires auth. */
10
+ auth: boolean;
9
11
  }
10
12
  export type Method = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "CONNECT" | "TRACE";
11
13
  /** Describes an API call being processed. */
package/dist/req_meta.js CHANGED
@@ -13,7 +13,7 @@ export function currentRequest() {
13
13
  }
14
14
  const meta = req.meta();
15
15
  const base = {
16
- trace: meta.trace,
16
+ trace: meta.trace
17
17
  };
18
18
  if (meta.apiCall) {
19
19
  const api = {
@@ -22,13 +22,14 @@ export function currentRequest() {
22
22
  service: meta.apiCall.api.service,
23
23
  endpoint: meta.apiCall.api.endpoint,
24
24
  raw: meta.apiCall.api.raw,
25
+ auth: meta.apiCall.api.requiresAuth
25
26
  },
26
27
  method: meta.apiCall.method,
27
28
  path: meta.apiCall.path,
28
29
  pathAndQuery: meta.apiCall.pathAndQuery,
29
30
  pathParams: meta.apiCall.pathParams ?? {},
30
31
  parsedPayload: meta.apiCall.parsedPayload,
31
- headers: meta.apiCall.headers,
32
+ headers: meta.apiCall.headers
32
33
  };
33
34
  return { ...base, ...api };
34
35
  }
@@ -40,7 +41,7 @@ export function currentRequest() {
40
41
  subscription: meta.pubsubMessage.subscription,
41
42
  messageId: meta.pubsubMessage.id,
42
43
  deliveryAttempt: meta.pubsubMessage.deliveryAttempt,
43
- parsedPayload: meta.pubsubMessage.parsedPayload,
44
+ parsedPayload: meta.pubsubMessage.parsedPayload
44
45
  };
45
46
  return { ...base, ...msg };
46
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"req_meta.js","sourceRoot":"","sources":["../req_meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AA4I5D;;;;;;GAMG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAC;IAChC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAExB,MAAM,IAAI,GAAoB;QAC5B,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC;IAEF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,GAAG,GAAgB;YACvB,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE;gBACH,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO;gBACjC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;gBACnC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG;aAC1B;YACD,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAgB;YACrC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAA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ACN,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { Middleware } from "../api/mod.js";
1
2
  /**
2
3
  * Defines an Encore backend service.
3
4
  *
@@ -13,4 +14,5 @@ export declare class Service {
13
14
  constructor(name: string, cfg?: ServiceConfig);
14
15
  }
15
16
  export interface ServiceConfig {
17
+ middlewares?: Middleware[];
16
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../service/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAO,OAAO;IACF,IAAI,CAAS;IACb,GAAG,CAAgB;IAEnC,YAAY,IAAY,EAAE,GAAmB;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;IACvB,CAAC;CACF"}
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../service/mod.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,OAAO,OAAO;IACF,IAAI,CAAS;IACb,GAAG,CAAgB;IAEnC,YAAY,IAAY,EAAE,GAAmB;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -1 +1 @@
1
- {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/typescript/lib/lib.es2022.intl.d.ts","../node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../internal/runtime/napi/napi.d.cts","../internal/runtime/mod.ts","../app_meta.ts","../internal/reqtrack/mod.ts","../req_meta.ts","../mod.ts","../api/error.ts","../auth/mod.ts","../api/gateway.ts","../internal/api/node_http.ts","../api/mod.ts","../internal/utils/constraints.ts","../config/secrets.ts","../config/mod.ts","../internal/types/mod.ts","../cron/mod.ts","../internal/api/mod.ts","../internal/appinit/mod.ts","../internal/auth/mod.ts","../internal/codegen/api.ts","../internal/codegen/appinit.ts","../internal/codegen/auth.ts","../log/mod.ts","../pubsub/attributes.ts","../pubsub/topic.ts","../pubsub/subscription.ts","../pubsub/mod.ts","../service/mod.ts","../storage/objects/error.ts","../storage/objects/refs.ts","../storage/objects/bucket.ts","../storage/objects/mod.ts","../storage/sqldb/database.ts","../storage/sqldb/mod.ts","../validate/mod.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/undici-types/header.d.ts","../node_modules/undici-types/readable.d.ts","../node_modules/undici-types/file.d.ts","../node_modules/undici-types/fetch.d.ts","../node_modules/undici-types/formdata.d.ts","../node_modules/undici-types/connector.d.ts","../node_modules/undici-types/client.d.ts","../node_modules/undici-types/errors.d.ts","../node_modules/undici-types/dispatcher.d.ts","../node_modules/undici-types/global-dispatcher.d.ts","../node_modules/undici-types/global-origin.d.ts","../node_modules/undici-types/pool-stats.d.ts","../node_modules/undici-types/pool.d.ts","../node_modules/undici-types/handlers.d.ts","../node_modules/undici-types/balanced-pool.d.ts","../node_modules/undici-types/agent.d.ts","../node_modules/undici-types/mock-interceptor.d.ts","../node_modules/undici-types/mock-agent.d.ts","../node_modules/undici-types/mock-client.d.ts","../node_modules/undici-types/mock-pool.d.ts","../node_modules/undici-types/mock-errors.d.ts","../node_modules/undici-types/proxy-agent.d.ts","../node_modules/undici-types/api.d.ts","../node_modules/undici-types/cookies.d.ts","../node_modules/undici-types/patch.d.ts","../node_modules/undici-types/filereader.d.ts","../node_modules/undici-types/diagnostics-channel.d.ts","../node_modules/undici-types/websocket.d.ts","../node_modules/undici-types/content-type.d.ts","../node_modules/undici-types/cache.d.ts","../node_modules/undici-types/interceptors.d.ts","../node_modules/undici-types/index.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/dom-events.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts"],"fileInfos":[{"version":"f33e5332b24c3773e930e212cbb8b6867c8ba3ec4492064ea78e55a524d57450","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","26f2f787e82c4222710f3b676b4d83eb5ad0a72fa7b746f03449e7a026ce5073","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc",{"version":"138fb588d26538783b78d1e3b2c2cc12d55840b97bf5e08bca7f7a174fbe2f17","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"e0275cd0e42990dc3a16f0b7c8bca3efe87f1c8ad404f80c6db1c7c0b828c59f","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"49ed889be54031e1044af0ad2c603d627b8bda8b50c1a68435fe85583901d072","affectsGlobalScope":true},{"version":"e93d098658ce4f0c8a0779e6cab91d0259efb88a318137f686ad76f8410ca270","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"acae90d417bee324b1372813b5a00829d31c7eb670d299cd7f8f9a648ac05688","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"51e547984877a62227042850456de71a5c45e7fe86b7c975c6e68896c86fa23b","affectsGlobalScope":true},{"version":"62a4966981264d1f04c44eb0f4b5bdc3d81c1a54725608861e44755aa24ad6a5","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"86a34c7a13de9cabc43161348f663624b56871ed80986e41d214932ddd8d6719","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"13f6e6380c78e15e140243dc4be2fa546c287c6d61f4729bc2dd7cf449605471","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"57d53832d5ba5c29853a5c98265a239a7ef8f5c3a998174ef94a7a17cc30c21e",{"version":"b29cdf4ae72c30b2ff554160827c71e1679fe83e90a29042748b0d8103039a08","signature":"cbdc3c62359f81de1fbfb1baf2f699990f36fe76dc3cf5e1defca9436cc09324"},{"version":"22c41cd969a3f3e8792047767157fd978e5bebf3d5edfe28263a60f094ea8960","signature":"f7a13afa5e66557c8b6fec4b7740e45c9ee0d0a3bdfc2419eeb21c9a214ab9b9"},{"version":"2f9d6c356517121fffa5c54a200fb8fd9b35a3a4339ec3a69ada6b90087c4479","signature":"0755afeffaa749b0a9d242ad328b06c1aa243dd7b10a5d38e13419150792c362"},{"version":"50fa1290cbd266a2e90aed612b1d42508eba49a7ebf83895b5eecc6bfee80af7","signature":"7185ad4db4d9fef477e3ea884784ba55bd44a6dec4923531779059e70e799f3f"},{"version":"76a8bc704b721e967c752b55bebb16f3a2922cdb86e652c0c82759f5cb3771da","signature":"6167410fcb897c61d6300d81d28f4fee3a1fc8e6ebbcd5c7fe9512fc5f061807"},{"version":"617f1365fe604e85dbee1041c4934d88784dcbfd8777dbcd0e347d7839a58270","signature":"733cbad424aa2dc04c2834d17a1e224182f9abcf355bf06f84972aa71e7cf88c"},{"version":"a9cb80f47f8ce54e616d903da3861ed87b4cc2db54369f3229305923a8d01e9e","signature":"e8b08e8437d7f449a1020c78f523c80edca47d2a7bec765cf8adee01b1b9f4b9"},{"version":"13f690099f433bbd91d6e5af8df80005df0ac3e0c96dc632898ba11bdeef49ba","signature":"b462e4f1ebcae75c287fe499122527a25b1f04c5349f842158c005d758bde646"},{"version":"483cbcd6c7ab7d449e6e130bbd314af689d893c28421bc6f4005d72fbea8ba1e","signature":"b44e1fa2517dcd005974748e4dc03c6be792f3566b794b9262e3da72062b0d74"},{"version":"693e812b5d1f7232f21924c42b81495ab8d2d503af22daa2fc6084828c284844","signature":"8146c610e33de447bbc9184b49b343f509a06c3b62c2d130f573ff3884327910"},{"version":"dac2ecb2e2edf2f279c46f49b05e7dab73fb427a72f662cb24d7e06556087db7","signature":"89c544a3aa54a88d90bb7db6e318542d661fc79035b98700d2b7fe5d87bf7edb"},{"version":"c2358758c15d37b0f88a8ecf8cf38deb1fa45995871d2ecda2219ce8e365d2e2","signature":"d6557e5b8c49c27f990d378acb3a64cbd6291d1c97984d9d14510df1038f5d5b"},"68fe5d7ce4b0073cb450767c70847f6bd7ef0e6b099b26effd7651410fcc6206",{"version":"00018aadf3bf8aac3b94d086c07d837b006af7389fab4f52bba73083bdd02c51","signature":"15b3437374aea37541f405e45622294bc2e2631b749920676ae90a8a38ee0bce"},{"version":"d236effd859fb8663d2802ac5b16a8675645585380448c35a2b9297011db0186","signature":"f2582ae9e2b63ad8a9615655f2c136e1652436f177885cbf874d82a8c74f1d29"},{"version":"0144a40fd18f8ec246f120c1cc7e769ece97212a97b718e15e7f643d16c10fe8","signature":"5a51e785a9a472cad391424aef04ff8c1b68c965f5ee7574ab8cb2eed826e09f"},{"version":"18f426770e585ed3637119a141c4290cabb523dd0a19ffe29273b48d42988692","signature":"2d7c6bc7a710b4b44da95cd1c207ad1f25e51981d9c144c4d130099981f4a9d9"},{"version":"65067ae33d9b54a877897cf19c04d11bbc642d23d5f9bddaacb6145b12b47252","signature":"484d6b91ba6f61784cbe40df3a8d4c894a8a6d9322147565c397c161d8b5e547"},"330fec351a0c9604ceaa9b098f5524875fae13b26e92a1f44555e67d12f87d35",{"version":"21c37ec4d5400f8d087cf808bc3fbeef1a332aa04a9ef3f6eff4de5addb9835b","signature":"017c1fe5d55daa40564b838ab60cea5e3981e494c20233bb1acc67276d1fb325"},{"version":"e8bf991b3662116671e3430bf519baaace5f6fff3da3fd8d0172ad28a31bc004","signature":"0bb4ce4d165639c83303131ec16c347188ae475335e48a4f0f0c5b09e19bebc7"},{"version":"99a7a53582f2a44381cfbd285fd0457e18116e4185fe93a8679b31a7253ae445","signature":"702197a1307efc488d7c2eed452627d3bfb63810e69e4dd7cecac4e289049e45"},{"version":"7752070ba7feb1db9554d53d98a6a88c7a33c8887d39e9fdcb0717f11efc3f55","signature":"8d4915d71b6ade8d068774cf77299cc76e597a63fb4ba7e055edde453edbf1eb"},{"version":"d73f514e65026f8431e3765a977f3ce2bd100b52a865677f28644972e200cafc","signature":"e470537b83f7ea9796f4088c419e5b95023b979b191030d1aefa742f3fbb1672"},{"version":"cb3393ffd4b953e1cb0fb2864e10c9dad9fb5a6343934ab0d1d034d0a8c09b0e","signature":"0c85004226ac441a92d4362392ee26d2de029799313b538cd7fab4304deae5f0"},{"version":"884eb991175ce17f8419fd6d4c380e8f1f3d1da8877d3820cddeecc2bfbc8c91","signature":"8605b99a002c3a7bbdf60d90193f3a1c62a5bdba0a940c812250a815162fbbb9"},{"version":"bf3807c4266809b2b7d8d907aea7d28cdbd7ddb52815c368ca9576f3439cd671","signature":"616c7a387f1bce3f6ede7a48c15de166f18054b41ed1ed23a460a19c3ac699d7"},{"version":"2e3ef79a9f913d0dd0c4e735ce917cc5e7b5f53b872642b6edc95d7c5fd4a436","signature":"d98413de84e40984b80541bd5f0444620fbf904859de5c06d5a0ea1540d5b741"},{"version":"338fc1986e022737ab89cb6efc3595acddd55b72c5b61cdf33851f461c6e6a42","signature":"2db3341caec90099ddab00329907bd2a26bf84235fd87c297ecb52808aa88a4b"},{"version":"edf15318ae9530d1765b459e072156543fa212e28e5572bb594f1214f80881bc","signature":"93e157f825a3b613d3aba05b90ccbd10b191fae12f9c33301e6fa17eaea36574"},"49bad97b9729c46c310cfe916fb2e22241910e7e9446678c2707d0b339d0bc97",{"version":"b595e020726c7c05967c5af385321e4ffd7225b2aab771d4c848a4c28659010b","signature":"ed19ca2f543ba5494817dbfd4462218637f435b03a1b5eb8747e829abf901cab"},"21a0fc92666d4ffe9628ad155124bdcbafc6bef107dff77349604ec9fd8c178b",{"version":"70fd95aea939e97c313c82fd0ab1556a3c820177869c64531038aab9fc929fca","signature":"ddc563f3a5f1a20f4aea98e92c26c65aa4c239e3bd71e3e66093a92a088d23cb"},"efc7d584a33fe3422847783d228f315c4cd1afe74bd7cf8e3f0e4c1125129fef","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","7180c03fd3cb6e22f911ce9ba0f8a7008b1a6ddbe88ccf16a9c8140ef9ac1686","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","54cb85a47d760da1c13c00add10d26b5118280d44d58e6908d8e89abbd9d7725","3e4825171442666d31c845aeb47fcd34b62e14041bb353ae2b874285d78482aa","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","a967bfe3ad4e62243eb604bf956101e4c740f5921277c60debaf325c1320bf88","e9775e97ac4877aebf963a0289c81abe76d1ec9a2a7778dbe637e5151f25c5f3","471e1da5a78350bc55ef8cef24eb3aca6174143c281b8b214ca2beda51f5e04a","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","db3435f3525cd785bf21ec6769bf8da7e8a776be1a99e2e7efb5f244a2ef5fee","c3b170c45fc031db31f782e612adf7314b167e60439d304b49e704010e7bafe5","40383ebef22b943d503c6ce2cb2e060282936b952a01bea5f9f493d5fb487cc7","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","3a84b7cb891141824bd00ef8a50b6a44596aded4075da937f180c90e362fe5f6","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","33203609eba548914dc83ddf6cadbc0bcb6e8ef89f6d648ca0908ae887f9fcc5","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","9f0a92164925aa37d4a5d9dd3e0134cff8177208dba55fd2310cd74beea40ee2","8bfdb79bf1a9d435ec48d9372dc93291161f152c0865b81fc0b2694aedb4578d","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","d32275be3546f252e3ad33976caf8c5e842c09cb87d468cb40d5f4cf092d1acc","4a0c3504813a3289f7fb1115db13967c8e004aa8e4f8a9021b95285502221bd1",{"version":"a14ed46fa3f5ffc7a8336b497cd07b45c2084213aaca933a22443fcb2eef0d07","affectsGlobalScope":true},"cce1f5f86974c1e916ec4a8cab6eec9aa8e31e8148845bf07fbaa8e1d97b1a2c",{"version":"7fd7fcbf021a5845bdd9397d4649fcf2fe17152d2098140fc723099a215d19ad","affectsGlobalScope":true},"16d74fe4d8e183344d3beb15d48b123c5980ff32ff0cc8c3b96614ddcdf9b239","7b43160a49cf2c6082da0465876c4a0b164e160b81187caeb0a6ca7a281e85ba",{"version":"41fb2a1c108fbf46609ce5a451b7ec78eb9b5ada95fd5b94643e4b26397de0b3","affectsGlobalScope":true},"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb",{"version":"a1d2988ad9d2aef7b9915a22b5e52c165c83a878f2851c35621409046bbe3c05","affectsGlobalScope":true},"bd3f5d05b6b5e4bfcea7739a45f3ffb4a7f4a3442ba7baf93e0200799285b8f1","4c775c2fccabf49483c03cd5e3673f87c1ffb6079d98e7b81089c3def79e29c6","8806ae97308ef26363bd7ec8071bca4d07fb575f905ee3d8a91aff226df6d618","af5bf1db6f1804fb0069039ae77a05d60133c77a2158d9635ea27b6bb2828a8f","b7fe70be794e13d1b7940e318b8770cd1fb3eced7707805318a2e3aaac2c3e9e",{"version":"2c71199d1fc83bf17636ad5bf63a945633406b7b94887612bba4ef027c662b3e","affectsGlobalScope":true},{"version":"674168aa3db414ea0a19b2a31d901b2d49705c7a495e43ffdc96928543010f8c","affectsGlobalScope":true},"fe1fd6afdfe77976d4c702f3746c05fb05a7e566845c890e0e970fe9376d6a90","313a0b063f5188037db113509de1b934a0e286f14e9479af24fada241435e707","afb1701fd4be413a8a5a88df6befdd4510c30a31372c07a4138facf61594c66d","87ef1a23caa071b07157c72077fa42b86d30568f9dc9e31eed24d5d14fc30ba8","396a8939b5e177542bdf9b5262b4eee85d29851b2d57681fa9d7eae30e225830","21773f5ac69ddf5a05636ba1f50b5239f4f2d27e4420db147fc2f76a5ae598ac",{"version":"ea455cc68871b049bcecd9f56d4cf27b852d6dafd5e3b54468ca87cc11604e4d","affectsGlobalScope":true},"c07146dbbbd8b347241b5df250a51e48f2d7bef19b1e187b1a3f20c849988ff1","45b1053e691c5af9bfe85060a3e1542835f8d84a7e6e2e77ca305251eda0cb3c","0f05c06ff6196958d76b865ae17245b52d8fe01773626ac3c43214a2458ea7b7",{"version":"ae5507fc333d637dec9f37c6b3f4d423105421ea2820a64818de55db85214d66","affectsGlobalScope":true},{"version":"0666f4c99b8688c7be5956df8fecf5d1779d3b22f8f2a88258ae7072c7b6026f","affectsGlobalScope":true},"8abd0566d2854c4bd1c5e48e05df5c74927187f1541e6770001d9637ac41542e","54e854615c4eafbdd3fd7688bd02a3aafd0ccf0e87c98f79d3e9109f047ce6b8","d8dba11dc34d50cb4202de5effa9a1b296d7a2f4a029eec871f894bddfb6430d","8b71dd18e7e63b6f991b511a201fad7c3bf8d1e0dd98acb5e3d844f335a73634","01d8e1419c84affad359cc240b2b551fb9812b450b4d3d456b64cda8102d4f60","8221b00f271cf7f535a8eeec03b0f80f0929c7a16116e2d2df089b41066de69b","269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","7424817d5eb498771e6d1808d726ec38f75d2eaf3fa359edd5c0c540c52725c1","9a9634296cca836c3308923ba7aa094fa6ed76bb1e366d8ddcf5c65888ab1024",{"version":"bddce945d552a963c9733db106b17a25474eefcab7fc990157a2134ef55d4954","affectsGlobalScope":true},{"version":"7052b7b0c3829df3b4985bab2fd74531074b4835d5a7b263b75c82f0916ad62f","affectsGlobalScope":true},"aa34c3aa493d1c699601027c441b9664547c3024f9dbab1639df7701d63d18fa","4b55240c2a03b2c71e98a7fc528b16136faa762211c92e781a01c37821915ea6","7c651f8dce91a927ab62925e73f190763574c46098f2b11fb8ddc1b147a6709a","7440ab60f4cb031812940cc38166b8bb6fbf2540cfe599f87c41c08011f0c1df",{"version":"94c086dff8dbc5998749326bc69b520e8e4273fb5b7b58b50e0210e0885dfcde","affectsGlobalScope":true},{"version":"f5b5dc128973498b75f52b1b8c2d5f8629869104899733ae485100c2309b4c12","affectsGlobalScope":true},"ebe5facd12fd7745cda5f4bc3319f91fb29dc1f96e57e9c6f8b260a7cc5b67ee","79bad8541d5779c85e82a9fb119c1fe06af77a71cc40f869d62ad379473d4b75","37dc027f781c75f0f546e329cfac7cf92a6b289f42458f47a9adc25e516b6839",{"version":"629d20681ca284d9e38c0a019f647108f5fe02f9c59ac164d56f5694fc3faf4d","affectsGlobalScope":true},"e7dbf5716d76846c7522e910896c5747b6df1abd538fee8f5291bdc843461795",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"b510d0a18e3db42ac9765d26711083ec1e8b4e21caaca6dc4d25ae6e8623f447"],"root":[[58,92]],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"module":7,"outDir":"./","rootDir":"..","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"fileIdsList":[[59,61,65],[64,66,67,144],[59],[70],[59,69],[72],[59,61,64],[59,144,149,159],[59,61,66,67],[61],[74],[75],[76],[59,128],[58],[59,61],[60,62],[93],[128],[129,134,162],[130,141,142,149,159,170],[130,131,141,149],[132,171],[133,134,142,150],[134,159,167],[135,137,141,149],[128,136],[137,138],[141],[139,141],[128,141],[141,142,143,159,170],[141,142,143,156,159,162],[126,129,175],[137,141,144,149,159,170],[141,142,144,145,149,159,167,170],[144,146,159,167,170],[93,94,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177],[141,147],[148,170,175],[137,141,149,159],[150],[151],[128,152],[153,169,175],[154],[155],[141,156,157],[156,158,171,173],[129,141,159,160,161,162],[129,159,161],[159,160],[162],[163],[128,159],[141,165,166],[165,166],[134,149,159,167],[168],[149,169],[129,144,155,170],[134,171],[159,172],[148,173],[174],[129,134,141,143,152,159,170,173,175],[159,176],[103,107,170],[103,159,170],[98],[100,103,167,170],[149,167],[178],[98,178],[100,103,149,170],[95,96,99,102,129,141,159,170],[95,101],[99,103,129,162,170,178],[129,178],[119,129,178],[97,98,178],[103],[97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,118,120,121,122,123,124,125],[103,110,111],[101,103,111,112],[102],[95,98,103],[103,107,111,112],[107],[101,103,106,170],[95,100,101,103,107,110],[129,159],[98,103,119,129,175,178],[81,82,83],[59,61,72,82],[59,61,81],[59,61,69,86,87],[86,87,88],[88],[59,61,69],[90],[65],[69],[59,66],[72,82],[81],[59,69,87]],"referencedMap":[[66,1],[68,2],[60,3],[71,4],[70,5],[73,6],[74,7],[67,8],[75,9],[76,10],[77,11],[78,12],[79,13],[61,14],[59,15],[80,16],[63,17],[93,18],[94,18],[128,19],[129,20],[130,21],[131,22],[132,23],[133,24],[134,25],[135,26],[136,27],[137,28],[138,28],[140,29],[139,30],[141,31],[142,32],[143,33],[127,34],[144,35],[145,36],[146,37],[178,38],[147,39],[148,40],[149,41],[150,42],[151,43],[152,44],[153,45],[154,46],[155,47],[156,48],[157,48],[158,49],[159,50],[161,51],[160,52],[162,53],[163,54],[164,55],[165,56],[166,57],[167,58],[168,59],[169,60],[170,61],[171,62],[172,63],[173,64],[174,65],[175,66],[176,67],[110,68],[117,69],[109,68],[124,70],[101,71],[100,72],[123,73],[118,74],[121,75],[103,76],[102,77],[98,78],[97,79],[120,80],[99,81],[104,82],[108,82],[126,83],[125,82],[112,84],[113,85],[115,86],[111,87],[114,88],[119,73],[106,89],[107,90],[116,91],[96,92],[122,93],[84,94],[83,95],[82,96],[62,10],[88,97],[86,3],[89,98],[87,99],[90,100],[91,101]],"exportedModulesMap":[[66,102],[68,2],[71,4],[70,103],[73,6],[67,8],[75,104],[77,11],[78,12],[79,13],[61,3],[59,15],[80,3],[63,17],[93,18],[94,18],[128,19],[129,20],[130,21],[131,22],[132,23],[133,24],[134,25],[135,26],[136,27],[137,28],[138,28],[140,29],[139,30],[141,31],[142,32],[143,33],[127,34],[144,35],[145,36],[146,37],[178,38],[147,39],[148,40],[149,41],[150,42],[151,43],[152,44],[153,45],[154,46],[155,47],[156,48],[157,48],[158,49],[159,50],[161,51],[160,52],[162,53],[163,54],[164,55],[165,56],[166,57],[167,58],[168,59],[169,60],[170,61],[171,62],[172,63],[173,64],[174,65],[175,66],[176,67],[110,68],[117,69],[109,68],[124,70],[101,71],[100,72],[123,73],[118,74],[121,75],[103,76],[102,77],[98,78],[97,79],[120,80],[99,81],[104,82],[108,82],[126,83],[125,82],[112,84],[113,85],[115,86],[111,87],[114,88],[119,73],[106,89],[107,90],[116,91],[96,92],[122,93],[84,94],[83,105],[82,106],[88,107],[86,3],[89,98],[87,99],[90,5],[91,101]],"semanticDiagnosticsPerFile":[64,66,68,60,65,71,70,73,74,67,75,76,77,78,79,61,59,58,72,69,80,63,93,94,128,129,130,131,132,133,134,135,136,137,138,140,139,141,142,143,127,177,144,145,146,178,147,148,149,150,151,152,153,154,155,156,157,158,159,161,160,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,56,57,11,10,2,12,13,14,15,16,17,18,19,3,4,20,24,21,22,23,25,26,27,5,28,29,30,31,6,35,32,33,34,36,7,37,42,43,38,39,40,41,8,47,44,45,46,48,9,49,50,51,54,52,53,1,55,110,117,109,124,101,100,123,118,121,103,102,98,97,120,99,104,105,108,95,126,125,112,113,115,111,114,119,106,107,116,96,122,81,84,83,82,62,85,88,86,89,87,90,91,92],"latestChangedDtsFile":"./validate/mod.d.ts"},"version":"5.3.3"}
1
+ {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/typescript/lib/lib.es2022.intl.d.ts","../node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../internal/runtime/napi/napi.d.cts","../internal/runtime/mod.ts","../app_meta.ts","../internal/reqtrack/mod.ts","../req_meta.ts","../mod.ts","../api/error.ts","../auth/mod.ts","../api/gateway.ts","../internal/api/node_http.ts","../internal/appinit/mod.ts","../api/mod.ts","../internal/utils/constraints.ts","../config/secrets.ts","../config/mod.ts","../internal/types/mod.ts","../cron/mod.ts","../internal/api/mod.ts","../internal/auth/mod.ts","../internal/codegen/api.ts","../internal/codegen/appinit.ts","../internal/codegen/auth.ts","../log/mod.ts","../pubsub/attributes.ts","../pubsub/topic.ts","../pubsub/subscription.ts","../pubsub/mod.ts","../service/mod.ts","../storage/objects/error.ts","../storage/objects/refs.ts","../storage/objects/bucket.ts","../storage/objects/mod.ts","../storage/sqldb/database.ts","../storage/sqldb/mod.ts","../validate/mod.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/undici-types/header.d.ts","../node_modules/undici-types/readable.d.ts","../node_modules/undici-types/file.d.ts","../node_modules/undici-types/fetch.d.ts","../node_modules/undici-types/formdata.d.ts","../node_modules/undici-types/connector.d.ts","../node_modules/undici-types/client.d.ts","../node_modules/undici-types/errors.d.ts","../node_modules/undici-types/dispatcher.d.ts","../node_modules/undici-types/global-dispatcher.d.ts","../node_modules/undici-types/global-origin.d.ts","../node_modules/undici-types/pool-stats.d.ts","../node_modules/undici-types/pool.d.ts","../node_modules/undici-types/handlers.d.ts","../node_modules/undici-types/balanced-pool.d.ts","../node_modules/undici-types/agent.d.ts","../node_modules/undici-types/mock-interceptor.d.ts","../node_modules/undici-types/mock-agent.d.ts","../node_modules/undici-types/mock-client.d.ts","../node_modules/undici-types/mock-pool.d.ts","../node_modules/undici-types/mock-errors.d.ts","../node_modules/undici-types/proxy-agent.d.ts","../node_modules/undici-types/api.d.ts","../node_modules/undici-types/cookies.d.ts","../node_modules/undici-types/patch.d.ts","../node_modules/undici-types/filereader.d.ts","../node_modules/undici-types/diagnostics-channel.d.ts","../node_modules/undici-types/websocket.d.ts","../node_modules/undici-types/content-type.d.ts","../node_modules/undici-types/cache.d.ts","../node_modules/undici-types/interceptors.d.ts","../node_modules/undici-types/index.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/dom-events.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts"],"fileInfos":[{"version":"f33e5332b24c3773e930e212cbb8b6867c8ba3ec4492064ea78e55a524d57450","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","26f2f787e82c4222710f3b676b4d83eb5ad0a72fa7b746f03449e7a026ce5073","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc",{"version":"138fb588d26538783b78d1e3b2c2cc12d55840b97bf5e08bca7f7a174fbe2f17","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"e0275cd0e42990dc3a16f0b7c8bca3efe87f1c8ad404f80c6db1c7c0b828c59f","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"49ed889be54031e1044af0ad2c603d627b8bda8b50c1a68435fe85583901d072","affectsGlobalScope":true},{"version":"e93d098658ce4f0c8a0779e6cab91d0259efb88a318137f686ad76f8410ca270","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"acae90d417bee324b1372813b5a00829d31c7eb670d299cd7f8f9a648ac05688","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"51e547984877a62227042850456de71a5c45e7fe86b7c975c6e68896c86fa23b","affectsGlobalScope":true},{"version":"62a4966981264d1f04c44eb0f4b5bdc3d81c1a54725608861e44755aa24ad6a5","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"86a34c7a13de9cabc43161348f663624b56871ed80986e41d214932ddd8d6719","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"13f6e6380c78e15e140243dc4be2fa546c287c6d61f4729bc2dd7cf449605471","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"30e738034ee440e1169fa35616ba9a35a895d5a1c2635ee7d2f8d3b8badffb65",{"version":"e11fa6d10e4091c1e8c499253c80f2d162f493990c0f1a35db564a02affb7b56","signature":"cbdc3c62359f81de1fbfb1baf2f699990f36fe76dc3cf5e1defca9436cc09324"},{"version":"22c41cd969a3f3e8792047767157fd978e5bebf3d5edfe28263a60f094ea8960","signature":"f7a13afa5e66557c8b6fec4b7740e45c9ee0d0a3bdfc2419eeb21c9a214ab9b9"},{"version":"2f9d6c356517121fffa5c54a200fb8fd9b35a3a4339ec3a69ada6b90087c4479","signature":"0755afeffaa749b0a9d242ad328b06c1aa243dd7b10a5d38e13419150792c362"},{"version":"5c2912d2c82c3ced0d4ae19d6480487bcf09f9a124e5ddd45a1b3a134fa66ddb","signature":"cac2ecb20b5161247bdc9097bf71976bee015ff2e8bb9b00d64b2a0dff0620bd"},{"version":"76a8bc704b721e967c752b55bebb16f3a2922cdb86e652c0c82759f5cb3771da","signature":"6167410fcb897c61d6300d81d28f4fee3a1fc8e6ebbcd5c7fe9512fc5f061807"},{"version":"617f1365fe604e85dbee1041c4934d88784dcbfd8777dbcd0e347d7839a58270","signature":"733cbad424aa2dc04c2834d17a1e224182f9abcf355bf06f84972aa71e7cf88c"},{"version":"a9cb80f47f8ce54e616d903da3861ed87b4cc2db54369f3229305923a8d01e9e","signature":"e8b08e8437d7f449a1020c78f523c80edca47d2a7bec765cf8adee01b1b9f4b9"},{"version":"13f690099f433bbd91d6e5af8df80005df0ac3e0c96dc632898ba11bdeef49ba","signature":"b462e4f1ebcae75c287fe499122527a25b1f04c5349f842158c005d758bde646"},{"version":"483cbcd6c7ab7d449e6e130bbd314af689d893c28421bc6f4005d72fbea8ba1e","signature":"b44e1fa2517dcd005974748e4dc03c6be792f3566b794b9262e3da72062b0d74"},{"version":"0ae3ea39f1c79530e688aaf087320dbc00219d845a1e9ae14a40d5e205a3293e","signature":"842e8adf4621b8caa3a6fbfed1a34ae7c6dcecec858e46529d866ca0cbdb9c67"},{"version":"73b4d87921b2db49d9381d2d7809ddcce7a6f6e834fe7ccbc3c31c2bb6042cb4","signature":"a0b8f3e0db81b911bbef1c1400f1884b1112337725c28a1b624c84978c15f6d7"},{"version":"dac2ecb2e2edf2f279c46f49b05e7dab73fb427a72f662cb24d7e06556087db7","signature":"89c544a3aa54a88d90bb7db6e318542d661fc79035b98700d2b7fe5d87bf7edb"},{"version":"c2358758c15d37b0f88a8ecf8cf38deb1fa45995871d2ecda2219ce8e365d2e2","signature":"d6557e5b8c49c27f990d378acb3a64cbd6291d1c97984d9d14510df1038f5d5b"},"68fe5d7ce4b0073cb450767c70847f6bd7ef0e6b099b26effd7651410fcc6206",{"version":"00018aadf3bf8aac3b94d086c07d837b006af7389fab4f52bba73083bdd02c51","signature":"15b3437374aea37541f405e45622294bc2e2631b749920676ae90a8a38ee0bce"},{"version":"d236effd859fb8663d2802ac5b16a8675645585380448c35a2b9297011db0186","signature":"f2582ae9e2b63ad8a9615655f2c136e1652436f177885cbf874d82a8c74f1d29"},{"version":"0144a40fd18f8ec246f120c1cc7e769ece97212a97b718e15e7f643d16c10fe8","signature":"5a51e785a9a472cad391424aef04ff8c1b68c965f5ee7574ab8cb2eed826e09f"},{"version":"65067ae33d9b54a877897cf19c04d11bbc642d23d5f9bddaacb6145b12b47252","signature":"484d6b91ba6f61784cbe40df3a8d4c894a8a6d9322147565c397c161d8b5e547"},"330fec351a0c9604ceaa9b098f5524875fae13b26e92a1f44555e67d12f87d35",{"version":"21c37ec4d5400f8d087cf808bc3fbeef1a332aa04a9ef3f6eff4de5addb9835b","signature":"017c1fe5d55daa40564b838ab60cea5e3981e494c20233bb1acc67276d1fb325"},{"version":"e8bf991b3662116671e3430bf519baaace5f6fff3da3fd8d0172ad28a31bc004","signature":"0bb4ce4d165639c83303131ec16c347188ae475335e48a4f0f0c5b09e19bebc7"},{"version":"99a7a53582f2a44381cfbd285fd0457e18116e4185fe93a8679b31a7253ae445","signature":"702197a1307efc488d7c2eed452627d3bfb63810e69e4dd7cecac4e289049e45"},{"version":"7752070ba7feb1db9554d53d98a6a88c7a33c8887d39e9fdcb0717f11efc3f55","signature":"8d4915d71b6ade8d068774cf77299cc76e597a63fb4ba7e055edde453edbf1eb"},{"version":"d73f514e65026f8431e3765a977f3ce2bd100b52a865677f28644972e200cafc","signature":"e470537b83f7ea9796f4088c419e5b95023b979b191030d1aefa742f3fbb1672"},{"version":"cb3393ffd4b953e1cb0fb2864e10c9dad9fb5a6343934ab0d1d034d0a8c09b0e","signature":"0c85004226ac441a92d4362392ee26d2de029799313b538cd7fab4304deae5f0"},{"version":"884eb991175ce17f8419fd6d4c380e8f1f3d1da8877d3820cddeecc2bfbc8c91","signature":"8605b99a002c3a7bbdf60d90193f3a1c62a5bdba0a940c812250a815162fbbb9"},{"version":"a437c68abc20686d0bc8cd7361b2c09fbe585ca0418a9caf9fae790f671e6001","signature":"320f693234a4a555bc4e9d95c6b635654d7f45509e0cba2a80399f159561ebbe"},{"version":"2e3ef79a9f913d0dd0c4e735ce917cc5e7b5f53b872642b6edc95d7c5fd4a436","signature":"d98413de84e40984b80541bd5f0444620fbf904859de5c06d5a0ea1540d5b741"},{"version":"338fc1986e022737ab89cb6efc3595acddd55b72c5b61cdf33851f461c6e6a42","signature":"2db3341caec90099ddab00329907bd2a26bf84235fd87c297ecb52808aa88a4b"},{"version":"edf15318ae9530d1765b459e072156543fa212e28e5572bb594f1214f80881bc","signature":"93e157f825a3b613d3aba05b90ccbd10b191fae12f9c33301e6fa17eaea36574"},"49bad97b9729c46c310cfe916fb2e22241910e7e9446678c2707d0b339d0bc97",{"version":"b595e020726c7c05967c5af385321e4ffd7225b2aab771d4c848a4c28659010b","signature":"ed19ca2f543ba5494817dbfd4462218637f435b03a1b5eb8747e829abf901cab"},"21a0fc92666d4ffe9628ad155124bdcbafc6bef107dff77349604ec9fd8c178b",{"version":"70fd95aea939e97c313c82fd0ab1556a3c820177869c64531038aab9fc929fca","signature":"ddc563f3a5f1a20f4aea98e92c26c65aa4c239e3bd71e3e66093a92a088d23cb"},"efc7d584a33fe3422847783d228f315c4cd1afe74bd7cf8e3f0e4c1125129fef","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","7180c03fd3cb6e22f911ce9ba0f8a7008b1a6ddbe88ccf16a9c8140ef9ac1686","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","54cb85a47d760da1c13c00add10d26b5118280d44d58e6908d8e89abbd9d7725","3e4825171442666d31c845aeb47fcd34b62e14041bb353ae2b874285d78482aa","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","a967bfe3ad4e62243eb604bf956101e4c740f5921277c60debaf325c1320bf88","e9775e97ac4877aebf963a0289c81abe76d1ec9a2a7778dbe637e5151f25c5f3","471e1da5a78350bc55ef8cef24eb3aca6174143c281b8b214ca2beda51f5e04a","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","db3435f3525cd785bf21ec6769bf8da7e8a776be1a99e2e7efb5f244a2ef5fee","c3b170c45fc031db31f782e612adf7314b167e60439d304b49e704010e7bafe5","40383ebef22b943d503c6ce2cb2e060282936b952a01bea5f9f493d5fb487cc7","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","3a84b7cb891141824bd00ef8a50b6a44596aded4075da937f180c90e362fe5f6","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","33203609eba548914dc83ddf6cadbc0bcb6e8ef89f6d648ca0908ae887f9fcc5","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","9f0a92164925aa37d4a5d9dd3e0134cff8177208dba55fd2310cd74beea40ee2","8bfdb79bf1a9d435ec48d9372dc93291161f152c0865b81fc0b2694aedb4578d","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","d32275be3546f252e3ad33976caf8c5e842c09cb87d468cb40d5f4cf092d1acc","4a0c3504813a3289f7fb1115db13967c8e004aa8e4f8a9021b95285502221bd1",{"version":"a14ed46fa3f5ffc7a8336b497cd07b45c2084213aaca933a22443fcb2eef0d07","affectsGlobalScope":true},"cce1f5f86974c1e916ec4a8cab6eec9aa8e31e8148845bf07fbaa8e1d97b1a2c",{"version":"7fd7fcbf021a5845bdd9397d4649fcf2fe17152d2098140fc723099a215d19ad","affectsGlobalScope":true},"16d74fe4d8e183344d3beb15d48b123c5980ff32ff0cc8c3b96614ddcdf9b239","7b43160a49cf2c6082da0465876c4a0b164e160b81187caeb0a6ca7a281e85ba",{"version":"41fb2a1c108fbf46609ce5a451b7ec78eb9b5ada95fd5b94643e4b26397de0b3","affectsGlobalScope":true},"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb",{"version":"a1d2988ad9d2aef7b9915a22b5e52c165c83a878f2851c35621409046bbe3c05","affectsGlobalScope":true},"bd3f5d05b6b5e4bfcea7739a45f3ffb4a7f4a3442ba7baf93e0200799285b8f1","4c775c2fccabf49483c03cd5e3673f87c1ffb6079d98e7b81089c3def79e29c6","8806ae97308ef26363bd7ec8071bca4d07fb575f905ee3d8a91aff226df6d618","af5bf1db6f1804fb0069039ae77a05d60133c77a2158d9635ea27b6bb2828a8f","b7fe70be794e13d1b7940e318b8770cd1fb3eced7707805318a2e3aaac2c3e9e",{"version":"2c71199d1fc83bf17636ad5bf63a945633406b7b94887612bba4ef027c662b3e","affectsGlobalScope":true},{"version":"674168aa3db414ea0a19b2a31d901b2d49705c7a495e43ffdc96928543010f8c","affectsGlobalScope":true},"fe1fd6afdfe77976d4c702f3746c05fb05a7e566845c890e0e970fe9376d6a90","313a0b063f5188037db113509de1b934a0e286f14e9479af24fada241435e707","afb1701fd4be413a8a5a88df6befdd4510c30a31372c07a4138facf61594c66d","87ef1a23caa071b07157c72077fa42b86d30568f9dc9e31eed24d5d14fc30ba8","396a8939b5e177542bdf9b5262b4eee85d29851b2d57681fa9d7eae30e225830","21773f5ac69ddf5a05636ba1f50b5239f4f2d27e4420db147fc2f76a5ae598ac",{"version":"ea455cc68871b049bcecd9f56d4cf27b852d6dafd5e3b54468ca87cc11604e4d","affectsGlobalScope":true},"c07146dbbbd8b347241b5df250a51e48f2d7bef19b1e187b1a3f20c849988ff1","45b1053e691c5af9bfe85060a3e1542835f8d84a7e6e2e77ca305251eda0cb3c","0f05c06ff6196958d76b865ae17245b52d8fe01773626ac3c43214a2458ea7b7",{"version":"ae5507fc333d637dec9f37c6b3f4d423105421ea2820a64818de55db85214d66","affectsGlobalScope":true},{"version":"0666f4c99b8688c7be5956df8fecf5d1779d3b22f8f2a88258ae7072c7b6026f","affectsGlobalScope":true},"8abd0566d2854c4bd1c5e48e05df5c74927187f1541e6770001d9637ac41542e","54e854615c4eafbdd3fd7688bd02a3aafd0ccf0e87c98f79d3e9109f047ce6b8","d8dba11dc34d50cb4202de5effa9a1b296d7a2f4a029eec871f894bddfb6430d","8b71dd18e7e63b6f991b511a201fad7c3bf8d1e0dd98acb5e3d844f335a73634","01d8e1419c84affad359cc240b2b551fb9812b450b4d3d456b64cda8102d4f60","8221b00f271cf7f535a8eeec03b0f80f0929c7a16116e2d2df089b41066de69b","269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","7424817d5eb498771e6d1808d726ec38f75d2eaf3fa359edd5c0c540c52725c1","9a9634296cca836c3308923ba7aa094fa6ed76bb1e366d8ddcf5c65888ab1024",{"version":"bddce945d552a963c9733db106b17a25474eefcab7fc990157a2134ef55d4954","affectsGlobalScope":true},{"version":"7052b7b0c3829df3b4985bab2fd74531074b4835d5a7b263b75c82f0916ad62f","affectsGlobalScope":true},"aa34c3aa493d1c699601027c441b9664547c3024f9dbab1639df7701d63d18fa","4b55240c2a03b2c71e98a7fc528b16136faa762211c92e781a01c37821915ea6","7c651f8dce91a927ab62925e73f190763574c46098f2b11fb8ddc1b147a6709a","7440ab60f4cb031812940cc38166b8bb6fbf2540cfe599f87c41c08011f0c1df",{"version":"94c086dff8dbc5998749326bc69b520e8e4273fb5b7b58b50e0210e0885dfcde","affectsGlobalScope":true},{"version":"f5b5dc128973498b75f52b1b8c2d5f8629869104899733ae485100c2309b4c12","affectsGlobalScope":true},"ebe5facd12fd7745cda5f4bc3319f91fb29dc1f96e57e9c6f8b260a7cc5b67ee","79bad8541d5779c85e82a9fb119c1fe06af77a71cc40f869d62ad379473d4b75","37dc027f781c75f0f546e329cfac7cf92a6b289f42458f47a9adc25e516b6839",{"version":"629d20681ca284d9e38c0a019f647108f5fe02f9c59ac164d56f5694fc3faf4d","affectsGlobalScope":true},"e7dbf5716d76846c7522e910896c5747b6df1abd538fee8f5291bdc843461795",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"b510d0a18e3db42ac9765d26711083ec1e8b4e21caaca6dc4d25ae6e8623f447"],"root":[[58,92]],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"module":7,"outDir":"./","rootDir":"..","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"fileIdsList":[[59,61,65],[59,63,64,66,67,68,69,144],[59],[71],[59,70],[73],[59,61,64],[59,144,149,159],[59,61,66,67,69],[61],[75],[68],[76],[59,128],[58,175],[59,61],[60,62],[93],[128],[129,134,162],[130,141,142,149,159,170],[130,131,141,149],[132,171],[133,134,142,150],[134,159,167],[135,137,141,149],[128,136],[137,138],[141],[139,141],[128,141],[141,142,143,159,170],[141,142,143,156,159,162],[126,129,175],[137,141,144,149,159,170],[141,142,144,145,149,159,167,170],[144,146,159,167,170],[93,94,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177],[141,147],[148,170,175],[137,141,149,159],[150],[151],[128,152],[153,169,175],[154],[155],[141,156,157],[156,158,171,173],[129,141,159,160,161,162],[129,159,161],[159,160],[162],[163],[128,159],[141,165,166],[165,166],[134,149,159,167],[168],[149,169],[129,144,155,170],[134,171],[159,172],[148,173],[174],[129,134,141,143,152,159,170,173,175],[159,176],[103,107,170],[103,159,170],[98],[100,103,167,170],[149,167],[178],[98,178],[100,103,149,170],[95,96,99,102,129,141,159,170],[95,101],[99,103,129,162,170,178],[129,178],[119,129,178],[97,98,178],[103],[97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,118,120,121,122,123,124,125],[103,110,111],[101,103,111,112],[102],[95,98,103],[103,107,111,112],[107],[101,103,106,170],[95,100,101,103,107,110],[129,159],[98,103,119,129,175,178],[81,82,83],[59,61,73,82],[59,61,81],[69],[59,61,70,86,87],[86,87,88],[88],[59,61,70],[90],[65],[70],[59,66,69],[58],[73,82],[81],[59,70,87]],"referencedMap":[[66,1],[69,2],[60,3],[72,4],[71,5],[74,6],[75,7],[67,8],[68,9],[76,10],[77,11],[78,12],[79,13],[61,14],[59,15],[80,16],[63,17],[93,18],[94,18],[128,19],[129,20],[130,21],[131,22],[132,23],[133,24],[134,25],[135,26],[136,27],[137,28],[138,28],[140,29],[139,30],[141,31],[142,32],[143,33],[127,34],[144,35],[145,36],[146,37],[178,38],[147,39],[148,40],[149,41],[150,42],[151,43],[152,44],[153,45],[154,46],[155,47],[156,48],[157,48],[158,49],[159,50],[161,51],[160,52],[162,53],[163,54],[164,55],[165,56],[166,57],[167,58],[168,59],[169,60],[170,61],[171,62],[172,63],[173,64],[174,65],[175,66],[176,67],[110,68],[117,69],[109,68],[124,70],[101,71],[100,72],[123,73],[118,74],[121,75],[103,76],[102,77],[98,78],[97,79],[120,80],[99,81],[104,82],[108,82],[126,83],[125,82],[112,84],[113,85],[115,86],[111,87],[114,88],[119,73],[106,89],[107,90],[116,91],[96,92],[122,93],[84,94],[83,95],[82,96],[62,10],[85,97],[88,98],[86,3],[89,99],[87,100],[90,101],[91,102]],"exportedModulesMap":[[66,103],[69,2],[72,4],[71,104],[74,6],[67,8],[68,105],[77,11],[78,12],[79,13],[61,3],[59,106],[80,3],[63,17],[93,18],[94,18],[128,19],[129,20],[130,21],[131,22],[132,23],[133,24],[134,25],[135,26],[136,27],[137,28],[138,28],[140,29],[139,30],[141,31],[142,32],[143,33],[127,34],[144,35],[145,36],[146,37],[178,38],[147,39],[148,40],[149,41],[150,42],[151,43],[152,44],[153,45],[154,46],[155,47],[156,48],[157,48],[158,49],[159,50],[161,51],[160,52],[162,53],[163,54],[164,55],[165,56],[166,57],[167,58],[168,59],[169,60],[170,61],[171,62],[172,63],[173,64],[174,65],[175,66],[176,67],[110,68],[117,69],[109,68],[124,70],[101,71],[100,72],[123,73],[118,74],[121,75],[103,76],[102,77],[98,78],[97,79],[120,80],[99,81],[104,82],[108,82],[126,83],[125,82],[112,84],[113,85],[115,86],[111,87],[114,88],[119,73],[106,89],[107,90],[116,91],[96,92],[122,93],[84,94],[83,107],[82,108],[85,97],[88,109],[86,3],[89,99],[87,100],[90,5],[91,102]],"semanticDiagnosticsPerFile":[64,66,69,60,65,72,71,74,75,67,68,76,77,78,79,61,59,58,73,70,80,63,93,94,128,129,130,131,132,133,134,135,136,137,138,140,139,141,142,143,127,177,144,145,146,178,147,148,149,150,151,152,153,154,155,156,157,158,159,161,160,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,56,57,11,10,2,12,13,14,15,16,17,18,19,3,4,20,24,21,22,23,25,26,27,5,28,29,30,31,6,35,32,33,34,36,7,37,42,43,38,39,40,41,8,47,44,45,46,48,9,49,50,51,54,52,53,1,55,110,117,109,124,101,100,123,118,121,103,102,98,97,120,99,104,105,108,95,126,125,112,113,115,111,114,119,106,107,116,96,122,81,84,83,82,62,85,88,86,89,87,90,91,92],"latestChangedDtsFile":"./validate/mod.d.ts"},"version":"5.3.3"}
@@ -1,9 +1,14 @@
1
1
  import { Gateway } from "../../api/gateway";
2
+ import { Middleware, MiddlewareRequest, HandlerResponse } from "../../api/mod";
2
3
  import { RawRequest, RawResponse } from "../api/node_http";
3
4
  import { setCurrentRequest } from "../reqtrack/mod";
4
5
  import * as runtime from "../runtime/mod";
5
6
 
6
- export type Handler = runtime.ApiRoute;
7
+ export type Handler = {
8
+ apiRoute: runtime.ApiRoute;
9
+ middlewares: Middleware[];
10
+ endpointOptions: EndpointOptions;
11
+ };
7
12
 
8
13
  export function registerHandlers(handlers: Handler[]) {
9
14
  runtime.RT.registerHandlers(handlers.map((h) => transformHandler(h)));
@@ -22,6 +27,13 @@ export async function run() {
22
27
  return runtime.RT.runForever();
23
28
  }
24
29
 
30
+ interface EndpointOptions {
31
+ expose: boolean;
32
+ auth: boolean;
33
+ isRaw: boolean;
34
+ isStream: boolean;
35
+ }
36
+
25
37
  class IterableStream {
26
38
  private stream: runtime.Stream;
27
39
 
@@ -73,13 +85,97 @@ class IterableSocket {
73
85
  }
74
86
  }
75
87
 
76
- function transformHandler(h: Handler): Handler {
77
- if (h.streamingResponse || h.streamingRequest) {
88
+ export interface InternalHandlerResponse {
89
+ payload: any;
90
+ extraHeaders?: Record<string, string | string[]>;
91
+ }
92
+
93
+ // recursively calls all middlewares
94
+ async function invokeMiddlewareChain(
95
+ req: MiddlewareRequest,
96
+ chain: Middleware[],
97
+ handler: () => Promise<any>
98
+ ): Promise<InternalHandlerResponse> {
99
+ const execute = async (
100
+ index: number,
101
+ req: MiddlewareRequest
102
+ ): Promise<HandlerResponse> => {
103
+ const currentMiddleware = chain.at(index);
104
+
105
+ // no more middlewares, execute the handler
106
+ if (currentMiddleware === undefined) {
107
+ return new HandlerResponse(await handler());
108
+ }
109
+
110
+ // execute current middleware
111
+ return currentMiddleware(req, (req) => {
112
+ return execute(index + 1, req);
113
+ });
114
+ };
115
+
116
+ return (await execute(0, req)).__internalToResponse();
117
+ }
118
+
119
+ // calculate what middlewares should run for an endpoint
120
+ function calculateMiddlewareChain(
121
+ endpointOptions: EndpointOptions,
122
+ ms: Middleware[]
123
+ ): Middleware[] {
124
+ let middlewares = [];
125
+
126
+ for (const m of ms) {
127
+ if (m.options === undefined || m.options.target === undefined) {
128
+ middlewares.push(m);
129
+ } else {
130
+ const target = m.options.target;
131
+ // check if options are set and if they match the endpoint options
132
+ if (target.auth !== undefined && target.auth !== endpointOptions.auth) {
133
+ continue;
134
+ }
135
+
136
+ if (
137
+ target.expose !== undefined &&
138
+ target.expose !== endpointOptions.expose
139
+ ) {
140
+ continue;
141
+ }
142
+
143
+ if (
144
+ target.isRaw !== undefined &&
145
+ target.isRaw !== endpointOptions.isRaw
146
+ ) {
147
+ continue;
148
+ }
149
+
150
+ if (
151
+ target.isStream !== undefined &&
152
+ target.isStream !== endpointOptions.isStream
153
+ ) {
154
+ continue;
155
+ }
156
+
157
+ middlewares.push(m);
158
+ }
159
+ }
160
+
161
+ return middlewares;
162
+ }
163
+
164
+ function transformHandler(h: Handler): runtime.ApiRoute {
165
+ const middlewares = calculateMiddlewareChain(
166
+ h.endpointOptions,
167
+ h.middlewares
168
+ );
169
+
170
+ if (h.apiRoute.streamingResponse || h.apiRoute.streamingRequest) {
78
171
  return {
79
- ...h,
172
+ ...h.apiRoute,
80
173
  // req is the upgrade request.
81
174
  // stream is either a bidirectional stream, in stream or out stream.
82
- handler: (req: runtime.Request, stream: unknown) => {
175
+ handler: (
176
+ req: runtime.Request,
177
+ stream: runtime.Sink | runtime.Stream | runtime.Socket
178
+ ) => {
83
179
  setCurrentRequest(req);
84
180
 
85
181
  // make readable streams async iterators
@@ -90,36 +186,89 @@ function transformHandler(h: Handler): Handler {
90
186
  stream = new IterableSocket(stream);
91
187
  }
92
188
 
93
- // handshake payload
94
- const payload = req.payload();
95
- return payload !== null
96
- ? h.handler(payload, stream)
97
- : h.handler(stream);
189
+ if (middlewares.length === 0) {
190
+ const payload = req.payload();
191
+ return toResponse(
192
+ payload !== null
193
+ ? h.apiRoute.handler(payload, stream)
194
+ : h.apiRoute.handler(stream)
195
+ );
196
+ }
197
+
198
+ const handler = async () => {
199
+ // handshake payload
200
+ const payload = req.payload();
201
+ return payload !== null
202
+ ? h.apiRoute.handler(payload, stream)
203
+ : h.apiRoute.handler(stream);
204
+ };
205
+
206
+ const mwRequest = new MiddlewareRequest(stream, undefined, undefined);
207
+ return invokeMiddlewareChain(mwRequest, middlewares, handler);
98
208
  }
99
209
  };
100
210
  }
101
211
 
102
- if (h.raw) {
212
+ if (h.apiRoute.raw) {
103
213
  return {
104
- ...h,
214
+ ...h.apiRoute,
105
215
  handler: (
106
216
  req: runtime.Request,
107
217
  resp: runtime.ResponseWriter,
108
218
  body: runtime.BodyReader
109
219
  ) => {
110
220
  setCurrentRequest(req);
221
+
111
222
  const rawReq = new RawRequest(req, body);
112
223
  const rawResp = new RawResponse(rawReq, resp);
113
- return h.handler(rawReq, rawResp);
224
+
225
+ if (middlewares.length === 0) {
226
+ return toResponse(h.apiRoute.handler(rawReq, rawResp));
227
+ }
228
+
229
+ const handler = async () => {
230
+ return h.apiRoute.handler(rawReq, rawResp);
231
+ };
232
+
233
+ const mwRequest = new MiddlewareRequest(undefined, rawReq, rawResp);
234
+ return invokeMiddlewareChain(mwRequest, middlewares, handler);
114
235
  }
115
236
  };
116
237
  }
238
+
117
239
  return {
118
- ...h,
240
+ ...h.apiRoute,
119
241
  handler: (req: runtime.Request) => {
120
242
  setCurrentRequest(req);
121
- const payload = req.payload();
122
- return payload !== null ? h.handler(payload) : h.handler();
243
+
244
+ if (middlewares.length === 0) {
245
+ const payload = req.payload();
246
+ return toResponse(
247
+ payload !== null ? h.apiRoute.handler(payload) : h.apiRoute.handler()
248
+ );
249
+ }
250
+
251
+ const handler = async () => {
252
+ const payload = req.payload();
253
+ return payload !== null
254
+ ? h.apiRoute.handler(payload)
255
+ : h.apiRoute.handler();
256
+ };
257
+
258
+ const mwRequest = new MiddlewareRequest(undefined, undefined, undefined);
259
+ return invokeMiddlewareChain(mwRequest, middlewares, handler);
123
260
  }
124
261
  };
125
262
  }
263
+
264
+ function toResponse(
265
+ payload: any
266
+ ): InternalHandlerResponse | Promise<InternalHandlerResponse> {
267
+ if (payload instanceof Promise) {
268
+ return payload.then((payload) => {
269
+ return new HandlerResponse(payload).__internalToResponse();
270
+ });
271
+ } else {
272
+ return new HandlerResponse(payload).__internalToResponse();
273
+ }
274
+ }
@@ -1,3 +1,4 @@
1
+ import { isMainThread } from "node:worker_threads";
1
2
  import { Runtime } from "./napi/napi.cjs";
2
3
 
3
4
  export * from "./napi/napi.cjs";
@@ -6,4 +7,5 @@ const testMode = process.env.NODE_ENV === "test";
6
7
 
7
8
  export const RT = new Runtime({
8
9
  testMode,
10
+ isWorker: !isMainThread && !testMode,
9
11
  });
@@ -1,5 +1,5 @@
1
1
  // The version of the runtime this JS bundle was generated for.
2
- const version = "v1.44.9-beta.2";
2
+ const version = "v1.44.10";
3
3
 
4
4
  // Load the native module.
5
5
  const nativeModulePath = process.env.ENCORE_RUNTIME_LIB;
@@ -23,6 +23,7 @@ export interface ApiDesc {
23
23
  service: string
24
24
  endpoint: string
25
25
  raw: boolean
26
+ requiresAuth: boolean
26
27
  }
27
28
 
28
29
  export interface ApiRoute {
@@ -247,6 +248,7 @@ export class Runtime {
247
248
 
248
249
  export interface RuntimeOptions {
249
250
  testMode?: boolean
251
+ isWorker?: boolean
250
252
  }
251
253
 
252
254
  export class Secret {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "encore.dev",
3
3
  "description": "Encore's JavaScript/TypeScript SDK",
4
- "version": "1.44.9-beta.2",
4
+ "version": "1.44.10",
5
5
  "license": "MPL-2.0",
6
6
  "bugs": {
7
7
  "url": "https://github.com/encoredev/encore/issues"
package/req_meta.ts CHANGED
@@ -10,6 +10,9 @@ export interface APIDesc {
10
10
 
11
11
  /** Whether the endpoint is a raw endpoint. */
12
12
  raw: boolean;
13
+
14
+ /** Whether the endpoint requires auth. */
15
+ auth: boolean;
13
16
  }
14
17
 
15
18
  export type Method =
@@ -153,7 +156,7 @@ export function currentRequest(): RequestMeta | undefined {
153
156
  const meta = req.meta();
154
157
 
155
158
  const base: BaseRequestMeta = {
156
- trace: meta.trace,
159
+ trace: meta.trace
157
160
  };
158
161
 
159
162
  if (meta.apiCall) {
@@ -163,13 +166,14 @@ export function currentRequest(): RequestMeta | undefined {
163
166
  service: meta.apiCall.api.service,
164
167
  endpoint: meta.apiCall.api.endpoint,
165
168
  raw: meta.apiCall.api.raw,
169
+ auth: meta.apiCall.api.requiresAuth
166
170
  },
167
171
  method: meta.apiCall.method as Method,
168
172
  path: meta.apiCall.path,
169
173
  pathAndQuery: meta.apiCall.pathAndQuery,
170
174
  pathParams: meta.apiCall.pathParams ?? {},
171
175
  parsedPayload: meta.apiCall.parsedPayload,
172
- headers: meta.apiCall.headers,
176
+ headers: meta.apiCall.headers
173
177
  };
174
178
  return { ...base, ...api };
175
179
  } else if (meta.pubsubMessage) {
@@ -180,7 +184,7 @@ export function currentRequest(): RequestMeta | undefined {
180
184
  subscription: meta.pubsubMessage.subscription,
181
185
  messageId: meta.pubsubMessage.id,
182
186
  deliveryAttempt: meta.pubsubMessage.deliveryAttempt,
183
- parsedPayload: meta.pubsubMessage.parsedPayload,
187
+ parsedPayload: meta.pubsubMessage.parsedPayload
184
188
  };
185
189
  return { ...base, ...msg };
186
190
  } else {
package/service/mod.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Middleware } from "../api/mod";
2
+
1
3
  /**
2
4
  * Defines an Encore backend service.
3
5
  *
@@ -17,4 +19,6 @@ export class Service {
17
19
  }
18
20
  }
19
21
 
20
- export interface ServiceConfig {}
22
+ export interface ServiceConfig {
23
+ middlewares?: Middleware[];
24
+ }