@hailer/app-sdk 2.0.0-beta-20 → 2.0.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 +206 -91
- package/lib/tools/publish.cjs.map +3 -3
- package/package.json +13 -5
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,256 @@ 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
|
+
function getArgValue(flag) {
|
|
66
|
+
const index = process.argv.indexOf(flag);
|
|
67
|
+
if (index === -1 || index + 1 >= process.argv.length) return void 0;
|
|
68
|
+
return process.argv[index + 1];
|
|
69
|
+
}
|
|
70
|
+
function hasFlag(flag) {
|
|
71
|
+
return process.argv.includes(flag);
|
|
72
|
+
}
|
|
73
|
+
var userApiKey = getArgValue("--user-api-key") || process.env.USER_API_KEY;
|
|
74
|
+
var email = getArgValue("--email") || process.env.EMAIL;
|
|
75
|
+
if (!userApiKey && !email && !process.env.LOCAL) {
|
|
76
|
+
console.log("Please provide authentication: --email, --user-api-key, or EMAIL env var.");
|
|
61
77
|
console.log("");
|
|
62
78
|
console.log("Usage:");
|
|
63
|
-
console.log("
|
|
79
|
+
console.log(" npm run publish-production -- --email user@mail.com (will prompt for password)");
|
|
80
|
+
console.log(" npm run publish-production -- --user-api-key <key>");
|
|
81
|
+
console.log(" EMAIL=user@mail.com npm run publish-production (going to be deprecated, use --email instead)");
|
|
82
|
+
console.log(" USER_API_KEY=<key> npm run publish-production (going to be deprecated, use --user-api-key instead)");
|
|
83
|
+
console.log("");
|
|
84
|
+
console.log("Create and publish new app:");
|
|
85
|
+
console.log(' npm run publish-production -- --create --app-name "My App" --workspace-id <id> --user-api-key <key> --yes');
|
|
86
|
+
console.log("");
|
|
87
|
+
console.log("Options:");
|
|
88
|
+
console.log(" --email <email> User email for authentication");
|
|
89
|
+
console.log(" --user-api-key <key> API key for authentication");
|
|
90
|
+
console.log(" --create Create a new app before publishing");
|
|
91
|
+
console.log(" --app-name <name> App name (with --create)");
|
|
92
|
+
console.log(" --workspace-id <id> Workspace ID (with --create)");
|
|
93
|
+
console.log(" --market Also publish to Hailer marketplace");
|
|
94
|
+
console.log(" --yes Skip confirmation prompt (going to be deprecated, use --force instead)");
|
|
95
|
+
console.log(" --force Skip confirmation prompt");
|
|
96
|
+
console.log(" --host <host> Specify the host URL");
|
|
64
97
|
process.exit(10);
|
|
65
98
|
}
|
|
66
99
|
(async () => {
|
|
67
|
-
let
|
|
68
|
-
|
|
69
|
-
const market = process.env.MARKET === "true";
|
|
100
|
+
let password;
|
|
101
|
+
const market = hasFlag("--market") || process.env.MARKET === "true";
|
|
70
102
|
const appPackageFile = process.argv[2];
|
|
71
|
-
const mode = process.argv
|
|
72
|
-
let host = process.env.HOST || "https://localhost:9443";
|
|
103
|
+
const mode = ["--development", "--staging", "--production", "--local"].find((m) => process.argv.includes(m));
|
|
104
|
+
let host = getArgValue("--host") || process.env.HOST || "https://localhost:9443";
|
|
73
105
|
switch (mode) {
|
|
74
106
|
case "--development":
|
|
75
|
-
host = process.env.HOST || "https://testapi.hailer.biz";
|
|
107
|
+
host = getArgValue("--host") || process.env.HOST || "https://testapi.hailer.biz";
|
|
76
108
|
break;
|
|
77
109
|
case "--staging":
|
|
78
|
-
host = process.env.HOST || "https://api.hailer.biz";
|
|
110
|
+
host = getArgValue("--host") || process.env.HOST || "https://api.hailer.biz";
|
|
79
111
|
break;
|
|
80
112
|
case "--production":
|
|
81
|
-
host = process.env.HOST || "https://api.hailer.com";
|
|
113
|
+
host = getArgValue("--host") || process.env.HOST || "https://api.hailer.com";
|
|
82
114
|
break;
|
|
83
115
|
}
|
|
84
116
|
if (process.env.LOCAL || mode === "--local") {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
117
|
+
host = getArgValue("--host") || process.env.HOST || "https://api.hailer.local.gd";
|
|
118
|
+
if (!userApiKey) {
|
|
119
|
+
console.log("Overriding credentials with local settings!");
|
|
120
|
+
email = "el@hailero.es";
|
|
121
|
+
password = "el@hailero.es";
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const isLocal = !!(process.env.LOCAL || mode === "--local");
|
|
125
|
+
if (isLocal) {
|
|
126
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
89
127
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
128
|
+
let cli;
|
|
129
|
+
if (userApiKey) {
|
|
130
|
+
cli = await import_cli.Client.create({ host, userApiKey, rejectUnauthorized: !isLocal }).catch(
|
|
131
|
+
(error) => {
|
|
132
|
+
console.log("Hailer Cli Error (API key auth):", error);
|
|
133
|
+
process.exit(8);
|
|
96
134
|
}
|
|
97
|
-
|
|
135
|
+
);
|
|
136
|
+
} else {
|
|
137
|
+
if (!password) {
|
|
138
|
+
password = await prompt("enter password for " + email + ": ");
|
|
98
139
|
}
|
|
99
|
-
|
|
140
|
+
cli = await import_cli.Client.create({ host, username: email, password, rejectUnauthorized: !isLocal }).catch(
|
|
141
|
+
(error) => {
|
|
142
|
+
if (error.msg === "Invalid Login Data") {
|
|
143
|
+
console.log("Invalid username or password when logging into Hailer.");
|
|
144
|
+
} else {
|
|
145
|
+
console.log("Hailer Cli Error:", error);
|
|
146
|
+
}
|
|
147
|
+
process.exit(8);
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
}
|
|
100
151
|
if (!appPackageFile?.endsWith(".tgz")) {
|
|
101
152
|
console.log("Failed getting .tgz file, found:", appPackageFile);
|
|
102
153
|
process.exit(7);
|
|
103
154
|
}
|
|
104
|
-
const manifest = JSON.parse((0, import_fs.readFileSync)("./dist/manifest.json").toString());
|
|
105
155
|
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);
|
|
156
|
+
let appId;
|
|
157
|
+
if (hasFlag("--create")) {
|
|
158
|
+
let appName = getArgValue("--app-name");
|
|
159
|
+
let workspaceId = getArgValue("--workspace-id");
|
|
160
|
+
if (!appName) {
|
|
161
|
+
appName = await prompt("App name: ", { hidden: false });
|
|
117
162
|
}
|
|
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
|
-
}
|
|
163
|
+
if (!workspaceId) {
|
|
164
|
+
workspaceId = await prompt("Workspace ID: ", { hidden: false });
|
|
126
165
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
console.log(
|
|
166
|
+
if (!appName) {
|
|
167
|
+
console.log("Error: --create requires --app-name <name>");
|
|
168
|
+
process.exit(11);
|
|
169
|
+
}
|
|
170
|
+
if (!workspaceId) {
|
|
171
|
+
console.log("Error: --create requires --workspace-id <id>");
|
|
172
|
+
process.exit(12);
|
|
173
|
+
}
|
|
174
|
+
console.log("Creating new app...");
|
|
175
|
+
console.log(" Name:", appName);
|
|
176
|
+
console.log(" Workspace:", workspaceId);
|
|
177
|
+
console.log(" Environment:", host);
|
|
178
|
+
console.log();
|
|
179
|
+
const appDoc = await cli.request("v3.app.create", [{
|
|
180
|
+
name: appName,
|
|
181
|
+
cid: workspaceId
|
|
182
|
+
}]).catch((error) => {
|
|
183
|
+
console.log("Failed to create app:", error);
|
|
184
|
+
process.exit(13);
|
|
185
|
+
});
|
|
186
|
+
appId = appDoc._id;
|
|
187
|
+
console.log("App created with id:", appId);
|
|
188
|
+
console.log();
|
|
140
189
|
} else {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
190
|
+
const manifest = JSON.parse((0, import_fs.readFileSync)("./dist/manifest.json").toString());
|
|
191
|
+
if (market) {
|
|
192
|
+
if (!manifest.version) {
|
|
193
|
+
manifest.version = "";
|
|
194
|
+
manifest.versionDescription = "";
|
|
195
|
+
const updatedManifestContent = JSON.stringify(manifest, null, 2);
|
|
196
|
+
(0, import_fs.writeFileSync)("./public/manifest.json", updatedManifestContent, "utf-8");
|
|
197
|
+
console.log("");
|
|
198
|
+
console.log("Please set version & versionDescription in file public/manifest.json! You have added MARKET=true in your publish string.");
|
|
199
|
+
console.log("");
|
|
200
|
+
process.exit(10);
|
|
201
|
+
}
|
|
151
202
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
} else {
|
|
160
|
-
resolve(true);
|
|
203
|
+
const info = await cli.request("v2.core.init", [["network", "networks", "apps"]]);
|
|
204
|
+
const getAppById = (manifestAppId) => {
|
|
205
|
+
for (const appMap of Object.values(info.apps)) {
|
|
206
|
+
for (const [id, app2] of Object.entries(appMap)) {
|
|
207
|
+
if (id === manifestAppId) {
|
|
208
|
+
return app2;
|
|
209
|
+
}
|
|
161
210
|
}
|
|
162
|
-
|
|
211
|
+
}
|
|
212
|
+
return null;
|
|
213
|
+
};
|
|
214
|
+
const app = getAppById(manifest.appId);
|
|
215
|
+
if (!app) {
|
|
216
|
+
const authInfo = userApiKey ? "the provided API key" : email;
|
|
217
|
+
console.log("The app was not found using:", authInfo);
|
|
218
|
+
process.exit(2);
|
|
219
|
+
}
|
|
220
|
+
const personalApp = !app.cid;
|
|
221
|
+
console.log("Publishing App");
|
|
222
|
+
console.log(" Id:", manifest.appId);
|
|
223
|
+
console.log(" Name:", app.name);
|
|
224
|
+
if (personalApp) {
|
|
225
|
+
console.log(" Workspace: any (personal app)");
|
|
226
|
+
} else {
|
|
227
|
+
console.log(" Workspace:", info.networks[app.cid]?.name, "(" + app.cid + ")");
|
|
228
|
+
}
|
|
229
|
+
console.log(" Environment:", host);
|
|
230
|
+
console.log();
|
|
231
|
+
if (market) {
|
|
232
|
+
console.log(" Note: Also publishing app to Hailer market");
|
|
233
|
+
}
|
|
234
|
+
const promptOverwriteQuestion = async () => {
|
|
235
|
+
if (hasFlag("--yes") || hasFlag("--force")) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return new Promise((resolve) => {
|
|
239
|
+
const rl = (0, import_readline.createInterface)(process.stdin, process.stdout);
|
|
240
|
+
rl.setPrompt("Overwrite the app? (Y/n): ");
|
|
241
|
+
rl.prompt();
|
|
242
|
+
rl.on("line", (line) => {
|
|
243
|
+
if (line.trim().toLocaleLowerCase().startsWith("n")) {
|
|
244
|
+
resolve(false);
|
|
245
|
+
} else {
|
|
246
|
+
resolve(true);
|
|
247
|
+
}
|
|
248
|
+
rl.close();
|
|
249
|
+
});
|
|
163
250
|
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
251
|
+
};
|
|
252
|
+
const shouldOverwrite = await promptOverwriteQuestion();
|
|
253
|
+
if (!shouldOverwrite) {
|
|
254
|
+
console.log("Aborted publishing app.");
|
|
255
|
+
process.exit(0);
|
|
256
|
+
}
|
|
257
|
+
appId = manifest.appId;
|
|
170
258
|
}
|
|
171
259
|
const formData = new FormData();
|
|
172
260
|
formData.append("file", new Blob([content]), appPackageFile);
|
|
173
|
-
formData.append("appId",
|
|
261
|
+
formData.append("appId", appId);
|
|
174
262
|
formData.append("publishMarket", market.toString());
|
|
263
|
+
const headers = {};
|
|
264
|
+
if (cli.sessionKey) {
|
|
265
|
+
headers.hlrkey = cli.sessionKey;
|
|
266
|
+
} else if (cli.userApiKey) {
|
|
267
|
+
headers.hlrkey = cli.userApiKey;
|
|
268
|
+
}
|
|
175
269
|
const resp = await fetch(host + "/app/publish", {
|
|
176
270
|
method: "POST",
|
|
177
|
-
headers
|
|
271
|
+
headers,
|
|
178
272
|
body: formData
|
|
179
273
|
}).catch((error) => {
|
|
180
274
|
console.log("Publish error uploading file:", error);
|
|
181
275
|
process.exit(9);
|
|
182
276
|
});
|
|
277
|
+
if (!resp.ok) {
|
|
278
|
+
console.log("Publish failed with status:", resp.status, resp.statusText);
|
|
279
|
+
const body2 = await resp.text();
|
|
280
|
+
console.log("Response:", body2);
|
|
281
|
+
process.exit(9);
|
|
282
|
+
}
|
|
183
283
|
const body = await resp.text();
|
|
184
284
|
let response;
|
|
185
285
|
let infoMarket = "";
|
|
186
286
|
try {
|
|
187
287
|
response = JSON.parse(body);
|
|
288
|
+
} catch (error) {
|
|
289
|
+
console.log("Failed to parse publish response:", error);
|
|
290
|
+
console.log("Response body:", body);
|
|
291
|
+
process.exit(6);
|
|
292
|
+
}
|
|
293
|
+
const manifestPath = "./public/manifest.json";
|
|
294
|
+
if ((0, import_fs.existsSync)(manifestPath)) {
|
|
295
|
+
const publicManifest = JSON.parse((0, import_fs.readFileSync)(manifestPath).toString());
|
|
296
|
+
let manifestUpdated = false;
|
|
297
|
+
if (hasFlag("--create")) {
|
|
298
|
+
publicManifest.appId = appId;
|
|
299
|
+
manifestUpdated = true;
|
|
300
|
+
console.log("Updated", manifestPath, "with appId:", appId);
|
|
301
|
+
}
|
|
188
302
|
if (response.manifest && response.manifest.targetId) {
|
|
303
|
+
publicManifest.targetId = response.manifest.targetId;
|
|
304
|
+
manifestUpdated = true;
|
|
189
305
|
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
306
|
}
|
|
194
|
-
|
|
307
|
+
if (manifestUpdated) {
|
|
308
|
+
(0, import_fs.writeFileSync)(manifestPath, JSON.stringify(publicManifest, null, 2), "utf-8");
|
|
309
|
+
}
|
|
195
310
|
}
|
|
196
311
|
console.log("App info:", (0, import_util.inspect)(response, { depth: 10, colors: true }));
|
|
197
312
|
console.log();
|
|
198
|
-
|
|
199
|
-
|
|
313
|
+
if (infoMarket)
|
|
314
|
+
console.log(infoMarket);
|
|
200
315
|
console.log("Published successfully!");
|
|
201
316
|
cli.disconnect();
|
|
202
317
|
})();
|
|
@@ -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';\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;\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 <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 <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-id');\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 <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 & 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 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,SAAS,QAAQ;AAEvB,IAAM,eAAe,CAAC,WAAmC;AACrD,QAAM,YAAY,OAAO;AACzB,QAAM,WAAW,IAAI;AACrB,QAAM,GAAG,QAAQ,MAAM;AACvB,QAAM,OAAO;AACjB;AAEA,IAAM,eAAe,CAAC,WAAmC;AACrD,QAAM,MAAM;AACZ,QAAM,eAAe,QAAQ,MAAM;AACnC,QAAM,WAAW,KAAK;AACtB,SAAO,MAAM,IAAI;AACrB;AAEO,IAAM,SAAS,CAAC,UAAkB,EAAE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AI,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": ["app", "body"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hailer/app-sdk",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "SDK for building Hailer Apps",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -16,15 +16,22 @@
|
|
|
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
31
|
"@wishcore/wish-rpc": "0.6.11"
|
|
24
32
|
},
|
|
25
33
|
"devDependencies": {
|
|
26
|
-
"@types/node": "^
|
|
27
|
-
|
|
34
|
+
"@types/node": "^22.19.17",
|
|
28
35
|
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
|
29
36
|
"@typescript-eslint/parser": "^5.60.0",
|
|
30
37
|
"concurrently": "8.2.1",
|
|
@@ -32,6 +39,7 @@
|
|
|
32
39
|
"eslint": "^8.43.0",
|
|
33
40
|
"open-cli": "^9.0.0",
|
|
34
41
|
"typedoc": "^0.24.8",
|
|
35
|
-
"typescript": "^5.1.3"
|
|
42
|
+
"typescript": "^5.1.3",
|
|
43
|
+
"vitest": "^4.1.4"
|
|
36
44
|
}
|
|
37
45
|
}
|