@madauth/server 0.2.0-beta.2 → 0.3.0-beta.2

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/index.js CHANGED
@@ -3,27 +3,33 @@ import {
3
3
  createTablesSql,
4
4
  tableName,
5
5
  upgradeTablesSql
6
- } from "./chunk-CNL562LZ.js";
6
+ } from "./chunk-56MOVFO4.js";
7
7
  import {
8
8
  madauthSchema
9
- } from "./chunk-XNBWZZHT.js";
9
+ } from "./chunk-CD7Y4T66.js";
10
10
  import {
11
11
  REDIRECT_ERROR_PARAM,
12
12
  createApp
13
- } from "./chunk-YALS7OMV.js";
14
- import "./chunk-7CTAB3QV.js";
13
+ } from "./chunk-DVVBIFIV.js";
14
+ import "./chunk-DCDTO5LG.js";
15
15
  import {
16
+ ADMIN_ROLE,
16
17
  ConfigError,
18
+ SIGN_IN_METHODS,
17
19
  envVars,
18
- loadConfig
19
- } from "./chunk-5CKEMC6M.js";
20
+ loadConfig,
21
+ parseClaims,
22
+ parseRoles
23
+ } from "./chunk-TI35AZ2U.js";
20
24
  import {
21
25
  generateSigningKey
22
26
  } from "./chunk-JDQLSL36.js";
23
- import "./chunk-6EJDVZCD.js";
27
+ import "./chunk-3QRKWLR7.js";
24
28
  export {
29
+ ADMIN_ROLE,
25
30
  ConfigError,
26
31
  REDIRECT_ERROR_PARAM,
32
+ SIGN_IN_METHODS,
27
33
  columnName,
28
34
  createApp,
29
35
  createTablesSql,
@@ -31,6 +37,8 @@ export {
31
37
  generateSigningKey,
32
38
  loadConfig,
33
39
  madauthSchema,
40
+ parseClaims,
41
+ parseRoles,
34
42
  tableName,
35
43
  upgradeTablesSql
36
44
  };
@@ -43,8 +43,9 @@ interface Schema {
43
43
  }
44
44
  /** The records madAuth stores. Timestamps are milliseconds since 1970. */
45
45
  declare const madauthSchema: {
46
- readonly version: 3;
46
+ readonly version: 4;
47
47
  readonly models: {
48
+ /** Someone who signed in, whichever way: the e-mail address is the identity shared by the sign-in methods. */
48
49
  readonly user: {
49
50
  readonly fields: {
50
51
  readonly id: {
@@ -75,12 +76,17 @@ declare const madauthSchema: {
75
76
  readonly wrongCodes: {
76
77
  readonly type: "number";
77
78
  };
79
+ /** What admins attached to the user, as JSON, e.g. `{"roles":["admin"]}` (since version 4). */
80
+ readonly claims: {
81
+ readonly type: "string";
82
+ readonly nullable: true;
83
+ };
78
84
  readonly createdAt: {
79
85
  readonly type: "number";
80
86
  };
81
87
  };
82
88
  };
83
- /** How a user signs in. `key` is e.g. `password:<userId>`; later `google:<sub>` or `totp:<userId>`. */
89
+ /** How a user signs in. `key` is `password:<userId>` or `google:<sub>`; later e.g. `totp:<userId>`. */
84
90
  readonly account: {
85
91
  readonly fields: {
86
92
  readonly id: {
@@ -105,6 +111,11 @@ declare const madauthSchema: {
105
111
  readonly lockedUntil: {
106
112
  readonly type: "number";
107
113
  };
114
+ /** The address the provider reported at the last sign-in, e.g. Google's current primary address (since version 4). */
115
+ readonly email: {
116
+ readonly type: "string";
117
+ readonly nullable: true;
118
+ };
108
119
  readonly createdAt: {
109
120
  readonly type: "number";
110
121
  };
@@ -135,23 +146,20 @@ declare const madauthSchema: {
135
146
  };
136
147
  };
137
148
  };
138
- /**
139
- * The roles of an e-mail address (since version 3). `id` is the normalized address, so the roles
140
- * apply whichever way its owner signs in. `roles` holds the names separated by spaces.
141
- */
142
- readonly role: {
149
+ /** A setting admins change at runtime, as JSON (since version 4), e.g. `methods`: which sign-in methods are on. */
150
+ readonly setting: {
143
151
  readonly fields: {
144
152
  readonly id: {
145
153
  readonly type: "string";
146
154
  readonly primaryKey: true;
147
155
  };
148
- readonly roles: {
156
+ readonly value: {
149
157
  readonly type: "string";
150
158
  };
151
159
  readonly updatedAt: {
152
160
  readonly type: "number";
153
161
  };
154
- /** The address of the admin who set them; empty when set from the command line. */
162
+ /** The address of the admin who set it; empty when set from the command line. */
155
163
  readonly updatedBy: {
156
164
  readonly type: "string";
157
165
  readonly nullable: true;
package/dist/sqlite.js CHANGED
@@ -3,10 +3,10 @@ import {
3
3
  createTablesSql,
4
4
  tableName,
5
5
  upgradeTablesSql
6
- } from "./chunk-CNL562LZ.js";
6
+ } from "./chunk-56MOVFO4.js";
7
7
  import {
8
8
  madauthSchema
9
- } from "./chunk-XNBWZZHT.js";
9
+ } from "./chunk-CD7Y4T66.js";
10
10
 
11
11
  // src/store/sqlite.ts
12
12
  function createSqliteAdapter(path) {