@logto/cloud 0.2.5-31703ea → 0.2.5-3452c56

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,913 @@
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 enum LogtoSkuType {
73
+ Basic = "Basic",
74
+ AddOn = "AddOn"
75
+ }
76
+ declare const AffiliateProperties: import("@withtyped/server/lib/model/index.js").default<"affiliate_properties", {
77
+ createdAt: Date;
78
+ affiliateId: string;
79
+ type: "hostname" | "query";
80
+ value: string;
81
+ }, "createdAt", "createdAt">;
82
+ export type AffiliateProperty = InferModelType<typeof AffiliateProperties>;
83
+ declare const Affiliates: import("@withtyped/server/lib/model/index.js").default<"affiliates", {
84
+ name: string;
85
+ createdAt: Date;
86
+ id: string;
87
+ }, "id" | "createdAt", "id" | "createdAt">;
88
+ export type Affiliate = InferModelType<typeof Affiliates>;
89
+ declare enum RegionName {
90
+ EU = "EU",
91
+ US = "US"
92
+ }
93
+ export type AffiliateData = Affiliate & {
94
+ properties: Array<Pick<AffiliateProperty, "type" | "value">>;
95
+ };
96
+ declare const router: import("@withtyped/server").Router<RequestContext, WithAuthContext<Omit<import("@withtyped/server").BaseContext & {
97
+ request: {
98
+ id?: string | undefined;
99
+ method?: import("@withtyped/server").RequestMethod | undefined;
100
+ headers: import("http").IncomingHttpHeaders;
101
+ url: URL;
102
+ body?: unknown;
103
+ };
104
+ }, "request"> & {
105
+ request: Record<string, unknown> & {
106
+ id?: string | undefined;
107
+ method?: import("@withtyped/server").RequestMethod | undefined;
108
+ headers: import("http").IncomingHttpHeaders;
109
+ url: URL;
110
+ body?: unknown;
111
+ } & {
112
+ body?: Json | undefined;
113
+ bodyRaw?: Buffer | undefined;
114
+ };
115
+ }>, 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").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
116
+ patch: {
117
+ "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
118
+ name?: string | undefined;
119
+ }, {
120
+ id: string;
121
+ name: string;
122
+ createdAt: Date;
123
+ usage: {
124
+ activeUsers: number;
125
+ cost: number;
126
+ tokenUsage: number;
127
+ };
128
+ indicator: string;
129
+ isSuspended: boolean;
130
+ planId: string;
131
+ subscription: {
132
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
133
+ planId: string;
134
+ currentPeriodStart: Date;
135
+ currentPeriodEnd: Date;
136
+ id?: string | undefined;
137
+ upcomingInvoice?: {
138
+ subtotal: number;
139
+ subtotalExcludingTax: number | null;
140
+ total: number;
141
+ totalExcludingTax: number | null;
142
+ } | null | undefined;
143
+ };
144
+ regionName: RegionName;
145
+ tag: TenantTag;
146
+ openInvoices: {
147
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
148
+ id: string;
149
+ createdAt: Date;
150
+ updatedAt: Date;
151
+ customerId: string | null;
152
+ billingReason: string | null;
153
+ periodStart: Date;
154
+ periodEnd: Date;
155
+ amountDue: number;
156
+ amountPaid: number;
157
+ subscriptionId: string | null;
158
+ hostedInvoiceUrl: string | null;
159
+ invoicePdf: string | null;
160
+ }[];
161
+ }>;
162
+ };
163
+ options: {};
164
+ get: {
165
+ "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
166
+ id: string;
167
+ name: string;
168
+ createdAt: Date;
169
+ usage: {
170
+ activeUsers: number;
171
+ cost: number;
172
+ tokenUsage: number;
173
+ };
174
+ indicator: string;
175
+ isSuspended: boolean;
176
+ planId: string;
177
+ subscription: {
178
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
179
+ planId: string;
180
+ currentPeriodStart: Date;
181
+ currentPeriodEnd: Date;
182
+ id?: string | undefined;
183
+ upcomingInvoice?: {
184
+ subtotal: number;
185
+ subtotalExcludingTax: number | null;
186
+ total: number;
187
+ totalExcludingTax: number | null;
188
+ } | null | undefined;
189
+ };
190
+ regionName: RegionName;
191
+ tag: TenantTag;
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
+ }[]>;
208
+ };
209
+ post: {
210
+ "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
211
+ name?: string | undefined;
212
+ tag?: TenantTag | undefined;
213
+ regionName?: RegionName | undefined;
214
+ }, {
215
+ id: string;
216
+ name: string;
217
+ createdAt: Date;
218
+ usage: {
219
+ activeUsers: number;
220
+ cost: number;
221
+ tokenUsage: number;
222
+ };
223
+ indicator: string;
224
+ isSuspended: boolean;
225
+ planId: string;
226
+ subscription: {
227
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
228
+ planId: string;
229
+ currentPeriodStart: Date;
230
+ currentPeriodEnd: Date;
231
+ id?: string | undefined;
232
+ upcomingInvoice?: {
233
+ subtotal: number;
234
+ subtotalExcludingTax: number | null;
235
+ total: number;
236
+ totalExcludingTax: number | null;
237
+ } | null | undefined;
238
+ };
239
+ regionName: RegionName;
240
+ tag: TenantTag;
241
+ openInvoices: {
242
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
243
+ id: string;
244
+ createdAt: Date;
245
+ updatedAt: Date;
246
+ customerId: string | null;
247
+ billingReason: string | null;
248
+ periodStart: Date;
249
+ periodEnd: Date;
250
+ amountDue: number;
251
+ amountPaid: number;
252
+ subscriptionId: string | null;
253
+ hostedInvoiceUrl: string | null;
254
+ invoicePdf: string | null;
255
+ }[];
256
+ }>;
257
+ };
258
+ put: {};
259
+ delete: {
260
+ "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
261
+ };
262
+ copy: {};
263
+ head: {};
264
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
265
+ patch: {};
266
+ options: {};
267
+ get: {
268
+ "/tenants/my/subscription": import("@withtyped/server").PathGuard<"/my/subscription", unknown, unknown, {
269
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
270
+ planId: string;
271
+ currentPeriodStart: Date;
272
+ currentPeriodEnd: Date;
273
+ id?: string | undefined;
274
+ upcomingInvoice?: {
275
+ subtotal: number;
276
+ subtotalExcludingTax: number | null;
277
+ total: number;
278
+ totalExcludingTax: number | null;
279
+ } | null | undefined;
280
+ }>;
281
+ } & {
282
+ "/tenants/my/subscription/quota": import("@withtyped/server").PathGuard<"/my/subscription/quota", unknown, unknown, {
283
+ mauLimit: number | null;
284
+ tokenLimit: number | null;
285
+ applicationsLimit: number | null;
286
+ machineToMachineLimit: number | null;
287
+ resourcesLimit: number | null;
288
+ scopesPerResourceLimit: number | null;
289
+ socialConnectorsLimit: number | null;
290
+ machineToMachineRolesLimit: number | null;
291
+ scopesPerRoleLimit: number | null;
292
+ hooksLimit: number | null;
293
+ auditLogsRetentionDays: number | null;
294
+ mfaEnabled: boolean;
295
+ organizationsEnabled: boolean;
296
+ thirdPartyApplicationsLimit: number | null;
297
+ tenantMembersLimit: number | null;
298
+ customJwtEnabled: boolean;
299
+ subjectTokenEnabled: boolean;
300
+ bringYourUiEnabled: boolean;
301
+ userRolesLimit: number | null;
302
+ enterpriseSsoLimit: number | null;
303
+ }>;
304
+ } & {
305
+ "/tenants/my/subscription/usage": import("@withtyped/server").PathGuard<"/my/subscription/usage", unknown, unknown, {
306
+ mauLimit: number;
307
+ tokenLimit: number;
308
+ applicationsLimit: number;
309
+ machineToMachineLimit: number;
310
+ resourcesLimit: number;
311
+ scopesPerResourceLimit: number;
312
+ socialConnectorsLimit: number;
313
+ machineToMachineRolesLimit: number;
314
+ scopesPerRoleLimit: number;
315
+ hooksLimit: number;
316
+ mfaEnabled: boolean;
317
+ organizationsEnabled: boolean;
318
+ thirdPartyApplicationsLimit: number;
319
+ tenantMembersLimit: number;
320
+ customJwtEnabled: boolean;
321
+ subjectTokenEnabled: boolean;
322
+ bringYourUiEnabled: boolean;
323
+ userRolesLimit: number;
324
+ enterpriseSsoLimit: number;
325
+ }>;
326
+ } & {
327
+ "/tenants/my/subscription/usage/:entityName/scopes": import("@withtyped/server").PathGuard<"/my/subscription/usage/:entityName/scopes", {
328
+ entityId?: string | undefined;
329
+ }, unknown, Record<string, number>>;
330
+ } & {
331
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, {
332
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
333
+ planId: string;
334
+ currentPeriodStart: Date;
335
+ currentPeriodEnd: Date;
336
+ id?: string | undefined;
337
+ upcomingInvoice?: {
338
+ subtotal: number;
339
+ subtotalExcludingTax: number | null;
340
+ total: number;
341
+ totalExcludingTax: number | null;
342
+ } | null | undefined;
343
+ }>;
344
+ } & {
345
+ "/tenants/:tenantId/subscription/quota": import("@withtyped/server").PathGuard<"/:tenantId/subscription/quota", unknown, unknown, {
346
+ mauLimit: number | null;
347
+ tokenLimit: number | null;
348
+ applicationsLimit: number | null;
349
+ machineToMachineLimit: number | null;
350
+ resourcesLimit: number | null;
351
+ scopesPerResourceLimit: number | null;
352
+ socialConnectorsLimit: number | null;
353
+ machineToMachineRolesLimit: number | null;
354
+ scopesPerRoleLimit: number | null;
355
+ hooksLimit: number | null;
356
+ auditLogsRetentionDays: number | null;
357
+ mfaEnabled: boolean;
358
+ organizationsEnabled: boolean;
359
+ thirdPartyApplicationsLimit: number | null;
360
+ tenantMembersLimit: number | null;
361
+ customJwtEnabled: boolean;
362
+ subjectTokenEnabled: boolean;
363
+ bringYourUiEnabled: boolean;
364
+ userRolesLimit: number | null;
365
+ enterpriseSsoLimit: number | null;
366
+ }>;
367
+ } & {
368
+ "/tenants/:tenantId/subscription/usage": import("@withtyped/server").PathGuard<"/:tenantId/subscription/usage", unknown, unknown, {
369
+ mauLimit: number;
370
+ tokenLimit: number;
371
+ applicationsLimit: number;
372
+ machineToMachineLimit: number;
373
+ resourcesLimit: number;
374
+ scopesPerResourceLimit: number;
375
+ socialConnectorsLimit: number;
376
+ machineToMachineRolesLimit: number;
377
+ scopesPerRoleLimit: number;
378
+ hooksLimit: number;
379
+ mfaEnabled: boolean;
380
+ organizationsEnabled: boolean;
381
+ thirdPartyApplicationsLimit: number;
382
+ tenantMembersLimit: number;
383
+ customJwtEnabled: boolean;
384
+ subjectTokenEnabled: boolean;
385
+ bringYourUiEnabled: boolean;
386
+ userRolesLimit: number;
387
+ enterpriseSsoLimit: number;
388
+ }>;
389
+ } & {
390
+ "/tenants/:tenantId/subscription/usage/:entityName/scopes": import("@withtyped/server").PathGuard<"/:tenantId/subscription/usage/:entityName/scopes", {
391
+ entityId?: string | undefined;
392
+ }, unknown, Record<string, number>>;
393
+ } & {
394
+ "/tenants/:tenantId/subscription-usage": import("@withtyped/server").PathGuard<"/:tenantId/subscription-usage", unknown, unknown, {
395
+ usage: {
396
+ mauLimit: number;
397
+ tokenLimit: number;
398
+ applicationsLimit: number;
399
+ machineToMachineLimit: number;
400
+ resourcesLimit: number;
401
+ scopesPerResourceLimit: number;
402
+ socialConnectorsLimit: number;
403
+ machineToMachineRolesLimit: number;
404
+ scopesPerRoleLimit: number;
405
+ hooksLimit: number;
406
+ mfaEnabled: boolean;
407
+ organizationsEnabled: boolean;
408
+ thirdPartyApplicationsLimit: number;
409
+ tenantMembersLimit: number;
410
+ customJwtEnabled: boolean;
411
+ subjectTokenEnabled: boolean;
412
+ bringYourUiEnabled: boolean;
413
+ userRolesLimit: number;
414
+ enterpriseSsoLimit: number;
415
+ };
416
+ resources: Record<string, number>;
417
+ roles: Record<string, number>;
418
+ quota: {
419
+ mauLimit: number | null;
420
+ tokenLimit: number | null;
421
+ applicationsLimit: number | null;
422
+ machineToMachineLimit: number | null;
423
+ resourcesLimit: number | null;
424
+ scopesPerResourceLimit: number | null;
425
+ socialConnectorsLimit: number | null;
426
+ machineToMachineRolesLimit: number | null;
427
+ scopesPerRoleLimit: number | null;
428
+ hooksLimit: number | null;
429
+ auditLogsRetentionDays: number | null;
430
+ mfaEnabled: boolean;
431
+ organizationsEnabled: boolean;
432
+ thirdPartyApplicationsLimit: number | null;
433
+ tenantMembersLimit: number | null;
434
+ customJwtEnabled: boolean;
435
+ subjectTokenEnabled: boolean;
436
+ bringYourUiEnabled: boolean;
437
+ userRolesLimit: number | null;
438
+ enterpriseSsoLimit: number | null;
439
+ };
440
+ }>;
441
+ } & {
442
+ "/tenants/:tenantId/invoices": import("@withtyped/server").PathGuard<"/:tenantId/invoices", unknown, unknown, {
443
+ invoices: {
444
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
445
+ id: string;
446
+ createdAt: Date;
447
+ updatedAt: Date;
448
+ customerId: string | null;
449
+ billingReason: string | null;
450
+ periodStart: Date;
451
+ periodEnd: Date;
452
+ amountDue: number;
453
+ amountPaid: number;
454
+ subscriptionId: string | null;
455
+ hostedInvoiceUrl: string | null;
456
+ invoicePdf: string | null;
457
+ planName: string | null;
458
+ skuId?: string | null | undefined;
459
+ }[];
460
+ }>;
461
+ } & {
462
+ "/tenants/:tenantId/invoices/:invoiceId/hosted-invoice-url": import("@withtyped/server").PathGuard<"/:tenantId/invoices/:invoiceId/hosted-invoice-url", unknown, unknown, {
463
+ hostedInvoiceUrl: string;
464
+ }>;
465
+ } & {
466
+ "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
467
+ activeUsers: number;
468
+ cost: number;
469
+ tokenUsage: number;
470
+ }>;
471
+ };
472
+ post: {
473
+ "/tenants/my/subscription/item-updates": import("@withtyped/server").PathGuard<"/my/subscription/item-updates", unknown, {
474
+ usageKey: "tokenLimit" | "machineToMachineLimit" | "resourcesLimit" | "enterpriseSsoLimit" | "hooksLimit" | "tenantMembersLimit" | "mfaEnabled" | "organizationsEnabled";
475
+ }, {
476
+ message: string;
477
+ }>;
478
+ } & {
479
+ "/tenants/:tenantId/stripe-customer-portal": import("@withtyped/server").PathGuard<"/:tenantId/stripe-customer-portal", unknown, {
480
+ callbackUrl?: string | undefined;
481
+ }, {
482
+ redirectUri: string;
483
+ }>;
484
+ };
485
+ put: {};
486
+ delete: {
487
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
488
+ };
489
+ copy: {};
490
+ head: {};
491
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
492
+ patch: {};
493
+ options: {};
494
+ get: {
495
+ "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
496
+ from?: string | undefined;
497
+ }, unknown, {
498
+ count: number;
499
+ }>;
500
+ };
501
+ post: {
502
+ "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
503
+ data: {
504
+ type: TemplateType | VerificationCodeType;
505
+ payload: {
506
+ code?: string | undefined;
507
+ link?: string | undefined;
508
+ } & Record<string, string> & {
509
+ senderName?: string | undefined;
510
+ companyInformation?: string | undefined;
511
+ appLogo?: string | undefined;
512
+ };
513
+ to: string;
514
+ };
515
+ }, unknown>;
516
+ } & {
517
+ "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
518
+ data: {
519
+ type: TemplateType | VerificationCodeType;
520
+ to: string;
521
+ payload: {
522
+ code?: string | undefined;
523
+ link?: string | undefined;
524
+ } & Record<string, string>;
525
+ };
526
+ }, unknown>;
527
+ } & {
528
+ "/services/custom-jwt": import("@withtyped/server").PathGuard<"/custom-jwt", {
529
+ isTest?: string | undefined;
530
+ }, {
531
+ context: Record<string, Json>;
532
+ script: string;
533
+ tokenType: LogtoJwtTokenKeyType.AccessToken;
534
+ token: Record<string, Json>;
535
+ environmentVariables?: Record<string, string> | undefined;
536
+ } | {
537
+ script: string;
538
+ tokenType: LogtoJwtTokenKeyType.ClientCredentials;
539
+ token: Record<string, Json>;
540
+ environmentVariables?: Record<string, string> | undefined;
541
+ }, Record<string, unknown>>;
542
+ };
543
+ put: {
544
+ "/services/custom-jwt/worker": import("@withtyped/server").PathGuard<"/custom-jwt/worker", unknown, {
545
+ "jwt.accessToken"?: {
546
+ production?: string | undefined;
547
+ test?: string | undefined;
548
+ } | undefined;
549
+ "jwt.clientCredentials"?: {
550
+ production?: string | undefined;
551
+ test?: string | undefined;
552
+ } | undefined;
553
+ }, unknown>;
554
+ };
555
+ delete: {
556
+ "/services/custom-jwt/worker": import("@withtyped/server").PathGuard<"/custom-jwt/worker", unknown, unknown, unknown>;
557
+ };
558
+ copy: {};
559
+ head: {};
560
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
561
+ patch: {};
562
+ options: {};
563
+ get: {
564
+ "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
565
+ id: string;
566
+ createdAt: Date;
567
+ name: string;
568
+ updatedAt: Date;
569
+ quota: {
570
+ mauLimit: number | null;
571
+ tokenLimit: number | null;
572
+ applicationsLimit: number | null;
573
+ machineToMachineLimit: number | null;
574
+ resourcesLimit: number | null;
575
+ scopesPerResourceLimit: number | null;
576
+ customDomainEnabled: boolean;
577
+ omniSignInEnabled: boolean;
578
+ builtInEmailConnectorEnabled: boolean;
579
+ socialConnectorsLimit: number | null;
580
+ standardConnectorsLimit: number | null;
581
+ rolesLimit: number | null;
582
+ machineToMachineRolesLimit: number | null;
583
+ scopesPerRoleLimit: number | null;
584
+ hooksLimit: number | null;
585
+ auditLogsRetentionDays: number | null;
586
+ mfaEnabled: boolean;
587
+ organizationsEnabled: boolean;
588
+ ssoEnabled: boolean;
589
+ thirdPartyApplicationsLimit: number | null;
590
+ tenantMembersLimit: number | null;
591
+ customJwtEnabled: boolean;
592
+ subjectTokenEnabled: boolean;
593
+ bringYourUiEnabled: boolean;
594
+ };
595
+ stripeProducts: {
596
+ type: "flat" | "tier1" | "tier2" | "tier3";
597
+ id: string;
598
+ name: string;
599
+ price: {
600
+ id: string;
601
+ unitAmountDecimal: string;
602
+ quantity?: 1 | undefined;
603
+ unitAmount?: number | null | undefined;
604
+ };
605
+ description?: string | undefined;
606
+ }[];
607
+ }[]>;
608
+ };
609
+ post: {};
610
+ put: {};
611
+ delete: {};
612
+ copy: {};
613
+ head: {};
614
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
615
+ patch: {};
616
+ options: {};
617
+ get: {
618
+ "/skus": import("@withtyped/server").PathGuard<"/", {
619
+ type?: LogtoSkuType | undefined;
620
+ }, unknown, {
621
+ type: LogtoSkuType;
622
+ id: string;
623
+ name: string | null;
624
+ quota: {
625
+ mauLimit?: number | null | undefined;
626
+ tokenLimit?: number | null | undefined;
627
+ applicationsLimit?: number | null | undefined;
628
+ machineToMachineLimit?: number | null | undefined;
629
+ resourcesLimit?: number | null | undefined;
630
+ scopesPerResourceLimit?: number | null | undefined;
631
+ socialConnectorsLimit?: number | null | undefined;
632
+ machineToMachineRolesLimit?: number | null | undefined;
633
+ scopesPerRoleLimit?: number | null | undefined;
634
+ hooksLimit?: number | null | undefined;
635
+ auditLogsRetentionDays?: number | null | undefined;
636
+ mfaEnabled?: boolean | undefined;
637
+ organizationsEnabled?: boolean | undefined;
638
+ thirdPartyApplicationsLimit?: number | null | undefined;
639
+ tenantMembersLimit?: number | null | undefined;
640
+ customJwtEnabled?: boolean | undefined;
641
+ subjectTokenEnabled?: boolean | undefined;
642
+ bringYourUiEnabled?: boolean | undefined;
643
+ userRolesLimit?: number | null | undefined;
644
+ enterpriseSsoLimit?: number | null | undefined;
645
+ };
646
+ createdAt: Date;
647
+ updatedAt: Date;
648
+ unitPrice: number | null;
649
+ }[]>;
650
+ };
651
+ post: {};
652
+ put: {};
653
+ delete: {};
654
+ copy: {};
655
+ head: {};
656
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
657
+ patch: {};
658
+ options: {};
659
+ get: {
660
+ "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
661
+ id: string;
662
+ createdAt: Date;
663
+ userId: string;
664
+ status: "open" | "complete" | "expired";
665
+ tenantId: string | null;
666
+ updatedAt: Date;
667
+ planId: string;
668
+ skuId: string | null;
669
+ }>;
670
+ };
671
+ post: {
672
+ "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
673
+ planId: string;
674
+ successCallbackUrl: string;
675
+ tenantId?: string | undefined;
676
+ skuId?: string | undefined;
677
+ tenantName?: string | undefined;
678
+ tenantTag?: TenantTag | undefined;
679
+ tenantRegionName?: RegionName | undefined;
680
+ cancelCallbackUrl?: string | undefined;
681
+ }, {
682
+ sessionId: string;
683
+ redirectUri?: string | null | undefined;
684
+ }>;
685
+ };
686
+ put: {};
687
+ delete: {};
688
+ copy: {};
689
+ head: {};
690
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
691
+ patch: {};
692
+ options: {};
693
+ get: {
694
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
695
+ };
696
+ post: {
697
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
698
+ name: string;
699
+ }, {
700
+ id: string;
701
+ createdAt: Date;
702
+ name: string;
703
+ }>;
704
+ } & {
705
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
706
+ type: "hostname" | "query";
707
+ value: string;
708
+ }, {
709
+ createdAt: Date;
710
+ affiliateId: string;
711
+ type: "hostname" | "query";
712
+ value: string;
713
+ }>;
714
+ };
715
+ put: {};
716
+ delete: {
717
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
718
+ type: "hostname" | "query";
719
+ value: string;
720
+ }, unknown>;
721
+ };
722
+ copy: {};
723
+ head: {};
724
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
725
+ patch: {};
726
+ options: {};
727
+ get: {};
728
+ post: {
729
+ "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
730
+ createdAt: string;
731
+ userId: string;
732
+ hostname?: string | undefined;
733
+ query?: string | undefined;
734
+ }, {
735
+ id: string;
736
+ createdAt: Date;
737
+ affiliateId: string | null;
738
+ userId: string;
739
+ createdVia: {
740
+ createdAt: string;
741
+ hostname?: string | undefined;
742
+ query?: string | undefined;
743
+ };
744
+ }>;
745
+ };
746
+ put: {};
747
+ delete: {};
748
+ copy: {};
749
+ head: {};
750
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
751
+ patch: {
752
+ "/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:invitationId/status", unknown, {
753
+ status: OrganizationInvitationStatus.Accepted;
754
+ }, unknown>;
755
+ };
756
+ options: {};
757
+ get: {
758
+ "/invitations": import("@withtyped/server").PathGuard<"/", unknown, unknown, ({
759
+ id: string;
760
+ createdAt: number;
761
+ status: OrganizationInvitationStatus;
762
+ tenantId: string;
763
+ updatedAt: number;
764
+ inviterId: string | null;
765
+ invitee: string;
766
+ acceptedUserId: string | null;
767
+ organizationId: string;
768
+ expiresAt: number;
769
+ organizationRoles: OrganizationRoleEntity[];
770
+ } & {
771
+ tenantName: string;
772
+ tenantTag: TenantTag;
773
+ })[]>;
774
+ } & {
775
+ "/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:invitationId", unknown, unknown, {
776
+ id: string;
777
+ createdAt: number;
778
+ status: OrganizationInvitationStatus;
779
+ tenantId: string;
780
+ updatedAt: number;
781
+ inviterId: string | null;
782
+ invitee: string;
783
+ acceptedUserId: string | null;
784
+ organizationId: string;
785
+ expiresAt: number;
786
+ organizationRoles: OrganizationRoleEntity[];
787
+ }>;
788
+ };
789
+ post: {};
790
+ put: {};
791
+ delete: {};
792
+ copy: {};
793
+ head: {};
794
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
795
+ patch: {};
796
+ options: {};
797
+ get: {};
798
+ post: {};
799
+ put: {};
800
+ delete: {
801
+ "/me": import("@withtyped/server").PathGuard<"/", unknown, unknown, unknown>;
802
+ };
803
+ copy: {};
804
+ head: {};
805
+ }, "/api">>, "/api">;
806
+ export declare const tenantAuthRouter: import("@withtyped/server").Router<RequestContext, import("@withtyped/server").WithBodyContext<import("@withtyped/server").BaseContext & {
807
+ request: {
808
+ id?: string | undefined;
809
+ method?: import("@withtyped/server").RequestMethod | undefined;
810
+ headers: import("http").IncomingHttpHeaders;
811
+ url: URL;
812
+ body?: unknown;
813
+ };
814
+ }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
815
+ patch: {
816
+ "/:tenantId/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/status", unknown, {
817
+ status: OrganizationInvitationStatus.Revoked;
818
+ }, {
819
+ id: string;
820
+ createdAt: number;
821
+ status: OrganizationInvitationStatus;
822
+ tenantId: string;
823
+ updatedAt: number;
824
+ inviterId: string | null;
825
+ invitee: string;
826
+ acceptedUserId: string | null;
827
+ organizationId: string;
828
+ expiresAt: number;
829
+ organizationRoles: OrganizationRoleEntity[];
830
+ }>;
831
+ };
832
+ options: {};
833
+ get: {
834
+ "/:tenantId/members": import("@withtyped/server").PathGuard<"/:tenantId/members", unknown, unknown, {
835
+ id: string;
836
+ name: string | null;
837
+ username: string | null;
838
+ primaryEmail: string | null;
839
+ primaryPhone: string | null;
840
+ avatar: string | null;
841
+ organizationRoles: OrganizationRoleEntity[];
842
+ }[]>;
843
+ } & {
844
+ "/:tenantId/members/:userId/scopes": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/scopes", unknown, unknown, OrganizationScope[]>;
845
+ } & {
846
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, unknown, ({
847
+ id: string;
848
+ createdAt: number;
849
+ status: OrganizationInvitationStatus;
850
+ tenantId: string;
851
+ updatedAt: number;
852
+ inviterId: string | null;
853
+ invitee: string;
854
+ acceptedUserId: string | null;
855
+ organizationId: string;
856
+ expiresAt: number;
857
+ organizationRoles: OrganizationRoleEntity[];
858
+ } & {
859
+ inviterName?: string | undefined;
860
+ })[]>;
861
+ };
862
+ post: {
863
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, {
864
+ invitee: string | string[];
865
+ roleName: TenantRole;
866
+ expiresAt?: number | undefined;
867
+ }, {
868
+ id: string;
869
+ createdAt: number;
870
+ status: OrganizationInvitationStatus;
871
+ tenantId: string;
872
+ updatedAt: number;
873
+ inviterId: string | null;
874
+ invitee: string;
875
+ acceptedUserId: string | null;
876
+ organizationId: string;
877
+ expiresAt: number;
878
+ organizationRoles: OrganizationRoleEntity[];
879
+ } | {
880
+ id: string;
881
+ createdAt: number;
882
+ status: OrganizationInvitationStatus;
883
+ tenantId: string;
884
+ updatedAt: number;
885
+ inviterId: string | null;
886
+ invitee: string;
887
+ acceptedUserId: string | null;
888
+ organizationId: string;
889
+ expiresAt: number;
890
+ organizationRoles: OrganizationRoleEntity[];
891
+ }[]>;
892
+ } & {
893
+ "/:tenantId/invitations/:invitationId/message": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/message", unknown, unknown, unknown>;
894
+ };
895
+ put: {
896
+ "/:tenantId/members/:userId/roles": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/roles", unknown, {
897
+ roleName: TenantRole;
898
+ }, unknown>;
899
+ };
900
+ delete: {
901
+ "/:tenantId/members/:userId": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId", unknown, unknown, unknown>;
902
+ } & {
903
+ "/:tenantId/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId", unknown, unknown, unknown>;
904
+ };
905
+ copy: {};
906
+ head: {};
907
+ }, "/api/tenants">>, "/api/tenants">;
908
+
909
+ export {
910
+ router as default,
911
+ };
912
+
913
+ export {};
package/package.json CHANGED
@@ -1,63 +1,68 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-31703ea",
3
+ "version": "0.2.5-3452c56",
4
4
  "description": "Logto Cloud service.",
5
5
  "main": "build/index.js",
6
6
  "author": "Silverhand Inc. <contact@silverhand.io>",
7
7
  "license": "Elastic-2.0",
8
8
  "type": "module",
9
9
  "files": [
10
- "build"
10
+ "lib"
11
11
  ],
12
12
  "exports": {
13
- "./routes": "./build/routes/index.js"
13
+ "./routes": "./lib/routes/index.js"
14
14
  },
15
15
  "imports": {
16
16
  "#src/*": "./build/*"
17
17
  },
18
18
  "devDependencies": {
19
- "@silverhand/eslint-config": "3.0.1",
20
- "@silverhand/jest-config": "3.0.0",
21
- "@silverhand/ts-config": "3.0.0",
19
+ "@silverhand/eslint-config": "6.0.1",
20
+ "@silverhand/ts-config": "6.0.0",
22
21
  "@types/accepts": "^1.3.5",
23
22
  "@types/http-proxy": "^1.17.9",
24
- "@types/jest": "^29.4.0",
25
23
  "@types/mime-types": "^2.1.1",
26
- "@types/node": "^18.11.18",
27
- "dts-bundle-generator": "^8.0.1",
28
- "eslint": "^8.21.0",
29
- "jest": "^29.5.0",
30
- "lint-staged": "^13.0.0",
31
- "nodemon": "^2.0.19",
32
- "prettier": "^2.8.1",
33
- "typescript": "^5.0.0"
24
+ "@types/node": "^20.0.0",
25
+ "@types/yargs": "^17.0.24",
26
+ "dts-bundle-generator": "^9.3.1",
27
+ "eslint": "^8.57.0",
28
+ "lint-staged": "^15.0.0",
29
+ "nodemon": "^3.0.0",
30
+ "prettier": "^3.0.0",
31
+ "typescript": "^5.3.3",
32
+ "vite-tsconfig-paths": "^4.3.1",
33
+ "vitest": "^2.0.0"
34
34
  },
35
35
  "engines": {
36
- "node": "^18.12.0"
36
+ "node": "^20.9.0"
37
37
  },
38
38
  "eslintConfig": {
39
- "extends": "@silverhand"
39
+ "extends": "@silverhand",
40
+ "rules": {
41
+ "no-console": "error"
42
+ },
43
+ "ignorePatterns": [
44
+ "types.test.ts"
45
+ ]
40
46
  },
41
47
  "prettier": "@silverhand/eslint-config/.prettierrc",
42
48
  "publishConfig": {
43
49
  "access": "public"
44
50
  },
45
51
  "dependencies": {
46
- "@withtyped/server": "^0.12.0"
52
+ "@silverhand/essentials": "^2.9.1",
53
+ "@withtyped/server": "^0.13.6"
47
54
  },
48
55
  "scripts": {
49
56
  "precommit": "lint-staged",
50
- "build": "rm -rf build/ && tsc -p tsconfig.build.json",
57
+ "build": "rm -rf build/ && tsc -p tsconfig.build.json && pnpm build:lib",
51
58
  "//": "It is not used to build the service itself.",
52
- "build:lib": "rm -rf build/ && dts-bundle-generator src/routes/index.ts --project tsconfig.build.json -o build/routes/index.d.ts",
53
- "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",
54
60
  "lint": "eslint --ext .ts src",
55
61
  "lint:report": "pnpm lint --format json --output-file report.json",
56
62
  "dev": "rm -rf build/ && nodemon",
57
63
  "start": "NODE_ENV=production node .",
58
- "test:only": "NODE_OPTIONS=\"--experimental-vm-modules --max_old_space_size=4096\" jest --logHeapUsage",
59
- "test": "pnpm build:test && pnpm test:only",
60
- "test:ci": "pnpm test:only --coverage --silent",
61
- "test:types": "tsc -p tsconfig.test.types.json"
64
+ "test": "vitest && pnpm build:lib && pnpm test:types",
65
+ "test:types": "tsc -p tsconfig.test.types.json",
66
+ "cli": "node ./build/cli/index.js"
62
67
  }
63
68
  }
@@ -1,165 +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 const Tenants: import("@withtyped/server/model").default<"tenants", {
18
- id: string;
19
- dbUser: string | null;
20
- dbUserPassword: string | null;
21
- name: string;
22
- tag: TenantTag;
23
- createdAt: Date;
24
- }, "name" | "createdAt" | "tag", "createdAt">;
25
- export type TenantModel = InferModelType<typeof Tenants>;
26
- export type TenantInfo = Pick<TenantModel, "id" | "name" | "tag"> & {
27
- indicator: string;
28
- };
29
- declare enum VerificationCodeType {
30
- SignIn = "SignIn",
31
- Register = "Register",
32
- ForgotPassword = "ForgotPassword",
33
- /** @deprecated */
34
- Continue = "Continue",
35
- Generic = "Generic",
36
- /** @deprecated Use `Generic` type template for sending test sms/email use case */
37
- Test = "Test"
38
- }
39
- declare const _default: import("@withtyped/server").Router<WithAuthContext, import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
40
- options: {};
41
- patch: {
42
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
43
- name?: string | undefined;
44
- tag?: TenantTag | undefined;
45
- }, TenantInfo>;
46
- };
47
- get: {
48
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, TenantInfo[]>;
49
- };
50
- post: {
51
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
52
- name?: string | undefined;
53
- tag?: TenantTag | undefined;
54
- }, TenantInfo>;
55
- };
56
- put: {};
57
- head: {};
58
- delete: {
59
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
60
- };
61
- copy: {};
62
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
63
- options: {};
64
- patch: {};
65
- get: {
66
- "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
67
- from?: string | undefined;
68
- }, unknown, unknown>;
69
- };
70
- post: {
71
- "/services/send-email": import("@withtyped/server").PathGuard<"/send-email", unknown, {
72
- data: {
73
- type: VerificationCodeType;
74
- to: string;
75
- payload: {
76
- fromName?: string | undefined;
77
- companyAddress?: string | undefined;
78
- appLogo?: string | undefined;
79
- code: string;
80
- };
81
- };
82
- }, unknown>;
83
- } & {
84
- "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
85
- data: {
86
- type: VerificationCodeType;
87
- to: string;
88
- payload: {
89
- fromName?: string | undefined;
90
- companyAddress?: string | undefined;
91
- appLogo?: string | undefined;
92
- code: string;
93
- };
94
- };
95
- }, unknown>;
96
- } & {
97
- "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
98
- data: {
99
- type: VerificationCodeType;
100
- to: string;
101
- payload: {
102
- fromName?: string | undefined;
103
- companyAddress?: string | undefined;
104
- appLogo?: string | undefined;
105
- code: string;
106
- };
107
- };
108
- }, unknown>;
109
- };
110
- put: {};
111
- head: {};
112
- delete: {};
113
- copy: {};
114
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
115
- options: {};
116
- patch: {};
117
- get: {
118
- "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
119
- id: string;
120
- name: string;
121
- products: {
122
- description?: string | undefined;
123
- type: "flat" | "tier1" | "tier2" | "tier3";
124
- id: string;
125
- name: string;
126
- price: {
127
- quantity?: 1 | undefined;
128
- unitAmount?: number | null | undefined;
129
- id: string;
130
- unitAmountDecimal: string;
131
- };
132
- }[];
133
- quota: {
134
- tenantLimit: number | null;
135
- mauLimit: number | null;
136
- applicationsLimit: number;
137
- machineToMachineLimit: number;
138
- resourcesLimit: number;
139
- scopesPerResourceLimit: number;
140
- customDomainEnabled: boolean;
141
- omniSignInEnabled: boolean;
142
- builtInEmailConnectorEnabled: boolean;
143
- socialConnectorsLimit: number | null;
144
- standardConnectorsLimit: number;
145
- rolesLimit: number;
146
- scopesPerRoleLimit: number | null;
147
- hooksLimit: number;
148
- auditLogsRetentionDays: number;
149
- };
150
- createdAt: Date;
151
- updatedAt: Date;
152
- }[]>;
153
- };
154
- post: {};
155
- put: {};
156
- head: {};
157
- delete: {};
158
- copy: {};
159
- }, "/api">>, "/api">;
160
-
161
- export {
162
- _default as default,
163
- };
164
-
165
- export {};