@holo-js/cli 0.1.4 → 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-CSSARTSA.mjs → broadcast-RT5KVZWP.mjs} +5 -5
- package/dist/{cache-4G6QGIZO.mjs → cache-NHCCHT44.mjs} +5 -5
- package/dist/{cache-migrations-NATT5WPQ.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-ZLRO7HXY.mjs → chunk-SCCPDJGO.mjs} +156 -15
- package/dist/{chunk-VT5IDQG6.mjs → chunk-UZTDQKIY.mjs} +61 -44
- package/dist/{chunk-MZXN2YMI.mjs → chunk-VCEO6N5T.mjs} +3542 -2517
- package/dist/{config-LS5USBRB.mjs → config-5JSC6KJG.mjs} +3 -3
- package/dist/{dev-LZ3O2E3U.mjs → dev-OSLYSBTL.mjs} +7 -7
- package/dist/{discovery-GBLAUTXS.mjs → discovery-JLT2EOGH.mjs} +3 -3
- package/dist/{generators-DSN4GWJI.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-FV35LLPR.mjs → queue-I66EISVS.mjs} +14 -14
- package/dist/{queue-migrations-SSIYKK5S.mjs → queue-migrations-UIAMAB6E.mjs} +24 -20
- package/dist/{runtime-EFZ5H5IL.mjs → runtime-MMQGO4PP.mjs} +9 -7
- package/dist/{runtime-OOSJ5JBY.mjs → runtime-ZKD6URAV.mjs} +1 -1
- package/dist/{scaffold-7OTDH4UR.mjs → scaffold-ISDVICNQ.mjs} +18 -5
- package/dist/{security-ATKDC26E.mjs → security-OZXTMYXF.mjs} +10 -7
- package/package.json +13 -12
- package/dist/broadcast-YSIJCL3R.mjs +0 -85
- package/dist/cache-OWQY4E7W.mjs +0 -67
- package/dist/cache-migrations-RVEA6CEU.mjs +0 -155
- package/dist/chunk-BWW5TDFI.mjs +0 -4
- package/dist/chunk-D4GG556Y.mjs +0 -23
- package/dist/chunk-DMH2B4UQ.mjs +0 -343
- 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-M7J3YTHR.mjs +0 -26
- package/dist/chunk-QFUSWV3J.mjs +0 -3237
- package/dist/chunk-S7P7EBM3.mjs +0 -787
- package/dist/chunk-SRWJU3A5.mjs +0 -11
- package/dist/chunk-URK7C3VQ.mjs +0 -538
- package/dist/chunk-XUYKPU5Q.mjs +0 -272
- package/dist/config-DMWBMMGD.mjs +0 -26
- package/dist/dev-KQFT7RHR.mjs +0 -43
- package/dist/discovery-R733D2PO.mjs +0 -29
- package/dist/generators-WX45BI4U.mjs +0 -426
- package/dist/queue-6OG7VJ34.mjs +0 -626
- package/dist/queue-migrations-NK2EYX3J.mjs +0 -163
- package/dist/runtime-4BV3JODY.mjs +0 -56
- package/dist/runtime-ANBO7VQM.mjs +0 -33
- package/dist/scaffold-DRKBGS2K.mjs +0 -120
- package/dist/security-R7VH6W5H.mjs +0 -69
|
@@ -1,33 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runProjectPrepare
|
|
3
|
+
} from "./chunk-SCCPDJGO.mjs";
|
|
4
|
+
import "./chunk-F4MT6GBK.mjs";
|
|
1
5
|
import {
|
|
2
6
|
getRegistryMigrationSlug,
|
|
3
7
|
hasRegisteredCreateTableMigration,
|
|
4
8
|
hasRegisteredMigrationSlug,
|
|
5
9
|
nextMigrationTemplate
|
|
6
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BAFQ2GOA.mjs";
|
|
7
11
|
import {
|
|
8
12
|
writeLine
|
|
9
13
|
} from "./chunk-ZXDU7RHU.mjs";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
runProjectPrepare
|
|
13
|
-
} from "./chunk-ZLRO7HXY.mjs";
|
|
14
|
-
import "./chunk-CUL4RJTG.mjs";
|
|
14
|
+
import "./chunk-57SJ566R.mjs";
|
|
15
15
|
import "./chunk-D7O4SU6N.mjs";
|
|
16
16
|
import {
|
|
17
17
|
prepareProjectDiscovery
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-UZTDQKIY.mjs";
|
|
19
|
+
import "./chunk-VCEO6N5T.mjs";
|
|
20
20
|
import {
|
|
21
21
|
ensureProjectConfig
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5BLEC66P.mjs";
|
|
23
23
|
import {
|
|
24
24
|
loadGeneratedProjectRegistry
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-MXKNQACM.mjs";
|
|
26
26
|
import {
|
|
27
27
|
makeProjectRelativePath,
|
|
28
28
|
resolveDefaultArtifactPath,
|
|
29
29
|
writeTextFile
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-R6BWRY3E.mjs";
|
|
31
31
|
|
|
32
32
|
// src/queue-migrations.ts
|
|
33
33
|
import { resolve } from "path";
|
|
@@ -42,12 +42,14 @@ function normalizeQueueMigrationName(tableName) {
|
|
|
42
42
|
return normalizeMigrationSlug(`create_${tableName.replaceAll(".", "_")}_table`);
|
|
43
43
|
}
|
|
44
44
|
function renderQueueTableMigration(tableName) {
|
|
45
|
+
const tableNameLiteral = JSON.stringify(tableName);
|
|
46
|
+
const indexPrefix = tableName.replaceAll(".", "_");
|
|
45
47
|
return [
|
|
46
48
|
"import { defineMigration, type MigrationContext } from '@holo-js/db'",
|
|
47
49
|
"",
|
|
48
50
|
"export default defineMigration({",
|
|
49
51
|
" async up({ schema }: MigrationContext) {",
|
|
50
|
-
` await schema.createTable(
|
|
52
|
+
` await schema.createTable(${tableNameLiteral}, (table) => {`,
|
|
51
53
|
" table.string('id').primaryKey()",
|
|
52
54
|
" table.string('job')",
|
|
53
55
|
" table.string('connection')",
|
|
@@ -59,25 +61,27 @@ function renderQueueTableMigration(tableName) {
|
|
|
59
61
|
" table.bigInteger('reserved_at').nullable()",
|
|
60
62
|
" table.string('reservation_id').nullable()",
|
|
61
63
|
" table.bigInteger('created_at')",
|
|
62
|
-
` table.index(['queue', 'available_at'],
|
|
63
|
-
` table.index(['queue', 'reserved_at'],
|
|
64
|
-
` table.index(['reservation_id'],
|
|
64
|
+
` table.index(['queue', 'available_at'], ${JSON.stringify(`${indexPrefix}_queue_available_at_index`)})`,
|
|
65
|
+
` table.index(['queue', 'reserved_at'], ${JSON.stringify(`${indexPrefix}_queue_reserved_at_index`)})`,
|
|
66
|
+
` table.index(['reservation_id'], ${JSON.stringify(`${indexPrefix}_reservation_id_index`)})`,
|
|
65
67
|
" })",
|
|
66
68
|
" },",
|
|
67
69
|
" async down({ schema }: MigrationContext) {",
|
|
68
|
-
` await schema.dropTable(
|
|
70
|
+
` await schema.dropTable(${tableNameLiteral})`,
|
|
69
71
|
" },",
|
|
70
72
|
"})",
|
|
71
73
|
""
|
|
72
74
|
].join("\n");
|
|
73
75
|
}
|
|
74
76
|
function renderFailedJobsTableMigration(tableName) {
|
|
77
|
+
const tableNameLiteral = JSON.stringify(tableName);
|
|
78
|
+
const indexPrefix = tableName.replaceAll(".", "_");
|
|
75
79
|
return [
|
|
76
80
|
"import { defineMigration, type MigrationContext } from '@holo-js/db'",
|
|
77
81
|
"",
|
|
78
82
|
"export default defineMigration({",
|
|
79
83
|
" async up({ schema }: MigrationContext) {",
|
|
80
|
-
` await schema.createTable(
|
|
84
|
+
` await schema.createTable(${tableNameLiteral}, (table) => {`,
|
|
81
85
|
" table.string('id').primaryKey()",
|
|
82
86
|
" table.string('job_id')",
|
|
83
87
|
" table.string('job')",
|
|
@@ -86,12 +90,12 @@ function renderFailedJobsTableMigration(tableName) {
|
|
|
86
90
|
" table.text('payload')",
|
|
87
91
|
" table.text('exception')",
|
|
88
92
|
" table.bigInteger('failed_at')",
|
|
89
|
-
` table.index(['job_id'],
|
|
90
|
-
` table.index(['failed_at'],
|
|
93
|
+
` table.index(['job_id'], ${JSON.stringify(`${indexPrefix}_job_id_index`)})`,
|
|
94
|
+
` table.index(['failed_at'], ${JSON.stringify(`${indexPrefix}_failed_at_index`)})`,
|
|
91
95
|
" })",
|
|
92
96
|
" },",
|
|
93
97
|
" async down({ schema }: MigrationContext) {",
|
|
94
|
-
` await schema.dropTable(
|
|
98
|
+
` await schema.dropTable(${tableNameLiteral})`,
|
|
95
99
|
" },",
|
|
96
100
|
"})",
|
|
97
101
|
""
|
|
@@ -20,15 +20,16 @@ import {
|
|
|
20
20
|
parseBooleanEnv,
|
|
21
21
|
resolveConfigModuleUrl,
|
|
22
22
|
resolvePackageRootFromSpecifier,
|
|
23
|
+
runRuntimeInvocation,
|
|
23
24
|
withRuntimeEnvironment
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-OZUDZEAW.mjs";
|
|
26
|
+
import "./chunk-57SJ566R.mjs";
|
|
26
27
|
import "./chunk-D7O4SU6N.mjs";
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-UZTDQKIY.mjs";
|
|
29
|
+
import "./chunk-VCEO6N5T.mjs";
|
|
30
|
+
import "./chunk-5BLEC66P.mjs";
|
|
31
|
+
import "./chunk-MXKNQACM.mjs";
|
|
32
|
+
import "./chunk-R6BWRY3E.mjs";
|
|
32
33
|
export {
|
|
33
34
|
RUNTIME_MIGRATION_NAME_PATTERN,
|
|
34
35
|
cacheProjectConfig,
|
|
@@ -51,5 +52,6 @@ export {
|
|
|
51
52
|
parseBooleanEnv,
|
|
52
53
|
resolveConfigModuleUrl,
|
|
53
54
|
resolvePackageRootFromSpecifier,
|
|
55
|
+
runRuntimeInvocation,
|
|
54
56
|
withRuntimeEnvironment
|
|
55
57
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
import {
|
|
3
2
|
authFeaturesRequireConfigUpdate,
|
|
4
3
|
detectAuthInstallFeaturesFromConfig,
|
|
@@ -12,20 +11,25 @@ import {
|
|
|
12
11
|
installCacheIntoProject,
|
|
13
12
|
installEventsIntoProject,
|
|
14
13
|
installMailIntoProject,
|
|
14
|
+
installMediaIntoProject,
|
|
15
15
|
installNotificationsIntoProject,
|
|
16
16
|
installQueueIntoProject,
|
|
17
17
|
installSecurityIntoProject,
|
|
18
18
|
normalizeScaffoldEnvSegments,
|
|
19
|
+
publishAuthNotificationsIntoProject,
|
|
19
20
|
renderAuthConfig,
|
|
20
21
|
renderAuthEnvFiles,
|
|
21
22
|
renderAuthMigration,
|
|
23
|
+
renderAuthProviderRouteFiles,
|
|
22
24
|
renderAuthUserModel,
|
|
23
25
|
renderCacheConfig,
|
|
24
26
|
renderCacheEnvFiles,
|
|
27
|
+
renderCorsConfig,
|
|
25
28
|
renderEnvFileContents,
|
|
26
29
|
renderFrameworkFiles,
|
|
27
30
|
renderFrameworkRunner,
|
|
28
31
|
renderMailConfig,
|
|
32
|
+
renderMailEnvFiles,
|
|
29
33
|
renderMediaConfig,
|
|
30
34
|
renderNotificationsConfig,
|
|
31
35
|
renderNotificationsMigration,
|
|
@@ -41,6 +45,7 @@ import {
|
|
|
41
45
|
renderSecurityConfig,
|
|
42
46
|
renderSessionConfig,
|
|
43
47
|
renderStorageConfig,
|
|
48
|
+
renderVSCodeSettings,
|
|
44
49
|
resolveBroadcastConfigTargetPath,
|
|
45
50
|
resolveDefaultDatabaseUrl,
|
|
46
51
|
resolvePackageManagerVersion,
|
|
@@ -50,17 +55,18 @@ import {
|
|
|
50
55
|
upsertCachePackageDependencies,
|
|
51
56
|
upsertEventsPackageDependency,
|
|
52
57
|
upsertMailPackageDependency,
|
|
58
|
+
upsertMediaPackageDependency,
|
|
53
59
|
upsertNotificationsPackageDependency,
|
|
54
60
|
upsertSecurityPackageDependency
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import "./chunk-
|
|
57
|
-
import "./chunk-
|
|
61
|
+
} from "./chunk-VCEO6N5T.mjs";
|
|
62
|
+
import "./chunk-5BLEC66P.mjs";
|
|
63
|
+
import "./chunk-MXKNQACM.mjs";
|
|
58
64
|
import {
|
|
59
65
|
isSupportedCacheInstallerDriver,
|
|
60
66
|
isSupportedQueueInstallerDriver,
|
|
61
67
|
normalizeScaffoldOptionalPackages,
|
|
62
68
|
sanitizePackageName
|
|
63
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-R6BWRY3E.mjs";
|
|
64
70
|
export {
|
|
65
71
|
authFeaturesRequireConfigUpdate,
|
|
66
72
|
detectAuthInstallFeaturesFromConfig,
|
|
@@ -74,6 +80,7 @@ export {
|
|
|
74
80
|
installCacheIntoProject,
|
|
75
81
|
installEventsIntoProject,
|
|
76
82
|
installMailIntoProject,
|
|
83
|
+
installMediaIntoProject,
|
|
77
84
|
installNotificationsIntoProject,
|
|
78
85
|
installQueueIntoProject,
|
|
79
86
|
installSecurityIntoProject,
|
|
@@ -81,16 +88,20 @@ export {
|
|
|
81
88
|
isSupportedQueueInstallerDriver,
|
|
82
89
|
normalizeScaffoldEnvSegments,
|
|
83
90
|
normalizeScaffoldOptionalPackages,
|
|
91
|
+
publishAuthNotificationsIntoProject,
|
|
84
92
|
renderAuthConfig,
|
|
85
93
|
renderAuthEnvFiles,
|
|
86
94
|
renderAuthMigration,
|
|
95
|
+
renderAuthProviderRouteFiles,
|
|
87
96
|
renderAuthUserModel,
|
|
88
97
|
renderCacheConfig,
|
|
89
98
|
renderCacheEnvFiles,
|
|
99
|
+
renderCorsConfig,
|
|
90
100
|
renderEnvFileContents,
|
|
91
101
|
renderFrameworkFiles,
|
|
92
102
|
renderFrameworkRunner,
|
|
93
103
|
renderMailConfig,
|
|
104
|
+
renderMailEnvFiles,
|
|
94
105
|
renderMediaConfig,
|
|
95
106
|
renderNotificationsConfig,
|
|
96
107
|
renderNotificationsMigration,
|
|
@@ -106,6 +117,7 @@ export {
|
|
|
106
117
|
renderSecurityConfig,
|
|
107
118
|
renderSessionConfig,
|
|
108
119
|
renderStorageConfig,
|
|
120
|
+
renderVSCodeSettings,
|
|
109
121
|
resolveBroadcastConfigTargetPath,
|
|
110
122
|
resolveDefaultDatabaseUrl,
|
|
111
123
|
resolvePackageManagerVersion,
|
|
@@ -116,6 +128,7 @@ export {
|
|
|
116
128
|
upsertCachePackageDependencies,
|
|
117
129
|
upsertEventsPackageDependency,
|
|
118
130
|
upsertMailPackageDependency,
|
|
131
|
+
upsertMediaPackageDependency,
|
|
119
132
|
upsertNotificationsPackageDependency,
|
|
120
133
|
upsertSecurityPackageDependency
|
|
121
134
|
};
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
writeLine
|
|
3
3
|
} from "./chunk-ZXDU7RHU.mjs";
|
|
4
4
|
import "./chunk-D7O4SU6N.mjs";
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-UZTDQKIY.mjs";
|
|
6
|
+
import "./chunk-VCEO6N5T.mjs";
|
|
7
|
+
import "./chunk-5BLEC66P.mjs";
|
|
8
|
+
import "./chunk-MXKNQACM.mjs";
|
|
9
9
|
import {
|
|
10
10
|
resolveProjectPackageImportSpecifier
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-R6BWRY3E.mjs";
|
|
12
12
|
|
|
13
13
|
// src/security.ts
|
|
14
14
|
import { loadConfigDirectory } from "@holo-js/config";
|
|
@@ -58,8 +58,11 @@ async function runRateLimitClearCommand(io, projectRoot, options, dependencies =
|
|
|
58
58
|
const count = typeof cleared === "boolean" ? cleared ? 1 : 0 : cleared;
|
|
59
59
|
writeLine(io.stdout, `[security] Cleared ${count} rate-limit bucket(s).`);
|
|
60
60
|
} finally {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
try {
|
|
62
|
+
await redisAdapter?.close();
|
|
63
|
+
} finally {
|
|
64
|
+
securityModule.resetSecurityRuntime();
|
|
65
|
+
}
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holo-js/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Holo-JS Framework - project creation, discovery, and operational CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,26 +20,27 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
|
-
"build": "tsup",
|
|
24
|
-
"stub": "tsup --watch",
|
|
23
|
+
"build": "node ../../scripts/generate-cli-workspace-catalog.mjs && tsup",
|
|
24
|
+
"stub": "node ../../scripts/generate-cli-workspace-catalog.mjs && tsup --watch",
|
|
25
25
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
26
|
-
"test": "vitest --run",
|
|
26
|
+
"test": "vitest --run && HOLO_CLI_INCLUDE_INTEGRATION=1 vitest --run tests/cli.test.ts",
|
|
27
27
|
"test:integration": "HOLO_CLI_INCLUDE_INTEGRATION=1 vitest --run tests/cli.test.ts"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@holo-js/config": "^0.1.
|
|
31
|
-
"@holo-js/core": "^0.1.
|
|
32
|
-
"@holo-js/db": "^0.1.
|
|
33
|
-
"esbuild": "^0.27.4"
|
|
30
|
+
"@holo-js/config": "^0.1.5",
|
|
31
|
+
"@holo-js/core": "^0.1.5",
|
|
32
|
+
"@holo-js/db": "^0.1.5",
|
|
33
|
+
"esbuild": "^0.27.4",
|
|
34
|
+
"inflection": "^3.0.2"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@holo-js/events": "^0.1.
|
|
37
|
-
"@holo-js/queue": "^0.1.
|
|
38
|
-
"@holo-js/queue-db": "^0.1.
|
|
37
|
+
"@holo-js/events": "^0.1.5",
|
|
38
|
+
"@holo-js/queue": "^0.1.5",
|
|
39
|
+
"@holo-js/queue-db": "^0.1.5",
|
|
39
40
|
"@types/node": "^22.10.2",
|
|
40
41
|
"tsup": "^8.3.5",
|
|
41
42
|
"typescript": "^5.7.2",
|
|
42
|
-
"vitest": "^
|
|
43
|
+
"vitest": "^4.1.5"
|
|
43
44
|
},
|
|
44
45
|
"engines": {
|
|
45
46
|
"node": ">=20.11.0"
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
writeLine
|
|
4
|
-
} from "./chunk-SRWJU3A5.mjs";
|
|
5
|
-
import "./chunk-BWW5TDFI.mjs";
|
|
6
|
-
import {
|
|
7
|
-
prepareProjectDiscovery
|
|
8
|
-
} from "./chunk-VT5IDQG6.mjs";
|
|
9
|
-
import "./chunk-QFUSWV3J.mjs";
|
|
10
|
-
import {
|
|
11
|
-
loadProjectConfig
|
|
12
|
-
} from "./chunk-ET7UXHHQ.mjs";
|
|
13
|
-
import {
|
|
14
|
-
loadGeneratedProjectRegistry
|
|
15
|
-
} from "./chunk-3OTCSFDG.mjs";
|
|
16
|
-
import {
|
|
17
|
-
importProjectModule,
|
|
18
|
-
resolveProjectPackageImportSpecifier
|
|
19
|
-
} from "./chunk-66FHW725.mjs";
|
|
20
|
-
|
|
21
|
-
// src/broadcast.ts
|
|
22
|
-
import { basename, extname } from "path";
|
|
23
|
-
import { loadConfigDirectory } from "@holo-js/config";
|
|
24
|
-
function hasLoadedRedisConfigSection(loadedFiles) {
|
|
25
|
-
return Array.isArray(loadedFiles) && loadedFiles.some((filePath) => {
|
|
26
|
-
return basename(filePath, extname(filePath)) === "redis";
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
async function loadBroadcastCliModule(projectRoot) {
|
|
30
|
-
try {
|
|
31
|
-
return await import(resolveProjectPackageImportSpecifier(projectRoot, "@holo-js/broadcast"));
|
|
32
|
-
} catch (error) {
|
|
33
|
-
const details = error instanceof Error ? error.message : String(error);
|
|
34
|
-
throw new Error(
|
|
35
|
-
`Unable to load @holo-js/broadcast from ${projectRoot}. Install it with "holo install broadcast". ${details}`
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async function runBroadcastWorkCommand(io, projectRoot, dependencies = {}) {
|
|
40
|
-
const loadConfig = dependencies.loadConfig ?? loadConfigDirectory;
|
|
41
|
-
const loadModule = dependencies.loadModule ?? loadBroadcastCliModule;
|
|
42
|
-
const config = await loadConfig(projectRoot);
|
|
43
|
-
const project = await loadProjectConfig(projectRoot);
|
|
44
|
-
const loadRegistry = dependencies.loadRegistry ?? loadGeneratedProjectRegistry;
|
|
45
|
-
await loadRegistry(projectRoot).catch(() => void 0);
|
|
46
|
-
const registry = await prepareProjectDiscovery(projectRoot, project.config);
|
|
47
|
-
const broadcastModule = await loadModule(projectRoot);
|
|
48
|
-
const worker = await broadcastModule.startBroadcastWorker({
|
|
49
|
-
config: config.broadcast,
|
|
50
|
-
queue: config.queue,
|
|
51
|
-
...hasLoadedRedisConfigSection(config.loadedFiles) ? { redis: config.redis } : {},
|
|
52
|
-
...registry ? {
|
|
53
|
-
channelAuth: {
|
|
54
|
-
registry: {
|
|
55
|
-
projectRoot,
|
|
56
|
-
channels: registry.channels
|
|
57
|
-
},
|
|
58
|
-
importModule: async (absolutePath) => await importProjectModule(projectRoot, absolutePath)
|
|
59
|
-
}
|
|
60
|
-
} : {}
|
|
61
|
-
});
|
|
62
|
-
writeLine(io.stdout, `[broadcast] Worker listening on ${worker.host}:${worker.port}`);
|
|
63
|
-
await new Promise((resolvePromise) => {
|
|
64
|
-
let stopped = false;
|
|
65
|
-
const stop = async () => {
|
|
66
|
-
if (stopped) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
stopped = true;
|
|
70
|
-
process.off("SIGINT", onSignal);
|
|
71
|
-
process.off("SIGTERM", onSignal);
|
|
72
|
-
await worker.stop();
|
|
73
|
-
resolvePromise();
|
|
74
|
-
};
|
|
75
|
-
const onSignal = () => {
|
|
76
|
-
void stop();
|
|
77
|
-
};
|
|
78
|
-
process.on("SIGINT", onSignal);
|
|
79
|
-
process.on("SIGTERM", onSignal);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
export {
|
|
83
|
-
loadBroadcastCliModule,
|
|
84
|
-
runBroadcastWorkCommand
|
|
85
|
-
};
|
package/dist/cache-OWQY4E7W.mjs
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
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-QFUSWV3J.mjs";
|
|
8
|
-
import "./chunk-ET7UXHHQ.mjs";
|
|
9
|
-
import "./chunk-3OTCSFDG.mjs";
|
|
10
|
-
import {
|
|
11
|
-
resolveProjectPackageImportSpecifier
|
|
12
|
-
} from "./chunk-66FHW725.mjs";
|
|
13
|
-
|
|
14
|
-
// src/cache.ts
|
|
15
|
-
import { loadConfigDirectory } from "@holo-js/config";
|
|
16
|
-
function resolveCacheFacade(cacheModule) {
|
|
17
|
-
const candidate = cacheModule.default;
|
|
18
|
-
if (candidate) {
|
|
19
|
-
return candidate;
|
|
20
|
-
}
|
|
21
|
-
return cacheModule;
|
|
22
|
-
}
|
|
23
|
-
async function loadCacheCliModule(projectRoot) {
|
|
24
|
-
return await import(resolveProjectPackageImportSpecifier(projectRoot, "@holo-js/cache"));
|
|
25
|
-
}
|
|
26
|
-
async function initializeCacheMaintenanceEnvironment(projectRoot) {
|
|
27
|
-
const loadedConfig = await loadConfigDirectory(projectRoot);
|
|
28
|
-
const cacheModule = await loadCacheCliModule(projectRoot);
|
|
29
|
-
const cache = resolveCacheFacade(cacheModule);
|
|
30
|
-
cache.configureCacheRuntime({
|
|
31
|
-
config: loadedConfig.cache,
|
|
32
|
-
databaseConfig: loadedConfig.database,
|
|
33
|
-
redisConfig: loadedConfig.redis
|
|
34
|
-
});
|
|
35
|
-
return {
|
|
36
|
-
cache,
|
|
37
|
-
async cleanup() {
|
|
38
|
-
cache.resetCacheRuntime();
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
async function runCacheClearCommand(io, projectRoot, driverName, dependencies = {}) {
|
|
43
|
-
const environment = await (dependencies.initializeCache ?? initializeCacheMaintenanceEnvironment)(projectRoot);
|
|
44
|
-
try {
|
|
45
|
-
const repository = driverName?.trim() ? environment.cache.driver(driverName) : environment.cache;
|
|
46
|
-
await (dependencies.flush ?? (async (target) => await target.flush()))(repository);
|
|
47
|
-
writeLine(io.stdout, driverName?.trim() ? `[cache] Cleared cache store "${driverName}".` : "[cache] Cleared the default cache store.");
|
|
48
|
-
} finally {
|
|
49
|
-
await environment.cleanup();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async function runCacheForgetCommand(io, projectRoot, key, driverName, dependencies = {}) {
|
|
53
|
-
const environment = await (dependencies.initializeCache ?? initializeCacheMaintenanceEnvironment)(projectRoot);
|
|
54
|
-
try {
|
|
55
|
-
const repository = driverName?.trim() ? environment.cache.driver(driverName) : environment.cache;
|
|
56
|
-
const forgotten = await (dependencies.forget ?? (async (target, targetKey) => await target.forget(targetKey)))(repository, key);
|
|
57
|
-
writeLine(io.stdout, forgotten ? `[cache] Forgot key "${key}".` : `[cache] Key "${key}" was not present.`);
|
|
58
|
-
} finally {
|
|
59
|
-
await environment.cleanup();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
export {
|
|
63
|
-
initializeCacheMaintenanceEnvironment,
|
|
64
|
-
loadCacheCliModule,
|
|
65
|
-
runCacheClearCommand,
|
|
66
|
-
runCacheForgetCommand
|
|
67
|
-
};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
getRegistryMigrationSlug,
|
|
4
|
-
hasRegisteredCreateTableMigration,
|
|
5
|
-
hasRegisteredMigrationSlug,
|
|
6
|
-
nextMigrationTemplate
|
|
7
|
-
} from "./chunk-ICJR7TS4.mjs";
|
|
8
|
-
import {
|
|
9
|
-
writeLine
|
|
10
|
-
} from "./chunk-SRWJU3A5.mjs";
|
|
11
|
-
import "./chunk-M7J3YTHR.mjs";
|
|
12
|
-
import {
|
|
13
|
-
runProjectPrepare
|
|
14
|
-
} from "./chunk-DMH2B4UQ.mjs";
|
|
15
|
-
import "./chunk-D4GG556Y.mjs";
|
|
16
|
-
import "./chunk-BWW5TDFI.mjs";
|
|
17
|
-
import {
|
|
18
|
-
prepareProjectDiscovery
|
|
19
|
-
} from "./chunk-VT5IDQG6.mjs";
|
|
20
|
-
import "./chunk-QFUSWV3J.mjs";
|
|
21
|
-
import {
|
|
22
|
-
ensureProjectConfig
|
|
23
|
-
} from "./chunk-ET7UXHHQ.mjs";
|
|
24
|
-
import {
|
|
25
|
-
loadGeneratedProjectRegistry
|
|
26
|
-
} from "./chunk-3OTCSFDG.mjs";
|
|
27
|
-
import {
|
|
28
|
-
makeProjectRelativePath,
|
|
29
|
-
resolveDefaultArtifactPath,
|
|
30
|
-
writeTextFile
|
|
31
|
-
} from "./chunk-66FHW725.mjs";
|
|
32
|
-
|
|
33
|
-
// src/cache-migrations.ts
|
|
34
|
-
import { resolve } from "path";
|
|
35
|
-
import { loadConfigDirectory } from "@holo-js/config";
|
|
36
|
-
import { normalizeMigrationSlug } from "@holo-js/db";
|
|
37
|
-
var DEFAULT_CACHE_DATABASE_TABLE = "cache";
|
|
38
|
-
var DEFAULT_CACHE_DATABASE_LOCK_TABLE = "cache_locks";
|
|
39
|
-
async function loadCacheConfig(projectRoot) {
|
|
40
|
-
const loadedConfig = await loadConfigDirectory(projectRoot);
|
|
41
|
-
if (!loadedConfig || typeof loadedConfig !== "object" || !("cache" in loadedConfig) || !loadedConfig.cache || typeof loadedConfig.cache !== "object" || !("drivers" in loadedConfig.cache) || typeof loadedConfig.cache.drivers !== "object" || loadedConfig.cache.drivers === null || Array.isArray(loadedConfig.cache.drivers)) {
|
|
42
|
-
throw new Error("Cache config is missing or malformed. Expected a cache config object with a drivers property.");
|
|
43
|
-
}
|
|
44
|
-
const cacheConfig = loadedConfig.cache;
|
|
45
|
-
for (const [driverName, driverConfig] of Object.entries(cacheConfig.drivers)) {
|
|
46
|
-
if (driverConfig.driver !== "database") {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
const databaseDriver = driverConfig;
|
|
50
|
-
if (typeof databaseDriver.table !== "string" || !databaseDriver.table.trim() || typeof databaseDriver.lockTable !== "string" || !databaseDriver.lockTable.trim()) {
|
|
51
|
-
throw new Error(`Database cache driver "${driverName}" must define non-empty "table" and "lockTable" strings.`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return cacheConfig;
|
|
55
|
-
}
|
|
56
|
-
function normalizeCacheMigrationName(tableName) {
|
|
57
|
-
return normalizeMigrationSlug(`create_${tableName.replaceAll(".", "_")}_cache_table`);
|
|
58
|
-
}
|
|
59
|
-
function escapeSingleQuotedString(value) {
|
|
60
|
-
return value.replaceAll("\\", "\\\\").replaceAll("'", "\\'");
|
|
61
|
-
}
|
|
62
|
-
function renderCacheTableMigration(tableName = DEFAULT_CACHE_DATABASE_TABLE, lockTableName = DEFAULT_CACHE_DATABASE_LOCK_TABLE) {
|
|
63
|
-
const escapedTableName = escapeSingleQuotedString(tableName);
|
|
64
|
-
const escapedLockTableName = escapeSingleQuotedString(lockTableName);
|
|
65
|
-
const escapedTableIndexName = escapeSingleQuotedString(`${tableName.replaceAll(".", "_")}_expires_at_index`);
|
|
66
|
-
const escapedLockTableIndexName = escapeSingleQuotedString(`${lockTableName.replaceAll(".", "_")}_expires_at_index`);
|
|
67
|
-
return [
|
|
68
|
-
"import { defineMigration, type MigrationContext } from '@holo-js/db'",
|
|
69
|
-
"",
|
|
70
|
-
"export default defineMigration({",
|
|
71
|
-
" async up({ schema }: MigrationContext) {",
|
|
72
|
-
` await schema.createTable('${escapedTableName}', (table) => {`,
|
|
73
|
-
" table.string('key').primaryKey()",
|
|
74
|
-
" table.text('payload')",
|
|
75
|
-
" table.bigInteger('expires_at').nullable()",
|
|
76
|
-
` table.index(['expires_at'], '${escapedTableIndexName}')`,
|
|
77
|
-
" })",
|
|
78
|
-
` await schema.createTable('${escapedLockTableName}', (table) => {`,
|
|
79
|
-
" table.string('name').primaryKey()",
|
|
80
|
-
" table.string('owner')",
|
|
81
|
-
" table.bigInteger('expires_at')",
|
|
82
|
-
` table.index(['expires_at'], '${escapedLockTableIndexName}')`,
|
|
83
|
-
" })",
|
|
84
|
-
" },",
|
|
85
|
-
" async down({ schema }: MigrationContext) {",
|
|
86
|
-
` await schema.dropTable('${escapedLockTableName}')`,
|
|
87
|
-
` await schema.dropTable('${escapedTableName}')`,
|
|
88
|
-
" },",
|
|
89
|
-
"})",
|
|
90
|
-
""
|
|
91
|
-
].join("\n");
|
|
92
|
-
}
|
|
93
|
-
function resolveDatabaseCacheTables(cacheConfig) {
|
|
94
|
-
const configured = Object.values(cacheConfig.drivers).filter((driver) => driver.driver === "database").map((driver) => ({
|
|
95
|
-
table: driver.table,
|
|
96
|
-
lockTable: driver.lockTable
|
|
97
|
-
}));
|
|
98
|
-
if (configured.length === 0) {
|
|
99
|
-
throw new Error("The configured cache drivers do not use the database driver.");
|
|
100
|
-
}
|
|
101
|
-
return Object.freeze(configured);
|
|
102
|
-
}
|
|
103
|
-
async function runCacheTableCommand(io, projectRoot) {
|
|
104
|
-
const project = await ensureProjectConfig(projectRoot);
|
|
105
|
-
const registry = await loadGeneratedProjectRegistry(projectRoot) ?? await prepareProjectDiscovery(projectRoot, project.config);
|
|
106
|
-
const cacheConfig = await loadCacheConfig(projectRoot);
|
|
107
|
-
const migrationsDir = resolve(projectRoot, project.config.paths.migrations);
|
|
108
|
-
const createdFiles = [];
|
|
109
|
-
const resolvedTables = resolveDatabaseCacheTables(cacheConfig);
|
|
110
|
-
const seenTables = /* @__PURE__ */ new Set();
|
|
111
|
-
const seenLockTables = /* @__PURE__ */ new Set();
|
|
112
|
-
const seenSlugs = /* @__PURE__ */ new Map();
|
|
113
|
-
for (const { table, lockTable } of resolvedTables) {
|
|
114
|
-
const migrationName = normalizeCacheMigrationName(table);
|
|
115
|
-
const previousTable = seenSlugs.get(migrationName);
|
|
116
|
-
if (seenTables.has(table) || seenLockTables.has(lockTable) || previousTable && previousTable !== table) {
|
|
117
|
-
throw new Error(`A migration for cache tables "${table}" and "${lockTable}" already exists.`);
|
|
118
|
-
}
|
|
119
|
-
seenTables.add(table);
|
|
120
|
-
seenLockTables.add(lockTable);
|
|
121
|
-
seenSlugs.set(migrationName, table);
|
|
122
|
-
}
|
|
123
|
-
for (const { table, lockTable } of resolvedTables) {
|
|
124
|
-
const migrationName = normalizeCacheMigrationName(table);
|
|
125
|
-
if (hasRegisteredMigrationSlug(registry, migrationName) || hasRegisteredCreateTableMigration(registry, table) || hasRegisteredCreateTableMigration(registry, lockTable)) {
|
|
126
|
-
throw new Error(`A migration for cache tables "${table}" and "${lockTable}" already exists.`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
for (const { table, lockTable } of resolvedTables) {
|
|
130
|
-
const migrationTemplate = await nextMigrationTemplate(normalizeCacheMigrationName(table), migrationsDir);
|
|
131
|
-
const migrationFilePath = resolveDefaultArtifactPath(projectRoot, project.config.paths.migrations, migrationTemplate.fileName);
|
|
132
|
-
await writeTextFile(migrationFilePath, renderCacheTableMigration(table, lockTable));
|
|
133
|
-
createdFiles.push(migrationFilePath);
|
|
134
|
-
}
|
|
135
|
-
await runProjectPrepare(projectRoot);
|
|
136
|
-
for (const filePath of createdFiles) {
|
|
137
|
-
writeLine(io.stdout, `Created migration: ${makeProjectRelativePath(projectRoot, filePath)}`);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
var cacheMigrationInternals = {
|
|
141
|
-
getRegistryMigrationSlug,
|
|
142
|
-
hasRegisteredMigrationSlug,
|
|
143
|
-
hasRegisteredCreateTableMigration,
|
|
144
|
-
nextMigrationTemplate
|
|
145
|
-
};
|
|
146
|
-
export {
|
|
147
|
-
DEFAULT_CACHE_DATABASE_LOCK_TABLE,
|
|
148
|
-
DEFAULT_CACHE_DATABASE_TABLE,
|
|
149
|
-
cacheMigrationInternals,
|
|
150
|
-
loadCacheConfig,
|
|
151
|
-
normalizeCacheMigrationName,
|
|
152
|
-
renderCacheTableMigration,
|
|
153
|
-
resolveDatabaseCacheTables,
|
|
154
|
-
runCacheTableCommand
|
|
155
|
-
};
|
package/dist/chunk-BWW5TDFI.mjs
DELETED
package/dist/chunk-D4GG556Y.mjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
readTextFile
|
|
4
|
-
} from "./chunk-66FHW725.mjs";
|
|
5
|
-
|
|
6
|
-
// src/package-json.ts
|
|
7
|
-
import { join } from "path";
|
|
8
|
-
async function hasProjectDependency(projectRoot, packageName) {
|
|
9
|
-
const packageJson = await readTextFile(join(projectRoot, "package.json"));
|
|
10
|
-
if (!packageJson) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
const parsed = JSON.parse(packageJson);
|
|
15
|
-
return typeof parsed.dependencies?.[packageName] === "string" || typeof parsed.devDependencies?.[packageName] === "string";
|
|
16
|
-
} catch {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
hasProjectDependency
|
|
23
|
-
};
|