@newfold/huapi-js 1.401.0 → 1.413.0-alpha.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 +0 -0
- package/package.json +2 -1
- package/src/index.d.ts +141 -6
- package/src/index.js +69 -3
- package/src/index.msw.d.ts +565 -0
- package/src/index.msw.js +306 -0
- package/src/index.schemas.d.ts +996 -0
- package/src/index.schemas.js +85 -0
package/README.md
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Hosting UAPI
|
|
5
5
|
* Hosting UAPI is an API to expose Hosting, Addons, and Site functionality to a customer-facing Front End such as (Account Manager).
|
|
6
|
-
* OpenAPI spec version: 1.
|
|
6
|
+
* OpenAPI spec version: 1.413.0
|
|
7
7
|
*/
|
|
8
8
|
import axios from 'axios';
|
|
9
9
|
import type { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
|
|
@@ -342,7 +342,8 @@ export declare type SitesInfo200 = {
|
|
|
342
342
|
url: string;
|
|
343
343
|
version: string;
|
|
344
344
|
versionLatest?: string;
|
|
345
|
-
|
|
345
|
+
/** The Php Version. If unable to determine, it will be NULL */
|
|
346
|
+
php_version?: string | null;
|
|
346
347
|
updatable?: boolean;
|
|
347
348
|
pending_url?: string;
|
|
348
349
|
meta?: SitesInfo200Meta;
|
|
@@ -488,9 +489,6 @@ export declare type HostingSiteAddBody = {
|
|
|
488
489
|
/** title of the site to be added */
|
|
489
490
|
title: string;
|
|
490
491
|
};
|
|
491
|
-
export declare type HostingSites200RowsItemMeta = {
|
|
492
|
-
pending_url?: string;
|
|
493
|
-
} | null;
|
|
494
492
|
export declare type HostingSites200RowsItem = {
|
|
495
493
|
id?: string;
|
|
496
494
|
name?: string;
|
|
@@ -512,6 +510,9 @@ export declare type HostingSites200 = {
|
|
|
512
510
|
available_sites?: number;
|
|
513
511
|
rows?: HostingSites200RowsItem[];
|
|
514
512
|
};
|
|
513
|
+
export declare type HostingSites200RowsItemMeta = {
|
|
514
|
+
pending_url?: string;
|
|
515
|
+
} | null;
|
|
515
516
|
export declare type HostingShellInfo200 = {
|
|
516
517
|
enabled?: boolean;
|
|
517
518
|
};
|
|
@@ -650,11 +651,15 @@ export declare type HostingFtpList200SpecialFtpAccountsItem = {
|
|
|
650
651
|
user?: string;
|
|
651
652
|
homedir?: string;
|
|
652
653
|
type?: string;
|
|
654
|
+
account?: string;
|
|
655
|
+
domain?: string;
|
|
653
656
|
};
|
|
654
657
|
export declare type HostingFtpList200FtpAccountsItem = {
|
|
655
658
|
user?: string;
|
|
656
659
|
homedir?: string;
|
|
657
660
|
type?: string;
|
|
661
|
+
account?: string;
|
|
662
|
+
domain?: string;
|
|
658
663
|
};
|
|
659
664
|
export declare type HostingFtpList200 = {
|
|
660
665
|
ftp_accounts?: HostingFtpList200FtpAccountsItem[];
|
|
@@ -680,6 +685,59 @@ export declare const DomainsType: {
|
|
|
680
685
|
export declare type DomainsParams = {
|
|
681
686
|
type?: DomainsType;
|
|
682
687
|
};
|
|
688
|
+
export declare type DbList200DatabasesItemUserlistItem = {
|
|
689
|
+
db?: string;
|
|
690
|
+
user?: string;
|
|
691
|
+
};
|
|
692
|
+
export declare type DbList200DatabasesItem = {
|
|
693
|
+
db?: string;
|
|
694
|
+
size?: string;
|
|
695
|
+
sizemeg?: string;
|
|
696
|
+
usercount?: number;
|
|
697
|
+
userlist?: DbList200DatabasesItemUserlistItem[];
|
|
698
|
+
};
|
|
699
|
+
export declare type DbList200 = {
|
|
700
|
+
status?: boolean;
|
|
701
|
+
databases?: DbList200DatabasesItem[];
|
|
702
|
+
};
|
|
703
|
+
export declare type Db200 = {
|
|
704
|
+
dbname?: string;
|
|
705
|
+
status?: number;
|
|
706
|
+
type?: string;
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* Type of database
|
|
710
|
+
*/
|
|
711
|
+
export declare type DbBodyType = typeof DbBodyType[keyof typeof DbBodyType];
|
|
712
|
+
export declare const DbBodyType: {
|
|
713
|
+
readonly mysql: "mysql";
|
|
714
|
+
readonly postgres: "postgres";
|
|
715
|
+
};
|
|
716
|
+
export declare type DbBody = {
|
|
717
|
+
/** The name of the database to delete.First 8 characters of account username will be prepended.ex: {username}_{dbname} */
|
|
718
|
+
dbname: string;
|
|
719
|
+
/** Type of database */
|
|
720
|
+
type?: DbBodyType;
|
|
721
|
+
};
|
|
722
|
+
export declare type DbAdd200 = {
|
|
723
|
+
dbname?: string;
|
|
724
|
+
status?: number;
|
|
725
|
+
type?: string;
|
|
726
|
+
};
|
|
727
|
+
/**
|
|
728
|
+
* Type of database to add
|
|
729
|
+
*/
|
|
730
|
+
export declare type DbAddBodyType = typeof DbAddBodyType[keyof typeof DbAddBodyType];
|
|
731
|
+
export declare const DbAddBodyType: {
|
|
732
|
+
readonly mysql: "mysql";
|
|
733
|
+
readonly postgres: "postgres";
|
|
734
|
+
};
|
|
735
|
+
export declare type DbAddBody = {
|
|
736
|
+
/** The database name. Account username_ will be prepended. Max length is 54 characters */
|
|
737
|
+
dbname: string;
|
|
738
|
+
/** Type of database to add */
|
|
739
|
+
type?: DbAddBodyType;
|
|
740
|
+
};
|
|
683
741
|
export declare type AddonCloudflare200 = {
|
|
684
742
|
status?: string;
|
|
685
743
|
addon_id?: number;
|
|
@@ -1360,6 +1418,56 @@ export declare const useAddonCloudflare: <TError = AxiosError<unknown, any>, TCo
|
|
|
1360
1418
|
hostingId: number;
|
|
1361
1419
|
data: AddonCloudflareBody;
|
|
1362
1420
|
}, TContext>;
|
|
1421
|
+
/**
|
|
1422
|
+
* Add a new db to an account
|
|
1423
|
+
* @summary Create a database for an account
|
|
1424
|
+
*/
|
|
1425
|
+
export declare const dbAdd: (hostingId: number, dbAddBody: DbAddBody, options?: AxiosRequestConfig) => Promise<AxiosResponse<DbAdd200>>;
|
|
1426
|
+
export declare type DbAddMutationResult = NonNullable<Awaited<ReturnType<typeof dbAdd>>>;
|
|
1427
|
+
export declare type DbAddMutationBody = DbAddBody;
|
|
1428
|
+
export declare type DbAddMutationError = AxiosError<unknown>;
|
|
1429
|
+
export declare const useDbAdd: <TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
|
|
1430
|
+
mutation?: UseMutationOptions<AxiosResponse<DbAdd200, any>, TError, {
|
|
1431
|
+
hostingId: number;
|
|
1432
|
+
data: DbAddBody;
|
|
1433
|
+
}, TContext> | undefined;
|
|
1434
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
1435
|
+
} | undefined) => import("@tanstack/react-query").UseMutationResult<AxiosResponse<DbAdd200, any>, TError, {
|
|
1436
|
+
hostingId: number;
|
|
1437
|
+
data: DbAddBody;
|
|
1438
|
+
}, TContext>;
|
|
1439
|
+
/**
|
|
1440
|
+
* Delete db account
|
|
1441
|
+
* @summary Delete db account
|
|
1442
|
+
*/
|
|
1443
|
+
export declare const db: (hostingId: number, dbBody: DbBody, options?: AxiosRequestConfig) => Promise<AxiosResponse<Db200>>;
|
|
1444
|
+
export declare type DbMutationResult = NonNullable<Awaited<ReturnType<typeof db>>>;
|
|
1445
|
+
export declare type DbMutationBody = DbBody;
|
|
1446
|
+
export declare type DbMutationError = AxiosError<unknown>;
|
|
1447
|
+
export declare const useDb: <TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
|
|
1448
|
+
mutation?: UseMutationOptions<AxiosResponse<Db200, any>, TError, {
|
|
1449
|
+
hostingId: number;
|
|
1450
|
+
data: DbBody;
|
|
1451
|
+
}, TContext> | undefined;
|
|
1452
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
1453
|
+
} | undefined) => import("@tanstack/react-query").UseMutationResult<AxiosResponse<Db200, any>, TError, {
|
|
1454
|
+
hostingId: number;
|
|
1455
|
+
data: DbBody;
|
|
1456
|
+
}, TContext>;
|
|
1457
|
+
/**
|
|
1458
|
+
* List all DB name
|
|
1459
|
+
* @summary Get list of database name
|
|
1460
|
+
*/
|
|
1461
|
+
export declare const dbList: (hostingId: number, options?: AxiosRequestConfig) => Promise<AxiosResponse<DbList200>>;
|
|
1462
|
+
export declare const getDbListQueryKey: (hostingId: number) => string[];
|
|
1463
|
+
export declare type DbListQueryResult = NonNullable<Awaited<ReturnType<typeof dbList>>>;
|
|
1464
|
+
export declare type DbListQueryError = AxiosError<unknown>;
|
|
1465
|
+
export declare const useDbList: <TData = AxiosResponse<DbList200, any>, TError = AxiosError<unknown, any>>(hostingId: number, options?: {
|
|
1466
|
+
query?: UseQueryOptions<AxiosResponse<DbList200, any>, TError, TData, QueryKey> | undefined;
|
|
1467
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
1468
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
1469
|
+
queryKey: QueryKey;
|
|
1470
|
+
};
|
|
1363
1471
|
/**
|
|
1364
1472
|
* Returns a list of domains
|
|
1365
1473
|
* @summary domain list
|
|
@@ -2580,6 +2688,29 @@ export declare const getAddonCloudflareMock: () => {
|
|
|
2580
2688
|
status: string | undefined;
|
|
2581
2689
|
addon_id: number | undefined;
|
|
2582
2690
|
};
|
|
2691
|
+
export declare const getDbAddMock: () => {
|
|
2692
|
+
dbname: string | undefined;
|
|
2693
|
+
status: number | undefined;
|
|
2694
|
+
type: string | undefined;
|
|
2695
|
+
};
|
|
2696
|
+
export declare const getDbMock: () => {
|
|
2697
|
+
dbname: string | undefined;
|
|
2698
|
+
status: number | undefined;
|
|
2699
|
+
type: string | undefined;
|
|
2700
|
+
};
|
|
2701
|
+
export declare const getDbListMock: () => {
|
|
2702
|
+
status: boolean | undefined;
|
|
2703
|
+
databases: {
|
|
2704
|
+
db: string | undefined;
|
|
2705
|
+
size: string | undefined;
|
|
2706
|
+
sizemeg: string | undefined;
|
|
2707
|
+
usercount: number | undefined;
|
|
2708
|
+
userlist: {
|
|
2709
|
+
db: string | undefined;
|
|
2710
|
+
user: string | undefined;
|
|
2711
|
+
}[] | undefined;
|
|
2712
|
+
}[] | undefined;
|
|
2713
|
+
};
|
|
2583
2714
|
export declare const getDomainsMock: () => {
|
|
2584
2715
|
domains: {
|
|
2585
2716
|
docroot: string;
|
|
@@ -2593,11 +2724,15 @@ export declare const getHostingFtpListMock: () => {
|
|
|
2593
2724
|
user: string | undefined;
|
|
2594
2725
|
homedir: string | undefined;
|
|
2595
2726
|
type: string | undefined;
|
|
2727
|
+
account: string | undefined;
|
|
2728
|
+
domain: string | undefined;
|
|
2596
2729
|
}[] | undefined;
|
|
2597
2730
|
special_ftp_accounts: {
|
|
2598
2731
|
user: string | undefined;
|
|
2599
2732
|
homedir: string | undefined;
|
|
2600
2733
|
type: string | undefined;
|
|
2734
|
+
account: string | undefined;
|
|
2735
|
+
domain: string | undefined;
|
|
2601
2736
|
}[] | undefined;
|
|
2602
2737
|
};
|
|
2603
2738
|
export declare const getHostingFtpAddMock: () => {
|
|
@@ -2733,7 +2868,7 @@ export declare const getSitesInfoMock: () => {
|
|
|
2733
2868
|
url: string;
|
|
2734
2869
|
version: string;
|
|
2735
2870
|
versionLatest: string | undefined;
|
|
2736
|
-
php_version: string | undefined;
|
|
2871
|
+
php_version: string | null | undefined;
|
|
2737
2872
|
updatable: boolean | undefined;
|
|
2738
2873
|
pending_url: string | undefined;
|
|
2739
2874
|
meta: {
|
package/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Hosting UAPI
|
|
5
5
|
* Hosting UAPI is an API to expose Hosting, Addons, and Site functionality to a customer-facing Front End such as (Account Manager).
|
|
6
|
-
* OpenAPI spec version: 1.
|
|
6
|
+
* OpenAPI spec version: 1.413.0
|
|
7
7
|
*/
|
|
8
8
|
import axios from 'axios';
|
|
9
9
|
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
@@ -84,6 +84,16 @@ export const DomainsType = {
|
|
|
84
84
|
sub: 'sub',
|
|
85
85
|
unassigned: 'unassigned',
|
|
86
86
|
};
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
88
|
+
export const DbBodyType = {
|
|
89
|
+
mysql: 'mysql',
|
|
90
|
+
postgres: 'postgres',
|
|
91
|
+
};
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
93
|
+
export const DbAddBodyType = {
|
|
94
|
+
mysql: 'mysql',
|
|
95
|
+
postgres: 'postgres',
|
|
96
|
+
};
|
|
87
97
|
/**
|
|
88
98
|
* Returns a combined backup list with website commit ids and corresponding database commits
|
|
89
99
|
* @summary backup list
|
|
@@ -521,6 +531,53 @@ export const useAddonCloudflare = (options) => {
|
|
|
521
531
|
};
|
|
522
532
|
return useMutation(mutationFn, mutationOptions);
|
|
523
533
|
};
|
|
534
|
+
/**
|
|
535
|
+
* Add a new db to an account
|
|
536
|
+
* @summary Create a database for an account
|
|
537
|
+
*/
|
|
538
|
+
export const dbAdd = (hostingId, dbAddBody, options) => {
|
|
539
|
+
return axios.post(`/v1/hosting/${hostingId}/db`, dbAddBody, options);
|
|
540
|
+
};
|
|
541
|
+
export const useDbAdd = (options) => {
|
|
542
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options !== null && options !== void 0 ? options : {};
|
|
543
|
+
const mutationFn = (props) => {
|
|
544
|
+
const { hostingId, data } = props !== null && props !== void 0 ? props : {};
|
|
545
|
+
return dbAdd(hostingId, data, axiosOptions);
|
|
546
|
+
};
|
|
547
|
+
return useMutation(mutationFn, mutationOptions);
|
|
548
|
+
};
|
|
549
|
+
/**
|
|
550
|
+
* Delete db account
|
|
551
|
+
* @summary Delete db account
|
|
552
|
+
*/
|
|
553
|
+
export const db = (hostingId, dbBody, options) => {
|
|
554
|
+
return axios.delete(`/v1/hosting/${hostingId}/db`, Object.assign({ data: dbBody }, options));
|
|
555
|
+
};
|
|
556
|
+
export const useDb = (options) => {
|
|
557
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options !== null && options !== void 0 ? options : {};
|
|
558
|
+
const mutationFn = (props) => {
|
|
559
|
+
const { hostingId, data } = props !== null && props !== void 0 ? props : {};
|
|
560
|
+
return db(hostingId, data, axiosOptions);
|
|
561
|
+
};
|
|
562
|
+
return useMutation(mutationFn, mutationOptions);
|
|
563
|
+
};
|
|
564
|
+
/**
|
|
565
|
+
* List all DB name
|
|
566
|
+
* @summary Get list of database name
|
|
567
|
+
*/
|
|
568
|
+
export const dbList = (hostingId, options) => {
|
|
569
|
+
return axios.get(`/v1/hosting/${hostingId}/db`, options);
|
|
570
|
+
};
|
|
571
|
+
export const getDbListQueryKey = (hostingId) => [`/v1/hosting/${hostingId}/db`];
|
|
572
|
+
export const useDbList = (hostingId, options) => {
|
|
573
|
+
var _a;
|
|
574
|
+
const { query: queryOptions, axios: axiosOptions } = options !== null && options !== void 0 ? options : {};
|
|
575
|
+
const queryKey = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.queryKey) !== null && _a !== void 0 ? _a : getDbListQueryKey(hostingId);
|
|
576
|
+
const queryFn = ({ signal }) => dbList(hostingId, Object.assign({ signal }, axiosOptions));
|
|
577
|
+
const query = useQuery(Object.assign({ queryKey, queryFn, enabled: !!(hostingId) }, queryOptions));
|
|
578
|
+
query.queryKey = queryKey;
|
|
579
|
+
return query;
|
|
580
|
+
};
|
|
524
581
|
/**
|
|
525
582
|
* Returns a list of domains
|
|
526
583
|
* @summary domain list
|
|
@@ -1653,8 +1710,11 @@ export const getHostingAdvancedSsoWhmMock = () => ({ url: faker.helpers.arrayEle
|
|
|
1653
1710
|
export const getHostingAdvancedSystemConsoleMock = () => ({ url: faker.helpers.arrayElement([faker.random.word(), undefined]) });
|
|
1654
1711
|
export const getHostingCapabilitiesMock = () => ({ server_controls: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), sites: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), cpanel: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), whm: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), advanced_hosting: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]) });
|
|
1655
1712
|
export const getAddonCloudflareMock = () => ({ status: faker.helpers.arrayElement([faker.random.word(), undefined]), addon_id: faker.helpers.arrayElement([faker.datatype.number({ min: undefined, max: undefined }), undefined]) });
|
|
1713
|
+
export const getDbAddMock = () => ({ dbname: faker.helpers.arrayElement([faker.random.word(), undefined]), status: faker.helpers.arrayElement([faker.datatype.number({ min: undefined, max: undefined }), undefined]), type: faker.helpers.arrayElement([faker.random.word(), undefined]) });
|
|
1714
|
+
export const getDbMock = () => ({ dbname: faker.helpers.arrayElement([faker.random.word(), undefined]), status: faker.helpers.arrayElement([faker.datatype.number({ min: undefined, max: undefined }), undefined]), type: faker.helpers.arrayElement([faker.random.word(), undefined]) });
|
|
1715
|
+
export const getDbListMock = () => ({ status: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), databases: faker.helpers.arrayElement([Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ db: faker.helpers.arrayElement([faker.random.word(), undefined]), size: faker.helpers.arrayElement([faker.random.word(), undefined]), sizemeg: faker.helpers.arrayElement([faker.random.word(), undefined]), usercount: faker.helpers.arrayElement([faker.datatype.number({ min: undefined, max: undefined }), undefined]), userlist: faker.helpers.arrayElement([Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ db: faker.helpers.arrayElement([faker.random.word(), undefined]), user: faker.helpers.arrayElement([faker.random.word(), undefined]) })), undefined]) })), undefined]) });
|
|
1656
1716
|
export const getDomainsMock = () => ({ domains: Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ docroot: faker.random.word(), domain: faker.random.word(), type: faker.random.word(), id: faker.datatype.number({ min: undefined, max: undefined }) })) });
|
|
1657
|
-
export const getHostingFtpListMock = () => ({ ftp_accounts: faker.helpers.arrayElement([Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ user: faker.helpers.arrayElement([faker.random.word(), undefined]), homedir: faker.helpers.arrayElement([faker.random.word(), undefined]), type: faker.helpers.arrayElement([faker.random.word(), undefined]) })), undefined]), special_ftp_accounts: faker.helpers.arrayElement([Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ user: faker.helpers.arrayElement([faker.random.word(), undefined]), homedir: faker.helpers.arrayElement([faker.random.word(), undefined]), type: faker.helpers.arrayElement([faker.random.word(), undefined]) })), undefined]) });
|
|
1717
|
+
export const getHostingFtpListMock = () => ({ ftp_accounts: faker.helpers.arrayElement([Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ user: faker.helpers.arrayElement([faker.random.word(), undefined]), homedir: faker.helpers.arrayElement([faker.random.word(), undefined]), type: faker.helpers.arrayElement([faker.random.word(), undefined]), account: faker.helpers.arrayElement([faker.random.word(), undefined]), domain: faker.helpers.arrayElement([faker.random.word(), undefined]) })), undefined]), special_ftp_accounts: faker.helpers.arrayElement([Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ user: faker.helpers.arrayElement([faker.random.word(), undefined]), homedir: faker.helpers.arrayElement([faker.random.word(), undefined]), type: faker.helpers.arrayElement([faker.random.word(), undefined]), account: faker.helpers.arrayElement([faker.random.word(), undefined]), domain: faker.helpers.arrayElement([faker.random.word(), undefined]) })), undefined]) });
|
|
1658
1718
|
export const getHostingFtpAddMock = () => ({ user: faker.helpers.arrayElement([faker.random.word(), undefined]), pass: faker.helpers.arrayElement([faker.random.word(), undefined]) });
|
|
1659
1719
|
export const getHostingFtpUpdateMock = () => ({ status: faker.helpers.arrayElement([faker.datatype.number({ min: undefined, max: undefined }), undefined]) });
|
|
1660
1720
|
export const getHostingFtpMock = () => ({ status: faker.helpers.arrayElement([faker.datatype.number({ min: undefined, max: undefined }), undefined]), user: faker.helpers.arrayElement([faker.random.word(), undefined]) });
|
|
@@ -1678,7 +1738,7 @@ export const getSshKeyMock = () => ({ deleted: faker.helpers.arrayElement([faker
|
|
|
1678
1738
|
export const getSshKeyGenerateMock = () => ({ key_name: faker.helpers.arrayElement([faker.random.word(), undefined]), private_key_path: faker.helpers.arrayElement([faker.random.word(), undefined]), public_key_path: faker.helpers.arrayElement([faker.random.word(), undefined]) });
|
|
1679
1739
|
export const getSsoMock = () => ({ url: faker.random.word() });
|
|
1680
1740
|
export const getSitesListMock = () => ({ items: faker.helpers.arrayElement([Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ id: faker.helpers.arrayElement([faker.random.word(), undefined]), name: faker.helpers.arrayElement([faker.random.word(), undefined]), url: faker.helpers.arrayElement([faker.random.word(), undefined]), docroot: faker.helpers.arrayElement([faker.random.word(), undefined]), status: faker.helpers.arrayElement([faker.random.word(), undefined]) })), undefined]) });
|
|
1681
|
-
export const getSitesInfoMock = () => ({ id: faker.random.word(), docroot: faker.random.word(), uuid: faker.random.word(), date_added: faker.random.word(), date_modified: faker.random.word(), name: faker.random.word(), type: faker.random.word(), subtype: faker.random.word(), status: faker.random.word(), url: faker.random.word(), version: faker.random.word(), versionLatest: faker.helpers.arrayElement([faker.random.word(), undefined]), php_version: faker.helpers.arrayElement([faker.random.word(), undefined]), updatable: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), pending_url: faker.helpers.arrayElement([faker.random.word(), undefined]), meta: faker.helpers.arrayElement([{ pending_url: faker.helpers.arrayElement([faker.random.word(), undefined]) }, undefined]) });
|
|
1741
|
+
export const getSitesInfoMock = () => ({ id: faker.random.word(), docroot: faker.random.word(), uuid: faker.random.word(), date_added: faker.random.word(), date_modified: faker.random.word(), name: faker.random.word(), type: faker.random.word(), subtype: faker.random.word(), status: faker.random.word(), url: faker.random.word(), version: faker.random.word(), versionLatest: faker.helpers.arrayElement([faker.random.word(), undefined]), php_version: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.random.word(), null]), undefined]), updatable: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), pending_url: faker.helpers.arrayElement([faker.random.word(), undefined]), meta: faker.helpers.arrayElement([{ pending_url: faker.helpers.arrayElement([faker.random.word(), undefined]) }, undefined]) });
|
|
1682
1742
|
export const getSiteUpdateMock = () => ({ success: faker.datatype.boolean() });
|
|
1683
1743
|
export const getSiteMock = () => ({ success: faker.datatype.boolean() });
|
|
1684
1744
|
export const getSitesAutoupdatesInfoMock = () => ({ plugins: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), core: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), themes: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]) });
|
|
@@ -1776,6 +1836,12 @@ export const getHostingUAPIMSW = () => [
|
|
|
1776
1836
|
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json(getHostingCapabilitiesMock()));
|
|
1777
1837
|
}), rest.post('*/v1/hosting/:hostingId/cloudflare', (_req, res, ctx) => {
|
|
1778
1838
|
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json(getAddonCloudflareMock()));
|
|
1839
|
+
}), rest.post('*/v1/hosting/:hostingId/db', (_req, res, ctx) => {
|
|
1840
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json(getDbAddMock()));
|
|
1841
|
+
}), rest.delete('*/v1/hosting/:hostingId/db', (_req, res, ctx) => {
|
|
1842
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json(getDbMock()));
|
|
1843
|
+
}), rest.get('*/v1/hosting/:hostingId/db', (_req, res, ctx) => {
|
|
1844
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json(getDbListMock()));
|
|
1779
1845
|
}), rest.get('*/v1/hosting/:hostingId/domains', (_req, res, ctx) => {
|
|
1780
1846
|
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json(getDomainsMock()));
|
|
1781
1847
|
}), rest.get('*/v1/hosting/:hostingId/ftp', (_req, res, ctx) => {
|