@stackframe/js 2.8.56 → 2.8.59
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/dist/esm/index.js.map +1 -1
- package/dist/esm/integrations/convex/component/convex.config.js.map +1 -1
- package/dist/esm/integrations/convex.js.map +1 -1
- package/dist/esm/lib/auth.js.map +1 -1
- package/dist/esm/lib/cookie.js.map +1 -1
- package/dist/esm/lib/stack-app/api-keys/index.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js +235 -0
- package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js +133 -23
- package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/common.js +2 -1
- package/dist/esm/lib/stack-app/apps/implementations/common.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/index.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js +31 -23
- package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/index.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/interfaces/server-app.js.map +1 -1
- package/dist/esm/lib/stack-app/common.js.map +1 -1
- package/dist/esm/lib/stack-app/contact-channels/index.js.map +1 -1
- package/dist/esm/lib/stack-app/email-templates/index.js.map +1 -1
- package/dist/esm/lib/stack-app/index.js.map +1 -1
- package/dist/esm/lib/stack-app/internal-api-keys/index.js.map +1 -1
- package/dist/esm/lib/stack-app/permissions/index.js.map +1 -1
- package/dist/esm/lib/stack-app/projects/index.js +4 -0
- package/dist/esm/lib/stack-app/projects/index.js.map +1 -1
- package/dist/esm/lib/stack-app/teams/index.js.map +1 -1
- package/dist/esm/lib/stack-app/users/index.js +13 -12
- package/dist/esm/lib/stack-app/users/index.js.map +1 -1
- package/dist/esm/utils/url.js.map +1 -1
- package/dist/index.d.mts +285 -17
- package/dist/index.d.ts +285 -17
- package/dist/index.js.map +1 -1
- package/dist/integrations/convex/component/convex.config.js.map +1 -1
- package/dist/integrations/convex.js.map +1 -1
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/cookie.js.map +1 -1
- package/dist/lib/stack-app/api-keys/index.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.js +235 -0
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/client-app-impl.js +132 -22
- package/dist/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/common.js +2 -1
- package/dist/lib/stack-app/apps/implementations/common.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/index.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/server-app-impl.js +29 -21
- package/dist/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -1
- package/dist/lib/stack-app/apps/index.js.map +1 -1
- package/dist/lib/stack-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
- package/dist/lib/stack-app/apps/interfaces/server-app.js.map +1 -1
- package/dist/lib/stack-app/common.js.map +1 -1
- package/dist/lib/stack-app/connected-accounts/index.js.map +1 -1
- package/dist/lib/stack-app/contact-channels/index.js.map +1 -1
- package/dist/lib/stack-app/customers/index.js.map +1 -1
- package/dist/lib/stack-app/data-vault/index.js.map +1 -1
- package/dist/lib/stack-app/email/index.js.map +1 -1
- package/dist/lib/stack-app/email-templates/index.js.map +1 -1
- package/dist/lib/stack-app/index.js.map +1 -1
- package/dist/lib/stack-app/internal-api-keys/index.js.map +1 -1
- package/dist/lib/stack-app/notification-categories/index.js.map +1 -1
- package/dist/lib/stack-app/permissions/index.js.map +1 -1
- package/dist/lib/stack-app/project-configs/index.js.map +1 -1
- package/dist/lib/stack-app/projects/index.js +4 -0
- package/dist/lib/stack-app/projects/index.js.map +1 -1
- package/dist/lib/stack-app/teams/index.js.map +1 -1
- package/dist/lib/stack-app/users/index.js +15 -14
- package/dist/lib/stack-app/users/index.js.map +1 -1
- package/dist/utils/url.js.map +1 -1
- package/package.json +14 -13
- package/CHANGELOG.md +0 -2072
package/dist/index.d.mts
CHANGED
|
@@ -37,6 +37,15 @@ type RedirectMethod = "window" | "none" | {
|
|
|
37
37
|
};
|
|
38
38
|
type GetCurrentUserOptions<HasTokenStore> = {
|
|
39
39
|
or?: 'redirect' | 'throw' | 'return-null' | 'anonymous' | /** @deprecated */ 'anonymous-if-exists[deprecated]';
|
|
40
|
+
/**
|
|
41
|
+
* Whether to include restricted users (users who haven't completed onboarding requirements like email verification).
|
|
42
|
+
* By default, restricted users are filtered out (treated similar to anonymous users).
|
|
43
|
+
*
|
|
44
|
+
* Note: This option cannot be set to false when `or: 'anonymous'` is used, as all anonymous users are also restricted.
|
|
45
|
+
*
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
includeRestricted?: boolean;
|
|
40
49
|
tokenStore?: TokenStoreInit;
|
|
41
50
|
} & (HasTokenStore extends false ? {
|
|
42
51
|
tokenStore: TokenStoreInit;
|
|
@@ -84,6 +93,7 @@ type HandlerUrls = {
|
|
|
84
93
|
teamInvitation: string;
|
|
85
94
|
mfa: string;
|
|
86
95
|
error: string;
|
|
96
|
+
onboarding: string;
|
|
87
97
|
};
|
|
88
98
|
type OAuthScopesOnSignIn = {
|
|
89
99
|
[key in ProviderType]: string[];
|
|
@@ -99,6 +109,20 @@ type AuthLike<ExtraOptions = {}> = {
|
|
|
99
109
|
signOut(options?: {
|
|
100
110
|
redirectUrl?: URL | string;
|
|
101
111
|
}): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Returns the current access token, or null if the user is not signed in.
|
|
114
|
+
*
|
|
115
|
+
* The access token is a short-lived JWT that can be used to authenticate requests to external servers.
|
|
116
|
+
* It will be automatically refreshed when it expires.
|
|
117
|
+
*/
|
|
118
|
+
getAccessToken(options?: {} & ExtraOptions): Promise<string | null>;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the current refresh token, or null if the user is not signed in.
|
|
121
|
+
*
|
|
122
|
+
* The refresh token is a long-lived token that can be used to obtain new access tokens.
|
|
123
|
+
* It should be kept secret and never exposed to the client.
|
|
124
|
+
*/
|
|
125
|
+
getRefreshToken(options?: {} & ExtraOptions): Promise<string | null>;
|
|
102
126
|
/**
|
|
103
127
|
* Returns headers for sending authenticated HTTP requests to external servers. Most commonly used in cross-origin
|
|
104
128
|
* requests. Similar to `getAuthJson`, but specifically for HTTP requests.
|
|
@@ -115,8 +139,8 @@ type AuthLike<ExtraOptions = {}> = {
|
|
|
115
139
|
* must include `x-stack-auth` in the [`Access-Control-Allow-Headers` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers)
|
|
116
140
|
* of the CORS preflight response.
|
|
117
141
|
*
|
|
118
|
-
* If you are not using HTTP (and hence cannot set headers), you will need to use the `
|
|
119
|
-
* instead.
|
|
142
|
+
* If you are not using HTTP (and hence cannot set headers), you will need to use the `getAccessToken()` and
|
|
143
|
+
* `getRefreshToken()` functions instead.
|
|
120
144
|
*
|
|
121
145
|
* Example:
|
|
122
146
|
*
|
|
@@ -140,6 +164,8 @@ type AuthLike<ExtraOptions = {}> = {
|
|
|
140
164
|
"x-stack-auth": string;
|
|
141
165
|
}>;
|
|
142
166
|
/**
|
|
167
|
+
* @deprecated Use `getAccessToken()` and `getRefreshToken()` instead.
|
|
168
|
+
*
|
|
143
169
|
* Creates a JSON-serializable object containing the information to authenticate a user on an external server.
|
|
144
170
|
* Similar to `getAuthHeaders`, but returns an object that can be sent over any protocol instead of just
|
|
145
171
|
* HTTP headers.
|
|
@@ -208,6 +234,17 @@ type CustomerProduct = {
|
|
|
208
234
|
customerType: "user" | "team" | "custom";
|
|
209
235
|
isServerOnly: boolean;
|
|
210
236
|
stackable: boolean;
|
|
237
|
+
type: "one_time" | "subscription";
|
|
238
|
+
subscription: null | {
|
|
239
|
+
currentPeriodEnd: Date | null;
|
|
240
|
+
cancelAtPeriodEnd: boolean;
|
|
241
|
+
isCancelable: boolean;
|
|
242
|
+
};
|
|
243
|
+
switchOptions?: Array<{
|
|
244
|
+
productId: string;
|
|
245
|
+
displayName: string;
|
|
246
|
+
prices: InlineProduct["prices"];
|
|
247
|
+
}>;
|
|
211
248
|
};
|
|
212
249
|
type CustomerProductsList = CustomerProduct[] & {
|
|
213
250
|
nextCursor: string | null;
|
|
@@ -223,6 +260,21 @@ type CustomerProductsRequestOptions = ({
|
|
|
223
260
|
} & CustomerProductsListOptions) | ({
|
|
224
261
|
customCustomerId: string;
|
|
225
262
|
} & CustomerProductsListOptions);
|
|
263
|
+
type CustomerDefaultPaymentMethod = {
|
|
264
|
+
id: string;
|
|
265
|
+
brand: string | null;
|
|
266
|
+
last4: string | null;
|
|
267
|
+
exp_month: number | null;
|
|
268
|
+
exp_year: number | null;
|
|
269
|
+
} | null;
|
|
270
|
+
type CustomerBilling = {
|
|
271
|
+
hasCustomer: boolean;
|
|
272
|
+
defaultPaymentMethod: CustomerDefaultPaymentMethod;
|
|
273
|
+
};
|
|
274
|
+
type CustomerPaymentMethodSetupIntent = {
|
|
275
|
+
clientSecret: string;
|
|
276
|
+
stripeAccountId: string;
|
|
277
|
+
};
|
|
226
278
|
type Customer<IsServer extends boolean = false> = {
|
|
227
279
|
readonly id: string;
|
|
228
280
|
createCheckoutUrl(options: ({
|
|
@@ -232,7 +284,16 @@ type Customer<IsServer extends boolean = false> = {
|
|
|
232
284
|
product: InlineProduct;
|
|
233
285
|
returnUrl?: string;
|
|
234
286
|
} : never))): Promise<string>;
|
|
235
|
-
|
|
287
|
+
createPaymentMethodSetupIntent(): Promise<CustomerPaymentMethodSetupIntent>;
|
|
288
|
+
setDefaultPaymentMethodFromSetupIntent(setupIntentId: string): Promise<CustomerDefaultPaymentMethod>;
|
|
289
|
+
switchSubscription(options: {
|
|
290
|
+
fromProductId: string;
|
|
291
|
+
toProductId: string;
|
|
292
|
+
priceId?: string;
|
|
293
|
+
quantity?: number;
|
|
294
|
+
}): Promise<void>;
|
|
295
|
+
} & AsyncStoreProperty<"billing", [
|
|
296
|
+
], CustomerBilling, false> & AsyncStoreProperty<"item", [
|
|
236
297
|
itemId: string
|
|
237
298
|
], IsServer extends true ? ServerItem : Item, false> & AsyncStoreProperty<"products", [
|
|
238
299
|
options?: CustomerProductsListOptions
|
|
@@ -254,6 +315,137 @@ type AdminSentEmail = {
|
|
|
254
315
|
sentAt: Date;
|
|
255
316
|
error?: unknown;
|
|
256
317
|
};
|
|
318
|
+
type AdminEmailOutboxRecipient = {
|
|
319
|
+
type: "user-primary-email";
|
|
320
|
+
userId: string;
|
|
321
|
+
} | {
|
|
322
|
+
type: "user-custom-emails";
|
|
323
|
+
userId: string;
|
|
324
|
+
emails: string[];
|
|
325
|
+
} | {
|
|
326
|
+
type: "custom-emails";
|
|
327
|
+
emails: string[];
|
|
328
|
+
};
|
|
329
|
+
type AdminEmailOutboxStatus = "paused" | "preparing" | "rendering" | "render-error" | "scheduled" | "queued" | "sending" | "server-error" | "skipped" | "bounced" | "delivery-delayed" | "sent" | "opened" | "clicked" | "marked-as-spam";
|
|
330
|
+
type AdminEmailOutboxSimpleStatus = "in-progress" | "ok" | "error";
|
|
331
|
+
type AdminEmailOutboxBase = {
|
|
332
|
+
id: string;
|
|
333
|
+
createdAt: Date;
|
|
334
|
+
updatedAt: Date;
|
|
335
|
+
to: AdminEmailOutboxRecipient;
|
|
336
|
+
scheduledAt: Date;
|
|
337
|
+
isPaused: false;
|
|
338
|
+
hasRendered: false;
|
|
339
|
+
hasDelivered: false;
|
|
340
|
+
};
|
|
341
|
+
type AdminEmailOutboxRenderedFields = Omit<AdminEmailOutboxBase, "hasRendered"> & {
|
|
342
|
+
hasRendered: true;
|
|
343
|
+
startedRenderingAt: Date;
|
|
344
|
+
renderedAt: Date;
|
|
345
|
+
subject: string;
|
|
346
|
+
html: string | null;
|
|
347
|
+
text: string | null;
|
|
348
|
+
isTransactional: boolean;
|
|
349
|
+
isHighPriority: boolean;
|
|
350
|
+
notificationCategoryId: string | null;
|
|
351
|
+
};
|
|
352
|
+
type AdminEmailOutboxStartedSendingFields = AdminEmailOutboxRenderedFields & {
|
|
353
|
+
startedSendingAt: Date;
|
|
354
|
+
};
|
|
355
|
+
type AdminEmailOutboxFinishedDeliveringFields = Omit<AdminEmailOutboxStartedSendingFields, "hasDelivered"> & {
|
|
356
|
+
hasDelivered: true;
|
|
357
|
+
deliveredAt: Date;
|
|
358
|
+
};
|
|
359
|
+
type AdminEmailOutboxPaused = Omit<AdminEmailOutboxBase, "isPaused"> & {
|
|
360
|
+
status: "paused";
|
|
361
|
+
simpleStatus: "in-progress";
|
|
362
|
+
isPaused: true;
|
|
363
|
+
};
|
|
364
|
+
type AdminEmailOutboxPreparing = AdminEmailOutboxBase & {
|
|
365
|
+
status: "preparing";
|
|
366
|
+
simpleStatus: "in-progress";
|
|
367
|
+
};
|
|
368
|
+
type AdminEmailOutboxRendering = AdminEmailOutboxBase & {
|
|
369
|
+
status: "rendering";
|
|
370
|
+
simpleStatus: "in-progress";
|
|
371
|
+
startedRenderingAt: Date;
|
|
372
|
+
};
|
|
373
|
+
type AdminEmailOutboxRenderError = AdminEmailOutboxBase & {
|
|
374
|
+
status: "render-error";
|
|
375
|
+
simpleStatus: "error";
|
|
376
|
+
startedRenderingAt: Date;
|
|
377
|
+
renderedAt: Date;
|
|
378
|
+
renderError: string;
|
|
379
|
+
};
|
|
380
|
+
type AdminEmailOutboxScheduled = AdminEmailOutboxRenderedFields & {
|
|
381
|
+
status: "scheduled";
|
|
382
|
+
simpleStatus: "in-progress";
|
|
383
|
+
};
|
|
384
|
+
type AdminEmailOutboxQueued = AdminEmailOutboxRenderedFields & {
|
|
385
|
+
status: "queued";
|
|
386
|
+
simpleStatus: "in-progress";
|
|
387
|
+
};
|
|
388
|
+
type AdminEmailOutboxSending = AdminEmailOutboxStartedSendingFields & {
|
|
389
|
+
status: "sending";
|
|
390
|
+
simpleStatus: "in-progress";
|
|
391
|
+
};
|
|
392
|
+
type AdminEmailOutboxServerError = AdminEmailOutboxStartedSendingFields & {
|
|
393
|
+
status: "server-error";
|
|
394
|
+
simpleStatus: "error";
|
|
395
|
+
errorAt: Date;
|
|
396
|
+
serverError: string;
|
|
397
|
+
};
|
|
398
|
+
type AdminEmailOutboxSkipped = Omit<AdminEmailOutboxBase, "hasRendered"> & {
|
|
399
|
+
status: "skipped";
|
|
400
|
+
simpleStatus: "ok";
|
|
401
|
+
hasRendered: boolean;
|
|
402
|
+
skippedAt: Date;
|
|
403
|
+
skippedReason: string;
|
|
404
|
+
skippedDetails: Record<string, unknown>;
|
|
405
|
+
startedRenderingAt?: Date;
|
|
406
|
+
renderedAt?: Date;
|
|
407
|
+
subject?: string;
|
|
408
|
+
html?: string | null;
|
|
409
|
+
text?: string | null;
|
|
410
|
+
isTransactional?: boolean;
|
|
411
|
+
isHighPriority?: boolean;
|
|
412
|
+
notificationCategoryId?: string | null;
|
|
413
|
+
startedSendingAt?: Date;
|
|
414
|
+
};
|
|
415
|
+
type AdminEmailOutboxBounced = AdminEmailOutboxStartedSendingFields & {
|
|
416
|
+
status: "bounced";
|
|
417
|
+
simpleStatus: "error";
|
|
418
|
+
bouncedAt: Date;
|
|
419
|
+
};
|
|
420
|
+
type AdminEmailOutboxDeliveryDelayed = AdminEmailOutboxStartedSendingFields & {
|
|
421
|
+
status: "delivery-delayed";
|
|
422
|
+
simpleStatus: "ok";
|
|
423
|
+
deliveryDelayedAt: Date;
|
|
424
|
+
};
|
|
425
|
+
type AdminEmailOutboxSent = AdminEmailOutboxFinishedDeliveringFields & {
|
|
426
|
+
status: "sent";
|
|
427
|
+
simpleStatus: "ok";
|
|
428
|
+
canHaveDeliveryInfo: boolean;
|
|
429
|
+
};
|
|
430
|
+
type AdminEmailOutboxOpened = AdminEmailOutboxFinishedDeliveringFields & {
|
|
431
|
+
status: "opened";
|
|
432
|
+
simpleStatus: "ok";
|
|
433
|
+
openedAt: Date;
|
|
434
|
+
canHaveDeliveryInfo: true;
|
|
435
|
+
};
|
|
436
|
+
type AdminEmailOutboxClicked = AdminEmailOutboxFinishedDeliveringFields & {
|
|
437
|
+
status: "clicked";
|
|
438
|
+
simpleStatus: "ok";
|
|
439
|
+
clickedAt: Date;
|
|
440
|
+
canHaveDeliveryInfo: true;
|
|
441
|
+
};
|
|
442
|
+
type AdminEmailOutboxMarkedAsSpam = AdminEmailOutboxFinishedDeliveringFields & {
|
|
443
|
+
status: "marked-as-spam";
|
|
444
|
+
simpleStatus: "ok";
|
|
445
|
+
markedAsSpamAt: Date;
|
|
446
|
+
canHaveDeliveryInfo: true;
|
|
447
|
+
};
|
|
448
|
+
type AdminEmailOutbox = AdminEmailOutboxPaused | AdminEmailOutboxPreparing | AdminEmailOutboxRendering | AdminEmailOutboxRenderError | AdminEmailOutboxScheduled | AdminEmailOutboxQueued | AdminEmailOutboxSending | AdminEmailOutboxServerError | AdminEmailOutboxSkipped | AdminEmailOutboxBounced | AdminEmailOutboxDeliveryDelayed | AdminEmailOutboxSent | AdminEmailOutboxOpened | AdminEmailOutboxClicked | AdminEmailOutboxMarkedAsSpam;
|
|
257
449
|
type SendEmailOptionsBase = {
|
|
258
450
|
themeId?: string | null | false;
|
|
259
451
|
subject?: string;
|
|
@@ -278,6 +470,25 @@ type SendEmailOptions = SendEmailOptionsBase & XOR<[
|
|
|
278
470
|
draftId: string;
|
|
279
471
|
}
|
|
280
472
|
]>;
|
|
473
|
+
type EmailDeliveryWindowStats = {
|
|
474
|
+
sent: number;
|
|
475
|
+
bounced: number;
|
|
476
|
+
marked_as_spam: number;
|
|
477
|
+
};
|
|
478
|
+
type EmailDeliveryStats = {
|
|
479
|
+
hour: EmailDeliveryWindowStats;
|
|
480
|
+
day: EmailDeliveryWindowStats;
|
|
481
|
+
week: EmailDeliveryWindowStats;
|
|
482
|
+
month: EmailDeliveryWindowStats;
|
|
483
|
+
};
|
|
484
|
+
type EmailDeliveryCapacity = {
|
|
485
|
+
rate_per_second: number;
|
|
486
|
+
penalty_factor: number;
|
|
487
|
+
};
|
|
488
|
+
type EmailDeliveryInfo = {
|
|
489
|
+
stats: EmailDeliveryStats;
|
|
490
|
+
capacity: EmailDeliveryCapacity;
|
|
491
|
+
};
|
|
281
492
|
|
|
282
493
|
type InternalApiKeyBase = {
|
|
283
494
|
id: string;
|
|
@@ -477,18 +688,17 @@ type ServerOAuthProvider = {
|
|
|
477
688
|
}): Promise<Result<void, InstanceType<typeof KnownErrors.OAuthProviderAccountIdAlreadyUsedForSignIn>>>;
|
|
478
689
|
delete(): Promise<void>;
|
|
479
690
|
};
|
|
480
|
-
type Session = {
|
|
481
|
-
getTokens(): Promise<{
|
|
482
|
-
accessToken: string | null;
|
|
483
|
-
refreshToken: string | null;
|
|
484
|
-
}>;
|
|
485
|
-
};
|
|
486
691
|
/**
|
|
487
692
|
* Contains everything related to the current user session.
|
|
488
693
|
*/
|
|
489
694
|
type Auth = AuthLike<{}> & {
|
|
490
695
|
readonly _internalSession: InternalSession;
|
|
491
|
-
readonly currentSession:
|
|
696
|
+
readonly currentSession: {
|
|
697
|
+
getTokens(): Promise<{
|
|
698
|
+
accessToken: string | null;
|
|
699
|
+
refreshToken: string | null;
|
|
700
|
+
}>;
|
|
701
|
+
};
|
|
492
702
|
};
|
|
493
703
|
/**
|
|
494
704
|
* ```
|
|
@@ -534,6 +744,18 @@ type BaseUser = {
|
|
|
534
744
|
readonly passkeyAuthEnabled: boolean;
|
|
535
745
|
readonly isMultiFactorRequired: boolean;
|
|
536
746
|
readonly isAnonymous: boolean;
|
|
747
|
+
/**
|
|
748
|
+
* Whether the user is in restricted state (signed up but hasn't completed onboarding requirements).
|
|
749
|
+
* For example, if email verification is required but the user hasn't verified their email yet.
|
|
750
|
+
*/
|
|
751
|
+
readonly isRestricted: boolean;
|
|
752
|
+
/**
|
|
753
|
+
* The reason why the user is restricted, e.g., { type: "email_not_verified" } or { type: "anonymous" }.
|
|
754
|
+
* Null if the user is not restricted.
|
|
755
|
+
*/
|
|
756
|
+
readonly restrictedReason: {
|
|
757
|
+
type: "anonymous" | "email_not_verified";
|
|
758
|
+
} | null;
|
|
537
759
|
toClientJson(): CurrentUserCrud["Client"]["Read"];
|
|
538
760
|
/**
|
|
539
761
|
* @deprecated, use contact channel's usedForAuth instead
|
|
@@ -547,7 +769,7 @@ type BaseUser = {
|
|
|
547
769
|
}[];
|
|
548
770
|
};
|
|
549
771
|
type UserExtra = {
|
|
550
|
-
setDisplayName(displayName: string): Promise<void>;
|
|
772
|
+
setDisplayName(displayName: string | null): Promise<void>;
|
|
551
773
|
/** @deprecated Use contact channel's sendVerificationEmail instead */
|
|
552
774
|
sendVerificationEmail(): Promise<KnownErrors["EmailAlreadyVerified"] | void>;
|
|
553
775
|
setClientMetadata(metadata: any): Promise<void>;
|
|
@@ -585,7 +807,7 @@ type UserExtra = {
|
|
|
585
807
|
recursive?: boolean;
|
|
586
808
|
}): Promise<TeamPermission[]>;
|
|
587
809
|
readonly selectedTeam: Team | null;
|
|
588
|
-
setSelectedTeam(
|
|
810
|
+
setSelectedTeam(teamOrId: string | Team | null): Promise<void>;
|
|
589
811
|
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
590
812
|
leaveTeam(team: Team): Promise<void>;
|
|
591
813
|
getActiveSessions(): Promise<ActiveSession[]>;
|
|
@@ -610,8 +832,8 @@ type User = BaseUser;
|
|
|
610
832
|
type CurrentUser = BaseUser & Auth & UserExtra & Customer;
|
|
611
833
|
type CurrentInternalUser = CurrentUser & InternalUserExtra;
|
|
612
834
|
type ProjectCurrentUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalUser : CurrentUser;
|
|
613
|
-
type TokenPartialUser = Pick<User, "id" | "displayName" | "primaryEmail" | "primaryEmailVerified" | "isAnonymous">;
|
|
614
|
-
type SyncedPartialUser = TokenPartialUser & Pick<User, "id" | "displayName" | "primaryEmail" | "primaryEmailVerified" | "profileImageUrl" | "signedUpAt" | "clientMetadata" | "clientReadOnlyMetadata" | "isAnonymous" | "hasPassword">;
|
|
835
|
+
type TokenPartialUser = Pick<User, "id" | "displayName" | "primaryEmail" | "primaryEmailVerified" | "isAnonymous" | "isRestricted" | "restrictedReason">;
|
|
836
|
+
type SyncedPartialUser = TokenPartialUser & Pick<User, "id" | "displayName" | "primaryEmail" | "primaryEmailVerified" | "profileImageUrl" | "signedUpAt" | "clientMetadata" | "clientReadOnlyMetadata" | "isAnonymous" | "hasPassword" | "isRestricted" | "restrictedReason">;
|
|
615
837
|
type ActiveSession = {
|
|
616
838
|
id: string;
|
|
617
839
|
userId: string;
|
|
@@ -622,13 +844,14 @@ type ActiveSession = {
|
|
|
622
844
|
geoInfo?: GeoInfo;
|
|
623
845
|
};
|
|
624
846
|
type UserUpdateOptions = {
|
|
625
|
-
displayName?: string;
|
|
847
|
+
displayName?: string | null;
|
|
626
848
|
clientMetadata?: ReadonlyJson;
|
|
627
849
|
selectedTeamId?: string | null;
|
|
628
850
|
totpMultiFactorSecret?: Uint8Array | null;
|
|
629
851
|
profileImageUrl?: string | null;
|
|
630
852
|
otpAuthEnabled?: boolean;
|
|
631
853
|
passkeyAuthEnabled?: boolean;
|
|
854
|
+
primaryEmail?: string | null;
|
|
632
855
|
};
|
|
633
856
|
type ServerBaseUser = {
|
|
634
857
|
setPrimaryEmail(email: string | null, options?: {
|
|
@@ -664,7 +887,12 @@ type ServerBaseUser = {
|
|
|
664
887
|
createSession(options?: {
|
|
665
888
|
expiresInMillis?: number;
|
|
666
889
|
isImpersonation?: boolean;
|
|
667
|
-
}): Promise<
|
|
890
|
+
}): Promise<{
|
|
891
|
+
getTokens(): Promise<{
|
|
892
|
+
accessToken: string | null;
|
|
893
|
+
refreshToken: string | null;
|
|
894
|
+
}>;
|
|
895
|
+
}>;
|
|
668
896
|
} & AsyncStoreProperty<"team", [id: string], ServerTeam | null, false> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & AsyncStoreProperty<"permission", [scope: Team, permissionId: string, options?: {
|
|
669
897
|
direct?: boolean;
|
|
670
898
|
}], AdminTeamPermission | null, false> & AsyncStoreProperty<"permissions", [scope: Team, options?: {
|
|
@@ -768,6 +996,15 @@ type ServerListUsersOptions = {
|
|
|
768
996
|
orderBy?: 'signedUpAt';
|
|
769
997
|
desc?: boolean;
|
|
770
998
|
query?: string;
|
|
999
|
+
/**
|
|
1000
|
+
* Whether to include restricted users (users who haven't completed onboarding requirements).
|
|
1001
|
+
* Defaults to false.
|
|
1002
|
+
*/
|
|
1003
|
+
includeRestricted?: boolean;
|
|
1004
|
+
/**
|
|
1005
|
+
* Whether to include anonymous users (and restricted users).
|
|
1006
|
+
* Defaults to false.
|
|
1007
|
+
*/
|
|
771
1008
|
includeAnonymous?: boolean;
|
|
772
1009
|
};
|
|
773
1010
|
type ServerTeamCreateOptions = TeamCreateOptions & {
|
|
@@ -848,6 +1085,7 @@ type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends s
|
|
|
848
1085
|
allowConnectedAccounts: boolean;
|
|
849
1086
|
}): Promise<Result<ServerOAuthProvider, InstanceType<typeof KnownErrors.OAuthProviderAccountIdAlreadyUsedForSignIn>>>;
|
|
850
1087
|
sendEmail(options: SendEmailOptions): Promise<void>;
|
|
1088
|
+
getEmailDeliveryStats(): Promise<EmailDeliveryInfo>;
|
|
851
1089
|
} & AsyncStoreProperty<"user", [id: string], ServerUser | null, false> & Omit<AsyncStoreProperty<"users", [], ServerUser[], true>, "listUsers" | "useUsers"> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & AsyncStoreProperty<"dataVaultStore", [id: string], DataVaultStore, false> & AsyncStoreProperty<"item", [
|
|
852
1090
|
{
|
|
853
1091
|
itemId: string;
|
|
@@ -864,6 +1102,21 @@ type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends s
|
|
|
864
1102
|
], CustomerProductsList, true> & StackClientApp<HasTokenStore, ProjectId>);
|
|
865
1103
|
declare const StackServerApp: StackServerAppConstructor;
|
|
866
1104
|
|
|
1105
|
+
type EmailOutboxListOptions = {
|
|
1106
|
+
status?: string;
|
|
1107
|
+
simpleStatus?: string;
|
|
1108
|
+
limit?: number;
|
|
1109
|
+
cursor?: string;
|
|
1110
|
+
};
|
|
1111
|
+
type EmailOutboxListResult = {
|
|
1112
|
+
items: AdminEmailOutbox[];
|
|
1113
|
+
nextCursor: string | null;
|
|
1114
|
+
};
|
|
1115
|
+
type EmailOutboxUpdateOptions = {
|
|
1116
|
+
isPaused?: boolean;
|
|
1117
|
+
scheduledAtMillis?: number;
|
|
1118
|
+
cancel?: boolean;
|
|
1119
|
+
};
|
|
867
1120
|
type StackAdminAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = (StackServerAppConstructorOptions<HasTokenStore, ProjectId> & {
|
|
868
1121
|
superSecretAdminKey?: string;
|
|
869
1122
|
projectOwnerSession?: InternalSession;
|
|
@@ -988,6 +1241,12 @@ type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends st
|
|
|
988
1241
|
type: "subscription" | "one-time-purchase";
|
|
989
1242
|
id: string;
|
|
990
1243
|
}): Promise<void>;
|
|
1244
|
+
listOutboxEmails(options?: EmailOutboxListOptions): Promise<EmailOutboxListResult>;
|
|
1245
|
+
getOutboxEmail(id: string): Promise<AdminEmailOutbox>;
|
|
1246
|
+
updateOutboxEmail(id: string, options: EmailOutboxUpdateOptions): Promise<AdminEmailOutbox>;
|
|
1247
|
+
pauseOutboxEmail(id: string): Promise<AdminEmailOutbox>;
|
|
1248
|
+
unpauseOutboxEmail(id: string): Promise<AdminEmailOutbox>;
|
|
1249
|
+
cancelOutboxEmail(id: string): Promise<AdminEmailOutbox>;
|
|
991
1250
|
} & StackServerApp<HasTokenStore, ProjectId>);
|
|
992
1251
|
declare const StackAdminApp: StackAdminAppConstructor;
|
|
993
1252
|
|
|
@@ -1005,6 +1264,9 @@ type ProjectConfig = {
|
|
|
1005
1264
|
type OAuthProviderConfig = {
|
|
1006
1265
|
readonly id: string;
|
|
1007
1266
|
};
|
|
1267
|
+
/**
|
|
1268
|
+
* @deprecated This type is deprecated. Use the new config override setup instead.
|
|
1269
|
+
*/
|
|
1008
1270
|
type AdminProjectConfig = {
|
|
1009
1271
|
readonly signUpEnabled: boolean;
|
|
1010
1272
|
readonly credentialEnabled: boolean;
|
|
@@ -1238,6 +1500,12 @@ type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends s
|
|
|
1238
1500
|
or: 'anonymous';
|
|
1239
1501
|
}): Promise<ProjectCurrentUser<ProjectId>>;
|
|
1240
1502
|
getUser(options?: GetCurrentUserOptions<HasTokenStore>): Promise<ProjectCurrentUser<ProjectId> | null>;
|
|
1503
|
+
cancelSubscription(options: {
|
|
1504
|
+
productId: string;
|
|
1505
|
+
} | {
|
|
1506
|
+
productId: string;
|
|
1507
|
+
teamId: string;
|
|
1508
|
+
}): Promise<void>;
|
|
1241
1509
|
getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore> & {
|
|
1242
1510
|
from: 'token';
|
|
1243
1511
|
}): Promise<TokenPartialUser | null>;
|
|
@@ -1274,4 +1542,4 @@ type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends s
|
|
|
1274
1542
|
}>);
|
|
1275
1543
|
declare const StackClientApp: StackClientAppConstructor;
|
|
1276
1544
|
|
|
1277
|
-
export { type AdminDomainConfig, type AdminEmailConfig, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectPermission, type AdminProjectPermissionDefinition, type AdminProjectPermissionDefinitionCreateOptions, type AdminProjectPermissionDefinitionUpdateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type Auth, type Connection, type ContactChannel, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type GetCurrentUserOptions, type GetCurrentUserOptions as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, type OAuthConnection, type OAuthProvider, type OAuthProviderConfig, type OAuthScopesOnSignIn, type Project, type ProjectConfig, type ServerContactChannel, type ServerListUsersOptions, type ServerOAuthProvider, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser,
|
|
1545
|
+
export { type AdminDomainConfig, type AdminEmailConfig, type AdminEmailOutbox, type AdminEmailOutboxRecipient, type AdminEmailOutboxSimpleStatus, type AdminEmailOutboxStatus, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectPermission, type AdminProjectPermissionDefinition, type AdminProjectPermissionDefinitionCreateOptions, type AdminProjectPermissionDefinitionUpdateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type Auth, type Connection, type ContactChannel, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type EmailOutboxListOptions, type EmailOutboxListResult, type EmailOutboxUpdateOptions, type GetCurrentUserOptions, type GetCurrentUserOptions as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, type OAuthConnection, type OAuthProvider, type OAuthProviderConfig, type OAuthScopesOnSignIn, type Project, type ProjectConfig, type ServerContactChannel, type ServerListUsersOptions, type ServerOAuthProvider, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, type Team, type TeamCreateOptions, type TeamInvitation, type TeamMemberProfile, type TeamUpdateOptions, type TeamUser, type User, stackAppInternalsSymbol };
|