gemi 0.4.16 → 0.4.18

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.
@@ -1,91 +1,10 @@
1
- import {createRequire} from "node:module";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getProtoOf = Object.getPrototypeOf;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
17
- };
18
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
- var __require = createRequire(import.meta.url);
20
-
21
- // http/requestContext.ts
22
- import {AsyncLocalStorage} from "async_hooks";
23
-
24
- // http/Cookie.ts
25
- class Cookie {
26
- name;
27
- value;
28
- options;
29
- constructor(name, value, options = {}) {
30
- this.name = name;
31
- this.value = value;
32
- this.options = options;
33
- }
34
- toString() {
35
- return [
36
- `${this.name}=${this.value}`,
37
- this.options.maxAge ? `Max-Age=${this.options.maxAge}` : "",
38
- this.options.httpOnly ? "HttpOnly" : "",
39
- this.options.secure ? "Secure" : "",
40
- this.options.sameSite ? `SameSite=${this.options.sameSite}` : "SameSite=Strict",
41
- this.options.path ? `Path=${this.options.path}` : "Path=/",
42
- this.options.domain ? `Domain=${this.options.domain}` : "",
43
- this.options.expires ? `Expires=${this.options.expires.toUTCString()}` : "",
44
- this.options.partitioned ? "Partitioned" : ""
45
- ].filter((i) => i !== "").join("; ");
46
- }
47
- }
48
-
49
- // http/requestContext.ts
50
- var requestContext = new AsyncLocalStorage;
51
-
52
- class Store {
53
- cookies = new Set;
54
- user = null;
55
- req = null;
56
- constructor() {
57
- }
58
- setCookie(name, value, options = {}) {
59
- this.cookies.add(new Cookie(name, value, options));
60
- }
61
- setUser(user) {
62
- this.user = user;
63
- }
64
- setRequest(req) {
65
- this.req = req;
66
- }
67
- }
68
-
69
- class RequestContext {
70
- static getStore() {
71
- return requestContext.getStore();
72
- }
73
- static setRequest(req) {
74
- requestContext.getStore().req = req;
75
- }
76
- static async run(fn) {
77
- return requestContext.run(new Store, fn);
78
- }
79
- }
80
-
81
- // kernel/context.ts
82
- import {AsyncLocalStorage as AsyncLocalStorage2} from "async_hooks";
83
- var kernelContext = new AsyncLocalStorage2;
84
-
85
- // kernel/KernelContext.ts
86
- class KernelContext {
87
- static getStore = () => kernelContext.getStore();
88
- }
1
+ // @bun
2
+ import {
3
+ KernelContext,
4
+ RequestBreakerError,
5
+ RequestContext
6
+ } from "../chunk-fa40971555060604.js";
7
+ import"../chunk-970e033f764e29fc.js";
89
8
 
90
9
  // facades/Auth.ts
91
10
  class Auth {
@@ -108,17 +27,6 @@ class Auth {
108
27
  return null;
109
28
  }
110
29
  }
111
- // http/Error.ts
112
- var GEMI_REQUEST_BREAKER_ERROR = "GEMI_REQUEST_BREAKER_ERROR";
113
-
114
- class RequestBreakerError extends Error {
115
- constructor() {
116
- super(...arguments);
117
- }
118
- kind = GEMI_REQUEST_BREAKER_ERROR;
119
- payload = { api: {}, view: {} };
120
- }
121
-
122
30
  // facades/Redirect.ts
123
31
  class RedirectError extends RequestBreakerError {
124
32
  constructor(path) {
@@ -149,3 +57,4 @@ export {
149
57
  Redirect,
150
58
  Auth
151
59
  };
60
+ export { Auth };
@@ -1,22 +1,10 @@
1
- import {createRequire} from "node:module";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getProtoOf = Object.getPrototypeOf;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
17
- };
18
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
- var __require = createRequire(import.meta.url);
1
+ // @bun
2
+ import {
3
+ KernelContext,
4
+ RequestBreakerError,
5
+ RequestContext
6
+ } from "../chunk-fa40971555060604.js";
7
+ import"../chunk-970e033f764e29fc.js";
20
8
 
21
9
  // http/Controller.ts
22
10
  class Controller {
@@ -193,17 +181,6 @@ class ViewRouter {
193
181
  };
194
182
  }
195
183
  }
196
- // http/Error.ts
197
- var GEMI_REQUEST_BREAKER_ERROR = "GEMI_REQUEST_BREAKER_ERROR";
198
-
199
- class RequestBreakerError extends Error {
200
- constructor() {
201
- super(...arguments);
202
- }
203
- kind = GEMI_REQUEST_BREAKER_ERROR;
204
- payload = { api: {}, view: {} };
205
- }
206
-
207
184
  // http/Router.ts
208
185
  class AuthenticationError extends RequestBreakerError {
209
186
  constructor() {
@@ -250,66 +227,6 @@ class ValidationError extends RequestBreakerError {
250
227
  };
251
228
  }
252
229
  }
253
- // http/requestContext.ts
254
- import {AsyncLocalStorage} from "async_hooks";
255
-
256
- // http/Cookie.ts
257
- class Cookie {
258
- name;
259
- value;
260
- options;
261
- constructor(name, value, options = {}) {
262
- this.name = name;
263
- this.value = value;
264
- this.options = options;
265
- }
266
- toString() {
267
- return [
268
- `${this.name}=${this.value}`,
269
- this.options.maxAge ? `Max-Age=${this.options.maxAge}` : "",
270
- this.options.httpOnly ? "HttpOnly" : "",
271
- this.options.secure ? "Secure" : "",
272
- this.options.sameSite ? `SameSite=${this.options.sameSite}` : "SameSite=Strict",
273
- this.options.path ? `Path=${this.options.path}` : "Path=/",
274
- this.options.domain ? `Domain=${this.options.domain}` : "",
275
- this.options.expires ? `Expires=${this.options.expires.toUTCString()}` : "",
276
- this.options.partitioned ? "Partitioned" : ""
277
- ].filter((i) => i !== "").join("; ");
278
- }
279
- }
280
-
281
- // http/requestContext.ts
282
- var requestContext = new AsyncLocalStorage;
283
-
284
- class Store {
285
- cookies = new Set;
286
- user = null;
287
- req = null;
288
- constructor() {
289
- }
290
- setCookie(name, value, options = {}) {
291
- this.cookies.add(new Cookie(name, value, options));
292
- }
293
- setUser(user) {
294
- this.user = user;
295
- }
296
- setRequest(req) {
297
- this.req = req;
298
- }
299
- }
300
-
301
- class RequestContext {
302
- static getStore() {
303
- return requestContext.getStore();
304
- }
305
- static setRequest(req) {
306
- requestContext.getStore().req = req;
307
- }
308
- static async run(fn) {
309
- return requestContext.run(new Store, fn);
310
- }
311
- }
312
-
313
230
  // http/HttpRequest.ts
314
231
  var validate = function(ruleName) {
315
232
  const [rule, param] = ruleName.split(":");
@@ -495,15 +412,6 @@ function getCookies(req) {
495
412
  class MiddlewareServiceProvider {
496
413
  aliases = {};
497
414
  }
498
- // kernel/context.ts
499
- import {AsyncLocalStorage as AsyncLocalStorage2} from "async_hooks";
500
- var kernelContext = new AsyncLocalStorage2;
501
-
502
- // kernel/KernelContext.ts
503
- class KernelContext {
504
- static getStore = () => kernelContext.getStore();
505
- }
506
-
507
415
  // http/AuthenticationMiddlware.ts
508
416
  class AuthenticationMiddleware extends Middleware {
509
417
  constructor() {
@@ -544,3 +452,4 @@ export {
544
452
  AuthenticationError,
545
453
  ApiRouter
546
454
  };
455
+ export { Controller, isConstructor, ApiRouter, ViewRouter, HttpRequest, MiddlewareServiceProvider };