@octonodes/cli 0.2.8 → 0.2.10
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 +41 -0
- package/dist/apps/build.d.ts +42 -0
- package/dist/apps/build.d.ts.map +1 -0
- package/dist/apps/build.js +198 -0
- package/dist/apps/build.js.map +1 -0
- package/dist/apps/cloudflared.d.ts +2 -0
- package/dist/apps/cloudflared.d.ts.map +1 -0
- package/dist/apps/cloudflared.js +64 -0
- package/dist/apps/cloudflared.js.map +1 -0
- package/dist/apps/constants.d.ts +5 -0
- package/dist/apps/constants.d.ts.map +1 -0
- package/dist/apps/constants.js +46 -0
- package/dist/apps/constants.js.map +1 -0
- package/dist/apps/create.d.ts +7 -0
- package/dist/apps/create.d.ts.map +1 -0
- package/dist/apps/create.js +225 -0
- package/dist/apps/create.js.map +1 -0
- package/dist/apps/dev.d.ts +26 -0
- package/dist/apps/dev.d.ts.map +1 -0
- package/dist/apps/dev.js +213 -0
- package/dist/apps/dev.js.map +1 -0
- package/dist/apps/development.d.ts +8 -0
- package/dist/apps/development.d.ts.map +1 -0
- package/dist/apps/development.js +80 -0
- package/dist/apps/development.js.map +1 -0
- package/dist/apps/index.d.ts +2 -0
- package/dist/apps/index.d.ts.map +1 -0
- package/dist/apps/index.js +84 -0
- package/dist/apps/index.js.map +1 -0
- package/dist/apps/preview.d.mts +2 -0
- package/dist/apps/preview.d.mts.map +1 -0
- package/dist/apps/preview.mjs +92 -0
- package/dist/apps/preview.mjs.map +1 -0
- package/dist/apps/publish.d.ts +8 -0
- package/dist/apps/publish.d.ts.map +1 -0
- package/dist/apps/publish.js +59 -0
- package/dist/apps/publish.js.map +1 -0
- package/dist/apps/server.d.ts +19 -0
- package/dist/apps/server.d.ts.map +1 -0
- package/dist/apps/server.js +191 -0
- package/dist/apps/server.js.map +1 -0
- package/dist/apps/source.d.ts +136 -0
- package/dist/apps/source.d.ts.map +1 -0
- package/dist/apps/source.js +88 -0
- package/dist/apps/source.js.map +1 -0
- package/dist/apps/tunnel.d.ts +7 -0
- package/dist/apps/tunnel.d.ts.map +1 -0
- package/dist/apps/tunnel.js +62 -0
- package/dist/apps/tunnel.js.map +1 -0
- package/dist/apps/types.d.ts +34 -0
- package/dist/apps/types.d.ts.map +1 -0
- package/dist/apps/types.js +3 -0
- package/dist/apps/types.js.map +1 -0
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/plugins/app.d.ts +5 -0
- package/dist/plugins/app.d.ts.map +1 -0
- package/dist/plugins/app.js +59 -0
- package/dist/plugins/app.js.map +1 -0
- package/dist/plugins/artifact.d.ts.map +1 -1
- package/dist/plugins/artifact.js +14 -0
- package/dist/plugins/artifact.js.map +1 -1
- package/dist/plugins/build.d.ts.map +1 -1
- package/dist/plugins/build.js +6 -0
- package/dist/plugins/build.js.map +1 -1
- package/dist/plugins/publish.d.ts +35 -0
- package/dist/plugins/publish.d.ts.map +1 -1
- package/package.json +3 -2
- package/runtime/plugin-lifecycle.cjs +298 -57
package/README.md
CHANGED
|
@@ -3,6 +3,47 @@
|
|
|
3
3
|
Command-line access to the public [Octonode cloud API](https://octonodes.com/api/docs). The CLI
|
|
4
4
|
wraps `@octonodes/sdk`, so every generated SDK operation is available without writing TypeScript.
|
|
5
5
|
|
|
6
|
+
## Create an app
|
|
7
|
+
|
|
8
|
+
Use Node 24 and a CLI release containing `octonodes app`. The default scaffold
|
|
9
|
+
is an extension-only workspace block: no page, backend, or Cloudflare account.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
octonodes app create workspace-notice
|
|
13
|
+
cd workspace-notice
|
|
14
|
+
npm install
|
|
15
|
+
npm test
|
|
16
|
+
npm run dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Edit `octonode.app.json` and `src/extensions/notice.tsx`. `npm test`
|
|
20
|
+
checks types and verifies build hashes. `npm run dev` watches changes and starts
|
|
21
|
+
a verified, automatically managed HTTPS tunnel. `--use-localhost` skips the
|
|
22
|
+
tunnel; `--tunnel-url <https-origin> --port <port>` uses your own. Preview
|
|
23
|
+
in Studio with `octonodes login` followed by
|
|
24
|
+
`octonodes app dev --workspace user:<id>`.
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
octonodes app extension add overview --target app.page
|
|
28
|
+
octonodes app publish --workspace user:<id>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Adding a page is optional. Install through Studio → Apps; a block appears on
|
|
32
|
+
workspace home, and a page-capable app opens from Apps. An administrator can
|
|
33
|
+
configure or disable an installation. The first publication returns the app ID
|
|
34
|
+
and revision. Increment the source version and publish an update with
|
|
35
|
+
`--app-id <id> --revision <current-revision>`; existing installs remain pinned
|
|
36
|
+
until their administrator approves an update.
|
|
37
|
+
|
|
38
|
+
For a connected backend, use `octonodes app create inventory-labels --template
|
|
39
|
+
full`. Set `web.applicationUrl` in `octonode.app.json` to a permanent HTTPS
|
|
40
|
+
origin, add only necessary `web.requestedActions`, and run `npm test`. The CLI
|
|
41
|
+
publishes release metadata; deploy `dist/web/inventory-labels` to a Node 24
|
|
42
|
+
host yourself, set `OCTONODE_APP_ID` and `OCTONODE_API_URL`, and run
|
|
43
|
+
`node start.cjs`. Keep prior content-hashed assets for pinned installations.
|
|
44
|
+
The [Playbook app guide](https://playbook.octonodes.com/docs/apps) covers the
|
|
45
|
+
project file, SDKs, hosting, consent, publishing and updates.
|
|
46
|
+
|
|
6
47
|
## Create and publish plugins
|
|
7
48
|
|
|
8
49
|
```sh
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PluginManifest } from "@octonodes/sdk/plugins";
|
|
2
|
+
export declare function buildAppProject(directory: string, applicationUrl?: string): Promise<import("../plugins/types").PluginBuild | {
|
|
3
|
+
manifest: PluginManifest;
|
|
4
|
+
directory: string;
|
|
5
|
+
webDirectory: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function verifyWebBuild(directory: string): {
|
|
8
|
+
apiVersion: "1";
|
|
9
|
+
hosting: "self-hosted";
|
|
10
|
+
applicationUrl: string;
|
|
11
|
+
iconUrl?: string | undefined;
|
|
12
|
+
privacyUrl?: string | undefined;
|
|
13
|
+
supportUrl?: string | undefined;
|
|
14
|
+
redirectUrls: string[];
|
|
15
|
+
webhookUrl?: string | undefined;
|
|
16
|
+
requestedActions: ("data:read" | "data:write" | "projects:read" | "workflows:run")[];
|
|
17
|
+
extensions: {
|
|
18
|
+
id: string;
|
|
19
|
+
target: "app.page" | "workspace.block";
|
|
20
|
+
url: string;
|
|
21
|
+
sha256: string;
|
|
22
|
+
}[];
|
|
23
|
+
} | {
|
|
24
|
+
apiVersion: "2";
|
|
25
|
+
hosting: "extension-only";
|
|
26
|
+
iconUrl?: string | undefined;
|
|
27
|
+
settings: {
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
defaultValue: string;
|
|
31
|
+
}[];
|
|
32
|
+
privacyUrl?: string | undefined;
|
|
33
|
+
supportUrl?: string | undefined;
|
|
34
|
+
requestedActions: ("data:read" | "data:write" | "projects:read" | "workflows:run")[];
|
|
35
|
+
extensions: {
|
|
36
|
+
id: string;
|
|
37
|
+
target: "app.page" | "workspace.block";
|
|
38
|
+
path: string;
|
|
39
|
+
sha256: string;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/apps/build.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAKxD,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;;;;GAyJ/E;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa/C"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAppProject = buildAppProject;
|
|
4
|
+
exports.verifyWebBuild = verifyWebBuild;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const esbuild_1 = require("esbuild");
|
|
8
|
+
const plugins_1 = require("@octonodes/sdk/plugins");
|
|
9
|
+
const app_1 = require("../plugins/app");
|
|
10
|
+
const artifact_1 = require("../plugins/artifact");
|
|
11
|
+
const source_1 = require("./source");
|
|
12
|
+
async function buildAppProject(directory, applicationUrl) {
|
|
13
|
+
const root = (0, node_path_1.resolve)(directory);
|
|
14
|
+
const source = (0, source_1.readAppSource)(root);
|
|
15
|
+
let output = root;
|
|
16
|
+
for (const part of ["dist", "apps"]) {
|
|
17
|
+
output = (0, node_path_1.join)(output, part);
|
|
18
|
+
if (!(0, node_fs_1.lstatSync)(output, { throwIfNoEntry: false }))
|
|
19
|
+
(0, node_fs_1.mkdirSync)(output);
|
|
20
|
+
if (!(0, node_fs_1.lstatSync)(output).isDirectory() || (0, node_fs_1.lstatSync)(output).isSymbolicLink())
|
|
21
|
+
throw new Error("Unsafe build directory");
|
|
22
|
+
}
|
|
23
|
+
const stage = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)(output, ".sources-"));
|
|
24
|
+
try {
|
|
25
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.join)(stage, "extensions"));
|
|
26
|
+
const hashes = [];
|
|
27
|
+
for (const extension of source.extensions) {
|
|
28
|
+
const entry = (0, source_1.sourceFile)(root, extension.entry);
|
|
29
|
+
const result = await (0, esbuild_1.build)({
|
|
30
|
+
absWorkingDir: root,
|
|
31
|
+
stdin: {
|
|
32
|
+
contents: `import extension from ${JSON.stringify(entry)}; import { startExtension } from "@octonodes/ui-extensions/react"; if (extension.target !== ${JSON.stringify(extension.target)}) throw new Error("Extension target mismatch"); startExtension(extension);`,
|
|
33
|
+
resolveDir: root,
|
|
34
|
+
loader: "ts",
|
|
35
|
+
},
|
|
36
|
+
bundle: true,
|
|
37
|
+
platform: "browser",
|
|
38
|
+
format: "iife",
|
|
39
|
+
target: "es2021",
|
|
40
|
+
jsx: "automatic",
|
|
41
|
+
minify: true,
|
|
42
|
+
write: false,
|
|
43
|
+
metafile: true,
|
|
44
|
+
preserveSymlinks: true,
|
|
45
|
+
logLevel: "silent",
|
|
46
|
+
});
|
|
47
|
+
if (result.warnings.length)
|
|
48
|
+
throw new Error(result.warnings.map((warning) => warning.text).join("\n"));
|
|
49
|
+
assertSourceInputs(root, Object.keys(result.metafile.inputs));
|
|
50
|
+
if (result.outputFiles.length !== 1 ||
|
|
51
|
+
Object.values(result.metafile.outputs).some((value) => value.imports.some((item) => item.external)))
|
|
52
|
+
throw new Error("App bundles must be self-contained JavaScript");
|
|
53
|
+
const path = (0, node_path_1.join)(stage, `extensions/${extension.id}.js`);
|
|
54
|
+
if (result.outputFiles[0].contents.length > 2 * 1024 * 1024)
|
|
55
|
+
throw new Error("App bundle exceeds 2 MiB");
|
|
56
|
+
(0, node_fs_1.writeFileSync)(path, result.outputFiles[0].contents);
|
|
57
|
+
hashes.push(`sha256:${(0, artifact_1.fileHash)(path)}`);
|
|
58
|
+
if (source.web)
|
|
59
|
+
(0, node_fs_1.copyFileSync)(path, (0, node_path_1.join)(stage, `extensions/${(0, artifact_1.fileHash)(path)}.js`));
|
|
60
|
+
}
|
|
61
|
+
if (!source.web)
|
|
62
|
+
return (0, app_1.buildApp)((0, source_1.appManifest)(source, hashes), output, stage);
|
|
63
|
+
const origin = applicationUrl ?? source.web.applicationUrl;
|
|
64
|
+
if (!origin)
|
|
65
|
+
throw new Error("Set web.applicationUrl or pass --app-url https://your-app.example before building a full app");
|
|
66
|
+
const normalized = new URL(origin);
|
|
67
|
+
if (normalized.origin !== origin.replace(/\/$/, ""))
|
|
68
|
+
throw new Error("App URL must be an HTTPS origin");
|
|
69
|
+
const manifest = plugins_1.PluginManifest.parse({
|
|
70
|
+
id: source.id,
|
|
71
|
+
name: source.name,
|
|
72
|
+
version: source.version,
|
|
73
|
+
description: source.description,
|
|
74
|
+
nodes: [],
|
|
75
|
+
app: {
|
|
76
|
+
apiVersion: "1",
|
|
77
|
+
hosting: "self-hosted",
|
|
78
|
+
applicationUrl: normalized.origin,
|
|
79
|
+
redirectUrls: [normalized.origin],
|
|
80
|
+
requestedActions: source.web.requestedActions ?? [],
|
|
81
|
+
extensions: source.extensions.map((extension, index) => ({
|
|
82
|
+
id: extension.id,
|
|
83
|
+
target: extension.target,
|
|
84
|
+
url: `${normalized.origin}/extensions/${hashes[index].slice(7)}.js`,
|
|
85
|
+
sha256: hashes[index],
|
|
86
|
+
})),
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
const backend = await (0, esbuild_1.build)({
|
|
90
|
+
entryPoints: [(0, source_1.sourceFile)(root, source.web.entry)],
|
|
91
|
+
absWorkingDir: root,
|
|
92
|
+
bundle: true,
|
|
93
|
+
platform: "node",
|
|
94
|
+
preserveSymlinks: true,
|
|
95
|
+
format: "cjs",
|
|
96
|
+
target: "node24",
|
|
97
|
+
outfile: (0, node_path_1.join)(stage, "server.cjs"),
|
|
98
|
+
logLevel: "silent",
|
|
99
|
+
metafile: true,
|
|
100
|
+
});
|
|
101
|
+
assertSourceInputs(root, Object.keys(backend.metafile.inputs));
|
|
102
|
+
if (backend.warnings.length)
|
|
103
|
+
throw new Error(backend.warnings.map((warning) => warning.text).join("\n"));
|
|
104
|
+
const previousWeb = (0, node_path_1.join)(root, "dist/web", source.id);
|
|
105
|
+
if ((0, node_fs_1.existsSync)(previousWeb)) {
|
|
106
|
+
verifyWebBuild(previousWeb);
|
|
107
|
+
// Retain pinned assets across incremental deployments; clean builders must restore the previous web artifact.
|
|
108
|
+
for (const file of (0, artifact_1.pluginFiles)(previousWeb).filter((file) => /^extensions\/[a-f0-9]{64}\.js$/.test(file))) {
|
|
109
|
+
if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(stage, file)))
|
|
110
|
+
(0, node_fs_1.copyFileSync)((0, node_path_1.join)(previousWeb, file), (0, node_path_1.join)(stage, file));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
await (0, esbuild_1.build)({
|
|
114
|
+
stdin: {
|
|
115
|
+
contents: `import { createAppServer } from ${JSON.stringify(require.resolve("./server"))};
|
|
116
|
+
import { readFileSync, readdirSync, lstatSync } from "node:fs";
|
|
117
|
+
import { join } from "node:path";
|
|
118
|
+
import { createHash } from "node:crypto";
|
|
119
|
+
const root = __dirname;
|
|
120
|
+
const record = JSON.parse(readFileSync(join(root,"octonode-web.json"),"utf8"));
|
|
121
|
+
function files(dir) { return readdirSync(join(root,dir)).flatMap(name=>{const file=dir?dir+"/"+name:name; const stat=lstatSync(join(root,file)); if(stat.isSymbolicLink())throw Error("Symlink in web build");return stat.isDirectory()?files(file):[file];}); }
|
|
122
|
+
const actual=files("").filter(file=>file!=="octonode-web.json").sort();
|
|
123
|
+
if(record.format!==1 || JSON.stringify(actual)!==JSON.stringify(Object.keys(record.files).sort()))throw Error("Web build changed");
|
|
124
|
+
for(const file of actual)if(createHash("sha256").update(readFileSync(join(root,file))).digest("hex")!==record.files[file])throw Error("Web build changed");
|
|
125
|
+
const port=Number(process.env.PORT??3000);if(!Number.isInteger(port)||port<0||port>65535)throw Error("Invalid PORT");
|
|
126
|
+
const source={id:"web",version:"1.0.0",extensions:record.app.extensions};
|
|
127
|
+
const host=createAppServer({port,source,development:false});
|
|
128
|
+
host.listen().then(()=>{host.setOrigin(record.app.applicationUrl);host.update(source,root,require(join(root,"server.cjs")).default);process.stdout.write("App server ready\\n");});
|
|
129
|
+
process.once("SIGINT",()=>host.close());process.once("SIGTERM",()=>host.close());`,
|
|
130
|
+
resolveDir: __dirname,
|
|
131
|
+
},
|
|
132
|
+
bundle: true,
|
|
133
|
+
platform: "node",
|
|
134
|
+
format: "cjs",
|
|
135
|
+
target: "node24",
|
|
136
|
+
outfile: (0, node_path_1.join)(stage, "start.cjs"),
|
|
137
|
+
logLevel: "silent",
|
|
138
|
+
});
|
|
139
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(stage, "octonode-web.json"), JSON.stringify({
|
|
140
|
+
format: 1,
|
|
141
|
+
app: manifest.app,
|
|
142
|
+
files: Object.fromEntries((0, artifact_1.pluginFiles)(stage).map((file) => [file, (0, artifact_1.fileHash)((0, node_path_1.join)(stage, file))])),
|
|
143
|
+
}));
|
|
144
|
+
const webParent = (0, node_path_1.join)(root, "dist/web");
|
|
145
|
+
if (!(0, node_fs_1.existsSync)(webParent))
|
|
146
|
+
(0, node_fs_1.mkdirSync)(webParent);
|
|
147
|
+
if ((0, node_fs_1.lstatSync)(webParent).isSymbolicLink() || !(0, node_fs_1.lstatSync)(webParent).isDirectory())
|
|
148
|
+
throw new Error("Unsafe web output directory");
|
|
149
|
+
const webDirectory = (0, node_path_1.join)(webParent, source.id);
|
|
150
|
+
const backup = (0, node_path_1.join)(output, `.previous-web-${source.id}`);
|
|
151
|
+
if ((0, node_fs_1.existsSync)(backup))
|
|
152
|
+
throw new Error("Previous web backup exists; inspect it before rebuilding");
|
|
153
|
+
if ((0, node_fs_1.existsSync)(webDirectory)) {
|
|
154
|
+
verifyWebBuild(webDirectory);
|
|
155
|
+
(0, node_fs_1.renameSync)(webDirectory, backup);
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
(0, node_fs_1.renameSync)(stage, webDirectory);
|
|
159
|
+
const artifact = (0, app_1.buildApp)(manifest, output, root);
|
|
160
|
+
(0, node_fs_1.rmSync)(backup, { recursive: true, force: true });
|
|
161
|
+
return { ...artifact, webDirectory };
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
(0, node_fs_1.rmSync)(webDirectory, { recursive: true, force: true });
|
|
165
|
+
if ((0, node_fs_1.existsSync)(backup))
|
|
166
|
+
(0, node_fs_1.renameSync)(backup, webDirectory);
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
finally {
|
|
171
|
+
(0, node_fs_1.rmSync)(stage, { recursive: true, force: true });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function verifyWebBuild(directory) {
|
|
175
|
+
const record = JSON.parse((0, node_fs_1.readFileSync)((0, source_1.sourceFile)(directory, "octonode-web.json"), "utf8"));
|
|
176
|
+
const actual = (0, artifact_1.pluginFiles)(directory).filter((file) => file !== "octonode-web.json");
|
|
177
|
+
if (record.format !== 1 ||
|
|
178
|
+
!record.files ||
|
|
179
|
+
JSON.stringify(Object.keys(record.files).sort()) !== JSON.stringify(actual.sort()))
|
|
180
|
+
throw new Error("Web build changed; rebuild first");
|
|
181
|
+
for (const file of actual)
|
|
182
|
+
if (record.files[file] !== (0, artifact_1.fileHash)((0, node_path_1.join)(directory, file)))
|
|
183
|
+
throw new Error("Web build changed; rebuild first");
|
|
184
|
+
const manifest = plugins_1.PluginManifest.parse({ id: "web", name: "web", version: "1.0.0", app: record.app });
|
|
185
|
+
return manifest.app;
|
|
186
|
+
}
|
|
187
|
+
function assertSourceInputs(root, inputs) {
|
|
188
|
+
for (const input of inputs) {
|
|
189
|
+
if (input === "<stdin>")
|
|
190
|
+
continue;
|
|
191
|
+
const local = (0, node_path_1.relative)(root, (0, node_path_1.resolve)(root, input)).replaceAll("\\", "/");
|
|
192
|
+
if (local.split("/").includes("node_modules") && !local.startsWith("../"))
|
|
193
|
+
continue;
|
|
194
|
+
(0, artifact_1.safePath)(local);
|
|
195
|
+
(0, source_1.sourceFile)(root, local);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/apps/build.ts"],"names":[],"mappings":";;;;AAAA,qCAUiB;AACjB,yCAAoD;AACpD,qCAAgC;AAChC,oDAAwD;AACxD,wCAA0C;AAC1C,kDAAsE;AACtE,qCAAkE;AAE3D,KAAK,0BAA0B,SAAiB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AAc,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;IACrG,OAAO,QAAQ,CAAC,GAAI,CAAC;AACvB,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY,EAAE,MAAgB;IACxD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,MAAM,KAAK,GAAG,IAAA,oBAAQ,EAAC,IAAI,EAAE,IAAA,mBAAO,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACzE,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,SAAS;QACpF,IAAA,mBAAQ,EAAC,KAAK,CAAC,CAAC;QAChB,IAAA,mBAAU,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflared.d.ts","sourceRoot":"","sources":["../../src/apps/cloudflared.ts"],"names":[],"mappings":"AAOA,wBAAsB,iBAAiB,CACrC,MAAM,CAAC,EAAE,WAAW,EACpB,KAAK,SAAgG,EACrG,QAAQ,SAAwC,GAC/C,OAAO,CAAC,MAAM,CAAC,CAgDjB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureCloudflared = ensureCloudflared;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const promises_1 = require("node:fs/promises");
|
|
6
|
+
const node_os_1 = require("node:os");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const tar_1 = require("tar");
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
async function ensureCloudflared(signal, cache = (0, node_path_1.join)(process.env.OCTONODE_CONFIG_DIR ?? (0, node_path_1.join)((0, node_os_1.homedir)(), ".octonode"), "cache", "cloudflared"), platform = `${process.platform}-${process.arch}`) {
|
|
11
|
+
const asset = constants_1.CLOUDFLARED_ASSETS[platform];
|
|
12
|
+
if (!asset)
|
|
13
|
+
throw new Error(`Automatic tunnels are unsupported on ${platform}; use --tunnel-url or --use-localhost`);
|
|
14
|
+
const directory = (0, node_path_1.join)(cache, constants_1.CLOUDFLARED_VERSION, platform);
|
|
15
|
+
const executable = (0, node_path_1.join)(directory, platform.startsWith("win32-") ? "cloudflared.exe" : "cloudflared");
|
|
16
|
+
const digest = (bytes) => (0, node_crypto_1.createHash)("sha256").update(bytes).digest("hex");
|
|
17
|
+
const binaryHash = asset.binarySha256 ?? asset.sha256;
|
|
18
|
+
try {
|
|
19
|
+
if (digest(await (0, promises_1.readFile)(executable)) === binaryHash)
|
|
20
|
+
return executable;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (error.code !== "ENOENT")
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
await (0, promises_1.mkdir)(directory, { recursive: true, mode: 0o700 });
|
|
27
|
+
const stage = await (0, promises_1.mkdtemp)((0, node_path_1.join)(directory, ".download-"));
|
|
28
|
+
try {
|
|
29
|
+
process.stderr.write("Preparing development tunnel (first download may take a moment)…\n");
|
|
30
|
+
const response = await fetch(`https://github.com/cloudflare/cloudflared/releases/download/${constants_1.CLOUDFLARED_VERSION}/${asset.file}`, {
|
|
31
|
+
signal: AbortSignal.any([AbortSignal.timeout(120_000), ...(signal ? [signal] : [])]),
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok)
|
|
34
|
+
throw new Error(`Download returned HTTP ${response.status}`);
|
|
35
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
36
|
+
if (digest(bytes) !== asset.sha256)
|
|
37
|
+
throw new Error("Tunnel download checksum mismatch");
|
|
38
|
+
const staged = (0, node_path_1.join)(stage, platform.startsWith("win32-") ? "cloudflared.exe" : "cloudflared");
|
|
39
|
+
if (asset.file.endsWith(".tgz")) {
|
|
40
|
+
const archive = (0, node_path_1.join)(stage, "download.tgz");
|
|
41
|
+
await (0, promises_1.writeFile)(archive, bytes);
|
|
42
|
+
await (0, tar_1.x)({
|
|
43
|
+
file: archive,
|
|
44
|
+
cwd: stage,
|
|
45
|
+
filter: (path) => path === "cloudflared",
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
await (0, promises_1.writeFile)(staged, bytes);
|
|
50
|
+
if (digest(await (0, promises_1.readFile)(staged)) !== binaryHash)
|
|
51
|
+
throw new Error("Tunnel executable checksum mismatch");
|
|
52
|
+
signal?.throwIfAborted();
|
|
53
|
+
await (0, promises_1.chmod)(staged, 0o700);
|
|
54
|
+
await (0, promises_1.rename)(staged, executable);
|
|
55
|
+
return executable;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
throw new Error(`Could not prepare the development tunnel: ${error instanceof Error ? error.message : String(error)}. Retry, use --tunnel-url, or pass --use-localhost`, { cause: error });
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
await (0, promises_1.rm)(stage, { recursive: true, force: true });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=cloudflared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflared.js","sourceRoot":"","sources":["../../src/apps/cloudflared.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,+CAA0F;AAC1F,qCAAkC;AAClC,yCAAiC;AACjC,6BAAwB;AACxB,2CAAsE;AAE/D,KAAK,4BACV,MAAoB,EACpB,KAAK,GAAG,IAAA,gBAAI,EAAC,OAAO,CAAC,GAA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Aa;aACzC,CAAC,CAAC;QACL,CAAC;;YAAM,MAAM,IAAA,oBAAS,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtC,IAAI,MAAM,CAAC,MAAM,IAAA,mBAAQ,EAAC,MAAM,CAAC,CAAC,KAAK,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC1G,MAAM,EAAE,cAAc,EAAE,CAAC;QACzB,MAAM,IAAA,gBAAK,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC3B,MAAM,IAAA,iBAAM,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACjC,OAAO,UAAU,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,6CAA6C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,oDAAoD,EACvJ,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,IAAA,aAAE,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const APP_SOURCE = "octonode.app.json";
|
|
2
|
+
export declare const APP_HELP = "Usage:\n octonodes app create <name> [--template extension|full]\n octonodes app extension add <id> --target workspace.block|app.page [--cwd <directory>]\n octonodes app dev [directory] [--use-localhost | --tunnel-url <https-origin>] [--port <port>] [--no-open] [--workspace kind:id]\n octonodes app build [directory] [--app-url <https-origin>]\n octonodes app serve [directory] [--port <port>]\n octonodes app publish [directory] --workspace kind:id [--app-id <id> --revision <n>]\n octonodes app validate <artifact-directory>\n\nCreate defaults to a workspace block. Build compiles declared browser entries and generates\nrelease hashes in dist/apps/<id>. Existing projects are never overwritten. No login is needed.\napp dev automatically downloads and caches its tunnel helper. No Cloudflare account or install is needed. --workspace opens an expiring Studio preview after login.\napp publish creates an immutable release; full apps must deploy their backend separately.\nInstallation requires Studio consent.\n";
|
|
3
|
+
export declare const CLOUDFLARED_VERSION = "2026.9.3";
|
|
4
|
+
export declare const CLOUDFLARED_ASSETS: Record<string, import("./types").CloudflaredAsset>;
|
|
5
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/apps/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,sBAAsB,CAAC;AAC9C,eAAO,MAAM,QAAQ,mgCAcpB,CAAC;AAGF,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAC9C,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,SAAS,EAAE,gBAAgB,CAuBjF,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLOUDFLARED_ASSETS = exports.CLOUDFLARED_VERSION = exports.APP_HELP = exports.APP_SOURCE = void 0;
|
|
4
|
+
exports.APP_SOURCE = "octonode.app.json";
|
|
5
|
+
exports.APP_HELP = `Usage:
|
|
6
|
+
octonodes app create <name> [--template extension|full]
|
|
7
|
+
octonodes app extension add <id> --target workspace.block|app.page [--cwd <directory>]
|
|
8
|
+
octonodes app dev [directory] [--use-localhost | --tunnel-url <https-origin>] [--port <port>] [--no-open] [--workspace kind:id]
|
|
9
|
+
octonodes app build [directory] [--app-url <https-origin>]
|
|
10
|
+
octonodes app serve [directory] [--port <port>]
|
|
11
|
+
octonodes app publish [directory] --workspace kind:id [--app-id <id> --revision <n>]
|
|
12
|
+
octonodes app validate <artifact-directory>
|
|
13
|
+
|
|
14
|
+
Create defaults to a workspace block. Build compiles declared browser entries and generates
|
|
15
|
+
release hashes in dist/apps/<id>. Existing projects are never overwritten. No login is needed.
|
|
16
|
+
app dev automatically downloads and caches its tunnel helper. No Cloudflare account or install is needed. --workspace opens an expiring Studio preview after login.
|
|
17
|
+
app publish creates an immutable release; full apps must deploy their backend separately.
|
|
18
|
+
Installation requires Studio consent.
|
|
19
|
+
`;
|
|
20
|
+
// Pinned official release: https://github.com/cloudflare/cloudflared/releases/tag/2026.9.3
|
|
21
|
+
exports.CLOUDFLARED_VERSION = "2026.9.3";
|
|
22
|
+
exports.CLOUDFLARED_ASSETS = {
|
|
23
|
+
"darwin-x64": {
|
|
24
|
+
file: "cloudflared-darwin-amd64.tgz",
|
|
25
|
+
sha256: "d1155d0837487f261183b15c1eab6c4ebcad9dc49b94675f1524c3564cea3977",
|
|
26
|
+
binarySha256: "ab588b3b4db9cdb4476c30a3db2a72635b1d8327d44741fee6799a0f37b0ec07",
|
|
27
|
+
},
|
|
28
|
+
"darwin-arm64": {
|
|
29
|
+
file: "cloudflared-darwin-arm64.tgz",
|
|
30
|
+
sha256: "587c2cfb1c230fe36c7fa7727da78be459dae028cabe8c001291999350f07095",
|
|
31
|
+
binarySha256: "5472c1a01c84bc31b3021056a73b4e5774ddddefc572124ea8fdf6c340639f32",
|
|
32
|
+
},
|
|
33
|
+
"linux-x64": {
|
|
34
|
+
file: "cloudflared-linux-amd64",
|
|
35
|
+
sha256: "77e26d8d900e0b8469f416239d14b5f296525fdf79fee6f511ef55609e3fbac2",
|
|
36
|
+
},
|
|
37
|
+
"linux-arm64": {
|
|
38
|
+
file: "cloudflared-linux-arm64",
|
|
39
|
+
sha256: "aaeb2d7d0da3614634c7e03ab13487a1522c2e79165ed2929cfe23d5e95b326d",
|
|
40
|
+
},
|
|
41
|
+
"win32-x64": {
|
|
42
|
+
file: "cloudflared-windows-amd64.exe",
|
|
43
|
+
sha256: "f096265ec2fcbe9bb6e2d64268db167ced3fcbb83d894bdb9e2fcdb26f2ea7e2",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/apps/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,mBAAmB,CAAC;AACjC,QAAA,QAAQ,GAAG;;;;;;;;;;;;;;CAcvB,CAAC;AAEF,2FAA2F;AAC9E,QAAA,mBAAmB,GAAG,UAAU,CAAC;AACjC,QAAA,kBAAkB,GAAuD;IACpF,YAAY,EAAE;QACZ,IAAI,EAAE,8BAA8B;QACpC,MAAM,EAAE,kEAAkE;QAC1E,YAAY,EAAE,kEAAkE;KACjF;IACD,cAAc,EAAE;QACd,IAAI,EAAE,8BAA8B;QACpC,MAAM,EAAE,kEAAkE;QAC1E,YAAY,EAAE,kEAAkE;KACjF;IACD,WAAW,EAAE;QACX,IAAI,EAAE,yBAAyB;QAC/B,MAAM,EAAE,kEAAkE;KAC3E;IACD,aAAa,EAAE;QACb,IAAI,EAAE,yBAAyB;QAC/B,MAAM,EAAE,kEAAkE;KAC3E;IACD,WAAW,EAAE;QACX,IAAI,EAAE,+BAA+B;QACrC,MAAM,EAAE,kEAAkE;KAC3E;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function createApp(name: string, version: string, template?: string): string;
|
|
2
|
+
export declare function addAppExtension(directory: string, id: string, target: string): {
|
|
3
|
+
id: string;
|
|
4
|
+
target: string;
|
|
5
|
+
entry: string;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/apps/create.ts"],"names":[],"mappings":"AAeA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAc,GAAG,MAAM,CAwLvF;AACD,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;EA8B5E"}
|