@placeos/ts-client 4.5.0 → 4.7.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/dist/alerts/functions.d.ts +7 -10
- package/dist/alerts/interfaces.d.ts +22 -0
- package/dist/api.d.ts +32 -19
- package/dist/applications/functions.d.ts +2 -5
- package/dist/applications/interfaces.d.ts +5 -11
- package/dist/assets/assets.class.d.ts +62 -0
- package/dist/assets/functions.d.ts +146 -0
- package/dist/assets/interfaces.d.ts +38 -0
- package/dist/clusters/functions.d.ts +16 -7
- package/dist/clusters/interfaces.d.ts +18 -3
- package/dist/domains/functions.d.ts +10 -6
- package/dist/drivers/functions.d.ts +3 -5
- package/dist/drivers/interfaces.d.ts +9 -7
- package/dist/edge/functions.d.ts +8 -7
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2695 -2081
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/ldap-sources/functions.d.ts +2 -5
- package/dist/metadata/functions.d.ts +8 -9
- package/dist/metadata/interfaces.d.ts +18 -4
- package/dist/modules/functions.d.ts +10 -4
- package/dist/modules/interfaces.d.ts +14 -12
- package/dist/oauth-sources/functions.d.ts +2 -5
- package/dist/repositories/functions.d.ts +17 -29
- package/dist/repositories/interfaces.d.ts +31 -3
- package/dist/resources/interface.d.ts +9 -4
- package/dist/saml-sources/functions.d.ts +4 -7
- package/dist/settings/functions.d.ts +6 -8
- package/dist/settings/interfaces.d.ts +7 -0
- package/dist/short-url/functions.d.ts +60 -0
- package/dist/short-url/interfaces.d.ts +22 -0
- package/dist/short-url/short-url.class.d.ts +17 -0
- package/dist/signage/interfaces.d.ts +9 -1
- package/dist/storages/functions.d.ts +31 -0
- package/dist/storages/interfaces.d.ts +6 -0
- package/dist/storages/storage.class.d.ts +18 -0
- package/dist/systems/functions.d.ts +38 -10
- package/dist/systems/interfaces.d.ts +58 -5
- package/dist/triggers/functions.d.ts +5 -7
- package/dist/triggers/interfaces.d.ts +9 -0
- package/dist/users/functions.d.ts +50 -10
- package/dist/users/interfaces.d.ts +35 -2
- package/dist/webrtc/functions.d.ts +52 -0
- package/dist/webrtc/interfaces.d.ts +73 -0
- package/dist/zones/functions.d.ts +12 -6
- package/dist/zones/interfaces.d.ts +9 -4
- package/package.json +1 -1
- package/src/alerts/functions.ts +14 -22
- package/src/alerts/interfaces.ts +25 -0
- package/src/api.ts +148 -3
- package/src/applications/functions.ts +4 -7
- package/src/applications/interfaces.ts +6 -12
- package/src/assets/assets.class.ts +123 -0
- package/src/assets/functions.ts +440 -0
- package/src/assets/interfaces.ts +41 -0
- package/src/clusters/functions.ts +39 -8
- package/src/clusters/interfaces.ts +21 -3
- package/src/domains/functions.ts +17 -6
- package/src/drivers/functions.ts +4 -6
- package/src/drivers/interfaces.ts +11 -7
- package/src/edge/functions.ts +18 -10
- package/src/ldap-sources/functions.ts +4 -7
- package/src/metadata/functions.ts +16 -10
- package/src/metadata/interfaces.ts +20 -4
- package/src/modules/functions.ts +29 -7
- package/src/modules/interfaces.ts +15 -12
- package/src/oauth-sources/functions.ts +4 -7
- package/src/repositories/functions.ts +35 -35
- package/src/repositories/interfaces.ts +35 -3
- package/src/resources/interface.ts +9 -4
- package/src/saml-sources/functions.ts +6 -9
- package/src/settings/functions.ts +14 -10
- package/src/settings/interfaces.ts +8 -0
- package/src/short-url/functions.ts +155 -0
- package/src/short-url/interfaces.ts +25 -0
- package/src/short-url/short-url.class.ts +33 -0
- package/src/signage/interfaces.ts +10 -1
- package/src/storages/functions.ts +88 -0
- package/src/storages/interfaces.ts +7 -0
- package/src/storages/storage.class.ts +34 -0
- package/src/systems/functions.ts +113 -13
- package/src/systems/interfaces.ts +65 -5
- package/src/triggers/functions.ts +9 -8
- package/src/triggers/interfaces.ts +10 -0
- package/src/users/functions.ts +104 -9
- package/src/users/interfaces.ts +40 -2
- package/src/webrtc/functions.ts +120 -0
- package/src/webrtc/interfaces.ts +77 -0
- package/src/zones/functions.ts +28 -7
- package/src/zones/interfaces.ts +10 -4
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { map } from 'rxjs';
|
|
2
|
+
import {
|
|
3
|
+
create,
|
|
4
|
+
del,
|
|
5
|
+
patch,
|
|
6
|
+
post,
|
|
7
|
+
put,
|
|
8
|
+
query,
|
|
9
|
+
remove,
|
|
10
|
+
show,
|
|
11
|
+
update,
|
|
12
|
+
} from '../api';
|
|
13
|
+
import { apiEndpoint } from '../auth';
|
|
14
|
+
import { toQueryString } from '../utilities/api';
|
|
15
|
+
import {
|
|
16
|
+
PlaceAsset,
|
|
17
|
+
PlaceAssetCategory,
|
|
18
|
+
PlaceAssetPurchaseOrder,
|
|
19
|
+
PlaceAssetType,
|
|
20
|
+
} from './assets.class';
|
|
21
|
+
import {
|
|
22
|
+
PlaceAssetCategoryQueryOptions,
|
|
23
|
+
PlaceAssetPurchaseOrderQueryOptions,
|
|
24
|
+
PlaceAssetQueryOptions,
|
|
25
|
+
PlaceAssetTypeQueryOptions,
|
|
26
|
+
} from './interfaces';
|
|
27
|
+
|
|
28
|
+
///////////////////////////////////////////////////////////////
|
|
29
|
+
////////////////////////// Assets /////////////////////////
|
|
30
|
+
///////////////////////////////////////////////////////////////
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
const ASSET_PATH = 'assets';
|
|
36
|
+
|
|
37
|
+
/** Convert raw server data to an asset object */
|
|
38
|
+
function processAsset(item: Partial<PlaceAsset>) {
|
|
39
|
+
return new PlaceAsset(item);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Query the available assets
|
|
44
|
+
* @param query_params Query parameters to add the to request URL
|
|
45
|
+
*/
|
|
46
|
+
export function queryAssets(query_params: PlaceAssetQueryOptions = {}) {
|
|
47
|
+
return query({
|
|
48
|
+
query_params,
|
|
49
|
+
fn: processAsset,
|
|
50
|
+
path: ASSET_PATH,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get the data for an asset
|
|
56
|
+
* @param id ID of the asset to retrieve
|
|
57
|
+
* @param query_params Query parameters to add the to request URL
|
|
58
|
+
*/
|
|
59
|
+
export function showAsset(id: string, query_params: Record<string, any> = {}) {
|
|
60
|
+
return show({
|
|
61
|
+
id,
|
|
62
|
+
query_params,
|
|
63
|
+
fn: processAsset,
|
|
64
|
+
path: ASSET_PATH,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Update the asset in the database
|
|
70
|
+
* @param id ID of the asset
|
|
71
|
+
* @param form_data New values for the asset
|
|
72
|
+
* @param query_params Query parameters to add the to request URL
|
|
73
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
74
|
+
*/
|
|
75
|
+
export function updateAsset(
|
|
76
|
+
id: string,
|
|
77
|
+
form_data: Partial<PlaceAsset>,
|
|
78
|
+
method: 'put' | 'patch' = 'patch',
|
|
79
|
+
) {
|
|
80
|
+
return update({
|
|
81
|
+
id,
|
|
82
|
+
form_data,
|
|
83
|
+
query_params: {},
|
|
84
|
+
method,
|
|
85
|
+
fn: processAsset,
|
|
86
|
+
path: ASSET_PATH,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Add a new asset to the database
|
|
92
|
+
* @param form_data Application data
|
|
93
|
+
* @param query_params Query parameters to add the to request URL
|
|
94
|
+
*/
|
|
95
|
+
export function addAsset(form_data: Partial<PlaceAsset>) {
|
|
96
|
+
return create({
|
|
97
|
+
form_data,
|
|
98
|
+
query_params: {},
|
|
99
|
+
fn: processAsset,
|
|
100
|
+
path: ASSET_PATH,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Remove an asset from the database
|
|
106
|
+
* @param id ID of the asset
|
|
107
|
+
* @param query_params Query parameters to add the to request URL
|
|
108
|
+
*/
|
|
109
|
+
export function removeAsset(
|
|
110
|
+
id: string,
|
|
111
|
+
query_params: Record<string, any> = {},
|
|
112
|
+
) {
|
|
113
|
+
return remove({ id, query_params, path: ASSET_PATH });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Add a list of new assets to the database
|
|
118
|
+
* @param form_data List of asset data
|
|
119
|
+
* @param query_params Query parameters to add the to request URL
|
|
120
|
+
*/
|
|
121
|
+
export function addAssets(form_data: Partial<PlaceAsset>[]) {
|
|
122
|
+
return post(
|
|
123
|
+
`${apiEndpoint()}${ASSET_PATH}/bulk`,
|
|
124
|
+
JSON.stringify(form_data),
|
|
125
|
+
{},
|
|
126
|
+
).pipe(map((l: any) => l.map((_: any) => processAsset(_))));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Update a list of assets in the database
|
|
131
|
+
* @param id ID of the asset
|
|
132
|
+
* @param form_data New values for the asset
|
|
133
|
+
* @param query_params Query parameters to add the to request URL
|
|
134
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
135
|
+
*/
|
|
136
|
+
export function updateAssets(
|
|
137
|
+
form_data: Partial<PlaceAsset>[],
|
|
138
|
+
method: 'put' | 'patch' = 'patch',
|
|
139
|
+
) {
|
|
140
|
+
const verb = method === 'put' ? put : patch;
|
|
141
|
+
return verb(
|
|
142
|
+
`${apiEndpoint()}${ASSET_PATH}/bulk`,
|
|
143
|
+
JSON.stringify(form_data),
|
|
144
|
+
{},
|
|
145
|
+
).pipe(map((l: any) => l.map((_: any) => processAsset(_))));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Remove an asset from the database
|
|
150
|
+
* @param id ID of the asset
|
|
151
|
+
* @param query_params Query parameters to add the to request URL
|
|
152
|
+
*/
|
|
153
|
+
export function removeAssets(
|
|
154
|
+
id_list: string[],
|
|
155
|
+
query_params: Record<string, any> = {},
|
|
156
|
+
) {
|
|
157
|
+
const q = toQueryString(query_params);
|
|
158
|
+
return del(`${apiEndpoint()}${ASSET_PATH}/bulk${q ? '?' + q : ''}`, {
|
|
159
|
+
body: JSON.stringify(id_list),
|
|
160
|
+
}).pipe(map((l: any) => l.map((_: any) => processAsset(_))));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
///////////////////////////////////////////////////////////////
|
|
164
|
+
//////////////////////// Asset Types //////////////////////
|
|
165
|
+
///////////////////////////////////////////////////////////////
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @private
|
|
169
|
+
*/
|
|
170
|
+
const ASSET_TYPE_PATH = 'asset_types';
|
|
171
|
+
|
|
172
|
+
/** Convert raw server data to an asset type object */
|
|
173
|
+
function processAssetType(item: Partial<PlaceAssetType>) {
|
|
174
|
+
return new PlaceAssetType(item);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Query the available asset types
|
|
179
|
+
* @param query_params Query parameters to add the to request URL
|
|
180
|
+
*/
|
|
181
|
+
export function queryAssetTypes(query_params: PlaceAssetTypeQueryOptions = {}) {
|
|
182
|
+
return query({
|
|
183
|
+
query_params,
|
|
184
|
+
fn: processAssetType,
|
|
185
|
+
path: ASSET_TYPE_PATH,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Get the data for an asset type
|
|
191
|
+
* @param id ID of the asset type to retrieve
|
|
192
|
+
* @param query_params Query parameters to add the to request URL
|
|
193
|
+
*/
|
|
194
|
+
export function showAssetType(
|
|
195
|
+
id: string,
|
|
196
|
+
query_params: Record<string, any> = {},
|
|
197
|
+
) {
|
|
198
|
+
return show({
|
|
199
|
+
id,
|
|
200
|
+
query_params,
|
|
201
|
+
fn: processAssetType,
|
|
202
|
+
path: ASSET_TYPE_PATH,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Update the asset type in the database
|
|
208
|
+
* @param id ID of the asset type
|
|
209
|
+
* @param form_data New values for the asset
|
|
210
|
+
* @param query_params Query parameters to add the to request URL
|
|
211
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
212
|
+
*/
|
|
213
|
+
export function updateAssetType(
|
|
214
|
+
id: string,
|
|
215
|
+
form_data: Partial<PlaceAssetType>,
|
|
216
|
+
method: 'put' | 'patch' = 'patch',
|
|
217
|
+
) {
|
|
218
|
+
return update({
|
|
219
|
+
id,
|
|
220
|
+
form_data,
|
|
221
|
+
query_params: {},
|
|
222
|
+
method,
|
|
223
|
+
fn: processAssetType,
|
|
224
|
+
path: ASSET_TYPE_PATH,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Add a new asset type to the database
|
|
230
|
+
* @param form_data Application data
|
|
231
|
+
* @param query_params Query parameters to add the to request URL
|
|
232
|
+
*/
|
|
233
|
+
export function addAssetType(form_data: Partial<PlaceAssetType>) {
|
|
234
|
+
return create({
|
|
235
|
+
form_data,
|
|
236
|
+
query_params: {},
|
|
237
|
+
fn: processAssetType,
|
|
238
|
+
path: ASSET_TYPE_PATH,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Remove an asset type from the database
|
|
244
|
+
* @param id ID of the asset type
|
|
245
|
+
* @param query_params Query parameters to add the to request URL
|
|
246
|
+
*/
|
|
247
|
+
export function removeAssetType(
|
|
248
|
+
id: string,
|
|
249
|
+
query_params: Record<string, any> = {},
|
|
250
|
+
) {
|
|
251
|
+
return remove({ id, query_params, path: ASSET_TYPE_PATH });
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
///////////////////////////////////////////////////////////////
|
|
255
|
+
///////////////////// Asset Categories ////////////////////
|
|
256
|
+
///////////////////////////////////////////////////////////////
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @private
|
|
260
|
+
*/
|
|
261
|
+
const ASSET_CATEGORY_PATH = 'asset_categories';
|
|
262
|
+
|
|
263
|
+
/** Convert raw server data to an asset category object */
|
|
264
|
+
function processAssetCategory(item: Partial<PlaceAssetCategory>) {
|
|
265
|
+
return new PlaceAssetCategory(item);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Query the available asset categories
|
|
270
|
+
* @param query_params Query parameters to add the to request URL
|
|
271
|
+
*/
|
|
272
|
+
export function queryAssetCategories(
|
|
273
|
+
query_params: PlaceAssetCategoryQueryOptions = {},
|
|
274
|
+
) {
|
|
275
|
+
return query({
|
|
276
|
+
query_params,
|
|
277
|
+
fn: processAssetCategory,
|
|
278
|
+
path: ASSET_CATEGORY_PATH,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Get the data for an asset category
|
|
284
|
+
* @param id ID of the asset category to retrieve
|
|
285
|
+
* @param query_params Query parameters to add the to request URL
|
|
286
|
+
*/
|
|
287
|
+
export function showAssetCategory(
|
|
288
|
+
id: string,
|
|
289
|
+
query_params: Record<string, any> = {},
|
|
290
|
+
) {
|
|
291
|
+
return show({
|
|
292
|
+
id,
|
|
293
|
+
query_params,
|
|
294
|
+
fn: processAssetCategory,
|
|
295
|
+
path: ASSET_CATEGORY_PATH,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Update the asset category in the database
|
|
301
|
+
* @param id ID of the asset category
|
|
302
|
+
* @param form_data New values for the asset category
|
|
303
|
+
* @param query_params Query parameters to add the to request URL
|
|
304
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
305
|
+
*/
|
|
306
|
+
export function updateAssetCategory(
|
|
307
|
+
id: string,
|
|
308
|
+
form_data: Partial<PlaceAssetCategory>,
|
|
309
|
+
method: 'put' | 'patch' = 'patch',
|
|
310
|
+
) {
|
|
311
|
+
return update({
|
|
312
|
+
id,
|
|
313
|
+
form_data,
|
|
314
|
+
query_params: {},
|
|
315
|
+
method,
|
|
316
|
+
fn: processAssetCategory,
|
|
317
|
+
path: ASSET_CATEGORY_PATH,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Add a new asset category to the database
|
|
323
|
+
* @param form_data Asset category data
|
|
324
|
+
* @param query_params Query parameters to add the to request URL
|
|
325
|
+
*/
|
|
326
|
+
export function addAssetCategory(form_data: Partial<PlaceAssetCategory>) {
|
|
327
|
+
return create({
|
|
328
|
+
form_data,
|
|
329
|
+
query_params: {},
|
|
330
|
+
fn: processAssetCategory,
|
|
331
|
+
path: ASSET_CATEGORY_PATH,
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Remove an asset category from the database
|
|
337
|
+
* @param id ID of the asset category
|
|
338
|
+
* @param query_params Query parameters to add the to request URL
|
|
339
|
+
*/
|
|
340
|
+
export function removeAssetCategory(
|
|
341
|
+
id: string,
|
|
342
|
+
query_params: Record<string, any> = {},
|
|
343
|
+
) {
|
|
344
|
+
return remove({ id, query_params, path: ASSET_CATEGORY_PATH });
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
///////////////////////////////////////////////////////////////
|
|
348
|
+
////////////////// Asset Purchase Orders //////////////////
|
|
349
|
+
///////////////////////////////////////////////////////////////
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* @private
|
|
353
|
+
*/
|
|
354
|
+
const ASSET_PURCHASE_ORDER_PATH = 'asset_purchase_orders';
|
|
355
|
+
|
|
356
|
+
/** Convert raw server data to an asset purchase order object */
|
|
357
|
+
function processAssetPurchaseOrder(item: Partial<PlaceAssetPurchaseOrder>) {
|
|
358
|
+
return new PlaceAssetPurchaseOrder(item);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Query the available asset purchase orders
|
|
363
|
+
* @param query_params Query parameters to add the to request URL
|
|
364
|
+
*/
|
|
365
|
+
export function queryAssetPurchaseOrders(
|
|
366
|
+
query_params: PlaceAssetPurchaseOrderQueryOptions = {},
|
|
367
|
+
) {
|
|
368
|
+
return query({
|
|
369
|
+
query_params,
|
|
370
|
+
fn: processAssetPurchaseOrder,
|
|
371
|
+
path: ASSET_PURCHASE_ORDER_PATH,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Get the data for an asset purchase order
|
|
377
|
+
* @param id ID of the asset purchase order to retrieve
|
|
378
|
+
* @param query_params Query parameters to add the to request URL
|
|
379
|
+
*/
|
|
380
|
+
export function showAssetPurchaseOrder(
|
|
381
|
+
id: string,
|
|
382
|
+
query_params: Record<string, any> = {},
|
|
383
|
+
) {
|
|
384
|
+
return show({
|
|
385
|
+
id,
|
|
386
|
+
query_params,
|
|
387
|
+
fn: processAssetPurchaseOrder,
|
|
388
|
+
path: ASSET_PURCHASE_ORDER_PATH,
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Update the asset purchase order in the database
|
|
394
|
+
* @param id ID of the asset purchase order
|
|
395
|
+
* @param form_data New values for the asset purchase order
|
|
396
|
+
* @param query_params Query parameters to add the to request URL
|
|
397
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
398
|
+
*/
|
|
399
|
+
export function updateAssetPurchaseOrder(
|
|
400
|
+
id: string,
|
|
401
|
+
form_data: Partial<PlaceAssetPurchaseOrder>,
|
|
402
|
+
method: 'put' | 'patch' = 'patch',
|
|
403
|
+
) {
|
|
404
|
+
return update({
|
|
405
|
+
id,
|
|
406
|
+
form_data,
|
|
407
|
+
query_params: {},
|
|
408
|
+
method,
|
|
409
|
+
fn: processAssetPurchaseOrder,
|
|
410
|
+
path: ASSET_PURCHASE_ORDER_PATH,
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Add a new asset purchase order to the database
|
|
416
|
+
* @param form_data Asset purchase order data
|
|
417
|
+
* @param query_params Query parameters to add the to request URL
|
|
418
|
+
*/
|
|
419
|
+
export function addAssetPurchaseOrder(
|
|
420
|
+
form_data: Partial<PlaceAssetPurchaseOrder>,
|
|
421
|
+
) {
|
|
422
|
+
return create({
|
|
423
|
+
form_data,
|
|
424
|
+
query_params: {},
|
|
425
|
+
fn: processAssetPurchaseOrder,
|
|
426
|
+
path: ASSET_PURCHASE_ORDER_PATH,
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Remove an asset purchase order from the database
|
|
432
|
+
* @param id ID of the asset purchase order
|
|
433
|
+
* @param query_params Query parameters to add the to request URL
|
|
434
|
+
*/
|
|
435
|
+
export function removeAssetPurchaseOrder(
|
|
436
|
+
id: string,
|
|
437
|
+
query_params: Record<string, any> = {},
|
|
438
|
+
) {
|
|
439
|
+
return remove({ id, query_params, path: ASSET_PURCHASE_ORDER_PATH });
|
|
440
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PlaceResourceQueryOptions } from '../resources/interface';
|
|
2
|
+
|
|
3
|
+
/** Mapping of available query parameters for the assets index endpoint */
|
|
4
|
+
export interface PlaceAssetQueryOptions extends PlaceResourceQueryOptions {
|
|
5
|
+
/** Return assets which are in the zone provided */
|
|
6
|
+
zone_id?: string;
|
|
7
|
+
/** Return assets that match the asset type ID provided */
|
|
8
|
+
type_id?: string;
|
|
9
|
+
/** Return assets that match the purchase order ID provided */
|
|
10
|
+
order_id?: string;
|
|
11
|
+
/** Return assets that have a matching barcode */
|
|
12
|
+
barcode?: string;
|
|
13
|
+
/** Return assets that have a matching serial number */
|
|
14
|
+
serial_number?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Mapping of available query parameters for the asset types index endpoint */
|
|
18
|
+
export interface PlaceAssetTypeQueryOptions extends PlaceResourceQueryOptions {
|
|
19
|
+
/** Return assets with the provided brand name */
|
|
20
|
+
brand?: string;
|
|
21
|
+
/** Return assets with the provided model number */
|
|
22
|
+
model_number?: string;
|
|
23
|
+
/** Return asset types in the category provided */
|
|
24
|
+
category_id?: string;
|
|
25
|
+
/** Filters the asset count to the zone provided */
|
|
26
|
+
zone_id?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Mapping of available query parameters for the asset categories index endpoint */
|
|
30
|
+
export interface PlaceAssetCategoryQueryOptions extends PlaceResourceQueryOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Filter categories by hidden status.
|
|
33
|
+
* `true` returns only hidden categories,
|
|
34
|
+
* `false` returns only non-hidden categories,
|
|
35
|
+
* `undefined` returns all categories.
|
|
36
|
+
*/
|
|
37
|
+
hidden?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Mapping of available query parameters for the asset purchase orders index endpoint */
|
|
41
|
+
export interface PlaceAssetPurchaseOrderQueryOptions extends PlaceResourceQueryOptions {}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { map } from 'rxjs/operators';
|
|
3
|
+
import { apiEndpoint } from '../auth/functions';
|
|
4
|
+
import { get, post } from '../http/functions';
|
|
1
5
|
import { query, remove, show } from '../resources/functions';
|
|
2
6
|
import { HashMap } from '../utilities/types';
|
|
3
7
|
import { PlaceCluster } from './cluster';
|
|
4
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
PlaceClusterQueryOptions,
|
|
10
|
+
PlaceClusterShowOptions,
|
|
11
|
+
PlaceClusterTerminateOptions,
|
|
12
|
+
PlaceClusterVersions,
|
|
13
|
+
} from './interfaces';
|
|
5
14
|
import { PlaceProcess } from './process';
|
|
6
15
|
|
|
7
16
|
/**
|
|
@@ -29,17 +38,20 @@ export function queryClusters(query_params: PlaceClusterQueryOptions = {}) {
|
|
|
29
38
|
*/
|
|
30
39
|
export function showCluster(
|
|
31
40
|
id: string,
|
|
32
|
-
query_params:
|
|
41
|
+
query_params: PlaceClusterShowOptions = {},
|
|
33
42
|
) {
|
|
34
43
|
return show({ id, query_params, fn: process, path: PATH });
|
|
35
44
|
}
|
|
36
45
|
|
|
37
46
|
/**
|
|
38
|
-
* Query the available
|
|
47
|
+
* Query the available processes for a cluster
|
|
39
48
|
* @param id ID of the cluster to query
|
|
40
49
|
* @param query_params Query parameters to add the to request URL
|
|
41
50
|
*/
|
|
42
|
-
export function queryProcesses(
|
|
51
|
+
export function queryProcesses(
|
|
52
|
+
id: string,
|
|
53
|
+
query_params: PlaceClusterShowOptions = {},
|
|
54
|
+
) {
|
|
43
55
|
return show({
|
|
44
56
|
id,
|
|
45
57
|
query_params,
|
|
@@ -52,10 +64,29 @@ export function queryProcesses(id: string, query_params: HashMap = {}) {
|
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
/**
|
|
55
|
-
*
|
|
67
|
+
* Terminate a process in a cluster
|
|
56
68
|
* @param id ID of the cluster associated with the process
|
|
57
|
-
* @param
|
|
69
|
+
* @param query_params Query parameters including driver name (required)
|
|
70
|
+
*/
|
|
71
|
+
export function terminateProcess(
|
|
72
|
+
id: string,
|
|
73
|
+
query_params: PlaceClusterTerminateOptions,
|
|
74
|
+
) {
|
|
75
|
+
return remove({ id, query_params, path: PATH });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Force the core nodes to perform a cluster rebalance
|
|
80
|
+
*/
|
|
81
|
+
export function clusterRebalance(): Observable<void> {
|
|
82
|
+
const url = `${apiEndpoint()}${PATH}/rebalance`;
|
|
83
|
+
return post(url, {}).pipe(map(() => undefined));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get the core node versions
|
|
58
88
|
*/
|
|
59
|
-
export function
|
|
60
|
-
|
|
89
|
+
export function clusterVersions(): Observable<PlaceClusterVersions> {
|
|
90
|
+
const url = `${apiEndpoint()}${PATH}/versions`;
|
|
91
|
+
return get(url).pipe(map((resp: HashMap) => resp as PlaceClusterVersions));
|
|
61
92
|
}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
|
-
/** Mapping of available query
|
|
1
|
+
/** Mapping of available query parameters for the cluster index endpoint */
|
|
2
2
|
export interface PlaceClusterQueryOptions {
|
|
3
|
-
/**
|
|
4
|
-
include_status?:
|
|
3
|
+
/** Return the detailed status of the node including memory and CPU usage */
|
|
4
|
+
include_status?: boolean;
|
|
5
5
|
/** Number of results to return. Defaults to `20`. Max `500` */
|
|
6
6
|
limit?: number;
|
|
7
7
|
/** Offset the page of results. Max `10000` */
|
|
8
8
|
offset?: number;
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
/** Mapping of available query parameters for the cluster show endpoint */
|
|
12
|
+
export interface PlaceClusterShowOptions {
|
|
13
|
+
/** Return the detailed status of the drivers running on the node */
|
|
14
|
+
include_status?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Mapping of available query parameters for the cluster delete endpoint (terminate process) */
|
|
18
|
+
export interface PlaceClusterTerminateOptions {
|
|
19
|
+
/** The name of the driver to terminate (required) */
|
|
20
|
+
driver: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Response from the cluster versions endpoint */
|
|
24
|
+
export interface PlaceClusterVersions {
|
|
25
|
+
/** Map of node ID to version string */
|
|
26
|
+
[nodeId: string]: string;
|
|
27
|
+
}
|
package/src/domains/functions.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { map } from 'rxjs/operators';
|
|
3
|
+
import { apiEndpoint } from '../auth/functions';
|
|
4
|
+
import { get } from '../http/functions';
|
|
1
5
|
import { create, query, remove, show, update } from '../resources/functions';
|
|
2
6
|
import { PlaceResourceQueryOptions } from '../resources/interface';
|
|
3
7
|
import { HashMap } from '../utilities/types';
|
|
@@ -24,10 +28,9 @@ export function queryDomains(query_params: PlaceResourceQueryOptions = {}) {
|
|
|
24
28
|
/**
|
|
25
29
|
* Get the data for a domain
|
|
26
30
|
* @param id ID of the domain to retrieve
|
|
27
|
-
* @param query_params Query parameters to add the to request URL
|
|
28
31
|
*/
|
|
29
|
-
export function showDomain(id: string
|
|
30
|
-
return show({ id, query_params, fn: process, path: PATH });
|
|
32
|
+
export function showDomain(id: string) {
|
|
33
|
+
return show({ id, query_params: {}, fn: process, path: PATH });
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
/**
|
|
@@ -64,8 +67,16 @@ export function addDomain(form_data: Partial<PlaceDomain>) {
|
|
|
64
67
|
/**
|
|
65
68
|
* Remove a domain from the database
|
|
66
69
|
* @param id ID of the domain
|
|
67
|
-
* @param query_params Query parameters to add the to request URL
|
|
68
70
|
*/
|
|
69
|
-
export function removeDomain(id: string
|
|
70
|
-
return remove({ id, query_params, path: PATH });
|
|
71
|
+
export function removeDomain(id: string) {
|
|
72
|
+
return remove({ id, query_params: {}, path: PATH });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Find the domain name by looking into domain registered email domains
|
|
77
|
+
* @param email Email address to lookup
|
|
78
|
+
*/
|
|
79
|
+
export function lookupDomainByEmail(email: string): Observable<PlaceDomain> {
|
|
80
|
+
const url = `${apiEndpoint()}${PATH}/lookup/${encodeURIComponent(email)}`;
|
|
81
|
+
return get(url).pipe(map((resp: HashMap) => process(resp as Partial<PlaceDomain>)));
|
|
71
82
|
}
|
package/src/drivers/functions.ts
CHANGED
|
@@ -6,9 +6,8 @@ import {
|
|
|
6
6
|
task,
|
|
7
7
|
update,
|
|
8
8
|
} from '../resources/functions';
|
|
9
|
-
import { HashMap } from '../utilities/types';
|
|
10
9
|
import { PlaceDriver } from './driver';
|
|
11
|
-
import { PlaceDriverQueryOptions } from './interfaces';
|
|
10
|
+
import { PlaceDriverQueryOptions, PlaceDriverShowOptions } from './interfaces';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* @private
|
|
@@ -33,7 +32,7 @@ export function queryDrivers(query_params: PlaceDriverQueryOptions = {}) {
|
|
|
33
32
|
* @param id ID of the driver to retrieve
|
|
34
33
|
* @param query_params Query parameters to add the to request URL
|
|
35
34
|
*/
|
|
36
|
-
export function showDriver(id: string, query_params:
|
|
35
|
+
export function showDriver(id: string, query_params: PlaceDriverShowOptions = {}) {
|
|
37
36
|
return show({ id, query_params, fn: process, path: PATH });
|
|
38
37
|
}
|
|
39
38
|
|
|
@@ -71,10 +70,9 @@ export function addDriver(form_data: Partial<PlaceDriver>) {
|
|
|
71
70
|
/**
|
|
72
71
|
* Remove a driver from the database
|
|
73
72
|
* @param id ID of the driver
|
|
74
|
-
* @param query_params Query parameters to add the to request URL
|
|
75
73
|
*/
|
|
76
|
-
export function removeDriver(id: string
|
|
77
|
-
return remove({ id, query_params, path: PATH });
|
|
74
|
+
export function removeDriver(id: string) {
|
|
75
|
+
return remove({ id, query_params: {}, path: PATH });
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
/**
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
offset?: number;
|
|
7
|
-
/** Filter result by type of driver. One of either `ssh`, `device`, `service` or `logic` */
|
|
1
|
+
import { PlaceResourceQueryOptions } from '../resources/interface';
|
|
2
|
+
|
|
3
|
+
/** Mapping of available query parameters for the drivers index endpoint */
|
|
4
|
+
export interface PlaceDriverQueryOptions extends PlaceResourceQueryOptions {
|
|
5
|
+
/** Filter result by type of driver */
|
|
8
6
|
role?: 'ssh' | 'device' | 'service' | 'logic' | 'websocket';
|
|
9
7
|
/** Only return drivers that have an update available */
|
|
10
8
|
update_available?: boolean;
|
|
11
9
|
}
|
|
12
10
|
|
|
11
|
+
/** Mapping of available query parameters for the drivers show endpoint */
|
|
12
|
+
export interface PlaceDriverShowOptions {
|
|
13
|
+
/** Check if the driver is compiled */
|
|
14
|
+
compilation_status?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
/** List of details that can be assigned to a new Driver */
|
|
14
18
|
export interface PlaceDriverDetails {
|
|
15
19
|
/** Default name for the driver */
|