streamby-core 0.16.1 → 0.16.3

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,5 @@
1
+ /**
2
+ * Executes `prisma db push` programmatically to sync the schema with the database.
3
+ * Ensures the command is only run once per application lifecycle.
4
+ */
5
+ export declare function pushPrismaSchema(): void;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.pushPrismaSchema = pushPrismaSchema;
7
+ const child_process_1 = require("child_process");
8
+ const path_1 = __importDefault(require("path"));
9
+ let schemaPushed = false;
10
+ /**
11
+ * Executes `prisma db push` programmatically to sync the schema with the database.
12
+ * Ensures the command is only run once per application lifecycle.
13
+ */
14
+ function pushPrismaSchema() {
15
+ if (schemaPushed) {
16
+ console.log('[StreamBy] Prisma schema has already been pushed. Skipping.');
17
+ return;
18
+ }
19
+ try {
20
+ // Resolve the path to the schema.prisma file relative to the compiled JS file.
21
+ // __dirname will be /path/to/your/project/node_modules/streamby-core/dist/utils
22
+ const schemaPath = path_1.default.resolve(__dirname, '..', '..', 'prisma', 'schema.prisma');
23
+ console.log(`[StreamBy] Locating Prisma schema at: ${schemaPath}`);
24
+ console.log('[StreamBy] Pushing Prisma schema to the database...');
25
+ const command = `npx prisma db push --schema="${schemaPath}"`;
26
+ (0, child_process_1.execSync)(command, { stdio: 'inherit' });
27
+ console.log('[StreamBy] Prisma schema pushed successfully.');
28
+ schemaPushed = true;
29
+ }
30
+ catch (error) {
31
+ console.error('[StreamBy] Failed to push Prisma schema:', error);
32
+ // Optional: decide if the application should exit on failure
33
+ // process.exit(1);
34
+ }
35
+ }
package/package.json CHANGED
@@ -1,56 +1,56 @@
1
- {
2
- "name": "streamby-core",
3
- "version": "0.16.1",
4
- "description": "StreamBy middleware framework for media storage management",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": [
8
- "dist"
9
- ],
10
- "scripts": {
11
- "build": "tsc",
12
- "test": "vitest",
13
- "dev": "ts-node-dev --respawn --clear dev.ts",
14
- "prepublishOnly": "npm run build"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "https://github.com/GwerhDev/StreamBy-Package.git"
19
- },
20
- "keywords": [
21
- "streamby",
22
- "middleware",
23
- "upload",
24
- "storage",
25
- "s3",
26
- "express",
27
- "typescript"
28
- ],
29
- "author": "TerminalCore Labs",
30
- "license": "MIT",
31
- "dependencies": {
32
- "@aws-sdk/client-s3": "^3.528.0",
33
- "@aws-sdk/s3-request-presigner": "^3.787.0",
34
- "@prisma/client": "^6.12.0",
35
- "bcrypt": "^5.1.1",
36
- "dotenv": "^16.5.0",
37
- "express": "^4.0.0",
38
- "mongoose": "^8.13.2",
39
- "prisma": "^6.12.0"
40
- },
41
- "devDependencies": {
42
- "@types/bcrypt": "^5.0.2",
43
- "@types/cors": "^2.8.18",
44
- "@types/express": "^4.17.17",
45
- "@types/node": "^22.15.21",
46
- "@types/supertest": "^6.0.3",
47
- "cors": "^2.8.5",
48
- "supertest": "^7.1.0",
49
- "ts-node-dev": "^2.0.0",
50
- "typescript": "^5.8.3",
51
- "vitest": "^3.1.1"
52
- },
53
- "peerDependencies": {
54
- "express": "^4.0.0"
55
- }
56
- }
1
+ {
2
+ "name": "streamby-core",
3
+ "version": "0.16.3",
4
+ "description": "StreamBy middleware framework for media storage management",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "test": "vitest",
13
+ "dev": "ts-node-dev --respawn --clear dev.ts",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/GwerhDev/StreamBy-Package.git"
19
+ },
20
+ "keywords": [
21
+ "streamby",
22
+ "middleware",
23
+ "upload",
24
+ "storage",
25
+ "s3",
26
+ "express",
27
+ "typescript"
28
+ ],
29
+ "author": "TerminalCore Labs",
30
+ "license": "MIT",
31
+ "dependencies": {
32
+ "@aws-sdk/client-s3": "^3.528.0",
33
+ "@aws-sdk/s3-request-presigner": "^3.787.0",
34
+ "@prisma/client": "^6.12.0",
35
+ "bcrypt": "^5.1.1",
36
+ "dotenv": "^16.5.0",
37
+ "express": "^4.0.0",
38
+ "mongoose": "^8.13.2",
39
+ "prisma": "^6.12.0"
40
+ },
41
+ "devDependencies": {
42
+ "@types/bcrypt": "^5.0.2",
43
+ "@types/cors": "^2.8.18",
44
+ "@types/express": "^4.17.17",
45
+ "@types/node": "^22.15.21",
46
+ "@types/supertest": "^6.0.3",
47
+ "cors": "^2.8.5",
48
+ "supertest": "^7.1.0",
49
+ "ts-node-dev": "^2.0.0",
50
+ "typescript": "^5.8.3",
51
+ "vitest": "^3.1.1"
52
+ },
53
+ "peerDependencies": {
54
+ "express": "^4.0.0"
55
+ }
56
+ }