@getstrata/core 0.5.54 → 0.5.56

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 (80) hide show
  1. package/README.md +16 -13
  2. package/dist/core/http/index.d.ts +5 -10
  3. package/dist/core/http/response.d.ts +6 -0
  4. package/dist/core/media/imageTransform.d.ts +13 -0
  5. package/dist/core/scheduler/osCron.d.ts +14 -0
  6. package/dist/core/terminal/runShell.d.ts +6 -0
  7. package/dist/core/view/assertEtaHtmlSource.d.ts +5 -0
  8. package/dist/core/view/etaViewEngine.d.ts +4 -0
  9. package/dist/entries/audit/exportAuditLogs.js +2 -2
  10. package/dist/entries/audit/siemFormatter.js +2 -2
  11. package/dist/entries/auth/accessControl.js +4 -4
  12. package/dist/entries/auth/membershipScope.js +6 -6
  13. package/dist/entries/auth/oauth/providers.js +2 -2
  14. package/dist/entries/auth/password.js +2 -2
  15. package/dist/entries/auth/policy.js +2 -2
  16. package/dist/entries/auth/sessionCookie.js +4 -4
  17. package/dist/entries/auth/sessionGuard.js +0 -91
  18. package/dist/entries/auth/tokenHash.js +2 -2
  19. package/dist/entries/config/envSchema.js +2 -2
  20. package/dist/entries/contracts/container.js +2 -2
  21. package/dist/entries/contracts/di.js +2 -2
  22. package/dist/entries/contracts/serviceTokens.js +6 -6
  23. package/dist/entries/crypto/fieldEncryption.js +8 -8
  24. package/dist/entries/crypto/mfaSecret.js +2 -2
  25. package/dist/entries/database/errors.js +2 -2
  26. package/dist/entries/database/migrations.js +8 -8
  27. package/dist/entries/database/model.js +5 -5
  28. package/dist/entries/database/query.js +19 -19
  29. package/dist/entries/database/relationships.js +13 -13
  30. package/dist/entries/database/schema.js +13 -13
  31. package/dist/entries/database/seeders.js +2 -2
  32. package/dist/entries/facades.js +8 -8
  33. package/dist/entries/http/authMiddleware.js +2 -2
  34. package/dist/entries/http/bodySizeLimitMiddleware.js +2 -2
  35. package/dist/entries/http/cookies.js +2 -2
  36. package/dist/entries/http/csrfProtection.js +2 -2
  37. package/dist/entries/http/csrfToken.js +6 -6
  38. package/dist/entries/http/etag.js +8 -8
  39. package/dist/entries/http/flashSession.js +4 -4
  40. package/dist/entries/http/formRequest.js +2 -2
  41. package/dist/entries/http/loginThrottleMiddleware.js +2 -2
  42. package/dist/entries/http/metricsMiddleware.js +2 -2
  43. package/dist/entries/http/pagination.js +4 -4
  44. package/dist/entries/http/parseFormBody.js +2 -2
  45. package/dist/entries/http/parseMultipartUpload.js +2 -2
  46. package/dist/entries/http/resources.js +2 -2
  47. package/dist/entries/http/response.js +968 -0
  48. package/dist/entries/http/securedRouteModelBinding.js +2 -2
  49. package/dist/entries/http/throttleMiddleware.js +2 -2
  50. package/dist/entries/http/validation.js +13 -13
  51. package/dist/entries/http/webErrorResponse.js +184 -96
  52. package/dist/entries/lifecycle/gracefulShutdown.js +3 -3
  53. package/dist/entries/logging/logger.js +2 -2
  54. package/dist/entries/mail/mailer.js +6 -6
  55. package/dist/entries/mail/markdownMail.js +3 -3
  56. package/dist/entries/mail/markdownMailable.js +2 -2
  57. package/dist/entries/media/imageTransform.js +40 -0
  58. package/dist/entries/metrics/prometheus.js +2 -2
  59. package/dist/entries/openapi/generator.js +2 -2
  60. package/dist/entries/queue/createAppQueue.js +4 -4
  61. package/dist/entries/queue/publicQueue.js +10 -10
  62. package/dist/entries/queue/queueMetrics.js +2 -2
  63. package/dist/entries/queue/redisQueue.js +7 -7
  64. package/dist/entries/queue.js +3 -3
  65. package/dist/entries/scheduler/osCron.js +27 -0
  66. package/dist/entries/scheduler/schedule.js +2 -2
  67. package/dist/entries/security/oauthState.js +3 -3
  68. package/dist/entries/security/publicReads.js +2 -2
  69. package/dist/entries/security/safeFetch.js +2 -2
  70. package/dist/entries/security/safeUrl.js +5 -5
  71. package/dist/entries/security/scimTenantTokens.js +2 -2
  72. package/dist/entries/security/totp.js +2 -2
  73. package/dist/entries/storage/storage.js +7 -7
  74. package/dist/entries/tenant/tenantDatabaseScope.js +2 -2
  75. package/dist/entries/terminal/runShell.js +18 -0
  76. package/dist/entries/validation/rules.js +12 -12
  77. package/dist/entries/view.js +186 -98
  78. package/dist/framework/public-api.d.ts +2 -1
  79. package/dist/index.js +1820 -1858
  80. package/package.json +22 -2
package/README.md CHANGED
@@ -14,19 +14,20 @@ Set `DATABASE_URL` before importing (connection is created lazily on first query
14
14
  ```typescript
15
15
  process.env.DATABASE_URL ??= "postgresql://postgres:postgres@localhost:5432/myapp";
16
16
 
17
- import {
18
- AdminResourceRegistry,
19
- BaseRepository,
20
- EtaViewEngine,
21
- FormRequest,
22
- Policy,
23
- formatAdminValue,
24
- mailer,
25
- storage,
26
- withErrorHandling,
27
- } from "@getstrata/core";
17
+ import { AdminResourceRegistry } from "@getstrata/core/admin/registry";
18
+ import { formatAdminValue } from "@getstrata/core/admin/formatValue";
19
+ import { Policy } from "@getstrata/core/auth/policy";
20
+ import { BaseRepository } from "@getstrata/core/database/baseRepository";
21
+ import { mail } from "@getstrata/core/facades";
22
+ import { FormRequest } from "@getstrata/core/http/formRequest";
23
+ import { withErrorHandling } from "@getstrata/core/http/response";
24
+ import { mailer } from "@getstrata/core/mail/mailer";
25
+ import { storage } from "@getstrata/core/facades";
26
+ import { EtaViewEngine } from "@getstrata/core/view";
28
27
  ```
29
28
 
29
+ `.eta` files are **HTML + Eta tags** (`<% %>`, `<%= %>`, `<%~ include() %>`), not Pug. Class/attribute shorthand such as `section.section` or `a href=` fails at render time with the template name.
30
+
30
31
  **Dependency:** `eta` is bundled as a direct dependency of `@getstrata/core`. Apps do not need to list it separately. The database driver is your app's choice. WorkHub and getstrata use **Bun's built-in `Bun.sql`** client; bind it with `bindDatabaseConnection()`.
31
32
 
32
33
  `orderBy` accepts explicit `{ column, direction }` objects or column shorthand such as `{ published_at: "desc" }`.
@@ -49,7 +50,7 @@ bun run verify:shared-subpaths # after build: confirm singleton shims
49
50
 
50
51
  ## Subpath imports
51
52
 
52
- `@getstrata/core` publishes **143+ subpaths** (for example `@getstrata/core/http/authMiddleware`,
53
+ `@getstrata/core` publishes **144+ subpaths** (for example `@getstrata/core/http/authMiddleware`,
53
54
  `@getstrata/core/database/migrations`). Prefer subpaths over the root import in apps, bootstrap, and tests.
54
55
 
55
56
  Some subpaths **re-export the main bundle** so singleton state stays shared (database pool binding,
@@ -59,10 +60,12 @@ Some subpaths **re-export the main bundle** so singleton state stays shared (dat
59
60
 
60
61
  When adding a subpath that owns process-wide state or base classes used with `instanceof`, append it to
61
62
  `CORE_SHARED_SUBPATHS`, run `bun scripts/sync-package-subpaths.ts`, and rebuild. Non-shared subpath
62
- bundles are built with generated `--external @getstrata/core/*` flags (all 143+ subpaths) so framework
63
+ bundles are built with generated `--external @getstrata/core/*` flags (all 144+ subpaths) so framework
63
64
  source can import shared modules via package self-imports (`scripts/codemod-core-self-imports.ts`).
64
65
  Bootstrap subpath builds externalize all `@getstrata/bootstrap/*` and `@getstrata/core/*` entries.
65
66
  `scripts/verify-no-root-imports.ts` blocks root `@getstrata/core` imports in application source.
67
+ `scripts/verify-no-shared-barrel-imports.ts` blocks `@getstrata/core/database` and
68
+ `@getstrata/core/http` barrel imports in application source.
66
69
  `scripts/audit-public-api-surface.ts` reports root exports with no in-repo root import usage.
67
70
  `scripts/verify-bundled-subpaths.ts` ensures entries like `http/webFormRequest` do not inline
68
71
  `ValidationError`.
@@ -9,19 +9,14 @@ export { FormRequest, QueryFormRequest } from "./formRequest";
9
9
  export type { Middleware, RouteHandler } from "./middleware";
10
10
  export { applyMiddlewareToRoutes, composeMiddleware, requestIdMiddleware, wrapRouteHandler, } from "./middleware";
11
11
  export { buildPaginationMeta, DEFAULT_PER_PAGE, MAX_PER_PAGE, paginatedResponse, parsePaginationQuery, } from "./pagination";
12
+ export type { ParsedUpload } from "./parseMultipartUpload";
13
+ export { parseMultipartUpload, sanitizeUploadFileName } from "./parseMultipartUpload";
12
14
  export { createRequireAuthMiddleware } from "./requireAuthMiddleware";
13
15
  export { serializeDate, toPaginatedResourceCollection, toResourceCollection } from "./resources";
16
+ export { createdResponse, errorResponse, jsonResponse, noContentResponse, withErrorHandling, } from "./response";
17
+ export type { RouteRequest } from "./route";
18
+ export { getRouteParams } from "./route";
14
19
  export { withMiddleware } from "./routeMiddleware";
15
20
  export { bindRouteModel } from "./routeModelBinding";
16
21
  export { securedBindRouteModel, securedBindRouteModelByKey, } from "./securedRouteModelBinding";
17
22
  export { buildRequestCacheKey, expectObject, getQueryParams, parseJsonBody, parseOptionalBooleanQueryParam, parseOptionalEnumQueryParam, parseOptionalPositiveIntQueryParam, parsePositiveIntParam, readOptionalEnum, readOptionalPositiveInt, readOptionalString, readRequiredEnum, readRequiredPositiveInt, readRequiredString, } from "./validation";
18
- declare function jsonResponse(data: unknown, init?: ResponseInit): Response;
19
- declare function createdResponse(data: unknown, init?: ResponseInit): Response;
20
- declare function noContentResponse(): Response;
21
- declare function errorResponse(error: unknown): Response;
22
- declare function withErrorHandling<TArgs extends unknown[]>(handler: (...args: TArgs) => Response | Promise<Response>): (...args: TArgs) => Promise<Response>;
23
- export type { ParsedUpload } from "./parseMultipartUpload";
24
- export { parseMultipartUpload, sanitizeUploadFileName } from "./parseMultipartUpload";
25
- export type { RouteRequest } from "./route";
26
- export { getRouteParams } from "./route";
27
- export { createdResponse, errorResponse, jsonResponse, noContentResponse, withErrorHandling };
@@ -0,0 +1,6 @@
1
+ declare function jsonResponse(data: unknown, init?: ResponseInit): Response;
2
+ declare function createdResponse(data: unknown, init?: ResponseInit): Response;
3
+ declare function noContentResponse(): Response;
4
+ declare function errorResponse(error: unknown): Response;
5
+ declare function withErrorHandling<TArgs extends unknown[]>(handler: (...args: TArgs) => Response | Promise<Response>): (...args: TArgs) => Promise<Response>;
6
+ export { createdResponse, errorResponse, jsonResponse, noContentResponse, withErrorHandling };
@@ -0,0 +1,13 @@
1
+ declare const IMAGE_MIME_TYPES: Set<string>;
2
+ declare function normalizeMimeType(mimeType: string): string;
3
+ declare function isImageMimeType(mimeType: string): boolean;
4
+ declare function parseThumbnailWidth(raw: string | null | undefined, options?: {
5
+ defaultWidth?: number;
6
+ minWidth?: number;
7
+ maxWidth?: number;
8
+ }): number;
9
+ declare function resizeImageContents(contents: Uint8Array, width: number, mimeType: string): Promise<{
10
+ body: Uint8Array;
11
+ contentType: string;
12
+ }>;
13
+ export { IMAGE_MIME_TYPES, isImageMimeType, normalizeMimeType, parseThumbnailWidth, resizeImageContents, };
@@ -0,0 +1,14 @@
1
+ declare const DEFAULT_SCHEDULE_RUN_EXPRESSION = "* * * * *";
2
+ declare const OS_CRON_JOB_TITLE = "getstrata-schedule-run";
3
+ interface InProcessCronJob {
4
+ readonly cron: string;
5
+ stop(): InProcessCronJob;
6
+ ref(): InProcessCronJob;
7
+ unref(): InProcessCronJob;
8
+ }
9
+ declare function parseScheduleExpression(expression: string, from?: Date): Date | null;
10
+ declare function registerInProcessScheduleRunner(run: () => void | Promise<void>, expression?: string): InProcessCronJob;
11
+ declare function installOsScheduleRunner(workerScriptPath: string, expression?: string, title?: string): Promise<void>;
12
+ declare function uninstallOsScheduleRunner(title?: string): Promise<void>;
13
+ export type { InProcessCronJob };
14
+ export { DEFAULT_SCHEDULE_RUN_EXPRESSION, installOsScheduleRunner, OS_CRON_JOB_TITLE, parseScheduleExpression, registerInProcessScheduleRunner, uninstallOsScheduleRunner, };
@@ -0,0 +1,6 @@
1
+ declare function runInteractiveShell(command: string[], options?: {
2
+ cwd?: string;
3
+ cols?: number;
4
+ rows?: number;
5
+ }): Promise<number>;
6
+ export { runInteractiveShell };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Throws when an .eta source still uses Pug shorthand instead of HTML + Eta tags.
3
+ */
4
+ declare function assertEtaHtmlSource(templateName: string, source: string): void;
5
+ export { assertEtaHtmlSource };
@@ -5,6 +5,10 @@ interface RenderOptions {
5
5
  layout?: string | false;
6
6
  }
7
7
  type LayoutDataResolver = () => Promise<Record<string, unknown>>;
8
+ /**
9
+ * Renders `.eta` files as HTML + Eta tags (`<% %>`, `<%= %>`, `<%~ include() %>`).
10
+ * Pug class/attribute shorthand is rejected at render time.
11
+ */
8
12
  declare class EtaViewEngine implements ViewEngine {
9
13
  private readonly eta;
10
14
  private readonly resolveLayoutData?;
@@ -262,6 +262,6 @@ async function exportPendingAuditLogs() {
262
262
  });
263
263
  }
264
264
  export {
265
- resolveAuditExportConfig,
266
- exportPendingAuditLogs
265
+ exportPendingAuditLogs,
266
+ resolveAuditExportConfig
267
267
  };
@@ -32,6 +32,6 @@ function formatCefLine(event) {
32
32
  return `CEF:0|WorkHub|API|1.0|${event.action}|${event.subject_type}|5|${extension}`;
33
33
  }
34
34
  export {
35
- formatSiemAuditEvent,
36
- formatCefLine
35
+ formatCefLine,
36
+ formatSiemAuditEvent
37
37
  };
@@ -52,9 +52,9 @@ function resolveUserId(user) {
52
52
  return userId;
53
53
  }
54
54
  export {
55
- resolveUserId,
56
- requireAuthenticatedUser,
57
- isGlobalAdmin,
55
+ ROLE_RANK,
58
56
  hasMinimumOrgRole,
59
- ROLE_RANK
57
+ isGlobalAdmin,
58
+ requireAuthenticatedUser,
59
+ resolveUserId
60
60
  };
@@ -326,11 +326,11 @@ function assertOrganizationReadable(organizationId) {
326
326
  }
327
327
  }
328
328
  export {
329
- scopedOrganizationIds,
330
- resolveOrganizationScope,
331
- emptyPaginateResult,
332
- assertResourceInCurrentTenant,
333
- assertOrganizationReadable,
329
+ appendOrganizationScope,
334
330
  appendProjectScope,
335
- appendOrganizationScope
331
+ assertOrganizationReadable,
332
+ assertResourceInCurrentTenant,
333
+ emptyPaginateResult,
334
+ resolveOrganizationScope,
335
+ scopedOrganizationIds
336
336
  };
@@ -66,6 +66,6 @@ class MockOAuthProvider {
66
66
  }
67
67
  }
68
68
  export {
69
- MockOAuthProvider,
70
- GitHubOAuthProvider
69
+ GitHubOAuthProvider,
70
+ MockOAuthProvider
71
71
  };
@@ -10,6 +10,6 @@ async function verifyPassword(password, passwordHash) {
10
10
  return await Bun.password.verify(password, passwordHash);
11
11
  }
12
12
  export {
13
- verifyPassword,
14
- hashPassword
13
+ hashPassword,
14
+ verifyPassword
15
15
  };
@@ -76,6 +76,6 @@ class PolicyGate {
76
76
  }
77
77
  }
78
78
  export {
79
- PolicyGate,
80
- Policy
79
+ Policy,
80
+ PolicyGate
81
81
  };
@@ -67,9 +67,9 @@ function clearSessionCookie() {
67
67
  return `${SESSION_COOKIE}=; Path=/; HttpOnly; SameSite=Lax; Max-Age=0${secure}`;
68
68
  }
69
69
  export {
70
- readSessionUserId,
71
- createSessionCookie,
72
- clearSessionCookie,
70
+ SESSION_COOKIE,
73
71
  SESSION_TTL_SECONDS,
74
- SESSION_COOKIE
72
+ clearSessionCookie,
73
+ createSessionCookie,
74
+ readSessionUserId
75
75
  };
@@ -227,97 +227,6 @@ import { logSecurityEvent } from "@getstrata/core/security/securityEvents";
227
227
  import { resolveDefaultTokenExpiryDays } from "@getstrata/core/security/tokenExpiry";
228
228
  import { verifyTotp } from "@getstrata/core/security/totp";
229
229
  import { currentTenantId } from "@getstrata/core/tenant/tenantContext";
230
- class AuthService {
231
- users;
232
- tokens;
233
- oauthIdentities;
234
- oauthProviders = new Map;
235
- constructor(users, tokens, oauthIdentities) {
236
- this.users = users;
237
- this.tokens = tokens;
238
- this.oauthIdentities = oauthIdentities;
239
- }
240
- registerOAuthProvider(provider) {
241
- this.oauthProviders.set(provider.name, provider);
242
- }
243
- getOAuthProvider(name) {
244
- return this.oauthProviders.get(name);
245
- }
246
- async loginWithPassword(email, password, options = {}) {
247
- const user = await this.users.findByEmail(email);
248
- if (!user?.password_hash) {
249
- logSecurityEvent("auth_login_failed", { reason: "unknown_user", email });
250
- throw new UnauthorizedError("Invalid credentials.");
251
- }
252
- const valid = await verifyPassword(password, user.password_hash);
253
- if (!valid) {
254
- logSecurityEvent("auth_login_failed", { reason: "invalid_password", user_id: user.id });
255
- throw new UnauthorizedError("Invalid credentials.");
256
- }
257
- if (isFeatureEnabled("emailVerification") && !user.email_verified_at) {
258
- logSecurityEvent("auth_login_blocked", { reason: "email_unverified", user_id: user.id });
259
- throw new UnauthorizedError("Email address is not verified.");
260
- }
261
- if (isFeatureEnabled("mfa") && user.mfa_enabled) {
262
- const mfaSecret = revealMfaSecret(user.mfa_secret);
263
- if (!mfaSecret || !options.mfaCode || !verifyTotp(mfaSecret, options.mfaCode)) {
264
- logSecurityEvent("auth_login_failed", { reason: "invalid_mfa", user_id: user.id });
265
- throw new UnauthorizedError("Invalid MFA code.");
266
- }
267
- }
268
- logSecurityEvent("auth_login_success", { user_id: user.id, method: "password" });
269
- return await this.tokens.createToken(user.id, {
270
- name: "password-login",
271
- abilities: resolveAbilitiesForRole(user.role),
272
- expiresInDays: resolveDefaultTokenExpiryDays() ?? undefined
273
- });
274
- }
275
- async loginWithOAuth(providerName, code) {
276
- const provider = this.oauthProviders.get(providerName);
277
- if (!provider) {
278
- throw new UnauthorizedError("Unsupported OAuth provider.");
279
- }
280
- const profile = await provider.exchangeCode(code);
281
- const user = await this.findOrCreateOAuthUser(providerName, profile);
282
- logSecurityEvent("auth_login_success", { user_id: user.id, method: `oauth:${providerName}` });
283
- return await this.tokens.createToken(user.id, {
284
- name: `${providerName}-oauth`,
285
- abilities: resolveAbilitiesForRole(user.role),
286
- expiresInDays: resolveDefaultTokenExpiryDays() ?? undefined
287
- });
288
- }
289
- buildOAuthAuthorizationUrl(providerName, state) {
290
- const provider = this.oauthProviders.get(providerName);
291
- if (!provider) {
292
- throw new UnauthorizedError("Unsupported OAuth provider.");
293
- }
294
- return provider.getAuthorizationUrl(state);
295
- }
296
- async findOrCreateOAuthUser(providerName, profile) {
297
- const existingIdentity = await this.oauthIdentities.findByProviderUser(providerName, profile.providerUserId);
298
- if (existingIdentity) {
299
- return await this.users.findByIdOrThrow(existingIdentity.user_id);
300
- }
301
- const existingUser = await this.users.findByEmail(profile.email);
302
- const user = existingUser ?? await this.users.create({
303
- name: profile.name,
304
- email: profile.email,
305
- role: "member",
306
- tenant_id: currentTenantId(),
307
- email_verified_at: new Date,
308
- created_at: new Date,
309
- updated_at: new Date
310
- });
311
- await this.oauthIdentities.create({
312
- user_id: user.id,
313
- provider: providerName,
314
- provider_user_id: profile.providerUserId,
315
- email: profile.email,
316
- created_at: new Date
317
- });
318
- return user;
319
- }
320
- }
321
230
 
322
231
  // ../../src/modules/user/notificationRepository.ts
323
232
  import { BaseRepository as BaseRepository2 } from "@getstrata/core/database/baseRepository";
@@ -12,6 +12,6 @@ function hashApiToken(token) {
12
12
  return createHash("sha256").update(token).digest("hex");
13
13
  }
14
14
  export {
15
- resolveTokenPepper,
16
- hashApiToken
15
+ hashApiToken,
16
+ resolveTokenPepper
17
17
  };
@@ -30,6 +30,6 @@ function validateEnv(schema, env = process.env) {
30
30
  return resolved;
31
31
  }
32
32
  export {
33
- validateEnv,
34
- defineEnvSchema
33
+ defineEnvSchema,
34
+ validateEnv
35
35
  };
@@ -64,6 +64,6 @@ class ConfigStore {
64
64
  }
65
65
  }
66
66
  export {
67
- ServiceContainer,
68
- ConfigStore
67
+ ConfigStore,
68
+ ServiceContainer
69
69
  };
@@ -21,7 +21,7 @@ function resolveService(dependencies, token) {
21
21
  return dependencies.container.resolve(token);
22
22
  }
23
23
  export {
24
- resolveService,
24
+ assertAppDependenciesComplete,
25
25
  getRequiredDependency,
26
- assertAppDependenciesComplete
26
+ resolveService
27
27
  };
@@ -8,11 +8,11 @@ var CORE_POLICY_GATE_TOKEN = "core.policyGate";
8
8
  var CORE_AUTH_TOKEN = "core.auth";
9
9
  var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
10
10
  export {
11
- CORE_TOKEN_SERVICE_TOKEN,
12
- CORE_QUEUE_TOKEN,
13
- CORE_POLICY_GATE_TOKEN,
14
- CORE_EVENT_BUS_TOKEN,
15
- CORE_CONFIG_TOKEN,
11
+ CORE_AUTH_TOKEN,
16
12
  CORE_CACHE_TOKEN,
17
- CORE_AUTH_TOKEN
13
+ CORE_CONFIG_TOKEN,
14
+ CORE_EVENT_BUS_TOKEN,
15
+ CORE_POLICY_GATE_TOKEN,
16
+ CORE_QUEUE_TOKEN,
17
+ CORE_TOKEN_SERVICE_TOKEN
18
18
  };
@@ -81,13 +81,13 @@ function emailLookupForQuery(email) {
81
81
  return hashLookupValue(normalized, key);
82
82
  }
83
83
  export {
84
- revealEmail,
85
- resolveEncryptionKey,
86
- protectEmail,
87
- normalizeEmail,
88
- isFieldEncryptionEnabled,
89
- hashLookupValue,
90
- encryptField,
84
+ decryptField,
91
85
  emailLookupForQuery,
92
- decryptField
86
+ encryptField,
87
+ hashLookupValue,
88
+ isFieldEncryptionEnabled,
89
+ normalizeEmail,
90
+ protectEmail,
91
+ resolveEncryptionKey,
92
+ revealEmail
93
93
  };
@@ -100,6 +100,6 @@ function revealMfaSecret(stored) {
100
100
  return decryptField(stored, key);
101
101
  }
102
102
  export {
103
- revealMfaSecret,
104
- protectMfaSecret
103
+ protectMfaSecret,
104
+ revealMfaSecret
105
105
  };
@@ -62,7 +62,7 @@ async function withDatabaseErrorHandling(operation) {
62
62
  }
63
63
  }
64
64
  export {
65
- withDatabaseErrorHandling,
65
+ isPostgresError,
66
66
  mapDatabaseError,
67
- isPostgresError
67
+ withDatabaseErrorHandling
68
68
  };
@@ -115,13 +115,13 @@ async function freshDatabase(db, migrations, options = {}) {
115
115
  await runFresh();
116
116
  }
117
117
  export {
118
- withMigrationLock,
119
- runPendingMigrations,
120
- rollbackDatabase,
121
- migrateDatabase,
122
- loadMigrationsFromDirectory,
123
- getMigrationStatus,
124
- getAppliedMigrations,
118
+ ensureMigrationsTable,
125
119
  freshDatabase,
126
- ensureMigrationsTable
120
+ getAppliedMigrations,
121
+ getMigrationStatus,
122
+ loadMigrationsFromDirectory,
123
+ migrateDatabase,
124
+ rollbackDatabase,
125
+ runPendingMigrations,
126
+ withMigrationLock
127
127
  };
@@ -876,10 +876,10 @@ function registerModelRepository(model, repository) {
876
876
  return model;
877
877
  }
878
878
  export {
879
- registerModelRepository,
880
- hydrateValue,
881
- filterMassAssignable,
882
- dehydrateValue,
879
+ Model,
883
880
  applyCasts,
884
- Model
881
+ dehydrateValue,
882
+ filterMassAssignable,
883
+ hydrateValue,
884
+ registerModelRepository
885
885
  };
@@ -413,24 +413,24 @@ function buildDeleteByIdQuery(table, id) {
413
413
  };
414
414
  }
415
415
  export {
416
- resolveSoftDeleteColumn,
417
- resolveQualifiedColumn,
418
- quoteIdentifier,
419
- qualifyColumn,
420
- parseQualifiedColumn,
421
- buildWhereClause,
422
- buildUpdateQuery,
423
- buildSoftDeleteByIdQuery,
424
- buildSelectQuery,
425
- buildRestoreByIdQuery,
426
- buildQueryWhereClause,
427
- buildProjectionQuery,
428
- buildOrderByClause,
429
- buildJoinClause,
430
- buildInsertQuery,
431
- buildGroupedCountQuery,
432
- buildDeleteByIdQuery,
433
- buildCountQuery,
416
+ assertSafeProjectionExpression,
434
417
  buildAdvancedWhereClause,
435
- assertSafeProjectionExpression
418
+ buildCountQuery,
419
+ buildDeleteByIdQuery,
420
+ buildGroupedCountQuery,
421
+ buildInsertQuery,
422
+ buildJoinClause,
423
+ buildOrderByClause,
424
+ buildProjectionQuery,
425
+ buildQueryWhereClause,
426
+ buildRestoreByIdQuery,
427
+ buildSelectQuery,
428
+ buildSoftDeleteByIdQuery,
429
+ buildUpdateQuery,
430
+ buildWhereClause,
431
+ parseQualifiedColumn,
432
+ qualifyColumn,
433
+ quoteIdentifier,
434
+ resolveQualifiedColumn,
435
+ resolveSoftDeleteColumn
436
436
  };
@@ -145,18 +145,18 @@ function indexMorphToRelation(children, parentsByType, relation) {
145
145
  return result;
146
146
  }
147
147
  export {
148
- morphTo,
149
- morphOne,
150
- morphMany,
151
- indexMorphToRelation,
152
- indexMorphOneRelation,
153
- indexMorphManyRelation,
154
- indexHasOneRelation,
155
- indexHasManyRelation,
156
- indexBelongsToRelation,
157
- indexBelongsToManyRelation,
158
- hasOne,
159
- hasMany,
148
+ belongsTo,
160
149
  belongsToMany,
161
- belongsTo
150
+ hasMany,
151
+ hasOne,
152
+ indexBelongsToManyRelation,
153
+ indexBelongsToRelation,
154
+ indexHasManyRelation,
155
+ indexHasOneRelation,
156
+ indexMorphManyRelation,
157
+ indexMorphOneRelation,
158
+ indexMorphToRelation,
159
+ morphMany,
160
+ morphOne,
161
+ morphTo
162
162
  };
@@ -1037,18 +1037,18 @@ function createSchemaBuilder(db, driver) {
1037
1037
  });
1038
1038
  }
1039
1039
  export {
1040
- resolveDatabaseDriver,
1041
- inferReferencedTable,
1042
- grammarForDriver,
1043
- createSchemaBuilder,
1044
- compileBlueprint,
1045
- UnsupportedSchemaFeatureError,
1046
- SqliteGrammar,
1047
- SchemaBuilder,
1048
- Schema,
1049
- PostgresGrammar,
1050
- MySqlGrammar,
1051
- ForeignIdColumnDefinition,
1040
+ Blueprint,
1052
1041
  ColumnDefinition,
1053
- Blueprint
1042
+ ForeignIdColumnDefinition,
1043
+ MySqlGrammar,
1044
+ PostgresGrammar,
1045
+ Schema,
1046
+ SchemaBuilder,
1047
+ SqliteGrammar,
1048
+ UnsupportedSchemaFeatureError,
1049
+ compileBlueprint,
1050
+ createSchemaBuilder,
1051
+ grammarForDriver,
1052
+ inferReferencedTable,
1053
+ resolveDatabaseDriver
1054
1054
  };
@@ -25,6 +25,6 @@ async function runSeedersFromDirectory(directory, db, options) {
25
25
  return seeders.length;
26
26
  }
27
27
  export {
28
- runSeedersFromDirectory,
29
- loadSeedersFromDirectory
28
+ loadSeedersFromDirectory,
29
+ runSeedersFromDirectory
30
30
  };
@@ -366,13 +366,13 @@ function storageFacade() {
366
366
  return storage();
367
367
  }
368
368
  export {
369
- storageFacade as storage,
370
- queue,
371
- policyGate,
372
- mail,
373
- log,
374
- events,
375
- config,
369
+ auth,
376
370
  cache,
377
- auth
371
+ config,
372
+ events,
373
+ log,
374
+ mail,
375
+ policyGate,
376
+ queue,
377
+ storageFacade as storage
378
378
  };
@@ -20,6 +20,6 @@ function createAuthMiddleware(auth) {
20
20
  };
21
21
  }
22
22
  export {
23
- createAuthMiddleware,
24
- authContext
23
+ authContext,
24
+ createAuthMiddleware
25
25
  };
@@ -27,6 +27,6 @@ function createBodySizeLimitMiddleware(maxBytes = resolveMaxBodyBytes()) {
27
27
  };
28
28
  }
29
29
  export {
30
- resolveMaxBodyBytes,
31
- createBodySizeLimitMiddleware
30
+ createBodySizeLimitMiddleware,
31
+ resolveMaxBodyBytes
32
32
  };
@@ -27,6 +27,6 @@ function readBunRequestCookie(request, name) {
27
27
  return request.cookies.get(name) ?? readRequestCookie(request, name);
28
28
  }
29
29
  export {
30
- readRequestCookie,
31
- readBunRequestCookie
30
+ readBunRequestCookie,
31
+ readRequestCookie
32
32
  };