@hailer/app-sdk 2.0.0-beta-3 → 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 (45) 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/network.d.ts +14 -0
  5. package/lib/modules/process.d.ts +38 -0
  6. package/lib/modules/product-installed.d.ts +40 -0
  7. package/lib/modules/product-version.d.ts +38 -0
  8. package/lib/modules/product.d.ts +4 -4
  9. package/lib/modules/public/product-version.d.ts +16 -0
  10. package/lib/modules/public/product.d.ts +2 -2
  11. package/lib/modules/public/version.d.ts +16 -0
  12. package/lib/modules/version.d.ts +16 -0
  13. package/lib/modules/workspace.d.ts +4 -2
  14. package/lib/src/constants.d.ts +7 -0
  15. package/lib/src/hailer-api.d.ts +92 -0
  16. package/lib/src/index.d.ts +2 -0
  17. package/lib/src/modules/activity/kanban.d.ts +36 -0
  18. package/lib/src/modules/activity.d.ts +83 -0
  19. package/lib/src/modules/app.d.ts +12 -0
  20. package/lib/src/modules/insight.d.ts +36 -0
  21. package/lib/src/modules/network.d.ts +14 -0
  22. package/lib/src/modules/permission.d.ts +9 -0
  23. package/lib/src/modules/process.d.ts +38 -0
  24. package/lib/src/modules/product-installed.d.ts +40 -0
  25. package/lib/src/modules/product-version.d.ts +16 -0
  26. package/lib/src/modules/product.d.ts +104 -0
  27. package/lib/src/modules/public/app.d.ts +17 -0
  28. package/lib/src/modules/public/form.d.ts +31 -0
  29. package/lib/src/modules/public/insight.d.ts +30 -0
  30. package/lib/src/modules/public/product-version.d.ts +16 -0
  31. package/lib/src/modules/public/product.d.ts +27 -0
  32. package/lib/src/modules/public.d.ts +22 -0
  33. package/lib/src/modules/ui/activity.d.ts +30 -0
  34. package/lib/src/modules/ui/files.d.ts +18 -0
  35. package/lib/src/modules/ui/snackbar.d.ts +18 -0
  36. package/lib/src/modules/ui.d.ts +17 -0
  37. package/lib/src/modules/user.d.ts +36 -0
  38. package/lib/src/modules/workflow.d.ts +24 -0
  39. package/lib/src/types.d.ts +381 -0
  40. package/lib/tools/publish.d.ts +1 -0
  41. package/lib/tools/replace-private.d.ts +1 -0
  42. package/lib/tools/replace-private.js +33 -0
  43. package/lib/types.d.ts +9 -3
  44. package/lib/version.d.ts +0 -0
  45. package/package.json +1 -1
@@ -0,0 +1,381 @@
1
+ export interface User {
2
+ _id: string;
3
+ firstname: string;
4
+ lastname: string;
5
+ email: string;
6
+ lastSeen: number;
7
+ status?: string;
8
+ managedUser?: boolean;
9
+ removed?: number;
10
+ defaultProfilepic: string;
11
+ }
12
+ export interface Workspace {
13
+ _id: string;
14
+ name: string;
15
+ members: string[];
16
+ settings: {
17
+ isolatedTeams?: boolean;
18
+ defaultView: string;
19
+ functionFieldVersion?: 1 | 2;
20
+ color?: string;
21
+ allowPublicCopy?: boolean;
22
+ };
23
+ license: object;
24
+ invoicing?: any;
25
+ propertyFields?: {
26
+ [section: string]: {
27
+ [field: string]: any;
28
+ };
29
+ };
30
+ }
31
+ export interface Activity {
32
+ _id: string;
33
+ process: string;
34
+ teamAccount: TeamAccount;
35
+ created: number;
36
+ uid: string;
37
+ cid: string;
38
+ discussion: string;
39
+ currentPhase: string;
40
+ active?: boolean;
41
+ history?: any[];
42
+ name?: string;
43
+ followers?: string[];
44
+ completePhases?: string[];
45
+ location?: {
46
+ type: 'point' | 'area' | 'polyline';
47
+ label: string | null;
48
+ data: {
49
+ lat: number;
50
+ lng: number;
51
+ }[];
52
+ };
53
+ fields?: any;
54
+ files?: any[];
55
+ updated?: number;
56
+ updatedBy?: string;
57
+ priority?: number;
58
+ sequence?: number;
59
+ }
60
+ export interface TeamAccount {
61
+ account: string;
62
+ team: string;
63
+ }
64
+ export interface FormsData {
65
+ files: string[];
66
+ history: {
67
+ 0: {
68
+ [fieldId: string]: {
69
+ value: any;
70
+ };
71
+ };
72
+ };
73
+ name: string;
74
+ location?: boolean;
75
+ uid?: string;
76
+ }
77
+ export interface FormsResponse {
78
+ name: string;
79
+ description?: string;
80
+ enableUnlinkedMode: boolean;
81
+ enableAttachments: boolean;
82
+ enableMapLocation: boolean;
83
+ locationRequired: 1;
84
+ phases: {
85
+ _id: string;
86
+ followers: [];
87
+ name: string;
88
+ description: string;
89
+ uid: string;
90
+ created: number;
91
+ fields: string[];
92
+ announcementFields: [];
93
+ announcementRecipients: [];
94
+ announcementFieldsOrder: [];
95
+ isEndpoint: boolean;
96
+ }[];
97
+ phasesOrder: string[];
98
+ fields: {
99
+ [id: string]: {
100
+ data: [];
101
+ label: string;
102
+ required: boolean;
103
+ type: string;
104
+ inviteToDiscussionOnChange: boolean;
105
+ _id: string;
106
+ created: number;
107
+ updated: number;
108
+ uid: string;
109
+ functionEnabled: boolean;
110
+ };
111
+ };
112
+ enableMessenger: boolean;
113
+ publicForm: {
114
+ enableMessaging: boolean;
115
+ };
116
+ fieldsOrder: [];
117
+ }
118
+ export interface FormCreateResponse {
119
+ key: string;
120
+ creator: string;
121
+ followers: string;
122
+ active: boolean;
123
+ enableMessaging: boolean;
124
+ allowRead: boolean;
125
+ }
126
+ export interface InsightResponse {
127
+ insight: {
128
+ name: string;
129
+ };
130
+ data: InsightResponseData;
131
+ }
132
+ export interface InsightResponseData {
133
+ headers: string[];
134
+ rows: [];
135
+ time: number;
136
+ }
137
+ export interface HailerAppConfig {
138
+ fields?: {
139
+ [fieldName: string]: {
140
+ type: string;
141
+ value?: string | number | boolean;
142
+ };
143
+ };
144
+ }
145
+ export type HailerProcess = Workflow;
146
+ export interface Workflow {
147
+ _id: string;
148
+ cid: string;
149
+ name: string;
150
+ description?: string;
151
+ fields: {
152
+ [fieldId: string]: any;
153
+ };
154
+ phases: {
155
+ [phase_id: string]: WorkflowPhase;
156
+ };
157
+ phasesOrder: string[];
158
+ enablePredefinedName?: boolean;
159
+ nameFunctionEnabled?: boolean;
160
+ nameEditable?: boolean;
161
+ productInstalledId: string;
162
+ }
163
+ export interface WorkflowPhase {
164
+ _id: string;
165
+ name: string;
166
+ description?: string;
167
+ fields?: string[];
168
+ }
169
+ export type PermissionType = 'admin' | 'own' | 'ownteam' | 'any' | 'edit';
170
+ export interface Member {
171
+ id: string;
172
+ info: {
173
+ [key: string]: string | number | boolean | null;
174
+ };
175
+ permissions: PermissionType[];
176
+ }
177
+ export interface InsightWorkflowSource {
178
+ name: string;
179
+ workflowId: string;
180
+ fields: {
181
+ name: string;
182
+ fieldId?: string;
183
+ /** Used for phaseLastMove meta */
184
+ phaseId?: string;
185
+ /** Activity information, like _id, created, phaseId etc. */
186
+ meta?: string;
187
+ }[];
188
+ }
189
+ export interface InsightDoc {
190
+ _id: string;
191
+ name: string;
192
+ sources: InsightWorkflowSource[];
193
+ cid: string;
194
+ /** User id of creator */
195
+ uid: string;
196
+ members: Member[];
197
+ updated: number;
198
+ public: boolean;
199
+ /** Key for accessing Insight when set to public */
200
+ publicKey?: string;
201
+ /** sandboxed javascript with access to all activities in given workflows */
202
+ function?: string;
203
+ /** To be used with SQLite if we want to.... */
204
+ query?: string;
205
+ presets: {
206
+ version: 1;
207
+ name: string | 'default';
208
+ options: any;
209
+ }[];
210
+ }
211
+ export type InsightPublic = Omit<InsightDoc, '_id'>;
212
+ export interface InsightData {
213
+ headers: string[];
214
+ rows: (string | number | null)[][];
215
+ time: number;
216
+ }
217
+ export interface InsightResponseAsObjectItem {
218
+ [key: string]: any;
219
+ }
220
+ export type InsightResponseAsObjects = InsightResponseAsObjectItem[];
221
+ export interface KanbanListResponse {
222
+ map: {
223
+ [phaseId: string]: {
224
+ activities: {
225
+ _id: string;
226
+ followers: string[];
227
+ name: string;
228
+ fields: {
229
+ [key: string]: any;
230
+ };
231
+ files: string[];
232
+ primaryDateField: number;
233
+ priority: number;
234
+ }[];
235
+ meta: {
236
+ count: number;
237
+ totalPrimaryNumericValue: number;
238
+ primaryNumericFieldUnit: string | null;
239
+ };
240
+ };
241
+ };
242
+ }
243
+ export interface KanbanLoadResponse {
244
+ activity: {
245
+ _id: string;
246
+ followers: string[];
247
+ name: string;
248
+ fields: {
249
+ [key: string]: any;
250
+ };
251
+ files: string[];
252
+ primaryDateField: number | null;
253
+ priority: number;
254
+ linkedFromCount: number;
255
+ };
256
+ process: string;
257
+ phase: string;
258
+ }
259
+ export interface ActivityListOptions {
260
+ sortBy?: 'name' | 'created' | 'updated' | 'following' | 'owner' | 'team' | 'completedOn' | 'priority';
261
+ sortOrder?: 'asc' | 'desc';
262
+ limit?: number;
263
+ skip?: number;
264
+ includeUsers?: boolean;
265
+ includeTeams?: boolean;
266
+ includeHistory?: boolean;
267
+ filters?: any;
268
+ }
269
+ export interface ActivityCreateOptions {
270
+ teamId?: string;
271
+ fileIds?: string[];
272
+ followerIds?: string[];
273
+ location?: {
274
+ label?: string;
275
+ type: 'area' | 'point' | 'polyline';
276
+ data: [{
277
+ lat: number;
278
+ lng: number;
279
+ }];
280
+ };
281
+ discussionId?: string;
282
+ phaseId?: string;
283
+ returnDocument?: boolean;
284
+ }
285
+ export interface ActivityKanbanListOptions {
286
+ filter: {
287
+ user?: {
288
+ uid: string;
289
+ field: string;
290
+ };
291
+ account?: string;
292
+ team?: string;
293
+ dates?: {
294
+ field: string;
295
+ start: number;
296
+ end: number;
297
+ };
298
+ };
299
+ search?: string;
300
+ limit?: number;
301
+ skip?: number;
302
+ phase?: string;
303
+ includeUsers?: boolean;
304
+ includeTeams?: boolean;
305
+ }
306
+ export interface HailerSettings {
307
+ theme: 'light' | 'dark';
308
+ preferredLanguages: string[];
309
+ }
310
+ export interface HailerError {
311
+ code: number;
312
+ msg: string;
313
+ debug: object;
314
+ }
315
+ export interface HailerApiInfo {
316
+ /** Url of the Hailer instance hosting the API */
317
+ hostUrl?: string;
318
+ config?: HailerAppConfig;
319
+ outside: boolean | null;
320
+ workspaceId?: string;
321
+ }
322
+ export declare class HailerError extends Error {
323
+ code: number;
324
+ msg: string;
325
+ debug: object;
326
+ constructor(error: {
327
+ code: number;
328
+ msg: string;
329
+ debug: object;
330
+ });
331
+ }
332
+ export interface HailerSignal {
333
+ sig: string;
334
+ meta: any;
335
+ }
336
+ export interface Product extends ProductType {
337
+ _id: string;
338
+ versionId: string;
339
+ name: string;
340
+ header?: string;
341
+ description?: string;
342
+ icon?: string;
343
+ images?: string[];
344
+ externalUrl?: string;
345
+ publisher?: string;
346
+ /** Available or not in app store */
347
+ public?: boolean;
348
+ cid?: string;
349
+ }
350
+ export interface ProductSearchOption {
351
+ limit?: number;
352
+ skip?: number;
353
+ search?: string;
354
+ reverse?: boolean;
355
+ sortBy?: 'name' | 'created' | 'updated' | 'type';
356
+ sortOrder?: 'asc' | 'desc';
357
+ }
358
+ export interface ProductSearchFilter extends ProductType {
359
+ public?: boolean;
360
+ cid?: string;
361
+ uid?: string;
362
+ }
363
+ export interface ProductType {
364
+ type?: 'app' | 'template' | 'document-template';
365
+ }
366
+ export interface ProductVersion {
367
+ _id: string;
368
+ name: string;
369
+ versions?: {
370
+ version: string;
371
+ description: string;
372
+ packageHash: string;
373
+ }[];
374
+ cid?: string;
375
+ }
376
+ export interface ProductInstalled {
377
+ _id: string;
378
+ productId: string;
379
+ versionId: string;
380
+ version: string;
381
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fs_1 = require("fs");
4
+ const path_1 = require("path");
5
+ const srcFolder = (0, path_1.join)(__dirname, '../src');
6
+ const publicSrcFolder = (0, path_1.join)(__dirname, '../public-src');
7
+ const replacePrivateComments = (fileContent) => {
8
+ // Replaces all occurences of /* @ private */ with private
9
+ return fileContent.replace(/\/\* @private \*\//g, 'private');
10
+ };
11
+ const copyAndReplaceFiles = (src, dest) => {
12
+ (0, fs_1.mkdirSync)(dest, { recursive: true });
13
+ console.log('Created folder: ', dest);
14
+ (0, fs_1.readdirSync)(src).forEach((file) => {
15
+ const srcFile = (0, path_1.join)(src, file);
16
+ const destFile = (0, path_1.join)(dest, file);
17
+ if ((0, fs_1.lstatSync)(srcFile).isDirectory()) {
18
+ copyAndReplaceFiles(srcFile, destFile);
19
+ }
20
+ else if (srcFile.endsWith('.ts')) {
21
+ const updatedContent = replacePrivateComments((0, fs_1.readFileSync)(srcFile, 'utf8'));
22
+ (0, fs_1.writeFileSync)(destFile, updatedContent, 'utf8');
23
+ }
24
+ else {
25
+ (0, fs_1.copyFileSync)(srcFile, destFile);
26
+ }
27
+ });
28
+ };
29
+ if ((0, fs_1.existsSync)(publicSrcFolder)) {
30
+ (0, fs_1.rmdirSync)(publicSrcFolder, { recursive: true });
31
+ }
32
+ copyAndReplaceFiles(srcFolder, publicSrcFolder);
33
+ console.log('Public source files generated in /public-src/');
package/lib/types.d.ts CHANGED
@@ -408,18 +408,24 @@ export interface Signal {
408
408
  }
409
409
  export interface Product extends ProductType {
410
410
  _id: string;
411
- targetId: string;
411
+ targetId?: string;
412
412
  name: string;
413
413
  description?: string;
414
414
  icon?: string;
415
415
  images?: string[];
416
416
  externalUrl?: string;
417
417
  publisher?: string;
418
+ ctaLabel: string;
419
+ ctaLink: string;
418
420
  /** Available or not in app store */
419
421
  public?: boolean;
420
- workspaceId?: string;
422
+ cid?: string;
421
423
  uid: string;
422
424
  }
425
+ export interface ProductListResponse {
426
+ products: Product[];
427
+ totalCount: number;
428
+ }
423
429
  export interface ProductSearchOption {
424
430
  limit?: number;
425
431
  skip?: number;
@@ -434,7 +440,7 @@ export interface ProductSearchFilter extends ProductType {
434
440
  uid?: string;
435
441
  }
436
442
  export interface ProductType {
437
- type?: 'app' | 'template' | 'document-template';
443
+ type?: 'app' | 'template' | 'integration' | 'expert' | 'ai-agent';
438
444
  }
439
445
  export interface ProductVersion {
440
446
  _id: string;
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hailer/app-sdk",
3
- "version": "2.0.0-beta-3",
3
+ "version": "2.0.0-beta-4",
4
4
  "description": "SDK for building Hailer Apps",
5
5
  "author": "",
6
6
  "license": "ISC",