@getstrata/core 0.5.56 → 0.5.57
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/README.md +1 -1
- package/dist/{domain/abilities.d.ts → core/auth/abilityCatalog.d.ts} +9 -1
- package/dist/core/auth/accessControl.d.ts +1 -1
- package/dist/core/auth/membershipContext.d.ts +6 -4
- package/dist/core/auth/membershipService.d.ts +5 -6
- package/dist/core/contracts/authUserDirectory.d.ts +11 -0
- package/dist/core/contracts/membership.d.ts +20 -0
- package/dist/core/http/clientIp.d.ts +3 -0
- package/dist/core/jobs/dispatchWebhookJob.d.ts +2 -0
- package/dist/core/tenant/tenancyConfig.d.ts +5 -0
- package/dist/core/tenant/tenantMiddleware.d.ts +1 -1
- package/dist/entries/auth/membershipMiddleware.js +21 -161
- package/dist/entries/auth/membershipScope.js +20 -160
- package/dist/entries/auth/membershipService.js +21 -161
- package/dist/entries/auth/scimAuthMiddleware.js +22 -4
- package/dist/entries/auth/sessionGuard.js +12 -258
- package/dist/entries/http/clientIp.js +19 -0
- package/dist/entries/http/csrfMiddleware.js +2 -1
- package/dist/entries/http/csrfToken.js +2 -1
- package/dist/entries/http/loginThrottleMiddleware.js +18 -1
- package/dist/entries/http/memoryThrottleMiddleware.js +16 -1
- package/dist/entries/http/response.js +28 -297
- package/dist/entries/http/scimThrottleMiddleware.js +40 -1
- package/dist/entries/http/throttleMiddleware.js +18 -1
- package/dist/entries/http/webErrorResponse.js +28 -297
- package/dist/entries/jobs/dispatchWebhookJob.js +111 -5
- package/dist/entries/logging/requestLoggingMiddleware.js +16 -1
- package/dist/entries/security/scimTenantTokens.js +1 -4
- package/dist/entries/tenant/tenancyConfig.js +12 -0
- package/dist/entries/tenant/tenantDatabaseScope.js +11 -0
- package/dist/entries/view.js +26 -295
- package/dist/framework/public-api.d.ts +4 -1
- package/dist/index.js +2186 -2243
- package/package.json +12 -2
- package/dist/config/database.d.ts +0 -10
- package/dist/db/connection/createConnection.d.ts +0 -6
- package/dist/db/connection/index.d.ts +0 -11
- package/dist/domain/auth.d.ts +0 -4
- package/dist/domain/scim.d.ts +0 -9
- package/dist/modules/organization/memberRepository.d.ts +0 -14
- package/dist/modules/organization/memberTypes.d.ts +0 -9
- package/dist/modules/user/apiTokenRepository.d.ts +0 -8
- package/dist/modules/user/apiTokenTable.d.ts +0 -3
- package/dist/modules/user/authService.d.ts +0 -23
- package/dist/modules/user/notificationRepository.d.ts +0 -6
- package/dist/modules/user/notificationService.d.ts +0 -25
- package/dist/modules/user/notificationTable.d.ts +0 -3
- package/dist/modules/user/notificationTypes.d.ts +0 -12
- package/dist/modules/user/oauthIdentityRepository.d.ts +0 -9
- package/dist/modules/user/provider.d.ts +0 -11
- package/dist/modules/user/repository.d.ts +0 -13
- package/dist/modules/user/table.d.ts +0 -3
- package/dist/modules/user/tokenService.d.ts +0 -29
- package/dist/modules/user/types.d.ts +0 -46
package/dist/entries/view.js
CHANGED
|
@@ -229,298 +229,14 @@ function isHtmxRequest(request) {
|
|
|
229
229
|
import { currentAuthUser } from "@getstrata/core/auth/authContext";
|
|
230
230
|
import { currentRequestMeta as currentRequestMeta2 } from "@getstrata/core/http/requestMetaContext";
|
|
231
231
|
|
|
232
|
-
// ../../src/
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
CORE_TOKEN_SERVICE_TOKEN
|
|
241
|
-
} from "@getstrata/core/contracts/serviceTokens";
|
|
242
|
-
var DEFAULT_QUEUE_DRIVER = "sync";
|
|
243
|
-
|
|
244
|
-
// ../../src/modules/user/provider.ts
|
|
245
|
-
import { OidcProvider } from "@getstrata/core/auth/oauth/oidcProvider";
|
|
246
|
-
import { GitHubOAuthProvider, MockOAuthProvider } from "@getstrata/core/auth/oauth/providers";
|
|
247
|
-
import { SamlProvider } from "@getstrata/core/auth/oauth/samlProvider";
|
|
248
|
-
|
|
249
|
-
// ../../src/config/features.ts
|
|
250
|
-
function readFeatureFlags() {
|
|
251
|
-
return {
|
|
252
|
-
webhooks: (process.env.FEATURE_WEBHOOKS ?? "true") !== "false",
|
|
253
|
-
fullTextSearch: (process.env.FEATURE_SEARCH ?? "true") !== "false",
|
|
254
|
-
auditLog: (process.env.FEATURE_AUDIT_LOG ?? "true") !== "false",
|
|
255
|
-
oauthLogin: (process.env.FEATURE_OAUTH ?? "true") !== "false",
|
|
256
|
-
samlLogin: (process.env.FEATURE_SAML ?? "false") === "true",
|
|
257
|
-
scim: (process.env.FEATURE_SCIM ?? "true") !== "false",
|
|
258
|
-
billing: (process.env.FEATURE_BILLING ?? "true") !== "false",
|
|
259
|
-
siemExport: (process.env.FEATURE_SIEM_EXPORT ?? "true") !== "false",
|
|
260
|
-
publicReads: (process.env.FEATURE_PUBLIC_READS ?? "true") !== "false",
|
|
261
|
-
emailVerification: (process.env.FEATURE_EMAIL_VERIFICATION ?? "false") === "true",
|
|
262
|
-
mfa: (process.env.FEATURE_MFA ?? "false") === "true"
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
var featureFlags = readFeatureFlags();
|
|
266
|
-
function isFeatureEnabled(feature) {
|
|
267
|
-
return readFeatureFlags()[feature];
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// ../../src/modules/user/apiTokenRepository.ts
|
|
271
|
-
import { BaseRepository } from "@getstrata/core/database/baseRepository";
|
|
272
|
-
|
|
273
|
-
// ../../src/config/database.ts
|
|
274
|
-
function readInteger(name, fallback) {
|
|
275
|
-
const parsed = Number.parseInt(process.env[name] ?? String(fallback), 10);
|
|
276
|
-
return Number.isInteger(parsed) && parsed >= 0 ? parsed : fallback;
|
|
277
|
-
}
|
|
278
|
-
var databaseConfig = {
|
|
279
|
-
url: process.env.DATABASE_URL ?? "",
|
|
280
|
-
poolMax: readInteger("DB_POOL_MAX", 10),
|
|
281
|
-
idleTimeoutSeconds: readInteger("DB_POOL_IDLE_TIMEOUT", 30),
|
|
282
|
-
maxLifetimeSeconds: readInteger("DB_POOL_MAX_LIFETIME", 3600),
|
|
283
|
-
connectionTimeoutSeconds: readInteger("DB_CONNECTION_TIMEOUT", 10)
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
// ../../src/core/runtime/asyncContextStore.ts
|
|
287
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
288
|
-
function createAsyncContextStore(key) {
|
|
289
|
-
const symbol = Symbol.for(key);
|
|
290
|
-
const globalRecord = globalThis;
|
|
291
|
-
const existing = globalRecord[symbol];
|
|
292
|
-
if (existing) {
|
|
293
|
-
return existing;
|
|
294
|
-
}
|
|
295
|
-
const store = new AsyncLocalStorage;
|
|
296
|
-
globalRecord[symbol] = store;
|
|
297
|
-
return store;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// ../../src/core/database/connectionContext.ts
|
|
301
|
-
var activeConnection = createAsyncContextStore("@getstrata/databaseConnectionContext");
|
|
302
|
-
function runWithDatabaseConnection(connection, callback) {
|
|
303
|
-
return activeConnection.run(connection, callback);
|
|
304
|
-
}
|
|
305
|
-
function getActiveDatabaseConnection(fallback) {
|
|
306
|
-
return activeConnection.getStore() ?? fallback;
|
|
307
|
-
}
|
|
308
|
-
function hasActiveDatabaseConnection() {
|
|
309
|
-
return activeConnection.getStore() !== undefined;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// ../../src/core/database/queryProxy.ts
|
|
313
|
-
var POOL_CONNECTION_METHODS = new Set(["begin", "close", "connect"]);
|
|
314
|
-
function createDatabaseQueryProxy(pool) {
|
|
315
|
-
function resolveDatabase() {
|
|
316
|
-
return getActiveDatabaseConnection(pool);
|
|
317
|
-
}
|
|
318
|
-
function resolveDatabaseForProperty(property) {
|
|
319
|
-
if (typeof property === "string" && POOL_CONNECTION_METHODS.has(property)) {
|
|
320
|
-
return pool;
|
|
321
|
-
}
|
|
322
|
-
return resolveDatabase();
|
|
323
|
-
}
|
|
324
|
-
return new Proxy(function database() {}, {
|
|
325
|
-
apply(_target, _thisArg, args) {
|
|
326
|
-
return resolveDatabase()(...args);
|
|
327
|
-
},
|
|
328
|
-
get(_target, property) {
|
|
329
|
-
const connection = resolveDatabaseForProperty(property);
|
|
330
|
-
const value = connection[property];
|
|
331
|
-
return typeof value === "function" ? value.bind(connection) : value;
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
// ../../src/core/database/defaultConnection.ts
|
|
337
|
-
var defaultPool = {
|
|
338
|
-
connection: null
|
|
339
|
-
};
|
|
340
|
-
var defaultQuery = {
|
|
341
|
-
connection: null
|
|
342
|
-
};
|
|
343
|
-
function registerDefaultDatabasePool(connection) {
|
|
344
|
-
defaultPool.connection = connection;
|
|
345
|
-
defaultQuery.connection = createDatabaseQueryProxy(connection);
|
|
346
|
-
}
|
|
347
|
-
function getDefaultDatabaseQuery() {
|
|
348
|
-
if (!defaultQuery.connection) {
|
|
349
|
-
throw new Error("Default database query handle is not registered. Call registerDefaultDatabasePool() during app bootstrap.");
|
|
350
|
-
}
|
|
351
|
-
return defaultQuery.connection;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// ../../src/db/connection/createConnection.ts
|
|
355
|
-
var {SQL } = globalThis.Bun;
|
|
356
|
-
function createDatabaseConnection(config) {
|
|
357
|
-
if (!config.url) {
|
|
358
|
-
throw new Error("DATABASE_URL is not configured. Set DATABASE_URL before starting the app or running integration tests.");
|
|
359
|
-
}
|
|
360
|
-
return new SQL({
|
|
361
|
-
url: config.url,
|
|
362
|
-
max: config.poolMax,
|
|
363
|
-
idleTimeout: config.idleTimeoutSeconds,
|
|
364
|
-
maxLifetime: config.maxLifetimeSeconds,
|
|
365
|
-
connectionTimeout: config.connectionTimeoutSeconds
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// ../../src/db/connection/index.ts
|
|
370
|
-
var connectionHolder = {
|
|
371
|
-
connection: null
|
|
372
|
-
};
|
|
373
|
-
function getDatabase() {
|
|
374
|
-
if (!connectionHolder.connection) {
|
|
375
|
-
connectionHolder.connection = createDatabaseConnection(databaseConfig);
|
|
376
|
-
registerDefaultDatabasePool(connectionHolder.connection);
|
|
377
|
-
}
|
|
378
|
-
return connectionHolder.connection;
|
|
379
|
-
}
|
|
380
|
-
function getDb() {
|
|
381
|
-
getDatabase();
|
|
382
|
-
return getDefaultDatabaseQuery();
|
|
383
|
-
}
|
|
384
|
-
var db = new Proxy(function database() {}, {
|
|
385
|
-
apply(_target, _thisArg, args) {
|
|
386
|
-
return getDb()(...args);
|
|
387
|
-
},
|
|
388
|
-
get(_target, property) {
|
|
389
|
-
const connection = getDb();
|
|
390
|
-
const value = connection[property];
|
|
391
|
-
return typeof value === "function" ? value.bind(connection) : value;
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
var connection_default = db;
|
|
395
|
-
|
|
396
|
-
// ../../src/modules/user/apiTokenTable.ts
|
|
397
|
-
import { defineTable } from "@getstrata/core/database/table";
|
|
398
|
-
var apiTokenTable = defineTable({
|
|
399
|
-
name: "api_token",
|
|
400
|
-
primaryKey: "id",
|
|
401
|
-
columns: [
|
|
402
|
-
"id",
|
|
403
|
-
"user_id",
|
|
404
|
-
"name",
|
|
405
|
-
"token_hash",
|
|
406
|
-
"abilities",
|
|
407
|
-
"last_used_at",
|
|
408
|
-
"expires_at",
|
|
409
|
-
"created_at"
|
|
410
|
-
],
|
|
411
|
-
defaultOrderBy: { column: "id", direction: "ASC" }
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
// ../../src/modules/user/authService.ts
|
|
415
|
-
import { verifyPassword } from "@getstrata/core/auth/password";
|
|
416
|
-
import { revealMfaSecret } from "@getstrata/core/crypto/mfaSecret";
|
|
417
|
-
import { UnauthorizedError } from "@getstrata/core/errors/http";
|
|
418
|
-
import { logSecurityEvent } from "@getstrata/core/security/securityEvents";
|
|
419
|
-
import { resolveDefaultTokenExpiryDays } from "@getstrata/core/security/tokenExpiry";
|
|
420
|
-
import { verifyTotp } from "@getstrata/core/security/totp";
|
|
421
|
-
import { currentTenantId } from "@getstrata/core/tenant/tenantContext";
|
|
422
|
-
|
|
423
|
-
// ../../src/domain/abilities.ts
|
|
424
|
-
var MEMBER_ABILITIES = [
|
|
425
|
-
"organizations:read",
|
|
426
|
-
"projects:read",
|
|
427
|
-
"projects:create",
|
|
428
|
-
"tasks:read",
|
|
429
|
-
"tasks:create",
|
|
430
|
-
"comments:read",
|
|
431
|
-
"comments:create",
|
|
432
|
-
"attachments:read",
|
|
433
|
-
"attachments:create",
|
|
434
|
-
"auth:tokens:read",
|
|
435
|
-
"auth:tokens:write"
|
|
436
|
-
];
|
|
437
|
-
var ADMIN_ABILITIES = [
|
|
438
|
-
...MEMBER_ABILITIES,
|
|
439
|
-
"organizations:create",
|
|
440
|
-
"organizations:update",
|
|
441
|
-
"organizations:delete",
|
|
442
|
-
"projects:update",
|
|
443
|
-
"projects:delete",
|
|
444
|
-
"tasks:update",
|
|
445
|
-
"tasks:delete",
|
|
446
|
-
"comments:update",
|
|
447
|
-
"comments:delete",
|
|
448
|
-
"attachments:delete",
|
|
449
|
-
"webhooks:read",
|
|
450
|
-
"webhooks:write",
|
|
451
|
-
"audit:read"
|
|
452
|
-
];
|
|
453
|
-
var PLATFORM_ADMIN_ABILITIES = ["*"];
|
|
454
|
-
function resolveAbilitiesForRole(role) {
|
|
455
|
-
if (role === "admin") {
|
|
456
|
-
return [...PLATFORM_ADMIN_ABILITIES];
|
|
457
|
-
}
|
|
458
|
-
return [...MEMBER_ABILITIES];
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// ../../src/modules/user/notificationRepository.ts
|
|
462
|
-
import { BaseRepository as BaseRepository2 } from "@getstrata/core/database/baseRepository";
|
|
463
|
-
|
|
464
|
-
// ../../src/modules/user/notificationTable.ts
|
|
465
|
-
import { defineTable as defineTable2 } from "@getstrata/core/database/table";
|
|
466
|
-
var notificationTable = defineTable2({
|
|
467
|
-
name: "notification",
|
|
468
|
-
primaryKey: "id",
|
|
469
|
-
columns: ["id", "user_id", "tenant_id", "type", "title", "body", "data", "read_at", "created_at"],
|
|
470
|
-
defaultOrderBy: { column: "created_at", direction: "DESC" }
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
// ../../src/modules/user/notificationService.ts
|
|
474
|
-
import { NotFoundError } from "@getstrata/core/errors/http";
|
|
475
|
-
|
|
476
|
-
// ../../src/modules/user/oauthIdentityRepository.ts
|
|
477
|
-
import { BaseRepository as BaseRepository3 } from "@getstrata/core/database/baseRepository";
|
|
478
|
-
import { defineTable as defineTable3 } from "@getstrata/core/database/table";
|
|
479
|
-
var oauthIdentityTable = defineTable3({
|
|
480
|
-
name: "oauth_identity",
|
|
481
|
-
primaryKey: "id",
|
|
482
|
-
columns: ["id", "user_id", "provider", "provider_user_id", "email", "created_at"]
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
// ../../src/modules/user/repository.ts
|
|
486
|
-
import {
|
|
487
|
-
emailLookupForQuery,
|
|
488
|
-
protectEmail,
|
|
489
|
-
revealEmail
|
|
490
|
-
} from "@getstrata/core/crypto/fieldEncryption";
|
|
491
|
-
import { revealMfaSecret as revealMfaSecret2 } from "@getstrata/core/crypto/mfaSecret";
|
|
492
|
-
import { BaseRepository as BaseRepository4 } from "@getstrata/core/database/baseRepository";
|
|
493
|
-
import { currentTenantId as currentTenantId2 } from "@getstrata/core/tenant/tenantContext";
|
|
494
|
-
|
|
495
|
-
// ../../src/modules/user/table.ts
|
|
496
|
-
import { defineTable as defineTable4 } from "@getstrata/core/database/table";
|
|
497
|
-
var userTable = defineTable4({
|
|
498
|
-
name: "users",
|
|
499
|
-
primaryKey: "id",
|
|
500
|
-
columns: [
|
|
501
|
-
"id",
|
|
502
|
-
"name",
|
|
503
|
-
"email",
|
|
504
|
-
"email_lookup",
|
|
505
|
-
"role",
|
|
506
|
-
"tenant_id",
|
|
507
|
-
"password_hash",
|
|
508
|
-
"email_verified_at",
|
|
509
|
-
"mfa_secret",
|
|
510
|
-
"mfa_enabled",
|
|
511
|
-
"created_at",
|
|
512
|
-
"updated_at"
|
|
513
|
-
],
|
|
514
|
-
defaultOrderBy: { column: "id", direction: "ASC" }
|
|
515
|
-
});
|
|
516
|
-
|
|
517
|
-
// ../../src/modules/user/tokenService.ts
|
|
518
|
-
import { hashApiToken } from "@getstrata/core/auth/tokenHash";
|
|
519
|
-
import { ForbiddenError, NotFoundError as NotFoundError2 } from "@getstrata/core/errors/http";
|
|
520
|
-
import { resolveDefaultTokenExpiryDays as resolveDefaultTokenExpiryDays2 } from "@getstrata/core/security/tokenExpiry";
|
|
521
|
-
|
|
522
|
-
// ../../src/modules/user/provider.ts
|
|
523
|
-
var tokenServiceToken = CORE_TOKEN_SERVICE_TOKEN;
|
|
232
|
+
// ../../src/core/contracts/serviceTokens.ts
|
|
233
|
+
var CORE_CONFIG_TOKEN = "core.config";
|
|
234
|
+
var CORE_CACHE_TOKEN = "core.cache";
|
|
235
|
+
var CORE_QUEUE_TOKEN = "core.queue";
|
|
236
|
+
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
237
|
+
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
238
|
+
var CORE_AUTH_TOKEN = "core.auth";
|
|
239
|
+
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
524
240
|
|
|
525
241
|
// ../../src/core/http/csrfToken.ts
|
|
526
242
|
import { timingSafeEqual } from "crypto";
|
|
@@ -553,6 +269,20 @@ function readBunRequestCookie(request, name) {
|
|
|
553
269
|
return request.cookies.get(name) ?? readRequestCookie(request, name);
|
|
554
270
|
}
|
|
555
271
|
|
|
272
|
+
// ../../src/core/runtime/asyncContextStore.ts
|
|
273
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
274
|
+
function createAsyncContextStore(key) {
|
|
275
|
+
const symbol = Symbol.for(key);
|
|
276
|
+
const globalRecord = globalThis;
|
|
277
|
+
const existing = globalRecord[symbol];
|
|
278
|
+
if (existing) {
|
|
279
|
+
return existing;
|
|
280
|
+
}
|
|
281
|
+
const store = new AsyncLocalStorage;
|
|
282
|
+
globalRecord[symbol] = store;
|
|
283
|
+
return store;
|
|
284
|
+
}
|
|
285
|
+
|
|
556
286
|
// ../../src/core/http/requestMetaContext.ts
|
|
557
287
|
var requestMetaContext = createAsyncContextStore("@getstrata/requestMetaContext");
|
|
558
288
|
function runWithRequestMeta(meta, callback) {
|
|
@@ -584,9 +314,10 @@ function tokensMatch(left, right) {
|
|
|
584
314
|
}
|
|
585
315
|
function createCsrfTokenCookie() {
|
|
586
316
|
const token = Bun.CSRF.generate(resolveCsrfSecret(), { expiresIn: CSRF_TTL_MS });
|
|
317
|
+
const secure = process.env.APP_ENV === "production" ? "; Secure" : "";
|
|
587
318
|
return {
|
|
588
319
|
token,
|
|
589
|
-
cookie: `${CSRF_COOKIE}=${encodeURIComponent(token)}; Path=/; SameSite=Lax; Max-Age=${Math.floor(CSRF_TTL_MS / 1000)}`
|
|
320
|
+
cookie: `${CSRF_COOKIE}=${encodeURIComponent(token)}; Path=/; SameSite=Lax; Max-Age=${Math.floor(CSRF_TTL_MS / 1000)}${secure}`
|
|
590
321
|
};
|
|
591
322
|
}
|
|
592
323
|
function resolveCsrfToken(request) {
|
|
@@ -754,7 +485,7 @@ async function resolveWebLayoutData(container, request) {
|
|
|
754
485
|
if (!Number.isInteger(userId) || userId <= 0) {
|
|
755
486
|
return { authUser: null, csrfToken, flash };
|
|
756
487
|
}
|
|
757
|
-
if (!container.has(
|
|
488
|
+
if (!container.has(CORE_TOKEN_SERVICE_TOKEN)) {
|
|
758
489
|
return {
|
|
759
490
|
authUser: {
|
|
760
491
|
id: userId,
|
|
@@ -765,7 +496,7 @@ async function resolveWebLayoutData(container, request) {
|
|
|
765
496
|
flash
|
|
766
497
|
};
|
|
767
498
|
}
|
|
768
|
-
const tokenService = container.resolve(
|
|
499
|
+
const tokenService = container.resolve(CORE_TOKEN_SERVICE_TOKEN);
|
|
769
500
|
try {
|
|
770
501
|
const user = await tokenService.findByIdOrThrow(userId);
|
|
771
502
|
return {
|
|
@@ -10,7 +10,7 @@ export type { AuthUser } from "../core/auth/authContext.ts";
|
|
|
10
10
|
export { authContext, currentAuthUser, runWithAuthUser } from "../core/auth/authContext.ts";
|
|
11
11
|
export type { AuthGuard } from "../core/auth/guard.ts";
|
|
12
12
|
export { ApiTokenGuard, AuthManager, CompositeGuard, DatabaseTokenGuard, GuestGuard, } from "../core/auth/guard.ts";
|
|
13
|
-
export { currentOrganizationIds, currentOrgRole, hasMinimumOrgRole, hasOrgMembership, } from "../core/auth/membershipContext.ts";
|
|
13
|
+
export { configureMembershipLookup, currentOrganizationIds, currentOrgRole, hasMinimumOrgRole, hasOrgMembership, } from "../core/auth/membershipContext.ts";
|
|
14
14
|
export { createMembershipMiddleware } from "../core/auth/membershipMiddleware.ts";
|
|
15
15
|
export { appendOrganizationScope, appendProjectScope, assertOrganizationReadable, assertResourceInCurrentTenant, emptyPaginateResult, resolveOrganizationScope, scopedOrganizationIds, } from "../core/auth/membershipScope.ts";
|
|
16
16
|
export { default as MembershipService, resolveMembershipService, } from "../core/auth/membershipService.ts";
|
|
@@ -53,6 +53,7 @@ export { EventBus, eventBus } from "../core/events/eventBus.ts";
|
|
|
53
53
|
export { modelEventName } from "../core/events/index.ts";
|
|
54
54
|
export { auth, cache, config, events, log, mail, policyGate, queue, storage, } from "../core/facades/index.ts";
|
|
55
55
|
export { createBodySizeLimitMiddleware } from "../core/http/bodySizeLimitMiddleware.ts";
|
|
56
|
+
export { readClientIp, trustForwardedFor } from "../core/http/clientIp.ts";
|
|
56
57
|
export { conditionalJsonResponse } from "../core/http/conditionalResponse.ts";
|
|
57
58
|
export { readBunRequestCookie, readRequestCookie } from "../core/http/cookies.ts";
|
|
58
59
|
export { createCorsMiddleware } from "../core/http/corsMiddleware.ts";
|
|
@@ -106,6 +107,8 @@ export type { SecurityEventDetails } from "../core/security/securityEvents.ts";
|
|
|
106
107
|
export { logSecurityEvent } from "../core/security/securityEvents.ts";
|
|
107
108
|
export type { StorageDriver } from "../core/storage/storage.ts";
|
|
108
109
|
export { createStorageDriver, LocalStorageDriver, resetDefaultStorage, StorageManager, } from "../core/storage/storage.ts";
|
|
110
|
+
export type { TenancyDriver } from "../core/tenant/tenancyConfig.ts";
|
|
111
|
+
export { isTenancyEnabled, readTenancyDriver } from "../core/tenant/tenancyConfig.ts";
|
|
109
112
|
export type { TenantContext } from "../core/tenant/tenantContext.ts";
|
|
110
113
|
export { currentTenant, currentTenantId, rateLimitMultiplierForPlan, runWithTenant, } from "../core/tenant/tenantContext.ts";
|
|
111
114
|
export { isInsideTenantDatabaseScope, runWithTenantDatabase, } from "../core/tenant/tenantDatabaseScope.ts";
|