@holo-js/cli 0.1.1 → 0.1.3
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 +533 -4616
- package/dist/broadcast-YZS4OFCM.mjs +84 -0
- package/dist/broadcast-ZYFKUFM5.mjs +85 -0
- package/dist/cache-ODBZT6IP.mjs +67 -0
- package/dist/cache-V43YMG4K.mjs +66 -0
- package/dist/cache-migrations-KPOEH6GP.mjs +155 -0
- package/dist/cache-migrations-ZUOI2A7N.mjs +154 -0
- package/dist/chunk-3OTCSFDG.mjs +849 -0
- package/dist/chunk-66FHW725.mjs +465 -0
- package/dist/chunk-BWW5TDFI.mjs +4 -0
- package/dist/chunk-CUL4RJTG.mjs +22 -0
- package/dist/chunk-D4GG556Y.mjs +23 -0
- package/dist/chunk-D7O4SU6N.mjs +2 -0
- package/dist/chunk-ET7UXHHQ.mjs +166 -0
- package/dist/chunk-EUIVXVJL.mjs +25 -0
- package/dist/chunk-G5ADO27Q.mjs +463 -0
- package/dist/chunk-GSQ3HTRO.mjs +165 -0
- package/dist/chunk-H7TJ4FB3.mjs +848 -0
- package/dist/chunk-HE6FYNVN.mjs +3203 -0
- package/dist/chunk-ICJR7TS4.mjs +66 -0
- package/dist/chunk-ICKN56JY.mjs +342 -0
- package/dist/chunk-JX2ZH6XY.mjs +270 -0
- package/dist/chunk-M7J3YTHR.mjs +26 -0
- package/dist/chunk-Q5F6C2D4.mjs +65 -0
- package/dist/chunk-QYLSMF7V.mjs +539 -0
- package/dist/chunk-RB65DLR4.mjs +343 -0
- package/dist/chunk-S7P7EBM3.mjs +787 -0
- package/dist/chunk-SRWJU3A5.mjs +11 -0
- package/dist/chunk-T4OVZZEE.mjs +3204 -0
- package/dist/chunk-URK7C3VQ.mjs +538 -0
- package/dist/chunk-VT5IDQG6.mjs +788 -0
- package/dist/chunk-XUYKPU5Q.mjs +272 -0
- package/dist/chunk-ZXDU7RHU.mjs +9 -0
- package/dist/config-DMWBMMGD.mjs +26 -0
- package/dist/config-LS5USBRB.mjs +25 -0
- package/dist/dev-KGRIGLJY.mjs +42 -0
- package/dist/dev-LVHDCPVS.mjs +43 -0
- package/dist/discovery-GBLAUTXS.mjs +28 -0
- package/dist/discovery-R733D2PO.mjs +29 -0
- package/dist/generators-32R45P6Z.mjs +426 -0
- package/dist/generators-WSF23UKM.mjs +425 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +536 -4618
- package/dist/queue-6N7HQMRL.mjs +625 -0
- package/dist/queue-QG5EXOG4.mjs +626 -0
- package/dist/queue-migrations-JWKU45Y3.mjs +163 -0
- package/dist/queue-migrations-O6QSSDPQ.mjs +162 -0
- package/dist/runtime-ANBO7VQM.mjs +33 -0
- package/dist/runtime-OOSJ5JBY.mjs +32 -0
- package/dist/runtime-RI4OWTIT.mjs +55 -0
- package/dist/runtime-ZRPK5DIT.mjs +56 -0
- package/dist/scaffold-IYWZKT3W.mjs +120 -0
- package/dist/scaffold-ULATB4CA.mjs +121 -0
- package/dist/security-AE6LGNC4.mjs +68 -0
- package/dist/security-OCOPEH2V.mjs +69 -0
- package/package.json +10 -9
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
authFeaturesRequireConfigUpdate,
|
|
4
|
+
detectAuthInstallFeaturesFromConfig,
|
|
5
|
+
hasLoadedConfigFile,
|
|
6
|
+
inferConnectionDriver,
|
|
7
|
+
inferDatabaseDriverFromUrl,
|
|
8
|
+
injectBroadcastAuthEndpoint,
|
|
9
|
+
installAuthIntoProject,
|
|
10
|
+
installAuthorizationIntoProject,
|
|
11
|
+
installBroadcastIntoProject,
|
|
12
|
+
installCacheIntoProject,
|
|
13
|
+
installEventsIntoProject,
|
|
14
|
+
installMailIntoProject,
|
|
15
|
+
installNotificationsIntoProject,
|
|
16
|
+
installQueueIntoProject,
|
|
17
|
+
installSecurityIntoProject,
|
|
18
|
+
normalizeScaffoldEnvSegments,
|
|
19
|
+
renderAuthConfig,
|
|
20
|
+
renderAuthEnvFiles,
|
|
21
|
+
renderAuthMigration,
|
|
22
|
+
renderAuthUserModel,
|
|
23
|
+
renderCacheConfig,
|
|
24
|
+
renderCacheEnvFiles,
|
|
25
|
+
renderEnvFileContents,
|
|
26
|
+
renderFrameworkFiles,
|
|
27
|
+
renderFrameworkRunner,
|
|
28
|
+
renderMailConfig,
|
|
29
|
+
renderMediaConfig,
|
|
30
|
+
renderNotificationsConfig,
|
|
31
|
+
renderNotificationsMigration,
|
|
32
|
+
renderQueueConfig,
|
|
33
|
+
renderQueueEnvFiles,
|
|
34
|
+
renderRedisConfig,
|
|
35
|
+
renderScaffoldAppConfig,
|
|
36
|
+
renderScaffoldDatabaseConfig,
|
|
37
|
+
renderScaffoldEnvFiles,
|
|
38
|
+
renderScaffoldGitignore,
|
|
39
|
+
renderScaffoldPackageJson,
|
|
40
|
+
renderScaffoldTsconfig,
|
|
41
|
+
renderSecurityConfig,
|
|
42
|
+
renderSessionConfig,
|
|
43
|
+
renderStorageConfig,
|
|
44
|
+
resolveBroadcastConfigTargetPath,
|
|
45
|
+
resolveDefaultDatabaseUrl,
|
|
46
|
+
resolvePackageManagerVersion,
|
|
47
|
+
scaffoldProject,
|
|
48
|
+
syncManagedDriverDependencies,
|
|
49
|
+
upsertAuthPackageDependencies,
|
|
50
|
+
upsertCachePackageDependencies,
|
|
51
|
+
upsertEventsPackageDependency,
|
|
52
|
+
upsertMailPackageDependency,
|
|
53
|
+
upsertNotificationsPackageDependency,
|
|
54
|
+
upsertSecurityPackageDependency
|
|
55
|
+
} from "./chunk-T4OVZZEE.mjs";
|
|
56
|
+
import "./chunk-ET7UXHHQ.mjs";
|
|
57
|
+
import "./chunk-3OTCSFDG.mjs";
|
|
58
|
+
import {
|
|
59
|
+
isSupportedCacheInstallerDriver,
|
|
60
|
+
isSupportedQueueInstallerDriver,
|
|
61
|
+
normalizeScaffoldOptionalPackages,
|
|
62
|
+
sanitizePackageName
|
|
63
|
+
} from "./chunk-66FHW725.mjs";
|
|
64
|
+
export {
|
|
65
|
+
authFeaturesRequireConfigUpdate,
|
|
66
|
+
detectAuthInstallFeaturesFromConfig,
|
|
67
|
+
hasLoadedConfigFile,
|
|
68
|
+
inferConnectionDriver,
|
|
69
|
+
inferDatabaseDriverFromUrl,
|
|
70
|
+
injectBroadcastAuthEndpoint,
|
|
71
|
+
installAuthIntoProject,
|
|
72
|
+
installAuthorizationIntoProject,
|
|
73
|
+
installBroadcastIntoProject,
|
|
74
|
+
installCacheIntoProject,
|
|
75
|
+
installEventsIntoProject,
|
|
76
|
+
installMailIntoProject,
|
|
77
|
+
installNotificationsIntoProject,
|
|
78
|
+
installQueueIntoProject,
|
|
79
|
+
installSecurityIntoProject,
|
|
80
|
+
isSupportedCacheInstallerDriver,
|
|
81
|
+
isSupportedQueueInstallerDriver,
|
|
82
|
+
normalizeScaffoldEnvSegments,
|
|
83
|
+
normalizeScaffoldOptionalPackages,
|
|
84
|
+
renderAuthConfig,
|
|
85
|
+
renderAuthEnvFiles,
|
|
86
|
+
renderAuthMigration,
|
|
87
|
+
renderAuthUserModel,
|
|
88
|
+
renderCacheConfig,
|
|
89
|
+
renderCacheEnvFiles,
|
|
90
|
+
renderEnvFileContents,
|
|
91
|
+
renderFrameworkFiles,
|
|
92
|
+
renderFrameworkRunner,
|
|
93
|
+
renderMailConfig,
|
|
94
|
+
renderMediaConfig,
|
|
95
|
+
renderNotificationsConfig,
|
|
96
|
+
renderNotificationsMigration,
|
|
97
|
+
renderQueueConfig,
|
|
98
|
+
renderQueueEnvFiles,
|
|
99
|
+
renderRedisConfig,
|
|
100
|
+
renderScaffoldAppConfig,
|
|
101
|
+
renderScaffoldDatabaseConfig,
|
|
102
|
+
renderScaffoldEnvFiles,
|
|
103
|
+
renderScaffoldGitignore,
|
|
104
|
+
renderScaffoldPackageJson,
|
|
105
|
+
renderScaffoldTsconfig,
|
|
106
|
+
renderSecurityConfig,
|
|
107
|
+
renderSessionConfig,
|
|
108
|
+
renderStorageConfig,
|
|
109
|
+
resolveBroadcastConfigTargetPath,
|
|
110
|
+
resolveDefaultDatabaseUrl,
|
|
111
|
+
resolvePackageManagerVersion,
|
|
112
|
+
sanitizePackageName,
|
|
113
|
+
scaffoldProject,
|
|
114
|
+
syncManagedDriverDependencies,
|
|
115
|
+
upsertAuthPackageDependencies,
|
|
116
|
+
upsertCachePackageDependencies,
|
|
117
|
+
upsertEventsPackageDependency,
|
|
118
|
+
upsertMailPackageDependency,
|
|
119
|
+
upsertNotificationsPackageDependency,
|
|
120
|
+
upsertSecurityPackageDependency
|
|
121
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeLine
|
|
3
|
+
} from "./chunk-ZXDU7RHU.mjs";
|
|
4
|
+
import "./chunk-D7O4SU6N.mjs";
|
|
5
|
+
import "./chunk-S7P7EBM3.mjs";
|
|
6
|
+
import "./chunk-HE6FYNVN.mjs";
|
|
7
|
+
import "./chunk-GSQ3HTRO.mjs";
|
|
8
|
+
import "./chunk-H7TJ4FB3.mjs";
|
|
9
|
+
import {
|
|
10
|
+
resolveProjectPackageImportSpecifier
|
|
11
|
+
} from "./chunk-G5ADO27Q.mjs";
|
|
12
|
+
|
|
13
|
+
// src/security.ts
|
|
14
|
+
import { loadConfigDirectory } from "@holo-js/config";
|
|
15
|
+
async function loadSecurityCliModule(projectRoot) {
|
|
16
|
+
const specifier = resolveProjectPackageImportSpecifier(projectRoot, "@holo-js/security");
|
|
17
|
+
try {
|
|
18
|
+
return await import(specifier);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
const details = error instanceof Error ? error.message : String(error);
|
|
21
|
+
throw new Error(
|
|
22
|
+
`Unable to load @holo-js/security from ${projectRoot}. Install it with "holo install security". ${details}`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function runRateLimitClearCommand(io, projectRoot, options, dependencies = {}) {
|
|
27
|
+
const loadSecurityModule = dependencies.loadSecurityModule ?? loadSecurityCliModule;
|
|
28
|
+
const loadConfig = dependencies.loadConfig ?? (async (root) => {
|
|
29
|
+
const loaded = await loadConfigDirectory(root, {
|
|
30
|
+
preferCache: false,
|
|
31
|
+
processEnv: process.env
|
|
32
|
+
});
|
|
33
|
+
return { security: loaded.security };
|
|
34
|
+
});
|
|
35
|
+
const loadRedisAdapter = dependencies.loadRedisAdapter ?? (async (root) => {
|
|
36
|
+
return await import(resolveProjectPackageImportSpecifier(root, "@holo-js/security/drivers/redis-adapter"));
|
|
37
|
+
});
|
|
38
|
+
const { security: securityConfig } = await loadConfig(projectRoot);
|
|
39
|
+
const securityModule = await loadSecurityModule(projectRoot);
|
|
40
|
+
const driver = securityConfig.rateLimit.driver;
|
|
41
|
+
if (driver === "memory") {
|
|
42
|
+
throw new Error("[security] The memory rate-limit driver is process-local and cannot be cleared meaningfully from the CLI.");
|
|
43
|
+
}
|
|
44
|
+
let redisAdapter;
|
|
45
|
+
if (driver === "redis") {
|
|
46
|
+
const { createSecurityRedisAdapter } = await loadRedisAdapter(projectRoot);
|
|
47
|
+
redisAdapter = createSecurityRedisAdapter(securityConfig.rateLimit.redis);
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
await redisAdapter?.connect();
|
|
51
|
+
const rateLimitStoreOptions = redisAdapter ? { projectRoot, redisAdapter } : { projectRoot };
|
|
52
|
+
const rateLimitStore = securityModule.createRateLimitStoreFromConfig(securityConfig, rateLimitStoreOptions);
|
|
53
|
+
securityModule.configureSecurityRuntime({
|
|
54
|
+
config: securityConfig,
|
|
55
|
+
rateLimitStore
|
|
56
|
+
});
|
|
57
|
+
const cleared = await securityModule.clearRateLimit(options);
|
|
58
|
+
const count = typeof cleared === "boolean" ? cleared ? 1 : 0 : cleared;
|
|
59
|
+
writeLine(io.stdout, `[security] Cleared ${count} rate-limit bucket(s).`);
|
|
60
|
+
} finally {
|
|
61
|
+
await redisAdapter?.close();
|
|
62
|
+
securityModule.resetSecurityRuntime();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
loadSecurityCliModule,
|
|
67
|
+
runRateLimitClearCommand
|
|
68
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
writeLine
|
|
4
|
+
} from "./chunk-SRWJU3A5.mjs";
|
|
5
|
+
import "./chunk-BWW5TDFI.mjs";
|
|
6
|
+
import "./chunk-VT5IDQG6.mjs";
|
|
7
|
+
import "./chunk-T4OVZZEE.mjs";
|
|
8
|
+
import "./chunk-ET7UXHHQ.mjs";
|
|
9
|
+
import "./chunk-3OTCSFDG.mjs";
|
|
10
|
+
import {
|
|
11
|
+
resolveProjectPackageImportSpecifier
|
|
12
|
+
} from "./chunk-66FHW725.mjs";
|
|
13
|
+
|
|
14
|
+
// src/security.ts
|
|
15
|
+
import { loadConfigDirectory } from "@holo-js/config";
|
|
16
|
+
async function loadSecurityCliModule(projectRoot) {
|
|
17
|
+
const specifier = resolveProjectPackageImportSpecifier(projectRoot, "@holo-js/security");
|
|
18
|
+
try {
|
|
19
|
+
return await import(specifier);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
const details = error instanceof Error ? error.message : String(error);
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Unable to load @holo-js/security from ${projectRoot}. Install it with "holo install security". ${details}`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function runRateLimitClearCommand(io, projectRoot, options, dependencies = {}) {
|
|
28
|
+
const loadSecurityModule = dependencies.loadSecurityModule ?? loadSecurityCliModule;
|
|
29
|
+
const loadConfig = dependencies.loadConfig ?? (async (root) => {
|
|
30
|
+
const loaded = await loadConfigDirectory(root, {
|
|
31
|
+
preferCache: false,
|
|
32
|
+
processEnv: process.env
|
|
33
|
+
});
|
|
34
|
+
return { security: loaded.security };
|
|
35
|
+
});
|
|
36
|
+
const loadRedisAdapter = dependencies.loadRedisAdapter ?? (async (root) => {
|
|
37
|
+
return await import(resolveProjectPackageImportSpecifier(root, "@holo-js/security/drivers/redis-adapter"));
|
|
38
|
+
});
|
|
39
|
+
const { security: securityConfig } = await loadConfig(projectRoot);
|
|
40
|
+
const securityModule = await loadSecurityModule(projectRoot);
|
|
41
|
+
const driver = securityConfig.rateLimit.driver;
|
|
42
|
+
if (driver === "memory") {
|
|
43
|
+
throw new Error("[security] The memory rate-limit driver is process-local and cannot be cleared meaningfully from the CLI.");
|
|
44
|
+
}
|
|
45
|
+
let redisAdapter;
|
|
46
|
+
if (driver === "redis") {
|
|
47
|
+
const { createSecurityRedisAdapter } = await loadRedisAdapter(projectRoot);
|
|
48
|
+
redisAdapter = createSecurityRedisAdapter(securityConfig.rateLimit.redis);
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
await redisAdapter?.connect();
|
|
52
|
+
const rateLimitStoreOptions = redisAdapter ? { projectRoot, redisAdapter } : { projectRoot };
|
|
53
|
+
const rateLimitStore = securityModule.createRateLimitStoreFromConfig(securityConfig, rateLimitStoreOptions);
|
|
54
|
+
securityModule.configureSecurityRuntime({
|
|
55
|
+
config: securityConfig,
|
|
56
|
+
rateLimitStore
|
|
57
|
+
});
|
|
58
|
+
const cleared = await securityModule.clearRateLimit(options);
|
|
59
|
+
const count = typeof cleared === "boolean" ? cleared ? 1 : 0 : cleared;
|
|
60
|
+
writeLine(io.stdout, `[security] Cleared ${count} rate-limit bucket(s).`);
|
|
61
|
+
} finally {
|
|
62
|
+
await redisAdapter?.close();
|
|
63
|
+
securityModule.resetSecurityRuntime();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
loadSecurityCliModule,
|
|
68
|
+
runRateLimitClearCommand
|
|
69
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holo-js/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Holo-JS Framework - project creation, discovery, and operational CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,24 +23,25 @@
|
|
|
23
23
|
"build": "tsup",
|
|
24
24
|
"stub": "tsup --watch",
|
|
25
25
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
26
|
-
"test": "vitest --run"
|
|
26
|
+
"test": "vitest --run",
|
|
27
|
+
"test:integration": "HOLO_CLI_INCLUDE_INTEGRATION=1 vitest --run tests/cli.test.ts"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@holo-js/config": "^0.1.
|
|
30
|
-
"@holo-js/core": "^0.1.
|
|
31
|
-
"@holo-js/db": "^0.1.
|
|
32
|
-
"@holo-js/events": "^0.1.1",
|
|
33
|
-
"@holo-js/queue": "^0.1.1",
|
|
34
|
-
"@holo-js/queue-db": "^0.1.1",
|
|
30
|
+
"@holo-js/config": "^0.1.3",
|
|
31
|
+
"@holo-js/core": "^0.1.3",
|
|
32
|
+
"@holo-js/db": "^0.1.3",
|
|
35
33
|
"esbuild": "^0.27.4"
|
|
36
34
|
},
|
|
37
35
|
"devDependencies": {
|
|
36
|
+
"@holo-js/events": "^0.1.3",
|
|
37
|
+
"@holo-js/queue": "^0.1.3",
|
|
38
|
+
"@holo-js/queue-db": "^0.1.3",
|
|
38
39
|
"@types/node": "^22.10.2",
|
|
39
40
|
"tsup": "^8.3.5",
|
|
40
41
|
"typescript": "^5.7.2",
|
|
41
42
|
"vitest": "^2.1.8"
|
|
42
43
|
},
|
|
43
44
|
"engines": {
|
|
44
|
-
"node": ">=20.
|
|
45
|
+
"node": ">=20.11.0"
|
|
45
46
|
}
|
|
46
47
|
}
|