@appsemble/types 0.20.38 → 0.20.39

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.38/config/assets/logo.svg) Appsemble Types
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.20.39/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.38/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.20.38)
7
- [![Code coverage](https://codecov.io/gl/appsemble/appsemble/branch/0.20.38/graph/badge.svg)](https://codecov.io/gl/appsemble/appsemble)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.20.39/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.20.39)
7
+ [![Code coverage](https://codecov.io/gl/appsemble/appsemble/branch/0.20.39/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.38/LICENSE.md) ©
24
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.20.39/LICENSE.md) ©
25
25
  [Appsemble](https://appsemble.com)
package/action.d.ts CHANGED
@@ -43,5 +43,5 @@ export type ResourcePatchAction = RequestLikeAction<'resource.patch'>;
43
43
  /**
44
44
  * An action that can be called from within a block.
45
45
  */
46
- export 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<'notify'> | BaseAction<'resource.subscription.status'> | BaseAction<'resource.subscription.subscribe'> | BaseAction<'resource.subscription.toggle'> | BaseAction<'resource.subscription.unsubscribe'> | BaseAction<'share'> | BaseAction<'static'> | BaseAction<'storage.append'> | BaseAction<'storage.delete'> | BaseAction<'storage.read'> | BaseAction<'storage.subtract'> | BaseAction<'storage.update'> | 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 | ResourcePatchAction | ResourceQueryAction | ResourceUpdateAction;
46
+ export 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<'match'> | BaseAction<'message'> | BaseAction<'noop'> | BaseAction<'notify'> | BaseAction<'resource.subscription.status'> | BaseAction<'resource.subscription.subscribe'> | BaseAction<'resource.subscription.toggle'> | BaseAction<'resource.subscription.unsubscribe'> | BaseAction<'share'> | BaseAction<'static'> | BaseAction<'storage.append'> | BaseAction<'storage.delete'> | BaseAction<'storage.read'> | BaseAction<'storage.subtract'> | BaseAction<'storage.update'> | 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 | ResourcePatchAction | ResourceQueryAction | ResourceUpdateAction;
47
47
  export {};
package/index.d.ts CHANGED
@@ -502,7 +502,9 @@ export interface Remappers {
502
502
  translate: string;
503
503
  user: keyof UserInfo;
504
504
  }
505
- export type Remapper = RequireExactlyOne<Remappers> | RequireExactlyOne<Remappers>[] | boolean | number | string;
505
+ export type ObjectRemapper = RequireExactlyOne<Remappers>;
506
+ export type ArrayRemapper = (ArrayRemapper | ObjectRemapper)[];
507
+ export type Remapper = ArrayRemapper | ObjectRemapper | boolean | number | string;
506
508
  export interface SubscriptionResponseResource {
507
509
  create: boolean;
508
510
  update: boolean;
@@ -719,6 +721,23 @@ export interface ConditionActionDefinition extends BaseActionDefinition<'conditi
719
721
  */
720
722
  else: ActionDefinition;
721
723
  }
724
+ export interface MatchActionDefinition extends BaseActionDefinition<'match'> {
725
+ /**
726
+ * Run another action if one of the cases is true.
727
+ *
728
+ * Only the first case that equals true is called.
729
+ */
730
+ match: {
731
+ /**
732
+ * The case to be matched.
733
+ */
734
+ case: Remapper;
735
+ /**
736
+ * Action to be called if the case equals true.
737
+ */
738
+ action: ActionDefinition;
739
+ }[];
740
+ }
722
741
  export interface DialogActionDefinition extends BaseActionDefinition<'dialog'> {
723
742
  /**
724
743
  * If false, the dialog cannot be closed by clicking outside of the dialog or on the close button.
@@ -1118,6 +1137,12 @@ export interface BaseMessage {
1118
1137
  * @default false
1119
1138
  */
1120
1139
  dismissable?: boolean;
1140
+ /**
1141
+ * The position of the message on the screen.
1142
+ *
1143
+ * @default 'bottom'
1144
+ */
1145
+ layout?: 'bottom' | 'top';
1121
1146
  }
1122
1147
  export type MessageActionDefinition = BaseActionDefinition<'message'> & BaseMessage & {
1123
1148
  /**
@@ -1125,7 +1150,7 @@ export type MessageActionDefinition = BaseActionDefinition<'message'> & BaseMess
1125
1150
  */
1126
1151
  body: Remapper;
1127
1152
  };
1128
- export 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 | NotifyActionDefinition | RequestActionDefinition | ResourceCountActionDefinition | ResourceCreateActionDefinition | ResourceDeleteActionDefinition | ResourceGetActionDefinition | ResourcePatchActionDefinition | ResourceQueryActionDefinition | ResourceSubscriptionStatusActionDefinition | ResourceSubscriptionSubscribeActionDefinition | ResourceSubscriptionToggleActionDefinition | ResourceSubscriptionUnsubscribeActionDefinition | ResourceUpdateActionDefinition | ShareActionDefinition | StaticActionDefinition | StorageAppendActionDefinition | StorageDeleteActionDefinition | StorageReadActionDefinition | StorageSubtractActionDefinition | StorageUpdateActionDefinition | StorageWriteActionDefinition | TeamInviteActionDefinition | UserLoginAction | UserRegisterAction | UserUpdateAction;
1153
+ export 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 | MatchActionDefinition | MessageActionDefinition | NotifyActionDefinition | RequestActionDefinition | ResourceCountActionDefinition | ResourceCreateActionDefinition | ResourceDeleteActionDefinition | ResourceGetActionDefinition | ResourcePatchActionDefinition | ResourceQueryActionDefinition | ResourceSubscriptionStatusActionDefinition | ResourceSubscriptionSubscribeActionDefinition | ResourceSubscriptionToggleActionDefinition | ResourceSubscriptionUnsubscribeActionDefinition | ResourceUpdateActionDefinition | ShareActionDefinition | StaticActionDefinition | StorageAppendActionDefinition | StorageDeleteActionDefinition | StorageReadActionDefinition | StorageSubtractActionDefinition | StorageUpdateActionDefinition | StorageWriteActionDefinition | TeamInviteActionDefinition | UserLoginAction | UserRegisterAction | UserUpdateAction;
1129
1154
  export interface ActionType {
1130
1155
  /**
1131
1156
  * 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.38",
3
+ "version": "0.20.39",
4
4
  "description": "TypeScript definitions reused within Appsemble internally",
5
5
  "keywords": [
6
6
  "app",