@logto/cloud 0.2.5-70aa370 → 0.2.5-72891e6

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,651 @@
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 const AffiliateProperties: import("@withtyped/server/lib/model/index.js").default<"affiliate_properties", {
73
+ createdAt: Date;
74
+ affiliateId: string;
75
+ type: "hostname" | "query";
76
+ value: string;
77
+ }, "createdAt", "createdAt">;
78
+ export type AffiliateProperty = InferModelType<typeof AffiliateProperties>;
79
+ declare const Affiliates: import("@withtyped/server/lib/model/index.js").default<"affiliates", {
80
+ name: string;
81
+ createdAt: Date;
82
+ id: string;
83
+ }, "id" | "createdAt", "id" | "createdAt">;
84
+ export type Affiliate = InferModelType<typeof Affiliates>;
85
+ declare enum RegionName {
86
+ EU = "EU",
87
+ US = "US"
88
+ }
89
+ export type AffiliateData = Affiliate & {
90
+ properties: Array<Pick<AffiliateProperty, "type" | "value">>;
91
+ };
92
+ declare const router: import("@withtyped/server").Router<RequestContext, WithAuthContext<Omit<import("@withtyped/server").BaseContext & {
93
+ request: {
94
+ id?: string | undefined;
95
+ method?: import("@withtyped/server").RequestMethod | undefined;
96
+ headers: import("http").IncomingHttpHeaders;
97
+ url: URL;
98
+ body?: unknown;
99
+ };
100
+ }, "request"> & {
101
+ request: Record<string, unknown> & {
102
+ id?: string | undefined;
103
+ method?: import("@withtyped/server").RequestMethod | undefined;
104
+ headers: import("http").IncomingHttpHeaders;
105
+ url: URL;
106
+ body?: unknown;
107
+ } & {
108
+ body?: Json | undefined;
109
+ bodyRaw?: Buffer | undefined;
110
+ };
111
+ }>, 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<{
112
+ patch: {
113
+ "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
114
+ name?: string | undefined;
115
+ }, {
116
+ id: string;
117
+ name: string;
118
+ createdAt: Date;
119
+ usage: {
120
+ activeUsers: number;
121
+ cost: number;
122
+ tokenUsage: number;
123
+ };
124
+ indicator: string;
125
+ isSuspended: boolean;
126
+ planId: string;
127
+ subscription: {
128
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
129
+ planId: string;
130
+ currentPeriodStart: Date;
131
+ currentPeriodEnd: Date;
132
+ };
133
+ regionName: RegionName;
134
+ tag: TenantTag;
135
+ openInvoices: {
136
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
137
+ id: string;
138
+ createdAt: Date;
139
+ updatedAt: Date;
140
+ customerId: string | null;
141
+ billingReason: string | null;
142
+ periodStart: Date;
143
+ periodEnd: Date;
144
+ amountDue: number;
145
+ amountPaid: number;
146
+ subscriptionId: string | null;
147
+ hostedInvoiceUrl: string | null;
148
+ invoicePdf: string | null;
149
+ }[];
150
+ }>;
151
+ };
152
+ options: {};
153
+ get: {
154
+ "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
155
+ id: string;
156
+ name: string;
157
+ createdAt: Date;
158
+ usage: {
159
+ activeUsers: number;
160
+ cost: number;
161
+ tokenUsage: number;
162
+ };
163
+ indicator: string;
164
+ isSuspended: boolean;
165
+ planId: string;
166
+ subscription: {
167
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
168
+ planId: string;
169
+ currentPeriodStart: Date;
170
+ currentPeriodEnd: Date;
171
+ };
172
+ regionName: RegionName;
173
+ tag: TenantTag;
174
+ openInvoices: {
175
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
176
+ id: string;
177
+ createdAt: Date;
178
+ updatedAt: Date;
179
+ customerId: string | null;
180
+ billingReason: string | null;
181
+ periodStart: Date;
182
+ periodEnd: Date;
183
+ amountDue: number;
184
+ amountPaid: number;
185
+ subscriptionId: string | null;
186
+ hostedInvoiceUrl: string | null;
187
+ invoicePdf: string | null;
188
+ }[];
189
+ }[]>;
190
+ };
191
+ post: {
192
+ "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
193
+ name?: string | undefined;
194
+ tag?: TenantTag | undefined;
195
+ regionName?: RegionName | undefined;
196
+ }, {
197
+ id: string;
198
+ name: string;
199
+ createdAt: Date;
200
+ usage: {
201
+ activeUsers: number;
202
+ cost: number;
203
+ tokenUsage: number;
204
+ };
205
+ indicator: string;
206
+ isSuspended: boolean;
207
+ planId: string;
208
+ subscription: {
209
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
210
+ planId: string;
211
+ currentPeriodStart: Date;
212
+ currentPeriodEnd: Date;
213
+ };
214
+ regionName: RegionName;
215
+ tag: TenantTag;
216
+ openInvoices: {
217
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
218
+ id: string;
219
+ createdAt: Date;
220
+ updatedAt: Date;
221
+ customerId: string | null;
222
+ billingReason: string | null;
223
+ periodStart: Date;
224
+ periodEnd: Date;
225
+ amountDue: number;
226
+ amountPaid: number;
227
+ subscriptionId: string | null;
228
+ hostedInvoiceUrl: string | null;
229
+ invoicePdf: string | null;
230
+ }[];
231
+ }>;
232
+ };
233
+ put: {};
234
+ delete: {
235
+ "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
236
+ };
237
+ copy: {};
238
+ head: {};
239
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
240
+ patch: {};
241
+ options: {};
242
+ get: {
243
+ "/tenants/my/subscription": import("@withtyped/server").PathGuard<"/my/subscription", unknown, unknown, {
244
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
245
+ planId: string;
246
+ currentPeriodStart: Date;
247
+ currentPeriodEnd: Date;
248
+ }>;
249
+ } & {
250
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, {
251
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
252
+ planId: string;
253
+ currentPeriodStart: Date;
254
+ currentPeriodEnd: Date;
255
+ }>;
256
+ } & {
257
+ "/tenants/:tenantId/invoices": import("@withtyped/server").PathGuard<"/:tenantId/invoices", unknown, unknown, {
258
+ invoices: {
259
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
260
+ id: string;
261
+ createdAt: Date;
262
+ updatedAt: Date;
263
+ customerId: string | null;
264
+ billingReason: string | null;
265
+ periodStart: Date;
266
+ periodEnd: Date;
267
+ amountDue: number;
268
+ amountPaid: number;
269
+ subscriptionId: string | null;
270
+ hostedInvoiceUrl: string | null;
271
+ invoicePdf: string | null;
272
+ planName: string | null;
273
+ }[];
274
+ }>;
275
+ } & {
276
+ "/tenants/:tenantId/invoices/:invoiceId/hosted-invoice-url": import("@withtyped/server").PathGuard<"/:tenantId/invoices/:invoiceId/hosted-invoice-url", unknown, unknown, {
277
+ hostedInvoiceUrl: string;
278
+ }>;
279
+ } & {
280
+ "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
281
+ activeUsers: number;
282
+ cost: number;
283
+ tokenUsage: number;
284
+ }>;
285
+ };
286
+ post: {
287
+ "/tenants/:tenantId/stripe-customer-portal": import("@withtyped/server").PathGuard<"/:tenantId/stripe-customer-portal", unknown, {
288
+ callbackUrl?: string | undefined;
289
+ }, {
290
+ redirectUri: string;
291
+ }>;
292
+ };
293
+ put: {};
294
+ delete: {
295
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
296
+ };
297
+ copy: {};
298
+ head: {};
299
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
300
+ patch: {};
301
+ options: {};
302
+ get: {
303
+ "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
304
+ from?: string | undefined;
305
+ }, unknown, {
306
+ count: number;
307
+ }>;
308
+ };
309
+ post: {
310
+ "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
311
+ data: {
312
+ type: TemplateType | VerificationCodeType;
313
+ payload: {
314
+ code?: string | undefined;
315
+ link?: string | undefined;
316
+ } & Record<string, string> & {
317
+ senderName?: string | undefined;
318
+ companyInformation?: string | undefined;
319
+ appLogo?: string | undefined;
320
+ };
321
+ to: string;
322
+ };
323
+ }, unknown>;
324
+ } & {
325
+ "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
326
+ data: {
327
+ type: TemplateType | VerificationCodeType;
328
+ to: string;
329
+ payload: {
330
+ code?: string | undefined;
331
+ link?: string | undefined;
332
+ } & Record<string, string>;
333
+ };
334
+ }, unknown>;
335
+ } & {
336
+ "/services/custom-jwt": import("@withtyped/server").PathGuard<"/custom-jwt", {
337
+ isTest?: string | undefined;
338
+ }, {
339
+ script: string;
340
+ tokenType: LogtoJwtTokenKeyType.AccessToken;
341
+ token: Record<string, Json>;
342
+ context: Record<string, Json>;
343
+ environmentVariables?: Record<string, string> | undefined;
344
+ } | {
345
+ script: string;
346
+ tokenType: LogtoJwtTokenKeyType.ClientCredentials;
347
+ token: Record<string, Json>;
348
+ environmentVariables?: Record<string, string> | undefined;
349
+ }, Record<string, unknown>>;
350
+ };
351
+ put: {
352
+ "/services/custom-jwt/worker": import("@withtyped/server").PathGuard<"/custom-jwt/worker", unknown, {
353
+ "jwt.accessToken"?: {
354
+ production?: string | undefined;
355
+ test?: string | undefined;
356
+ } | undefined;
357
+ "jwt.clientCredentials"?: {
358
+ production?: string | undefined;
359
+ test?: string | undefined;
360
+ } | undefined;
361
+ }, unknown>;
362
+ };
363
+ delete: {
364
+ "/services/custom-jwt/worker": import("@withtyped/server").PathGuard<"/custom-jwt/worker", unknown, unknown, unknown>;
365
+ };
366
+ copy: {};
367
+ head: {};
368
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
369
+ patch: {};
370
+ options: {};
371
+ get: {
372
+ "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
373
+ id: string;
374
+ createdAt: Date;
375
+ name: string;
376
+ updatedAt: Date;
377
+ stripeProducts: {
378
+ type: "flat" | "tier1" | "tier2" | "tier3";
379
+ id: string;
380
+ name: string;
381
+ price: {
382
+ id: string;
383
+ unitAmountDecimal: string;
384
+ quantity?: 1 | undefined;
385
+ unitAmount?: number | null | undefined;
386
+ };
387
+ description?: string | undefined;
388
+ }[];
389
+ quota: {
390
+ mauLimit: number | null;
391
+ tokenLimit: number | null;
392
+ applicationsLimit: number | null;
393
+ machineToMachineLimit: number | null;
394
+ resourcesLimit: number | null;
395
+ scopesPerResourceLimit: number | null;
396
+ customDomainEnabled: boolean;
397
+ omniSignInEnabled: boolean;
398
+ builtInEmailConnectorEnabled: boolean;
399
+ socialConnectorsLimit: number | null;
400
+ standardConnectorsLimit: number | null;
401
+ rolesLimit: number | null;
402
+ machineToMachineRolesLimit: number | null;
403
+ scopesPerRoleLimit: number | null;
404
+ hooksLimit: number | null;
405
+ auditLogsRetentionDays: number | null;
406
+ mfaEnabled: boolean;
407
+ organizationsEnabled: boolean;
408
+ ssoEnabled: boolean;
409
+ thirdPartyApplicationsLimit: number | null;
410
+ tenantMembersLimit: number | null;
411
+ customJwtEnabled: boolean;
412
+ };
413
+ }[]>;
414
+ };
415
+ post: {};
416
+ put: {};
417
+ delete: {};
418
+ copy: {};
419
+ head: {};
420
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
421
+ patch: {};
422
+ options: {};
423
+ get: {
424
+ "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
425
+ id: string;
426
+ createdAt: Date;
427
+ userId: string;
428
+ status: "open" | "complete" | "expired";
429
+ tenantId: string | null;
430
+ updatedAt: Date;
431
+ planId: string;
432
+ }>;
433
+ };
434
+ post: {
435
+ "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
436
+ planId: string;
437
+ successCallbackUrl: string;
438
+ tenantId?: string | undefined;
439
+ cancelCallbackUrl?: string | undefined;
440
+ tenantTag?: TenantTag | undefined;
441
+ tenantName?: string | undefined;
442
+ }, {
443
+ sessionId: string;
444
+ redirectUri?: string | null | undefined;
445
+ }>;
446
+ };
447
+ put: {};
448
+ delete: {};
449
+ copy: {};
450
+ head: {};
451
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
452
+ patch: {};
453
+ options: {};
454
+ get: {
455
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
456
+ };
457
+ post: {
458
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
459
+ name: string;
460
+ }, {
461
+ id: string;
462
+ createdAt: Date;
463
+ name: string;
464
+ }>;
465
+ } & {
466
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
467
+ type: "hostname" | "query";
468
+ value: string;
469
+ }, {
470
+ createdAt: Date;
471
+ affiliateId: string;
472
+ type: "hostname" | "query";
473
+ value: string;
474
+ }>;
475
+ };
476
+ put: {};
477
+ delete: {
478
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
479
+ type: "hostname" | "query";
480
+ value: string;
481
+ }, unknown>;
482
+ };
483
+ copy: {};
484
+ head: {};
485
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
486
+ patch: {};
487
+ options: {};
488
+ get: {};
489
+ post: {
490
+ "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
491
+ createdAt: string;
492
+ userId: string;
493
+ hostname?: string | undefined;
494
+ query?: string | undefined;
495
+ }, {
496
+ id: string;
497
+ createdAt: Date;
498
+ affiliateId: string | null;
499
+ userId: string;
500
+ createdVia: {
501
+ createdAt: string;
502
+ hostname?: string | undefined;
503
+ query?: string | undefined;
504
+ };
505
+ }>;
506
+ };
507
+ put: {};
508
+ delete: {};
509
+ copy: {};
510
+ head: {};
511
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
512
+ patch: {
513
+ "/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:invitationId/status", unknown, {
514
+ status: OrganizationInvitationStatus.Accepted;
515
+ }, unknown>;
516
+ };
517
+ options: {};
518
+ get: {
519
+ "/invitations": import("@withtyped/server").PathGuard<"/", unknown, unknown, ({
520
+ id: string;
521
+ createdAt: number;
522
+ status: OrganizationInvitationStatus;
523
+ tenantId: string;
524
+ updatedAt: number;
525
+ inviterId: string | null;
526
+ invitee: string;
527
+ acceptedUserId: string | null;
528
+ organizationId: string;
529
+ expiresAt: number;
530
+ organizationRoles: OrganizationRoleEntity[];
531
+ } & {
532
+ tenantName: string;
533
+ tenantTag: TenantTag;
534
+ })[]>;
535
+ } & {
536
+ "/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:invitationId", unknown, unknown, {
537
+ id: string;
538
+ createdAt: number;
539
+ status: OrganizationInvitationStatus;
540
+ tenantId: string;
541
+ updatedAt: number;
542
+ inviterId: string | null;
543
+ invitee: string;
544
+ acceptedUserId: string | null;
545
+ organizationId: string;
546
+ expiresAt: number;
547
+ organizationRoles: OrganizationRoleEntity[];
548
+ }>;
549
+ };
550
+ post: {};
551
+ put: {};
552
+ delete: {};
553
+ copy: {};
554
+ head: {};
555
+ }, "/api">>, "/api">;
556
+ export declare const tenantAuthRouter: import("@withtyped/server").Router<RequestContext, import("@withtyped/server").WithBodyContext<import("@withtyped/server").BaseContext & {
557
+ request: {
558
+ id?: string | undefined;
559
+ method?: import("@withtyped/server").RequestMethod | undefined;
560
+ headers: import("http").IncomingHttpHeaders;
561
+ url: URL;
562
+ body?: unknown;
563
+ };
564
+ }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
565
+ patch: {
566
+ "/:tenantId/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/status", unknown, {
567
+ status: OrganizationInvitationStatus.Revoked;
568
+ }, {
569
+ id: string;
570
+ createdAt: number;
571
+ status: OrganizationInvitationStatus;
572
+ tenantId: string;
573
+ updatedAt: number;
574
+ inviterId: string | null;
575
+ invitee: string;
576
+ acceptedUserId: string | null;
577
+ organizationId: string;
578
+ expiresAt: number;
579
+ organizationRoles: OrganizationRoleEntity[];
580
+ }>;
581
+ };
582
+ options: {};
583
+ get: {
584
+ "/:tenantId/members": import("@withtyped/server").PathGuard<"/:tenantId/members", unknown, unknown, {
585
+ id: string;
586
+ name: string | null;
587
+ username: string | null;
588
+ primaryEmail: string | null;
589
+ primaryPhone: string | null;
590
+ avatar: string | null;
591
+ organizationRoles: OrganizationRoleEntity[];
592
+ }[]>;
593
+ } & {
594
+ "/:tenantId/members/:userId/scopes": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/scopes", unknown, unknown, OrganizationScope[]>;
595
+ } & {
596
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, unknown, ({
597
+ id: string;
598
+ createdAt: number;
599
+ status: OrganizationInvitationStatus;
600
+ tenantId: string;
601
+ updatedAt: number;
602
+ inviterId: string | null;
603
+ invitee: string;
604
+ acceptedUserId: string | null;
605
+ organizationId: string;
606
+ expiresAt: number;
607
+ organizationRoles: OrganizationRoleEntity[];
608
+ } & {
609
+ inviterName?: string | undefined;
610
+ })[]>;
611
+ };
612
+ post: {
613
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, {
614
+ invitee: string;
615
+ roleName: TenantRole;
616
+ expiresAt?: number | undefined;
617
+ }, {
618
+ id: string;
619
+ createdAt: number;
620
+ status: OrganizationInvitationStatus;
621
+ tenantId: string;
622
+ updatedAt: number;
623
+ inviterId: string | null;
624
+ invitee: string;
625
+ acceptedUserId: string | null;
626
+ organizationId: string;
627
+ expiresAt: number;
628
+ organizationRoles: OrganizationRoleEntity[];
629
+ }>;
630
+ } & {
631
+ "/:tenantId/invitations/:invitationId/message": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/message", unknown, unknown, unknown>;
632
+ };
633
+ put: {
634
+ "/:tenantId/members/:userId/roles": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/roles", unknown, {
635
+ roleName: TenantRole;
636
+ }, unknown>;
637
+ };
638
+ delete: {
639
+ "/:tenantId/members/:userId": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId", unknown, unknown, unknown>;
640
+ } & {
641
+ "/:tenantId/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId", unknown, unknown, unknown>;
642
+ };
643
+ copy: {};
644
+ head: {};
645
+ }, "/api/tenants">>, "/api/tenants">;
646
+
647
+ export {
648
+ router as default,
649
+ };
650
+
651
+ 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-72891e6",
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.0",
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 {};