@holo-js/cli 0.3.0 → 0.3.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/bin/holo.mjs +38 -35
- package/dist/{broadcast-5VZM5SGQ.mjs → broadcast-PJLFVZH4.mjs} +9 -11
- package/dist/{cache-A42JSVYA.mjs → cache-KR4ACOYD.mjs} +8 -9
- package/dist/{cache-migrations-4WKSEN2Q.mjs → cache-migrations-J34RE4WH.mjs} +13 -15
- package/dist/{chunk-OLZEMIDQ.mjs → chunk-2XXJ76YC.mjs} +1 -1
- package/dist/{chunk-3RFRE7XG.mjs → chunk-3ICVWL2M.mjs} +2 -2
- package/dist/{chunk-JVLZ3SOW.mjs → chunk-4VYR2ARA.mjs} +2 -2
- package/dist/{chunk-QSVMXMTQ.mjs → chunk-7KZVFDSI.mjs} +3 -3
- package/dist/{chunk-TRYHX5S4.mjs → chunk-AZ6NVJAP.mjs} +1 -1
- package/dist/{chunk-LHK5YUR4.mjs → chunk-CT23GSEC.mjs} +1 -1
- package/dist/{chunk-6BHJLCAO.mjs → chunk-FFTJKBQF.mjs} +43 -13
- package/dist/{chunk-EQUFFLRG.mjs → chunk-I3RRWDLV.mjs} +5 -5
- package/dist/{chunk-R4ZYMEDU.mjs → chunk-L3YATEQY.mjs} +1 -1
- package/dist/{chunk-TH5YCOZB.mjs → chunk-L6FF22IV.mjs} +28 -17
- package/dist/{chunk-YACY2572.mjs → chunk-PVVGQSUP.mjs} +47 -47
- package/dist/{chunk-I7QBCEV7.mjs → chunk-Y355VYRN.mjs} +5 -3
- package/dist/{chunk-VRGB6DIS.mjs → chunk-YJWHIQ45.mjs} +2 -0
- package/dist/{config-BZHQK532.mjs → config-XVPV6DJW.mjs} +3 -3
- package/dist/{dev-7KGRV56X.mjs → dev-NTQTEY5B.mjs} +9 -10
- package/dist/{discovery-HNH3BLDL.mjs → discovery-TMPUQQHI.mjs} +4 -4
- package/dist/{generators-3FVW4AEJ.mjs → generators-3FDCCJDC.mjs} +14 -16
- package/dist/index.mjs +38 -35
- package/dist/{media-migrations-EG34NYAG.mjs → media-migrations-UJ6BMUSZ.mjs} +10 -12
- package/dist/{plugins-ZGLB6JO6.mjs → plugins-USHY6SPF.mjs} +3 -3
- package/dist/{queue-BEZDCZCY.mjs → queue-6U7JU4T6.mjs} +11 -13
- package/dist/{queue-R54DUUYA.mjs → queue-VJEFD6SE.mjs} +13 -15
- package/dist/{queue-migrations-AM3AKT76.mjs → queue-migrations-6YUUOKMH.mjs} +13 -15
- package/dist/{runtime-4TJYZLQV.mjs → runtime-FVRB4O2M.mjs} +8 -10
- package/dist/{runtime-VR5BDPYQ.mjs → runtime-P5R7H3B4.mjs} +1 -1
- package/dist/{scaffold-ASEX5LEX.mjs → scaffold-F3AZDNPG.mjs} +7 -6
- package/dist/{security-KYTLP4DF.mjs → security-X4274RHX.mjs} +8 -9
- package/package.json +19 -19
- package/dist/broadcast-AABT52BK.mjs +0 -206
- package/dist/cache-DUVBBOZU.mjs +0 -138
- package/dist/cache-migrations-PD2T5AV4.mjs +0 -175
- package/dist/chunk-HX6MOYBO.mjs +0 -2
- package/dist/chunk-KRADH7PK.mjs +0 -501
- package/dist/chunk-LALDNNPH.mjs +0 -428
- package/dist/chunk-M3IPUCTM.mjs +0 -25
- package/dist/chunk-OI54DOHK.mjs +0 -3170
- package/dist/dev-GQT37XJU.mjs +0 -46
- package/dist/generators-JWVNGUUE.mjs +0 -523
- package/dist/media-migrations-LGI7R7AR.mjs +0 -108
- package/dist/queue-migrations-U477YSFD.mjs +0 -173
- package/dist/runtime-MSRQD5W5.mjs +0 -59
- package/dist/scaffold-ZAD3XUSD.mjs +0 -143
- package/dist/security-4QLV7QCH.mjs +0 -73
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runProjectPrepare
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-L6FF22IV.mjs";
|
|
4
|
+
import "./chunk-CT23GSEC.mjs";
|
|
5
5
|
import {
|
|
6
6
|
getRegistryMigrationSlug,
|
|
7
7
|
hasRegisteredCreateTableMigration,
|
|
8
8
|
hasRegisteredMigrationSlug,
|
|
9
9
|
nextMigrationTemplate
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-M3IPUCTM.mjs";
|
|
10
|
+
} from "./chunk-2XXJ76YC.mjs";
|
|
12
11
|
import {
|
|
13
12
|
writeLine
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import {
|
|
17
|
-
prepareProjectDiscovery
|
|
18
|
-
} from "./chunk-QSVMXMTQ.mjs";
|
|
19
|
-
import "./chunk-OI54DOHK.mjs";
|
|
13
|
+
} from "./chunk-Y355VYRN.mjs";
|
|
14
|
+
import "./chunk-FFTJKBQF.mjs";
|
|
20
15
|
import {
|
|
21
16
|
ensureProjectConfig
|
|
22
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4VYR2ARA.mjs";
|
|
18
|
+
import {
|
|
19
|
+
prepareProjectDiscovery
|
|
20
|
+
} from "./chunk-7KZVFDSI.mjs";
|
|
23
21
|
import {
|
|
24
22
|
loadGeneratedProjectRegistry
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-L3YATEQY.mjs";
|
|
24
|
+
import "./chunk-3ICVWL2M.mjs";
|
|
25
|
+
import "./chunk-AZ6NVJAP.mjs";
|
|
28
26
|
import {
|
|
29
27
|
makeProjectRelativePath,
|
|
30
28
|
resolveDefaultArtifactPath,
|
|
31
29
|
writeTextFile
|
|
32
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-PVVGQSUP.mjs";
|
|
33
31
|
|
|
34
32
|
// src/queue-migrations.ts
|
|
35
33
|
import { resolve } from "path";
|
|
@@ -22,16 +22,14 @@ import {
|
|
|
22
22
|
resolveRuntimeWorkerPath,
|
|
23
23
|
runRuntimeInvocation,
|
|
24
24
|
withRuntimeEnvironment
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-TRYHX5S4.mjs";
|
|
34
|
-
import "./chunk-YACY2572.mjs";
|
|
25
|
+
} from "./chunk-I3RRWDLV.mjs";
|
|
26
|
+
import "./chunk-FFTJKBQF.mjs";
|
|
27
|
+
import "./chunk-4VYR2ARA.mjs";
|
|
28
|
+
import "./chunk-7KZVFDSI.mjs";
|
|
29
|
+
import "./chunk-L3YATEQY.mjs";
|
|
30
|
+
import "./chunk-3ICVWL2M.mjs";
|
|
31
|
+
import "./chunk-AZ6NVJAP.mjs";
|
|
32
|
+
import "./chunk-PVVGQSUP.mjs";
|
|
35
33
|
export {
|
|
36
34
|
RUNTIME_MIGRATION_NAME_PATTERN,
|
|
37
35
|
cacheProjectConfig,
|
|
@@ -56,23 +56,24 @@ import {
|
|
|
56
56
|
upsertMediaPackageDependency,
|
|
57
57
|
upsertNotificationsPackageDependency,
|
|
58
58
|
upsertSecurityPackageDependency
|
|
59
|
-
} from "./chunk-
|
|
60
|
-
import "./chunk-
|
|
59
|
+
} from "./chunk-FFTJKBQF.mjs";
|
|
60
|
+
import "./chunk-4VYR2ARA.mjs";
|
|
61
|
+
import "./chunk-7KZVFDSI.mjs";
|
|
61
62
|
import {
|
|
62
63
|
renderAuthProviderRouteFiles,
|
|
63
64
|
renderFrameworkFiles,
|
|
64
65
|
renderFrameworkRunner,
|
|
65
66
|
renderFrameworkRunnerForDescriptor,
|
|
66
67
|
renderNextBroadcastConfigRoute
|
|
67
|
-
} from "./chunk-
|
|
68
|
-
import "./chunk-
|
|
69
|
-
import "./chunk-
|
|
68
|
+
} from "./chunk-L3YATEQY.mjs";
|
|
69
|
+
import "./chunk-3ICVWL2M.mjs";
|
|
70
|
+
import "./chunk-AZ6NVJAP.mjs";
|
|
70
71
|
import {
|
|
71
72
|
isSupportedCacheInstallerDriver,
|
|
72
73
|
isSupportedQueueInstallerDriver,
|
|
73
74
|
normalizeScaffoldOptionalPackages,
|
|
74
75
|
sanitizePackageName
|
|
75
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-PVVGQSUP.mjs";
|
|
76
77
|
export {
|
|
77
78
|
authFeaturesRequireConfigUpdate,
|
|
78
79
|
detectAuthInstallFeaturesFromConfig,
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
writeLine
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-TRYHX5S4.mjs";
|
|
3
|
+
} from "./chunk-Y355VYRN.mjs";
|
|
4
|
+
import "./chunk-FFTJKBQF.mjs";
|
|
5
|
+
import "./chunk-4VYR2ARA.mjs";
|
|
6
|
+
import "./chunk-7KZVFDSI.mjs";
|
|
7
|
+
import "./chunk-L3YATEQY.mjs";
|
|
8
|
+
import "./chunk-3ICVWL2M.mjs";
|
|
9
|
+
import "./chunk-AZ6NVJAP.mjs";
|
|
11
10
|
import {
|
|
12
11
|
resolveProjectPackageImportSpecifier
|
|
13
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PVVGQSUP.mjs";
|
|
14
13
|
|
|
15
14
|
// src/security.ts
|
|
16
15
|
import { loadConfigDirectory } from "@holo-js/config";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holo-js/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Holo-JS Framework - project creation, discovery, and operational CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,22 +28,22 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@clack/prompts": "^1.5.1",
|
|
31
|
-
"@holo-js/auth": "^0.3.
|
|
32
|
-
"@holo-js/cache-db": "^0.3.
|
|
33
|
-
"@holo-js/config": "^0.3.
|
|
34
|
-
"@holo-js/core": "^0.3.
|
|
35
|
-
"@holo-js/db": "^0.3.
|
|
36
|
-
"@holo-js/kernel": "^0.3.
|
|
37
|
-
"@holo-js/security": "^0.3.
|
|
38
|
-
"@holo-js/storage": "^0.3.
|
|
31
|
+
"@holo-js/auth": "^0.3.1",
|
|
32
|
+
"@holo-js/cache-db": "^0.3.1",
|
|
33
|
+
"@holo-js/config": "^0.3.1",
|
|
34
|
+
"@holo-js/core": "^0.3.1",
|
|
35
|
+
"@holo-js/db": "^0.3.1",
|
|
36
|
+
"@holo-js/kernel": "^0.3.1",
|
|
37
|
+
"@holo-js/security": "^0.3.1",
|
|
38
|
+
"@holo-js/storage": "^0.3.1",
|
|
39
39
|
"esbuild": "^0.27.4",
|
|
40
40
|
"inflection": "^3.0.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@holo-js/broadcast": "^0.3.
|
|
44
|
-
"@holo-js/mail": "^0.3.
|
|
45
|
-
"@holo-js/session": "^0.3.
|
|
46
|
-
"@holo-js/queue": "^0.3.
|
|
43
|
+
"@holo-js/broadcast": "^0.3.1",
|
|
44
|
+
"@holo-js/mail": "^0.3.1",
|
|
45
|
+
"@holo-js/session": "^0.3.1",
|
|
46
|
+
"@holo-js/queue": "^0.3.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependenciesMeta": {
|
|
49
49
|
"@holo-js/broadcast": {
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@holo-js/broadcast": "^0.3.
|
|
64
|
-
"@holo-js/events": "^0.3.
|
|
65
|
-
"@holo-js/mail": "^0.3.
|
|
66
|
-
"@holo-js/queue": "^0.3.
|
|
67
|
-
"@holo-js/queue-db": "^0.3.
|
|
68
|
-
"@holo-js/session": "^0.3.
|
|
63
|
+
"@holo-js/broadcast": "^0.3.1",
|
|
64
|
+
"@holo-js/events": "^0.3.1",
|
|
65
|
+
"@holo-js/mail": "^0.3.1",
|
|
66
|
+
"@holo-js/queue": "^0.3.1",
|
|
67
|
+
"@holo-js/queue-db": "^0.3.1",
|
|
68
|
+
"@holo-js/session": "^0.3.1",
|
|
69
69
|
"@types/node": "^22.10.2",
|
|
70
70
|
"tsup": "^8.3.5",
|
|
71
71
|
"typescript": "^5.7.2",
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
initializeProjectRuntime
|
|
3
|
-
} from "./chunk-LALDNNPH.mjs";
|
|
4
|
-
import "./chunk-M3IPUCTM.mjs";
|
|
5
|
-
import {
|
|
6
|
-
writeLine
|
|
7
|
-
} from "./chunk-I7QBCEV7.mjs";
|
|
8
|
-
import "./chunk-HX6MOYBO.mjs";
|
|
9
|
-
import {
|
|
10
|
-
prepareProjectDiscovery
|
|
11
|
-
} from "./chunk-QSVMXMTQ.mjs";
|
|
12
|
-
import "./chunk-OI54DOHK.mjs";
|
|
13
|
-
import {
|
|
14
|
-
loadProjectConfig
|
|
15
|
-
} from "./chunk-JVLZ3SOW.mjs";
|
|
16
|
-
import {
|
|
17
|
-
loadGeneratedProjectRegistry
|
|
18
|
-
} from "./chunk-R4ZYMEDU.mjs";
|
|
19
|
-
import "./chunk-3RFRE7XG.mjs";
|
|
20
|
-
import "./chunk-TRYHX5S4.mjs";
|
|
21
|
-
import {
|
|
22
|
-
importProjectModule,
|
|
23
|
-
resolveProjectPackageImportSpecifier
|
|
24
|
-
} from "./chunk-YACY2572.mjs";
|
|
25
|
-
|
|
26
|
-
// src/broadcast.ts
|
|
27
|
-
import { basename, extname, resolve } from "path";
|
|
28
|
-
import { readFile } from "fs/promises";
|
|
29
|
-
import { loadConfigDirectory } from "@holo-js/config";
|
|
30
|
-
function hasLoadedRedisConfigSection(loadedFiles) {
|
|
31
|
-
return Array.isArray(loadedFiles) && loadedFiles.some((filePath) => {
|
|
32
|
-
return basename(filePath, extname(filePath)) === "redis";
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
async function hasProjectPackageDependency(projectRoot, packageName) {
|
|
36
|
-
try {
|
|
37
|
-
const manifest = JSON.parse(await readFile(resolve(projectRoot, "package.json"), "utf8"));
|
|
38
|
-
return Boolean(
|
|
39
|
-
manifest.dependencies?.[packageName] || manifest.devDependencies?.[packageName] || manifest.optionalDependencies?.[packageName] || manifest.peerDependencies?.[packageName]
|
|
40
|
-
);
|
|
41
|
-
} catch {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async function loadBroadcastCliModule(projectRoot) {
|
|
46
|
-
try {
|
|
47
|
-
return await import(resolveProjectPackageImportSpecifier(projectRoot, "@holo-js/broadcast"));
|
|
48
|
-
} catch (error) {
|
|
49
|
-
const details = error instanceof Error ? error.message : String(error);
|
|
50
|
-
throw new Error(
|
|
51
|
-
`Unable to load @holo-js/broadcast from ${projectRoot}. Install it with "holo install broadcast". ${details}`
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
async function loadRealtimeServerModule(projectRoot) {
|
|
56
|
-
const specifier = resolveProjectPackageImportSpecifier(projectRoot, "@holo-js/realtime/server");
|
|
57
|
-
try {
|
|
58
|
-
return await import(specifier);
|
|
59
|
-
} catch (error) {
|
|
60
|
-
const details = error instanceof Error ? error.message : String(error);
|
|
61
|
-
if (/Cannot find module|ERR_MODULE_NOT_FOUND|MODULE_NOT_FOUND/i.test(details) && details.includes(specifier)) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
throw error;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function safeDecodeCookieSegment(value) {
|
|
68
|
-
try {
|
|
69
|
-
return decodeURIComponent(value);
|
|
70
|
-
} catch {
|
|
71
|
-
return value;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function readCookieFromHeader(header, name) {
|
|
75
|
-
for (const segment of header?.split(";") ?? []) {
|
|
76
|
-
const separator = segment.indexOf("=");
|
|
77
|
-
if (separator <= 0) {
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
const cookieName = safeDecodeCookieSegment(segment.slice(0, separator).trim());
|
|
81
|
-
if (cookieName === name) {
|
|
82
|
-
return safeDecodeCookieSegment(segment.slice(separator + 1).trim());
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return void 0;
|
|
86
|
-
}
|
|
87
|
-
function createRealtimeAuthRequestAccessors(headers) {
|
|
88
|
-
return {
|
|
89
|
-
async getCookie(name) {
|
|
90
|
-
return readCookieFromHeader(headers.get("cookie"), name);
|
|
91
|
-
},
|
|
92
|
-
async getHeader(name) {
|
|
93
|
-
return headers.get(name) ?? void 0;
|
|
94
|
-
},
|
|
95
|
-
async appendResponseCookie(_cookie) {
|
|
96
|
-
},
|
|
97
|
-
async redirectResponse(url) {
|
|
98
|
-
throw new Error(`Realtime auth attempted to redirect to "${url}". Realtime requests cannot redirect.`);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
async function createRealtimeWorkerBindings(projectRoot) {
|
|
103
|
-
if (!await hasProjectPackageDependency(projectRoot, "@holo-js/realtime")) {
|
|
104
|
-
return void 0;
|
|
105
|
-
}
|
|
106
|
-
const realtime = await loadRealtimeServerModule(projectRoot);
|
|
107
|
-
if (!realtime) {
|
|
108
|
-
return void 0;
|
|
109
|
-
}
|
|
110
|
-
const runtime = await initializeProjectRuntime(projectRoot);
|
|
111
|
-
realtime.configureRealtimeRuntime?.({
|
|
112
|
-
async runWithAuthRequestAccessors(accessors, callback) {
|
|
113
|
-
const runner = runtime.runWithAuthRequestAccessors;
|
|
114
|
-
return runner ? await runner(accessors, callback) : await callback();
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
const definitions = /* @__PURE__ */ new Map();
|
|
118
|
-
const resolveDefinition = async (name) => {
|
|
119
|
-
const cached = definitions.get(name);
|
|
120
|
-
if (cached) {
|
|
121
|
-
return await cached;
|
|
122
|
-
}
|
|
123
|
-
const resolved = realtime.resolveRealtimeDefinition(name, {
|
|
124
|
-
projectRoot,
|
|
125
|
-
importModule: async (absolutePath) => await importProjectModule(projectRoot, absolutePath)
|
|
126
|
-
}).catch((error) => {
|
|
127
|
-
definitions.delete(name);
|
|
128
|
-
throw error;
|
|
129
|
-
});
|
|
130
|
-
definitions.set(name, resolved);
|
|
131
|
-
return await resolved;
|
|
132
|
-
};
|
|
133
|
-
const withRealtimeRequest = async (context, callback) => {
|
|
134
|
-
return await callback(createRealtimeAuthRequestAccessors(context.headers));
|
|
135
|
-
};
|
|
136
|
-
return {
|
|
137
|
-
async query(name, args, context) {
|
|
138
|
-
return await withRealtimeRequest(context, async (authRequest) => {
|
|
139
|
-
return await realtime.executeRealtimeQuery(await resolveDefinition(name), args, { authRequest });
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
async mutate(name, args, context) {
|
|
143
|
-
return await withRealtimeRequest(context, async (authRequest) => {
|
|
144
|
-
return await realtime.executeRealtimeMutation(await resolveDefinition(name), args, { authRequest });
|
|
145
|
-
});
|
|
146
|
-
},
|
|
147
|
-
async subscribe(name, args, options) {
|
|
148
|
-
return await withRealtimeRequest(options.context, async (authRequest) => {
|
|
149
|
-
return await realtime.subscribeRealtimeQuery(await resolveDefinition(name), args, {
|
|
150
|
-
onData: options.onData,
|
|
151
|
-
onPatch: options.onPatch,
|
|
152
|
-
onError: options.onError
|
|
153
|
-
}, { authRequest });
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
async function runBroadcastWorkCommand(io, projectRoot, dependencies = {}) {
|
|
159
|
-
const loadConfig = dependencies.loadConfig ?? loadConfigDirectory;
|
|
160
|
-
const loadModule = dependencies.loadModule ?? loadBroadcastCliModule;
|
|
161
|
-
const config = await loadConfig(projectRoot);
|
|
162
|
-
const project = await loadProjectConfig(projectRoot);
|
|
163
|
-
const loadRegistry = dependencies.loadRegistry ?? loadGeneratedProjectRegistry;
|
|
164
|
-
await loadRegistry(projectRoot).catch(() => void 0);
|
|
165
|
-
const registry = await prepareProjectDiscovery(projectRoot, project.config);
|
|
166
|
-
const broadcastModule = await loadModule(projectRoot);
|
|
167
|
-
const realtime = await createRealtimeWorkerBindings(projectRoot);
|
|
168
|
-
const worker = await broadcastModule.startBroadcastWorker({
|
|
169
|
-
config: config.broadcast,
|
|
170
|
-
queue: config.queue,
|
|
171
|
-
...hasLoadedRedisConfigSection(config.loadedFiles) ? { redis: config.redis } : {},
|
|
172
|
-
...registry ? {
|
|
173
|
-
channelAuth: {
|
|
174
|
-
registry: {
|
|
175
|
-
projectRoot,
|
|
176
|
-
channels: registry.channels
|
|
177
|
-
},
|
|
178
|
-
importModule: async (absolutePath) => await importProjectModule(projectRoot, absolutePath)
|
|
179
|
-
}
|
|
180
|
-
} : {},
|
|
181
|
-
...realtime ? { realtime } : {}
|
|
182
|
-
});
|
|
183
|
-
writeLine(io.stdout, `[broadcast] Worker listening on ${worker.host}:${worker.port}`);
|
|
184
|
-
await new Promise((resolvePromise) => {
|
|
185
|
-
let stopped = false;
|
|
186
|
-
const stop = async () => {
|
|
187
|
-
if (stopped) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
stopped = true;
|
|
191
|
-
process.off("SIGINT", onSignal);
|
|
192
|
-
process.off("SIGTERM", onSignal);
|
|
193
|
-
await worker.stop();
|
|
194
|
-
resolvePromise();
|
|
195
|
-
};
|
|
196
|
-
const onSignal = () => {
|
|
197
|
-
void stop();
|
|
198
|
-
};
|
|
199
|
-
process.on("SIGINT", onSignal);
|
|
200
|
-
process.on("SIGTERM", onSignal);
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
export {
|
|
204
|
-
loadBroadcastCliModule,
|
|
205
|
-
runBroadcastWorkCommand
|
|
206
|
-
};
|
package/dist/cache-DUVBBOZU.mjs
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadProjectDatabaseDrivers
|
|
3
|
-
} from "./chunk-XBOVM6LO.mjs";
|
|
4
|
-
import {
|
|
5
|
-
writeLine
|
|
6
|
-
} from "./chunk-I7QBCEV7.mjs";
|
|
7
|
-
import "./chunk-HX6MOYBO.mjs";
|
|
8
|
-
import "./chunk-6BHJLCAO.mjs";
|
|
9
|
-
import "./chunk-JVLZ3SOW.mjs";
|
|
10
|
-
import "./chunk-QSVMXMTQ.mjs";
|
|
11
|
-
import "./chunk-R4ZYMEDU.mjs";
|
|
12
|
-
import "./chunk-3RFRE7XG.mjs";
|
|
13
|
-
import "./chunk-TRYHX5S4.mjs";
|
|
14
|
-
import {
|
|
15
|
-
resolveProjectPackageImportSpecifier
|
|
16
|
-
} from "./chunk-YACY2572.mjs";
|
|
17
|
-
|
|
18
|
-
// src/cache.ts
|
|
19
|
-
import { loadConfigDirectory } from "@holo-js/config";
|
|
20
|
-
import { unregisterDatabaseDriverFactory } from "@holo-js/db";
|
|
21
|
-
var BUILT_IN_CACHE_DRIVER_NAMES = /* @__PURE__ */ new Set(["database", "file", "memory", "redis"]);
|
|
22
|
-
var CONCRETE_CACHE_DRIVER_PACKAGES = {
|
|
23
|
-
database: "@holo-js/cache-db",
|
|
24
|
-
redis: "@holo-js/cache-redis"
|
|
25
|
-
};
|
|
26
|
-
async function loadConfiguredCacheDriverPackages(projectRoot, drivers, loadPackage = (specifier) => import(specifier)) {
|
|
27
|
-
const configuredDrivers = new Set(Object.values(drivers).map(resolveConfiguredCacheDriverName));
|
|
28
|
-
for (const driver of configuredDrivers) {
|
|
29
|
-
if (driver !== "database" && driver !== "redis") continue;
|
|
30
|
-
const packageName = CONCRETE_CACHE_DRIVER_PACKAGES[driver];
|
|
31
|
-
try {
|
|
32
|
-
await loadPackage(resolveProjectPackageImportSpecifier(projectRoot, packageName));
|
|
33
|
-
} catch (error) {
|
|
34
|
-
throw new Error(
|
|
35
|
-
`[Holo CLI] Cache driver "${driver}" requires ${packageName} to be installed.`,
|
|
36
|
-
{ cause: error }
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function resolveCacheFacade(cacheModule) {
|
|
42
|
-
const candidate = cacheModule.default;
|
|
43
|
-
if (candidate) {
|
|
44
|
-
return candidate;
|
|
45
|
-
}
|
|
46
|
-
return cacheModule;
|
|
47
|
-
}
|
|
48
|
-
function resolveConfiguredCacheDriverName(driverConfig) {
|
|
49
|
-
if (!driverConfig || typeof driverConfig !== "object" || Array.isArray(driverConfig)) {
|
|
50
|
-
return void 0;
|
|
51
|
-
}
|
|
52
|
-
const value = driverConfig.driver;
|
|
53
|
-
return typeof value === "string" ? value : void 0;
|
|
54
|
-
}
|
|
55
|
-
function resolveCachePluginDriverLoader(cacheModule, cache, drivers, requestedDriverName, defaultDriverName) {
|
|
56
|
-
const loadCachePluginDrivers = ("loadCachePluginDrivers" in cache ? cache.loadCachePluginDrivers?.bind(cache) : void 0) ?? ("loadCachePluginDrivers" in cacheModule ? cacheModule.loadCachePluginDrivers?.bind(cacheModule) : void 0);
|
|
57
|
-
const storeName = requestedDriverName?.trim() || defaultDriverName;
|
|
58
|
-
const driverName = resolveConfiguredCacheDriverName(drivers[storeName]);
|
|
59
|
-
if (!driverName || BUILT_IN_CACHE_DRIVER_NAMES.has(driverName)) {
|
|
60
|
-
return void 0;
|
|
61
|
-
}
|
|
62
|
-
if (loadCachePluginDrivers) {
|
|
63
|
-
return loadCachePluginDrivers;
|
|
64
|
-
}
|
|
65
|
-
throw new Error(
|
|
66
|
-
`[Holo CLI] Cache store "${storeName}" uses plugin driver "${driverName}", but the installed @holo-js/cache package does not support cache plugin drivers.`
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
var cacheCommandInternals = {
|
|
70
|
-
loadConfiguredCacheDriverPackages,
|
|
71
|
-
resolveCachePluginDriverLoader
|
|
72
|
-
};
|
|
73
|
-
async function loadCacheCliModule(projectRoot) {
|
|
74
|
-
return await import(resolveProjectPackageImportSpecifier(projectRoot, "@holo-js/cache"));
|
|
75
|
-
}
|
|
76
|
-
async function initializeCacheMaintenanceEnvironment(projectRoot, driverName) {
|
|
77
|
-
const loadedConfig = await loadConfigDirectory(projectRoot);
|
|
78
|
-
const databaseDriverFactories = await loadProjectDatabaseDrivers(projectRoot, loadedConfig.database);
|
|
79
|
-
const cacheModule = await loadCacheCliModule(projectRoot);
|
|
80
|
-
const cache = resolveCacheFacade(cacheModule);
|
|
81
|
-
await loadConfiguredCacheDriverPackages(projectRoot, loadedConfig.cache.drivers);
|
|
82
|
-
const loadCachePluginDrivers = resolveCachePluginDriverLoader(
|
|
83
|
-
cacheModule,
|
|
84
|
-
cache,
|
|
85
|
-
loadedConfig.cache.drivers,
|
|
86
|
-
driverName,
|
|
87
|
-
loadedConfig.cache.default
|
|
88
|
-
);
|
|
89
|
-
cache.configureCacheRuntime({
|
|
90
|
-
config: loadedConfig.cache,
|
|
91
|
-
databaseConfig: loadedConfig.database,
|
|
92
|
-
redisConfig: loadedConfig.redis
|
|
93
|
-
});
|
|
94
|
-
if (loadCachePluginDrivers) {
|
|
95
|
-
try {
|
|
96
|
-
await loadCachePluginDrivers(projectRoot, loadedConfig.app.plugins);
|
|
97
|
-
} catch (error) {
|
|
98
|
-
cache.resetCacheRuntime();
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
cache,
|
|
104
|
-
async cleanup() {
|
|
105
|
-
cache.resetCacheRuntime();
|
|
106
|
-
for (const factory of [...databaseDriverFactories].reverse()) {
|
|
107
|
-
unregisterDatabaseDriverFactory(factory);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
async function runCacheClearCommand(io, projectRoot, driverName, dependencies = {}) {
|
|
113
|
-
const environment = await (dependencies.initializeCache ?? initializeCacheMaintenanceEnvironment)(projectRoot, driverName);
|
|
114
|
-
try {
|
|
115
|
-
const repository = driverName?.trim() ? environment.cache.driver(driverName) : environment.cache;
|
|
116
|
-
await (dependencies.flush ?? (async (target) => await target.flush()))(repository);
|
|
117
|
-
writeLine(io.stdout, driverName?.trim() ? `[cache] Cleared cache store "${driverName}".` : "[cache] Cleared the default cache store.");
|
|
118
|
-
} finally {
|
|
119
|
-
await environment.cleanup();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
async function runCacheForgetCommand(io, projectRoot, key, driverName, dependencies = {}) {
|
|
123
|
-
const environment = await (dependencies.initializeCache ?? initializeCacheMaintenanceEnvironment)(projectRoot, driverName);
|
|
124
|
-
try {
|
|
125
|
-
const repository = driverName?.trim() ? environment.cache.driver(driverName) : environment.cache;
|
|
126
|
-
const forgotten = await (dependencies.forget ?? (async (target, targetKey) => await target.forget(targetKey)))(repository, key);
|
|
127
|
-
writeLine(io.stdout, forgotten ? `[cache] Forgot key "${key}".` : `[cache] Key "${key}" was not present.`);
|
|
128
|
-
} finally {
|
|
129
|
-
await environment.cleanup();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
export {
|
|
133
|
-
cacheCommandInternals,
|
|
134
|
-
initializeCacheMaintenanceEnvironment,
|
|
135
|
-
loadCacheCliModule,
|
|
136
|
-
runCacheClearCommand,
|
|
137
|
-
runCacheForgetCommand
|
|
138
|
-
};
|