@zenstackhq/cli 3.4.0 → 3.4.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/index.cjs +12 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -1460,7 +1460,6 @@ __name(parseEnumValues, "parseEnumValues");
|
|
|
1460
1460
|
|
|
1461
1461
|
// src/actions/pull/provider/postgresql.ts
|
|
1462
1462
|
var import_factory3 = require("@zenstackhq/language/factory");
|
|
1463
|
-
var import_pg = require("pg");
|
|
1464
1463
|
var pgTypnameToStandard = {
|
|
1465
1464
|
int2: "smallint",
|
|
1466
1465
|
int4: "integer",
|
|
@@ -1630,7 +1629,8 @@ var postgresql = {
|
|
|
1630
1629
|
}
|
|
1631
1630
|
},
|
|
1632
1631
|
async introspect(connectionString, options) {
|
|
1633
|
-
const
|
|
1632
|
+
const { Client } = await import("pg");
|
|
1633
|
+
const client = new Client({
|
|
1634
1634
|
connectionString
|
|
1635
1635
|
});
|
|
1636
1636
|
await client.connect();
|
|
@@ -3680,7 +3680,8 @@ async function run9(options) {
|
|
|
3680
3680
|
}
|
|
3681
3681
|
const provider = (0, import_utils8.getStringLiteral)(dataSource?.fields.find((f) => f.name === "provider")?.value);
|
|
3682
3682
|
const dialect = await createDialect(provider, databaseUrl, outputPath);
|
|
3683
|
-
const
|
|
3683
|
+
const fileUrl = typeof __filename !== "undefined" ? __filename : import_meta3.url;
|
|
3684
|
+
const jiti = (0, import_jiti2.createJiti)(fileUrl);
|
|
3684
3685
|
const schemaModule = await jiti.import(import_node_path9.default.join(outputPath, "schema"));
|
|
3685
3686
|
const schema = schemaModule.schema;
|
|
3686
3687
|
const omit = {};
|
|
@@ -3698,7 +3699,8 @@ async function run9(options) {
|
|
|
3698
3699
|
const db = new import_orm.ZenStackClient(schema, {
|
|
3699
3700
|
dialect,
|
|
3700
3701
|
log: log && log.length > 0 ? log : void 0,
|
|
3701
|
-
omit: Object.keys(omit).length > 0 ? omit : void 0
|
|
3702
|
+
omit: Object.keys(omit).length > 0 ? omit : void 0,
|
|
3703
|
+
skipValidationForComputedFields: true
|
|
3702
3704
|
});
|
|
3703
3705
|
try {
|
|
3704
3706
|
await db.$connect();
|
|
@@ -3791,7 +3793,7 @@ async function createDialect(provider, databaseUrl, outputPath) {
|
|
|
3791
3793
|
}
|
|
3792
3794
|
}
|
|
3793
3795
|
__name(createDialect, "createDialect");
|
|
3794
|
-
function
|
|
3796
|
+
function createProxyApp(client, schema) {
|
|
3795
3797
|
const app = (0, import_express2.default)();
|
|
3796
3798
|
app.use((0, import_cors.default)());
|
|
3797
3799
|
app.use(import_express2.default.json({
|
|
@@ -3813,6 +3815,11 @@ function startServer(client, schema, options) {
|
|
|
3813
3815
|
zenstackVersion: getVersion()
|
|
3814
3816
|
});
|
|
3815
3817
|
});
|
|
3818
|
+
return app;
|
|
3819
|
+
}
|
|
3820
|
+
__name(createProxyApp, "createProxyApp");
|
|
3821
|
+
function startServer(client, schema, options) {
|
|
3822
|
+
const app = createProxyApp(client, schema);
|
|
3816
3823
|
const server = app.listen(options.port, () => {
|
|
3817
3824
|
console.log(`ZenStack proxy server is running on port: ${options.port}`);
|
|
3818
3825
|
console.log(`You can visit ZenStack Studio at: ${import_colors11.default.blue("https://studio.zenstack.dev")}`);
|