@simplepush/cli 0.5.0 → 0.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/dist/main.mjs +9 -3
- package/dist/main.mjs.map +1 -1
- package/package.json +2 -2
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.
|
|
17
|
+
var version = "0.6.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). */
|
|
@@ -2883,6 +2883,7 @@ const broadcastOption$1 = Options.boolean("broadcast").pipe(Options.withAlias("b
|
|
|
2883
2883
|
const orgTopicOption$1 = Options.text("org-topic").pipe(Options.withAlias("o"), Options.withDescription("Send to an org topic by value (from `sp org topics list`). Org send; mutually exclusive with --member, --broadcast, and -k/--topic (the personal topic)."), Options.optional);
|
|
2884
2884
|
const tagOption$1 = Options.text("tag").pipe(Options.withDescription("Optional notification tag — recipients can use it to coalesce / replace prior notifications with the same tag."), Options.optional);
|
|
2885
2885
|
const imageOption = Options.text("image").pipe(Options.withDescription("Image URL to show in the push (PNG/JPEG/GIF). Renders on iOS + Android. Mutually exclusive with --audio. URLs only — file uploads are SDK-only."), Options.optional);
|
|
2886
|
+
const linkOption$2 = Options.text("link").pipe(Options.withAlias("l"), Options.withDescription("A URL shown as an \"Open link\" button on the push. Any scheme: https opens the browser, an app's deep link (unifi-protect://...) opens that app. Mutually exclusive with the input flags."), Options.optional);
|
|
2886
2887
|
const audioOption = Options.text("audio").pipe(Options.withDescription("Audio URL to play inline in the push (AIFF/WAV/MP3/M4A; iOS only). Mutually exclusive with --image. URLs only."), Options.optional);
|
|
2887
2888
|
const noEncryptOption$2 = Options.boolean("no-encrypt").pipe(Options.withDescription("Send the body in plaintext even when an unlocked vault is available."));
|
|
2888
2889
|
const actionInputOption = Options.text("action-input").pipe(Options.withAlias("a"), Options.withDescription("Add an actions input: tap-buttons the recipient answers with (e.g. Accept/Deny). Format: `[description;]key=Label[:style],...`, actions comma-separated; style is default|destructive. Use `\\,` for a literal comma in a label. A notification carries at most one input."), Options.optional);
|
|
@@ -2932,6 +2933,7 @@ const notifyCommand = Command.make("notify", {
|
|
|
2932
2933
|
tag: tagOption$1,
|
|
2933
2934
|
image: imageOption,
|
|
2934
2935
|
audio: audioOption,
|
|
2936
|
+
link: linkOption$2,
|
|
2935
2937
|
"text-input": textInputOption,
|
|
2936
2938
|
"choice-input": choiceInputOption,
|
|
2937
2939
|
"action-input": actionInputOption,
|
|
@@ -2961,6 +2963,7 @@ const notifyCommand = Command.make("notify", {
|
|
|
2961
2963
|
const message = args.content;
|
|
2962
2964
|
const imageUrl = Option.getOrUndefined(args.image);
|
|
2963
2965
|
const audioUrl = Option.getOrUndefined(args.audio);
|
|
2966
|
+
const linkUrl = Option.getOrUndefined(args.link);
|
|
2964
2967
|
if (imageUrl !== void 0 && audioUrl !== void 0) return yield* Effect.fail(new UserError({ message: "only one of --image or --audio may be set" }));
|
|
2965
2968
|
const mediaUrl = imageUrl ?? audioUrl;
|
|
2966
2969
|
const mediaKind = imageUrl !== void 0 ? "image" : "audio";
|
|
@@ -2969,6 +2972,7 @@ const notifyCommand = Command.make("notify", {
|
|
|
2969
2972
|
if (notifyMediaContentType(mediaUrl, mediaKind) === null) return yield* Effect.fail(new UserError({ message: `--${mediaKind} URL must point to a supported ${mediaKind} type (by extension); got "${mediaUrl}"` }));
|
|
2970
2973
|
}
|
|
2971
2974
|
const input = yield* parseNotificationInput(args["text-input"], Option.getOrUndefined(args["choice-input"]), Option.getOrUndefined(args["action-input"]));
|
|
2975
|
+
if (input !== void 0 && linkUrl !== void 0) return yield* Effect.fail(new UserError({ message: "a notification carries either an input or --link, not both: the input's buttons take the action slots, so the link would never be shown" }));
|
|
2972
2976
|
if (isOrgTarget) {
|
|
2973
2977
|
const api = yield* Api;
|
|
2974
2978
|
const vault = yield* (yield* VaultAccess).forSendOrPlaintext(args.noEncrypt);
|
|
@@ -2985,7 +2989,8 @@ const notifyCommand = Command.make("notify", {
|
|
|
2985
2989
|
...tagOpt !== void 0 ? { tag: tagOpt } : {},
|
|
2986
2990
|
...input !== void 0 ? { input } : {},
|
|
2987
2991
|
...imageUrl !== void 0 ? { image: imageUrl } : {},
|
|
2988
|
-
...audioUrl !== void 0 ? { audio: audioUrl } : {}
|
|
2992
|
+
...audioUrl !== void 0 ? { audio: audioUrl } : {},
|
|
2993
|
+
...linkUrl !== void 0 ? { link: linkUrl } : {}
|
|
2989
2994
|
};
|
|
2990
2995
|
yield* Effect.scoped(Effect.gen(function* () {
|
|
2991
2996
|
const client = yield* acquireOrgClient({
|
|
@@ -3045,7 +3050,8 @@ const notifyCommand = Command.make("notify", {
|
|
|
3045
3050
|
...tagOpt !== void 0 ? { tag: tagOpt } : {},
|
|
3046
3051
|
...input !== void 0 ? { input } : {},
|
|
3047
3052
|
...imageUrl !== void 0 ? { image: imageUrl } : {},
|
|
3048
|
-
...audioUrl !== void 0 ? { audio: audioUrl } : {}
|
|
3053
|
+
...audioUrl !== void 0 ? { audio: audioUrl } : {},
|
|
3054
|
+
...linkUrl !== void 0 ? { link: linkUrl } : {}
|
|
3049
3055
|
};
|
|
3050
3056
|
yield* Effect.scoped(Effect.gen(function* () {
|
|
3051
3057
|
const client = yield* acquireClient({
|