@stll/auth-model 0.2.6 → 0.2.7
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 +35 -27
- package/dist/contract.js +4 -0
- package/package.json +3 -4
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
|
@@ -19,18 +19,18 @@ export type BetterAuthOrganizationRoleGrants = Record<OrganizationRoleName, Orga
|
|
|
19
19
|
/** Core grants shared by every application; product grants remain host-owned. */
|
|
20
20
|
export declare const BETTER_AUTH_ORGANIZATION_ROLE_GRANTS: {
|
|
21
21
|
owner: {
|
|
22
|
-
organization: ("
|
|
23
|
-
member: ("
|
|
24
|
-
invitation: ("
|
|
25
|
-
team: ("
|
|
26
|
-
ac: ("
|
|
22
|
+
organization: ("delete" | "update")[];
|
|
23
|
+
member: ("create" | "delete" | "update")[];
|
|
24
|
+
invitation: ("cancel" | "create")[];
|
|
25
|
+
team: ("create" | "delete" | "update")[];
|
|
26
|
+
ac: ("create" | "delete" | "read" | "update")[];
|
|
27
27
|
};
|
|
28
28
|
admin: {
|
|
29
29
|
organization: "update"[];
|
|
30
|
-
member: ("
|
|
31
|
-
invitation: ("
|
|
32
|
-
team: ("
|
|
33
|
-
ac: ("
|
|
30
|
+
member: ("create" | "delete" | "update")[];
|
|
31
|
+
invitation: ("cancel" | "create")[];
|
|
32
|
+
team: ("create" | "delete" | "update")[];
|
|
33
|
+
ac: ("create" | "delete" | "read" | "update")[];
|
|
34
34
|
};
|
|
35
35
|
member: {
|
|
36
36
|
organization: never[];
|
|
@@ -86,7 +86,7 @@ export type BetterAuthFieldDefault = {
|
|
|
86
86
|
};
|
|
87
87
|
export type BetterAuthFieldReference = {
|
|
88
88
|
field: "id";
|
|
89
|
-
model: "organization" | "user";
|
|
89
|
+
model: "oauthConsent" | "organization" | "user";
|
|
90
90
|
onDelete: "cascade" | null;
|
|
91
91
|
};
|
|
92
92
|
export type BetterAuthLogicalFieldContract = {
|
|
@@ -144,6 +144,10 @@ export declare const BETTER_AUTH_CORE_SCHEMA: {
|
|
|
144
144
|
readonly primaryKey: readonly ["id"];
|
|
145
145
|
readonly fields: Record<string, BetterAuthFieldContract>;
|
|
146
146
|
readonly indexes: readonly [{
|
|
147
|
+
readonly fields: readonly ["id"];
|
|
148
|
+
readonly predicate: `"session"."id" LIKE 'synthetic-session-%'`;
|
|
149
|
+
readonly unique: false;
|
|
150
|
+
}, {
|
|
147
151
|
readonly fields: readonly ["userId", "activeOrganizationId"];
|
|
148
152
|
readonly predicate: null;
|
|
149
153
|
readonly unique: false;
|
|
@@ -224,6 +228,10 @@ export type BetterAuthAdapterContract = {
|
|
|
224
228
|
verificationStorage: "database";
|
|
225
229
|
};
|
|
226
230
|
export declare const BETTER_AUTH_ADAPTER_INVARIANTS: {
|
|
231
|
+
readonly camelCase: false;
|
|
232
|
+
readonly provider: "pg";
|
|
233
|
+
readonly transaction: true;
|
|
234
|
+
readonly usePlural: false;
|
|
227
235
|
readonly dateStorage: "timestamp-with-time-zone";
|
|
228
236
|
readonly idGeneration: "application-string";
|
|
229
237
|
readonly sessionStorage: "database";
|
|
@@ -237,10 +245,6 @@ export declare const BETTER_AUTH_ADAPTER_INVARIANTS: {
|
|
|
237
245
|
readonly member: "member";
|
|
238
246
|
readonly invitation: "invitation";
|
|
239
247
|
};
|
|
240
|
-
readonly camelCase: false;
|
|
241
|
-
readonly provider: "pg";
|
|
242
|
-
readonly transaction: true;
|
|
243
|
-
readonly usePlural: false;
|
|
244
248
|
};
|
|
245
249
|
export type BetterAuthSchemaCandidate = {
|
|
246
250
|
adapter: BetterAuthAdapterContract;
|
|
@@ -269,6 +273,10 @@ export type BetterAuthSchemaParityResult = {
|
|
|
269
273
|
export declare const compareBetterAuthSchema: (candidate: BetterAuthSchemaCandidate, extensions?: BetterAuthSchemaExtensions) => BetterAuthSchemaParityResult;
|
|
270
274
|
export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
271
275
|
readonly adapterInvariants: {
|
|
276
|
+
readonly camelCase: false;
|
|
277
|
+
readonly provider: "pg";
|
|
278
|
+
readonly transaction: true;
|
|
279
|
+
readonly usePlural: false;
|
|
272
280
|
readonly dateStorage: "timestamp-with-time-zone";
|
|
273
281
|
readonly idGeneration: "application-string";
|
|
274
282
|
readonly sessionStorage: "database";
|
|
@@ -282,10 +290,6 @@ export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
|
282
290
|
readonly member: "member";
|
|
283
291
|
readonly invitation: "invitation";
|
|
284
292
|
};
|
|
285
|
-
readonly camelCase: false;
|
|
286
|
-
readonly provider: "pg";
|
|
287
|
-
readonly transaction: true;
|
|
288
|
-
readonly usePlural: false;
|
|
289
293
|
};
|
|
290
294
|
readonly betterAuthVersion: "1.7.6";
|
|
291
295
|
readonly options: {
|
|
@@ -298,18 +302,18 @@ export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
|
298
302
|
};
|
|
299
303
|
readonly roleGrants: {
|
|
300
304
|
owner: {
|
|
301
|
-
organization: ("
|
|
302
|
-
member: ("
|
|
303
|
-
invitation: ("
|
|
304
|
-
team: ("
|
|
305
|
-
ac: ("
|
|
305
|
+
organization: ("delete" | "update")[];
|
|
306
|
+
member: ("create" | "delete" | "update")[];
|
|
307
|
+
invitation: ("cancel" | "create")[];
|
|
308
|
+
team: ("create" | "delete" | "update")[];
|
|
309
|
+
ac: ("create" | "delete" | "read" | "update")[];
|
|
306
310
|
};
|
|
307
311
|
admin: {
|
|
308
312
|
organization: "update"[];
|
|
309
|
-
member: ("
|
|
310
|
-
invitation: ("
|
|
311
|
-
team: ("
|
|
312
|
-
ac: ("
|
|
313
|
+
member: ("create" | "delete" | "update")[];
|
|
314
|
+
invitation: ("cancel" | "create")[];
|
|
315
|
+
team: ("create" | "delete" | "update")[];
|
|
316
|
+
ac: ("create" | "delete" | "read" | "update")[];
|
|
313
317
|
};
|
|
314
318
|
member: {
|
|
315
319
|
organization: never[];
|
|
@@ -346,6 +350,10 @@ export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
|
346
350
|
readonly primaryKey: readonly ["id"];
|
|
347
351
|
readonly fields: Record<string, BetterAuthFieldContract>;
|
|
348
352
|
readonly indexes: readonly [{
|
|
353
|
+
readonly fields: readonly ["id"];
|
|
354
|
+
readonly predicate: `"session"."id" LIKE 'synthetic-session-%'`;
|
|
355
|
+
readonly unique: false;
|
|
356
|
+
}, {
|
|
349
357
|
readonly fields: readonly ["userId", "activeOrganizationId"];
|
|
350
358
|
readonly predicate: null;
|
|
351
359
|
readonly unique: false;
|
package/dist/contract.js
CHANGED
|
@@ -271,6 +271,10 @@ const BETTER_AUTH_CORE_SCHEMA = {
|
|
|
271
271
|
activeOrganizationId: field("string", { input: "server-managed" })
|
|
272
272
|
}),
|
|
273
273
|
indexes: [{
|
|
274
|
+
fields: ["id"],
|
|
275
|
+
predicate: `"session"."id" LIKE 'synthetic-session-%'`,
|
|
276
|
+
unique: false
|
|
277
|
+
}, {
|
|
274
278
|
fields: ["userId", "activeOrganizationId"],
|
|
275
279
|
predicate: null,
|
|
276
280
|
unique: false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/auth-model",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Portable Better Auth core contract and parity checks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -39,16 +39,15 @@
|
|
|
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
49
|
"better-auth": "1.7.6",
|
|
51
|
-
"bun-types": "1.4.
|
|
50
|
+
"bun-types": "1.4.4",
|
|
52
51
|
"tsdown": "0.23.0"
|
|
53
52
|
},
|
|
54
53
|
"main": "./dist/contract.js",
|