@logto/cloud 0.2.5-2a777a1 → 0.2.5-3046fa6

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 +127 -72
  2. package/package.json +7 -7
@@ -37,6 +37,20 @@ declare enum OrganizationInvitationStatus {
37
37
  Expired = "Expired",
38
38
  Revoked = "Revoked"
39
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
+ }
40
54
  /**
41
55
  * The simplified organization role entity that is returned in the `roles` field
42
56
  * of the organization.
@@ -52,12 +66,34 @@ declare enum TenantTag {
52
66
  declare enum TenantRole {
53
67
  /** Admin of the tenant, who has all permissions. */
54
68
  Admin = "admin",
55
- /** Member of the tenant, who has permissions to operate the tenant data, but not the tenant settings. */
56
- Member = "member"
69
+ /** Collaborator of the tenant, who has permissions to operate the tenant data, but not the tenant settings. */
70
+ Collaborator = "collaborator"
57
71
  }
58
- declare enum LogtoJwtTokenPath {
59
- AccessToken = "access-token",
60
- ClientCredentials = "client-credentials"
72
+ declare enum ReservedPlanId {
73
+ Free = "free",
74
+ /**
75
+ * @deprecated
76
+ * In recent refactoring, the `hobby` plan is now treated as the `pro` plan.
77
+ * Only use this plan ID to check if a plan is a `pro` plan or not.
78
+ * This plan ID will be renamed to `pro` after legacy Stripe data is migrated by @darcyYe
79
+ *
80
+ * Todo @darcyYe:
81
+ * - LOG-7846: Rename `hobby` to `pro` and `pro` to `legacy-pro`
82
+ * - LOG-8339: Migrate legacy Stripe data
83
+ */
84
+ Hobby = "hobby",
85
+ Pro = "pro",
86
+ /**
87
+ * @deprecated
88
+ * Should not use this plan ID, we only use this tag as a record for the legacy `pro` plan since we will rename the `hobby` plan to be `pro`.
89
+ */
90
+ GrandfatheredPro = "grandfathered-pro",
91
+ Development = "dev",
92
+ /**
93
+ * This plan ID is reserved for Admin tenant.
94
+ * In our new pricing model, we plan to add a special plan for Admin tenant, previously, admin tenant is using the `pro` plan, which is not suitable.
95
+ */
96
+ Admin = "admin"
61
97
  }
62
98
  declare const AffiliateProperties: import("@withtyped/server/lib/model/index.js").default<"affiliate_properties", {
63
99
  createdAt: Date;
@@ -72,11 +108,16 @@ declare const Affiliates: import("@withtyped/server/lib/model/index.js").default
72
108
  id: string;
73
109
  }, "id" | "createdAt", "id" | "createdAt">;
74
110
  export type Affiliate = InferModelType<typeof Affiliates>;
111
+ declare enum RegionName {
112
+ EU = "EU",
113
+ US = "US"
114
+ }
75
115
  export type AffiliateData = Affiliate & {
76
116
  properties: Array<Pick<AffiliateProperty, "type" | "value">>;
77
117
  };
78
118
  declare const router: import("@withtyped/server").Router<RequestContext, WithAuthContext<Omit<import("@withtyped/server").BaseContext & {
79
119
  request: {
120
+ id?: string | undefined;
80
121
  method?: import("@withtyped/server").RequestMethod | undefined;
81
122
  headers: import("http").IncomingHttpHeaders;
82
123
  url: URL;
@@ -84,6 +125,7 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
84
125
  };
85
126
  }, "request"> & {
86
127
  request: Record<string, unknown> & {
128
+ id?: string | undefined;
87
129
  method?: import("@withtyped/server").RequestMethod | undefined;
88
130
  headers: import("http").IncomingHttpHeaders;
89
131
  url: URL;
@@ -92,13 +134,14 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
92
134
  body?: Json | undefined;
93
135
  bodyRaw?: Buffer | undefined;
94
136
  };
95
- }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
137
+ }>, 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<{
96
138
  patch: {
97
139
  "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
98
140
  name?: string | undefined;
99
141
  }, {
100
142
  id: string;
101
143
  name: string;
144
+ createdAt: Date;
102
145
  usage: {
103
146
  activeUsers: number;
104
147
  cost: number;
@@ -113,6 +156,8 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
113
156
  currentPeriodStart: Date;
114
157
  currentPeriodEnd: Date;
115
158
  };
159
+ regionName: RegionName;
160
+ tag: TenantTag;
116
161
  openInvoices: {
117
162
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
118
163
  id: string;
@@ -128,7 +173,6 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
128
173
  hostedInvoiceUrl: string | null;
129
174
  invoicePdf: string | null;
130
175
  }[];
131
- tag: TenantTag;
132
176
  }>;
133
177
  };
134
178
  options: {};
@@ -136,6 +180,7 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
136
180
  "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
137
181
  id: string;
138
182
  name: string;
183
+ createdAt: Date;
139
184
  usage: {
140
185
  activeUsers: number;
141
186
  cost: number;
@@ -150,6 +195,8 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
150
195
  currentPeriodStart: Date;
151
196
  currentPeriodEnd: Date;
152
197
  };
198
+ regionName: RegionName;
199
+ tag: TenantTag;
153
200
  openInvoices: {
154
201
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
155
202
  id: string;
@@ -165,16 +212,17 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
165
212
  hostedInvoiceUrl: string | null;
166
213
  invoicePdf: string | null;
167
214
  }[];
168
- tag: TenantTag;
169
215
  }[]>;
170
216
  };
171
217
  post: {
172
218
  "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
173
219
  name?: string | undefined;
174
220
  tag?: TenantTag | undefined;
221
+ regionName?: RegionName | undefined;
175
222
  }, {
176
223
  id: string;
177
224
  name: string;
225
+ createdAt: Date;
178
226
  usage: {
179
227
  activeUsers: number;
180
228
  cost: number;
@@ -189,6 +237,8 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
189
237
  currentPeriodStart: Date;
190
238
  currentPeriodEnd: Date;
191
239
  };
240
+ regionName: RegionName;
241
+ tag: TenantTag;
192
242
  openInvoices: {
193
243
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
194
244
  id: string;
@@ -204,7 +254,6 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
204
254
  hostedInvoiceUrl: string | null;
205
255
  invoicePdf: string | null;
206
256
  }[];
207
- tag: TenantTag;
208
257
  }>;
209
258
  };
210
259
  put: {};
@@ -310,21 +359,36 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
310
359
  };
311
360
  }, unknown>;
312
361
  } & {
313
- "/services/custom-jwt": import("@withtyped/server").PathGuard<"/custom-jwt", unknown, {
362
+ "/services/custom-jwt": import("@withtyped/server").PathGuard<"/custom-jwt", {
363
+ isTest?: string | undefined;
364
+ }, {
365
+ context: Record<string, Json>;
314
366
  script: string;
367
+ tokenType: LogtoJwtTokenKeyType.AccessToken;
315
368
  token: Record<string, Json>;
316
- tokenType: LogtoJwtTokenPath.AccessToken;
317
- context: Record<string, Json>;
318
- envVars?: Record<string, string> | undefined;
369
+ environmentVariables?: Record<string, string> | undefined;
319
370
  } | {
320
371
  script: string;
372
+ tokenType: LogtoJwtTokenKeyType.ClientCredentials;
321
373
  token: Record<string, Json>;
322
- tokenType: LogtoJwtTokenPath.ClientCredentials;
323
- envVars?: Record<string, string> | undefined;
374
+ environmentVariables?: Record<string, string> | undefined;
324
375
  }, Record<string, unknown>>;
325
376
  };
326
- put: {};
327
- delete: {};
377
+ put: {
378
+ "/services/custom-jwt/worker": import("@withtyped/server").PathGuard<"/custom-jwt/worker", unknown, {
379
+ "jwt.accessToken"?: {
380
+ production?: string | undefined;
381
+ test?: string | undefined;
382
+ } | undefined;
383
+ "jwt.clientCredentials"?: {
384
+ production?: string | undefined;
385
+ test?: string | undefined;
386
+ } | undefined;
387
+ }, unknown>;
388
+ };
389
+ delete: {
390
+ "/services/custom-jwt/worker": import("@withtyped/server").PathGuard<"/custom-jwt/worker", unknown, unknown, unknown>;
391
+ };
328
392
  copy: {};
329
393
  head: {};
330
394
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
@@ -336,18 +400,6 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
336
400
  createdAt: Date;
337
401
  name: string;
338
402
  updatedAt: Date;
339
- stripeProducts: {
340
- type: "flat" | "tier1" | "tier2" | "tier3";
341
- id: string;
342
- name: string;
343
- price: {
344
- id: string;
345
- unitAmountDecimal: string;
346
- quantity?: 1 | undefined;
347
- unitAmount?: number | null | undefined;
348
- };
349
- description?: string | undefined;
350
- }[];
351
403
  quota: {
352
404
  mauLimit: number | null;
353
405
  tokenLimit: number | null;
@@ -369,7 +421,22 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
369
421
  organizationsEnabled: boolean;
370
422
  ssoEnabled: boolean;
371
423
  thirdPartyApplicationsLimit: number | null;
424
+ tenantMembersLimit: number | null;
425
+ customJwtEnabled: boolean;
426
+ subjectTokenEnabled: boolean;
372
427
  };
428
+ stripeProducts: {
429
+ type: "flat" | "tier1" | "tier2" | "tier3";
430
+ id: string;
431
+ name: string;
432
+ price: {
433
+ id: string;
434
+ unitAmountDecimal: string;
435
+ quantity?: 1 | undefined;
436
+ unitAmount?: number | null | undefined;
437
+ };
438
+ description?: string | undefined;
439
+ }[];
373
440
  }[]>;
374
441
  };
375
442
  post: {};
@@ -393,12 +460,13 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
393
460
  };
394
461
  post: {
395
462
  "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
396
- planId: string;
463
+ planId: ReservedPlanId;
397
464
  successCallbackUrl: string;
398
465
  tenantId?: string | undefined;
399
466
  cancelCallbackUrl?: string | undefined;
400
467
  tenantTag?: TenantTag | undefined;
401
468
  tenantName?: string | undefined;
469
+ tenantRegionName?: RegionName | undefined;
402
470
  }, {
403
471
  sessionId: string;
404
472
  redirectUri?: string | null | undefined;
@@ -482,15 +550,15 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
482
550
  status: OrganizationInvitationStatus;
483
551
  tenantId: string;
484
552
  updatedAt: number;
485
- organizationId: string;
486
553
  inviterId: string | null;
487
554
  invitee: string;
488
- expiresAt: number;
489
555
  acceptedUserId: string | null;
556
+ organizationId: string;
557
+ expiresAt: number;
490
558
  organizationRoles: OrganizationRoleEntity[];
491
559
  } & {
492
- tenantTag: TenantTag;
493
560
  tenantName: string;
561
+ tenantTag: TenantTag;
494
562
  })[]>;
495
563
  } & {
496
564
  "/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:invitationId", unknown, unknown, {
@@ -499,11 +567,11 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
499
567
  status: OrganizationInvitationStatus;
500
568
  tenantId: string;
501
569
  updatedAt: number;
502
- organizationId: string;
503
570
  inviterId: string | null;
504
571
  invitee: string;
505
- expiresAt: number;
506
572
  acceptedUserId: string | null;
573
+ organizationId: string;
574
+ expiresAt: number;
507
575
  organizationRoles: OrganizationRoleEntity[];
508
576
  }>;
509
577
  };
@@ -512,9 +580,21 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
512
580
  delete: {};
513
581
  copy: {};
514
582
  head: {};
583
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
584
+ patch: {};
585
+ options: {};
586
+ get: {};
587
+ post: {};
588
+ put: {};
589
+ delete: {
590
+ "/me": import("@withtyped/server").PathGuard<"/", unknown, unknown, unknown>;
591
+ };
592
+ copy: {};
593
+ head: {};
515
594
  }, "/api">>, "/api">;
516
595
  export declare const tenantAuthRouter: import("@withtyped/server").Router<RequestContext, import("@withtyped/server").WithBodyContext<import("@withtyped/server").BaseContext & {
517
596
  request: {
597
+ id?: string | undefined;
518
598
  method?: import("@withtyped/server").RequestMethod | undefined;
519
599
  headers: import("http").IncomingHttpHeaders;
520
600
  url: URL;
@@ -530,11 +610,11 @@ export declare const tenantAuthRouter: import("@withtyped/server").Router<Reques
530
610
  status: OrganizationInvitationStatus;
531
611
  tenantId: string;
532
612
  updatedAt: number;
533
- organizationId: string;
534
613
  inviterId: string | null;
535
614
  invitee: string;
536
- expiresAt: number;
537
615
  acceptedUserId: string | null;
616
+ organizationId: string;
617
+ expiresAt: number;
538
618
  organizationRoles: OrganizationRoleEntity[];
539
619
  }>;
540
620
  };
@@ -550,19 +630,23 @@ export declare const tenantAuthRouter: import("@withtyped/server").Router<Reques
550
630
  organizationRoles: OrganizationRoleEntity[];
551
631
  }[]>;
552
632
  } & {
553
- "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, unknown, {
633
+ "/:tenantId/members/:userId/scopes": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/scopes", unknown, unknown, OrganizationScope[]>;
634
+ } & {
635
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, unknown, ({
554
636
  id: string;
555
637
  createdAt: number;
556
638
  status: OrganizationInvitationStatus;
557
639
  tenantId: string;
558
640
  updatedAt: number;
559
- organizationId: string;
560
641
  inviterId: string | null;
561
642
  invitee: string;
562
- expiresAt: number;
563
643
  acceptedUserId: string | null;
644
+ organizationId: string;
645
+ expiresAt: number;
564
646
  organizationRoles: OrganizationRoleEntity[];
565
- }[]>;
647
+ } & {
648
+ inviterName?: string | undefined;
649
+ })[]>;
566
650
  };
567
651
  post: {
568
652
  "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, {
@@ -575,11 +659,11 @@ export declare const tenantAuthRouter: import("@withtyped/server").Router<Reques
575
659
  status: OrganizationInvitationStatus;
576
660
  tenantId: string;
577
661
  updatedAt: number;
578
- organizationId: string;
579
662
  inviterId: string | null;
580
663
  invitee: string;
581
- expiresAt: number;
582
664
  acceptedUserId: string | null;
665
+ organizationId: string;
666
+ expiresAt: number;
583
667
  organizationRoles: OrganizationRoleEntity[];
584
668
  }>;
585
669
  } & {
@@ -598,35 +682,6 @@ export declare const tenantAuthRouter: import("@withtyped/server").Router<Reques
598
682
  copy: {};
599
683
  head: {};
600
684
  }, "/api/tenants">>, "/api/tenants">;
601
- export declare const functionsRouter: import("@withtyped/server").Router<RequestContext, WithAuthContext<Omit<import("@withtyped/server").BaseContext & {
602
- request: {
603
- method?: import("@withtyped/server").RequestMethod | undefined;
604
- headers: import("http").IncomingHttpHeaders;
605
- url: URL;
606
- body?: unknown;
607
- };
608
- }, "request"> & {
609
- request: Record<string, unknown> & {
610
- method?: import("@withtyped/server").RequestMethod | undefined;
611
- headers: import("http").IncomingHttpHeaders;
612
- url: URL;
613
- body?: unknown;
614
- } & {
615
- body?: Json | undefined;
616
- bodyRaw?: Buffer | undefined;
617
- };
618
- }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
619
- patch: {};
620
- options: {};
621
- get: {};
622
- post: {
623
- "/database-alteration": import("@withtyped/server").PathGuard<"/database-alteration", unknown, Json, unknown>;
624
- };
625
- put: {};
626
- delete: {};
627
- copy: {};
628
- head: {};
629
- }, "/functions">>, "/functions">;
630
685
 
631
686
  export {
632
687
  router as default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-2a777a1",
3
+ "version": "0.2.5-3046fa6",
4
4
  "description": "Logto Cloud service.",
5
5
  "main": "build/index.js",
6
6
  "author": "Silverhand Inc. <contact@silverhand.io>",
@@ -16,21 +16,21 @@
16
16
  "#src/*": "./build/*"
17
17
  },
18
18
  "devDependencies": {
19
- "@silverhand/eslint-config": "5.0.0",
20
- "@silverhand/ts-config": "5.0.0",
19
+ "@silverhand/eslint-config": "6.0.1",
20
+ "@silverhand/ts-config": "6.0.0",
21
21
  "@types/accepts": "^1.3.5",
22
22
  "@types/http-proxy": "^1.17.9",
23
23
  "@types/mime-types": "^2.1.1",
24
24
  "@types/node": "^20.0.0",
25
25
  "@types/yargs": "^17.0.24",
26
26
  "dts-bundle-generator": "^9.3.1",
27
- "eslint": "^8.44.0",
27
+ "eslint": "^8.57.0",
28
28
  "lint-staged": "^15.0.0",
29
29
  "nodemon": "^3.0.0",
30
30
  "prettier": "^3.0.0",
31
31
  "typescript": "^5.3.3",
32
32
  "vite-tsconfig-paths": "^4.3.1",
33
- "vitest": "^1.0.0"
33
+ "vitest": "^1.5.0"
34
34
  },
35
35
  "engines": {
36
36
  "node": "^20.9.0"
@@ -49,8 +49,8 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@silverhand/essentials": "^2.9.0",
53
- "@withtyped/server": "^0.13.3"
52
+ "@silverhand/essentials": "^2.9.1",
53
+ "@withtyped/server": "^0.13.6"
54
54
  },
55
55
  "scripts": {
56
56
  "precommit": "lint-staged",