@aooth/auth-moost 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 aoothjs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ <p align="center">
2
+ <a href="https://aooth.moost.org">
3
+ <img src="https://aooth.moost.org/logo.svg" alt="aoothjs" width="120" />
4
+ </a>
5
+ </p>
6
+
7
+ <h1 align="center">@aooth/auth-moost</h1>
8
+
9
+ <p align="center">
10
+ Moost integration for <code>@aooth/auth</code> — <code>AuthGuard</code> interceptor, <code>useAuth()</code> composable, REST endpoints (<code>/auth/*</code>), and login / recovery / invite workflows driven by typed <code>.as</code> forms.
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://aooth.moost.org/moost/"><strong>Documentation →</strong></a>
15
+ </p>
16
+
17
+ ---
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ pnpm add @aooth/auth-moost @aooth/auth @aooth/user
23
+ ```
24
+
25
+ ## Documentation
26
+
27
+ Full docs, API reference, and recipes: **https://aooth.moost.org/moost/**
28
+
29
+ - [Setup](https://aooth.moost.org/moost/setup)
30
+ - [Config](https://aooth.moost.org/moost/config)
31
+ - [Auth guard](https://aooth.moost.org/moost/auth-guard)
32
+ - [Controllers](https://aooth.moost.org/moost/controllers)
33
+ - [Decorators](https://aooth.moost.org/moost/decorators)
34
+ - [Workflows (login / recovery / invite)](https://aooth.moost.org/moost/workflows)
35
+ - [Audit](https://aooth.moost.org/moost/audit)
36
+ - [API reference](https://aooth.moost.org/api/auth-moost)
37
+
38
+ ## License
39
+
40
+ MIT
@@ -0,0 +1,2 @@
1
+ import { _ as RecoveryModeSelectForm, a as ConsentMarketingForm, b as TenantSelectForm, c as InviteForm, d as MagicLinkRequestForm, f as MfaCodeForm, g as RecoveryFactorForm, h as ProfileCompleteForm, i as ConcurrencyLimitForm, l as InviteSendModeForm, m as PincodeForm, n as AskPhoneForm, o as EmailIdentifierForm, p as PersonaSelectForm, r as BackupCodeForm, s as InviteEmailForm, t as AskEmailForm, u as LoginCredentialsForm, v as Select2faForm, x as TermsAcceptForm, y as SetPasswordForm } from "../forms-BE62OrN1.mjs";
2
+ export { AskEmailForm, AskPhoneForm, BackupCodeForm, ConcurrencyLimitForm, ConsentMarketingForm, EmailIdentifierForm, InviteEmailForm, InviteForm, InviteSendModeForm, LoginCredentialsForm, MagicLinkRequestForm, MfaCodeForm, PersonaSelectForm, PincodeForm, ProfileCompleteForm, RecoveryFactorForm, RecoveryModeSelectForm, Select2faForm, SetPasswordForm, TenantSelectForm, TermsAcceptForm };
@@ -0,0 +1,2 @@
1
+ import { _ as RecoveryModeSelectForm, a as ConsentMarketingForm, b as TenantSelectForm, c as InviteForm, d as MagicLinkRequestForm, f as MfaCodeForm, g as RecoveryFactorForm, h as ProfileCompleteForm, i as ConcurrencyLimitForm, l as InviteSendModeForm, m as PincodeForm, n as AskPhoneForm, o as EmailIdentifierForm, p as PersonaSelectForm, r as BackupCodeForm, s as InviteEmailForm, t as AskEmailForm, u as LoginCredentialsForm, v as Select2faForm, x as TermsAcceptForm, y as SetPasswordForm } from "../forms-BE62OrN1.mjs";
2
+ export { AskEmailForm, AskPhoneForm, BackupCodeForm, ConcurrencyLimitForm, ConsentMarketingForm, EmailIdentifierForm, InviteEmailForm, InviteForm, InviteSendModeForm, LoginCredentialsForm, MagicLinkRequestForm, MfaCodeForm, PersonaSelectForm, PincodeForm, ProfileCompleteForm, RecoveryFactorForm, RecoveryModeSelectForm, Select2faForm, SetPasswordForm, TenantSelectForm, TermsAcceptForm };
@@ -0,0 +1,230 @@
1
+ import { defineAnnotatedType, throwFeatureDisabled } from "@atscript/typescript/utils";
2
+ //#region src/atscript/models/forms.as
3
+ var LoginCredentialsForm = class {
4
+ static __is_atscript_annotated_type = true;
5
+ static type = {};
6
+ static metadata = /* @__PURE__ */ new Map();
7
+ static id = "LoginCredentialsForm";
8
+ static toJsonSchema() {
9
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
10
+ }
11
+ };
12
+ var MfaCodeForm = class {
13
+ static __is_atscript_annotated_type = true;
14
+ static type = {};
15
+ static metadata = /* @__PURE__ */ new Map();
16
+ static id = "MfaCodeForm";
17
+ static toJsonSchema() {
18
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
19
+ }
20
+ };
21
+ var BackupCodeForm = class {
22
+ static __is_atscript_annotated_type = true;
23
+ static type = {};
24
+ static metadata = /* @__PURE__ */ new Map();
25
+ static id = "BackupCodeForm";
26
+ static toJsonSchema() {
27
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
28
+ }
29
+ };
30
+ var EmailIdentifierForm = class {
31
+ static __is_atscript_annotated_type = true;
32
+ static type = {};
33
+ static metadata = /* @__PURE__ */ new Map();
34
+ static id = "EmailIdentifierForm";
35
+ static toJsonSchema() {
36
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
37
+ }
38
+ };
39
+ var SetPasswordForm = class {
40
+ static __is_atscript_annotated_type = true;
41
+ static type = {};
42
+ static metadata = /* @__PURE__ */ new Map();
43
+ static id = "SetPasswordForm";
44
+ static toJsonSchema() {
45
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
46
+ }
47
+ };
48
+ var InviteForm = class {
49
+ static __is_atscript_annotated_type = true;
50
+ static type = {};
51
+ static metadata = /* @__PURE__ */ new Map();
52
+ static id = "InviteForm";
53
+ static toJsonSchema() {
54
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
55
+ }
56
+ };
57
+ var InviteEmailForm = class {
58
+ static __is_atscript_annotated_type = true;
59
+ static type = {};
60
+ static metadata = /* @__PURE__ */ new Map();
61
+ static id = "InviteEmailForm";
62
+ static toJsonSchema() {
63
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
64
+ }
65
+ };
66
+ var InviteSendModeForm = class {
67
+ static __is_atscript_annotated_type = true;
68
+ static type = {};
69
+ static metadata = /* @__PURE__ */ new Map();
70
+ static id = "InviteSendModeForm";
71
+ static toJsonSchema() {
72
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
73
+ }
74
+ };
75
+ var Select2faForm = class {
76
+ static __is_atscript_annotated_type = true;
77
+ static type = {};
78
+ static metadata = /* @__PURE__ */ new Map();
79
+ static id = "Select2faForm";
80
+ static toJsonSchema() {
81
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
82
+ }
83
+ };
84
+ var PincodeForm = class {
85
+ static __is_atscript_annotated_type = true;
86
+ static type = {};
87
+ static metadata = /* @__PURE__ */ new Map();
88
+ static id = "PincodeForm";
89
+ static toJsonSchema() {
90
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
91
+ }
92
+ };
93
+ var AskEmailForm = class {
94
+ static __is_atscript_annotated_type = true;
95
+ static type = {};
96
+ static metadata = /* @__PURE__ */ new Map();
97
+ static id = "AskEmailForm";
98
+ static toJsonSchema() {
99
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
100
+ }
101
+ };
102
+ var AskPhoneForm = class {
103
+ static __is_atscript_annotated_type = true;
104
+ static type = {};
105
+ static metadata = /* @__PURE__ */ new Map();
106
+ static id = "AskPhoneForm";
107
+ static toJsonSchema() {
108
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
109
+ }
110
+ };
111
+ var TermsAcceptForm = class {
112
+ static __is_atscript_annotated_type = true;
113
+ static type = {};
114
+ static metadata = /* @__PURE__ */ new Map();
115
+ static id = "TermsAcceptForm";
116
+ static toJsonSchema() {
117
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
118
+ }
119
+ };
120
+ var ProfileCompleteForm = class {
121
+ static __is_atscript_annotated_type = true;
122
+ static type = {};
123
+ static metadata = /* @__PURE__ */ new Map();
124
+ static id = "ProfileCompleteForm";
125
+ static toJsonSchema() {
126
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
127
+ }
128
+ };
129
+ var ConsentMarketingForm = class {
130
+ static __is_atscript_annotated_type = true;
131
+ static type = {};
132
+ static metadata = /* @__PURE__ */ new Map();
133
+ static id = "ConsentMarketingForm";
134
+ static toJsonSchema() {
135
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
136
+ }
137
+ };
138
+ var TenantSelectForm = class {
139
+ static __is_atscript_annotated_type = true;
140
+ static type = {};
141
+ static metadata = /* @__PURE__ */ new Map();
142
+ static id = "TenantSelectForm";
143
+ static toJsonSchema() {
144
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
145
+ }
146
+ };
147
+ var PersonaSelectForm = class {
148
+ static __is_atscript_annotated_type = true;
149
+ static type = {};
150
+ static metadata = /* @__PURE__ */ new Map();
151
+ static id = "PersonaSelectForm";
152
+ static toJsonSchema() {
153
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
154
+ }
155
+ };
156
+ var ConcurrencyLimitForm = class {
157
+ static __is_atscript_annotated_type = true;
158
+ static type = {};
159
+ static metadata = /* @__PURE__ */ new Map();
160
+ static id = "ConcurrencyLimitForm";
161
+ static toJsonSchema() {
162
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
163
+ }
164
+ };
165
+ var MagicLinkRequestForm = class {
166
+ static __is_atscript_annotated_type = true;
167
+ static type = {};
168
+ static metadata = /* @__PURE__ */ new Map();
169
+ static id = "MagicLinkRequestForm";
170
+ static toJsonSchema() {
171
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
172
+ }
173
+ };
174
+ var RecoveryModeSelectForm = class {
175
+ static __is_atscript_annotated_type = true;
176
+ static type = {};
177
+ static metadata = /* @__PURE__ */ new Map();
178
+ static id = "RecoveryModeSelectForm";
179
+ static toJsonSchema() {
180
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
181
+ }
182
+ };
183
+ var RecoveryFactorForm = class {
184
+ static __is_atscript_annotated_type = true;
185
+ static type = {};
186
+ static metadata = /* @__PURE__ */ new Map();
187
+ static id = "RecoveryFactorForm";
188
+ static toJsonSchema() {
189
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
190
+ }
191
+ };
192
+ defineAnnotatedType("object", LoginCredentialsForm).prop("username", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Username").annotate("ui.form.autocomplete", "username").annotate("meta.required", {}).annotate("expect.minLength", { length: 1 }).$type).prop("password", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "password").annotate("meta.label", "Password").annotate("ui.form.autocomplete", "current-password").annotate("meta.sensitive", true).annotate("meta.required", {}).annotate("expect.minLength", { length: 1 }).$type);
193
+ defineAnnotatedType("object", MfaCodeForm).prop("code", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Verification code").annotate("ui.form.autocomplete", "one-time-code").annotate("meta.required", {}).annotate("expect.minLength", { length: 4 }).annotate("expect.maxLength", { length: 12 }).annotate("expect.pattern", { pattern: "^[0-9]+$" }, true).$type);
194
+ defineAnnotatedType("object", BackupCodeForm).prop("code", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Backup code").annotate("ui.form.autocomplete", "one-time-code").annotate("meta.required", {}).annotate("expect.minLength", { length: 4 }).annotate("expect.maxLength", { length: 32 }).annotate("expect.pattern", { pattern: "^[A-Z2-9-]+$" }, true).$type);
195
+ defineAnnotatedType("object", EmailIdentifierForm).prop("email", defineAnnotatedType().designType("string").tags("email", "string").annotate("ui.form.type", "text").annotate("meta.label", "Email").annotate("ui.form.autocomplete", "email").annotate("meta.required", {}).annotate("expect.pattern", {
196
+ pattern: "^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",
197
+ flags: "",
198
+ message: "Invalid email format."
199
+ }, true).$type).annotate("wf.context.pass", "defaults", true);
200
+ defineAnnotatedType("object", SetPasswordForm).prop("newPassword", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "password").annotate("meta.label", "New password").annotate("ui.form.autocomplete", "new-password").annotate("meta.sensitive", true).annotate("meta.required", {}).annotate("expect.minLength", { length: 8 }).$type).prop("confirmPassword", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "password").annotate("meta.label", "Confirm password").annotate("ui.form.autocomplete", "new-password").annotate("meta.sensitive", true).annotate("meta.required", {}).annotate("expect.minLength", { length: 8 }).$type);
201
+ defineAnnotatedType("object", InviteForm).prop("email", defineAnnotatedType().designType("string").tags("email", "string").annotate("ui.form.type", "text").annotate("meta.label", "Email").annotate("ui.form.autocomplete", "email").annotate("meta.required", {}).annotate("expect.pattern", {
202
+ pattern: "^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",
203
+ flags: "",
204
+ message: "Invalid email format."
205
+ }, true).$type).prop("firstName", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "First name").optional().$type).prop("lastName", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Last name").optional().$type).prop("roles", defineAnnotatedType("array").of(defineAnnotatedType().designType("string").tags("string").$type).annotate("ui.form.type", "select").annotate("ui.form.fn.options", "(_, _data, context) => Array.isArray(context.availableRoles) ? context.availableRoles.map(r => ({ value: r, label: r })) : []").annotate("meta.label", "Roles").optional().$type).annotate("wf.context.pass", "availableRoles", true);
206
+ defineAnnotatedType("object", InviteEmailForm).prop("email", defineAnnotatedType().designType("string").tags("email", "string").annotate("ui.form.type", "text").annotate("meta.label", "Email").annotate("ui.form.autocomplete", "email").annotate("meta.required", {}).annotate("expect.pattern", {
207
+ pattern: "^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",
208
+ flags: "",
209
+ message: "Invalid email format."
210
+ }, true).$type);
211
+ defineAnnotatedType("object", InviteSendModeForm).prop("mode", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Delivery mode").annotate("meta.required", {}).annotate("expect.pattern", { pattern: "^(email|shareableLink)$" }, true).$type);
212
+ defineAnnotatedType("object", Select2faForm).prop("methodName", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "MFA method").annotate("meta.required", {}).$type).prop("saveAsDefault", defineAnnotatedType().designType("boolean").tags("boolean").annotate("ui.form.type", "checkbox").annotate("meta.label", "Save as default").optional().$type);
213
+ defineAnnotatedType("object", PincodeForm).prop("code", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Verification code").annotate("ui.form.autocomplete", "one-time-code").annotate("meta.required", {}).annotate("expect.minLength", { length: 4 }).annotate("expect.maxLength", { length: 12 }).annotate("expect.pattern", { pattern: "^[0-9]+$" }, true).$type).prop("rememberDevice", defineAnnotatedType().designType("boolean").tags("boolean").annotate("ui.form.type", "checkbox").annotate("meta.label", "Remember this device").optional().$type);
214
+ defineAnnotatedType("object", AskEmailForm).prop("email", defineAnnotatedType().designType("string").tags("email", "string").annotate("ui.form.type", "text").annotate("meta.label", "Email").annotate("ui.form.autocomplete", "email").annotate("meta.required", {}).annotate("expect.pattern", {
215
+ pattern: "^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",
216
+ flags: "",
217
+ message: "Invalid email format."
218
+ }, true).$type);
219
+ defineAnnotatedType("object", AskPhoneForm).prop("phone", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Phone (E.164)").annotate("ui.form.autocomplete", "tel").annotate("meta.required", {}).$type);
220
+ defineAnnotatedType("object", TermsAcceptForm).prop("acceptedVersion", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Accepted version").annotate("meta.required", {}).$type).prop("accepted", defineAnnotatedType().designType("boolean").tags("boolean").annotate("ui.form.type", "checkbox").annotate("meta.label", "I accept the Terms & Conditions").annotate("meta.required", {}).$type);
221
+ defineAnnotatedType("object", ProfileCompleteForm).prop("firstName", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "First name").optional().$type).prop("lastName", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Last name").optional().$type);
222
+ defineAnnotatedType("object", ConsentMarketingForm).prop("optIn", defineAnnotatedType().designType("boolean").tags("boolean").annotate("ui.form.type", "checkbox").annotate("meta.label", "I would like to receive marketing emails").optional().$type);
223
+ defineAnnotatedType("object", TenantSelectForm).prop("tenantId", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Tenant").annotate("meta.required", {}).$type);
224
+ defineAnnotatedType("object", PersonaSelectForm).prop("personaId", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Persona").annotate("meta.required", {}).$type);
225
+ defineAnnotatedType("object", ConcurrencyLimitForm).prop("action", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Action").annotate("meta.required", {}).annotate("expect.pattern", { pattern: "^(logoutOthers|cancel)$" }, true).$type);
226
+ defineAnnotatedType("object", MagicLinkRequestForm).prop("identifier", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Email or username").annotate("ui.form.autocomplete", "username").annotate("meta.required", {}).$type);
227
+ defineAnnotatedType("object", RecoveryModeSelectForm).prop("mode", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Recovery method").annotate("meta.required", {}).annotate("expect.pattern", { pattern: "^(magicLink|otp)$" }, true).$type);
228
+ defineAnnotatedType("object", RecoveryFactorForm).prop("factor", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Factor").annotate("meta.required", {}).annotate("expect.pattern", { pattern: "^(phone|totp)$" }, true).$type).prop("value", defineAnnotatedType().designType("string").tags("string").annotate("ui.form.type", "text").annotate("meta.label", "Value").annotate("meta.required", {}).annotate("expect.minLength", { length: 4 }).annotate("expect.maxLength", { length: 12 }).$type);
229
+ //#endregion
230
+ export { RecoveryModeSelectForm as _, ConsentMarketingForm as a, TenantSelectForm as b, InviteForm as c, MagicLinkRequestForm as d, MfaCodeForm as f, RecoveryFactorForm as g, ProfileCompleteForm as h, ConcurrencyLimitForm as i, InviteSendModeForm as l, PincodeForm as m, AskPhoneForm as n, EmailIdentifierForm as o, PersonaSelectForm as p, BackupCodeForm as r, InviteEmailForm as s, AskEmailForm as t, LoginCredentialsForm as u, Select2faForm as v, TermsAcceptForm as x, SetPasswordForm as y };