@logto/cloud 0.2.5-2a72cc4 → 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 +145 -34
  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,8 +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"
71
+ }
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"
57
97
  }
58
98
  declare const AffiliateProperties: import("@withtyped/server/lib/model/index.js").default<"affiliate_properties", {
59
99
  createdAt: Date;
@@ -68,11 +108,16 @@ declare const Affiliates: import("@withtyped/server/lib/model/index.js").default
68
108
  id: string;
69
109
  }, "id" | "createdAt", "id" | "createdAt">;
70
110
  export type Affiliate = InferModelType<typeof Affiliates>;
111
+ declare enum RegionName {
112
+ EU = "EU",
113
+ US = "US"
114
+ }
71
115
  export type AffiliateData = Affiliate & {
72
116
  properties: Array<Pick<AffiliateProperty, "type" | "value">>;
73
117
  };
74
118
  declare const router: import("@withtyped/server").Router<RequestContext, WithAuthContext<Omit<import("@withtyped/server").BaseContext & {
75
119
  request: {
120
+ id?: string | undefined;
76
121
  method?: import("@withtyped/server").RequestMethod | undefined;
77
122
  headers: import("http").IncomingHttpHeaders;
78
123
  url: URL;
@@ -80,6 +125,7 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
80
125
  };
81
126
  }, "request"> & {
82
127
  request: Record<string, unknown> & {
128
+ id?: string | undefined;
83
129
  method?: import("@withtyped/server").RequestMethod | undefined;
84
130
  headers: import("http").IncomingHttpHeaders;
85
131
  url: URL;
@@ -88,13 +134,14 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
88
134
  body?: Json | undefined;
89
135
  bodyRaw?: Buffer | undefined;
90
136
  };
91
- }>, 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<{
92
138
  patch: {
93
139
  "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
94
140
  name?: string | undefined;
95
141
  }, {
96
142
  id: string;
97
143
  name: string;
144
+ createdAt: Date;
98
145
  usage: {
99
146
  activeUsers: number;
100
147
  cost: number;
@@ -109,6 +156,8 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
109
156
  currentPeriodStart: Date;
110
157
  currentPeriodEnd: Date;
111
158
  };
159
+ regionName: RegionName;
160
+ tag: TenantTag;
112
161
  openInvoices: {
113
162
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
114
163
  id: string;
@@ -124,7 +173,6 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
124
173
  hostedInvoiceUrl: string | null;
125
174
  invoicePdf: string | null;
126
175
  }[];
127
- tag: TenantTag;
128
176
  }>;
129
177
  };
130
178
  options: {};
@@ -132,6 +180,7 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
132
180
  "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
133
181
  id: string;
134
182
  name: string;
183
+ createdAt: Date;
135
184
  usage: {
136
185
  activeUsers: number;
137
186
  cost: number;
@@ -146,6 +195,8 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
146
195
  currentPeriodStart: Date;
147
196
  currentPeriodEnd: Date;
148
197
  };
198
+ regionName: RegionName;
199
+ tag: TenantTag;
149
200
  openInvoices: {
150
201
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
151
202
  id: string;
@@ -161,16 +212,17 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
161
212
  hostedInvoiceUrl: string | null;
162
213
  invoicePdf: string | null;
163
214
  }[];
164
- tag: TenantTag;
165
215
  }[]>;
166
216
  };
167
217
  post: {
168
218
  "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
169
219
  name?: string | undefined;
170
220
  tag?: TenantTag | undefined;
221
+ regionName?: RegionName | undefined;
171
222
  }, {
172
223
  id: string;
173
224
  name: string;
225
+ createdAt: Date;
174
226
  usage: {
175
227
  activeUsers: number;
176
228
  cost: number;
@@ -185,6 +237,8 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
185
237
  currentPeriodStart: Date;
186
238
  currentPeriodEnd: Date;
187
239
  };
240
+ regionName: RegionName;
241
+ tag: TenantTag;
188
242
  openInvoices: {
189
243
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
190
244
  id: string;
@@ -200,7 +254,6 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
200
254
  hostedInvoiceUrl: string | null;
201
255
  invoicePdf: string | null;
202
256
  }[];
203
- tag: TenantTag;
204
257
  }>;
205
258
  };
206
259
  put: {};
@@ -306,15 +359,36 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
306
359
  };
307
360
  }, unknown>;
308
361
  } & {
309
- "/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>;
366
+ script: string;
367
+ tokenType: LogtoJwtTokenKeyType.AccessToken;
368
+ token: Record<string, Json>;
369
+ environmentVariables?: Record<string, string> | undefined;
370
+ } | {
310
371
  script: string;
372
+ tokenType: LogtoJwtTokenKeyType.ClientCredentials;
311
373
  token: Record<string, Json>;
312
- envVars?: Record<string, string> | undefined;
313
- context?: Record<string, Json> | undefined;
374
+ environmentVariables?: Record<string, string> | undefined;
314
375
  }, Record<string, unknown>>;
315
376
  };
316
- put: {};
317
- 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
+ };
318
392
  copy: {};
319
393
  head: {};
320
394
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
@@ -326,18 +400,6 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
326
400
  createdAt: Date;
327
401
  name: string;
328
402
  updatedAt: Date;
329
- stripeProducts: {
330
- type: "flat" | "tier1" | "tier2" | "tier3";
331
- id: string;
332
- name: string;
333
- price: {
334
- id: string;
335
- unitAmountDecimal: string;
336
- quantity?: 1 | undefined;
337
- unitAmount?: number | null | undefined;
338
- };
339
- description?: string | undefined;
340
- }[];
341
403
  quota: {
342
404
  mauLimit: number | null;
343
405
  tokenLimit: number | null;
@@ -359,7 +421,22 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
359
421
  organizationsEnabled: boolean;
360
422
  ssoEnabled: boolean;
361
423
  thirdPartyApplicationsLimit: number | null;
424
+ tenantMembersLimit: number | null;
425
+ customJwtEnabled: boolean;
426
+ subjectTokenEnabled: boolean;
362
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
+ }[];
363
440
  }[]>;
364
441
  };
365
442
  post: {};
@@ -383,12 +460,13 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
383
460
  };
384
461
  post: {
385
462
  "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
386
- planId: string;
463
+ planId: ReservedPlanId;
387
464
  successCallbackUrl: string;
388
465
  tenantId?: string | undefined;
389
466
  cancelCallbackUrl?: string | undefined;
390
467
  tenantTag?: TenantTag | undefined;
391
468
  tenantName?: string | undefined;
469
+ tenantRegionName?: RegionName | undefined;
392
470
  }, {
393
471
  sessionId: string;
394
472
  redirectUri?: string | null | undefined;
@@ -466,17 +544,34 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
466
544
  };
467
545
  options: {};
468
546
  get: {
469
- "/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:invitationId", unknown, unknown, {
547
+ "/invitations": import("@withtyped/server").PathGuard<"/", unknown, unknown, ({
470
548
  id: string;
471
549
  createdAt: number;
472
550
  status: OrganizationInvitationStatus;
473
551
  tenantId: string;
474
552
  updatedAt: number;
475
- organizationId: string;
476
553
  inviterId: string | null;
554
+ invitee: string;
555
+ acceptedUserId: string | null;
556
+ organizationId: string;
477
557
  expiresAt: number;
558
+ organizationRoles: OrganizationRoleEntity[];
559
+ } & {
560
+ tenantName: string;
561
+ tenantTag: TenantTag;
562
+ })[]>;
563
+ } & {
564
+ "/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:invitationId", unknown, unknown, {
565
+ id: string;
566
+ createdAt: number;
567
+ status: OrganizationInvitationStatus;
568
+ tenantId: string;
569
+ updatedAt: number;
570
+ inviterId: string | null;
478
571
  invitee: string;
479
572
  acceptedUserId: string | null;
573
+ organizationId: string;
574
+ expiresAt: number;
480
575
  organizationRoles: OrganizationRoleEntity[];
481
576
  }>;
482
577
  };
@@ -485,9 +580,21 @@ declare const router: import("@withtyped/server").Router<RequestContext, WithAut
485
580
  delete: {};
486
581
  copy: {};
487
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: {};
488
594
  }, "/api">>, "/api">;
489
595
  export declare const tenantAuthRouter: import("@withtyped/server").Router<RequestContext, import("@withtyped/server").WithBodyContext<import("@withtyped/server").BaseContext & {
490
596
  request: {
597
+ id?: string | undefined;
491
598
  method?: import("@withtyped/server").RequestMethod | undefined;
492
599
  headers: import("http").IncomingHttpHeaders;
493
600
  url: URL;
@@ -503,11 +610,11 @@ export declare const tenantAuthRouter: import("@withtyped/server").Router<Reques
503
610
  status: OrganizationInvitationStatus;
504
611
  tenantId: string;
505
612
  updatedAt: number;
506
- organizationId: string;
507
613
  inviterId: string | null;
508
- expiresAt: number;
509
614
  invitee: string;
510
615
  acceptedUserId: string | null;
616
+ organizationId: string;
617
+ expiresAt: number;
511
618
  organizationRoles: OrganizationRoleEntity[];
512
619
  }>;
513
620
  };
@@ -523,19 +630,23 @@ export declare const tenantAuthRouter: import("@withtyped/server").Router<Reques
523
630
  organizationRoles: OrganizationRoleEntity[];
524
631
  }[]>;
525
632
  } & {
526
- "/: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, ({
527
636
  id: string;
528
637
  createdAt: number;
529
638
  status: OrganizationInvitationStatus;
530
639
  tenantId: string;
531
640
  updatedAt: number;
532
- organizationId: string;
533
641
  inviterId: string | null;
534
- expiresAt: number;
535
642
  invitee: string;
536
643
  acceptedUserId: string | null;
644
+ organizationId: string;
645
+ expiresAt: number;
537
646
  organizationRoles: OrganizationRoleEntity[];
538
- }[]>;
647
+ } & {
648
+ inviterName?: string | undefined;
649
+ })[]>;
539
650
  };
540
651
  post: {
541
652
  "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, {
@@ -548,11 +659,11 @@ export declare const tenantAuthRouter: import("@withtyped/server").Router<Reques
548
659
  status: OrganizationInvitationStatus;
549
660
  tenantId: string;
550
661
  updatedAt: number;
551
- organizationId: string;
552
662
  inviterId: string | null;
553
- expiresAt: number;
554
663
  invitee: string;
555
664
  acceptedUserId: string | null;
665
+ organizationId: string;
666
+ expiresAt: number;
556
667
  organizationRoles: OrganizationRoleEntity[];
557
668
  }>;
558
669
  } & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-2a72cc4",
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",