@appsemble/types 0.20.15 → 0.20.17

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 CHANGED
@@ -1,10 +1,10 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.20.15/config/assets/logo.svg) Appsemble Types
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.20.17/config/assets/logo.svg) Appsemble Types
2
2
 
3
3
  > Reusable TypeScript types
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/types)](https://www.npmjs.com/package/@appsemble/types)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.20.15/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.20.15)
7
- [![Code coverage](https://codecov.io/gl/appsemble/appsemble/branch/0.20.15/graph/badge.svg)](https://codecov.io/gl/appsemble/appsemble)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.20.17/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.20.17)
7
+ [![Code coverage](https://codecov.io/gl/appsemble/appsemble/branch/0.20.17/graph/badge.svg)](https://codecov.io/gl/appsemble/appsemble)
8
8
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
9
9
 
10
10
  ## Installation
@@ -21,5 +21,5 @@ not guaranteed.
21
21
 
22
22
  ## License
23
23
 
24
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.20.15/LICENSE.md) ©
24
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.20.17/LICENSE.md) ©
25
25
  [Appsemble](https://appsemble.com)
package/action.d.ts CHANGED
@@ -42,5 +42,5 @@ export declare type ResourceUpdateAction = RequestLikeAction<'resource.update'>;
42
42
  /**
43
43
  * An action that can be called from within a block.
44
44
  */
45
- export declare type Action = BaseAction<'analytics'> | BaseAction<'condition'> | BaseAction<'dialog.error'> | BaseAction<'dialog.ok'> | BaseAction<'dialog'> | BaseAction<'download'> | BaseAction<'email'> | BaseAction<'event'> | BaseAction<'flow.back'> | BaseAction<'flow.cancel'> | BaseAction<'flow.finish'> | BaseAction<'flow.next'> | BaseAction<'flow.to'> | BaseAction<'link.back'> | BaseAction<'link.next'> | BaseAction<'message'> | BaseAction<'noop'> | BaseAction<'resource.subscription.status'> | BaseAction<'resource.subscription.subscribe'> | BaseAction<'resource.subscription.toggle'> | BaseAction<'resource.subscription.unsubscribe'> | BaseAction<'share'> | BaseAction<'static'> | BaseAction<'storage.read'> | BaseAction<'storage.write'> | BaseAction<'team.invite'> | BaseAction<'team.join'> | BaseAction<'team.list'> | BaseAction<'throw'> | BaseAction<'user.login'> | BaseAction<'user.register'> | BaseAction<'user.update'> | LinkAction | LogAction | RequestAction | ResourceCountAction | ResourceCreateAction | ResourceDeleteAction | ResourceGetAction | ResourceQueryAction | ResourceUpdateAction;
45
+ export declare type Action = BaseAction<'analytics'> | BaseAction<'condition'> | BaseAction<'dialog.error'> | BaseAction<'dialog.ok'> | BaseAction<'dialog'> | BaseAction<'download'> | BaseAction<'each'> | BaseAction<'email'> | BaseAction<'event'> | BaseAction<'flow.back'> | BaseAction<'flow.cancel'> | BaseAction<'flow.finish'> | BaseAction<'flow.next'> | BaseAction<'flow.to'> | BaseAction<'link.back'> | BaseAction<'link.next'> | BaseAction<'message'> | BaseAction<'noop'> | BaseAction<'resource.subscription.status'> | BaseAction<'resource.subscription.subscribe'> | BaseAction<'resource.subscription.toggle'> | BaseAction<'resource.subscription.unsubscribe'> | BaseAction<'share'> | BaseAction<'static'> | BaseAction<'storage.read'> | BaseAction<'storage.write'> | BaseAction<'team.invite'> | BaseAction<'team.join'> | BaseAction<'team.list'> | BaseAction<'throw'> | BaseAction<'user.login'> | BaseAction<'user.register'> | BaseAction<'user.update'> | LinkAction | LogAction | RequestAction | ResourceCountAction | ResourceCreateAction | ResourceDeleteAction | ResourceGetAction | ResourceQueryAction | ResourceUpdateAction;
46
46
  export {};
package/action.ts CHANGED
@@ -56,6 +56,7 @@ export type Action =
56
56
  | BaseAction<'dialog.ok'>
57
57
  | BaseAction<'dialog'>
58
58
  | BaseAction<'download'>
59
+ | BaseAction<'each'>
59
60
  | BaseAction<'email'>
60
61
  | BaseAction<'event'>
61
62
  | BaseAction<'flow.back'>
package/index.d.ts CHANGED
@@ -380,6 +380,54 @@ export interface Remappers {
380
380
  * Get the input data as it was initially passed to the remap function.
381
381
  */
382
382
  root: null;
383
+ /**
384
+ * Get the data at a certain index from the history stack prior to an action.
385
+ *
386
+ * 0 is the index of the first item in the history stack.
387
+ */
388
+ history: number;
389
+ /**
390
+ * Assign properties from the history stack at a certain index to an existing object.
391
+ */
392
+ 'assign.history': {
393
+ /**
394
+ * The index of the history stack item to assign.
395
+ *
396
+ * 0 is the index of the first item in the history stack.
397
+ */
398
+ index: number;
399
+ /**
400
+ * Predefined mapper keys to choose what properties to assign.
401
+ */
402
+ props: Record<string, Remapper>;
403
+ };
404
+ /**
405
+ * Assign properties from the history stack at a certain index and exclude the unwanted.
406
+ */
407
+ 'omit.history': {
408
+ /**
409
+ * The index of the history stack item to assign.
410
+ *
411
+ * 0 is the index of the first item in the history stack.
412
+ */
413
+ index: number;
414
+ /**
415
+ * Exclude properties from the history stack item, based on the given object keys.
416
+ *
417
+ * Nested properties can be excluded using arrays of keys.
418
+ *
419
+ * @example
420
+ * ```yaml
421
+ * omit.history:
422
+ * index: 0
423
+ * keys:
424
+ * - foo # Excludes the property foo
425
+ * - - bar # Excludes the property baz inside of bar
426
+ * - baz
427
+ * ```
428
+ */
429
+ keys: (string[] | string)[];
430
+ };
383
431
  /**
384
432
  * Convert an input to lower or upper case.
385
433
  */
@@ -419,6 +467,7 @@ export interface SubscriptionResponseResource {
419
467
  update: boolean;
420
468
  delete: boolean;
421
469
  subscriptions?: Record<string, {
470
+ create?: boolean;
422
471
  update: boolean;
423
472
  delete: boolean;
424
473
  }>;
@@ -649,6 +698,16 @@ export interface DownloadActionDefinition extends BaseActionDefinition<'download
649
698
  */
650
699
  filename: string;
651
700
  }
701
+ export interface EachActionDefinition extends BaseActionDefinition<'each'> {
702
+ /**
703
+ * Run an action for each entry in an array.
704
+ *
705
+ * The actions are run in parallel.
706
+ *
707
+ * If the input is not an array, the action will be applied to the input instead.
708
+ */
709
+ do: ActionDefinition;
710
+ }
652
711
  export interface EmailActionDefinition extends BaseActionDefinition<'email'> {
653
712
  /**
654
713
  * The recipient of the email.
@@ -937,7 +996,7 @@ export declare type MessageActionDefinition = BaseActionDefinition<'message'> &
937
996
  */
938
997
  body: Remapper;
939
998
  };
940
- 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;
999
+ 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 | EachActionDefinition | 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;
941
1000
  export interface ActionType {
942
1001
  /**
943
1002
  * Whether or not app creators are required to define this action.
package/index.ts CHANGED
@@ -441,6 +441,59 @@ export interface Remappers {
441
441
  */
442
442
  root: null;
443
443
 
444
+ /**
445
+ * Get the data at a certain index from the history stack prior to an action.
446
+ *
447
+ * 0 is the index of the first item in the history stack.
448
+ */
449
+ history: number;
450
+
451
+ /**
452
+ * Assign properties from the history stack at a certain index to an existing object.
453
+ */
454
+ 'assign.history': {
455
+ /**
456
+ * The index of the history stack item to assign.
457
+ *
458
+ * 0 is the index of the first item in the history stack.
459
+ */
460
+ index: number;
461
+
462
+ /**
463
+ * Predefined mapper keys to choose what properties to assign.
464
+ */
465
+ props: Record<string, Remapper>;
466
+ };
467
+
468
+ /**
469
+ * Assign properties from the history stack at a certain index and exclude the unwanted.
470
+ */
471
+ 'omit.history': {
472
+ /**
473
+ * The index of the history stack item to assign.
474
+ *
475
+ * 0 is the index of the first item in the history stack.
476
+ */
477
+ index: number;
478
+
479
+ /**
480
+ * Exclude properties from the history stack item, based on the given object keys.
481
+ *
482
+ * Nested properties can be excluded using arrays of keys.
483
+ *
484
+ * @example
485
+ * ```yaml
486
+ * omit.history:
487
+ * index: 0
488
+ * keys:
489
+ * - foo # Excludes the property foo
490
+ * - - bar # Excludes the property baz inside of bar
491
+ * - baz
492
+ * ```
493
+ */
494
+ keys: (string[] | string)[];
495
+ };
496
+
444
497
  /**
445
498
  * Convert an input to lower or upper case.
446
499
  */
@@ -495,6 +548,7 @@ export interface SubscriptionResponseResource {
495
548
  subscriptions?: Record<
496
549
  string,
497
550
  {
551
+ create?: boolean;
498
552
  update: boolean;
499
553
  delete: boolean;
500
554
  }
@@ -776,6 +830,17 @@ export interface DownloadActionDefinition extends BaseActionDefinition<'download
776
830
  filename: string;
777
831
  }
778
832
 
833
+ export interface EachActionDefinition extends BaseActionDefinition<'each'> {
834
+ /**
835
+ * Run an action for each entry in an array.
836
+ *
837
+ * The actions are run in parallel.
838
+ *
839
+ * If the input is not an array, the action will be applied to the input instead.
840
+ */
841
+ do: ActionDefinition;
842
+ }
843
+
779
844
  export interface EmailActionDefinition extends BaseActionDefinition<'email'> {
780
845
  /**
781
846
  * The recipient of the email.
@@ -1148,6 +1213,7 @@ export type ActionDefinition =
1148
1213
  | ConditionActionDefinition
1149
1214
  | DialogActionDefinition
1150
1215
  | DownloadActionDefinition
1216
+ | EachActionDefinition
1151
1217
  | EmailActionDefinition
1152
1218
  | EventActionDefinition
1153
1219
  | FlowToActionDefinition
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/types",
3
- "version": "0.20.15",
3
+ "version": "0.20.17",
4
4
  "description": "TypeScript definitions reused within Appsemble internally",
5
5
  "keywords": [
6
6
  "app",