@mintlify/http-client 0.0.5 → 0.0.8
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/LICENSE +93 -0
- package/README.md +16 -16
- package/dist/client/baseClient.d.ts +63 -63
- package/dist/client/baseClient.js +93 -93
- package/dist/client/clientError.d.ts +32 -32
- package/dist/client/clientError.js +88 -88
- package/dist/client/index.d.ts +6 -6
- package/dist/client/index.js +7 -7
- package/dist/client/interfaces.d.ts +93 -93
- package/dist/client/interfaces.js +2 -2
- package/dist/client/types.d.ts +9 -9
- package/dist/client/types.js +2 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -18
- package/dist/leaves-client/constants.d.ts +21 -18
- package/dist/leaves-client/constants.d.ts.map +1 -1
- package/dist/leaves-client/constants.js +19 -16
- package/dist/leaves-client/constants.js.map +1 -1
- package/dist/leaves-client/index.d.ts +5 -5
- package/dist/leaves-client/index.js +23 -23
- package/dist/leaves-client/interfaces.d.ts +18 -16
- package/dist/leaves-client/interfaces.d.ts.map +1 -1
- package/dist/leaves-client/interfaces.js +2 -2
- package/dist/leaves-client/leavesClient.d.ts +7 -7
- package/dist/leaves-client/leavesClient.d.ts.map +1 -1
- package/dist/leaves-client/leavesClient.js +95 -92
- package/dist/leaves-client/leavesClient.js.map +1 -1
- package/dist/leaves-client/types.d.ts +7 -11
- package/dist/leaves-client/types.d.ts.map +1 -1
- package/dist/leaves-client/types.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +78 -77
- package/dist/setup-jest.d.ts +0 -1
- package/dist/setup-jest.js +0 -5
- package/dist/src/client/baseClient.d.ts +0 -63
- package/dist/src/client/baseClient.js +0 -180
- package/dist/src/client/clientError.d.ts +0 -32
- package/dist/src/client/clientError.js +0 -160
- package/dist/src/client/index.d.ts +0 -6
- package/dist/src/client/index.js +0 -7
- package/dist/src/client/interfaces.d.ts +0 -93
- package/dist/src/client/interfaces.js +0 -2
- package/dist/src/client/types.d.ts +0 -9
- package/dist/src/client/types.js +0 -2
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.js +0 -18
- package/dist/src/leaves-client/constants.d.ts +0 -18
- package/dist/src/leaves-client/constants.js +0 -16
- package/dist/src/leaves-client/index.d.ts +0 -4
- package/dist/src/leaves-client/index.js +0 -8
- package/dist/src/leaves-client/interfaces.d.ts +0 -15
- package/dist/src/leaves-client/interfaces.js +0 -2
- package/dist/src/leaves-client/leavesClient.d.ts +0 -7
- package/dist/src/leaves-client/leavesClient.js +0 -157
- package/dist/src/leaves-client/types.d.ts +0 -11
- package/dist/src/leaves-client/types.js +0 -2
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleAccess = exports.handleJson = exports.handleText = exports.isClientError = void 0;
|
|
4
|
-
const leaves_client_1 = require("../leaves-client");
|
|
5
|
-
/**
|
|
6
|
-
* Represents a client-side error.
|
|
7
|
-
*/
|
|
8
|
-
class ClientError extends Error {
|
|
9
|
-
/**
|
|
10
|
-
* Constructs a ClientError.
|
|
11
|
-
* @param message - The error message.
|
|
12
|
-
* @param client - The BaseClient that generated the error.
|
|
13
|
-
* @param response - The server's response.
|
|
14
|
-
* @param request - The original request.
|
|
15
|
-
* @param uri - The URI to which the request was sent.
|
|
16
|
-
*/
|
|
17
|
-
constructor(message, client, response, request, uri) {
|
|
18
|
-
super(message);
|
|
19
|
-
this.client = client;
|
|
20
|
-
this.response = response;
|
|
21
|
-
this.request = request;
|
|
22
|
-
this.uri = uri;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Type guard for ClientError.
|
|
27
|
-
* @param object - The object to check.
|
|
28
|
-
* @returns True if the object is a ClientError; otherwise, false.
|
|
29
|
-
*/
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
-
function isClientError(object) {
|
|
32
|
-
return (object instanceof ClientError ||
|
|
33
|
-
('client' in object &&
|
|
34
|
-
'message' in object &&
|
|
35
|
-
'host' in object.client &&
|
|
36
|
-
'isPasswordProtected' in object.client &&
|
|
37
|
-
'subdomain' in object.client &&
|
|
38
|
-
'response' in object &&
|
|
39
|
-
'status' in object.response &&
|
|
40
|
-
!isNaN(object.response.status)));
|
|
41
|
-
}
|
|
42
|
-
exports.isClientError = isClientError;
|
|
43
|
-
/**
|
|
44
|
-
* Fetches a resource as text.
|
|
45
|
-
* @param req - The request object.
|
|
46
|
-
* @param res - The response object.
|
|
47
|
-
* @param uri - The URI to fetch from.
|
|
48
|
-
* @throws ClientError - If the response is not ok.
|
|
49
|
-
* @returns The fetched text.
|
|
50
|
-
*/
|
|
51
|
-
async function handleText(req, res, uri) {
|
|
52
|
-
const text = await res.text();
|
|
53
|
-
if (res.ok) {
|
|
54
|
-
return text;
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
throw new ClientError(text, this, res, req, uri);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.handleText = handleText;
|
|
61
|
-
/**
|
|
62
|
-
* Fetches a resource as JSON.
|
|
63
|
-
* @param req - The request object.
|
|
64
|
-
* @param res - The response object.
|
|
65
|
-
* @param uri - The URI to fetch from.
|
|
66
|
-
* @throws ClientError - If the response is not ok.
|
|
67
|
-
* @returns The fetched JSON data.
|
|
68
|
-
*/
|
|
69
|
-
async function handleJson(req, res, uri) {
|
|
70
|
-
if (res.ok) {
|
|
71
|
-
return res.json();
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
throw new ClientError(await res.text(), this, res, req, uri);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.handleJson = handleJson;
|
|
78
|
-
/**
|
|
79
|
-
* Checks if a client has access to a resource.
|
|
80
|
-
* @param accessCondition - The condition to check to get access.
|
|
81
|
-
* @throws ClientError - If the condition is true.
|
|
82
|
-
*/
|
|
83
|
-
function handleAccess(accessCondition) {
|
|
84
|
-
if (!accessCondition) {
|
|
85
|
-
throw new ClientError(leaves_client_1.ACCESS_DENIED, this, leaves_client_1.UNAUTHORIZED);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.handleAccess = handleAccess;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleAccess = exports.handleJson = exports.handleText = exports.isClientError = void 0;
|
|
4
|
+
const leaves_client_1 = require("../leaves-client");
|
|
5
|
+
/**
|
|
6
|
+
* Represents a client-side error.
|
|
7
|
+
*/
|
|
8
|
+
class ClientError extends Error {
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a ClientError.
|
|
11
|
+
* @param message - The error message.
|
|
12
|
+
* @param client - The BaseClient that generated the error.
|
|
13
|
+
* @param response - The server's response.
|
|
14
|
+
* @param request - The original request.
|
|
15
|
+
* @param uri - The URI to which the request was sent.
|
|
16
|
+
*/
|
|
17
|
+
constructor(message, client, response, request, uri) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.client = client;
|
|
20
|
+
this.response = response;
|
|
21
|
+
this.request = request;
|
|
22
|
+
this.uri = uri;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Type guard for ClientError.
|
|
27
|
+
* @param object - The object to check.
|
|
28
|
+
* @returns True if the object is a ClientError; otherwise, false.
|
|
29
|
+
*/
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
function isClientError(object) {
|
|
32
|
+
return (object instanceof ClientError ||
|
|
33
|
+
('client' in object &&
|
|
34
|
+
'message' in object &&
|
|
35
|
+
'host' in object.client &&
|
|
36
|
+
'isPasswordProtected' in object.client &&
|
|
37
|
+
'subdomain' in object.client &&
|
|
38
|
+
'response' in object &&
|
|
39
|
+
'status' in object.response &&
|
|
40
|
+
!isNaN(object.response.status)));
|
|
41
|
+
}
|
|
42
|
+
exports.isClientError = isClientError;
|
|
43
|
+
/**
|
|
44
|
+
* Fetches a resource as text.
|
|
45
|
+
* @param req - The request object.
|
|
46
|
+
* @param res - The response object.
|
|
47
|
+
* @param uri - The URI to fetch from.
|
|
48
|
+
* @throws ClientError - If the response is not ok.
|
|
49
|
+
* @returns The fetched text.
|
|
50
|
+
*/
|
|
51
|
+
async function handleText(req, res, uri) {
|
|
52
|
+
const text = await res.text();
|
|
53
|
+
if (res.ok) {
|
|
54
|
+
return text;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
throw new ClientError(text, this, res, req, uri);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.handleText = handleText;
|
|
61
|
+
/**
|
|
62
|
+
* Fetches a resource as JSON.
|
|
63
|
+
* @param req - The request object.
|
|
64
|
+
* @param res - The response object.
|
|
65
|
+
* @param uri - The URI to fetch from.
|
|
66
|
+
* @throws ClientError - If the response is not ok.
|
|
67
|
+
* @returns The fetched JSON data.
|
|
68
|
+
*/
|
|
69
|
+
async function handleJson(req, res, uri) {
|
|
70
|
+
if (res.ok) {
|
|
71
|
+
return res.json();
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw new ClientError(await res.text(), this, res, req, uri);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.handleJson = handleJson;
|
|
78
|
+
/**
|
|
79
|
+
* Checks if a client has access to a resource.
|
|
80
|
+
* @param accessCondition - The condition to check to get access.
|
|
81
|
+
* @throws ClientError - If the condition is true.
|
|
82
|
+
*/
|
|
83
|
+
function handleAccess(accessCondition) {
|
|
84
|
+
if (!accessCondition) {
|
|
85
|
+
throw new ClientError(leaves_client_1.ACCESS_DENIED, this, leaves_client_1.UNAUTHORIZED);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.handleAccess = handleAccess;
|
|
89
89
|
//# sourceMappingURL=clientError.js.map
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BaseClient } from './baseClient';
|
|
2
|
-
import { isClientError } from './clientError';
|
|
3
|
-
import { IBaseClient, IClientError } from './interfaces';
|
|
4
|
-
import { HttpMethods, QueryType } from './types';
|
|
5
|
-
export { BaseClient, isClientError };
|
|
6
|
-
export type { IBaseClient, IClientError, HttpMethods, QueryType };
|
|
1
|
+
import { BaseClient } from './baseClient';
|
|
2
|
+
import { isClientError } from './clientError';
|
|
3
|
+
import { IBaseClient, IClientError } from './interfaces';
|
|
4
|
+
import { HttpMethods, QueryType } from './types';
|
|
5
|
+
export { BaseClient, isClientError };
|
|
6
|
+
export type { IBaseClient, IClientError, HttpMethods, QueryType };
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/client/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isClientError = exports.BaseClient = void 0;
|
|
4
|
-
const baseClient_1 = require("./baseClient");
|
|
5
|
-
Object.defineProperty(exports, "BaseClient", { enumerable: true, get: function () { return baseClient_1.BaseClient; } });
|
|
6
|
-
const clientError_1 = require("./clientError");
|
|
7
|
-
Object.defineProperty(exports, "isClientError", { enumerable: true, get: function () { return clientError_1.isClientError; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isClientError = exports.BaseClient = void 0;
|
|
4
|
+
const baseClient_1 = require("./baseClient");
|
|
5
|
+
Object.defineProperty(exports, "BaseClient", { enumerable: true, get: function () { return baseClient_1.BaseClient; } });
|
|
6
|
+
const clientError_1 = require("./clientError");
|
|
7
|
+
Object.defineProperty(exports, "isClientError", { enumerable: true, get: function () { return clientError_1.isClientError; } });
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
import { ErrorResponseType, HttpMethods, QueryType, RequestInitType } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* The `IBaseClient` interface outlines the structure for a base client with basic configurations for making HTTP requests.
|
|
4
|
-
*/
|
|
5
|
-
export interface IBaseClient {
|
|
6
|
-
/**
|
|
7
|
-
* The server's address to which the client makes requests.
|
|
8
|
-
*/
|
|
9
|
-
readonly host: string;
|
|
10
|
-
/**
|
|
11
|
-
* Fetches a response from the given path.
|
|
12
|
-
* @param path - The path of the resource.
|
|
13
|
-
* @param query - Optional query.
|
|
14
|
-
* @param init - Optional request initializer. Overwrites default settings.
|
|
15
|
-
*/
|
|
16
|
-
fetch(path: string, query?: QueryType, init?: RequestInit): Promise<{
|
|
17
|
-
uri: string;
|
|
18
|
-
res: Response;
|
|
19
|
-
}>;
|
|
20
|
-
/**
|
|
21
|
-
* Gets a response from the given path.
|
|
22
|
-
* @param path - The path of the resource.
|
|
23
|
-
* @param query - Optional query.
|
|
24
|
-
* @param init - Optional request initializer. Overwrites default settings.
|
|
25
|
-
*/
|
|
26
|
-
get(path: string, query?: QueryType, init?: RequestInit): Promise<Response>;
|
|
27
|
-
/**
|
|
28
|
-
* Posts a request and gets a response from the given path.
|
|
29
|
-
* @param path - The path of the resource.
|
|
30
|
-
* @param query - Optional query.
|
|
31
|
-
* @param init - Optional request initializer. Overwrites default settings.
|
|
32
|
-
* @returns Promise that resolves with the JSON data.
|
|
33
|
-
*/
|
|
34
|
-
post(path: string, query?: QueryType, init?: RequestInitType): Promise<Response>;
|
|
35
|
-
/**
|
|
36
|
-
* Fetches a resource as text from the given path.
|
|
37
|
-
* @param path - The path of the resource.
|
|
38
|
-
* @param query - Optional query.
|
|
39
|
-
* @param init - Optional request initializer. Overwrites default settings.
|
|
40
|
-
* @returns Promise that resolves with the text data.
|
|
41
|
-
*/
|
|
42
|
-
text(path: string, query?: QueryType, init?: RequestInit): Promise<string>;
|
|
43
|
-
/**
|
|
44
|
-
* Fetches a resource as JSON from the given path.
|
|
45
|
-
* @param path - The path of the resource.
|
|
46
|
-
* @param query - Optional query.
|
|
47
|
-
* @param init - Optional request initializer. Overwrites default settings.
|
|
48
|
-
* @returns Promise that resolves with the JSON data.
|
|
49
|
-
*/
|
|
50
|
-
json<T extends object>(path: string, query?: QueryType, init?: RequestInit): Promise<T>;
|
|
51
|
-
/**
|
|
52
|
-
* Fetches a response, using the given path and method.
|
|
53
|
-
* @param method = Http method of the request.
|
|
54
|
-
* @param path - The path of the resource.
|
|
55
|
-
* @param query - Optional query.
|
|
56
|
-
* @param init - Optional request initializer. Overwrites default settings.
|
|
57
|
-
*/
|
|
58
|
-
method(method: HttpMethods, path: string, query?: QueryType, init?: RequestInitType): Promise<Response>;
|
|
59
|
-
/**
|
|
60
|
-
* Constructs a URI path by joining URI components.
|
|
61
|
-
* @param paths - Paths to encode and join.
|
|
62
|
-
* @returns encoded URI path.
|
|
63
|
-
*/
|
|
64
|
-
getPath(...paths: string[]): string;
|
|
65
|
-
/**
|
|
66
|
-
* Constructs a URI by appending a path to the host.
|
|
67
|
-
* @param path - The path to append to the host.
|
|
68
|
-
* @returns URI string.
|
|
69
|
-
*/
|
|
70
|
-
getUri(path: string): string;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Outlines the structure for a custom error type to handle client errors.
|
|
74
|
-
* It extends the built-in Error interface.
|
|
75
|
-
*/
|
|
76
|
-
export interface IClientError extends Error {
|
|
77
|
-
/**
|
|
78
|
-
* `BaseClient` that is associated with the error.
|
|
79
|
-
*/
|
|
80
|
-
readonly client: IBaseClient;
|
|
81
|
-
/**
|
|
82
|
-
* Response received from the server that caused the error.
|
|
83
|
-
*/
|
|
84
|
-
readonly response: ErrorResponseType;
|
|
85
|
-
/**
|
|
86
|
-
* Optional request that was sent which caused the error.
|
|
87
|
-
*/
|
|
88
|
-
readonly request?: RequestInit;
|
|
89
|
-
/**
|
|
90
|
-
* Optional URI to which the request was sent.
|
|
91
|
-
*/
|
|
92
|
-
readonly uri?: string;
|
|
93
|
-
}
|
|
1
|
+
import { ErrorResponseType, HttpMethods, QueryType, RequestInitType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The `IBaseClient` interface outlines the structure for a base client with basic configurations for making HTTP requests.
|
|
4
|
+
*/
|
|
5
|
+
export interface IBaseClient {
|
|
6
|
+
/**
|
|
7
|
+
* The server's address to which the client makes requests.
|
|
8
|
+
*/
|
|
9
|
+
readonly host: string;
|
|
10
|
+
/**
|
|
11
|
+
* Fetches a response from the given path.
|
|
12
|
+
* @param path - The path of the resource.
|
|
13
|
+
* @param query - Optional query.
|
|
14
|
+
* @param init - Optional request initializer. Overwrites default settings.
|
|
15
|
+
*/
|
|
16
|
+
fetch(path: string, query?: QueryType, init?: RequestInit): Promise<{
|
|
17
|
+
uri: string;
|
|
18
|
+
res: Response;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Gets a response from the given path.
|
|
22
|
+
* @param path - The path of the resource.
|
|
23
|
+
* @param query - Optional query.
|
|
24
|
+
* @param init - Optional request initializer. Overwrites default settings.
|
|
25
|
+
*/
|
|
26
|
+
get(path: string, query?: QueryType, init?: RequestInit): Promise<Response>;
|
|
27
|
+
/**
|
|
28
|
+
* Posts a request and gets a response from the given path.
|
|
29
|
+
* @param path - The path of the resource.
|
|
30
|
+
* @param query - Optional query.
|
|
31
|
+
* @param init - Optional request initializer. Overwrites default settings.
|
|
32
|
+
* @returns Promise that resolves with the JSON data.
|
|
33
|
+
*/
|
|
34
|
+
post(path: string, query?: QueryType, init?: RequestInitType): Promise<Response>;
|
|
35
|
+
/**
|
|
36
|
+
* Fetches a resource as text from the given path.
|
|
37
|
+
* @param path - The path of the resource.
|
|
38
|
+
* @param query - Optional query.
|
|
39
|
+
* @param init - Optional request initializer. Overwrites default settings.
|
|
40
|
+
* @returns Promise that resolves with the text data.
|
|
41
|
+
*/
|
|
42
|
+
text(path: string, query?: QueryType, init?: RequestInit): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Fetches a resource as JSON from the given path.
|
|
45
|
+
* @param path - The path of the resource.
|
|
46
|
+
* @param query - Optional query.
|
|
47
|
+
* @param init - Optional request initializer. Overwrites default settings.
|
|
48
|
+
* @returns Promise that resolves with the JSON data.
|
|
49
|
+
*/
|
|
50
|
+
json<T extends object>(path: string, query?: QueryType, init?: RequestInit): Promise<T>;
|
|
51
|
+
/**
|
|
52
|
+
* Fetches a response, using the given path and method.
|
|
53
|
+
* @param method = Http method of the request.
|
|
54
|
+
* @param path - The path of the resource.
|
|
55
|
+
* @param query - Optional query.
|
|
56
|
+
* @param init - Optional request initializer. Overwrites default settings.
|
|
57
|
+
*/
|
|
58
|
+
method(method: HttpMethods, path: string, query?: QueryType, init?: RequestInitType): Promise<Response>;
|
|
59
|
+
/**
|
|
60
|
+
* Constructs a URI path by joining URI components.
|
|
61
|
+
* @param paths - Paths to encode and join.
|
|
62
|
+
* @returns encoded URI path.
|
|
63
|
+
*/
|
|
64
|
+
getPath(...paths: string[]): string;
|
|
65
|
+
/**
|
|
66
|
+
* Constructs a URI by appending a path to the host.
|
|
67
|
+
* @param path - The path to append to the host.
|
|
68
|
+
* @returns URI string.
|
|
69
|
+
*/
|
|
70
|
+
getUri(path: string): string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Outlines the structure for a custom error type to handle client errors.
|
|
74
|
+
* It extends the built-in Error interface.
|
|
75
|
+
*/
|
|
76
|
+
export interface IClientError extends Error {
|
|
77
|
+
/**
|
|
78
|
+
* `BaseClient` that is associated with the error.
|
|
79
|
+
*/
|
|
80
|
+
readonly client: IBaseClient;
|
|
81
|
+
/**
|
|
82
|
+
* Response received from the server that caused the error.
|
|
83
|
+
*/
|
|
84
|
+
readonly response: ErrorResponseType;
|
|
85
|
+
/**
|
|
86
|
+
* Optional request that was sent which caused the error.
|
|
87
|
+
*/
|
|
88
|
+
readonly request?: RequestInit;
|
|
89
|
+
/**
|
|
90
|
+
* Optional URI to which the request was sent.
|
|
91
|
+
*/
|
|
92
|
+
readonly uri?: string;
|
|
93
|
+
}
|
|
94
94
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=interfaces.js.map
|
package/dist/client/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `ErrorResponseType` type represents a server response that contains a client side error.
|
|
3
|
-
* It includes the mandatory 'status' property from the Response object.
|
|
4
|
-
* All other properties are optional.
|
|
5
|
-
*/
|
|
6
|
-
export type ErrorResponseType = Partial<Omit<Response, 'status'>> & Pick<Response, 'status'>;
|
|
7
|
-
export type HttpMethods = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace' | 'connect';
|
|
8
|
-
export type QueryType = string[][] | Record<string, string> | string | URLSearchParams;
|
|
9
|
-
export type RequestInitType = Omit<RequestInit, 'method'>;
|
|
1
|
+
/**
|
|
2
|
+
* The `ErrorResponseType` type represents a server response that contains a client side error.
|
|
3
|
+
* It includes the mandatory 'status' property from the Response object.
|
|
4
|
+
* All other properties are optional.
|
|
5
|
+
*/
|
|
6
|
+
export type ErrorResponseType = Partial<Omit<Response, 'status'>> & Pick<Response, 'status'>;
|
|
7
|
+
export type HttpMethods = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace' | 'connect';
|
|
8
|
+
export type QueryType = string[][] | Record<string, string> | string | URLSearchParams;
|
|
9
|
+
export type RequestInitType = Omit<RequestInit, 'method'>;
|
|
10
10
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/client/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=types.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HttpMethods, IBaseClient, IClientError, QueryType } from './client';
|
|
2
|
-
import { ILeavesClient } from './leaves-client';
|
|
3
|
-
import {
|
|
4
|
-
export * from './leaves-client';
|
|
5
|
-
export * from './client';
|
|
6
|
-
export type { ILeavesClient, PagePropsResponseType
|
|
7
|
-
export type { IBaseClient, IClientError, HttpMethods, QueryType };
|
|
1
|
+
import { HttpMethods, IBaseClient, IClientError, QueryType } from './client';
|
|
2
|
+
import { ILeavesClient } from './leaves-client';
|
|
3
|
+
import { PagePropsResponseType } from './leaves-client/types';
|
|
4
|
+
export * from './leaves-client';
|
|
5
|
+
export * from './client';
|
|
6
|
+
export type { ILeavesClient, PagePropsResponseType };
|
|
7
|
+
export type { IBaseClient, IClientError, HttpMethods, QueryType };
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AAEzB,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,CAAC;AACrD,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./leaves-client"), exports);
|
|
18
|
-
__exportStar(require("./client"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./leaves-client"), exports);
|
|
18
|
+
__exportStar(require("./client"), exports);
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { ErrorResponseType } from '../client/types';
|
|
2
|
-
export declare const ADMIN_TOKEN: string | undefined;
|
|
3
|
-
export declare const SUBDOMAIN: string | undefined;
|
|
4
|
-
export declare const AUTH_HEADER: {
|
|
5
|
-
Authorization: string;
|
|
6
|
-
} | undefined;
|
|
7
|
-
export declare const API_ENDPOINT: string;
|
|
8
|
-
export declare const ENDPOINT: string;
|
|
9
|
-
export declare const HEADERS: {
|
|
10
|
-
Authorization: string;
|
|
11
|
-
} | undefined;
|
|
12
|
-
export declare const NAVIGATION_ROUTE = "navigation";
|
|
13
|
-
export declare const PATHS_ROUTE = "paths";
|
|
14
|
-
export declare const HOSTING_LOCATION_ROUTE = "hosting-location";
|
|
15
|
-
export declare const HIDDEN_PAGES_ROUTE = "hidden-pages";
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
1
|
+
import { ErrorResponseType } from '../client/types';
|
|
2
|
+
export declare const ADMIN_TOKEN: string | undefined;
|
|
3
|
+
export declare const SUBDOMAIN: string | undefined;
|
|
4
|
+
export declare const AUTH_HEADER: {
|
|
5
|
+
Authorization: string;
|
|
6
|
+
} | undefined;
|
|
7
|
+
export declare const API_ENDPOINT: string;
|
|
8
|
+
export declare const ENDPOINT: string;
|
|
9
|
+
export declare const HEADERS: {
|
|
10
|
+
Authorization: string;
|
|
11
|
+
} | undefined;
|
|
12
|
+
export declare const NAVIGATION_ROUTE = "navigation";
|
|
13
|
+
export declare const PATHS_ROUTE = "paths";
|
|
14
|
+
export declare const HOSTING_LOCATION_ROUTE = "hosting-location";
|
|
15
|
+
export declare const HIDDEN_PAGES_ROUTE = "hidden-pages";
|
|
16
|
+
export declare const PLAN_ROUTE = "plan";
|
|
17
|
+
export declare const PLAN_BY_ID_ROUTE = "planById";
|
|
18
|
+
export declare const ORG_BY_ID_ROUTE = "byId";
|
|
19
|
+
export declare const UNAUTHORIZED: ErrorResponseType;
|
|
20
|
+
export declare const ACCESS_DENIED = "Access denied. Not authorized to access protected content.";
|
|
21
|
+
export declare const IS_PASSWORD_PROTECTED: boolean;
|
|
19
22
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/leaves-client/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,WAAW,oBAA0B,CAAC;AACnD,eAAO,MAAM,SAAS,oBAAwB,CAAC;AAC/C,eAAO,MAAM,WAAW;;aAAuE,CAAC;AAChG,eAAO,MAAM,YAAY,QAAsD,CAAC;AAChF,eAAO,MAAM,QAAQ,QAAwB,CAAC;AAC9C,eAAO,MAAM,OAAO;;aAAc,CAAC;AACnC,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAC7C,eAAO,MAAM,WAAW,UAAU,CAAC;AACnC,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AACjD,eAAO,MAAM,YAAY,EAAE,iBAAmC,CAAC;AAC/D,eAAO,MAAM,aAAa,+DAA+D,CAAC;AAC1F,eAAO,MAAM,qBAAqB,SAA+C,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/leaves-client/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,WAAW,oBAA0B,CAAC;AACnD,eAAO,MAAM,SAAS,oBAAwB,CAAC;AAC/C,eAAO,MAAM,WAAW;;aAAuE,CAAC;AAChG,eAAO,MAAM,YAAY,QAAsD,CAAC;AAChF,eAAO,MAAM,QAAQ,QAAwB,CAAC;AAC9C,eAAO,MAAM,OAAO;;aAAc,CAAC;AACnC,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAC7C,eAAO,MAAM,WAAW,UAAU,CAAC;AACnC,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AACjD,eAAO,MAAM,UAAU,SAAS,CAAC;AACjC,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAC3C,eAAO,MAAM,eAAe,SAAS,CAAC;AAEtC,eAAO,MAAM,YAAY,EAAE,iBAAmC,CAAC;AAC/D,eAAO,MAAM,aAAa,+DAA+D,CAAC;AAC1F,eAAO,MAAM,qBAAqB,SAA+C,CAAC"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IS_PASSWORD_PROTECTED = exports.ACCESS_DENIED = exports.UNAUTHORIZED = exports.HIDDEN_PAGES_ROUTE = exports.HOSTING_LOCATION_ROUTE = exports.PATHS_ROUTE = exports.NAVIGATION_ROUTE = exports.HEADERS = exports.ENDPOINT = exports.API_ENDPOINT = exports.AUTH_HEADER = exports.SUBDOMAIN = exports.ADMIN_TOKEN = void 0;
|
|
4
|
-
exports.ADMIN_TOKEN = process.env.ADMIN_TOKEN;
|
|
5
|
-
exports.SUBDOMAIN = process.env.SUBDOMAIN;
|
|
6
|
-
exports.AUTH_HEADER = exports.ADMIN_TOKEN ? { Authorization: `Bearer ${exports.ADMIN_TOKEN}` } : undefined;
|
|
7
|
-
exports.API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:5000';
|
|
8
|
-
exports.ENDPOINT = `${exports.API_ENDPOINT}/api`;
|
|
9
|
-
exports.HEADERS = exports.AUTH_HEADER;
|
|
10
|
-
exports.NAVIGATION_ROUTE = 'navigation';
|
|
11
|
-
exports.PATHS_ROUTE = 'paths';
|
|
12
|
-
exports.HOSTING_LOCATION_ROUTE = 'hosting-location';
|
|
13
|
-
exports.HIDDEN_PAGES_ROUTE = 'hidden-pages';
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IS_PASSWORD_PROTECTED = exports.ACCESS_DENIED = exports.UNAUTHORIZED = exports.ORG_BY_ID_ROUTE = exports.PLAN_BY_ID_ROUTE = exports.PLAN_ROUTE = exports.HIDDEN_PAGES_ROUTE = exports.HOSTING_LOCATION_ROUTE = exports.PATHS_ROUTE = exports.NAVIGATION_ROUTE = exports.HEADERS = exports.ENDPOINT = exports.API_ENDPOINT = exports.AUTH_HEADER = exports.SUBDOMAIN = exports.ADMIN_TOKEN = void 0;
|
|
4
|
+
exports.ADMIN_TOKEN = process.env.ADMIN_TOKEN;
|
|
5
|
+
exports.SUBDOMAIN = process.env.SUBDOMAIN;
|
|
6
|
+
exports.AUTH_HEADER = exports.ADMIN_TOKEN ? { Authorization: `Bearer ${exports.ADMIN_TOKEN}` } : undefined;
|
|
7
|
+
exports.API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:5000';
|
|
8
|
+
exports.ENDPOINT = `${exports.API_ENDPOINT}/api`;
|
|
9
|
+
exports.HEADERS = exports.AUTH_HEADER;
|
|
10
|
+
exports.NAVIGATION_ROUTE = 'navigation';
|
|
11
|
+
exports.PATHS_ROUTE = 'paths';
|
|
12
|
+
exports.HOSTING_LOCATION_ROUTE = 'hosting-location';
|
|
13
|
+
exports.HIDDEN_PAGES_ROUTE = 'hidden-pages';
|
|
14
|
+
exports.PLAN_ROUTE = 'plan';
|
|
15
|
+
exports.PLAN_BY_ID_ROUTE = 'planById';
|
|
16
|
+
exports.ORG_BY_ID_ROUTE = 'byId';
|
|
17
|
+
exports.UNAUTHORIZED = { status: 401 };
|
|
18
|
+
exports.ACCESS_DENIED = 'Access denied. Not authorized to access protected content.';
|
|
19
|
+
exports.IS_PASSWORD_PROTECTED = process.env.IS_PASSWORD_PROTECTED === 'true';
|
|
17
20
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/leaves-client/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AACtC,QAAA,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;AAClC,QAAA,WAAW,GAAG,mBAAW,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,mBAAW,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,QAAA,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,uBAAuB,CAAC;AACnE,QAAA,QAAQ,GAAG,GAAG,oBAAY,MAAM,CAAC;AACjC,QAAA,OAAO,GAAG,mBAAW,CAAC;AACtB,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAChC,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,sBAAsB,GAAG,kBAAkB,CAAC;AAC5C,QAAA,kBAAkB,GAAG,cAAc,CAAC;AACpC,QAAA,YAAY,GAAsB,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAClD,QAAA,aAAa,GAAG,4DAA4D,CAAC;AAC7E,QAAA,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/leaves-client/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AACtC,QAAA,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;AAClC,QAAA,WAAW,GAAG,mBAAW,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,mBAAW,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,QAAA,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,uBAAuB,CAAC;AACnE,QAAA,QAAQ,GAAG,GAAG,oBAAY,MAAM,CAAC;AACjC,QAAA,OAAO,GAAG,mBAAW,CAAC;AACtB,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAChC,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,sBAAsB,GAAG,kBAAkB,CAAC;AAC5C,QAAA,kBAAkB,GAAG,cAAc,CAAC;AACpC,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,gBAAgB,GAAG,UAAU,CAAC;AAC9B,QAAA,eAAe,GAAG,MAAM,CAAC;AAEzB,QAAA,YAAY,GAAsB,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAClD,QAAA,aAAa,GAAG,4DAA4D,CAAC;AAC7E,QAAA,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,MAAM,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ILeavesClient } from './interfaces';
|
|
2
|
-
import getLeavesClient from './leavesClient';
|
|
3
|
-
export { getLeavesClient };
|
|
4
|
-
export * from './constants';
|
|
5
|
-
export type { ILeavesClient };
|
|
1
|
+
import { ILeavesClient } from './interfaces';
|
|
2
|
+
import getLeavesClient from './leavesClient';
|
|
3
|
+
export { getLeavesClient };
|
|
4
|
+
export * from './constants';
|
|
5
|
+
export type { ILeavesClient };
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|