New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nhost/nhost-js

Package Overview
Dependencies
Maintainers
3
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nhost/nhost-js - npm Package Compare versions

Comparing version 0.0.1-6 to 0.0.1-7

dist/utils/types.d.ts

5

dist/index.d.ts

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

import NhostClient from "./nhost-client";
import * as types from "./types";
declare const createClient: (config: types.NhostConfig) => NhostClient;
export { NhostClient, createClient };
export * from './nhost-client';

20

dist/index.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createClient = exports.NhostClient = void 0;
var nhost_client_1 = __importDefault(require("./nhost-client"));
exports.NhostClient = nhost_client_1.default;
var createClient = function (config) {
return new nhost_client_1.default(config);
};
exports.createClient = createClient;
//# sourceMappingURL=index.js.map
__exportStar(require("./nhost-client"), exports);

@@ -1,14 +0,8 @@

import NhostAuth from "./nhost-auth";
import NhostStorage from "./nhost-storage";
import * as types from "./types";
import { HasuraAuthClient } from '@nhost/hasura-auth-js';
import { HasuraStorageClient } from '@nhost/hasura-storage-js';
import { NhostClientConstructorParams } from './utils/types';
export default class NhostClient {
protected baseURL: string;
private refreshIntervalTime;
private clientStorage;
private clientStorageType;
private ssr;
private session;
auth: NhostAuth;
storage: NhostStorage;
constructor(config: types.NhostConfig);
auth: HasuraAuthClient;
storage: HasuraStorageClient;
constructor(params: NhostClientConstructorParams);
}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var nhost_auth_1 = __importDefault(require("./nhost-auth"));
var nhost_storage_1 = __importDefault(require("./nhost-storage"));
var user_session_1 = __importDefault(require("./user-session"));
var hasura_auth_js_1 = require("@nhost/hasura-auth-js");
var hasura_storage_js_1 = require("@nhost/hasura-storage-js");
var NhostClient = /** @class */ (function () {
function NhostClient(config) {
var _a;
if (!config.baseURL)
throw "Please specify a baseURL. Docs: https://docs.nhost.io/libraries/nhost-js-sdk#setup.";
this.baseURL = config.baseURL;
this.ssr = (_a = config.ssr) !== null && _a !== void 0 ? _a : typeof window === "undefined";
this.session = new user_session_1.default();
this.refreshIntervalTime = config.refreshIntervalTime || null; // 10 minutes (600 seconds)
this.clientStorage = this.ssr
? {}
: config.clientStorage || window.localStorage;
this.clientStorageType = config.clientStorageType
? config.clientStorageType
: "web";
this.auth = new nhost_auth_1.default({
baseURL: this.baseURL,
refreshIntervalTime: this.refreshIntervalTime,
clientStorage: this.clientStorage,
clientStorageType: this.clientStorageType,
ssr: this.ssr,
}, this.session);
this.storage = new nhost_storage_1.default({
baseURL: this.baseURL,
userSession: this.session,
function NhostClient(params) {
var _this = this;
if (!params.url)
throw 'Please specify a baseURL. Docs: TODO.';
var url = params.url, refreshIntervalTime = params.refreshIntervalTime, clientStorage = params.clientStorage, clientStorageType = params.clientStorageType, autoRefreshToken = params.autoRefreshToken, autoLogin = params.autoLogin;
this.auth = new hasura_auth_js_1.HasuraAuthClient({
url: url + "/auth",
refreshIntervalTime: refreshIntervalTime,
clientStorage: clientStorage,
clientStorageType: clientStorageType,
autoRefreshToken: autoRefreshToken,
autoLogin: autoLogin,
});
this.storage = new hasura_storage_js_1.HasuraStorageClient({
url: url + "/storage",
});
// set current token if token is already accessable
this.storage.setAccessToken(this.auth.getAccessToken());
// update access token for storage
this.auth.onAuthStateChanged(function (_event, session) {
_this.storage.setAccessToken(session === null || session === void 0 ? void 0 : session.accessToken);
});
}

@@ -39,2 +32,1 @@ return NhostClient;

exports.default = NhostClient;
//# sourceMappingURL=nhost-client.js.map
{
"name": "@nhost/nhost-js",
"version": "0.0.1-6",
"version": "0.0.1-7",
"description": "Nhost JavaScript SDK",

@@ -28,2 +28,4 @@ "main": "dist/index.js",

"dependencies": {
"@nhost/hasura-auth-js": "^0.0.1",
"@nhost/hasura-storage-js": "^0.0.1",
"axios": "^0.21.1",

@@ -30,0 +32,0 @@ "jwt-decode": "^3.1.2",

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