@logto/cloud 0.2.5-70aa370 → 0.2.5-749cae5

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