@newfold/huapi-js 1.2.6 → 1.2.7
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/dist/handlers/sites/data/sites.d.ts +19 -0
- package/dist/handlers/sites/data/sites.js +178 -0
- package/dist/handlers/sites/getHostingSitesHandler.d.ts +9 -0
- package/dist/handlers/sites/getHostingSitesHandler.js +17 -0
- package/{src/msw/handlers/index.js → dist/handlers.msw.d.ts} +1 -1
- package/dist/handlers.msw.js +21 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +51 -0
- package/dist/index.msw.d.ts +15 -0
- package/dist/index.msw.js +24 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +19 -0
- package/dist/models/site.d.ts +18 -0
- package/dist/models/site.js +9 -0
- package/dist/models/siteList.d.ts +23 -0
- package/dist/models/siteList.js +2 -0
- package/dist/models/siteSso.d.ts +14 -0
- package/dist/models/siteSso.js +9 -0
- package/package.json +9 -6
- package/openapi.json +0 -209
- package/orval.config.js +0 -22
- package/prettier.config.js +0 -4
- package/src/msw/handlers/sites/data/sites.js +0 -172
- package/src/msw/handlers/sites/getHostingSitesHandler.js +0 -24
- package/src/msw/sites.js +0 -153
- package/tsconfig.json +0 -101
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const getResponseByStatus: (responseKey: string, status: number) => {
|
|
2
|
+
message: string;
|
|
3
|
+
limit?: undefined;
|
|
4
|
+
n_pages?: undefined;
|
|
5
|
+
n_rows?: undefined;
|
|
6
|
+
page?: undefined;
|
|
7
|
+
rows?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
limit: number;
|
|
10
|
+
n_pages: number;
|
|
11
|
+
n_rows: number;
|
|
12
|
+
page: number;
|
|
13
|
+
rows: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
url: string;
|
|
17
|
+
}[];
|
|
18
|
+
message?: undefined;
|
|
19
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getResponseByStatus = void 0;
|
|
4
|
+
const rows = [
|
|
5
|
+
{
|
|
6
|
+
id: '1',
|
|
7
|
+
name: 'Site 1',
|
|
8
|
+
url: 'https://site-1.com',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: '2',
|
|
12
|
+
name: 'Site 2',
|
|
13
|
+
url: 'https://site-2.com',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: '3',
|
|
17
|
+
name: 'Site 3',
|
|
18
|
+
url: 'https://site-3.com',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: '4',
|
|
22
|
+
name: 'Site 4',
|
|
23
|
+
url: 'https://site-4.com',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: '5',
|
|
27
|
+
name: 'Site 5',
|
|
28
|
+
url: 'https://site-5.com',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: '6',
|
|
32
|
+
name: 'Site 6',
|
|
33
|
+
url: 'https://site-6.com',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: '7',
|
|
37
|
+
name: 'Site 7',
|
|
38
|
+
url: 'https://site-7.com',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: '8',
|
|
42
|
+
name: 'Site 8',
|
|
43
|
+
url: 'https://site-8.com',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: '9',
|
|
47
|
+
name: 'Site 9',
|
|
48
|
+
url: 'https://site-9.com',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: '10',
|
|
52
|
+
name: 'Site 10',
|
|
53
|
+
url: 'https://site-10.com',
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
const getResponseByStatus = (responseKey, status) => {
|
|
57
|
+
switch (status) {
|
|
58
|
+
case 500 - 599:
|
|
59
|
+
return {
|
|
60
|
+
message: 'Something went wrong',
|
|
61
|
+
};
|
|
62
|
+
case 200 - 299:
|
|
63
|
+
default:
|
|
64
|
+
switch (responseKey) {
|
|
65
|
+
case '0':
|
|
66
|
+
return {
|
|
67
|
+
limit: 10,
|
|
68
|
+
n_pages: 0,
|
|
69
|
+
n_rows: 0,
|
|
70
|
+
page: 1,
|
|
71
|
+
rows: [],
|
|
72
|
+
};
|
|
73
|
+
case '1':
|
|
74
|
+
return {
|
|
75
|
+
limit: 10,
|
|
76
|
+
n_pages: 1,
|
|
77
|
+
n_rows: 1,
|
|
78
|
+
page: 1,
|
|
79
|
+
rows: [rows[0]],
|
|
80
|
+
};
|
|
81
|
+
default:
|
|
82
|
+
case 'some':
|
|
83
|
+
return {
|
|
84
|
+
limit: 10,
|
|
85
|
+
n_pages: 1,
|
|
86
|
+
n_rows: 3,
|
|
87
|
+
page: 1,
|
|
88
|
+
rows,
|
|
89
|
+
};
|
|
90
|
+
case 'many':
|
|
91
|
+
return {
|
|
92
|
+
limit: 10,
|
|
93
|
+
n_pages: 50,
|
|
94
|
+
n_rows: 3,
|
|
95
|
+
page: 1,
|
|
96
|
+
rows: [
|
|
97
|
+
...rows,
|
|
98
|
+
{
|
|
99
|
+
id: '11',
|
|
100
|
+
name: 'Site 11',
|
|
101
|
+
url: 'https://site-11.com',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: '12',
|
|
105
|
+
name: 'Site 12',
|
|
106
|
+
url: 'https://site-12.com',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: '13',
|
|
110
|
+
name: 'Site 13',
|
|
111
|
+
url: 'https://site-13.com',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: '14',
|
|
115
|
+
name: 'Site 14',
|
|
116
|
+
url: 'https://site-14.com',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: '15',
|
|
120
|
+
name: 'Site 15',
|
|
121
|
+
url: 'https://site-15.com',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: '16',
|
|
125
|
+
name: 'Site 16',
|
|
126
|
+
url: 'https://site-16.com',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: '17',
|
|
130
|
+
name: 'Site 17',
|
|
131
|
+
url: 'https://site-17.com',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: '18',
|
|
135
|
+
name: 'Site 18',
|
|
136
|
+
url: 'https://site-18.com',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: '19',
|
|
140
|
+
name: 'Site 19',
|
|
141
|
+
url: 'https://site-19.com',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: '20',
|
|
145
|
+
name: 'Site 20',
|
|
146
|
+
url: 'https://site-20.com',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: '21',
|
|
150
|
+
name: 'Site 21',
|
|
151
|
+
url: 'https://site-21.com',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: '22',
|
|
155
|
+
name: 'Site 22',
|
|
156
|
+
url: 'https://site-22.com',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: '23',
|
|
160
|
+
name: 'Site 23',
|
|
161
|
+
url: 'https://site-23.com',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: '24',
|
|
165
|
+
name: 'Site 24',
|
|
166
|
+
url: 'https://site-24.com',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: '25',
|
|
170
|
+
name: 'Site 25',
|
|
171
|
+
url: 'https://site-25.com',
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
exports.getResponseByStatus = getResponseByStatus;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* getHostingSitesHandler
|
|
3
|
+
* @param {string} responseKey - the key of the response to return from the responses object
|
|
4
|
+
* @param {int} status - the status code to mock
|
|
5
|
+
* @param {int} delay - the delay in ms to wait before returning the response
|
|
6
|
+
* @returns - a msw handler
|
|
7
|
+
*/
|
|
8
|
+
export declare function getHostingSitesHandler(responseKey?: string, // int or string
|
|
9
|
+
status?: number, delay?: number): import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHostingSitesHandler = void 0;
|
|
4
|
+
const msw_1 = require("msw");
|
|
5
|
+
const sites_1 = require("./data/sites");
|
|
6
|
+
/**
|
|
7
|
+
* getHostingSitesHandler
|
|
8
|
+
* @param {string} responseKey - the key of the response to return from the responses object
|
|
9
|
+
* @param {int} status - the status code to mock
|
|
10
|
+
* @param {int} delay - the delay in ms to wait before returning the response
|
|
11
|
+
* @returns - a msw handler
|
|
12
|
+
*/
|
|
13
|
+
function getHostingSitesHandler(responseKey = '1', // int or string
|
|
14
|
+
status = 200, delay = 1000) {
|
|
15
|
+
return msw_1.rest.get('*/hosting/:hostingId/sites', (req, res, ctx) => res(ctx.delay(delay), ctx.status(status, 'Mocked status'), ctx.json((0, sites_1.getResponseByStatus)(responseKey, status))));
|
|
16
|
+
}
|
|
17
|
+
exports.getHostingSitesHandler = getHostingSitesHandler;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
/**
|
|
18
|
+
* NOTE: this will move to @newfold/huapi-js in the future
|
|
19
|
+
* Usage: `import { getHostingSitesHandler } from '@newfold/huapi-js';`
|
|
20
|
+
*/
|
|
21
|
+
__exportStar(require("./handlers/sites/getHostingSitesHandler"), exports);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
* Hosting UAPI
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
|
|
9
|
+
import { UseQueryOptions, UseMutationOptions, UseQueryResult, QueryKey } from 'react-query';
|
|
10
|
+
import type { SiteSso, SiteList } from './models';
|
|
11
|
+
declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
12
|
+
/**
|
|
13
|
+
* TODO
|
|
14
|
+
* @summary Get SSO token
|
|
15
|
+
*/
|
|
16
|
+
export declare const siteSso: (siteId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<SiteSso>>;
|
|
17
|
+
export declare type SiteSsoMutationResult = NonNullable<AsyncReturnType<typeof siteSso>>;
|
|
18
|
+
export declare type SiteSsoMutationError = AxiosError<unknown>;
|
|
19
|
+
export declare const useSiteSso: <TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
|
|
20
|
+
mutation?: UseMutationOptions<AxiosResponse<SiteSso, any>, TError, {
|
|
21
|
+
siteId: number;
|
|
22
|
+
}, TContext> | undefined;
|
|
23
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
24
|
+
} | undefined) => import("react-query").UseMutationResult<AxiosResponse<SiteSso, any>, TError, {
|
|
25
|
+
siteId: number;
|
|
26
|
+
}, TContext>;
|
|
27
|
+
/**
|
|
28
|
+
* Obtain a list of sites.
|
|
29
|
+
* @summary Get sites for a hosting id
|
|
30
|
+
*/
|
|
31
|
+
export declare const hostingSites: (hostingId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<SiteList>>;
|
|
32
|
+
export declare const getHostingSitesQueryKey: (hostingId: number) => string[];
|
|
33
|
+
export declare type HostingSitesQueryResult = NonNullable<AsyncReturnType<typeof hostingSites>>;
|
|
34
|
+
export declare type HostingSitesQueryError = AxiosError<unknown>;
|
|
35
|
+
export declare const useHostingSites: <TData = AxiosResponse<SiteList, any>, TError = AxiosError<unknown, any>>(hostingId: number, options?: {
|
|
36
|
+
query?: UseQueryOptions<AxiosResponse<SiteList, any>, TError, TData, QueryKey> | undefined;
|
|
37
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
38
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
39
|
+
queryKey: QueryKey;
|
|
40
|
+
};
|
|
41
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useHostingSites = exports.getHostingSitesQueryKey = exports.hostingSites = exports.useSiteSso = exports.siteSso = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Generated by orval v6.7.1 🍺
|
|
9
|
+
* Do not edit manually.
|
|
10
|
+
* Hosting UAPI
|
|
11
|
+
* Hosting UAPI
|
|
12
|
+
* OpenAPI spec version: 0.1.0
|
|
13
|
+
*/
|
|
14
|
+
const axios_1 = __importDefault(require("axios"));
|
|
15
|
+
const react_query_1 = require("react-query");
|
|
16
|
+
/**
|
|
17
|
+
* TODO
|
|
18
|
+
* @summary Get SSO token
|
|
19
|
+
*/
|
|
20
|
+
const siteSso = (siteId, options) => {
|
|
21
|
+
return axios_1.default.post(`/sites/${siteId}/sso`, undefined, options);
|
|
22
|
+
};
|
|
23
|
+
exports.siteSso = siteSso;
|
|
24
|
+
const useSiteSso = (options) => {
|
|
25
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
26
|
+
const mutationFn = (props) => {
|
|
27
|
+
const { siteId } = props || {};
|
|
28
|
+
return (0, exports.siteSso)(siteId, axiosOptions);
|
|
29
|
+
};
|
|
30
|
+
return (0, react_query_1.useMutation)(mutationFn, mutationOptions);
|
|
31
|
+
};
|
|
32
|
+
exports.useSiteSso = useSiteSso;
|
|
33
|
+
/**
|
|
34
|
+
* Obtain a list of sites.
|
|
35
|
+
* @summary Get sites for a hosting id
|
|
36
|
+
*/
|
|
37
|
+
const hostingSites = (hostingId, options) => {
|
|
38
|
+
return axios_1.default.get(`/hosting/${hostingId}/sites`, options);
|
|
39
|
+
};
|
|
40
|
+
exports.hostingSites = hostingSites;
|
|
41
|
+
const getHostingSitesQueryKey = (hostingId) => [`/hosting/${hostingId}/sites`];
|
|
42
|
+
exports.getHostingSitesQueryKey = getHostingSitesQueryKey;
|
|
43
|
+
const useHostingSites = (hostingId, options) => {
|
|
44
|
+
var _a;
|
|
45
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
46
|
+
const queryKey = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.queryKey) !== null && _a !== void 0 ? _a : (0, exports.getHostingSitesQueryKey)(hostingId);
|
|
47
|
+
const queryFn = () => (0, exports.hostingSites)(hostingId, axiosOptions);
|
|
48
|
+
const query = (0, react_query_1.useQuery)(queryKey, queryFn, Object.assign({ enabled: !!(hostingId) }, queryOptions));
|
|
49
|
+
return Object.assign({ queryKey }, query);
|
|
50
|
+
};
|
|
51
|
+
exports.useHostingSites = useHostingSites;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const getSiteSsoMock: () => {
|
|
2
|
+
sso: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const getHostingSitesMock: () => {
|
|
5
|
+
limit: number;
|
|
6
|
+
n_pages: number;
|
|
7
|
+
n_rows: number;
|
|
8
|
+
page: number;
|
|
9
|
+
rows: {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
url: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
export declare const getHostingUAPIMSW: () => import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHostingUAPIMSW = exports.getHostingSitesMock = exports.getSiteSsoMock = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generated by orval v6.7.1 🍺
|
|
6
|
+
* Do not edit manually.
|
|
7
|
+
* Hosting UAPI
|
|
8
|
+
* Hosting UAPI
|
|
9
|
+
* OpenAPI spec version: 0.1.0
|
|
10
|
+
*/
|
|
11
|
+
const msw_1 = require("msw");
|
|
12
|
+
const faker_1 = require("@faker-js/faker");
|
|
13
|
+
const getSiteSsoMock = () => ({ sso: faker_1.faker.random.word() });
|
|
14
|
+
exports.getSiteSsoMock = getSiteSsoMock;
|
|
15
|
+
const getHostingSitesMock = () => ({ limit: faker_1.faker.datatype.number(), n_pages: faker_1.faker.datatype.number(), n_rows: faker_1.faker.datatype.number(), page: faker_1.faker.datatype.number(), rows: [...Array(faker_1.faker.datatype.number({ min: 1, max: 10 }))].map(() => ({ id: faker_1.faker.random.word(), name: faker_1.faker.random.word(), url: faker_1.faker.random.word() })) });
|
|
16
|
+
exports.getHostingSitesMock = getHostingSitesMock;
|
|
17
|
+
const getHostingUAPIMSW = () => [
|
|
18
|
+
msw_1.rest.post('*/sites/:siteid/sso', (_req, res, ctx) => {
|
|
19
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getSiteSsoMock)()));
|
|
20
|
+
}), msw_1.rest.get('*/hosting/:hostingid/sites', (_req, res, ctx) => {
|
|
21
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getHostingSitesMock)()));
|
|
22
|
+
}),
|
|
23
|
+
];
|
|
24
|
+
exports.getHostingUAPIMSW = getHostingUAPIMSW;
|
|
@@ -0,0 +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("./siteList"), exports);
|
|
18
|
+
__exportStar(require("./site"), exports);
|
|
19
|
+
__exportStar(require("./siteSso"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
* Hosting UAPI
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A site
|
|
10
|
+
*/
|
|
11
|
+
export interface Site {
|
|
12
|
+
/** TODO */
|
|
13
|
+
id: string;
|
|
14
|
+
/** TODO */
|
|
15
|
+
name: string;
|
|
16
|
+
/** TODO */
|
|
17
|
+
url: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
* Hosting UAPI
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import type { Site } from './site';
|
|
9
|
+
/**
|
|
10
|
+
* List of sites
|
|
11
|
+
*/
|
|
12
|
+
export interface SiteList {
|
|
13
|
+
/** Max number of sites included in response */
|
|
14
|
+
limit: number;
|
|
15
|
+
/** TODO */
|
|
16
|
+
n_pages: number;
|
|
17
|
+
/** TODO */
|
|
18
|
+
n_rows: number;
|
|
19
|
+
/** TODO */
|
|
20
|
+
page: number;
|
|
21
|
+
/** TODO */
|
|
22
|
+
rows: Site[];
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newfold/huapi-js",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"main": "dist/huapi.js",
|
|
3
|
+
"version": "1.2.7",
|
|
5
4
|
"license": "MIT",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
6
10
|
"dependencies": {
|
|
7
11
|
"@faker-js/faker": "^6.1.2",
|
|
8
12
|
"axios": "^0.26.1",
|
|
@@ -15,12 +19,11 @@
|
|
|
15
19
|
"typescript": "^4.6.3"
|
|
16
20
|
},
|
|
17
21
|
"peerDependencies": {
|
|
18
|
-
"react": "^17.0.0 || ^18.0.0"
|
|
19
|
-
"react-query": "^3.34.19"
|
|
22
|
+
"react": "^17.0.0 || ^18.0.0"
|
|
20
23
|
},
|
|
21
24
|
"scripts": {
|
|
22
25
|
"orval": "orval",
|
|
23
|
-
"
|
|
24
|
-
"build": "yarn orval && yarn
|
|
26
|
+
"tsc": "npx tsc",
|
|
27
|
+
"build": "yarn orval && yarn tsc"
|
|
25
28
|
}
|
|
26
29
|
}
|
package/openapi.json
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"openapi": "3.0.0",
|
|
3
|
-
"info": {
|
|
4
|
-
"version": "0.1.0",
|
|
5
|
-
"title": "Hosting UAPI",
|
|
6
|
-
"description": "Hosting UAPI"
|
|
7
|
-
},
|
|
8
|
-
"components": {
|
|
9
|
-
"schemas": {
|
|
10
|
-
"Site": {
|
|
11
|
-
"type": "object",
|
|
12
|
-
"description": "A site",
|
|
13
|
-
"properties": {
|
|
14
|
-
"id": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "TODO",
|
|
17
|
-
"example": "1"
|
|
18
|
-
},
|
|
19
|
-
"name": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "TODO",
|
|
22
|
-
"example": "Example Site 1"
|
|
23
|
-
},
|
|
24
|
-
"url": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "TODO",
|
|
27
|
-
"example": "https://example.com"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"example": {
|
|
31
|
-
"id": 1,
|
|
32
|
-
"name": "Example Site 1",
|
|
33
|
-
"url": "https://example.com"
|
|
34
|
-
},
|
|
35
|
-
"required": ["id", "name", "url"]
|
|
36
|
-
},
|
|
37
|
-
"SiteList": {
|
|
38
|
-
"description": "List of sites",
|
|
39
|
-
"type": "object",
|
|
40
|
-
"properties": {
|
|
41
|
-
"limit": {
|
|
42
|
-
"type": "integer",
|
|
43
|
-
"description": "Max number of sites included in response",
|
|
44
|
-
"example": 10
|
|
45
|
-
},
|
|
46
|
-
"n_pages": {
|
|
47
|
-
"type": "integer",
|
|
48
|
-
"description": "TODO",
|
|
49
|
-
"example": 1
|
|
50
|
-
},
|
|
51
|
-
"n_rows": {
|
|
52
|
-
"type": "integer",
|
|
53
|
-
"description": "TODO",
|
|
54
|
-
"example": 1
|
|
55
|
-
},
|
|
56
|
-
"page": {
|
|
57
|
-
"type": "integer",
|
|
58
|
-
"description": "TODO",
|
|
59
|
-
"example": 1
|
|
60
|
-
},
|
|
61
|
-
"rows": {
|
|
62
|
-
"type": "array",
|
|
63
|
-
"description": "TODO",
|
|
64
|
-
"items": {
|
|
65
|
-
"type": "array",
|
|
66
|
-
"$ref": "#/components/schemas/Site"
|
|
67
|
-
},
|
|
68
|
-
"example": [
|
|
69
|
-
{
|
|
70
|
-
"id": "1",
|
|
71
|
-
"name": "Example Site 1",
|
|
72
|
-
"url": "https://example.com"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"id": "2",
|
|
76
|
-
"name": "Example Site 2",
|
|
77
|
-
"url": "https://example2.com"
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"example": {
|
|
83
|
-
"limit": 10,
|
|
84
|
-
"n_pages": 1,
|
|
85
|
-
"n_rows": 1,
|
|
86
|
-
"page": 1,
|
|
87
|
-
"rows": [
|
|
88
|
-
[
|
|
89
|
-
{
|
|
90
|
-
"id": "1",
|
|
91
|
-
"name": "Example Site 1",
|
|
92
|
-
"url": "https://example.com"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"id": "2",
|
|
96
|
-
"name": "Example Site 2",
|
|
97
|
-
"url": "https://example2.com"
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
]
|
|
101
|
-
},
|
|
102
|
-
"required": ["limit", "n_pages", "n_rows", "page", "rows"]
|
|
103
|
-
},
|
|
104
|
-
"SiteSso": {
|
|
105
|
-
"description": "SSO token or login URL",
|
|
106
|
-
"type": "object",
|
|
107
|
-
"properties": {
|
|
108
|
-
"sso": {
|
|
109
|
-
"type": "string",
|
|
110
|
-
"example": "$randomUrl",
|
|
111
|
-
"description": "TODO"
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
"example": {
|
|
115
|
-
"sso": "$randomUrl"
|
|
116
|
-
},
|
|
117
|
-
"required": ["sso"]
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
"securitySchemes": {
|
|
121
|
-
"bearerAuth": {
|
|
122
|
-
"type": "http",
|
|
123
|
-
"scheme": "bearer",
|
|
124
|
-
"bearerFormat": "JWT"
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
"paths": {
|
|
129
|
-
"/sites/{site_id}/sso": {
|
|
130
|
-
"post": {
|
|
131
|
-
"summary": "Get SSO token",
|
|
132
|
-
"operationId": "site_sso",
|
|
133
|
-
"description": "TODO",
|
|
134
|
-
"tags": ["sites"],
|
|
135
|
-
"security": [
|
|
136
|
-
{
|
|
137
|
-
"bearerAuth": []
|
|
138
|
-
}
|
|
139
|
-
],
|
|
140
|
-
"parameters": [
|
|
141
|
-
{
|
|
142
|
-
"name": "site_id",
|
|
143
|
-
"description": "Specify the site id to get the SSO token for.",
|
|
144
|
-
"in": "path",
|
|
145
|
-
"required": true,
|
|
146
|
-
"schema": {
|
|
147
|
-
"type": "integer",
|
|
148
|
-
"description": "Specify the site id to get the SSO token for."
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
"responses": {
|
|
153
|
-
"200": {
|
|
154
|
-
"description": "OK",
|
|
155
|
-
"content": {
|
|
156
|
-
"application/json": {
|
|
157
|
-
"schema": {
|
|
158
|
-
"$ref": "#/components/schemas/SiteSso"
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
"/hosting/{hosting_id}/sites": {
|
|
167
|
-
"get": {
|
|
168
|
-
"operationId": "hosting_sites",
|
|
169
|
-
"tags": ["sites"],
|
|
170
|
-
"security": [{ "bearerAuth": [] }],
|
|
171
|
-
"summary": "Get sites for a hosting id",
|
|
172
|
-
"description": "Obtain a list of sites.",
|
|
173
|
-
"parameters": [
|
|
174
|
-
{
|
|
175
|
-
"name": "hosting_id",
|
|
176
|
-
"in": "path",
|
|
177
|
-
"required": true,
|
|
178
|
-
"schema": {
|
|
179
|
-
"type": "integer",
|
|
180
|
-
"description": "Specify the hosting id to get sites for."
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
],
|
|
184
|
-
"responses": {
|
|
185
|
-
"200": {
|
|
186
|
-
"description": "OK",
|
|
187
|
-
"content": {
|
|
188
|
-
"application/json": {
|
|
189
|
-
"schema": {
|
|
190
|
-
"$ref": "#/components/schemas/SiteList"
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
"servers": [
|
|
200
|
-
{
|
|
201
|
-
"url": "https://api.example.com/v1",
|
|
202
|
-
"description": "Production server (uses live data)"
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
"url": "https://sandbox-api.example.com:8443/v1",
|
|
206
|
-
"description": "Sandbox server (uses test data)"
|
|
207
|
-
}
|
|
208
|
-
]
|
|
209
|
-
}
|
package/orval.config.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'orval';
|
|
2
|
-
|
|
3
|
-
const input = {
|
|
4
|
-
target: './openapi.json',
|
|
5
|
-
validation: true,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const output = {
|
|
9
|
-
mode: 'split',
|
|
10
|
-
target: './dist/huapi.ts',
|
|
11
|
-
schemas: './dist/models',
|
|
12
|
-
client: 'react-query',
|
|
13
|
-
mock: true,
|
|
14
|
-
clean: true,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default defineConfig({
|
|
18
|
-
huapi: {
|
|
19
|
-
input,
|
|
20
|
-
output,
|
|
21
|
-
},
|
|
22
|
-
});
|
package/prettier.config.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
const rows = [
|
|
2
|
-
{
|
|
3
|
-
id: '1',
|
|
4
|
-
name: 'Site 1',
|
|
5
|
-
url: 'https://www.bluehost.com',
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
id: '2',
|
|
9
|
-
name: 'Site 2',
|
|
10
|
-
url: 'https://www.web.com',
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
id: '3',
|
|
14
|
-
name: 'Site 3',
|
|
15
|
-
url: 'https://www.bluehost.com',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
id: '4',
|
|
19
|
-
name: 'Site 4',
|
|
20
|
-
url: 'https://www.web.com',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: '5',
|
|
24
|
-
name: 'Site 5',
|
|
25
|
-
url: 'https://www.bluehost.com',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: '6',
|
|
29
|
-
name: 'Site 6',
|
|
30
|
-
url: 'https://www.web.com',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: '7',
|
|
34
|
-
name: 'Site 7',
|
|
35
|
-
url: 'https://www.bluehost.com',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
id: '8',
|
|
39
|
-
name: 'Site 8',
|
|
40
|
-
url: 'https://www.web.com',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: '9',
|
|
44
|
-
name: 'Site 9',
|
|
45
|
-
url: 'https://www.bluehost.com',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: '10',
|
|
49
|
-
name: 'Site 10',
|
|
50
|
-
url: 'https://www.web.com',
|
|
51
|
-
},
|
|
52
|
-
];
|
|
53
|
-
|
|
54
|
-
export const sitesResponses = {
|
|
55
|
-
200: {
|
|
56
|
-
0: {
|
|
57
|
-
limit: 10,
|
|
58
|
-
n_pages: 0,
|
|
59
|
-
n_rows: 0,
|
|
60
|
-
page: 1,
|
|
61
|
-
rows: [],
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
1: {
|
|
65
|
-
limit: 10,
|
|
66
|
-
n_pages: 1,
|
|
67
|
-
n_rows: 1,
|
|
68
|
-
page: 1,
|
|
69
|
-
rows: [rows[0]],
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
some: {
|
|
73
|
-
limit: 10,
|
|
74
|
-
n_pages: 1,
|
|
75
|
-
n_rows: 3,
|
|
76
|
-
page: 1,
|
|
77
|
-
rows,
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
many: {
|
|
81
|
-
limit: 10,
|
|
82
|
-
n_pages: 50,
|
|
83
|
-
n_rows: 3,
|
|
84
|
-
page: 1,
|
|
85
|
-
rows: [
|
|
86
|
-
...rows,
|
|
87
|
-
{
|
|
88
|
-
id: '11',
|
|
89
|
-
name: 'Site 11',
|
|
90
|
-
url: 'https://www.bluehost.com',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
id: '12',
|
|
94
|
-
name: 'Site 12',
|
|
95
|
-
url: 'https://www.web.com',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
id: '13',
|
|
99
|
-
name: 'Site 13',
|
|
100
|
-
url: 'https://www.bluehost.com',
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: '14',
|
|
104
|
-
name: 'Site 14',
|
|
105
|
-
url: 'https://www.web.com',
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
id: '15',
|
|
109
|
-
name: 'Site 15',
|
|
110
|
-
url: 'https://www.bluehost.com',
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
id: '16',
|
|
114
|
-
name: 'Site 16',
|
|
115
|
-
url: 'https://www.web.com',
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
id: '17',
|
|
119
|
-
name: 'Site 17',
|
|
120
|
-
url: 'https://www.bluehost.com',
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: '18',
|
|
124
|
-
name: 'Site 18',
|
|
125
|
-
url: 'https://www.web.com',
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
id: '19',
|
|
129
|
-
name: 'Site 19',
|
|
130
|
-
url: 'https://www.bluehost.com',
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
id: '20',
|
|
134
|
-
name: 'Site 20',
|
|
135
|
-
url: 'https://www.web.com',
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
id: '21',
|
|
139
|
-
name: 'Site 21',
|
|
140
|
-
url: 'https://www.bluehost.com',
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
id: '22',
|
|
144
|
-
name: 'Site 22',
|
|
145
|
-
url: 'https://www.web.com',
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
id: '23',
|
|
149
|
-
name: 'Site 23',
|
|
150
|
-
url: 'https://www.bluehost.com',
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
id: '24',
|
|
154
|
-
name: 'Site 24',
|
|
155
|
-
url: 'https://www.web.com',
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
id: '25',
|
|
159
|
-
name: 'Site 25',
|
|
160
|
-
url: 'https://www.bluehost.com',
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
500: {
|
|
166
|
-
0: {
|
|
167
|
-
message: 'Something went wrong',
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export default sitesResponses;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { rest } from 'msw';
|
|
2
|
-
|
|
3
|
-
import responses from './data/sites';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* getHostingSitesHandler
|
|
7
|
-
* @param {string} responseKey - the key of the response to return from the responses object
|
|
8
|
-
* @param {int} status - the status code to mock
|
|
9
|
-
* @param {int} delay - the delay in ms to wait before returning the response
|
|
10
|
-
* @returns - a msw handler
|
|
11
|
-
*/
|
|
12
|
-
export function getHostingSitesHandler(
|
|
13
|
-
responseKey = 1, // int or string
|
|
14
|
-
status = 200,
|
|
15
|
-
delay = 1000,
|
|
16
|
-
) {
|
|
17
|
-
return rest.get('*/hosting/:hostingId/sites', (req, res, ctx) =>
|
|
18
|
-
res(
|
|
19
|
-
ctx.delay(delay),
|
|
20
|
-
ctx.status(status, 'Mocked status'),
|
|
21
|
-
ctx.json(responses[status][responseKey ?? 0]),
|
|
22
|
-
),
|
|
23
|
-
);
|
|
24
|
-
}
|
package/src/msw/sites.js
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
const sitesCollection = [
|
|
2
|
-
{
|
|
3
|
-
id: '1',
|
|
4
|
-
name: 'Coffee Beans',
|
|
5
|
-
url: 'https://coffeebeans.com',
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
id: '2',
|
|
9
|
-
name: 'Chilli Beans',
|
|
10
|
-
url: 'https://chillibeans.com',
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
id: '3',
|
|
14
|
-
name: 'Cannellini Beans',
|
|
15
|
-
url: 'https://cannellinibeans.com',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
id: '4',
|
|
19
|
-
name: 'Soy Beans',
|
|
20
|
-
url: 'https://soybeans.com',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: '5',
|
|
24
|
-
name: 'Cool Beans',
|
|
25
|
-
url: 'https://coolbeans.com',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: '6',
|
|
29
|
-
name: 'Hot Beans',
|
|
30
|
-
url: 'https://hotbeans.com',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: '7',
|
|
34
|
-
name: 'Black Beans',
|
|
35
|
-
url: 'https://blackbeans.com',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
id: '8',
|
|
39
|
-
name: 'Pinto Beans',
|
|
40
|
-
url: 'https://pintobeans.com',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: '9',
|
|
44
|
-
name: 'Refried Beans',
|
|
45
|
-
url: 'https://refriedbeans.com',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: '10',
|
|
49
|
-
name: 'Baked Beans',
|
|
50
|
-
url: 'https://bakedbeans.com',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
id: '11',
|
|
54
|
-
name: 'Lima Beans',
|
|
55
|
-
url: 'https://limabeans.com',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: '12',
|
|
59
|
-
name: 'Kidney Beans',
|
|
60
|
-
url: 'https://kidneybeans.com',
|
|
61
|
-
},
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
export const sites = ({ responseType, page }) => {
|
|
65
|
-
const pageOne = {
|
|
66
|
-
limit: 10,
|
|
67
|
-
n_pages: 2,
|
|
68
|
-
n_rows: 3,
|
|
69
|
-
page: 1,
|
|
70
|
-
rows: sitesCollection,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const pageTwo = {
|
|
74
|
-
limit: 10,
|
|
75
|
-
n_pages: 2,
|
|
76
|
-
n_rows: 3,
|
|
77
|
-
page: 2,
|
|
78
|
-
rows: [
|
|
79
|
-
{
|
|
80
|
-
id: '11',
|
|
81
|
-
name: 'Bob the Blog',
|
|
82
|
-
url: 'https://bobtheblog.com',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
id: '12',
|
|
86
|
-
name: 'Wendy the Website',
|
|
87
|
-
url: 'https://wendythewebsite.com',
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: '13',
|
|
91
|
-
name: 'Cathy the Coding Camp',
|
|
92
|
-
url: 'https://cathythecodingcamp.com',
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: '14',
|
|
96
|
-
name: 'Harry Potter',
|
|
97
|
-
url: 'https://hogwarts.com',
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
id: '15',
|
|
101
|
-
name: 'Cool Beans',
|
|
102
|
-
url: 'https://coolbeans.com',
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
id: '16',
|
|
106
|
-
name: 'Hot Beans',
|
|
107
|
-
url: 'https://hotbeans.com',
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
id: '17',
|
|
111
|
-
name: 'Black Beans',
|
|
112
|
-
url: 'https://blackbeans.com',
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
id: '18',
|
|
116
|
-
name: 'Pinto Beans',
|
|
117
|
-
url: 'https://pintobeans.com',
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: '19',
|
|
121
|
-
name: 'Refried Beans',
|
|
122
|
-
url: 'https://refriedbeans.com',
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
id: '20',
|
|
126
|
-
name: 'Baked Beans',
|
|
127
|
-
url: 'https://bakedbeans.com',
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const resp = page === 1 ? pageOne : pageTwo;
|
|
133
|
-
switch (responseType) {
|
|
134
|
-
case 'empty':
|
|
135
|
-
resp.rows = [];
|
|
136
|
-
break;
|
|
137
|
-
case 'one':
|
|
138
|
-
resp.rows = resp.rows[0];
|
|
139
|
-
break;
|
|
140
|
-
case 'some':
|
|
141
|
-
resp.rows = resp.rows.slice(0, 5);
|
|
142
|
-
break;
|
|
143
|
-
default:
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
return resp;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// TODO: would be nice if we could take in the param (siteId) and return the proper site,
|
|
150
|
-
// but currently we are just dumbly returning the same site regardless of siteId
|
|
151
|
-
export const site = sitesCollection[0];
|
|
152
|
-
|
|
153
|
-
export const siteSso = `${sitesCollection[0].url}/wp-login.php?ssotoken=1234567890`;
|
package/tsconfig.json
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
-
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
|
20
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
|
22
|
-
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
-
|
|
26
|
-
/* Modules */
|
|
27
|
-
"module": "commonjs", /* Specify what module code is generated. */
|
|
28
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
29
|
-
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
30
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
31
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
32
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
33
|
-
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
|
34
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
35
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
36
|
-
// "resolveJsonModule": true, /* Enable importing .json files */
|
|
37
|
-
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
|
38
|
-
|
|
39
|
-
/* JavaScript Support */
|
|
40
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
|
41
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
42
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
|
43
|
-
|
|
44
|
-
/* Emit */
|
|
45
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
46
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
47
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
48
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
49
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
|
50
|
-
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
51
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
52
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
53
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
54
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
|
55
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
56
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
57
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
58
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
60
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
61
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
62
|
-
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
|
63
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
|
64
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
65
|
-
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
|
66
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
67
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
68
|
-
|
|
69
|
-
/* Interop Constraints */
|
|
70
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
71
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
72
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
|
73
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
74
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
75
|
-
|
|
76
|
-
/* Type Checking */
|
|
77
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
78
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
|
79
|
-
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
|
80
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
81
|
-
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
|
82
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
83
|
-
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
|
84
|
-
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
|
85
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
86
|
-
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
|
87
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
|
88
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
89
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
90
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
91
|
-
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
92
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
93
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
|
94
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
95
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
96
|
-
|
|
97
|
-
/* Completeness */
|
|
98
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
|
-
}
|
|
101
|
-
}
|