@hailer/app-sdk 2.0.0-beta-2 → 2.0.0-beta-4

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.
Files changed (60) hide show
  1. package/lib/app-sdk.js +2 -2
  2. package/lib/app-sdk.js.map +3 -3
  3. package/lib/modules/app.d.ts +8 -4
  4. package/lib/modules/product-installed.d.ts +40 -0
  5. package/lib/modules/product-version.d.ts +38 -0
  6. package/lib/modules/product.d.ts +4 -4
  7. package/lib/modules/public/product-version.d.ts +16 -0
  8. package/lib/modules/public/product.d.ts +2 -2
  9. package/lib/modules/public/version.d.ts +16 -0
  10. package/lib/modules/version.d.ts +16 -0
  11. package/lib/modules/workspace.d.ts +4 -2
  12. package/lib/src/constants.d.ts +7 -0
  13. package/lib/src/hailer-api.d.ts +92 -0
  14. package/lib/{index.js → src/index.d.ts} +0 -1
  15. package/lib/src/modules/activity/kanban.d.ts +36 -0
  16. package/lib/src/modules/activity.d.ts +83 -0
  17. package/lib/src/modules/app.d.ts +12 -0
  18. package/lib/src/modules/insight.d.ts +36 -0
  19. package/lib/src/modules/network.d.ts +14 -0
  20. package/lib/src/modules/permission.d.ts +9 -0
  21. package/lib/src/modules/process.d.ts +38 -0
  22. package/lib/src/modules/product-installed.d.ts +40 -0
  23. package/lib/src/modules/product-version.d.ts +16 -0
  24. package/lib/src/modules/product.d.ts +104 -0
  25. package/lib/src/modules/public/app.d.ts +17 -0
  26. package/lib/src/modules/public/form.d.ts +31 -0
  27. package/lib/src/modules/public/insight.d.ts +30 -0
  28. package/lib/src/modules/public/product-version.d.ts +16 -0
  29. package/lib/src/modules/public/product.d.ts +27 -0
  30. package/lib/src/modules/public.d.ts +22 -0
  31. package/lib/src/modules/ui/activity.d.ts +30 -0
  32. package/lib/src/modules/ui/files.d.ts +18 -0
  33. package/lib/src/modules/ui/snackbar.d.ts +18 -0
  34. package/lib/src/modules/ui.d.ts +17 -0
  35. package/lib/src/modules/user.d.ts +36 -0
  36. package/lib/src/modules/workflow.d.ts +24 -0
  37. package/lib/src/types.d.ts +381 -0
  38. package/lib/tools/publish.cjs +219 -183
  39. package/lib/tools/publish.cjs.map +7 -0
  40. package/lib/types.d.ts +9 -3
  41. package/lib/version.d.ts +0 -0
  42. package/package.json +2 -2
  43. package/lib/constants.js +0 -3
  44. package/lib/hailer-api.js +0 -147
  45. package/lib/modules/activity/kanban.js +0 -88
  46. package/lib/modules/activity.js +0 -170
  47. package/lib/modules/insight.js +0 -73
  48. package/lib/modules/network.js +0 -74
  49. package/lib/modules/process.js +0 -104
  50. package/lib/modules/public/form.js +0 -117
  51. package/lib/modules/public/insight.js +0 -114
  52. package/lib/modules/team.d.ts +0 -17
  53. package/lib/modules/ui/activity.js +0 -72
  54. package/lib/modules/ui.js +0 -10
  55. package/lib/modules/user.js +0 -133
  56. package/lib/public-api.d.ts +0 -16
  57. package/lib/public-api.js +0 -13
  58. package/lib/tools/minimal-password-prompt.d.ts +0 -1
  59. package/lib/tools/minimal-password-prompt.js +0 -50
  60. package/lib/types.js +0 -28
@@ -0,0 +1,104 @@
1
+ import { Client } from '@wishcore/wish-rpc';
2
+ import { Product, ProductSearchOption, ProductSearchFilter } from '../types';
3
+ export declare class ProductApi {
4
+ private client;
5
+ constructor(client: Client);
6
+ /**
7
+ * Lists products from Hailer market
8
+ *
9
+ * @param filter ProductSearchFilter
10
+ * @param options ProductSearchOption
11
+ *
12
+ * @returns List of products in Hailer market filtered with supplied options
13
+ *
14
+ * @throws {HailerError} if request is incorrect
15
+ */
16
+ list(filter?: ProductSearchFilter, options?: ProductSearchOption): Promise<Product[]>;
17
+ /**
18
+ * Gets single product from Hailer market
19
+ *
20
+ * @param id Product Id
21
+ *
22
+ * @returns Single product from Hailer market or undefined if no product found
23
+ *
24
+ * @throws {HailerError} if request is incorrect
25
+ */
26
+ get(id: string): Promise<Product | undefined>;
27
+ /**
28
+ * Creates product in Hailer market
29
+ *
30
+ * @param versionId link to version
31
+ * @param name Name of the product
32
+ * @param header Header of the product
33
+ * @param description Description what this product is doing
34
+ * @param icon Icon id for the product
35
+ * @param images List of fileIds for showing pictures of the product
36
+ * @param externalUrl Public URL for creator to show more information about the product
37
+ * @param publisher Publisher (author)
38
+ * @param type App, template, music etc.
39
+ *
40
+ * @returns Created product in Hailer market
41
+ *
42
+ * @throws {HailerError} if request is incorrect
43
+ */
44
+ create(product: {
45
+ versionId: string;
46
+ name: string;
47
+ header?: string;
48
+ description?: string;
49
+ icon?: string;
50
+ images?: string[];
51
+ externalUrl?: string;
52
+ publisher?: string;
53
+ type?: string;
54
+ }): Promise<Product>;
55
+ /**
56
+ * Updates product in Hailer market
57
+ *
58
+ * @param id Id of product in Hailer market
59
+ * @param name Name of the product
60
+ * @param header Header of the product
61
+ * @param description Description what this product is doing
62
+ * @param icon Icon id for the product
63
+ * @param images List of fileIds for showing pictures of the product
64
+ * @param externalUrl Public URL for creator to show more information about the product
65
+ * @param publisher Publisher (Author)
66
+ * @param public: Visible or not in Hailer market
67
+ * @param type App, template, music etc.
68
+ *
69
+ * @returns Updated product in Hailer market
70
+ *
71
+ * @throws {HailerError} if request is incorrect
72
+ */
73
+ update(id: string, product: {
74
+ name?: string;
75
+ header?: string;
76
+ description?: string;
77
+ icon?: string;
78
+ images?: string[];
79
+ externalUrl?: string;
80
+ publisher?: string;
81
+ public?: string;
82
+ type?: string;
83
+ }): Promise<Product>;
84
+ /**
85
+ * Remove product from Hailer market
86
+ *
87
+ * @param id Id of product in Hailer market
88
+ *
89
+ * @returns true, if removed
90
+ *
91
+ * @throws {HailerError} if request is incorrect
92
+ */
93
+ remove(id: string): Promise<boolean>;
94
+ /**
95
+ * Install something from Hailer market
96
+ *
97
+ * @param id Id of product in Hailer market
98
+ *
99
+ * @returns true, if installed else error
100
+ *
101
+ * @throws {HailerError} if request is incorrect
102
+ */
103
+ install(id: string): Promise<boolean>;
104
+ }
@@ -0,0 +1,17 @@
1
+ import { Options } from '../../hailer-api';
2
+ import { HailerAppConfig } from '../../types';
3
+ export declare class App {
4
+ private options;
5
+ constructor(options: Options);
6
+ /**
7
+ * Read data from app API
8
+ *
9
+ * @param appId key of a specific insight
10
+ *
11
+ * @returns App manifest
12
+ *
13
+ * @throws {HailerError} if there is something wrong with the request or insight cannot be found
14
+ * @throws {TypeError} if Hailer cannot be reached
15
+ */
16
+ config(): Promise<HailerAppConfig>;
17
+ }
@@ -0,0 +1,31 @@
1
+ import { Options } from '../../hailer-api';
2
+ import { FormCreateResponse, FormsData, FormsResponse } from '../../types';
3
+ export declare class Form {
4
+ private options;
5
+ constructor(options: Options);
6
+ /**
7
+ * Read data from forms
8
+ *
9
+ * @param formsKey key of a form
10
+ * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms
11
+ *
12
+ * @returns forms data as object or null if form could not be found
13
+ *
14
+ * @throws {HailerError} if there is something wrong with the request or form cannot be found
15
+ * @throws {TypeError} if Hailer cannot be reached
16
+ */
17
+ data(formsKey: string): Promise<FormsResponse>;
18
+ /**
19
+ * Submits form to specified process
20
+ *
21
+ * @param formsKey key of a form
22
+ * @param formsData Data to be sent to form endpoint
23
+ * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms
24
+ *
25
+ * @returns form creation data or null if form could not be created
26
+ *
27
+ * @throws {HailerError} if there is something wrong with the request or form cannot be found
28
+ * @throws {TypeError} if Hailer cannot be reached
29
+ */
30
+ submit(formsKey: string, formsData: FormsData): Promise<FormCreateResponse>;
31
+ }
@@ -0,0 +1,30 @@
1
+ import { Options } from '../../hailer-api';
2
+ import { InsightResponse, InsightResponseAsObjects } from '../../types';
3
+ export declare class InsightPublicApi {
4
+ private options;
5
+ constructor(options: Options);
6
+ /**
7
+ * Read data from insight API
8
+ *
9
+ * @param insightKey key of a specific insight
10
+ * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public
11
+ *
12
+ * @returns Insight data as object
13
+ *
14
+ * @throws {HailerError} if there is something wrong with the request or insight cannot be found
15
+ * @throws {TypeError} if Hailer cannot be reached
16
+ */
17
+ data(insightKey: string): Promise<InsightResponse>;
18
+ /**
19
+ * Read data from insight API and return in an array of JavaScript objects
20
+ *
21
+ * @param insightKey key of a specific insight
22
+ * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public
23
+ *
24
+ * @returns Insight data as array of JavaScript objects
25
+ *
26
+ * @throws {HailerError} if there is something wrong with the request or insight cannot be found
27
+ * @throws {TypeError} if Hailer cannot be reached
28
+ */
29
+ dataAsObject(insightKey: string): Promise<InsightResponseAsObjects>;
30
+ }
@@ -0,0 +1,16 @@
1
+ import { Options } from '../../hailer-api';
2
+ import { ProductVersion } from '../../types';
3
+ export declare class ProductVersionPublicApi {
4
+ private options;
5
+ constructor(options: Options);
6
+ /**
7
+ * Gets single version from Hailer market
8
+ *
9
+ * @param id Version Id
10
+ *
11
+ * @returns Single version from Hailer market or undefined if no version found
12
+ *
13
+ * @throws {HailerError} if request is incorrect
14
+ */
15
+ get(id: string): Promise<ProductVersion | undefined>;
16
+ }
@@ -0,0 +1,27 @@
1
+ import { Options } from '../../hailer-api';
2
+ import { Product, ProductSearchFilter, ProductSearchOption } from '../../types';
3
+ export declare class ProductPublicApi {
4
+ private options;
5
+ constructor(options: Options);
6
+ /**
7
+ * Lists products from Hailer market
8
+ *
9
+ * @param filter ProductSearchFilter
10
+ * @param options ProductSearchOption
11
+ *
12
+ * @returns List of products in Hailer market filtered with supplied options
13
+ *
14
+ * @throws {HailerError} if request is incorrect
15
+ */
16
+ list(filter?: ProductSearchFilter, options?: ProductSearchOption): Promise<Product[]>;
17
+ /**
18
+ * Gets single product from Hailer market
19
+ *
20
+ * @param id Product Id
21
+ *
22
+ * @returns Single product from Hailer market or undefined if no product found
23
+ *
24
+ * @throws {HailerError} if request is incorrect
25
+ */
26
+ get(id: string): Promise<Product | undefined>;
27
+ }
@@ -0,0 +1,22 @@
1
+ import { Options } from '../hailer-api';
2
+ import { App } from './public/app';
3
+ import { Form } from './public/form';
4
+ import { InsightPublicApi } from './public/insight';
5
+ import { ProductPublicApi } from './public/product';
6
+ import { ProductVersionPublicApi } from './public/product-version';
7
+ /**
8
+ * This class is used to access Hailer public API even when the app is outside of Hailer
9
+ */
10
+ export declare class HailerPublicApi {
11
+ /** Allows accessing public insight methods. Used for reading data from Hailer even when app is outside of Hailer */
12
+ insight: InsightPublicApi;
13
+ /** Allows accessing public forms methods. Used for sending data to Hailer even when app is outside of Hailer */
14
+ form: Form;
15
+ /** Access public App information */
16
+ app: App;
17
+ /** Access public Product information */
18
+ product: ProductPublicApi;
19
+ /** Access public Version information */
20
+ productVersion: ProductVersionPublicApi;
21
+ constructor(options: Options);
22
+ }
@@ -0,0 +1,30 @@
1
+ import { Client } from '@wishcore/wish-rpc';
2
+ export type ActivityTabTypes = 'detail' | 'discussion' | 'files' | 'location' | 'linkedFrom' | 'options';
3
+ export declare class Activity {
4
+ private client;
5
+ constructor(client: Client);
6
+ /** Opens an activity in Hailer sidebar */
7
+ open(
8
+ /** Hailer Activity Id */
9
+ activityId: string, options?: {
10
+ /** Which tab to open in activity aside */
11
+ tab?: ActivityTabTypes;
12
+ }): Promise<void>;
13
+ /** Opens activity creation view in Hailer sidebar */
14
+ create(processId: string, options?: {
15
+ /** Activity name/title */
16
+ name?: string;
17
+ /** Prepopulate fields */
18
+ fields?: {
19
+ [fieldId: string]: number | string | {
20
+ start: number;
21
+ end: number;
22
+ };
23
+ };
24
+ }): Promise<{
25
+ _id: string;
26
+ name: string;
27
+ } | null>;
28
+ /** Opens multiple activity edit view in Hailer sidebar */
29
+ editMultiple(activityIds: string[]): Promise<any>;
30
+ }
@@ -0,0 +1,18 @@
1
+ import { Client } from '@wishcore/wish-rpc';
2
+ export declare class Files {
3
+ private client;
4
+ constructor(client: Client);
5
+ /**
6
+ * Uploads a file to Hailer
7
+ *
8
+ * @param file file to be uploaded
9
+ * @param publicFile is the file accessible outside of Hailer
10
+ * @param options if file is public
11
+ *
12
+ * @returns File ID in Hailer as string
13
+ */
14
+ uploadFile(file: File, filename: string, options: {
15
+ isPublic?: boolean;
16
+ }): Promise<string>;
17
+ private toBase64;
18
+ }
@@ -0,0 +1,18 @@
1
+ import { Client } from '@wishcore/wish-rpc';
2
+ export declare class Snackbar {
3
+ private client;
4
+ constructor(client: Client);
5
+ /**
6
+ * Opens a snackbar in Hailer
7
+ * @param text the text displayed on the snackbar
8
+ * @param buttonLabel the label for the button on the snackbar, for example 'OK'
9
+ * @param duration the time the snackbar is visible in ms
10
+ */
11
+ open(
12
+ /** The text displayed on the snackbar */
13
+ text: string,
14
+ /** The label for the button on the snackbar, for example 'OK' */
15
+ buttonLabel: string,
16
+ /** The time the snackbar is visible in ms */
17
+ duration?: number): Promise<void>;
18
+ }
@@ -0,0 +1,17 @@
1
+ import { Client } from '@wishcore/wish-rpc';
2
+ import { Activity } from './ui/activity';
3
+ import { Snackbar } from './ui/snackbar';
4
+ import { Files } from './ui/files';
5
+ export declare class Ui {
6
+ private client;
7
+ activity: Activity;
8
+ snackbar: Snackbar;
9
+ files: Files;
10
+ insight: {
11
+ create: (workspaceId?: string) => Promise<void>;
12
+ edit: (insightId: string) => Promise<void>;
13
+ delete: (insightId: string) => Promise<void>;
14
+ permission: (insightId: string) => Promise<void>;
15
+ };
16
+ constructor(client: Client);
17
+ }
@@ -0,0 +1,36 @@
1
+ import { Client } from '@wishcore/wish-rpc';
2
+ import { User } from '../types';
3
+ export declare class UserApi {
4
+ private client;
5
+ constructor(client: Client);
6
+ /**
7
+ * Returns the specified user
8
+ *
9
+ * @param userId id of the Hailer user
10
+ *
11
+ * @returns Hailer user information
12
+ *
13
+ * @throws {HailerError} if request is incorrect
14
+ */
15
+ get(userId: string): Promise<User>;
16
+ /**
17
+ * Returns the current user
18
+ *
19
+ *
20
+ * @returns the current Hailer user information
21
+ *
22
+ * @throws {HailerError} if request is incorrect
23
+ */
24
+ current(): Promise<User>;
25
+ /**
26
+ * Lists all Hailer users from a workspace
27
+ *
28
+ *
29
+ * @returns list of Hailer users in the workspace the app user is currently in
30
+ *
31
+ * @throws {HailerError} if request is incorrect
32
+ */
33
+ list(): Promise<{
34
+ [key: string]: User;
35
+ }>;
36
+ }
@@ -0,0 +1,24 @@
1
+ import { Client } from '@wishcore/wish-rpc';
2
+ import { Workflow } from '../types';
3
+ export declare class WorkflowApi {
4
+ private client;
5
+ constructor(client: Client);
6
+ /**
7
+ * Lists all processes from a workspace
8
+ *
9
+ * @returns all Hailer processes in the workspace the app user is currently in
10
+ *
11
+ * @throws {HailerError} if request is incorrect
12
+ */
13
+ list(): Promise<Workflow[]>;
14
+ /**
15
+ * Gets a single process from a workspace
16
+ *
17
+ * @param processId the id of the process in question
18
+ *
19
+ * @returns the specified Hailer process
20
+ *
21
+ * @throws {HailerError} if request is incorrect
22
+ */
23
+ get(processId: string): Promise<Workflow>;
24
+ }