@socialgouv/matomo-postgres 2.2.3 → 2.2.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.
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { readdir, readFile } from 'fs/promises';
|
|
11
|
+
import { join } from 'path';
|
|
12
|
+
describe('Migration Import Validation', () => {
|
|
13
|
+
it('should not have src/ imports in migration files', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
const migrationsDir = join(__dirname, '../migrations');
|
|
15
|
+
const migrationFiles = yield readdir(migrationsDir);
|
|
16
|
+
const tsFiles = migrationFiles.filter((file) => file.endsWith('.ts'));
|
|
17
|
+
const problematicFiles = [];
|
|
18
|
+
for (const file of tsFiles) {
|
|
19
|
+
const filePath = join(migrationsDir, file);
|
|
20
|
+
const content = yield readFile(filePath, 'utf-8');
|
|
21
|
+
// Check for imports from 'src/' paths
|
|
22
|
+
const srcImportRegex = /(?:import\s+[^;]+from\s+['"]src\/|require\s*\(\s*['"]src\/)/g;
|
|
23
|
+
const matches = content.match(srcImportRegex);
|
|
24
|
+
if (matches) {
|
|
25
|
+
problematicFiles.push(`${file}: ${matches.join(', ')}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (problematicFiles.length > 0) {
|
|
29
|
+
fail(`Migration files contain problematic src/ imports that will fail in production:\n${problematicFiles.join('\n')}\n\nMigration files should use direct constants or relative imports instead.`);
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
it('should have at least one migration file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
const migrationsDir = join(__dirname, '../migrations');
|
|
34
|
+
const migrationFiles = yield readdir(migrationsDir);
|
|
35
|
+
const tsFiles = migrationFiles.filter((file) => file.endsWith('.ts'));
|
|
36
|
+
expect(tsFiles.length).toBeGreaterThan(0);
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { sql } from 'kysely';
|
|
11
|
-
import { PARTITIONED_MATOMO_TABLE_NAME } from '../config';
|
|
11
|
+
import { PARTITIONED_MATOMO_TABLE_NAME } from '../config.js';
|
|
12
12
|
export function up(db) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
// First, create the partitioned table structure as a partitioned table
|
package/package.json
CHANGED