@arkstack/driver-h3 0.12.19 → 0.12.20

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.
Files changed (2) hide show
  1. package/dist/index.js +35 -1
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -65,7 +65,7 @@ const defaultErrorHandler = async (err, event) => {
65
65
  });
66
66
  };
67
67
  //#endregion
68
- //#region ../http/dist/redirect-C1kZMywY.js
68
+ //#region ../http/dist/redirect-C1DNCiO9.js
69
69
  const unwrapRequestSource = (source) => {
70
70
  if (source.headers) return source;
71
71
  if (source.req) return source.req;
@@ -119,6 +119,8 @@ var Request$1 = class Request$1 extends Request {
119
119
  ip;
120
120
  source;
121
121
  user;
122
+ auth;
123
+ authUser;
122
124
  authToken;
123
125
  constructor(options = {}) {
124
126
  super(options);
@@ -128,6 +130,8 @@ var Request$1 = class Request$1 extends Request {
128
130
  if (this.path) this.path = options.path;
129
131
  this.ip = options.ip ?? null;
130
132
  this.user = options.user;
133
+ this.auth = options.auth;
134
+ this.authUser = options.authUser;
131
135
  this.authToken = options.authToken;
132
136
  this.source = options.source;
133
137
  globalThis.request = (key) => key ? this.input(key) : this;
@@ -143,6 +147,8 @@ var Request$1 = class Request$1 extends Request {
143
147
  path: request.path,
144
148
  ip: request.ip ?? null,
145
149
  user: request.user,
150
+ auth: request.auth,
151
+ authUser: request.authUser,
146
152
  authToken: request.authToken,
147
153
  source
148
154
  });
@@ -160,6 +166,31 @@ var Request$1 = class Request$1 extends Request {
160
166
  if (isRecord(this.source)) this.source.user = user;
161
167
  return this;
162
168
  }
169
+ setAuthentication(auth, user, token) {
170
+ this.auth = auth;
171
+ this.authUser = user;
172
+ this.authToken = token;
173
+ this.setUser(user);
174
+ if (isRecord(this.source)) {
175
+ this.source.auth = auth;
176
+ this.source.authUser = user;
177
+ this.source.authToken = token;
178
+ }
179
+ return this;
180
+ }
181
+ clearAuthentication() {
182
+ this.auth = void 0;
183
+ this.authUser = void 0;
184
+ this.authToken = void 0;
185
+ this.user = void 0;
186
+ if (isRecord(this.source)) {
187
+ this.source.auth = void 0;
188
+ this.source.authUser = void 0;
189
+ this.source.authToken = void 0;
190
+ this.source.user = void 0;
191
+ }
192
+ return this;
193
+ }
163
194
  };
164
195
  var FlashBag = class {
165
196
  bag = {};
@@ -1179,6 +1210,9 @@ definePlugin({
1179
1210
  registerResponseFlashSweep(ctx, session);
1180
1211
  return session;
1181
1212
  });
1213
+ bind(Request$1, ({ request, ctx }) => {
1214
+ return request instanceof Request$1 ? request : Request$1.from(request ?? ctx);
1215
+ });
1182
1216
  useHttpContext((context) => {
1183
1217
  const session = getSession(context.ctx);
1184
1218
  if (session) {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@arkstack/driver-h3",
3
- "version": "0.12.19",
3
+ "version": "0.12.20",
4
4
  "type": "module",
5
5
  "description": "H3 driver for Arkstack, providing H3-based runtime integration for the framework.",
6
6
  "homepage": "https://arkstack.toneflix.net",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/arkstack-tmp/arkstack.git",
9
+ "url": "git+https://github.com/arkstack-hq/arkstack.git",
10
10
  "directory": "packages/driver-h3"
11
11
  },
12
12
  "keywords": [
@@ -38,15 +38,15 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "clear-router": "^2.8.6",
41
- "@resora/plugin-clear-router": "^1.0.46",
42
- "resora": "^1.3.14",
43
- "@arkstack/contract": "^0.12.19"
41
+ "@resora/plugin-clear-router": "^1.0.48",
42
+ "resora": "^1.3.16",
43
+ "@arkstack/contract": "^0.12.20"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "h3": "2.0.1-rc.22",
47
- "@arkstack/common": "^0.12.19",
48
- "@arkstack/foundry": "^0.12.19",
49
- "@arkstack/auth": "^0.12.19"
47
+ "@arkstack/auth": "^0.12.20",
48
+ "@arkstack/foundry": "^0.12.20",
49
+ "@arkstack/common": "^0.12.20"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@arkstack/auth": {