@logto/cloud 0.2.5-4686b84 → 0.2.5-4ef0b45

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.
@@ -1,37 +1,48 @@
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 TenantTag {
35
+ Development = "development",
36
+ Production = "production"
37
+ }
38
+ declare const AffiliateProperties: import("@withtyped/server/lib/model/index.js").default<"affiliate_properties", {
28
39
  createdAt: Date;
29
40
  affiliateId: string;
30
41
  type: "hostname" | "query";
31
42
  value: string;
32
43
  }, "createdAt", "createdAt">;
33
44
  export type AffiliateProperty = InferModelType<typeof AffiliateProperties>;
34
- declare const Affiliates: import("@withtyped/server/model").default<"affiliates", {
45
+ declare const Affiliates: import("@withtyped/server/lib/model/index.js").default<"affiliates", {
35
46
  id: string;
36
47
  createdAt: Date;
37
48
  name: string;
@@ -40,27 +51,148 @@ export type Affiliate = InferModelType<typeof Affiliates>;
40
51
  export type AffiliateData = Affiliate & {
41
52
  properties: Array<Pick<AffiliateProperty, "type" | "value">>;
42
53
  };
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").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
54
+ declare const router: import("@withtyped/server").Router<RequestContext, WithAuthContext<Omit<import("@withtyped/server").BaseContext & {
55
+ request: {
56
+ method?: import("@withtyped/server").RequestMethod | undefined;
57
+ headers: import("http").IncomingHttpHeaders;
58
+ url: URL;
59
+ body?: unknown;
60
+ };
61
+ }, "request"> & {
62
+ request: Record<string, unknown> & {
63
+ method?: import("@withtyped/server").RequestMethod | undefined;
64
+ headers: import("http").IncomingHttpHeaders;
65
+ url: URL;
66
+ body?: unknown;
67
+ } & {
68
+ body?: Json | undefined;
69
+ bodyRaw?: Buffer | undefined;
70
+ };
71
+ }>, 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
72
  options: {};
45
73
  patch: {
46
74
  "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
47
75
  name?: string | undefined;
48
- tag?: TenantTag | undefined;
49
76
  }, {
50
- name: string;
51
77
  id: string;
78
+ name: string;
79
+ usage: {
80
+ activeUsers: number;
81
+ cost: number;
82
+ tokenUsage: number;
83
+ };
52
84
  indicator: string;
85
+ isSuspended: boolean;
86
+ planId: string;
87
+ subscription: {
88
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
89
+ planId: string;
90
+ currentPeriodStart: Date;
91
+ currentPeriodEnd: Date;
92
+ };
53
93
  tag: TenantTag;
94
+ openInvoices: {
95
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
96
+ createdAt: Date;
97
+ id: string;
98
+ updatedAt: Date;
99
+ customerId: string | null;
100
+ billingReason: string | null;
101
+ periodStart: Date;
102
+ periodEnd: Date;
103
+ amountDue: number;
104
+ amountPaid: number;
105
+ subscriptionId: string | null;
106
+ hostedInvoiceUrl: string | null;
107
+ invoicePdf: string | null;
108
+ }[];
54
109
  }>;
55
110
  };
56
111
  get: {
57
112
  "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
58
- name: string;
59
113
  id: string;
114
+ name: string;
115
+ usage: {
116
+ activeUsers: number;
117
+ cost: number;
118
+ tokenUsage: number;
119
+ };
60
120
  indicator: string;
121
+ isSuspended: boolean;
122
+ planId: string;
123
+ subscription: {
124
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
125
+ planId: string;
126
+ currentPeriodStart: Date;
127
+ currentPeriodEnd: Date;
128
+ };
61
129
  tag: TenantTag;
130
+ openInvoices: {
131
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
132
+ createdAt: Date;
133
+ id: string;
134
+ updatedAt: Date;
135
+ customerId: string | null;
136
+ billingReason: string | null;
137
+ periodStart: Date;
138
+ periodEnd: Date;
139
+ amountDue: number;
140
+ amountPaid: number;
141
+ subscriptionId: string | null;
142
+ hostedInvoiceUrl: string | null;
143
+ invoicePdf: string | null;
144
+ }[];
62
145
  }[]>;
63
- } & {
146
+ };
147
+ post: {
148
+ "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
149
+ name?: string | undefined;
150
+ tag?: TenantTag | undefined;
151
+ }, {
152
+ id: string;
153
+ name: string;
154
+ usage: {
155
+ activeUsers: number;
156
+ cost: number;
157
+ tokenUsage: number;
158
+ };
159
+ indicator: string;
160
+ isSuspended: boolean;
161
+ planId: string;
162
+ subscription: {
163
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
164
+ planId: string;
165
+ currentPeriodStart: Date;
166
+ currentPeriodEnd: Date;
167
+ };
168
+ tag: TenantTag;
169
+ openInvoices: {
170
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
171
+ createdAt: Date;
172
+ id: string;
173
+ updatedAt: Date;
174
+ customerId: string | null;
175
+ billingReason: string | null;
176
+ periodStart: Date;
177
+ periodEnd: Date;
178
+ amountDue: number;
179
+ amountPaid: number;
180
+ subscriptionId: string | null;
181
+ hostedInvoiceUrl: string | null;
182
+ invoicePdf: string | null;
183
+ }[];
184
+ }>;
185
+ };
186
+ put: {};
187
+ delete: {
188
+ "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
189
+ };
190
+ copy: {};
191
+ head: {};
192
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
193
+ options: {};
194
+ patch: {};
195
+ get: {
64
196
  "/tenants/my/subscription": import("@withtyped/server").PathGuard<"/my/subscription", unknown, unknown, {
65
197
  status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
66
198
  planId: string;
@@ -93,37 +225,30 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
93
225
  planName: string | null;
94
226
  }[];
95
227
  }>;
228
+ } & {
229
+ "/tenants/:tenantId/invoices/:invoiceId/hosted-invoice-url": import("@withtyped/server").PathGuard<"/:tenantId/invoices/:invoiceId/hosted-invoice-url", unknown, unknown, {
230
+ hostedInvoiceUrl: string;
231
+ }>;
96
232
  } & {
97
233
  "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
98
234
  activeUsers: number;
99
235
  cost: number;
236
+ tokenUsage: number;
100
237
  }>;
101
238
  };
102
239
  post: {
103
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
104
- name?: string | undefined;
105
- tag?: TenantTag | undefined;
106
- }, {
107
- name: string;
108
- id: string;
109
- indicator: string;
110
- tag: TenantTag;
111
- }>;
112
- } & {
113
240
  "/tenants/:tenantId/stripe-customer-portal": import("@withtyped/server").PathGuard<"/:tenantId/stripe-customer-portal", unknown, {
114
241
  callbackUrl?: string | undefined;
115
- } | undefined, {
242
+ }, {
116
243
  redirectUri: string;
117
244
  }>;
118
245
  };
119
246
  put: {};
120
- head: {};
121
247
  delete: {
122
248
  "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
123
- } & {
124
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
125
249
  };
126
250
  copy: {};
251
+ head: {};
127
252
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
128
253
  options: {};
129
254
  patch: {};
@@ -135,49 +260,35 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
135
260
  }>;
136
261
  };
137
262
  post: {
138
- "/services/send-email": import("@withtyped/server").PathGuard<"/send-email", unknown, {
139
- data: {
140
- type: VerificationCodeType;
141
- to: string;
142
- payload: {
143
- senderName?: string | undefined;
144
- companyInformation?: string | undefined;
145
- appLogo?: string | undefined;
146
- code: string;
147
- };
148
- };
149
- }, unknown>;
150
- } & {
151
263
  "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
152
264
  data: {
153
- type: VerificationCodeType;
154
- to: string;
265
+ type: TemplateType | VerificationCodeType;
155
266
  payload: {
267
+ code?: string | undefined;
268
+ link?: string | undefined;
156
269
  senderName?: string | undefined;
157
270
  companyInformation?: string | undefined;
158
271
  appLogo?: string | undefined;
159
- code: string;
160
272
  };
273
+ to: string;
161
274
  };
162
275
  }, unknown>;
163
276
  } & {
164
277
  "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
165
278
  data: {
166
- type: VerificationCodeType;
279
+ type: TemplateType | VerificationCodeType;
167
280
  to: string;
168
281
  payload: {
169
- senderName?: string | undefined;
170
- companyInformation?: string | undefined;
171
- appLogo?: string | undefined;
172
- code: string;
282
+ code?: string | undefined;
283
+ link?: string | undefined;
173
284
  };
174
285
  };
175
286
  }, unknown>;
176
287
  };
177
288
  put: {};
178
- head: {};
179
289
  delete: {};
180
290
  copy: {};
291
+ head: {};
181
292
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
182
293
  options: {};
183
294
  patch: {};
@@ -188,40 +299,63 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
188
299
  name: string;
189
300
  quota: {
190
301
  mauLimit: number | null;
191
- applicationsLimit: number;
192
- machineToMachineLimit: number;
193
- resourcesLimit: number;
194
- scopesPerResourceLimit: number;
302
+ tokenLimit: number | null;
303
+ applicationsLimit: number | null;
304
+ machineToMachineLimit: number | null;
305
+ resourcesLimit: number | null;
306
+ scopesPerResourceLimit: number | null;
195
307
  customDomainEnabled: boolean;
196
308
  omniSignInEnabled: boolean;
197
309
  builtInEmailConnectorEnabled: boolean;
198
310
  socialConnectorsLimit: number | null;
199
- standardConnectorsLimit: number;
200
- rolesLimit: number;
311
+ standardConnectorsLimit: number | null;
312
+ rolesLimit: number | null;
313
+ machineToMachineRolesLimit: number | null;
201
314
  scopesPerRoleLimit: number | null;
202
- hooksLimit: number;
203
- auditLogsRetentionDays: number;
315
+ hooksLimit: number | null;
316
+ auditLogsRetentionDays: number | null;
317
+ mfaEnabled: boolean;
318
+ organizationsEnabled: boolean;
319
+ ssoEnabled: boolean;
320
+ thirdPartyApplicationsLimit: number | null;
204
321
  };
205
322
  stripeProducts: {
206
- description?: string | undefined;
207
323
  type: "flat" | "tier1" | "tier2" | "tier3";
208
324
  id: string;
209
325
  name: string;
210
326
  price: {
211
- quantity?: 1 | undefined;
212
- unitAmount?: number | null | undefined;
213
327
  id: string;
214
328
  unitAmountDecimal: string;
329
+ quantity?: 1 | undefined;
330
+ unitAmount?: number | null | undefined;
215
331
  };
332
+ description?: string | undefined;
216
333
  }[];
217
334
  updatedAt: Date;
218
335
  }[]>;
219
336
  };
220
337
  post: {};
221
338
  put: {};
339
+ delete: {};
340
+ copy: {};
222
341
  head: {};
342
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
343
+ options: {};
344
+ patch: {};
345
+ get: {
346
+ "/my/tenant": import("@withtyped/server").PathGuard<"/tenant", unknown, unknown, {
347
+ name: string;
348
+ id: string;
349
+ indicator: string;
350
+ isSuspended: boolean;
351
+ tag: TenantTag;
352
+ }>;
353
+ };
354
+ post: {};
355
+ put: {};
223
356
  delete: {};
224
357
  copy: {};
358
+ head: {};
225
359
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
226
360
  options: {};
227
361
  patch: {};
@@ -238,21 +372,21 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
238
372
  };
239
373
  post: {
240
374
  "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
375
+ planId: string;
376
+ successCallbackUrl: string;
241
377
  tenantId?: string | undefined;
378
+ cancelCallbackUrl?: string | undefined;
242
379
  tenantTag?: TenantTag | undefined;
243
380
  tenantName?: string | undefined;
244
- cancelCallbackUrl?: string | undefined;
245
- planId: string;
246
- successCallbackUrl: string;
247
381
  }, {
248
- redirectUri?: string | null | undefined;
249
382
  sessionId: string;
383
+ redirectUri?: string | null | undefined;
250
384
  }>;
251
385
  };
252
386
  put: {};
253
- head: {};
254
387
  delete: {};
255
388
  copy: {};
389
+ head: {};
256
390
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
257
391
  options: {};
258
392
  patch: {};
@@ -279,7 +413,6 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
279
413
  }>;
280
414
  };
281
415
  put: {};
282
- head: {};
283
416
  delete: {
284
417
  "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
285
418
  value: string;
@@ -287,33 +420,42 @@ declare const router: import("@withtyped/server").Router<WithAuthContext, import
287
420
  }, unknown>;
288
421
  };
289
422
  copy: {};
423
+ head: {};
290
424
  }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
291
425
  options: {};
292
426
  patch: {};
293
427
  get: {};
294
428
  post: {
295
429
  "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
296
- hostname?: string | undefined;
297
- query?: string | undefined;
298
430
  createdAt: string;
299
431
  userId: string;
432
+ hostname?: string | undefined;
433
+ query?: string | undefined;
300
434
  }, {
301
435
  createdAt: Date;
302
436
  id: string;
303
437
  affiliateId: string | null;
304
438
  userId: string;
305
439
  createdVia: {
440
+ createdAt: string;
306
441
  hostname?: string | undefined;
307
442
  query?: string | undefined;
308
- createdAt: string;
309
443
  };
310
444
  }>;
311
445
  };
312
446
  put: {};
313
- head: {};
314
447
  delete: {};
315
448
  copy: {};
449
+ head: {};
316
450
  }, "/api">>, "/api">;
451
+ export declare const tenantAuthRouter: import("@withtyped/server").Router<RequestContext, import("@withtyped/server").WithBodyContext<import("@withtyped/server").BaseContext & {
452
+ request: {
453
+ method?: import("@withtyped/server").RequestMethod | undefined;
454
+ headers: import("http").IncomingHttpHeaders;
455
+ url: URL;
456
+ body?: unknown;
457
+ };
458
+ }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<import("@withtyped/server").BaseRoutes, "/api/tenants">>, "/api/tenants">;
317
459
 
318
460
  export {
319
461
  router as default,
package/package.json CHANGED
@@ -1,40 +1,40 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-4686b84",
3
+ "version": "0.2.5-4ef0b45",
4
4
  "description": "Logto Cloud service.",
5
5
  "main": "build/index.js",
6
6
  "author": "Silverhand Inc. <contact@silverhand.io>",
7
7
  "license": "Elastic-2.0",
8
8
  "type": "module",
9
9
  "files": [
10
- "build"
10
+ "lib"
11
11
  ],
12
12
  "exports": {
13
- "./routes": "./build/routes/index.js"
13
+ "./routes": "./lib/routes/index.js"
14
14
  },
15
15
  "imports": {
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": "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",
29
- "eslint": "^8.21.0",
28
+ "dts-bundle-generator": "^9.3.1",
29
+ "eslint": "^8.44.0",
30
30
  "jest": "^29.5.0",
31
- "lint-staged": "^13.0.0",
31
+ "lint-staged": "^15.0.0",
32
32
  "nodemon": "^3.0.0",
33
- "prettier": "^2.8.1",
34
- "typescript": "^5.0.0"
33
+ "prettier": "^3.0.0",
34
+ "typescript": "^5.3.3"
35
35
  },
36
36
  "engines": {
37
- "node": "^18.12.0"
37
+ "node": "^20.9.0"
38
38
  },
39
39
  "eslintConfig": {
40
40
  "extends": "@silverhand",
@@ -50,14 +50,14 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@silverhand/essentials": "^2.7.0",
54
- "@withtyped/server": "^0.12.7"
53
+ "@silverhand/essentials": "^2.9.0",
54
+ "@withtyped/server": "^0.13.3"
55
55
  },
56
56
  "scripts": {
57
57
  "precommit": "lint-staged",
58
- "build": "rm -rf build/ && tsc -p tsconfig.build.json",
58
+ "build": "rm -rf build/ && tsc -p tsconfig.build.json && pnpm build:lib",
59
59
  "//": "It is not used to build the service itself.",
60
- "build:lib": "rm -rf build/ && dts-bundle-generator src/routes/index.ts --project tsconfig.build.json -o build/routes/index.d.ts",
60
+ "build:lib": "rm -rf lib/ && dts-bundle-generator src/routes/index.ts --project tsconfig.build.lib.json -o lib/routes/index.d.ts",
61
61
  "build:test": "rm -rf build/ && tsc -p tsconfig.test.json --sourcemap",
62
62
  "lint": "eslint --ext .ts src",
63
63
  "lint:report": "pnpm lint --format json --output-file report.json",