@atlasauth/msw 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -0
- package/dist/handlers.d.ts +29 -0
- package/dist/handlers.js +600 -0
- package/dist/handlers.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/serializers.d.ts +156 -0
- package/dist/serializers.js +162 -0
- package/dist/serializers.js.map +1 -0
- package/dist/state.d.ts +242 -0
- package/dist/state.js +266 -0
- package/dist/state.js.map +1 -0
- package/package.json +33 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@atlasauth/msw` — Mock Service Worker (v2) request handlers that mock Atlas's
|
|
3
|
+
* Frontend API (FAPI) and Backend API (BAPI), so an integrator can test their
|
|
4
|
+
* Atlas integration against realistic, shape-correct responses without a live
|
|
5
|
+
* server. The MSW peer of `@atlasauth/testing`.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { setupServer } from 'msw/node';
|
|
9
|
+
* import { atlasHandlers, createAtlasMock } from '@atlasauth/msw';
|
|
10
|
+
*
|
|
11
|
+
* const mock = createAtlasMock({ users: [{ email: 'ada@example.com', password: 'pw' }] });
|
|
12
|
+
* const server = setupServer(...atlasHandlers(mock));
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export { atlasHandlers, type AtlasHandlersOptions } from './handlers';
|
|
16
|
+
export { createAtlasMock, AtlasMock, IdFactory, ID_PREFIXES, type AtlasMockSeed, type SeedUser, type SeedOrganization, type EntityKind, type MockInstance, type MockUser, type MockEmail, type MockOrganization, type MockMembership, type MockSession, type MockAttempt, type MockSocialProvider, } from './state';
|
|
17
|
+
export { errorBody, listEnvelope, presentUser, presentMeUser, presentMembership, presentOrganization, presentSession, presentSignInAttempt, presentSignUpAttempt, } from './serializers';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.presentSignUpAttempt = exports.presentSignInAttempt = exports.presentSession = exports.presentOrganization = exports.presentMembership = exports.presentMeUser = exports.presentUser = exports.listEnvelope = exports.errorBody = exports.ID_PREFIXES = exports.IdFactory = exports.AtlasMock = exports.createAtlasMock = exports.atlasHandlers = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* `@atlasauth/msw` — Mock Service Worker (v2) request handlers that mock Atlas's
|
|
6
|
+
* Frontend API (FAPI) and Backend API (BAPI), so an integrator can test their
|
|
7
|
+
* Atlas integration against realistic, shape-correct responses without a live
|
|
8
|
+
* server. The MSW peer of `@atlasauth/testing`.
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { setupServer } from 'msw/node';
|
|
12
|
+
* import { atlasHandlers, createAtlasMock } from '@atlasauth/msw';
|
|
13
|
+
*
|
|
14
|
+
* const mock = createAtlasMock({ users: [{ email: 'ada@example.com', password: 'pw' }] });
|
|
15
|
+
* const server = setupServer(...atlasHandlers(mock));
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
var handlers_1 = require("./handlers");
|
|
19
|
+
Object.defineProperty(exports, "atlasHandlers", { enumerable: true, get: function () { return handlers_1.atlasHandlers; } });
|
|
20
|
+
var state_1 = require("./state");
|
|
21
|
+
Object.defineProperty(exports, "createAtlasMock", { enumerable: true, get: function () { return state_1.createAtlasMock; } });
|
|
22
|
+
Object.defineProperty(exports, "AtlasMock", { enumerable: true, get: function () { return state_1.AtlasMock; } });
|
|
23
|
+
Object.defineProperty(exports, "IdFactory", { enumerable: true, get: function () { return state_1.IdFactory; } });
|
|
24
|
+
Object.defineProperty(exports, "ID_PREFIXES", { enumerable: true, get: function () { return state_1.ID_PREFIXES; } });
|
|
25
|
+
var serializers_1 = require("./serializers");
|
|
26
|
+
Object.defineProperty(exports, "errorBody", { enumerable: true, get: function () { return serializers_1.errorBody; } });
|
|
27
|
+
Object.defineProperty(exports, "listEnvelope", { enumerable: true, get: function () { return serializers_1.listEnvelope; } });
|
|
28
|
+
Object.defineProperty(exports, "presentUser", { enumerable: true, get: function () { return serializers_1.presentUser; } });
|
|
29
|
+
Object.defineProperty(exports, "presentMeUser", { enumerable: true, get: function () { return serializers_1.presentMeUser; } });
|
|
30
|
+
Object.defineProperty(exports, "presentMembership", { enumerable: true, get: function () { return serializers_1.presentMembership; } });
|
|
31
|
+
Object.defineProperty(exports, "presentOrganization", { enumerable: true, get: function () { return serializers_1.presentOrganization; } });
|
|
32
|
+
Object.defineProperty(exports, "presentSession", { enumerable: true, get: function () { return serializers_1.presentSession; } });
|
|
33
|
+
Object.defineProperty(exports, "presentSignInAttempt", { enumerable: true, get: function () { return serializers_1.presentSignInAttempt; } });
|
|
34
|
+
Object.defineProperty(exports, "presentSignUpAttempt", { enumerable: true, get: function () { return serializers_1.presentSignUpAttempt; } });
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,uCAAsE;AAA7D,yGAAA,aAAa,OAAA;AACtB,iCAiBiB;AAhBf,wGAAA,eAAe,OAAA;AACf,kGAAA,SAAS,OAAA;AACT,kGAAA,SAAS,OAAA;AACT,oGAAA,WAAW,OAAA;AAcb,6CAUuB;AATrB,wGAAA,SAAS,OAAA;AACT,2GAAA,YAAY,OAAA;AACZ,0GAAA,WAAW,OAAA;AACX,4GAAA,aAAa,OAAA;AACb,gHAAA,iBAAiB,OAAA;AACjB,kHAAA,mBAAmB,OAAA;AACnB,6GAAA,cAAc,OAAA;AACd,mHAAA,oBAAoB,OAAA;AACpB,mHAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialisers that turn the mock store's internal objects into the exact wire
|
|
3
|
+
* shapes Atlas's FAPI and BAPI return. Kept in one place, mirroring the API's
|
|
4
|
+
* own per-resource `present()` closures, so a shape change is a one-line edit.
|
|
5
|
+
*
|
|
6
|
+
* Verbatim references (so the shapes do not drift from the server):
|
|
7
|
+
* - BAPI user → apps/api/src/routes/users/context.ts `present`
|
|
8
|
+
* - FAPI `me` user → apps/api/src/routes/me/profile.ts `present` (+ extras)
|
|
9
|
+
* - BAPI organization → apps/api/src/routes/organizations/context.ts `present`
|
|
10
|
+
* - BAPI session → apps/api/src/routes/bapi-sessions.ts `present`
|
|
11
|
+
* - sign_in_attempt → apps/api/src/modules/signin/signin.service.ts `view`
|
|
12
|
+
* - sign_up_attempt → apps/api/src/modules/signup/signup.types.ts `toAttemptView`
|
|
13
|
+
* - environment → apps/api/src/routes/fapi-oauth/environment.ts
|
|
14
|
+
*/
|
|
15
|
+
import type { AtlasMock, MockAttempt, MockOrganization, MockSession, MockUser } from './state';
|
|
16
|
+
/** The §9.1 error envelope: `{ errors: [{ code, message, param?, meta?, docs_url }] }`. */
|
|
17
|
+
export declare function errorBody(code: string, message: string, param?: string, meta?: Record<string, unknown>): {
|
|
18
|
+
errors: Array<Record<string, unknown>>;
|
|
19
|
+
};
|
|
20
|
+
/** BAPI user — `private_metadata` is never serialised (§4.2). */
|
|
21
|
+
export declare function presentUser(user: MockUser): {
|
|
22
|
+
object: "user";
|
|
23
|
+
id: string;
|
|
24
|
+
username: string | null;
|
|
25
|
+
first_name: string | null;
|
|
26
|
+
last_name: string | null;
|
|
27
|
+
image_url: string | null;
|
|
28
|
+
email_addresses: {
|
|
29
|
+
id: string;
|
|
30
|
+
object: "email_address";
|
|
31
|
+
email_address: string;
|
|
32
|
+
verification: {
|
|
33
|
+
status: string;
|
|
34
|
+
};
|
|
35
|
+
verified: boolean;
|
|
36
|
+
primary: boolean;
|
|
37
|
+
}[];
|
|
38
|
+
primary_email_address_id: string | null;
|
|
39
|
+
primary_email: string | null;
|
|
40
|
+
external_id: string | null;
|
|
41
|
+
password_enabled: boolean;
|
|
42
|
+
public_metadata: Record<string, unknown>;
|
|
43
|
+
mfa_enabled: boolean;
|
|
44
|
+
is_anonymous: boolean;
|
|
45
|
+
banned: boolean;
|
|
46
|
+
ban_reason: null;
|
|
47
|
+
ban_note: null;
|
|
48
|
+
locked: boolean;
|
|
49
|
+
deleted_at: number | null;
|
|
50
|
+
last_sign_in_at: number | null;
|
|
51
|
+
created_at: number;
|
|
52
|
+
updated_at: number;
|
|
53
|
+
};
|
|
54
|
+
/** FAPI `/v1/client/me` user — carries `unsafe_metadata` + connections, never `private_metadata`. */
|
|
55
|
+
export declare function presentMeUser(mock: AtlasMock, user: MockUser): {
|
|
56
|
+
object: "user";
|
|
57
|
+
id: string;
|
|
58
|
+
first_name: string | null;
|
|
59
|
+
last_name: string | null;
|
|
60
|
+
username: string | null;
|
|
61
|
+
image_url: string | null;
|
|
62
|
+
locale: string | null;
|
|
63
|
+
public_metadata: Record<string, unknown>;
|
|
64
|
+
unsafe_metadata: Record<string, unknown>;
|
|
65
|
+
mfa_enabled: boolean;
|
|
66
|
+
has_password: boolean;
|
|
67
|
+
is_anonymous: boolean;
|
|
68
|
+
created_at: number;
|
|
69
|
+
primary_email_id: string | null;
|
|
70
|
+
email_addresses: {
|
|
71
|
+
object: "email_address";
|
|
72
|
+
id: string;
|
|
73
|
+
email_address: string;
|
|
74
|
+
verified: boolean;
|
|
75
|
+
primary: boolean;
|
|
76
|
+
}[];
|
|
77
|
+
external_accounts: unknown[];
|
|
78
|
+
passkeys: unknown[];
|
|
79
|
+
organization_memberships: {
|
|
80
|
+
object: "organization_membership";
|
|
81
|
+
role: string;
|
|
82
|
+
organization: {
|
|
83
|
+
object: "organization";
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
slug: string | null;
|
|
87
|
+
image_url: string | null;
|
|
88
|
+
public_metadata: Record<string, unknown>;
|
|
89
|
+
} | null;
|
|
90
|
+
}[];
|
|
91
|
+
};
|
|
92
|
+
/** The `organization_membership` shape used in the client boot + me. */
|
|
93
|
+
export declare function presentMembership(mock: AtlasMock, organizationId: string, role: string): {
|
|
94
|
+
object: "organization_membership";
|
|
95
|
+
role: string;
|
|
96
|
+
organization: {
|
|
97
|
+
object: "organization";
|
|
98
|
+
id: string;
|
|
99
|
+
name: string;
|
|
100
|
+
slug: string | null;
|
|
101
|
+
image_url: string | null;
|
|
102
|
+
public_metadata: Record<string, unknown>;
|
|
103
|
+
} | null;
|
|
104
|
+
};
|
|
105
|
+
/** BAPI organization — `private_metadata` is never serialised (§4.4). */
|
|
106
|
+
export declare function presentOrganization(org: MockOrganization): {
|
|
107
|
+
object: "organization";
|
|
108
|
+
id: string;
|
|
109
|
+
name: string;
|
|
110
|
+
slug: string | null;
|
|
111
|
+
image_url: string | null;
|
|
112
|
+
parent_organization_id: string | null;
|
|
113
|
+
public_metadata: Record<string, unknown>;
|
|
114
|
+
max_allowed_memberships: number | null;
|
|
115
|
+
created_by: string | null;
|
|
116
|
+
created_at: number;
|
|
117
|
+
updated_at: number;
|
|
118
|
+
};
|
|
119
|
+
/** BAPI session (operator view). */
|
|
120
|
+
export declare function presentSession(session: MockSession): {
|
|
121
|
+
object: "session";
|
|
122
|
+
id: string;
|
|
123
|
+
user_id: string;
|
|
124
|
+
status: "active" | "revoked" | "ended";
|
|
125
|
+
last_active_organization_id: string | null;
|
|
126
|
+
impersonated_by: string | null;
|
|
127
|
+
last_active_at: number;
|
|
128
|
+
expire_at: number;
|
|
129
|
+
abandon_at: number;
|
|
130
|
+
created_at: number;
|
|
131
|
+
};
|
|
132
|
+
/** A sign_in_attempt view. `supported_first_factors` is always the instance's list. */
|
|
133
|
+
export declare function presentSignInAttempt(mock: AtlasMock, attempt: MockAttempt): {
|
|
134
|
+
id: string;
|
|
135
|
+
object: "sign_in_attempt";
|
|
136
|
+
status: "needs_identifier" | "needs_first_factor" | "needs_second_factor" | "needs_email_verification" | "complete" | "abandoned";
|
|
137
|
+
identifier: string | null;
|
|
138
|
+
supported_first_factors: string[];
|
|
139
|
+
created_session_id: string | null;
|
|
140
|
+
expires_at: number;
|
|
141
|
+
};
|
|
142
|
+
/** A sign_up_attempt view. */
|
|
143
|
+
export declare function presentSignUpAttempt(attempt: MockAttempt): {
|
|
144
|
+
id: string;
|
|
145
|
+
object: "sign_up_attempt";
|
|
146
|
+
status: "needs_identifier" | "needs_first_factor" | "needs_second_factor" | "needs_email_verification" | "complete" | "abandoned";
|
|
147
|
+
identifier: string | null;
|
|
148
|
+
created_session_id: string | null;
|
|
149
|
+
expires_at: number;
|
|
150
|
+
};
|
|
151
|
+
/** The cursor-paginated list envelope (§9.1): `{ data, has_more, next_cursor }`. */
|
|
152
|
+
export declare function listEnvelope<T>(data: T[], hasMore: boolean, nextCursor: string | null): {
|
|
153
|
+
data: T[];
|
|
154
|
+
has_more: boolean;
|
|
155
|
+
next_cursor: string | null;
|
|
156
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.errorBody = errorBody;
|
|
4
|
+
exports.presentUser = presentUser;
|
|
5
|
+
exports.presentMeUser = presentMeUser;
|
|
6
|
+
exports.presentMembership = presentMembership;
|
|
7
|
+
exports.presentOrganization = presentOrganization;
|
|
8
|
+
exports.presentSession = presentSession;
|
|
9
|
+
exports.presentSignInAttempt = presentSignInAttempt;
|
|
10
|
+
exports.presentSignUpAttempt = presentSignUpAttempt;
|
|
11
|
+
exports.listEnvelope = listEnvelope;
|
|
12
|
+
/** The §9.1 error envelope: `{ errors: [{ code, message, param?, meta?, docs_url }] }`. */
|
|
13
|
+
function errorBody(code, message, param, meta) {
|
|
14
|
+
const item = { code, message };
|
|
15
|
+
if (param !== undefined)
|
|
16
|
+
item.param = param;
|
|
17
|
+
if (meta !== undefined)
|
|
18
|
+
item.meta = meta;
|
|
19
|
+
item.docs_url = `https://atlasauth.net/docs/errors/${code.toLowerCase()}`;
|
|
20
|
+
return { errors: [item] };
|
|
21
|
+
}
|
|
22
|
+
/** BAPI user — `private_metadata` is never serialised (§4.2). */
|
|
23
|
+
function presentUser(user) {
|
|
24
|
+
return {
|
|
25
|
+
object: 'user',
|
|
26
|
+
id: user.id,
|
|
27
|
+
username: user.username,
|
|
28
|
+
first_name: user.firstName,
|
|
29
|
+
last_name: user.lastName,
|
|
30
|
+
image_url: user.imageUrl,
|
|
31
|
+
email_addresses: user.emails.map((e) => ({
|
|
32
|
+
id: e.id,
|
|
33
|
+
object: 'email_address',
|
|
34
|
+
email_address: e.email,
|
|
35
|
+
verification: { status: e.verified ? 'verified' : 'unverified' },
|
|
36
|
+
verified: e.verified,
|
|
37
|
+
primary: e.id === user.primaryEmailId,
|
|
38
|
+
})),
|
|
39
|
+
primary_email_address_id: user.primaryEmailId,
|
|
40
|
+
primary_email: user.emails.find((e) => e.id === user.primaryEmailId)?.email ?? null,
|
|
41
|
+
external_id: user.externalId,
|
|
42
|
+
password_enabled: user.password != null,
|
|
43
|
+
public_metadata: user.publicMetadata,
|
|
44
|
+
mfa_enabled: user.mfaEnabled,
|
|
45
|
+
is_anonymous: user.isAnonymous,
|
|
46
|
+
banned: user.banned,
|
|
47
|
+
ban_reason: null,
|
|
48
|
+
ban_note: null,
|
|
49
|
+
locked: false,
|
|
50
|
+
deleted_at: user.deletedAt,
|
|
51
|
+
last_sign_in_at: user.lastSignInAt,
|
|
52
|
+
created_at: user.createdAt,
|
|
53
|
+
updated_at: user.updatedAt,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** FAPI `/v1/client/me` user — carries `unsafe_metadata` + connections, never `private_metadata`. */
|
|
57
|
+
function presentMeUser(mock, user) {
|
|
58
|
+
const memberships = mock.memberships.filter((m) => m.userId === user.id);
|
|
59
|
+
return {
|
|
60
|
+
object: 'user',
|
|
61
|
+
id: user.id,
|
|
62
|
+
first_name: user.firstName,
|
|
63
|
+
last_name: user.lastName,
|
|
64
|
+
username: user.username,
|
|
65
|
+
image_url: user.imageUrl,
|
|
66
|
+
locale: user.locale,
|
|
67
|
+
public_metadata: user.publicMetadata,
|
|
68
|
+
unsafe_metadata: user.unsafeMetadata,
|
|
69
|
+
mfa_enabled: user.mfaEnabled,
|
|
70
|
+
has_password: user.password !== null,
|
|
71
|
+
is_anonymous: user.isAnonymous,
|
|
72
|
+
created_at: user.createdAt,
|
|
73
|
+
primary_email_id: user.primaryEmailId,
|
|
74
|
+
email_addresses: user.emails.map((e) => ({
|
|
75
|
+
object: 'email_address',
|
|
76
|
+
id: e.id,
|
|
77
|
+
email_address: e.email,
|
|
78
|
+
verified: e.verified,
|
|
79
|
+
primary: e.id === user.primaryEmailId,
|
|
80
|
+
})),
|
|
81
|
+
external_accounts: [],
|
|
82
|
+
passkeys: [],
|
|
83
|
+
organization_memberships: memberships.map((m) => presentMembership(mock, m.organizationId, m.role)),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** The `organization_membership` shape used in the client boot + me. */
|
|
87
|
+
function presentMembership(mock, organizationId, role) {
|
|
88
|
+
const org = mock.findOrganization(organizationId);
|
|
89
|
+
return {
|
|
90
|
+
object: 'organization_membership',
|
|
91
|
+
role,
|
|
92
|
+
organization: org
|
|
93
|
+
? {
|
|
94
|
+
object: 'organization',
|
|
95
|
+
id: org.id,
|
|
96
|
+
name: org.name,
|
|
97
|
+
slug: org.slug,
|
|
98
|
+
image_url: org.imageUrl,
|
|
99
|
+
public_metadata: org.publicMetadata,
|
|
100
|
+
}
|
|
101
|
+
: null,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** BAPI organization — `private_metadata` is never serialised (§4.4). */
|
|
105
|
+
function presentOrganization(org) {
|
|
106
|
+
return {
|
|
107
|
+
object: 'organization',
|
|
108
|
+
id: org.id,
|
|
109
|
+
name: org.name,
|
|
110
|
+
slug: org.slug,
|
|
111
|
+
image_url: org.imageUrl,
|
|
112
|
+
parent_organization_id: org.parentOrganizationId,
|
|
113
|
+
public_metadata: org.publicMetadata,
|
|
114
|
+
max_allowed_memberships: org.maxAllowedMemberships,
|
|
115
|
+
created_by: org.createdBy,
|
|
116
|
+
created_at: org.createdAt,
|
|
117
|
+
updated_at: org.updatedAt,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** BAPI session (operator view). */
|
|
121
|
+
function presentSession(session) {
|
|
122
|
+
return {
|
|
123
|
+
object: 'session',
|
|
124
|
+
id: session.id,
|
|
125
|
+
user_id: session.userId,
|
|
126
|
+
status: session.status,
|
|
127
|
+
last_active_organization_id: session.activeOrganizationId,
|
|
128
|
+
impersonated_by: session.impersonatedBy,
|
|
129
|
+
last_active_at: session.lastActiveAt,
|
|
130
|
+
expire_at: session.expiresAt,
|
|
131
|
+
abandon_at: session.idleExpiresAt,
|
|
132
|
+
created_at: session.createdAt,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/** A sign_in_attempt view. `supported_first_factors` is always the instance's list. */
|
|
136
|
+
function presentSignInAttempt(mock, attempt) {
|
|
137
|
+
return {
|
|
138
|
+
id: attempt.id,
|
|
139
|
+
object: 'sign_in_attempt',
|
|
140
|
+
status: attempt.status,
|
|
141
|
+
identifier: attempt.identifier,
|
|
142
|
+
supported_first_factors: mock.instance.firstFactors,
|
|
143
|
+
created_session_id: attempt.sessionId,
|
|
144
|
+
expires_at: attempt.expiresAt,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/** A sign_up_attempt view. */
|
|
148
|
+
function presentSignUpAttempt(attempt) {
|
|
149
|
+
return {
|
|
150
|
+
id: attempt.id,
|
|
151
|
+
object: 'sign_up_attempt',
|
|
152
|
+
status: attempt.status,
|
|
153
|
+
identifier: attempt.identifier,
|
|
154
|
+
created_session_id: attempt.sessionId,
|
|
155
|
+
expires_at: attempt.expiresAt,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** The cursor-paginated list envelope (§9.1): `{ data, has_more, next_cursor }`. */
|
|
159
|
+
function listEnvelope(data, hasMore, nextCursor) {
|
|
160
|
+
return { data, has_more: hasMore, next_cursor: nextCursor };
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=serializers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializers.js","sourceRoot":"","sources":["../src/serializers.ts"],"names":[],"mappings":";;AAuBA,8BAWC;AAGD,kCAgCC;AAGD,sCA4BC;AAGD,8CAgBC;AAGD,kDAcC;AAGD,wCAaC;AAGD,oDAUC;AAGD,oDASC;AAGD,oCAEC;AAhKD,2FAA2F;AAC3F,SAAgB,SAAS,CACvB,IAAY,EACZ,OAAe,EACf,KAAc,EACd,IAA8B;IAE9B,MAAM,IAAI,GAA4B,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACxD,IAAI,KAAK,KAAK,SAAS;QAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAC5C,IAAI,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACzC,IAAI,CAAC,QAAQ,GAAG,qCAAqC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;IAC1E,OAAO,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;AAC5B,CAAC;AAED,iEAAiE;AACjE,SAAgB,WAAW,CAAC,IAAc;IACxC,OAAO;QACL,MAAM,EAAE,MAAe;QACvB,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,UAAU,EAAE,IAAI,CAAC,SAAS;QAC1B,SAAS,EAAE,IAAI,CAAC,QAAQ;QACxB,SAAS,EAAE,IAAI,CAAC,QAAQ;QACxB,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,MAAM,EAAE,eAAwB;YAChC,aAAa,EAAE,CAAC,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d,MAAM,EAAE,iBAA0B;QAClC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,uBAAuB,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY;QACnD,kBAAkB,EAAE,OAAO,CAAC,SAAS;QACrC,UAAU,EAAE,OAAO,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC;AAED,8BAA8B;AAC9B,SAAgB,oBAAoB,CAAC,OAAoB;IACvD,OAAO;QACL,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,MAAM,EAAE,iBAA0B;QAClC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,kBAAkB,EAAE,OAAO,CAAC,SAAS;QACrC,UAAU,EAAE,OAAO,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,SAAgB,YAAY,CAAI,IAAS,EAAE,OAAgB,EAAE,UAAyB;IACpF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AAC9D,CAAC"}
|
package/dist/state.d.ts
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-memory mock backend that {@link ../handlers} reads and mutates.
|
|
3
|
+
*
|
|
4
|
+
* `createAtlasMock(seed?)` returns a mutable store standing in for ONE Atlas
|
|
5
|
+
* instance: its environment config, users (with email addresses), organizations
|
|
6
|
+
* and memberships, live sign-in / sign-up attempts, and sessions. The handlers
|
|
7
|
+
* advance this store — a sign-in attempt really transitions across calls, a
|
|
8
|
+
* created user really appears in the next list — so a test drives the same state
|
|
9
|
+
* machine the real server runs, without a server.
|
|
10
|
+
*
|
|
11
|
+
* Everything is deterministic: ids come from a seedable per-prefix counter, so a
|
|
12
|
+
* test that seeds the same thing gets byte-identical ids every run.
|
|
13
|
+
*/
|
|
14
|
+
/** The Atlas entity kinds this mock mints ids for. Mirrors `@atlas/shared`'s prefixes. */
|
|
15
|
+
export declare const ID_PREFIXES: {
|
|
16
|
+
readonly instance: "ins";
|
|
17
|
+
readonly user: "user";
|
|
18
|
+
readonly emailAddress: "eml";
|
|
19
|
+
readonly session: "sess";
|
|
20
|
+
readonly signInAttempt: "sia";
|
|
21
|
+
readonly signUpAttempt: "sia";
|
|
22
|
+
readonly organization: "org";
|
|
23
|
+
readonly organizationMembership: "orgmem";
|
|
24
|
+
};
|
|
25
|
+
export type EntityKind = keyof typeof ID_PREFIXES;
|
|
26
|
+
/** A single email address on a user — the Clerk-compatible `email_address` shape. */
|
|
27
|
+
export interface MockEmail {
|
|
28
|
+
id: string;
|
|
29
|
+
email: string;
|
|
30
|
+
verified: boolean;
|
|
31
|
+
primary: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** A user in the mock store. Field names are internal; the handlers serialise them. */
|
|
34
|
+
export interface MockUser {
|
|
35
|
+
id: string;
|
|
36
|
+
firstName: string | null;
|
|
37
|
+
lastName: string | null;
|
|
38
|
+
username: string | null;
|
|
39
|
+
imageUrl: string | null;
|
|
40
|
+
locale: string | null;
|
|
41
|
+
externalId: string | null;
|
|
42
|
+
/** The plaintext password the mock checks on a password sign-in (never serialised). */
|
|
43
|
+
password: string | null;
|
|
44
|
+
emails: MockEmail[];
|
|
45
|
+
primaryEmailId: string | null;
|
|
46
|
+
publicMetadata: Record<string, unknown>;
|
|
47
|
+
privateMetadata: Record<string, unknown>;
|
|
48
|
+
unsafeMetadata: Record<string, unknown>;
|
|
49
|
+
mfaEnabled: boolean;
|
|
50
|
+
isAnonymous: boolean;
|
|
51
|
+
banned: boolean;
|
|
52
|
+
deletedAt: number | null;
|
|
53
|
+
lastSignInAt: number | null;
|
|
54
|
+
createdAt: number;
|
|
55
|
+
updatedAt: number;
|
|
56
|
+
}
|
|
57
|
+
/** An organization in the mock store. */
|
|
58
|
+
export interface MockOrganization {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
slug: string | null;
|
|
62
|
+
imageUrl: string | null;
|
|
63
|
+
parentOrganizationId: string | null;
|
|
64
|
+
publicMetadata: Record<string, unknown>;
|
|
65
|
+
privateMetadata: Record<string, unknown>;
|
|
66
|
+
maxAllowedMemberships: number | null;
|
|
67
|
+
createdBy: string | null;
|
|
68
|
+
createdAt: number;
|
|
69
|
+
updatedAt: number;
|
|
70
|
+
}
|
|
71
|
+
/** A user's membership of an organization, with the role they hold in it. */
|
|
72
|
+
export interface MockMembership {
|
|
73
|
+
id: string;
|
|
74
|
+
userId: string;
|
|
75
|
+
organizationId: string;
|
|
76
|
+
role: string;
|
|
77
|
+
createdAt: number;
|
|
78
|
+
}
|
|
79
|
+
/** A live session minted by a completed sign-in or a backend mint. */
|
|
80
|
+
export interface MockSession {
|
|
81
|
+
id: string;
|
|
82
|
+
userId: string;
|
|
83
|
+
status: 'active' | 'revoked' | 'ended';
|
|
84
|
+
activeOrganizationId: string | null;
|
|
85
|
+
impersonatedBy: string | null;
|
|
86
|
+
/** The opaque bearer the mock hands back as `jwt` and accepts on `me`. */
|
|
87
|
+
jwt: string;
|
|
88
|
+
refreshToken: string;
|
|
89
|
+
lastActiveAt: number;
|
|
90
|
+
expiresAt: number;
|
|
91
|
+
idleExpiresAt: number;
|
|
92
|
+
createdAt: number;
|
|
93
|
+
}
|
|
94
|
+
/** A live sign-in or sign-up attempt, advanced across prepare/attempt calls. */
|
|
95
|
+
export interface MockAttempt {
|
|
96
|
+
id: string;
|
|
97
|
+
kind: 'sign_in' | 'sign_up';
|
|
98
|
+
status: 'needs_identifier' | 'needs_first_factor' | 'needs_second_factor' | 'needs_email_verification' | 'complete' | 'abandoned';
|
|
99
|
+
identifier: string | null;
|
|
100
|
+
userId: string | null;
|
|
101
|
+
strategy: string | null;
|
|
102
|
+
/** The code the next `attempt_*` call must present (email_code / verification). */
|
|
103
|
+
pendingCode: string | null;
|
|
104
|
+
/** Returned to the originating tab by `prepare_first_factor` (sign-in only). */
|
|
105
|
+
pollSecret: string | null;
|
|
106
|
+
/** One-time ticket issued on completion, redeemed at `tickets/exchange`. */
|
|
107
|
+
ticket: string | null;
|
|
108
|
+
sessionId: string | null;
|
|
109
|
+
createdAt: number;
|
|
110
|
+
expiresAt: number;
|
|
111
|
+
}
|
|
112
|
+
/** A social provider surfaced by `GET /v1/client/environment`. */
|
|
113
|
+
export interface MockSocialProvider {
|
|
114
|
+
provider: string;
|
|
115
|
+
native?: boolean;
|
|
116
|
+
mode?: 'native' | 'redirect';
|
|
117
|
+
label?: string | null;
|
|
118
|
+
display_name?: string | null;
|
|
119
|
+
allow_sign_in?: boolean;
|
|
120
|
+
allow_sign_up?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/** The instance / environment config the environment + JWKS endpoints report. */
|
|
123
|
+
export interface MockInstance {
|
|
124
|
+
id: string;
|
|
125
|
+
/** The FAPI origin the handlers are mounted on (publishable-key surface). */
|
|
126
|
+
fapiBaseUrl: string;
|
|
127
|
+
/** The BAPI origin the handlers are mounted on (secret-key surface). */
|
|
128
|
+
bapiBaseUrl: string;
|
|
129
|
+
publishableKey: string;
|
|
130
|
+
secretKey: string;
|
|
131
|
+
/** The enabled first factors, surfaced as `environment.first_factors`. */
|
|
132
|
+
firstFactors: string[];
|
|
133
|
+
socialProviders: MockSocialProvider[];
|
|
134
|
+
/** The fixed OTP every email_code / verification accepts in the mock. */
|
|
135
|
+
testOtp: string;
|
|
136
|
+
jwks: {
|
|
137
|
+
keys: unknown[];
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/** Seed for {@link createAtlasMock}. Everything is optional; sane defaults fill the rest. */
|
|
141
|
+
export interface AtlasMockSeed {
|
|
142
|
+
instance?: Partial<MockInstance>;
|
|
143
|
+
users?: SeedUser[];
|
|
144
|
+
organizations?: SeedOrganization[];
|
|
145
|
+
}
|
|
146
|
+
/** A friendly user seed — the mock normalises it into a {@link MockUser}. */
|
|
147
|
+
export interface SeedUser {
|
|
148
|
+
id?: string;
|
|
149
|
+
email?: string;
|
|
150
|
+
emailVerified?: boolean;
|
|
151
|
+
password?: string;
|
|
152
|
+
firstName?: string;
|
|
153
|
+
lastName?: string;
|
|
154
|
+
username?: string;
|
|
155
|
+
imageUrl?: string;
|
|
156
|
+
locale?: string;
|
|
157
|
+
externalId?: string;
|
|
158
|
+
publicMetadata?: Record<string, unknown>;
|
|
159
|
+
privateMetadata?: Record<string, unknown>;
|
|
160
|
+
unsafeMetadata?: Record<string, unknown>;
|
|
161
|
+
mfaEnabled?: boolean;
|
|
162
|
+
isAnonymous?: boolean;
|
|
163
|
+
}
|
|
164
|
+
/** A friendly organization seed. */
|
|
165
|
+
export interface SeedOrganization {
|
|
166
|
+
id?: string;
|
|
167
|
+
name: string;
|
|
168
|
+
slug?: string;
|
|
169
|
+
imageUrl?: string;
|
|
170
|
+
publicMetadata?: Record<string, unknown>;
|
|
171
|
+
maxAllowedMemberships?: number;
|
|
172
|
+
createdBy?: string;
|
|
173
|
+
/** User ids to seat as members, with their role (defaults to `member`). */
|
|
174
|
+
members?: Array<{
|
|
175
|
+
userId: string;
|
|
176
|
+
role?: string;
|
|
177
|
+
}>;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* A deterministic, seedable id factory. Each entity kind has its own monotonic
|
|
181
|
+
* counter, so `user(1)`, `user(2)`, … are stable across runs. Ids keep the
|
|
182
|
+
* Atlas `<prefix>_<...>` shape (e.g. `user_0000000000000000000000000001`).
|
|
183
|
+
*/
|
|
184
|
+
export declare class IdFactory {
|
|
185
|
+
private readonly counters;
|
|
186
|
+
next(kind: EntityKind): string;
|
|
187
|
+
reset(): void;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The mutable mock store. Created by {@link createAtlasMock}; the handlers close
|
|
191
|
+
* over one instance of this and mutate it in place.
|
|
192
|
+
*/
|
|
193
|
+
export declare class AtlasMock {
|
|
194
|
+
readonly instance: MockInstance;
|
|
195
|
+
readonly users: MockUser[];
|
|
196
|
+
readonly organizations: MockOrganization[];
|
|
197
|
+
readonly memberships: MockMembership[];
|
|
198
|
+
readonly attempts: MockAttempt[];
|
|
199
|
+
readonly sessions: MockSession[];
|
|
200
|
+
/** The session the `GET /v1/client` boot reports as active (set on exchange). */
|
|
201
|
+
activeSessionId: string | null;
|
|
202
|
+
readonly ids: IdFactory;
|
|
203
|
+
private readonly seed;
|
|
204
|
+
constructor(seed?: AtlasMockSeed);
|
|
205
|
+
private applySeed;
|
|
206
|
+
/** The FAPI origin the handlers are mounted on. */
|
|
207
|
+
get fapiBaseUrl(): string;
|
|
208
|
+
/** The BAPI origin the handlers are mounted on. */
|
|
209
|
+
get bapiBaseUrl(): string;
|
|
210
|
+
/** Seat a user into the store, normalising a friendly seed into a {@link MockUser}. */
|
|
211
|
+
addUser(seed: SeedUser): MockUser;
|
|
212
|
+
/** Seat an organization (and any seeded members) into the store. */
|
|
213
|
+
addOrganization(seed: SeedOrganization): MockOrganization;
|
|
214
|
+
/** Add a membership tying a user to an organization with a role. */
|
|
215
|
+
addMembership(userId: string, organizationId: string, role?: string): MockMembership;
|
|
216
|
+
/** Find a user by id (ignores soft-deleted unless asked). */
|
|
217
|
+
findUser(id: string, includeDeleted?: boolean): MockUser | undefined;
|
|
218
|
+
/** Find a user by any of their verified email addresses. */
|
|
219
|
+
findUserByEmail(email: string): MockUser | undefined;
|
|
220
|
+
findOrganization(id: string): MockOrganization | undefined;
|
|
221
|
+
findAttempt(id: string): MockAttempt | undefined;
|
|
222
|
+
findSession(id: string): MockSession | undefined;
|
|
223
|
+
/** The live session a FAPI bearer `jwt` authenticates as, or undefined. */
|
|
224
|
+
sessionForJwt(jwt: string): MockSession | undefined;
|
|
225
|
+
/** Mint a live session for a user (the same object a completed sign-in yields). */
|
|
226
|
+
createSession(userId: string, opts?: {
|
|
227
|
+
impersonatedBy?: string;
|
|
228
|
+
}): MockSession;
|
|
229
|
+
/** Reset the store to its original seed — the per-test teardown helper. */
|
|
230
|
+
reset(): void;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Create a mutable mock Atlas backend. Pass a seed to pre-populate users,
|
|
234
|
+
* organizations and the instance/environment config; everything is optional.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* const mock = createAtlasMock({
|
|
238
|
+
* instance: { firstFactors: ['password'] },
|
|
239
|
+
* users: [{ email: 'ada@example.com', password: 'hunter2' }],
|
|
240
|
+
* });
|
|
241
|
+
*/
|
|
242
|
+
export declare function createAtlasMock(seed?: AtlasMockSeed): AtlasMock;
|