@optima-chat/browser-cli 0.4.0 → 0.5.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.
Files changed (2) hide show
  1. package/dist/index.js +6 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -331,10 +331,12 @@ var BrowserAPI = class {
331
331
  async deleteScript(name) {
332
332
  await request(`/api/scripts/${encodeURIComponent(name)}`, { method: "DELETE" });
333
333
  }
334
- async runScript(scriptName, params = {}) {
334
+ async runScript(scriptName, params = {}, profileId) {
335
+ const payload = { params };
336
+ if (profileId) payload.profile_id = profileId;
335
337
  return request(`/api/scripts/${encodeURIComponent(scriptName)}/run`, {
336
338
  method: "POST",
337
- body: JSON.stringify({ params })
339
+ body: JSON.stringify(payload)
338
340
  });
339
341
  }
340
342
  async getScriptTask(taskId) {
@@ -1132,7 +1134,7 @@ function registerScriptCommands(program2) {
1132
1134
  process.exit(1);
1133
1135
  }
1134
1136
  });
1135
- program2.command("runscript").argument("<name>", "Script name").description("Run a script (polls until complete)").option("--param <params...>", "Parameters as key=value").option("--no-poll", "Return immediately without polling").action(async (name, opts) => {
1137
+ program2.command("runscript").argument("<name>", "Script name").description("Run a script (polls until complete)").option("--param <params...>", "Parameters as key=value").option("--profile <id>", "Use a named browser profile").option("--no-poll", "Return immediately without polling").action(async (name, opts) => {
1136
1138
  try {
1137
1139
  const params = {};
1138
1140
  if (opts.param) {
@@ -1142,7 +1144,7 @@ function registerScriptCommands(program2) {
1142
1144
  }
1143
1145
  }
1144
1146
  clearSessionId();
1145
- const task = await api.runScript(name, params);
1147
+ const task = await api.runScript(name, params, opts.profile);
1146
1148
  console.log(`Script started (task: ${task.id})`);
1147
1149
  if (!opts.poll) {
1148
1150
  console.log(`Poll with: browser-cli script-task ${task.id}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/browser-cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {