@logto/cloud 0.2.5-70aa370 → 0.2.5-711f812

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,824 @@
1
+ // Generated by dts-bundle-generator v9.3.1
2
+
3
+ import { Json, JsonObject, RequestContext } from '@withtyped/server';
4
+ import { InferModelType } from '@withtyped/server/model';
5
+
6
+ export type WithAuthContext<Context = RequestContext> = Context & {
7
+ auth: {
8
+ /** The ID of the authenticated subject (`sub`). */
9
+ id: string;
10
+ /** The scopes that the subject has (`scope`). */
11
+ scopes: string[];
12
+ };
13
+ };
14
+ declare enum VerificationCodeType {
15
+ SignIn = "SignIn",
16
+ Register = "Register",
17
+ ForgotPassword = "ForgotPassword",
18
+ Generic = "Generic",
19
+ /** @deprecated Use `Generic` type template for sending test sms/email use case */
20
+ Test = "Test"
21
+ }
22
+ declare enum TemplateType {
23
+ /** The template for sending verification code when user is signing in. */
24
+ SignIn = "SignIn",
25
+ /** The template for sending verification code when user is registering. */
26
+ Register = "Register",
27
+ /** The template for sending verification code when user is resetting password. */
28
+ ForgotPassword = "ForgotPassword",
29
+ /** The template for sending organization invitation. */
30
+ OrganizationInvitation = "OrganizationInvitation",
31
+ /** The template for generic usage. */
32
+ Generic = "Generic"
33
+ }
34
+ declare enum OrganizationInvitationStatus {
35
+ Pending = "Pending",
36
+ Accepted = "Accepted",
37
+ Expired = "Expired",
38
+ Revoked = "Revoked"
39
+ }
40
+ /** The scopes (permissions) defined by the organization template. */
41
+ export type OrganizationScope = {
42
+ tenantId: string;
43
+ /** The globally unique identifier of the organization scope. */
44
+ id: string;
45
+ /** The organization scope's name, unique within the organization template. */
46
+ name: string;
47
+ /** A brief description of the organization scope. */
48
+ description: string | null;
49
+ };
50
+ declare enum LogtoJwtTokenKeyType {
51
+ AccessToken = "access-token",
52
+ ClientCredentials = "client-credentials"
53
+ }
54
+ /**
55
+ * The simplified organization role entity that is returned in the `roles` field
56
+ * of the organization.
57
+ */
58
+ export type OrganizationRoleEntity = {
59
+ id: string;
60
+ name: string;
61
+ };
62
+ declare enum TenantTag {
63
+ Development = "development",
64
+ Production = "production"
65
+ }
66
+ declare enum TenantRole {
67
+ /** Admin of the tenant, who has all permissions. */
68
+ Admin = "admin",
69
+ /** Collaborator of the tenant, who has permissions to operate the tenant data, but not the tenant settings. */
70
+ Collaborator = "collaborator"
71
+ }
72
+ declare enum ReservedPlanId {
73
+ Free = "free",
74
+ /**
75
+ * @deprecated
76
+ * In recent refactoring, the `hobby` plan is now treated as the `pro` plan.
77
+ * Only use this plan ID to check if a plan is a `pro` plan or not.
78
+ * This plan ID will be renamed to `pro` after legacy Stripe data is migrated by @darcyYe
79
+ *
80
+ * Todo @darcyYe:
81
+ * - LOG-7846: Rename `hobby` to `pro` and `pro` to `legacy-pro`
82
+ * - LOG-8339: Migrate legacy Stripe data
83
+ */
84
+ Hobby = "hobby",
85
+ Pro = "pro",
86
+ /**
87
+ * @deprecated
88
+ * Should not use this plan ID, we only use this tag as a record for the legacy `pro` plan since we will rename the `hobby` plan to be `pro`.
89
+ */
90
+ GrandfatheredPro = "grandfathered-pro",
91
+ Development = "dev",
92
+ /**
93
+ * This plan ID is reserved for Admin tenant.
94
+ * In our new pricing model, we plan to add a special plan for Admin tenant, previously, admin tenant is using the `pro` plan, which is not suitable.
95
+ */
96
+ Admin = "admin"
97
+ }
98
+ declare enum LogtoSkuType {
99
+ Basic = "Basic",
100
+ AddOn = "AddOn"
101
+ }
102
+ declare const AffiliateProperties: import("@withtyped/server/lib/model/index.js").default<"affiliate_properties", {
103
+ createdAt: Date;
104
+ affiliateId: string;
105
+ type: "hostname" | "query";
106
+ value: string;
107
+ }, "createdAt", "createdAt">;
108
+ export type AffiliateProperty = InferModelType<typeof AffiliateProperties>;
109
+ declare const Affiliates: import("@withtyped/server/lib/model/index.js").default<"affiliates", {
110
+ name: string;
111
+ createdAt: Date;
112
+ id: string;
113
+ }, "id" | "createdAt", "id" | "createdAt">;
114
+ export type Affiliate = InferModelType<typeof Affiliates>;
115
+ declare enum RegionName {
116
+ EU = "EU",
117
+ US = "US"
118
+ }
119
+ export type AffiliateData = Affiliate & {
120
+ properties: Array<Pick<AffiliateProperty, "type" | "value">>;
121
+ };
122
+ declare const router: import("@withtyped/server").Router<RequestContext, WithAuthContext<Omit<import("@withtyped/server").BaseContext & {
123
+ request: {
124
+ id?: string | undefined;
125
+ method?: import("@withtyped/server").RequestMethod | undefined;
126
+ headers: import("http").IncomingHttpHeaders;
127
+ url: URL;
128
+ body?: unknown;
129
+ };
130
+ }, "request"> & {
131
+ request: Record<string, unknown> & {
132
+ id?: string | undefined;
133
+ method?: import("@withtyped/server").RequestMethod | undefined;
134
+ headers: import("http").IncomingHttpHeaders;
135
+ url: URL;
136
+ body?: unknown;
137
+ } & {
138
+ body?: Json | undefined;
139
+ bodyRaw?: Buffer | undefined;
140
+ };
141
+ }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
142
+ patch: {
143
+ "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
144
+ name?: string | undefined;
145
+ }, {
146
+ id: string;
147
+ name: string;
148
+ createdAt: Date;
149
+ usage: {
150
+ activeUsers: number;
151
+ cost: number;
152
+ tokenUsage: number;
153
+ };
154
+ indicator: string;
155
+ isSuspended: boolean;
156
+ planId: string;
157
+ subscription: {
158
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
159
+ planId: string;
160
+ currentPeriodStart: Date;
161
+ currentPeriodEnd: Date;
162
+ id?: string | undefined;
163
+ };
164
+ regionName: RegionName;
165
+ tag: TenantTag;
166
+ openInvoices: {
167
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
168
+ id: string;
169
+ createdAt: Date;
170
+ updatedAt: Date;
171
+ customerId: string | null;
172
+ billingReason: string | null;
173
+ periodStart: Date;
174
+ periodEnd: Date;
175
+ amountDue: number;
176
+ amountPaid: number;
177
+ subscriptionId: string | null;
178
+ hostedInvoiceUrl: string | null;
179
+ invoicePdf: string | null;
180
+ }[];
181
+ }>;
182
+ };
183
+ options: {};
184
+ get: {
185
+ "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
186
+ id: string;
187
+ name: string;
188
+ createdAt: Date;
189
+ usage: {
190
+ activeUsers: number;
191
+ cost: number;
192
+ tokenUsage: number;
193
+ };
194
+ indicator: string;
195
+ isSuspended: boolean;
196
+ planId: string;
197
+ subscription: {
198
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
199
+ planId: string;
200
+ currentPeriodStart: Date;
201
+ currentPeriodEnd: Date;
202
+ id?: string | undefined;
203
+ };
204
+ regionName: RegionName;
205
+ tag: TenantTag;
206
+ openInvoices: {
207
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
208
+ id: string;
209
+ createdAt: Date;
210
+ updatedAt: Date;
211
+ customerId: string | null;
212
+ billingReason: string | null;
213
+ periodStart: Date;
214
+ periodEnd: Date;
215
+ amountDue: number;
216
+ amountPaid: number;
217
+ subscriptionId: string | null;
218
+ hostedInvoiceUrl: string | null;
219
+ invoicePdf: string | null;
220
+ }[];
221
+ }[]>;
222
+ };
223
+ post: {
224
+ "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
225
+ name?: string | undefined;
226
+ tag?: TenantTag | undefined;
227
+ regionName?: RegionName | undefined;
228
+ }, {
229
+ id: string;
230
+ name: string;
231
+ createdAt: Date;
232
+ usage: {
233
+ activeUsers: number;
234
+ cost: number;
235
+ tokenUsage: number;
236
+ };
237
+ indicator: string;
238
+ isSuspended: boolean;
239
+ planId: string;
240
+ subscription: {
241
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
242
+ planId: string;
243
+ currentPeriodStart: Date;
244
+ currentPeriodEnd: Date;
245
+ id?: string | undefined;
246
+ };
247
+ regionName: RegionName;
248
+ tag: TenantTag;
249
+ openInvoices: {
250
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
251
+ id: string;
252
+ createdAt: Date;
253
+ updatedAt: Date;
254
+ customerId: string | null;
255
+ billingReason: string | null;
256
+ periodStart: Date;
257
+ periodEnd: Date;
258
+ amountDue: number;
259
+ amountPaid: number;
260
+ subscriptionId: string | null;
261
+ hostedInvoiceUrl: string | null;
262
+ invoicePdf: string | null;
263
+ }[];
264
+ }>;
265
+ };
266
+ put: {};
267
+ delete: {
268
+ "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
269
+ };
270
+ copy: {};
271
+ head: {};
272
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
273
+ patch: {};
274
+ options: {};
275
+ get: {
276
+ "/tenants/my/subscription": import("@withtyped/server").PathGuard<"/my/subscription", unknown, unknown, {
277
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
278
+ planId: string;
279
+ currentPeriodStart: Date;
280
+ currentPeriodEnd: Date;
281
+ id?: string | undefined;
282
+ }>;
283
+ } & {
284
+ "/tenants/my/subscription/quota": import("@withtyped/server").PathGuard<"/my/subscription/quota", unknown, unknown, {
285
+ mauLimit: number | null;
286
+ tokenLimit: number | null;
287
+ applicationsLimit: number | null;
288
+ machineToMachineLimit: number | null;
289
+ resourcesLimit: number | null;
290
+ scopesPerResourceLimit: number | null;
291
+ socialConnectorsLimit: number | null;
292
+ machineToMachineRolesLimit: number | null;
293
+ scopesPerRoleLimit: number | null;
294
+ hooksLimit: number | null;
295
+ auditLogsRetentionDays: number | null;
296
+ mfaEnabled: boolean;
297
+ organizationsEnabled: boolean;
298
+ thirdPartyApplicationsLimit: number | null;
299
+ tenantMembersLimit: number | null;
300
+ customJwtEnabled: boolean;
301
+ subjectTokenEnabled: boolean;
302
+ userRolesLimit: number | null;
303
+ enterpriseSsoLimit: number | null;
304
+ }>;
305
+ } & {
306
+ "/tenants/my/subscription/usage": import("@withtyped/server").PathGuard<"/my/subscription/usage", unknown, unknown, {
307
+ mauLimit: number;
308
+ tokenLimit: number;
309
+ applicationsLimit: number;
310
+ machineToMachineLimit: number;
311
+ resourcesLimit: number;
312
+ scopesPerResourceLimit: number;
313
+ socialConnectorsLimit: number;
314
+ machineToMachineRolesLimit: number;
315
+ scopesPerRoleLimit: number;
316
+ hooksLimit: number;
317
+ mfaEnabled: boolean;
318
+ organizationsEnabled: boolean;
319
+ thirdPartyApplicationsLimit: number;
320
+ tenantMembersLimit: number;
321
+ customJwtEnabled: boolean;
322
+ subjectTokenEnabled: boolean;
323
+ userRolesLimit: number;
324
+ enterpriseSsoLimit: number;
325
+ }>;
326
+ } & {
327
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, {
328
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
329
+ planId: string;
330
+ currentPeriodStart: Date;
331
+ currentPeriodEnd: Date;
332
+ id?: string | undefined;
333
+ }>;
334
+ } & {
335
+ "/tenants/:tenantId/subscription/quota": import("@withtyped/server").PathGuard<"/:tenantId/subscription/quota", unknown, unknown, {
336
+ mauLimit: number | null;
337
+ tokenLimit: number | null;
338
+ applicationsLimit: number | null;
339
+ machineToMachineLimit: number | null;
340
+ resourcesLimit: number | null;
341
+ scopesPerResourceLimit: number | null;
342
+ socialConnectorsLimit: number | null;
343
+ machineToMachineRolesLimit: number | null;
344
+ scopesPerRoleLimit: number | null;
345
+ hooksLimit: number | null;
346
+ auditLogsRetentionDays: number | null;
347
+ mfaEnabled: boolean;
348
+ organizationsEnabled: boolean;
349
+ thirdPartyApplicationsLimit: number | null;
350
+ tenantMembersLimit: number | null;
351
+ customJwtEnabled: boolean;
352
+ subjectTokenEnabled: boolean;
353
+ userRolesLimit: number | null;
354
+ enterpriseSsoLimit: number | null;
355
+ }>;
356
+ } & {
357
+ "/tenants/:tenantId/subscription/usage": import("@withtyped/server").PathGuard<"/:tenantId/subscription/usage", unknown, unknown, {
358
+ mauLimit: number;
359
+ tokenLimit: number;
360
+ applicationsLimit: number;
361
+ machineToMachineLimit: number;
362
+ resourcesLimit: number;
363
+ scopesPerResourceLimit: number;
364
+ socialConnectorsLimit: number;
365
+ machineToMachineRolesLimit: number;
366
+ scopesPerRoleLimit: number;
367
+ hooksLimit: number;
368
+ mfaEnabled: boolean;
369
+ organizationsEnabled: boolean;
370
+ thirdPartyApplicationsLimit: number;
371
+ tenantMembersLimit: number;
372
+ customJwtEnabled: boolean;
373
+ subjectTokenEnabled: boolean;
374
+ userRolesLimit: number;
375
+ enterpriseSsoLimit: number;
376
+ }>;
377
+ } & {
378
+ "/tenants/:tenantId/invoices": import("@withtyped/server").PathGuard<"/:tenantId/invoices", unknown, unknown, {
379
+ invoices: {
380
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
381
+ id: string;
382
+ createdAt: Date;
383
+ updatedAt: Date;
384
+ customerId: string | null;
385
+ billingReason: string | null;
386
+ periodStart: Date;
387
+ periodEnd: Date;
388
+ amountDue: number;
389
+ amountPaid: number;
390
+ subscriptionId: string | null;
391
+ hostedInvoiceUrl: string | null;
392
+ invoicePdf: string | null;
393
+ planName: string | null;
394
+ }[];
395
+ }>;
396
+ } & {
397
+ "/tenants/:tenantId/invoices/:invoiceId/hosted-invoice-url": import("@withtyped/server").PathGuard<"/:tenantId/invoices/:invoiceId/hosted-invoice-url", unknown, unknown, {
398
+ hostedInvoiceUrl: string;
399
+ }>;
400
+ } & {
401
+ "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
402
+ activeUsers: number;
403
+ cost: number;
404
+ tokenUsage: number;
405
+ }>;
406
+ };
407
+ post: {
408
+ "/tenants/:tenantId/stripe-customer-portal": import("@withtyped/server").PathGuard<"/:tenantId/stripe-customer-portal", unknown, {
409
+ callbackUrl?: string | undefined;
410
+ }, {
411
+ redirectUri: string;
412
+ }>;
413
+ };
414
+ put: {};
415
+ delete: {
416
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
417
+ };
418
+ copy: {};
419
+ head: {};
420
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
421
+ patch: {};
422
+ options: {};
423
+ get: {
424
+ "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
425
+ from?: string | undefined;
426
+ }, unknown, {
427
+ count: number;
428
+ }>;
429
+ };
430
+ post: {
431
+ "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
432
+ data: {
433
+ type: TemplateType | VerificationCodeType;
434
+ payload: {
435
+ code?: string | undefined;
436
+ link?: string | undefined;
437
+ } & Record<string, string> & {
438
+ senderName?: string | undefined;
439
+ companyInformation?: string | undefined;
440
+ appLogo?: string | undefined;
441
+ };
442
+ to: string;
443
+ };
444
+ }, unknown>;
445
+ } & {
446
+ "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
447
+ data: {
448
+ type: TemplateType | VerificationCodeType;
449
+ to: string;
450
+ payload: {
451
+ code?: string | undefined;
452
+ link?: string | undefined;
453
+ } & Record<string, string>;
454
+ };
455
+ }, unknown>;
456
+ } & {
457
+ "/services/custom-jwt": import("@withtyped/server").PathGuard<"/custom-jwt", {
458
+ isTest?: string | undefined;
459
+ }, {
460
+ context: Record<string, Json>;
461
+ script: string;
462
+ tokenType: LogtoJwtTokenKeyType.AccessToken;
463
+ token: Record<string, Json>;
464
+ environmentVariables?: Record<string, string> | undefined;
465
+ } | {
466
+ script: string;
467
+ tokenType: LogtoJwtTokenKeyType.ClientCredentials;
468
+ token: Record<string, Json>;
469
+ environmentVariables?: Record<string, string> | undefined;
470
+ }, Record<string, unknown>>;
471
+ };
472
+ put: {
473
+ "/services/custom-jwt/worker": import("@withtyped/server").PathGuard<"/custom-jwt/worker", unknown, {
474
+ "jwt.accessToken"?: {
475
+ production?: string | undefined;
476
+ test?: string | undefined;
477
+ } | undefined;
478
+ "jwt.clientCredentials"?: {
479
+ production?: string | undefined;
480
+ test?: string | undefined;
481
+ } | undefined;
482
+ }, unknown>;
483
+ };
484
+ delete: {
485
+ "/services/custom-jwt/worker": import("@withtyped/server").PathGuard<"/custom-jwt/worker", unknown, unknown, unknown>;
486
+ };
487
+ copy: {};
488
+ head: {};
489
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
490
+ patch: {};
491
+ options: {};
492
+ get: {
493
+ "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
494
+ id: string;
495
+ createdAt: Date;
496
+ name: string;
497
+ updatedAt: Date;
498
+ quota: {
499
+ mauLimit: number | null;
500
+ tokenLimit: number | null;
501
+ applicationsLimit: number | null;
502
+ machineToMachineLimit: number | null;
503
+ resourcesLimit: number | null;
504
+ scopesPerResourceLimit: number | null;
505
+ customDomainEnabled: boolean;
506
+ omniSignInEnabled: boolean;
507
+ builtInEmailConnectorEnabled: boolean;
508
+ socialConnectorsLimit: number | null;
509
+ standardConnectorsLimit: number | null;
510
+ rolesLimit: number | null;
511
+ machineToMachineRolesLimit: number | null;
512
+ scopesPerRoleLimit: number | null;
513
+ hooksLimit: number | null;
514
+ auditLogsRetentionDays: number | null;
515
+ mfaEnabled: boolean;
516
+ organizationsEnabled: boolean;
517
+ ssoEnabled: boolean;
518
+ thirdPartyApplicationsLimit: number | null;
519
+ tenantMembersLimit: number | null;
520
+ customJwtEnabled: boolean;
521
+ subjectTokenEnabled: boolean;
522
+ };
523
+ stripeProducts: {
524
+ type: "flat" | "tier1" | "tier2" | "tier3";
525
+ id: string;
526
+ name: string;
527
+ price: {
528
+ id: string;
529
+ unitAmountDecimal: string;
530
+ quantity?: 1 | undefined;
531
+ unitAmount?: number | null | undefined;
532
+ };
533
+ description?: string | undefined;
534
+ }[];
535
+ }[]>;
536
+ };
537
+ post: {};
538
+ put: {};
539
+ delete: {};
540
+ copy: {};
541
+ head: {};
542
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
543
+ patch: {};
544
+ options: {};
545
+ get: {
546
+ "/skus": import("@withtyped/server").PathGuard<"/", {
547
+ isBasicSkuOnly?: string | undefined;
548
+ }, unknown, {
549
+ id: string;
550
+ createdAt: Date;
551
+ type: LogtoSkuType;
552
+ updatedAt: Date;
553
+ quota: {
554
+ mauLimit?: number | null | undefined;
555
+ applicationsLimit?: number | null | undefined;
556
+ thirdPartyApplicationsLimit?: number | null | undefined;
557
+ scopesPerResourceLimit?: number | null | undefined;
558
+ socialConnectorsLimit?: number | null | undefined;
559
+ userRolesLimit?: number | null | undefined;
560
+ machineToMachineRolesLimit?: number | null | undefined;
561
+ scopesPerRoleLimit?: number | null | undefined;
562
+ hooksLimit?: number | null | undefined;
563
+ auditLogsRetentionDays?: number | null | undefined;
564
+ customJwtEnabled?: boolean | undefined;
565
+ subjectTokenEnabled?: boolean | undefined;
566
+ tokenLimit?: number | null | undefined;
567
+ machineToMachineLimit?: number | null | undefined;
568
+ resourcesLimit?: number | null | undefined;
569
+ enterpriseSsoLimit?: number | null | undefined;
570
+ tenantMembersLimit?: number | null | undefined;
571
+ mfaEnabled?: boolean | undefined;
572
+ organizationsEnabled?: boolean | undefined;
573
+ };
574
+ }[]>;
575
+ };
576
+ post: {};
577
+ put: {};
578
+ delete: {};
579
+ copy: {};
580
+ head: {};
581
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
582
+ patch: {};
583
+ options: {};
584
+ get: {
585
+ "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
586
+ id: string;
587
+ createdAt: Date;
588
+ userId: string;
589
+ status: "open" | "complete" | "expired";
590
+ tenantId: string | null;
591
+ updatedAt: Date;
592
+ planId: string;
593
+ }>;
594
+ };
595
+ post: {
596
+ "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
597
+ planId: ReservedPlanId;
598
+ successCallbackUrl: string;
599
+ tenantId?: string | undefined;
600
+ cancelCallbackUrl?: string | undefined;
601
+ tenantTag?: TenantTag | undefined;
602
+ tenantName?: string | undefined;
603
+ tenantRegionName?: RegionName | undefined;
604
+ }, {
605
+ sessionId: string;
606
+ redirectUri?: string | null | undefined;
607
+ }>;
608
+ };
609
+ put: {};
610
+ delete: {};
611
+ copy: {};
612
+ head: {};
613
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
614
+ patch: {};
615
+ options: {};
616
+ get: {
617
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
618
+ };
619
+ post: {
620
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
621
+ name: string;
622
+ }, {
623
+ id: string;
624
+ createdAt: Date;
625
+ name: string;
626
+ }>;
627
+ } & {
628
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
629
+ type: "hostname" | "query";
630
+ value: string;
631
+ }, {
632
+ createdAt: Date;
633
+ affiliateId: string;
634
+ type: "hostname" | "query";
635
+ value: string;
636
+ }>;
637
+ };
638
+ put: {};
639
+ delete: {
640
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
641
+ type: "hostname" | "query";
642
+ value: string;
643
+ }, unknown>;
644
+ };
645
+ copy: {};
646
+ head: {};
647
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
648
+ patch: {};
649
+ options: {};
650
+ get: {};
651
+ post: {
652
+ "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
653
+ createdAt: string;
654
+ userId: string;
655
+ hostname?: string | undefined;
656
+ query?: string | undefined;
657
+ }, {
658
+ id: string;
659
+ createdAt: Date;
660
+ affiliateId: string | null;
661
+ userId: string;
662
+ createdVia: {
663
+ createdAt: string;
664
+ hostname?: string | undefined;
665
+ query?: string | undefined;
666
+ };
667
+ }>;
668
+ };
669
+ put: {};
670
+ delete: {};
671
+ copy: {};
672
+ head: {};
673
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
674
+ patch: {
675
+ "/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:invitationId/status", unknown, {
676
+ status: OrganizationInvitationStatus.Accepted;
677
+ }, unknown>;
678
+ };
679
+ options: {};
680
+ get: {
681
+ "/invitations": import("@withtyped/server").PathGuard<"/", unknown, unknown, ({
682
+ id: string;
683
+ createdAt: number;
684
+ status: OrganizationInvitationStatus;
685
+ tenantId: string;
686
+ updatedAt: number;
687
+ inviterId: string | null;
688
+ invitee: string;
689
+ acceptedUserId: string | null;
690
+ organizationId: string;
691
+ expiresAt: number;
692
+ organizationRoles: OrganizationRoleEntity[];
693
+ } & {
694
+ tenantName: string;
695
+ tenantTag: TenantTag;
696
+ })[]>;
697
+ } & {
698
+ "/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:invitationId", unknown, unknown, {
699
+ id: string;
700
+ createdAt: number;
701
+ status: OrganizationInvitationStatus;
702
+ tenantId: string;
703
+ updatedAt: number;
704
+ inviterId: string | null;
705
+ invitee: string;
706
+ acceptedUserId: string | null;
707
+ organizationId: string;
708
+ expiresAt: number;
709
+ organizationRoles: OrganizationRoleEntity[];
710
+ }>;
711
+ };
712
+ post: {};
713
+ put: {};
714
+ delete: {};
715
+ copy: {};
716
+ head: {};
717
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
718
+ patch: {};
719
+ options: {};
720
+ get: {};
721
+ post: {};
722
+ put: {};
723
+ delete: {
724
+ "/me": import("@withtyped/server").PathGuard<"/", unknown, unknown, unknown>;
725
+ };
726
+ copy: {};
727
+ head: {};
728
+ }, "/api">>, "/api">;
729
+ export declare const tenantAuthRouter: import("@withtyped/server").Router<RequestContext, import("@withtyped/server").WithBodyContext<import("@withtyped/server").BaseContext & {
730
+ request: {
731
+ id?: string | undefined;
732
+ method?: import("@withtyped/server").RequestMethod | undefined;
733
+ headers: import("http").IncomingHttpHeaders;
734
+ url: URL;
735
+ body?: unknown;
736
+ };
737
+ }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
738
+ patch: {
739
+ "/:tenantId/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/status", unknown, {
740
+ status: OrganizationInvitationStatus.Revoked;
741
+ }, {
742
+ id: string;
743
+ createdAt: number;
744
+ status: OrganizationInvitationStatus;
745
+ tenantId: string;
746
+ updatedAt: number;
747
+ inviterId: string | null;
748
+ invitee: string;
749
+ acceptedUserId: string | null;
750
+ organizationId: string;
751
+ expiresAt: number;
752
+ organizationRoles: OrganizationRoleEntity[];
753
+ }>;
754
+ };
755
+ options: {};
756
+ get: {
757
+ "/:tenantId/members": import("@withtyped/server").PathGuard<"/:tenantId/members", unknown, unknown, {
758
+ id: string;
759
+ name: string | null;
760
+ username: string | null;
761
+ primaryEmail: string | null;
762
+ primaryPhone: string | null;
763
+ avatar: string | null;
764
+ organizationRoles: OrganizationRoleEntity[];
765
+ }[]>;
766
+ } & {
767
+ "/:tenantId/members/:userId/scopes": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/scopes", unknown, unknown, OrganizationScope[]>;
768
+ } & {
769
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, unknown, ({
770
+ id: string;
771
+ createdAt: number;
772
+ status: OrganizationInvitationStatus;
773
+ tenantId: string;
774
+ updatedAt: number;
775
+ inviterId: string | null;
776
+ invitee: string;
777
+ acceptedUserId: string | null;
778
+ organizationId: string;
779
+ expiresAt: number;
780
+ organizationRoles: OrganizationRoleEntity[];
781
+ } & {
782
+ inviterName?: string | undefined;
783
+ })[]>;
784
+ };
785
+ post: {
786
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, {
787
+ invitee: string;
788
+ roleName: TenantRole;
789
+ expiresAt?: number | undefined;
790
+ }, {
791
+ id: string;
792
+ createdAt: number;
793
+ status: OrganizationInvitationStatus;
794
+ tenantId: string;
795
+ updatedAt: number;
796
+ inviterId: string | null;
797
+ invitee: string;
798
+ acceptedUserId: string | null;
799
+ organizationId: string;
800
+ expiresAt: number;
801
+ organizationRoles: OrganizationRoleEntity[];
802
+ }>;
803
+ } & {
804
+ "/:tenantId/invitations/:invitationId/message": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/message", unknown, unknown, unknown>;
805
+ };
806
+ put: {
807
+ "/:tenantId/members/:userId/roles": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/roles", unknown, {
808
+ roleName: TenantRole;
809
+ }, unknown>;
810
+ };
811
+ delete: {
812
+ "/:tenantId/members/:userId": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId", unknown, unknown, unknown>;
813
+ } & {
814
+ "/:tenantId/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId", unknown, unknown, unknown>;
815
+ };
816
+ copy: {};
817
+ head: {};
818
+ }, "/api/tenants">>, "/api/tenants">;
819
+
820
+ export {
821
+ router as default,
822
+ };
823
+
824
+ export {};
package/package.json CHANGED
@@ -1,40 +1,39 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-70aa370",
3
+ "version": "0.2.5-711f812",
4
4
  "description": "Logto Cloud service.",
5
5
  "main": "build/index.js",
6
6
  "author": "Silverhand Inc. <contact@silverhand.io>",
7
7
  "license": "Elastic-2.0",
8
8
  "type": "module",
9
9
  "files": [
10
- "build"
10
+ "lib"
11
11
  ],
12
12
  "exports": {
13
- "./routes": "./build/routes/index.js"
13
+ "./routes": "./lib/routes/index.js"
14
14
  },
15
15
  "imports": {
16
16
  "#src/*": "./build/*"
17
17
  },
18
18
  "devDependencies": {
19
- "@silverhand/eslint-config": "3.0.1",
20
- "@silverhand/jest-config": "3.0.0",
21
- "@silverhand/ts-config": "3.0.0",
19
+ "@silverhand/eslint-config": "6.0.1",
20
+ "@silverhand/ts-config": "6.0.0",
22
21
  "@types/accepts": "^1.3.5",
23
22
  "@types/http-proxy": "^1.17.9",
24
- "@types/jest": "^29.4.0",
25
23
  "@types/mime-types": "^2.1.1",
26
- "@types/node": "^18.11.18",
24
+ "@types/node": "^20.0.0",
27
25
  "@types/yargs": "^17.0.24",
28
- "dts-bundle-generator": "^8.0.1",
29
- "eslint": "^8.21.0",
30
- "jest": "^29.5.0",
31
- "lint-staged": "^13.0.0",
26
+ "dts-bundle-generator": "^9.3.1",
27
+ "eslint": "^8.57.0",
28
+ "lint-staged": "^15.0.0",
32
29
  "nodemon": "^3.0.0",
33
- "prettier": "^2.8.1",
34
- "typescript": "^5.0.0"
30
+ "prettier": "^3.0.0",
31
+ "typescript": "^5.3.3",
32
+ "vite-tsconfig-paths": "^4.3.1",
33
+ "vitest": "^1.5.0"
35
34
  },
36
35
  "engines": {
37
- "node": "^18.12.0"
36
+ "node": "^20.9.0"
38
37
  },
39
38
  "eslintConfig": {
40
39
  "extends": "@silverhand",
@@ -50,22 +49,19 @@
50
49
  "access": "public"
51
50
  },
52
51
  "dependencies": {
53
- "@silverhand/essentials": "^2.7.0",
54
- "@withtyped/server": "^0.12.7"
52
+ "@silverhand/essentials": "^2.9.1",
53
+ "@withtyped/server": "^0.13.6"
55
54
  },
56
55
  "scripts": {
57
56
  "precommit": "lint-staged",
58
- "build": "rm -rf build/ && tsc -p tsconfig.build.json",
57
+ "build": "rm -rf build/ && tsc -p tsconfig.build.json && pnpm build:lib",
59
58
  "//": "It is not used to build the service itself.",
60
- "build:lib": "rm -rf build/ && dts-bundle-generator src/routes/index.ts --project tsconfig.build.json -o build/routes/index.d.ts",
61
- "build:test": "rm -rf build/ && tsc -p tsconfig.test.json --sourcemap",
59
+ "build:lib": "rm -rf lib/ && dts-bundle-generator src/routes/index.ts --project tsconfig.build.lib.json -o lib/routes/index.d.ts",
62
60
  "lint": "eslint --ext .ts src",
63
61
  "lint:report": "pnpm lint --format json --output-file report.json",
64
62
  "dev": "rm -rf build/ && nodemon",
65
63
  "start": "NODE_ENV=production node .",
66
- "test:only": "NODE_OPTIONS=\"--experimental-vm-modules --max_old_space_size=4096\" jest --logHeapUsage",
67
- "test": "pnpm build:test && pnpm test:only && pnpm build:lib && pnpm test:types",
68
- "test:ci": "pnpm test:only --coverage --silent",
64
+ "test": "vitest && pnpm build:lib && pnpm test:types",
69
65
  "test:types": "tsc -p tsconfig.test.types.json",
70
66
  "cli": "node ./build/cli/index.js"
71
67
  }
@@ -1,325 +0,0 @@
1
- // Generated by dts-bundle-generator v8.0.1
2
-
3
- import { RequestContext } from '@withtyped/server';
4
- import { InferModelType } from '@withtyped/server/model';
5
-
6
- export type WithAuthContext<Context = RequestContext> = Context & {
7
- auth: {
8
- id: string;
9
- scopes: string[];
10
- };
11
- };
12
- declare enum TenantTag {
13
- Development = "development",
14
- Staging = "staging",
15
- Production = "production"
16
- }
17
- declare enum VerificationCodeType {
18
- SignIn = "SignIn",
19
- Register = "Register",
20
- ForgotPassword = "ForgotPassword",
21
- /** @deprecated */
22
- Continue = "Continue",
23
- Generic = "Generic",
24
- /** @deprecated Use `Generic` type template for sending test sms/email use case */
25
- Test = "Test"
26
- }
27
- declare const AffiliateProperties: import("@withtyped/server/model").default<"affiliate_properties", {
28
- createdAt: Date;
29
- affiliateId: string;
30
- type: "hostname" | "query";
31
- value: string;
32
- }, "createdAt", "createdAt">;
33
- export type AffiliateProperty = InferModelType<typeof AffiliateProperties>;
34
- declare const Affiliates: import("@withtyped/server/model").default<"affiliates", {
35
- id: string;
36
- createdAt: Date;
37
- name: string;
38
- }, "createdAt" | "id", "createdAt" | "id">;
39
- export type Affiliate = InferModelType<typeof Affiliates>;
40
- export type AffiliateData = Affiliate & {
41
- properties: Array<Pick<AffiliateProperty, "type" | "value">>;
42
- };
43
- declare const router: import("@withtyped/server").Router<WithAuthContext, import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
44
- options: {};
45
- patch: {
46
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
47
- name?: string | undefined;
48
- tag?: TenantTag | undefined;
49
- }, {
50
- id: string;
51
- name: string;
52
- indicator: string;
53
- planId: string;
54
- tag: TenantTag;
55
- }>;
56
- };
57
- get: {
58
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
59
- id: string;
60
- name: string;
61
- indicator: string;
62
- planId: string;
63
- tag: TenantTag;
64
- }[]>;
65
- } & {
66
- "/tenants/my/subscription": import("@withtyped/server").PathGuard<"/my/subscription", unknown, unknown, {
67
- status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
68
- planId: string;
69
- currentPeriodStart: Date;
70
- currentPeriodEnd: Date;
71
- }>;
72
- } & {
73
- "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, {
74
- status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
75
- planId: string;
76
- currentPeriodStart: Date;
77
- currentPeriodEnd: Date;
78
- }>;
79
- } & {
80
- "/tenants/:tenantId/invoices": import("@withtyped/server").PathGuard<"/:tenantId/invoices", unknown, unknown, {
81
- invoices: {
82
- status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
83
- createdAt: Date;
84
- id: string;
85
- updatedAt: Date;
86
- customerId: string | null;
87
- billingReason: string | null;
88
- periodStart: Date;
89
- periodEnd: Date;
90
- amountDue: number;
91
- amountPaid: number;
92
- subscriptionId: string | null;
93
- hostedInvoiceUrl: string | null;
94
- invoicePdf: string | null;
95
- planName: string | null;
96
- }[];
97
- }>;
98
- } & {
99
- "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
100
- activeUsers: number;
101
- cost: number;
102
- }>;
103
- };
104
- post: {
105
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
106
- name?: string | undefined;
107
- tag?: TenantTag | undefined;
108
- }, {
109
- id: string;
110
- name: string;
111
- indicator: string;
112
- planId: string;
113
- tag: TenantTag;
114
- }>;
115
- } & {
116
- "/tenants/:tenantId/stripe-customer-portal": import("@withtyped/server").PathGuard<"/:tenantId/stripe-customer-portal", unknown, {
117
- callbackUrl?: string | undefined;
118
- } | undefined, {
119
- redirectUri: string;
120
- }>;
121
- };
122
- put: {};
123
- head: {};
124
- delete: {
125
- "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
126
- } & {
127
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
128
- };
129
- copy: {};
130
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
131
- options: {};
132
- patch: {};
133
- get: {
134
- "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
135
- from?: string | undefined;
136
- }, unknown, {
137
- count: number;
138
- }>;
139
- };
140
- post: {
141
- "/services/send-email": import("@withtyped/server").PathGuard<"/send-email", unknown, {
142
- data: {
143
- type: VerificationCodeType;
144
- to: string;
145
- payload: {
146
- senderName?: string | undefined;
147
- companyInformation?: string | undefined;
148
- appLogo?: string | undefined;
149
- code: string;
150
- };
151
- };
152
- }, unknown>;
153
- } & {
154
- "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
155
- data: {
156
- type: VerificationCodeType;
157
- to: string;
158
- payload: {
159
- senderName?: string | undefined;
160
- companyInformation?: string | undefined;
161
- appLogo?: string | undefined;
162
- code: string;
163
- };
164
- };
165
- }, unknown>;
166
- } & {
167
- "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
168
- data: {
169
- type: VerificationCodeType;
170
- to: string;
171
- payload: {
172
- senderName?: string | undefined;
173
- companyInformation?: string | undefined;
174
- appLogo?: string | undefined;
175
- code: string;
176
- };
177
- };
178
- }, unknown>;
179
- };
180
- put: {};
181
- head: {};
182
- delete: {};
183
- copy: {};
184
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
185
- options: {};
186
- patch: {};
187
- get: {
188
- "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
189
- createdAt: Date;
190
- id: string;
191
- name: string;
192
- quota: {
193
- mauLimit: number | null;
194
- applicationsLimit: number;
195
- machineToMachineLimit: number;
196
- resourcesLimit: number;
197
- scopesPerResourceLimit: number;
198
- customDomainEnabled: boolean;
199
- omniSignInEnabled: boolean;
200
- builtInEmailConnectorEnabled: boolean;
201
- socialConnectorsLimit: number | null;
202
- standardConnectorsLimit: number;
203
- rolesLimit: number;
204
- scopesPerRoleLimit: number | null;
205
- hooksLimit: number;
206
- auditLogsRetentionDays: number;
207
- };
208
- stripeProducts: {
209
- description?: string | undefined;
210
- type: "flat" | "tier1" | "tier2" | "tier3";
211
- id: string;
212
- name: string;
213
- price: {
214
- quantity?: 1 | undefined;
215
- unitAmount?: number | null | undefined;
216
- id: string;
217
- unitAmountDecimal: string;
218
- };
219
- }[];
220
- updatedAt: Date;
221
- }[]>;
222
- };
223
- post: {};
224
- put: {};
225
- head: {};
226
- delete: {};
227
- copy: {};
228
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
229
- options: {};
230
- patch: {};
231
- get: {
232
- "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
233
- status: "open" | "complete" | "expired";
234
- createdAt: Date;
235
- id: string;
236
- userId: string;
237
- updatedAt: Date;
238
- tenantId: string | null;
239
- planId: string;
240
- }>;
241
- };
242
- post: {
243
- "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
244
- tenantId?: string | undefined;
245
- tenantTag?: TenantTag | undefined;
246
- tenantName?: string | undefined;
247
- cancelCallbackUrl?: string | undefined;
248
- planId: string;
249
- successCallbackUrl: string;
250
- }, {
251
- redirectUri?: string | null | undefined;
252
- sessionId: string;
253
- }>;
254
- };
255
- put: {};
256
- head: {};
257
- delete: {};
258
- copy: {};
259
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
260
- options: {};
261
- patch: {};
262
- get: {
263
- "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
264
- };
265
- post: {
266
- "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
267
- name: string;
268
- }, {
269
- createdAt: Date;
270
- id: string;
271
- name: string;
272
- }>;
273
- } & {
274
- "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
275
- value: string;
276
- type: "hostname" | "query";
277
- }, {
278
- value: string;
279
- type: "hostname" | "query";
280
- createdAt: Date;
281
- affiliateId: string;
282
- }>;
283
- };
284
- put: {};
285
- head: {};
286
- delete: {
287
- "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
288
- value: string;
289
- type: "hostname" | "query";
290
- }, unknown>;
291
- };
292
- copy: {};
293
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
294
- options: {};
295
- patch: {};
296
- get: {};
297
- post: {
298
- "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
299
- hostname?: string | undefined;
300
- query?: string | undefined;
301
- createdAt: string;
302
- userId: string;
303
- }, {
304
- createdAt: Date;
305
- id: string;
306
- affiliateId: string | null;
307
- userId: string;
308
- createdVia: {
309
- hostname?: string | undefined;
310
- query?: string | undefined;
311
- createdAt: string;
312
- };
313
- }>;
314
- };
315
- put: {};
316
- head: {};
317
- delete: {};
318
- copy: {};
319
- }, "/api">>, "/api">;
320
-
321
- export {
322
- router as default,
323
- };
324
-
325
- export {};