clefbase 1.2.0 → 1.2.2
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-src/cli/api.js +30 -17
- package/dist/cli-src/cli/commands/init.js +125 -18
- package/dist/cli.js +132 -34
- package/dist/hosting/index.d.ts +4 -7
- package/dist/hosting/index.d.ts.map +1 -1
- package/dist/hosting/index.js +36 -24
- package/dist/hosting/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli-src/cli/api.js
CHANGED
|
@@ -105,29 +105,42 @@ async function createDeploy(cfg, siteId, entrypoint = "index.html") {
|
|
|
105
105
|
}
|
|
106
106
|
async function uploadFileBatch(cfg, deployId, files) {
|
|
107
107
|
const fetchFn = await getFetch();
|
|
108
|
-
|
|
109
|
-
let
|
|
108
|
+
const url = `${base(cfg)}/api/hosting/databases/${cfg.projectId}/deploys/${deployId}/files/batch`;
|
|
109
|
+
let res;
|
|
110
110
|
if (typeof FormData !== "undefined") {
|
|
111
|
-
|
|
111
|
+
// Node 18+ native FormData: Buffer must be wrapped in Blob/File
|
|
112
|
+
const form = new FormData();
|
|
113
|
+
for (const f of files) {
|
|
114
|
+
const filename = f.path.split("/").pop() ?? f.path;
|
|
115
|
+
const ab = f.buffer.buffer.slice(f.buffer.byteOffset, f.buffer.byteOffset + f.buffer.byteLength);
|
|
116
|
+
const blob = new Blob([ab], { type: "application/octet-stream" });
|
|
117
|
+
form.append("files[]", new File([blob], filename, { type: "application/octet-stream" }));
|
|
118
|
+
form.append("filePaths", f.path);
|
|
119
|
+
}
|
|
120
|
+
res = await fetchFn(url, {
|
|
121
|
+
method: "POST",
|
|
122
|
+
headers: { "x-admin-secret": cfg.adminSecret },
|
|
123
|
+
body: form,
|
|
124
|
+
});
|
|
112
125
|
}
|
|
113
126
|
else {
|
|
127
|
+
// Older Node: use form-data package which natively accepts Buffers
|
|
114
128
|
const mod = await Promise.resolve().then(() => __importStar(require("form-data")));
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
const FormDataLegacy = mod.default;
|
|
130
|
+
const form = new FormDataLegacy();
|
|
131
|
+
for (const f of files) {
|
|
132
|
+
form.append("files[]", f.buffer, {
|
|
133
|
+
filename: f.path.split("/").pop() ?? f.path,
|
|
134
|
+
contentType: "application/octet-stream",
|
|
135
|
+
});
|
|
136
|
+
form.append("filePaths", f.path);
|
|
137
|
+
}
|
|
138
|
+
res = await fetchFn(url, {
|
|
139
|
+
method: "POST",
|
|
140
|
+
headers: { "x-admin-secret": cfg.adminSecret, ...form.getHeaders() },
|
|
141
|
+
body: form,
|
|
122
142
|
});
|
|
123
|
-
form.append("filePaths", f.path);
|
|
124
143
|
}
|
|
125
|
-
const url = `${base(cfg)}/api/hosting/databases/${cfg.projectId}/deploys/${deployId}/files/batch`;
|
|
126
|
-
const res = await fetchFn(url, {
|
|
127
|
-
method: "POST",
|
|
128
|
-
headers: { "x-admin-secret": cfg.adminSecret },
|
|
129
|
-
body: form,
|
|
130
|
-
});
|
|
131
144
|
if (!res.ok) {
|
|
132
145
|
let msg = `${res.status} ${res.statusText}`;
|
|
133
146
|
try {
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.runInit = runInit;
|
|
7
|
+
exports.scaffoldLib = scaffoldLib;
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const fs_1 = __importDefault(require("fs"));
|
|
9
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -93,25 +94,129 @@ async function runInit(cwd = process.cwd()) {
|
|
|
93
94
|
if (cfg.services.hosting) {
|
|
94
95
|
await setupHosting(cfg, cwd);
|
|
95
96
|
}
|
|
96
|
-
// ── Step 5: Write config files
|
|
97
|
+
// ── Step 5: Write root config files ──────────────────────────────────────
|
|
97
98
|
const configPath = (0, config_1.saveConfig)(cfg, cwd);
|
|
98
99
|
(0, config_1.ensureGitignore)(cwd);
|
|
99
100
|
(0, config_1.writeEnvExample)(cfg, cwd);
|
|
101
|
+
// ── Step 6: Scaffold src/lib ──────────────────────────────────────────────
|
|
102
|
+
const libResult = scaffoldLib(cfg, cwd);
|
|
103
|
+
// ── Done ──────────────────────────────────────────────────────────────────
|
|
100
104
|
console.log();
|
|
101
105
|
console.log(chalk_1.default.green.bold(" ✓ Project initialised!"));
|
|
102
106
|
console.log();
|
|
103
|
-
console.log(chalk_1.default.dim(` Config:
|
|
104
|
-
console.log(chalk_1.default.dim(" Secrets:
|
|
105
|
-
console.log(chalk_1.default.dim(" Env example:
|
|
107
|
+
console.log(chalk_1.default.dim(` Config: ${path_1.default.relative(cwd, configPath)}`));
|
|
108
|
+
console.log(chalk_1.default.dim(" Secrets: clefbase.json has been added to .gitignore"));
|
|
109
|
+
console.log(chalk_1.default.dim(" Env example: .env.example created"));
|
|
110
|
+
if (libResult) {
|
|
111
|
+
console.log(chalk_1.default.dim(` Lib config: ${libResult.configCopy}`));
|
|
112
|
+
console.log(chalk_1.default.dim(` Lib entry: ${libResult.libFile}`));
|
|
113
|
+
}
|
|
106
114
|
console.log();
|
|
107
115
|
printUsageHint(cfg);
|
|
108
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Writes two files into `<cwd>/src/lib/`:
|
|
119
|
+
* • clefbase.json — a copy of the project config (secrets stripped for safety)
|
|
120
|
+
* • clefBase.ts — ready-to-import service exports
|
|
121
|
+
*
|
|
122
|
+
* Safe to call multiple times — the TS file is regenerated on every call so it
|
|
123
|
+
* stays in sync with the enabled services.
|
|
124
|
+
*/
|
|
125
|
+
function scaffoldLib(cfg, cwd = process.cwd()) {
|
|
126
|
+
const libDir = path_1.default.join(cwd, "src", "lib");
|
|
127
|
+
fs_1.default.mkdirSync(libDir, { recursive: true });
|
|
128
|
+
// ── 1. Config copy (strip adminSecret for safety) ─────────────────────────
|
|
129
|
+
const publicCfg = {
|
|
130
|
+
serverUrl: cfg.serverUrl,
|
|
131
|
+
projectId: cfg.projectId,
|
|
132
|
+
apiKey: cfg.apiKey,
|
|
133
|
+
// adminSecret intentionally omitted — not needed in client code
|
|
134
|
+
services: cfg.services,
|
|
135
|
+
...(cfg.hosting ? { hosting: cfg.hosting } : {}),
|
|
136
|
+
};
|
|
137
|
+
const configCopyAbs = path_1.default.join(libDir, "clefbase.json");
|
|
138
|
+
fs_1.default.writeFileSync(configCopyAbs, JSON.stringify(publicCfg, null, 2) + "\n");
|
|
139
|
+
// ── 2. clefBase.ts ────────────────────────────────────────────────────────
|
|
140
|
+
const libFileAbs = path_1.default.join(libDir, "clefBase.ts");
|
|
141
|
+
fs_1.default.writeFileSync(libFileAbs, buildLibTs(cfg));
|
|
142
|
+
return {
|
|
143
|
+
configCopy: path_1.default.relative(cwd, configCopyAbs),
|
|
144
|
+
libFile: path_1.default.relative(cwd, libFileAbs),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/** Build the content of src/lib/clefBase.ts based on enabled services. */
|
|
148
|
+
function buildLibTs(cfg) {
|
|
149
|
+
const { database, auth, storage } = cfg.services;
|
|
150
|
+
// Collect SDK imports
|
|
151
|
+
const sdkImports = ["initClefbase"];
|
|
152
|
+
if (database)
|
|
153
|
+
sdkImports.push("getDatabase");
|
|
154
|
+
if (auth)
|
|
155
|
+
sdkImports.push("getAuth");
|
|
156
|
+
if (storage)
|
|
157
|
+
sdkImports.push("getStorage");
|
|
158
|
+
// Collect type imports
|
|
159
|
+
const typeImports = [];
|
|
160
|
+
if (database)
|
|
161
|
+
typeImports.push("Database");
|
|
162
|
+
if (auth)
|
|
163
|
+
typeImports.push("Auth");
|
|
164
|
+
if (storage)
|
|
165
|
+
typeImports.push("ClefbaseStorage");
|
|
166
|
+
const lines = [
|
|
167
|
+
`/**`,
|
|
168
|
+
` * Clefbase — pre-initialised service exports`,
|
|
169
|
+
` *`,
|
|
170
|
+
` * Usage:`,
|
|
171
|
+
` * import { db, auth, storage } from "@lib/clefBase";`,
|
|
172
|
+
` * import db from "@lib/clefBase";`,
|
|
173
|
+
` */`,
|
|
174
|
+
``,
|
|
175
|
+
`import { ${sdkImports.join(", ")} } from "clefbase";`,
|
|
176
|
+
...(typeImports.length > 0
|
|
177
|
+
? [`import type { ${typeImports.join(", ")} } from "clefbase";`]
|
|
178
|
+
: []),
|
|
179
|
+
`import config from "./clefbase.json";`,
|
|
180
|
+
``,
|
|
181
|
+
`// ─── App ─────────────────────────────────────────────────────────────────────`,
|
|
182
|
+
``,
|
|
183
|
+
`const app = initClefbase({`,
|
|
184
|
+
` serverUrl: config.serverUrl,`,
|
|
185
|
+
` projectId: config.projectId,`,
|
|
186
|
+
` apiKey: config.apiKey,`,
|
|
187
|
+
`});`,
|
|
188
|
+
``,
|
|
189
|
+
];
|
|
190
|
+
// ── Service instances ──────────────────────────────────────────────────────
|
|
191
|
+
if (database || auth || storage) {
|
|
192
|
+
lines.push("// ─── Services ───────────────────────────────────────────────────────────────");
|
|
193
|
+
lines.push("");
|
|
194
|
+
}
|
|
195
|
+
if (database) {
|
|
196
|
+
lines.push(`/** Clefbase Database — query and mutate documents. */`);
|
|
197
|
+
lines.push(`export const db: Database = getDatabase(app);`);
|
|
198
|
+
lines.push("");
|
|
199
|
+
}
|
|
200
|
+
if (auth) {
|
|
201
|
+
lines.push(`/** Clefbase Auth — sign up, sign in, manage sessions. */`);
|
|
202
|
+
lines.push(`export const auth: Auth = getAuth(app);`);
|
|
203
|
+
lines.push("");
|
|
204
|
+
}
|
|
205
|
+
if (storage) {
|
|
206
|
+
lines.push(`/** Clefbase Storage — upload and manage files. */`);
|
|
207
|
+
lines.push(`export const storage: ClefbaseStorage = getStorage(app);`);
|
|
208
|
+
lines.push("");
|
|
209
|
+
}
|
|
210
|
+
// ── Re-export app for advanced use ────────────────────────────────────────
|
|
211
|
+
lines.push(`// ─── Advanced ────────────────────────────────────────────────────────────────`, ``, `/** The underlying ClefbaseApp instance (for advanced use). */`, `export { app };`, ``);
|
|
212
|
+
lines.push("");
|
|
213
|
+
return lines.join("\n");
|
|
214
|
+
}
|
|
109
215
|
// ─── Hosting sub-flow ─────────────────────────────────────────────────────────
|
|
110
216
|
async function setupHosting(cfg, cwd) {
|
|
111
217
|
console.log();
|
|
112
218
|
console.log(chalk_1.default.bold(" Hosting"));
|
|
113
219
|
console.log();
|
|
114
|
-
// Fetch existing sites
|
|
115
220
|
let existing = [];
|
|
116
221
|
const siteSpinner = (0, ora_1.default)("Fetching existing sites…").start();
|
|
117
222
|
try {
|
|
@@ -191,35 +296,37 @@ function guessDistDir(cwd) {
|
|
|
191
296
|
return "dist";
|
|
192
297
|
}
|
|
193
298
|
function printUsageHint(cfg) {
|
|
194
|
-
const
|
|
299
|
+
const namedImports = [];
|
|
195
300
|
if (cfg.services.database)
|
|
196
|
-
|
|
301
|
+
namedImports.push("db");
|
|
197
302
|
if (cfg.services.auth)
|
|
198
|
-
|
|
303
|
+
namedImports.push("auth");
|
|
199
304
|
if (cfg.services.storage)
|
|
200
|
-
|
|
201
|
-
if (cfg.services.hosting)
|
|
202
|
-
imports.push("getHosting");
|
|
305
|
+
namedImports.push("storage");
|
|
203
306
|
console.log(chalk_1.default.bold(" Quick start:"));
|
|
204
307
|
console.log();
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
308
|
+
if (namedImports.length > 0) {
|
|
309
|
+
console.log(chalk_1.default.cyan(` import { ${namedImports.join(", ")} } from "@lib/clefBase";`));
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
console.log(chalk_1.default.cyan(` import app from "@lib/clefBase";`));
|
|
313
|
+
}
|
|
209
314
|
if (cfg.services.database) {
|
|
210
315
|
console.log();
|
|
211
|
-
console.log(chalk_1.default.cyan(` const db = getDatabase(app);`));
|
|
212
316
|
console.log(chalk_1.default.cyan(` const docs = await db.collection("items").getDocs();`));
|
|
213
317
|
}
|
|
214
318
|
if (cfg.services.auth) {
|
|
215
319
|
console.log();
|
|
216
|
-
console.log(chalk_1.default.cyan(` const auth = getAuth(app);`));
|
|
217
320
|
console.log(chalk_1.default.cyan(` const { user } = await auth.signIn("email", "pass");`));
|
|
218
321
|
}
|
|
322
|
+
if (cfg.services.storage) {
|
|
323
|
+
console.log();
|
|
324
|
+
console.log(chalk_1.default.cyan(` await storage.ref("uploads/photo.jpg").upload(file);`));
|
|
325
|
+
}
|
|
219
326
|
if (cfg.services.hosting && cfg.hosting) {
|
|
220
327
|
console.log();
|
|
221
328
|
console.log(chalk_1.default.bold(" Deploy:"));
|
|
222
|
-
console.log(chalk_1.default.cyan(` $ npm run build && clefbase deploy`));
|
|
329
|
+
console.log(chalk_1.default.cyan(` $ npm run build && npx clefbase deploy`));
|
|
223
330
|
console.log(chalk_1.default.dim(` Site: ${cfg.serverUrl}/hosted/${cfg.projectId}/${cfg.hosting.siteId}`));
|
|
224
331
|
}
|
|
225
332
|
console.log();
|
package/dist/cli.js
CHANGED
|
@@ -33748,31 +33748,39 @@ async function createDeploy(cfg, siteId, entrypoint = "index.html") {
|
|
|
33748
33748
|
}
|
|
33749
33749
|
async function uploadFileBatch(cfg, deployId, files) {
|
|
33750
33750
|
const fetchFn = await getFetch();
|
|
33751
|
-
|
|
33751
|
+
const url = `${base(cfg)}/api/hosting/databases/${cfg.projectId}/deploys/${deployId}/files/batch`;
|
|
33752
|
+
let res;
|
|
33752
33753
|
if (typeof FormData !== "undefined") {
|
|
33753
|
-
|
|
33754
|
+
const form = new FormData();
|
|
33755
|
+
for (const f of files) {
|
|
33756
|
+
const filename = f.path.split("/").pop() ?? f.path;
|
|
33757
|
+
const ab = f.buffer.buffer.slice(f.buffer.byteOffset, f.buffer.byteOffset + f.buffer.byteLength);
|
|
33758
|
+
const blob = new Blob([ab], { type: "application/octet-stream" });
|
|
33759
|
+
form.append("files[]", new File([blob], filename, { type: "application/octet-stream" }));
|
|
33760
|
+
form.append("filePaths", f.path);
|
|
33761
|
+
}
|
|
33762
|
+
res = await fetchFn(url, {
|
|
33763
|
+
method: "POST",
|
|
33764
|
+
headers: { "x-admin-secret": cfg.adminSecret },
|
|
33765
|
+
body: form
|
|
33766
|
+
});
|
|
33754
33767
|
} else {
|
|
33755
33768
|
const mod = await import("form-data");
|
|
33756
|
-
|
|
33757
|
-
|
|
33758
|
-
|
|
33759
|
-
|
|
33760
|
-
form.append(
|
|
33761
|
-
"files[]",
|
|
33762
|
-
f.buffer,
|
|
33763
|
-
{
|
|
33769
|
+
const FormDataLegacy = mod.default;
|
|
33770
|
+
const form = new FormDataLegacy();
|
|
33771
|
+
for (const f of files) {
|
|
33772
|
+
form.append("files[]", f.buffer, {
|
|
33764
33773
|
filename: f.path.split("/").pop() ?? f.path,
|
|
33765
33774
|
contentType: "application/octet-stream"
|
|
33766
|
-
}
|
|
33767
|
-
|
|
33768
|
-
|
|
33775
|
+
});
|
|
33776
|
+
form.append("filePaths", f.path);
|
|
33777
|
+
}
|
|
33778
|
+
res = await fetchFn(url, {
|
|
33779
|
+
method: "POST",
|
|
33780
|
+
headers: { "x-admin-secret": cfg.adminSecret, ...form.getHeaders() },
|
|
33781
|
+
body: form
|
|
33782
|
+
});
|
|
33769
33783
|
}
|
|
33770
|
-
const url = `${base(cfg)}/api/hosting/databases/${cfg.projectId}/deploys/${deployId}/files/batch`;
|
|
33771
|
-
const res = await fetchFn(url, {
|
|
33772
|
-
method: "POST",
|
|
33773
|
-
headers: { "x-admin-secret": cfg.adminSecret },
|
|
33774
|
-
body: form
|
|
33775
|
-
});
|
|
33776
33784
|
if (!res.ok) {
|
|
33777
33785
|
let msg = `${res.status} ${res.statusText}`;
|
|
33778
33786
|
try {
|
|
@@ -33895,15 +33903,101 @@ async function runInit(cwd = process.cwd()) {
|
|
|
33895
33903
|
const configPath = saveConfig(cfg, cwd);
|
|
33896
33904
|
ensureGitignore(cwd);
|
|
33897
33905
|
writeEnvExample(cfg, cwd);
|
|
33906
|
+
const libResult = scaffoldLib(cfg, cwd);
|
|
33898
33907
|
console.log();
|
|
33899
33908
|
console.log(source_default.green.bold(" \u2713 Project initialised!"));
|
|
33900
33909
|
console.log();
|
|
33901
|
-
console.log(source_default.dim(` Config:
|
|
33902
|
-
console.log(source_default.dim(" Secrets:
|
|
33903
|
-
console.log(source_default.dim(" Env example:
|
|
33910
|
+
console.log(source_default.dim(` Config: ${import_path2.default.relative(cwd, configPath)}`));
|
|
33911
|
+
console.log(source_default.dim(" Secrets: clefbase.json has been added to .gitignore"));
|
|
33912
|
+
console.log(source_default.dim(" Env example: .env.example created"));
|
|
33913
|
+
if (libResult) {
|
|
33914
|
+
console.log(source_default.dim(` Lib config: ${libResult.configCopy}`));
|
|
33915
|
+
console.log(source_default.dim(` Lib entry: ${libResult.libFile}`));
|
|
33916
|
+
}
|
|
33904
33917
|
console.log();
|
|
33905
33918
|
printUsageHint(cfg);
|
|
33906
33919
|
}
|
|
33920
|
+
function scaffoldLib(cfg, cwd = process.cwd()) {
|
|
33921
|
+
const libDir = import_path2.default.join(cwd, "src", "lib");
|
|
33922
|
+
import_fs3.default.mkdirSync(libDir, { recursive: true });
|
|
33923
|
+
const publicCfg = {
|
|
33924
|
+
serverUrl: cfg.serverUrl,
|
|
33925
|
+
projectId: cfg.projectId,
|
|
33926
|
+
apiKey: cfg.apiKey,
|
|
33927
|
+
// adminSecret intentionally omitted — not needed in client code
|
|
33928
|
+
services: cfg.services,
|
|
33929
|
+
...cfg.hosting ? { hosting: cfg.hosting } : {}
|
|
33930
|
+
};
|
|
33931
|
+
const configCopyAbs = import_path2.default.join(libDir, "clefbase.json");
|
|
33932
|
+
import_fs3.default.writeFileSync(configCopyAbs, JSON.stringify(publicCfg, null, 2) + "\n");
|
|
33933
|
+
const libFileAbs = import_path2.default.join(libDir, "clefBase.ts");
|
|
33934
|
+
import_fs3.default.writeFileSync(libFileAbs, buildLibTs(cfg));
|
|
33935
|
+
return {
|
|
33936
|
+
configCopy: import_path2.default.relative(cwd, configCopyAbs),
|
|
33937
|
+
libFile: import_path2.default.relative(cwd, libFileAbs)
|
|
33938
|
+
};
|
|
33939
|
+
}
|
|
33940
|
+
function buildLibTs(cfg) {
|
|
33941
|
+
const { database, auth, storage } = cfg.services;
|
|
33942
|
+
const sdkImports = ["initClefbase"];
|
|
33943
|
+
if (database) sdkImports.push("getDatabase");
|
|
33944
|
+
if (auth) sdkImports.push("getAuth");
|
|
33945
|
+
if (storage) sdkImports.push("getStorage");
|
|
33946
|
+
const typeImports = [];
|
|
33947
|
+
if (database) typeImports.push("Database");
|
|
33948
|
+
if (auth) typeImports.push("Auth");
|
|
33949
|
+
if (storage) typeImports.push("ClefbaseStorage");
|
|
33950
|
+
const lines = [
|
|
33951
|
+
`/**`,
|
|
33952
|
+
` * Clefbase \u2014 pre-initialised service exports`,
|
|
33953
|
+
` *`,
|
|
33954
|
+
` * Usage:`,
|
|
33955
|
+
` * import { db, auth, storage } from "@lib/clefBase";`,
|
|
33956
|
+
` * import db from "@lib/clefBase";`,
|
|
33957
|
+
` */`,
|
|
33958
|
+
``,
|
|
33959
|
+
`import { ${sdkImports.join(", ")} } from "clefbase";`,
|
|
33960
|
+
...typeImports.length > 0 ? [`import type { ${typeImports.join(", ")} } from "clefbase";`] : [],
|
|
33961
|
+
`import config from "./clefbase.json";`,
|
|
33962
|
+
``,
|
|
33963
|
+
`// \u2500\u2500\u2500 App \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
|
|
33964
|
+
``,
|
|
33965
|
+
`const app = initClefbase({`,
|
|
33966
|
+
` serverUrl: config.serverUrl,`,
|
|
33967
|
+
` projectId: config.projectId,`,
|
|
33968
|
+
` apiKey: config.apiKey,`,
|
|
33969
|
+
`});`,
|
|
33970
|
+
``
|
|
33971
|
+
];
|
|
33972
|
+
if (database || auth || storage) {
|
|
33973
|
+
lines.push("// \u2500\u2500\u2500 Services \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
33974
|
+
lines.push("");
|
|
33975
|
+
}
|
|
33976
|
+
if (database) {
|
|
33977
|
+
lines.push(`/** Clefbase Database \u2014 query and mutate documents. */`);
|
|
33978
|
+
lines.push(`export const db: Database = getDatabase(app);`);
|
|
33979
|
+
lines.push("");
|
|
33980
|
+
}
|
|
33981
|
+
if (auth) {
|
|
33982
|
+
lines.push(`/** Clefbase Auth \u2014 sign up, sign in, manage sessions. */`);
|
|
33983
|
+
lines.push(`export const auth: Auth = getAuth(app);`);
|
|
33984
|
+
lines.push("");
|
|
33985
|
+
}
|
|
33986
|
+
if (storage) {
|
|
33987
|
+
lines.push(`/** Clefbase Storage \u2014 upload and manage files. */`);
|
|
33988
|
+
lines.push(`export const storage: ClefbaseStorage = getStorage(app);`);
|
|
33989
|
+
lines.push("");
|
|
33990
|
+
}
|
|
33991
|
+
lines.push(
|
|
33992
|
+
`// \u2500\u2500\u2500 Advanced \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
|
|
33993
|
+
``,
|
|
33994
|
+
`/** The underlying ClefbaseApp instance (for advanced use). */`,
|
|
33995
|
+
`export { app };`,
|
|
33996
|
+
``
|
|
33997
|
+
);
|
|
33998
|
+
lines.push("");
|
|
33999
|
+
return lines.join("\n");
|
|
34000
|
+
}
|
|
33907
34001
|
async function setupHosting(cfg, cwd) {
|
|
33908
34002
|
var _a;
|
|
33909
34003
|
console.log();
|
|
@@ -33984,31 +34078,35 @@ function guessDistDir(cwd) {
|
|
|
33984
34078
|
return "dist";
|
|
33985
34079
|
}
|
|
33986
34080
|
function printUsageHint(cfg) {
|
|
33987
|
-
const
|
|
33988
|
-
if (cfg.services.database)
|
|
33989
|
-
if (cfg.services.auth)
|
|
33990
|
-
if (cfg.services.storage)
|
|
33991
|
-
if (cfg.services.hosting) imports.push("getHosting");
|
|
34081
|
+
const namedImports = [];
|
|
34082
|
+
if (cfg.services.database) namedImports.push("db");
|
|
34083
|
+
if (cfg.services.auth) namedImports.push("auth");
|
|
34084
|
+
if (cfg.services.storage) namedImports.push("storage");
|
|
33992
34085
|
console.log(source_default.bold(" Quick start:"));
|
|
33993
34086
|
console.log();
|
|
33994
|
-
|
|
33995
|
-
|
|
33996
|
-
|
|
33997
|
-
|
|
34087
|
+
if (namedImports.length > 0) {
|
|
34088
|
+
console.log(
|
|
34089
|
+
source_default.cyan(` import { ${namedImports.join(", ")} } from "@lib/clefBase";`)
|
|
34090
|
+
);
|
|
34091
|
+
} else {
|
|
34092
|
+
console.log(source_default.cyan(` import app from "@lib/clefBase";`));
|
|
34093
|
+
}
|
|
33998
34094
|
if (cfg.services.database) {
|
|
33999
34095
|
console.log();
|
|
34000
|
-
console.log(source_default.cyan(` const db = getDatabase(app);`));
|
|
34001
34096
|
console.log(source_default.cyan(` const docs = await db.collection("items").getDocs();`));
|
|
34002
34097
|
}
|
|
34003
34098
|
if (cfg.services.auth) {
|
|
34004
34099
|
console.log();
|
|
34005
|
-
console.log(source_default.cyan(` const auth = getAuth(app);`));
|
|
34006
34100
|
console.log(source_default.cyan(` const { user } = await auth.signIn("email", "pass");`));
|
|
34007
34101
|
}
|
|
34102
|
+
if (cfg.services.storage) {
|
|
34103
|
+
console.log();
|
|
34104
|
+
console.log(source_default.cyan(` await storage.ref("uploads/photo.jpg").upload(file);`));
|
|
34105
|
+
}
|
|
34008
34106
|
if (cfg.services.hosting && cfg.hosting) {
|
|
34009
34107
|
console.log();
|
|
34010
34108
|
console.log(source_default.bold(" Deploy:"));
|
|
34011
|
-
console.log(source_default.cyan(` $ npm run build && clefbase deploy`));
|
|
34109
|
+
console.log(source_default.cyan(` $ npm run build && npx clefbase deploy`));
|
|
34012
34110
|
console.log(source_default.dim(` Site: ${cfg.serverUrl}/hosted/${cfg.projectId}/${cfg.hosting.siteId}`));
|
|
34013
34111
|
}
|
|
34014
34112
|
console.log();
|
package/dist/hosting/index.d.ts
CHANGED
|
@@ -74,14 +74,11 @@ export declare class SiteReference {
|
|
|
74
74
|
*
|
|
75
75
|
* @example
|
|
76
76
|
* import fs from "fs";
|
|
77
|
-
* import path from "path";
|
|
78
77
|
*
|
|
79
|
-
* const
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* const result = await site.deployFiles(files, {
|
|
78
|
+
* const result = await site.deployFiles({
|
|
79
|
+
* "index.html": fs.readFileSync("dist/index.html"),
|
|
80
|
+
* "app.js": fs.readFileSync("dist/app.js"),
|
|
81
|
+
* }, {
|
|
85
82
|
* message: "v1.2.0",
|
|
86
83
|
* onProgress: (done, total) => console.log(`${done}/${total}`),
|
|
87
84
|
* });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","s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AAM,GAAG,aAAa;IAMnC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI1B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IASrD,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAY/D,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAMtD,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,IAAI,GAAE,aAAkB,GACvB,OAAO,CAAC,YAAY,CAAC;CAoFzB"}
|
package/dist/hosting/index.js
CHANGED
|
@@ -66,14 +66,11 @@ class SiteReference {
|
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* import fs from "fs";
|
|
69
|
-
* import path from "path";
|
|
70
69
|
*
|
|
71
|
-
* const
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* const result = await site.deployFiles(files, {
|
|
70
|
+
* const result = await site.deployFiles({
|
|
71
|
+
* "index.html": fs.readFileSync("dist/index.html"),
|
|
72
|
+
* "app.js": fs.readFileSync("dist/app.js"),
|
|
73
|
+
* }, {
|
|
77
74
|
* message: "v1.2.0",
|
|
78
75
|
* onProgress: (done, total) => console.log(`${done}/${total}`),
|
|
79
76
|
* });
|
|
@@ -159,28 +156,43 @@ class ClefbaseHosting {
|
|
|
159
156
|
const fileBuffers = Object.values(files);
|
|
160
157
|
const errors = [];
|
|
161
158
|
let uploaded = 0;
|
|
162
|
-
// 2.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
159
|
+
// 2. Detect whether we have native FormData (Node 18+) or need form-data pkg
|
|
160
|
+
const hasNativeFormData = typeof FormData !== "undefined";
|
|
161
|
+
let FormDataLegacy;
|
|
162
|
+
if (!hasNativeFormData) {
|
|
168
163
|
const mod = await Promise.resolve().then(() => __importStar(require("form-data")));
|
|
169
|
-
|
|
164
|
+
FormDataLegacy = mod.default;
|
|
170
165
|
}
|
|
166
|
+
// 3. Upload in batches
|
|
171
167
|
for (let i = 0; i < filePaths.length; i += batchSize) {
|
|
172
168
|
const batchPaths = filePaths.slice(i, i + batchSize);
|
|
173
169
|
const batchBuffers = fileBuffers.slice(i, i + batchSize);
|
|
174
|
-
const form = new FormDataImpl();
|
|
175
|
-
for (let j = 0; j < batchPaths.length; j++) {
|
|
176
|
-
form.append("files[]", batchBuffers[j], {
|
|
177
|
-
filename: batchPaths[j].split("/").pop() ?? batchPaths[j],
|
|
178
|
-
contentType: "application/octet-stream",
|
|
179
|
-
});
|
|
180
|
-
form.append("filePaths", batchPaths[j]);
|
|
181
|
-
}
|
|
182
170
|
try {
|
|
183
|
-
|
|
171
|
+
if (hasNativeFormData) {
|
|
172
|
+
// Node 18+ native FormData: Buffers must be wrapped in Blob/File
|
|
173
|
+
const form = new FormData();
|
|
174
|
+
for (let j = 0; j < batchPaths.length; j++) {
|
|
175
|
+
const filename = batchPaths[j].split("/").pop() ?? batchPaths[j];
|
|
176
|
+
const buf = batchBuffers[j];
|
|
177
|
+
const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
|
|
178
|
+
const blob = new Blob([ab], { type: "application/octet-stream" });
|
|
179
|
+
form.append("files[]", new File([blob], filename, { type: "application/octet-stream" }));
|
|
180
|
+
form.append("filePaths", batchPaths[j]);
|
|
181
|
+
}
|
|
182
|
+
await this.http.request(`/databases/${this.dbId}/deploys/${pending.id}/files/batch`, { method: "POST", body: form, isFormData: true });
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// Older Node: form-data package accepts Buffers natively
|
|
186
|
+
const form = new FormDataLegacy();
|
|
187
|
+
for (let j = 0; j < batchPaths.length; j++) {
|
|
188
|
+
form.append("files[]", batchBuffers[j], {
|
|
189
|
+
filename: batchPaths[j].split("/").pop() ?? batchPaths[j],
|
|
190
|
+
contentType: "application/octet-stream",
|
|
191
|
+
});
|
|
192
|
+
form.append("filePaths", batchPaths[j]);
|
|
193
|
+
}
|
|
194
|
+
await this.http.request(`/databases/${this.dbId}/deploys/${pending.id}/files/batch`, { method: "POST", body: form, isFormData: true });
|
|
195
|
+
}
|
|
184
196
|
uploaded += batchPaths.length;
|
|
185
197
|
}
|
|
186
198
|
catch (err) {
|
|
@@ -188,7 +200,7 @@ class ClefbaseHosting {
|
|
|
188
200
|
}
|
|
189
201
|
onProgress?.(Math.min(i + batchSize, filePaths.length), filePaths.length);
|
|
190
202
|
}
|
|
191
|
-
//
|
|
203
|
+
// 4. Finalize → go live
|
|
192
204
|
const live = await this.http.post(`/databases/${this.dbId}/deploys/${pending.id}/finalize`, { message: message ?? "Deployed via clefbase SDK" });
|
|
193
205
|
return {
|
|
194
206
|
deploy: live,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hosting/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,iFAAiF;AAEjF;;;;;;;GAOG;AACH,MAAa,aAAa;IACxB,YACmB,OAAwB,EACzB,MAAc;QADb,YAAO,GAAP,OAAO,CAAiB;QACzB,WAAM,GAAN,MAAM,CAAQ;IAC7B,CAAC;IAEJ,yBAAyB;IACzB,KAAK,CAAC,GAAG;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,sDAAsD;IACtD,KAAK,CAAC,eAAe;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAED,qDAAqD;IACrD,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,YAA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