@blinkdotnew/cli 0.1.4 → 0.1.6

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/dist/cli.js CHANGED
@@ -869,29 +869,32 @@ Examples:
869
869
  $ blink notify email user@example.com "Newsletter" --file ./email.html
870
870
  $ blink notify email proj_xxx user@example.com "Subject" "Body"
871
871
  `);
872
- notify.command("email [project] <to> <subject> [body]").description("Send an email via your project's notification settings").option("--file <path>", "Read email body from an HTML file instead of inline body").addHelpText("after", `
872
+ notify.command("email <arg1> [arg2] [arg3] [arg4]").description("Send an email via your project's notification settings").option("--file <path>", "Read email body from an HTML file instead of inline body").addHelpText("after", `
873
873
  Examples:
874
874
  $ blink notify email user@example.com "Welcome!" "Thanks for signing up."
875
875
  $ blink notify email user@example.com "Your report is ready" --file ./report.html
876
876
  $ blink notify email proj_xxx user@example.com "Order confirmed" "Your order #42 is ready."
877
877
 
878
878
  The email is sent from your project's configured sender address (set in blink.new project settings).
879
- `).action(async (projectArg, toArg, subjectArg, bodyArg, opts) => {
879
+ `).action(async (arg1, arg2, arg3, arg4, opts) => {
880
880
  requireToken();
881
881
  let projectId;
882
882
  let to;
883
883
  let subject;
884
884
  let body;
885
- if (projectArg.startsWith("proj_")) {
886
- projectId = requireProjectId(projectArg);
887
- to = toArg;
888
- subject = subjectArg;
889
- body = bodyArg ?? "";
885
+ if (arg1.startsWith("proj_") && arg2) {
886
+ projectId = requireProjectId(arg1);
887
+ to = arg2;
888
+ subject = arg3 ?? "";
889
+ body = arg4 ?? "";
890
+ } else if (arg1.startsWith("proj_")) {
891
+ process.stderr.write("error: missing required argument 'to'\n");
892
+ process.exit(1);
890
893
  } else {
891
894
  projectId = requireProjectId();
892
- to = projectArg;
893
- subject = toArg;
894
- body = subjectArg ?? bodyArg ?? "";
895
+ to = arg1;
896
+ subject = arg2 ?? "";
897
+ body = arg3 ?? arg4 ?? "";
895
898
  }
896
899
  if (opts.file) body = readFileSync7(opts.file, "utf-8");
897
900
  await withSpinner(
@@ -944,7 +947,7 @@ Examples:
944
947
  }
945
948
  const result = await withSpinner(
946
949
  `Executing ${provider}/${action}...`,
947
- () => resourcesRequest(`/api/v1/connectors/${provider}/execute`, {
950
+ () => resourcesRequest(`/v1/connectors/${provider}/execute`, {
948
951
  body: {
949
952
  method: action,
950
953
  http_method: opts.method,
@@ -1111,7 +1114,7 @@ Project resolution:
1111
1114
  program2.command("rollback [project] [deployment_id]").description("Rollback production to a previous deployment (use blink deployments to find IDs)").action(async (projectArg, deploymentIdArg) => {
1112
1115
  requireToken();
1113
1116
  const projectId = requireProjectId(projectArg?.startsWith("proj_") ? projectArg : void 0);
1114
- const deploymentId = deploymentIdArg ?? projectArg;
1117
+ const deploymentId = deploymentIdArg ?? (projectArg?.startsWith("proj_") ? void 0 : projectArg);
1115
1118
  const result = await withSpinner(
1116
1119
  "Rolling back...",
1117
1120
  () => appRequest(`/api/project/${projectId}/rollback`, { body: { deployment_id: deploymentId } })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Blink platform CLI — deploy apps, manage databases, generate AI content",
5
5
  "bin": {
6
6
  "blink": "dist/cli.js"
@@ -46,7 +46,7 @@ Examples:
46
46
  try { params = JSON.parse(paramsArg) } catch { params = {} }
47
47
  }
48
48
  const result = await withSpinner(`Executing ${provider}/${action}...`, () =>
49
- resourcesRequest(`/api/v1/connectors/${provider}/execute`, {
49
+ resourcesRequest(`/v1/connectors/${provider}/execute`, {
50
50
  body: {
51
51
  method: action,
52
52
  http_method: opts.method,
@@ -128,7 +128,7 @@ Project resolution:
128
128
  .action(async (projectArg: string | undefined, deploymentIdArg: string | undefined) => {
129
129
  requireToken()
130
130
  const projectId = requireProjectId(projectArg?.startsWith('proj_') ? projectArg : undefined)
131
- const deploymentId = deploymentIdArg ?? projectArg
131
+ const deploymentId = deploymentIdArg ?? (projectArg?.startsWith('proj_') ? undefined : projectArg)
132
132
  const result = await withSpinner('Rolling back...', () =>
133
133
  appRequest(`/api/project/${projectId}/rollback`, { body: { deployment_id: deploymentId } })
134
134
  )
@@ -15,7 +15,7 @@ Examples:
15
15
  $ blink notify email proj_xxx user@example.com "Subject" "Body"
16
16
  `)
17
17
 
18
- notify.command('email [project] <to> <subject> [body]')
18
+ notify.command('email <arg1> [arg2] [arg3] [arg4]')
19
19
  .description('Send an email via your project\'s notification settings')
20
20
  .option('--file <path>', 'Read email body from an HTML file instead of inline body')
21
21
  .addHelpText('after', `
@@ -26,23 +26,26 @@ Examples:
26
26
 
27
27
  The email is sent from your project's configured sender address (set in blink.new project settings).
28
28
  `)
29
- .action(async (projectArg: string, toArg: string, subjectArg: string, bodyArg: string | undefined, opts) => {
29
+ .action(async (arg1: string, arg2: string | undefined, arg3: string | undefined, arg4: string | undefined, opts) => {
30
30
  requireToken()
31
31
  let projectId: string
32
32
  let to: string
33
33
  let subject: string
34
34
  let body: string
35
35
 
36
- if (projectArg.startsWith('proj_')) {
37
- projectId = requireProjectId(projectArg)
38
- to = toArg
39
- subject = subjectArg
40
- body = bodyArg ?? ''
36
+ if (arg1.startsWith('proj_') && arg2) {
37
+ projectId = requireProjectId(arg1)
38
+ to = arg2
39
+ subject = arg3 ?? ''
40
+ body = arg4 ?? ''
41
+ } else if (arg1.startsWith('proj_')) {
42
+ process.stderr.write('error: missing required argument \'to\'\n')
43
+ process.exit(1)
41
44
  } else {
42
45
  projectId = requireProjectId()
43
- to = projectArg
44
- subject = toArg
45
- body = subjectArg ?? bodyArg ?? ''
46
+ to = arg1
47
+ subject = arg2 ?? ''
48
+ body = arg3 ?? arg4 ?? ''
46
49
  }
47
50
 
48
51
  if (opts.file) body = readFileSync(opts.file, 'utf-8')