@logto/cloud 0.2.5-1116646 → 0.2.5-1795c3d

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,321 @@
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").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
+ post: {
67
+ "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
68
+ name?: string | undefined;
69
+ tag?: TenantTag | undefined;
70
+ }, {
71
+ id: string;
72
+ name: string;
73
+ indicator: string;
74
+ planId: string;
75
+ tag: TenantTag;
76
+ }>;
77
+ };
78
+ put: {};
79
+ head: {};
80
+ delete: {
81
+ "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
82
+ };
83
+ copy: {};
84
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
85
+ options: {};
86
+ patch: {};
87
+ get: {
88
+ "/tenants/my/subscription": import("@withtyped/server").PathGuard<"/my/subscription", unknown, unknown, {
89
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
90
+ planId: string;
91
+ currentPeriodStart: Date;
92
+ currentPeriodEnd: Date;
93
+ }>;
94
+ } & {
95
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, {
96
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused";
97
+ planId: string;
98
+ currentPeriodStart: Date;
99
+ currentPeriodEnd: Date;
100
+ }>;
101
+ } & {
102
+ "/tenants/:tenantId/invoices": import("@withtyped/server").PathGuard<"/:tenantId/invoices", unknown, unknown, {
103
+ invoices: {
104
+ status: "void" | "open" | "draft" | "paid" | "uncollectible" | null;
105
+ createdAt: Date;
106
+ id: string;
107
+ updatedAt: Date;
108
+ customerId: string | null;
109
+ billingReason: string | null;
110
+ periodStart: Date;
111
+ periodEnd: Date;
112
+ amountDue: number;
113
+ amountPaid: number;
114
+ subscriptionId: string | null;
115
+ hostedInvoiceUrl: string | null;
116
+ invoicePdf: string | null;
117
+ planName: string | null;
118
+ }[];
119
+ }>;
120
+ } & {
121
+ "/tenants/:tenantId/usage": import("@withtyped/server").PathGuard<"/:tenantId/usage", unknown, unknown, {
122
+ activeUsers: number;
123
+ cost: number;
124
+ }>;
125
+ };
126
+ post: {
127
+ "/tenants/:tenantId/stripe-customer-portal": import("@withtyped/server").PathGuard<"/:tenantId/stripe-customer-portal", unknown, {
128
+ callbackUrl?: string | undefined;
129
+ }, {
130
+ redirectUri: string;
131
+ }>;
132
+ };
133
+ put: {};
134
+ head: {};
135
+ delete: {
136
+ "/tenants/:tenantId/subscription": import("@withtyped/server").PathGuard<"/:tenantId/subscription", unknown, unknown, unknown>;
137
+ };
138
+ copy: {};
139
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
140
+ options: {};
141
+ patch: {};
142
+ get: {
143
+ "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
144
+ from?: string | undefined;
145
+ }, unknown, {
146
+ count: number;
147
+ }>;
148
+ };
149
+ post: {
150
+ "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
151
+ data: {
152
+ type: VerificationCodeType;
153
+ to: string;
154
+ payload: {
155
+ senderName?: string | undefined;
156
+ companyInformation?: string | undefined;
157
+ appLogo?: string | undefined;
158
+ code: string;
159
+ };
160
+ };
161
+ }, unknown>;
162
+ } & {
163
+ "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
164
+ data: {
165
+ type: VerificationCodeType;
166
+ to: string;
167
+ payload: {
168
+ senderName?: string | undefined;
169
+ companyInformation?: string | undefined;
170
+ appLogo?: string | undefined;
171
+ code: string;
172
+ };
173
+ };
174
+ }, unknown>;
175
+ };
176
+ put: {};
177
+ head: {};
178
+ delete: {};
179
+ copy: {};
180
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
181
+ options: {};
182
+ patch: {};
183
+ get: {
184
+ "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
185
+ createdAt: Date;
186
+ id: string;
187
+ name: string;
188
+ quota: {
189
+ mauLimit: number | null;
190
+ applicationsLimit: number | null;
191
+ machineToMachineLimit: number | null;
192
+ resourcesLimit: number | null;
193
+ scopesPerResourceLimit: number | null;
194
+ customDomainEnabled: boolean;
195
+ omniSignInEnabled: boolean;
196
+ builtInEmailConnectorEnabled: boolean;
197
+ socialConnectorsLimit: number | null;
198
+ standardConnectorsLimit: number | null;
199
+ rolesLimit: number | null;
200
+ scopesPerRoleLimit: number | null;
201
+ hooksLimit: number | null;
202
+ auditLogsRetentionDays: number | null;
203
+ };
204
+ stripeProducts: {
205
+ description?: string | undefined;
206
+ type: "flat" | "tier1" | "tier2" | "tier3";
207
+ id: string;
208
+ name: string;
209
+ price: {
210
+ quantity?: 1 | undefined;
211
+ unitAmount?: number | null | undefined;
212
+ id: string;
213
+ unitAmountDecimal: string;
214
+ };
215
+ }[];
216
+ updatedAt: Date;
217
+ }[]>;
218
+ };
219
+ post: {};
220
+ put: {};
221
+ head: {};
222
+ delete: {};
223
+ copy: {};
224
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
225
+ options: {};
226
+ patch: {};
227
+ get: {
228
+ "/checkout-session/:id": import("@withtyped/server").PathGuard<"/:id", unknown, unknown, {
229
+ status: "open" | "complete" | "expired";
230
+ createdAt: Date;
231
+ id: string;
232
+ userId: string;
233
+ updatedAt: Date;
234
+ tenantId: string | null;
235
+ planId: string;
236
+ }>;
237
+ };
238
+ post: {
239
+ "/checkout-session": import("@withtyped/server").PathGuard<"/", unknown, {
240
+ tenantId?: string | undefined;
241
+ tenantTag?: TenantTag | undefined;
242
+ tenantName?: string | undefined;
243
+ cancelCallbackUrl?: string | undefined;
244
+ planId: string;
245
+ successCallbackUrl: string;
246
+ }, {
247
+ redirectUri?: string | null | undefined;
248
+ sessionId: string;
249
+ }>;
250
+ };
251
+ put: {};
252
+ head: {};
253
+ delete: {};
254
+ copy: {};
255
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
256
+ options: {};
257
+ patch: {};
258
+ get: {
259
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, unknown, AffiliateData[]>;
260
+ };
261
+ post: {
262
+ "/affiliates": import("@withtyped/server").PathGuard<"/", unknown, {
263
+ name: string;
264
+ }, {
265
+ createdAt: Date;
266
+ id: string;
267
+ name: string;
268
+ }>;
269
+ } & {
270
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
271
+ value: string;
272
+ type: "hostname" | "query";
273
+ }, {
274
+ value: string;
275
+ type: "hostname" | "query";
276
+ createdAt: Date;
277
+ affiliateId: string;
278
+ }>;
279
+ };
280
+ put: {};
281
+ head: {};
282
+ delete: {
283
+ "/affiliates/:id/properties": import("@withtyped/server").PathGuard<"/:id/properties", unknown, {
284
+ value: string;
285
+ type: "hostname" | "query";
286
+ }, unknown>;
287
+ };
288
+ copy: {};
289
+ }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
290
+ options: {};
291
+ patch: {};
292
+ get: {};
293
+ post: {
294
+ "/affiliate-logs": import("@withtyped/server").PathGuard<"/", unknown, {
295
+ hostname?: string | undefined;
296
+ query?: string | undefined;
297
+ createdAt: string;
298
+ userId: string;
299
+ }, {
300
+ createdAt: Date;
301
+ id: string;
302
+ affiliateId: string | null;
303
+ userId: string;
304
+ createdVia: {
305
+ hostname?: string | undefined;
306
+ query?: string | undefined;
307
+ createdAt: string;
308
+ };
309
+ }>;
310
+ };
311
+ put: {};
312
+ head: {};
313
+ delete: {};
314
+ copy: {};
315
+ }, "/api">>, "/api">;
316
+
317
+ export {
318
+ router as default,
319
+ };
320
+
321
+ export {};
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@logto/cloud",
3
- "version": "0.2.5-1116646",
3
+ "version": "0.2.5-1795c3d",
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/*"
@@ -24,11 +24,12 @@
24
24
  "@types/jest": "^29.4.0",
25
25
  "@types/mime-types": "^2.1.1",
26
26
  "@types/node": "^18.11.18",
27
+ "@types/yargs": "^17.0.24",
27
28
  "dts-bundle-generator": "^8.0.1",
28
29
  "eslint": "^8.21.0",
29
30
  "jest": "^29.5.0",
30
31
  "lint-staged": "^13.0.0",
31
- "nodemon": "^2.0.19",
32
+ "nodemon": "^3.0.0",
32
33
  "prettier": "^2.8.1",
33
34
  "typescript": "^5.0.0"
34
35
  },
@@ -36,28 +37,36 @@
36
37
  "node": "^18.12.0"
37
38
  },
38
39
  "eslintConfig": {
39
- "extends": "@silverhand"
40
+ "extends": "@silverhand",
41
+ "rules": {
42
+ "no-console": "error"
43
+ },
44
+ "ignorePatterns": [
45
+ "types.test.ts"
46
+ ]
40
47
  },
41
48
  "prettier": "@silverhand/eslint-config/.prettierrc",
42
49
  "publishConfig": {
43
50
  "access": "public"
44
51
  },
45
52
  "dependencies": {
46
- "@withtyped/server": "^0.12.0"
53
+ "@silverhand/essentials": "^2.7.0",
54
+ "@withtyped/server": "^0.12.7"
47
55
  },
48
56
  "scripts": {
49
57
  "precommit": "lint-staged",
50
- "build": "rm -rf build/ && tsc -p tsconfig.build.json",
58
+ "build": "rm -rf build/ && tsc -p tsconfig.build.json && pnpm build:lib",
51
59
  "//": "It is not used to build the service itself.",
52
- "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.json -o lib/routes/index.d.ts",
53
61
  "build:test": "rm -rf build/ && tsc -p tsconfig.test.json --sourcemap",
54
62
  "lint": "eslint --ext .ts src",
55
63
  "lint:report": "pnpm lint --format json --output-file report.json",
56
64
  "dev": "rm -rf build/ && nodemon",
57
65
  "start": "NODE_ENV=production node .",
58
66
  "test:only": "NODE_OPTIONS=\"--experimental-vm-modules --max_old_space_size=4096\" jest --logHeapUsage",
59
- "test": "pnpm build:test && pnpm test:only",
67
+ "test": "pnpm build:test && pnpm test:only && pnpm build:lib && pnpm test:types",
60
68
  "test:ci": "pnpm test:only --coverage --silent",
61
- "test:types": "tsc -p tsconfig.test.types.json"
69
+ "test:types": "tsc -p tsconfig.test.types.json",
70
+ "cli": "node ./build/cli/index.js"
62
71
  }
63
72
  }
@@ -1,171 +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 const Tenants: import("@withtyped/server/model").default<"tenants", {
18
- id: string;
19
- dbUser: string | null;
20
- dbUserPassword: string | null;
21
- name: string;
22
- tag: TenantTag;
23
- createdAt: Date;
24
- }, "name" | "createdAt" | "tag", "createdAt">;
25
- export type TenantModel = InferModelType<typeof Tenants>;
26
- export type TenantInfo = Pick<TenantModel, "id" | "name" | "tag"> & {
27
- indicator: string;
28
- };
29
- declare enum VerificationCodeType {
30
- SignIn = "SignIn",
31
- Register = "Register",
32
- ForgotPassword = "ForgotPassword",
33
- /** @deprecated */
34
- Continue = "Continue",
35
- Generic = "Generic",
36
- /** @deprecated Use `Generic` type template for sending test sms/email use case */
37
- Test = "Test"
38
- }
39
- declare enum ProductType {
40
- FlatRate = "FlatRate",
41
- Tier1 = "tier1",
42
- Tier2 = "tier2",
43
- Tier3 = "tier3"
44
- }
45
- declare const _default: import("@withtyped/server").Router<WithAuthContext, import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").MergeRoutes<import("@withtyped/server").BaseRoutes, import("@withtyped/server").RoutesWithPrefix<{
46
- options: {};
47
- patch: {
48
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, {
49
- name?: string | undefined;
50
- tag?: TenantTag | undefined;
51
- }, TenantInfo>;
52
- };
53
- get: {
54
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, unknown, TenantInfo[]>;
55
- };
56
- post: {
57
- "/tenants": import("@withtyped/server").PathGuard<"/", unknown, {
58
- name?: string | undefined;
59
- tag?: TenantTag | undefined;
60
- }, TenantInfo>;
61
- };
62
- put: {};
63
- head: {};
64
- delete: {
65
- "/tenants/:tenantId": import("@withtyped/server").PathGuard<"/:tenantId", unknown, unknown, unknown>;
66
- };
67
- copy: {};
68
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
69
- options: {};
70
- patch: {};
71
- get: {
72
- "/services/mails/usage": import("@withtyped/server").PathGuard<"/mails/usage", {
73
- from?: string | undefined;
74
- }, unknown, unknown>;
75
- };
76
- post: {
77
- "/services/send-email": import("@withtyped/server").PathGuard<"/send-email", unknown, {
78
- data: {
79
- type: VerificationCodeType;
80
- to: string;
81
- payload: {
82
- fromName?: string | undefined;
83
- companyAddress?: string | undefined;
84
- appLogo?: string | undefined;
85
- code: string;
86
- };
87
- };
88
- }, unknown>;
89
- } & {
90
- "/services/mails": import("@withtyped/server").PathGuard<"/mails", unknown, {
91
- data: {
92
- type: VerificationCodeType;
93
- to: string;
94
- payload: {
95
- fromName?: string | undefined;
96
- companyAddress?: string | undefined;
97
- appLogo?: string | undefined;
98
- code: string;
99
- };
100
- };
101
- }, unknown>;
102
- } & {
103
- "/services/send-sms": import("@withtyped/server").PathGuard<"/send-sms", unknown, {
104
- data: {
105
- type: VerificationCodeType;
106
- to: string;
107
- payload: {
108
- fromName?: string | undefined;
109
- companyAddress?: string | undefined;
110
- appLogo?: string | undefined;
111
- code: string;
112
- };
113
- };
114
- }, unknown>;
115
- };
116
- put: {};
117
- head: {};
118
- delete: {};
119
- copy: {};
120
- }, "/api">>, import("@withtyped/server").RoutesWithPrefix<{
121
- options: {};
122
- patch: {};
123
- get: {
124
- "/subscription-plans": import("@withtyped/server").PathGuard<"/", unknown, unknown, {
125
- id: string;
126
- name: string;
127
- products: {
128
- description?: string | undefined;
129
- id: string;
130
- name: string;
131
- type: ProductType;
132
- price: {
133
- quantity?: 1 | undefined;
134
- unitAmount?: number | null | undefined;
135
- id: string;
136
- unitAmountDecimal: string;
137
- };
138
- }[];
139
- quota: {
140
- tenantLimit: number | null;
141
- mauLimit: number | null;
142
- applicationsLimit: number;
143
- machineToMachineLimit: number;
144
- resourcesLimit: number;
145
- scopesPerResourceLimit: number;
146
- customDomainEnabled: boolean;
147
- omniSignInEnabled: boolean;
148
- builtInEmailConnectorEnabled: boolean;
149
- socialConnectorsLimit: number | null;
150
- standardConnectorsLimit: number;
151
- rolesLimit: number;
152
- scopesPerRoleLimit: number | null;
153
- hooksLimit: number;
154
- auditLogsRetentionDays: number;
155
- };
156
- createdAt: Date;
157
- updatedAt: Date;
158
- }[]>;
159
- };
160
- post: {};
161
- put: {};
162
- head: {};
163
- delete: {};
164
- copy: {};
165
- }, "/api">>, "/api">;
166
-
167
- export {
168
- _default as default,
169
- };
170
-
171
- export {};