@logto/cloud 0.2.5-4686b84 → 0.2.5-4917039

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