@stll/auth-model 0.2.7 → 0.4.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/dist/contract.d.ts +19 -4
- package/dist/contract.js +27 -3
- package/dist/invitation-sections.d.ts +33305 -0
- package/dist/invitation-sections.js +22 -0
- package/package.json +8 -3
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];
|
|
@@ -58,6 +59,19 @@ export declare const BETTER_AUTH_ORGANIZATION_ROLE_GRANTS: {
|
|
|
58
59
|
* Values that change Better Auth's organization authorization semantics.
|
|
59
60
|
* Hooks, adapters, email delivery, and product-specific options stay local.
|
|
60
61
|
*/
|
|
62
|
+
export declare const ORGANIZATION_SLUG_RULES: {
|
|
63
|
+
readonly minLength: 1;
|
|
64
|
+
readonly maxLength: 128;
|
|
65
|
+
readonly pattern: RegExp;
|
|
66
|
+
};
|
|
67
|
+
/** Random bytes behind an opaque organization slug. */
|
|
68
|
+
export declare const ORGANIZATION_OPAQUE_SLUG_BYTES = 10;
|
|
69
|
+
/**
|
|
70
|
+
* The opaque `org-` slug shared by organization creation and slug changes.
|
|
71
|
+
* The source fills this function's own fixed-size buffer, so it cannot change
|
|
72
|
+
* the identifier's length; organization names never enter the identifier.
|
|
73
|
+
*/
|
|
74
|
+
export declare const createOpaqueOrganizationSlug: (fillRandom?: (bytes: Uint8Array) => void) => string;
|
|
61
75
|
export declare const BETTER_AUTH_ORGANIZATION_OPTIONS: {
|
|
62
76
|
readonly allowUserToCreateOrganization: true;
|
|
63
77
|
readonly cancelPendingInvitationsOnReInvite: false;
|
|
@@ -291,7 +305,7 @@ export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
|
291
305
|
readonly invitation: "invitation";
|
|
292
306
|
};
|
|
293
307
|
};
|
|
294
|
-
readonly betterAuthVersion: "1.7.
|
|
308
|
+
readonly betterAuthVersion: "1.7.12";
|
|
295
309
|
readonly options: {
|
|
296
310
|
readonly allowUserToCreateOrganization: true;
|
|
297
311
|
readonly cancelPendingInvitationsOnReInvite: false;
|
|
@@ -423,4 +437,5 @@ export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
|
423
437
|
};
|
|
424
438
|
};
|
|
425
439
|
};
|
|
426
|
-
//#endregion
|
|
440
|
+
//#endregion
|
|
441
|
+
export {};
|
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",
|
|
@@ -100,6 +104,26 @@ const BETTER_AUTH_ORGANIZATION_ROLE_GRANTS = {
|
|
|
100
104
|
* Values that change Better Auth's organization authorization semantics.
|
|
101
105
|
* Hooks, adapters, email delivery, and product-specific options stay local.
|
|
102
106
|
*/
|
|
107
|
+
const ORGANIZATION_SLUG_RULES = {
|
|
108
|
+
minLength: 1,
|
|
109
|
+
maxLength: 128,
|
|
110
|
+
pattern: /^[a-z0-9\x2d]+$/u
|
|
111
|
+
};
|
|
112
|
+
/** Random bytes behind an opaque organization slug. */
|
|
113
|
+
const ORGANIZATION_OPAQUE_SLUG_BYTES = 10;
|
|
114
|
+
const OPAQUE_SLUG_ALPHABET = "abcdefghijklmnopqrstuvwxyz234567";
|
|
115
|
+
/**
|
|
116
|
+
* The opaque `org-` slug shared by organization creation and slug changes.
|
|
117
|
+
* The source fills this function's own fixed-size buffer, so it cannot change
|
|
118
|
+
* the identifier's length; organization names never enter the identifier.
|
|
119
|
+
*/
|
|
120
|
+
const createOpaqueOrganizationSlug = (fillRandom = (bytes) => {
|
|
121
|
+
crypto.getRandomValues(bytes);
|
|
122
|
+
}) => {
|
|
123
|
+
const bytes = /* @__PURE__ */ new Uint8Array(10);
|
|
124
|
+
fillRandom(bytes);
|
|
125
|
+
return `org-${Array.from(bytes, (byte) => OPAQUE_SLUG_ALPHABET.charAt(byte % 32)).join("")}`;
|
|
126
|
+
};
|
|
103
127
|
const BETTER_AUTH_ORGANIZATION_OPTIONS = {
|
|
104
128
|
allowUserToCreateOrganization: true,
|
|
105
129
|
cancelPendingInvitationsOnReInvite: false,
|
|
@@ -540,4 +564,4 @@ const BETTER_AUTH_PARITY_MANIFEST = {
|
|
|
540
564
|
schema: BETTER_AUTH_CORE_SCHEMA
|
|
541
565
|
};
|
|
542
566
|
//#endregion
|
|
543
|
-
export { AUTH_ACCESS_RESET_ERROR_CODE, AUTH_SESSION_STARTUP_HEADER, AUTH_SOCIAL_PROVIDER_IDS, BETTER_AUTH_ADAPTER_INVARIANTS, BETTER_AUTH_ADAPTER_OPTIONS, BETTER_AUTH_CONTRACT_VERSION, BETTER_AUTH_CORE_MODEL_NAMES, BETTER_AUTH_CORE_SCHEMA, BETTER_AUTH_ORGANIZATION_OPTIONS, BETTER_AUTH_ORGANIZATION_ROLE_GRANTS, BETTER_AUTH_ORGANIZATION_STATEMENTS, BETTER_AUTH_PARITY_MANIFEST, ORGANIZATION_ROLE_NAMES, compareBetterAuthSchema };
|
|
567
|
+
export { AUTH_ACCESS_RESET_ERROR_CODE, AUTH_SESSION_STARTUP_HEADER, AUTH_SOCIAL_PROVIDER_IDS, BETTER_AUTH_ADAPTER_INVARIANTS, BETTER_AUTH_ADAPTER_OPTIONS, BETTER_AUTH_CONTRACT_VERSION, BETTER_AUTH_CORE_MODEL_NAMES, BETTER_AUTH_CORE_SCHEMA, BETTER_AUTH_ORGANIZATION_OPTIONS, BETTER_AUTH_ORGANIZATION_ROLE_GRANTS, BETTER_AUTH_ORGANIZATION_STATEMENTS, BETTER_AUTH_PARITY_MANIFEST, ORGANIZATION_OPAQUE_SLUG_BYTES, ORGANIZATION_ROLE_NAMES, ORGANIZATION_SLUG_RULES, compareBetterAuthSchema, createOpaqueOrganizationSlug };
|