@fusebase/fusebase-gate-sdk 2.2.15-sdk.5 → 2.2.15-sdk.6

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.
@@ -0,0 +1,45 @@
1
+ /**
2
+ * AppMagicLinks API
3
+ *
4
+ * Generated from contract introspection
5
+ * Domain: app-magic-links
6
+ */
7
+ import type { Client } from "../runtime/transport";
8
+ import type { ActivateAppMagicLinkResponseContract, CreateAppMagicLinkRequestContract, CreateAppMagicLinkResponseContract, orgIdInPathRequired, RequestAppMagicLinkRequestContract, RequestAppMagicLinkResponseContract } from "../types";
9
+ export declare class AppMagicLinksApi {
10
+ private client;
11
+ constructor(client: Client);
12
+ /**
13
+ * Activate an app magic link
14
+ * Unauthenticated activation: exchange a magic-link globalId for a session token (used to set the eversessionid cookie on the app subdomain), a Gate feature token, and a Dashboard feature token, all scoped to the magic link's app and target user. Re-evaluates accessPrincipals at activation time so a link issued before access was revoked can no longer be redeemed. Within the 24h TTL the link can be activated more than once.
15
+ */
16
+ activateAppMagicLink(params: {
17
+ path: {
18
+ globalId: string;
19
+ };
20
+ headers?: Record<string, string>;
21
+ }): Promise<ActivateAppMagicLinkResponseContract>;
22
+ /**
23
+ * Create an app magic link (invite flow)
24
+ * Owner/admin invite flow. Issues a 24h magic link for the recipient email and dispatches it via the magic_link_app email template. When addToAccessPrincipals is true (default), provisions a brand-new user record if needed and appends a user principal to every feature of the app. Requires app_magic_link.write and org access.
25
+ */
26
+ createAppMagicLink(params: {
27
+ path: {
28
+ orgId: orgIdInPathRequired;
29
+ appId: string;
30
+ };
31
+ headers?: Record<string, string>;
32
+ body: CreateAppMagicLinkRequestContract;
33
+ }): Promise<CreateAppMagicLinkResponseContract>;
34
+ /**
35
+ * Request an app magic link (visitor self-service flow)
36
+ * Unauthenticated visitor flow. The link is dispatched only when the email already has access to the app under its current accessPrincipals; otherwise the call is a no-op. Always returns 200 with `{ ok: true }` so the response cannot be used to enumerate emails or access. Apply per-IP rate limiting upstream of this call.
37
+ */
38
+ requestAppMagicLink(params: {
39
+ path: {
40
+ host: string;
41
+ };
42
+ headers?: Record<string, string>;
43
+ body: RequestAppMagicLinkRequestContract;
44
+ }): Promise<RequestAppMagicLinkResponseContract>;
45
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ /**
3
+ * AppMagicLinks API
4
+ *
5
+ * Generated from contract introspection
6
+ * Domain: app-magic-links
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AppMagicLinksApi = void 0;
10
+ class AppMagicLinksApi {
11
+ constructor(client) {
12
+ this.client = client;
13
+ }
14
+ /**
15
+ * Activate an app magic link
16
+ * Unauthenticated activation: exchange a magic-link globalId for a session token (used to set the eversessionid cookie on the app subdomain), a Gate feature token, and a Dashboard feature token, all scoped to the magic link's app and target user. Re-evaluates accessPrincipals at activation time so a link issued before access was revoked can no longer be redeemed. Within the 24h TTL the link can be activated more than once.
17
+ */
18
+ async activateAppMagicLink(params) {
19
+ return this.client.request({
20
+ method: "POST",
21
+ path: "/apps/magic-links/:globalId/activate",
22
+ pathParams: params.path,
23
+ headers: params.headers,
24
+ opId: "activateAppMagicLink",
25
+ expectedContentType: "application/json",
26
+ });
27
+ }
28
+ /**
29
+ * Create an app magic link (invite flow)
30
+ * Owner/admin invite flow. Issues a 24h magic link for the recipient email and dispatches it via the magic_link_app email template. When addToAccessPrincipals is true (default), provisions a brand-new user record if needed and appends a user principal to every feature of the app. Requires app_magic_link.write and org access.
31
+ */
32
+ async createAppMagicLink(params) {
33
+ return this.client.request({
34
+ method: "POST",
35
+ path: "/:orgId/apps/:appId/magic-links",
36
+ pathParams: params.path,
37
+ headers: params.headers,
38
+ body: params.body,
39
+ opId: "createAppMagicLink",
40
+ expectedContentType: "application/json",
41
+ });
42
+ }
43
+ /**
44
+ * Request an app magic link (visitor self-service flow)
45
+ * Unauthenticated visitor flow. The link is dispatched only when the email already has access to the app under its current accessPrincipals; otherwise the call is a no-op. Always returns 200 with `{ ok: true }` so the response cannot be used to enumerate emails or access. Apply per-IP rate limiting upstream of this call.
46
+ */
47
+ async requestAppMagicLink(params) {
48
+ return this.client.request({
49
+ method: "POST",
50
+ path: "/apps/by-host/:host/magic-links/request",
51
+ pathParams: params.path,
52
+ headers: params.headers,
53
+ body: params.body,
54
+ opId: "requestAppMagicLink",
55
+ expectedContentType: "application/json",
56
+ });
57
+ }
58
+ }
59
+ exports.AppMagicLinksApi = AppMagicLinksApi;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * FusebaseAuth API
3
+ *
4
+ * Generated from contract introspection
5
+ * Domain: fusebase-auth
6
+ */
7
+ import type { Client } from "../runtime/transport";
8
+ import type { FusebaseAuthChallengeRequestContract, FusebaseAuthChallengeResponseContract, FusebaseAuthLoginRequestContract, FusebaseAuthLoginResponseContract, FusebaseAuthLogoutResponseContract, FusebaseAuthPasswordResetRequestContract, FusebaseAuthPasswordResetResponseContract, FusebaseAuthPasswordRestoreKeyResponseContract, FusebaseAuthPasswordRestoreRequestContract, FusebaseAuthPasswordRestoreResponseContract, FusebaseAuthRegisterMemberRequestContract, FusebaseAuthRegisterMemberResponseContract, FusebaseAuthRegisterRequestContract, FusebaseAuthRegisterResponseContract, orgIdInPathRequired } from "../types";
9
+ export declare class FusebaseAuthApi {
10
+ private client;
11
+ constructor(client: Client);
12
+ /**
13
+ * Check Fusebase password restore key
14
+ * Checks a restore-password session key through user-service. Returns `{ valid: false }` instead of exposing upstream errors.
15
+ */
16
+ checkFusebasePasswordRestoreKey(params: {
17
+ path: {
18
+ key: string;
19
+ };
20
+ headers?: Record<string, string>;
21
+ }): Promise<FusebaseAuthPasswordRestoreKeyResponseContract>;
22
+ /**
23
+ * Complete Fusebase auth challenge
24
+ * Visitor-safe challenge completion endpoint for CAPTCHA, OTP, mail OTP, and MFA flows returned by register/login.
25
+ */
26
+ completeFusebaseAuthChallenge(params: {
27
+ headers?: Record<string, string>;
28
+ body: FusebaseAuthChallengeRequestContract;
29
+ }): Promise<FusebaseAuthChallengeResponseContract>;
30
+ /**
31
+ * Login a Fusebase user
32
+ * Visitor-safe email/password login proxy for AI App auth. Forwards to auth-form `/auth/api/auth` server-side and returns sessionId for the app backend to set as its own cookie. Never provisions org membership.
33
+ */
34
+ loginFusebaseUser(params: {
35
+ headers?: Record<string, string>;
36
+ body: FusebaseAuthLoginRequestContract;
37
+ }): Promise<FusebaseAuthLoginResponseContract>;
38
+ /**
39
+ * Get Fusebase auth logout cookie hints
40
+ * Returns the app-domain cookies that the AI App backend/frontend should clear. Gate cannot clear cookies for an app domain when called on the Gate domain.
41
+ */
42
+ logoutFusebaseUser(params: {
43
+ headers?: Record<string, string>;
44
+ }): Promise<FusebaseAuthLogoutResponseContract>;
45
+ /**
46
+ * Register a Fusebase user and add org membership
47
+ * Protected AI App onboarding flow. Creates a Fusebase account through auth-form, then adds the newly created user to the path org with the requested role. Requires org.members.write and org access. This endpoint is for registration only; do not call it on login because that can overwrite or duplicate existing membership intent.
48
+ */
49
+ registerFusebaseOrgMember(params: {
50
+ path: {
51
+ orgId: orgIdInPathRequired;
52
+ };
53
+ headers?: Record<string, string>;
54
+ body: FusebaseAuthRegisterMemberRequestContract;
55
+ }): Promise<FusebaseAuthRegisterMemberResponseContract>;
56
+ /**
57
+ * Register a Fusebase user
58
+ * Visitor-safe email/password Fusebase registration proxy for AI App auth. Forwards to auth-form `/auth/api/register` server-side and returns the Fusebase sessionId for the app backend to set as its own cookie. Does not add org membership.
59
+ */
60
+ registerFusebaseUser(params: {
61
+ headers?: Record<string, string>;
62
+ body: FusebaseAuthRegisterRequestContract;
63
+ }): Promise<FusebaseAuthRegisterResponseContract>;
64
+ /**
65
+ * Request Fusebase password restore
66
+ * Visitor-safe password restore request. Forwards to auth-form `/auth/api/remind` and always returns a generic success shape so the route does not enumerate accounts.
67
+ */
68
+ requestFusebasePasswordRestore(params: {
69
+ headers?: Record<string, string>;
70
+ body: FusebaseAuthPasswordRestoreRequestContract;
71
+ }): Promise<FusebaseAuthPasswordRestoreResponseContract>;
72
+ /**
73
+ * Reset Fusebase password
74
+ * Completes a password restore session by setting a new password through user-service.
75
+ */
76
+ resetFusebasePassword(params: {
77
+ path: {
78
+ key: string;
79
+ };
80
+ headers?: Record<string, string>;
81
+ body: FusebaseAuthPasswordResetRequestContract;
82
+ }): Promise<FusebaseAuthPasswordResetResponseContract>;
83
+ }
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ /**
3
+ * FusebaseAuth API
4
+ *
5
+ * Generated from contract introspection
6
+ * Domain: fusebase-auth
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.FusebaseAuthApi = void 0;
10
+ class FusebaseAuthApi {
11
+ constructor(client) {
12
+ this.client = client;
13
+ }
14
+ /**
15
+ * Check Fusebase password restore key
16
+ * Checks a restore-password session key through user-service. Returns `{ valid: false }` instead of exposing upstream errors.
17
+ */
18
+ async checkFusebasePasswordRestoreKey(params) {
19
+ return this.client.request({
20
+ method: "GET",
21
+ path: "/auth/fusebase/password-restore/:key",
22
+ pathParams: params.path,
23
+ headers: params.headers,
24
+ opId: "checkFusebasePasswordRestoreKey",
25
+ expectedContentType: "application/json",
26
+ });
27
+ }
28
+ /**
29
+ * Complete Fusebase auth challenge
30
+ * Visitor-safe challenge completion endpoint for CAPTCHA, OTP, mail OTP, and MFA flows returned by register/login.
31
+ */
32
+ async completeFusebaseAuthChallenge(params) {
33
+ return this.client.request({
34
+ method: "POST",
35
+ path: "/auth/fusebase/challenge",
36
+ headers: params.headers,
37
+ body: params.body,
38
+ opId: "completeFusebaseAuthChallenge",
39
+ expectedContentType: "application/json",
40
+ });
41
+ }
42
+ /**
43
+ * Login a Fusebase user
44
+ * Visitor-safe email/password login proxy for AI App auth. Forwards to auth-form `/auth/api/auth` server-side and returns sessionId for the app backend to set as its own cookie. Never provisions org membership.
45
+ */
46
+ async loginFusebaseUser(params) {
47
+ return this.client.request({
48
+ method: "POST",
49
+ path: "/auth/fusebase/login",
50
+ headers: params.headers,
51
+ body: params.body,
52
+ opId: "loginFusebaseUser",
53
+ expectedContentType: "application/json",
54
+ });
55
+ }
56
+ /**
57
+ * Get Fusebase auth logout cookie hints
58
+ * Returns the app-domain cookies that the AI App backend/frontend should clear. Gate cannot clear cookies for an app domain when called on the Gate domain.
59
+ */
60
+ async logoutFusebaseUser(params) {
61
+ return this.client.request({
62
+ method: "POST",
63
+ path: "/auth/fusebase/logout",
64
+ headers: params.headers,
65
+ opId: "logoutFusebaseUser",
66
+ expectedContentType: "application/json",
67
+ });
68
+ }
69
+ /**
70
+ * Register a Fusebase user and add org membership
71
+ * Protected AI App onboarding flow. Creates a Fusebase account through auth-form, then adds the newly created user to the path org with the requested role. Requires org.members.write and org access. This endpoint is for registration only; do not call it on login because that can overwrite or duplicate existing membership intent.
72
+ */
73
+ async registerFusebaseOrgMember(params) {
74
+ return this.client.request({
75
+ method: "POST",
76
+ path: "/:orgId/auth/fusebase/register-member",
77
+ pathParams: params.path,
78
+ headers: params.headers,
79
+ body: params.body,
80
+ opId: "registerFusebaseOrgMember",
81
+ expectedContentType: "application/json",
82
+ });
83
+ }
84
+ /**
85
+ * Register a Fusebase user
86
+ * Visitor-safe email/password Fusebase registration proxy for AI App auth. Forwards to auth-form `/auth/api/register` server-side and returns the Fusebase sessionId for the app backend to set as its own cookie. Does not add org membership.
87
+ */
88
+ async registerFusebaseUser(params) {
89
+ return this.client.request({
90
+ method: "POST",
91
+ path: "/auth/fusebase/register",
92
+ headers: params.headers,
93
+ body: params.body,
94
+ opId: "registerFusebaseUser",
95
+ expectedContentType: "application/json",
96
+ });
97
+ }
98
+ /**
99
+ * Request Fusebase password restore
100
+ * Visitor-safe password restore request. Forwards to auth-form `/auth/api/remind` and always returns a generic success shape so the route does not enumerate accounts.
101
+ */
102
+ async requestFusebasePasswordRestore(params) {
103
+ return this.client.request({
104
+ method: "POST",
105
+ path: "/auth/fusebase/password-restore",
106
+ headers: params.headers,
107
+ body: params.body,
108
+ opId: "requestFusebasePasswordRestore",
109
+ expectedContentType: "application/json",
110
+ });
111
+ }
112
+ /**
113
+ * Reset Fusebase password
114
+ * Completes a password restore session by setting a new password through user-service.
115
+ */
116
+ async resetFusebasePassword(params) {
117
+ return this.client.request({
118
+ method: "POST",
119
+ path: "/auth/fusebase/password-restore/:key",
120
+ pathParams: params.path,
121
+ headers: params.headers,
122
+ body: params.body,
123
+ opId: "resetFusebasePassword",
124
+ expectedContentType: "application/json",
125
+ });
126
+ }
127
+ }
128
+ exports.FusebaseAuthApi = FusebaseAuthApi;
package/dist/index.d.ts CHANGED
@@ -7,9 +7,11 @@ export * from "./runtime";
7
7
  export * from "./types";
8
8
  export { AccessApi } from "./apis/AccessApi";
9
9
  export { AppApisApi } from "./apis/AppApisApi";
10
+ export { AppMagicLinksApi } from "./apis/AppMagicLinksApi";
10
11
  export { BillingApi } from "./apis/BillingApi";
11
12
  export { EmailsApi } from "./apis/EmailsApi";
12
13
  export { FilesApi } from "./apis/FilesApi";
14
+ export { FusebaseAuthApi } from "./apis/FusebaseAuthApi";
13
15
  export { HealthApi } from "./apis/HealthApi";
14
16
  export { IsolatedStoresApi } from "./apis/IsolatedStoresApi";
15
17
  export { McpManagerApi } from "./apis/McpManagerApi";
package/dist/index.js CHANGED
@@ -19,19 +19,23 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.WorkspacesApi = exports.TokensApi = exports.SystemApi = exports.PortalsApi = exports.OrgUsersApi = exports.OrgGroupsApi = exports.NotesApi = exports.McpManagerApi = exports.IsolatedStoresApi = exports.HealthApi = exports.FilesApi = exports.EmailsApi = exports.BillingApi = exports.AppApisApi = exports.AccessApi = void 0;
22
+ exports.WorkspacesApi = exports.TokensApi = exports.SystemApi = exports.PortalsApi = exports.OrgUsersApi = exports.OrgGroupsApi = exports.NotesApi = exports.McpManagerApi = exports.IsolatedStoresApi = exports.HealthApi = exports.FusebaseAuthApi = exports.FilesApi = exports.EmailsApi = exports.BillingApi = exports.AppMagicLinksApi = exports.AppApisApi = exports.AccessApi = void 0;
23
23
  __exportStar(require("./runtime"), exports);
24
24
  __exportStar(require("./types"), exports);
25
25
  var AccessApi_1 = require("./apis/AccessApi");
26
26
  Object.defineProperty(exports, "AccessApi", { enumerable: true, get: function () { return AccessApi_1.AccessApi; } });
27
27
  var AppApisApi_1 = require("./apis/AppApisApi");
28
28
  Object.defineProperty(exports, "AppApisApi", { enumerable: true, get: function () { return AppApisApi_1.AppApisApi; } });
29
+ var AppMagicLinksApi_1 = require("./apis/AppMagicLinksApi");
30
+ Object.defineProperty(exports, "AppMagicLinksApi", { enumerable: true, get: function () { return AppMagicLinksApi_1.AppMagicLinksApi; } });
29
31
  var BillingApi_1 = require("./apis/BillingApi");
30
32
  Object.defineProperty(exports, "BillingApi", { enumerable: true, get: function () { return BillingApi_1.BillingApi; } });
31
33
  var EmailsApi_1 = require("./apis/EmailsApi");
32
34
  Object.defineProperty(exports, "EmailsApi", { enumerable: true, get: function () { return EmailsApi_1.EmailsApi; } });
33
35
  var FilesApi_1 = require("./apis/FilesApi");
34
36
  Object.defineProperty(exports, "FilesApi", { enumerable: true, get: function () { return FilesApi_1.FilesApi; } });
37
+ var FusebaseAuthApi_1 = require("./apis/FusebaseAuthApi");
38
+ Object.defineProperty(exports, "FusebaseAuthApi", { enumerable: true, get: function () { return FusebaseAuthApi_1.FusebaseAuthApi; } });
35
39
  var HealthApi_1 = require("./apis/HealthApi");
36
40
  Object.defineProperty(exports, "HealthApi", { enumerable: true, get: function () { return HealthApi_1.HealthApi; } });
37
41
  var IsolatedStoresApi_1 = require("./apis/IsolatedStoresApi");
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Request body for createAppMagicLink (owner/admin invite flow).
3
+ */
4
+ export interface CreateAppMagicLinkRequestContract {
5
+ /**
6
+ * Recipient email address. The link is dispatched to this address.
7
+ * @format email
8
+ */
9
+ email: string;
10
+ /**
11
+ * Relative app path to land on after activation (e.g. /proposals/abc).
12
+ * Omit for root.
13
+ * @nullable true
14
+ */
15
+ redirectPath?: string | null;
16
+ /**
17
+ * When true (default), append a user principal to every feature of the app
18
+ * and provision a new user record if the email is not yet known.
19
+ * When false, the user must already exist or the call rejects with NotFound.
20
+ */
21
+ addToAccessPrincipals?: boolean;
22
+ }
23
+ /**
24
+ * Response body for createAppMagicLink.
25
+ */
26
+ export interface CreateAppMagicLinkResponseContract {
27
+ /**
28
+ * globalId of the magic link row, also the value passed to the activation
29
+ * endpoint.
30
+ */
31
+ id: string;
32
+ /**
33
+ * Fully qualified URL to the app `/link` route with `id` (and optional
34
+ * `redirect`) query params.
35
+ */
36
+ magicLinkUrl: string;
37
+ /**
38
+ * Unix timestamp (seconds) when the link expires (createdAt + 24h).
39
+ */
40
+ expiresAt: number;
41
+ }
42
+ /**
43
+ * Request body for requestAppMagicLink (visitor self-service flow).
44
+ */
45
+ export interface RequestAppMagicLinkRequestContract {
46
+ /**
47
+ * Email address typed by the visitor. The link is dispatched to this address
48
+ * only when it already has access to the app.
49
+ * @format email
50
+ */
51
+ email: string;
52
+ /**
53
+ * Optional relative app path to land on after activation
54
+ * (e.g. /proposals/abc). Omit for root.
55
+ * @nullable true
56
+ */
57
+ redirectPath?: string | null;
58
+ }
59
+ /**
60
+ * Generic acknowledgment. Returned for both allowed and denied requests so
61
+ * the response cannot be used to enumerate emails or access state.
62
+ */
63
+ export interface RequestAppMagicLinkResponseContract {
64
+ /**
65
+ * Always true.
66
+ */
67
+ ok: boolean;
68
+ }
69
+ /**
70
+ * Response body for activateAppMagicLink.
71
+ */
72
+ export interface ActivateAppMagicLinkResponseContract {
73
+ /**
74
+ * globalId of the magic link that was activated.
75
+ */
76
+ id: string;
77
+ /**
78
+ * Session id usable as the `eversessionid` cookie value.
79
+ */
80
+ sessionToken: string;
81
+ /**
82
+ * Fusebase Gate token scoped to the resolved app feature and target user.
83
+ * May be empty if upstream token issuance failed; the activation itself
84
+ * still succeeded and the SPA can retry.
85
+ */
86
+ featureToken: string;
87
+ /**
88
+ * Dashboard service token scoped to the same feature and user. May be empty
89
+ * if upstream token issuance failed.
90
+ */
91
+ dashboardToken: string;
92
+ /**
93
+ * Relative app path the SPA should navigate to after the cookie is set
94
+ * (e.g. /proposals/abc). Defaults to `/` when no `redirectPath` was provided
95
+ * when the link was created.
96
+ */
97
+ redirectPath: string;
98
+ /**
99
+ * Unix timestamp (seconds) when the magic link expires.
100
+ */
101
+ expiresAt: number;
102
+ /**
103
+ * globalId of the resolved app feature whose access the tokens are scoped to.
104
+ */
105
+ appFeatureId: string;
106
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,104 @@
1
+ export interface FusebaseAuthSessionContract {
2
+ sessionId: string;
3
+ userId: number;
4
+ }
5
+ export interface FusebaseAuthChallengeContract {
6
+ type: string;
7
+ state: string;
8
+ image?: string;
9
+ question?: string;
10
+ email?: string;
11
+ }
12
+ export interface FusebaseAuthRegisterRequestContract {
13
+ /**
14
+ * User email. Forwarded to auth-form as `login`.
15
+ * @format email
16
+ */
17
+ email: string;
18
+ password: string;
19
+ firstName?: string;
20
+ lastName?: string;
21
+ fullName?: string;
22
+ subscribe?: boolean;
23
+ redirectPath?: string | null;
24
+ tags?: string[];
25
+ }
26
+ export interface FusebaseAuthRegisterResponseContract {
27
+ status: "authenticated" | "challenge_required";
28
+ session?: FusebaseAuthSessionContract;
29
+ challenge?: FusebaseAuthChallengeContract;
30
+ redirectPath: string;
31
+ }
32
+ export interface FusebaseAuthRegisterMemberRequestContract extends FusebaseAuthRegisterRequestContract {
33
+ /**
34
+ * Org role to grant after the Fusebase account is created.
35
+ * Defaults to `client`.
36
+ */
37
+ orgRole?: string;
38
+ memberTTL?: number | null;
39
+ defaultWorkspaceRole?: string;
40
+ }
41
+ export interface FusebaseAuthRegisterMemberResponseContract extends FusebaseAuthRegisterResponseContract {
42
+ membership?: {
43
+ orgId: string;
44
+ userId: number;
45
+ role: string;
46
+ memberTTL?: number | null;
47
+ };
48
+ }
49
+ export interface FusebaseAuthLoginRequestContract {
50
+ /**
51
+ * User email. Forwarded to auth-form as `login`.
52
+ * @format email
53
+ */
54
+ email: string;
55
+ password: string;
56
+ redirectPath?: string | null;
57
+ device?: Record<string, unknown>;
58
+ }
59
+ export interface FusebaseAuthLoginResponseContract {
60
+ status: "authenticated" | "challenge_required";
61
+ session?: FusebaseAuthSessionContract;
62
+ challenge?: FusebaseAuthChallengeContract;
63
+ redirectPath: string;
64
+ }
65
+ export interface FusebaseAuthChallengeRequestContract {
66
+ state: string;
67
+ answer: string;
68
+ redirectPath?: string | null;
69
+ }
70
+ export interface FusebaseAuthChallengeResponseContract {
71
+ status: "authenticated" | "challenge_required";
72
+ session?: FusebaseAuthSessionContract;
73
+ challenge?: FusebaseAuthChallengeContract;
74
+ redirectPath: string;
75
+ }
76
+ export interface FusebaseAuthPasswordRestoreRequestContract {
77
+ /**
78
+ * User email. The response is intentionally generic.
79
+ * @format email
80
+ */
81
+ email: string;
82
+ customAuthUrl?: string;
83
+ portalId?: string;
84
+ workspaceId?: string;
85
+ }
86
+ export interface FusebaseAuthPasswordRestoreResponseContract {
87
+ ok: true;
88
+ }
89
+ export interface FusebaseAuthPasswordRestoreKeyResponseContract {
90
+ valid: boolean;
91
+ }
92
+ export interface FusebaseAuthPasswordResetRequestContract {
93
+ password: string;
94
+ }
95
+ export interface FusebaseAuthPasswordResetResponseContract {
96
+ ok: true;
97
+ }
98
+ export interface FusebaseAuthLogoutResponseContract {
99
+ ok: true;
100
+ /**
101
+ * App/BFF should clear these cookies on its own domain.
102
+ */
103
+ cookiesToDelete: string[];
104
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,9 +6,11 @@
6
6
  */
7
7
  export type { AuthenticatedUserSummaryContract, MyOrgAccessResponseContract } from "./access/access";
8
8
  export type { AppApiOperationContract, AppApiOperationListResponseContract, CallAppApiRequestContract, CallAppApiResponseContract } from "./app-api/app-api";
9
+ export type { ActivateAppMagicLinkResponseContract, CreateAppMagicLinkRequestContract, CreateAppMagicLinkResponseContract, RequestAppMagicLinkRequestContract, RequestAppMagicLinkResponseContract } from "./app-magic-link/app-magic-link";
9
10
  export * from "./billing/billing";
10
11
  export type { OrgEmailSendRequestContract, OrgEmailSendResponseContract } from "./email/email";
11
12
  export * from "./file/file";
13
+ export type { FusebaseAuthChallengeContract, FusebaseAuthChallengeRequestContract, FusebaseAuthChallengeResponseContract, FusebaseAuthLoginRequestContract, FusebaseAuthLoginResponseContract, FusebaseAuthLogoutResponseContract, FusebaseAuthPasswordResetRequestContract, FusebaseAuthPasswordResetResponseContract, FusebaseAuthPasswordRestoreKeyResponseContract, FusebaseAuthPasswordRestoreRequestContract, FusebaseAuthPasswordRestoreResponseContract, FusebaseAuthRegisterMemberRequestContract, FusebaseAuthRegisterMemberResponseContract, FusebaseAuthRegisterRequestContract, FusebaseAuthRegisterResponseContract, FusebaseAuthSessionContract } from "./fusebase-auth/fusebase-auth";
12
14
  export * from "./isolated-store/isolated-store";
13
15
  export * from "./mcp-manager/mcp-manager";
14
16
  export type { MeAuthContract, MeOrgGroupContract, MeResponseContract, MeScopeContract, MeUserContract } from "./me/me";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusebase/fusebase-gate-sdk",
3
- "version": "2.2.15-sdk.5",
3
+ "version": "2.2.15-sdk.6",
4
4
  "description": "TypeScript SDK for Fusebase Gate APIs - Generated from contract introspection",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -0,0 +1,93 @@
1
+ # Release Notes 2.2.15-sdk.6
2
+
3
+ - Current ref: `HEAD`
4
+ - Previous tag: `v2.2.15-sdk.5`
5
+ - Generated at: 2026-05-21T09:33:50.726Z
6
+
7
+ ## Included Drafts
8
+
9
+ - `docs/release-notes/2026-05-06-app-magic-links.md` - 2026-05-06-app-magic-links
10
+ - `docs/release-notes/2026-05-20-app-magic-links-product-app-naming.md` - 2026-05-20-app-magic-links-product-app-naming
11
+ - `docs/release-notes/2026-05-21-fusebase-auth-app-flows.md` - 2026-05-21-fusebase-auth-app-flows
12
+
13
+ ## Summary
14
+
15
+ ### 2026-05-06-app-magic-links
16
+
17
+ Surface AI App **Magic Link** flows through Gate. Three new ops let app owners and runtime apps issue, request, and activate magic links against `nimbus-ai`'s storage layer. Ships with a new `appMagicLinks` MCP prompt group and the regenerated `app-magic-links.md` skill reference under `generated/claude_skills/fusebase-gate/references/`.
18
+
19
+ ### 2026-05-20-app-magic-links-product-app-naming
20
+
21
+ Update the `appMagicLinks` MCP prompt (and the regenerated `app-magic-links.md` skill reference) so it accounts for the `app → product` / `feature → app` rename. The magic-link **wire contract still uses the pre-rename field names** (`appId`, `appFeatureId`, `featureToken`), which no longer match the CLI (`fusebase.json`, `fusebase app list`). The stale skill caused agents to pass an App id where Gate expects a Product id, failing with `App not found`. No API, SDK, or permission changes — skill/prompt content only.
22
+
23
+
24
+ ## API / SDK Changes
25
+
26
+ ### 2026-05-06-app-magic-links
27
+
28
+ - New ops in `src/api/contracts/ops/app-magic-links/app-magic-links.ts`:
29
+ - `createAppMagicLink` — `POST /:orgId/apps/:appId/magic-links`. Owner/admin invite flow. Requires the new permission `app_magic_link.write` and org access.
30
+ - `requestAppMagicLink` — `POST /apps/by-host/:host/magic-links/request`. Visitor self-service flow (no auth). Always returns `{ ok: true }` so it cannot be used to enumerate emails or access state. Apply per-IP rate limiting upstream.
31
+ - `activateAppMagicLink` — `POST /apps/magic-links/:globalId/activate`. Visitor activation (no auth). Returns `{ id, sessionToken, featureToken, dashboardToken, redirectPath, expiresAt, appFeatureId }`. Surfaces `403` with `reason=expired|revoked` and `404` for unknown/deleted links.
32
+ - New permission `app_magic_link.write` registered in `GatePermission` and granted to owner/manager/member/guest roles via the existing `GATE_ALL_PERMISSIONS` set.
33
+ - New controller `AppMagicLinksController` (`src/controllers/app-magic-links/app-magic-links.ts`) and nimbus-ai client wrapper `src/clients/app-magic-link-client.ts`. The wrapper forwards the caller's userId via the standard `Authorization: Internal <userId>:gate` + `X-Secret` header pair on the create endpoint, and only `X-Secret` on the visitor endpoints.
34
+ - Bumped `@internal/nimbus-ai` peer to `^1.58.0` to pick up the new `apiCreateAppMagicLink`, `apiRequestAppMagicLink`, and `apiActivateAppMagicLink` methods. The 1.58.0 client is published by the nimbus-ai NIM-40935 MR (`internal/nimbus-ai!65`); CI on this MR will be red until that MR lands and the registry has 1.58.0.
35
+
36
+ ### 2026-05-20-app-magic-links-product-app-naming
37
+
38
+ - None. The HTTP contracts, SDK, OpenAPI spec, and permissions are unchanged.
39
+
40
+
41
+ ## Consumer Impact
42
+
43
+ ### 2026-05-06-app-magic-links
44
+
45
+ - New SDK domain `AppMagicLinksApi` with three methods (`createAppMagicLink`, `requestAppMagicLink`, `activateAppMagicLink`) materialized in `generated/sdk-client/src/apis/AppMagicLinksApi.ts`.
46
+ - New SDK type module `generated/sdk-client/src/types/app-magic-link/`.
47
+ - Apps that want to ship a one-click client onboarding flow can now invite-by-email (with optional `addToAccessPrincipals=true` to provision a brand-new user) and surface a `/link?id=…&redirect=…` route in their SPA scaffold (see follow-up subtask NIM-41013 for the apps-cli template).
48
+ - The `request` endpoint never mutates `accessPrincipals` and never provisions users, by design — visitors can self-service only when they already have access.
49
+ - New MCP prompt group `appMagicLinks` (registered in `src/mcp/prompts/index.ts`) covers when to use each flow, deep-link `redirectPath` rules, and expired/revoked link handling. The op contracts declare `promptGroups: ["authz", "sdk", "appMagicLinks"]` (authed) and `["sdk", "appMagicLinks"]` (visitor), so prompt-aware MCP clients receive the guidance automatically.
50
+ - New skill reference file `generated/claude_skills/fusebase-gate/references/app-magic-links.md` (marker `mcp-app-magic-links-loaded`). `npm run mcp:skills:copy-to-apps-cli:local` propagates it into `apps-cli/project-template/.claude/skills/fusebase-gate/references/` for fresh `fusebase init` output.
51
+
52
+ ### 2026-05-20-app-magic-links-product-app-naming
53
+
54
+ - `src/mcp/prompts/app-magic-links.ts` — bumped `version` `1.0.0` → `1.1.0`. New "Terminology: `product` / `app` vs the Gate wire contract" section maps the renamed concepts onto the unchanged wire fields:
55
+ - `createAppMagicLink`'s `appId` **path segment** is the **Product id** (`productId` in `fusebase.json`), not an App id.
56
+ - `appFeatureId` in the activation response and the scope of `featureToken` is an **App** id (`apps[].id` / `fusebase app list`).
57
+ - The wire field names stay at their pre-rename spelling for backward compatibility; only the human-facing concepts were renamed.
58
+ - The Invite-flow, Identity/Scoping, Activation, and Working-Rules sections now use `Product` / `App` consistently ("every App of the Product", "App-scoped by host", etc.) and call out the `App not found` failure mode explicitly.
59
+ - The Activation section now folds in the SPA `fetch`-vs-SDK note and the `fbsdashboardtoken` cookie detail, so the next `mcp:skills:copy-to-apps-cli` no longer reverts the apps-cli-side hand edits — the generated skill is the single source of truth again.
60
+ - Regenerated `generated/claude_skills/fusebase-gate/references/app-magic-links.md` (frontmatter `version: 1.1.0`). `apps-cli` receives the same file under `project-template/.claude/skills/fusebase-gate/references/`.
61
+
62
+
63
+ ## Verification
64
+
65
+ ### 2026-05-06-app-magic-links
66
+
67
+ - `npm run lint`
68
+ - `npm test` (190 tests pass; new tests in `tests/unit/app-magic-links-contracts.test.ts` and `tests/unit/app-magic-links-controller.test.ts`)
69
+ - `npm run build`
70
+ - `FEATURE_FLAGS=isolated_sql_stores,isolated_nosql_stores npm run build:sdk` — SDK regenerated, `dist/apis/AppMagicLinksApi.{js,d.ts}` and `dist/types/app-magic-link/` produced; OpenAPI spec updated.
71
+ - `npm run mcp:skills:generate` — `app-magic-links.md` written under `generated/claude_skills/fusebase-gate/references/`; `SKILL.md` TOC updated.
72
+ - `npm run mcp:skills:validate` — passes (1 skill).
73
+ - `npm run mcp:skills:copy-to-apps-cli:local` — generated skill copied into the local apps-cli checkout (commit owned by NIM-41013).
74
+
75
+ ### 2026-05-20-app-magic-links-product-app-naming
76
+
77
+ - `npm run build` — clean.
78
+ - `npm run lint` — 0 errors (5 pre-existing `dist/` warnings).
79
+ - `npm test` — 216 pass / 1 skipped, including the new `mcp-prompts.test.ts` case `maps the product/app rename onto the magic-link wire contract`.
80
+ - `npm run mcp:skills:generate` — only `app-magic-links.md` rewritten.
81
+ - `npm run mcp:skills:validate` — passes (1 skill).
82
+
83
+
84
+ ## Follow-ups
85
+
86
+ ### 2026-05-06-app-magic-links
87
+
88
+ - **CI dependency:** the dependency bump to `@internal/nimbus-ai@^1.58.0` requires `internal/nimbus-ai!65` (NIM-40935) to merge and publish 1.58.0 to the GitLab npm registry. After it merges, this branch should be rebased and `npm install` re-run to refresh the lock file with the upstream-published integrity hash.
89
+ - **NIM-41013:** receive the generated skill in `apps-cli` and ship the `/link` route example in `feature-templates/spa/`. The skill file is already in the local apps-cli working tree from `mcp:skills:copy-to-apps-cli:local`; NIM-41013 owns the apps-cli commit.
90
+
91
+ ### 2026-05-20-app-magic-links-product-app-naming
92
+
93
+ - Optional: align the magic-link wire field names (`appId` → `productId`, `appFeatureId` → `appId`) and the `nimbus-ai` `app_magic_links` columns with the new terminology. That is a contract/SDK change deferred as a separate product decision (see story-spec `NIM-40935/README.md` Open Questions); this change only makes the skill describe the current contract correctly.
@@ -1,9 +1,93 @@
1
- # Release Notes 2.2.15-sdk.5
1
+ # Release Notes 2.2.15-sdk.6
2
2
 
3
3
  - Current ref: `HEAD`
4
4
  - Previous tag: `v2.2.15-sdk.5`
5
- - Generated at: 2026-05-18T10:10:39.543Z
5
+ - Generated at: 2026-05-21T09:33:50.726Z
6
6
 
7
7
  ## Included Drafts
8
8
 
9
- - None
9
+ - `docs/release-notes/2026-05-06-app-magic-links.md` - 2026-05-06-app-magic-links
10
+ - `docs/release-notes/2026-05-20-app-magic-links-product-app-naming.md` - 2026-05-20-app-magic-links-product-app-naming
11
+ - `docs/release-notes/2026-05-21-fusebase-auth-app-flows.md` - 2026-05-21-fusebase-auth-app-flows
12
+
13
+ ## Summary
14
+
15
+ ### 2026-05-06-app-magic-links
16
+
17
+ Surface AI App **Magic Link** flows through Gate. Three new ops let app owners and runtime apps issue, request, and activate magic links against `nimbus-ai`'s storage layer. Ships with a new `appMagicLinks` MCP prompt group and the regenerated `app-magic-links.md` skill reference under `generated/claude_skills/fusebase-gate/references/`.
18
+
19
+ ### 2026-05-20-app-magic-links-product-app-naming
20
+
21
+ Update the `appMagicLinks` MCP prompt (and the regenerated `app-magic-links.md` skill reference) so it accounts for the `app → product` / `feature → app` rename. The magic-link **wire contract still uses the pre-rename field names** (`appId`, `appFeatureId`, `featureToken`), which no longer match the CLI (`fusebase.json`, `fusebase app list`). The stale skill caused agents to pass an App id where Gate expects a Product id, failing with `App not found`. No API, SDK, or permission changes — skill/prompt content only.
22
+
23
+
24
+ ## API / SDK Changes
25
+
26
+ ### 2026-05-06-app-magic-links
27
+
28
+ - New ops in `src/api/contracts/ops/app-magic-links/app-magic-links.ts`:
29
+ - `createAppMagicLink` — `POST /:orgId/apps/:appId/magic-links`. Owner/admin invite flow. Requires the new permission `app_magic_link.write` and org access.
30
+ - `requestAppMagicLink` — `POST /apps/by-host/:host/magic-links/request`. Visitor self-service flow (no auth). Always returns `{ ok: true }` so it cannot be used to enumerate emails or access state. Apply per-IP rate limiting upstream.
31
+ - `activateAppMagicLink` — `POST /apps/magic-links/:globalId/activate`. Visitor activation (no auth). Returns `{ id, sessionToken, featureToken, dashboardToken, redirectPath, expiresAt, appFeatureId }`. Surfaces `403` with `reason=expired|revoked` and `404` for unknown/deleted links.
32
+ - New permission `app_magic_link.write` registered in `GatePermission` and granted to owner/manager/member/guest roles via the existing `GATE_ALL_PERMISSIONS` set.
33
+ - New controller `AppMagicLinksController` (`src/controllers/app-magic-links/app-magic-links.ts`) and nimbus-ai client wrapper `src/clients/app-magic-link-client.ts`. The wrapper forwards the caller's userId via the standard `Authorization: Internal <userId>:gate` + `X-Secret` header pair on the create endpoint, and only `X-Secret` on the visitor endpoints.
34
+ - Bumped `@internal/nimbus-ai` peer to `^1.58.0` to pick up the new `apiCreateAppMagicLink`, `apiRequestAppMagicLink`, and `apiActivateAppMagicLink` methods. The 1.58.0 client is published by the nimbus-ai NIM-40935 MR (`internal/nimbus-ai!65`); CI on this MR will be red until that MR lands and the registry has 1.58.0.
35
+
36
+ ### 2026-05-20-app-magic-links-product-app-naming
37
+
38
+ - None. The HTTP contracts, SDK, OpenAPI spec, and permissions are unchanged.
39
+
40
+
41
+ ## Consumer Impact
42
+
43
+ ### 2026-05-06-app-magic-links
44
+
45
+ - New SDK domain `AppMagicLinksApi` with three methods (`createAppMagicLink`, `requestAppMagicLink`, `activateAppMagicLink`) materialized in `generated/sdk-client/src/apis/AppMagicLinksApi.ts`.
46
+ - New SDK type module `generated/sdk-client/src/types/app-magic-link/`.
47
+ - Apps that want to ship a one-click client onboarding flow can now invite-by-email (with optional `addToAccessPrincipals=true` to provision a brand-new user) and surface a `/link?id=…&redirect=…` route in their SPA scaffold (see follow-up subtask NIM-41013 for the apps-cli template).
48
+ - The `request` endpoint never mutates `accessPrincipals` and never provisions users, by design — visitors can self-service only when they already have access.
49
+ - New MCP prompt group `appMagicLinks` (registered in `src/mcp/prompts/index.ts`) covers when to use each flow, deep-link `redirectPath` rules, and expired/revoked link handling. The op contracts declare `promptGroups: ["authz", "sdk", "appMagicLinks"]` (authed) and `["sdk", "appMagicLinks"]` (visitor), so prompt-aware MCP clients receive the guidance automatically.
50
+ - New skill reference file `generated/claude_skills/fusebase-gate/references/app-magic-links.md` (marker `mcp-app-magic-links-loaded`). `npm run mcp:skills:copy-to-apps-cli:local` propagates it into `apps-cli/project-template/.claude/skills/fusebase-gate/references/` for fresh `fusebase init` output.
51
+
52
+ ### 2026-05-20-app-magic-links-product-app-naming
53
+
54
+ - `src/mcp/prompts/app-magic-links.ts` — bumped `version` `1.0.0` → `1.1.0`. New "Terminology: `product` / `app` vs the Gate wire contract" section maps the renamed concepts onto the unchanged wire fields:
55
+ - `createAppMagicLink`'s `appId` **path segment** is the **Product id** (`productId` in `fusebase.json`), not an App id.
56
+ - `appFeatureId` in the activation response and the scope of `featureToken` is an **App** id (`apps[].id` / `fusebase app list`).
57
+ - The wire field names stay at their pre-rename spelling for backward compatibility; only the human-facing concepts were renamed.
58
+ - The Invite-flow, Identity/Scoping, Activation, and Working-Rules sections now use `Product` / `App` consistently ("every App of the Product", "App-scoped by host", etc.) and call out the `App not found` failure mode explicitly.
59
+ - The Activation section now folds in the SPA `fetch`-vs-SDK note and the `fbsdashboardtoken` cookie detail, so the next `mcp:skills:copy-to-apps-cli` no longer reverts the apps-cli-side hand edits — the generated skill is the single source of truth again.
60
+ - Regenerated `generated/claude_skills/fusebase-gate/references/app-magic-links.md` (frontmatter `version: 1.1.0`). `apps-cli` receives the same file under `project-template/.claude/skills/fusebase-gate/references/`.
61
+
62
+
63
+ ## Verification
64
+
65
+ ### 2026-05-06-app-magic-links
66
+
67
+ - `npm run lint`
68
+ - `npm test` (190 tests pass; new tests in `tests/unit/app-magic-links-contracts.test.ts` and `tests/unit/app-magic-links-controller.test.ts`)
69
+ - `npm run build`
70
+ - `FEATURE_FLAGS=isolated_sql_stores,isolated_nosql_stores npm run build:sdk` — SDK regenerated, `dist/apis/AppMagicLinksApi.{js,d.ts}` and `dist/types/app-magic-link/` produced; OpenAPI spec updated.
71
+ - `npm run mcp:skills:generate` — `app-magic-links.md` written under `generated/claude_skills/fusebase-gate/references/`; `SKILL.md` TOC updated.
72
+ - `npm run mcp:skills:validate` — passes (1 skill).
73
+ - `npm run mcp:skills:copy-to-apps-cli:local` — generated skill copied into the local apps-cli checkout (commit owned by NIM-41013).
74
+
75
+ ### 2026-05-20-app-magic-links-product-app-naming
76
+
77
+ - `npm run build` — clean.
78
+ - `npm run lint` — 0 errors (5 pre-existing `dist/` warnings).
79
+ - `npm test` — 216 pass / 1 skipped, including the new `mcp-prompts.test.ts` case `maps the product/app rename onto the magic-link wire contract`.
80
+ - `npm run mcp:skills:generate` — only `app-magic-links.md` rewritten.
81
+ - `npm run mcp:skills:validate` — passes (1 skill).
82
+
83
+
84
+ ## Follow-ups
85
+
86
+ ### 2026-05-06-app-magic-links
87
+
88
+ - **CI dependency:** the dependency bump to `@internal/nimbus-ai@^1.58.0` requires `internal/nimbus-ai!65` (NIM-40935) to merge and publish 1.58.0 to the GitLab npm registry. After it merges, this branch should be rebased and `npm install` re-run to refresh the lock file with the upstream-published integrity hash.
89
+ - **NIM-41013:** receive the generated skill in `apps-cli` and ship the `/link` route example in `feature-templates/spa/`. The skill file is already in the local apps-cli working tree from `mcp:skills:copy-to-apps-cli:local`; NIM-41013 owns the apps-cli commit.
90
+
91
+ ### 2026-05-20-app-magic-links-product-app-naming
92
+
93
+ - Optional: align the magic-link wire field names (`appId` → `productId`, `appFeatureId` → `appId`) and the `nimbus-ai` `app_magic_links` columns with the new terminology. That is a contract/SDK change deferred as a separate product decision (see story-spec `NIM-40935/README.md` Open Questions); this change only makes the skill describe the current contract correctly.
@@ -1,9 +0,0 @@
1
- # Release Notes 2.2.15-sdk.5
2
-
3
- - Current ref: `HEAD`
4
- - Previous tag: `v2.2.15-sdk.5`
5
- - Generated at: 2026-05-18T10:10:39.543Z
6
-
7
- ## Included Drafts
8
-
9
- - None