@appsemble/types 0.23.5 → 0.23.6

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,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.23.5/config/assets/logo.svg) Appsemble Types
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.23.6/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.23.5/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.23.5)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.23.6/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.23.6)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -26,5 +26,5 @@ not guaranteed.
26
26
 
27
27
  ## License
28
28
 
29
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.23.5/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.23.6/LICENSE.md) ©
30
30
  [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<'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<'team.members'> | BaseAction<'throw'> | BaseAction<'user.login'> | BaseAction<'user.logout'> | 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<'controller'> | 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<'team.members'> | BaseAction<'throw'> | BaseAction<'user.login'> | BaseAction<'user.logout'> | BaseAction<'user.register'> | BaseAction<'user.update'> | LinkAction | LogAction | RequestAction | ResourceCountAction | ResourceCreateAction | ResourceDeleteAction | ResourceGetAction | ResourcePatchAction | ResourceQueryAction | ResourceUpdateAction;
47
47
  export {};
package/index.d.ts CHANGED
@@ -35,26 +35,46 @@ export interface OAuth2AuthorizationCode {
35
35
  */
36
36
  code: string;
37
37
  }
38
+ /**
39
+ * A project that is loaded in an app
40
+ */
41
+ export interface ControllerDefinition {
42
+ /**
43
+ * A mapping of actions that can be fired by the project to action handlers.
44
+ *
45
+ * The exact meaning of the parameters depends on the project.
46
+ */
47
+ actions?: Record<string, ActionDefinition>;
48
+ /**
49
+ * Mapping of the events the project can listen to and emit.
50
+ *
51
+ * The exact meaning of the parameters depends on the project.
52
+ */
53
+ events?: {
54
+ listen?: Record<string, string>;
55
+ emit?: Record<string, string>;
56
+ };
57
+ }
38
58
  /**
39
59
  * A block that is displayed on a page.
40
60
  */
41
- export interface BlockDefinition {
61
+ export interface BlockDefinition extends ControllerDefinition {
42
62
  /**
43
- * The type of the block.
63
+ * The type of the controller.
44
64
  *
45
- * A block type follow the format `@organization/name`.
65
+ * A block type follow the format `@organization/project`.
46
66
  * If the organization is _appsemble_, it may be omitted.
47
67
  *
48
68
  * Pattern:
49
69
  * ^(@[a-z]([a-z\d-]{0,30}[a-z\d])?\/)?[a-z]([a-z\d-]{0,30}[a-z\d])$
50
70
  *
51
71
  * Examples:
52
- * - `form`
53
- * - `@amsterdam/splash`
72
+ * - `empty`
73
+ * - `@amsterdam/empty`
54
74
  */
55
75
  type: string;
56
76
  /**
57
- * A [semver](https://semver.org) representation of the block version.
77
+ * A [semver](https://semver.org) representation of the project version.
58
78
  *
59
79
  * Pattern:
60
80
  * ^\d+\.\d+\.\d+$
@@ -77,30 +97,15 @@ export interface BlockDefinition {
77
97
  */
78
98
  theme?: Partial<Theme>;
79
99
  /**
80
- * A free form mapping of named parameters.
81
- *
82
- * The exact meaning of the parameters depends on the block type.
83
- */
84
- parameters?: JsonObject;
85
- /**
86
- * A mapping of actions that can be fired by the block to action handlers.
87
- *
88
- * The exact meaning of the parameters depends on the block type.
100
+ * A list of roles that are allowed to view this block.
89
101
  */
90
- actions?: Record<string, ActionDefinition>;
102
+ roles?: string[];
91
103
  /**
92
- * Mapping of the events the block can listen to and emit.
104
+ * A free form mapping of named parameters.
93
105
  *
94
- * The exact meaning of the parameters depends on the block type.
106
+ * The exact meaning of the parameters depends on the project type.
95
107
  */
96
- events?: {
97
- listen?: Record<string, string>;
98
- emit?: Record<string, string>;
99
- };
100
- /**
101
- * A list of roles that are allowed to view this block.
102
- */
103
- roles?: string[];
108
+ parameters?: JsonObject;
104
109
  }
105
110
  /**
106
111
  * OpenID Connect specifies a set of standard claims about the end-user, which cover common profile
@@ -1132,6 +1137,9 @@ interface ViewResourceDefinition {
1132
1137
  */
1133
1138
  view?: string;
1134
1139
  }
1140
+ export interface ControllerActionDefinition extends BaseActionDefinition<'controller'> {
1141
+ handler: string;
1142
+ }
1135
1143
  export type RequestActionDefinition = RequestLikeActionDefinition<'request'>;
1136
1144
  export type ResourceCreateActionDefinition = ResourceActionDefinition<'resource.create'>;
1137
1145
  export type ResourceDeleteActionDefinition = ResourceActionDefinition<'resource.delete'>;
@@ -1205,7 +1213,7 @@ export type MessageActionDefinition = BaseActionDefinition<'message'> & BaseMess
1205
1213
  */
1206
1214
  body: Remapper;
1207
1215
  };
1208
- 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 | TeamMembersActionDefinition | UserLoginAction | UserLogoutAction | UserRegisterAction | UserUpdateAction;
1216
+ 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 | ControllerActionDefinition | 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 | TeamMembersActionDefinition | UserLoginAction | UserLogoutAction | UserRegisterAction | UserUpdateAction;
1209
1217
  export interface ActionType {
1210
1218
  /**
1211
1219
  * Whether or not app creators are required to define this action.
@@ -1222,82 +1230,6 @@ export interface EventType {
1222
1230
  */
1223
1231
  description?: string;
1224
1232
  }
1225
- export interface BlockManifest {
1226
- /**
1227
- * A block manifest as it is available to the app and in the SDK.
1228
- * pattern: ^@[a-z]([a-z\d-]{0,30}[a-z\d])?\/[a-z]([a-z\d-]{0,30}[a-z\d])$
1229
- * The name of a block.
1230
- */
1231
- name: string;
1232
- /**
1233
- * The description of the block.
1234
- */
1235
- description?: string;
1236
- /**
1237
- * The long description of the block.
1238
- *
1239
- * This is displayed when rendering block documentation and supports Markdown.
1240
- */
1241
- longDescription?: string;
1242
- /**
1243
- * A [semver](https://semver.org) representation of the block version.
1244
- *
1245
- * Pattern:
1246
- * ^\d+\.\d+\.\d+$
1247
- */
1248
- version: string;
1249
- /**
1250
- * The type of layout to be used for the block.
1251
- */
1252
- layout?: 'float' | 'grow' | 'hidden' | 'static' | null;
1253
- /**
1254
- * Array of urls associated to the files of the block.
1255
- */
1256
- files: string[];
1257
- /**
1258
- * The actions that are supported by a block.
1259
- */
1260
- actions?: Record<string, ActionType>;
1261
- /**
1262
- * The messages that are supported by a block.
1263
- */
1264
- messages?: Record<string, Record<string, any> | never>;
1265
- /**
1266
- * The events that are supported by a block.
1267
- */
1268
- events?: {
1269
- listen?: Record<string, EventType>;
1270
- emit?: Record<string, EventType>;
1271
- };
1272
- /**
1273
- * A JSON schema to validate block parameters.
1274
- */
1275
- parameters?: Schema;
1276
- /**
1277
- * The URL that can be used to fetch this block’s icon.
1278
- */
1279
- iconUrl?: string;
1280
- /**
1281
- * The languages that are supported by the block by default.
1282
- *
1283
- * If the block has no messages, this property is `null`.
1284
- */
1285
- languages: string[] | null;
1286
- examples?: string[];
1287
- /**
1288
- * Whether the block should be listed publicly
1289
- * for users who aren’t part of the block’s organization.
1290
- *
1291
- * - **`public`**: The block is visible for everyone.
1292
- * - **`unlisted`**: The block will only be visible if the user is
1293
- * logged in and is part of the block’s organization.
1294
- */
1295
- visibility?: 'public' | 'unlisted';
1296
- /**
1297
- * Whether action validation for wildcard action is skipped.
1298
- */
1299
- wildcardActions?: boolean;
1300
- }
1301
1233
  /**
1302
1234
  * This describes what a page will look like in the app.
1303
1235
  */
@@ -1495,6 +1427,7 @@ export interface AppDefinition {
1495
1427
  * The pages of the app.
1496
1428
  */
1497
1429
  pages: PageDefinition[];
1430
+ controller?: ControllerDefinition;
1498
1431
  /**
1499
1432
  * Resource definitions that may be used by the app.
1500
1433
  */
@@ -1638,6 +1571,14 @@ export interface App {
1638
1571
  * Any pre-included translations of the app.
1639
1572
  */
1640
1573
  messages?: AppsembleMessages;
1574
+ /**
1575
+ * The build app controller's code
1576
+ */
1577
+ controllerCode?: string;
1578
+ /**
1579
+ * The build app controller's manifest
1580
+ */
1581
+ controllerImplementations?: ProjectImplementations;
1641
1582
  /**
1642
1583
  * Any app styles that are shared.
1643
1584
  */
@@ -1725,7 +1666,7 @@ export interface OrganizationInvite {
1725
1666
  role: string;
1726
1667
  }
1727
1668
  /**
1728
- * A member of an app.
1669
+ * The controller of an app.
1729
1670
  */
1730
1671
  export interface AppMember {
1731
1672
  id: string;
@@ -1992,22 +1933,94 @@ export interface TrainingBlock {
1992
1933
  exampleCode?: string;
1993
1934
  }
1994
1935
  export type SAMLStatus = 'badsignature' | 'emailconflict' | 'invalidrelaystate' | 'invalidsecret' | 'invalidstatuscode' | 'invalidsubjectconfirmation' | 'missingnameid' | 'missingsubject';
1995
- /**
1996
- * The block configuration that’s used by the CLI when building a block.
1997
- *
1998
- * This configuration is also passed to the Webpack configuration function as the `env` variable.
1999
- */
2000
- export interface BlockConfig extends Pick<BlockManifest, 'actions' | 'description' | 'events' | 'layout' | 'longDescription' | 'messages' | 'name' | 'parameters' | 'version' | 'visibility' | 'wildcardActions'> {
1936
+ export interface ProjectConfig {
1937
+ /**
1938
+ * The name of the project.
1939
+ */
1940
+ name: string;
2001
1941
  /**
2002
- * The path to the webpack configuration file relative to the block project directory.
1942
+ * The description of the project.
2003
1943
  */
2004
- webpack: string;
1944
+ description?: string;
2005
1945
  /**
2006
- * The build output directory relative to the block project directory.
1946
+ * The long description of the project.
1947
+ *
1948
+ * This is displayed when rendering documentation and supports Markdown.
2007
1949
  */
2008
- output: string;
1950
+ longDescription?: string;
2009
1951
  /**
2010
- * The absolute directory of the block project.
1952
+ * A [semver](https://semver.org) representation of the project version.
1953
+ *
1954
+ * Pattern:
1955
+ * ^\d+\.\d+\.\d+$
1956
+ */
1957
+ version: string;
1958
+ [key: string]: any;
1959
+ }
1960
+ export interface ProjectBuildConfig extends ProjectConfig {
1961
+ /**
1962
+ * The build output directory relative to the project directory.
1963
+ */
1964
+ output?: string;
1965
+ /**
1966
+ * The absolute directory of the project.
2011
1967
  */
2012
1968
  dir: string;
2013
1969
  }
1970
+ export interface ProjectImplementations {
1971
+ /**
1972
+ * The actions that are supported by a project.
1973
+ */
1974
+ actions?: Record<string, ActionType>;
1975
+ /**
1976
+ * The events that are supported by a project.
1977
+ */
1978
+ events?: {
1979
+ listen?: Record<string, EventType>;
1980
+ emit?: Record<string, EventType>;
1981
+ };
1982
+ /**
1983
+ * The messages that are supported by a project.
1984
+ */
1985
+ messages?: Record<string, Record<string, any> | never>;
1986
+ /**
1987
+ * A JSON schema to validate project parameters.
1988
+ */
1989
+ parameters?: Schema;
1990
+ }
1991
+ export interface ProjectManifest extends ProjectConfig, ProjectImplementations {
1992
+ /**
1993
+ * Array of urls associated to the files of the project.
1994
+ */
1995
+ files: string[];
1996
+ }
1997
+ export interface BlockManifest extends ProjectManifest {
1998
+ /**
1999
+ * The URL that can be used to fetch this block’s icon.
2000
+ */
2001
+ iconUrl?: string;
2002
+ /**
2003
+ * The languages that are supported by the block by default.
2004
+ *
2005
+ * If the block has no messages, this property is `null`.
2006
+ */
2007
+ languages: string[] | null;
2008
+ examples?: string[];
2009
+ /**
2010
+ * Whether the block should be listed publicly
2011
+ * for users who aren’t part of the block’s organization.
2012
+ *
2013
+ * - **`public`**: The block is visible for everyone.
2014
+ * - **`unlisted`**: The block will only be visible if the user is
2015
+ * logged in and is part of the block’s organization.
2016
+ */
2017
+ visibility?: 'public' | 'unlisted';
2018
+ /**
2019
+ * Whether action validation for wildcard action is skipped.
2020
+ */
2021
+ wildcardActions?: boolean;
2022
+ /**
2023
+ * The type of layout to be used for the block.
2024
+ */
2025
+ layout?: 'float' | 'grow' | 'hidden' | 'static' | null;
2026
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/types",
3
- "version": "0.23.5",
3
+ "version": "0.23.6",
4
4
  "description": "TypeScript definitions reused within Appsemble internally",
5
5
  "keywords": [
6
6
  "app",