@logto/cloud 0.2.5-25a9c6d → 0.2.5-2a777a1

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