@holo-js/cli 0.1.3 → 0.1.5
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 +192 -35
- package/dist/{broadcast-YZS4OFCM.mjs → broadcast-RT5KVZWP.mjs} +5 -5
- package/dist/{cache-V43YMG4K.mjs → cache-NHCCHT44.mjs} +5 -5
- package/dist/{cache-migrations-ZUOI2A7N.mjs → cache-migrations-R2RL2RVD.mjs} +15 -16
- package/dist/{chunk-EUIVXVJL.mjs → chunk-57SJ566R.mjs} +1 -1
- package/dist/chunk-5BLEC66P.mjs +284 -0
- package/dist/{chunk-JX2ZH6XY.mjs → chunk-5EU32E7X.mjs} +3 -3
- package/dist/{chunk-Q5F6C2D4.mjs → chunk-BAFQ2GOA.mjs} +1 -1
- package/dist/{chunk-CUL4RJTG.mjs → chunk-F4MT6GBK.mjs} +1 -1
- package/dist/{chunk-3OTCSFDG.mjs → chunk-MXKNQACM.mjs} +544 -82
- package/dist/{chunk-QYLSMF7V.mjs → chunk-OZUDZEAW.mjs} +142 -28
- package/dist/{chunk-66FHW725.mjs → chunk-R6BWRY3E.mjs} +28 -2
- package/dist/{chunk-RB65DLR4.mjs → chunk-SCCPDJGO.mjs} +156 -16
- package/dist/{chunk-VT5IDQG6.mjs → chunk-UZTDQKIY.mjs} +61 -44
- package/dist/{chunk-HE6FYNVN.mjs → chunk-VCEO6N5T.mjs} +3563 -2505
- package/dist/{config-LS5USBRB.mjs → config-5JSC6KJG.mjs} +3 -3
- package/dist/{dev-KGRIGLJY.mjs → dev-OSLYSBTL.mjs} +7 -7
- package/dist/{discovery-GBLAUTXS.mjs → discovery-JLT2EOGH.mjs} +3 -3
- package/dist/{generators-WSF23UKM.mjs → generators-ZIWACCBE.mjs} +134 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +189 -32
- package/dist/media-migrations-UBAL2YVV.mjs +117 -0
- package/dist/{queue-6N7HQMRL.mjs → queue-I66EISVS.mjs} +14 -14
- package/dist/{queue-migrations-O6QSSDPQ.mjs → queue-migrations-UIAMAB6E.mjs} +24 -20
- package/dist/{runtime-RI4OWTIT.mjs → runtime-MMQGO4PP.mjs} +9 -7
- package/dist/{runtime-OOSJ5JBY.mjs → runtime-ZKD6URAV.mjs} +1 -1
- package/dist/{scaffold-IYWZKT3W.mjs → scaffold-ISDVICNQ.mjs} +18 -4
- package/dist/{security-AE6LGNC4.mjs → security-OZXTMYXF.mjs} +10 -7
- package/package.json +13 -12
- package/dist/broadcast-ZYFKUFM5.mjs +0 -85
- package/dist/cache-ODBZT6IP.mjs +0 -67
- package/dist/cache-migrations-KPOEH6GP.mjs +0 -155
- package/dist/chunk-BWW5TDFI.mjs +0 -4
- package/dist/chunk-D4GG556Y.mjs +0 -23
- package/dist/chunk-ET7UXHHQ.mjs +0 -166
- package/dist/chunk-G5ADO27Q.mjs +0 -463
- package/dist/chunk-GSQ3HTRO.mjs +0 -165
- package/dist/chunk-H7TJ4FB3.mjs +0 -848
- package/dist/chunk-ICJR7TS4.mjs +0 -66
- package/dist/chunk-ICKN56JY.mjs +0 -342
- package/dist/chunk-M7J3YTHR.mjs +0 -26
- package/dist/chunk-S7P7EBM3.mjs +0 -787
- package/dist/chunk-SRWJU3A5.mjs +0 -11
- package/dist/chunk-T4OVZZEE.mjs +0 -3204
- package/dist/chunk-URK7C3VQ.mjs +0 -538
- package/dist/chunk-XUYKPU5Q.mjs +0 -272
- package/dist/config-DMWBMMGD.mjs +0 -26
- package/dist/dev-LVHDCPVS.mjs +0 -43
- package/dist/discovery-R733D2PO.mjs +0 -29
- package/dist/generators-32R45P6Z.mjs +0 -426
- package/dist/queue-QG5EXOG4.mjs +0 -626
- package/dist/queue-migrations-JWKU45Y3.mjs +0 -163
- package/dist/runtime-ANBO7VQM.mjs +0 -33
- package/dist/runtime-ZRPK5DIT.mjs +0 -56
- package/dist/scaffold-ULATB4CA.mjs +0 -121
- package/dist/security-OCOPEH2V.mjs +0 -69
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
import {
|
|
3
2
|
loadGeneratedProjectRegistry,
|
|
4
3
|
writeGeneratedProjectRegistry
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MXKNQACM.mjs";
|
|
6
5
|
import {
|
|
7
6
|
COMMAND_FILE_PATTERN,
|
|
8
7
|
MIGRATION_NAME_PATTERN,
|
|
@@ -18,15 +17,18 @@ import {
|
|
|
18
17
|
pathExists,
|
|
19
18
|
readTextFile,
|
|
20
19
|
toPosixPath
|
|
21
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-R6BWRY3E.mjs";
|
|
22
21
|
|
|
23
22
|
// src/project/discovery.ts
|
|
24
|
-
import {
|
|
25
|
-
import { basename, dirname, extname, join, relative, resolve } from "path";
|
|
23
|
+
import { resolve as resolve2 } from "path";
|
|
26
24
|
import { loadConfigDirectory } from "@holo-js/config";
|
|
27
25
|
import {
|
|
28
26
|
normalizeHoloProjectConfig
|
|
29
27
|
} from "@holo-js/db";
|
|
28
|
+
|
|
29
|
+
// src/project/discovery-helpers.ts
|
|
30
|
+
import { readdir } from "fs/promises";
|
|
31
|
+
import { basename, dirname, extname, join, relative, resolve } from "path";
|
|
30
32
|
async function collectFiles(root) {
|
|
31
33
|
if (!await pathExists(root)) {
|
|
32
34
|
return [];
|
|
@@ -337,23 +339,44 @@ function resolveBroadcastArtifactsPath(config, key) {
|
|
|
337
339
|
const configuredPaths = config.paths;
|
|
338
340
|
return configuredPaths[key] ?? `server/${key}`;
|
|
339
341
|
}
|
|
342
|
+
function inferMigrationNameFromEntry(entry) {
|
|
343
|
+
const fileName = basename(entry, extname(entry));
|
|
344
|
+
return validateMigrationName(
|
|
345
|
+
fileName,
|
|
346
|
+
`Registered migration "${entry}" must use a timestamped file name matching YYYY_MM_DD_HHMMSS_description.`
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
function validateMigrationName(name, message) {
|
|
350
|
+
if (!MIGRATION_NAME_PATTERN.test(name)) {
|
|
351
|
+
throw new Error(
|
|
352
|
+
message ?? `Migration name "${name}" must match YYYY_MM_DD_HHMMSS_description.`
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
return name;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// src/project/discovery.ts
|
|
340
359
|
async function prepareProjectDiscovery(projectRoot, config = normalizeHoloProjectConfig()) {
|
|
341
360
|
const loadedConfig = await loadConfigDirectory(projectRoot, {
|
|
342
361
|
processEnv: process.env
|
|
343
362
|
});
|
|
344
|
-
const modelsRoot =
|
|
345
|
-
const migrationsRoot =
|
|
346
|
-
const seedersRoot =
|
|
347
|
-
const commandsRoot =
|
|
348
|
-
const jobsRoot =
|
|
349
|
-
const eventsRoot =
|
|
350
|
-
const listenersRoot =
|
|
363
|
+
const modelsRoot = resolve2(projectRoot, config.paths.models);
|
|
364
|
+
const migrationsRoot = resolve2(projectRoot, config.paths.migrations);
|
|
365
|
+
const seedersRoot = resolve2(projectRoot, config.paths.seeders);
|
|
366
|
+
const commandsRoot = resolve2(projectRoot, config.paths.commands);
|
|
367
|
+
const jobsRoot = resolve2(projectRoot, config.paths.jobs);
|
|
368
|
+
const eventsRoot = resolve2(projectRoot, config.paths.events);
|
|
369
|
+
const listenersRoot = resolve2(projectRoot, config.paths.listeners);
|
|
351
370
|
const broadcastPath = resolveBroadcastArtifactsPath(config, "broadcast");
|
|
352
371
|
const channelsPath = resolveBroadcastArtifactsPath(config, "channels");
|
|
353
|
-
const broadcastRoot =
|
|
354
|
-
const channelsRoot =
|
|
355
|
-
const policiesRoot =
|
|
356
|
-
const abilitiesRoot =
|
|
372
|
+
const broadcastRoot = resolve2(projectRoot, broadcastPath);
|
|
373
|
+
const channelsRoot = resolve2(projectRoot, channelsPath);
|
|
374
|
+
const policiesRoot = resolve2(projectRoot, config.paths.authorizationPolicies ?? "server/policies");
|
|
375
|
+
const abilitiesRoot = resolve2(projectRoot, config.paths.authorizationAbilities ?? "server/abilities");
|
|
376
|
+
const generatedSchemaPath = resolve2(projectRoot, config.paths.generatedSchema);
|
|
377
|
+
if (await pathExists(generatedSchemaPath)) {
|
|
378
|
+
await importProjectModule(projectRoot, generatedSchemaPath);
|
|
379
|
+
}
|
|
357
380
|
const [modelFiles, migrationFiles, seederFiles, commandFiles, jobFiles, eventFiles, listenerFiles, broadcastFiles, channelFiles] = await Promise.all([
|
|
358
381
|
collectFiles(modelsRoot),
|
|
359
382
|
collectFiles(migrationsRoot),
|
|
@@ -374,8 +397,8 @@ async function prepareProjectDiscovery(projectRoot, config = normalizeHoloProjec
|
|
|
374
397
|
const relativePath = makeProjectRelativePath(projectRoot, filePath);
|
|
375
398
|
try {
|
|
376
399
|
const moduleValue = await importProjectModule(projectRoot, filePath);
|
|
377
|
-
const
|
|
378
|
-
if (!
|
|
400
|
+
const exportedModel = resolveNamedExportEntry(moduleValue, isCliModelReference);
|
|
401
|
+
if (!exportedModel) {
|
|
379
402
|
if (isInactiveGeneratedModelModule(moduleValue)) {
|
|
380
403
|
continue;
|
|
381
404
|
}
|
|
@@ -383,8 +406,10 @@ async function prepareProjectDiscovery(projectRoot, config = normalizeHoloProjec
|
|
|
383
406
|
}
|
|
384
407
|
models.push({
|
|
385
408
|
sourcePath: relativePath,
|
|
386
|
-
name:
|
|
387
|
-
|
|
409
|
+
name: exportedModel.value.definition.name,
|
|
410
|
+
tableName: exportedModel.value.definition.table.tableName,
|
|
411
|
+
prunable: Boolean(exportedModel.value.definition.prunable),
|
|
412
|
+
...exportedModel.exportName === "default" ? {} : { exportName: exportedModel.exportName }
|
|
388
413
|
});
|
|
389
414
|
} catch (error) {
|
|
390
415
|
if (!isMissingGeneratedSchemaModelError(error)) {
|
|
@@ -410,15 +435,21 @@ async function prepareProjectDiscovery(projectRoot, config = normalizeHoloProjec
|
|
|
410
435
|
const seeders = [];
|
|
411
436
|
for (const filePath of seederFiles) {
|
|
412
437
|
const relativePath = makeProjectRelativePath(projectRoot, filePath);
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
438
|
+
try {
|
|
439
|
+
const moduleValue = await importProjectModule(projectRoot, filePath);
|
|
440
|
+
const seeder = resolveNamedExport(moduleValue, isSeederDefinition);
|
|
441
|
+
if (!seeder) {
|
|
442
|
+
throw new Error(`Discovered seeder "${relativePath}" does not export a Holo seeder.`);
|
|
443
|
+
}
|
|
444
|
+
seeders.push({
|
|
445
|
+
sourcePath: relativePath,
|
|
446
|
+
name: seeder.name
|
|
447
|
+
});
|
|
448
|
+
} catch (error) {
|
|
449
|
+
if (!isMissingGeneratedSchemaModelError(error)) {
|
|
450
|
+
throw error;
|
|
451
|
+
}
|
|
417
452
|
}
|
|
418
|
-
seeders.push({
|
|
419
|
-
sourcePath: relativePath,
|
|
420
|
-
name: seeder.name
|
|
421
|
-
});
|
|
422
453
|
}
|
|
423
454
|
assertUniqueEntries("seeder", seeders);
|
|
424
455
|
const commands = [];
|
|
@@ -709,7 +740,7 @@ async function discoverAppCommands(projectRoot, config = normalizeHoloProjectCon
|
|
|
709
740
|
description: entry.description,
|
|
710
741
|
...entry.usage ? { usage: entry.usage } : {},
|
|
711
742
|
async load() {
|
|
712
|
-
const moduleValue = await importProjectModule(projectRoot,
|
|
743
|
+
const moduleValue = await importProjectModule(projectRoot, resolve2(projectRoot, entry.sourcePath));
|
|
713
744
|
const command = resolveCommandExport(moduleValue);
|
|
714
745
|
if (!command) {
|
|
715
746
|
throw new Error(`Discovered command "${entry.sourcePath}" does not export a Holo command.`);
|
|
@@ -745,21 +776,6 @@ async function loadRegisteredMigrations(projectRoot, config) {
|
|
|
745
776
|
}
|
|
746
777
|
return migrations;
|
|
747
778
|
}
|
|
748
|
-
function inferMigrationNameFromEntry(entry) {
|
|
749
|
-
const fileName = basename(entry, extname(entry));
|
|
750
|
-
return validateMigrationName(
|
|
751
|
-
fileName,
|
|
752
|
-
`Registered migration "${entry}" must use a timestamped file name matching YYYY_MM_DD_HHMMSS_description.`
|
|
753
|
-
);
|
|
754
|
-
}
|
|
755
|
-
function validateMigrationName(name, message) {
|
|
756
|
-
if (!MIGRATION_NAME_PATTERN.test(name)) {
|
|
757
|
-
throw new Error(
|
|
758
|
-
message ?? `Migration name "${name}" must match YYYY_MM_DD_HHMMSS_description.`
|
|
759
|
-
);
|
|
760
|
-
}
|
|
761
|
-
return name;
|
|
762
|
-
}
|
|
763
779
|
async function loadRegisteredSeeders(projectRoot, config) {
|
|
764
780
|
const seeders = [];
|
|
765
781
|
for (const entry of config.seeders) {
|
|
@@ -774,6 +790,7 @@ async function loadRegisteredSeeders(projectRoot, config) {
|
|
|
774
790
|
}
|
|
775
791
|
|
|
776
792
|
export {
|
|
793
|
+
collectFiles,
|
|
777
794
|
resolveNamedExport,
|
|
778
795
|
resolveNamedExportEntry,
|
|
779
796
|
resolveListenerEventNamesForDiscovery,
|