@logto/cloud 0.2.5-2087c06 → 0.2.5-2a72cc4

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.
@@ -0,0 +1,579 @@
1
+ // Generated by dts-bundle-generator v9.3.1
2
+
3
+ import { Json, JsonObject, RequestContext } from '@withtyped/server';
4
+ import { InferModelType } from '@withtyped/server/model';
5
+
6
+ export type WithAuthContext<Context = RequestContext> = Context & {
7
+ auth: {
8
+ /** The ID of the authenticated subject (`sub`). */
9
+ id: string;
10
+ /** The scopes that the subject has (`scope`). */
11
+ scopes: string[];
12
+ };
13
+ };
14
+ declare enum VerificationCodeType {
15
+ SignIn = "SignIn",
16
+ Register = "Register",
17
+ ForgotPassword = "ForgotPassword",
18
+ Generic = "Generic",
19
+ /** @deprecated Use `Generic` type template for sending test sms/email use case */
20
+ Test = "Test"
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
+ };
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", {
59
+ createdAt: Date;
60
+ affiliateId: string;
61
+ type: "hostname" | "query";
62
+ value: string;
63
+ }, "createdAt", "createdAt">;
64
+ export type AffiliateProperty = InferModelType<typeof AffiliateProperties>;
65
+ declare const Affiliates: import("@withtyped/server/lib/model/index.js").default<"affiliates", {
66
+ name: string;
67
+ createdAt: Date;
68
+ id: string;
69
+ }, "id" | "createdAt", "id" | "createdAt">;
70
+ export type Affiliate = InferModelType<typeof Affiliates>;
71
+ export type AffiliateData = Affiliate & {
72
+ properties: Array<Pick<AffiliateProperty, "type" | "value">>;
73
+ };
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").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
92
+ patch: {
93
+ "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
94
+ name?: string | undefined;
95
+ }, {
96
+ id: string;
97
+ name: string;
98
+ usage: {
99
+ activeUsers: number;
100
+ cost: number;
101
+ tokenUsage: number;
102
+ };
103
+ indicator: string;
104
+ isSuspended: boolean;
105
+ planId: string;
106
+ subscription: {
107
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
108
+ planId: string;
109
+ currentPeriodStart: Date;
110
+ currentPeriodEnd: Date;
111
+ };
112
+ openInvoices: {
113
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
114
+ id: string;
115
+ createdAt: Date;
116
+ updatedAt: Date;
117
+ customerId: string | null;
118
+ billingReason: string | null;
119
+ periodStart: Date;
120
+ periodEnd: Date;
121
+ amountDue: number;
122
+ amountPaid: number;
123
+ subscriptionId: string | null;
124
+ hostedInvoiceUrl: string | null;
125
+ invoicePdf: string | null;
126
+ }[];
127
+ tag: TenantTag;
128
+ }>;
129
+ };
130
+ options: {};
131
+ get: {
132
+ "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
133
+ id: string;
134
+ name: string;
135
+ usage: {
136
+ activeUsers: number;
137
+ cost: number;
138
+ tokenUsage: number;
139
+ };
140
+ indicator: string;
141
+ isSuspended: boolean;
142
+ planId: string;
143
+ subscription: {
144
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
145
+ planId: string;
146
+ currentPeriodStart: Date;
147
+ currentPeriodEnd: Date;
148
+ };
149
+ openInvoices: {
150
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
151
+ id: string;
152
+ createdAt: Date;
153
+ updatedAt: Date;
154
+ customerId: string | null;
155
+ billingReason: string | null;
156
+ periodStart: Date;
157
+ periodEnd: Date;
158
+ amountDue: number;
159
+ amountPaid: number;
160
+ subscriptionId: string | null;
161
+ hostedInvoiceUrl: string | null;
162
+ invoicePdf: string | null;
163
+ }[];
164
+ tag: TenantTag;
165
+ }[]>;
166
+ };
167
+ post: {
168
+ "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
169
+ name?: string | undefined;
170
+ tag?: TenantTag | undefined;
171
+ }, {
172
+ id: string;
173
+ name: string;
174
+ usage: {
175
+ activeUsers: number;
176
+ cost: number;
177
+ tokenUsage: number;
178
+ };
179
+ indicator: string;
180
+ isSuspended: boolean;
181
+ planId: string;
182
+ subscription: {
183
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
184
+ planId: string;
185
+ currentPeriodStart: Date;
186
+ currentPeriodEnd: Date;
187
+ };
188
+ openInvoices: {
189
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
190
+ id: string;
191
+ createdAt: Date;
192
+ updatedAt: Date;
193
+ customerId: string | null;
194
+ billingReason: string | null;
195
+ periodStart: Date;
196
+ periodEnd: Date;
197
+ amountDue: number;
198
+ amountPaid: number;
199
+ subscriptionId: string | null;
200
+ hostedInvoiceUrl: string | null;
201
+ invoicePdf: string | null;
202
+ }[];
203
+ tag: TenantTag;
204
+ }>;
205
+ };
206
+ put: {};
207
+ delete: {
208
+ "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
209
+ };
210
+ copy: {};
211
+ head: {};
212
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
213
+ patch: {};
214
+ options: {};
215
+ get: {
216
+ "/tenants/my/subscription": import("@withtyped/server").PathGuard<"/my/subscription", unknown, unknown, {
217
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
218
+ planId: string;
219
+ currentPeriodStart: Date;
220
+ currentPeriodEnd: Date;
221
+ }>;
222
+ } & {
223
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, {
224
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
225
+ planId: string;
226
+ currentPeriodStart: Date;
227
+ currentPeriodEnd: Date;
228
+ }>;
229
+ } & {
230
+ "/tenants/:tenantId/invoices": import("@withtyped/server").PathGuard<"/:tenantId/invoices", unknown, unknown, {
231
+ invoices: {
232
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
233
+ id: string;
234
+ createdAt: Date;
235
+ updatedAt: Date;
236
+ customerId: string | null;
237
+ billingReason: string | null;
238
+ periodStart: Date;
239
+ periodEnd: Date;
240
+ amountDue: number;
241
+ amountPaid: number;
242
+ subscriptionId: string | null;
243
+ hostedInvoiceUrl: string | null;
244
+ invoicePdf: string | null;
245
+ planName: string | null;
246
+ }[];
247
+ }>;
248
+ } & {
249
+ "/tenants/:tenantId/invoices/:invoiceId/hosted-invoice-url": import("@withtyped/server").PathGuard<"/:tenantId/invoices/:invoiceId/hosted-invoice-url", unknown, unknown, {
250
+ hostedInvoiceUrl: string;
251
+ }>;
252
+ } & {
253
+ "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
254
+ activeUsers: number;
255
+ cost: number;
256
+ tokenUsage: number;
257
+ }>;
258
+ };
259
+ post: {
260
+ "/tenants/:tenantId/stripe-customer-portal": import("@withtyped/server").PathGuard<"/:tenantId/stripe-customer-portal", unknown, {
261
+ callbackUrl?: string | undefined;
262
+ }, {
263
+ redirectUri: string;
264
+ }>;
265
+ };
266
+ put: {};
267
+ delete: {
268
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
269
+ };
270
+ copy: {};
271
+ head: {};
272
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
273
+ patch: {};
274
+ options: {};
275
+ get: {
276
+ "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
277
+ from?: string | undefined;
278
+ }, unknown, {
279
+ count: number;
280
+ }>;
281
+ };
282
+ post: {
283
+ "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
284
+ data: {
285
+ type: TemplateType | VerificationCodeType;
286
+ payload: {
287
+ code?: string | undefined;
288
+ link?: string | undefined;
289
+ } & Record<string, string> & {
290
+ senderName?: string | undefined;
291
+ companyInformation?: string | undefined;
292
+ appLogo?: string | undefined;
293
+ };
294
+ to: string;
295
+ };
296
+ }, unknown>;
297
+ } & {
298
+ "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
299
+ data: {
300
+ type: TemplateType | VerificationCodeType;
301
+ to: string;
302
+ payload: {
303
+ code?: string | undefined;
304
+ link?: string | undefined;
305
+ } & Record<string, string>;
306
+ };
307
+ }, unknown>;
308
+ } & {
309
+ "/services/custom-jwt": import("@withtyped/server").PathGuard<"/custom-jwt", unknown, {
310
+ script: string;
311
+ token: Record<string, Json>;
312
+ envVars?: Record<string, string> | undefined;
313
+ context?: Record<string, Json> | undefined;
314
+ }, Record<string, unknown>>;
315
+ };
316
+ put: {};
317
+ delete: {};
318
+ copy: {};
319
+ head: {};
320
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
321
+ patch: {};
322
+ options: {};
323
+ get: {
324
+ "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
325
+ id: string;
326
+ createdAt: Date;
327
+ name: string;
328
+ 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
+ quota: {
342
+ mauLimit: number | null;
343
+ tokenLimit: number | null;
344
+ applicationsLimit: number | null;
345
+ machineToMachineLimit: number | null;
346
+ resourcesLimit: number | null;
347
+ scopesPerResourceLimit: number | null;
348
+ customDomainEnabled: boolean;
349
+ omniSignInEnabled: boolean;
350
+ builtInEmailConnectorEnabled: boolean;
351
+ socialConnectorsLimit: number | null;
352
+ standardConnectorsLimit: number | null;
353
+ rolesLimit: number | null;
354
+ machineToMachineRolesLimit: number | null;
355
+ scopesPerRoleLimit: number | null;
356
+ hooksLimit: number | null;
357
+ auditLogsRetentionDays: number | null;
358
+ mfaEnabled: boolean;
359
+ organizationsEnabled: boolean;
360
+ ssoEnabled: boolean;
361
+ thirdPartyApplicationsLimit: number | null;
362
+ };
363
+ }[]>;
364
+ };
365
+ post: {};
366
+ put: {};
367
+ delete: {};
368
+ copy: {};
369
+ head: {};
370
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
371
+ patch: {};
372
+ options: {};
373
+ get: {
374
+ "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
375
+ id: string;
376
+ createdAt: Date;
377
+ userId: string;
378
+ status: "open" | "complete" | "expired";
379
+ tenantId: string | null;
380
+ updatedAt: Date;
381
+ planId: string;
382
+ }>;
383
+ };
384
+ post: {
385
+ "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
386
+ planId: string;
387
+ successCallbackUrl: string;
388
+ tenantId?: string | undefined;
389
+ cancelCallbackUrl?: string | undefined;
390
+ tenantTag?: TenantTag | undefined;
391
+ tenantName?: string | undefined;
392
+ }, {
393
+ sessionId: string;
394
+ redirectUri?: string | null | undefined;
395
+ }>;
396
+ };
397
+ put: {};
398
+ delete: {};
399
+ copy: {};
400
+ head: {};
401
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
402
+ patch: {};
403
+ options: {};
404
+ get: {
405
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
406
+ };
407
+ post: {
408
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
409
+ name: string;
410
+ }, {
411
+ id: string;
412
+ createdAt: Date;
413
+ name: string;
414
+ }>;
415
+ } & {
416
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
417
+ type: "hostname" | "query";
418
+ value: string;
419
+ }, {
420
+ createdAt: Date;
421
+ affiliateId: string;
422
+ type: "hostname" | "query";
423
+ value: string;
424
+ }>;
425
+ };
426
+ put: {};
427
+ delete: {
428
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
429
+ type: "hostname" | "query";
430
+ value: string;
431
+ }, unknown>;
432
+ };
433
+ copy: {};
434
+ head: {};
435
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
436
+ patch: {};
437
+ options: {};
438
+ get: {};
439
+ post: {
440
+ "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
441
+ createdAt: string;
442
+ userId: string;
443
+ hostname?: string | undefined;
444
+ query?: string | undefined;
445
+ }, {
446
+ id: string;
447
+ createdAt: Date;
448
+ affiliateId: string | null;
449
+ userId: string;
450
+ createdVia: {
451
+ createdAt: string;
452
+ hostname?: string | undefined;
453
+ query?: string | undefined;
454
+ };
455
+ }>;
456
+ };
457
+ put: {};
458
+ delete: {};
459
+ copy: {};
460
+ head: {};
461
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
462
+ patch: {
463
+ "/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:invitationId/status", unknown, {
464
+ status: OrganizationInvitationStatus.Accepted;
465
+ }, unknown>;
466
+ };
467
+ options: {};
468
+ get: {
469
+ "/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:invitationId", unknown, unknown, {
470
+ id: string;
471
+ createdAt: number;
472
+ status: OrganizationInvitationStatus;
473
+ tenantId: string;
474
+ updatedAt: number;
475
+ organizationId: string;
476
+ inviterId: string | null;
477
+ expiresAt: number;
478
+ invitee: string;
479
+ acceptedUserId: string | null;
480
+ organizationRoles: OrganizationRoleEntity[];
481
+ }>;
482
+ };
483
+ post: {};
484
+ put: {};
485
+ delete: {};
486
+ copy: {};
487
+ head: {};
488
+ }, "/api">>, "/api">;
489
+ export declare const tenantAuthRouter: import("@withtyped/server").Router<RequestContext, import("@withtyped/server").WithBodyContext<import("@withtyped/server").BaseContext & {
490
+ request: {
491
+ method?: import("@withtyped/server").RequestMethod | undefined;
492
+ headers: import("http").IncomingHttpHeaders;
493
+ url: URL;
494
+ body?: unknown;
495
+ };
496
+ }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
497
+ patch: {
498
+ "/:tenantId/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/status", unknown, {
499
+ status: OrganizationInvitationStatus.Revoked;
500
+ }, {
501
+ id: string;
502
+ createdAt: number;
503
+ status: OrganizationInvitationStatus;
504
+ tenantId: string;
505
+ updatedAt: number;
506
+ organizationId: string;
507
+ inviterId: string | null;
508
+ expiresAt: number;
509
+ invitee: string;
510
+ acceptedUserId: string | null;
511
+ organizationRoles: OrganizationRoleEntity[];
512
+ }>;
513
+ };
514
+ options: {};
515
+ get: {
516
+ "/:tenantId/members": import("@withtyped/server").PathGuard<"/:tenantId/members", unknown, unknown, {
517
+ id: string;
518
+ name: string | null;
519
+ username: string | null;
520
+ primaryEmail: string | null;
521
+ primaryPhone: string | null;
522
+ avatar: string | null;
523
+ organizationRoles: OrganizationRoleEntity[];
524
+ }[]>;
525
+ } & {
526
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, unknown, {
527
+ id: string;
528
+ createdAt: number;
529
+ status: OrganizationInvitationStatus;
530
+ tenantId: string;
531
+ updatedAt: number;
532
+ organizationId: string;
533
+ inviterId: string | null;
534
+ expiresAt: number;
535
+ invitee: string;
536
+ acceptedUserId: string | null;
537
+ organizationRoles: OrganizationRoleEntity[];
538
+ }[]>;
539
+ };
540
+ post: {
541
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, {
542
+ invitee: string;
543
+ roleName: TenantRole;
544
+ expiresAt?: number | undefined;
545
+ }, {
546
+ id: string;
547
+ createdAt: number;
548
+ status: OrganizationInvitationStatus;
549
+ tenantId: string;
550
+ updatedAt: number;
551
+ organizationId: string;
552
+ inviterId: string | null;
553
+ expiresAt: number;
554
+ invitee: string;
555
+ acceptedUserId: string | null;
556
+ organizationRoles: OrganizationRoleEntity[];
557
+ }>;
558
+ } & {
559
+ "/:tenantId/invitations/:invitationId/message": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/message", unknown, unknown, unknown>;
560
+ };
561
+ put: {
562
+ "/:tenantId/members/:userId/roles": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/roles", unknown, {
563
+ roleName: TenantRole;
564
+ }, unknown>;
565
+ };
566
+ delete: {
567
+ "/:tenantId/members/:userId": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId", unknown, unknown, unknown>;
568
+ } & {
569
+ "/:tenantId/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId", unknown, unknown, unknown>;
570
+ };
571
+ copy: {};
572
+ head: {};
573
+ }, "/api/tenants">>, "/api/tenants">;
574
+
575
+ export {
576
+ router as default,
577
+ };
578
+
579
+ export {};
package/package.json CHANGED
@@ -1,40 +1,39 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-2087c06",
3
+ "version": "0.2.5-2a72cc4",
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/ts-config": "5.0.0",
22
21
  "@types/accepts": "^1.3.5",
23
22
  "@types/http-proxy": "^1.17.9",
24
- "@types/jest": "^29.4.0",
25
23
  "@types/mime-types": "^2.1.1",
26
- "@types/node": "^18.11.18",
24
+ "@types/node": "^20.0.0",
27
25
  "@types/yargs": "^17.0.24",
28
- "dts-bundle-generator": "^8.0.1",
29
- "eslint": "^8.21.0",
30
- "jest": "^29.5.0",
31
- "lint-staged": "^13.0.0",
26
+ "dts-bundle-generator": "^9.3.1",
27
+ "eslint": "^8.44.0",
28
+ "lint-staged": "^15.0.0",
32
29
  "nodemon": "^3.0.0",
33
- "prettier": "^2.8.1",
34
- "typescript": "^5.0.0"
30
+ "prettier": "^3.0.0",
31
+ "typescript": "^5.3.3",
32
+ "vite-tsconfig-paths": "^4.3.1",
33
+ "vitest": "^1.0.0"
35
34
  },
36
35
  "engines": {
37
- "node": "^18.12.0"
36
+ "node": "^20.9.0"
38
37
  },
39
38
  "eslintConfig": {
40
39
  "extends": "@silverhand",
@@ -50,22 +49,19 @@
50
49
  "access": "public"
51
50
  },
52
51
  "dependencies": {
53
- "@silverhand/essentials": "^2.7.0",
54
- "@withtyped/server": "^0.12.7"
52
+ "@silverhand/essentials": "^2.9.0",
53
+ "@withtyped/server": "^0.13.3"
55
54
  },
56
55
  "scripts": {
57
56
  "precommit": "lint-staged",
58
- "build": "rm -rf build/ && tsc -p tsconfig.build.json",
57
+ "build": "rm -rf build/ && tsc -p tsconfig.build.json && pnpm build:lib",
59
58
  "//": "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",
61
- "build:test": "rm -rf build/ && tsc -p tsconfig.test.json --sourcemap",
59
+ "build:lib": "rm -rf lib/ && dts-bundle-generator src/routes/index.ts --project tsconfig.build.lib.json -o lib/routes/index.d.ts",
62
60
  "lint": "eslint --ext .ts src",
63
61
  "lint:report": "pnpm lint --format json --output-file report.json",
64
62
  "dev": "rm -rf build/ && nodemon",
65
63
  "start": "NODE_ENV=production node .",
66
- "test:only": "NODE_OPTIONS=\"--experimental-vm-modules --max_old_space_size=4096\" jest --logHeapUsage",
67
- "test": "pnpm build:test && pnpm test:only && pnpm build:lib && pnpm test:types",
68
- "test:ci": "pnpm test:only --coverage --silent",
64
+ "test": "vitest && pnpm build:lib && pnpm test:types",
69
65
  "test:types": "tsc -p tsconfig.test.types.json",
70
66
  "cli": "node ./build/cli/index.js"
71
67
  }
@@ -1,309 +0,0 @@
1
- // Generated by dts-bundle-generator v8.0.1
2
-
3
- import { RequestContext } from '@withtyped/server';
4
- import { InferModelType } from '@withtyped/server/model';
5
-
6
- export type WithAuthContext<Context = RequestContext> = Context & {
7
- auth: {
8
- id: string;
9
- scopes: string[];
10
- };
11
- };
12
- declare enum TenantTag {
13
- Development = "development",
14
- Staging = "staging",
15
- Production = "production"
16
- }
17
- declare enum VerificationCodeType {
18
- SignIn = "SignIn",
19
- Register = "Register",
20
- ForgotPassword = "ForgotPassword",
21
- /** @deprecated */
22
- Continue = "Continue",
23
- Generic = "Generic",
24
- /** @deprecated Use `Generic` type template for sending test sms/email use case */
25
- Test = "Test"
26
- }
27
- declare const AffiliateProperties: import("@withtyped/server/model").default<"affiliate_properties", {
28
- createdAt: Date;
29
- affiliateId: string;
30
- type: "hostname" | "query";
31
- value: string;
32
- }, "createdAt", "createdAt">;
33
- export type AffiliateProperty = InferModelType<typeof AffiliateProperties>;
34
- declare const Affiliates: import("@withtyped/server/model").default<"affiliates", {
35
- id: string;
36
- createdAt: Date;
37
- name: string;
38
- }, "createdAt" | "id", "createdAt" | "id">;
39
- export type Affiliate = InferModelType<typeof Affiliates>;
40
- export type AffiliateData = Affiliate & {
41
- properties: Array<Pick<AffiliateProperty, "type" | "value">>;
42
- };
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<{
44
- options: {};
45
- patch: {
46
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
47
- name?: string | undefined;
48
- tag?: TenantTag | undefined;
49
- }, {
50
- name: string;
51
- id: string;
52
- indicator: string;
53
- tag: TenantTag;
54
- }>;
55
- };
56
- get: {
57
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
58
- name: string;
59
- id: string;
60
- indicator: string;
61
- tag: TenantTag;
62
- }[]>;
63
- } & {
64
- "/tenants/my/subscription": import("@withtyped/server").PathGuard<"/my/subscription", unknown, unknown, {
65
- status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
66
- planId: string;
67
- currentPeriodStart: Date;
68
- currentPeriodEnd: Date;
69
- }>;
70
- } & {
71
- "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, {
72
- status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
73
- planId: string;
74
- currentPeriodStart: Date;
75
- currentPeriodEnd: Date;
76
- }>;
77
- } & {
78
- "/tenants/:tenantId/invoices": import("@withtyped/server").PathGuard<"/:tenantId/invoices", unknown, unknown, {
79
- invoices: {
80
- status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
81
- createdAt: Date;
82
- id: string;
83
- updatedAt: Date;
84
- customerId: string | null;
85
- billingReason: string | null;
86
- periodStart: Date;
87
- periodEnd: Date;
88
- amountDue: number;
89
- amountPaid: number;
90
- subscriptionId: string | null;
91
- hostedInvoiceUrl: string | null;
92
- invoicePdf: string | null;
93
- planName: string | null;
94
- }[];
95
- }>;
96
- } & {
97
- "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
98
- activeUsers: number;
99
- cost: number;
100
- }>;
101
- };
102
- 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
- put: {};
114
- head: {};
115
- delete: {
116
- "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
117
- } & {
118
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
119
- };
120
- copy: {};
121
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
122
- options: {};
123
- patch: {};
124
- get: {
125
- "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
126
- from?: string | undefined;
127
- }, unknown, unknown>;
128
- };
129
- post: {
130
- "/services/send-email": import("@withtyped/server").PathGuard<"/send-email", unknown, {
131
- data: {
132
- type: VerificationCodeType;
133
- to: string;
134
- payload: {
135
- senderName?: string | undefined;
136
- companyInformation?: string | undefined;
137
- appLogo?: string | undefined;
138
- code: string;
139
- };
140
- };
141
- }, unknown>;
142
- } & {
143
- "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
144
- data: {
145
- type: VerificationCodeType;
146
- to: string;
147
- payload: {
148
- senderName?: string | undefined;
149
- companyInformation?: string | undefined;
150
- appLogo?: string | undefined;
151
- code: string;
152
- };
153
- };
154
- }, unknown>;
155
- } & {
156
- "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
157
- data: {
158
- type: VerificationCodeType;
159
- to: string;
160
- payload: {
161
- senderName?: string | undefined;
162
- companyInformation?: string | undefined;
163
- appLogo?: string | undefined;
164
- code: string;
165
- };
166
- };
167
- }, unknown>;
168
- };
169
- put: {};
170
- head: {};
171
- delete: {};
172
- copy: {};
173
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
174
- options: {};
175
- patch: {};
176
- get: {
177
- "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
178
- createdAt: Date;
179
- id: string;
180
- name: string;
181
- quota: {
182
- mauLimit: number | null;
183
- applicationsLimit: number;
184
- machineToMachineLimit: number;
185
- resourcesLimit: number;
186
- scopesPerResourceLimit: number;
187
- customDomainEnabled: boolean;
188
- omniSignInEnabled: boolean;
189
- builtInEmailConnectorEnabled: boolean;
190
- socialConnectorsLimit: number | null;
191
- standardConnectorsLimit: number;
192
- rolesLimit: number;
193
- scopesPerRoleLimit: number | null;
194
- hooksLimit: number;
195
- auditLogsRetentionDays: number;
196
- };
197
- stripeProducts: {
198
- description?: string | undefined;
199
- type: "flat" | "tier1" | "tier2" | "tier3";
200
- id: string;
201
- name: string;
202
- price: {
203
- quantity?: 1 | undefined;
204
- unitAmount?: number | null | undefined;
205
- id: string;
206
- unitAmountDecimal: string;
207
- };
208
- }[];
209
- updatedAt: Date;
210
- }[]>;
211
- };
212
- post: {};
213
- put: {};
214
- head: {};
215
- delete: {};
216
- copy: {};
217
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
218
- options: {};
219
- patch: {};
220
- get: {
221
- "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
222
- status: "open" | "complete" | "expired";
223
- createdAt: Date;
224
- id: string;
225
- userId: string;
226
- updatedAt: Date;
227
- tenantId: string | null;
228
- planId: string;
229
- }>;
230
- };
231
- post: {
232
- "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
233
- tenantId?: string | undefined;
234
- tenantTag?: TenantTag | undefined;
235
- tenantName?: string | undefined;
236
- cancelCallbackUrl?: string | undefined;
237
- planId: string;
238
- successCallbackUrl: string;
239
- }, {
240
- redirectUri?: string | null | undefined;
241
- sessionId: string;
242
- }>;
243
- };
244
- put: {};
245
- head: {};
246
- delete: {};
247
- copy: {};
248
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
249
- options: {};
250
- patch: {};
251
- get: {
252
- "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
253
- };
254
- post: {
255
- "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
256
- name: string;
257
- }, {
258
- createdAt: Date;
259
- id: string;
260
- name: string;
261
- }>;
262
- } & {
263
- "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
264
- value: string;
265
- type: "hostname" | "query";
266
- }, unknown>;
267
- };
268
- put: {};
269
- head: {};
270
- delete: {
271
- "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
272
- value: string;
273
- type: "hostname" | "query";
274
- }, unknown>;
275
- };
276
- copy: {};
277
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
278
- options: {};
279
- patch: {};
280
- get: {};
281
- post: {
282
- "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
283
- hostname?: string | undefined;
284
- query?: string | undefined;
285
- createdAt: string;
286
- userId: string;
287
- }, {
288
- createdAt: Date;
289
- id: string;
290
- affiliateId: string | null;
291
- userId: string;
292
- createdVia: {
293
- hostname?: string | undefined;
294
- query?: string | undefined;
295
- createdAt: string;
296
- };
297
- }>;
298
- };
299
- put: {};
300
- head: {};
301
- delete: {};
302
- copy: {};
303
- }, "/api">>, "/api">;
304
-
305
- export {
306
- router as default,
307
- };
308
-
309
- export {};