@stll/auth-model 0.2.6 → 0.3.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.
- package/README.md +2 -1
- package/dist/contract.d.ts +39 -30
- package/dist/contract.js +10 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -20,13 +20,14 @@ product permissions. Every additional field, index, or plugin model must be
|
|
|
20
20
|
declared explicitly when comparing the normalized host schema.
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
|
+
import { createAccessControl } from "better-auth/plugins/access";
|
|
24
|
+
|
|
23
25
|
import {
|
|
24
26
|
BETTER_AUTH_ADAPTER_OPTIONS,
|
|
25
27
|
BETTER_AUTH_ORGANIZATION_OPTIONS,
|
|
26
28
|
BETTER_AUTH_ORGANIZATION_ROLE_GRANTS,
|
|
27
29
|
BETTER_AUTH_ORGANIZATION_STATEMENTS,
|
|
28
30
|
} from "@stll/auth-model";
|
|
29
|
-
import { createAccessControl } from "better-auth/plugins/access";
|
|
30
31
|
|
|
31
32
|
const statements = {
|
|
32
33
|
...BETTER_AUTH_ORGANIZATION_STATEMENTS,
|
package/dist/contract.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
//#region src/contract.d.ts
|
|
2
2
|
/** Better Auth version whose logical schema this contract describes. */
|
|
3
|
-
export declare const BETTER_AUTH_CONTRACT_VERSION = "1.7.
|
|
3
|
+
export declare const BETTER_AUTH_CONTRACT_VERSION = "1.7.12";
|
|
4
4
|
export declare const AUTH_SESSION_STARTUP_HEADER = "x-stella-session-startup";
|
|
5
|
-
export declare const AUTH_SOCIAL_PROVIDER_IDS: readonly ["google", "microsoft"];
|
|
5
|
+
export declare const AUTH_SOCIAL_PROVIDER_IDS: readonly ["google", "microsoft", "apple"];
|
|
6
|
+
export type AuthSocialProviderId = (typeof AUTH_SOCIAL_PROVIDER_IDS)[number];
|
|
6
7
|
export declare const AUTH_ACCESS_RESET_ERROR_CODE = "confirm_access_reset";
|
|
7
8
|
export declare const ORGANIZATION_ROLE_NAMES: readonly ["owner", "admin", "member", "intern", "external"];
|
|
8
9
|
export type OrganizationRoleName = (typeof ORGANIZATION_ROLE_NAMES)[number];
|
|
@@ -19,18 +20,18 @@ export type BetterAuthOrganizationRoleGrants = Record<OrganizationRoleName, Orga
|
|
|
19
20
|
/** Core grants shared by every application; product grants remain host-owned. */
|
|
20
21
|
export declare const BETTER_AUTH_ORGANIZATION_ROLE_GRANTS: {
|
|
21
22
|
owner: {
|
|
22
|
-
organization: ("
|
|
23
|
-
member: ("
|
|
24
|
-
invitation: ("
|
|
25
|
-
team: ("
|
|
26
|
-
ac: ("
|
|
23
|
+
organization: ("delete" | "update")[];
|
|
24
|
+
member: ("create" | "delete" | "update")[];
|
|
25
|
+
invitation: ("cancel" | "create")[];
|
|
26
|
+
team: ("create" | "delete" | "update")[];
|
|
27
|
+
ac: ("create" | "delete" | "read" | "update")[];
|
|
27
28
|
};
|
|
28
29
|
admin: {
|
|
29
30
|
organization: "update"[];
|
|
30
|
-
member: ("
|
|
31
|
-
invitation: ("
|
|
32
|
-
team: ("
|
|
33
|
-
ac: ("
|
|
31
|
+
member: ("create" | "delete" | "update")[];
|
|
32
|
+
invitation: ("cancel" | "create")[];
|
|
33
|
+
team: ("create" | "delete" | "update")[];
|
|
34
|
+
ac: ("create" | "delete" | "read" | "update")[];
|
|
34
35
|
};
|
|
35
36
|
member: {
|
|
36
37
|
organization: never[];
|
|
@@ -86,7 +87,7 @@ export type BetterAuthFieldDefault = {
|
|
|
86
87
|
};
|
|
87
88
|
export type BetterAuthFieldReference = {
|
|
88
89
|
field: "id";
|
|
89
|
-
model: "organization" | "user";
|
|
90
|
+
model: "oauthConsent" | "organization" | "user";
|
|
90
91
|
onDelete: "cascade" | null;
|
|
91
92
|
};
|
|
92
93
|
export type BetterAuthLogicalFieldContract = {
|
|
@@ -144,6 +145,10 @@ export declare const BETTER_AUTH_CORE_SCHEMA: {
|
|
|
144
145
|
readonly primaryKey: readonly ["id"];
|
|
145
146
|
readonly fields: Record<string, BetterAuthFieldContract>;
|
|
146
147
|
readonly indexes: readonly [{
|
|
148
|
+
readonly fields: readonly ["id"];
|
|
149
|
+
readonly predicate: `"session"."id" LIKE 'synthetic-session-%'`;
|
|
150
|
+
readonly unique: false;
|
|
151
|
+
}, {
|
|
147
152
|
readonly fields: readonly ["userId", "activeOrganizationId"];
|
|
148
153
|
readonly predicate: null;
|
|
149
154
|
readonly unique: false;
|
|
@@ -224,6 +229,10 @@ export type BetterAuthAdapterContract = {
|
|
|
224
229
|
verificationStorage: "database";
|
|
225
230
|
};
|
|
226
231
|
export declare const BETTER_AUTH_ADAPTER_INVARIANTS: {
|
|
232
|
+
readonly camelCase: false;
|
|
233
|
+
readonly provider: "pg";
|
|
234
|
+
readonly transaction: true;
|
|
235
|
+
readonly usePlural: false;
|
|
227
236
|
readonly dateStorage: "timestamp-with-time-zone";
|
|
228
237
|
readonly idGeneration: "application-string";
|
|
229
238
|
readonly sessionStorage: "database";
|
|
@@ -237,10 +246,6 @@ export declare const BETTER_AUTH_ADAPTER_INVARIANTS: {
|
|
|
237
246
|
readonly member: "member";
|
|
238
247
|
readonly invitation: "invitation";
|
|
239
248
|
};
|
|
240
|
-
readonly camelCase: false;
|
|
241
|
-
readonly provider: "pg";
|
|
242
|
-
readonly transaction: true;
|
|
243
|
-
readonly usePlural: false;
|
|
244
249
|
};
|
|
245
250
|
export type BetterAuthSchemaCandidate = {
|
|
246
251
|
adapter: BetterAuthAdapterContract;
|
|
@@ -269,6 +274,10 @@ export type BetterAuthSchemaParityResult = {
|
|
|
269
274
|
export declare const compareBetterAuthSchema: (candidate: BetterAuthSchemaCandidate, extensions?: BetterAuthSchemaExtensions) => BetterAuthSchemaParityResult;
|
|
270
275
|
export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
271
276
|
readonly adapterInvariants: {
|
|
277
|
+
readonly camelCase: false;
|
|
278
|
+
readonly provider: "pg";
|
|
279
|
+
readonly transaction: true;
|
|
280
|
+
readonly usePlural: false;
|
|
272
281
|
readonly dateStorage: "timestamp-with-time-zone";
|
|
273
282
|
readonly idGeneration: "application-string";
|
|
274
283
|
readonly sessionStorage: "database";
|
|
@@ -282,12 +291,8 @@ export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
|
282
291
|
readonly member: "member";
|
|
283
292
|
readonly invitation: "invitation";
|
|
284
293
|
};
|
|
285
|
-
readonly camelCase: false;
|
|
286
|
-
readonly provider: "pg";
|
|
287
|
-
readonly transaction: true;
|
|
288
|
-
readonly usePlural: false;
|
|
289
294
|
};
|
|
290
|
-
readonly betterAuthVersion: "1.7.
|
|
295
|
+
readonly betterAuthVersion: "1.7.12";
|
|
291
296
|
readonly options: {
|
|
292
297
|
readonly allowUserToCreateOrganization: true;
|
|
293
298
|
readonly cancelPendingInvitationsOnReInvite: false;
|
|
@@ -298,18 +303,18 @@ export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
|
298
303
|
};
|
|
299
304
|
readonly roleGrants: {
|
|
300
305
|
owner: {
|
|
301
|
-
organization: ("
|
|
302
|
-
member: ("
|
|
303
|
-
invitation: ("
|
|
304
|
-
team: ("
|
|
305
|
-
ac: ("
|
|
306
|
+
organization: ("delete" | "update")[];
|
|
307
|
+
member: ("create" | "delete" | "update")[];
|
|
308
|
+
invitation: ("cancel" | "create")[];
|
|
309
|
+
team: ("create" | "delete" | "update")[];
|
|
310
|
+
ac: ("create" | "delete" | "read" | "update")[];
|
|
306
311
|
};
|
|
307
312
|
admin: {
|
|
308
313
|
organization: "update"[];
|
|
309
|
-
member: ("
|
|
310
|
-
invitation: ("
|
|
311
|
-
team: ("
|
|
312
|
-
ac: ("
|
|
314
|
+
member: ("create" | "delete" | "update")[];
|
|
315
|
+
invitation: ("cancel" | "create")[];
|
|
316
|
+
team: ("create" | "delete" | "update")[];
|
|
317
|
+
ac: ("create" | "delete" | "read" | "update")[];
|
|
313
318
|
};
|
|
314
319
|
member: {
|
|
315
320
|
organization: never[];
|
|
@@ -346,6 +351,10 @@ export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
|
346
351
|
readonly primaryKey: readonly ["id"];
|
|
347
352
|
readonly fields: Record<string, BetterAuthFieldContract>;
|
|
348
353
|
readonly indexes: readonly [{
|
|
354
|
+
readonly fields: readonly ["id"];
|
|
355
|
+
readonly predicate: `"session"."id" LIKE 'synthetic-session-%'`;
|
|
356
|
+
readonly unique: false;
|
|
357
|
+
}, {
|
|
349
358
|
readonly fields: readonly ["userId", "activeOrganizationId"];
|
|
350
359
|
readonly predicate: null;
|
|
351
360
|
readonly unique: false;
|
package/dist/contract.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
//#region src/contract.ts
|
|
2
2
|
/** Better Auth version whose logical schema this contract describes. */
|
|
3
|
-
const BETTER_AUTH_CONTRACT_VERSION = "1.7.
|
|
3
|
+
const BETTER_AUTH_CONTRACT_VERSION = "1.7.12";
|
|
4
4
|
const AUTH_SESSION_STARTUP_HEADER = "x-stella-session-startup";
|
|
5
|
-
const AUTH_SOCIAL_PROVIDER_IDS = [
|
|
5
|
+
const AUTH_SOCIAL_PROVIDER_IDS = [
|
|
6
|
+
"google",
|
|
7
|
+
"microsoft",
|
|
8
|
+
"apple"
|
|
9
|
+
];
|
|
6
10
|
const AUTH_ACCESS_RESET_ERROR_CODE = "confirm_access_reset";
|
|
7
11
|
const ORGANIZATION_ROLE_NAMES = [
|
|
8
12
|
"owner",
|
|
@@ -271,6 +275,10 @@ const BETTER_AUTH_CORE_SCHEMA = {
|
|
|
271
275
|
activeOrganizationId: field("string", { input: "server-managed" })
|
|
272
276
|
}),
|
|
273
277
|
indexes: [{
|
|
278
|
+
fields: ["id"],
|
|
279
|
+
predicate: `"session"."id" LIKE 'synthetic-session-%'`,
|
|
280
|
+
unique: false
|
|
281
|
+
}, {
|
|
274
282
|
fields: ["userId", "activeOrganizationId"],
|
|
275
283
|
predicate: null,
|
|
276
284
|
unique: false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/auth-model",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Portable Better Auth core contract and parity checks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"build": "tsdown",
|
|
40
40
|
"pack:dry-run": "bun pm pack --dry-run",
|
|
41
41
|
"test": "bun test src",
|
|
42
|
-
"typecheck": "bun
|
|
42
|
+
"typecheck": "bun check --no-pretty --all --project=tsconfig.json",
|
|
43
43
|
"lint": "cd ../.. && bun --bun oxlint -c oxlint.config.ts --report-unused-disable-directives-severity=error --type-aware --type-check packages/auth-model",
|
|
44
44
|
"lint:fix": "cd ../.. && bun --bun oxlint -c oxlint.config.ts --type-aware --fix packages/auth-model",
|
|
45
|
-
"format": "bun ../../scripts/run-oxfmt.ts .",
|
|
46
45
|
"prepack": "bun run build"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@stll/typescript-config": "0.0.0",
|
|
50
|
-
"better-auth": "1.7.
|
|
51
|
-
"bun-types": "1.4.
|
|
52
|
-
"tsdown": "0.23.0"
|
|
49
|
+
"better-auth": "1.7.12",
|
|
50
|
+
"bun-types": "1.4.4",
|
|
51
|
+
"tsdown": "0.23.0",
|
|
52
|
+
"tsrs": "0.18.0-ts7.1.0-dev.20260929"
|
|
53
53
|
},
|
|
54
54
|
"main": "./dist/contract.js",
|
|
55
55
|
"types": "./dist/contract.d.ts"
|