node-type-registry 0.14.0 → 0.17.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.
Files changed (49) hide show
  1. package/blueprint-types.generated.d.ts +2 -0
  2. package/codegen/generate-types.js +12 -2
  3. package/esm/blueprint-types.generated.d.ts +2 -0
  4. package/esm/codegen/generate-types.js +12 -2
  5. package/esm/index.d.ts +1 -0
  6. package/esm/index.js +1 -0
  7. package/esm/module-presets/auth-email-magic.d.ts +15 -0
  8. package/esm/module-presets/auth-email-magic.js +55 -0
  9. package/esm/module-presets/auth-email.d.ts +17 -0
  10. package/esm/module-presets/auth-email.js +69 -0
  11. package/esm/module-presets/auth-hardened.d.ts +10 -0
  12. package/esm/module-presets/auth-hardened.js +65 -0
  13. package/esm/module-presets/auth-passkey.d.ts +14 -0
  14. package/esm/module-presets/auth-passkey.js +56 -0
  15. package/esm/module-presets/auth-sso.d.ts +21 -0
  16. package/esm/module-presets/auth-sso.js +65 -0
  17. package/esm/module-presets/b2b.d.ts +14 -0
  18. package/esm/module-presets/b2b.js +83 -0
  19. package/esm/module-presets/full.d.ts +15 -0
  20. package/esm/module-presets/full.js +38 -0
  21. package/esm/module-presets/index.d.ts +18 -0
  22. package/esm/module-presets/index.js +27 -0
  23. package/esm/module-presets/minimal.d.ts +14 -0
  24. package/esm/module-presets/minimal.js +48 -0
  25. package/esm/module-presets/types.d.ts +60 -0
  26. package/esm/module-presets/types.js +1 -0
  27. package/index.d.ts +1 -0
  28. package/index.js +1 -0
  29. package/module-presets/auth-email-magic.d.ts +15 -0
  30. package/module-presets/auth-email-magic.js +58 -0
  31. package/module-presets/auth-email.d.ts +17 -0
  32. package/module-presets/auth-email.js +72 -0
  33. package/module-presets/auth-hardened.d.ts +10 -0
  34. package/module-presets/auth-hardened.js +68 -0
  35. package/module-presets/auth-passkey.d.ts +14 -0
  36. package/module-presets/auth-passkey.js +59 -0
  37. package/module-presets/auth-sso.d.ts +21 -0
  38. package/module-presets/auth-sso.js +68 -0
  39. package/module-presets/b2b.d.ts +14 -0
  40. package/module-presets/b2b.js +86 -0
  41. package/module-presets/full.d.ts +15 -0
  42. package/module-presets/full.js +41 -0
  43. package/module-presets/index.d.ts +18 -0
  44. package/module-presets/index.js +38 -0
  45. package/module-presets/minimal.d.ts +14 -0
  46. package/module-presets/minimal.js +51 -0
  47. package/module-presets/types.d.ts +60 -0
  48. package/module-presets/types.js +2 -0
  49. package/package.json +2 -2
@@ -0,0 +1,18 @@
1
+ export type { ModulePreset } from './types';
2
+ import type { ModulePreset } from './types';
3
+ import { PresetMinimal } from './minimal';
4
+ import { PresetAuthEmail } from './auth-email';
5
+ import { PresetAuthEmailMagic } from './auth-email-magic';
6
+ import { PresetAuthSso } from './auth-sso';
7
+ import { PresetAuthPasskey } from './auth-passkey';
8
+ import { PresetAuthHardened } from './auth-hardened';
9
+ import { PresetB2b } from './b2b';
10
+ import { PresetFull } from './full';
11
+ export { PresetMinimal, PresetAuthEmail, PresetAuthEmailMagic, PresetAuthSso, PresetAuthPasskey, PresetAuthHardened, PresetB2b, PresetFull };
12
+ /**
13
+ * Ordered list of all shipped module presets, from smallest to largest
14
+ * module footprint. Stable ordering — CLIs / UIs can present this directly.
15
+ */
16
+ export declare const allModulePresets: ModulePreset[];
17
+ /** Look up a preset by name. Returns undefined if the name isn't known. */
18
+ export declare function getModulePreset(name: string): ModulePreset | undefined;
@@ -0,0 +1,27 @@
1
+ import { PresetMinimal } from './minimal';
2
+ import { PresetAuthEmail } from './auth-email';
3
+ import { PresetAuthEmailMagic } from './auth-email-magic';
4
+ import { PresetAuthSso } from './auth-sso';
5
+ import { PresetAuthPasskey } from './auth-passkey';
6
+ import { PresetAuthHardened } from './auth-hardened';
7
+ import { PresetB2b } from './b2b';
8
+ import { PresetFull } from './full';
9
+ export { PresetMinimal, PresetAuthEmail, PresetAuthEmailMagic, PresetAuthSso, PresetAuthPasskey, PresetAuthHardened, PresetB2b, PresetFull };
10
+ /**
11
+ * Ordered list of all shipped module presets, from smallest to largest
12
+ * module footprint. Stable ordering — CLIs / UIs can present this directly.
13
+ */
14
+ export const allModulePresets = [
15
+ PresetMinimal,
16
+ PresetAuthEmail,
17
+ PresetAuthEmailMagic,
18
+ PresetAuthSso,
19
+ PresetAuthPasskey,
20
+ PresetAuthHardened,
21
+ PresetB2b,
22
+ PresetFull
23
+ ];
24
+ /** Look up a preset by name. Returns undefined if the name isn't known. */
25
+ export function getModulePreset(name) {
26
+ return allModulePresets.find((p) => p.name === name);
27
+ }
@@ -0,0 +1,14 @@
1
+ import type { ModulePreset } from './types';
2
+ /**
3
+ * `minimal` — users + sessions + RLS + API keys. No auth procedures, no
4
+ * memberships, no orgs, no emails, no passwords.
5
+ *
6
+ * This is the barest foundation: a `users` table, a `sessions` table so
7
+ * something upstream can mint tokens, `rls_module` so row-level security
8
+ * is enforceable, and `secrets_module` so you can issue API keys. Nothing
9
+ * else.
10
+ *
11
+ * You still write your own identity bridge on top (or rely on a header-based
12
+ * user-id coming from an upstream proxy / JWT verifier).
13
+ */
14
+ export declare const PresetMinimal: ModulePreset;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * `minimal` — users + sessions + RLS + API keys. No auth procedures, no
3
+ * memberships, no orgs, no emails, no passwords.
4
+ *
5
+ * This is the barest foundation: a `users` table, a `sessions` table so
6
+ * something upstream can mint tokens, `rls_module` so row-level security
7
+ * is enforceable, and `secrets_module` so you can issue API keys. Nothing
8
+ * else.
9
+ *
10
+ * You still write your own identity bridge on top (or rely on a header-based
11
+ * user-id coming from an upstream proxy / JWT verifier).
12
+ */
13
+ export const PresetMinimal = {
14
+ name: 'minimal',
15
+ display_name: 'Minimal (RLS only)',
16
+ summary: 'users + sessions + RLS + API keys. No auth procedures installed.',
17
+ description: 'The smallest coherent Constructive install. You get a users table, a sessions table, ' +
18
+ 'RLS enforcement, and API-key infrastructure — but no server-side sign_up/sign_in flow. ' +
19
+ 'Pick this when authentication lives outside the database (an upstream IdP, a header from ' +
20
+ 'a proxy, an internal service-to-service JWT) and Constructive is just the RLS-aware data ' +
21
+ 'layer underneath.',
22
+ good_for: [
23
+ 'Internal tools where an upstream proxy supplies the user identity',
24
+ 'Backend-of-backend services that only need RLS, not an auth surface',
25
+ 'Prototypes that will bolt on a richer auth preset later'
26
+ ],
27
+ not_for: [
28
+ 'Any app that needs `sign_up` / `sign_in` / `reset_password` out of the box — use `auth:email` instead',
29
+ 'Multi-tenant / org-scoped apps — use `b2b`'
30
+ ],
31
+ modules: [
32
+ 'users_module',
33
+ 'sessions_module',
34
+ 'rls_module',
35
+ 'secrets_module'
36
+ ],
37
+ includes_notes: {
38
+ users_module: 'The canonical users table. Required by every preset.',
39
+ sessions_module: 'Session/token storage; needed so whatever upstream auth can mint a session row.',
40
+ rls_module: 'RLS policy infrastructure. Without it, row-level security is not enforced.',
41
+ secrets_module: 'API-key storage. Optional for this preset but almost always wanted alongside upstream auth.'
42
+ },
43
+ omits_notes: {
44
+ user_auth_module: 'No server-side sign_up/sign_in procedures in this preset.',
45
+ emails_module: 'Not needed without password/magic-link flows; upstream auth handles identity.',
46
+ memberships_module: 'No memberships without a user_auth_module wiring them up.'
47
+ }
48
+ };
@@ -0,0 +1,60 @@
1
+ /**
2
+ * A preset is a named, curated bundle of Constructive modules intended for a
3
+ * recognizable app shape (internal tool, consumer email login, SSO-only B2B,
4
+ * etc.). Presets are metadata only — passing `preset.modules` to
5
+ * `provision_database_modules(v_modules => ...)` is what actually installs
6
+ * them.
7
+ *
8
+ * Presets are NOT node types. They are a sibling concept: node types are
9
+ * reusable building blocks used inside a blueprint; presets are starting
10
+ * points for which modules to install before any blueprint is authored.
11
+ *
12
+ * All module names match the `rls_module`, `user_auth_module`, ... names in
13
+ * `metaschema_generators.provision_database_modules` in constructive-db.
14
+ *
15
+ * Naming uses snake_case for module names to match the server-side SQL
16
+ * convention, and kebab-ish `auth:email` for preset names because they're
17
+ * user-facing labels, not identifiers.
18
+ */
19
+ export interface ModulePreset {
20
+ /** Preset identifier, e.g. 'auth:email'. Stable, used as a key in CLI/codegen. */
21
+ name: string;
22
+ /** Human-readable label for UIs, e.g. 'Email + Password'. */
23
+ display_name: string;
24
+ /** One-line pitch — what this preset is in plain English. */
25
+ summary: string;
26
+ /**
27
+ * Longer narrative. Explain when you'd reach for this preset, what it
28
+ * implies architecturally, and what tradeoffs the user is accepting by
29
+ * choosing it. Keep to a few paragraphs max.
30
+ */
31
+ description: string;
32
+ /** Concrete scenarios this preset fits well. */
33
+ good_for: string[];
34
+ /** Scenarios where this preset is the wrong choice — point at alternatives. */
35
+ not_for: string[];
36
+ /**
37
+ * Flat list of module names to install. Module names must match the
38
+ * canonical list accepted by
39
+ * `metaschema_generators.provision_database_modules` in constructive-db.
40
+ * Order doesn't matter — provisioning resolves dependencies.
41
+ */
42
+ modules: string[];
43
+ /**
44
+ * Optional per-module justifications. Map from module name to a short
45
+ * "why this module is in this preset" note. Rendered in docs and CLI
46
+ * `--explain` output.
47
+ */
48
+ includes_notes?: Record<string, string>;
49
+ /**
50
+ * Optional per-module "why we deliberately leave this out" notes. Only
51
+ * list modules that a user might reasonably expect to be here; don't
52
+ * enumerate every omitted module.
53
+ */
54
+ omits_notes?: Record<string, string>;
55
+ /**
56
+ * Optional: name(s) of presets this one builds on. Purely documentary —
57
+ * not enforced at runtime, `modules` must still be the full flat list.
58
+ */
59
+ extends?: string[];
60
+ }
@@ -0,0 +1 @@
1
+ export {};
package/index.d.ts CHANGED
@@ -4,5 +4,6 @@ export * from './data';
4
4
  export * from './relation';
5
5
  export * from './view';
6
6
  export * from './blueprint-types.generated';
7
+ export * from './module-presets';
7
8
  import type { NodeTypeDefinition } from './types';
8
9
  export declare const allNodeTypes: NodeTypeDefinition[];
package/index.js CHANGED
@@ -42,6 +42,7 @@ __exportStar(require("./data"), exports);
42
42
  __exportStar(require("./relation"), exports);
43
43
  __exportStar(require("./view"), exports);
44
44
  __exportStar(require("./blueprint-types.generated"), exports);
45
+ __exportStar(require("./module-presets"), exports);
45
46
  const authz = __importStar(require("./authz"));
46
47
  const data = __importStar(require("./data"));
47
48
  const relation = __importStar(require("./relation"));
@@ -0,0 +1,15 @@
1
+ import type { ModulePreset } from './types';
2
+ /**
3
+ * `auth:email+magic` — `auth:email` plus passwordless email flows.
4
+ *
5
+ * Adds `session_secrets_module`, which is where one-time nonces for magic
6
+ * links and email OTPs are stored. Once installed, the `user_auth_module`
7
+ * emits `sign_up_magic_link`, `sign_in_magic_link`, and `sign_in_email_otp`
8
+ * procedures (gated on the equivalent `allow_*` toggles in
9
+ * `app_settings_auth`).
10
+ *
11
+ * Choose this over `auth:email` when you want users to be able to log in
12
+ * without ever setting a password — but still only over email (no SMS, no
13
+ * SSO).
14
+ */
15
+ export declare const PresetAuthEmailMagic: ModulePreset;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PresetAuthEmailMagic = void 0;
4
+ /**
5
+ * `auth:email+magic` — `auth:email` plus passwordless email flows.
6
+ *
7
+ * Adds `session_secrets_module`, which is where one-time nonces for magic
8
+ * links and email OTPs are stored. Once installed, the `user_auth_module`
9
+ * emits `sign_up_magic_link`, `sign_in_magic_link`, and `sign_in_email_otp`
10
+ * procedures (gated on the equivalent `allow_*` toggles in
11
+ * `app_settings_auth`).
12
+ *
13
+ * Choose this over `auth:email` when you want users to be able to log in
14
+ * without ever setting a password — but still only over email (no SMS, no
15
+ * SSO).
16
+ */
17
+ exports.PresetAuthEmailMagic = {
18
+ name: 'auth:email+magic',
19
+ display_name: 'Email + Magic Link / OTP',
20
+ summary: 'Everything in `auth:email` plus magic-link and email-OTP passwordless flows.',
21
+ description: 'Same password-based auth as `auth:email`, with `session_secrets_module` added so the ' +
22
+ 'generator emits the passwordless procedures: `sign_up_magic_link`, `sign_in_magic_link`, ' +
23
+ '`sign_in_email_otp`. Password flows still exist — you opt into passwordless-only by ' +
24
+ 'flipping the `allow_password_sign_*` toggles off in `app_settings_auth` after install. ' +
25
+ "This is the right step up from `auth:email` when you want to ship magic links without yet " +
26
+ "taking on SSO or passkeys.",
27
+ good_for: [
28
+ 'Consumer apps that want passwordless from day one',
29
+ 'Apps targeting users who forget passwords (newsletters, one-off tools)',
30
+ 'Hardening path from `auth:email` without jumping all the way to `auth:hardened`'
31
+ ],
32
+ not_for: [
33
+ 'Apps that need SSO or passkeys — use `auth:sso` or `auth:passkey`',
34
+ 'Production at scale — use `auth:hardened` for rate limiting'
35
+ ],
36
+ modules: [
37
+ 'users_module',
38
+ 'membership_types_module',
39
+ 'memberships_module:app',
40
+ 'sessions_module',
41
+ 'secrets_module',
42
+ 'encrypted_secrets_module',
43
+ 'emails_module',
44
+ 'rls_module',
45
+ 'user_auth_module',
46
+ 'session_secrets_module'
47
+ ],
48
+ includes_notes: {
49
+ session_secrets_module: 'Stores nonces for magic-link and email-OTP flows. Without it those procedures are not emitted.'
50
+ },
51
+ omits_notes: {
52
+ rate_limits_module: 'Same reasoning as `auth:email` — add later via `auth:hardened`.',
53
+ connected_accounts_module: 'No OAuth / SSO in this preset.',
54
+ webauthn_credentials_module: 'No passkeys — add `auth:passkey`.',
55
+ phone_numbers_module: 'No SMS — add `auth:hardened`.'
56
+ },
57
+ extends: ['auth:email']
58
+ };
@@ -0,0 +1,17 @@
1
+ import type { ModulePreset } from './types';
2
+ /**
3
+ * `auth:email` — email + password sign_up/sign_in. No orgs, no SSO, no SMS,
4
+ * no passkeys, no rate limits.
5
+ *
6
+ * This is the "working consumer login in one step" preset. It installs the
7
+ * `user_auth_module` and all the tables its insert trigger hard-requires,
8
+ * giving you the standard procedures: `sign_up`, `sign_in`, `sign_out`,
9
+ * `set_password`, `reset_password`, `forgot_password`, `verify_email`,
10
+ * `delete_account`, `my_sessions`, API-key CRUD. Nothing more.
11
+ *
12
+ * It deliberately excludes rate limits, connected accounts / identity
13
+ * providers (OAuth), WebAuthn (passkeys), phone numbers (SMS), invites,
14
+ * permissions, and org-scoped memberships. Bolt those on by moving to a
15
+ * richer preset (`auth:hardened`, `b2b`) when you actually need them.
16
+ */
17
+ export declare const PresetAuthEmail: ModulePreset;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PresetAuthEmail = void 0;
4
+ /**
5
+ * `auth:email` — email + password sign_up/sign_in. No orgs, no SSO, no SMS,
6
+ * no passkeys, no rate limits.
7
+ *
8
+ * This is the "working consumer login in one step" preset. It installs the
9
+ * `user_auth_module` and all the tables its insert trigger hard-requires,
10
+ * giving you the standard procedures: `sign_up`, `sign_in`, `sign_out`,
11
+ * `set_password`, `reset_password`, `forgot_password`, `verify_email`,
12
+ * `delete_account`, `my_sessions`, API-key CRUD. Nothing more.
13
+ *
14
+ * It deliberately excludes rate limits, connected accounts / identity
15
+ * providers (OAuth), WebAuthn (passkeys), phone numbers (SMS), invites,
16
+ * permissions, and org-scoped memberships. Bolt those on by moving to a
17
+ * richer preset (`auth:hardened`, `b2b`) when you actually need them.
18
+ */
19
+ exports.PresetAuthEmail = {
20
+ name: 'auth:email',
21
+ display_name: 'Email + Password',
22
+ summary: 'Standard email/password auth flow. No orgs, no SSO, no MFA, no rate limits.',
23
+ description: "Installs `user_auth_module` with exactly the table dependencies its insert trigger " +
24
+ "hard-requires: users, app-scoped memberships, emails, secrets, encrypted secrets, " +
25
+ "sessions, plus RLS. You get the standard password-based auth procedures (sign_up, " +
26
+ "sign_in, reset_password, verify_email, delete_account, ...) and that's it. " +
27
+ "Everything else in the module catalog — SSO, passkeys, SMS, rate limits, orgs, " +
28
+ "invites, permissions — is deliberately omitted. This is the right shape for single-tenant " +
29
+ "consumer apps in the first weeks, internal tools that need a real login, or anything " +
30
+ "where you want the lightest possible working auth and will add complexity only when " +
31
+ "forced to.",
32
+ good_for: [
33
+ 'Single-tenant consumer apps in the first week of development',
34
+ 'Internal tools where one simple login is enough',
35
+ 'Demos and hobby projects that need real password auth',
36
+ 'B2C SaaS before org/team features are needed'
37
+ ],
38
+ not_for: [
39
+ 'Apps with org/team/workspace structure — use `b2b`',
40
+ 'Apps that need SSO or passkeys from day one — use `auth:sso` or `auth:passkey`',
41
+ 'Production apps at scale — use `auth:hardened` (adds rate limits, SSO, passkeys, SMS)'
42
+ ],
43
+ modules: [
44
+ 'users_module',
45
+ 'membership_types_module',
46
+ 'memberships_module:app',
47
+ 'sessions_module',
48
+ 'secrets_module',
49
+ 'encrypted_secrets_module',
50
+ 'emails_module',
51
+ 'rls_module',
52
+ 'user_auth_module'
53
+ ],
54
+ includes_notes: {
55
+ 'memberships_module:app': 'Required by `user_auth_module`: every user gets an app-level membership row at sign-up.',
56
+ membership_types_module: "Required by `memberships_module:app`; defines the 'app' scope.",
57
+ emails_module: 'Required by the `user_auth_module` insert trigger (`RAISE EXCEPTION REQUIRES emails_module`).',
58
+ encrypted_secrets_module: 'Required for password hashing; referenced by `set_password`, `verify_password`, and reset flows.',
59
+ secrets_module: 'API-key storage (`create_api_key`, `revoke_api_key`, `my_api_keys`).'
60
+ },
61
+ omits_notes: {
62
+ rate_limits_module: 'Omitted intentionally; throttle_* helpers are null-safe and the auth procs compile without it. Add later via `auth:hardened`.',
63
+ connected_accounts_module: 'No OAuth / SSO in this preset — add `auth:sso`.',
64
+ identity_providers_module: 'No OAuth provider configs without connected_accounts.',
65
+ webauthn_credentials_module: 'No passkeys — add `auth:passkey`.',
66
+ phone_numbers_module: 'No SMS login — add `auth:hardened` or the SMS-only refactor path.',
67
+ 'memberships_module:org': 'No org/team structure — move to `b2b` when you need one.',
68
+ 'permissions_module:app': 'No fine-grained RBAC; the `is_admin` flag on users is the only gate.',
69
+ invites_module: 'Self-serve signup only.',
70
+ session_secrets_module: 'No magic-link / email-OTP nonces; add `auth:email+magic`.'
71
+ }
72
+ };
@@ -0,0 +1,10 @@
1
+ import type { ModulePreset } from './types';
2
+ /**
3
+ * `auth:hardened` — `auth:email` with rate limiting, SSO, passkeys, SMS,
4
+ * and magic-link / OTP infrastructure all installed. Production-ready
5
+ * consumer auth with the full identifier matrix.
6
+ *
7
+ * Still single-tenant (no orgs / teams / invites / permissions). For
8
+ * multi-tenant B2B, step up to `b2b`.
9
+ */
10
+ export declare const PresetAuthHardened: ModulePreset;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PresetAuthHardened = void 0;
4
+ /**
5
+ * `auth:hardened` — `auth:email` with rate limiting, SSO, passkeys, SMS,
6
+ * and magic-link / OTP infrastructure all installed. Production-ready
7
+ * consumer auth with the full identifier matrix.
8
+ *
9
+ * Still single-tenant (no orgs / teams / invites / permissions). For
10
+ * multi-tenant B2B, step up to `b2b`.
11
+ */
12
+ exports.PresetAuthHardened = {
13
+ name: 'auth:hardened',
14
+ display_name: 'Hardened (all auth surfaces)',
15
+ summary: 'Rate limits + SSO + passkeys + SMS + magic links. Production-grade consumer auth.',
16
+ description: 'All of `auth:email`, plus every optional auth module that fits inside the single-tenant ' +
17
+ 'model: `rate_limits_module` for throttling (protects sign-in, password reset, and ' +
18
+ 'signup flows), `connected_accounts_module` + `identity_providers_module` for SSO, ' +
19
+ '`webauthn_credentials_module` + `webauthn_auth_module` for passkeys, ' +
20
+ '`session_secrets_module` for magic-link / email-OTP nonces, and ' +
21
+ '`phone_numbers_module` for SMS flows. Every login identifier is available; ' +
22
+ 'toggle whichever ones you want off via `app_settings_auth.allow_*` columns. ' +
23
+ 'Choose this for any production consumer app; step up to `b2b` once you need orgs.',
24
+ good_for: [
25
+ 'Production consumer apps with a serious user base',
26
+ 'Apps that need every identifier available (email, SSO, passkey, SMS) with throttling',
27
+ 'Apps doing a progressive rollout of auth methods — everything is installed, you toggle per method'
28
+ ],
29
+ not_for: [
30
+ 'Hobby projects / demos — way too much infrastructure; use `auth:email`',
31
+ 'Multi-tenant B2B apps — use `b2b`, which layers orgs + invites + permissions on top'
32
+ ],
33
+ modules: [
34
+ 'users_module',
35
+ 'membership_types_module',
36
+ 'memberships_module:app',
37
+ 'sessions_module',
38
+ 'secrets_module',
39
+ 'encrypted_secrets_module',
40
+ 'emails_module',
41
+ 'rls_module',
42
+ 'user_auth_module',
43
+ 'session_secrets_module',
44
+ 'rate_limits_module',
45
+ 'connected_accounts_module',
46
+ 'identity_providers_module',
47
+ 'webauthn_credentials_module',
48
+ 'webauthn_auth_module',
49
+ 'phone_numbers_module'
50
+ ],
51
+ includes_notes: {
52
+ rate_limits_module: 'Throttling for sign-in, password reset, sign-up, and IP-based gates.',
53
+ connected_accounts_module: 'OAuth / SSO linkage.',
54
+ identity_providers_module: 'OAuth provider configs (required for `connected_accounts_module`).',
55
+ webauthn_credentials_module: 'Per-user passkey storage.',
56
+ webauthn_auth_module: 'Passkey challenge + assertion runtime.',
57
+ session_secrets_module: 'Nonces for magic links, email OTP, and WebAuthn challenges.',
58
+ phone_numbers_module: 'SMS sign-in / MFA support.'
59
+ },
60
+ omits_notes: {
61
+ 'memberships_module:org': 'No orgs / teams — use `b2b` when you need multi-tenancy.',
62
+ 'permissions_module:app': 'No RBAC beyond the `is_admin` flag — add via `b2b`.',
63
+ invites_module: 'No invite flow — add via `b2b`.',
64
+ storage_module: 'Add separately if you need file uploads.',
65
+ crypto_addresses_module: 'Not a web3 preset; omit unless doing wallet sign-in.'
66
+ },
67
+ extends: ['auth:email', 'auth:email+magic', 'auth:sso', 'auth:passkey']
68
+ };
@@ -0,0 +1,14 @@
1
+ import type { ModulePreset } from './types';
2
+ /**
3
+ * `auth:passkey` — `auth:email` plus WebAuthn / passkeys.
4
+ *
5
+ * Adds `webauthn_credentials_module` (stores each user's registered public
6
+ * keys and credential IDs), `webauthn_auth_module` (the auth-time challenge
7
+ * storage + flow), and `session_secrets_module` (where the one-time
8
+ * challenge nonces live). The generator then emits WebAuthn registration
9
+ * and assertion procedures.
10
+ *
11
+ * Password flows stay on by default as a recovery path; toggle them off in
12
+ * `app_settings_auth` if you want strictly-passkey.
13
+ */
14
+ export declare const PresetAuthPasskey: ModulePreset;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PresetAuthPasskey = void 0;
4
+ /**
5
+ * `auth:passkey` — `auth:email` plus WebAuthn / passkeys.
6
+ *
7
+ * Adds `webauthn_credentials_module` (stores each user's registered public
8
+ * keys and credential IDs), `webauthn_auth_module` (the auth-time challenge
9
+ * storage + flow), and `session_secrets_module` (where the one-time
10
+ * challenge nonces live). The generator then emits WebAuthn registration
11
+ * and assertion procedures.
12
+ *
13
+ * Password flows stay on by default as a recovery path; toggle them off in
14
+ * `app_settings_auth` if you want strictly-passkey.
15
+ */
16
+ exports.PresetAuthPasskey = {
17
+ name: 'auth:passkey',
18
+ display_name: 'Passkeys (WebAuthn)',
19
+ summary: '`auth:email` plus WebAuthn passkey registration and assertion.',
20
+ description: "Installs the three modules WebAuthn needs: `webauthn_credentials_module` for each user's " +
21
+ "registered public keys, `webauthn_auth_module` for the runtime challenge/assertion flow, " +
22
+ "and `session_secrets_module` for the one-time challenge nonces. With these installed, " +
23
+ "the generator emits WebAuthn registration/login procs. Keep password flows as a recovery " +
24
+ "path, or disable them in `app_settings_auth` for passkey-only deployments.",
25
+ good_for: [
26
+ 'Apps where you want users to adopt phishing-resistant auth',
27
+ 'Consumer apps with a tech-forward audience',
28
+ 'Internal tools protecting sensitive data where FIDO2 is a requirement'
29
+ ],
30
+ not_for: [
31
+ 'Apps that also need SSO or SMS — use `auth:hardened` for everything',
32
+ 'Apps where the end-user device mix is heavy on old browsers that lack WebAuthn'
33
+ ],
34
+ modules: [
35
+ 'users_module',
36
+ 'membership_types_module',
37
+ 'memberships_module:app',
38
+ 'sessions_module',
39
+ 'secrets_module',
40
+ 'encrypted_secrets_module',
41
+ 'emails_module',
42
+ 'rls_module',
43
+ 'user_auth_module',
44
+ 'session_secrets_module',
45
+ 'webauthn_credentials_module',
46
+ 'webauthn_auth_module'
47
+ ],
48
+ includes_notes: {
49
+ webauthn_credentials_module: 'Per-user WebAuthn credential storage. Without it, passkey registration does not compile.',
50
+ webauthn_auth_module: 'Runtime challenge + assertion flow.',
51
+ session_secrets_module: 'Challenge nonces for registration and assertion.'
52
+ },
53
+ omits_notes: {
54
+ rate_limits_module: 'Add via `auth:hardened` for production.',
55
+ connected_accounts_module: 'No OAuth / SSO — add via `auth:hardened`.',
56
+ phone_numbers_module: 'No SMS.'
57
+ },
58
+ extends: ['auth:email']
59
+ };
@@ -0,0 +1,21 @@
1
+ import type { ModulePreset } from './types';
2
+ /**
3
+ * `auth:sso` — `auth:email` plus OAuth / OpenID Connect sign-in.
4
+ *
5
+ * Adds `connected_accounts_module` (the junction table mapping a user to
6
+ * `(provider, external_id)`) and `identity_providers_module` (the provider
7
+ * config: URLs, client_id, encrypted client_secret, scopes, PKCE/nonce
8
+ * knobs). The generator then emits `sign_in_identity` / `sign_up_identity`
9
+ * procedures which rely on `encrypted_secrets_module` to decrypt the client
10
+ * secret at auth time.
11
+ *
12
+ * Password fallback stays on by default (break-glass for admins); flip the
13
+ * `allow_password_sign_*` toggles off in `app_settings_auth` for strictly
14
+ * SSO-only.
15
+ *
16
+ * Note: `emails_module` is still required — the `user_auth_module` insert
17
+ * trigger hard-requires it today. A pure SSO-only install without emails
18
+ * is a separate refactor (see `docs/architecture/module-presets.md` in
19
+ * constructive-db).
20
+ */
21
+ export declare const PresetAuthSso: ModulePreset;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PresetAuthSso = void 0;
4
+ /**
5
+ * `auth:sso` — `auth:email` plus OAuth / OpenID Connect sign-in.
6
+ *
7
+ * Adds `connected_accounts_module` (the junction table mapping a user to
8
+ * `(provider, external_id)`) and `identity_providers_module` (the provider
9
+ * config: URLs, client_id, encrypted client_secret, scopes, PKCE/nonce
10
+ * knobs). The generator then emits `sign_in_identity` / `sign_up_identity`
11
+ * procedures which rely on `encrypted_secrets_module` to decrypt the client
12
+ * secret at auth time.
13
+ *
14
+ * Password fallback stays on by default (break-glass for admins); flip the
15
+ * `allow_password_sign_*` toggles off in `app_settings_auth` for strictly
16
+ * SSO-only.
17
+ *
18
+ * Note: `emails_module` is still required — the `user_auth_module` insert
19
+ * trigger hard-requires it today. A pure SSO-only install without emails
20
+ * is a separate refactor (see `docs/architecture/module-presets.md` in
21
+ * constructive-db).
22
+ */
23
+ exports.PresetAuthSso = {
24
+ name: 'auth:sso',
25
+ display_name: 'OAuth / OpenID Connect',
26
+ summary: '`auth:email` plus OAuth providers and connected-account linkage.',
27
+ description: "Adds the two modules that make SSO work: `identity_providers_module` (where provider " +
28
+ "definitions live — Google, GitHub, Okta, etc., with their URLs, client IDs, and " +
29
+ "encrypted client secrets) and `connected_accounts_module` (the junction mapping a " +
30
+ "Constructive user to a `(provider, external_id)` pair). The generator emits " +
31
+ "`sign_in_identity` and `sign_up_identity` procedures which decrypt the client secret " +
32
+ "through `encrypted_secrets_module` at auth time. Keep password flows as break-glass, or " +
33
+ "disable them via `app_settings_auth` toggles for strictly-SSO deployments.",
34
+ good_for: [
35
+ 'B2B apps where end users sign in via their employer IdP',
36
+ 'Consumer apps that want "Sign in with Google / GitHub"',
37
+ 'Apps that need to federate identity with a specific provider ecosystem'
38
+ ],
39
+ not_for: [
40
+ 'Apps that also need passkeys and rate limits — use `auth:hardened`',
41
+ 'Strictly-SSO apps that want NO email storage — needs the emails-optional refactor; not supported by a preset today'
42
+ ],
43
+ modules: [
44
+ 'users_module',
45
+ 'membership_types_module',
46
+ 'memberships_module:app',
47
+ 'sessions_module',
48
+ 'secrets_module',
49
+ 'encrypted_secrets_module',
50
+ 'emails_module',
51
+ 'rls_module',
52
+ 'user_auth_module',
53
+ 'connected_accounts_module',
54
+ 'identity_providers_module'
55
+ ],
56
+ includes_notes: {
57
+ connected_accounts_module: 'Junction table for (user, provider, external_id). Without it, `sign_in_identity` does not compile.',
58
+ identity_providers_module: 'Provider config table (URLs, client_id, encrypted client_secret, scopes, PKCE knobs).',
59
+ encrypted_secrets_module: 'Required by `auth:email` already; also used by SSO to decrypt the provider client_secret at auth time.'
60
+ },
61
+ omits_notes: {
62
+ webauthn_credentials_module: 'No passkeys — add `auth:passkey` or move to `auth:hardened`.',
63
+ rate_limits_module: 'Omitted; add via `auth:hardened` for production.',
64
+ session_secrets_module: "Not required for authorization-code OAuth; add if you also want magic-link flows. PKCE doesn't require it for stateless OAuth flows today.",
65
+ phone_numbers_module: 'No SMS in this preset.'
66
+ },
67
+ extends: ['auth:email']
68
+ };
@@ -0,0 +1,14 @@
1
+ import type { ModulePreset } from './types';
2
+ /**
3
+ * `b2b` — `auth:hardened` plus orgs, invites, permissions, levels,
4
+ * profiles, and hierarchy. The full multi-tenant / B2B SaaS shape.
5
+ *
6
+ * Installs both app-scoped AND org-scoped instances of the membership,
7
+ * permission, limit, level, profile, and invite modules. `hierarchy_module`
8
+ * at the org scope enables nested org/team structures.
9
+ *
10
+ * This is a large install — every B2B concept Constructive ships. Don't
11
+ * reach for it until you actually need orgs; moving from `auth:hardened`
12
+ * to `b2b` later is a provisioning step, not a schema rewrite.
13
+ */
14
+ export declare const PresetB2b: ModulePreset;