@appsemble/types 0.20.5 → 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 +136 -6
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -165,6 +165,49 @@ export interface TokenResponse {
|
|
|
165
165
|
refresh_token?: string;
|
|
166
166
|
token_type: 'bearer';
|
|
167
167
|
}
|
|
168
|
+
interface BaseICSRemapper {
|
|
169
|
+
/**
|
|
170
|
+
* The start of the icalendar event.
|
|
171
|
+
*/
|
|
172
|
+
start: Remapper;
|
|
173
|
+
/**
|
|
174
|
+
* The title of the event.
|
|
175
|
+
*/
|
|
176
|
+
title: Remapper;
|
|
177
|
+
/**
|
|
178
|
+
* An optional description of the event.
|
|
179
|
+
*/
|
|
180
|
+
description?: Remapper;
|
|
181
|
+
/**
|
|
182
|
+
* An optional link to attach to the event.
|
|
183
|
+
*/
|
|
184
|
+
url?: Remapper;
|
|
185
|
+
/**
|
|
186
|
+
* An optional location description to attach to the event.
|
|
187
|
+
*/
|
|
188
|
+
location?: Remapper;
|
|
189
|
+
/**
|
|
190
|
+
* An optional geolocation description to attach to the event.
|
|
191
|
+
*
|
|
192
|
+
* This must be an object with the properties `lat` or `latitude`, and `lon`, `lng` or
|
|
193
|
+
* `longitude`.
|
|
194
|
+
*/
|
|
195
|
+
coordinates?: Remapper;
|
|
196
|
+
}
|
|
197
|
+
interface DurationICSRemapper extends BaseICSRemapper {
|
|
198
|
+
/**
|
|
199
|
+
* The duration of the event.
|
|
200
|
+
*
|
|
201
|
+
* @example '1w 3d 10h 30m'
|
|
202
|
+
*/
|
|
203
|
+
duration: Remapper;
|
|
204
|
+
}
|
|
205
|
+
interface EndTimeICSRemapper extends BaseICSRemapper {
|
|
206
|
+
/**
|
|
207
|
+
* The end time of the event as a date or a date string.
|
|
208
|
+
*/
|
|
209
|
+
end: Remapper;
|
|
210
|
+
}
|
|
168
211
|
export interface Remappers {
|
|
169
212
|
/**
|
|
170
213
|
* Get app metadata.
|
|
@@ -207,6 +250,18 @@ export interface Remappers {
|
|
|
207
250
|
* Returns `true` if all entries are equal, otherwise `false`.
|
|
208
251
|
*/
|
|
209
252
|
equals: Remapper[];
|
|
253
|
+
/**
|
|
254
|
+
* Compares the first computed remapper value with the second computed remapper value.
|
|
255
|
+
*
|
|
256
|
+
* Returns `true` of the first entry is greater than the second entry.
|
|
257
|
+
*/
|
|
258
|
+
gt: [Remapper, Remapper];
|
|
259
|
+
/**
|
|
260
|
+
* Compares the first computed remapper value with the second computed remapper value.
|
|
261
|
+
*
|
|
262
|
+
* Returns `true` of the first entry is less than the second entry.
|
|
263
|
+
*/
|
|
264
|
+
lt: [Remapper, Remapper];
|
|
210
265
|
/**
|
|
211
266
|
* Builds an array based on the given data and remappers.
|
|
212
267
|
*
|
|
@@ -226,6 +281,10 @@ export interface Remappers {
|
|
|
226
281
|
* If the input is not an array, the input is returned without any modifications.
|
|
227
282
|
*/
|
|
228
283
|
'array.unique': Remapper;
|
|
284
|
+
/**
|
|
285
|
+
* Create an icalendar event.
|
|
286
|
+
*/
|
|
287
|
+
ics: DurationICSRemapper | EndTimeICSRemapper;
|
|
229
288
|
/**
|
|
230
289
|
* Checks if condition results in a truthy value.
|
|
231
290
|
*
|
|
@@ -250,6 +309,20 @@ export interface Remappers {
|
|
|
250
309
|
* Assign properties to an existing object given some predefined mapper keys.
|
|
251
310
|
*/
|
|
252
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)[];
|
|
253
326
|
/**
|
|
254
327
|
* Use a static value.
|
|
255
328
|
*/
|
|
@@ -272,6 +345,27 @@ export interface Remappers {
|
|
|
272
345
|
* If the input is not an array, the input is returned as-is.
|
|
273
346
|
*/
|
|
274
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
|
+
};
|
|
275
369
|
/**
|
|
276
370
|
* Get the input data as it was initially passed to the remap function.
|
|
277
371
|
*/
|
|
@@ -393,6 +487,16 @@ export interface ResourceHistoryDefinition {
|
|
|
393
487
|
*/
|
|
394
488
|
data: boolean;
|
|
395
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
|
+
}
|
|
396
500
|
export interface ResourceDefinition {
|
|
397
501
|
/**
|
|
398
502
|
* The default list of roles used for permission checks for each action.
|
|
@@ -442,6 +546,10 @@ export interface ResourceDefinition {
|
|
|
442
546
|
* @default autogenerated for use with the Appsemble resource API.
|
|
443
547
|
*/
|
|
444
548
|
url?: string;
|
|
549
|
+
/**
|
|
550
|
+
* The alternate views of this resource.
|
|
551
|
+
*/
|
|
552
|
+
views?: Record<string, ResourceView>;
|
|
445
553
|
/**
|
|
446
554
|
* The references this resources has to other resources.
|
|
447
555
|
*/
|
|
@@ -449,7 +557,7 @@ export interface ResourceDefinition {
|
|
|
449
557
|
/**
|
|
450
558
|
* A time string representing when a resource should expire.
|
|
451
559
|
*
|
|
452
|
-
*
|
|
560
|
+
* @example '1d 8h 30m'
|
|
453
561
|
*/
|
|
454
562
|
expires?: string;
|
|
455
563
|
}
|
|
@@ -514,6 +622,12 @@ export interface DialogActionDefinition extends BaseActionDefinition<'dialog'> {
|
|
|
514
622
|
*/
|
|
515
623
|
title?: Remapper;
|
|
516
624
|
}
|
|
625
|
+
export interface DownloadActionDefinition extends BaseActionDefinition<'download'> {
|
|
626
|
+
/**
|
|
627
|
+
* The filename to download the file as. It must include a file extension.
|
|
628
|
+
*/
|
|
629
|
+
filename: string;
|
|
630
|
+
}
|
|
517
631
|
export interface EmailActionDefinition extends BaseActionDefinition<'email'> {
|
|
518
632
|
/**
|
|
519
633
|
* The recipient of the email.
|
|
@@ -542,9 +656,19 @@ export interface EmailActionDefinition extends BaseActionDefinition<'email'> {
|
|
|
542
656
|
*/
|
|
543
657
|
body: Remapper;
|
|
544
658
|
/**
|
|
545
|
-
* The attachments
|
|
659
|
+
* The attachments to include in the email.
|
|
660
|
+
*
|
|
661
|
+
* The remapper must resolve to an object containing the following properties:
|
|
546
662
|
*
|
|
547
|
-
*
|
|
663
|
+
* - \`target\`: The asset ID or link to download contents from to add as an attachment. This is
|
|
664
|
+
* mutually exclusive with \`content\`.
|
|
665
|
+
* - \`content\`: The raw content to include as the file content. This is mutually exclusive with
|
|
666
|
+
* \`target\`.
|
|
667
|
+
* - \`filename\`: The filename to include the attachment as.
|
|
668
|
+
* - \`accept\` If the target is a URL, this will be set as the HTTP \`Accept\` header when
|
|
669
|
+
* downloading the file.
|
|
670
|
+
*
|
|
671
|
+
* If the attachment is a string, it will be treated as the target.
|
|
548
672
|
*/
|
|
549
673
|
attachments?: Remapper;
|
|
550
674
|
}
|
|
@@ -721,11 +845,17 @@ interface ResourceActionDefinition<T extends Action['type']> extends RequestLike
|
|
|
721
845
|
*/
|
|
722
846
|
resource: string;
|
|
723
847
|
}
|
|
848
|
+
interface ViewResourceDefinition {
|
|
849
|
+
/**
|
|
850
|
+
* The view to use for the request.
|
|
851
|
+
*/
|
|
852
|
+
view?: string;
|
|
853
|
+
}
|
|
724
854
|
export declare type RequestActionDefinition = RequestLikeActionDefinition<'request'>;
|
|
725
855
|
export declare type ResourceCreateActionDefinition = ResourceActionDefinition<'resource.create'>;
|
|
726
856
|
export declare type ResourceDeleteActionDefinition = ResourceActionDefinition<'resource.delete'>;
|
|
727
|
-
export declare type ResourceGetActionDefinition = ResourceActionDefinition<'resource.get'
|
|
728
|
-
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;
|
|
729
859
|
export declare type ResourceCountActionDefinition = ResourceActionDefinition<'resource.count'>;
|
|
730
860
|
export declare type ResourceUpdateActionDefinition = ResourceActionDefinition<'resource.update'>;
|
|
731
861
|
export interface BaseResourceSubscribeActionDefinition<T extends Action['type']> extends BaseActionDefinition<T> {
|
|
@@ -766,7 +896,7 @@ export declare type MessageActionDefinition = BaseActionDefinition<'message'> &
|
|
|
766
896
|
*/
|
|
767
897
|
body: Remapper;
|
|
768
898
|
};
|
|
769
|
-
export declare type ActionDefinition = AnalyticsAction | BaseActionDefinition<'dialog.error'> | BaseActionDefinition<'dialog.ok'> | BaseActionDefinition<'flow.back'> | BaseActionDefinition<'flow.cancel'> | BaseActionDefinition<'flow.finish'> | BaseActionDefinition<'flow.next'> | BaseActionDefinition<'link.back'> | BaseActionDefinition<'link.next'> | BaseActionDefinition<'noop'> | BaseActionDefinition<'team.join'> | BaseActionDefinition<'team.list'> | BaseActionDefinition<'throw'> | ConditionActionDefinition | DialogActionDefinition | EmailActionDefinition | EventActionDefinition | FlowToActionDefinition | LinkActionDefinition | LogActionDefinition | MessageActionDefinition | RequestActionDefinition | ResourceCountActionDefinition | ResourceCreateActionDefinition | ResourceDeleteActionDefinition | ResourceGetActionDefinition | ResourceQueryActionDefinition | ResourceSubscriptionStatusActionDefinition | ResourceSubscriptionSubscribeActionDefinition | ResourceSubscriptionToggleActionDefinition | ResourceSubscriptionUnsubscribeActionDefinition | ResourceUpdateActionDefinition | ShareActionDefinition | StaticActionDefinition | StorageReadActionDefinition | StorageWriteActionDefinition | TeamInviteActionDefinition | UserLoginAction | UserRegisterAction | UserUpdateAction;
|
|
899
|
+
export declare type ActionDefinition = AnalyticsAction | BaseActionDefinition<'dialog.error'> | BaseActionDefinition<'dialog.ok'> | BaseActionDefinition<'flow.back'> | BaseActionDefinition<'flow.cancel'> | BaseActionDefinition<'flow.finish'> | BaseActionDefinition<'flow.next'> | BaseActionDefinition<'link.back'> | BaseActionDefinition<'link.next'> | BaseActionDefinition<'noop'> | BaseActionDefinition<'team.join'> | BaseActionDefinition<'team.list'> | BaseActionDefinition<'throw'> | ConditionActionDefinition | DialogActionDefinition | DownloadActionDefinition | EmailActionDefinition | EventActionDefinition | FlowToActionDefinition | LinkActionDefinition | LogActionDefinition | MessageActionDefinition | RequestActionDefinition | ResourceCountActionDefinition | ResourceCreateActionDefinition | ResourceDeleteActionDefinition | ResourceGetActionDefinition | ResourceQueryActionDefinition | ResourceSubscriptionStatusActionDefinition | ResourceSubscriptionSubscribeActionDefinition | ResourceSubscriptionToggleActionDefinition | ResourceSubscriptionUnsubscribeActionDefinition | ResourceUpdateActionDefinition | ShareActionDefinition | StaticActionDefinition | StorageReadActionDefinition | StorageWriteActionDefinition | TeamInviteActionDefinition | UserLoginAction | UserRegisterAction | UserUpdateAction;
|
|
770
900
|
export interface ActionType {
|
|
771
901
|
/**
|
|
772
902
|
* Whether or not app creators are required to define this action.
|
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,10 +30,10 @@
|
|
|
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
|
-
"openapi-types": "^
|
|
36
|
+
"openapi-types": "^11.0.0",
|
|
37
37
|
"type-fest": "^2.0.0"
|
|
38
38
|
}
|
|
39
39
|
}
|