@logto/cloud 0.2.5-70aa370 → 0.2.5-7a187bb

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,596 @@
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").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
+ link?: string | undefined;
288
+ code?: string | undefined;
289
+ senderName?: string | undefined;
290
+ companyInformation?: string | undefined;
291
+ appLogo?: string | undefined;
292
+ };
293
+ to: string;
294
+ };
295
+ }, unknown>;
296
+ } & {
297
+ "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
298
+ data: {
299
+ type: TemplateType | VerificationCodeType;
300
+ to: string;
301
+ payload: {
302
+ code?: string | undefined;
303
+ link?: string | undefined;
304
+ };
305
+ };
306
+ }, unknown>;
307
+ } & {
308
+ "/services/custom-jwt": import("@withtyped/server").PathGuard<"/custom-jwt", unknown, {
309
+ script: string;
310
+ token: Record<string, Json>;
311
+ envVars?: Record<string, string> | undefined;
312
+ context?: Record<string, Json> | undefined;
313
+ }, Json>;
314
+ };
315
+ put: {};
316
+ delete: {};
317
+ copy: {};
318
+ head: {};
319
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
320
+ patch: {};
321
+ options: {};
322
+ get: {
323
+ "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
324
+ id: string;
325
+ createdAt: Date;
326
+ name: string;
327
+ updatedAt: Date;
328
+ stripeProducts: {
329
+ type: "flat" | "tier1" | "tier2" | "tier3";
330
+ id: string;
331
+ name: string;
332
+ price: {
333
+ id: string;
334
+ unitAmountDecimal: string;
335
+ quantity?: 1 | undefined;
336
+ unitAmount?: number | null | undefined;
337
+ };
338
+ description?: string | undefined;
339
+ }[];
340
+ quota: {
341
+ mauLimit: number | null;
342
+ tokenLimit: number | null;
343
+ applicationsLimit: number | null;
344
+ machineToMachineLimit: number | null;
345
+ resourcesLimit: number | null;
346
+ scopesPerResourceLimit: number | null;
347
+ customDomainEnabled: boolean;
348
+ omniSignInEnabled: boolean;
349
+ builtInEmailConnectorEnabled: boolean;
350
+ socialConnectorsLimit: number | null;
351
+ standardConnectorsLimit: number | null;
352
+ rolesLimit: number | null;
353
+ machineToMachineRolesLimit: number | null;
354
+ scopesPerRoleLimit: number | null;
355
+ hooksLimit: number | null;
356
+ auditLogsRetentionDays: number | null;
357
+ mfaEnabled: boolean;
358
+ organizationsEnabled: boolean;
359
+ ssoEnabled: boolean;
360
+ thirdPartyApplicationsLimit: number | null;
361
+ };
362
+ }[]>;
363
+ };
364
+ post: {};
365
+ put: {};
366
+ delete: {};
367
+ copy: {};
368
+ head: {};
369
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
370
+ patch: {};
371
+ options: {};
372
+ get: {
373
+ "/my/tenant": import("@withtyped/server").PathGuard<"/tenant", unknown, unknown, {
374
+ name: string;
375
+ id: string;
376
+ indicator: string;
377
+ isSuspended: boolean;
378
+ tag: TenantTag;
379
+ }>;
380
+ };
381
+ post: {};
382
+ put: {};
383
+ delete: {};
384
+ copy: {};
385
+ head: {};
386
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
387
+ patch: {};
388
+ options: {};
389
+ get: {
390
+ "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
391
+ id: string;
392
+ createdAt: Date;
393
+ userId: string;
394
+ status: "open" | "complete" | "expired";
395
+ tenantId: string | null;
396
+ updatedAt: Date;
397
+ planId: string;
398
+ }>;
399
+ };
400
+ post: {
401
+ "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
402
+ planId: string;
403
+ successCallbackUrl: string;
404
+ tenantId?: string | undefined;
405
+ cancelCallbackUrl?: string | undefined;
406
+ tenantTag?: TenantTag | undefined;
407
+ tenantName?: string | undefined;
408
+ }, {
409
+ sessionId: string;
410
+ redirectUri?: string | null | undefined;
411
+ }>;
412
+ };
413
+ put: {};
414
+ delete: {};
415
+ copy: {};
416
+ head: {};
417
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
418
+ patch: {};
419
+ options: {};
420
+ get: {
421
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
422
+ };
423
+ post: {
424
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
425
+ name: string;
426
+ }, {
427
+ id: string;
428
+ createdAt: Date;
429
+ name: string;
430
+ }>;
431
+ } & {
432
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
433
+ type: "hostname" | "query";
434
+ value: string;
435
+ }, {
436
+ createdAt: Date;
437
+ affiliateId: string;
438
+ type: "hostname" | "query";
439
+ value: string;
440
+ }>;
441
+ };
442
+ put: {};
443
+ delete: {
444
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
445
+ type: "hostname" | "query";
446
+ value: string;
447
+ }, unknown>;
448
+ };
449
+ copy: {};
450
+ head: {};
451
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
452
+ patch: {};
453
+ options: {};
454
+ get: {};
455
+ post: {
456
+ "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
457
+ createdAt: string;
458
+ userId: string;
459
+ hostname?: string | undefined;
460
+ query?: string | undefined;
461
+ }, {
462
+ id: string;
463
+ createdAt: Date;
464
+ affiliateId: string | null;
465
+ userId: string;
466
+ createdVia: {
467
+ createdAt: string;
468
+ hostname?: string | undefined;
469
+ query?: string | undefined;
470
+ };
471
+ }>;
472
+ };
473
+ put: {};
474
+ delete: {};
475
+ copy: {};
476
+ head: {};
477
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
478
+ patch: {};
479
+ options: {};
480
+ get: {};
481
+ post: {};
482
+ put: {};
483
+ delete: {
484
+ "/logs/expired": import("@withtyped/server").PathGuard<"/expired", {
485
+ dryRun?: string | undefined;
486
+ }, unknown, {
487
+ affectedRows: number;
488
+ }>;
489
+ };
490
+ copy: {};
491
+ head: {};
492
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
493
+ patch: {
494
+ "/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:invitationId/status", unknown, {
495
+ status: OrganizationInvitationStatus.Accepted;
496
+ }, unknown>;
497
+ };
498
+ options: {};
499
+ get: {};
500
+ post: {};
501
+ put: {};
502
+ delete: {};
503
+ copy: {};
504
+ head: {};
505
+ }, "/api">>, "/api">;
506
+ export declare const tenantAuthRouter: import("@withtyped/server").Router<RequestContext, import("@withtyped/server").WithBodyContext<import("@withtyped/server").BaseContext & {
507
+ request: {
508
+ method?: import("@withtyped/server").RequestMethod | undefined;
509
+ headers: import("http").IncomingHttpHeaders;
510
+ url: URL;
511
+ body?: unknown;
512
+ };
513
+ }>, import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
514
+ patch: {
515
+ "/:tenantId/invitations/:invitationId/status": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/status", unknown, {
516
+ status: OrganizationInvitationStatus.Revoked;
517
+ }, {
518
+ id: string;
519
+ createdAt: number;
520
+ status: OrganizationInvitationStatus;
521
+ tenantId: string;
522
+ updatedAt: number;
523
+ organizationId: string;
524
+ inviterId: string | null;
525
+ expiresAt: number;
526
+ organizationRoles: OrganizationRoleEntity[];
527
+ invitee: string;
528
+ acceptedUserId: string | null;
529
+ }>;
530
+ };
531
+ options: {};
532
+ get: {
533
+ "/:tenantId/members": import("@withtyped/server").PathGuard<"/:tenantId/members", unknown, unknown, {
534
+ id: string;
535
+ name: string | null;
536
+ username: string | null;
537
+ primaryEmail: string | null;
538
+ primaryPhone: string | null;
539
+ avatar: string | null;
540
+ organizationRoles: OrganizationRoleEntity[];
541
+ }[]>;
542
+ } & {
543
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, unknown, {
544
+ id: string;
545
+ createdAt: number;
546
+ status: OrganizationInvitationStatus;
547
+ tenantId: string;
548
+ updatedAt: number;
549
+ organizationId: string;
550
+ inviterId: string | null;
551
+ expiresAt: number;
552
+ organizationRoles: OrganizationRoleEntity[];
553
+ invitee: string;
554
+ acceptedUserId: string | null;
555
+ }[]>;
556
+ };
557
+ post: {
558
+ "/:tenantId/invitations": import("@withtyped/server").PathGuard<"/:tenantId/invitations", unknown, {
559
+ roleName: TenantRole;
560
+ invitee: string;
561
+ expiresAt?: number | undefined;
562
+ }, {
563
+ id: string;
564
+ createdAt: number;
565
+ status: OrganizationInvitationStatus;
566
+ tenantId: string;
567
+ updatedAt: number;
568
+ organizationId: string;
569
+ inviterId: string | null;
570
+ expiresAt: number;
571
+ organizationRoles: OrganizationRoleEntity[];
572
+ invitee: string;
573
+ acceptedUserId: string | null;
574
+ }>;
575
+ } & {
576
+ "/:tenantId/invitations/:invitationId/message": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId/message", unknown, unknown, unknown>;
577
+ };
578
+ put: {
579
+ "/:tenantId/members/:userId/roles": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId/roles", unknown, {
580
+ roleName: TenantRole;
581
+ }, unknown>;
582
+ };
583
+ delete: {
584
+ "/:tenantId/members/:userId": import("@withtyped/server").PathGuard<"/:tenantId/members/:userId", unknown, unknown, unknown>;
585
+ } & {
586
+ "/:tenantId/invitations/:invitationId": import("@withtyped/server").PathGuard<"/:tenantId/invitations/:invitationId", unknown, unknown, unknown>;
587
+ };
588
+ copy: {};
589
+ head: {};
590
+ }, "/api/tenants">>, "/api/tenants">;
591
+
592
+ export {
593
+ router as default,
594
+ };
595
+
596
+ export {};
package/package.json CHANGED
@@ -1,40 +1,39 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-70aa370",
3
+ "version": "0.2.5-7a187bb",
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,325 +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
- id: string;
51
- name: string;
52
- indicator: string;
53
- planId: string;
54
- tag: TenantTag;
55
- }>;
56
- };
57
- get: {
58
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
59
- id: string;
60
- name: string;
61
- indicator: string;
62
- planId: string;
63
- tag: TenantTag;
64
- }[]>;
65
- } & {
66
- "/tenants/my/subscription": import("@withtyped/server").PathGuard<"/my/subscription", unknown, unknown, {
67
- status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
68
- planId: string;
69
- currentPeriodStart: Date;
70
- currentPeriodEnd: Date;
71
- }>;
72
- } & {
73
- "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, {
74
- status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
75
- planId: string;
76
- currentPeriodStart: Date;
77
- currentPeriodEnd: Date;
78
- }>;
79
- } & {
80
- "/tenants/:tenantId/invoices": import("@withtyped/server").PathGuard<"/:tenantId/invoices", unknown, unknown, {
81
- invoices: {
82
- status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
83
- createdAt: Date;
84
- id: string;
85
- updatedAt: Date;
86
- customerId: string | null;
87
- billingReason: string | null;
88
- periodStart: Date;
89
- periodEnd: Date;
90
- amountDue: number;
91
- amountPaid: number;
92
- subscriptionId: string | null;
93
- hostedInvoiceUrl: string | null;
94
- invoicePdf: string | null;
95
- planName: string | null;
96
- }[];
97
- }>;
98
- } & {
99
- "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
100
- activeUsers: number;
101
- cost: number;
102
- }>;
103
- };
104
- post: {
105
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
106
- name?: string | undefined;
107
- tag?: TenantTag | undefined;
108
- }, {
109
- id: string;
110
- name: string;
111
- indicator: string;
112
- planId: string;
113
- tag: TenantTag;
114
- }>;
115
- } & {
116
- "/tenants/:tenantId/stripe-customer-portal": import("@withtyped/server").PathGuard<"/:tenantId/stripe-customer-portal", unknown, {
117
- callbackUrl?: string | undefined;
118
- } | undefined, {
119
- redirectUri: string;
120
- }>;
121
- };
122
- put: {};
123
- head: {};
124
- delete: {
125
- "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
126
- } & {
127
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
128
- };
129
- copy: {};
130
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
131
- options: {};
132
- patch: {};
133
- get: {
134
- "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
135
- from?: string | undefined;
136
- }, unknown, {
137
- count: number;
138
- }>;
139
- };
140
- post: {
141
- "/services/send-email": import("@withtyped/server").PathGuard<"/send-email", unknown, {
142
- data: {
143
- type: VerificationCodeType;
144
- to: string;
145
- payload: {
146
- senderName?: string | undefined;
147
- companyInformation?: string | undefined;
148
- appLogo?: string | undefined;
149
- code: string;
150
- };
151
- };
152
- }, unknown>;
153
- } & {
154
- "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
155
- data: {
156
- type: VerificationCodeType;
157
- to: string;
158
- payload: {
159
- senderName?: string | undefined;
160
- companyInformation?: string | undefined;
161
- appLogo?: string | undefined;
162
- code: string;
163
- };
164
- };
165
- }, unknown>;
166
- } & {
167
- "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
168
- data: {
169
- type: VerificationCodeType;
170
- to: string;
171
- payload: {
172
- senderName?: string | undefined;
173
- companyInformation?: string | undefined;
174
- appLogo?: string | undefined;
175
- code: string;
176
- };
177
- };
178
- }, unknown>;
179
- };
180
- put: {};
181
- head: {};
182
- delete: {};
183
- copy: {};
184
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
185
- options: {};
186
- patch: {};
187
- get: {
188
- "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
189
- createdAt: Date;
190
- id: string;
191
- name: string;
192
- quota: {
193
- mauLimit: number | null;
194
- applicationsLimit: number;
195
- machineToMachineLimit: number;
196
- resourcesLimit: number;
197
- scopesPerResourceLimit: number;
198
- customDomainEnabled: boolean;
199
- omniSignInEnabled: boolean;
200
- builtInEmailConnectorEnabled: boolean;
201
- socialConnectorsLimit: number | null;
202
- standardConnectorsLimit: number;
203
- rolesLimit: number;
204
- scopesPerRoleLimit: number | null;
205
- hooksLimit: number;
206
- auditLogsRetentionDays: number;
207
- };
208
- stripeProducts: {
209
- description?: string | undefined;
210
- type: "flat" | "tier1" | "tier2" | "tier3";
211
- id: string;
212
- name: string;
213
- price: {
214
- quantity?: 1 | undefined;
215
- unitAmount?: number | null | undefined;
216
- id: string;
217
- unitAmountDecimal: string;
218
- };
219
- }[];
220
- updatedAt: Date;
221
- }[]>;
222
- };
223
- post: {};
224
- put: {};
225
- head: {};
226
- delete: {};
227
- copy: {};
228
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
229
- options: {};
230
- patch: {};
231
- get: {
232
- "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
233
- status: "open" | "complete" | "expired";
234
- createdAt: Date;
235
- id: string;
236
- userId: string;
237
- updatedAt: Date;
238
- tenantId: string | null;
239
- planId: string;
240
- }>;
241
- };
242
- post: {
243
- "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
244
- tenantId?: string | undefined;
245
- tenantTag?: TenantTag | undefined;
246
- tenantName?: string | undefined;
247
- cancelCallbackUrl?: string | undefined;
248
- planId: string;
249
- successCallbackUrl: string;
250
- }, {
251
- redirectUri?: string | null | undefined;
252
- sessionId: string;
253
- }>;
254
- };
255
- put: {};
256
- head: {};
257
- delete: {};
258
- copy: {};
259
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
260
- options: {};
261
- patch: {};
262
- get: {
263
- "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
264
- };
265
- post: {
266
- "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
267
- name: string;
268
- }, {
269
- createdAt: Date;
270
- id: string;
271
- name: string;
272
- }>;
273
- } & {
274
- "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
275
- value: string;
276
- type: "hostname" | "query";
277
- }, {
278
- value: string;
279
- type: "hostname" | "query";
280
- createdAt: Date;
281
- affiliateId: string;
282
- }>;
283
- };
284
- put: {};
285
- head: {};
286
- delete: {
287
- "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
288
- value: string;
289
- type: "hostname" | "query";
290
- }, unknown>;
291
- };
292
- copy: {};
293
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
294
- options: {};
295
- patch: {};
296
- get: {};
297
- post: {
298
- "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
299
- hostname?: string | undefined;
300
- query?: string | undefined;
301
- createdAt: string;
302
- userId: string;
303
- }, {
304
- createdAt: Date;
305
- id: string;
306
- affiliateId: string | null;
307
- userId: string;
308
- createdVia: {
309
- hostname?: string | undefined;
310
- query?: string | undefined;
311
- createdAt: string;
312
- };
313
- }>;
314
- };
315
- put: {};
316
- head: {};
317
- delete: {};
318
- copy: {};
319
- }, "/api">>, "/api">;
320
-
321
- export {
322
- router as default,
323
- };
324
-
325
- export {};