@hailer/app-sdk 1.0.0 → 1.0.1-beta

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/lib/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Changing this will be a breaking change
2
2
  export const DEFAULT_API_VERSION = 1;
3
- export const DEFAULT_ALLOWED_URLS = ['https://app.hailer.com', 'https://next.hailer.com', 'https://testapp.hailer.biz', 'https://app.hailer.biz'];
3
+ export const DEFAULT_ALLOWED_URLS = ['https://app.hailer.com', 'https://next.hailer.com', 'https://testapp.hailer.biz', 'https://app.hailer.biz', 'https://localhost:9443'];
4
4
  export const DEFAULT_BACKEND_URL = 'https://api.hailer.com';
5
5
  /** Map of which backend to use depending on which frontend is hosting the app frame, be sure to fall back to production backend if no match */
6
6
  export const publicBackendMap = {
@@ -1,12 +1,13 @@
1
- import { User } from './modules/user';
2
- import { Activity } from './modules/activity';
3
- import { Network } from './modules/network';
4
- import { ApiVersion, HailerApiInfo, HailerSettings, HailerSignal } from './types';
1
+ import { UserApi } from './modules/user';
2
+ import { ActivityApi } from './modules/activity';
3
+ import { WorkspaceApi } from './modules/network';
4
+ import { HailerApiInfo, HailerSettings, HailerSignal } from './types';
5
5
  import { Ui } from './modules/ui';
6
- import { Insight } from './modules/insight';
7
6
  import { Process } from './modules/process';
8
- import { HailerApiPublic } from './modules/public';
9
- import { Workflow } from './modules/workflow';
7
+ import { HailerPublicApi } from './modules/public';
8
+ import { WorkflowApi } from './modules/workflow';
9
+ import { AppApi } from './modules/app';
10
+ import { InsightApi } from './modules/insight';
10
11
  export interface Options {
11
12
  /** When connected is called the host is ready to receive calls */
12
13
  connected?: () => void;
@@ -27,20 +28,21 @@ export interface Options {
27
28
  /** The signals we want the Hailer frontend to pass to the app. If an empty array is provided, all signals will be passed. */
28
29
  subscribedSignals?: string[];
29
30
  /** Api version to be used in the app by default */
30
- apiVersion?: ApiVersion;
31
+ apiVersion?: 1;
31
32
  /** Public backend Api url. Defaults to https://api.hailer.com */
32
33
  publicBackendUrl?: string;
33
34
  }
34
35
  export declare class HailerApi {
35
36
  options: Options;
36
- user: User;
37
- activity: Activity;
38
- insight: Insight;
39
- network: Network;
37
+ user: UserApi;
38
+ app: AppApi;
39
+ activity: ActivityApi;
40
+ insight: InsightApi;
41
+ network: WorkspaceApi;
40
42
  process: Process;
41
- workflow: Workflow;
43
+ workflow: WorkflowApi;
42
44
  /** All public endpoints, which can be accessed while not logged in to Hailer. */
43
- public: HailerApiPublic;
45
+ public: HailerPublicApi;
44
46
  /** User interface commands */
45
47
  ui: Ui;
46
48
  /** Url of the Hailer instance hosting the API */
package/lib/hailer-api.js CHANGED
@@ -8,15 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { Client } from '@wishcore/wish-rpc';
11
- import { User } from './modules/user';
12
- import { Activity } from './modules/activity';
13
- import { Network } from './modules/network';
11
+ import { UserApi } from './modules/user';
12
+ import { ActivityApi } from './modules/activity';
13
+ import { WorkspaceApi } from './modules/network';
14
14
  import { Ui } from './modules/ui';
15
- import { Insight } from './modules/insight';
16
15
  import { Process } from './modules/process';
17
16
  import { DEFAULT_ALLOWED_URLS, DEFAULT_API_VERSION, DEFAULT_BACKEND_URL, publicBackendMap } from './constants';
18
- import { HailerApiPublic } from './modules/public';
19
- import { Workflow } from './modules/workflow';
17
+ import { HailerPublicApi } from './modules/public';
18
+ import { WorkflowApi } from './modules/workflow';
19
+ import { AppApi } from './modules/app';
20
+ import { InsightApi } from './modules/insight';
20
21
  export class HailerApi {
21
22
  /**
22
23
  * Create a Hailer API client for inteacting with Hailer. **NOTE** This only works when inside Hailer.
@@ -44,13 +45,14 @@ export class HailerApi {
44
45
  parent.postMessage(JSON.stringify(msg), this.hostUrl);
45
46
  }
46
47
  });
47
- this.user = new User(this.client);
48
- this.activity = new Activity(this.client);
49
- this.insight = new Insight(this.client);
50
- this.network = new Network(this.client);
48
+ this.user = new UserApi(this.client);
49
+ this.app = new AppApi(this.client);
50
+ this.activity = new ActivityApi(this.client);
51
+ this.insight = new InsightApi(this.client);
52
+ this.network = new WorkspaceApi(this.client);
51
53
  this.process = new Process(this.client);
52
- this.workflow = new Workflow(this.client);
53
- this.public = new HailerApiPublic(this.options);
54
+ this.workflow = new WorkflowApi(this.client);
55
+ this.public = new HailerPublicApi(this.options);
54
56
  this.ui = new Ui(this.client);
55
57
  const registerMessage = JSON.stringify({ op: 'register', args: [] });
56
58
  // If we are not in Iframe set location to outside, else wait 100ms for response to register to check if we are in Hailer
@@ -7,7 +7,7 @@ export declare class Kanban {
7
7
  * Lists all activities in a kanban grouped by phases
8
8
  *
9
9
  * @param processId the id of the process the kanban relates to
10
- * @param options object containing apiVersion option and requestOptions to be passed to the backend endpoint
10
+ * @param options ActivityKanbanListOptions
11
11
  *
12
12
  * @returns activities in kanban list format
13
13
  *
@@ -18,7 +18,6 @@ export declare class Kanban {
18
18
  * Loads a single activity in kanban format
19
19
  *
20
20
  * @param activityId activityId of the wanted activity
21
- * @param options object containing apiVersion option
22
21
  *
23
22
  * @returns activity in kanban format
24
23
  *
@@ -30,7 +29,6 @@ export declare class Kanban {
30
29
  *
31
30
  * @param activityId activityId of the wanted activity
32
31
  * @param priority new priority for the activity
33
- * @param options object containing apiVersion option
34
32
  *
35
33
  * @throws {HailerError} if request is incorrect
36
34
  */
@@ -16,7 +16,7 @@ export class Kanban {
16
16
  * Lists all activities in a kanban grouped by phases
17
17
  *
18
18
  * @param processId the id of the process the kanban relates to
19
- * @param options object containing apiVersion option and requestOptions to be passed to the backend endpoint
19
+ * @param options ActivityKanbanListOptions
20
20
  *
21
21
  * @returns activities in kanban list format
22
22
  *
@@ -37,7 +37,6 @@ export class Kanban {
37
37
  * Loads a single activity in kanban format
38
38
  *
39
39
  * @param activityId activityId of the wanted activity
40
- * @param options object containing apiVersion option
41
40
  *
42
41
  * @returns activity in kanban format
43
42
  *
@@ -59,7 +58,6 @@ export class Kanban {
59
58
  *
60
59
  * @param activityId activityId of the wanted activity
61
60
  * @param priority new priority for the activity
62
- * @param options object containing apiVersion option
63
61
  *
64
62
  * @throws {HailerError} if request is incorrect
65
63
  */
@@ -1,7 +1,7 @@
1
1
  import { Client } from '@wishcore/wish-rpc';
2
- import { ActivityCreateOptions, ActivityListOptions, HailerActivity } from '../types';
2
+ import { ActivityCreateOptions, ActivityListOptions, Activity } from '../types';
3
3
  import { Kanban } from './activity/kanban';
4
- export declare class Activity {
4
+ export declare class ActivityApi {
5
5
  private client;
6
6
  kanban: Kanban;
7
7
  constructor(client: Client);
@@ -10,13 +10,13 @@ export declare class Activity {
10
10
  *
11
11
  * @param processId process from current network
12
12
  * @param phaseId phase in the process specified in processId
13
- * @param options options with apiVersion and requestOptions, default values can be found in api.hailer.com/docs v3.activity.list
13
+ * @param options ActivityListOptions
14
14
  *
15
15
  * @returns List of Hailer activities from process and phase filtered with supplied options
16
16
  *
17
17
  * @throws {HailerError} if request is incorrect
18
18
  */
19
- list(processId: string, phaseId: string, options?: ActivityListOptions): Promise<HailerActivity[]>;
19
+ list(processId: string, phaseId: string, options?: ActivityListOptions): Promise<Activity[]>;
20
20
  /**
21
21
  * Gets single activity
22
22
  *
@@ -29,7 +29,7 @@ export declare class Activity {
29
29
  *
30
30
  * @throws {HailerError} if request is incorrect
31
31
  */
32
- get(activityId: string): Promise<HailerActivity | undefined>;
32
+ get(activityId: string): Promise<Activity | undefined>;
33
33
  /**
34
34
  * Creates activities
35
35
  *
@@ -37,7 +37,7 @@ export declare class Activity {
37
37
  * @param activities new activities as objects
38
38
  * @param activities.name name of the activity
39
39
  * @param activities.fields fields of the activity
40
- * @param options optional options with apiVersion and requestOptions to be passed to the backend endpoint
40
+ * @param options ActivityCreateOptions
41
41
  *
42
42
  * @throws {HailerError} if request is incorrect
43
43
  */
@@ -46,7 +46,7 @@ export declare class Activity {
46
46
  fields: {
47
47
  [id: string]: string | number;
48
48
  };
49
- }[], options?: ActivityCreateOptions): Promise<HailerActivity[]>;
49
+ }[], options?: ActivityCreateOptions): Promise<Activity[]>;
50
50
  /**
51
51
  * Updates activites
52
52
  *
@@ -55,7 +55,7 @@ export declare class Activity {
55
55
  * @param activities.name New name of the activity
56
56
  * @param activities.fields change values of fields, null removes current value
57
57
  * @param activities.phaseId New phase of the activity
58
- * @param options options containing apiVersion
58
+ * @param options
59
59
  *
60
60
  * @returns The number of updated activities
61
61
  *
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { HailerError } from '../types';
11
11
  import { Kanban } from './activity/kanban';
12
- export class Activity {
12
+ export class ActivityApi {
13
13
  constructor(client) {
14
14
  this.client = client;
15
15
  this.kanban = new Kanban(client);
@@ -19,7 +19,7 @@ export class Activity {
19
19
  *
20
20
  * @param processId process from current network
21
21
  * @param phaseId phase in the process specified in processId
22
- * @param options options with apiVersion and requestOptions, default values can be found in api.hailer.com/docs v3.activity.list
22
+ * @param options ActivityListOptions
23
23
  *
24
24
  * @returns List of Hailer activities from process and phase filtered with supplied options
25
25
  *
@@ -66,7 +66,7 @@ export class Activity {
66
66
  * @param activities new activities as objects
67
67
  * @param activities.name name of the activity
68
68
  * @param activities.fields fields of the activity
69
- * @param options optional options with apiVersion and requestOptions to be passed to the backend endpoint
69
+ * @param options ActivityCreateOptions
70
70
  *
71
71
  * @throws {HailerError} if request is incorrect
72
72
  */
@@ -89,7 +89,7 @@ export class Activity {
89
89
  * @param activities.name New name of the activity
90
90
  * @param activities.fields change values of fields, null removes current value
91
91
  * @param activities.phaseId New phase of the activity
92
- * @param options options containing apiVersion
92
+ * @param options
93
93
  *
94
94
  * @returns The number of updated activities
95
95
  *
@@ -0,0 +1,12 @@
1
+ import { Client } from '@wishcore/wish-rpc';
2
+ import { HailerAppConfig } from '../types';
3
+ /**
4
+ * This class is used to access Hailer public API even when the app is outside of Hailer
5
+ */
6
+ export declare class AppApi {
7
+ private client;
8
+ constructor(client: Client);
9
+ config: {
10
+ update: (appId: string, config: HailerAppConfig) => Promise<void>;
11
+ };
12
+ }
@@ -0,0 +1,29 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { HailerError } from '../types';
11
+ /**
12
+ * This class is used to access Hailer public API even when the app is outside of Hailer
13
+ */
14
+ export class AppApi {
15
+ constructor(client) {
16
+ this.client = client;
17
+ this.config = {
18
+ update: (appId, config) => __awaiter(this, void 0, void 0, function* () {
19
+ try {
20
+ return yield this.client.requestAsync('v1.app.config.update', [appId, config]);
21
+ }
22
+ catch (error) {
23
+ console.log('Errorasd ', error);
24
+ throw new HailerError(error);
25
+ }
26
+ })
27
+ };
28
+ }
29
+ }
@@ -1,13 +1,12 @@
1
1
  import { Client } from '@wishcore/wish-rpc';
2
2
  import { InsightData, InsightDoc } from '../types';
3
- export declare class Insight {
3
+ export declare class InsightApi {
4
4
  private client;
5
5
  constructor(client: Client);
6
6
  /**
7
7
  * Get Insight data
8
8
  *
9
9
  * @param insightId the id of the Insight the data is fetched from
10
- * @param options object containing apiVersion option
11
10
  *
12
11
  * @returns data from the Insight
13
12
  *
@@ -17,7 +16,6 @@ export declare class Insight {
17
16
  /**
18
17
  * Get Insight data
19
18
  *
20
- * @param options object containing apiVersion option
21
19
  *
22
20
  * @returns data from the Insight
23
21
  *
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { HailerError } from '../types';
11
- export class Insight {
11
+ export class InsightApi {
12
12
  constructor(client) {
13
13
  this.client = client;
14
14
  }
@@ -16,7 +16,6 @@ export class Insight {
16
16
  * Get Insight data
17
17
  *
18
18
  * @param insightId the id of the Insight the data is fetched from
19
- * @param options object containing apiVersion option
20
19
  *
21
20
  * @returns data from the Insight
22
21
  *
@@ -35,7 +34,6 @@ export class Insight {
35
34
  /**
36
35
  * Get Insight data
37
36
  *
38
- * @param options object containing apiVersion option
39
37
  *
40
38
  * @returns data from the Insight
41
39
  *
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@wishcore/wish-rpc';
2
- import { HailerWorkspace } from '../types';
3
- export declare class Network {
2
+ import { Workspace } from '../types';
3
+ export declare class WorkspaceApi {
4
4
  private client;
5
5
  constructor(client: Client);
6
6
  /**
@@ -10,5 +10,5 @@ export declare class Network {
10
10
  *
11
11
  * @throws {HailerError} if request is incorrect
12
12
  */
13
- current(): Promise<HailerWorkspace>;
13
+ current(): Promise<Workspace>;
14
14
  }
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { HailerError } from '../types';
11
- export class Network {
11
+ export class WorkspaceApi {
12
12
  constructor(client) {
13
13
  this.client = client;
14
14
  }
@@ -18,7 +18,6 @@ export declare class Process {
18
18
  * Gets a single process from a workspace
19
19
  *
20
20
  * @param processId the id of the process in question
21
- * @param options object containing apiVersion option
22
21
  *
23
22
  * @returns the specified Hailer process
24
23
  *
@@ -30,7 +29,6 @@ export declare class Process {
30
29
  *
31
30
  * @param processId the id of the process in question
32
31
  * @param fieldName name of the field
33
- * @param options object containing apiVersion option
34
32
  *
35
33
  * @returns the field id as string
36
34
  *
@@ -35,7 +35,6 @@ export class Process {
35
35
  * Gets a single process from a workspace
36
36
  *
37
37
  * @param processId the id of the process in question
38
- * @param options object containing apiVersion option
39
38
  *
40
39
  * @returns the specified Hailer process
41
40
  *
@@ -57,7 +56,6 @@ export class Process {
57
56
  *
58
57
  * @param processId the id of the process in question
59
58
  * @param fieldName name of the field
60
- * @param options object containing apiVersion option
61
59
  *
62
60
  * @returns the field id as string
63
61
  *
@@ -1,6 +1,6 @@
1
1
  import { Options } from '../../hailer-api';
2
2
  import { InsightResponse, InsightResponseAsObjects } from '../../types';
3
- export declare class Insight {
3
+ export declare class InsightPublicApi {
4
4
  private options;
5
5
  constructor(options: Options);
6
6
  /**
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { HailerError } from '../../types';
11
- export class Insight {
11
+ export class InsightPublicApi {
12
12
  constructor(options) {
13
13
  this.options = options;
14
14
  }
@@ -1,13 +1,13 @@
1
1
  import { Options } from '../hailer-api';
2
2
  import { App } from './public/app';
3
3
  import { Form } from './public/form';
4
- import { Insight } from './public/insight';
4
+ import { InsightPublicApi } from './public/insight';
5
5
  /**
6
6
  * This class is used to access Hailer public API even when the app is outside of Hailer
7
7
  */
8
- export declare class HailerApiPublic {
8
+ export declare class HailerPublicApi {
9
9
  /** Allows accessing public insight methods. Used for reading data from Hailer even when app is outside of Hailer */
10
- insight: Insight;
10
+ insight: InsightPublicApi;
11
11
  /** Allows accessing public forms methods. Used for sending data to Hailer even when app is outside of Hailer */
12
12
  form: Form;
13
13
  /** Access public App information */
@@ -1,12 +1,12 @@
1
1
  import { App } from './public/app';
2
2
  import { Form } from './public/form';
3
- import { Insight } from './public/insight';
3
+ import { InsightPublicApi } from './public/insight';
4
4
  /**
5
5
  * This class is used to access Hailer public API even when the app is outside of Hailer
6
6
  */
7
- export class HailerApiPublic {
7
+ export class HailerPublicApi {
8
8
  constructor(options) {
9
- this.insight = new Insight(options);
9
+ this.insight = new InsightPublicApi(options);
10
10
  this.form = new Form(options);
11
11
  this.app = new App(options);
12
12
  }
@@ -21,5 +21,8 @@ export declare class Activity {
21
21
  end: number;
22
22
  };
23
23
  };
24
- }): Promise<void>;
24
+ }): Promise<{
25
+ _id: string;
26
+ name: string;
27
+ } | null>;
25
28
  }
@@ -7,7 +7,6 @@ export declare class Snackbar {
7
7
  * @param text the text displayed on the snackbar
8
8
  * @param buttonLabel the label for the button on the snackbar, for example 'OK'
9
9
  * @param duration the time the snackbar is visible in ms
10
- * @param options object containing apiVersion option
11
10
  */
12
11
  open(
13
12
  /** The text displayed on the snackbar */
@@ -16,7 +16,6 @@ export class Snackbar {
16
16
  * @param text the text displayed on the snackbar
17
17
  * @param buttonLabel the label for the button on the snackbar, for example 'OK'
18
18
  * @param duration the time the snackbar is visible in ms
19
- * @param options object containing apiVersion option
20
19
  */
21
20
  open(
22
21
  /** The text displayed on the snackbar */
@@ -1,39 +1,36 @@
1
1
  import { Client } from '@wishcore/wish-rpc';
2
- import { HailerUser } from '../types';
3
- export declare class User {
2
+ import { User } from '../types';
3
+ export declare class UserApi {
4
4
  private client;
5
5
  constructor(client: Client);
6
6
  /**
7
7
  * Returns the specified user
8
8
  *
9
9
  * @param userId id of the Hailer user
10
- * @param options object containing apiVersion option
11
10
  *
12
11
  * @returns Hailer user information
13
12
  *
14
13
  * @throws {HailerError} if request is incorrect
15
14
  */
16
- get(userId: string): Promise<HailerUser>;
15
+ get(userId: string): Promise<User>;
17
16
  /**
18
17
  * Returns the current user
19
18
  *
20
- * @param options object containing apiVersion option
21
19
  *
22
20
  * @returns the current Hailer user information
23
21
  *
24
22
  * @throws {HailerError} if request is incorrect
25
23
  */
26
- current(): Promise<HailerUser>;
24
+ current(): Promise<User>;
27
25
  /**
28
26
  * Lists all Hailer users from a workspace
29
27
  *
30
- * @param options object containing apiVersion option
31
28
  *
32
29
  * @returns list of Hailer users in the workspace the app user is currently in
33
30
  *
34
31
  * @throws {HailerError} if request is incorrect
35
32
  */
36
33
  list(): Promise<{
37
- [key: string]: HailerUser;
34
+ [key: string]: User;
38
35
  }>;
39
36
  }
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { HailerError } from '../types';
11
- export class User {
11
+ export class UserApi {
12
12
  constructor(client) {
13
13
  this.client = client;
14
14
  }
@@ -16,7 +16,6 @@ export class User {
16
16
  * Returns the specified user
17
17
  *
18
18
  * @param userId id of the Hailer user
19
- * @param options object containing apiVersion option
20
19
  *
21
20
  * @returns Hailer user information
22
21
  *
@@ -36,7 +35,6 @@ export class User {
36
35
  /**
37
36
  * Returns the current user
38
37
  *
39
- * @param options object containing apiVersion option
40
38
  *
41
39
  * @returns the current Hailer user information
42
40
  *
@@ -56,7 +54,6 @@ export class User {
56
54
  /**
57
55
  * Lists all Hailer users from a workspace
58
56
  *
59
- * @param options object containing apiVersion option
60
57
  *
61
58
  * @returns list of Hailer users in the workspace the app user is currently in
62
59
  *
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@wishcore/wish-rpc';
2
- import { HailerProcess } from '../types';
3
- export declare class Workflow {
2
+ import { Workflow } from '../types';
3
+ export declare class WorkflowApi {
4
4
  private client;
5
5
  constructor(client: Client);
6
6
  /**
@@ -10,16 +10,15 @@ export declare class Workflow {
10
10
  *
11
11
  * @throws {HailerError} if request is incorrect
12
12
  */
13
- list(): Promise<HailerProcess[]>;
13
+ list(): Promise<Workflow[]>;
14
14
  /**
15
15
  * Gets a single process from a workspace
16
16
  *
17
17
  * @param processId the id of the process in question
18
- * @param options object containing apiVersion option
19
18
  *
20
19
  * @returns the specified Hailer process
21
20
  *
22
21
  * @throws {HailerError} if request is incorrect
23
22
  */
24
- get(processId: string): Promise<HailerProcess>;
23
+ get(processId: string): Promise<Workflow>;
25
24
  }
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { HailerError } from '../types';
11
- export class Workflow {
11
+ export class WorkflowApi {
12
12
  constructor(client) {
13
13
  this.client = client;
14
14
  }
@@ -34,7 +34,6 @@ export class Workflow {
34
34
  * Gets a single process from a workspace
35
35
  *
36
36
  * @param processId the id of the process in question
37
- * @param options object containing apiVersion option
38
37
  *
39
38
  * @returns the specified Hailer process
40
39
  *
package/lib/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export interface HailerUser {
1
+ export interface User {
2
2
  firstname: string;
3
3
  lastname: string;
4
4
  email: string;
@@ -7,7 +7,7 @@ export interface HailerUser {
7
7
  managedUser?: boolean;
8
8
  removed?: number;
9
9
  }
10
- export interface HailerWorkspace {
10
+ export interface Workspace {
11
11
  _id: string;
12
12
  name: string;
13
13
  members: string[];
@@ -26,7 +26,7 @@ export interface HailerWorkspace {
26
26
  };
27
27
  };
28
28
  }
29
- export interface HailerActivity {
29
+ export interface Activity {
30
30
  _id: string;
31
31
  process: string;
32
32
  teamAccount: TeamAccount;
@@ -59,13 +59,6 @@ export interface TeamAccount {
59
59
  account: string;
60
60
  team: string;
61
61
  }
62
- export interface Link {
63
- id: string;
64
- linkId: string;
65
- type: LinkType;
66
- created: string;
67
- }
68
- export type LinkType = 'user-mention' | 'reaction' | 'tag' | 'apple-id' | 'feed.lastseen' | 'google-folder-id';
69
62
  export interface FormsData {
70
63
  files: string[];
71
64
  history: {
@@ -147,7 +140,8 @@ export interface HailerAppConfig {
147
140
  };
148
141
  };
149
142
  }
150
- export interface HailerProcess {
143
+ export type HailerProcess = Workflow;
144
+ export interface Workflow {
151
145
  _id: string;
152
146
  cid: string;
153
147
  name: string;
@@ -156,16 +150,17 @@ export interface HailerProcess {
156
150
  [fieldId: string]: any;
157
151
  };
158
152
  phases: {
159
- [phase_id: string]: HailerPhase;
153
+ [phase_id: string]: WorkflowPhase;
160
154
  };
155
+ phasesOrder: string[];
161
156
  }
162
- export interface HailerPhase {
157
+ export interface WorkflowPhase {
163
158
  _id: string;
164
159
  name: string;
165
160
  description?: string;
166
161
  }
167
162
  export type PermissionType = 'admin' | 'own' | 'ownteam' | 'any' | 'edit';
168
- export interface MemberDoc {
163
+ export interface Member {
169
164
  id: string;
170
165
  info: {
171
166
  [key: string]: string | number | boolean | null;
@@ -190,7 +185,7 @@ export interface InsightDoc {
190
185
  cid: string;
191
186
  /** User id of creator */
192
187
  uid: string;
193
- members: MemberDoc[];
188
+ members: Member[];
194
189
  updated: number;
195
190
  public: boolean;
196
191
  /** Key for accessing Insight when set to public */
@@ -294,7 +289,6 @@ export interface ActivityKanbanListOptions {
294
289
  includeUsers?: boolean;
295
290
  includeTeams?: boolean;
296
291
  }
297
- export type ApiVersion = 1;
298
292
  export interface HailerSettings {
299
293
  theme: 'light' | 'dark';
300
294
  preferredLanguages: string[];
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@hailer/app-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-beta",
4
4
  "description": "SDK for building Hailer Apps",
5
5
  "author": "",
6
6
  "license": "ISC",
7
7
  "main": "./lib/index.js",
8
+ "type": "module",
8
9
  "types": "./lib/index.d.ts",
9
10
  "files": [
10
11
  "./lib/**/*"