@appsemble/types 0.25.2 → 0.27.0

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.25.2/config/assets/logo.svg) Appsemble Types
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.27.0/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.25.2/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.25.2)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.27.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.27.0)
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.25.2/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.0/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
package/action.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type HTTPMethods } from './http.js';
2
- import { type Remapper } from './index.js';
2
+ import { type ActionDefinition, type Remapper } from './index.js';
3
3
  interface BaseAction<T extends string> {
4
4
  /**
5
5
  * A function which can be called to dispatch the action.
@@ -44,4 +44,41 @@ export type ResourcePatchAction = RequestLikeAction<'resource.patch'>;
44
44
  * An action that can be called from within a block.
45
45
  */
46
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.create'> | BaseAction<'user.login'> | BaseAction<'user.logout'> | BaseAction<'user.query'> | BaseAction<'user.register'> | BaseAction<'user.remove'> | BaseAction<'user.update'> | LinkAction | LogAction | RequestAction | ResourceCountAction | ResourceCreateAction | ResourceDeleteAction | ResourceGetAction | ResourcePatchAction | ResourceQueryAction | ResourceUpdateAction;
47
+ interface ActionErrorOptions<D extends ActionDefinition> {
48
+ /**
49
+ * What caused the error to be thrown.
50
+ */
51
+ cause: unknown;
52
+ /**
53
+ * The action input data.
54
+ */
55
+ data: unknown;
56
+ /**
57
+ * The definition of the action that threw the error.
58
+ */
59
+ definition: D;
60
+ /**
61
+ * The HTTP status code of the error, if there is one.
62
+ */
63
+ status?: number;
64
+ }
65
+ /**
66
+ * This error may be thrown by actions.
67
+ */
68
+ export declare class ActionError<D extends ActionDefinition = ActionDefinition> extends Error {
69
+ cause: unknown;
70
+ /**
71
+ * The action input data.
72
+ */
73
+ data: unknown;
74
+ /**
75
+ * The definition of the action that threw the error.
76
+ */
77
+ definition: D;
78
+ /**
79
+ * The HTTP status code of the error, if there is one.
80
+ */
81
+ status?: number;
82
+ constructor(options: ActionErrorOptions<D>);
83
+ }
47
84
  export {};
package/action.js CHANGED
@@ -1,2 +1,30 @@
1
- export {};
1
+ /**
2
+ * This error may be thrown by actions.
3
+ */
4
+ export class ActionError extends Error {
5
+ constructor(options) {
6
+ const { cause, data, definition } = options;
7
+ super(`An error occurred while running ${definition.type}`, { cause });
8
+ this.data = data;
9
+ this.definition = definition;
10
+ if (typeof cause === 'object' && cause != null && 'response' in cause) {
11
+ const { response } = cause;
12
+ if (typeof response === 'object' && response != null && 'status' in response) {
13
+ const responseStatus = response.status;
14
+ if (responseStatus && typeof responseStatus === 'number') {
15
+ this.status = responseStatus;
16
+ }
17
+ }
18
+ }
19
+ // eslint-disable-next-line unicorn/custom-error-definition
20
+ this.name = `ActionError(${definition.type})`;
21
+ this.cause = cause;
22
+ if (cause instanceof Error && cause.stack) {
23
+ this.stack += `\n\n${cause.stack
24
+ .split('\n')
25
+ .map((line) => ` ${line}`)
26
+ .join('\n')}`;
27
+ }
28
+ }
29
+ }
2
30
  //# sourceMappingURL=action.js.map
package/cli.d.ts CHANGED
@@ -46,10 +46,18 @@ export interface AppsembleContext {
46
46
  * If `seed` is specified, this will override `--seed` passed on the command line.
47
47
  */
48
48
  seed?: boolean;
49
+ /**
50
+ * Whether app assets should be clonable.
51
+ */
52
+ assetsClonable?: boolean;
49
53
  /**
50
54
  * Set the value of AppLock for your app.
51
55
  */
52
56
  appLock?: AppLock;
57
+ /**
58
+ * A list of collections the app needs to be added to
59
+ */
60
+ collections?: string[];
53
61
  }
54
62
  export interface AppsembleRC {
55
63
  /**
package/index.d.ts CHANGED
@@ -159,6 +159,10 @@ export interface UserInfo {
159
159
  * The properties of the currently logged in member of the app
160
160
  */
161
161
  appMember?: AppMember;
162
+ /**
163
+ * Returns `true` if the user has no Oauth connections and no password.
164
+ */
165
+ hasNoLoginMethods?: boolean;
162
166
  }
163
167
  /**
164
168
  * The payload stored in our JSON web tokens
@@ -776,7 +780,7 @@ export interface BaseActionDefinition<T extends Action['type']> {
776
780
  */
777
781
  remapBefore?: Remapper;
778
782
  /**
779
- * The remapper used to transfrom the output before passing it to the next action.
783
+ * The remapper used to transform the output before passing it to the next action.
780
784
  */
781
785
  remapAfter?: Remapper;
782
786
  /**
@@ -1493,7 +1497,7 @@ export interface AppDefinition {
1493
1497
  /**
1494
1498
  * The navigation type to use.
1495
1499
  *
1496
- * If this is omitted, a collapsable side navigation menu will be rendered on the left.
1500
+ * If this is omitted, a collapsible side navigation menu will be rendered on the left.
1497
1501
  *
1498
1502
  * @default 'left-menu'
1499
1503
  */
@@ -1684,10 +1688,6 @@ export interface App {
1684
1688
  * Whether the app should be used in demo mode.
1685
1689
  */
1686
1690
  demoMode: boolean;
1687
- /**
1688
- * Whether the app should seed resources and assets in demo mode.
1689
- */
1690
- seed: boolean;
1691
1691
  }
1692
1692
  /**
1693
1693
  * A rating given to an app.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/types",
3
- "version": "0.25.2",
3
+ "version": "0.27.0",
4
4
  "description": "TypeScript definitions reused within Appsemble internally",
5
5
  "keywords": [
6
6
  "app",