@logto/cloud 0.2.5-33a6965 → 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.
Files changed (2) hide show
  1. package/lib/routes/index.d.ts +653 -61
  2. package/package.json +16 -20
@@ -1,109 +1,449 @@
1
- // Generated by dts-bundle-generator v8.0.1
1
+ // Generated by dts-bundle-generator v9.3.1
2
2
 
3
- import { RequestContext } from '@withtyped/server';
3
+ import { Json, JsonObject, RequestContext } from '@withtyped/server';
4
4
  import { InferModelType } from '@withtyped/server/model';
5
5
 
6
6
  export type WithAuthContext<Context = RequestContext> = Context & {
7
7
  auth: {
8
+ /** The ID of the authenticated subject (`sub`). */
8
9
  id: string;
10
+ /** The scopes that the subject has (`scope`). */
9
11
  scopes: string[];
10
12
  };
11
13
  };
12
- declare enum TenantTag {
13
- Development = "development",
14
- Staging = "staging",
15
- Production = "production"
16
- }
17
14
  declare enum VerificationCodeType {
18
15
  SignIn = "SignIn",
19
16
  Register = "Register",
20
17
  ForgotPassword = "ForgotPassword",
21
- /** @deprecated */
22
- Continue = "Continue",
23
18
  Generic = "Generic",
24
19
  /** @deprecated Use `Generic` type template for sending test sms/email use case */
25
20
  Test = "Test"
26
21
  }
27
- declare const AffiliateProperties: import("@withtyped/server/model").default<"affiliate_properties", {
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", {
28
77
  createdAt: Date;
29
78
  affiliateId: string;
30
79
  type: "hostname" | "query";
31
80
  value: string;
32
81
  }, "createdAt", "createdAt">;
33
82
  export type AffiliateProperty = InferModelType<typeof AffiliateProperties>;
34
- declare const Affiliates: import("@withtyped/server/model").default<"affiliates", {
35
- id: string;
36
- createdAt: Date;
83
+ declare const Affiliates: import("@withtyped/server/lib/model/index.js").default<"affiliates", {
37
84
  name: string;
38
- }, "createdAt" | "id", "createdAt" | "id">;
85
+ createdAt: Date;
86
+ id: string;
87
+ }, "id" | "createdAt", "id" | "createdAt">;
39
88
  export type Affiliate = InferModelType<typeof Affiliates>;
89
+ declare enum RegionName {
90
+ EU = "EU",
91
+ US = "US"
92
+ }
40
93
  export type AffiliateData = Affiliate & {
41
94
  properties: Array<Pick<AffiliateProperty, "type" | "value">>;
42
95
  };
43
- declare const router: import("@withtyped/server").Router<WithAuthContext, import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
44
- options: {};
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<{
45
116
  patch: {
46
117
  "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
47
118
  name?: string | undefined;
48
- tag?: TenantTag | undefined;
49
119
  }, {
50
120
  id: string;
51
121
  name: string;
122
+ createdAt: Date;
123
+ usage: {
124
+ activeUsers: number;
125
+ cost: number;
126
+ tokenUsage: number;
127
+ };
52
128
  indicator: string;
129
+ isSuspended: boolean;
53
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;
54
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
+ }[];
55
161
  }>;
56
162
  };
163
+ options: {};
57
164
  get: {
58
165
  "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
59
166
  id: string;
60
167
  name: string;
168
+ createdAt: Date;
169
+ usage: {
170
+ activeUsers: number;
171
+ cost: number;
172
+ tokenUsage: number;
173
+ };
61
174
  indicator: string;
175
+ isSuspended: boolean;
62
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;
63
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
+ }[];
64
207
  }[]>;
65
208
  };
66
209
  post: {
67
210
  "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
68
211
  name?: string | undefined;
69
212
  tag?: TenantTag | undefined;
213
+ regionName?: RegionName | undefined;
70
214
  }, {
71
215
  id: string;
72
216
  name: string;
217
+ createdAt: Date;
218
+ usage: {
219
+ activeUsers: number;
220
+ cost: number;
221
+ tokenUsage: number;
222
+ };
73
223
  indicator: string;
224
+ isSuspended: boolean;
74
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;
75
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
+ }[];
76
256
  }>;
77
257
  };
78
258
  put: {};
79
- head: {};
80
259
  delete: {
81
260
  "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
82
261
  };
83
262
  copy: {};
263
+ head: {};
84
264
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
85
- options: {};
86
265
  patch: {};
266
+ options: {};
87
267
  get: {
88
268
  "/tenants/my/subscription": import("@withtyped/server").PathGuard<"/my/subscription", unknown, unknown, {
89
269
  status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
90
270
  planId: string;
91
271
  currentPeriodStart: Date;
92
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;
93
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>>;
94
330
  } & {
95
331
  "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, {
96
332
  status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
97
333
  planId: string;
98
334
  currentPeriodStart: Date;
99
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
+ };
100
440
  }>;
101
441
  } & {
102
442
  "/tenants/:tenantId/invoices": import("@withtyped/server").PathGuard<"/:tenantId/invoices", unknown, unknown, {
103
443
  invoices: {
104
444
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
105
- createdAt: Date;
106
445
  id: string;
446
+ createdAt: Date;
107
447
  updatedAt: Date;
108
448
  customerId: string | null;
109
449
  billingReason: string | null;
@@ -115,15 +455,27 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
115
455
  hostedInvoiceUrl: string | null;
116
456
  invoicePdf: string | null;
117
457
  planName: string | null;
458
+ skuId?: string | null | undefined;
118
459
  }[];
119
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
+ }>;
120
465
  } & {
121
466
  "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
122
467
  activeUsers: number;
123
468
  cost: number;
469
+ tokenUsage: number;
124
470
  }>;
125
471
  };
126
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
+ } & {
127
479
  "/tenants/:tenantId/stripe-customer-portal": import("@withtyped/server").PathGuard<"/:tenantId/stripe-customer-portal", unknown, {
128
480
  callbackUrl?: string | undefined;
129
481
  }, {
@@ -131,14 +483,14 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
131
483
  }>;
132
484
  };
133
485
  put: {};
134
- head: {};
135
486
  delete: {
136
487
  "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
137
488
  };
138
489
  copy: {};
490
+ head: {};
139
491
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
140
- options: {};
141
492
  patch: {};
493
+ options: {};
142
494
  get: {
143
495
  "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
144
496
  from?: string | undefined;
@@ -149,44 +501,74 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
149
501
  post: {
150
502
  "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
151
503
  data: {
152
- type: VerificationCodeType;
153
- to: string;
504
+ type: TemplateType | VerificationCodeType;
154
505
  payload: {
506
+ code?: string | undefined;
507
+ link?: string | undefined;
508
+ } & Record<string, string> & {
155
509
  senderName?: string | undefined;
156
510
  companyInformation?: string | undefined;
157
511
  appLogo?: string | undefined;
158
- code: string;
159
512
  };
513
+ to: string;
160
514
  };
161
515
  }, unknown>;
162
516
  } & {
163
517
  "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
164
518
  data: {
165
- type: VerificationCodeType;
519
+ type: TemplateType | VerificationCodeType;
166
520
  to: string;
167
521
  payload: {
168
- senderName?: string | undefined;
169
- companyInformation?: string | undefined;
170
- appLogo?: string | undefined;
171
- code: string;
172
- };
522
+ code?: string | undefined;
523
+ link?: string | undefined;
524
+ } & Record<string, string>;
173
525
  };
174
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>;
175
557
  };
176
- put: {};
177
- head: {};
178
- delete: {};
179
558
  copy: {};
559
+ head: {};
180
560
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
181
- options: {};
182
561
  patch: {};
562
+ options: {};
183
563
  get: {
184
564
  "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
185
- createdAt: Date;
186
565
  id: string;
566
+ createdAt: Date;
187
567
  name: string;
568
+ updatedAt: Date;
188
569
  quota: {
189
570
  mauLimit: number | null;
571
+ tokenLimit: number | null;
190
572
  applicationsLimit: number | null;
191
573
  machineToMachineLimit: number | null;
192
574
  resourcesLimit: number | null;
@@ -197,64 +579,117 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
197
579
  socialConnectorsLimit: number | null;
198
580
  standardConnectorsLimit: number | null;
199
581
  rolesLimit: number | null;
582
+ machineToMachineRolesLimit: number | null;
200
583
  scopesPerRoleLimit: number | null;
201
584
  hooksLimit: number | null;
202
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;
203
594
  };
204
595
  stripeProducts: {
205
- description?: string | undefined;
206
596
  type: "flat" | "tier1" | "tier2" | "tier3";
207
597
  id: string;
208
598
  name: string;
209
599
  price: {
210
- quantity?: 1 | undefined;
211
- unitAmount?: number | null | undefined;
212
600
  id: string;
213
601
  unitAmountDecimal: string;
602
+ quantity?: 1 | undefined;
603
+ unitAmount?: number | null | undefined;
214
604
  };
605
+ description?: string | undefined;
215
606
  }[];
216
- updatedAt: Date;
217
607
  }[]>;
218
608
  };
219
609
  post: {};
220
610
  put: {};
221
- head: {};
222
611
  delete: {};
223
612
  copy: {};
613
+ head: {};
224
614
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
615
+ patch: {};
225
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<{
226
657
  patch: {};
658
+ options: {};
227
659
  get: {
228
660
  "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
229
- status: "open" | "complete" | "expired";
230
- createdAt: Date;
231
661
  id: string;
662
+ createdAt: Date;
232
663
  userId: string;
233
- updatedAt: Date;
664
+ status: "open" | "complete" | "expired";
234
665
  tenantId: string | null;
666
+ updatedAt: Date;
235
667
  planId: string;
668
+ skuId: string | null;
236
669
  }>;
237
670
  };
238
671
  post: {
239
672
  "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
673
+ planId: string;
674
+ successCallbackUrl: string;
240
675
  tenantId?: string | undefined;
241
- tenantTag?: TenantTag | undefined;
676
+ skuId?: string | undefined;
242
677
  tenantName?: string | undefined;
678
+ tenantTag?: TenantTag | undefined;
679
+ tenantRegionName?: RegionName | undefined;
243
680
  cancelCallbackUrl?: string | undefined;
244
- planId: string;
245
- successCallbackUrl: string;
246
681
  }, {
247
- redirectUri?: string | null | undefined;
248
682
  sessionId: string;
683
+ redirectUri?: string | null | undefined;
249
684
  }>;
250
685
  };
251
686
  put: {};
252
- head: {};
253
687
  delete: {};
254
688
  copy: {};
689
+ head: {};
255
690
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
256
- options: {};
257
691
  patch: {};
692
+ options: {};
258
693
  get: {
259
694
  "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
260
695
  };
@@ -262,57 +697,214 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
262
697
  "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
263
698
  name: string;
264
699
  }, {
265
- createdAt: Date;
266
700
  id: string;
701
+ createdAt: Date;
267
702
  name: string;
268
703
  }>;
269
704
  } & {
270
705
  "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
271
- value: string;
272
706
  type: "hostname" | "query";
273
- }, {
274
707
  value: string;
275
- type: "hostname" | "query";
708
+ }, {
276
709
  createdAt: Date;
277
710
  affiliateId: string;
711
+ type: "hostname" | "query";
712
+ value: string;
278
713
  }>;
279
714
  };
280
715
  put: {};
281
- head: {};
282
716
  delete: {
283
717
  "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
284
- value: string;
285
718
  type: "hostname" | "query";
719
+ value: string;
286
720
  }, unknown>;
287
721
  };
288
722
  copy: {};
723
+ head: {};
289
724
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
290
- options: {};
291
725
  patch: {};
726
+ options: {};
292
727
  get: {};
293
728
  post: {
294
729
  "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
295
- hostname?: string | undefined;
296
- query?: string | undefined;
297
730
  createdAt: string;
298
731
  userId: string;
732
+ hostname?: string | undefined;
733
+ query?: string | undefined;
299
734
  }, {
300
- createdAt: Date;
301
735
  id: string;
736
+ createdAt: Date;
302
737
  affiliateId: string | null;
303
738
  userId: string;
304
739
  createdVia: {
740
+ createdAt: string;
305
741
  hostname?: string | undefined;
306
742
  query?: string | undefined;
307
- createdAt: string;
308
743
  };
309
744
  }>;
310
745
  };
311
746
  put: {};
747
+ delete: {};
748
+ copy: {};
312
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: {};
313
791
  delete: {};
314
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: {};
315
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">;
316
908
 
317
909
  export {
318
910
  router as default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-33a6965",
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>",
@@ -16,25 +16,24 @@
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",
@@ -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.1",
53
+ "@withtyped/server": "^0.13.6"
55
54
  },
56
55
  "scripts": {
57
56
  "precommit": "lint-staged",
58
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 lib/ && dts-bundle-generator src/routes/index.ts --project tsconfig.build.json -o lib/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
  }