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 1.13.4 to 2.0.0

dist/clients/graphql.d.ts

13

dist/clients/functions/index.d.ts

@@ -1,5 +0,3 @@

import { AxiosRequestConfig } from 'axios';
import { NhostClientConstructorParams } from '../../utils/types';
import { DeprecatedNhostFunctionCallResponse, NhostFunctionCallConfig, NhostFunctionCallResponse, NhostFunctionsConstructorParams } from './types';
export * from './types';
import { NhostFunctionCallConfig, NhostFunctionCallResponse, NhostFunctionsConstructorParams } from './types';
/**

@@ -14,13 +12,6 @@ * Creates a client for Functions from either a subdomain or a URL

readonly url: string;
private instance;
private accessToken;
private adminSecret?;
constructor(params: NhostFunctionsConstructorParams);
/** @deprecated Axios will be replaced by cross-fetch in the near future. Only the headers configuration will be kept. */
call<T = unknown, D = any>(url: string, data?: D, config?: (NhostFunctionCallConfig | AxiosRequestConfig) & {
useAxios?: true;
}): Promise<DeprecatedNhostFunctionCallResponse<T>>;
call<T = unknown, D = any>(url: string, data: D, config?: NhostFunctionCallConfig & {
useAxios: false;
}): Promise<NhostFunctionCallResponse<T>>;
call<T = unknown, D = any>(url: string, data: D, config?: NhostFunctionCallConfig): Promise<NhostFunctionCallResponse<T>>;
/**

@@ -27,0 +18,0 @@ * Use `nhost.functions.setAccessToken` to a set an access token to be used in subsequent functions requests. Note that if you're signin in users with `nhost.auth.signIn()` the access token will be set automatically.

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

import type { AxiosResponse } from 'axios';
import { ErrorPayload } from '../../utils/types';

@@ -24,14 +23,8 @@ export interface NhostFunctionsConstructorParams {

};
/**@deprecated */
export declare type DeprecatedNhostFunctionCallResponse<T = unknown> = {
res: AxiosResponse<T>;
error: null;
} | {
res: null;
error: Error;
};
/** Subset of RequestInit parameters that are supported by the functions client */
export interface NhostFunctionCallConfig {
headers?: Record<string, string>;
/** @deprecated Axios has been replaced by cross-fetch. You should now remove this option. */
useAxios?: false;
}
//# sourceMappingURL=types.d.ts.map

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

import { GenericSchema, NhostGraphqlClient } from '@nhost/graphql-js';
import { HasuraAuthClient } from '@nhost/hasura-auth-js';

@@ -5,9 +6,8 @@ import { HasuraStorageClient } from '@nhost/hasura-storage-js';

import { NhostFunctionsClient } from './functions';
import { NhostGraphqlClient } from './graphql';
export declare const createNhostClient: (params: NhostClientConstructorParams) => NhostClient;
export declare class NhostClient {
export declare const createNhostClient: <Schema extends GenericSchema | undefined = undefined>(params: NhostClientConstructorParams<Schema>) => NhostClient<Schema>;
export declare class NhostClient<Schema extends GenericSchema | undefined = undefined> {
auth: HasuraAuthClient;
storage: HasuraStorageClient;
functions: NhostFunctionsClient;
graphql: NhostGraphqlClient;
graphql: NhostGraphqlClient<Schema>;
private _adminSecret?;

@@ -25,3 +25,3 @@ readonly devTools?: boolean;

*/
constructor({ refreshIntervalTime, clientStorageGetter, clientStorageSetter, clientStorage, clientStorageType, autoRefreshToken, autoSignIn, adminSecret, devTools, start, ...urlParams }: NhostClientConstructorParams);
constructor({ refreshIntervalTime, clientStorage, clientStorageType, autoRefreshToken, autoSignIn, adminSecret, devTools, start, schema, ...urlParams }: NhostClientConstructorParams<Schema>);
get adminSecret(): string | undefined;

@@ -28,0 +28,0 @@ set adminSecret(newValue: string | undefined);

@@ -6,3 +6,3 @@ import { HasuraStorageClient } from '@nhost/hasura-storage-js';

*/
export declare function createStorageClient(params: NhostClientConstructorParams): HasuraStorageClient;
export declare function createStorageClient(params: NhostClientConstructorParams<undefined>): HasuraStorageClient;
//# sourceMappingURL=storage.d.ts.map

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

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@nhost/hasura-auth-js"),g=require("@nhost/hasura-storage-js"),k=require("axios"),q=require("graphql"),v=/^((?<protocol>http[s]?):\/\/)?(?<host>localhost)(:(?<port>(\d+|__\w+__)))?$/;function f(e,t){const{backendUrl:s,subdomain:r,region:o}=e;if(s)return`${s}/v1/${t}`;if(!r)throw new Error("Either `backendUrl` or `subdomain` must be set.");const c=r.match(v);if(c!=null&&c.groups){const{protocol:n="http",host:a,port:i=1337}=c.groups,u=$(t);return u||`${n}://${a}:${i}/v1/${t}`}if(!o)throw new Error('`region` must be set when using a `subdomain` other than "localhost".');return`https://${r}.${t}.${o}.nhost.run/v1`}function E(){return typeof window<"u"}function y(){return typeof process<"u"&&process.env}function $(e){return E()||!y()?null:process.env[`NHOST_${e.toUpperCase()}_URL`]}function b(e){const t="subdomain"in e||"backendUrl"in e?f(e,"auth"):e.authUrl;if(!t)throw new Error("Please provide `subdomain` or `authUrl`.");return new p.HasuraAuthClient({url:t,...e})}function w(e){const t="subdomain"in e||"backendUrl"in e?f(e,"functions"):e.functionsUrl;if(!t)throw new Error("Please provide `subdomain` or `functionsUrl`.");return new T({url:t,...e})}class T{constructor(t){const{url:s,adminSecret:r}=t;this.url=s,this.accessToken=null,this.adminSecret=r,this.instance=k.create({baseURL:s})}async call(t,s,{useAxios:r=!0,...o}={}){r&&console.warn("nhost.functions.call() will no longer use Axios in the near future. Please add `useAxios: false` in the config argument to use the new implementation.");const c={...this.generateAccessTokenHeaders(),...o==null?void 0:o.headers};let n;try{n=await this.instance.post(t,s,{...o,headers:c})}catch(a){if(a instanceof Error){if(r)return{res:null,error:a};const i=a;return{res:null,error:{error:i.code||"unknown",status:i.status||0,message:i.message}}}}return n?r?{res:n,error:null}:{res:{status:n.status,statusText:n.statusText,data:n.data},error:null}:r?{res:null,error:new Error("Unable to make post request to function")}:{res:null,error:{error:"invalid-response",status:0,message:"Unable to make post request to function"}}}setAccessToken(t){if(!t){this.accessToken=null;return}this.accessToken=t}generateAccessTokenHeaders(){return this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:{}}}function m(e){const t="subdomain"in e||"backendUrl"in e?f(e,"graphql"):e.graphqlUrl;if(!t)throw new Error("Please provide `subdomain` or `graphqlUrl`.");return new U({url:t,...e})}class U{constructor(t){const{url:s,adminSecret:r}=t;this.url=s,this.accessToken=null,this.adminSecret=r,this.instance=k.create({baseURL:s})}async request(t,s,{useAxios:r=!0,...o}={}){const c={"Accept-Encoding":"*",...this.generateAccessTokenHeaders(),...o==null?void 0:o.headers};try{const n="",i=(await this.instance.post("",{operationName:n||void 0,query:typeof t=="string"?t:q.print(t),variables:s},{...o,headers:c})).data,{data:u}=i;return i.errors?{data:null,error:i.errors}:typeof u!="object"||Array.isArray(u)||u===null?r?{data:null,error:new Error("incorrect response data from GraphQL server")}:{data:null,error:{error:"invalid-response",status:0,message:"incorrect response data from GraphQL server"}}:{data:u,error:null}}catch(n){if(console.error(n),r)return n instanceof Error?{data:null,error:n}:{data:null,error:new Error("Unable to get do GraphQL request")};const a=n;return{data:null,error:{error:a.code||"unknown",status:a.status||0,message:a.message}}}}getUrl(){return this.url}setAccessToken(t){if(!t){this.accessToken=null;return}this.accessToken=t}generateAccessTokenHeaders(){return this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:{}}}function A(e){const t="subdomain"in e||"backendUrl"in e?f(e,"storage"):e.storageUrl;if(!t)throw new Error("Please provide `subdomain` or `storageUrl`.");return new g.HasuraStorageClient({url:t,...e})}const N=e=>new C(e);class C{constructor({refreshIntervalTime:t,clientStorageGetter:s,clientStorageSetter:r,clientStorage:o,clientStorageType:c,autoRefreshToken:n,autoSignIn:a,adminSecret:i,devTools:u,start:S=!0,...h}){this.auth=b({refreshIntervalTime:t,clientStorageGetter:s,clientStorageSetter:r,clientStorage:o,clientStorageType:c,autoRefreshToken:n,autoSignIn:a,start:S,...h}),this.storage=A({adminSecret:i,...h}),this.functions=w({adminSecret:i,...h}),this.graphql=m({adminSecret:i,...h}),this.auth.onAuthStateChanged((l,d)=>{l==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(l=>{const d=l==null?void 0:l.accessToken;this.storage.setAccessToken(d),this.functions.setAccessToken(d),this.graphql.setAccessToken(d)}),this._adminSecret=i,this.devTools=u}get adminSecret(){return this._adminSecret}set adminSecret(t){this._adminSecret=t,this.storage.setAdminSecret(t)}}exports.NhostClient=C;exports.NhostFunctionsClient=T;exports.NhostGraphqlClient=U;exports.createAuthClient=b;exports.createFunctionsClient=w;exports.createGraphqlClient=m;exports.createNhostClient=N;exports.createStorageClient=A;for(const e in p)e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>p[e]});for(const e in g)e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>g[e]});
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@nhost/hasura-auth-js"),b=require("@nhost/hasura-storage-js"),A=require("cross-fetch"),S=require("@nhost/graphql-js"),y=/^((?<protocol>http[s]?):\/\/)?(?<host>localhost)(:(?<port>(\d+|__\w+__)))?$/;function h(t,e){const{backendUrl:s,subdomain:o,region:i}=t;if(s)return`${s}/v1/${e}`;if(!o)throw new Error("Either `backendUrl` or `subdomain` must be set.");const r=o.match(y);if(r!=null&&r.groups){const{protocol:n="http",host:d,port:f=1337}=r.groups,u=v(e);return u||`${n}://${d}:${f}/v1/${e}`}if(!i)throw new Error('`region` must be set when using a `subdomain` other than "localhost".');return`https://${o}.${e}.${i}.nhost.run/v1`}function m(){return typeof window<"u"}function q(){return typeof process<"u"&&process.env}function v(t){return m()||!q()?null:process.env[`NHOST_${t.toUpperCase()}_URL`]}function w(t){const e="subdomain"in t||"backendUrl"in t?h(t,"auth"):t.authUrl;if(!e)throw new Error("Please provide `subdomain` or `authUrl`.");return new g.HasuraAuthClient({url:e,...t})}function p(t){const e="subdomain"in t||"backendUrl"in t?h(t,"functions"):t.functionsUrl;if(!e)throw new Error("Please provide `subdomain` or `functionsUrl`.");return new k({url:e,...t})}class k{constructor(e){const{url:s,adminSecret:o}=e;this.url=s,this.accessToken=null,this.adminSecret=o}async call(e,s,o){const i={"Content-Type":"application/json",...this.generateAccessTokenHeaders(),...o==null?void 0:o.headers};try{const r=await A(e,{body:JSON.stringify(s),headers:i,method:"POST"});if(!r.ok)throw new Error(r.statusText);let n;try{n=await r.json()}catch{n=await r.text()}return{res:{data:n,status:r.status,statusText:r.statusText},error:null}}catch(r){const n=r;return{res:null,error:{message:n.message,status:n.name==="AbortError"?0:500,error:n.name==="AbortError"?"abort-error":"unknown"}}}}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){return this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:{}}}function T(t){const e="subdomain"in t||"backendUrl"in t?h(t,"graphql"):t.graphqlUrl;if(!e)throw new Error("Please provide `subdomain` or `graphqlUrl`.");return new S.NhostGraphqlClient({url:e,...t})}function C(t){const e="subdomain"in t||"backendUrl"in t?h(t,"storage"):t.storageUrl;if(!e)throw new Error("Please provide `subdomain` or `storageUrl`.");return new b.HasuraStorageClient({url:e,...t})}const E=t=>new U(t);class U{constructor({refreshIntervalTime:e,clientStorage:s,clientStorageType:o,autoRefreshToken:i,autoSignIn:r,adminSecret:n,devTools:d,start:f=!0,schema:u,...a}){this.auth=w({refreshIntervalTime:e,clientStorage:s,clientStorageType:o,autoRefreshToken:i,autoSignIn:r,start:f,...a}),this.storage=C({adminSecret:n,...a}),this.functions=p({adminSecret:n,...a}),this.graphql=T({adminSecret:n,schema:u,...a}),this.auth.onAuthStateChanged((c,l)=>{c==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(c=>{const l=c==null?void 0:c.accessToken;this.storage.setAccessToken(l),this.functions.setAccessToken(l),this.graphql.setAccessToken(l)}),this._adminSecret=n,this.devTools=d}get adminSecret(){return this._adminSecret}set adminSecret(e){this._adminSecret=e,this.storage.setAdminSecret(e)}}exports.NhostClient=U;exports.NhostFunctionsClient=k;exports.createAuthClient=w;exports.createFunctionsClient=p;exports.createGraphqlClient=T;exports.createNhostClient=E;exports.createStorageClient=C;for(const t in g)t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>g[t]});for(const t in b)t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>b[t]});
//# sourceMappingURL=index.cjs.js.map
import { HasuraAuthClient as g } from "@nhost/hasura-auth-js";
export * from "@nhost/hasura-auth-js";
import { HasuraStorageClient as k } from "@nhost/hasura-storage-js";
import { HasuraStorageClient as w } from "@nhost/hasura-storage-js";
export * from "@nhost/hasura-storage-js";
import p from "axios";
import { print as w } from "graphql";
const T = /^((?<protocol>http[s]?):\/\/)?(?<host>localhost)(:(?<port>(\d+|__\w+__)))?$/;
function f(r, e) {
const { backendUrl: s, subdomain: t, region: o } = r;
import T from "cross-fetch";
import { NhostGraphqlClient as b } from "@nhost/graphql-js";
const k = /^((?<protocol>http[s]?):\/\/)?(?<host>localhost)(:(?<port>(\d+|__\w+__)))?$/;
function l(t, e) {
const { backendUrl: s, subdomain: o, region: i } = t;
if (s)
return `${s}/v1/${e}`;
if (!t)
if (!o)
throw new Error("Either `backendUrl` or `subdomain` must be set.");
const c = t.match(T);
if (c != null && c.groups) {
const { protocol: n = "http", host: a, port: i = 1337 } = c.groups, u = A(e);
return u || `${n}://${a}:${i}/v1/${e}`;
const r = o.match(k);
if (r != null && r.groups) {
const { protocol: n = "http", host: d, port: f = 1337 } = r.groups, u = U(e);
return u || `${n}://${d}:${f}/v1/${e}`;
}
if (!o)
if (!i)
throw new Error('`region` must be set when using a `subdomain` other than "localhost".');
return `https://${t}.${e}.${o}.nhost.run/v1`;
return `https://${o}.${e}.${i}.nhost.run/v1`;
}
function U() {
function p() {
return typeof window < "u";
}
function b() {
function m() {
return typeof process < "u" && process.env;
}
function A(r) {
return U() || !b() ? null : process.env[`NHOST_${r.toUpperCase()}_URL`];
function U(t) {
return p() || !m() ? null : process.env[`NHOST_${t.toUpperCase()}_URL`];
}
function E(r) {
const e = "subdomain" in r || "backendUrl" in r ? f(r, "auth") : r.authUrl;
function A(t) {
const e = "subdomain" in t || "backendUrl" in t ? l(t, "auth") : t.authUrl;
if (!e)
throw new Error("Please provide `subdomain` or `authUrl`.");
return new g({ url: e, ...r });
return new g({ url: e, ...t });
}
function v(r) {
const e = "subdomain" in r || "backendUrl" in r ? f(r, "functions") : r.functionsUrl;
function S(t) {
const e = "subdomain" in t || "backendUrl" in t ? l(t, "functions") : t.functionsUrl;
if (!e)
throw new Error("Please provide `subdomain` or `functionsUrl`.");
return new S({ url: e, ...r });
return new C({ url: e, ...t });
}
class S {
class C {
constructor(e) {
const { url: s, adminSecret: t } = e;
this.url = s, this.accessToken = null, this.adminSecret = t, this.instance = p.create({
baseURL: s
});
const { url: s, adminSecret: o } = e;
this.url = s, this.accessToken = null, this.adminSecret = o;
}
async call(e, s, {
useAxios: t = !0,
...o
} = {}) {
t && console.warn(
"nhost.functions.call() will no longer use Axios in the near future. Please add `useAxios: false` in the config argument to use the new implementation."
);
const c = {
async call(e, s, o) {
const i = {
"Content-Type": "application/json",
...this.generateAccessTokenHeaders(),
...o == null ? void 0 : o.headers
};
let n;
try {
n = await this.instance.post(e, s, { ...o, headers: c });
} catch (a) {
if (a instanceof Error) {
if (t)
return { res: null, error: a };
const i = a;
return {
res: null,
error: {
error: i.code || "unknown",
status: i.status || 0,
message: i.message
}
};
const r = await T(e, {
body: JSON.stringify(s),
headers: i,
method: "POST"
});
if (!r.ok)
throw new Error(r.statusText);
let n;
try {
n = await r.json();
} catch {
n = await r.text();
}
}
return n ? t ? { res: n, error: null } : {
res: {
status: n.status,
statusText: n.statusText,
data: n.data
},
error: null
} : t ? {
res: null,
error: new Error("Unable to make post request to function")
} : {
res: null,
error: {
error: "invalid-response",
status: 0,
message: "Unable to make post request to function"
}
};
}
setAccessToken(e) {
if (!e) {
this.accessToken = null;
return;
}
this.accessToken = e;
}
generateAccessTokenHeaders() {
return this.adminSecret ? {
"x-hasura-admin-secret": this.adminSecret
} : this.accessToken ? {
Authorization: `Bearer ${this.accessToken}`
} : {};
}
}
function q(r) {
const e = "subdomain" in r || "backendUrl" in r ? f(r, "graphql") : r.graphqlUrl;
if (!e)
throw new Error("Please provide `subdomain` or `graphqlUrl`.");
return new C({ url: e, ...r });
}
class C {
constructor(e) {
const { url: s, adminSecret: t } = e;
this.url = s, this.accessToken = null, this.adminSecret = t, this.instance = p.create({
baseURL: s
});
}
async request(e, s, {
useAxios: t = !0,
...o
} = {}) {
const c = {
"Accept-Encoding": "*",
...this.generateAccessTokenHeaders(),
...o == null ? void 0 : o.headers
};
try {
const n = "", i = (await this.instance.post(
"",
{
operationName: n || void 0,
query: typeof e == "string" ? e : w(e),
variables: s
},
{ ...o, headers: c }
)).data, { data: u } = i;
return i.errors ? {
data: null,
error: i.errors
} : typeof u != "object" || Array.isArray(u) || u === null ? t ? {
data: null,
error: new Error("incorrect response data from GraphQL server")
} : {
data: null,
error: {
error: "invalid-response",
status: 0,
message: "incorrect response data from GraphQL server"
}
} : { data: u, error: null };
} catch (n) {
if (console.error(n), t)
return n instanceof Error ? { data: null, error: n } : {
data: null,
error: new Error("Unable to get do GraphQL request")
};
const a = n;
return {
data: null,
res: { data: n, status: r.status, statusText: r.statusText },
error: null
};
} catch (r) {
const n = r;
return {
res: null,
error: {
error: a.code || "unknown",
status: a.status || 0,
message: a.message
message: n.message,
status: n.name === "AbortError" ? 0 : 500,
error: n.name === "AbortError" ? "abort-error" : "unknown"
}

@@ -177,5 +85,2 @@ };

}
getUrl() {
return this.url;
}
setAccessToken(e) {

@@ -196,39 +101,42 @@ if (!e) {

}
function $(r) {
const e = "subdomain" in r || "backendUrl" in r ? f(r, "storage") : r.storageUrl;
function E(t) {
const e = "subdomain" in t || "backendUrl" in t ? l(t, "graphql") : t.graphqlUrl;
if (!e)
throw new Error("Please provide `subdomain` or `graphqlUrl`.");
return new b({ url: e, ...t });
}
function v(t) {
const e = "subdomain" in t || "backendUrl" in t ? l(t, "storage") : t.storageUrl;
if (!e)
throw new Error("Please provide `subdomain` or `storageUrl`.");
return new k({ url: e, ...r });
return new w({ url: e, ...t });
}
const G = (r) => new y(r);
class y {
const N = (t) => new $(t);
class $ {
constructor({
refreshIntervalTime: e,
clientStorageGetter: s,
clientStorageSetter: t,
clientStorage: o,
clientStorageType: c,
autoRefreshToken: n,
autoSignIn: a,
adminSecret: i,
devTools: u,
start: m = !0,
clientStorage: s,
clientStorageType: o,
autoRefreshToken: i,
autoSignIn: r,
adminSecret: n,
devTools: d,
start: f = !0,
schema: u,
...h
}) {
this.auth = E({
this.auth = A({
refreshIntervalTime: e,
clientStorageGetter: s,
clientStorageSetter: t,
clientStorage: o,
clientStorageType: c,
autoRefreshToken: n,
autoSignIn: a,
start: m,
clientStorage: s,
clientStorageType: o,
autoRefreshToken: i,
autoSignIn: r,
start: f,
...h
}), this.storage = $({ adminSecret: i, ...h }), this.functions = v({ adminSecret: i, ...h }), this.graphql = q({ adminSecret: i, ...h }), this.auth.onAuthStateChanged((l, d) => {
l === "SIGNED_OUT" && (this.storage.setAccessToken(void 0), this.functions.setAccessToken(void 0), this.graphql.setAccessToken(void 0));
}), this.auth.onTokenChanged((l) => {
const d = l == null ? void 0 : l.accessToken;
this.storage.setAccessToken(d), this.functions.setAccessToken(d), this.graphql.setAccessToken(d);
}), this._adminSecret = i, this.devTools = u;
}), this.storage = v({ adminSecret: n, ...h }), this.functions = S({ adminSecret: n, ...h }), this.graphql = E({ adminSecret: n, schema: u, ...h }), this.auth.onAuthStateChanged((c, a) => {
c === "SIGNED_OUT" && (this.storage.setAccessToken(void 0), this.functions.setAccessToken(void 0), this.graphql.setAccessToken(void 0));
}), this.auth.onTokenChanged((c) => {
const a = c == null ? void 0 : c.accessToken;
this.storage.setAccessToken(a), this.functions.setAccessToken(a), this.graphql.setAccessToken(a);
}), this._adminSecret = n, this.devTools = d;
}

@@ -243,11 +151,10 @@ get adminSecret() {

export {
y as NhostClient,
S as NhostFunctionsClient,
C as NhostGraphqlClient,
E as createAuthClient,
v as createFunctionsClient,
q as createGraphqlClient,
G as createNhostClient,
$ as createStorageClient
$ as NhostClient,
C as NhostFunctionsClient,
A as createAuthClient,
S as createFunctionsClient,
E as createGraphqlClient,
N as createNhostClient,
v as createStorageClient
};
//# sourceMappingURL=index.esm.js.map

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

import { GenericSchema } from '@nhost/graphql-js';
import { NhostAuthConstructorParams } from '@nhost/hasura-auth-js';

@@ -38,3 +39,4 @@ export declare type ErrorPayload = {

export declare type BackendOrSubdomain = BackendUrl | Subdomain;
export interface NhostClientConstructorParams extends Partial<BackendUrl>, Partial<Subdomain>, Partial<ServiceUrls>, Omit<NhostAuthConstructorParams, 'url'> {
export interface NhostClientConstructorParams<Schema extends GenericSchema | undefined = undefined> extends Partial<BackendUrl>, Partial<Subdomain>, Partial<ServiceUrls>, Omit<NhostAuthConstructorParams, 'url'> {
schema?: Schema;
/**

@@ -41,0 +43,0 @@ * When set, the admin secret is sent as a header, `x-hasura-admin-secret`,

{
"name": "@nhost/nhost-js",
"version": "1.13.4",
"version": "2.0.0",
"description": "Nhost JavaScript SDK",

@@ -46,12 +46,10 @@ "license": "MIT",

"dependencies": {
"axios": "^1.2.0",
"jwt-decode": "^3.1.2",
"@nhost/hasura-auth-js": "1.12.4",
"@nhost/hasura-storage-js": "1.13.2"
"cross-fetch": "^3.1.5",
"@nhost/hasura-auth-js": "2.0.0",
"@nhost/hasura-storage-js": "2.0.0",
"@nhost/graphql-js": "0.0.1"
},
"devDependencies": {
"@faker-js/faker": "^7.6.0",
"graphql": "16.6.0",
"start-server-and-test": "^1.15.2",
"@nhost/docgen": "0.1.6"
"start-server-and-test": "^1.15.2"
},

@@ -68,5 +66,2 @@ "peerDependencies": {

"test:watch": "vitest",
"e2e": "start-test e2e:backend http-get://localhost:9695 ci:test",
"ci:test": "vitest run --config vite.config.e2e.js",
"e2e:backend": "nhost dev --no-browser",
"test:coverage": "vitest run --coverage",

@@ -78,6 +73,4 @@ "prettier": "prettier --check src/",

"verify": "run-p prettier lint",
"verify:fix": "run-p prettier:fix lint:fix",
"typedoc": "typedoc --options ./nhost-js.typedoc.json --tsconfig ./typedoc.tsconfig.json",
"docgen": "pnpm typedoc && docgen --config ./nhost-js.docgen.json"
"verify:fix": "run-p prettier:fix lint:fix"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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