@kaloma-ai/framework-api 0.0.0-stage → 0.5.0

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.
@@ -0,0 +1,215 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/auth/schema.ts
8
+ var schema_exports = {};
9
+ __export(schema_exports, {
10
+ account: () => account,
11
+ accountRelations: () => accountRelations,
12
+ apikey: () => apikey,
13
+ invitation: () => invitation,
14
+ invitationRelations: () => invitationRelations,
15
+ member: () => member,
16
+ memberRelations: () => memberRelations,
17
+ organization: () => organization,
18
+ organizationRelations: () => organizationRelations,
19
+ session: () => session,
20
+ sessionRelations: () => sessionRelations,
21
+ user: () => user,
22
+ userRelations: () => userRelations,
23
+ verification: () => verification
24
+ });
25
+ import { relations } from "drizzle-orm";
26
+ import {
27
+ pgTable,
28
+ text,
29
+ timestamp,
30
+ boolean,
31
+ index,
32
+ uniqueIndex,
33
+ integer
34
+ } from "drizzle-orm/pg-core";
35
+ var user = pgTable("user", {
36
+ id: text("id").primaryKey(),
37
+ name: text("name").notNull(),
38
+ email: text("email").notNull().unique(),
39
+ emailVerified: boolean("email_verified").default(false).notNull(),
40
+ image: text("image"),
41
+ createdAt: timestamp("created_at").defaultNow().notNull(),
42
+ updatedAt: timestamp("updated_at").defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
43
+ });
44
+ var session = pgTable(
45
+ "session",
46
+ {
47
+ id: text("id").primaryKey(),
48
+ expiresAt: timestamp("expires_at").notNull(),
49
+ token: text("token").notNull().unique(),
50
+ createdAt: timestamp("created_at").defaultNow().notNull(),
51
+ updatedAt: timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull(),
52
+ ipAddress: text("ip_address"),
53
+ userAgent: text("user_agent"),
54
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
55
+ activeOrganizationId: text("active_organization_id")
56
+ },
57
+ (table) => [index("session_userId_idx").on(table.userId)]
58
+ );
59
+ var account = pgTable(
60
+ "account",
61
+ {
62
+ id: text("id").primaryKey(),
63
+ accountId: text("account_id").notNull(),
64
+ providerId: text("provider_id").notNull(),
65
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
66
+ accessToken: text("access_token"),
67
+ refreshToken: text("refresh_token"),
68
+ idToken: text("id_token"),
69
+ accessTokenExpiresAt: timestamp("access_token_expires_at"),
70
+ refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
71
+ scope: text("scope"),
72
+ password: text("password"),
73
+ createdAt: timestamp("created_at").defaultNow().notNull(),
74
+ updatedAt: timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
75
+ },
76
+ (table) => [index("account_userId_idx").on(table.userId)]
77
+ );
78
+ var verification = pgTable(
79
+ "verification",
80
+ {
81
+ id: text("id").primaryKey(),
82
+ identifier: text("identifier").notNull(),
83
+ value: text("value").notNull(),
84
+ expiresAt: timestamp("expires_at").notNull(),
85
+ createdAt: timestamp("created_at").defaultNow().notNull(),
86
+ updatedAt: timestamp("updated_at").defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
87
+ },
88
+ (table) => [index("verification_identifier_idx").on(table.identifier)]
89
+ );
90
+ var organization = pgTable(
91
+ "organization",
92
+ {
93
+ id: text("id").primaryKey(),
94
+ name: text("name").notNull(),
95
+ slug: text("slug").notNull().unique(),
96
+ logo: text("logo"),
97
+ createdAt: timestamp("created_at").notNull(),
98
+ metadata: text("metadata")
99
+ },
100
+ (table) => [uniqueIndex("organization_slug_uidx").on(table.slug)]
101
+ );
102
+ var member = pgTable(
103
+ "member",
104
+ {
105
+ id: text("id").primaryKey(),
106
+ organizationId: text("organization_id").notNull().references(() => organization.id, { onDelete: "cascade" }),
107
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
108
+ role: text("role").default("member").notNull(),
109
+ createdAt: timestamp("created_at").notNull()
110
+ },
111
+ (table) => [
112
+ index("member_organizationId_idx").on(table.organizationId),
113
+ index("member_userId_idx").on(table.userId)
114
+ ]
115
+ );
116
+ var invitation = pgTable(
117
+ "invitation",
118
+ {
119
+ id: text("id").primaryKey(),
120
+ organizationId: text("organization_id").notNull().references(() => organization.id, { onDelete: "cascade" }),
121
+ email: text("email").notNull(),
122
+ role: text("role"),
123
+ status: text("status").default("pending").notNull(),
124
+ expiresAt: timestamp("expires_at").notNull(),
125
+ createdAt: timestamp("created_at").defaultNow().notNull(),
126
+ inviterId: text("inviter_id").notNull().references(() => user.id, { onDelete: "cascade" })
127
+ },
128
+ (table) => [
129
+ index("invitation_organizationId_idx").on(table.organizationId),
130
+ index("invitation_email_idx").on(table.email)
131
+ ]
132
+ );
133
+ var userRelations = relations(user, ({ many }) => ({
134
+ sessions: many(session),
135
+ accounts: many(account),
136
+ members: many(member),
137
+ invitations: many(invitation)
138
+ }));
139
+ var sessionRelations = relations(session, ({ one }) => ({
140
+ user: one(user, {
141
+ fields: [session.userId],
142
+ references: [user.id]
143
+ })
144
+ }));
145
+ var accountRelations = relations(account, ({ one }) => ({
146
+ user: one(user, {
147
+ fields: [account.userId],
148
+ references: [user.id]
149
+ })
150
+ }));
151
+ var organizationRelations = relations(organization, ({ many }) => ({
152
+ members: many(member),
153
+ invitations: many(invitation)
154
+ }));
155
+ var memberRelations = relations(member, ({ one }) => ({
156
+ organization: one(organization, {
157
+ fields: [member.organizationId],
158
+ references: [organization.id]
159
+ }),
160
+ user: one(user, {
161
+ fields: [member.userId],
162
+ references: [user.id]
163
+ })
164
+ }));
165
+ var invitationRelations = relations(invitation, ({ one }) => ({
166
+ organization: one(organization, {
167
+ fields: [invitation.organizationId],
168
+ references: [organization.id]
169
+ }),
170
+ user: one(user, {
171
+ fields: [invitation.inviterId],
172
+ references: [user.id]
173
+ })
174
+ }));
175
+ var apikey = pgTable(
176
+ "apikey",
177
+ {
178
+ id: text("id").primaryKey(),
179
+ configId: text("config_id").default("default").notNull(),
180
+ name: text("name"),
181
+ start: text("start"),
182
+ referenceId: text("reference_id").notNull(),
183
+ prefix: text("prefix"),
184
+ key: text("key").notNull(),
185
+ refillInterval: integer("refill_interval"),
186
+ refillAmount: integer("refill_amount"),
187
+ lastRefillAt: timestamp("last_refill_at"),
188
+ enabled: boolean("enabled").default(true),
189
+ rateLimitEnabled: boolean("rate_limit_enabled").default(true),
190
+ rateLimitTimeWindow: integer("rate_limit_time_window").default(6e4),
191
+ rateLimitMax: integer("rate_limit_max").default(100),
192
+ requestCount: integer("request_count").default(0),
193
+ remaining: integer("remaining"),
194
+ lastRequest: timestamp("last_request"),
195
+ expiresAt: timestamp("expires_at"),
196
+ createdAt: timestamp("created_at").notNull(),
197
+ updatedAt: timestamp("updated_at").notNull(),
198
+ permissions: text("permissions"),
199
+ metadata: text("metadata")
200
+ },
201
+ (table) => [
202
+ index("apikey_configId_idx").on(table.configId),
203
+ index("apikey_referenceId_idx").on(table.referenceId),
204
+ index("apikey_key_idx").on(table.key)
205
+ ]
206
+ );
207
+
208
+ export {
209
+ user,
210
+ organization,
211
+ member,
212
+ invitation,
213
+ apikey,
214
+ schema_exports
215
+ };
@@ -0,0 +1,84 @@
1
+ import { D as Db, C as Config } from './app-UFeIdPnm.js';
2
+ export { A as AppAuthz, a as AppDeps, b as AuditFn, c as Auth, d as AuthEnv, e as Authz, f as AuthzError, B as BACKUP_STORAGE, g as Brand, h as BrandService, i as Catalog, j as ConnectionError, k as ConnectionKind, l as ConnectionSlot, m as ConnectionStatus, n as ConnectionView, o as Connections, p as DEFAULT_STORAGE, E as EMAIL_CONNECTION, q as Email, r as EmailSender, F as FieldDef, s as FileStorage, H as HealthDeps, L as Llm, t as LlmCallOptions, u as LlmGetOptions, v as LoadedBrand, O as Operations, P as PermissionDef, R as RoleDef, S as SessionUser, w as SettingDef, x as SettingType, y as SettingView, z as Settings, G as SmtpSettings, I as StoredFile, U as Usage, J as assertDefaultDeny, K as brandRoutes, M as buildCatalog, N as consoleEmailSender, Q as contrastOn, T as createApp, V as createAuth, W as createAuthz, X as createBrandService, Y as createConnections, Z as createDb, _ as createEmailSender, $ as createLocalFileStorage, a0 as createOperations, a1 as createSettings, a2 as findUndeclaredRoutes, a3 as frameworkPermissions, a4 as frameworkSettings, a5 as getCompanyId, a6 as healthRoutes, a7 as loadBrand, a8 as loadConfig, a9 as publicRoute, aa as requirePermission, ab as requireSession, ac as sessionMiddleware, ad as smtpSender } from './app-UFeIdPnm.js';
3
+ import 'hono/types';
4
+ import 'hono';
5
+ import 'zod';
6
+ import 'drizzle-orm/postgres-js';
7
+ import 'postgres';
8
+ import 'node:stream';
9
+ import 'ai';
10
+ import 'drizzle-orm/pg-core';
11
+
12
+ /** The folder with the framework's own migrations, inside the installed package (`src/` and `dist/` sit next to `drizzle/`). */
13
+ declare function frameworkMigrationsDir(): string;
14
+ /**
15
+ * Applies pending migrations from a folder generated by drizzle-kit. Safe to run on every start.
16
+ * The app's own migrations use their own `table`, so they never interfere with the framework's.
17
+ *
18
+ * Drizzle only runs migrations newer than the newest one it has applied, so a migration with an older
19
+ * timestamp (two branches merged, a hotfix released late) would be skipped without a word. After migrating,
20
+ * every migration in the folder must be recorded as applied, otherwise this throws and the API does not start.
21
+ */
22
+ declare function runMigrations(db: Db, migrationsFolder: string, table?: string): Promise<void>;
23
+
24
+ /**
25
+ * Settings that make a real deployment unsafe or useless. Errors stop the app from starting;
26
+ * warnings are printed. Only applies in production (NODE_ENV=production, which the Docker image sets).
27
+ */
28
+ declare function productionProblems(config: Config): {
29
+ errors: string[];
30
+ warnings: string[];
31
+ };
32
+
33
+ /** The framework release this app runs (from the package version). Shown by /api/health, the Status page and in backups. */
34
+ declare const FRAMEWORK_VERSION: string;
35
+
36
+ interface GroupMember {
37
+ id: string;
38
+ name: string;
39
+ email: string;
40
+ }
41
+ interface GroupView {
42
+ id: string;
43
+ name: string;
44
+ description: string;
45
+ members: GroupMember[];
46
+ }
47
+ interface GroupRef {
48
+ id: string;
49
+ name: string;
50
+ }
51
+ interface MembersChange {
52
+ group: GroupView;
53
+ added: GroupMember[];
54
+ removed: GroupMember[];
55
+ }
56
+ interface Groups {
57
+ list(): Promise<GroupView[]>;
58
+ create(name: string, description?: string): Promise<GroupView>;
59
+ update(id: string, changes: {
60
+ name?: string;
61
+ description?: string;
62
+ }): Promise<GroupView>;
63
+ remove(id: string): Promise<GroupView>;
64
+ /** Replaces the members of a group with exactly these users. */
65
+ setMembers(id: string, userIds: string[]): Promise<MembersChange>;
66
+ /**
67
+ * The users in any of these groups, without duplicates. People who cannot sign in (deactivated or
68
+ * expired) are left out unless `includeInactive` is set, so notifications and assignments skip them.
69
+ */
70
+ memberIds(groupIds: string[], options?: {
71
+ includeInactive?: boolean;
72
+ }): Promise<string[]>;
73
+ /** The groups one user belongs to. */
74
+ forUser(userId: string): Promise<GroupRef[]>;
75
+ /** The groups of every user, for lists that show them. */
76
+ byUser(): Promise<Map<string, GroupRef[]>>;
77
+ }
78
+ /** Organizational groups. They say who belongs together; roles say what people may do. */
79
+ declare function createGroups({ db }: {
80
+ db: Db;
81
+ }): Groups;
82
+
83
+ export { Config, Db, FRAMEWORK_VERSION, createGroups, frameworkMigrationsDir, productionProblems, runMigrations };
84
+ export type { GroupMember, GroupRef, GroupView, Groups };
package/dist/index.js ADDED
@@ -0,0 +1,100 @@
1
+ import {
2
+ AuthzError,
3
+ BACKUP_STORAGE,
4
+ ConnectionError,
5
+ DEFAULT_STORAGE,
6
+ EMAIL_CONNECTION,
7
+ FRAMEWORK_VERSION,
8
+ assertDefaultDeny,
9
+ brandRoutes,
10
+ buildCatalog,
11
+ consoleEmailSender,
12
+ contrastOn,
13
+ createApp,
14
+ createAuth,
15
+ createAuthz,
16
+ createBrandService,
17
+ createConnections,
18
+ createDb,
19
+ createEmailSender,
20
+ createGroups,
21
+ createLocalFileStorage,
22
+ createOperations,
23
+ createSettings,
24
+ findUndeclaredRoutes,
25
+ frameworkMigrationsDir,
26
+ frameworkPermissions,
27
+ frameworkSettings,
28
+ getCompanyId,
29
+ healthRoutes,
30
+ loadBrand,
31
+ loadConfig,
32
+ publicRoute,
33
+ requirePermission,
34
+ requireSession,
35
+ runMigrations,
36
+ sessionMiddleware,
37
+ smtpSender
38
+ } from "./chunk-DI2XKT4C.js";
39
+ import "./chunk-R6W6GTUR.js";
40
+
41
+ // src/production.ts
42
+ var LOCAL_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
43
+ var PLACEHOLDER = /replace-with|change-me|changeme|example|secret|password/i;
44
+ function productionProblems(config) {
45
+ const errors = [];
46
+ const warnings = [];
47
+ if (config.NODE_ENV !== "production") return { errors, warnings };
48
+ if (PLACEHOLDER.test(config.AUTH_SECRET) || new Set(config.AUTH_SECRET).size < 8) {
49
+ errors.push("AUTH_SECRET is a placeholder or too simple. Generate one with: openssl rand -hex 32");
50
+ }
51
+ const url = new URL(config.PUBLIC_URL);
52
+ if (url.protocol !== "https:" && !LOCAL_HOSTS.has(url.hostname)) {
53
+ errors.push(`PUBLIC_URL must be https for a real address (got ${config.PUBLIC_URL}): sessions and passwords would travel unencrypted.`);
54
+ }
55
+ if (config.EMAIL_TRANSPORT === "console" && !LOCAL_HOSTS.has(url.hostname)) {
56
+ warnings.push("EMAIL_TRANSPORT=console: invitations, password resets and reminders are only printed in the log. Set EMAIL_TRANSPORT=smtp, or set up Email on the Connections page after the first sign-in.");
57
+ }
58
+ if (config.ALERT_EMAILS.length === 0) warnings.push("ALERT_EMAILS is empty: nobody is told about failed backups or outages.");
59
+ if (!config.BACKUP_ENABLED) warnings.push("BACKUP_ENABLED=false: there are no automatic backups.");
60
+ return { errors, warnings };
61
+ }
62
+ export {
63
+ AuthzError,
64
+ BACKUP_STORAGE,
65
+ ConnectionError,
66
+ DEFAULT_STORAGE,
67
+ EMAIL_CONNECTION,
68
+ FRAMEWORK_VERSION,
69
+ assertDefaultDeny,
70
+ brandRoutes,
71
+ buildCatalog,
72
+ consoleEmailSender,
73
+ contrastOn,
74
+ createApp,
75
+ createAuth,
76
+ createAuthz,
77
+ createBrandService,
78
+ createConnections,
79
+ createDb,
80
+ createEmailSender,
81
+ createGroups,
82
+ createLocalFileStorage,
83
+ createOperations,
84
+ createSettings,
85
+ findUndeclaredRoutes,
86
+ frameworkMigrationsDir,
87
+ frameworkPermissions,
88
+ frameworkSettings,
89
+ getCompanyId,
90
+ healthRoutes,
91
+ loadBrand,
92
+ loadConfig,
93
+ productionProblems,
94
+ publicRoute,
95
+ requirePermission,
96
+ requireSession,
97
+ runMigrations,
98
+ sessionMiddleware,
99
+ smtpSender
100
+ };
@@ -0,0 +1,130 @@
1
+ import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
2
+
3
+ declare const user: drizzle_orm_pg_core.PgTableWithColumns<{
4
+ name: "user";
5
+ schema: undefined;
6
+ columns: {
7
+ id: drizzle_orm_pg_core.PgColumn<{
8
+ name: "id";
9
+ tableName: "user";
10
+ dataType: "string";
11
+ columnType: "PgText";
12
+ data: string;
13
+ driverParam: string;
14
+ notNull: true;
15
+ hasDefault: false;
16
+ isPrimaryKey: true;
17
+ isAutoincrement: false;
18
+ hasRuntimeDefault: false;
19
+ enumValues: [string, ...string[]];
20
+ baseColumn: never;
21
+ identity: undefined;
22
+ generated: undefined;
23
+ }, {}, {}>;
24
+ name: drizzle_orm_pg_core.PgColumn<{
25
+ name: "name";
26
+ tableName: "user";
27
+ dataType: "string";
28
+ columnType: "PgText";
29
+ data: string;
30
+ driverParam: string;
31
+ notNull: true;
32
+ hasDefault: false;
33
+ isPrimaryKey: false;
34
+ isAutoincrement: false;
35
+ hasRuntimeDefault: false;
36
+ enumValues: [string, ...string[]];
37
+ baseColumn: never;
38
+ identity: undefined;
39
+ generated: undefined;
40
+ }, {}, {}>;
41
+ email: drizzle_orm_pg_core.PgColumn<{
42
+ name: "email";
43
+ tableName: "user";
44
+ dataType: "string";
45
+ columnType: "PgText";
46
+ data: string;
47
+ driverParam: string;
48
+ notNull: true;
49
+ hasDefault: false;
50
+ isPrimaryKey: false;
51
+ isAutoincrement: false;
52
+ hasRuntimeDefault: false;
53
+ enumValues: [string, ...string[]];
54
+ baseColumn: never;
55
+ identity: undefined;
56
+ generated: undefined;
57
+ }, {}, {}>;
58
+ emailVerified: drizzle_orm_pg_core.PgColumn<{
59
+ name: "email_verified";
60
+ tableName: "user";
61
+ dataType: "boolean";
62
+ columnType: "PgBoolean";
63
+ data: boolean;
64
+ driverParam: boolean;
65
+ notNull: true;
66
+ hasDefault: true;
67
+ isPrimaryKey: false;
68
+ isAutoincrement: false;
69
+ hasRuntimeDefault: false;
70
+ enumValues: undefined;
71
+ baseColumn: never;
72
+ identity: undefined;
73
+ generated: undefined;
74
+ }, {}, {}>;
75
+ image: drizzle_orm_pg_core.PgColumn<{
76
+ name: "image";
77
+ tableName: "user";
78
+ dataType: "string";
79
+ columnType: "PgText";
80
+ data: string;
81
+ driverParam: string;
82
+ notNull: false;
83
+ hasDefault: false;
84
+ isPrimaryKey: false;
85
+ isAutoincrement: false;
86
+ hasRuntimeDefault: false;
87
+ enumValues: [string, ...string[]];
88
+ baseColumn: never;
89
+ identity: undefined;
90
+ generated: undefined;
91
+ }, {}, {}>;
92
+ createdAt: drizzle_orm_pg_core.PgColumn<{
93
+ name: "created_at";
94
+ tableName: "user";
95
+ dataType: "date";
96
+ columnType: "PgTimestamp";
97
+ data: Date;
98
+ driverParam: string;
99
+ notNull: true;
100
+ hasDefault: true;
101
+ isPrimaryKey: false;
102
+ isAutoincrement: false;
103
+ hasRuntimeDefault: false;
104
+ enumValues: undefined;
105
+ baseColumn: never;
106
+ identity: undefined;
107
+ generated: undefined;
108
+ }, {}, {}>;
109
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
110
+ name: "updated_at";
111
+ tableName: "user";
112
+ dataType: "date";
113
+ columnType: "PgTimestamp";
114
+ data: Date;
115
+ driverParam: string;
116
+ notNull: true;
117
+ hasDefault: true;
118
+ isPrimaryKey: false;
119
+ isAutoincrement: false;
120
+ hasRuntimeDefault: false;
121
+ enumValues: undefined;
122
+ baseColumn: never;
123
+ identity: undefined;
124
+ generated: undefined;
125
+ }, {}, {}>;
126
+ };
127
+ dialect: "pg";
128
+ }>;
129
+
130
+ export { user };
package/dist/schema.js ADDED
@@ -0,0 +1,6 @@
1
+ import {
2
+ user
3
+ } from "./chunk-R6W6GTUR.js";
4
+ export {
5
+ user
6
+ };
@@ -0,0 +1,73 @@
1
+ import { Operations, Settings, FileStorage, Connections, BrandService, Config, EmailSender, createApp, Auth, Authz, Email, AppAuthz, SettingDef, ConnectionSlot } from './index.js';
2
+ import * as drizzle_orm_postgres_js from 'drizzle-orm/postgres-js';
3
+ import postgres__default from 'postgres';
4
+ import 'hono/types';
5
+ import 'hono';
6
+ import 'zod';
7
+ import 'node:stream';
8
+ import 'ai';
9
+ import 'drizzle-orm/pg-core';
10
+
11
+ declare const testDatabaseUrl: string | undefined;
12
+ /**
13
+ * Creates a throwaway database on the server in TEST_DATABASE_URL, migrates it,
14
+ * and returns a client plus a cleanup function.
15
+ */
16
+ declare function createTestDatabase(): Promise<{
17
+ url: string;
18
+ drop(): Promise<void>;
19
+ db: drizzle_orm_postgres_js.PostgresJsDatabase<Record<string, never>> & {
20
+ $client: postgres__default.Sql<{}>;
21
+ };
22
+ client: postgres__default.Sql<{}>;
23
+ close: () => Promise<void>;
24
+ }>;
25
+
26
+ declare const ORIGIN = "http://localhost:8080";
27
+ declare const PASSWORD = "a-long-enough-password";
28
+ declare const ADMIN = "boss@example.com";
29
+ /** Written out (not inferred) so the published type declarations stay small. */
30
+ interface Harness {
31
+ testDb: Awaited<ReturnType<typeof createTestDatabase>>;
32
+ ops: Operations;
33
+ settings: Settings;
34
+ storage: FileStorage;
35
+ connections: Connections;
36
+ brand: BrandService;
37
+ backupDir: string;
38
+ config: Config;
39
+ email: EmailSender;
40
+ app: ReturnType<typeof createApp>;
41
+ auth: Auth;
42
+ authz: Authz;
43
+ outbox: Email[];
44
+ call(path: string, opts?: {
45
+ method?: string;
46
+ body?: unknown;
47
+ cookie?: string;
48
+ apiKey?: string;
49
+ }): Promise<Response>;
50
+ cookieOf(res: Response): string;
51
+ lastLink(to: string): {
52
+ mail: Email;
53
+ path: string;
54
+ url: string;
55
+ };
56
+ signUp(address: string, name?: string, invitationId?: string): Promise<Response>;
57
+ verifyAndSignIn(address: string): Promise<string>;
58
+ setUpAdmin(): Promise<string>;
59
+ addUser(adminCookie: string, address: string, roles: string[]): Promise<{
60
+ cookie: string;
61
+ id: string;
62
+ }>;
63
+ }
64
+ /** A full app on a throwaway Postgres database, with helpers to drive it like a browser or an agent. */
65
+ declare function createHarness(appAuthz?: AppAuthz, options?: {
66
+ appMigrations?: string;
67
+ settings?: SettingDef[];
68
+ connections?: ConnectionSlot[];
69
+ fetch?: typeof fetch;
70
+ }): Promise<Harness>;
71
+
72
+ export { ADMIN, ORIGIN, PASSWORD, createHarness, testDatabaseUrl };
73
+ export type { Harness };