@rlynicrisis/link 0.0.3 → 0.0.5
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 +51 -21
- package/package.json +5 -1
- package/src/link/message.js +1621 -0
- package/src/onboarding.ts +20 -17
package/src/onboarding.ts
CHANGED
|
@@ -16,12 +16,12 @@ export const linkOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
16
16
|
getStatus: async ({ cfg }) => {
|
|
17
17
|
const linkCfg = getLinkConfig(cfg);
|
|
18
18
|
const configured = Boolean(
|
|
19
|
-
linkCfg?.host && linkCfg?.
|
|
19
|
+
linkCfg?.host && linkCfg?.accessToken
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
const statusLines: string[] = [];
|
|
23
23
|
if (!configured) {
|
|
24
|
-
statusLines.push("Link: needs host
|
|
24
|
+
statusLines.push("Link: needs host and accessToken");
|
|
25
25
|
} else {
|
|
26
26
|
statusLines.push(`Link: configured (host: ${linkCfg?.host})`);
|
|
27
27
|
}
|
|
@@ -40,24 +40,14 @@ export const linkOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
40
40
|
const linkCfg = getLinkConfig(next) || {} as LinkConfig;
|
|
41
41
|
|
|
42
42
|
const host = await prompter.text({
|
|
43
|
-
message: "Link Server Host",
|
|
43
|
+
message: "Link Server Host (host:port)",
|
|
44
44
|
initialValue: linkCfg.host,
|
|
45
|
-
placeholder: "e.g. embtcpbeta.bingolink.biz",
|
|
45
|
+
placeholder: "e.g. embtcpbeta.bingolink.biz:20081",
|
|
46
46
|
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
initialValue: linkCfg.port ? String(linkCfg.port) : undefined,
|
|
52
|
-
placeholder: "e.g. 20081",
|
|
53
|
-
validate: (value) => {
|
|
54
|
-
if (!value?.trim()) return "Required";
|
|
55
|
-
const n = Number(value);
|
|
56
|
-
if (isNaN(n) || n <= 0) return "Must be a positive number";
|
|
57
|
-
return undefined;
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
const port = Number(portStr);
|
|
49
|
+
// Remove separate port prompt, as it is merged into host
|
|
50
|
+
// const portStr = ...
|
|
61
51
|
|
|
62
52
|
const accessToken = await prompter.text({
|
|
63
53
|
message: "User Access Token",
|
|
@@ -65,11 +55,24 @@ export const linkOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
65
55
|
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
66
56
|
});
|
|
67
57
|
|
|
58
|
+
const refreshToken = await prompter.text({
|
|
59
|
+
message: "Refresh Token (Optional)",
|
|
60
|
+
initialValue: linkCfg.refreshToken,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const ssoUrl = await prompter.text({
|
|
64
|
+
message: "SSO URL (Optional, for refresh)",
|
|
65
|
+
initialValue: linkCfg.ssoUrl,
|
|
66
|
+
placeholder: "e.g. https://sso.example.com",
|
|
67
|
+
});
|
|
68
|
+
|
|
68
69
|
const newLinkConfig: LinkConfig = {
|
|
69
70
|
...linkCfg,
|
|
70
71
|
host: String(host).trim(),
|
|
71
|
-
port
|
|
72
|
+
// port is now part of host string or handled internally
|
|
72
73
|
accessToken: String(accessToken).trim(),
|
|
74
|
+
refreshToken: refreshToken ? String(refreshToken).trim() : undefined,
|
|
75
|
+
ssoUrl: ssoUrl ? String(ssoUrl).trim() : undefined,
|
|
73
76
|
};
|
|
74
77
|
|
|
75
78
|
next = {
|