procbay-schema 1.0.164 → 1.0.165
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/package.json +9 -2
- package/prisma/seeders/city.seed.js +2 -1
- package/prisma/seeders/country.seed.js +2 -1
- package/prisma/seeders/region.seed.js +2 -1
- package/prisma/seeders/state.seed.js +4 -6
- package/prisma/seeders/subregion.seed.js +2 -1
- package/src/create-prisma-client.js +1 -1
- package/src/generated/prisma/client.bundle.mjs +6715 -0
- package/src/prisma/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "procbay-schema",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.165",
|
|
4
4
|
"description": "A set of utilities for managing Prisma database schemas, seeding, and maintenance operations for the Procure-to-Pay system",
|
|
5
5
|
"main": "src/prisma/index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/prisma/index.js",
|
|
9
|
+
"./src/create-prisma-client.js": "./src/create-prisma-client.js",
|
|
10
|
+
"./prisma/seeders/seed.js": "./prisma/seeders/seed.js",
|
|
11
|
+
"./prisma/seeders/utils/seeder-config-mapper.js": "./prisma/seeders/utils/seeder-config-mapper.js"
|
|
12
|
+
},
|
|
7
13
|
"bin": {
|
|
8
14
|
"prisma-sync": "scripts/sync-schemas.js",
|
|
9
15
|
"prisma-seed": "scripts/seed-databases.js",
|
|
@@ -23,6 +29,7 @@
|
|
|
23
29
|
"LICENSE"
|
|
24
30
|
],
|
|
25
31
|
"devDependencies": {
|
|
32
|
+
"esbuild": "^0.25.0",
|
|
26
33
|
"@types/bcrypt": "^5.0.2",
|
|
27
34
|
"@types/jest": "^30.0.0",
|
|
28
35
|
"eslint": "^9.30.1",
|
|
@@ -47,7 +54,7 @@
|
|
|
47
54
|
"seed-database": "tsx scripts/seed-databases.js",
|
|
48
55
|
"truncate-tables": "tsx scripts/truncate-tables.js",
|
|
49
56
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
50
|
-
"prepare": "prisma generate",
|
|
57
|
+
"prepare": "prisma generate && node scripts/bundle-prisma-client.mjs",
|
|
51
58
|
"patch": "npm version patch && npm publish"
|
|
52
59
|
},
|
|
53
60
|
"keywords": [
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// tenant-config-patch: geographic seeders must throw on SQL errors
|
|
1
2
|
import { createPrismaClient } from "../../src/create-prisma-client.js";
|
|
2
3
|
import {
|
|
3
4
|
createProgressTracker,
|
|
@@ -65,7 +66,7 @@ async function processBatch(
|
|
|
65
66
|
error.message
|
|
66
67
|
);
|
|
67
68
|
tracker.update(batch.length);
|
|
68
|
-
|
|
69
|
+
throw error;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
// Wait before retry with exponential backoff
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// tenant-config-patch: geographic seeders must throw on SQL errors
|
|
1
2
|
import { createPrismaClient } from "../../src/create-prisma-client.js";
|
|
2
3
|
import { loadGeoData } from "./utils/json-loader.js";
|
|
3
4
|
import {
|
|
@@ -106,7 +107,7 @@ async function processBatchOptimized(
|
|
|
106
107
|
return { success: true, created: result.count };
|
|
107
108
|
} catch (error) {
|
|
108
109
|
logEntityError("country batch", "N/A", error.message);
|
|
109
|
-
|
|
110
|
+
throw error;
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// tenant-config-patch: geographic seeders must throw on SQL errors
|
|
1
2
|
import { createPrismaClient } from "../../src/create-prisma-client.js";
|
|
2
3
|
import fs from "fs";
|
|
3
4
|
import path from "path";
|
|
@@ -51,8 +52,8 @@ export async function seedRegions(prismaClient, seederManager = null) {
|
|
|
51
52
|
// Store the mapping between JSON ID and database ID
|
|
52
53
|
regionIdMap.set(jsonId, dbRegion.id);
|
|
53
54
|
} catch (error) {
|
|
54
|
-
// Log error but don't interrupt progress bar
|
|
55
55
|
logEntityError("regions", region.name, error.message);
|
|
56
|
+
throw error;
|
|
56
57
|
}
|
|
57
58
|
tracker.update();
|
|
58
59
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// tenant-config-patch: geographic seeders must throw on SQL errors
|
|
1
2
|
import { createPrismaClient } from "../../src/create-prisma-client.js";
|
|
2
3
|
import {
|
|
3
4
|
createProgressTracker,
|
|
@@ -61,7 +62,7 @@ async function processBatchOptimized(
|
|
|
61
62
|
} catch (error) {
|
|
62
63
|
logEntityError("state batch", "N/A", error.message);
|
|
63
64
|
tracker.update(batch.length);
|
|
64
|
-
|
|
65
|
+
throw error;
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
tracker.update(batch.length);
|
|
@@ -157,15 +158,12 @@ export async function seedStates(
|
|
|
157
158
|
// Execute batches and monitor memory
|
|
158
159
|
const results = await Promise.allSettled(batchPromises);
|
|
159
160
|
|
|
160
|
-
// Check for failed batches
|
|
161
161
|
const failedBatches = results.filter(
|
|
162
162
|
(result) => result.status === "rejected"
|
|
163
163
|
);
|
|
164
164
|
if (failedBatches.length > 0) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
console.error(`Batch ${index} error:`, result.reason);
|
|
168
|
-
});
|
|
165
|
+
const reason = failedBatches[0].reason;
|
|
166
|
+
throw reason instanceof Error ? reason : new Error(String(reason));
|
|
169
167
|
}
|
|
170
168
|
|
|
171
169
|
// Final memory cleanup
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// tenant-config-patch: geographic seeders must throw on SQL errors
|
|
1
2
|
import { createPrismaClient } from "../../src/create-prisma-client.js";
|
|
2
3
|
import {
|
|
3
4
|
createProgressTracker,
|
|
@@ -65,8 +66,8 @@ export async function seedSubregions(
|
|
|
65
66
|
// Store the mapping between JSON ID and database ID
|
|
66
67
|
subregionIdMap.set(jsonId, dbSubregion.id);
|
|
67
68
|
} catch (error) {
|
|
68
|
-
// Log error but don't interrupt progress bar
|
|
69
69
|
logEntityError("subregion", subregion.name, error.message);
|
|
70
|
+
throw error;
|
|
70
71
|
}
|
|
71
72
|
tracker.update();
|
|
72
73
|
}
|