@appsemble/types 0.20.7 → 0.20.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +57 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -309,6 +309,20 @@ export interface Remappers {
|
|
|
309
309
|
* Assign properties to an existing object given some predefined mapper keys.
|
|
310
310
|
*/
|
|
311
311
|
'object.assign': Record<string, Remapper>;
|
|
312
|
+
/**
|
|
313
|
+
* Remove properties from an existing object based on the given the object keys.
|
|
314
|
+
*
|
|
315
|
+
* Nested properties can be removed using arrays of keys.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```yaml
|
|
319
|
+
* object.omit:
|
|
320
|
+
* - foo # Removes the property foo
|
|
321
|
+
* - - bar # Removes the property baz inside of bar
|
|
322
|
+
* - baz
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
|
+
'object.omit': (string[] | string)[];
|
|
312
326
|
/**
|
|
313
327
|
* Use a static value.
|
|
314
328
|
*/
|
|
@@ -331,6 +345,27 @@ export interface Remappers {
|
|
|
331
345
|
* If the input is not an array, the input is returned as-is.
|
|
332
346
|
*/
|
|
333
347
|
'random.choice': null;
|
|
348
|
+
/**
|
|
349
|
+
* Pick and return a random entry from an array.
|
|
350
|
+
*
|
|
351
|
+
* If the input is not an array, the input is returned as-is.
|
|
352
|
+
*/
|
|
353
|
+
'random.integer': [number, number];
|
|
354
|
+
/**
|
|
355
|
+
* Pick and return a random entry from an array.
|
|
356
|
+
*
|
|
357
|
+
* If the input is not an array, the input is returned as-is.
|
|
358
|
+
*/
|
|
359
|
+
'random.float': [number, number];
|
|
360
|
+
/**
|
|
361
|
+
* Pick and return a random entry from an array.
|
|
362
|
+
*
|
|
363
|
+
* If the input is not an array, the input is returned as-is.
|
|
364
|
+
*/
|
|
365
|
+
'random.string': {
|
|
366
|
+
choice: string;
|
|
367
|
+
length: number;
|
|
368
|
+
};
|
|
334
369
|
/**
|
|
335
370
|
* Get the input data as it was initially passed to the remap function.
|
|
336
371
|
*/
|
|
@@ -452,6 +487,16 @@ export interface ResourceHistoryDefinition {
|
|
|
452
487
|
*/
|
|
453
488
|
data: boolean;
|
|
454
489
|
}
|
|
490
|
+
export interface ResourceView {
|
|
491
|
+
/**
|
|
492
|
+
* The roles required to use this view.
|
|
493
|
+
*/
|
|
494
|
+
roles: string[];
|
|
495
|
+
/**
|
|
496
|
+
* The remappers used to transform the output.
|
|
497
|
+
*/
|
|
498
|
+
remap: Remapper;
|
|
499
|
+
}
|
|
455
500
|
export interface ResourceDefinition {
|
|
456
501
|
/**
|
|
457
502
|
* The default list of roles used for permission checks for each action.
|
|
@@ -501,6 +546,10 @@ export interface ResourceDefinition {
|
|
|
501
546
|
* @default autogenerated for use with the Appsemble resource API.
|
|
502
547
|
*/
|
|
503
548
|
url?: string;
|
|
549
|
+
/**
|
|
550
|
+
* The alternate views of this resource.
|
|
551
|
+
*/
|
|
552
|
+
views?: Record<string, ResourceView>;
|
|
504
553
|
/**
|
|
505
554
|
* The references this resources has to other resources.
|
|
506
555
|
*/
|
|
@@ -796,11 +845,17 @@ interface ResourceActionDefinition<T extends Action['type']> extends RequestLike
|
|
|
796
845
|
*/
|
|
797
846
|
resource: string;
|
|
798
847
|
}
|
|
848
|
+
interface ViewResourceDefinition {
|
|
849
|
+
/**
|
|
850
|
+
* The view to use for the request.
|
|
851
|
+
*/
|
|
852
|
+
view?: string;
|
|
853
|
+
}
|
|
799
854
|
export declare type RequestActionDefinition = RequestLikeActionDefinition<'request'>;
|
|
800
855
|
export declare type ResourceCreateActionDefinition = ResourceActionDefinition<'resource.create'>;
|
|
801
856
|
export declare type ResourceDeleteActionDefinition = ResourceActionDefinition<'resource.delete'>;
|
|
802
|
-
export declare type ResourceGetActionDefinition = ResourceActionDefinition<'resource.get'
|
|
803
|
-
export declare type ResourceQueryActionDefinition = ResourceActionDefinition<'resource.query'
|
|
857
|
+
export declare type ResourceGetActionDefinition = ResourceActionDefinition<'resource.get'> & ViewResourceDefinition;
|
|
858
|
+
export declare type ResourceQueryActionDefinition = ResourceActionDefinition<'resource.query'> & ViewResourceDefinition;
|
|
804
859
|
export declare type ResourceCountActionDefinition = ResourceActionDefinition<'resource.count'>;
|
|
805
860
|
export declare type ResourceUpdateActionDefinition = ResourceActionDefinition<'resource.update'>;
|
|
806
861
|
export interface BaseResourceSubscribeActionDefinition<T extends Action['type']> extends BaseActionDefinition<T> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/types",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.8",
|
|
4
4
|
"description": "TypeScript definitions reused within Appsemble internally",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"test": "jest"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@appsemble/sdk": "0.20.
|
|
33
|
+
"@appsemble/sdk": "0.20.8",
|
|
34
34
|
"@fortawesome/fontawesome-common-types": "^6.0.0",
|
|
35
35
|
"jsonschema": "^1.0.0",
|
|
36
36
|
"openapi-types": "^11.0.0",
|