@nhost/nhost-js 1.1.12 → 1.2.0
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/README.md +6 -9
- package/dist/clients/functions.d.ts +8 -0
- package/dist/clients/functions.d.ts.map +1 -1
- package/dist/clients/graphql.d.ts +9 -1
- package/dist/clients/graphql.d.ts.map +1 -1
- package/dist/core/nhost-client.d.ts +7 -1
- package/dist/core/nhost-client.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +36 -18
- package/dist/index.es.js.map +1 -1
- package/dist/index.mjs +203 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +11 -8
- package/umd/nhost-js.umd.js +6 -6
- package/umd/nhost-js.umd.js.map +1 -1
- package/umd/clients/functions.d.ts +0 -37
- package/umd/clients/functions.d.ts.map +0 -1
- package/umd/clients/graphql.d.ts +0 -58
- package/umd/clients/graphql.d.ts.map +0 -1
- package/umd/clients/index.d.ts +0 -3
- package/umd/clients/index.d.ts.map +0 -1
- package/umd/core/index.d.ts +0 -2
- package/umd/core/index.d.ts.map +0 -1
- package/umd/core/nhost-client.d.ts +0 -26
- package/umd/core/nhost-client.d.ts.map +0 -1
- package/umd/index.d.ts +0 -6
- package/umd/index.d.ts.map +0 -1
- package/umd/types.d.ts +0 -20
- package/umd/types.d.ts.map +0 -1
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { FunctionCallResponse } from '../types';
|
|
3
|
-
export interface NhostFunctionsConstructorParams {
|
|
4
|
-
url: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* @alias Functions
|
|
8
|
-
*/
|
|
9
|
-
export declare class NhostFunctionsClient {
|
|
10
|
-
private instance;
|
|
11
|
-
private accessToken;
|
|
12
|
-
constructor(params: NhostFunctionsConstructorParams);
|
|
13
|
-
/**
|
|
14
|
-
* Use `nhost.functions.call` to call (sending a POST request to) a serverless function.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* await nhost.functions.call('send-welcome-email', { email: 'joe@example.com', name: 'Joe Doe' })
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @docs https://docs.nhost.io/reference/javascript/nhost-js/functions/call
|
|
22
|
-
*/
|
|
23
|
-
call<T = unknown, D = any>(url: string, data: D, config?: AxiosRequestConfig): Promise<FunctionCallResponse<T>>;
|
|
24
|
-
/**
|
|
25
|
-
* 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.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* nhost.functions.setAccessToken('some-access-token')
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @docs https://docs.nhost.io/reference/javascript/nhost-js/functions/set-access-token
|
|
33
|
-
*/
|
|
34
|
-
setAccessToken(accessToken: string | undefined): void;
|
|
35
|
-
private generateAccessTokenHeaders;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["functions.ts"],"names":[],"mappings":"AAAA,OAAc,EAAiB,kBAAkB,EAAiB,MAAM,OAAO,CAAA;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,MAAM,WAAW,+BAA+B;IAC9C,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,WAAW,CAAe;gBAEtB,MAAM,EAAE,+BAA+B;IASnD;;;;;;;;;OASG;IACG,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,GAAG,EAC7B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,CAAC,EACP,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAyBnC;;;;;;;;;OASG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS;IAS9C,OAAO,CAAC,0BAA0B;CAUnC"}
|
package/umd/clients/graphql.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import type { DocumentNode } from 'graphql';
|
|
3
|
-
import { GraphqlRequestResponse } from '../types';
|
|
4
|
-
export interface NhostGraphqlConstructorParams {
|
|
5
|
-
url: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* @alias GraphQL
|
|
9
|
-
*/
|
|
10
|
-
export declare class NhostGraphqlClient {
|
|
11
|
-
private url;
|
|
12
|
-
private instance;
|
|
13
|
-
private accessToken;
|
|
14
|
-
constructor(params: NhostGraphqlConstructorParams);
|
|
15
|
-
/**
|
|
16
|
-
* Use `nhost.graphql.request` to send a GraphQL request. For more serious GraphQL usage in your app we recommend using a GraphQL client such as Apollo Client (https://www.apollographql.com/docs/react).
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* const CUSTOMERS = gql`
|
|
21
|
-
* query {
|
|
22
|
-
* customers {
|
|
23
|
-
* id
|
|
24
|
-
* name
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
* `
|
|
28
|
-
* const { data, error } = await nhost.graphql.request(CUSTOMERS)
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @docs https://docs.nhost.io/reference/javascript/nhost-js/graphql/request
|
|
32
|
-
*/
|
|
33
|
-
request<T = any, V = any>(document: string | DocumentNode, variables?: V, config?: AxiosRequestConfig): Promise<GraphqlRequestResponse<T>>;
|
|
34
|
-
/**
|
|
35
|
-
* Use `nhost.graphql.getUrl` to get the GraphQL URL.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```ts
|
|
39
|
-
* const url = nhost.graphql.getUrl();
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @docs https://docs.nhost.io/reference/javascript/nhost-js/graphql/get-url
|
|
43
|
-
*/
|
|
44
|
-
getUrl(): string;
|
|
45
|
-
/**
|
|
46
|
-
* Use `nhost.graphql.setAccessToken` to a set an access token to be used in subsequent graphql requests. Note that if you're signin in users with `nhost.auth.signIn()` the access token will be set automatically.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```ts
|
|
50
|
-
* nhost.graphql.setAccessToken('some-access-token')
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @docs https://docs.nhost.io/reference/javascript/nhost-js/graphql/set-access-token
|
|
54
|
-
*/
|
|
55
|
-
setAccessToken(accessToken: string | undefined): void;
|
|
56
|
-
private generateAccessTokenHeaders;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=graphql.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["graphql.ts"],"names":[],"mappings":"AAAA,OAAc,EAAiB,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C,OAAO,EAAE,sBAAsB,EAAmB,MAAM,UAAU,CAAA;AAElE,MAAM,WAAW,6BAA6B;IAC5C,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,GAAG,CAAQ;IACnB,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,WAAW,CAAe;gBAEtB,MAAM,EAAE,6BAA6B;IAUjD;;;;;;;;;;;;;;;;;OAiBG;IACG,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAC5B,QAAQ,EAAE,MAAM,GAAG,YAAY,EAC/B,SAAS,CAAC,EAAE,CAAC,EACb,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAiDrC;;;;;;;;;OASG;IACH,MAAM,IAAI,MAAM;IAIhB;;;;;;;;;OASG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS;IAS9C,OAAO,CAAC,0BAA0B;CAUnC"}
|
package/umd/clients/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA"}
|
package/umd/core/index.d.ts
DELETED
package/umd/core/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { HasuraAuthClient, NhostAuthConstructorParams } from '@nhost/hasura-auth-js';
|
|
2
|
-
import { HasuraStorageClient } from '@nhost/hasura-storage-js';
|
|
3
|
-
import { NhostFunctionsClient } from '../clients/functions';
|
|
4
|
-
import { NhostGraphqlClient } from '../clients/graphql';
|
|
5
|
-
export interface NhostClientConstructorParams extends Omit<NhostAuthConstructorParams, 'url'> {
|
|
6
|
-
/**
|
|
7
|
-
* Nhost backend URL.
|
|
8
|
-
*/
|
|
9
|
-
backendUrl: string;
|
|
10
|
-
}
|
|
11
|
-
export declare class NhostClient {
|
|
12
|
-
auth: HasuraAuthClient;
|
|
13
|
-
storage: HasuraStorageClient;
|
|
14
|
-
functions: NhostFunctionsClient;
|
|
15
|
-
graphql: NhostGraphqlClient;
|
|
16
|
-
/**
|
|
17
|
-
* Nhost Client
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* const nhost = new NhostClient({ url });
|
|
21
|
-
*
|
|
22
|
-
* @docs https://docs.nhost.io/reference/javascript
|
|
23
|
-
*/
|
|
24
|
-
constructor({ backendUrl, refreshIntervalTime, clientStorageGetter, clientStorageSetter, clientStorage, clientStorageType, autoRefreshToken, autoSignIn, start }: NhostClientConstructorParams);
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=nhost-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nhost-client.d.ts","sourceRoot":"","sources":["nhost-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CAAC,0BAA0B,EAAE,KAAK,CAAC;IAC3F;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,qBAAa,WAAW;IACtB,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE,mBAAmB,CAAA;IAC5B,SAAS,EAAE,oBAAoB,CAAA;IAC/B,OAAO,EAAE,kBAAkB,CAAA;IAE3B;;;;;;;OAOG;gBACS,EACV,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,KAAY,EACb,EAAE,4BAA4B;CAiDhC"}
|
package/umd/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { NhostClient, NhostClientConstructorParams } from './core';
|
|
2
|
-
declare const createClient: (config: NhostClientConstructorParams) => NhostClient;
|
|
3
|
-
export * from './clients';
|
|
4
|
-
export * from './core';
|
|
5
|
-
export { createClient };
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
package/umd/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE,MAAM,QAAQ,CAAA;AAElE,QAAA,MAAM,YAAY,WAAY,4BAA4B,gBAA4B,CAAA;AAEtF,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
package/umd/types.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { AxiosResponse } from 'axios';
|
|
2
|
-
export declare type GraphqlRequestResponse<T = unknown> = {
|
|
3
|
-
data: null;
|
|
4
|
-
error: Error | object | object[];
|
|
5
|
-
} | {
|
|
6
|
-
data: T;
|
|
7
|
-
error: null;
|
|
8
|
-
};
|
|
9
|
-
export declare type FunctionCallResponse<T = unknown> = {
|
|
10
|
-
res: AxiosResponse<T>;
|
|
11
|
-
error: null;
|
|
12
|
-
} | {
|
|
13
|
-
res: null;
|
|
14
|
-
error: Error;
|
|
15
|
-
};
|
|
16
|
-
export interface GraphqlResponse<T = object> {
|
|
17
|
-
errors?: object[];
|
|
18
|
-
data?: T;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=types.d.ts.map
|
package/umd/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,oBAAY,sBAAsB,CAAC,CAAC,GAAG,OAAO,IAC1C;IACE,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;CACjC,GACD;IACE,IAAI,EAAE,CAAC,CAAA;IACP,KAAK,EAAE,IAAI,CAAA;CACZ,CAAA;AAEL,oBAAY,oBAAoB,CAAC,CAAC,GAAG,OAAO,IACxC;IACE,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IACrB,KAAK,EAAE,IAAI,CAAA;CACZ,GACD;IACE,GAAG,EAAE,IAAI,CAAA;IACT,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAEL,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,MAAM;IACzC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,CAAC,EAAE,CAAC,CAAA;CACT"}
|