@logto/cloud 0.2.5-9257c0d → 0.2.5-a21a38a

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 +193 -22
  2. package/package.json +12 -11
@@ -1,11 +1,13 @@
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
  };
@@ -17,19 +19,50 @@ declare enum VerificationCodeType {
17
19
  /** @deprecated Use `Generic` type template for sending test sms/email use case */
18
20
  Test = "Test"
19
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
+ /**
41
+ * The simplified organization role entity that is returned in the `roles` field
42
+ * of the organization.
43
+ */
44
+ export type OrganizationRoleEntity = {
45
+ id: string;
46
+ name: string;
47
+ };
20
48
  declare enum TenantTag {
21
49
  Development = "development",
22
- Staging = "staging",
23
50
  Production = "production"
24
51
  }
25
- declare const AffiliateProperties: import("@withtyped/server/model").default<"affiliate_properties", {
52
+ declare enum TenantRole {
53
+ /** Admin of the tenant, who has all permissions. */
54
+ Admin = "admin",
55
+ /** Member of the tenant, who has permissions to operate the tenant data, but not the tenant settings. */
56
+ Member = "member"
57
+ }
58
+ declare const AffiliateProperties: import("@withtyped/server/lib/model/index.js").default<"affiliate_properties", {
26
59
  createdAt: Date;
27
60
  affiliateId: string;
28
61
  type: "hostname" | "query";
29
62
  value: string;
30
63
  }, "createdAt", "createdAt">;
31
64
  export type AffiliateProperty = InferModelType<typeof AffiliateProperties>;
32
- declare const Affiliates: import("@withtyped/server/model").default<"affiliates", {
65
+ declare const Affiliates: import("@withtyped/server/lib/model/index.js").default<"affiliates", {
33
66
  id: string;
34
67
  createdAt: Date;
35
68
  name: string;
@@ -38,7 +71,24 @@ export type Affiliate = InferModelType<typeof Affiliates>;
38
71
  export type AffiliateData = Affiliate & {
39
72
  properties: Array<Pick<AffiliateProperty, "type" | "value">>;
40
73
  };
41
- 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").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
74
+ declare const router: import("@withtyped/server").Router<RequestContext, WithAuthContext<Omit<import("@withtyped/server").BaseContext & {
75
+ request: {
76
+ method?: import("@withtyped/server").RequestMethod | undefined;
77
+ headers: import("http").IncomingHttpHeaders;
78
+ url: URL;
79
+ body?: unknown;
80
+ };
81
+ }, "request"> & {
82
+ request: Record<string, unknown> & {
83
+ method?: import("@withtyped/server").RequestMethod | undefined;
84
+ headers: import("http").IncomingHttpHeaders;
85
+ url: URL;
86
+ body?: unknown;
87
+ } & {
88
+ body?: Json | undefined;
89
+ bodyRaw?: Buffer | undefined;
90
+ };
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").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
42
92
  options: {};
43
93
  patch: {
44
94
  "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
@@ -46,6 +96,11 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
46
96
  }, {
47
97
  id: string;
48
98
  name: string;
99
+ usage: {
100
+ activeUsers: number;
101
+ cost: number;
102
+ tokenUsage: number;
103
+ };
49
104
  indicator: string;
50
105
  isSuspended: boolean;
51
106
  planId: string;
@@ -56,10 +111,6 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
56
111
  currentPeriodEnd: Date;
57
112
  };
58
113
  tag: TenantTag;
59
- usage: {
60
- activeUsers: number;
61
- cost: number;
62
- };
63
114
  openInvoices: {
64
115
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
65
116
  createdAt: Date;
@@ -81,6 +132,11 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
81
132
  "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
82
133
  id: string;
83
134
  name: string;
135
+ usage: {
136
+ activeUsers: number;
137
+ cost: number;
138
+ tokenUsage: number;
139
+ };
84
140
  indicator: string;
85
141
  isSuspended: boolean;
86
142
  planId: string;
@@ -91,10 +147,6 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
91
147
  currentPeriodEnd: Date;
92
148
  };
93
149
  tag: TenantTag;
94
- usage: {
95
- activeUsers: number;
96
- cost: number;
97
- };
98
150
  openInvoices: {
99
151
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
100
152
  createdAt: Date;
@@ -119,6 +171,11 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
119
171
  }, {
120
172
  id: string;
121
173
  name: string;
174
+ usage: {
175
+ activeUsers: number;
176
+ cost: number;
177
+ tokenUsage: number;
178
+ };
122
179
  indicator: string;
123
180
  isSuspended: boolean;
124
181
  planId: string;
@@ -129,10 +186,6 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
129
186
  currentPeriodEnd: Date;
130
187
  };
131
188
  tag: TenantTag;
132
- usage: {
133
- activeUsers: number;
134
- cost: number;
135
- };
136
189
  openInvoices: {
137
190
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
138
191
  createdAt: Date;
@@ -200,6 +253,7 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
200
253
  "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
201
254
  activeUsers: number;
202
255
  cost: number;
256
+ tokenUsage: number;
203
257
  }>;
204
258
  };
205
259
  post: {
@@ -228,9 +282,10 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
228
282
  post: {
229
283
  "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
230
284
  data: {
231
- type: VerificationCodeType;
285
+ type: TemplateType | VerificationCodeType;
232
286
  payload: {
233
- code: string;
287
+ code?: string | undefined;
288
+ link?: string | undefined;
234
289
  senderName?: string | undefined;
235
290
  companyInformation?: string | undefined;
236
291
  appLogo?: string | undefined;
@@ -241,10 +296,11 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
241
296
  } & {
242
297
  "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
243
298
  data: {
244
- type: VerificationCodeType;
299
+ type: TemplateType | VerificationCodeType;
245
300
  to: string;
246
301
  payload: {
247
- code: string;
302
+ code?: string | undefined;
303
+ link?: string | undefined;
248
304
  };
249
305
  };
250
306
  }, unknown>;
@@ -263,6 +319,7 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
263
319
  name: string;
264
320
  quota: {
265
321
  mauLimit: number | null;
322
+ tokenLimit: number | null;
266
323
  applicationsLimit: number | null;
267
324
  machineToMachineLimit: number | null;
268
325
  resourcesLimit: number | null;
@@ -273,11 +330,14 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
273
330
  socialConnectorsLimit: number | null;
274
331
  standardConnectorsLimit: number | null;
275
332
  rolesLimit: number | null;
333
+ machineToMachineRolesLimit: number | null;
276
334
  scopesPerRoleLimit: number | null;
277
335
  hooksLimit: number | null;
278
336
  auditLogsRetentionDays: number | null;
279
337
  mfaEnabled: boolean;
280
338
  organizationsEnabled: boolean;
339
+ ssoEnabled: boolean;
340
+ thirdPartyApplicationsLimit: number | null;
281
341
  };
282
342
  stripeProducts: {
283
343
  type: "flat" | "tier1" | "tier2" | "tier3";
@@ -407,7 +467,118 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
407
467
  delete: {};
408
468
  copy: {};
409
469
  head: {};
470
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
471
+ options: {};
472
+ patch: {};
473
+ get: {};
474
+ post: {};
475
+ put: {};
476
+ delete: {
477
+ "/logs/expired": import("@withtyped/server").PathGuard<"/expired", {
478
+ dryRun?: string | undefined;
479
+ }, unknown, {
480
+ affectedRows: number;
481
+ }>;
482
+ };
483
+ copy: {};
484
+ head: {};
485
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
486
+ options: {};
487
+ patch: {
488
+ "/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:invitationId/status", unknown, {
489
+ status: OrganizationInvitationStatus.Accepted;
490
+ }, unknown>;
491
+ };
492
+ get: {};
493
+ post: {};
494
+ put: {};
495
+ delete: {};
496
+ copy: {};
497
+ head: {};
410
498
  }, "/api">>, "/api">;
499
+ export declare const tenantAuthRouter: import("@withtyped/server").Router<RequestContext, import("@withtyped/server").WithBodyContext<import("@withtyped/server").BaseContext & {
500
+ request: {
501
+ method?: import("@withtyped/server").RequestMethod | undefined;
502
+ headers: import("http").IncomingHttpHeaders;
503
+ url: URL;
504
+ body?: unknown;
505
+ };
506
+ }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
507
+ options: {};
508
+ patch: {
509
+ "/:tenantId/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/status", unknown, {
510
+ status: OrganizationInvitationStatus.Revoked;
511
+ }, {
512
+ status: OrganizationInvitationStatus;
513
+ createdAt: number;
514
+ id: string;
515
+ updatedAt: number;
516
+ tenantId: string;
517
+ organizationId: string;
518
+ inviterId: string | null;
519
+ expiresAt: number;
520
+ organizationRoles: OrganizationRoleEntity[];
521
+ invitee: string;
522
+ acceptedUserId: string | null;
523
+ }>;
524
+ };
525
+ get: {
526
+ "/:tenantId/members": import("@withtyped/server").PathGuard<"/:tenantId/members", unknown, unknown, {
527
+ id: string;
528
+ name: string | null;
529
+ username: string | null;
530
+ primaryEmail: string | null;
531
+ organizationRoles: OrganizationRoleEntity[];
532
+ }[]>;
533
+ } & {
534
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, unknown, {
535
+ status: OrganizationInvitationStatus;
536
+ createdAt: number;
537
+ id: string;
538
+ updatedAt: number;
539
+ tenantId: string;
540
+ organizationId: string;
541
+ inviterId: string | null;
542
+ expiresAt: number;
543
+ organizationRoles: OrganizationRoleEntity[];
544
+ invitee: string;
545
+ acceptedUserId: string | null;
546
+ }[]>;
547
+ };
548
+ post: {
549
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, {
550
+ roleName: TenantRole;
551
+ invitee: string;
552
+ expiresAt?: number | undefined;
553
+ }, {
554
+ status: OrganizationInvitationStatus;
555
+ createdAt: number;
556
+ id: string;
557
+ updatedAt: number;
558
+ tenantId: string;
559
+ organizationId: string;
560
+ inviterId: string | null;
561
+ expiresAt: number;
562
+ organizationRoles: OrganizationRoleEntity[];
563
+ invitee: string;
564
+ acceptedUserId: string | null;
565
+ }>;
566
+ } & {
567
+ "/:tenantId/invitations/:invitationId/message": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/message", unknown, unknown, unknown>;
568
+ };
569
+ put: {
570
+ "/:tenantId/members/:userId/roles": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/roles", unknown, {
571
+ roleName: TenantRole;
572
+ }, unknown>;
573
+ };
574
+ delete: {
575
+ "/:tenantId/members/:userId": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId", unknown, unknown, unknown>;
576
+ } & {
577
+ "/:tenantId/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId", unknown, unknown, unknown>;
578
+ };
579
+ copy: {};
580
+ head: {};
581
+ }, "/api/tenants">>, "/api/tenants">;
411
582
 
412
583
  export {
413
584
  router as default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-9257c0d",
3
+ "version": "0.2.5-a21a38a",
4
4
  "description": "Logto Cloud service.",
5
5
  "main": "build/index.js",
6
6
  "author": "Silverhand Inc. <contact@silverhand.io>",
@@ -16,25 +16,26 @@
16
16
  "#src/*": "./build/*"
17
17
  },
18
18
  "devDependencies": {
19
- "@silverhand/eslint-config": "4.0.1",
20
- "@silverhand/jest-config": "4.0.0",
21
- "@silverhand/ts-config": "4.0.0",
19
+ "@silverhand/eslint-config": "5.0.0",
20
+ "@silverhand/jest-config": "5.0.0",
21
+ "@silverhand/ts-config": "5.0.0",
22
22
  "@types/accepts": "^1.3.5",
23
23
  "@types/http-proxy": "^1.17.9",
24
24
  "@types/jest": "^29.4.0",
25
25
  "@types/mime-types": "^2.1.1",
26
- "@types/node": "^18.11.18",
26
+ "@types/node": "^20.0.0",
27
27
  "@types/yargs": "^17.0.24",
28
- "dts-bundle-generator": "^8.0.1",
28
+ "dts-bundle-generator": "^9.3.1",
29
29
  "eslint": "^8.44.0",
30
30
  "jest": "^29.5.0",
31
31
  "lint-staged": "^15.0.0",
32
32
  "nodemon": "^3.0.0",
33
+ "p-map": "^7.0.1",
33
34
  "prettier": "^3.0.0",
34
- "typescript": "^5.0.0"
35
+ "typescript": "^5.3.3"
35
36
  },
36
37
  "engines": {
37
- "node": "^18.12.0"
38
+ "node": "^20.9.0"
38
39
  },
39
40
  "eslintConfig": {
40
41
  "extends": "@silverhand",
@@ -50,14 +51,14 @@
50
51
  "access": "public"
51
52
  },
52
53
  "dependencies": {
53
- "@silverhand/essentials": "^2.8.5",
54
- "@withtyped/server": "^0.12.7"
54
+ "@silverhand/essentials": "^2.9.0",
55
+ "@withtyped/server": "^0.13.3"
55
56
  },
56
57
  "scripts": {
57
58
  "precommit": "lint-staged",
58
59
  "build": "rm -rf build/ && tsc -p tsconfig.build.json && pnpm build:lib",
59
60
  "//": "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:lib": "rm -rf lib/ && dts-bundle-generator src/routes/index.ts --project tsconfig.build.lib.json -o lib/routes/index.d.ts",
61
62
  "build:test": "rm -rf build/ && tsc -p tsconfig.test.json --sourcemap",
62
63
  "lint": "eslint --ext .ts src",
63
64
  "lint:report": "pnpm lint --format json --output-file report.json",