@logto/cloud 0.2.5-8065345 → 0.2.5-821690c

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