@gasboost/cli 0.3.5 → 0.3.6
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/rtdb/RtdbRulesCommand.d.ts +2 -5
- package/dist/rtdb/RtdbRulesCommand.d.ts.map +1 -1
- package/dist/rtdb/RtdbRulesCommand.js +4 -30
- package/dist/rtdb/RtdbRulesCommand.js.map +1 -1
- package/dist/rtdb/RtdbRulesWriter.d.ts +1 -9
- package/dist/rtdb/RtdbRulesWriter.d.ts.map +1 -1
- package/dist/rtdb/RtdbRulesWriter.js +1 -16
- package/dist/rtdb/RtdbRulesWriter.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type { ModuleLoader, NormalizedGasboostConfig } from "@gasboost/config";
|
|
2
|
-
import type { RtdbRulesWriter } from "./RtdbRulesWriter.js";
|
|
1
|
+
import type { ModuleLoader, NormalizedGasboostConfig, RtdbRulesWriter } from "@gasboost/config";
|
|
3
2
|
export declare class RtdbRulesCommand {
|
|
4
|
-
private readonly
|
|
5
|
-
private readonly moduleLoader;
|
|
6
|
-
private readonly writer;
|
|
3
|
+
private readonly generator;
|
|
7
4
|
constructor({ loadConfig, moduleLoader, writer, }: {
|
|
8
5
|
loadConfig: () => Promise<NormalizedGasboostConfig>;
|
|
9
6
|
moduleLoader: ModuleLoader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RtdbRulesCommand.d.ts","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesCommand.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,
|
|
1
|
+
{"version":3,"file":"RtdbRulesCommand.d.ts","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesCommand.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEhG,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;IAE/C,YAAmB,EACjB,UAAU,EACV,YAAY,EACZ,MAAM,GACP,EAAE;QACD,UAAU,EAAE,MAAM,OAAO,CAAC,wBAAwB,CAAC,CAAC;QACpD,YAAY,EAAE,YAAY,CAAC;QAC3B,MAAM,EAAE,eAAe,CAAC;KACzB,EAEA;IAEY,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAEtC;CACF"}
|
|
@@ -1,37 +1,11 @@
|
|
|
1
|
+
import { RtdbRulesGenerator } from "@gasboost/config";
|
|
1
2
|
export class RtdbRulesCommand {
|
|
2
|
-
|
|
3
|
-
moduleLoader;
|
|
4
|
-
writer;
|
|
3
|
+
generator;
|
|
5
4
|
constructor({ loadConfig, moduleLoader, writer, }) {
|
|
6
|
-
this.
|
|
7
|
-
this.moduleLoader = moduleLoader;
|
|
8
|
-
this.writer = writer;
|
|
5
|
+
this.generator = new RtdbRulesGenerator({ loadConfig, moduleLoader, writer });
|
|
9
6
|
}
|
|
10
7
|
async execute() {
|
|
11
|
-
|
|
12
|
-
const rtdb = config.firebase?.realtimeDatabase;
|
|
13
|
-
if (rtdb === undefined) {
|
|
14
|
-
throw new Error("RTDB configuration was not found in gasboost.config.ts.");
|
|
15
|
-
}
|
|
16
|
-
if (rtdb.source.length === 0) {
|
|
17
|
-
throw new Error("firebase.realtimeDatabase.source must not be empty.");
|
|
18
|
-
}
|
|
19
|
-
if (rtdb.out.length === 0) {
|
|
20
|
-
throw new Error("firebase.realtimeDatabase.out must not be empty.");
|
|
21
|
-
}
|
|
22
|
-
const source = await this.moduleLoader.import(rtdb.source);
|
|
23
|
-
if (typeof source.rtdb !== "object" ||
|
|
24
|
-
source.rtdb === null ||
|
|
25
|
-
!("rules" in source.rtdb) ||
|
|
26
|
-
typeof source.rtdb.rules !== "function") {
|
|
27
|
-
throw new Error(`RTDB source '${rtdb.source}' must export 'rtdb' with a rules() method.`);
|
|
28
|
-
}
|
|
29
|
-
const definition = source.rtdb;
|
|
30
|
-
const rules = definition.rules();
|
|
31
|
-
return this.writer.write({
|
|
32
|
-
out: rtdb.out,
|
|
33
|
-
rules,
|
|
34
|
-
});
|
|
8
|
+
return (await this.generator.generate()).outputPath;
|
|
35
9
|
}
|
|
36
10
|
}
|
|
37
11
|
//# sourceMappingURL=RtdbRulesCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RtdbRulesCommand.js","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RtdbRulesCommand.js","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,OAAO,gBAAgB;IACV,SAAS,CAAqB;IAE/C,YAAmB,EACjB,UAAU,EACV,YAAY,EACZ,MAAM,GAKP;QACC,IAAI,CAAC,SAAS,GAAG,IAAI,kBAAkB,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;IAChF,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,OAAO,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare class RtdbRulesWriter {
|
|
3
|
-
private readonly projectRoot;
|
|
4
|
-
constructor(projectRoot: string);
|
|
5
|
-
write({ out, rules, }: {
|
|
6
|
-
out: string;
|
|
7
|
-
rules: FirebaseRtdbRulesJson;
|
|
8
|
-
}): Promise<string>;
|
|
9
|
-
}
|
|
1
|
+
export { RtdbRulesWriter } from "@gasboost/config";
|
|
10
2
|
//# sourceMappingURL=RtdbRulesWriter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RtdbRulesWriter.d.ts","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesWriter.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"RtdbRulesWriter.d.ts","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { dirname, resolve } from "node:path";
|
|
3
|
-
export class RtdbRulesWriter {
|
|
4
|
-
projectRoot;
|
|
5
|
-
constructor(projectRoot) {
|
|
6
|
-
this.projectRoot = projectRoot;
|
|
7
|
-
}
|
|
8
|
-
async write({ out, rules, }) {
|
|
9
|
-
const outputPath = resolve(this.projectRoot, out);
|
|
10
|
-
await mkdir(dirname(outputPath), {
|
|
11
|
-
recursive: true,
|
|
12
|
-
});
|
|
13
|
-
await writeFile(outputPath, `${JSON.stringify(rules, null, 2)}\n`, "utf8");
|
|
14
|
-
return outputPath;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
export { RtdbRulesWriter } from "@gasboost/config";
|
|
17
2
|
//# sourceMappingURL=RtdbRulesWriter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RtdbRulesWriter.js","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesWriter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RtdbRulesWriter.js","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasboost/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Developer tooling for the Gasboost ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"node": ">=24"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@gasboost/
|
|
24
|
-
"@gasboost/
|
|
23
|
+
"@gasboost/console": "0.5.0",
|
|
24
|
+
"@gasboost/config": "0.2.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@gasboost/realtime-firebase": "^0.1.0",
|