@logto/cloud 0.2.5-d434baa → 0.2.5-d9576f9

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 +218 -47
  2. package/package.json +13 -12
@@ -1,37 +1,68 @@
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
+ /**
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
+ };
48
+ declare enum TenantTag {
49
+ Development = "development",
50
+ Production = "production"
51
+ }
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", {
28
59
  createdAt: Date;
29
60
  affiliateId: string;
30
61
  type: "hostname" | "query";
31
62
  value: string;
32
63
  }, "createdAt", "createdAt">;
33
64
  export type AffiliateProperty = InferModelType<typeof AffiliateProperties>;
34
- declare const Affiliates: import("@withtyped/server/model").default<"affiliates", {
65
+ declare const Affiliates: import("@withtyped/server/lib/model/index.js").default<"affiliates", {
35
66
  id: string;
36
67
  createdAt: Date;
37
68
  name: string;
@@ -40,15 +71,36 @@ export type Affiliate = InferModelType<typeof Affiliates>;
40
71
  export type AffiliateData = Affiliate & {
41
72
  properties: Array<Pick<AffiliateProperty, "type" | "value">>;
42
73
  };
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").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<{
44
92
  options: {};
45
93
  patch: {
46
94
  "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
47
95
  name?: string | undefined;
48
- tag?: TenantTag | undefined;
49
96
  }, {
50
97
  id: string;
51
98
  name: string;
99
+ usage: {
100
+ activeUsers: number;
101
+ cost: number;
102
+ tokenUsage: number;
103
+ };
52
104
  indicator: string;
53
105
  isSuspended: boolean;
54
106
  planId: string;
@@ -59,10 +111,6 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
59
111
  currentPeriodEnd: Date;
60
112
  };
61
113
  tag: TenantTag;
62
- usage: {
63
- activeUsers: number;
64
- cost: number;
65
- };
66
114
  openInvoices: {
67
115
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
68
116
  createdAt: Date;
@@ -84,6 +132,11 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
84
132
  "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
85
133
  id: string;
86
134
  name: string;
135
+ usage: {
136
+ activeUsers: number;
137
+ cost: number;
138
+ tokenUsage: number;
139
+ };
87
140
  indicator: string;
88
141
  isSuspended: boolean;
89
142
  planId: string;
@@ -94,10 +147,6 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
94
147
  currentPeriodEnd: Date;
95
148
  };
96
149
  tag: TenantTag;
97
- usage: {
98
- activeUsers: number;
99
- cost: number;
100
- };
101
150
  openInvoices: {
102
151
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
103
152
  createdAt: Date;
@@ -122,6 +171,11 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
122
171
  }, {
123
172
  id: string;
124
173
  name: string;
174
+ usage: {
175
+ activeUsers: number;
176
+ cost: number;
177
+ tokenUsage: number;
178
+ };
125
179
  indicator: string;
126
180
  isSuspended: boolean;
127
181
  planId: string;
@@ -132,10 +186,6 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
132
186
  currentPeriodEnd: Date;
133
187
  };
134
188
  tag: TenantTag;
135
- usage: {
136
- activeUsers: number;
137
- cost: number;
138
- };
139
189
  openInvoices: {
140
190
  status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
141
191
  createdAt: Date;
@@ -154,11 +204,11 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
154
204
  }>;
155
205
  };
156
206
  put: {};
157
- head: {};
158
207
  delete: {
159
208
  "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
160
209
  };
161
210
  copy: {};
211
+ head: {};
162
212
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
163
213
  options: {};
164
214
  patch: {};
@@ -203,6 +253,7 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
203
253
  "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
204
254
  activeUsers: number;
205
255
  cost: number;
256
+ tokenUsage: number;
206
257
  }>;
207
258
  };
208
259
  post: {
@@ -213,11 +264,11 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
213
264
  }>;
214
265
  };
215
266
  put: {};
216
- head: {};
217
267
  delete: {
218
268
  "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
219
269
  };
220
270
  copy: {};
271
+ head: {};
221
272
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
222
273
  options: {};
223
274
  patch: {};
@@ -231,12 +282,13 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
231
282
  post: {
232
283
  "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
233
284
  data: {
234
- type: VerificationCodeType;
285
+ type: TemplateType | VerificationCodeType;
235
286
  payload: {
287
+ code?: string | undefined;
288
+ link?: string | undefined;
236
289
  senderName?: string | undefined;
237
290
  companyInformation?: string | undefined;
238
291
  appLogo?: string | undefined;
239
- code: string;
240
292
  };
241
293
  to: string;
242
294
  };
@@ -244,18 +296,19 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
244
296
  } & {
245
297
  "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
246
298
  data: {
247
- type: VerificationCodeType;
299
+ type: TemplateType | VerificationCodeType;
248
300
  to: string;
249
301
  payload: {
250
- code: string;
302
+ code?: string | undefined;
303
+ link?: string | undefined;
251
304
  };
252
305
  };
253
306
  }, unknown>;
254
307
  };
255
308
  put: {};
256
- head: {};
257
309
  delete: {};
258
310
  copy: {};
311
+ head: {};
259
312
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
260
313
  options: {};
261
314
  patch: {};
@@ -266,6 +319,7 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
266
319
  name: string;
267
320
  quota: {
268
321
  mauLimit: number | null;
322
+ tokenLimit: number | null;
269
323
  applicationsLimit: number | null;
270
324
  machineToMachineLimit: number | null;
271
325
  resourcesLimit: number | null;
@@ -276,38 +330,42 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
276
330
  socialConnectorsLimit: number | null;
277
331
  standardConnectorsLimit: number | null;
278
332
  rolesLimit: number | null;
333
+ machineToMachineRolesLimit: number | null;
279
334
  scopesPerRoleLimit: number | null;
280
335
  hooksLimit: number | null;
281
336
  auditLogsRetentionDays: number | null;
282
337
  mfaEnabled: boolean;
338
+ organizationsEnabled: boolean;
339
+ ssoEnabled: boolean;
340
+ thirdPartyApplicationsLimit: number | null;
283
341
  };
284
342
  stripeProducts: {
285
- description?: string | undefined;
286
343
  type: "flat" | "tier1" | "tier2" | "tier3";
287
344
  id: string;
288
345
  name: string;
289
346
  price: {
290
- quantity?: 1 | undefined;
291
- unitAmount?: number | null | undefined;
292
347
  id: string;
293
348
  unitAmountDecimal: string;
349
+ quantity?: 1 | undefined;
350
+ unitAmount?: number | null | undefined;
294
351
  };
352
+ description?: string | undefined;
295
353
  }[];
296
354
  updatedAt: Date;
297
355
  }[]>;
298
356
  };
299
357
  post: {};
300
358
  put: {};
301
- head: {};
302
359
  delete: {};
303
360
  copy: {};
361
+ head: {};
304
362
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
305
363
  options: {};
306
364
  patch: {};
307
365
  get: {
308
366
  "/my/tenant": import("@withtyped/server").PathGuard<"/tenant", unknown, unknown, {
309
- id: string;
310
367
  name: string;
368
+ id: string;
311
369
  indicator: string;
312
370
  isSuspended: boolean;
313
371
  tag: TenantTag;
@@ -315,9 +373,9 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
315
373
  };
316
374
  post: {};
317
375
  put: {};
318
- head: {};
319
376
  delete: {};
320
377
  copy: {};
378
+ head: {};
321
379
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
322
380
  options: {};
323
381
  patch: {};
@@ -334,21 +392,21 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
334
392
  };
335
393
  post: {
336
394
  "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
395
+ planId: string;
396
+ successCallbackUrl: string;
337
397
  tenantId?: string | undefined;
398
+ cancelCallbackUrl?: string | undefined;
338
399
  tenantTag?: TenantTag | undefined;
339
400
  tenantName?: string | undefined;
340
- cancelCallbackUrl?: string | undefined;
341
- planId: string;
342
- successCallbackUrl: string;
343
401
  }, {
344
- redirectUri?: string | null | undefined;
345
402
  sessionId: string;
403
+ redirectUri?: string | null | undefined;
346
404
  }>;
347
405
  };
348
406
  put: {};
349
- head: {};
350
407
  delete: {};
351
408
  copy: {};
409
+ head: {};
352
410
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
353
411
  options: {};
354
412
  patch: {};
@@ -375,7 +433,6 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
375
433
  }>;
376
434
  };
377
435
  put: {};
378
- head: {};
379
436
  delete: {
380
437
  "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
381
438
  value: string;
@@ -383,33 +440,147 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
383
440
  }, unknown>;
384
441
  };
385
442
  copy: {};
443
+ head: {};
386
444
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
387
445
  options: {};
388
446
  patch: {};
389
447
  get: {};
390
448
  post: {
391
449
  "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
392
- hostname?: string | undefined;
393
- query?: string | undefined;
394
450
  createdAt: string;
395
451
  userId: string;
452
+ hostname?: string | undefined;
453
+ query?: string | undefined;
396
454
  }, {
397
455
  createdAt: Date;
398
456
  id: string;
399
457
  affiliateId: string | null;
400
458
  userId: string;
401
459
  createdVia: {
460
+ createdAt: string;
402
461
  hostname?: string | undefined;
403
462
  query?: string | undefined;
404
- createdAt: string;
405
463
  };
406
464
  }>;
407
465
  };
408
466
  put: {};
467
+ delete: {};
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: {};
410
495
  delete: {};
411
496
  copy: {};
497
+ head: {};
412
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
+ primaryPhone: string | null;
532
+ avatar: string | null;
533
+ organizationRoles: OrganizationRoleEntity[];
534
+ }[]>;
535
+ } & {
536
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, unknown, {
537
+ status: OrganizationInvitationStatus;
538
+ createdAt: number;
539
+ id: string;
540
+ updatedAt: number;
541
+ tenantId: string;
542
+ organizationId: string;
543
+ inviterId: string | null;
544
+ expiresAt: number;
545
+ organizationRoles: OrganizationRoleEntity[];
546
+ invitee: string;
547
+ acceptedUserId: string | null;
548
+ }[]>;
549
+ };
550
+ post: {
551
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, {
552
+ roleName: TenantRole;
553
+ invitee: string;
554
+ expiresAt?: number | undefined;
555
+ }, {
556
+ status: OrganizationInvitationStatus;
557
+ createdAt: number;
558
+ id: string;
559
+ updatedAt: number;
560
+ tenantId: string;
561
+ organizationId: string;
562
+ inviterId: string | null;
563
+ expiresAt: number;
564
+ organizationRoles: OrganizationRoleEntity[];
565
+ invitee: string;
566
+ acceptedUserId: string | null;
567
+ }>;
568
+ } & {
569
+ "/:tenantId/invitations/:invitationId/message": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/message", unknown, unknown, unknown>;
570
+ };
571
+ put: {
572
+ "/:tenantId/members/:userId/roles": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/roles", unknown, {
573
+ roleName: TenantRole;
574
+ }, unknown>;
575
+ };
576
+ delete: {
577
+ "/:tenantId/members/:userId": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId", unknown, unknown, unknown>;
578
+ } & {
579
+ "/:tenantId/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId", unknown, unknown, unknown>;
580
+ };
581
+ copy: {};
582
+ head: {};
583
+ }, "/api/tenants">>, "/api/tenants">;
413
584
 
414
585
  export {
415
586
  router as default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-d434baa",
3
+ "version": "0.2.5-d9576f9",
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
- "lint-staged": "^14.0.0",
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.4",
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",