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

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 (66) hide show
  1. package/lib/app-sdk.js +2 -1
  2. package/lib/app-sdk.js.map +4 -4
  3. package/lib/constants.d.ts +0 -1
  4. package/lib/constants.js +3 -0
  5. package/lib/hailer-api.d.ts +4 -20
  6. package/lib/hailer-api.js +147 -0
  7. package/lib/{src/index.d.ts → index.js} +1 -0
  8. package/lib/modules/activity/kanban.js +88 -0
  9. package/lib/modules/activity.d.ts +6 -19
  10. package/lib/modules/activity.js +170 -0
  11. package/lib/modules/app.d.ts +4 -2
  12. package/lib/modules/insight.d.ts +0 -1
  13. package/lib/modules/insight.js +73 -0
  14. package/lib/modules/network.js +74 -0
  15. package/lib/modules/permission.d.ts +2 -1
  16. package/lib/modules/process.js +104 -0
  17. package/lib/modules/public/app.d.ts +2 -2
  18. package/lib/modules/public/form.js +117 -0
  19. package/lib/modules/public/insight.js +114 -0
  20. package/lib/modules/team.d.ts +17 -0
  21. package/lib/modules/ui/activity.js +72 -0
  22. package/lib/modules/ui.js +10 -0
  23. package/lib/modules/user.d.ts +1 -3
  24. package/lib/modules/user.js +133 -0
  25. package/lib/modules/workflow.d.ts +14 -2
  26. package/lib/public-api.d.ts +16 -0
  27. package/lib/public-api.js +13 -0
  28. package/lib/tools/minimal-password-prompt.d.ts +1 -0
  29. package/lib/tools/minimal-password-prompt.js +50 -0
  30. package/lib/tools/publish.cjs +121 -125
  31. package/lib/tools/replace-private.d.ts +1 -0
  32. package/lib/tools/replace-private.js +33 -0
  33. package/lib/types.d.ts +131 -42
  34. package/lib/types.js +28 -0
  35. package/package.json +2 -3
  36. package/lib/modules/product-installed.d.ts +0 -40
  37. package/lib/modules/product-version.d.ts +0 -38
  38. package/lib/modules/public/product-version.d.ts +0 -16
  39. package/lib/modules/public/version.d.ts +0 -16
  40. package/lib/modules/version.d.ts +0 -16
  41. package/lib/src/constants.d.ts +0 -7
  42. package/lib/src/hailer-api.d.ts +0 -92
  43. package/lib/src/modules/activity/kanban.d.ts +0 -36
  44. package/lib/src/modules/activity.d.ts +0 -83
  45. package/lib/src/modules/app.d.ts +0 -12
  46. package/lib/src/modules/insight.d.ts +0 -36
  47. package/lib/src/modules/network.d.ts +0 -14
  48. package/lib/src/modules/permission.d.ts +0 -9
  49. package/lib/src/modules/process.d.ts +0 -38
  50. package/lib/src/modules/product-installed.d.ts +0 -40
  51. package/lib/src/modules/product-version.d.ts +0 -16
  52. package/lib/src/modules/product.d.ts +0 -104
  53. package/lib/src/modules/public/app.d.ts +0 -17
  54. package/lib/src/modules/public/form.d.ts +0 -31
  55. package/lib/src/modules/public/insight.d.ts +0 -30
  56. package/lib/src/modules/public/product-version.d.ts +0 -16
  57. package/lib/src/modules/public/product.d.ts +0 -27
  58. package/lib/src/modules/public.d.ts +0 -22
  59. package/lib/src/modules/ui/activity.d.ts +0 -30
  60. package/lib/src/modules/ui/files.d.ts +0 -18
  61. package/lib/src/modules/ui/snackbar.d.ts +0 -18
  62. package/lib/src/modules/ui.d.ts +0 -17
  63. package/lib/src/modules/user.d.ts +0 -36
  64. package/lib/src/modules/workflow.d.ts +0 -24
  65. package/lib/src/types.d.ts +0 -381
  66. package/lib/version.d.ts +0 -0
package/lib/types.d.ts CHANGED
@@ -2,24 +2,35 @@ export interface User {
2
2
  _id: string;
3
3
  firstname: string;
4
4
  lastname: string;
5
- email: string;
6
- lastSeen: number;
7
- status?: string;
8
- managedUser?: boolean;
9
- removed?: number;
10
- defaultProfilepic: string;
11
5
  }
12
6
  export interface Workspace {
13
7
  _id: string;
14
8
  name: string;
15
9
  }
10
+ export interface ActivityFieldRange {
11
+ start: number;
12
+ end: number;
13
+ }
14
+ export interface ActivityFieldLink {
15
+ _id: string;
16
+ name: string;
17
+ }
18
+ export interface ActivityFieldError {
19
+ error?: string;
20
+ }
21
+ export type ActivityFieldValue = boolean | number | string | (ActivityFieldCountry & ActivityFieldError & ActivityFieldRange & ActivityFieldLink);
22
+ export type ActivityFieldUpdateValue = ActivityFieldValue | null;
23
+ export interface ActivityFieldCountry {
24
+ /** ISO 3166-1 alpha-2 (cca2) */
25
+ code: string;
26
+ }
16
27
  export interface Activity {
17
28
  _id: string;
18
29
  process: string;
19
30
  teamAccount: TeamAccount;
20
31
  created: number;
21
32
  uid: string;
22
- cid: string;
33
+ workspaceId: string;
23
34
  discussion: string;
24
35
  currentPhase: string;
25
36
  active?: boolean;
@@ -35,7 +46,9 @@ export interface Activity {
35
46
  lng: number;
36
47
  }[];
37
48
  };
38
- fields?: any;
49
+ fields?: {
50
+ [fieldId: string]: ActivityFieldValue;
51
+ };
39
52
  files?: any[];
40
53
  updated?: number;
41
54
  updatedBy?: string;
@@ -119,23 +132,30 @@ export interface InsightResponseData {
119
132
  rows: [];
120
133
  time: number;
121
134
  }
122
- export interface HailerAppConfig {
123
- fields?: {
124
- [fieldName: string]: {
125
- type: string;
126
- value?: string | number | boolean;
127
- };
128
- };
135
+ export interface Config {
136
+ [fieldName: string]: string;
137
+ }
138
+ export type WorkflowFieldType = ('activitylink' | 'country' | 'date' | 'daterange' | 'datetime' | 'numeric' | 'numericunit' | 'teams' | 'text' | 'textarea' | 'textunit' | 'textpredefinedoptions' | 'time' | 'timerange' | 'datetimerange' | 'users' | 'linkedfrom' | 'subheader');
139
+ export interface WorkflowField {
140
+ _id: string;
141
+ type: WorkflowFieldType;
142
+ label: string;
143
+ required: boolean;
144
+ unit: string;
145
+ placeholder: string;
146
+ description: string;
147
+ data: string[];
148
+ functionEnabled: boolean;
149
+ editable: boolean;
129
150
  }
130
- export type HailerProcess = Workflow;
131
151
  export interface Workflow {
132
152
  _id: string;
133
- cid: string;
134
153
  name: string;
135
154
  description?: string;
136
155
  fields: {
137
156
  [fieldId: string]: any;
138
157
  };
158
+ fieldsOrder: string[];
139
159
  phases: {
140
160
  [phase_id: string]: WorkflowPhase;
141
161
  };
@@ -144,12 +164,23 @@ export interface Workflow {
144
164
  nameFunctionEnabled?: boolean;
145
165
  nameEditable?: boolean;
146
166
  productInstalledId: string;
167
+ workspaceId: string;
147
168
  }
148
169
  export interface WorkflowPhase {
149
170
  _id: string;
150
171
  name: string;
151
172
  description?: string;
152
173
  fields?: string[];
174
+ primaryDateField?: string;
175
+ primaryNumericField?: string;
176
+ }
177
+ /**
178
+ * ```ts
179
+ * { [templateId: string]: string }
180
+ * ```
181
+ */
182
+ export interface IdsMap {
183
+ [templateId: string]: string;
153
184
  }
154
185
  export type PermissionType = 'admin' | 'own' | 'ownteam' | 'any' | 'edit';
155
186
  export interface Member {
@@ -159,6 +190,41 @@ export interface Member {
159
190
  };
160
191
  permissions: PermissionType[];
161
192
  }
193
+ export type WorkflowPermission = 'admin' | 'any' | 'ownteam' | 'own' | 'guest' | 'none';
194
+ export type WorkflowPhasePermission = 'edit' | 'view' | 'none';
195
+ export interface PermissionPath {
196
+ type: 'network' | 'user' | 'team' | 'group';
197
+ id: string;
198
+ permission: WorkflowPermission | WorkflowPhasePermission;
199
+ }
200
+ export interface WorkflowPermissionMap {
201
+ [workflowId: string]: {
202
+ isAdmin: boolean;
203
+ permission: WorkflowPermission;
204
+ permissions: PermissionPath;
205
+ phases: {
206
+ [phaseId: string]: {
207
+ permission: WorkflowPhasePermission;
208
+ permissions: PermissionPath[];
209
+ restricted: boolean;
210
+ };
211
+ };
212
+ teams: string[];
213
+ };
214
+ }
215
+ export interface WorkspaceRolesPermission {
216
+ isAdmin: boolean;
217
+ isOwner: boolean;
218
+ isGuest: boolean;
219
+ isInviter: boolean;
220
+ isUser: boolean;
221
+ }
222
+ export interface PermissionMap {
223
+ [userId: string]: {
224
+ workflow: WorkflowPermissionMap;
225
+ workspace: WorkspaceRolesPermission;
226
+ };
227
+ }
162
228
  export interface InsightWorkflowSource {
163
229
  name: string;
164
230
  workflowId: string;
@@ -174,24 +240,17 @@ export interface InsightWorkflowSource {
174
240
  export interface InsightDoc {
175
241
  _id: string;
176
242
  name: string;
177
- sources: InsightWorkflowSource[];
178
- cid: string;
179
- /** User id of creator */
180
- uid: string;
181
- members: Member[];
182
- updated: number;
183
- public: boolean;
184
243
  /** Key for accessing Insight when set to public */
185
244
  publicKey?: string;
186
- /** sandboxed javascript with access to all activities in given workflows */
187
- function?: string;
188
- /** To be used with SQLite if we want to.... */
189
- query?: string;
190
245
  presets: {
191
246
  version: 1;
192
247
  name: string | 'default';
193
248
  options: any;
194
249
  }[];
250
+ /** To be used with SQLite if we want to.... */
251
+ query?: string;
252
+ sources: InsightWorkflowSource[];
253
+ public: boolean;
195
254
  }
196
255
  export type InsightPublic = Omit<InsightDoc, '_id'>;
197
256
  export interface InsightData {
@@ -267,6 +326,29 @@ export interface ActivityCreateOptions {
267
326
  phaseId?: string;
268
327
  returnDocument?: boolean;
269
328
  }
329
+ /** Simplistic syntax for add/remove/replace */
330
+ export interface IdSetUpdate {
331
+ /** Clear all existing */
332
+ '*'?: null;
333
+ /** Add: true, Remove: null */
334
+ [id: string]: true | null | undefined;
335
+ }
336
+ export interface ActivityLocation {
337
+ data: {
338
+ lat: number;
339
+ lng: number;
340
+ }[];
341
+ label?: string;
342
+ type: 'area' | 'point' | 'polyline';
343
+ }
344
+ export interface ActivityUpdateOptions {
345
+ fields?: ActivityFieldUpdateValue;
346
+ teamId?: string;
347
+ location?: ActivityLocation;
348
+ phaseId?: string;
349
+ files?: IdSetUpdate;
350
+ followers?: IdSetUpdate;
351
+ }
270
352
  export interface ActivityKanbanListOptions {
271
353
  filter: {
272
354
  user?: {
@@ -288,35 +370,41 @@ export interface ActivityKanbanListOptions {
288
370
  includeUsers?: boolean;
289
371
  includeTeams?: boolean;
290
372
  }
291
- export interface HailerSettings {
373
+ export interface Settings {
292
374
  theme: 'light' | 'dark';
293
375
  preferredLanguages: string[];
294
376
  }
295
- export interface HailerError {
296
- code: number;
297
- msg: string;
298
- debug: object;
299
- }
300
- export interface HailerApiInfo {
377
+ export interface ApiInfo {
301
378
  /** Url of the Hailer instance hosting the API */
302
379
  hostUrl?: string;
303
- config?: HailerAppConfig;
380
+ config?: Config;
304
381
  outside: boolean | null;
305
382
  workspaceId?: string;
306
383
  }
307
- export declare class HailerError extends Error {
384
+ export interface ApiError {
308
385
  code: number;
309
386
  msg: string;
310
387
  debug: object;
388
+ }
389
+ declare class CustomError extends Error {
390
+ msg: string;
391
+ code: number;
392
+ constructor(message: string, code: number);
393
+ }
394
+ export declare class HailerError extends CustomError {
395
+ debug: object;
396
+ details?: any;
311
397
  constructor(error: {
312
398
  code: number;
313
399
  msg: string;
314
- debug: object;
400
+ details?: any;
401
+ debug: any;
315
402
  });
403
+ toString(): string;
316
404
  }
317
- export interface HailerSignal {
318
- sig: string;
319
- meta: any;
405
+ export interface Signal {
406
+ name: string;
407
+ data: any;
320
408
  }
321
409
  export interface Product extends ProductType {
322
410
  _id: string;
@@ -329,7 +417,7 @@ export interface Product extends ProductType {
329
417
  publisher?: string;
330
418
  /** Available or not in app store */
331
419
  public?: boolean;
332
- cid?: string;
420
+ workspaceId?: string;
333
421
  uid: string;
334
422
  }
335
423
  export interface ProductSearchOption {
@@ -360,3 +448,4 @@ export interface Version {
360
448
  packageHash: string;
361
449
  created: number;
362
450
  }
451
+ export {};
package/lib/types.js ADDED
@@ -0,0 +1,28 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var HailerError = /** @class */ (function (_super) {
17
+ __extends(HailerError, _super);
18
+ function HailerError(error) {
19
+ var _this = _super.call(this) || this;
20
+ _this.code = error.code;
21
+ _this.msg = error.msg;
22
+ _this.debug = error.debug;
23
+ Object.setPrototypeOf(_this, HailerError.prototype);
24
+ return _this;
25
+ }
26
+ return HailerError;
27
+ }(Error));
28
+ export { HailerError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hailer/app-sdk",
3
- "version": "1.0.3",
3
+ "version": "2.0.0-beta-2",
4
4
  "description": "SDK for building Hailer Apps",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -19,9 +19,8 @@
19
19
  "docs": "typedoc --entryPointStrategy expand ./src && open-cli ./docs/index.html"
20
20
  },
21
21
  "dependencies": {
22
- "@hailer-oy/hailer-cli": "^1.1.6",
22
+ "@hailer/cli": "1.1.8",
23
23
  "@wishcore/wish-rpc": "0.6.11",
24
- "minimal-password-prompt": "1.1.0",
25
24
  "request": "2.88.2"
26
25
  },
27
26
  "devDependencies": {
@@ -1,40 +0,0 @@
1
- import { Client } from '@wishcore/wish-rpc';
2
- import { ProductInstalled } from '../types';
3
- export declare class ProductInstalledApi {
4
- private client;
5
- constructor(client: Client);
6
- /**
7
- * Lists products from Hailer market
8
- *
9
- * @param cid WorkspaceId
10
- * @param productId productId
11
- *
12
- * @returns List of installed products in Hailer market
13
- *
14
- * @throws {HailerError} if request is incorrect
15
- */
16
- list(productInstalled: {
17
- cid: string;
18
- productId: string;
19
- }): Promise<ProductInstalled[]>;
20
- /**
21
- * Gets installed product from Hailer market
22
- *
23
- * @param id Product Installed Id
24
- *
25
- * @returns Single installed product from Hailer market or undefined if no installed product found
26
- *
27
- * @throws {HailerError} if request is incorrect
28
- */
29
- get(id: string): Promise<ProductInstalled | undefined>;
30
- /**
31
- * Remove installed product from Hailer market
32
- *
33
- * @param id Id of installed product in Hailer market
34
- *
35
- * @returns true, if removed
36
- *
37
- * @throws {HailerError} if request is incorrect
38
- */
39
- remove(id: string): Promise<boolean>;
40
- }
@@ -1,38 +0,0 @@
1
- import { Client } from '@wishcore/wish-rpc';
2
- import { ProductVersion } from '../types';
3
- export declare class ProductVersionApi {
4
- private client;
5
- constructor(client: Client);
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
- /**
17
- * Publish template in Hailer market
18
- *
19
- * @param workspaceId Id of workspace
20
- * @param versionId link to version (empty if first publish)
21
- * @param version Version number
22
- * @param versionDescription Version description
23
- * @param title
24
- * @param description
25
- *
26
- * @returns Created version in Hailer market
27
- *
28
- * @throws {HailerError} if request is incorrect
29
- */
30
- publishTemplate(template: {
31
- workspaceId?: string;
32
- versionId?: string;
33
- version: string;
34
- versionDescription: string;
35
- title: string;
36
- description: string;
37
- }): Promise<ProductVersion>;
38
- }
@@ -1,16 +0,0 @@
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
- }
@@ -1,16 +0,0 @@
1
- import { Options } from '../../hailer-api';
2
- import { Version } from '../../types';
3
- export declare class VersionPublicApi {
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<Version | undefined>;
16
- }
@@ -1,16 +0,0 @@
1
- import { Client } from '@wishcore/wish-rpc';
2
- import { Version } from '../types';
3
- export declare class VersionApi {
4
- private client;
5
- constructor(client: Client);
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<Version | undefined>;
16
- }
@@ -1,7 +0,0 @@
1
- export declare const DEFAULT_API_VERSION = 1;
2
- export declare const DEFAULT_ALLOWED_URLS: string[];
3
- export declare const DEFAULT_BACKEND_URL = "https://api.hailer.com";
4
- /** 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 */
5
- export declare const publicBackendMap: {
6
- [host: string]: string;
7
- };
@@ -1,92 +0,0 @@
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
- import { Ui } from './modules/ui';
6
- import { Process } from './modules/process';
7
- import { HailerPublicApi } from './modules/public';
8
- import { WorkflowApi } from './modules/workflow';
9
- import { AppApi } from './modules/app';
10
- import { InsightApi } from './modules/insight';
11
- import { PermissionApi } from './modules/permission';
12
- import { ProductApi } from './modules/product';
13
- import { ProductVersionApi } from './modules/product-version';
14
- import { ProductInstalledApi } from './modules/product-installed';
15
- export interface Options {
16
- /** When connected is called the host is ready to receive calls */
17
- connected?: () => void;
18
- /** Callback when app is determined to be outside of Hailer, as a standalone app */
19
- outside?: (config?: any) => void;
20
- /** Callback on errors, defaults to printing errors in console */
21
- error?: (error: Error) => void;
22
- /** Callback called on app init and when permissions have changed */
23
- permissions?: () => void;
24
- /** Callback called on app init and when settings have changed */
25
- settings?: (data: HailerSettings) => void;
26
- /** Callback called on app init and when config has changed */
27
- config?: (config: any) => void;
28
- /** Will be called each time a subscribed signal is emitted from Hailer frontend. To subscribe to signals, add them to options.subscribedSignals[] */
29
- signals?: (signal: HailerSignal) => void;
30
- /** Urls the sdk is allowed to connect to. Defaults to all Hailer instances*/
31
- allowedUrls?: string[];
32
- /**
33
- * Optional signal filter, passes all signals by default
34
- *
35
- * Example:
36
- *
37
- * subscribedSignals: ['activity.create', 'activity.update']
38
- */
39
- subscribedSignals?: string[];
40
- /** Api version to be used in the app by default */
41
- apiVersion?: 1;
42
- /** Public backend Api url. Defaults to https://api.hailer.com */
43
- publicBackendUrl?: string;
44
- }
45
- export declare class HailerApi {
46
- options: Options;
47
- user: UserApi;
48
- app: AppApi;
49
- activity: ActivityApi;
50
- insight: InsightApi;
51
- network: WorkspaceApi;
52
- process: Process;
53
- workflow: WorkflowApi;
54
- permission: PermissionApi;
55
- product: ProductApi;
56
- productVersion: ProductVersionApi;
57
- productInstalled: ProductInstalledApi;
58
- /** All public endpoints, which can be accessed while not logged in to Hailer. */
59
- public: HailerPublicApi;
60
- /** User interface commands */
61
- ui: Ui;
62
- /** Url of the Hailer instance hosting the API */
63
- private hostUrl?;
64
- private appId?;
65
- /** If set it indicates that app is locked to a specific workspaceId */
66
- private workspaceId?;
67
- private client;
68
- private apiVersion;
69
- private settings?;
70
- private config?;
71
- private subscribedSignals?;
72
- private timer?;
73
- /**
74
- * Hailer API state
75
- *
76
- * ```
77
- * true // outside hailer
78
- * false // logged into hailer
79
- * null // state not yet detected
80
- * ```
81
- */
82
- private outside;
83
- /**
84
- * Create a Hailer API client for inteacting with Hailer. **NOTE** This only works when inside Hailer.
85
- *
86
- * This should be run after window is initialized for example in ***onMount*** in Svelte or in ***useEffect*** in React
87
- */
88
- constructor(options?: Options);
89
- private createEventListener;
90
- info(): HailerApiInfo;
91
- request(op: string, args: any[]): Promise<any>;
92
- }
@@ -1,36 +0,0 @@
1
- import { Client } from '@wishcore/wish-rpc';
2
- import { ActivityKanbanListOptions, KanbanListResponse, KanbanLoadResponse } from '../../types';
3
- export declare class Kanban {
4
- private client;
5
- constructor(client: Client);
6
- /**
7
- * Lists all activities in a kanban grouped by phases
8
- *
9
- * @param processId the id of the process the kanban relates to
10
- * @param options ActivityKanbanListOptions
11
- *
12
- * @returns activities in kanban list format
13
- *
14
- * @throws {HailerError} if request fails
15
- */
16
- list(processId: string, options?: ActivityKanbanListOptions): Promise<KanbanListResponse>;
17
- /**
18
- * Loads a single activity in kanban format
19
- *
20
- * @param activityId activityId of the wanted activity
21
- *
22
- * @returns activity in kanban format
23
- *
24
- * @throws {HailerError} if request is incorrect
25
- */
26
- load(activityId: string): Promise<KanbanLoadResponse>;
27
- /**
28
- * Updates priority of activities in kanban
29
- *
30
- * @param activityId activityId of the wanted activity
31
- * @param priority new priority for the activity
32
- *
33
- * @throws {HailerError} if request is incorrect
34
- */
35
- updatePriority(activityId: string, priority: number): Promise<void>;
36
- }
@@ -1,83 +0,0 @@
1
- import { Client } from '@wishcore/wish-rpc';
2
- import { ActivityCreateOptions, ActivityListOptions, Activity } from '../types';
3
- import { Kanban } from './activity/kanban';
4
- export declare class ActivityApi {
5
- private client;
6
- kanban: Kanban;
7
- constructor(client: Client);
8
- /**
9
- * Lists all activities from the specified process and phase
10
- *
11
- * @param processId process from current network
12
- * @param phaseId phase in the process specified in processId
13
- * @param options ActivityListOptions
14
- *
15
- * @returns List of Hailer activities from process and phase filtered with supplied options
16
- *
17
- * @throws {HailerError} if request is incorrect
18
- */
19
- list(processId: string, phaseId: string, options?: ActivityListOptions): Promise<Activity[]>;
20
- /**
21
- * Gets single activity
22
- *
23
- * @param activityId activity Id of the process specified in processId
24
- * @param processId Process where the activityId is
25
- * @param phaseId Phase where the activityId is in process specified by processId
26
- * @param options options containing apiVersion
27
- *
28
- * @returns Hailer activity information or undefined if no activity is found
29
- *
30
- * @throws {HailerError} if request is incorrect
31
- */
32
- get(activityId: string): Promise<Activity | undefined>;
33
- /**
34
- * Creates activities
35
- *
36
- * @param processId The process where the activity is created
37
- * @param activities new activities as objects
38
- * @param activities.name name of the activity
39
- * @param activities.fields fields of the activity
40
- * @param options ActivityCreateOptions
41
- *
42
- * @throws {HailerError} if request is incorrect
43
- */
44
- create(processId: string, activities: {
45
- name: string;
46
- fields?: {
47
- [id: string]: string | number;
48
- };
49
- }[], options?: ActivityCreateOptions): Promise<Activity[]>;
50
- /**
51
- * Updates activites
52
- *
53
- * Each activity has the following parameters
54
- * @param activities updated activity objects of an activity to edit
55
- * @param activities.name New name of the activity
56
- * @param activities.fields change values of fields, null removes current value
57
- * @param activities.phaseId New phase of the activity
58
- * @param options
59
- *
60
- * @returns The number of updated activities
61
- *
62
- * @throws {HailerError} if request is incorrect
63
- */
64
- update(activities: {
65
- _id: string;
66
- name?: string;
67
- fields?: {
68
- [id: string]: string | number | null;
69
- };
70
- phaseId?: string;
71
- }[], options: any): Promise<number>;
72
- /**
73
- * Removes activities
74
- *
75
- * @param activities Ids of activities to be removed
76
- * @param options options containing apiVersion
77
- *
78
- * @returns The number of removed activities
79
- *
80
- * @throws {HailerError} if request is incorrect
81
- */
82
- remove(activities: string[]): Promise<number>;
83
- }