alepha 0.14.1 → 0.14.2
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.
- package/README.md +3 -3
- package/dist/api/audits/index.d.ts +342 -342
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.d.ts +161 -161
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/users/index.d.ts +791 -791
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +4 -0
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts +128 -128
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/batch/index.js.map +1 -1
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cli/index.d.ts +173 -167
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +427 -409
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +5 -5
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +7 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +7 -6
- package/dist/core/index.native.js.map +1 -1
- package/dist/datetime/index.js.map +1 -1
- package/dist/fake/index.js.map +1 -1
- package/dist/file/index.js.map +1 -1
- package/dist/lock/redis/index.js.map +1 -1
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/index.browser.js +26 -5
- package/dist/orm/index.browser.js.map +1 -1
- package/dist/orm/index.d.ts +115 -90
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +37 -12
- package/dist/orm/index.js.map +1 -1
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.js.map +1 -1
- package/dist/router/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +6 -6
- package/dist/scheduler/index.js.map +1 -1
- package/dist/security/index.d.ts +28 -28
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +155 -155
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cache/index.js.map +1 -1
- package/dist/server/cookies/index.browser.js.map +1 -1
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.browser.js.map +1 -1
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/health/index.d.ts +17 -17
- package/dist/server/helmet/index.js.map +1 -1
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/multipart/index.js.map +1 -1
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/security/index.d.ts +9 -9
- package/dist/server/security/index.js.map +1 -1
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/thread/index.js.map +1 -1
- package/dist/topic/core/index.js.map +1 -1
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.browser.js.map +1 -1
- package/dist/websocket/index.d.ts +7 -7
- package/dist/websocket/index.js.map +1 -1
- package/package.json +3 -3
- package/src/api/users/index.ts +4 -0
- package/src/cli/apps/AlephaCli.ts +31 -14
- package/src/cli/apps/AlephaPackageBuilderCli.ts +2 -1
- package/src/cli/assets/appRouterTs.ts +1 -1
- package/src/cli/commands/{ViteCommands.ts → build.ts} +2 -105
- package/src/cli/commands/{ChangelogCommands.ts → changelog.ts} +7 -22
- package/src/cli/commands/clean.ts +14 -0
- package/src/cli/commands/{DrizzleCommands.ts → db.ts} +10 -117
- package/src/cli/commands/{DeployCommands.ts → deploy.ts} +1 -1
- package/src/cli/commands/dev.ts +57 -0
- package/src/cli/commands/format.ts +17 -0
- package/src/cli/commands/{CoreCommands.ts → init.ts} +2 -40
- package/src/cli/commands/lint.ts +17 -0
- package/src/cli/commands/root.ts +32 -0
- package/src/cli/commands/run.ts +24 -0
- package/src/cli/commands/test.ts +42 -0
- package/src/cli/commands/typecheck.ts +19 -0
- package/src/cli/commands/{VerifyCommands.ts → verify.ts} +1 -13
- package/src/cli/defineConfig.ts +10 -1
- package/src/cli/index.ts +16 -7
- package/src/cli/services/GitMessageParser.ts +1 -1
- package/src/core/Alepha.ts +7 -4
- package/src/orm/index.browser.ts +1 -1
- package/src/orm/index.ts +10 -6
- package/src/orm/providers/{PostgresTypeProvider.ts → DatabaseTypeProvider.ts} +25 -3
- package/src/cli/commands/BiomeCommands.ts +0 -29
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { $inject } from "alepha";
|
|
2
|
+
import { $command } from "alepha/command";
|
|
3
|
+
import { AlephaCliUtils } from "../services/AlephaCliUtils.ts";
|
|
4
|
+
|
|
5
|
+
export class TypecheckCommand {
|
|
6
|
+
protected readonly utils = $inject(AlephaCliUtils);
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Run TypeScript type checking across the codebase with no emit.
|
|
10
|
+
*/
|
|
11
|
+
public readonly typecheck = $command({
|
|
12
|
+
name: "typecheck",
|
|
13
|
+
description: "Check TypeScript types across the codebase",
|
|
14
|
+
handler: async ({ root }) => {
|
|
15
|
+
await this.utils.ensureDependency(root, "typescript");
|
|
16
|
+
await this.utils.exec("tsc --noEmit");
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -2,7 +2,7 @@ import { $inject } from "alepha";
|
|
|
2
2
|
import { $command } from "alepha/command";
|
|
3
3
|
import { AlephaCliUtils } from "../services/AlephaCliUtils.ts";
|
|
4
4
|
|
|
5
|
-
export class
|
|
5
|
+
export class VerifyCommand {
|
|
6
6
|
protected readonly utils = $inject(AlephaCliUtils);
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -44,16 +44,4 @@ export class VerifyCommands {
|
|
|
44
44
|
await run("alepha clean");
|
|
45
45
|
},
|
|
46
46
|
});
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Run TypeScript type checking across the codebase with no emit.
|
|
50
|
-
*/
|
|
51
|
-
public readonly typecheck = $command({
|
|
52
|
-
name: "typecheck",
|
|
53
|
-
description: "Check TypeScript types across the codebase",
|
|
54
|
-
handler: async ({ root }) => {
|
|
55
|
-
await this.utils.ensureDependency(root, "typescript");
|
|
56
|
-
await this.utils.exec("tsc --noEmit");
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
47
|
}
|
package/src/cli/defineConfig.ts
CHANGED
|
@@ -3,13 +3,22 @@ import type { CommandPrimitive } from "alepha/command";
|
|
|
3
3
|
|
|
4
4
|
export type AlephaCliConfig = (alepha: Alepha) => {
|
|
5
5
|
commands?: Record<string, CommandPrimitive>;
|
|
6
|
+
services?: Array<any>;
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
export const defineConfig = (config: AlephaCliConfig) => {
|
|
9
10
|
return (alepha: Alepha) => {
|
|
10
|
-
const { commands } = config(alepha);
|
|
11
|
+
const { commands, services = [] } = config(alepha);
|
|
12
|
+
for (const it of services) {
|
|
13
|
+
alepha.with(it);
|
|
14
|
+
}
|
|
11
15
|
return {
|
|
12
16
|
...commands,
|
|
13
17
|
};
|
|
14
18
|
};
|
|
15
19
|
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @alias defineConfig
|
|
23
|
+
*/
|
|
24
|
+
export const defineAlephaConfig = defineConfig;
|
package/src/cli/index.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
export * from "./apps/AlephaCli.ts";
|
|
2
2
|
export * from "./apps/AlephaPackageBuilderCli.ts";
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./commands/
|
|
5
|
-
export * from "./commands/
|
|
6
|
-
export * from "./commands/
|
|
7
|
-
export * from "./commands/
|
|
8
|
-
export * from "./commands/
|
|
9
|
-
export * from "./commands/
|
|
3
|
+
export * from "./atoms/changelogOptions.ts";
|
|
4
|
+
export * from "./commands/build.ts";
|
|
5
|
+
export * from "./commands/changelog.ts";
|
|
6
|
+
export * from "./commands/clean.ts";
|
|
7
|
+
export * from "./commands/db.ts";
|
|
8
|
+
export * from "./commands/deploy.ts";
|
|
9
|
+
export * from "./commands/dev.ts";
|
|
10
|
+
export * from "./commands/format.ts";
|
|
11
|
+
export * from "./commands/init.ts";
|
|
12
|
+
export * from "./commands/lint.ts";
|
|
13
|
+
export * from "./commands/root.ts";
|
|
14
|
+
export * from "./commands/run.ts";
|
|
15
|
+
export * from "./commands/test.ts";
|
|
16
|
+
export * from "./commands/typecheck.ts";
|
|
17
|
+
export * from "./commands/verify.ts";
|
|
10
18
|
export * from "./defineConfig.ts";
|
|
11
19
|
export * from "./services/AlephaCliUtils.ts";
|
|
20
|
+
export * from "./services/GitMessageParser.ts";
|
|
12
21
|
export * from "./version.ts";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
type ChangelogOptions,
|
|
4
4
|
DEFAULT_IGNORE,
|
|
5
5
|
} from "../atoms/changelogOptions.ts";
|
|
6
|
-
import type { Commit } from "../commands/
|
|
6
|
+
import type { Commit } from "../commands/changelog.ts";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Service for parsing git commit messages into structured format.
|
package/src/core/Alepha.ts
CHANGED
|
@@ -165,11 +165,14 @@ export class Alepha {
|
|
|
165
165
|
...state.env,
|
|
166
166
|
...process.env,
|
|
167
167
|
};
|
|
168
|
+
}
|
|
168
169
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
// force production mode when building with vite
|
|
171
|
+
if (process.env.NODE_ENV === "production") {
|
|
172
|
+
state.env ??= {};
|
|
173
|
+
Object.assign(state.env, {
|
|
174
|
+
NODE_ENV: "production",
|
|
175
|
+
});
|
|
173
176
|
}
|
|
174
177
|
|
|
175
178
|
const alepha = new Alepha(state);
|
package/src/orm/index.browser.ts
CHANGED
|
@@ -16,7 +16,7 @@ export * from "./interfaces/FilterOperators.ts";
|
|
|
16
16
|
export * from "./interfaces/PgQuery.ts";
|
|
17
17
|
export * from "./interfaces/PgQueryWhere.ts";
|
|
18
18
|
export * from "./primitives/$entity.ts";
|
|
19
|
-
export * from "./providers/
|
|
19
|
+
export * from "./providers/DatabaseTypeProvider.ts";
|
|
20
20
|
export * from "./schemas/legacyIdSchema.ts";
|
|
21
21
|
|
|
22
22
|
// ---------------------------------------------------------------------------------------------------------------------
|
package/src/orm/index.ts
CHANGED
|
@@ -114,6 +114,7 @@ export * from "./primitives/$entity.ts";
|
|
|
114
114
|
export * from "./primitives/$repository.ts";
|
|
115
115
|
export * from "./primitives/$sequence.ts";
|
|
116
116
|
export * from "./primitives/$transaction.ts";
|
|
117
|
+
export * from "./providers/DatabaseTypeProvider.ts";
|
|
117
118
|
export * from "./providers/DrizzleKitProvider.ts";
|
|
118
119
|
export * from "./providers/drivers/BunPostgresProvider.ts";
|
|
119
120
|
export * from "./providers/drivers/BunSqliteProvider.ts";
|
|
@@ -121,7 +122,6 @@ export * from "./providers/drivers/CloudflareD1Provider.ts";
|
|
|
121
122
|
export * from "./providers/drivers/DatabaseProvider.ts";
|
|
122
123
|
export * from "./providers/drivers/NodePostgresProvider.ts";
|
|
123
124
|
export * from "./providers/drivers/NodeSqliteProvider.ts";
|
|
124
|
-
export * from "./providers/PostgresTypeProvider.ts";
|
|
125
125
|
export * from "./providers/RepositoryProvider.ts";
|
|
126
126
|
export * from "./schemas/insertSchema.ts";
|
|
127
127
|
export * from "./schemas/legacyIdSchema.ts";
|
|
@@ -135,21 +135,25 @@ export * from "./types/schema.ts";
|
|
|
135
135
|
* Postgres client based on Drizzle ORM, Alepha type-safe friendly.
|
|
136
136
|
*
|
|
137
137
|
* ```ts
|
|
138
|
+
* import { t } from "alepha";
|
|
139
|
+
* import { $entity, $repository, db } from "alepha/postgres";
|
|
140
|
+
*
|
|
138
141
|
* const users = $entity({
|
|
139
142
|
* name: "users",
|
|
140
143
|
* schema: t.object({
|
|
141
|
-
* id:
|
|
144
|
+
* id: db.primaryKey(),
|
|
142
145
|
* name: t.text(),
|
|
143
146
|
* email: t.text(),
|
|
144
147
|
* }),
|
|
145
148
|
* });
|
|
146
149
|
*
|
|
147
|
-
* class
|
|
150
|
+
* class App {
|
|
148
151
|
* users = $repository(users);
|
|
149
|
-
* }
|
|
150
152
|
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
+
* getUserByName(name: string) {
|
|
154
|
+
* return this.users.findOne({ name: { eq: name } });
|
|
155
|
+
* }
|
|
156
|
+
* }
|
|
153
157
|
* ```
|
|
154
158
|
*
|
|
155
159
|
* This is not a full ORM, but rather a set of tools to work with Postgres databases in a type-safe way.
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
import type { PgAttr } from "../helpers/pgAttr.ts";
|
|
36
36
|
import { pgAttr } from "../helpers/pgAttr.ts";
|
|
37
37
|
|
|
38
|
-
export class
|
|
38
|
+
export class DatabaseTypeProvider {
|
|
39
39
|
public readonly attr = pgAttr;
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -239,7 +239,7 @@ export class PostgresTypeProvider {
|
|
|
239
239
|
|
|
240
240
|
/**
|
|
241
241
|
* Creates a page schema for a given object schema.
|
|
242
|
-
* It's used by {@link
|
|
242
|
+
* It's used by {@link Repository#paginate} method.
|
|
243
243
|
*/
|
|
244
244
|
public readonly page = <T extends TObject>(
|
|
245
245
|
resource: T,
|
|
@@ -249,4 +249,26 @@ export class PostgresTypeProvider {
|
|
|
249
249
|
};
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
/**
|
|
253
|
+
* Wrapper of TypeProvider (`t`) for database types.
|
|
254
|
+
*
|
|
255
|
+
* Use `db` for improve TypeBox schema definitions with database-specific attributes.
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* import { t } from "alepha";
|
|
260
|
+
* import { db } from "alepha/orm";
|
|
261
|
+
*
|
|
262
|
+
* const userSchema = t.object({
|
|
263
|
+
* id: db.primaryKey(t.uuid()),
|
|
264
|
+
* email: t.email(),
|
|
265
|
+
* createdAt: db.createdAt(),
|
|
266
|
+
* });
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
export const db = new DatabaseTypeProvider();
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @deprecated Use `db` instead.
|
|
273
|
+
*/
|
|
274
|
+
export const pg = db;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { $inject } from "alepha";
|
|
2
|
-
import { $command } from "alepha/command";
|
|
3
|
-
import { $logger } from "alepha/logger";
|
|
4
|
-
import { AlephaCliUtils } from "../services/AlephaCliUtils.ts";
|
|
5
|
-
|
|
6
|
-
export class BiomeCommands {
|
|
7
|
-
protected readonly log = $logger();
|
|
8
|
-
protected readonly utils = $inject(AlephaCliUtils);
|
|
9
|
-
|
|
10
|
-
public readonly format = $command({
|
|
11
|
-
name: "format",
|
|
12
|
-
description: "Format the codebase using Biome",
|
|
13
|
-
handler: async ({ root }) => {
|
|
14
|
-
await this.utils.ensureConfig(root, { biomeJson: true });
|
|
15
|
-
await this.utils.ensureDependency(root, "@biomejs/biome");
|
|
16
|
-
await this.utils.exec(`biome format --fix`);
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
public readonly lint = $command({
|
|
21
|
-
name: "lint",
|
|
22
|
-
description: "Run linter across the codebase using Biome",
|
|
23
|
-
handler: async ({ root }) => {
|
|
24
|
-
await this.utils.ensureConfig(root, { biomeJson: true });
|
|
25
|
-
await this.utils.ensureDependency(root, "@biomejs/biome");
|
|
26
|
-
await this.utils.exec(`biome check --formatter-enabled=false --fix`);
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
}
|