alepha 0.13.0 → 0.13.1
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/dist/api-jobs/index.d.ts +26 -26
- package/dist/api-users/index.d.ts +1 -1
- package/dist/cli/{dist-Sz2EXvQX.cjs → dist-Dl9Vl7Ur.js} +17 -13
- package/dist/cli/{dist-BBPjuQ56.js.map → dist-Dl9Vl7Ur.js.map} +1 -1
- package/dist/cli/index.d.ts +3 -11
- package/dist/cli/index.js +106 -74
- package/dist/cli/index.js.map +1 -1
- package/dist/email/index.js +71 -73
- package/dist/email/index.js.map +1 -1
- package/dist/orm/index.d.ts +1 -1
- package/dist/orm/index.js.map +1 -1
- package/dist/queue/index.d.ts +4 -4
- package/dist/retry/index.d.ts +1 -1
- package/dist/retry/index.js +2 -2
- package/dist/retry/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +6 -6
- package/dist/security/index.d.ts +28 -28
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server-health/index.d.ts +17 -17
- package/dist/server-metrics/index.js +170 -174
- package/dist/server-metrics/index.js.map +1 -1
- package/dist/server-security/index.d.ts +9 -9
- package/dist/vite/index.js +4 -5
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.d.ts +7 -7
- package/package.json +52 -103
- package/src/cli/apps/AlephaPackageBuilderCli.ts +7 -2
- package/src/cli/assets/appRouterTs.ts +9 -0
- package/src/cli/assets/indexHtml.ts +2 -1
- package/src/cli/assets/mainBrowserTs.ts +10 -0
- package/src/cli/commands/CoreCommands.ts +6 -5
- package/src/cli/commands/DrizzleCommands.ts +65 -57
- package/src/cli/commands/VerifyCommands.ts +1 -1
- package/src/cli/services/ProjectUtils.ts +44 -38
- package/src/orm/providers/DrizzleKitProvider.ts +1 -1
- package/src/retry/descriptors/$retry.ts +5 -3
- package/src/server/providers/NodeHttpServerProvider.ts +1 -1
- package/src/vite/helpers/boot.ts +3 -3
- package/dist/api-files/index.cjs +0 -1293
- package/dist/api-files/index.cjs.map +0 -1
- package/dist/api-files/index.d.cts +0 -829
- package/dist/api-jobs/index.cjs +0 -274
- package/dist/api-jobs/index.cjs.map +0 -1
- package/dist/api-jobs/index.d.cts +0 -654
- package/dist/api-notifications/index.cjs +0 -380
- package/dist/api-notifications/index.cjs.map +0 -1
- package/dist/api-notifications/index.d.cts +0 -289
- package/dist/api-parameters/index.cjs +0 -66
- package/dist/api-parameters/index.cjs.map +0 -1
- package/dist/api-parameters/index.d.cts +0 -84
- package/dist/api-users/index.cjs +0 -6009
- package/dist/api-users/index.cjs.map +0 -1
- package/dist/api-users/index.d.cts +0 -4740
- package/dist/api-verifications/index.cjs +0 -407
- package/dist/api-verifications/index.cjs.map +0 -1
- package/dist/api-verifications/index.d.cts +0 -207
- package/dist/batch/index.cjs +0 -408
- package/dist/batch/index.cjs.map +0 -1
- package/dist/batch/index.d.cts +0 -330
- package/dist/bin/index.cjs +0 -17
- package/dist/bin/index.cjs.map +0 -1
- package/dist/bin/index.d.cts +0 -1
- package/dist/bucket/index.cjs +0 -303
- package/dist/bucket/index.cjs.map +0 -1
- package/dist/bucket/index.d.cts +0 -355
- package/dist/cache/index.cjs +0 -241
- package/dist/cache/index.cjs.map +0 -1
- package/dist/cache/index.d.cts +0 -202
- package/dist/cache-redis/index.cjs +0 -84
- package/dist/cache-redis/index.cjs.map +0 -1
- package/dist/cache-redis/index.d.cts +0 -40
- package/dist/cli/chunk-DSlc6foC.cjs +0 -43
- package/dist/cli/dist-BBPjuQ56.js +0 -2778
- package/dist/cli/dist-Sz2EXvQX.cjs.map +0 -1
- package/dist/cli/index.cjs +0 -1241
- package/dist/cli/index.cjs.map +0 -1
- package/dist/cli/index.d.cts +0 -422
- package/dist/command/index.cjs +0 -693
- package/dist/command/index.cjs.map +0 -1
- package/dist/command/index.d.cts +0 -340
- package/dist/core/index.cjs +0 -2264
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -1927
- package/dist/datetime/index.cjs +0 -318
- package/dist/datetime/index.cjs.map +0 -1
- package/dist/datetime/index.d.cts +0 -145
- package/dist/email/index.cjs +0 -10874
- package/dist/email/index.cjs.map +0 -1
- package/dist/email/index.d.cts +0 -186
- package/dist/fake/index.cjs +0 -34641
- package/dist/fake/index.cjs.map +0 -1
- package/dist/fake/index.d.cts +0 -74
- package/dist/file/index.cjs +0 -1212
- package/dist/file/index.cjs.map +0 -1
- package/dist/file/index.d.cts +0 -698
- package/dist/lock/index.cjs +0 -226
- package/dist/lock/index.cjs.map +0 -1
- package/dist/lock/index.d.cts +0 -361
- package/dist/lock-redis/index.cjs +0 -113
- package/dist/lock-redis/index.cjs.map +0 -1
- package/dist/lock-redis/index.d.cts +0 -24
- package/dist/logger/index.cjs +0 -521
- package/dist/logger/index.cjs.map +0 -1
- package/dist/logger/index.d.cts +0 -281
- package/dist/orm/index.cjs +0 -2986
- package/dist/orm/index.cjs.map +0 -1
- package/dist/orm/index.d.cts +0 -2213
- package/dist/queue/index.cjs +0 -1044
- package/dist/queue/index.cjs.map +0 -1
- package/dist/queue/index.d.cts +0 -1265
- package/dist/queue-redis/index.cjs +0 -873
- package/dist/queue-redis/index.cjs.map +0 -1
- package/dist/queue-redis/index.d.cts +0 -82
- package/dist/redis/index.cjs +0 -153
- package/dist/redis/index.cjs.map +0 -1
- package/dist/redis/index.d.cts +0 -82
- package/dist/retry/index.cjs +0 -146
- package/dist/retry/index.cjs.map +0 -1
- package/dist/retry/index.d.cts +0 -172
- package/dist/router/index.cjs +0 -111
- package/dist/router/index.cjs.map +0 -1
- package/dist/router/index.d.cts +0 -46
- package/dist/scheduler/index.cjs +0 -576
- package/dist/scheduler/index.cjs.map +0 -1
- package/dist/scheduler/index.d.cts +0 -145
- package/dist/security/index.cjs +0 -2402
- package/dist/security/index.cjs.map +0 -1
- package/dist/security/index.d.cts +0 -598
- package/dist/server/index.cjs +0 -1680
- package/dist/server/index.cjs.map +0 -1
- package/dist/server/index.d.cts +0 -810
- package/dist/server-auth/index.cjs +0 -3146
- package/dist/server-auth/index.cjs.map +0 -1
- package/dist/server-auth/index.d.cts +0 -1164
- package/dist/server-cache/index.cjs +0 -252
- package/dist/server-cache/index.cjs.map +0 -1
- package/dist/server-cache/index.d.cts +0 -164
- package/dist/server-compress/index.cjs +0 -141
- package/dist/server-compress/index.cjs.map +0 -1
- package/dist/server-compress/index.d.cts +0 -38
- package/dist/server-cookies/index.cjs +0 -234
- package/dist/server-cookies/index.cjs.map +0 -1
- package/dist/server-cookies/index.d.cts +0 -144
- package/dist/server-cors/index.cjs +0 -201
- package/dist/server-cors/index.cjs.map +0 -1
- package/dist/server-cors/index.d.cts +0 -140
- package/dist/server-health/index.cjs +0 -62
- package/dist/server-health/index.cjs.map +0 -1
- package/dist/server-health/index.d.cts +0 -58
- package/dist/server-helmet/index.cjs +0 -131
- package/dist/server-helmet/index.cjs.map +0 -1
- package/dist/server-helmet/index.d.cts +0 -97
- package/dist/server-links/index.cjs +0 -992
- package/dist/server-links/index.cjs.map +0 -1
- package/dist/server-links/index.d.cts +0 -513
- package/dist/server-metrics/index.cjs +0 -4535
- package/dist/server-metrics/index.cjs.map +0 -1
- package/dist/server-metrics/index.d.cts +0 -35
- package/dist/server-multipart/index.cjs +0 -237
- package/dist/server-multipart/index.cjs.map +0 -1
- package/dist/server-multipart/index.d.cts +0 -50
- package/dist/server-proxy/index.cjs +0 -186
- package/dist/server-proxy/index.cjs.map +0 -1
- package/dist/server-proxy/index.d.cts +0 -234
- package/dist/server-rate-limit/index.cjs +0 -241
- package/dist/server-rate-limit/index.cjs.map +0 -1
- package/dist/server-rate-limit/index.d.cts +0 -183
- package/dist/server-security/index.cjs +0 -316
- package/dist/server-security/index.cjs.map +0 -1
- package/dist/server-security/index.d.cts +0 -173
- package/dist/server-static/index.cjs +0 -170
- package/dist/server-static/index.cjs.map +0 -1
- package/dist/server-static/index.d.cts +0 -121
- package/dist/server-swagger/index.cjs +0 -1021
- package/dist/server-swagger/index.cjs.map +0 -1
- package/dist/server-swagger/index.d.cts +0 -382
- package/dist/sms/index.cjs +0 -221
- package/dist/sms/index.cjs.map +0 -1
- package/dist/sms/index.d.cts +0 -130
- package/dist/thread/index.cjs +0 -350
- package/dist/thread/index.cjs.map +0 -1
- package/dist/thread/index.d.cts +0 -260
- package/dist/topic/index.cjs +0 -282
- package/dist/topic/index.cjs.map +0 -1
- package/dist/topic/index.d.cts +0 -523
- package/dist/topic-redis/index.cjs +0 -71
- package/dist/topic-redis/index.cjs.map +0 -1
- package/dist/topic-redis/index.d.cts +0 -42
- package/dist/vite/index.cjs +0 -1077
- package/dist/vite/index.cjs.map +0 -1
- package/dist/vite/index.d.cts +0 -542
- package/dist/websocket/index.cjs +0 -1117
- package/dist/websocket/index.cjs.map +0 -1
- package/dist/websocket/index.d.cts +0 -861
|
@@ -3,11 +3,13 @@ import { join } from "node:path";
|
|
|
3
3
|
import { $inject, Alepha, AlephaError } from "alepha";
|
|
4
4
|
import { FileSystemProvider } from "alepha/file";
|
|
5
5
|
import { $logger } from "alepha/logger";
|
|
6
|
-
import type { RepositoryProvider } from "alepha/orm";
|
|
6
|
+
import type { DrizzleKitProvider, RepositoryProvider } from "alepha/orm";
|
|
7
7
|
import { boot } from "alepha/vite";
|
|
8
8
|
import { tsImport } from "tsx/esm/api";
|
|
9
|
+
import { appRouterTs } from "../assets/appRouterTs.ts";
|
|
9
10
|
import { biomeJson } from "../assets/biomeJson.ts";
|
|
10
11
|
import { indexHtml } from "../assets/indexHtml.ts";
|
|
12
|
+
import { mainBrowserTs } from "../assets/mainBrowserTs.ts";
|
|
11
13
|
import { tsconfigJson } from "../assets/tsconfigJson.ts";
|
|
12
14
|
import { viteConfigTs } from "../assets/viteConfigTs.ts";
|
|
13
15
|
import { version } from "../version.ts";
|
|
@@ -40,18 +42,16 @@ export class ProjectUtils {
|
|
|
40
42
|
* @param root - The root directory of the project
|
|
41
43
|
*/
|
|
42
44
|
public async ensureYarn(root: string): Promise<void> {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
await this.ensureFileExists(
|
|
46
|
+
root,
|
|
47
|
+
".yarnrc.yml",
|
|
48
|
+
"nodeLinker: node-modules",
|
|
49
|
+
false,
|
|
50
|
+
);
|
|
49
51
|
|
|
50
52
|
// remove lock files from other package managers
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
await this.fs.rm(npmLockPath, { force: true });
|
|
54
|
-
await this.fs.rm(pnpmLockPath, { force: true });
|
|
53
|
+
await this.fs.rm(join(root, "package-lock.json"), { force: true });
|
|
54
|
+
await this.fs.rm(join(root, "pnpm-lock.yaml"), { force: true });
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -74,8 +74,13 @@ export class ProjectUtils {
|
|
|
74
74
|
|
|
75
75
|
if (modes.react) {
|
|
76
76
|
dependencies["@alepha/react"] = `^${version}`;
|
|
77
|
-
dependencies.react = "19.
|
|
78
|
-
|
|
77
|
+
dependencies.react = "^19.2.0";
|
|
78
|
+
dependencies["react-dom"] = "^19.2.0";
|
|
79
|
+
devDependencies["@types/react"] = "^19.2.0";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (modes.admin) {
|
|
83
|
+
dependencies["@alepha/ui"] = `^${version}`;
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
return {
|
|
@@ -85,6 +90,7 @@ export class ProjectUtils {
|
|
|
85
90
|
scripts: {
|
|
86
91
|
dev: "alepha dev",
|
|
87
92
|
build: "alepha build",
|
|
93
|
+
verify: "alepha verify",
|
|
88
94
|
},
|
|
89
95
|
};
|
|
90
96
|
}
|
|
@@ -353,22 +359,6 @@ export class ProjectUtils {
|
|
|
353
359
|
);
|
|
354
360
|
}
|
|
355
361
|
|
|
356
|
-
/**
|
|
357
|
-
* Get DrizzleKitProvider from an Alepha instance.
|
|
358
|
-
*
|
|
359
|
-
* Searches the Alepha registry for the DrizzleKitProvider instance.
|
|
360
|
-
*
|
|
361
|
-
* @param alepha - The Alepha instance to search
|
|
362
|
-
* @returns The DrizzleKitProvider instance
|
|
363
|
-
*/
|
|
364
|
-
public getKitFromAlepha(alepha: Alepha): any {
|
|
365
|
-
// biome-ignore lint/complexity/useLiteralKeys: private key
|
|
366
|
-
return alepha["registry"]
|
|
367
|
-
.values()
|
|
368
|
-
.find((it: any) => it.instance.constructor.name === "DrizzleKitProvider")
|
|
369
|
-
?.instance;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
362
|
/**
|
|
373
363
|
* Generate JavaScript code for Drizzle entities export.
|
|
374
364
|
*
|
|
@@ -476,7 +466,8 @@ ${models.map((it: string) => `export const ${it} = models["${it}"];`).join("\n")
|
|
|
476
466
|
options.args,
|
|
477
467
|
);
|
|
478
468
|
|
|
479
|
-
const
|
|
469
|
+
const drizzleKitProvider =
|
|
470
|
+
alepha.inject<DrizzleKitProvider>("DrizzleKitProvider");
|
|
480
471
|
const repositoryProvider =
|
|
481
472
|
alepha.inject<RepositoryProvider>("RepositoryProvider");
|
|
482
473
|
const accepted = new Set<string>([]);
|
|
@@ -503,7 +494,7 @@ ${models.map((it: string) => `export const ${it} = models["${it}"];`).join("\n")
|
|
|
503
494
|
this.log.info(options.logMessage(providerName, dialect));
|
|
504
495
|
|
|
505
496
|
const drizzleConfigJsPath = await this.prepareDrizzleConfig({
|
|
506
|
-
kit,
|
|
497
|
+
kit: drizzleKitProvider,
|
|
507
498
|
provider,
|
|
508
499
|
providerName,
|
|
509
500
|
providerUrl: provider.url,
|
|
@@ -536,11 +527,27 @@ ${models.map((it: string) => `export const ${it} = models["${it}"];`).join("\n")
|
|
|
536
527
|
return;
|
|
537
528
|
}
|
|
538
529
|
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
);
|
|
530
|
+
const serverEntry = "src/main.server.ts";
|
|
531
|
+
const browserEntry = "src/main.browser.ts";
|
|
532
|
+
const appRouter = "src/AppRouter.ts";
|
|
533
|
+
|
|
534
|
+
await this.fs.writeFile(join(root, "index.html"), indexHtml(browserEntry));
|
|
535
|
+
|
|
536
|
+
try {
|
|
537
|
+
await this.fs.mkdir(join(root, "src"), { recursive: true });
|
|
538
|
+
} catch {}
|
|
539
|
+
|
|
540
|
+
if (!(await this.fs.exists(join(root, browserEntry)))) {
|
|
541
|
+
await this.fs.writeFile(join(root, browserEntry), mainBrowserTs());
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (!(await this.fs.exists(join(root, serverEntry)))) {
|
|
545
|
+
await this.fs.writeFile(join(root, serverEntry), mainBrowserTs());
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
if (!(await this.fs.exists(join(root, appRouter)))) {
|
|
549
|
+
await this.fs.writeFile(join(root, appRouter), appRouterTs());
|
|
550
|
+
}
|
|
544
551
|
}
|
|
545
552
|
|
|
546
553
|
public async hasDir(root: string, dirName: string): Promise<boolean> {
|
|
@@ -559,6 +566,5 @@ ${models.map((it: string) => `export const ${it} = models["${it}"];`).join("\n")
|
|
|
559
566
|
|
|
560
567
|
export interface DependencyModes {
|
|
561
568
|
react?: boolean;
|
|
562
|
-
|
|
563
|
-
// ui?: boolean;
|
|
569
|
+
admin?: boolean;
|
|
564
570
|
}
|
|
@@ -297,7 +297,7 @@ export class DrizzleKitProvider {
|
|
|
297
297
|
* Try to load the official Drizzle Kit API.
|
|
298
298
|
* If not available, fallback to the local kit import.
|
|
299
299
|
*/
|
|
300
|
-
|
|
300
|
+
public importDrizzleKit(): typeof DrizzleKit {
|
|
301
301
|
try {
|
|
302
302
|
return createRequire(import.meta.url)("drizzle-kit/api");
|
|
303
303
|
} catch (_) {
|
|
@@ -76,18 +76,20 @@ export class RetryDescriptor<
|
|
|
76
76
|
T extends (...args: any[]) => any,
|
|
77
77
|
> extends Descriptor<RetryDescriptorOptions<T>> {
|
|
78
78
|
protected readonly retryProvider = $inject(RetryProvider);
|
|
79
|
-
protected appAbortController
|
|
79
|
+
protected appAbortController?: AbortController;
|
|
80
80
|
|
|
81
81
|
constructor(args: DescriptorArgs<RetryDescriptorOptions<T>>) {
|
|
82
82
|
super(args);
|
|
83
83
|
|
|
84
|
-
this.appAbortController = new AbortController();
|
|
85
84
|
this.alepha.events.on("stop", () => {
|
|
86
|
-
this.appAbortController
|
|
85
|
+
this.appAbortController?.abort();
|
|
87
86
|
});
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
async run(...args: Parameters<T>): Promise<ReturnType<T>> {
|
|
90
|
+
// Nov 25: Cloudflare does not like 'new AbortController' outside main handler, we can't pre-create it in the constructor.
|
|
91
|
+
this.appAbortController ??= new AbortController();
|
|
92
|
+
|
|
91
93
|
return this.retryProvider.retry(
|
|
92
94
|
{
|
|
93
95
|
...this.options,
|
|
@@ -67,7 +67,7 @@ export class NodeHttpServerProvider extends ServerProvider {
|
|
|
67
67
|
return createServer(
|
|
68
68
|
{
|
|
69
69
|
// nov 25 - keep connections alive for better performance, cuz we http/1.1 by default
|
|
70
|
-
keepAlive:
|
|
70
|
+
keepAlive: this.alepha.isProduction(),
|
|
71
71
|
},
|
|
72
72
|
func,
|
|
73
73
|
);
|
package/src/vite/helpers/boot.ts
CHANGED
|
@@ -43,10 +43,8 @@ const getServerEntry = async (
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const maybeEntry = [
|
|
46
|
-
"src/index.server.ts",
|
|
47
46
|
"src/main.server.ts",
|
|
48
47
|
"src/server-entry.ts",
|
|
49
|
-
"src/index.server.tsx",
|
|
50
48
|
"src/main.server.tsx",
|
|
51
49
|
"src/server-entry.tsx",
|
|
52
50
|
"src/main.ts",
|
|
@@ -68,7 +66,9 @@ const getServerEntry = async (
|
|
|
68
66
|
return clientEntry;
|
|
69
67
|
}
|
|
70
68
|
|
|
71
|
-
throw new AlephaError(
|
|
69
|
+
throw new AlephaError(
|
|
70
|
+
`Could not find a server entry file. List of supported entry file: ${maybeEntry.join(", ")}`,
|
|
71
|
+
);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
/**
|