@stackframe/stack-shared 2.8.3 → 2.8.5
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/CHANGELOG.md +12 -0
- package/dist/config/format.d.ts +38 -0
- package/dist/config/format.js +224 -0
- package/dist/config/schema.d.ts +721 -0
- package/dist/config/schema.js +185 -0
- package/dist/crud.js +1 -1
- package/dist/interface/adminInterface.js +3 -3
- package/dist/interface/clientInterface.d.ts +4 -4
- package/dist/interface/crud/current-user.d.ts +1 -1
- package/dist/interface/crud/project-api-keys.d.ts +4 -4
- package/dist/interface/crud/projects.d.ts +25 -20
- package/dist/interface/crud/projects.js +9 -5
- package/dist/interface/crud/team-member-profiles.d.ts +2 -2
- package/dist/interface/crud/users.d.ts +4 -4
- package/dist/known-errors.d.ts +14 -0
- package/dist/known-errors.js +20 -0
- package/dist/schema-fields.d.ts +5 -4
- package/dist/schema-fields.js +34 -2
- package/dist/utils/api-keys.js +11 -10
- package/dist/utils/caches.d.ts +10 -10
- package/dist/utils/objects.d.ts +28 -3
- package/dist/utils/objects.js +117 -0
- package/dist/utils/promises.d.ts +1 -1
- package/dist/utils/promises.js +9 -10
- package/dist/utils/stores.d.ts +6 -6
- package/dist/utils/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import * as schemaFields from "../schema-fields";
|
|
2
|
+
import { yupBoolean, yupObject, yupRecord, yupString } from "../schema-fields";
|
|
3
|
+
import { allProviders } from "../utils/oauth";
|
|
4
|
+
import { get, has, isObjectLike, set } from "../utils/objects";
|
|
5
|
+
// NOTE: The validation schemas in here are all schematic validators, not sanity-check validators.
|
|
6
|
+
// For more info, see ./README.md
|
|
7
|
+
export const configLevels = ['project', 'branch', 'environment', 'organization'];
|
|
8
|
+
const permissionRegex = /^\$?[a-z0-9_:]+$/;
|
|
9
|
+
/**
|
|
10
|
+
* All fields that can be overridden at this level.
|
|
11
|
+
*/
|
|
12
|
+
export const projectConfigSchema = yupObject({});
|
|
13
|
+
// --- NEW RBAC Schema ---
|
|
14
|
+
const branchRbacDefaultPermissions = yupRecord(yupString().optional().matches(permissionRegex), yupBoolean().isTrue().optional()).optional();
|
|
15
|
+
const branchRbacSchema = yupObject({
|
|
16
|
+
permissions: yupRecord(yupString().optional().matches(permissionRegex), yupObject({
|
|
17
|
+
description: yupString().optional(),
|
|
18
|
+
scope: yupString().oneOf(['team', 'project']).optional(),
|
|
19
|
+
containedPermissionIds: yupRecord(yupString().optional().matches(permissionRegex), yupBoolean().isTrue().optional()).optional(),
|
|
20
|
+
}).optional()).optional(),
|
|
21
|
+
defaultPermissions: yupObject({
|
|
22
|
+
teamCreator: branchRbacDefaultPermissions,
|
|
23
|
+
teamMember: branchRbacDefaultPermissions,
|
|
24
|
+
signUp: branchRbacDefaultPermissions,
|
|
25
|
+
}).optional(),
|
|
26
|
+
}).optional();
|
|
27
|
+
// --- END NEW RBAC Schema ---
|
|
28
|
+
// --- NEW API Keys Schema ---
|
|
29
|
+
const branchApiKeysSchema = yupObject({
|
|
30
|
+
enabled: yupObject({
|
|
31
|
+
team: yupBoolean().optional(),
|
|
32
|
+
user: yupBoolean().optional(),
|
|
33
|
+
}).optional(),
|
|
34
|
+
}).optional();
|
|
35
|
+
// --- END NEW API Keys Schema ---
|
|
36
|
+
const branchAuthSchema = yupObject({
|
|
37
|
+
allowSignUp: yupBoolean().optional(),
|
|
38
|
+
password: yupObject({
|
|
39
|
+
allowSignIn: yupBoolean().optional(),
|
|
40
|
+
}).optional(),
|
|
41
|
+
otp: yupObject({
|
|
42
|
+
allowSignIn: yupBoolean().optional(),
|
|
43
|
+
}).optional(),
|
|
44
|
+
passkey: yupObject({
|
|
45
|
+
allowSignIn: yupBoolean().optional(),
|
|
46
|
+
}).optional(),
|
|
47
|
+
oauth: yupObject({
|
|
48
|
+
accountMergeStrategy: yupString().oneOf(['link_method', 'raise_error', 'allow_duplicates']).optional(),
|
|
49
|
+
providers: yupRecord(yupString().optional().matches(permissionRegex), yupObject({
|
|
50
|
+
type: yupString().oneOf(allProviders).optional(),
|
|
51
|
+
allowSignIn: yupBoolean().optional(),
|
|
52
|
+
allowConnectedAccounts: yupBoolean().optional(),
|
|
53
|
+
}).defined()).optional(),
|
|
54
|
+
}).optional(),
|
|
55
|
+
}).optional();
|
|
56
|
+
const branchDomain = yupObject({
|
|
57
|
+
allowLocalhost: yupBoolean().optional(),
|
|
58
|
+
}).optional();
|
|
59
|
+
export const branchConfigSchema = projectConfigSchema.concat(yupObject({
|
|
60
|
+
rbac: branchRbacSchema,
|
|
61
|
+
teams: yupObject({
|
|
62
|
+
createPersonalTeamOnSignUp: yupBoolean().optional(),
|
|
63
|
+
allowClientTeamCreation: yupBoolean().optional(),
|
|
64
|
+
}).optional(),
|
|
65
|
+
users: yupObject({
|
|
66
|
+
allowClientUserDeletion: yupBoolean().optional(),
|
|
67
|
+
}).optional(),
|
|
68
|
+
apiKeys: branchApiKeysSchema,
|
|
69
|
+
domains: branchDomain,
|
|
70
|
+
auth: branchAuthSchema,
|
|
71
|
+
emails: yupObject({}),
|
|
72
|
+
}));
|
|
73
|
+
export const environmentConfigSchema = branchConfigSchema.concat(yupObject({
|
|
74
|
+
auth: branchConfigSchema.getNested("auth").concat(yupObject({
|
|
75
|
+
oauth: branchConfigSchema.getNested("auth").getNested("oauth").concat(yupObject({
|
|
76
|
+
providers: yupRecord(yupString().optional().matches(permissionRegex), yupObject({
|
|
77
|
+
type: yupString().oneOf(allProviders).optional(),
|
|
78
|
+
isShared: yupBoolean().optional(),
|
|
79
|
+
clientId: schemaFields.oauthClientIdSchema.optional(),
|
|
80
|
+
clientSecret: schemaFields.oauthClientSecretSchema.optional(),
|
|
81
|
+
facebookConfigId: schemaFields.oauthFacebookConfigIdSchema.optional(),
|
|
82
|
+
microsoftTenantId: schemaFields.oauthMicrosoftTenantIdSchema.optional(),
|
|
83
|
+
allowSignIn: yupBoolean().optional(),
|
|
84
|
+
allowConnectedAccounts: yupBoolean().optional(),
|
|
85
|
+
})).optional(),
|
|
86
|
+
}).optional()),
|
|
87
|
+
})),
|
|
88
|
+
emails: branchConfigSchema.getNested("emails").concat(yupObject({
|
|
89
|
+
server: yupObject({
|
|
90
|
+
isShared: yupBoolean().optional(),
|
|
91
|
+
host: schemaFields.emailHostSchema.optional().nonEmpty(),
|
|
92
|
+
port: schemaFields.emailPortSchema.optional(),
|
|
93
|
+
username: schemaFields.emailUsernameSchema.optional().nonEmpty(),
|
|
94
|
+
password: schemaFields.emailPasswordSchema.optional().nonEmpty(),
|
|
95
|
+
senderName: schemaFields.emailSenderNameSchema.optional().nonEmpty(),
|
|
96
|
+
senderEmail: schemaFields.emailSenderEmailSchema.optional().nonEmpty(),
|
|
97
|
+
}),
|
|
98
|
+
}).optional()),
|
|
99
|
+
domains: branchConfigSchema.getNested("domains").concat(yupObject({
|
|
100
|
+
trustedDomains: yupRecord(yupString().uuid().optional(), yupObject({
|
|
101
|
+
baseUrl: schemaFields.urlSchema.optional(),
|
|
102
|
+
handlerPath: schemaFields.handlerPathSchema.optional(),
|
|
103
|
+
})).optional(),
|
|
104
|
+
})),
|
|
105
|
+
}));
|
|
106
|
+
export const organizationConfigSchema = environmentConfigSchema.concat(yupObject({}));
|
|
107
|
+
// Defaults
|
|
108
|
+
// these are objects that are merged together to form the rendered config (see ./README.md)
|
|
109
|
+
// Wherever an object could be used as a value, a function can instead be used to generate the default values on a per-key basis
|
|
110
|
+
export const projectConfigDefaults = {};
|
|
111
|
+
export const branchConfigDefaults = {};
|
|
112
|
+
export const environmentConfigDefaults = {};
|
|
113
|
+
export const organizationConfigDefaults = {
|
|
114
|
+
rbac: {
|
|
115
|
+
permissions: (key) => ({}),
|
|
116
|
+
defaultPermissions: {
|
|
117
|
+
teamCreator: {},
|
|
118
|
+
teamMember: {},
|
|
119
|
+
signUp: {},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
apiKeys: {
|
|
123
|
+
enabled: {
|
|
124
|
+
team: false,
|
|
125
|
+
user: false,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
teams: {
|
|
129
|
+
createPersonalTeamOnSignUp: false,
|
|
130
|
+
allowClientTeamCreation: false,
|
|
131
|
+
},
|
|
132
|
+
users: {
|
|
133
|
+
allowClientUserDeletion: false,
|
|
134
|
+
},
|
|
135
|
+
domains: {
|
|
136
|
+
allowLocalhost: false,
|
|
137
|
+
trustedDomains: (key) => ({
|
|
138
|
+
handlerPath: '/handler',
|
|
139
|
+
}),
|
|
140
|
+
},
|
|
141
|
+
auth: {
|
|
142
|
+
allowSignUp: true,
|
|
143
|
+
password: {
|
|
144
|
+
allowSignIn: false,
|
|
145
|
+
},
|
|
146
|
+
otp: {
|
|
147
|
+
allowSignIn: false,
|
|
148
|
+
},
|
|
149
|
+
passkey: {
|
|
150
|
+
allowSignIn: false,
|
|
151
|
+
},
|
|
152
|
+
oauth: {
|
|
153
|
+
accountMergeStrategy: 'link_method',
|
|
154
|
+
providers: (key) => ({
|
|
155
|
+
allowSignIn: false,
|
|
156
|
+
allowConnectedAccounts: false,
|
|
157
|
+
}),
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
emails: {
|
|
161
|
+
server: {
|
|
162
|
+
isShared: true,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
export function applyDefaults(defaults, config) {
|
|
167
|
+
const res = { ...typeof defaults === 'function' ? {} : defaults };
|
|
168
|
+
for (const [key, mergeValue] of Object.entries(config)) {
|
|
169
|
+
const baseValue = typeof defaults === 'function' ? defaults(key) : (has(defaults, key) ? get(defaults, key) : undefined);
|
|
170
|
+
if (baseValue !== undefined) {
|
|
171
|
+
if (isObjectLike(baseValue) && isObjectLike(mergeValue)) {
|
|
172
|
+
set(res, key, applyDefaults(baseValue, mergeValue));
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
set(res, key, mergeValue);
|
|
177
|
+
}
|
|
178
|
+
return res;
|
|
179
|
+
}
|
|
180
|
+
import.meta.vitest?.test("applyDefaults", ({ expect }) => {
|
|
181
|
+
expect(applyDefaults({ a: 1 }, { a: 2 })).toEqual({ a: 2 });
|
|
182
|
+
expect(applyDefaults({ a: { b: 1 } }, { a: { c: 2 } })).toEqual({ a: { b: 1, c: 2 } });
|
|
183
|
+
expect(applyDefaults((key) => ({ b: key }), { a: {} })).toEqual({ a: { b: "a" } });
|
|
184
|
+
expect(applyDefaults({ a: (key) => ({ b: key }) }, { a: { c: { d: 1 } } })).toEqual({ a: { c: { b: "c", d: 1 } } });
|
|
185
|
+
});
|
package/dist/crud.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { yupObject, yupString } from './schema-fields';
|
|
1
2
|
import { filterUndefined } from './utils/objects';
|
|
2
3
|
export function createCrud(options) {
|
|
3
4
|
const docs = options.docs ?? {};
|
|
@@ -52,7 +53,6 @@ export function createCrud(options) {
|
|
|
52
53
|
hasDelete: !!admin.deleteSchema,
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
|
-
import { yupObject, yupString } from './schema-fields';
|
|
56
56
|
import.meta.vitest?.test("createCrud", ({ expect }) => {
|
|
57
57
|
// Test with empty options
|
|
58
58
|
const emptyCrud = createCrud({});
|
|
@@ -14,13 +14,13 @@ export class StackAdminInterface extends StackServerInterface {
|
|
|
14
14
|
}, session, requestType);
|
|
15
15
|
}
|
|
16
16
|
async getProject() {
|
|
17
|
-
const response = await this.sendAdminRequest("/projects/current", {
|
|
17
|
+
const response = await this.sendAdminRequest("/internal/projects/current", {
|
|
18
18
|
method: "GET",
|
|
19
19
|
}, null);
|
|
20
20
|
return await response.json();
|
|
21
21
|
}
|
|
22
22
|
async updateProject(update) {
|
|
23
|
-
const response = await this.sendAdminRequest("/projects/current", {
|
|
23
|
+
const response = await this.sendAdminRequest("/internal/projects/current", {
|
|
24
24
|
method: "PATCH",
|
|
25
25
|
headers: {
|
|
26
26
|
"content-type": "application/json",
|
|
@@ -145,7 +145,7 @@ export class StackAdminInterface extends StackServerInterface {
|
|
|
145
145
|
return await response.json();
|
|
146
146
|
}
|
|
147
147
|
async deleteProject() {
|
|
148
|
-
await this.sendAdminRequest("/projects/current", {
|
|
148
|
+
await this.sendAdminRequest("/internal/projects/current", {
|
|
149
149
|
method: "DELETE",
|
|
150
150
|
}, null);
|
|
151
151
|
}
|
|
@@ -9,7 +9,7 @@ import { CurrentUserCrud } from './crud/current-user';
|
|
|
9
9
|
import { ConnectedAccountAccessTokenCrud } from './crud/oauth';
|
|
10
10
|
import { TeamApiKeysCrud, UserApiKeysCrud, teamApiKeysCreateInputSchema, teamApiKeysCreateOutputSchema, userApiKeysCreateInputSchema, userApiKeysCreateOutputSchema } from './crud/project-api-keys';
|
|
11
11
|
import { ProjectPermissionsCrud } from './crud/project-permissions';
|
|
12
|
-
import {
|
|
12
|
+
import { AdminUserProjectsCrud, ClientProjectsCrud } from './crud/projects';
|
|
13
13
|
import { SessionsCrud } from './crud/sessions';
|
|
14
14
|
import { TeamInvitationCrud } from './crud/team-invitation';
|
|
15
15
|
import { TeamMemberProfilesCrud } from './crud/team-member-profiles';
|
|
@@ -194,10 +194,10 @@ export declare class StackClientInterface {
|
|
|
194
194
|
recursive: boolean;
|
|
195
195
|
}, session: InternalSession): Promise<ProjectPermissionsCrud['Client']['Read'][]>;
|
|
196
196
|
listCurrentUserTeams(session: InternalSession): Promise<TeamsCrud["Client"]["Read"][]>;
|
|
197
|
-
getClientProject(): Promise<Result<
|
|
197
|
+
getClientProject(): Promise<Result<ClientProjectsCrud['Client']['Read'], KnownErrors["ProjectNotFound"]>>;
|
|
198
198
|
updateClientUser(update: CurrentUserCrud["Client"]["Update"], session: InternalSession): Promise<void>;
|
|
199
|
-
listProjects(session: InternalSession): Promise<
|
|
200
|
-
createProject(project:
|
|
199
|
+
listProjects(session: InternalSession): Promise<AdminUserProjectsCrud['Client']['Read'][]>;
|
|
200
|
+
createProject(project: AdminUserProjectsCrud['Client']['Create'], session: InternalSession): Promise<AdminUserProjectsCrud['Client']['Read']>;
|
|
201
201
|
createProviderAccessToken(provider: string, scope: string, session: InternalSession): Promise<ConnectedAccountAccessTokenCrud['Client']['Read']>;
|
|
202
202
|
createClientTeam(data: TeamsCrud['Client']['Create'], session: InternalSession): Promise<TeamsCrud['Client']['Read']>;
|
|
203
203
|
deleteTeam(teamId: string, session: InternalSession): Promise<void>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CrudTypeOf } from "../../crud";
|
|
2
2
|
export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
3
3
|
clientReadSchema: import("yup").ObjectSchema<{
|
|
4
|
-
primary_email: string | null;
|
|
5
4
|
id: string;
|
|
6
5
|
display_name: string | null;
|
|
7
6
|
oauth_providers: {
|
|
@@ -12,6 +11,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
12
11
|
profile_image_url: string | null;
|
|
13
12
|
client_metadata: {} | null;
|
|
14
13
|
client_read_only_metadata: {} | null;
|
|
14
|
+
primary_email: string | null;
|
|
15
15
|
primary_email_verified: boolean;
|
|
16
16
|
passkey_auth_enabled: boolean;
|
|
17
17
|
otp_auth_enabled: boolean;
|
|
@@ -71,13 +71,13 @@ export declare const userApiKeysCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
71
71
|
is_public: undefined;
|
|
72
72
|
user_id: undefined;
|
|
73
73
|
}, "">, userApiKeysCreateOutputSchema: yup.ObjectSchema<{
|
|
74
|
+
id: string;
|
|
74
75
|
type: "user";
|
|
75
|
-
user_id: string;
|
|
76
76
|
description: string;
|
|
77
|
-
id: string;
|
|
78
77
|
created_at_millis: number;
|
|
79
78
|
expires_at_millis: number | undefined;
|
|
80
79
|
manually_revoked_at_millis: number | undefined;
|
|
80
|
+
user_id: string;
|
|
81
81
|
is_public: boolean;
|
|
82
82
|
} & {
|
|
83
83
|
value: string;
|
|
@@ -164,13 +164,13 @@ export declare const teamApiKeysCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
164
164
|
is_public: undefined;
|
|
165
165
|
team_id: undefined;
|
|
166
166
|
}, "">, teamApiKeysCreateOutputSchema: yup.ObjectSchema<{
|
|
167
|
+
id: string;
|
|
167
168
|
type: "team";
|
|
168
|
-
team_id: string;
|
|
169
169
|
description: string;
|
|
170
|
-
id: string;
|
|
171
170
|
created_at_millis: number;
|
|
172
171
|
expires_at_millis: number | undefined;
|
|
173
172
|
manually_revoked_at_millis: number | undefined;
|
|
173
|
+
team_id: string;
|
|
174
174
|
is_public: boolean;
|
|
175
175
|
} & {
|
|
176
176
|
value: string;
|
|
@@ -55,12 +55,12 @@ export declare const projectsCrudAdminReadSchema: import("yup").ObjectSchema<{
|
|
|
55
55
|
client_secret?: string | undefined;
|
|
56
56
|
facebook_config_id?: string | undefined;
|
|
57
57
|
microsoft_tenant_id?: string | undefined;
|
|
58
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
58
59
|
type: "shared" | "standard";
|
|
59
|
-
id: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x";
|
|
60
60
|
enabled: boolean;
|
|
61
61
|
}[];
|
|
62
62
|
enabled_oauth_providers: {
|
|
63
|
-
id: "
|
|
63
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
64
64
|
}[];
|
|
65
65
|
domains: {
|
|
66
66
|
domain: string;
|
|
@@ -137,7 +137,7 @@ export declare const projectsCrudClientReadSchema: import("yup").ObjectSchema<{
|
|
|
137
137
|
allow_user_api_keys: boolean;
|
|
138
138
|
allow_team_api_keys: boolean;
|
|
139
139
|
enabled_oauth_providers: {
|
|
140
|
-
id: "
|
|
140
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
141
141
|
}[];
|
|
142
142
|
};
|
|
143
143
|
}, import("yup").AnyObject, {
|
|
@@ -174,8 +174,8 @@ export declare const projectsCrudAdminUpdateSchema: import("yup").ObjectSchema<{
|
|
|
174
174
|
client_secret?: string | undefined;
|
|
175
175
|
facebook_config_id?: string | undefined;
|
|
176
176
|
microsoft_tenant_id?: string | undefined;
|
|
177
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
177
178
|
type: "shared" | "standard";
|
|
178
|
-
id: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x";
|
|
179
179
|
enabled: boolean;
|
|
180
180
|
}[] | undefined;
|
|
181
181
|
domains?: {
|
|
@@ -228,8 +228,8 @@ export declare const projectsCrudAdminCreateSchema: import("yup").ObjectSchema<{
|
|
|
228
228
|
client_secret?: string | undefined;
|
|
229
229
|
facebook_config_id?: string | undefined;
|
|
230
230
|
microsoft_tenant_id?: string | undefined;
|
|
231
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
231
232
|
type: "shared" | "standard";
|
|
232
|
-
id: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x";
|
|
233
233
|
enabled: boolean;
|
|
234
234
|
}[] | undefined;
|
|
235
235
|
domains?: {
|
|
@@ -266,7 +266,7 @@ export declare const projectsCrudAdminCreateSchema: import("yup").ObjectSchema<{
|
|
|
266
266
|
config: undefined;
|
|
267
267
|
}, "">;
|
|
268
268
|
export declare const projectsCrudAdminDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
|
|
269
|
-
export declare const
|
|
269
|
+
export declare const clientProjectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
270
270
|
clientReadSchema: import("yup").ObjectSchema<{
|
|
271
271
|
id: string;
|
|
272
272
|
display_name: string;
|
|
@@ -280,7 +280,7 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
280
280
|
allow_user_api_keys: boolean;
|
|
281
281
|
allow_team_api_keys: boolean;
|
|
282
282
|
enabled_oauth_providers: {
|
|
283
|
-
id: "
|
|
283
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
284
284
|
}[];
|
|
285
285
|
};
|
|
286
286
|
}, import("yup").AnyObject, {
|
|
@@ -298,6 +298,16 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
298
298
|
enabled_oauth_providers: undefined;
|
|
299
299
|
};
|
|
300
300
|
}, "">;
|
|
301
|
+
docs: {
|
|
302
|
+
clientRead: {
|
|
303
|
+
summary: string;
|
|
304
|
+
description: string;
|
|
305
|
+
tags: string[];
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
}>;
|
|
309
|
+
export type ClientProjectsCrud = CrudTypeOf<typeof clientProjectsCrud>;
|
|
310
|
+
export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
301
311
|
adminReadSchema: import("yup").ObjectSchema<{
|
|
302
312
|
id: string;
|
|
303
313
|
display_name: string;
|
|
@@ -321,12 +331,12 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
321
331
|
client_secret?: string | undefined;
|
|
322
332
|
facebook_config_id?: string | undefined;
|
|
323
333
|
microsoft_tenant_id?: string | undefined;
|
|
334
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
324
335
|
type: "shared" | "standard";
|
|
325
|
-
id: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x";
|
|
326
336
|
enabled: boolean;
|
|
327
337
|
}[];
|
|
328
338
|
enabled_oauth_providers: {
|
|
329
|
-
id: "
|
|
339
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
330
340
|
}[];
|
|
331
341
|
domains: {
|
|
332
342
|
domain: string;
|
|
@@ -409,8 +419,8 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
409
419
|
client_secret?: string | undefined;
|
|
410
420
|
facebook_config_id?: string | undefined;
|
|
411
421
|
microsoft_tenant_id?: string | undefined;
|
|
422
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
412
423
|
type: "shared" | "standard";
|
|
413
|
-
id: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x";
|
|
414
424
|
enabled: boolean;
|
|
415
425
|
}[] | undefined;
|
|
416
426
|
domains?: {
|
|
@@ -446,11 +456,6 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
446
456
|
}, "">;
|
|
447
457
|
adminDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
|
|
448
458
|
docs: {
|
|
449
|
-
clientRead: {
|
|
450
|
-
summary: string;
|
|
451
|
-
description: string;
|
|
452
|
-
tags: string[];
|
|
453
|
-
};
|
|
454
459
|
adminRead: {
|
|
455
460
|
summary: string;
|
|
456
461
|
description: string;
|
|
@@ -469,7 +474,7 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
469
474
|
};
|
|
470
475
|
}>;
|
|
471
476
|
export type ProjectsCrud = CrudTypeOf<typeof projectsCrud>;
|
|
472
|
-
export declare const
|
|
477
|
+
export declare const adminUserProjectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
473
478
|
clientReadSchema: import("yup").ObjectSchema<{
|
|
474
479
|
id: string;
|
|
475
480
|
display_name: string;
|
|
@@ -493,12 +498,12 @@ export declare const internalProjectsCrud: import("../../crud").CrudSchemaFromOp
|
|
|
493
498
|
client_secret?: string | undefined;
|
|
494
499
|
facebook_config_id?: string | undefined;
|
|
495
500
|
microsoft_tenant_id?: string | undefined;
|
|
501
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
496
502
|
type: "shared" | "standard";
|
|
497
|
-
id: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x";
|
|
498
503
|
enabled: boolean;
|
|
499
504
|
}[];
|
|
500
505
|
enabled_oauth_providers: {
|
|
501
|
-
id: "
|
|
506
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
502
507
|
}[];
|
|
503
508
|
domains: {
|
|
504
509
|
domain: string;
|
|
@@ -581,8 +586,8 @@ export declare const internalProjectsCrud: import("../../crud").CrudSchemaFromOp
|
|
|
581
586
|
client_secret?: string | undefined;
|
|
582
587
|
facebook_config_id?: string | undefined;
|
|
583
588
|
microsoft_tenant_id?: string | undefined;
|
|
589
|
+
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
|
|
584
590
|
type: "shared" | "standard";
|
|
585
|
-
id: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x";
|
|
586
591
|
enabled: boolean;
|
|
587
592
|
}[] | undefined;
|
|
588
593
|
domains?: {
|
|
@@ -627,4 +632,4 @@ export declare const internalProjectsCrud: import("../../crud").CrudSchemaFromOp
|
|
|
627
632
|
};
|
|
628
633
|
};
|
|
629
634
|
}>;
|
|
630
|
-
export type
|
|
635
|
+
export type AdminUserProjectsCrud = CrudTypeOf<typeof adminUserProjectsCrud>;
|
|
@@ -124,17 +124,21 @@ export const projectsCrudAdminCreateSchema = projectsCrudAdminUpdateSchema.conca
|
|
|
124
124
|
display_name: schemaFields.projectDisplayNameSchema.defined(),
|
|
125
125
|
}).defined());
|
|
126
126
|
export const projectsCrudAdminDeleteSchema = schemaFields.yupMixed();
|
|
127
|
-
export const
|
|
127
|
+
export const clientProjectsCrud = createCrud({
|
|
128
128
|
clientReadSchema: projectsCrudClientReadSchema,
|
|
129
|
-
adminReadSchema: projectsCrudAdminReadSchema,
|
|
130
|
-
adminUpdateSchema: projectsCrudAdminUpdateSchema,
|
|
131
|
-
adminDeleteSchema: projectsCrudAdminDeleteSchema,
|
|
132
129
|
docs: {
|
|
133
130
|
clientRead: {
|
|
134
131
|
summary: 'Get the current project',
|
|
135
132
|
description: 'Get the current project information including display name, OAuth providers and authentication methods. Useful for display the available login options to the user.',
|
|
136
133
|
tags: ['Projects'],
|
|
137
134
|
},
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
export const projectsCrud = createCrud({
|
|
138
|
+
adminReadSchema: projectsCrudAdminReadSchema,
|
|
139
|
+
adminUpdateSchema: projectsCrudAdminUpdateSchema,
|
|
140
|
+
adminDeleteSchema: projectsCrudAdminDeleteSchema,
|
|
141
|
+
docs: {
|
|
138
142
|
adminRead: {
|
|
139
143
|
summary: 'Get the current project',
|
|
140
144
|
description: 'Get the current project information and configuration including display name, OAuth providers, email configuration, etc.',
|
|
@@ -152,7 +156,7 @@ export const projectsCrud = createCrud({
|
|
|
152
156
|
},
|
|
153
157
|
},
|
|
154
158
|
});
|
|
155
|
-
export const
|
|
159
|
+
export const adminUserProjectsCrud = createCrud({
|
|
156
160
|
clientReadSchema: projectsCrudAdminReadSchema,
|
|
157
161
|
clientCreateSchema: projectsCrudAdminCreateSchema,
|
|
158
162
|
docs: {
|
|
@@ -17,7 +17,6 @@ export declare const teamMemberProfilesCrudServerReadSchema: import("yup").Objec
|
|
|
17
17
|
profile_image_url: string | null;
|
|
18
18
|
} & {
|
|
19
19
|
user: {
|
|
20
|
-
primary_email: string | null;
|
|
21
20
|
id: string;
|
|
22
21
|
display_name: string | null;
|
|
23
22
|
oauth_providers: {
|
|
@@ -29,6 +28,7 @@ export declare const teamMemberProfilesCrudServerReadSchema: import("yup").Objec
|
|
|
29
28
|
client_metadata: {} | null;
|
|
30
29
|
client_read_only_metadata: {} | null;
|
|
31
30
|
server_metadata: {} | null;
|
|
31
|
+
primary_email: string | null;
|
|
32
32
|
primary_email_verified: boolean;
|
|
33
33
|
primary_email_auth_enabled: boolean;
|
|
34
34
|
passkey_auth_enabled: boolean;
|
|
@@ -112,7 +112,6 @@ export declare const teamMemberProfilesCrud: import("../../crud").CrudSchemaFrom
|
|
|
112
112
|
profile_image_url: string | null;
|
|
113
113
|
} & {
|
|
114
114
|
user: {
|
|
115
|
-
primary_email: string | null;
|
|
116
115
|
id: string;
|
|
117
116
|
display_name: string | null;
|
|
118
117
|
oauth_providers: {
|
|
@@ -124,6 +123,7 @@ export declare const teamMemberProfilesCrud: import("../../crud").CrudSchemaFrom
|
|
|
124
123
|
client_metadata: {} | null;
|
|
125
124
|
client_read_only_metadata: {} | null;
|
|
126
125
|
server_metadata: {} | null;
|
|
126
|
+
primary_email: string | null;
|
|
127
127
|
primary_email_verified: boolean;
|
|
128
128
|
primary_email_auth_enabled: boolean;
|
|
129
129
|
passkey_auth_enabled: boolean;
|
|
@@ -96,13 +96,13 @@ export declare const usersCrudServerReadSchema: import("yup").ObjectSchema<{
|
|
|
96
96
|
requires_totp_mfa: undefined;
|
|
97
97
|
}, "">;
|
|
98
98
|
export declare const usersCrudServerCreateSchema: import("yup").ObjectSchema<{
|
|
99
|
-
primary_email: string | null | undefined;
|
|
100
99
|
password: string | null | undefined;
|
|
101
100
|
display_name: string | null | undefined;
|
|
102
101
|
profile_image_url: string | null | undefined;
|
|
103
102
|
client_metadata: {} | null | undefined;
|
|
104
103
|
client_read_only_metadata: {} | null | undefined;
|
|
105
104
|
server_metadata: {} | null | undefined;
|
|
105
|
+
primary_email: string | null | undefined;
|
|
106
106
|
primary_email_verified: boolean | undefined;
|
|
107
107
|
primary_email_auth_enabled: boolean | undefined;
|
|
108
108
|
passkey_auth_enabled: boolean | undefined;
|
|
@@ -112,9 +112,9 @@ export declare const usersCrudServerCreateSchema: import("yup").ObjectSchema<{
|
|
|
112
112
|
is_anonymous: boolean | undefined;
|
|
113
113
|
} & {
|
|
114
114
|
oauth_providers: {
|
|
115
|
-
email: string | null;
|
|
116
115
|
id: string;
|
|
117
116
|
account_id: string;
|
|
117
|
+
email: string | null;
|
|
118
118
|
}[] | undefined;
|
|
119
119
|
is_anonymous: boolean | undefined;
|
|
120
120
|
}, import("yup").AnyObject, {
|
|
@@ -234,13 +234,13 @@ export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
234
234
|
is_anonymous: undefined;
|
|
235
235
|
}, "">;
|
|
236
236
|
serverCreateSchema: import("yup").ObjectSchema<{
|
|
237
|
-
primary_email: string | null | undefined;
|
|
238
237
|
password: string | null | undefined;
|
|
239
238
|
display_name: string | null | undefined;
|
|
240
239
|
profile_image_url: string | null | undefined;
|
|
241
240
|
client_metadata: {} | null | undefined;
|
|
242
241
|
client_read_only_metadata: {} | null | undefined;
|
|
243
242
|
server_metadata: {} | null | undefined;
|
|
243
|
+
primary_email: string | null | undefined;
|
|
244
244
|
primary_email_verified: boolean | undefined;
|
|
245
245
|
primary_email_auth_enabled: boolean | undefined;
|
|
246
246
|
passkey_auth_enabled: boolean | undefined;
|
|
@@ -250,9 +250,9 @@ export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
250
250
|
is_anonymous: boolean | undefined;
|
|
251
251
|
} & {
|
|
252
252
|
oauth_providers: {
|
|
253
|
-
email: string | null;
|
|
254
253
|
id: string;
|
|
255
254
|
account_id: string;
|
|
255
|
+
email: string | null;
|
|
256
256
|
}[] | undefined;
|
|
257
257
|
is_anonymous: boolean | undefined;
|
|
258
258
|
}, import("yup").AnyObject, {
|
package/dist/known-errors.d.ts
CHANGED
|
@@ -69,6 +69,15 @@ export declare const KnownErrors: {
|
|
|
69
69
|
PermissionIdAlreadyExists: KnownErrorConstructor<KnownError & KnownErrorBrand<"PERMISSION_ID_ALREADY_EXISTS">, [permissionId: string]> & {
|
|
70
70
|
errorCode: "PERMISSION_ID_ALREADY_EXISTS";
|
|
71
71
|
};
|
|
72
|
+
CliAuthError: KnownErrorConstructor<KnownError & KnownErrorBrand<"CLI_AUTH_ERROR">, [message: string]> & {
|
|
73
|
+
errorCode: "CLI_AUTH_ERROR";
|
|
74
|
+
};
|
|
75
|
+
CliAuthExpiredError: KnownErrorConstructor<KnownError & KnownErrorBrand<"CLI_AUTH_EXPIRED_ERROR">, [message?: string | undefined]> & {
|
|
76
|
+
errorCode: "CLI_AUTH_EXPIRED_ERROR";
|
|
77
|
+
};
|
|
78
|
+
CliAuthUsedError: KnownErrorConstructor<KnownError & KnownErrorBrand<"CLI_AUTH_USED_ERROR">, [message?: string | undefined]> & {
|
|
79
|
+
errorCode: "CLI_AUTH_USED_ERROR";
|
|
80
|
+
};
|
|
72
81
|
InvalidProjectAuthentication: KnownErrorConstructor<KnownError & KnownErrorBrand<"PROJECT_AUTHENTICATION_ERROR"> & {
|
|
73
82
|
constructorArgs: [statusCode: number, humanReadableMessage: string, details?: Json | undefined];
|
|
74
83
|
} & KnownErrorBrand<"INVALID_PROJECT_AUTHENTICATION">, [statusCode: number, humanReadableMessage: string, details?: Json | undefined]> & {
|
|
@@ -240,6 +249,11 @@ export declare const KnownErrors: {
|
|
|
240
249
|
} & KnownErrorBrand<"API_KEY_NOT_FOUND">, []> & {
|
|
241
250
|
errorCode: "API_KEY_NOT_FOUND";
|
|
242
251
|
};
|
|
252
|
+
PublicApiKeyCannotBeRevoked: KnownErrorConstructor<KnownError & KnownErrorBrand<"API_KEY_NOT_VALID"> & {
|
|
253
|
+
constructorArgs: [statusCode: number, humanReadableMessage: string, details?: Json | undefined];
|
|
254
|
+
} & KnownErrorBrand<"PUBLIC_API_KEY_CANNOT_BE_REVOKED">, []> & {
|
|
255
|
+
errorCode: "PUBLIC_API_KEY_CANNOT_BE_REVOKED";
|
|
256
|
+
};
|
|
243
257
|
ProjectNotFound: KnownErrorConstructor<KnownError & KnownErrorBrand<"PROJECT_NOT_FOUND">, [projectId: string]> & {
|
|
244
258
|
errorCode: "PROJECT_NOT_FOUND";
|
|
245
259
|
};
|
package/dist/known-errors.js
CHANGED
|
@@ -566,6 +566,18 @@ const InvalidPollingCodeError = createKnownErrorConstructor(KnownError, "INVALID
|
|
|
566
566
|
"The polling code is invalid or does not exist.",
|
|
567
567
|
details,
|
|
568
568
|
], (json) => [json]);
|
|
569
|
+
const CliAuthError = createKnownErrorConstructor(KnownError, "CLI_AUTH_ERROR", (message) => [
|
|
570
|
+
400,
|
|
571
|
+
message,
|
|
572
|
+
], (json) => [json.message]);
|
|
573
|
+
const CliAuthExpiredError = createKnownErrorConstructor(KnownError, "CLI_AUTH_EXPIRED_ERROR", (message = "CLI authentication request expired. Please try again.") => [
|
|
574
|
+
400,
|
|
575
|
+
message,
|
|
576
|
+
], (json) => [json.message]);
|
|
577
|
+
const CliAuthUsedError = createKnownErrorConstructor(KnownError, "CLI_AUTH_USED_ERROR", (message = "This authentication token has already been used.") => [
|
|
578
|
+
400,
|
|
579
|
+
message,
|
|
580
|
+
], (json) => [json.message]);
|
|
569
581
|
const ApiKeyNotValid = createKnownErrorConstructor(KnownError, "API_KEY_NOT_VALID", "inherit", "inherit");
|
|
570
582
|
const ApiKeyExpired = createKnownErrorConstructor(ApiKeyNotValid, "API_KEY_EXPIRED", () => [
|
|
571
583
|
401,
|
|
@@ -584,6 +596,10 @@ const ApiKeyNotFound = createKnownErrorConstructor(ApiKeyNotValid, "API_KEY_NOT_
|
|
|
584
596
|
404,
|
|
585
597
|
"API key not found.",
|
|
586
598
|
], () => []);
|
|
599
|
+
const PublicApiKeyCannotBeRevoked = createKnownErrorConstructor(ApiKeyNotValid, "PUBLIC_API_KEY_CANNOT_BE_REVOKED", () => [
|
|
600
|
+
400,
|
|
601
|
+
"Public API keys cannot be revoked by the secretscanner endpoint.",
|
|
602
|
+
], () => []);
|
|
587
603
|
const PermissionIdAlreadyExists = createKnownErrorConstructor(KnownError, "PERMISSION_ID_ALREADY_EXISTS", (permissionId) => [
|
|
588
604
|
400,
|
|
589
605
|
`Permission with ID "${permissionId}" already exists. Choose a different ID.`,
|
|
@@ -599,6 +615,9 @@ export const KnownErrors = {
|
|
|
599
615
|
AllOverloadsFailed,
|
|
600
616
|
ProjectAuthenticationError,
|
|
601
617
|
PermissionIdAlreadyExists,
|
|
618
|
+
CliAuthError,
|
|
619
|
+
CliAuthExpiredError,
|
|
620
|
+
CliAuthUsedError,
|
|
602
621
|
InvalidProjectAuthentication,
|
|
603
622
|
ProjectKeyWithoutAccessType,
|
|
604
623
|
InvalidAccessType,
|
|
@@ -636,6 +655,7 @@ export const KnownErrors = {
|
|
|
636
655
|
UserIdDoesNotExist,
|
|
637
656
|
UserNotFound,
|
|
638
657
|
ApiKeyNotFound,
|
|
658
|
+
PublicApiKeyCannotBeRevoked,
|
|
639
659
|
ProjectNotFound,
|
|
640
660
|
SignUpNotEnabled,
|
|
641
661
|
PasswordAuthenticationNotEnabled,
|