@stackframe/stack-shared 2.5.31 → 2.5.32

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @stackframe/stack-shared
2
2
 
3
+ ## 2.5.32
4
+
5
+ ### Patch Changes
6
+
7
+ - Improved connected account performance
8
+ - @stackframe/stack-sc@2.5.32
9
+
3
10
  ## 2.5.31
4
11
 
5
12
  ### Patch Changes
@@ -30,14 +30,16 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
30
30
  } | {
31
31
  type: "oauth";
32
32
  provider: {
33
- type: string;
33
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
34
+ id: string;
34
35
  provider_user_id: string;
35
36
  };
36
37
  })[];
37
38
  connected_accounts: {
38
39
  type: "oauth";
39
40
  provider: {
40
- type: string;
41
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
42
+ id: string;
41
43
  provider_user_id: string;
42
44
  };
43
45
  }[];
@@ -112,14 +114,16 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
112
114
  } | {
113
115
  type: "oauth";
114
116
  provider: {
115
- type: string;
117
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
118
+ id: string;
116
119
  provider_user_id: string;
117
120
  };
118
121
  })[];
119
122
  connected_accounts: {
120
123
  type: "oauth";
121
124
  provider: {
122
- type: string;
125
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
126
+ id: string;
123
127
  provider_user_id: string;
124
128
  };
125
129
  }[];
@@ -27,7 +27,7 @@ const emailConfigSchema = yupObject({
27
27
  sender_email: yupRequiredWhen(schemaFields.emailSenderEmailSchema, 'type', 'standard'),
28
28
  });
29
29
  const domainSchema = yupObject({
30
- domain: schemaFields.domainSchema.required(),
30
+ domain: schemaFields.projectTrustedDomainSchema.required(),
31
31
  handler_path: schemaFields.handlerPathSchema.required(),
32
32
  });
33
33
  export const projectsCrudAdminReadSchema = yupObject({
@@ -56,14 +56,16 @@ export declare const teamMemberProfilesCrudServerReadSchema: import("yup").Objec
56
56
  } | {
57
57
  type: "oauth";
58
58
  provider: {
59
- type: string;
59
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
60
+ id: string;
60
61
  provider_user_id: string;
61
62
  };
62
63
  })[];
63
64
  connected_accounts: {
64
65
  type: "oauth";
65
66
  provider: {
66
- type: string;
67
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
68
+ id: string;
67
69
  provider_user_id: string;
68
70
  };
69
71
  }[];
@@ -168,14 +170,16 @@ export declare const teamMemberProfilesCrud: import("../../crud").CrudSchemaFrom
168
170
  } | {
169
171
  type: "oauth";
170
172
  provider: {
171
- type: string;
173
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
174
+ id: string;
172
175
  provider_user_id: string;
173
176
  };
174
177
  })[];
175
178
  connected_accounts: {
176
179
  type: "oauth";
177
180
  provider: {
178
- type: string;
181
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
182
+ id: string;
179
183
  provider_user_id: string;
180
184
  };
181
185
  }[];
@@ -61,14 +61,16 @@ export declare const usersCrudServerReadSchema: import("yup").ObjectSchema<{
61
61
  } | {
62
62
  type: "oauth";
63
63
  provider: {
64
- type: string;
64
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
65
+ id: string;
65
66
  provider_user_id: string;
66
67
  };
67
68
  })[];
68
69
  connected_accounts: {
69
70
  type: "oauth";
70
71
  provider: {
71
- type: string;
72
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
73
+ id: string;
72
74
  provider_user_id: string;
73
75
  };
74
76
  }[];
@@ -175,14 +177,16 @@ export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
175
177
  } | {
176
178
  type: "oauth";
177
179
  provider: {
178
- type: string;
180
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
181
+ id: string;
179
182
  provider_user_id: string;
180
183
  };
181
184
  })[];
182
185
  connected_accounts: {
183
186
  type: "oauth";
184
187
  provider: {
185
- type: string;
188
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
189
+ id: string;
186
190
  provider_user_id: string;
187
191
  };
188
192
  }[];
@@ -344,14 +348,16 @@ export declare const userCreatedWebhookEvent: {
344
348
  } | {
345
349
  type: "oauth";
346
350
  provider: {
347
- type: string;
351
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
352
+ id: string;
348
353
  provider_user_id: string;
349
354
  };
350
355
  })[];
351
356
  connected_accounts: {
352
357
  type: "oauth";
353
358
  provider: {
354
- type: string;
359
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
360
+ id: string;
355
361
  provider_user_id: string;
356
362
  };
357
363
  }[];
@@ -432,14 +438,16 @@ export declare const userUpdatedWebhookEvent: {
432
438
  } | {
433
439
  type: "oauth";
434
440
  provider: {
435
- type: string;
441
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
442
+ id: string;
436
443
  provider_user_id: string;
437
444
  };
438
445
  })[];
439
446
  connected_accounts: {
440
447
  type: "oauth";
441
448
  provider: {
442
- type: string;
449
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
450
+ id: string;
443
451
  provider_user_id: string;
444
452
  };
445
453
  }[];
@@ -21,7 +21,7 @@ const emailConfigSchema = yupObject({
21
21
  sender_email: yupRequiredWhen(schemaFields.emailSenderEmailSchema, 'type', 'standard'),
22
22
  });
23
23
  const domainSchema = yupObject({
24
- domain: schemaFields.domainSchema.required(),
24
+ domain: schemaFields.projectTrustedDomainSchema.required(),
25
25
  handler_path: schemaFields.handlerPathSchema.required(),
26
26
  });
27
27
  export const projectsCrudAdminReadSchema = yupObject({
@@ -47,14 +47,16 @@ export declare const webhookEvents: readonly [{
47
47
  } | {
48
48
  type: "oauth";
49
49
  provider: {
50
- type: string;
50
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
51
+ id: string;
51
52
  provider_user_id: string;
52
53
  };
53
54
  })[];
54
55
  connected_accounts: {
55
56
  type: "oauth";
56
57
  provider: {
57
- type: string;
58
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
59
+ id: string;
58
60
  provider_user_id: string;
59
61
  };
60
62
  }[];
@@ -134,14 +136,16 @@ export declare const webhookEvents: readonly [{
134
136
  } | {
135
137
  type: "oauth";
136
138
  provider: {
137
- type: string;
139
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
140
+ id: string;
138
141
  provider_user_id: string;
139
142
  };
140
143
  })[];
141
144
  connected_accounts: {
142
145
  type: "oauth";
143
146
  provider: {
144
- type: string;
147
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
148
+ id: string;
145
149
  provider_user_id: string;
146
150
  };
147
151
  }[];
@@ -51,7 +51,7 @@ export declare const emailPortSchema: yup.NumberSchema<number | undefined, yup.A
51
51
  export declare const emailUsernameSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
52
52
  export declare const emailSenderEmailSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
53
53
  export declare const emailPasswordSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
54
- export declare const domainSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
54
+ export declare const projectTrustedDomainSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
55
55
  export declare const handlerPathSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
56
56
  export declare class ReplaceFieldWithOwnUserId extends Error {
57
57
  readonly path: string;
@@ -69,9 +69,11 @@ export declare const userClientMetadataSchema: yup.MixedSchema<{} | null, yup.An
69
69
  export declare const userClientReadOnlyMetadataSchema: yup.MixedSchema<{} | null, yup.AnyObject, undefined, "">;
70
70
  export declare const userServerMetadataSchema: yup.MixedSchema<{} | null, yup.AnyObject, undefined, "">;
71
71
  export declare const userOAuthProviderSchema: yup.ObjectSchema<{
72
- type: string;
72
+ id: string;
73
+ type: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | "discord" | "gitlab" | "bitbucket" | undefined>;
73
74
  provider_user_id: string;
74
75
  }, yup.AnyObject, {
76
+ id: undefined;
75
77
  type: undefined;
76
78
  provider_user_id: undefined;
77
79
  }, "">;
@@ -168,7 +168,7 @@ export const emailUsernameSchema = yupString().meta({ openapiField: { descriptio
168
168
  export const emailSenderEmailSchema = emailSchema.meta({ openapiField: { description: 'Email sender email. Needs to be specified when using type="standard"', exampleValue: 'example@your-domain.com' } });
169
169
  export const emailPasswordSchema = yupString().meta({ openapiField: { description: 'Email password. Needs to be specified when using type="standard"', exampleValue: 'your-email-password' } });
170
170
  // Project domain config
171
- export const domainSchema = yupString().test('is-https', 'Domain must start with https://', (value) => value?.startsWith('https://')).meta({ openapiField: { description: 'Your domain URL. Make sure you own and trust this domain. Needs to start with https://', exampleValue: 'example.com' } });
171
+ export const projectTrustedDomainSchema = yupString().test('is-https', 'Trusted domain must start with https://', (value) => value?.startsWith('https://')).meta({ openapiField: { description: 'Your domain URL. Make sure you own and trust this domain. Needs to start with https://', exampleValue: 'https://example.com' } });
172
172
  export const handlerPathSchema = yupString().test('is-handler-path', 'Handler path must start with /', (value) => value?.startsWith('/')).meta({ openapiField: { description: 'Handler path. If you did not setup a custom handler path, it should be "/handler" by default. It needs to start with /', exampleValue: '/handler' } });
173
173
  // Users
174
174
  export class ReplaceFieldWithOwnUserId extends Error {
@@ -199,7 +199,8 @@ export const userClientMetadataSchema = jsonSchema.meta({ openapiField: { descri
199
199
  export const userClientReadOnlyMetadataSchema = jsonSchema.meta({ openapiField: { description: _clientReadOnlyMetaDataDescription('user'), exampleValue: { key: 'value' } } });
200
200
  export const userServerMetadataSchema = jsonSchema.meta({ openapiField: { description: _serverMetaDataDescription('user'), exampleValue: { key: 'value' } } });
201
201
  export const userOAuthProviderSchema = yupObject({
202
- type: yupString().required(),
202
+ id: yupString().required(),
203
+ type: yupString().oneOf(allProviders).required(),
203
204
  provider_user_id: yupString().required(),
204
205
  });
205
206
  export const userLastActiveAtMillisSchema = yupNumber().nullable().meta({ openapiField: { description: _lastActiveAtMillisDescription, exampleValue: 1630000000000 } });
@@ -207,8 +208,8 @@ export const userLastActiveAtMillisSchema = yupNumber().nullable().meta({ openap
207
208
  export const signInEmailSchema = emailSchema.meta({ openapiField: { description: 'The email to sign in with.', exampleValue: 'johndoe@example.com' } });
208
209
  export const emailOtpSignInCallbackUrlSchema = urlSchema.meta({ openapiField: { description: 'The base callback URL to construct the magic link from. A query argument `code` with the verification code will be appended to it. The page should then make a request to the `/auth/otp/sign-in` endpoint.', exampleValue: 'https://example.com/handler/magic-link-callback' } });
209
210
  export const emailVerificationCallbackUrlSchema = urlSchema.meta({ openapiField: { description: 'The base callback URL to construct a verification link for the verification e-mail. A query argument `code` with the verification code will be appended to it. The page should then make a request to the `/contact-channels/verify` endpoint.', exampleValue: 'https://example.com/handler/email-verification' } });
210
- export const accessTokenResponseSchema = yupString().meta({ openapiField: { description: 'Short-lived access token that can be used to authenticate the user', exampleValue: 'eyJhmMiJBMTO...diI4QT' } });
211
- export const refreshTokenResponseSchema = yupString().meta({ openapiField: { description: 'Long-lived refresh token that can be used to obtain a new access token', exampleValue: 'i8nsoaq2...14y' } });
211
+ export const accessTokenResponseSchema = yupString().meta({ openapiField: { description: 'Short-lived access token that can be used to authenticate the user', exampleValue: 'eyJhmMiJB2TO...diI4QT' } });
212
+ export const refreshTokenResponseSchema = yupString().meta({ openapiField: { description: 'Long-lived refresh token that can be used to obtain a new access token', exampleValue: 'i8ns3aq2...14y' } });
212
213
  export const signInResponseSchema = yupObject({
213
214
  refresh_token: refreshTokenResponseSchema.required(),
214
215
  access_token: accessTokenResponseSchema.required(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackframe/stack-shared",
3
- "version": "2.5.31",
3
+ "version": "2.5.32",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -37,7 +37,7 @@
37
37
  "jose": "^5.2.2",
38
38
  "oauth4webapi": "^2.10.3",
39
39
  "uuid": "^9.0.1",
40
- "@stackframe/stack-sc": "2.5.31"
40
+ "@stackframe/stack-sc": "2.5.32"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/bcrypt": "^5.0.2",