@appsemble/types 0.20.9 → 0.20.10

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.
@@ -0,0 +1,46 @@
1
+ import { Remapper } from '.';
2
+ import { HTTPMethods } from './http';
3
+ interface BaseAction<T extends string> {
4
+ /**
5
+ * A function which can be called to dispatch the action.
6
+ */
7
+ <R>(data?: any, context?: Record<string, any>): Promise<R>;
8
+ /**
9
+ * The type of the action.
10
+ */
11
+ type: T;
12
+ }
13
+ export interface LinkAction extends BaseAction<'link'> {
14
+ /**
15
+ * Get the link that the action would link to if the given data was passed.
16
+ */
17
+ href: (data?: unknown) => string;
18
+ }
19
+ export interface LogAction extends BaseAction<'log'> {
20
+ /**
21
+ * The logging level.
22
+ */
23
+ level: 'error' | 'info' | 'warn';
24
+ }
25
+ interface RequestLikeAction<T extends Action['type']> extends BaseAction<T> {
26
+ /**
27
+ * The HTTP method used to make the request.
28
+ */
29
+ method: HTTPMethods;
30
+ /**
31
+ * The URL to which the request will be made.
32
+ */
33
+ url: Remapper;
34
+ }
35
+ export declare type RequestAction = RequestLikeAction<'request'>;
36
+ export declare type ResourceCreateAction = RequestLikeAction<'resource.create'>;
37
+ export declare type ResourceDeleteAction = RequestLikeAction<'resource.delete'>;
38
+ export declare type ResourceGetAction = RequestLikeAction<'resource.get'>;
39
+ export declare type ResourceQueryAction = RequestLikeAction<'resource.query'>;
40
+ export declare type ResourceCountAction = RequestLikeAction<'resource.count'>;
41
+ export declare type ResourceUpdateAction = RequestLikeAction<'resource.update'>;
42
+ /**
43
+ * An action that can be called from within a block.
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;
46
+ export {};
package/dist/action.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * A color known to Bulma.
3
+ */
4
+ export declare type BulmaColor = 'danger' | 'dark' | 'info' | 'link' | 'primary' | 'success' | 'warning' | 'white';
5
+ export declare type BulmaSize = 'large' | 'medium' | 'normal' | 'small';
package/dist/bulma.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bulma.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulma.js","sourceRoot":"","sources":["../src/bulma.ts"],"names":[],"mappings":""}
package/dist/http.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Common HTTP methods, but either all upper case or all lower case.
3
+ */
4
+ export declare type HTTPMethods = 'DELETE' | 'delete' | 'GET' | 'get' | 'PATCH' | 'patch' | 'POST' | 'post' | 'PUT' | 'put';
package/dist/http.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,22 +1,28 @@
1
- import { Action, BaseMessage, HTTPMethods, LogAction, Theme } from '@appsemble/sdk/src/types';
2
1
  import { IconName } from '@fortawesome/fontawesome-common-types';
3
2
  import { Schema } from 'jsonschema';
4
3
  import { OpenAPIV3 } from 'openapi-types';
5
4
  import { JsonObject, RequireExactlyOne } from 'type-fest';
5
+ import { Action, LogAction } from './action';
6
6
  import { AppVisibility, TeamsDefinition } from './app';
7
+ import { BulmaColor } from './bulma';
8
+ import { HTTPMethods } from './http';
9
+ import { Theme } from './theme';
10
+ export * from './action';
7
11
  export * from './app';
8
12
  export * from './appMember';
9
13
  export * from './asset';
10
14
  export * from './authentication';
11
15
  export * from './author';
16
+ export * from './bulma';
17
+ export * from './http';
12
18
  export * from './snapshot';
13
19
  export * from './resource';
14
20
  export * from './saml';
15
21
  export * from './ssl';
16
22
  export * from './team';
17
23
  export * from './template';
24
+ export * from './theme';
18
25
  export * from './user';
19
- export { Theme };
20
26
  /**
21
27
  * A representation of a generated OAuth2 authorization code response.
22
28
  */
@@ -569,8 +575,19 @@ export interface BaseActionDefinition<T extends Action['type']> {
569
575
  /**
570
576
  * A remapper function. This may be used to remap data before it is passed into the action
571
577
  * function.
578
+ *
579
+ * @deprecated Since 0.20.10, use {@link remapBefore} instead.
572
580
  */
573
581
  remap?: Remapper;
582
+ /**
583
+ * A remapper function. This may be used to remap data before it is passed into the action
584
+ * function.
585
+ */
586
+ remapBefore?: Remapper;
587
+ /**
588
+ * The remapper used to transfrom the output before passing it to the next action.
589
+ */
590
+ remapAfter?: Remapper;
574
591
  /**
575
592
  * Another action that is dispatched when the action has been dispatched successfully.
576
593
  */
@@ -890,6 +907,26 @@ export interface StaticActionDefinition extends BaseActionDefinition<'static'> {
890
907
  */
891
908
  value: any;
892
909
  }
910
+ export interface BaseMessage {
911
+ /**
912
+ * The color to use for the message.
913
+ *
914
+ * @default 'info'
915
+ */
916
+ color?: BulmaColor;
917
+ /**
918
+ * The timeout period for this message (in milliseconds).
919
+ *
920
+ * @default 5000
921
+ */
922
+ timeout?: number;
923
+ /**
924
+ * Whether or not to show the dismiss button.
925
+ *
926
+ * @default false
927
+ */
928
+ dismissable?: boolean;
929
+ }
893
930
  export declare type MessageActionDefinition = BaseActionDefinition<'message'> & BaseMessage & {
894
931
  /**
895
932
  * The content of the message to display.
@@ -974,6 +1011,7 @@ export interface BlockManifest {
974
1011
  * If the block has no messages, this property is `null`.
975
1012
  */
976
1013
  languages: string[] | null;
1014
+ examples?: string[];
977
1015
  /**
978
1016
  * Whether the block should be listed publicly
979
1017
  * for users who aren’t part of the block’s organization.
package/dist/index.js CHANGED
@@ -1,13 +1,17 @@
1
+ export * from './action';
1
2
  export * from './app';
2
3
  export * from './appMember';
3
4
  export * from './asset';
4
5
  export * from './authentication';
5
6
  export * from './author';
7
+ export * from './bulma';
8
+ export * from './http';
6
9
  export * from './snapshot';
7
10
  export * from './resource';
8
11
  export * from './saml';
9
12
  export * from './ssl';
10
13
  export * from './team';
11
14
  export * from './template';
15
+ export * from './theme';
12
16
  export * from './user';
13
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,54 @@
1
+ export interface FontDefinition {
2
+ /**
3
+ * Where to load a font from.
4
+ */
5
+ source?: 'custom' | 'google';
6
+ /**
7
+ * The name of the font family.
8
+ *
9
+ * This will be referenced in the Bulma CSS.
10
+ */
11
+ family: string;
12
+ }
13
+ export interface Theme {
14
+ /**
15
+ * The color primarily featured in the color scheme.
16
+ */
17
+ primaryColor: string;
18
+ /**
19
+ * The color used for links.
20
+ */
21
+ linkColor: string;
22
+ /**
23
+ * The color used to feature succesful or positive actions.
24
+ */
25
+ successColor: string;
26
+ /**
27
+ * The color used to indicate information.
28
+ */
29
+ infoColor: string;
30
+ /**
31
+ * The color used for elements that require extra attention.
32
+ */
33
+ warningColor: string;
34
+ /**
35
+ * The color used for elements that demand caution for destructive actions.
36
+ */
37
+ dangerColor: string;
38
+ /**
39
+ * The color used in the foreground of the splash screen.
40
+ */
41
+ themeColor: string;
42
+ /**
43
+ * The color used in the background of the splash screen.
44
+ */
45
+ splashColor: string;
46
+ /**
47
+ * The link to the tile layer used for Leaflet maps.
48
+ */
49
+ tileLayer: string;
50
+ /**
51
+ * The name of a font available on Google fonts.
52
+ */
53
+ font: FontDefinition;
54
+ }
package/dist/theme.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/types",
3
- "version": "0.20.9",
3
+ "version": "0.20.10",
4
4
  "description": "TypeScript definitions reused within Appsemble internally",
5
5
  "keywords": [
6
6
  "app",
@@ -30,7 +30,6 @@
30
30
  "test": "jest"
31
31
  },
32
32
  "dependencies": {
33
- "@appsemble/sdk": "0.20.9",
34
33
  "@fortawesome/fontawesome-common-types": "^6.0.0",
35
34
  "jsonschema": "^1.0.0",
36
35
  "openapi-types": "^12.0.0",