@hailer/app-sdk 2.0.0-beta-5 → 2.0.0-beta-7

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 (46) hide show
  1. package/lib/app-sdk.js +2 -2
  2. package/lib/app-sdk.js.map +4 -4
  3. package/lib/modules/app.d.ts +8 -4
  4. package/lib/modules/insight.d.ts +0 -8
  5. package/lib/modules/product.d.ts +4 -4
  6. package/lib/modules/public/product.d.ts +2 -2
  7. package/lib/modules/ui/dialog.d.ts +13 -0
  8. package/lib/modules/ui/workflow.d.ts +13 -0
  9. package/lib/modules/ui.d.ts +2 -0
  10. package/lib/modules/workspace.d.ts +4 -2
  11. package/lib/tools/publish.cjs +218 -186
  12. package/lib/types.d.ts +12 -3
  13. package/package.json +3 -4
  14. package/lib/modules/network.d.ts +0 -14
  15. package/lib/modules/public/version.d.ts +0 -16
  16. package/lib/modules/version.d.ts +0 -16
  17. package/lib/src/constants.d.ts +0 -7
  18. package/lib/src/hailer-api.d.ts +0 -92
  19. package/lib/src/index.d.ts +0 -2
  20. package/lib/src/modules/activity/kanban.d.ts +0 -36
  21. package/lib/src/modules/activity.d.ts +0 -83
  22. package/lib/src/modules/app.d.ts +0 -12
  23. package/lib/src/modules/insight.d.ts +0 -36
  24. package/lib/src/modules/network.d.ts +0 -14
  25. package/lib/src/modules/permission.d.ts +0 -9
  26. package/lib/src/modules/process.d.ts +0 -38
  27. package/lib/src/modules/product-installed.d.ts +0 -40
  28. package/lib/src/modules/product-version.d.ts +0 -16
  29. package/lib/src/modules/product.d.ts +0 -104
  30. package/lib/src/modules/public/app.d.ts +0 -17
  31. package/lib/src/modules/public/form.d.ts +0 -31
  32. package/lib/src/modules/public/insight.d.ts +0 -30
  33. package/lib/src/modules/public/product-version.d.ts +0 -16
  34. package/lib/src/modules/public/product.d.ts +0 -27
  35. package/lib/src/modules/public.d.ts +0 -22
  36. package/lib/src/modules/ui/activity.d.ts +0 -30
  37. package/lib/src/modules/ui/files.d.ts +0 -18
  38. package/lib/src/modules/ui/snackbar.d.ts +0 -18
  39. package/lib/src/modules/ui.d.ts +0 -17
  40. package/lib/src/modules/user.d.ts +0 -36
  41. package/lib/src/modules/workflow.d.ts +0 -24
  42. package/lib/src/types.d.ts +0 -381
  43. package/lib/tools/publish.d.ts +0 -1
  44. package/lib/tools/replace-private.d.ts +0 -1
  45. package/lib/tools/replace-private.js +0 -33
  46. package/lib/version.d.ts +0 -0
@@ -7,11 +7,11 @@ export declare class AppApi {
7
7
  private client;
8
8
  product: {
9
9
  /** Check if product is installed */
10
- isProductInstalled(id: string): Promise<boolean>;
10
+ isProductInstalled(productId: string, workspaceId: string): Promise<boolean>;
11
11
  /** Get version */
12
12
  get(id: string): Promise<ProductVersion | undefined>;
13
13
  /** Install app from Hailer market */
14
- install(id: string): Promise<boolean>;
14
+ install(productId: string, workspaceId: string): Promise<boolean>;
15
15
  /** Get installed version */
16
16
  getInstalledVersion(id: string): Promise<Version>;
17
17
  /** Get manifest content from Hailer market */
@@ -26,7 +26,9 @@ export declare class AppApi {
26
26
  /**
27
27
  * Check if product is installed
28
28
  *
29
- * @param id Id of product in Hailer market
29
+ * @param productId Id of product in Hailer market
30
+ *
31
+ * @param workspaceId Id of workspace
30
32
  *
31
33
  * @returns true if ok else false
32
34
  *
@@ -46,7 +48,9 @@ export declare class AppApi {
46
48
  /**
47
49
  * Install app from Hailer market
48
50
  *
49
- * @param id Id of product in Hailer market
51
+ * @param productId Id of product in Hailer market
52
+ *
53
+ * @param workspaceId Id of workspace where the product will be installed
50
54
  *
51
55
  * @returns true, if installed else error
52
56
  *
@@ -32,12 +32,4 @@ export declare class InsightApi {
32
32
  * @throws {HailerError} if request is incorrect
33
33
  */
34
34
  update(insightId: string, update: Partial<InsightDoc>): Promise<InsightDoc[]>;
35
- /**
36
- * Copy Insight data
37
- *
38
- * @returns data from the Insight
39
- *
40
- * @throws {HailerError} if request is incorrect
41
- */
42
- copy(insightId: string, update: Partial<InsightDoc>): Promise<InsightDoc[]>;
43
35
  }
@@ -1,5 +1,5 @@
1
1
  import { Client } from '@wishcore/wish-rpc';
2
- import { Product, ProductSearchOption, ProductSearchFilter } from '../types';
2
+ import { Product, ProductSearchOption, ProductSearchFilter, ProductListResponse } from '../types';
3
3
  export declare class ProductApi {
4
4
  private client;
5
5
  constructor(client: Client);
@@ -13,7 +13,7 @@ export declare class ProductApi {
13
13
  *
14
14
  * @throws {HailerError} if request is incorrect
15
15
  */
16
- list(filter?: ProductSearchFilter, options?: ProductSearchOption): Promise<Product[]>;
16
+ list(filter?: ProductSearchFilter, options?: ProductSearchOption): Promise<ProductListResponse>;
17
17
  /**
18
18
  * Gets single product from Hailer market
19
19
  *
@@ -27,7 +27,7 @@ export declare class ProductApi {
27
27
  /**
28
28
  * Creates product in Hailer market
29
29
  *
30
- * @param versionId link to version
30
+ * @param targetId link to targetId (version)
31
31
  * @param name Name of the product
32
32
  * @param description Description what this product is doing
33
33
  * @param icon Icon id for the product
@@ -41,7 +41,7 @@ export declare class ProductApi {
41
41
  * @throws {HailerError} if request is incorrect
42
42
  */
43
43
  create(product: {
44
- versionId: string;
44
+ targetId?: string;
45
45
  name: string;
46
46
  description?: string;
47
47
  icon?: string;
@@ -1,5 +1,5 @@
1
1
  import { Options } from '../../hailer-api';
2
- import { Product, ProductSearchFilter, ProductSearchOption } from '../../types';
2
+ import { Product, ProductListResponse, ProductSearchFilter, ProductSearchOption } from '../../types';
3
3
  export declare class ProductPublicApi {
4
4
  private options;
5
5
  constructor(options: Options);
@@ -13,7 +13,7 @@ export declare class ProductPublicApi {
13
13
  *
14
14
  * @throws {HailerError} if request is incorrect
15
15
  */
16
- list(filter?: ProductSearchFilter, options?: ProductSearchOption): Promise<Product[]>;
16
+ list(filter?: ProductSearchFilter, options?: ProductSearchOption): Promise<ProductListResponse>;
17
17
  /**
18
18
  * Gets single product from Hailer market
19
19
  *
@@ -0,0 +1,13 @@
1
+ import { Client } from '@wishcore/wish-rpc';
2
+ export declare class Workflow {
3
+ private client;
4
+ constructor(client: Client);
5
+ function: {
6
+ /**
7
+ * Opens the function editor dialog for a specific field
8
+ * @param fieldId The ID of the field to edit
9
+ * @param options Additional options including workflowId and activityId
10
+ */
11
+ edit: (workflowId: string, fieldId: string) => Promise<void>;
12
+ };
13
+ }
@@ -0,0 +1,13 @@
1
+ import { Client } from '@wishcore/wish-rpc';
2
+ export declare class Workflow {
3
+ private client;
4
+ constructor(client: Client);
5
+ function: {
6
+ /**
7
+ * Opens the function editor dialog for a specific field
8
+ * @param fieldId The ID of the field to edit
9
+ * @param options Additional options including workflowId and activityId
10
+ */
11
+ edit: (workflowId: string, fieldId: string) => Promise<void>;
12
+ };
13
+ }
@@ -2,6 +2,7 @@ import { Client } from '@wishcore/wish-rpc';
2
2
  import { Activity } from './ui/activity';
3
3
  import { Snackbar } from './ui/snackbar';
4
4
  import { Files } from './ui/files';
5
+ import { Workflow } from './ui/workflow';
5
6
  export declare class Ui {
6
7
  private client;
7
8
  activity: Activity;
@@ -13,5 +14,6 @@ export declare class Ui {
13
14
  delete: (insightId: string) => Promise<void>;
14
15
  permission: (insightId: string) => Promise<void>;
15
16
  };
17
+ workflow: Workflow;
16
18
  constructor(client: Client);
17
19
  }
@@ -17,7 +17,7 @@ export declare class WorkspaceApi {
17
17
  /** Get version */
18
18
  get(id: string): Promise<ProductVersion | undefined>;
19
19
  /** Install template from Hailer market */
20
- install(id: string): Promise<boolean>;
20
+ install(productId: string, workspaceId: string): Promise<boolean>;
21
21
  /** Get manifest content from Hailer market */
22
22
  getManifest(id: string): Promise<any>;
23
23
  };
@@ -76,7 +76,9 @@ export declare class WorkspaceApi {
76
76
  /**
77
77
  * Install template from Hailer market
78
78
  *
79
- * @param id Id of product in Hailer market
79
+ * @param productId Id of product in Hailer market
80
+ *
81
+ * @param workspaceId Id of workspace where the product will be installed
80
82
  *
81
83
  * @returns true, if installed else error
82
84
  *
@@ -1,201 +1,233 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
24
15
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+
25
+ // tools/publish.ts
26
+ var import_cli = require("@hailer/cli");
27
+ var request = __toESM(require("request"));
28
+ var import_fs = require("fs");
29
+
30
+ // tools/minimal-password-prompt.ts
31
+ var stdin = process.stdin;
32
+ var stdout = process.stdout;
33
+ var captureStdin = (onData) => {
34
+ stdin.setEncoding("utf-8");
35
+ stdin.setRawMode(true);
36
+ stdin.on("data", onData);
37
+ stdin.resume();
27
38
  };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const hailer_cli_1 = require("@hailer-oy/hailer-cli");
30
- const request = __importStar(require("request"));
31
- const fs_1 = require("fs");
32
- const minimal_password_prompt_1 = __importDefault(require("minimal-password-prompt"));
33
- const util_1 = require("util");
34
- const readline_1 = require("readline");
39
+ var releaseStdin = (onData) => {
40
+ stdin.pause();
41
+ stdin.removeListener("data", onData);
42
+ stdin.setRawMode(false);
43
+ stdout.write("\n");
44
+ };
45
+ var prompt = (question, ctrlcExits = true) => new Promise((resolve, reject) => {
46
+ let input = "";
47
+ const onData = (data) => {
48
+ switch (data) {
49
+ case "\n":
50
+ case "\r":
51
+ case "":
52
+ releaseStdin(onData);
53
+ resolve(input);
54
+ break;
55
+ case "":
56
+ releaseStdin(onData);
57
+ if (ctrlcExits) {
58
+ process.exit();
59
+ } else {
60
+ reject(new Error("Ctrl+C"));
61
+ }
62
+ break;
63
+ case "\b":
64
+ case "\x7F":
65
+ input = input.slice(0, -1);
66
+ break;
67
+ default:
68
+ input += data;
69
+ }
70
+ ;
71
+ };
72
+ captureStdin(onData);
73
+ stdout.write(question);
74
+ });
75
+
76
+ // tools/publish.ts
77
+ var import_util = require("util");
78
+ var import_readline = require("readline");
35
79
  if (!process.env.EMAIL && !process.env.LOCAL) {
36
- console.log('Please set environment variable EMAIL to Hailer user name.');
37
- console.log('');
38
- console.log('Usage:');
39
- console.log(' EMAIL=user.name@mail.com npm run publish-production');
40
- process.exit(10);
80
+ console.log("Please set environment variable EMAIL to Hailer user name.");
81
+ console.log("");
82
+ console.log("Usage:");
83
+ console.log(" EMAIL=user.name@mail.com npm run publish-production");
84
+ process.exit(10);
41
85
  }
42
86
  (async () => {
43
- let email = process.env.EMAIL;
44
- let password = process.env.LOCAL || await (0, minimal_password_prompt_1.default)('enter password for ' + email + ': ');
45
- // Market code
46
- const market = process.env.MARKET === 'true';
47
- const appPackageFile = process.argv[2];
48
- /** Alternatives: `--development` | `--staging` | `--production` */
49
- const mode = process.argv[3];
50
- let host = 'https://localhost:9443';
51
- switch (mode) {
52
- case '--development':
53
- host = 'https://testapi.hailer.biz';
54
- break;
55
- case '--staging':
56
- host = 'https://api.hailer.biz';
57
- break;
58
- case '--production':
59
- host = 'https://api.hailer.com';
60
- break;
87
+ let email = process.env.EMAIL;
88
+ let password = process.env.LOCAL || await prompt("enter password for " + email + ": ");
89
+ const market = process.env.MARKET === "true";
90
+ const appPackageFile = process.argv[2];
91
+ const mode = process.argv[3];
92
+ let host = process.env.HOST || "https://localhost:9443";
93
+ switch (mode) {
94
+ case "--development":
95
+ host = process.env.HOST || "https://testapi.hailer.biz";
96
+ break;
97
+ case "--staging":
98
+ host = process.env.HOST || "https://api.hailer.biz";
99
+ break;
100
+ case "--production":
101
+ host = process.env.HOST || "https://api.hailer.com";
102
+ break;
103
+ }
104
+ if (process.env.LOCAL || mode === "--local") {
105
+ console.log("Overriding credentials with local settings!");
106
+ email = "el@hailero.es";
107
+ password = "el@hailero.es";
108
+ host = process.env.HOST || "https://api.hailer.local.gd";
109
+ }
110
+ const cli = await import_cli.Client.create({ host, username: email, password }).catch(
111
+ (error) => {
112
+ if (error.msg === "Invalid Login Data") {
113
+ console.log("Invalid username or password when logging into Hailer.");
114
+ } else {
115
+ console.log("Hailer Cli Error:", error);
116
+ }
117
+ process.exit(8);
118
+ }
119
+ );
120
+ if (!appPackageFile?.endsWith(".tgz")) {
121
+ console.log("Failed getting .tgz file, found:", appPackageFile);
122
+ process.exit(7);
123
+ }
124
+ const manifest = JSON.parse((0, import_fs.readFileSync)("./dist/manifest.json").toString());
125
+ const content = (0, import_fs.readFileSync)(appPackageFile);
126
+ const info = await cli.request("v2.core.init", [["network", "networks", "apps"]]);
127
+ if (market) {
128
+ if (!manifest.version) {
129
+ manifest.version = "";
130
+ manifest.versionDescription = "";
131
+ const updatedManifestContent = JSON.stringify(manifest, null, 2);
132
+ (0, import_fs.writeFileSync)("./public/manifest.json", updatedManifestContent, "utf-8");
133
+ console.log("");
134
+ console.log("Please set version & versionDescription in file public/manifest.json! You have added MARKET=true in your publish string.");
135
+ console.log("");
136
+ process.exit(10);
61
137
  }
62
- if (process.env.LOCAL || mode === '--local') {
63
- console.log('Overriding credentials with local settings!');
64
- email = 'el@hailero.es';
65
- password = 'thispasswordshouldbestrongenough';
66
- host = 'http://localhost:1337';
138
+ }
139
+ const getAppById = (manifestAppId) => {
140
+ for (const appMap of Object.values(info.apps)) {
141
+ for (const [appId, app2] of Object.entries(appMap)) {
142
+ if (appId === manifestAppId) {
143
+ return app2;
144
+ }
145
+ }
67
146
  }
68
- const cli = new hailer_cli_1.Cli(host, email, password);
69
- if (!appPackageFile?.endsWith('.tgz')) {
70
- console.log('Failed getting .tgz file, found:', appPackageFile);
71
- process.exit(7);
147
+ return null;
148
+ };
149
+ const app = getAppById(manifest.appId);
150
+ if (!app) {
151
+ console.log("The app was not found using this user:", email);
152
+ process.exit(2);
153
+ }
154
+ const personalApp = !app.cid;
155
+ console.log("Publishing App");
156
+ console.log(" Id:", manifest.appId);
157
+ console.log(" Name:", app.name);
158
+ if (personalApp) {
159
+ console.log(" Workspace: any (personal app)");
160
+ } else {
161
+ console.log(" Workspace:", info.networks[app.cid]?.name, "(" + app.cid + ")");
162
+ }
163
+ console.log(" Environment:", host);
164
+ console.log();
165
+ if (market) {
166
+ console.log(" Note: Also publishing app to Hailer market");
167
+ }
168
+ const promptOverwriteQuestion = async () => {
169
+ if (process.argv.includes("--yes")) {
170
+ return true;
72
171
  }
73
- cli.on('error', (error) => {
74
- if (error.msg === 'Invalid Login Data') {
75
- console.log('Invalid username or password when logging into Hailer.');
76
- process.exit(8);
172
+ return new Promise((resolve) => {
173
+ const rl = (0, import_readline.createInterface)(process.stdin, process.stdout);
174
+ rl.setPrompt("Overwrite the app? (Y/n): ");
175
+ rl.prompt();
176
+ rl.on("line", (line) => {
177
+ if (line.trim().toLocaleLowerCase().startsWith("n")) {
178
+ resolve(false);
179
+ } else {
180
+ resolve(true);
77
181
  }
78
- console.log('Hailer Cli Error:', error);
182
+ rl.close();
183
+ });
79
184
  });
80
- cli.on('ready', async () => {
81
- const manifest = JSON.parse((0, fs_1.readFileSync)('./dist/manifest.json').toString());
82
- const content = (0, fs_1.readFileSync)(appPackageFile);
83
- const info = await cli.request('v2.core.init', [['network', 'networks', 'apps']], undefined);
185
+ };
186
+ const shouldOverwrite = await promptOverwriteQuestion();
187
+ if (!shouldOverwrite) {
188
+ console.log("Aborted publishing app.");
189
+ process.exit(0);
190
+ }
191
+ await new Promise((resolve, reject) => {
192
+ request.post({
193
+ uri: host + "/app/publish",
194
+ headers: { hlrkey: cli.sessionKey },
195
+ formData: {
196
+ file: {
197
+ value: content,
198
+ options: {
199
+ filename: appPackageFile
200
+ }
201
+ },
202
+ appId: manifest.appId,
84
203
  // Market code
85
- if (market) {
86
- // Check if version exist in manifest.json. If not, add empty version and let user fill it in
87
- if (!manifest.version) {
88
- manifest.version = '';
89
- manifest.versionDescription = '';
90
- // Convert the modified object back to JSON
91
- const updatedManifestContent = JSON.stringify(manifest, null, 2);
92
- // Write the updated JSON content back to manifest.json
93
- (0, fs_1.writeFileSync)('./public/manifest.json', updatedManifestContent, 'utf-8');
94
- console.log('');
95
- console.log('Please set version & versionDescription in file public/manifest.json! You have added MARKET=true in your publish string.');
96
- console.log('');
97
- process.exit(10);
98
- }
99
- }
100
- const getAppById = (manifestAppId) => {
101
- for (const appMap of Object.values(info.apps)) {
102
- for (const [appId, app] of Object.entries(appMap)) {
103
- if (appId === manifestAppId) {
104
- return app;
105
- }
106
- }
107
- }
108
- return null;
109
- };
110
- const app = getAppById(manifest.appId);
111
- if (!app) {
112
- console.log('The app was not found using this user:', email);
113
- process.exit(2);
114
- }
115
- const personalApp = !app.cid;
116
- console.log('Publishing App');
117
- console.log(' Id:', manifest.appId);
118
- console.log(' Name:', app.name);
119
- if (personalApp) {
120
- console.log(' Workspace: any (personal app)');
121
- }
122
- else {
123
- console.log(' Workspace:', info.networks[app.cid]?.name, '(' + app.cid + ')');
124
- }
125
- console.log(' Environment:', host);
126
- console.log();
127
- // Market code
128
- if (market) {
129
- console.log(' Note: Also publishing app to Hailer market');
130
- }
131
- /** Default to publish (yes) */
132
- const promptOverwriteQuestion = () => {
133
- return new Promise(resolve => {
134
- const rl = (0, readline_1.createInterface)(process.stdin, process.stdout);
135
- rl.setPrompt('Overwrite the app? (Y/n): ');
136
- rl.prompt();
137
- rl.on('line', (line) => {
138
- if (line.trim().toLocaleLowerCase().startsWith('n')) {
139
- resolve(false);
140
- }
141
- else {
142
- resolve(true);
143
- }
144
- rl.close();
145
- });
146
- });
147
- };
148
- const shouldOverwrite = await promptOverwriteQuestion();
149
- if (!shouldOverwrite) {
150
- console.log('Aborted publishing app.');
151
- process.exit(0);
204
+ publishMarket: market.toString()
205
+ }
206
+ }, function(error, resp, body) {
207
+ if (error) {
208
+ console.log("Publish error uploading file:", error);
209
+ process.exit(9);
210
+ }
211
+ let response;
212
+ let infoMarket = "";
213
+ try {
214
+ response = JSON.parse(body);
215
+ if (response.manifest && response.manifest.targetId) {
216
+ infoMarket = "Note! Use targetId in public/manifest.json file when creating the product in market!";
217
+ manifest.targetId = response.manifest.targetId;
218
+ const updatedManifestContent = JSON.stringify(manifest, null, 2);
219
+ (0, import_fs.writeFileSync)("./public/manifest.json", updatedManifestContent, "utf-8");
152
220
  }
153
- await new Promise((resolve, reject) => {
154
- request.post({
155
- uri: host + '/app/publish',
156
- headers: { hlrkey: cli.client.sessionKey },
157
- formData: {
158
- file: {
159
- value: content,
160
- options: {
161
- filename: appPackageFile,
162
- }
163
- },
164
- appId: manifest.appId,
165
- // Market code
166
- publishMarket: market.toString(),
167
- }
168
- }, function (error, resp, body) {
169
- if (error) {
170
- console.log('Publish error uploading file:', error);
171
- process.exit(9);
172
- }
173
- let response;
174
- let infoMarket = '';
175
- try {
176
- response = JSON.parse(body);
177
- // Market code
178
- if (response.manifest && response.manifest.targetId) {
179
- infoMarket = 'Note! Use targetId in public/manifest.json file when creating the product in market!';
180
- // Write targetId to manifest.json
181
- manifest.targetId = response.manifest.targetId;
182
- // Convert the modified object back to JSON
183
- const updatedManifestContent = JSON.stringify(manifest, null, 2);
184
- // Write the updated JSON content back to manifest.json
185
- (0, fs_1.writeFileSync)('./public/manifest.json', updatedManifestContent, 'utf-8');
186
- }
187
- }
188
- catch (error) {
189
- // ingore
190
- }
191
- console.log('App info:', (0, util_1.inspect)(response, { depth: 10, colors: true }));
192
- console.log();
193
- console.log(infoMarket);
194
- console.log();
195
- console.log('Published successfully!');
196
- resolve();
197
- });
198
- });
199
- cli.disconnect();
221
+ } catch (error2) {
222
+ }
223
+ console.log("App info:", (0, import_util.inspect)(response, { depth: 10, colors: true }));
224
+ console.log();
225
+ console.log(infoMarket);
226
+ console.log();
227
+ console.log("Published successfully!");
228
+ resolve();
200
229
  });
230
+ });
231
+ cli.disconnect();
201
232
  })();
233
+ //# sourceMappingURL=publish.cjs.map
package/lib/types.d.ts CHANGED
@@ -147,6 +147,9 @@ export interface WorkflowField {
147
147
  data: string[];
148
148
  functionEnabled: boolean;
149
149
  editable: boolean;
150
+ functionVariables?: {
151
+ [key: string]: any;
152
+ };
150
153
  }
151
154
  export interface Workflow {
152
155
  _id: string;
@@ -408,18 +411,24 @@ export interface Signal {
408
411
  }
409
412
  export interface Product extends ProductType {
410
413
  _id: string;
411
- targetId: string;
414
+ targetId?: string;
412
415
  name: string;
413
416
  description?: string;
414
417
  icon?: string;
415
418
  images?: string[];
416
419
  externalUrl?: string;
417
420
  publisher?: string;
421
+ ctaLabel: string;
422
+ ctaLink: string;
418
423
  /** Available or not in app store */
419
424
  public?: boolean;
420
- workspaceId?: string;
425
+ cid?: string;
421
426
  uid: string;
422
427
  }
428
+ export interface ProductListResponse {
429
+ products: Product[];
430
+ totalCount: number;
431
+ }
423
432
  export interface ProductSearchOption {
424
433
  limit?: number;
425
434
  skip?: number;
@@ -434,7 +443,7 @@ export interface ProductSearchFilter extends ProductType {
434
443
  uid?: string;
435
444
  }
436
445
  export interface ProductType {
437
- type?: 'app' | 'template' | 'document-template';
446
+ type?: 'app' | 'template' | 'integration' | 'expert' | 'ai-agent';
438
447
  }
439
448
  export interface ProductVersion {
440
449
  _id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hailer/app-sdk",
3
- "version": "2.0.0-beta-5",
3
+ "version": "2.0.0-beta-7",
4
4
  "description": "SDK for building Hailer Apps",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -11,7 +11,7 @@
11
11
  "./lib/**/*"
12
12
  ],
13
13
  "scripts": {
14
- "build": "tsc --project tools/tsconfig.json && mv lib/tools/publish.js lib/tools/publish.cjs && tsc && esbuild src/index.ts --bundle --format=esm --minify --sourcemap --outfile=lib/app-sdk.js",
14
+ "build": "esbuild tools/publish.ts --platform=node --packages=external --bundle --format=cjs --sourcemap --outfile=lib/tools/publish.cjs && tsc && esbuild src/index.ts --bundle --format=esm --minify --sourcemap --outfile=lib/app-sdk.js",
15
15
  "prepublishOnly": "npm run build",
16
16
  "watch": "concurrently --kill-others \"npm run watch-tsc\" \"npm run watch-esbuild\"",
17
17
  "watch-tsc": "tsc --watch",
@@ -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": {