prisma-client-php 4.0.0 → 4.0.2

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/init.js CHANGED
@@ -1 +1 @@
1
- import fs from"fs";import path from"path";import{execSync}from"child_process";import{getFileMeta}from"./utils.js";import chalk from"chalk";const{__dirname}=getFileMeta();let projectSettings=null;function checkExcludeFiles(e){return projectSettings?.excludeFilePath?.includes(e.replace(/\\/g,"/"))??!1}function copyRecursiveSync(e,s,n=e,i=!1){if(!fs.existsSync(e))return void console.error(`Source folder does not exist: ${e}`);fs.existsSync(s)||fs.mkdirSync(s,{recursive:!0});const o=fs.readdirSync(e,{withFileTypes:!0});for(const r of o){const o=path.join(e,r.name),c=path.join(s,r.name),t=path.relative(n,o),p=path.join(path.basename(n),t);if(checkExcludeFiles(c))return;const a=path.relative(__dirname,o),l=path.normalize("src/Lib/Validator.php");i&&a===l?console.log(`Skipping file: ${p}`):r.isDirectory()?copyRecursiveSync(o,c,n,i):(fs.copyFileSync(o,c),console.log(`Copied file: ${p}`))}}const directoriesToCopy=[{srcFolder:path.join(__dirname,"src"),destFolder:path.join(process.cwd(),"src")},{srcFolder:path.join(__dirname,"settings"),destFolder:path.join(process.cwd(),"settings")},{srcFolder:path.join(__dirname,"prisma"),destFolder:path.join(process.cwd(),"prisma")}];function installNpmDependencies(e){const s=process.cwd(),n=path.join(s,"package.json");let i;if(!fs.existsSync(n))return void console.error("package.json does not exist.");{const s=fs.readFileSync(n,"utf8");i=JSON.parse(s),e||(i.type="module"),fs.writeFileSync(n,JSON.stringify(i,null,2))}let o=[npmPkg("prisma"),npmPkg("@prisma/client"),npmPkg("@prisma/internals")];e||o.push(npmPkg("tsx"),npmPkg("typescript"),npmPkg("@types/node"));const r=o.join(" ");try{console.log(`Installing packages: ${r}`),execSync(`npm install --save-dev ${r}`,{stdio:"inherit",cwd:s}),e||execSync("npx tsc --init",{stdio:"inherit",cwd:s}),console.log("Packages installed successfully.")}catch(e){console.error("Error installing packages:",e)}}function initPrisma(){const e=process.cwd(),s=path.join(e,"prisma");if(fs.existsSync(s))console.warn("Prisma folder already exists. Skipping prisma init.");else try{console.log("Initializing Prisma..."),execSync("npx prisma init",{stdio:"inherit",cwd:e}),console.log("Prisma initialized successfully.")}catch(e){console.error("Error initializing Prisma:",e)}}async function installComposerDependencies(e){const s=process.cwd(),n=path.join(s,"composer.json");if(!fs.existsSync(n))return void console.error("composer.json does not exist.");let i=[composerPkg("calicastle/cuid")];if(e){const e=path.join(s,"prisma-php.json");if(fs.existsSync(e)){const n=readJsonFile(e);let i=[];n.excludeFiles?.map(e=>{const n=path.join(s,e);fs.existsSync(n)&&i.push(n.replace(/\\/g,"/"))}),projectSettings={...n,excludeFiles:n.excludeFiles??[],excludeFilePath:i??[]}}}else i.push(composerPkg("symfony/uid"),composerPkg("brick/math"),composerPkg("tsnc/prisma-php"));try{console.log("Installing Composer dependencies:"),i.forEach(e=>console.log(`- ${chalk.blue(e)}`));const e=`C:\\xampp\\php\\php.exe C:\\ProgramData\\ComposerSetup\\bin\\composer.phar require ${i.join(" ")}`;execSync(e,{stdio:"inherit",cwd:s})}catch(e){console.error("Error installing Composer dependencies:",e)}}const readJsonFile=e=>{const s=fs.readFileSync(e,"utf8");return JSON.parse(s)},npmPinnedVersions={prisma:"^7.0.0","@prisma/client":"^7.0.0","@prisma/internals":"^7.0.0",tsx:"^4.20.6",typescript:"^5.9.3","@types/node":"^24.9.2"};function npmPkg(e){return npmPinnedVersions[e]?`${e}@${npmPinnedVersions[e]}`:e}const composerPinnedVersions={"calicastle/cuid":"^2.0.0","symfony/uid":"^7.3.1","brick/math":"^0.14.0","tsnc/prisma-php":"^1.0.0"};function composerPkg(e){return composerPinnedVersions[e]?`${e}:${composerPinnedVersions[e]}`:e}async function main(){const e=process.argv.includes("--prisma-php");installNpmDependencies(e),installComposerDependencies(e),initPrisma(),directoriesToCopy.forEach(s=>{copyRecursiveSync(s.srcFolder,s.destFolder,s.srcFolder,e)});const s=path.join(__dirname,"prisma.config.ts"),n=path.join(process.cwd(),"prisma.config.ts");var i,o;i=s,o=n,fs.existsSync(i)?(fs.copyFileSync(i,o),console.log(`Copied file: ${path.basename(i)}`)):console.warn(`File not found (skip): ${i}`),console.log("Finished copying directories.")}main().catch(e=>{console.error("Error during execution:",e)});
1
+ import fs from"fs";import path from"path";import{execSync}from"child_process";import{getFileMeta}from"./utils.js";import chalk from"chalk";const{__dirname}=getFileMeta();let projectSettings=null;function checkExcludeFiles(e){return projectSettings?.excludeFilePath?.includes(e.replace(/\\/g,"/"))??!1}function copyRecursiveSync(e,s,n=e,i=!1){if(!fs.existsSync(e))return void console.error(`Source folder does not exist: ${e}`);fs.existsSync(s)||fs.mkdirSync(s,{recursive:!0});const o=fs.readdirSync(e,{withFileTypes:!0});for(const r of o){const o=path.join(e,r.name),c=path.join(s,r.name),t=path.relative(n,o),p=path.join(path.basename(n),t);if(checkExcludeFiles(c))return;const a=path.relative(__dirname,o),l=path.normalize("src/Lib/Validator.php");i&&a===l?console.log(`Skipping file: ${p}`):r.isDirectory()?copyRecursiveSync(o,c,n,i):(fs.copyFileSync(o,c),console.log(`Copied file: ${p}`))}}const directoriesToCopy=[{srcFolder:path.join(__dirname,"src"),destFolder:path.join(process.cwd(),"src")},{srcFolder:path.join(__dirname,"settings"),destFolder:path.join(process.cwd(),"settings")},{srcFolder:path.join(__dirname,"prisma"),destFolder:path.join(process.cwd(),"prisma")}];function installNpmDependencies(e){const s=process.cwd(),n=path.join(s,"package.json");let i;if(!fs.existsSync(n))return void console.error("package.json does not exist.");{const s=fs.readFileSync(n,"utf8");i=JSON.parse(s),e||(i.type="module"),fs.writeFileSync(n,JSON.stringify(i,null,2))}let o=[npmPkg("prisma"),npmPkg("@prisma/client"),npmPkg("@prisma/internals")];e||o.push(npmPkg("tsx"),npmPkg("typescript"),npmPkg("@types/node"));const r=o.join(" ");try{console.log(`Installing packages: ${r}`),execSync(`npm install --save-dev ${r}`,{stdio:"inherit",cwd:s}),e||execSync("npx tsc --init",{stdio:"inherit",cwd:s}),console.log("Packages installed successfully.")}catch(e){console.error("Error installing packages:",e)}}function initPrisma(){const e=process.cwd(),s=path.join(e,"prisma");if(fs.existsSync(s))console.warn("Prisma folder already exists. Skipping prisma init.");else try{console.log("Initializing Prisma..."),execSync("npx prisma init",{stdio:"inherit",cwd:e}),console.log("Prisma initialized successfully.")}catch(e){console.error("Error initializing Prisma:",e)}}async function installComposerDependencies(e){const s=process.cwd(),n=path.join(s,"composer.json");if(!fs.existsSync(n))return void console.error("composer.json does not exist.");let i=[composerPkg("calicastle/cuid")];if(e){const e=path.join(s,"prisma-php.json");if(fs.existsSync(e)){const n=readJsonFile(e);let i=[];n.excludeFiles?.map(e=>{const n=path.join(s,e);fs.existsSync(n)&&i.push(n.replace(/\\/g,"/"))}),projectSettings={...n,excludeFiles:n.excludeFiles??[],excludeFilePath:i??[]}}}else i.push(composerPkg("symfony/uid"),composerPkg("brick/math"),composerPkg("tsnc/prisma-php"));try{console.log("Installing Composer dependencies:"),i.forEach(e=>console.log(`- ${chalk.blue(e)}`));const e=`C:\\xampp\\php\\php.exe C:\\ProgramData\\ComposerSetup\\bin\\composer.phar require ${i.join(" ")}`;execSync(e,{stdio:"inherit",cwd:s})}catch(e){console.error("Error installing Composer dependencies:",e)}}const readJsonFile=e=>{const s=fs.readFileSync(e,"utf8");return JSON.parse(s)},npmPinnedVersions={prisma:"7.0.1","@prisma/client":"7.0.1","@prisma/internals":"7.0.1",tsx:"4.20.6",typescript:"5.9.3","@types/node":"24.10.1"};function npmPkg(e){return npmPinnedVersions[e]?`${e}@${npmPinnedVersions[e]}`:e}const composerPinnedVersions={"calicastle/cuid":"2.0.0","symfony/uid":"7.3.1","brick/math":"0.14.1","tsnc/prisma-php":"1.0.0"};function composerPkg(e){return composerPinnedVersions[e]?`${e}:${composerPinnedVersions[e]}`:e}async function main(){const e=process.argv.includes("--prisma-php");installNpmDependencies(e),installComposerDependencies(e),initPrisma(),directoriesToCopy.forEach(s=>{copyRecursiveSync(s.srcFolder,s.destFolder,s.srcFolder,e)});const s=path.join(__dirname,"prisma.config.ts"),n=path.join(process.cwd(),"prisma.config.ts");var i,o;i=s,o=n,fs.existsSync(i)?(fs.copyFileSync(i,o),console.log(`Copied file: ${path.basename(i)}`)):console.warn(`File not found (skip): ${i}`),console.log("Finished copying directories.")}main().catch(e=>{console.error("Error during execution:",e)});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prisma-client-php",
3
3
  "description": "Prisma Client PHP is an auto-generated query builder that enables type-safe database access in PHP.",
4
- "version": "4.0.0",
4
+ "version": "4.0.2",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {