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

@replit/database

Package Overview
Dependencies
Maintainers
33
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@replit/database - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

15

dist/index.d.ts

@@ -21,11 +21,2 @@ /**

/**
* An object that represents an error with a request
* @public
*/
interface RequestError {
message: string;
statusCode?: number;
}
declare class Client {

@@ -94,3 +85,7 @@ private _dbUrl;

}
interface RequestError {
message: string;
statusCode?: number;
}
export { Client as default };
export = Client;

@@ -1,30 +0,4 @@

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/index.ts
var _fs = require('fs');
// src/index.ts
var src_exports = {};
__export(src_exports, {
default: () => Client
});
module.exports = __toCommonJS(src_exports);
// src/request.ts
var import_fs = require("fs");
// src/result.ts

@@ -38,39 +12,7 @@ function Err(error, errorExtras) {

// src/request.ts
async function doFetch({
urlPath,
...rest
}) {
try {
const response = await fetch(new URL(urlPath), rest);
if (response.status !== 200 && response.status !== 204) {
return Err({
message: await response.text(),
statusCode: response.status
});
}
return Ok(response);
} catch (e) {
return Err({ message: e instanceof Error ? e.message : "unknown error" });
}
}
var replitDBFilename = "/tmp/replitdb";
function getDbUrl() {
let dbUrl;
try {
dbUrl = (0, import_fs.readFileSync)(replitDBFilename, "utf8");
} catch (err) {
dbUrl = process.env.REPLIT_DB_URL;
}
if (!dbUrl) {
throw new Error("expected dbUrl, got undefined");
}
return dbUrl;
}
// src/index.ts
var Client = class {
_dbUrl;
// use this.dbUrl internally
lastDbUrlRefreshTime;
/**

@@ -121,3 +63,3 @@ * Initiates Class.

return Ok(parsed === null || parsed === void 0 ? null : parsed);
} catch {
} catch (e2) {
return Err({

@@ -253,1 +195,36 @@ message: `Failed to parse value of ${key}, try passing a raw option to get the raw value`

};
async function doFetch({
urlPath,
...rest
}) {
try {
const response = await fetch(new URL(urlPath), rest);
if (response.status !== 200 && response.status !== 204) {
return Err({
message: await response.text(),
statusCode: response.status
});
}
return Ok(response);
} catch (e) {
return Err({ message: e instanceof Error ? e.message : "unknown error" });
}
}
var replitDBFilename = "/tmp/replitdb";
function getDbUrl() {
let dbUrl;
try {
dbUrl = _fs.readFileSync.call(void 0, replitDBFilename, "utf8");
} catch (err) {
dbUrl = process.env.REPLIT_DB_URL;
}
if (!dbUrl) {
throw new Error("expected dbUrl, got undefined");
}
return dbUrl;
}
exports.default = Client;
module.exports = exports.default
{
"name": "@replit/database",
"version": "3.0.0",
"version": "3.0.1",
"engines": {

@@ -15,13 +15,11 @@ "node": ">=18"

"scripts": {
"build": "rm -rf dist && tsup src/index.ts --platform node --dts --format esm,cjs",
"test": "vitest run src/*"
"build": "rm -rf dist/ && tsup src/index.ts --platform node --format cjs,esm --dts --cjsInterop --splitting",
"prepublishOnly": "npm run build",
"test": "npm run build && cd test && npm install && cd ../ && vitest run test/*"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": {
"default": "./dist/index.mjs"
},
"require": "./dist/index.js",
"default": "./dist/index.js"
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}

@@ -35,3 +33,4 @@ },

"devDependencies": {
"tsup": "^8.0.2",
"@types/node": "^18.11.18",
"tsup": "^7.2.0",
"typescript": "^5.4.3",

@@ -38,0 +37,0 @@ "vitest": "^1.4.0"

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