@holo-js/cli 0.3.0 → 0.3.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/dist/bin/holo.mjs +38 -35
- package/dist/{broadcast-5VZM5SGQ.mjs → broadcast-GUQFANQ4.mjs} +9 -11
- package/dist/{cache-A42JSVYA.mjs → cache-PCM2BJJ2.mjs} +8 -9
- package/dist/{cache-migrations-4WKSEN2Q.mjs → cache-migrations-M6VC3JW3.mjs} +13 -15
- package/dist/{chunk-6BHJLCAO.mjs → chunk-BVULOZZ4.mjs} +52 -14
- package/dist/{chunk-TRYHX5S4.mjs → chunk-I6EXRSZM.mjs} +1 -1
- package/dist/{chunk-TH5YCOZB.mjs → chunk-JLZNWWFV.mjs} +28 -17
- package/dist/{chunk-R4ZYMEDU.mjs → chunk-NSG3OJDY.mjs} +116 -7
- package/dist/{chunk-YACY2572.mjs → chunk-OQEZ3MOE.mjs} +47 -47
- package/dist/{chunk-3RFRE7XG.mjs → chunk-SCVF2F3I.mjs} +2 -2
- package/dist/{chunk-EQUFFLRG.mjs → chunk-VQP6GHIQ.mjs} +6 -6
- package/dist/{chunk-QSVMXMTQ.mjs → chunk-VUJ4ITXR.mjs} +3 -3
- package/dist/{chunk-OLZEMIDQ.mjs → chunk-WMBFSYWK.mjs} +1 -1
- package/dist/{chunk-LHK5YUR4.mjs → chunk-XXQUCGBO.mjs} +1 -1
- package/dist/{chunk-I7QBCEV7.mjs → chunk-Y355VYRN.mjs} +5 -3
- package/dist/{chunk-VRGB6DIS.mjs → chunk-YJWHIQ45.mjs} +2 -0
- package/dist/{chunk-JVLZ3SOW.mjs → chunk-ZNJ4APGF.mjs} +2 -2
- package/dist/{config-BZHQK532.mjs → config-43W3SZUI.mjs} +3 -3
- package/dist/{dev-7KGRV56X.mjs → dev-SNXMGPLU.mjs} +9 -10
- package/dist/{discovery-HNH3BLDL.mjs → discovery-7TQXEUYW.mjs} +4 -4
- package/dist/{generators-3FVW4AEJ.mjs → generators-2KJ6OFWA.mjs} +14 -16
- package/dist/index.mjs +38 -35
- package/dist/{media-migrations-EG34NYAG.mjs → media-migrations-JMA7QMX7.mjs} +10 -12
- package/dist/{plugins-ZGLB6JO6.mjs → plugins-D6FWODCH.mjs} +3 -3
- package/dist/{queue-BEZDCZCY.mjs → queue-6QSL5VFZ.mjs} +11 -13
- package/dist/{queue-R54DUUYA.mjs → queue-SAPFMTB7.mjs} +13 -15
- package/dist/{queue-migrations-AM3AKT76.mjs → queue-migrations-GSREPIHP.mjs} +13 -15
- package/dist/{runtime-VR5BDPYQ.mjs → runtime-HYSSH54H.mjs} +1 -1
- package/dist/{runtime-4TJYZLQV.mjs → runtime-RX46GVZQ.mjs} +8 -10
- package/dist/runtime-worker.mjs +18 -1
- package/dist/{scaffold-ASEX5LEX.mjs → scaffold-HPNFLBF2.mjs} +7 -6
- package/dist/{security-KYTLP4DF.mjs → security-NR2WEPQ6.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,173 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
runProjectPrepare
|
|
3
|
-
} from "./chunk-TH5YCOZB.mjs";
|
|
4
|
-
import "./chunk-LHK5YUR4.mjs";
|
|
5
|
-
import {
|
|
6
|
-
getRegistryMigrationSlug,
|
|
7
|
-
hasRegisteredCreateTableMigration,
|
|
8
|
-
hasRegisteredMigrationSlug,
|
|
9
|
-
nextMigrationTemplate
|
|
10
|
-
} from "./chunk-OLZEMIDQ.mjs";
|
|
11
|
-
import "./chunk-M3IPUCTM.mjs";
|
|
12
|
-
import {
|
|
13
|
-
writeLine
|
|
14
|
-
} from "./chunk-I7QBCEV7.mjs";
|
|
15
|
-
import "./chunk-HX6MOYBO.mjs";
|
|
16
|
-
import "./chunk-6BHJLCAO.mjs";
|
|
17
|
-
import {
|
|
18
|
-
ensureProjectConfig
|
|
19
|
-
} from "./chunk-JVLZ3SOW.mjs";
|
|
20
|
-
import {
|
|
21
|
-
prepareProjectDiscovery
|
|
22
|
-
} from "./chunk-QSVMXMTQ.mjs";
|
|
23
|
-
import {
|
|
24
|
-
loadGeneratedProjectRegistry
|
|
25
|
-
} from "./chunk-R4ZYMEDU.mjs";
|
|
26
|
-
import "./chunk-3RFRE7XG.mjs";
|
|
27
|
-
import "./chunk-TRYHX5S4.mjs";
|
|
28
|
-
import {
|
|
29
|
-
makeProjectRelativePath,
|
|
30
|
-
resolveDefaultArtifactPath,
|
|
31
|
-
writeTextFile
|
|
32
|
-
} from "./chunk-YACY2572.mjs";
|
|
33
|
-
|
|
34
|
-
// src/queue-migrations.ts
|
|
35
|
-
import { resolve } from "path";
|
|
36
|
-
import { loadConfigDirectory } from "@holo-js/config";
|
|
37
|
-
import { normalizeMigrationSlug } from "@holo-js/db";
|
|
38
|
-
var DEFAULT_DATABASE_QUEUE_TABLE = "jobs";
|
|
39
|
-
var DEFAULT_FAILED_JOBS_TABLE = "failed_jobs";
|
|
40
|
-
async function loadQueueConfig(projectRoot) {
|
|
41
|
-
return (await loadConfigDirectory(projectRoot)).queue;
|
|
42
|
-
}
|
|
43
|
-
function isDatabaseQueueConnection(connection) {
|
|
44
|
-
return connection.driver === "database";
|
|
45
|
-
}
|
|
46
|
-
function normalizeQueueMigrationName(tableName) {
|
|
47
|
-
return normalizeMigrationSlug(`create_${tableName.replaceAll(".", "_")}_table`);
|
|
48
|
-
}
|
|
49
|
-
function renderStringLiteral(value) {
|
|
50
|
-
return JSON.stringify(value);
|
|
51
|
-
}
|
|
52
|
-
function renderQueueTableMigration(tableName) {
|
|
53
|
-
const indexPrefix = tableName.replaceAll(".", "_");
|
|
54
|
-
return [
|
|
55
|
-
"import { defineMigration } from '@holo-js/db'",
|
|
56
|
-
"",
|
|
57
|
-
"export default defineMigration({",
|
|
58
|
-
" async up({ schema }) {",
|
|
59
|
-
` await schema.createTable(${renderStringLiteral(tableName)}, (table) => {`,
|
|
60
|
-
" table.string('id').primaryKey()",
|
|
61
|
-
" table.string('job')",
|
|
62
|
-
" table.string('connection')",
|
|
63
|
-
" table.string('queue')",
|
|
64
|
-
" table.text('payload')",
|
|
65
|
-
" table.integer('attempts').default(0)",
|
|
66
|
-
" table.integer('max_attempts').default(1)",
|
|
67
|
-
" table.bigInteger('available_at')",
|
|
68
|
-
" table.bigInteger('reserved_at').nullable()",
|
|
69
|
-
" table.string('reservation_id').nullable()",
|
|
70
|
-
" table.bigInteger('created_at')",
|
|
71
|
-
` table.index(['queue', 'available_at'], ${renderStringLiteral(`${indexPrefix}_queue_available_at_index`)})`,
|
|
72
|
-
` table.index(['queue', 'reserved_at'], ${renderStringLiteral(`${indexPrefix}_queue_reserved_at_index`)})`,
|
|
73
|
-
` table.index(['reservation_id'], ${renderStringLiteral(`${indexPrefix}_reservation_id_index`)})`,
|
|
74
|
-
" })",
|
|
75
|
-
" },",
|
|
76
|
-
" async down({ schema }) {",
|
|
77
|
-
` await schema.dropTable(${renderStringLiteral(tableName)})`,
|
|
78
|
-
" },",
|
|
79
|
-
"})",
|
|
80
|
-
""
|
|
81
|
-
].join("\n");
|
|
82
|
-
}
|
|
83
|
-
function renderFailedJobsTableMigration(tableName) {
|
|
84
|
-
const indexPrefix = tableName.replaceAll(".", "_");
|
|
85
|
-
return [
|
|
86
|
-
"import { defineMigration } from '@holo-js/db'",
|
|
87
|
-
"",
|
|
88
|
-
"export default defineMigration({",
|
|
89
|
-
" async up({ schema }) {",
|
|
90
|
-
` await schema.createTable(${renderStringLiteral(tableName)}, (table) => {`,
|
|
91
|
-
" table.string('id').primaryKey()",
|
|
92
|
-
" table.string('job_id')",
|
|
93
|
-
" table.string('job')",
|
|
94
|
-
" table.string('connection')",
|
|
95
|
-
" table.string('queue')",
|
|
96
|
-
" table.text('payload')",
|
|
97
|
-
" table.text('exception')",
|
|
98
|
-
" table.bigInteger('failed_at')",
|
|
99
|
-
` table.index(['job_id'], ${renderStringLiteral(`${indexPrefix}_job_id_index`)})`,
|
|
100
|
-
` table.index(['failed_at'], ${renderStringLiteral(`${indexPrefix}_failed_at_index`)})`,
|
|
101
|
-
" })",
|
|
102
|
-
" },",
|
|
103
|
-
" async down({ schema }) {",
|
|
104
|
-
` await schema.dropTable(${renderStringLiteral(tableName)})`,
|
|
105
|
-
" },",
|
|
106
|
-
"})",
|
|
107
|
-
""
|
|
108
|
-
].join("\n");
|
|
109
|
-
}
|
|
110
|
-
function resolveDatabaseQueueTables(queueConfig) {
|
|
111
|
-
const configured = Object.values(queueConfig.connections).filter(isDatabaseQueueConnection).map((connection) => connection.table);
|
|
112
|
-
return Object.freeze(configured.length > 0 ? [...new Set(configured)] : [DEFAULT_DATABASE_QUEUE_TABLE]);
|
|
113
|
-
}
|
|
114
|
-
async function runQueueTableCommand(io, projectRoot) {
|
|
115
|
-
const project = await ensureProjectConfig(projectRoot);
|
|
116
|
-
const registry = await loadGeneratedProjectRegistry(projectRoot) ?? await prepareProjectDiscovery(projectRoot, project.config);
|
|
117
|
-
const queueConfig = await loadQueueConfig(projectRoot);
|
|
118
|
-
const migrationsDir = resolve(projectRoot, project.config.paths.migrations);
|
|
119
|
-
const createdFiles = [];
|
|
120
|
-
const tableNames = resolveDatabaseQueueTables(queueConfig);
|
|
121
|
-
for (const tableName of tableNames) {
|
|
122
|
-
const migrationName = normalizeQueueMigrationName(tableName);
|
|
123
|
-
if (hasRegisteredMigrationSlug(registry, migrationName) || hasRegisteredCreateTableMigration(registry, tableName)) {
|
|
124
|
-
throw new Error(`A migration for table "${tableName}" already exists.`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
for (const tableName of tableNames) {
|
|
128
|
-
const migrationTemplate = await nextMigrationTemplate(normalizeQueueMigrationName(tableName), migrationsDir);
|
|
129
|
-
const migrationFilePath = resolveDefaultArtifactPath(projectRoot, project.config.paths.migrations, migrationTemplate.fileName);
|
|
130
|
-
await writeTextFile(migrationFilePath, renderQueueTableMigration(tableName));
|
|
131
|
-
createdFiles.push(migrationFilePath);
|
|
132
|
-
}
|
|
133
|
-
await runProjectPrepare(projectRoot);
|
|
134
|
-
for (const filePath of createdFiles) {
|
|
135
|
-
writeLine(io.stdout, `Created migration: ${makeProjectRelativePath(projectRoot, filePath)}`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
async function runQueueFailedTableCommand(io, projectRoot) {
|
|
139
|
-
const project = await ensureProjectConfig(projectRoot);
|
|
140
|
-
const registry = await loadGeneratedProjectRegistry(projectRoot) ?? await prepareProjectDiscovery(projectRoot, project.config);
|
|
141
|
-
const queueConfig = await loadQueueConfig(projectRoot);
|
|
142
|
-
const tableName = queueConfig.failed === false ? DEFAULT_FAILED_JOBS_TABLE : queueConfig.failed.table;
|
|
143
|
-
const migrationName = normalizeQueueMigrationName(tableName);
|
|
144
|
-
if (hasRegisteredMigrationSlug(registry, migrationName) || hasRegisteredCreateTableMigration(registry, tableName)) {
|
|
145
|
-
throw new Error(`A migration for table "${tableName}" already exists.`);
|
|
146
|
-
}
|
|
147
|
-
const migrationTemplate = await nextMigrationTemplate(
|
|
148
|
-
migrationName,
|
|
149
|
-
resolve(projectRoot, project.config.paths.migrations)
|
|
150
|
-
);
|
|
151
|
-
const migrationFilePath = resolveDefaultArtifactPath(projectRoot, project.config.paths.migrations, migrationTemplate.fileName);
|
|
152
|
-
await writeTextFile(migrationFilePath, renderFailedJobsTableMigration(tableName));
|
|
153
|
-
await runProjectPrepare(projectRoot);
|
|
154
|
-
writeLine(io.stdout, `Created migration: ${makeProjectRelativePath(projectRoot, migrationFilePath)}`);
|
|
155
|
-
}
|
|
156
|
-
var queueMigrationInternals = {
|
|
157
|
-
getRegistryMigrationSlug,
|
|
158
|
-
hasRegisteredMigrationSlug,
|
|
159
|
-
hasRegisteredCreateTableMigration,
|
|
160
|
-
nextMigrationTemplate
|
|
161
|
-
};
|
|
162
|
-
export {
|
|
163
|
-
DEFAULT_DATABASE_QUEUE_TABLE,
|
|
164
|
-
DEFAULT_FAILED_JOBS_TABLE,
|
|
165
|
-
loadQueueConfig,
|
|
166
|
-
normalizeQueueMigrationName,
|
|
167
|
-
queueMigrationInternals,
|
|
168
|
-
renderFailedJobsTableMigration,
|
|
169
|
-
renderQueueTableMigration,
|
|
170
|
-
resolveDatabaseQueueTables,
|
|
171
|
-
runQueueFailedTableCommand,
|
|
172
|
-
runQueueTableCommand
|
|
173
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RUNTIME_MIGRATION_NAME_PATTERN,
|
|
3
|
-
cacheProjectConfig,
|
|
4
|
-
cleanupRuntimeDependencyLink,
|
|
5
|
-
compileFreshDropIdentifierPath,
|
|
6
|
-
createEnvRuntimeConfig,
|
|
7
|
-
createRuntimeInvocation,
|
|
8
|
-
dropAllTablesForFresh,
|
|
9
|
-
ensureRuntimeDependencyLink,
|
|
10
|
-
filterDefinedRuntimeConnectionInput,
|
|
11
|
-
getRuntimeEnvironment,
|
|
12
|
-
getRuntimeFailureMessage,
|
|
13
|
-
inferRuntimeMigrationName,
|
|
14
|
-
initializeProjectRuntime,
|
|
15
|
-
isDefined,
|
|
16
|
-
mergeRuntimeDatabaseConfig,
|
|
17
|
-
normalizeRuntimeConnectionInput,
|
|
18
|
-
normalizeRuntimeMigration,
|
|
19
|
-
parseBooleanEnv,
|
|
20
|
-
resolveConfigModuleUrl,
|
|
21
|
-
resolvePackageRootFromSpecifier,
|
|
22
|
-
resolveRuntimeWorkerPath,
|
|
23
|
-
runRuntimeInvocation,
|
|
24
|
-
withRuntimeEnvironment
|
|
25
|
-
} from "./chunk-LALDNNPH.mjs";
|
|
26
|
-
import "./chunk-M3IPUCTM.mjs";
|
|
27
|
-
import "./chunk-HX6MOYBO.mjs";
|
|
28
|
-
import "./chunk-QSVMXMTQ.mjs";
|
|
29
|
-
import "./chunk-OI54DOHK.mjs";
|
|
30
|
-
import "./chunk-JVLZ3SOW.mjs";
|
|
31
|
-
import "./chunk-R4ZYMEDU.mjs";
|
|
32
|
-
import "./chunk-3RFRE7XG.mjs";
|
|
33
|
-
import "./chunk-TRYHX5S4.mjs";
|
|
34
|
-
import "./chunk-YACY2572.mjs";
|
|
35
|
-
export {
|
|
36
|
-
RUNTIME_MIGRATION_NAME_PATTERN,
|
|
37
|
-
cacheProjectConfig,
|
|
38
|
-
cleanupRuntimeDependencyLink,
|
|
39
|
-
compileFreshDropIdentifierPath,
|
|
40
|
-
createEnvRuntimeConfig,
|
|
41
|
-
createRuntimeInvocation,
|
|
42
|
-
dropAllTablesForFresh,
|
|
43
|
-
ensureRuntimeDependencyLink,
|
|
44
|
-
filterDefinedRuntimeConnectionInput,
|
|
45
|
-
getRuntimeEnvironment,
|
|
46
|
-
getRuntimeFailureMessage,
|
|
47
|
-
inferRuntimeMigrationName,
|
|
48
|
-
initializeProjectRuntime,
|
|
49
|
-
isDefined,
|
|
50
|
-
mergeRuntimeDatabaseConfig,
|
|
51
|
-
normalizeRuntimeConnectionInput,
|
|
52
|
-
normalizeRuntimeMigration,
|
|
53
|
-
parseBooleanEnv,
|
|
54
|
-
resolveConfigModuleUrl,
|
|
55
|
-
resolvePackageRootFromSpecifier,
|
|
56
|
-
resolveRuntimeWorkerPath,
|
|
57
|
-
runRuntimeInvocation,
|
|
58
|
-
withRuntimeEnvironment
|
|
59
|
-
};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
authFeaturesRequireConfigUpdate,
|
|
3
|
-
detectAuthInstallFeaturesFromConfig,
|
|
4
|
-
hasLoadedConfigFile,
|
|
5
|
-
inferConnectionDriver,
|
|
6
|
-
inferDatabaseDriverFromUrl,
|
|
7
|
-
injectBroadcastAuthEndpoint,
|
|
8
|
-
installAuthIntoProject,
|
|
9
|
-
installAuthorizationIntoProject,
|
|
10
|
-
installBroadcastIntoProject,
|
|
11
|
-
installCacheIntoProject,
|
|
12
|
-
installEventsIntoProject,
|
|
13
|
-
installMailIntoProject,
|
|
14
|
-
installMediaIntoProject,
|
|
15
|
-
installNotificationsIntoProject,
|
|
16
|
-
installQueueIntoProject,
|
|
17
|
-
installRealtimeIntoProject,
|
|
18
|
-
installSecurityIntoProject,
|
|
19
|
-
normalizeScaffoldEnvSegments,
|
|
20
|
-
publishAuthNotificationsIntoProject,
|
|
21
|
-
renderAuthConfig,
|
|
22
|
-
renderAuthEnvFiles,
|
|
23
|
-
renderAuthMigration,
|
|
24
|
-
renderAuthUserModel,
|
|
25
|
-
renderCacheConfig,
|
|
26
|
-
renderCacheEnvFiles,
|
|
27
|
-
renderCorsConfig,
|
|
28
|
-
renderEnvFileContents,
|
|
29
|
-
renderMailConfig,
|
|
30
|
-
renderMailEnvFiles,
|
|
31
|
-
renderMediaConfig,
|
|
32
|
-
renderNotificationsConfig,
|
|
33
|
-
renderNotificationsMigration,
|
|
34
|
-
renderQueueConfig,
|
|
35
|
-
renderQueueEnvFiles,
|
|
36
|
-
renderRedisConfig,
|
|
37
|
-
renderScaffoldAppConfig,
|
|
38
|
-
renderScaffoldDatabaseConfig,
|
|
39
|
-
renderScaffoldEnvFiles,
|
|
40
|
-
renderScaffoldGitignore,
|
|
41
|
-
renderScaffoldPackageJson,
|
|
42
|
-
renderScaffoldTsconfig,
|
|
43
|
-
renderSecurityConfig,
|
|
44
|
-
renderSessionConfig,
|
|
45
|
-
renderStorageConfig,
|
|
46
|
-
renderVSCodeSettings,
|
|
47
|
-
resolveBroadcastConfigTargetPath,
|
|
48
|
-
resolveDefaultDatabaseUrl,
|
|
49
|
-
resolvePackageManagerVersion,
|
|
50
|
-
scaffoldProject,
|
|
51
|
-
syncManagedDriverDependencies,
|
|
52
|
-
upsertAuthPackageDependencies,
|
|
53
|
-
upsertCachePackageDependencies,
|
|
54
|
-
upsertEventsPackageDependency,
|
|
55
|
-
upsertMailPackageDependency,
|
|
56
|
-
upsertMediaPackageDependency,
|
|
57
|
-
upsertNotificationsPackageDependency,
|
|
58
|
-
upsertSecurityPackageDependency
|
|
59
|
-
} from "./chunk-OI54DOHK.mjs";
|
|
60
|
-
import "./chunk-JVLZ3SOW.mjs";
|
|
61
|
-
import {
|
|
62
|
-
renderAuthProviderRouteFiles,
|
|
63
|
-
renderFrameworkFiles,
|
|
64
|
-
renderFrameworkRunner,
|
|
65
|
-
renderFrameworkRunnerForDescriptor,
|
|
66
|
-
renderNextBroadcastConfigRoute
|
|
67
|
-
} from "./chunk-R4ZYMEDU.mjs";
|
|
68
|
-
import "./chunk-3RFRE7XG.mjs";
|
|
69
|
-
import "./chunk-TRYHX5S4.mjs";
|
|
70
|
-
import {
|
|
71
|
-
isSupportedCacheInstallerDriver,
|
|
72
|
-
isSupportedQueueInstallerDriver,
|
|
73
|
-
normalizeScaffoldOptionalPackages,
|
|
74
|
-
sanitizePackageName
|
|
75
|
-
} from "./chunk-YACY2572.mjs";
|
|
76
|
-
export {
|
|
77
|
-
authFeaturesRequireConfigUpdate,
|
|
78
|
-
detectAuthInstallFeaturesFromConfig,
|
|
79
|
-
hasLoadedConfigFile,
|
|
80
|
-
inferConnectionDriver,
|
|
81
|
-
inferDatabaseDriverFromUrl,
|
|
82
|
-
injectBroadcastAuthEndpoint,
|
|
83
|
-
installAuthIntoProject,
|
|
84
|
-
installAuthorizationIntoProject,
|
|
85
|
-
installBroadcastIntoProject,
|
|
86
|
-
installCacheIntoProject,
|
|
87
|
-
installEventsIntoProject,
|
|
88
|
-
installMailIntoProject,
|
|
89
|
-
installMediaIntoProject,
|
|
90
|
-
installNotificationsIntoProject,
|
|
91
|
-
installQueueIntoProject,
|
|
92
|
-
installRealtimeIntoProject,
|
|
93
|
-
installSecurityIntoProject,
|
|
94
|
-
isSupportedCacheInstallerDriver,
|
|
95
|
-
isSupportedQueueInstallerDriver,
|
|
96
|
-
normalizeScaffoldEnvSegments,
|
|
97
|
-
normalizeScaffoldOptionalPackages,
|
|
98
|
-
publishAuthNotificationsIntoProject,
|
|
99
|
-
renderAuthConfig,
|
|
100
|
-
renderAuthEnvFiles,
|
|
101
|
-
renderAuthMigration,
|
|
102
|
-
renderAuthProviderRouteFiles,
|
|
103
|
-
renderAuthUserModel,
|
|
104
|
-
renderCacheConfig,
|
|
105
|
-
renderCacheEnvFiles,
|
|
106
|
-
renderCorsConfig,
|
|
107
|
-
renderEnvFileContents,
|
|
108
|
-
renderFrameworkFiles,
|
|
109
|
-
renderFrameworkRunner,
|
|
110
|
-
renderFrameworkRunnerForDescriptor,
|
|
111
|
-
renderMailConfig,
|
|
112
|
-
renderMailEnvFiles,
|
|
113
|
-
renderMediaConfig,
|
|
114
|
-
renderNextBroadcastConfigRoute,
|
|
115
|
-
renderNotificationsConfig,
|
|
116
|
-
renderNotificationsMigration,
|
|
117
|
-
renderQueueConfig,
|
|
118
|
-
renderQueueEnvFiles,
|
|
119
|
-
renderRedisConfig,
|
|
120
|
-
renderScaffoldAppConfig,
|
|
121
|
-
renderScaffoldDatabaseConfig,
|
|
122
|
-
renderScaffoldEnvFiles,
|
|
123
|
-
renderScaffoldGitignore,
|
|
124
|
-
renderScaffoldPackageJson,
|
|
125
|
-
renderScaffoldTsconfig,
|
|
126
|
-
renderSecurityConfig,
|
|
127
|
-
renderSessionConfig,
|
|
128
|
-
renderStorageConfig,
|
|
129
|
-
renderVSCodeSettings,
|
|
130
|
-
resolveBroadcastConfigTargetPath,
|
|
131
|
-
resolveDefaultDatabaseUrl,
|
|
132
|
-
resolvePackageManagerVersion,
|
|
133
|
-
sanitizePackageName,
|
|
134
|
-
scaffoldProject,
|
|
135
|
-
syncManagedDriverDependencies,
|
|
136
|
-
upsertAuthPackageDependencies,
|
|
137
|
-
upsertCachePackageDependencies,
|
|
138
|
-
upsertEventsPackageDependency,
|
|
139
|
-
upsertMailPackageDependency,
|
|
140
|
-
upsertMediaPackageDependency,
|
|
141
|
-
upsertNotificationsPackageDependency,
|
|
142
|
-
upsertSecurityPackageDependency
|
|
143
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
writeLine
|
|
3
|
-
} from "./chunk-I7QBCEV7.mjs";
|
|
4
|
-
import "./chunk-HX6MOYBO.mjs";
|
|
5
|
-
import "./chunk-QSVMXMTQ.mjs";
|
|
6
|
-
import "./chunk-OI54DOHK.mjs";
|
|
7
|
-
import "./chunk-JVLZ3SOW.mjs";
|
|
8
|
-
import "./chunk-R4ZYMEDU.mjs";
|
|
9
|
-
import "./chunk-3RFRE7XG.mjs";
|
|
10
|
-
import "./chunk-TRYHX5S4.mjs";
|
|
11
|
-
import {
|
|
12
|
-
resolveProjectPackageImportSpecifier
|
|
13
|
-
} from "./chunk-YACY2572.mjs";
|
|
14
|
-
|
|
15
|
-
// src/security.ts
|
|
16
|
-
import { loadConfigDirectory } from "@holo-js/config";
|
|
17
|
-
async function loadSecurityCliModule(projectRoot) {
|
|
18
|
-
const specifier = resolveProjectPackageImportSpecifier(projectRoot, "@holo-js/security");
|
|
19
|
-
try {
|
|
20
|
-
return await import(specifier);
|
|
21
|
-
} catch (error) {
|
|
22
|
-
const details = error instanceof Error ? error.message : String(error);
|
|
23
|
-
throw new Error(
|
|
24
|
-
`Unable to load @holo-js/security from ${projectRoot}. Install it with "holo install security". ${details}`
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async function runRateLimitClearCommand(io, projectRoot, options, dependencies = {}) {
|
|
29
|
-
const loadSecurityModule = dependencies.loadSecurityModule ?? loadSecurityCliModule;
|
|
30
|
-
const loadConfig = dependencies.loadConfig ?? (async (root) => {
|
|
31
|
-
const loaded = await loadConfigDirectory(root, {
|
|
32
|
-
preferCache: false,
|
|
33
|
-
processEnv: process.env
|
|
34
|
-
});
|
|
35
|
-
return { security: loaded.security };
|
|
36
|
-
});
|
|
37
|
-
const loadRedisAdapter = dependencies.loadRedisAdapter ?? (async (root) => {
|
|
38
|
-
return await import(resolveProjectPackageImportSpecifier(root, "@holo-js/security/drivers/redis-adapter"));
|
|
39
|
-
});
|
|
40
|
-
const { security: securityConfig } = await loadConfig(projectRoot);
|
|
41
|
-
const securityModule = await loadSecurityModule(projectRoot);
|
|
42
|
-
const driver = securityConfig.rateLimit.driver;
|
|
43
|
-
if (driver === "memory") {
|
|
44
|
-
throw new Error("[security] The memory rate-limit driver is process-local and cannot be cleared meaningfully from the CLI.");
|
|
45
|
-
}
|
|
46
|
-
let redisAdapter;
|
|
47
|
-
if (driver === "redis") {
|
|
48
|
-
const { createSecurityRedisAdapter } = await loadRedisAdapter(projectRoot);
|
|
49
|
-
redisAdapter = createSecurityRedisAdapter(securityConfig.rateLimit.redis);
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
await redisAdapter?.connect();
|
|
53
|
-
const rateLimitStoreOptions = redisAdapter ? { projectRoot, redisAdapter } : { projectRoot };
|
|
54
|
-
const rateLimitStore = securityModule.createRateLimitStoreFromConfig(securityConfig, rateLimitStoreOptions);
|
|
55
|
-
securityModule.configureSecurityRuntime({
|
|
56
|
-
config: securityConfig,
|
|
57
|
-
rateLimitStore
|
|
58
|
-
});
|
|
59
|
-
const cleared = await securityModule.clearRateLimit(options);
|
|
60
|
-
const count = typeof cleared === "boolean" ? cleared ? 1 : 0 : cleared;
|
|
61
|
-
writeLine(io.stdout, `[security] Cleared ${count} rate-limit bucket(s).`);
|
|
62
|
-
} finally {
|
|
63
|
-
try {
|
|
64
|
-
await redisAdapter?.close();
|
|
65
|
-
} finally {
|
|
66
|
-
securityModule.resetSecurityRuntime();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
export {
|
|
71
|
-
loadSecurityCliModule,
|
|
72
|
-
runRateLimitClearCommand
|
|
73
|
-
};
|