@getstrata/bootstrap 0.2.4 → 0.2.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @getstrata/bootstrap
2
2
 
3
- Application bootstrap for Strata sibling apps HttpKernel, service container, and web utilities.
3
+ Application bootstrap for Strata sibling apps: HttpKernel, service container, and web utilities.
4
4
 
5
5
  ## Install
6
6
 
@@ -20,6 +20,8 @@ import {
20
20
  } from "@getstrata/bootstrap";
21
21
  ```
22
22
 
23
+ `CookieSessionStore` reads optional `is_admin` from the user row for global admin routing via `wrapWebGlobalAdmin`.
24
+
23
25
  ## HttpKernel (API / module apps)
24
26
 
25
27
  ```typescript
@@ -1,5 +1,4 @@
1
- import type { Policy } from "../core/auth/policy";
2
- import { type Middleware, type RouteHandler } from "../core/http/middleware";
1
+ import { type Middleware, type Policy, type RouteHandler } from "@getstrata/core";
3
2
  import type { AppDependencies } from "./contracts";
4
3
  type MiddlewareGroupName = "api" | "authenticated" | "web";
5
4
  declare class HttpKernel {
@@ -1,4 +1,4 @@
1
- import { type Middleware } from "../core/http/middleware";
1
+ import { type Middleware } from "@getstrata/core";
2
2
  import type { AppDependencies } from "./contracts";
3
3
  declare function createDefaultMiddleware(dependencies: AppDependencies): Middleware[];
4
4
  export { createDefaultMiddleware };
@@ -3,6 +3,7 @@ export interface SessionUser {
3
3
  name: string;
4
4
  email: string;
5
5
  learn_subscriber?: boolean;
6
+ is_admin?: boolean;
6
7
  }
7
8
  type SqlClient = {
8
9
  unsafe<T>(query: string, params?: readonly unknown[]): Promise<T[]>;
@@ -0,0 +1,3 @@
1
+ import type { AdminColumnType } from "./types.ts";
2
+ declare function formatAdminValue(value: unknown, type?: AdminColumnType): string;
3
+ export { formatAdminValue };
@@ -0,0 +1,3 @@
1
+ export { formatAdminValue } from "./formatValue.ts";
2
+ export { AdminResourceRegistry } from "./registry.ts";
3
+ export type { AdminColumn, AdminColumnType, AdminResource, AdminResourceDefinition, AdminResourceHandlers, } from "./types.ts";
@@ -0,0 +1,11 @@
1
+ import type { AdminResource, AdminResourceDefinition } from "./types.ts";
2
+ declare class AdminResourceRegistry {
3
+ private readonly resources;
4
+ constructor();
5
+ register<TEntity extends object>(resource: AdminResource<TEntity>): void;
6
+ get(name: string): AdminResource<object> | undefined;
7
+ list(): AdminResourceDefinition[];
8
+ all(): AdminResource<object>[];
9
+ clear(): void;
10
+ }
11
+ export { AdminResourceRegistry };
@@ -0,0 +1,24 @@
1
+ import type { PaginatedResult } from "../pagination/index.ts";
2
+ type AdminColumnType = "text" | "number" | "boolean" | "datetime" | "code";
3
+ interface AdminColumn {
4
+ key: string;
5
+ label: string;
6
+ type?: AdminColumnType;
7
+ }
8
+ interface AdminResourceHandlers<TEntity extends object> {
9
+ paginate(options: {
10
+ page: number;
11
+ perPage: number;
12
+ }): Promise<PaginatedResult<TEntity>>;
13
+ findById?(id: number): Promise<TEntity | null>;
14
+ }
15
+ interface AdminResourceDefinition {
16
+ name: string;
17
+ label: string;
18
+ labelPlural: string;
19
+ columns: AdminColumn[];
20
+ }
21
+ interface AdminResource<TEntity extends object> extends AdminResourceDefinition {
22
+ handlers: AdminResourceHandlers<TEntity>;
23
+ }
24
+ export type { AdminColumn, AdminColumnType, AdminResource, AdminResourceDefinition, AdminResourceHandlers, };
@@ -1,5 +1,5 @@
1
1
  import { type CursorPaginatedResult, type PaginatedResult } from "../pagination/index.ts";
2
- import { type BelongsToRelation, type HasManyRelation } from "./relationships.ts";
2
+ import { type BelongsToRelation, type HasManyRelation, type MorphManyRelation, type MorphOneRelation, type MorphToRelation } from "./relationships.ts";
3
3
  import { RepositoryQuery } from "./repositoryQuery.ts";
4
4
  import type { TableDefinition } from "./table.ts";
5
5
  import type { MutationValues, QueryOptions, QueryWhere, UpdateValues } from "./types.ts";
@@ -54,6 +54,9 @@ declare class BaseRepository<TEntity extends object, PrimaryKey extends keyof TE
54
54
  findByHasManyRelation<TParent extends object, LocalKey extends keyof TParent & string, ForeignKey extends keyof TEntity & string>(relation: HasManyRelation<TParent, TEntity, LocalKey, ForeignKey>, parentId: TParent[LocalKey], options?: Omit<QueryOptions<TEntity>, "where">): Promise<TEntity[]>;
55
55
  loadHasManyForParents<TParent extends object, LocalKey extends keyof TParent & string, ForeignKey extends keyof TEntity & string>(parents: readonly TParent[], relation: HasManyRelation<TParent, TEntity, LocalKey, ForeignKey>, options?: Omit<QueryOptions<TEntity>, "where">): Promise<Map<TParent[LocalKey], TEntity[]>>;
56
56
  loadBelongsToForParents<TChild extends object, TParent extends object, ForeignKey extends keyof TChild & string, OwnerKey extends keyof TParent & string>(children: readonly TChild[], relation: BelongsToRelation<TChild, TParent, ForeignKey, OwnerKey>, parentRepository: BaseRepository<TParent, OwnerKey>, options?: Omit<QueryOptions<TParent>, "where">): Promise<Map<TChild[ForeignKey], TParent>>;
57
+ loadMorphManyForParents<TParent extends object, LocalKey extends keyof TParent & string, MorphTypeKey extends keyof TEntity & string, MorphIdKey extends keyof TEntity & string>(parents: readonly TParent[], relation: MorphManyRelation<TParent, TEntity, LocalKey, MorphTypeKey, MorphIdKey>, options?: Omit<QueryOptions<TEntity>, "where">): Promise<Map<TParent[LocalKey], TEntity[]>>;
58
+ loadMorphOneForParents<TParent extends object, LocalKey extends keyof TParent & string, MorphTypeKey extends keyof TEntity & string, MorphIdKey extends keyof TEntity & string>(parents: readonly TParent[], relation: MorphOneRelation<TParent, TEntity, LocalKey, MorphTypeKey, MorphIdKey>, options?: Omit<QueryOptions<TEntity>, "where">): Promise<Map<TParent[LocalKey], TEntity | undefined>>;
59
+ loadMorphToForChildren<TChild extends object, TParent extends object, MorphTypeKey extends keyof TChild & string, MorphIdKey extends keyof TChild & string, OwnerKey extends keyof TParent & string>(children: readonly TChild[], relation: MorphToRelation<TChild, MorphTypeKey, MorphIdKey>, repositoriesByType: ReadonlyMap<string, BaseRepository<TParent, OwnerKey>>, options?: Omit<QueryOptions<TParent>, "where">): Promise<Map<TChild[MorphIdKey], TParent>>;
57
60
  }
58
61
  export default BaseRepository;
59
62
  export type { DatabaseConnection };
@@ -5,8 +5,8 @@ export { mapDatabaseError, withDatabaseErrorHandling } from "./errors.ts";
5
5
  export type { CastType, GlobalScopeFn, ModelConstructor } from "./model.ts";
6
6
  export { applyCasts, dehydrateValue, filterMassAssignable, hydrateValue, Model, registerModelRepository, } from "./model.ts";
7
7
  export { buildAdvancedWhereClause, buildCountQuery, buildDeleteByIdQuery, buildGroupedCountQuery, buildInsertQuery, buildJoinClause, buildOrderByClause, buildProjectionQuery, buildQueryWhereClause, buildRestoreByIdQuery, buildSelectQuery, buildSoftDeleteByIdQuery, buildUpdateQuery, buildWhereClause, parseQualifiedColumn, qualifyColumn, quoteIdentifier, resolveQualifiedColumn, resolveSoftDeleteColumn, } from "./query.ts";
8
- export type { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasOneRelation, } from "./relationships.ts";
9
- export { belongsTo, belongsToMany, hasMany, hasOne, indexBelongsToManyRelation, indexBelongsToRelation, indexHasManyRelation, indexHasOneRelation, } from "./relationships.ts";
8
+ export type { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasOneRelation, MorphManyRelation, MorphOneRelation, MorphToRelation, } from "./relationships.ts";
9
+ export { belongsTo, belongsToMany, hasMany, hasOne, indexBelongsToManyRelation, indexBelongsToRelation, indexHasManyRelation, indexHasOneRelation, indexMorphManyRelation, indexMorphOneRelation, indexMorphToRelation, morphMany, morphOne, morphTo, } from "./relationships.ts";
10
10
  export { RepositoryQuery } from "./repositoryQuery.ts";
11
11
  export type { BlueprintAction, BlueprintCallback, ColumnKind, DatabaseDriver, ForeignKeyOptions, Grammar, IndexDefinition, IndexKind, ResolveDatabaseDriverOptions, SchemaBuilder, } from "./schema/index.ts";
12
12
  export { Blueprint, ColumnDefinition, compileBlueprint, createSchemaBuilder, ForeignIdColumnDefinition, grammarForDriver, inferReferencedTable, MySqlGrammar, PostgresGrammar, resolveDatabaseDriver, Schema, SqliteGrammar, UnsupportedSchemaFeatureError, } from "./schema/index.ts";
@@ -52,5 +52,49 @@ declare function indexHasManyRelation<TParent, TChild, LocalKey extends keyof TP
52
52
  declare function indexHasOneRelation<TParent, TChild, LocalKey extends keyof TParent & string, ForeignKey extends keyof TChild & string>(parents: readonly TParent[], children: readonly TChild[], relation: HasOneRelation<TParent, TChild, LocalKey, ForeignKey>): Map<TParent[LocalKey], TChild | undefined>;
53
53
  declare function indexBelongsToRelation<TChild, TParent, ForeignKey extends keyof TChild & string, OwnerKey extends keyof TParent & string>(children: readonly TChild[], parents: readonly TParent[], relation: BelongsToRelation<TChild, TParent, ForeignKey, OwnerKey>): Map<TChild[ForeignKey], TParent>;
54
54
  declare function indexBelongsToManyRelation<TParent, TRelated, Pivot extends object, ParentKey extends keyof TParent & string, RelatedKey extends keyof TRelated & string, ForeignPivotKey extends keyof Pivot & string, RelatedPivotKey extends keyof Pivot & string>(parents: readonly TParent[], pivotRows: readonly Pivot[], relatedRows: readonly TRelated[], relation: BelongsToManyRelation<TParent, TRelated, Pivot, ParentKey, RelatedKey, ForeignPivotKey, RelatedPivotKey>): Map<TParent[ParentKey], TRelated[]>;
55
- export type { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasOneRelation };
56
- export { belongsTo, belongsToMany, hasMany, hasOne, indexBelongsToManyRelation, indexBelongsToRelation, indexHasManyRelation, indexHasOneRelation, };
55
+ interface MorphManyRelation<TParent, TChild, LocalKey extends keyof TParent & string = keyof TParent & string, MorphTypeKey extends keyof TChild & string = keyof TChild & string, MorphIdKey extends keyof TChild & string = keyof TChild & string> {
56
+ type: "morphMany";
57
+ name: string;
58
+ localKey: LocalKey;
59
+ morphTypeKey: MorphTypeKey;
60
+ morphIdKey: MorphIdKey;
61
+ morphType: string;
62
+ }
63
+ interface MorphOneRelation<TParent, TChild, LocalKey extends keyof TParent & string = keyof TParent & string, MorphTypeKey extends keyof TChild & string = keyof TChild & string, MorphIdKey extends keyof TChild & string = keyof TChild & string> {
64
+ type: "morphOne";
65
+ name: string;
66
+ localKey: LocalKey;
67
+ morphTypeKey: MorphTypeKey;
68
+ morphIdKey: MorphIdKey;
69
+ morphType: string;
70
+ }
71
+ interface MorphToRelation<TChild, MorphTypeKey extends keyof TChild & string = keyof TChild & string, MorphIdKey extends keyof TChild & string = keyof TChild & string> {
72
+ type: "morphTo";
73
+ name: string;
74
+ morphTypeKey: MorphTypeKey;
75
+ morphIdKey: MorphIdKey;
76
+ }
77
+ declare function morphMany<TParent, TChild, LocalKey extends keyof TParent & string = keyof TParent & string, MorphTypeKey extends keyof TChild & string = keyof TChild & string, MorphIdKey extends keyof TChild & string = keyof TChild & string>(definition: {
78
+ name: string;
79
+ localKey: LocalKey;
80
+ morphTypeKey: MorphTypeKey;
81
+ morphIdKey: MorphIdKey;
82
+ morphType: string;
83
+ }): MorphManyRelation<TParent, TChild, LocalKey, MorphTypeKey, MorphIdKey>;
84
+ declare function morphOne<TParent, TChild, LocalKey extends keyof TParent & string = keyof TParent & string, MorphTypeKey extends keyof TChild & string = keyof TChild & string, MorphIdKey extends keyof TChild & string = keyof TChild & string>(definition: {
85
+ name: string;
86
+ localKey: LocalKey;
87
+ morphTypeKey: MorphTypeKey;
88
+ morphIdKey: MorphIdKey;
89
+ morphType: string;
90
+ }): MorphOneRelation<TParent, TChild, LocalKey, MorphTypeKey, MorphIdKey>;
91
+ declare function morphTo<TChild, MorphTypeKey extends keyof TChild & string = keyof TChild & string, MorphIdKey extends keyof TChild & string = keyof TChild & string>(definition: {
92
+ name: string;
93
+ morphTypeKey: MorphTypeKey;
94
+ morphIdKey: MorphIdKey;
95
+ }): MorphToRelation<TChild, MorphTypeKey, MorphIdKey>;
96
+ declare function indexMorphManyRelation<TParent, TChild, LocalKey extends keyof TParent & string, MorphTypeKey extends keyof TChild & string, MorphIdKey extends keyof TChild & string>(parents: readonly TParent[], children: readonly TChild[], relation: MorphManyRelation<TParent, TChild, LocalKey, MorphTypeKey, MorphIdKey>): Map<TParent[LocalKey], TChild[]>;
97
+ declare function indexMorphOneRelation<TParent, TChild, LocalKey extends keyof TParent & string, MorphTypeKey extends keyof TChild & string, MorphIdKey extends keyof TChild & string>(parents: readonly TParent[], children: readonly TChild[], relation: MorphOneRelation<TParent, TChild, LocalKey, MorphTypeKey, MorphIdKey>): Map<TParent[LocalKey], TChild | undefined>;
98
+ declare function indexMorphToRelation<TChild, TParent extends object, MorphTypeKey extends keyof TChild & string, MorphIdKey extends keyof TChild & string, OwnerKey extends keyof TParent & string>(children: readonly TChild[], parentsByType: ReadonlyMap<string, ReadonlyMap<TParent[OwnerKey], TParent>>, relation: MorphToRelation<TChild, MorphTypeKey, MorphIdKey>): Map<TChild[MorphIdKey], TParent>;
99
+ export type { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasOneRelation, MorphManyRelation, MorphOneRelation, MorphToRelation, };
100
+ export { belongsTo, belongsToMany, hasMany, hasOne, indexBelongsToManyRelation, indexBelongsToRelation, indexHasManyRelation, indexHasOneRelation, indexMorphManyRelation, indexMorphOneRelation, indexMorphToRelation, morphMany, morphOne, morphTo, };
@@ -1,6 +1,6 @@
1
1
  import type { PaginatedResult } from "../pagination/index.ts";
2
2
  import type BaseRepository from "./baseRepository.ts";
3
- import type { BelongsToRelation, HasManyRelation } from "./relationships.ts";
3
+ import type { BelongsToRelation, HasManyRelation, MorphManyRelation, MorphOneRelation, MorphToRelation } from "./relationships.ts";
4
4
  import type { QueryOptions, QueryWhere } from "./types.ts";
5
5
  import { WhereBuilder } from "./whereBuilder.ts";
6
6
  type LoadedRow = Record<string, unknown>;
@@ -22,6 +22,9 @@ declare class RepositoryQuery<TEntity extends object, PrimaryKey extends keyof T
22
22
  having(having: QueryWhere<TEntity>): this;
23
23
  withHasMany<TChild extends object, LocalKey extends keyof TEntity & string, ForeignKey extends keyof TChild & string, Alias extends string>(as: Alias, relation: HasManyRelation<TEntity, TChild, LocalKey, ForeignKey>, childRepository: BaseRepository<TChild, keyof TChild & string>, options?: Omit<QueryOptions<TChild>, "where">): this;
24
24
  withBelongsTo<TParent extends object, ForeignKey extends keyof TEntity & string, OwnerKey extends keyof TParent & string, Alias extends string>(as: Alias, relation: BelongsToRelation<TEntity, TParent, ForeignKey, OwnerKey>, parentRepository: BaseRepository<TParent, OwnerKey>, options?: Omit<QueryOptions<TParent>, "where">): this;
25
+ withMorphMany<TChild extends object, LocalKey extends keyof TEntity & string, MorphTypeKey extends keyof TChild & string, MorphIdKey extends keyof TChild & string, Alias extends string>(as: Alias, relation: MorphManyRelation<TEntity, TChild, LocalKey, MorphTypeKey, MorphIdKey>, childRepository: BaseRepository<TChild, keyof TChild & string>, options?: Omit<QueryOptions<TChild>, "where">): this;
26
+ withMorphOne<TChild extends object, LocalKey extends keyof TEntity & string, MorphTypeKey extends keyof TChild & string, MorphIdKey extends keyof TChild & string, Alias extends string>(as: Alias, relation: MorphOneRelation<TEntity, TChild, LocalKey, MorphTypeKey, MorphIdKey>, childRepository: BaseRepository<TChild, keyof TChild & string>, options?: Omit<QueryOptions<TChild>, "where">): this;
27
+ withMorphTo<TParent extends object, MorphTypeKey extends keyof TEntity & string, MorphIdKey extends keyof TEntity & string, Alias extends string>(as: Alias, relation: MorphToRelation<TEntity, MorphTypeKey, MorphIdKey>, repositoriesByType: ReadonlyMap<string, BaseRepository<TParent, keyof TParent & string>>, options?: Omit<QueryOptions<TParent>, "where">): this;
25
28
  get(): Promise<Array<TEntity & LoadedRow>>;
26
29
  first(): Promise<(TEntity & LoadedRow) | null>;
27
30
  paginate(options: {
@@ -2,6 +2,7 @@ interface MailMessage {
2
2
  to: string;
3
3
  subject: string;
4
4
  body: string;
5
+ html?: string;
5
6
  }
6
7
  interface MailDriver {
7
8
  send(message: MailMessage): Promise<void>;
@@ -16,6 +17,7 @@ interface SmtpConfig {
16
17
  }
17
18
  type SmtpTransport = (config: SmtpConfig, message: MailMessage) => Promise<void>;
18
19
  declare function resolveSmtpConfig(): SmtpConfig;
20
+ declare function buildSmtpPayload(from: string, message: MailMessage): string;
19
21
  declare class LogMailDriver implements MailDriver {
20
22
  send(message: MailMessage): Promise<void>;
21
23
  }
@@ -33,4 +35,4 @@ declare class Mailer {
33
35
  declare function createMailDriver(): MailDriver;
34
36
  declare function mailer(): Mailer;
35
37
  export type { MailDriver, MailMessage, SmtpConfig, SmtpTransport };
36
- export { createMailDriver, LogMailDriver, Mailer, mailer, resolveSmtpConfig, SmtpMailDriver };
38
+ export { buildSmtpPayload, createMailDriver, LogMailDriver, Mailer, mailer, resolveSmtpConfig, SmtpMailDriver, };
@@ -0,0 +1,15 @@
1
+ interface MarkdownMailLayoutOptions {
2
+ title?: string;
3
+ preview?: string;
4
+ footer?: string;
5
+ }
6
+ interface RenderedMarkdownMail {
7
+ html: string;
8
+ text: string;
9
+ }
10
+ declare function stripMarkdown(markdown: string): string;
11
+ declare function markdownToHtml(markdown: string): string;
12
+ declare function wrapMarkdownMailLayout(bodyHtml: string, options?: MarkdownMailLayoutOptions): string;
13
+ declare function renderMarkdownMail(markdown: string, options?: MarkdownMailLayoutOptions): RenderedMarkdownMail;
14
+ export type { MarkdownMailLayoutOptions, RenderedMarkdownMail };
15
+ export { markdownToHtml, renderMarkdownMail, stripMarkdown, wrapMarkdownMailLayout };
@@ -0,0 +1,12 @@
1
+ import type { Mailer, MailMessage } from "./mailer.ts";
2
+ import { type MarkdownMailLayoutOptions } from "./markdownMail.ts";
3
+ interface MarkdownMailableInput {
4
+ to: string;
5
+ subject: string;
6
+ markdown: string;
7
+ layout?: MarkdownMailLayoutOptions;
8
+ }
9
+ declare function buildMarkdownMailMessage(input: MarkdownMailableInput): MailMessage;
10
+ declare function sendMarkdownMail(mailer: Mailer, input: MarkdownMailableInput): Promise<void>;
11
+ export type { MarkdownMailableInput };
12
+ export { buildMarkdownMailMessage, sendMarkdownMail };
@@ -0,0 +1,13 @@
1
+ import type { Mailer } from "../mail/mailer.ts";
2
+ import type { Notification } from "./notification.ts";
3
+ import type { DatabaseNotificationStore, Notifiable } from "./types.ts";
4
+ declare class NotificationDispatcher {
5
+ private readonly mailer;
6
+ private readonly databaseStore;
7
+ constructor(mailer: Mailer, databaseStore?: DatabaseNotificationStore | null);
8
+ send(notifiable: Notifiable, notification: Notification): Promise<void>;
9
+ private sendMail;
10
+ private sendDatabase;
11
+ }
12
+ declare function createNotificationDispatcher(mailer: Mailer, databaseStore?: DatabaseNotificationStore): NotificationDispatcher;
13
+ export { createNotificationDispatcher, NotificationDispatcher };
@@ -0,0 +1,3 @@
1
+ export { createNotificationDispatcher, NotificationDispatcher } from "./dispatcher.ts";
2
+ export { Notification } from "./notification.ts";
3
+ export type { DatabaseNotificationPayload, DatabaseNotificationStore, MailNotificationMessage, Notifiable, NotificationChannelName, } from "./types.ts";
@@ -0,0 +1,7 @@
1
+ import type { DatabaseNotificationPayload, MailNotificationMessage, NotificationChannelName } from "./types.ts";
2
+ declare abstract class Notification<TNotifiable = unknown> {
3
+ via(_notifiable: TNotifiable): NotificationChannelName[];
4
+ toMail(_notifiable: TNotifiable): MailNotificationMessage | null;
5
+ toDatabase(_notifiable: TNotifiable): DatabaseNotificationPayload | null;
6
+ }
7
+ export { Notification };
@@ -0,0 +1,25 @@
1
+ type NotificationChannelName = "mail" | "database";
2
+ interface MailNotificationMessage {
3
+ subject: string;
4
+ markdown?: string;
5
+ body?: string;
6
+ html?: string;
7
+ }
8
+ interface DatabaseNotificationPayload {
9
+ type: string;
10
+ title: string;
11
+ body: string;
12
+ data?: Record<string, unknown>;
13
+ notifiableType?: string | null;
14
+ notifiableId?: number | null;
15
+ }
16
+ interface DatabaseNotificationStore {
17
+ create(input: DatabaseNotificationPayload & {
18
+ userId: number;
19
+ }): Promise<Record<string, unknown>>;
20
+ }
21
+ interface Notifiable {
22
+ getNotificationKey(): string | number;
23
+ routeNotificationFor(channel: NotificationChannelName): string | number | null;
24
+ }
25
+ export type { DatabaseNotificationPayload, DatabaseNotificationStore, MailNotificationMessage, Notifiable, NotificationChannelName, };
@@ -10,6 +10,7 @@ declare class FailedJobService {
10
10
  }): Promise<FailedJobRecord>;
11
11
  listRecent(limit?: number): Promise<FailedJobRecord[]>;
12
12
  retry(id: number): Promise<FailedJobRecord>;
13
+ delete(id: number): Promise<void>;
13
14
  flush(): Promise<number>;
14
15
  }
15
16
  export default FailedJobService;
@@ -2,6 +2,7 @@ import FailedJobRepository from "./failedJobRepository.ts";
2
2
  import FailedJobService from "./failedJobService.ts";
3
3
  import type { Job, Queue } from "./index.ts";
4
4
  import { jobRegistry } from "./jobRegistry.ts";
5
+ import { runQueueJob } from "./jobRunner.ts";
5
6
  import { QueueWorker, RedisQueue } from "./redisQueue.ts";
6
7
  import { ResilientQueue } from "./resilientQueue.ts";
7
8
  declare function createFailedJobService(): FailedJobService;
@@ -12,4 +13,4 @@ declare function createProductionQueue(driver: "sync" | "async" | "redis", optio
12
13
  registerJobs?: () => void;
13
14
  }): Queue;
14
15
  declare function createQueueWorker(redisUrl: string, failedJobs?: FailedJobService): QueueWorker;
15
- export { createFailedJobService, createProductionQueue, createQueueWorker, createTrackedJob, FailedJobRepository, FailedJobService, jobRegistry, QueueWorker, RedisQueue, ResilientQueue, };
16
+ export { createFailedJobService, createProductionQueue, createQueueWorker, createTrackedJob, FailedJobRepository, FailedJobService, jobRegistry, QueueWorker, RedisQueue, ResilientQueue, runQueueJob, };
@@ -12,8 +12,9 @@ interface S3StorageConfig {
12
12
  endpoint?: string;
13
13
  }
14
14
  declare class LocalStorageDriver implements StorageDriver {
15
- private readonly rootDirectory;
16
- constructor(rootDirectory: string);
15
+ private readonly rootDirectory?;
16
+ constructor(rootDirectory?: string | undefined);
17
+ private resolveRootDirectory;
17
18
  private resolvePath;
18
19
  put(path: string, contents: string | Uint8Array): Promise<string>;
19
20
  get(path: string): Promise<Uint8Array | null>;
@@ -37,5 +38,7 @@ declare function resolveS3Config(): S3StorageConfig;
37
38
  declare function createS3Client(config?: S3StorageConfig): S3Client;
38
39
  declare function createStorageDriver(): StorageDriver;
39
40
  declare function storage(): StorageManager;
41
+ /** Test hook: drop the process-wide storage singleton (e.g. after changing STORAGE_PATH). */
42
+ declare function resetDefaultStorage(): void;
40
43
  export type { S3StorageConfig, StorageDriver };
41
- export { createS3Client, createStorageDriver, LocalStorageDriver, resolveS3Config, S3StorageDriver, StorageManager, storage, };
44
+ export { createS3Client, createStorageDriver, LocalStorageDriver, resetDefaultStorage, resolveS3Config, S3StorageDriver, StorageManager, storage, };
@@ -5,9 +5,12 @@
5
5
  export { resolveApplicationAuth, resolveApplicationCache, resolveApplicationConfig, resolveApplicationDependencies, resolveApplicationLogger, resolveApplicationPolicyGate, resolveApplicationQueue, setActiveApplicationContext, } from "../bootstrap/applicationRegistry.ts";
6
6
  export type { ServiceProvider } from "../bootstrap/contracts.ts";
7
7
  export { ConfigStore, resolveService, ServiceContainer, } from "../bootstrap/contracts.ts";
8
+ export type { AdminColumn, AdminColumnType, AdminResource, AdminResourceDefinition, AdminResourceHandlers, } from "../core/admin/index.ts";
9
+ export { AdminResourceRegistry, formatAdminValue, } from "../core/admin/index.ts";
8
10
  export type { AbilityChecker } from "../core/auth/abilityChecker.ts";
9
11
  export type { AuthUser } from "../core/auth/authContext.ts";
10
12
  export { currentAuthUser, runWithAuthUser } from "../core/auth/authContext.ts";
13
+ export { createMembershipMiddleware } from "../core/auth/membershipMiddleware.ts";
11
14
  export { Policy, PolicyGate } from "../core/auth/policy.ts";
12
15
  export { default as CacheRepository } from "../core/cache/repository.ts";
13
16
  export { CACHE_TAGS } from "../core/cache/tags.ts";
@@ -21,8 +24,8 @@ export { freshDatabase, getMigrationStatus, loadMigrationsFromDirectory, migrate
21
24
  export type { Migration, MigrationDatabase, MigrationStatus, } from "../core/database/migrations/types.ts";
22
25
  export type { CastType, GlobalScopeFn, ModelConstructor } from "../core/database/model.ts";
23
26
  export { applyCasts, dehydrateValue, filterMassAssignable, hydrateValue, Model, registerModelRepository, } from "../core/database/model.ts";
24
- export type { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasOneRelation, } from "../core/database/relationships.ts";
25
- export { belongsTo, belongsToMany, hasMany, hasOne, indexBelongsToManyRelation, indexBelongsToRelation, indexHasManyRelation, indexHasOneRelation, } from "../core/database/relationships.ts";
27
+ export type { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasOneRelation, MorphManyRelation, MorphOneRelation, MorphToRelation, } from "../core/database/relationships.ts";
28
+ export { belongsTo, belongsToMany, hasMany, hasOne, indexBelongsToManyRelation, indexBelongsToRelation, indexHasManyRelation, indexHasOneRelation, indexMorphManyRelation, indexMorphOneRelation, indexMorphToRelation, morphMany, morphOne, morphTo, } from "../core/database/relationships.ts";
26
29
  export { RepositoryQuery } from "../core/database/repositoryQuery.ts";
27
30
  export type { BlueprintAction, BlueprintCallback, ColumnKind, DatabaseDriver, ForeignKeyOptions, Grammar, IndexDefinition, IndexKind, ResolveDatabaseDriverOptions, SchemaBuilder, } from "../core/database/schema/index.ts";
28
31
  export { Blueprint, ColumnDefinition, compileBlueprint, createSchemaBuilder, ForeignIdColumnDefinition, grammarForDriver, inferReferencedTable, MySqlGrammar, PostgresGrammar, resolveDatabaseDriver, Schema, SqliteGrammar, UnsupportedSchemaFeatureError, } from "../core/database/schema/index.ts";
@@ -38,16 +41,20 @@ export { EventBus } from "../core/events/eventBus.ts";
38
41
  export { auth, cache, config, events, log, mail, policyGate, queue, storage, } from "../core/facades/index.ts";
39
42
  export { createBodySizeLimitMiddleware } from "../core/http/bodySizeLimitMiddleware.ts";
40
43
  export { readBunRequestCookie, readRequestCookie } from "../core/http/cookies.ts";
44
+ export { createCorsMiddleware } from "../core/http/corsMiddleware.ts";
41
45
  export { createCsrfMiddleware } from "../core/http/csrfMiddleware.ts";
42
46
  export { createCsrfProtection } from "../core/http/csrfProtection.ts";
43
47
  export { createCsrfTokenCookie, readSubmittedCsrfToken, readSubmittedCsrfTokenFromBody, resolveCsrfToken, resolveCsrfTokenForRequest, verifyCsrfToken, } from "../core/http/csrfToken.ts";
44
48
  export { assertIfMatch, etagFromResource, isEtagEnabled, } from "../core/http/etag.ts";
49
+ export { createFlashMiddleware } from "../core/http/flashMiddleware.ts";
45
50
  export { FormRequest } from "../core/http/formRequest.ts";
46
- export { applyMiddlewareToRoutes, composeMiddleware, createAuthMiddleware, createAuthorizeMiddleware, createdResponse, createRequireAuthMiddleware, jsonResponse, noContentResponse, paginatedResponse, parsePaginationQuery, securedBindRouteModel, securedBindRouteModelByKey, withErrorHandling, withMiddleware, } from "../core/http/index.ts";
51
+ export { applyMiddlewareToRoutes, composeMiddleware, createAuthMiddleware, createAuthorizeMiddleware, createdResponse, createRequireAuthMiddleware, jsonResponse, noContentResponse, paginatedResponse, parsePaginationQuery, requestIdMiddleware, securedBindRouteModel, securedBindRouteModelByKey, withErrorHandling, withMiddleware, } from "../core/http/index.ts";
47
52
  export { createLoginThrottleMiddleware } from "../core/http/loginThrottleMiddleware.ts";
48
53
  export { createMemoryThrottleMiddleware } from "../core/http/memoryThrottleMiddleware.ts";
49
54
  export { createMetricsMiddleware, normalizeMetricPath } from "../core/http/metricsMiddleware.ts";
50
55
  export type { Middleware, RouteHandler } from "../core/http/middleware.ts";
56
+ export { createRequireAbilityMiddleware } from "../core/http/requireAbilityMiddleware.ts";
57
+ export { createRequireGlobalAdminMiddleware } from "../core/http/requireGlobalAdminMiddleware.ts";
51
58
  export { createRequireWebAuthMiddleware } from "../core/http/requireWebAuthMiddleware.ts";
52
59
  export { serializeDate, toPaginatedResourceCollection, toResourceCollection, } from "../core/http/resources.ts";
53
60
  export type { RouteRequest } from "../core/http/route.ts";
@@ -55,18 +62,28 @@ export { createSecurityHeadersMiddleware } from "../core/http/securityHeadersMid
55
62
  export { createThrottleMiddleware } from "../core/http/throttleMiddleware.ts";
56
63
  export { WebFormRequest } from "../core/http/webFormRequest.ts";
57
64
  export { installGracefulShutdownSignals, registerShutdownHandler, runGracefulShutdown, } from "../core/lifecycle/gracefulShutdown.ts";
65
+ export { createRequestLoggingMiddleware } from "../core/logging/requestLoggingMiddleware.ts";
58
66
  export type { MailDriver, MailMessage } from "../core/mail/mailer.ts";
59
- export { LogMailDriver, Mailer, mailer } from "../core/mail/mailer.ts";
67
+ export { buildSmtpPayload, LogMailDriver, Mailer, mailer, } from "../core/mail/mailer.ts";
68
+ export type { MarkdownMailLayoutOptions, RenderedMarkdownMail } from "../core/mail/markdownMail.ts";
69
+ export { markdownToHtml, renderMarkdownMail, stripMarkdown, wrapMarkdownMailLayout, } from "../core/mail/markdownMail.ts";
70
+ export type { MarkdownMailableInput } from "../core/mail/markdownMailable.ts";
71
+ export { buildMarkdownMailMessage, sendMarkdownMail } from "../core/mail/markdownMailable.ts";
60
72
  export type { MetricLabels } from "../core/metrics/prometheus.ts";
61
73
  export { PrometheusRegistry, prometheusRegistry } from "../core/metrics/prometheus.ts";
74
+ export type { DatabaseNotificationPayload, DatabaseNotificationStore, MailNotificationMessage, Notifiable, NotificationChannelName, } from "../core/notifications/index.ts";
75
+ export { createNotificationDispatcher, Notification, NotificationDispatcher, } from "../core/notifications/index.ts";
62
76
  export type { CursorPaginatedResult, PaginatedResult, PaginationMeta, } from "../core/pagination/index.ts";
63
77
  export type { Queue, QueuePriority } from "../core/queue/index.ts";
64
78
  export { AsyncQueue, createQueue, Job, SyncQueue } from "../core/queue/index.ts";
65
- export { createFailedJobService, createProductionQueue, createQueueWorker, createTrackedJob, FailedJobRepository, FailedJobService, jobRegistry, QueueWorker, RedisQueue, ResilientQueue, } from "../core/queue/publicQueue.ts";
79
+ export { createFailedJobService, createProductionQueue, createQueueWorker, createTrackedJob, FailedJobRepository, FailedJobService, jobRegistry, QueueWorker, RedisQueue, ResilientQueue, runQueueJob, } from "../core/queue/publicQueue.ts";
66
80
  export type { ScheduledTask } from "../core/scheduler/schedule.ts";
67
81
  export { appSchedule, runDueScheduledTasks, Schedule } from "../core/scheduler/schedule.ts";
82
+ export { isPublicReadsEnabled } from "../core/security/publicReads.ts";
68
83
  export type { StorageDriver } from "../core/storage/storage.ts";
69
- export { LocalStorageDriver, StorageManager } from "../core/storage/storage.ts";
84
+ export { LocalStorageDriver, resetDefaultStorage, StorageManager, } from "../core/storage/storage.ts";
85
+ export { createTenantMiddleware } from "../core/tenant/tenantMiddleware.ts";
86
+ export { createTracingMiddleware } from "../core/tracing/tracingMiddleware.ts";
70
87
  export type { ValidationRule, ValidationSchema } from "../core/validation/rules.ts";
71
88
  export { emailRule, maxLength, minLength, required, stringRule, validateObject, } from "../core/validation/rules.ts";
72
89
  export { DEFAULT_VIEWS_DIRECTORY, EtaViewEngine, htmlResponse, isHtmxRequest, resolveWebLayoutData, } from "../core/view/index.ts";