@newfold/huapi-js 1.2.6 → 1.2.8-alpha.1

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.
Files changed (64) hide show
  1. package/dist/handlers/sites/data/sites.d.ts +19 -0
  2. package/dist/handlers/sites/data/sites.js +178 -0
  3. package/dist/handlers/sites/getHostingSitesHandler.d.ts +9 -0
  4. package/dist/handlers/sites/getHostingSitesHandler.js +17 -0
  5. package/{src/msw/handlers/index.js → dist/handlers.msw.d.ts} +1 -1
  6. package/dist/handlers.msw.js +21 -0
  7. package/dist/index.d.ts +114 -0
  8. package/dist/index.js +146 -0
  9. package/dist/index.msw.d.ts +42 -0
  10. package/dist/index.msw.js +44 -0
  11. package/dist/models/getAddonsCodeguardWebsiteListV1200.d.ts +11 -0
  12. package/dist/models/getAddonsCodeguardWebsiteListV1200.js +2 -0
  13. package/dist/models/getAddonsCodeguardWebsiteListV1200WebsiteListItem.d.ts +11 -0
  14. package/dist/models/getAddonsCodeguardWebsiteListV1200WebsiteListItem.js +2 -0
  15. package/dist/models/getAddonsCodeguardWebsiteListV1200WebsiteListItemWebsite.d.ts +10 -0
  16. package/dist/models/getAddonsCodeguardWebsiteListV1200WebsiteListItemWebsite.js +9 -0
  17. package/dist/models/getAddonsCodeguardWebsitesV1200.d.ts +9 -0
  18. package/dist/models/getAddonsCodeguardWebsitesV1200.js +2 -0
  19. package/dist/models/getAddonsCodeguardWebsitesV1200WebsiteListItem.d.ts +9 -0
  20. package/dist/models/getAddonsCodeguardWebsitesV1200WebsiteListItem.js +2 -0
  21. package/dist/models/getAddonsCodeguardWebsitesV1200WebsiteListItemWebsite.d.ts +9 -0
  22. package/dist/models/getAddonsCodeguardWebsitesV1200WebsiteListItemWebsite.js +7 -0
  23. package/dist/models/getHostingFtpV1200.d.ts +11 -0
  24. package/dist/models/getHostingFtpV1200.js +2 -0
  25. package/dist/models/getHostingFtpV1200FtpAccountItem.d.ts +11 -0
  26. package/dist/models/getHostingFtpV1200FtpAccountItem.js +9 -0
  27. package/dist/models/getHostingInfoV1200.d.ts +8 -0
  28. package/dist/models/getHostingInfoV1200.js +7 -0
  29. package/dist/models/getHostingSitesV1200.d.ts +9 -0
  30. package/dist/models/getHostingSitesV1200.js +2 -0
  31. package/dist/models/getHostingSitesV1200RowsItem.d.ts +10 -0
  32. package/dist/models/getHostingSitesV1200RowsItem.js +7 -0
  33. package/dist/models/getSitesInfoV1200.d.ts +18 -0
  34. package/dist/models/getSitesInfoV1200.js +9 -0
  35. package/dist/models/getSitesSsoV1200.d.ts +8 -0
  36. package/dist/models/getSitesSsoV1200.js +7 -0
  37. package/dist/models/hostingInfo200.d.ts +10 -0
  38. package/dist/models/hostingInfo200.js +9 -0
  39. package/dist/models/hostingSites200.d.ts +11 -0
  40. package/dist/models/hostingSites200.js +2 -0
  41. package/dist/models/hostingSites200RowsItem.d.ts +12 -0
  42. package/dist/models/hostingSites200RowsItem.js +9 -0
  43. package/dist/models/index.d.ts +22 -0
  44. package/dist/models/index.js +38 -0
  45. package/dist/models/postHostingFtpV1200.d.ts +11 -0
  46. package/dist/models/postHostingFtpV1200.js +9 -0
  47. package/dist/models/postHostingFtpV1Body.d.ts +11 -0
  48. package/dist/models/postHostingFtpV1Body.js +9 -0
  49. package/dist/models/site.d.ts +18 -0
  50. package/dist/models/site.js +9 -0
  51. package/dist/models/siteList.d.ts +23 -0
  52. package/dist/models/siteList.js +2 -0
  53. package/dist/models/siteSso.d.ts +14 -0
  54. package/dist/models/siteSso.js +9 -0
  55. package/dist/models/sitesSso200.d.ts +10 -0
  56. package/dist/models/sitesSso200.js +9 -0
  57. package/package.json +11 -6
  58. package/openapi.json +0 -209
  59. package/orval.config.js +0 -22
  60. package/prettier.config.js +0 -4
  61. package/src/msw/handlers/sites/data/sites.js +0 -172
  62. package/src/msw/handlers/sites/getHostingSitesHandler.js +0 -24
  63. package/src/msw/sites.js +0 -153
  64. package/tsconfig.json +0 -101
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
- });
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- singleQuote: true,
3
- trailingComma: "all",
4
- };
@@ -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`;