@hailer/app-sdk 2.0.0-beta-20 → 2.1.0
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/tools/publish.cjs +210 -91
- package/lib/tools/publish.cjs.map +3 -3
- package/package.json +15 -6
package/lib/tools/publish.cjs
CHANGED
|
@@ -19,7 +19,7 @@ var releaseStdin = (onData) => {
|
|
|
19
19
|
stdin.setRawMode(false);
|
|
20
20
|
stdout.write("\n");
|
|
21
21
|
};
|
|
22
|
-
var prompt = (question, ctrlcExits = true) => new Promise((resolve, reject) => {
|
|
22
|
+
var prompt = (question, { hidden = true, ctrlcExits = true } = {}) => new Promise((resolve, reject) => {
|
|
23
23
|
let input = "";
|
|
24
24
|
const onData = (data) => {
|
|
25
25
|
switch (data) {
|
|
@@ -43,9 +43,15 @@ var prompt = (question, ctrlcExits = true) => new Promise((resolve, reject) => {
|
|
|
43
43
|
// Backspace
|
|
44
44
|
case "\x7F":
|
|
45
45
|
input = input.slice(0, -1);
|
|
46
|
+
if (!hidden) {
|
|
47
|
+
stdout.write("\b \b");
|
|
48
|
+
}
|
|
46
49
|
break;
|
|
47
50
|
default:
|
|
48
51
|
input += data;
|
|
52
|
+
if (!hidden) {
|
|
53
|
+
stdout.write(data);
|
|
54
|
+
}
|
|
49
55
|
}
|
|
50
56
|
;
|
|
51
57
|
};
|
|
@@ -56,147 +62,260 @@ var prompt = (question, ctrlcExits = true) => new Promise((resolve, reject) => {
|
|
|
56
62
|
// tools/publish.ts
|
|
57
63
|
var import_util = require("util");
|
|
58
64
|
var import_readline = require("readline");
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
var import_dotenv = require("dotenv");
|
|
66
|
+
var import_os = require("os");
|
|
67
|
+
var import_path = require("path");
|
|
68
|
+
(0, import_dotenv.config)({ path: (0, import_path.join)((0, import_os.homedir)(), ".env") });
|
|
69
|
+
function getArgValue(flag) {
|
|
70
|
+
const index = process.argv.indexOf(flag);
|
|
71
|
+
if (index === -1 || index + 1 >= process.argv.length) return void 0;
|
|
72
|
+
return process.argv[index + 1];
|
|
73
|
+
}
|
|
74
|
+
function hasFlag(flag) {
|
|
75
|
+
return process.argv.includes(flag);
|
|
76
|
+
}
|
|
77
|
+
var userApiKey = getArgValue("--user-api-key") || process.env.USER_API_KEY || process.env.HAILER_USER_API_KEY;
|
|
78
|
+
var email = getArgValue("--email") || process.env.EMAIL;
|
|
79
|
+
if (!userApiKey && !email && !process.env.LOCAL) {
|
|
80
|
+
console.log("Please provide authentication: --email, --user-api-key, or EMAIL env var.");
|
|
61
81
|
console.log("");
|
|
62
82
|
console.log("Usage:");
|
|
63
|
-
console.log("
|
|
83
|
+
console.log(" npm run publish-production -- --email user@mail.com (will prompt for password)");
|
|
84
|
+
console.log(" npm run publish-production -- --user-api-key <key>");
|
|
85
|
+
console.log(" EMAIL=user@mail.com npm run publish-production (going to be deprecated, use --email instead)");
|
|
86
|
+
console.log(" USER_API_KEY=<key> npm run publish-production (going to be deprecated, use --user-api-key instead)");
|
|
87
|
+
console.log("");
|
|
88
|
+
console.log("Create and publish new app:");
|
|
89
|
+
console.log(' npm run publish-production -- --create --app-name "My App" --workspace <id> --user-api-key <key> --yes');
|
|
90
|
+
console.log("");
|
|
91
|
+
console.log("Options:");
|
|
92
|
+
console.log(" --email <email> User email for authentication");
|
|
93
|
+
console.log(" --user-api-key <key> API key for authentication");
|
|
94
|
+
console.log(" --create Create a new app before publishing");
|
|
95
|
+
console.log(" --app-name <name> App name (with --create)");
|
|
96
|
+
console.log(" --workspace <id> Workspace ID (with --create)");
|
|
97
|
+
console.log(" --market Also publish to Hailer marketplace");
|
|
98
|
+
console.log(" --yes Skip confirmation prompt (going to be deprecated, use --force instead)");
|
|
99
|
+
console.log(" --force Skip confirmation prompt");
|
|
100
|
+
console.log(" --host <host> Specify the host URL");
|
|
64
101
|
process.exit(10);
|
|
65
102
|
}
|
|
66
103
|
(async () => {
|
|
67
|
-
let
|
|
68
|
-
|
|
69
|
-
const market = process.env.MARKET === "true";
|
|
104
|
+
let password;
|
|
105
|
+
const market = hasFlag("--market") || process.env.MARKET === "true";
|
|
70
106
|
const appPackageFile = process.argv[2];
|
|
71
|
-
const mode = process.argv
|
|
72
|
-
let host = process.env.HOST || "https://localhost:9443";
|
|
107
|
+
const mode = ["--development", "--staging", "--production", "--local"].find((m) => process.argv.includes(m));
|
|
108
|
+
let host = getArgValue("--host") || process.env.HOST || "https://localhost:9443";
|
|
73
109
|
switch (mode) {
|
|
74
110
|
case "--development":
|
|
75
|
-
host = process.env.HOST || "https://testapi.hailer.biz";
|
|
111
|
+
host = getArgValue("--host") || process.env.HOST || "https://testapi.hailer.biz";
|
|
76
112
|
break;
|
|
77
113
|
case "--staging":
|
|
78
|
-
host = process.env.HOST || "https://api.hailer.biz";
|
|
114
|
+
host = getArgValue("--host") || process.env.HOST || "https://api.hailer.biz";
|
|
79
115
|
break;
|
|
80
116
|
case "--production":
|
|
81
|
-
host = process.env.HOST || "https://api.hailer.com";
|
|
117
|
+
host = getArgValue("--host") || process.env.HOST || "https://api.hailer.com";
|
|
82
118
|
break;
|
|
83
119
|
}
|
|
84
120
|
if (process.env.LOCAL || mode === "--local") {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
121
|
+
host = getArgValue("--host") || process.env.HOST || "https://api.hailer.local.gd";
|
|
122
|
+
if (!userApiKey) {
|
|
123
|
+
console.log("Overriding credentials with local settings!");
|
|
124
|
+
email = "el@hailero.es";
|
|
125
|
+
password = "el@hailero.es";
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const isLocal = !!(process.env.LOCAL || mode === "--local");
|
|
129
|
+
if (isLocal) {
|
|
130
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
89
131
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
132
|
+
let cli;
|
|
133
|
+
if (userApiKey) {
|
|
134
|
+
cli = await import_cli.Client.create({ host, userApiKey, rejectUnauthorized: !isLocal }).catch(
|
|
135
|
+
(error) => {
|
|
136
|
+
console.log("Hailer Cli Error (API key auth):", error);
|
|
137
|
+
process.exit(8);
|
|
96
138
|
}
|
|
97
|
-
|
|
139
|
+
);
|
|
140
|
+
} else {
|
|
141
|
+
if (!password) {
|
|
142
|
+
password = await prompt("enter password for " + email + ": ");
|
|
98
143
|
}
|
|
99
|
-
|
|
144
|
+
cli = await import_cli.Client.create({ host, username: email, password, rejectUnauthorized: !isLocal }).catch(
|
|
145
|
+
(error) => {
|
|
146
|
+
if (error.msg === "Invalid Login Data") {
|
|
147
|
+
console.log("Invalid username or password when logging into Hailer.");
|
|
148
|
+
} else {
|
|
149
|
+
console.log("Hailer Cli Error:", error);
|
|
150
|
+
}
|
|
151
|
+
process.exit(8);
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
100
155
|
if (!appPackageFile?.endsWith(".tgz")) {
|
|
101
156
|
console.log("Failed getting .tgz file, found:", appPackageFile);
|
|
102
157
|
process.exit(7);
|
|
103
158
|
}
|
|
104
|
-
const manifest = JSON.parse((0, import_fs.readFileSync)("./dist/manifest.json").toString());
|
|
105
159
|
const content = (0, import_fs.readFileSync)(appPackageFile);
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
(0, import_fs.writeFileSync)("./public/manifest.json", updatedManifestContent, "utf-8");
|
|
113
|
-
console.log("");
|
|
114
|
-
console.log("Please set version & versionDescription in file public/manifest.json! You have added MARKET=true in your publish string.");
|
|
115
|
-
console.log("");
|
|
116
|
-
process.exit(10);
|
|
160
|
+
let appId;
|
|
161
|
+
if (hasFlag("--create")) {
|
|
162
|
+
let appName = getArgValue("--app-name");
|
|
163
|
+
let workspaceId = getArgValue("--workspace");
|
|
164
|
+
if (!appName) {
|
|
165
|
+
appName = await prompt("App name: ", { hidden: false });
|
|
117
166
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
for (const appMap of Object.values(info.apps)) {
|
|
121
|
-
for (const [appId, app2] of Object.entries(appMap)) {
|
|
122
|
-
if (appId === manifestAppId) {
|
|
123
|
-
return app2;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
167
|
+
if (!workspaceId) {
|
|
168
|
+
workspaceId = await prompt("Workspace ID: ", { hidden: false });
|
|
126
169
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
console.log(
|
|
170
|
+
if (!appName) {
|
|
171
|
+
console.log("Error: --create requires --app-name <name>");
|
|
172
|
+
process.exit(11);
|
|
173
|
+
}
|
|
174
|
+
if (!workspaceId) {
|
|
175
|
+
console.log("Error: --create requires --workspace <id>");
|
|
176
|
+
process.exit(12);
|
|
177
|
+
}
|
|
178
|
+
console.log("Creating new app...");
|
|
179
|
+
console.log(" Name:", appName);
|
|
180
|
+
console.log(" Workspace:", workspaceId);
|
|
181
|
+
console.log(" Environment:", host);
|
|
182
|
+
console.log();
|
|
183
|
+
const appDoc = await cli.request("v3.app.create", [{
|
|
184
|
+
name: appName,
|
|
185
|
+
cid: workspaceId
|
|
186
|
+
}]).catch((error) => {
|
|
187
|
+
console.log("Failed to create app:", error);
|
|
188
|
+
process.exit(13);
|
|
189
|
+
});
|
|
190
|
+
appId = appDoc._id;
|
|
191
|
+
console.log("App created with id:", appId);
|
|
192
|
+
console.log();
|
|
140
193
|
} else {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
194
|
+
const manifest = JSON.parse((0, import_fs.readFileSync)("./dist/manifest.json").toString());
|
|
195
|
+
if (market) {
|
|
196
|
+
if (!manifest.version) {
|
|
197
|
+
manifest.version = "";
|
|
198
|
+
manifest.versionDescription = "";
|
|
199
|
+
const updatedManifestContent = JSON.stringify(manifest, null, 2);
|
|
200
|
+
(0, import_fs.writeFileSync)("./public/manifest.json", updatedManifestContent, "utf-8");
|
|
201
|
+
console.log("");
|
|
202
|
+
console.log("Please set version in format (x.y.z) & versionDescription in file public/manifest.json! You have added MARKET=true or --market in your publish string.");
|
|
203
|
+
console.log("");
|
|
204
|
+
process.exit(10);
|
|
205
|
+
}
|
|
151
206
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
} else {
|
|
160
|
-
resolve(true);
|
|
207
|
+
const info = await cli.request("v2.core.init", [["network", "networks", "apps"]]);
|
|
208
|
+
const getAppById = (manifestAppId) => {
|
|
209
|
+
for (const appMap of Object.values(info.apps)) {
|
|
210
|
+
for (const [id, app2] of Object.entries(appMap)) {
|
|
211
|
+
if (id === manifestAppId) {
|
|
212
|
+
return app2;
|
|
213
|
+
}
|
|
161
214
|
}
|
|
162
|
-
|
|
215
|
+
}
|
|
216
|
+
return null;
|
|
217
|
+
};
|
|
218
|
+
const app = getAppById(manifest.appId);
|
|
219
|
+
if (!app) {
|
|
220
|
+
const authInfo = userApiKey ? "the provided API key" : email;
|
|
221
|
+
console.log("The app was not found using:", authInfo);
|
|
222
|
+
process.exit(2);
|
|
223
|
+
}
|
|
224
|
+
const personalApp = !app.cid;
|
|
225
|
+
console.log("Publishing App");
|
|
226
|
+
console.log(" Id:", manifest.appId);
|
|
227
|
+
console.log(" Name:", app.name);
|
|
228
|
+
if (personalApp) {
|
|
229
|
+
console.log(" Workspace: any (personal app)");
|
|
230
|
+
} else {
|
|
231
|
+
console.log(" Workspace:", info.networks[app.cid]?.name, "(" + app.cid + ")");
|
|
232
|
+
}
|
|
233
|
+
console.log(" Environment:", host);
|
|
234
|
+
console.log();
|
|
235
|
+
if (market) {
|
|
236
|
+
console.log(" Note: Also publishing app to Hailer market");
|
|
237
|
+
}
|
|
238
|
+
const promptOverwriteQuestion = async () => {
|
|
239
|
+
if (hasFlag("--yes") || hasFlag("--force")) {
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
return new Promise((resolve) => {
|
|
243
|
+
const rl = (0, import_readline.createInterface)(process.stdin, process.stdout);
|
|
244
|
+
rl.setPrompt("Overwrite the app? (Y/n): ");
|
|
245
|
+
rl.prompt();
|
|
246
|
+
rl.on("line", (line) => {
|
|
247
|
+
if (line.trim().toLocaleLowerCase().startsWith("n")) {
|
|
248
|
+
resolve(false);
|
|
249
|
+
} else {
|
|
250
|
+
resolve(true);
|
|
251
|
+
}
|
|
252
|
+
rl.close();
|
|
253
|
+
});
|
|
163
254
|
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
255
|
+
};
|
|
256
|
+
const shouldOverwrite = await promptOverwriteQuestion();
|
|
257
|
+
if (!shouldOverwrite) {
|
|
258
|
+
console.log("Aborted publishing app.");
|
|
259
|
+
process.exit(0);
|
|
260
|
+
}
|
|
261
|
+
appId = manifest.appId;
|
|
170
262
|
}
|
|
171
263
|
const formData = new FormData();
|
|
172
264
|
formData.append("file", new Blob([content]), appPackageFile);
|
|
173
|
-
formData.append("appId",
|
|
265
|
+
formData.append("appId", appId);
|
|
174
266
|
formData.append("publishMarket", market.toString());
|
|
267
|
+
const headers = {};
|
|
268
|
+
if (cli.sessionKey) {
|
|
269
|
+
headers.hlrkey = cli.sessionKey;
|
|
270
|
+
} else if (cli.userApiKey) {
|
|
271
|
+
headers.hlrkey = cli.userApiKey;
|
|
272
|
+
}
|
|
175
273
|
const resp = await fetch(host + "/app/publish", {
|
|
176
274
|
method: "POST",
|
|
177
|
-
headers
|
|
275
|
+
headers,
|
|
178
276
|
body: formData
|
|
179
277
|
}).catch((error) => {
|
|
180
278
|
console.log("Publish error uploading file:", error);
|
|
181
279
|
process.exit(9);
|
|
182
280
|
});
|
|
281
|
+
if (!resp.ok) {
|
|
282
|
+
console.log("Publish failed with status:", resp.status, resp.statusText);
|
|
283
|
+
const body2 = await resp.text();
|
|
284
|
+
console.log("Response:", body2);
|
|
285
|
+
process.exit(9);
|
|
286
|
+
}
|
|
183
287
|
const body = await resp.text();
|
|
184
288
|
let response;
|
|
185
289
|
let infoMarket = "";
|
|
186
290
|
try {
|
|
187
291
|
response = JSON.parse(body);
|
|
292
|
+
} catch (error) {
|
|
293
|
+
console.log("Failed to parse publish response:", error);
|
|
294
|
+
console.log("Response body:", body);
|
|
295
|
+
process.exit(6);
|
|
296
|
+
}
|
|
297
|
+
const manifestPath = "./public/manifest.json";
|
|
298
|
+
if ((0, import_fs.existsSync)(manifestPath)) {
|
|
299
|
+
const publicManifest = JSON.parse((0, import_fs.readFileSync)(manifestPath).toString());
|
|
300
|
+
let manifestUpdated = false;
|
|
301
|
+
if (hasFlag("--create")) {
|
|
302
|
+
publicManifest.appId = appId;
|
|
303
|
+
manifestUpdated = true;
|
|
304
|
+
console.log("Updated", manifestPath, "with appId:", appId);
|
|
305
|
+
}
|
|
188
306
|
if (response.manifest && response.manifest.targetId) {
|
|
307
|
+
publicManifest.targetId = response.manifest.targetId;
|
|
308
|
+
manifestUpdated = true;
|
|
189
309
|
infoMarket = "Note! Use targetId in public/manifest.json file when creating the product in market!";
|
|
190
|
-
manifest.targetId = response.manifest.targetId;
|
|
191
|
-
const updatedManifestContent = JSON.stringify(manifest, null, 2);
|
|
192
|
-
(0, import_fs.writeFileSync)("./public/manifest.json", updatedManifestContent, "utf-8");
|
|
193
310
|
}
|
|
194
|
-
|
|
311
|
+
if (manifestUpdated) {
|
|
312
|
+
(0, import_fs.writeFileSync)(manifestPath, JSON.stringify(publicManifest, null, 2), "utf-8");
|
|
313
|
+
}
|
|
195
314
|
}
|
|
196
315
|
console.log("App info:", (0, import_util.inspect)(response, { depth: 10, colors: true }));
|
|
197
316
|
console.log();
|
|
198
|
-
|
|
199
|
-
|
|
317
|
+
if (infoMarket)
|
|
318
|
+
console.log(infoMarket);
|
|
200
319
|
console.log("Published successfully!");
|
|
201
320
|
cli.disconnect();
|
|
202
321
|
})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../tools/publish.ts", "../../tools/minimal-password-prompt.ts"],
|
|
4
|
-
"sourcesContent": ["import { Client } from '@hailer/cli';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { prompt } from './minimal-password-prompt';\nimport { inspect } from 'util';\nimport { createInterface } from 'readline';\n\nif (!process.env.EMAIL && !process.env.LOCAL) {\n console.log('Please set environment variable EMAIL to Hailer user name.');\n console.log('');\n console.log('Usage:');\n console.log(' EMAIL=user.name@mail.com npm run publish-production');\n process.exit(10);\n}\n\n(async () => {\n\n let email = process.env.EMAIL;\n let password = process.env.LOCAL || await prompt('enter password for ' + email + ': ');\n\n // Market code\n const market = process.env.MARKET === 'true';\n\n const appPackageFile = process.argv[2];\n\n /** Alternatives: `--development` | `--staging` | `--production` */\n const mode = process.argv[3];\n\n let host = process.env.HOST || 'https://localhost:9443';\n\n switch (mode) {\n case '--development':\n host = process.env.HOST || 'https://testapi.hailer.biz';\n break;\n case '--staging':\n host = process.env.HOST || 'https://api.hailer.biz';\n break;\n case '--production':\n host = process.env.HOST || 'https://api.hailer.com';\n break;\n }\n\n if (process.env.LOCAL || mode === '--local') {\n console.log('Overriding credentials with local settings!');\n email = 'el@hailero.es';\n password = 'el@hailero.es';\n host = process.env.HOST || 'https://api.hailer.local.gd';\n }\n\n const cli = await Client.create({ host, username: email, password }).catch(\n (error) => {\n if (error.msg === 'Invalid Login Data') {\n console.log('Invalid username or password when logging into Hailer.');\n } else {\n console.log('Hailer Cli Error:', error);\n }\n\n process.exit(8);\n }\n );\n\n if (!appPackageFile?.endsWith('.tgz')) {\n console.log('Failed getting .tgz file, found:', appPackageFile);\n process.exit(7);\n }\n\n const manifest = JSON.parse(readFileSync('./dist/manifest.json').toString());\n const content = readFileSync(appPackageFile);\n const info = await cli.request('v2.core.init', [['network', 'networks', 'apps']]);\n\n // Market code\n if (market) {\n // Check if version exist in manifest.json. If not, add empty version and let user fill it in\n if (!manifest.version) {\n manifest.version = '';\n manifest.versionDescription = '';\n\n // Convert the modified object back to JSON\n const updatedManifestContent = JSON.stringify(manifest, null, 2);\n \n // Write the updated JSON content back to manifest.json\n writeFileSync('./public/manifest.json', updatedManifestContent, 'utf-8');\n\n console.log('');\n console.log('Please set version & versionDescription in file public/manifest.json! You have added MARKET=true in your publish string.');\n console.log('');\n process.exit(10);\n }\n }\n\n const getAppById = (manifestAppId: string): { _id: string, name: string, cid: string } | null => {\n for (const appMap of Object.values(info.apps)) {\n for (const [appId, app] of Object.entries(appMap as any)) {\n if (appId === manifestAppId) {\n return app as any;\n }\n }\n }\n\n return null;\n }\n\n const app = getAppById(manifest.appId);\n\n if (!app) {\n console.log('The app was not found using this user:', email);\n process.exit(2);\n }\n\n const personalApp = !app.cid;\n\n console.log('Publishing App');\n console.log(' Id:', manifest.appId);\n console.log(' Name:', app.name);\n if (personalApp) {\n console.log(' Workspace: any (personal app)');\n } else {\n console.log(' Workspace:', info.networks[app.cid]?.name, '(' + app.cid + ')');\n }\n console.log(' Environment:', host);\n console.log();\n\n // Market code\n if (market) {\n console.log(' Note: Also publishing app to Hailer market');\n }\n\n /** Default to publish (yes) */\n const promptOverwriteQuestion = async () => {\n if (process.argv.includes('--yes')) {\n return true;\n }\n\n return new Promise<boolean>(resolve => {\n const rl = createInterface(process.stdin, process.stdout);\n\n rl.setPrompt('Overwrite the app? (Y/n): ');\n rl.prompt();\n rl.on('line', (line) => {\n if (line.trim().toLocaleLowerCase().startsWith('n')) {\n resolve(false);\n } else {\n resolve(true);\n }\n rl.close();\n });\n });\n }\n\n const shouldOverwrite = await promptOverwriteQuestion();\n\n if (!shouldOverwrite) {\n console.log('Aborted publishing app.');\n process.exit(0);\n }\n\n const formData = new FormData();\n formData.append('file', new Blob([content]), appPackageFile);\n formData.append('appId', manifest.appId);\n // Market code\n formData.append('publishMarket', market.toString());\n\n const resp = await fetch(host + '/app/publish', {\n method: 'POST',\n headers: { hlrkey: cli.sessionKey },\n body: formData,\n }).catch((error) => {\n console.log('Publish error uploading file:', error);\n process.exit(9);\n });\n\n const body = await resp.text();\n let response;\n let infoMarket = '';\n\n try {\n response = JSON.parse(body);\n\n // Market code\n if (response.manifest && response.manifest.targetId) {\n infoMarket = 'Note! Use targetId in public/manifest.json file when creating the product in market!';\n // Write targetId to manifest.json\n manifest.targetId = response.manifest.targetId;\n\n // Convert the modified object back to JSON\n const updatedManifestContent = JSON.stringify(manifest, null, 2);\n\n // Write the updated JSON content back to manifest.json\n writeFileSync('./public/manifest.json', updatedManifestContent, 'utf-8');\n }\n } catch (error) {\n // ingore\n }\n\n console.log('App info:', inspect(response, { depth: 10, colors: true }));\n console.log();\n console.log(infoMarket);\n console.log();\n console.log('Published successfully!');\n\n cli.disconnect();\n})();\n", "// Re-written to TypeScript to fix typing issue, see: https://www.npmjs.com/package/minimal-password-prompt/v/1.1.0\n\nconst stdin = process.stdin;\nconst stdout = process.stdout;\n\nconst captureStdin = (onData: (data: string) => void) => {\n stdin.setEncoding('utf-8');\n stdin.setRawMode(true);\n stdin.on('data', onData);\n stdin.resume();\n};\n\nconst releaseStdin = (onData: (data: string) => void) => {\n stdin.pause();\n stdin.removeListener('data', onData);\n stdin.setRawMode(false);\n stdout.write('\\n');\n};\n\nexport const prompt = (question: string, ctrlcExits = true): Promise<string> => (\n new Promise((resolve, reject) => {\n let input = '';\n const onData = (data: string) => {\n switch (data) {\n case '\\u000A': // \\n\n case '\\u000D': // \\r\n case '\\u0004': // Ctrl+D\n releaseStdin(onData);\n resolve(input);\n break;\n case '\\u0003': // Ctrl+C\n releaseStdin(onData);\n if (ctrlcExits) { // exit or raise error\n process.exit();\n } else {\n reject(new Error('Ctrl+C'));\n }\n break;\n case '\\u0008': // Backspace\n case '\\u007F': // Delete\n input = input.slice(0, -1);\n break;\n default: // any other\n input += data;\n };\n };\n captureStdin(onData);\n stdout.write(question);\n })\n);\n"],
|
|
5
|
-
"mappings": ";;;AAAA,iBAAuB;AACvB,
|
|
6
|
-
"names": ["app"]
|
|
4
|
+
"sourcesContent": ["import { Client } from '@hailer/cli';\nimport { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { prompt } from './minimal-password-prompt';\nimport { inspect } from 'util';\nimport { createInterface } from 'readline';\nimport { config as loadEnv } from 'dotenv';\nimport { homedir } from 'os';\nimport { join } from 'path';\n\n// Load ~/.env as fallback (doesn't overwrite existing env vars)\nloadEnv({ path: join(homedir(), '.env') });\n\n/** Get the value following a named flag, e.g. getArgValue('--user-api-key') */\nfunction getArgValue(flag: string): string | undefined {\n const index = process.argv.indexOf(flag);\n if (index === -1 || index + 1 >= process.argv.length) return undefined;\n return process.argv[index + 1];\n}\n\nfunction hasFlag(flag: string): boolean {\n return process.argv.includes(flag);\n}\n\nconst userApiKey = getArgValue('--user-api-key') || process.env.USER_API_KEY || process.env.HAILER_USER_API_KEY;\n\nlet email = getArgValue('--email') || process.env.EMAIL;\n\nif (!userApiKey && !email && !process.env.LOCAL) {\n console.log('Please provide authentication: --email, --user-api-key, or EMAIL env var.');\n console.log('');\n console.log('Usage:');\n console.log(' npm run publish-production -- --email user@mail.com (will prompt for password)');\n console.log(' npm run publish-production -- --user-api-key <key>');\n console.log(' EMAIL=user@mail.com npm run publish-production (going to be deprecated, use --email instead)');\n console.log(' USER_API_KEY=<key> npm run publish-production (going to be deprecated, use --user-api-key instead)');\n console.log('');\n console.log('Create and publish new app:');\n console.log(' npm run publish-production -- --create --app-name \"My App\" --workspace <id> --user-api-key <key> --yes');\n console.log('');\n console.log('Options:');\n console.log(' --email <email> User email for authentication');\n console.log(' --user-api-key <key> API key for authentication');\n console.log(' --create Create a new app before publishing');\n console.log(' --app-name <name> App name (with --create)');\n console.log(' --workspace <id> Workspace ID (with --create)');\n console.log(' --market Also publish to Hailer marketplace');\n console.log(' --yes Skip confirmation prompt (going to be deprecated, use --force instead)');\n console.log(' --force Skip confirmation prompt');\n console.log(' --host <host> Specify the host URL');\n process.exit(10);\n}\n\n(async () => {\n\n let password: string | undefined;\n\n const market = hasFlag('--market') || process.env.MARKET === 'true';\n\n const appPackageFile = process.argv[2];\n\n /** Detect mode from any position in argv */\n const mode = ['--development', '--staging', '--production', '--local']\n .find(m => process.argv.includes(m));\n\n let host = getArgValue(\"--host\") || process.env.HOST || 'https://localhost:9443';\n\n switch (mode) {\n case '--development':\n host = getArgValue(\"--host\") || process.env.HOST || 'https://testapi.hailer.biz';\n break;\n case '--staging':\n host = getArgValue(\"--host\") || process.env.HOST || 'https://api.hailer.biz';\n break;\n case '--production':\n host = getArgValue(\"--host\") || process.env.HOST || 'https://api.hailer.com';\n break;\n }\n\n if (process.env.LOCAL || mode === '--local') {\n host = getArgValue(\"--host\") || process.env.HOST || 'https://api.hailer.local.gd';\n if (!userApiKey) {\n console.log('Overriding credentials with local settings!');\n email = 'el@hailero.es';\n password = 'el@hailero.es';\n }\n }\n\n const isLocal = !!(process.env.LOCAL || mode === '--local');\n\n if (isLocal) {\n process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';\n }\n\n // Authenticate\n let cli: Client;\n\n if (userApiKey) {\n cli = await Client.create({ host, userApiKey, rejectUnauthorized: !isLocal }).catch(\n (error) => {\n console.log('Hailer Cli Error (API key auth):', error);\n process.exit(8);\n }\n );\n } else {\n if (!password) {\n password = await prompt('enter password for ' + email + ': ');\n }\n\n cli = await Client.create({ host, username: email, password, rejectUnauthorized: !isLocal }).catch(\n (error) => {\n if (error.msg === 'Invalid Login Data') {\n console.log('Invalid username or password when logging into Hailer.');\n } else {\n console.log('Hailer Cli Error:', error);\n }\n\n process.exit(8);\n }\n );\n }\n\n // Validate .tgz file\n if (!appPackageFile?.endsWith('.tgz')) {\n console.log('Failed getting .tgz file, found:', appPackageFile);\n process.exit(7);\n }\n\n const content = readFileSync(appPackageFile);\n let appId: string;\n\n // --create: Create a new app, then publish it\n if (hasFlag('--create')) {\n let appName = getArgValue('--app-name');\n let workspaceId = getArgValue('--workspace');\n\n if (!appName) {\n appName = await prompt('App name: ', { hidden: false });\n }\n\n if (!workspaceId) {\n workspaceId = await prompt('Workspace ID: ', { hidden: false });\n }\n\n if (!appName) {\n console.log('Error: --create requires --app-name <name>');\n process.exit(11);\n }\n if (!workspaceId) {\n console.log('Error: --create requires --workspace <id>');\n process.exit(12);\n }\n\n console.log('Creating new app...');\n console.log(' Name:', appName);\n console.log(' Workspace:', workspaceId);\n console.log(' Environment:', host);\n console.log();\n\n const appDoc = await cli.request('v3.app.create', [{\n name: appName,\n cid: workspaceId,\n }]).catch((error: any) => {\n console.log('Failed to create app:', error);\n process.exit(13);\n });\n\n appId = appDoc._id;\n console.log('App created with id:', appId);\n console.log();\n\n } else {\n // Normal publish: read appId from manifest\n const manifest = JSON.parse(readFileSync('./dist/manifest.json').toString());\n\n // Market code\n if (market) {\n if (!manifest.version) {\n manifest.version = '';\n manifest.versionDescription = '';\n\n const updatedManifestContent = JSON.stringify(manifest, null, 2);\n writeFileSync('./public/manifest.json', updatedManifestContent, 'utf-8');\n\n console.log('');\n console.log('Please set version in format (x.y.z) & versionDescription in file public/manifest.json! You have added MARKET=true or --market in your publish string.');\n console.log('');\n process.exit(10);\n }\n }\n\n const info = await cli.request('v2.core.init', [['network', 'networks', 'apps']]);\n\n const getAppById = (manifestAppId: string): { _id: string, name: string, cid: string } | null => {\n for (const appMap of Object.values(info.apps)) {\n for (const [id, app] of Object.entries(appMap as any)) {\n if (id === manifestAppId) {\n return app as any;\n }\n }\n }\n return null;\n }\n\n const app = getAppById(manifest.appId);\n\n if (!app) {\n const authInfo = userApiKey ? 'the provided API key' : email;\n console.log('The app was not found using:', authInfo);\n process.exit(2);\n }\n\n const personalApp = !app.cid;\n\n console.log('Publishing App');\n console.log(' Id:', manifest.appId);\n console.log(' Name:', app.name);\n if (personalApp) {\n console.log(' Workspace: any (personal app)');\n } else {\n console.log(' Workspace:', info.networks[app.cid]?.name, '(' + app.cid + ')');\n }\n console.log(' Environment:', host);\n console.log();\n\n // Market code\n if (market) {\n console.log(' Note: Also publishing app to Hailer market');\n }\n\n /** Default to publish (yes) */\n const promptOverwriteQuestion = async () => {\n if (hasFlag('--yes') || hasFlag('--force')) {\n return true;\n }\n\n return new Promise<boolean>(resolve => {\n const rl = createInterface(process.stdin, process.stdout);\n\n rl.setPrompt('Overwrite the app? (Y/n): ');\n rl.prompt();\n rl.on('line', (line) => {\n if (line.trim().toLocaleLowerCase().startsWith('n')) {\n resolve(false);\n } else {\n resolve(true);\n }\n rl.close();\n });\n });\n }\n\n const shouldOverwrite = await promptOverwriteQuestion();\n\n if (!shouldOverwrite) {\n console.log('Aborted publishing app.');\n process.exit(0);\n }\n\n appId = manifest.appId;\n }\n\n // Upload\n const formData = new FormData();\n formData.append('file', new Blob([content]), appPackageFile);\n formData.append('appId', appId);\n // Market code\n formData.append('publishMarket', market.toString());\n\n const headers: Record<string, string> = {};\n \n if (cli.sessionKey) {\n headers.hlrkey = cli.sessionKey;\n } else if (cli.userApiKey) {\n headers.hlrkey = cli.userApiKey;\n }\n\n const resp = await fetch(host + '/app/publish', {\n method: 'POST',\n headers,\n body: formData,\n }).catch((error) => {\n console.log('Publish error uploading file:', error);\n process.exit(9);\n });\n\n if (!resp.ok) {\n console.log('Publish failed with status:', resp.status, resp.statusText);\n const body = await resp.text();\n console.log('Response:', body);\n process.exit(9);\n }\n\n const body = await resp.text();\n let response;\n let infoMarket = '';\n\n try {\n response = JSON.parse(body);\n } catch (error) {\n console.log('Failed to parse publish response:', error);\n console.log('Response body:', body);\n process.exit(6);\n }\n\n // Update manifest.json with appId (--create) and/or targetId (--market)\n const manifestPath = './public/manifest.json';\n if (existsSync(manifestPath)) {\n const publicManifest = JSON.parse(readFileSync(manifestPath).toString());\n let manifestUpdated = false;\n\n if (hasFlag('--create')) {\n publicManifest.appId = appId;\n manifestUpdated = true;\n console.log('Updated', manifestPath, 'with appId:', appId);\n }\n\n if (response.manifest && response.manifest.targetId) {\n publicManifest.targetId = response.manifest.targetId;\n manifestUpdated = true;\n infoMarket = 'Note! Use targetId in public/manifest.json file when creating the product in market!';\n }\n\n if (manifestUpdated) {\n writeFileSync(manifestPath, JSON.stringify(publicManifest, null, 2), 'utf-8');\n }\n }\n\n console.log('App info:', inspect(response, { depth: 10, colors: true }));\n console.log();\n if (infoMarket)\n console.log(infoMarket);\n console.log('Published successfully!');\n\n cli.disconnect();\n})();\n", "// Re-written to TypeScript to fix typing issue, see: https://www.npmjs.com/package/minimal-password-prompt/v/1.1.0\n\nconst stdin = process.stdin;\nconst stdout = process.stdout;\n\nconst captureStdin = (onData: (data: string) => void) => {\n stdin.setEncoding('utf-8');\n stdin.setRawMode(true);\n stdin.on('data', onData);\n stdin.resume();\n};\n\nconst releaseStdin = (onData: (data: string) => void) => {\n stdin.pause();\n stdin.removeListener('data', onData);\n stdin.setRawMode(false);\n stdout.write('\\n');\n};\n\nexport const prompt = (question: string, { hidden = true, ctrlcExits = true } = {}): Promise<string> => (\n new Promise((resolve, reject) => {\n let input = '';\n const onData = (data: string) => {\n switch (data) {\n case '\\u000A': // \\n\n case '\\u000D': // \\r\n case '\\u0004': // Ctrl+D\n releaseStdin(onData);\n resolve(input);\n break;\n case '\\u0003': // Ctrl+C\n releaseStdin(onData);\n if (ctrlcExits) { // exit or raise error\n process.exit();\n } else {\n reject(new Error('Ctrl+C'));\n }\n break;\n case '\\u0008': // Backspace\n case '\\u007F': // Delete\n input = input.slice(0, -1);\n if (!hidden) {\n stdout.write('\\b \\b');\n }\n break;\n default: // any other\n input += data;\n if (!hidden) {\n stdout.write(data);\n }\n };\n };\n captureStdin(onData);\n stdout.write(question);\n })\n);\n"],
|
|
5
|
+
"mappings": ";;;AAAA,iBAAuB;AACvB,gBAAwD;;;ACCxD,IAAM,QAAQ,QAAQ;AACtB,IAAM,S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ClB;AAEA,QAAM,OAAO,MAAM,KAAK,KAAK;AAC7B,MAAI;AACJ,MAAI,aAAa;AAEjB,MAAI;AACA,eAAW,KAAK,MAAM,IAAI;AAAA,EAC9B,SAAS,OAAO;AACZ,YAAQ,IAAI,qCAAqC,KAAK;AACtD,YAAQ,IAAI,kBAAkB,IAAI;AAClC,YAAQ,KAAK,CAAC;AAAA,EAClB;AAGA,QAAM,eAAe;AACrB,UAAI,sBAAW,YAAY,GAAG;AAC1B,UAAM,iBAAiB,KAAK,UAAM,wBAAa,YAAY,EAAE,SAAS,CAAC;AACvE,QAAI,kBAAkB;AAEtB,QAAI,QAAQ,UAAU,GAAG;AACrB,qBAAe,QAAQ;AACvB,wBAAkB;AAClB,cAAQ,IAAI,WAAW,cAAc,eAAe,KAAK;AAAA,IAC7D;AAEA,QAAI,SAAS,YAAY,SAAS,SAAS,UAAU;AACjD,qBAAe,WAAW,SAAS,SAAS;AAC5C,wBAAkB;AAClB,mBAAa;AAAA,IACjB;AAEA,QAAI,iBAAiB;AACjB,mCAAc,cAAc,KAAK,UAAU,gBAAgB,MAAM,CAAC,GAAG,OAAO;AAAA,IAChF;AAAA,EACJ;AAEA,UAAQ,IAAI,iBAAa,qBAAQ,UAAU,EAAE,OAAO,IAAI,QAAQ,KAAK,CAAC,CAAC;AACvE,UAAQ,IAAI;AACZ,MAAI;AACA,YAAQ,IAAI,UAAU;AAC1B,UAAQ,IAAI,yBAAyB;AAErC,MAAI,WAAW;AACnB,GAAG;",
|
|
6
|
+
"names": ["loadEnv", "app", "body"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hailer/app-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "SDK for building Hailer Apps",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -16,15 +16,23 @@
|
|
|
16
16
|
"watch": "concurrently --kill-others \"npm run watch-tsc\" \"npm run watch-esbuild\"",
|
|
17
17
|
"watch-tsc": "tsc --watch",
|
|
18
18
|
"watch-esbuild": "esbuild src/index.ts --bundle --format=esm --sourcemap --outfile=lib/app-sdk.js --watch",
|
|
19
|
-
"docs": "typedoc --entryPointStrategy expand ./src && open-cli ./docs/index.html"
|
|
19
|
+
"docs": "typedoc --entryPointStrategy expand ./src && open-cli ./docs/index.html",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"release:patch": "npm test && npm version patch -m 'chore: release v%s' && git push && git push --tags",
|
|
23
|
+
"release:minor": "npm test && npm version minor -m 'chore: release v%s' && git push && git push --tags",
|
|
24
|
+
"release:major": "npm test && npm version major -m 'chore: release v%s' && git push && git push --tags",
|
|
25
|
+
"release:beta-patch": "npm test && npm version prerelease --preid=beta -m 'chore: release v%s' && git push && git push --tags",
|
|
26
|
+
"release:beta-minor": "npm test && npm version preminor --preid=beta -m 'chore: release v%s' && git push && git push --tags",
|
|
27
|
+
"release:beta-major": "npm test && npm version premajor --preid=beta -m 'chore: release v%s' && git push && git push --tags"
|
|
20
28
|
},
|
|
21
29
|
"dependencies": {
|
|
22
30
|
"@hailer/cli": "1.2.0",
|
|
23
|
-
"@wishcore/wish-rpc": "0.6.11"
|
|
31
|
+
"@wishcore/wish-rpc": "0.6.11",
|
|
32
|
+
"dotenv": "^17.4.1"
|
|
24
33
|
},
|
|
25
34
|
"devDependencies": {
|
|
26
|
-
"@types/node": "^
|
|
27
|
-
|
|
35
|
+
"@types/node": "^22.19.17",
|
|
28
36
|
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
|
29
37
|
"@typescript-eslint/parser": "^5.60.0",
|
|
30
38
|
"concurrently": "8.2.1",
|
|
@@ -32,6 +40,7 @@
|
|
|
32
40
|
"eslint": "^8.43.0",
|
|
33
41
|
"open-cli": "^9.0.0",
|
|
34
42
|
"typedoc": "^0.24.8",
|
|
35
|
-
"typescript": "^5.1.3"
|
|
43
|
+
"typescript": "^5.1.3",
|
|
44
|
+
"vitest": "^4.1.4"
|
|
36
45
|
}
|
|
37
46
|
}
|