@holo-js/cli 0.1.2 → 0.1.4
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-CSSARTSA.mjs +84 -0
- package/dist/broadcast-YSIJCL3R.mjs +85 -0
- package/dist/cache-4G6QGIZO.mjs +66 -0
- package/dist/cache-OWQY4E7W.mjs +67 -0
- package/dist/cache-migrations-NATT5WPQ.mjs +154 -0
- package/dist/cache-migrations-RVEA6CEU.mjs +155 -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-DMH2B4UQ.mjs +343 -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-ICJR7TS4.mjs +66 -0
- package/dist/chunk-JX2ZH6XY.mjs +270 -0
- package/dist/chunk-M7J3YTHR.mjs +26 -0
- package/dist/chunk-MZXN2YMI.mjs +3236 -0
- package/dist/chunk-Q5F6C2D4.mjs +65 -0
- package/dist/chunk-QFUSWV3J.mjs +3237 -0
- package/dist/chunk-QYLSMF7V.mjs +539 -0
- package/dist/chunk-S7P7EBM3.mjs +787 -0
- package/dist/chunk-SRWJU3A5.mjs +11 -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-ZLRO7HXY.mjs +342 -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-KQFT7RHR.mjs +43 -0
- package/dist/dev-LZ3O2E3U.mjs +42 -0
- package/dist/discovery-GBLAUTXS.mjs +28 -0
- package/dist/discovery-R733D2PO.mjs +29 -0
- package/dist/generators-DSN4GWJI.mjs +425 -0
- package/dist/generators-WX45BI4U.mjs +426 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +536 -4618
- package/dist/queue-6OG7VJ34.mjs +626 -0
- package/dist/queue-FV35LLPR.mjs +625 -0
- package/dist/queue-migrations-NK2EYX3J.mjs +163 -0
- package/dist/queue-migrations-SSIYKK5S.mjs +162 -0
- package/dist/runtime-4BV3JODY.mjs +56 -0
- package/dist/runtime-ANBO7VQM.mjs +33 -0
- package/dist/runtime-EFZ5H5IL.mjs +55 -0
- package/dist/runtime-OOSJ5JBY.mjs +32 -0
- package/dist/scaffold-7OTDH4UR.mjs +121 -0
- package/dist/scaffold-DRKBGS2K.mjs +120 -0
- package/dist/security-ATKDC26E.mjs +68 -0
- package/dist/security-R7VH6W5H.mjs +69 -0
- package/package.json +12 -11
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fileExists
|
|
3
|
+
} from "./chunk-EUIVXVJL.mjs";
|
|
4
|
+
|
|
5
|
+
// src/migrations.ts
|
|
6
|
+
import { join } from "path";
|
|
7
|
+
import {
|
|
8
|
+
generateMigrationTemplate,
|
|
9
|
+
inferMigrationTableName,
|
|
10
|
+
inferMigrationTemplateKind,
|
|
11
|
+
normalizeMigrationSlug
|
|
12
|
+
} from "@holo-js/db";
|
|
13
|
+
var MIGRATION_NAME_PREFIX_PATTERN = /^\d{4}_\d{2}_\d{2}_\d{6}_/;
|
|
14
|
+
function stripMigrationNamePrefix(name) {
|
|
15
|
+
return name.replace(MIGRATION_NAME_PREFIX_PATTERN, "");
|
|
16
|
+
}
|
|
17
|
+
function getRegistryMigrationSlug(name) {
|
|
18
|
+
return normalizeMigrationSlug(stripMigrationNamePrefix(name));
|
|
19
|
+
}
|
|
20
|
+
function hasRegisteredMigrationSlug(registry, migrationSlug) {
|
|
21
|
+
return Boolean(registry?.migrations.some((entry) => {
|
|
22
|
+
try {
|
|
23
|
+
return getRegistryMigrationSlug(entry.name) === migrationSlug;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
function hasRegisteredCreateTableMigration(registry, tableName) {
|
|
30
|
+
const expectedSlug = `create_${tableName}_table`;
|
|
31
|
+
return Boolean(registry?.migrations.some((entry) => {
|
|
32
|
+
try {
|
|
33
|
+
const slug = getRegistryMigrationSlug(entry.name);
|
|
34
|
+
if (slug === expectedSlug) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (inferMigrationTemplateKind(slug) !== "create_table") {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return inferMigrationTableName(slug, "create_table") === tableName;
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
async function nextMigrationTemplate(name, migrationsDir, options = {}) {
|
|
47
|
+
let offsetSeconds = 0;
|
|
48
|
+
while (true) {
|
|
49
|
+
const candidate = generateMigrationTemplate(name, {
|
|
50
|
+
date: new Date(Date.now() + offsetSeconds * 1e3),
|
|
51
|
+
...options
|
|
52
|
+
});
|
|
53
|
+
if (!await fileExists(join(migrationsDir, candidate.fileName))) {
|
|
54
|
+
return candidate;
|
|
55
|
+
}
|
|
56
|
+
offsetSeconds += 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
getRegistryMigrationSlug,
|
|
62
|
+
hasRegisteredMigrationSlug,
|
|
63
|
+
hasRegisteredCreateTableMigration,
|
|
64
|
+
nextMigrationTemplate
|
|
65
|
+
};
|