@logto/cloud 0.2.5-4f1d80b → 0.2.5-50ff8fe

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,853 @@
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/invoices": import("@withtyped/server").PathGuard<"/:tenantId/invoices", unknown, unknown, {
395
+ invoices: {
396
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
397
+ id: string;
398
+ createdAt: Date;
399
+ updatedAt: Date;
400
+ customerId: string | null;
401
+ billingReason: string | null;
402
+ periodStart: Date;
403
+ periodEnd: Date;
404
+ amountDue: number;
405
+ amountPaid: number;
406
+ subscriptionId: string | null;
407
+ hostedInvoiceUrl: string | null;
408
+ invoicePdf: string | null;
409
+ planName: string | null;
410
+ skuId?: string | null | undefined;
411
+ }[];
412
+ }>;
413
+ } & {
414
+ "/tenants/:tenantId/invoices/:invoiceId/hosted-invoice-url": import("@withtyped/server").PathGuard<"/:tenantId/invoices/:invoiceId/hosted-invoice-url", unknown, unknown, {
415
+ hostedInvoiceUrl: string;
416
+ }>;
417
+ } & {
418
+ "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
419
+ activeUsers: number;
420
+ cost: number;
421
+ tokenUsage: number;
422
+ }>;
423
+ };
424
+ post: {
425
+ "/tenants/my/subscription/item-updates": import("@withtyped/server").PathGuard<"/my/subscription/item-updates", unknown, {
426
+ usageKey: "tokenLimit" | "machineToMachineLimit" | "resourcesLimit" | "enterpriseSsoLimit" | "tenantMembersLimit" | "mfaEnabled" | "organizationsEnabled";
427
+ }, {
428
+ message: string;
429
+ }>;
430
+ } & {
431
+ "/tenants/:tenantId/stripe-customer-portal": import("@withtyped/server").PathGuard<"/:tenantId/stripe-customer-portal", unknown, {
432
+ callbackUrl?: string | undefined;
433
+ }, {
434
+ redirectUri: string;
435
+ }>;
436
+ };
437
+ put: {};
438
+ delete: {
439
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
440
+ };
441
+ copy: {};
442
+ head: {};
443
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
444
+ patch: {};
445
+ options: {};
446
+ get: {
447
+ "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
448
+ from?: string | undefined;
449
+ }, unknown, {
450
+ count: number;
451
+ }>;
452
+ };
453
+ post: {
454
+ "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
455
+ data: {
456
+ type: TemplateType | VerificationCodeType;
457
+ payload: {
458
+ code?: string | undefined;
459
+ link?: string | undefined;
460
+ } & Record<string, string> & {
461
+ senderName?: string | undefined;
462
+ companyInformation?: string | undefined;
463
+ appLogo?: string | undefined;
464
+ };
465
+ to: string;
466
+ };
467
+ }, unknown>;
468
+ } & {
469
+ "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
470
+ data: {
471
+ type: TemplateType | VerificationCodeType;
472
+ to: string;
473
+ payload: {
474
+ code?: string | undefined;
475
+ link?: string | undefined;
476
+ } & Record<string, string>;
477
+ };
478
+ }, unknown>;
479
+ } & {
480
+ "/services/custom-jwt": import("@withtyped/server").PathGuard<"/custom-jwt", {
481
+ isTest?: string | undefined;
482
+ }, {
483
+ context: Record<string, Json>;
484
+ script: string;
485
+ tokenType: LogtoJwtTokenKeyType.AccessToken;
486
+ token: Record<string, Json>;
487
+ environmentVariables?: Record<string, string> | undefined;
488
+ } | {
489
+ script: string;
490
+ tokenType: LogtoJwtTokenKeyType.ClientCredentials;
491
+ token: Record<string, Json>;
492
+ environmentVariables?: Record<string, string> | undefined;
493
+ }, Record<string, unknown>>;
494
+ };
495
+ put: {
496
+ "/services/custom-jwt/worker": import("@withtyped/server").PathGuard<"/custom-jwt/worker", unknown, {
497
+ "jwt.accessToken"?: {
498
+ production?: string | undefined;
499
+ test?: string | undefined;
500
+ } | undefined;
501
+ "jwt.clientCredentials"?: {
502
+ production?: string | undefined;
503
+ test?: string | undefined;
504
+ } | undefined;
505
+ }, unknown>;
506
+ };
507
+ delete: {
508
+ "/services/custom-jwt/worker": import("@withtyped/server").PathGuard<"/custom-jwt/worker", unknown, unknown, unknown>;
509
+ };
510
+ copy: {};
511
+ head: {};
512
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
513
+ patch: {};
514
+ options: {};
515
+ get: {
516
+ "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
517
+ id: string;
518
+ createdAt: Date;
519
+ name: string;
520
+ updatedAt: Date;
521
+ quota: {
522
+ mauLimit: number | null;
523
+ tokenLimit: number | null;
524
+ applicationsLimit: number | null;
525
+ machineToMachineLimit: number | null;
526
+ resourcesLimit: number | null;
527
+ scopesPerResourceLimit: number | null;
528
+ customDomainEnabled: boolean;
529
+ omniSignInEnabled: boolean;
530
+ builtInEmailConnectorEnabled: boolean;
531
+ socialConnectorsLimit: number | null;
532
+ standardConnectorsLimit: number | null;
533
+ rolesLimit: number | null;
534
+ machineToMachineRolesLimit: number | null;
535
+ scopesPerRoleLimit: number | null;
536
+ hooksLimit: number | null;
537
+ auditLogsRetentionDays: number | null;
538
+ mfaEnabled: boolean;
539
+ organizationsEnabled: boolean;
540
+ ssoEnabled: boolean;
541
+ thirdPartyApplicationsLimit: number | null;
542
+ tenantMembersLimit: number | null;
543
+ customJwtEnabled: boolean;
544
+ subjectTokenEnabled: boolean;
545
+ bringYourUiEnabled: boolean;
546
+ };
547
+ stripeProducts: {
548
+ type: "flat" | "tier1" | "tier2" | "tier3";
549
+ id: string;
550
+ name: string;
551
+ price: {
552
+ id: string;
553
+ unitAmountDecimal: string;
554
+ quantity?: 1 | undefined;
555
+ unitAmount?: number | null | undefined;
556
+ };
557
+ description?: string | undefined;
558
+ }[];
559
+ }[]>;
560
+ };
561
+ post: {};
562
+ put: {};
563
+ delete: {};
564
+ copy: {};
565
+ head: {};
566
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
567
+ patch: {};
568
+ options: {};
569
+ get: {
570
+ "/skus": import("@withtyped/server").PathGuard<"/", {
571
+ type?: LogtoSkuType | undefined;
572
+ }, unknown, {
573
+ type: LogtoSkuType;
574
+ id: string;
575
+ name: string | null;
576
+ quota: {
577
+ mauLimit?: number | null | undefined;
578
+ tokenLimit?: number | null | undefined;
579
+ applicationsLimit?: number | null | undefined;
580
+ machineToMachineLimit?: number | null | undefined;
581
+ resourcesLimit?: number | null | undefined;
582
+ scopesPerResourceLimit?: number | null | undefined;
583
+ socialConnectorsLimit?: number | null | undefined;
584
+ machineToMachineRolesLimit?: number | null | undefined;
585
+ scopesPerRoleLimit?: number | null | undefined;
586
+ hooksLimit?: number | null | undefined;
587
+ auditLogsRetentionDays?: number | null | undefined;
588
+ mfaEnabled?: boolean | undefined;
589
+ organizationsEnabled?: boolean | undefined;
590
+ thirdPartyApplicationsLimit?: number | null | undefined;
591
+ tenantMembersLimit?: number | null | undefined;
592
+ customJwtEnabled?: boolean | undefined;
593
+ subjectTokenEnabled?: boolean | undefined;
594
+ bringYourUiEnabled?: boolean | undefined;
595
+ userRolesLimit?: number | null | undefined;
596
+ enterpriseSsoLimit?: number | null | undefined;
597
+ };
598
+ createdAt: Date;
599
+ updatedAt: Date;
600
+ unitPrice: number | null;
601
+ }[]>;
602
+ };
603
+ post: {};
604
+ put: {};
605
+ delete: {};
606
+ copy: {};
607
+ head: {};
608
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
609
+ patch: {};
610
+ options: {};
611
+ get: {
612
+ "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
613
+ id: string;
614
+ createdAt: Date;
615
+ userId: string;
616
+ status: "open" | "complete" | "expired";
617
+ tenantId: string | null;
618
+ updatedAt: Date;
619
+ planId: string;
620
+ skuId: string | null;
621
+ }>;
622
+ };
623
+ post: {
624
+ "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
625
+ planId: string;
626
+ successCallbackUrl: string;
627
+ tenantId?: string | undefined;
628
+ skuId?: string | undefined;
629
+ tenantName?: string | undefined;
630
+ tenantTag?: TenantTag | undefined;
631
+ tenantRegionName?: RegionName | undefined;
632
+ cancelCallbackUrl?: string | undefined;
633
+ }, {
634
+ sessionId: string;
635
+ redirectUri?: string | null | undefined;
636
+ }>;
637
+ };
638
+ put: {};
639
+ delete: {};
640
+ copy: {};
641
+ head: {};
642
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
643
+ patch: {};
644
+ options: {};
645
+ get: {
646
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
647
+ };
648
+ post: {
649
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
650
+ name: string;
651
+ }, {
652
+ id: string;
653
+ createdAt: Date;
654
+ name: string;
655
+ }>;
656
+ } & {
657
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
658
+ type: "hostname" | "query";
659
+ value: string;
660
+ }, {
661
+ createdAt: Date;
662
+ affiliateId: string;
663
+ type: "hostname" | "query";
664
+ value: string;
665
+ }>;
666
+ };
667
+ put: {};
668
+ delete: {
669
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
670
+ type: "hostname" | "query";
671
+ value: string;
672
+ }, unknown>;
673
+ };
674
+ copy: {};
675
+ head: {};
676
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
677
+ patch: {};
678
+ options: {};
679
+ get: {};
680
+ post: {
681
+ "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
682
+ createdAt: string;
683
+ userId: string;
684
+ hostname?: string | undefined;
685
+ query?: string | undefined;
686
+ }, {
687
+ id: string;
688
+ createdAt: Date;
689
+ affiliateId: string | null;
690
+ userId: string;
691
+ createdVia: {
692
+ createdAt: string;
693
+ hostname?: string | undefined;
694
+ query?: string | undefined;
695
+ };
696
+ }>;
697
+ };
698
+ put: {};
699
+ delete: {};
700
+ copy: {};
701
+ head: {};
702
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
703
+ patch: {
704
+ "/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:invitationId/status", unknown, {
705
+ status: OrganizationInvitationStatus.Accepted;
706
+ }, unknown>;
707
+ };
708
+ options: {};
709
+ get: {
710
+ "/invitations": import("@withtyped/server").PathGuard<"/", unknown, unknown, ({
711
+ id: string;
712
+ createdAt: number;
713
+ status: OrganizationInvitationStatus;
714
+ tenantId: string;
715
+ updatedAt: number;
716
+ inviterId: string | null;
717
+ invitee: string;
718
+ acceptedUserId: string | null;
719
+ organizationId: string;
720
+ expiresAt: number;
721
+ organizationRoles: OrganizationRoleEntity[];
722
+ } & {
723
+ tenantName: string;
724
+ tenantTag: TenantTag;
725
+ })[]>;
726
+ } & {
727
+ "/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:invitationId", unknown, unknown, {
728
+ id: string;
729
+ createdAt: number;
730
+ status: OrganizationInvitationStatus;
731
+ tenantId: string;
732
+ updatedAt: number;
733
+ inviterId: string | null;
734
+ invitee: string;
735
+ acceptedUserId: string | null;
736
+ organizationId: string;
737
+ expiresAt: number;
738
+ organizationRoles: OrganizationRoleEntity[];
739
+ }>;
740
+ };
741
+ post: {};
742
+ put: {};
743
+ delete: {};
744
+ copy: {};
745
+ head: {};
746
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
747
+ patch: {};
748
+ options: {};
749
+ get: {};
750
+ post: {};
751
+ put: {};
752
+ delete: {
753
+ "/me": import("@withtyped/server").PathGuard<"/", unknown, unknown, unknown>;
754
+ };
755
+ copy: {};
756
+ head: {};
757
+ }, "/api">>, "/api">;
758
+ export declare const tenantAuthRouter: import("@withtyped/server").Router<RequestContext, import("@withtyped/server").WithBodyContext<import("@withtyped/server").BaseContext & {
759
+ request: {
760
+ id?: string | undefined;
761
+ method?: import("@withtyped/server").RequestMethod | undefined;
762
+ headers: import("http").IncomingHttpHeaders;
763
+ url: URL;
764
+ body?: unknown;
765
+ };
766
+ }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
767
+ patch: {
768
+ "/:tenantId/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/status", unknown, {
769
+ status: OrganizationInvitationStatus.Revoked;
770
+ }, {
771
+ id: string;
772
+ createdAt: number;
773
+ status: OrganizationInvitationStatus;
774
+ tenantId: string;
775
+ updatedAt: number;
776
+ inviterId: string | null;
777
+ invitee: string;
778
+ acceptedUserId: string | null;
779
+ organizationId: string;
780
+ expiresAt: number;
781
+ organizationRoles: OrganizationRoleEntity[];
782
+ }>;
783
+ };
784
+ options: {};
785
+ get: {
786
+ "/:tenantId/members": import("@withtyped/server").PathGuard<"/:tenantId/members", unknown, unknown, {
787
+ id: string;
788
+ name: string | null;
789
+ username: string | null;
790
+ primaryEmail: string | null;
791
+ primaryPhone: string | null;
792
+ avatar: string | null;
793
+ organizationRoles: OrganizationRoleEntity[];
794
+ }[]>;
795
+ } & {
796
+ "/:tenantId/members/:userId/scopes": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/scopes", unknown, unknown, OrganizationScope[]>;
797
+ } & {
798
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, unknown, ({
799
+ id: string;
800
+ createdAt: number;
801
+ status: OrganizationInvitationStatus;
802
+ tenantId: string;
803
+ updatedAt: number;
804
+ inviterId: string | null;
805
+ invitee: string;
806
+ acceptedUserId: string | null;
807
+ organizationId: string;
808
+ expiresAt: number;
809
+ organizationRoles: OrganizationRoleEntity[];
810
+ } & {
811
+ inviterName?: string | undefined;
812
+ })[]>;
813
+ };
814
+ post: {
815
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, {
816
+ invitee: string;
817
+ roleName: TenantRole;
818
+ expiresAt?: number | undefined;
819
+ }, {
820
+ id: string;
821
+ createdAt: number;
822
+ status: OrganizationInvitationStatus;
823
+ tenantId: string;
824
+ updatedAt: number;
825
+ inviterId: string | null;
826
+ invitee: string;
827
+ acceptedUserId: string | null;
828
+ organizationId: string;
829
+ expiresAt: number;
830
+ organizationRoles: OrganizationRoleEntity[];
831
+ }>;
832
+ } & {
833
+ "/:tenantId/invitations/:invitationId/message": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/message", unknown, unknown, unknown>;
834
+ };
835
+ put: {
836
+ "/:tenantId/members/:userId/roles": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/roles", unknown, {
837
+ roleName: TenantRole;
838
+ }, unknown>;
839
+ };
840
+ delete: {
841
+ "/:tenantId/members/:userId": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId", unknown, unknown, unknown>;
842
+ } & {
843
+ "/:tenantId/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId", unknown, unknown, unknown>;
844
+ };
845
+ copy: {};
846
+ head: {};
847
+ }, "/api/tenants">>, "/api/tenants">;
848
+
849
+ export {
850
+ router as default,
851
+ };
852
+
853
+ export {};
package/package.json CHANGED
@@ -1,43 +1,45 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-4f1d80b",
3
+ "version": "0.2.5-50ff8fe",
4
4
  "description": "Logto Cloud service.",
5
5
  "main": "build/index.js",
6
6
  "author": "Silverhand Inc. <contact@silverhand.io>",
7
7
  "license": "Elastic-2.0",
8
8
  "type": "module",
9
9
  "files": [
10
- "build"
10
+ "lib"
11
11
  ],
12
12
  "exports": {
13
- "./routes": "./build/routes/index.js"
13
+ "./routes": "./lib/routes/index.js"
14
14
  },
15
15
  "imports": {
16
16
  "#src/*": "./build/*"
17
17
  },
18
18
  "devDependencies": {
19
- "@silverhand/eslint-config": "3.0.1",
20
- "@silverhand/jest-config": "3.0.0",
21
- "@silverhand/ts-config": "3.0.0",
19
+ "@silverhand/eslint-config": "6.0.1",
20
+ "@silverhand/ts-config": "6.0.0",
22
21
  "@types/accepts": "^1.3.5",
23
22
  "@types/http-proxy": "^1.17.9",
24
- "@types/jest": "^29.4.0",
25
23
  "@types/mime-types": "^2.1.1",
26
- "@types/node": "^18.11.18",
24
+ "@types/node": "^20.0.0",
27
25
  "@types/yargs": "^17.0.24",
28
- "dts-bundle-generator": "^8.0.1",
29
- "eslint": "^8.21.0",
30
- "jest": "^29.5.0",
31
- "lint-staged": "^13.0.0",
26
+ "dts-bundle-generator": "^9.3.1",
27
+ "eslint": "^8.57.0",
28
+ "lint-staged": "^15.0.0",
32
29
  "nodemon": "^3.0.0",
33
- "prettier": "^2.8.1",
34
- "typescript": "^5.0.0"
30
+ "prettier": "^3.0.0",
31
+ "typescript": "^5.3.3",
32
+ "vite-tsconfig-paths": "^4.3.1",
33
+ "vitest": "^2.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",
40
+ "rules": {
41
+ "no-console": "error"
42
+ },
41
43
  "ignorePatterns": [
42
44
  "types.test.ts"
43
45
  ]
@@ -47,22 +49,19 @@
47
49
  "access": "public"
48
50
  },
49
51
  "dependencies": {
50
- "@silverhand/essentials": "^2.7.0",
51
- "@withtyped/server": "^0.12.7"
52
+ "@silverhand/essentials": "^2.9.1",
53
+ "@withtyped/server": "^0.13.6"
52
54
  },
53
55
  "scripts": {
54
56
  "precommit": "lint-staged",
55
- "build": "rm -rf build/ && tsc -p tsconfig.build.json",
57
+ "build": "rm -rf build/ && tsc -p tsconfig.build.json && pnpm build:lib",
56
58
  "//": "It is not used to build the service itself.",
57
- "build:lib": "rm -rf build/ && dts-bundle-generator src/routes/index.ts --project tsconfig.build.json -o build/routes/index.d.ts",
58
- "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",
59
60
  "lint": "eslint --ext .ts src",
60
61
  "lint:report": "pnpm lint --format json --output-file report.json",
61
62
  "dev": "rm -rf build/ && nodemon",
62
63
  "start": "NODE_ENV=production node .",
63
- "test:only": "NODE_OPTIONS=\"--experimental-vm-modules --max_old_space_size=4096\" jest --logHeapUsage",
64
- "test": "pnpm build:test && pnpm test:only && pnpm build:lib && pnpm test:types",
65
- "test:ci": "pnpm test:only --coverage --silent",
64
+ "test": "vitest && pnpm build:lib && pnpm test:types",
66
65
  "test:types": "tsc -p tsconfig.test.types.json",
67
66
  "cli": "node ./build/cli/index.js"
68
67
  }
@@ -1,257 +0,0 @@
1
- // Generated by dts-bundle-generator v8.0.1
2
-
3
- import { RequestContext } from '@withtyped/server';
4
-
5
- export type WithAuthContext<Context = RequestContext> = Context & {
6
- auth: {
7
- id: string;
8
- scopes: string[];
9
- };
10
- };
11
- declare enum TenantTag {
12
- Development = "development",
13
- Staging = "staging",
14
- Production = "production"
15
- }
16
- declare enum VerificationCodeType {
17
- SignIn = "SignIn",
18
- Register = "Register",
19
- ForgotPassword = "ForgotPassword",
20
- /** @deprecated */
21
- Continue = "Continue",
22
- Generic = "Generic",
23
- /** @deprecated Use `Generic` type template for sending test sms/email use case */
24
- Test = "Test"
25
- }
26
- 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").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
27
- options: {};
28
- patch: {
29
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
30
- name?: string | undefined;
31
- tag?: TenantTag | undefined;
32
- }, {
33
- name: string;
34
- id: string;
35
- indicator: string;
36
- tag: TenantTag;
37
- }>;
38
- };
39
- get: {
40
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
41
- id: string;
42
- name: string;
43
- indicator: string;
44
- tag: TenantTag;
45
- subscriptionPlan: {
46
- id: string;
47
- name: string;
48
- quota: {
49
- mauLimit: number | null;
50
- applicationsLimit: number;
51
- machineToMachineLimit: number;
52
- resourcesLimit: number;
53
- scopesPerResourceLimit: number;
54
- customDomainEnabled: boolean;
55
- omniSignInEnabled: boolean;
56
- builtInEmailConnectorEnabled: boolean;
57
- socialConnectorsLimit: number | null;
58
- standardConnectorsLimit: number;
59
- rolesLimit: number;
60
- scopesPerRoleLimit: number | null;
61
- hooksLimit: number;
62
- auditLogsRetentionDays: number;
63
- };
64
- stripeProducts: {
65
- description?: string | undefined;
66
- id: string;
67
- name: string;
68
- type: "flat" | "tier1" | "tier2" | "tier3";
69
- price: {
70
- quantity?: 1 | undefined;
71
- unitAmount?: number | null | undefined;
72
- id: string;
73
- unitAmountDecimal: string;
74
- };
75
- }[];
76
- createdAt: Date;
77
- updatedAt: Date;
78
- };
79
- }[]>;
80
- } & {
81
- "/tenants/my": import("@withtyped/server").PathGuard<"/my", unknown, unknown, {
82
- id: string;
83
- name: string;
84
- indicator: string;
85
- tag: TenantTag;
86
- subscriptionPlan: {
87
- id: string;
88
- name: string;
89
- quota: {
90
- mauLimit: number | null;
91
- applicationsLimit: number;
92
- machineToMachineLimit: number;
93
- resourcesLimit: number;
94
- scopesPerResourceLimit: number;
95
- customDomainEnabled: boolean;
96
- omniSignInEnabled: boolean;
97
- builtInEmailConnectorEnabled: boolean;
98
- socialConnectorsLimit: number | null;
99
- standardConnectorsLimit: number;
100
- rolesLimit: number;
101
- scopesPerRoleLimit: number | null;
102
- hooksLimit: number;
103
- auditLogsRetentionDays: number;
104
- };
105
- stripeProducts: {
106
- description?: string | undefined;
107
- id: string;
108
- name: string;
109
- type: "flat" | "tier1" | "tier2" | "tier3";
110
- price: {
111
- quantity?: 1 | undefined;
112
- unitAmount?: number | null | undefined;
113
- id: string;
114
- unitAmountDecimal: string;
115
- };
116
- }[];
117
- createdAt: Date;
118
- updatedAt: Date;
119
- };
120
- }>;
121
- };
122
- post: {
123
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
124
- name?: string | undefined;
125
- tag?: TenantTag | undefined;
126
- }, {
127
- name: string;
128
- id: string;
129
- indicator: string;
130
- tag: TenantTag;
131
- }>;
132
- };
133
- put: {};
134
- head: {};
135
- delete: {
136
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
137
- };
138
- copy: {};
139
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
140
- options: {};
141
- patch: {};
142
- get: {
143
- "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
144
- from?: string | undefined;
145
- }, unknown, unknown>;
146
- };
147
- post: {
148
- "/services/send-email": import("@withtyped/server").PathGuard<"/send-email", unknown, {
149
- data: {
150
- type: VerificationCodeType;
151
- to: string;
152
- payload: {
153
- senderName?: string | undefined;
154
- companyInformation?: string | undefined;
155
- appLogo?: string | undefined;
156
- code: string;
157
- };
158
- };
159
- }, unknown>;
160
- } & {
161
- "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
162
- data: {
163
- type: VerificationCodeType;
164
- to: string;
165
- payload: {
166
- senderName?: string | undefined;
167
- companyInformation?: string | undefined;
168
- appLogo?: string | undefined;
169
- code: string;
170
- };
171
- };
172
- }, unknown>;
173
- } & {
174
- "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
175
- data: {
176
- type: VerificationCodeType;
177
- to: string;
178
- payload: {
179
- senderName?: string | undefined;
180
- companyInformation?: string | undefined;
181
- appLogo?: string | undefined;
182
- code: string;
183
- };
184
- };
185
- }, unknown>;
186
- };
187
- put: {};
188
- head: {};
189
- delete: {};
190
- copy: {};
191
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
192
- options: {};
193
- patch: {};
194
- get: {
195
- "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
196
- id: string;
197
- name: string;
198
- quota: {
199
- mauLimit: number | null;
200
- applicationsLimit: number;
201
- machineToMachineLimit: number;
202
- resourcesLimit: number;
203
- scopesPerResourceLimit: number;
204
- customDomainEnabled: boolean;
205
- omniSignInEnabled: boolean;
206
- builtInEmailConnectorEnabled: boolean;
207
- socialConnectorsLimit: number | null;
208
- standardConnectorsLimit: number;
209
- rolesLimit: number;
210
- scopesPerRoleLimit: number | null;
211
- hooksLimit: number;
212
- auditLogsRetentionDays: number;
213
- };
214
- stripeProducts: {
215
- description?: string | undefined;
216
- id: string;
217
- name: string;
218
- type: "flat" | "tier1" | "tier2" | "tier3";
219
- price: {
220
- quantity?: 1 | undefined;
221
- unitAmount?: number | null | undefined;
222
- id: string;
223
- unitAmountDecimal: string;
224
- };
225
- }[];
226
- createdAt: Date;
227
- updatedAt: Date;
228
- }[]>;
229
- };
230
- post: {};
231
- put: {};
232
- head: {};
233
- delete: {};
234
- copy: {};
235
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
236
- options: {};
237
- patch: {};
238
- get: {};
239
- post: {
240
- "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
241
- tenantId?: string | undefined;
242
- cancelCallbackUrl?: string | undefined;
243
- planId: string;
244
- successCallbackUrl: string;
245
- }, unknown>;
246
- };
247
- put: {};
248
- head: {};
249
- delete: {};
250
- copy: {};
251
- }, "/api">>, "/api">;
252
-
253
- export {
254
- router as default,
255
- };
256
-
257
- export {};