Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@prisma/fetch-engine

Package Overview
Dependencies
Maintainers
5
Versions
7915
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma/fetch-engine - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

1

dist/download.d.ts

@@ -0,1 +1,2 @@

export declare function downloadMigrationBinary(migrationBinary: string, version: string): Promise<void>;
/**

@@ -2,0 +3,0 @@ * TODO: Check if binary already exists and if checksum is the same!

@@ -27,2 +27,60 @@ "use strict";

const readFile = util_1.promisify(fs_1.default.readFile);
async function downloadMigrationBinary(migrationBinary, version) {
try {
fs_1.default.writeFileSync(migrationBinary, '#!/usr/bin/env node\n' + 'console.log("Please wait until the \'prisma\' installation completes!")\n');
}
catch (err) {
if (err.code === 'EACCES') {
log_1.warn('Please try installing Prisma CLI again with the `--unsafe-perm` option.');
log_1.info('Example: `npm i -g --unsafe-perm prisma`');
process.exit();
}
throw err;
}
death_1.default(() => {
fs_1.default.writeFileSync(migrationBinary, '#!/usr/bin/env node\n' +
'console.log("The \'prisma\' installation did not complete successfully.")\n' +
'console.log("Please run \'npm i -g prisma\' to reinstall!")\n');
process.exit();
});
log_1.info('For the source code, check out: https://github.com/prisma/lift');
// Print an empty line
const platform = await getPlatform();
const cacheDir = await getCacheDir(platform);
const cachedMigrationEnginePath = path_1.default.join(cacheDir, 'migration-engine');
const cachedLastModifiedPath = path_1.default.join(cacheDir, 'lastModifiedMigrationEngine');
const [cachedMigrationEngineExists, localLastModified] = await Promise.all([
exists(cachedMigrationEnginePath),
getLocalLastModified(cachedLastModifiedPath),
]);
if (cachedMigrationEngineExists && localLastModified) {
const remoteLastModified = await getRemoteLastModified(getMigrationEngineDownloadUrl(platform));
// If there is no new binary and we have it localy, copy it over
if (localLastModified >= remoteLastModified) {
console.log(`Taking migration engine binary from local cache from ${localLastModified.toISOString()}`);
await Promise.all([copy_1.copy(cachedMigrationEnginePath, migrationBinary)]);
return;
}
}
log_1.enableProgress('Downloading Prisma Binary ' + version);
log_1.showProgress(0);
const lastModified = await downloadFile(getMigrationEngineDownloadUrl(platform), migrationBinary, 100);
log_1.showProgress(100);
log_1.disableProgress();
chmod_1.default(migrationBinary);
/**
* Cache the result only on Mac for better dev experience
*/
if (platform === 'darwin') {
try {
await copy_1.copy(migrationBinary, cachedMigrationEnginePath);
await writeFile(cachedLastModifiedPath, lastModified);
}
catch (e) {
// console.error(e)
// let this fail silently - the CI system may have reached the file size limit
}
}
}
exports.downloadMigrationBinary = downloadMigrationBinary;
/**

@@ -85,3 +143,3 @@ * TODO: Check if binary already exists and if checksum is the same!

await copy_1.copy(schemaInferrerBinPath, cachedSchemaInferrerPath);
writeFile(cachedLastModifiedPath, lastModified);
await writeFile(cachedLastModifiedPath, lastModified);
}

@@ -205,2 +263,5 @@ catch (e) {

}
function getMigrationEngineDownloadUrl(platform) {
return `https://s3-eu-west-1.amazonaws.com/prisma-native/alpha/latest/${platform}/migration-engine`;
}
//# sourceMappingURL=download.js.map
export declare function ensureBinaries(resultPath?: string): Promise<void>;
export declare function ensureMigrationBinary(resultPath: string): Promise<void>;

@@ -20,2 +20,8 @@ "use strict";

exports.ensureBinaries = ensureBinaries;
async function ensureMigrationBinary(resultPath) {
await make_dir_1.default(resultPath);
const prisma = path_1.default.join(resultPath, 'migration-engine');
await download_1.downloadMigrationBinary(prisma, '0.0.1');
}
exports.ensureMigrationBinary = ensureMigrationBinary;
async function getRuntimeDir() {

@@ -22,0 +28,0 @@ let runtimeDir = path_1.default.join(__dirname, '../runtime');

2

package.json
{
"name": "@prisma/fetch-engine",
"version": "0.0.10",
"version": "0.0.11",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc