@hailer/app-sdk 2.4.2 → 2.6.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/README.md +122 -6
- package/lib/app-sdk.js +2 -2
- package/lib/app-sdk.js.map +3 -3
- package/lib/modules/file.d.ts +26 -0
- package/lib/modules/http.d.ts +11 -11
- package/lib/modules/metrics.d.ts +33 -33
- package/lib/modules/ui/discussion.d.ts +2 -2
- package/lib/tools/publish.cjs +29 -14
- package/lib/tools/publish.cjs.map +3 -3
- package/package.json +60 -43
package/lib/modules/file.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export interface FileResponse {
|
|
|
4
4
|
/** Base64-encoded file data */
|
|
5
5
|
data: string;
|
|
6
6
|
mimeType: string;
|
|
7
|
+
/** Free-form string tags attached to the file */
|
|
8
|
+
tags: string[];
|
|
7
9
|
}
|
|
8
10
|
export interface UploadOptions {
|
|
9
11
|
/** Whether the file should be publicly accessible */
|
|
@@ -34,5 +36,29 @@ export declare class FileApi {
|
|
|
34
36
|
* @throws {HailerError} if upload fails
|
|
35
37
|
*/
|
|
36
38
|
upload(file: File, filename: string, options?: UploadOptions): Promise<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Appends tags to a file, deduping against the existing list.
|
|
41
|
+
*
|
|
42
|
+
* Tags are case-sensitive free-form strings (trimmed, 1-64 characters, max 50 per file).
|
|
43
|
+
*
|
|
44
|
+
* @param fileId The ID of the file to tag
|
|
45
|
+
* @param tags Tags to add
|
|
46
|
+
*
|
|
47
|
+
* @returns The file's resulting tag list
|
|
48
|
+
*
|
|
49
|
+
* @throws {HailerError} if validation fails or the file cannot be edited
|
|
50
|
+
*/
|
|
51
|
+
addTags(fileId: string, tags: string[]): Promise<string[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Removes tags from a file by case-sensitive exact match. Tags not present are silently ignored.
|
|
54
|
+
*
|
|
55
|
+
* @param fileId The ID of the file to untag
|
|
56
|
+
* @param tags Tags to remove
|
|
57
|
+
*
|
|
58
|
+
* @returns The file's resulting tag list
|
|
59
|
+
*
|
|
60
|
+
* @throws {HailerError} if validation fails or the file cannot be edited
|
|
61
|
+
*/
|
|
62
|
+
removeTags(fileId: string, tags: string[]): Promise<string[]>;
|
|
37
63
|
private toBase64;
|
|
38
64
|
}
|
package/lib/modules/http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Client } from
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
2
|
export interface HTTPFetchOptions {
|
|
3
3
|
method?: string;
|
|
4
4
|
headers?: Record<string, string>;
|
|
@@ -46,19 +46,19 @@ export declare class HttpApi {
|
|
|
46
46
|
private client;
|
|
47
47
|
constructor(client: Client);
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
* Make an HTTP request through the parent frame.
|
|
50
|
+
* The parent's browser context sends the hlrkey cookie automatically.
|
|
51
|
+
*/
|
|
52
52
|
fetch(url: string, options?: HTTPFetchOptions): Promise<HTTPFetchResponse>;
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
* Upload files through the parent frame as multipart/form-data.
|
|
55
|
+
* Files are sent as base64 strings and reconstructed into FormData by the parent.
|
|
56
|
+
* The parent's browser context sends the hlrkey cookie automatically.
|
|
57
|
+
*/
|
|
58
58
|
upload(url: string, entries: HTTPUploadEntry[]): Promise<HTTPFetchResponse>;
|
|
59
59
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
* Open a WebSocket connection through the parent frame.
|
|
61
|
+
* Returns a HTTPWebSocket that mimics the native WebSocket API.
|
|
62
|
+
*/
|
|
63
63
|
openWebSocket(url: string): HTTPWebSocket;
|
|
64
64
|
}
|
package/lib/modules/metrics.d.ts
CHANGED
|
@@ -73,35 +73,35 @@ export declare class MetricsApi {
|
|
|
73
73
|
private client;
|
|
74
74
|
constructor(client: Client);
|
|
75
75
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
* Get list of available metrics for current user based on permissions
|
|
77
|
+
* @param options Optional filtering options
|
|
78
|
+
* @returns Array of metric IDs or detailed metric definitions
|
|
79
|
+
*/
|
|
80
80
|
list(options?: MetricListOptions): Promise<string[] | MetricDefinition[]>;
|
|
81
81
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
82
|
+
* Get metrics data with optional Query Builder
|
|
83
|
+
* @param metricTypes Single metric or array of metrics to fetch
|
|
84
|
+
* @param options Optional filtering, time range, and Query Builder options
|
|
85
|
+
* @returns Metric data with values and optional time series
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* // Simple query
|
|
89
|
+
* await api.metrics.get('hailer.activity.create', { workspaceId: 'abc123' });
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* // Query Builder: Top 10 users by activity
|
|
93
|
+
* await api.metrics.get('hailer.activity.create', {
|
|
94
|
+
* workspaceId: 'abc123',
|
|
95
|
+
* timeRange: { start: Date.now() - 86400000, end: Date.now() },
|
|
96
|
+
* aggregation: 'sum',
|
|
97
|
+
* groupBy: ['user'],
|
|
98
|
+
* topk: 10
|
|
99
|
+
* });
|
|
100
|
+
*/
|
|
101
101
|
get(metricTypes: string | string[], options?: MetricOptions): Promise<MetricData>;
|
|
102
102
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
* Admin endpoints for metrics management
|
|
104
|
+
*/
|
|
105
105
|
admin: {
|
|
106
106
|
/**
|
|
107
107
|
* Get list of workspaces for admin metrics filtering
|
|
@@ -118,14 +118,14 @@ export declare class MetricsApi {
|
|
|
118
118
|
*/
|
|
119
119
|
workspacesList: (options: WorkspaceMetricsListOptions) => Promise<WorkspaceMetricsListResult>;
|
|
120
120
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
* Get list of users for admin metrics filtering
|
|
122
|
+
* @param options Lookup by userIds array
|
|
123
|
+
* @returns List of users with _id, name, email
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* // Look up by user IDs
|
|
127
|
+
* await api.metrics.admin.usersList({ userIds: ['id1', 'id2'] });
|
|
128
|
+
*/
|
|
129
129
|
usersList: (options: UserMetricsListOptions) => Promise<UserMetricsListResult>;
|
|
130
130
|
};
|
|
131
131
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Client } from
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
2
|
/**
|
|
3
3
|
* Valid tab types for opening discussions.
|
|
4
4
|
* - Private discussions: "discussions" | "files" | "info" | "location"
|
|
5
5
|
* - Group discussions: "discussion" | "overview" | "files"
|
|
6
6
|
*/
|
|
7
|
-
export type DiscussionTabTypes =
|
|
7
|
+
export type DiscussionTabTypes = 'discussions' | 'files' | 'location' | 'info' | 'discussion' | 'overview' | 'detail' | 'participants' | 'linkedFrom' | 'options';
|
|
8
8
|
export declare class Discussion {
|
|
9
9
|
private client;
|
|
10
10
|
constructor(client: Client);
|
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, { hidden = true, ctrlcExits = true } = {}) => new Promise((
|
|
22
|
+
var prompt = (question, { hidden = true, ctrlcExits = true } = {}) => new Promise((resolve2, reject) => {
|
|
23
23
|
let input = "";
|
|
24
24
|
const onData = (data) => {
|
|
25
25
|
switch (data) {
|
|
@@ -29,7 +29,7 @@ var prompt = (question, { hidden = true, ctrlcExits = true } = {}) => new Promis
|
|
|
29
29
|
// \r
|
|
30
30
|
case "":
|
|
31
31
|
releaseStdin(onData);
|
|
32
|
-
|
|
32
|
+
resolve2(input);
|
|
33
33
|
break;
|
|
34
34
|
case "":
|
|
35
35
|
releaseStdin(onData);
|
|
@@ -65,15 +65,21 @@ var import_readline = require("readline");
|
|
|
65
65
|
var import_dotenv = require("dotenv");
|
|
66
66
|
var import_os = require("os");
|
|
67
67
|
var import_path = require("path");
|
|
68
|
-
(0, import_dotenv.config)({ path: (0, import_path.join)((0, import_os.homedir)(), ".env") });
|
|
69
68
|
function getArgValue(flag) {
|
|
70
69
|
const index = process.argv.indexOf(flag);
|
|
71
|
-
if (index === -1 || index + 1 >= process.argv.length)
|
|
70
|
+
if (index === -1 || index + 1 >= process.argv.length) {
|
|
71
|
+
return void 0;
|
|
72
|
+
}
|
|
72
73
|
return process.argv[index + 1];
|
|
73
74
|
}
|
|
74
75
|
function hasFlag(flag) {
|
|
75
76
|
return process.argv.includes(flag);
|
|
76
77
|
}
|
|
78
|
+
var customEnvPath = getArgValue("--env-file");
|
|
79
|
+
if (customEnvPath && (0, import_fs.existsSync)((0, import_path.resolve)(customEnvPath))) {
|
|
80
|
+
(0, import_dotenv.config)({ path: (0, import_path.resolve)(customEnvPath) });
|
|
81
|
+
}
|
|
82
|
+
(0, import_dotenv.config)({ path: (0, import_path.join)((0, import_os.homedir)(), ".env") });
|
|
77
83
|
var userApiKey = getArgValue("--user-api-key") || process.env.USER_API_KEY || process.env.HAILER_USER_API_KEY;
|
|
78
84
|
var email = getArgValue("--email") || process.env.EMAIL;
|
|
79
85
|
if (!userApiKey && !email && !process.env.LOCAL) {
|
|
@@ -98,6 +104,7 @@ if (!userApiKey && !email && !process.env.LOCAL) {
|
|
|
98
104
|
console.log(" --yes Skip confirmation prompt (going to be deprecated, use --force instead)");
|
|
99
105
|
console.log(" --force Skip confirmation prompt");
|
|
100
106
|
console.log(" --host <host> Specify the host URL");
|
|
107
|
+
console.log(" --env-file <path> Load env vars from this file, in addition to ~/.env");
|
|
101
108
|
process.exit(10);
|
|
102
109
|
}
|
|
103
110
|
(async () => {
|
|
@@ -139,7 +146,7 @@ if (!userApiKey && !email && !process.env.LOCAL) {
|
|
|
139
146
|
);
|
|
140
147
|
} else {
|
|
141
148
|
if (!password) {
|
|
142
|
-
password = await prompt(
|
|
149
|
+
password = await prompt(`enter password for ${email}: `);
|
|
143
150
|
}
|
|
144
151
|
cli = await import_cli.Client.create({ host, username: email, password, rejectUnauthorized: !isLocal }).catch(
|
|
145
152
|
(error) => {
|
|
@@ -204,7 +211,11 @@ if (!userApiKey && !email && !process.env.LOCAL) {
|
|
|
204
211
|
process.exit(10);
|
|
205
212
|
}
|
|
206
213
|
}
|
|
207
|
-
const info = await cli.request("v2.core.init", [["network", "networks", "apps"]])
|
|
214
|
+
const info = await cli.request("v2.core.init", [["network", "networks", "apps"]]).catch((error) => {
|
|
215
|
+
console.log("Failed to authenticate. Check that your API key is valid and has access to this app.");
|
|
216
|
+
console.log("Server response:", (0, import_util.inspect)(error, { depth: 10 }));
|
|
217
|
+
process.exit(8);
|
|
218
|
+
});
|
|
208
219
|
const getAppById = (manifestAppId) => {
|
|
209
220
|
for (const appMap of Object.values(info.apps)) {
|
|
210
221
|
for (const [id, app2] of Object.entries(appMap)) {
|
|
@@ -228,7 +239,7 @@ if (!userApiKey && !email && !process.env.LOCAL) {
|
|
|
228
239
|
if (personalApp) {
|
|
229
240
|
console.log(" Workspace: any (personal app)");
|
|
230
241
|
} else {
|
|
231
|
-
console.log(" Workspace:", info.networks[app.cid]?.name,
|
|
242
|
+
console.log(" Workspace:", info.networks[app.cid]?.name, `(${app.cid})`);
|
|
232
243
|
}
|
|
233
244
|
console.log(" Environment:", host);
|
|
234
245
|
console.log();
|
|
@@ -239,15 +250,15 @@ if (!userApiKey && !email && !process.env.LOCAL) {
|
|
|
239
250
|
if (hasFlag("--yes") || hasFlag("--force")) {
|
|
240
251
|
return true;
|
|
241
252
|
}
|
|
242
|
-
return new Promise((
|
|
253
|
+
return new Promise((resolve2) => {
|
|
243
254
|
const rl = (0, import_readline.createInterface)(process.stdin, process.stdout);
|
|
244
255
|
rl.setPrompt("Overwrite the app? (Y/n): ");
|
|
245
256
|
rl.prompt();
|
|
246
257
|
rl.on("line", (line) => {
|
|
247
258
|
if (line.trim().toLocaleLowerCase().startsWith("n")) {
|
|
248
|
-
|
|
259
|
+
resolve2(false);
|
|
249
260
|
} else {
|
|
250
|
-
|
|
261
|
+
resolve2(true);
|
|
251
262
|
}
|
|
252
263
|
rl.close();
|
|
253
264
|
});
|
|
@@ -270,7 +281,7 @@ if (!userApiKey && !email && !process.env.LOCAL) {
|
|
|
270
281
|
} else if (cli.userApiKey) {
|
|
271
282
|
headers.hlrkey = cli.userApiKey;
|
|
272
283
|
}
|
|
273
|
-
const resp = await fetch(host
|
|
284
|
+
const resp = await fetch(`${host}/app/publish`, {
|
|
274
285
|
method: "POST",
|
|
275
286
|
headers,
|
|
276
287
|
body: formData
|
|
@@ -303,7 +314,7 @@ if (!userApiKey && !email && !process.env.LOCAL) {
|
|
|
303
314
|
manifestUpdated = true;
|
|
304
315
|
console.log("Updated", manifestPath, "with appId:", appId);
|
|
305
316
|
}
|
|
306
|
-
if (response.manifest
|
|
317
|
+
if (response.manifest?.targetId) {
|
|
307
318
|
publicManifest.targetId = response.manifest.targetId;
|
|
308
319
|
manifestUpdated = true;
|
|
309
320
|
infoMarket = "Note! Use targetId in public/manifest.json file when creating the product in market!";
|
|
@@ -314,9 +325,13 @@ if (!userApiKey && !email && !process.env.LOCAL) {
|
|
|
314
325
|
}
|
|
315
326
|
console.log("App info:", (0, import_util.inspect)(response, { depth: 10, colors: true }));
|
|
316
327
|
console.log();
|
|
317
|
-
if (infoMarket)
|
|
328
|
+
if (infoMarket) {
|
|
318
329
|
console.log(infoMarket);
|
|
330
|
+
}
|
|
319
331
|
console.log("Published successfully!");
|
|
320
332
|
cli.disconnect();
|
|
321
|
-
})()
|
|
333
|
+
})().catch((error) => {
|
|
334
|
+
console.log("Publish failed:", (0, import_util.inspect)(error, { depth: 10 }));
|
|
335
|
+
process.exit(1);
|
|
336
|
+
});
|
|
322
337
|
//# sourceMappingURL=publish.cjs.map
|
|
@@ -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 { 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,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,SAAS,MAAM,aAAa,KAAK,IAAI,CAAC,MAC7E,IAAI,QAAQ,
|
|
6
|
-
"names": ["loadEnv", "app", "body"]
|
|
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, resolve } from 'path';\n\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) {\n return undefined;\n }\n return process.argv[index + 1];\n}\n\nfunction hasFlag(flag: string): boolean {\n return process.argv.includes(flag);\n}\n\n\n// Load env files dotenv never overwrites variables already set in the real environment and loading an earlier file means its values persist\nconst customEnvPath = getArgValue('--env-file');\nif (customEnvPath && existsSync(resolve(customEnvPath))) {\n loadEnv({ path: resolve(customEnvPath) });\n}\nloadEnv({ path: join(homedir(), '.env') });\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 console.log(' --env-file <path> Load env vars from this file, in addition to ~/.env');\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']]).catch((error: any) => {\n console.log('Failed to authenticate. Check that your API key is valid and has access to this app.');\n console.log('Server response:', inspect(error, { depth: 10 }));\n process.exit(8);\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 [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?.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 }\n console.log('Published successfully!');\n\n cli.disconnect();\n})().catch((error) => {\n console.log('Publish failed:', inspect(error, { depth: 10 }));\n process.exit(1);\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,SAAS,MAAM,aAAa,KAAK,IAAI,CAAC,MAC7E,IAAI,QAAQ,CAACA,UAAS,WAAW;AAC7B,MAAI,QAAQ;AACZ,QAAM,SAAS,CAAC,SAAiB;AAC7B,YAAQ,MAAM;AAAA,MACV,KAAK;AAAA;AAAA,MACL,KAAK;AAAA;AAAA,MACL,KAAK;AACD,qBAAa,MAAM;A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er Apps",
|
|
5
|
+
"author": "",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"main": "./lib/app-sdk.js",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"types": "./lib/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"./lib/**/*"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
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
|
+
"prepublishOnly": "npm run build",
|
|
16
|
+
"watch": "concurrently --kill-others \"npm run watch-tsc\" \"npm run watch-esbuild\"",
|
|
17
|
+
"watch-tsc": "tsc --watch",
|
|
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",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"lint": "eslint .",
|
|
23
|
+
"lint:fix": "eslint . --fix",
|
|
24
|
+
"format": "eslint . --fix",
|
|
25
|
+
"release:patch": "npm version patch -m 'chore: release v%s' && git push && git push --tags",
|
|
26
|
+
"release:minor": "npm version minor -m 'chore: release v%s' && git push && git push --tags",
|
|
27
|
+
"release:major": "npm version major -m 'chore: release v%s' && git push && git push --tags",
|
|
28
|
+
"release:beta-patch": "npm version prerelease --preid=beta -m 'chore: release v%s' && git push && git push --tags",
|
|
29
|
+
"release:beta-minor": "npm version preminor --preid=beta -m 'chore: release v%s' && git push && git push --tags",
|
|
30
|
+
"release:beta-major": "npm version premajor --preid=beta -m 'chore: release v%s' && git push && git push --tags",
|
|
31
|
+
"prepare": "husky"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@hailer/cli": "1.2.0",
|
|
35
|
+
"@wishcore/wish-rpc": "0.6.11",
|
|
36
|
+
"dotenv": "^17.4.1"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@eslint/js": "10.0.1",
|
|
40
|
+
"@hailer-repos/eslint-config": "1.14.0",
|
|
41
|
+
"@types/node": "^22.19.17",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
43
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
44
|
+
"concurrently": "8.2.1",
|
|
45
|
+
"esbuild": "^0.28.0",
|
|
46
|
+
"eslint": "^10.4.0",
|
|
47
|
+
"eslint-plugin-diff": "2.1.7",
|
|
48
|
+
"husky": "9.1.7",
|
|
49
|
+
"lint-staged": "17.0.5",
|
|
50
|
+
"open-cli": "^9.0.0",
|
|
51
|
+
"typedoc": "^0.24.8",
|
|
52
|
+
"typescript": "^5.1.3",
|
|
53
|
+
"vitest": "^4.1.4"
|
|
54
|
+
},
|
|
55
|
+
"lint-staged": {
|
|
56
|
+
"*.{ts,js}": [
|
|
57
|
+
"eslint --config eslint.config.staged.mjs --fix"
|
|
12
58
|
],
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"watch-tsc": "tsc --watch",
|
|
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",
|
|
20
|
-
"test": "vitest run",
|
|
21
|
-
"test:watch": "vitest",
|
|
22
|
-
"release:patch": "npm version patch -m 'chore: release v%s' && git push && git push --tags",
|
|
23
|
-
"release:minor": "npm version minor -m 'chore: release v%s' && git push && git push --tags",
|
|
24
|
-
"release:major": "npm version major -m 'chore: release v%s' && git push && git push --tags",
|
|
25
|
-
"release:beta-patch": "npm version prerelease --preid=beta -m 'chore: release v%s' && git push && git push --tags",
|
|
26
|
-
"release:beta-minor": "npm version preminor --preid=beta -m 'chore: release v%s' && git push && git push --tags",
|
|
27
|
-
"release:beta-major": "npm version premajor --preid=beta -m 'chore: release v%s' && git push && git push --tags"
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@hailer/cli": "1.2.0",
|
|
31
|
-
"@wishcore/wish-rpc": "0.6.11",
|
|
32
|
-
"dotenv": "^17.4.1"
|
|
33
|
-
},
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"@types/node": "^22.19.17",
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
|
37
|
-
"@typescript-eslint/parser": "^5.60.0",
|
|
38
|
-
"concurrently": "8.2.1",
|
|
39
|
-
"esbuild": "^0.28.0",
|
|
40
|
-
"eslint": "^8.43.0",
|
|
41
|
-
"open-cli": "^9.0.0",
|
|
42
|
-
"typedoc": "^0.24.8",
|
|
43
|
-
"typescript": "^5.1.3",
|
|
44
|
-
"vitest": "^4.1.4"
|
|
45
|
-
}
|
|
59
|
+
"*.json": [
|
|
60
|
+
"eslint --config eslint.config.staged.mjs --fix"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
46
63
|
}
|