@nanocollective/roster 0.1.0-beta.15 → 0.1.0-beta.16
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 +26 -12
- package/dist/worker/index.js +1 -1
- package/docs/hosting.md +2 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3603,7 +3603,7 @@ async function deployCommand(argv) {
|
|
|
3603
3603
|
` + (config.account_id ? ` account ${config.account_id}
|
|
3604
3604
|
` : "") + ` signs in the humans in org.yaml, with GitHub
|
|
3605
3605
|
` + (exists ? "" : ` writes ${ws.opsName}/${CONFIG} and ${ws.opsName}/${WORKFLOW}
|
|
3606
|
-
`) + (config.vars.GITHUB_CLIENT_ID ? "" : " asks for the portal's GitHub OAuth App (a three-field form)\n") + (
|
|
3606
|
+
`) + (config.vars.GITHUB_CLIENT_ID ? "" : " asks for the portal's GitHub OAuth App (a three-field form)\n") + (hasConnectorStore(config) ? "" : " binds a KV namespace for connectors that sign in, such as Notion\n") + ` deploys with ${WRANGLER}, as whoever wrangler is signed in as
|
|
3607
3607
|
|
|
3608
3608
|
`
|
|
3609
3609
|
);
|
|
@@ -3639,9 +3639,9 @@ async function deployCommand(argv) {
|
|
|
3639
3639
|
assets: { ...config.assets, directory: bundle.assets }
|
|
3640
3640
|
};
|
|
3641
3641
|
writeFileSync5(join16(tmp, "wrangler.json"), JSON.stringify(full, null, 2));
|
|
3642
|
-
if (!
|
|
3643
|
-
process.stdout.write("
|
|
3644
|
-
const id = await
|
|
3642
|
+
if (!hasConnectorStore(config)) {
|
|
3643
|
+
process.stdout.write(" finding the KV namespace for signed-in connectors\u2026\n");
|
|
3644
|
+
const id = await namespaceFor(`${config.name}-connectors`, join16(tmp, "wrangler.json"));
|
|
3645
3645
|
if (id) {
|
|
3646
3646
|
config.kv_namespaces = [
|
|
3647
3647
|
...config.kv_namespaces ?? [],
|
|
@@ -3737,21 +3737,35 @@ function hasConnectorStore(config) {
|
|
|
3737
3737
|
(k) => k.binding === "CONNECTORS"
|
|
3738
3738
|
);
|
|
3739
3739
|
}
|
|
3740
|
-
async function
|
|
3741
|
-
const
|
|
3740
|
+
async function namespaceFor(title, configFile) {
|
|
3741
|
+
const listed = await captured(["kv", "namespace", "list", "--config", configFile]);
|
|
3742
|
+
if (listed.code === 0) {
|
|
3743
|
+
const found = existingNamespace(listed.text, title);
|
|
3744
|
+
if (found) return found;
|
|
3745
|
+
}
|
|
3746
|
+
const made = await captured(["kv", "namespace", "create", title, "--config", configFile]);
|
|
3747
|
+
return made.code === 0 ? namespaceId(made.text) : null;
|
|
3748
|
+
}
|
|
3749
|
+
function captured(args) {
|
|
3750
|
+
return new Promise((resolve7) => {
|
|
3742
3751
|
let text2 = "";
|
|
3743
|
-
const child = spawn(
|
|
3744
|
-
"
|
|
3745
|
-
|
|
3746
|
-
{ stdio: ["ignore", "pipe", "inherit"] }
|
|
3747
|
-
);
|
|
3752
|
+
const child = spawn("npx", ["--yes", WRANGLER, ...args], {
|
|
3753
|
+
stdio: ["ignore", "pipe", "inherit"]
|
|
3754
|
+
});
|
|
3748
3755
|
child.stdout.on("data", (b) => {
|
|
3749
3756
|
text2 += String(b);
|
|
3750
3757
|
});
|
|
3751
3758
|
child.on("close", (code) => resolve7({ code: code ?? 1, text: text2 }));
|
|
3752
3759
|
child.on("error", () => resolve7({ code: 1, text: text2 }));
|
|
3753
3760
|
});
|
|
3754
|
-
|
|
3761
|
+
}
|
|
3762
|
+
function existingNamespace(text2, title) {
|
|
3763
|
+
try {
|
|
3764
|
+
const list2 = JSON.parse(text2.slice(text2.indexOf("[")));
|
|
3765
|
+
return list2.find((n) => n.title === title)?.id ?? null;
|
|
3766
|
+
} catch {
|
|
3767
|
+
return null;
|
|
3768
|
+
}
|
|
3755
3769
|
}
|
|
3756
3770
|
function namespaceId(text2) {
|
|
3757
3771
|
return /\bid\b["']?\s*[:=]\s*["']([0-9a-f]{32})["']/.exec(text2)?.[1] ?? null;
|