@simplepush/cli 0.7.0 → 0.8.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/dist/main.mjs CHANGED
@@ -14,7 +14,7 @@ import { mkdir, stat, writeFile } from "node:fs/promises";
14
14
  import { connect, createConnection } from "node:net";
15
15
  import path, { basename, extname, join } from "node:path";
16
16
  //#region package.json
17
- var version = "0.7.0";
17
+ var version = "0.8.0";
18
18
  //#endregion
19
19
  //#region src/errors.ts
20
20
  /** No CLI session saved — `sp auth login` hasn't been run (or was logged out). */
@@ -2554,6 +2554,15 @@ const searchCommand = Command.make("search", {
2554
2554
  if (res.hits.length === 0 && args.format === "pretty") yield* ctx.out.info("no hits");
2555
2555
  }))).pipe(Command.withDescription("Ranked full-text and location search over everything this credential reads, across all time. Words match literally plus stemmed in the org's configured languages; --near/--radius or --within search by place instead of or on top of words."));
2556
2556
  //#endregion
2557
+ //#region src/commands/priority-options.ts
2558
+ const priorityOption = Options.integer("priority").pipe(Options.withDescription("How loudly the push interrupts, 1 (minimal: silent, no banner) to 5 (critical: sounds even on a muted phone). Default 3. 4 and 5 get through Do Not Disturb / Focus."), Options.filterMap((n) => n >= 1 && n <= 5 ? Option.some(n) : Option.none(), "--priority must be between 1 and 5"), Options.optional);
2559
+ const criticalVolumeOption = Options.float("critical-volume").pipe(Options.withDescription("Volume of the iOS critical alert sound, greater than 0 and at most 1 (default 1). Only with --priority 5."), Options.filterMap((v) => v > 0 && v <= 1 ? Option.some(v) : Option.none(), "--critical-volume must be greater than 0 and at most 1"), Options.optional);
2560
+ /** The SDK option fields for the two flags; absent flags produce no keys. */
2561
+ const priorityFields = (priority, criticalVolume) => ({
2562
+ ...Option.isSome(priority) ? { priority: priority.value } : {},
2563
+ ...Option.isSome(criticalVolume) ? { criticalVolume: criticalVolume.value } : {}
2564
+ });
2565
+ //#endregion
2557
2566
  //#region src/input-spec.ts
2558
2567
  const SETTING_RE = /^[A-Za-z_][A-Za-z0-9_]*=/;
2559
2568
  function looksLikeSetting(seg) {
@@ -2963,6 +2972,8 @@ const notifyCommand = Command.make("notify", {
2963
2972
  "choice-input": choiceInputOption,
2964
2973
  "action-input": actionInputOption,
2965
2974
  shared: sharedOption$1,
2975
+ priority: priorityOption,
2976
+ "critical-volume": criticalVolumeOption,
2966
2977
  format: formatOption$2,
2967
2978
  noEncrypt: noEncryptOption$2,
2968
2979
  topic: topicOption$1,
@@ -3015,7 +3026,8 @@ const notifyCommand = Command.make("notify", {
3015
3026
  ...input !== void 0 ? { input } : {},
3016
3027
  ...imageUrl !== void 0 ? { image: imageUrl } : {},
3017
3028
  ...audioUrl !== void 0 ? { audio: audioUrl } : {},
3018
- ...linkUrl !== void 0 ? { link: linkUrl } : {}
3029
+ ...linkUrl !== void 0 ? { link: linkUrl } : {},
3030
+ ...priorityFields(args.priority, args["critical-volume"])
3019
3031
  };
3020
3032
  yield* Effect.scoped(Effect.gen(function* () {
3021
3033
  const client = yield* acquireOrgClient({
@@ -3076,7 +3088,8 @@ const notifyCommand = Command.make("notify", {
3076
3088
  ...input !== void 0 ? { input } : {},
3077
3089
  ...imageUrl !== void 0 ? { image: imageUrl } : {},
3078
3090
  ...audioUrl !== void 0 ? { audio: audioUrl } : {},
3079
- ...linkUrl !== void 0 ? { link: linkUrl } : {}
3091
+ ...linkUrl !== void 0 ? { link: linkUrl } : {},
3092
+ ...priorityFields(args.priority, args["critical-volume"])
3080
3093
  };
3081
3094
  yield* Effect.scoped(Effect.gen(function* () {
3082
3095
  const client = yield* acquireClient({
@@ -3880,6 +3893,8 @@ const taskCommand = Command.make("task", {
3880
3893
  "org-topic": orgTopicOption,
3881
3894
  "no-encrypt": noEncryptOption$1,
3882
3895
  markdown: markdownOption$1,
3896
+ priority: priorityOption,
3897
+ "critical-volume": criticalVolumeOption,
3883
3898
  shared: sharedOption,
3884
3899
  expires: expiresOption,
3885
3900
  format: formatOption$1,
@@ -3926,6 +3941,7 @@ const taskCommand = Command.make("task", {
3926
3941
  autoCommit: args["auto-commit"],
3927
3942
  reply: Option.getOrUndefined(args.reply),
3928
3943
  markdown: args.markdown,
3944
+ ...priorityFields(args.priority, args["critical-volume"]),
3929
3945
  noEncrypt: args["no-encrypt"],
3930
3946
  wait: args.wait,
3931
3947
  shared: args.shared,
@@ -3953,6 +3969,7 @@ const taskCommand = Command.make("task", {
3953
3969
  autoCommit: args["auto-commit"],
3954
3970
  ...Option.isSome(args.reply) ? { reply: args.reply.value } : {},
3955
3971
  ...args.markdown ? { contentFormat: "markdown" } : {},
3972
+ ...priorityFields(args.priority, args["critical-volume"]),
3956
3973
  ...expiresAt !== void 0 ? { expiresAt } : {}
3957
3974
  };
3958
3975
  if (topic === void 0) {
@@ -4076,6 +4093,8 @@ const sendOrgTask = (params) => Effect.gen(function* () {
4076
4093
  autoCommit: params.autoCommit,
4077
4094
  ...params.reply !== void 0 ? { reply: params.reply } : {},
4078
4095
  ...params.markdown ? { contentFormat: "markdown" } : {},
4096
+ ...params.priority !== void 0 ? { priority: params.priority } : {},
4097
+ ...params.criticalVolume !== void 0 ? { criticalVolume: params.criticalVolume } : {},
4079
4098
  ...params.expiresAt !== void 0 ? { expiresAt: params.expiresAt } : {}
4080
4099
  };
4081
4100
  const orgMasterKeys = vault ? [vault.masterKeyCurrent, ...vault.masterKeyHistory].map((k) => ({
@@ -4187,6 +4206,8 @@ const subtaskCommand = Command.make("subtask", {
4187
4206
  format: formatOption,
4188
4207
  reply: replyOption,
4189
4208
  markdown: markdownOption,
4209
+ priority: priorityOption,
4210
+ "critical-volume": criticalVolumeOption,
4190
4211
  "no-encrypt": noEncryptOption,
4191
4212
  instance: instanceOption,
4192
4213
  topic: topicOption$1,
@@ -4214,7 +4235,8 @@ const subtaskCommand = Command.make("subtask", {
4214
4235
  links: [...args.link],
4215
4236
  autoCommit: args["auto-commit"],
4216
4237
  ...Option.isSome(args.reply) ? { reply: args.reply.value } : {},
4217
- ...args.markdown ? { contentFormat: "markdown" } : {}
4238
+ ...args.markdown ? { contentFormat: "markdown" } : {},
4239
+ ...priorityFields(args.priority, args["critical-volume"])
4218
4240
  };
4219
4241
  const instances = args.instance.length > 0 ? [...args.instance] : void 0;
4220
4242
  const apiToken = Option.getOrUndefined(args["api-token"]);