@hasna/cloud 0.1.15 → 0.1.17

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/config.d.ts CHANGED
@@ -7,17 +7,17 @@ export declare const CloudConfigSchema: z.ZodObject<{
7
7
  password_env: z.ZodDefault<z.ZodString>;
8
8
  ssl: z.ZodDefault<z.ZodBoolean>;
9
9
  }, "strip", z.ZodTypeAny, {
10
+ ssl: boolean;
10
11
  host: string;
11
12
  port: number;
12
13
  username: string;
13
14
  password_env: string;
14
- ssl: boolean;
15
15
  }, {
16
+ ssl?: boolean | undefined;
16
17
  host?: string | undefined;
17
18
  port?: number | undefined;
18
19
  username?: string | undefined;
19
20
  password_env?: string | undefined;
20
- ssl?: boolean | undefined;
21
21
  }>>;
22
22
  mode: z.ZodDefault<z.ZodEnum<["local", "cloud", "hybrid"]>>;
23
23
  auto_sync_interval_minutes: z.ZodDefault<z.ZodNumber>;
@@ -31,11 +31,11 @@ export declare const CloudConfigSchema: z.ZodObject<{
31
31
  }>>;
32
32
  }, "strip", z.ZodTypeAny, {
33
33
  rds: {
34
+ ssl: boolean;
34
35
  host: string;
35
36
  port: number;
36
37
  username: string;
37
38
  password_env: string;
38
- ssl: boolean;
39
39
  };
40
40
  mode: "local" | "cloud" | "hybrid";
41
41
  auto_sync_interval_minutes: number;
@@ -45,11 +45,11 @@ export declare const CloudConfigSchema: z.ZodObject<{
45
45
  };
46
46
  }, {
47
47
  rds?: {
48
+ ssl?: boolean | undefined;
48
49
  host?: string | undefined;
49
50
  port?: number | undefined;
50
51
  username?: string | undefined;
51
52
  password_env?: string | undefined;
52
- ssl?: boolean | undefined;
53
53
  } | undefined;
54
54
  mode?: "local" | "cloud" | "hybrid" | undefined;
55
55
  auto_sync_interval_minutes?: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,M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tC;AAMD,wBAAgB,cAAc,IAAI,WAAW,CAU5C;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAGzD;AAMD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAoB1D;AAMD,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxE,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpC,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,SAAS,CAaxE"}
package/dist/index.js CHANGED
@@ -5048,7 +5048,8 @@ class PgAdapter {
5048
5048
  _client = null;
5049
5049
  constructor(arg) {
5050
5050
  if (typeof arg === "string") {
5051
- this.pool = new esm_default.Pool({ connectionString: arg });
5051
+ const sslConfig = arg.includes("sslmode=require") || arg.includes("ssl=true") ? { rejectUnauthorized: false } : undefined;
5052
+ this.pool = new esm_default.Pool({ connectionString: arg, ssl: sslConfig });
5052
5053
  } else {
5053
5054
  this.pool = arg;
5054
5055
  }
@@ -5175,7 +5176,8 @@ class PgAdapterAsync {
5175
5176
  pool;
5176
5177
  constructor(arg) {
5177
5178
  if (typeof arg === "string") {
5178
- this.pool = new esm_default.Pool({ connectionString: arg });
5179
+ const sslConfig = arg.includes("sslmode=require") || arg.includes("ssl=true") ? { rejectUnauthorized: false } : undefined;
5180
+ this.pool = new esm_default.Pool({ connectionString: arg, ssl: sslConfig });
5179
5181
  } else {
5180
5182
  this.pool = arg;
5181
5183
  }
@@ -9294,7 +9296,10 @@ function getConnectionString(dbName) {
9294
9296
  if (!host || !username) {
9295
9297
  throw new Error("Cloud RDS not configured. Run `cloud setup` to configure.");
9296
9298
  }
9297
- const password = process.env[password_env] ?? "";
9299
+ const password = process.env[password_env];
9300
+ if (password === undefined || password === "") {
9301
+ throw new Error(`RDS password not set. Export ${password_env} in your shell or add it to ~/.secrets/hasna/rds/live.env`);
9302
+ }
9298
9303
  const sslParam = ssl ? "?sslmode=require" : "";
9299
9304
  return `postgres://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbName}${sslParam}`;
9300
9305
  }
@@ -9321,7 +9326,7 @@ var init_config = __esm(() => {
9321
9326
  password_env: exports_external.string().default("HASNA_RDS_PASSWORD"),
9322
9327
  ssl: exports_external.boolean().default(true)
9323
9328
  }).default({}),
9324
- mode: exports_external.enum(["local", "cloud", "hybrid"]).default("local"),
9329
+ mode: exports_external.enum(["local", "cloud", "hybrid"]).default("hybrid"),
9325
9330
  auto_sync_interval_minutes: exports_external.number().default(0),
9326
9331
  feedback_endpoint: exports_external.string().default("https://feedback.hasna.com/api/v1/feedback"),
9327
9332
  sync: exports_external.object({
package/dist/mcp/index.js CHANGED
@@ -24468,7 +24468,8 @@ class PgAdapter {
24468
24468
  _client = null;
24469
24469
  constructor(arg) {
24470
24470
  if (typeof arg === "string") {
24471
- this.pool = new esm_default.Pool({ connectionString: arg });
24471
+ const sslConfig = arg.includes("sslmode=require") || arg.includes("ssl=true") ? { rejectUnauthorized: false } : undefined;
24472
+ this.pool = new esm_default.Pool({ connectionString: arg, ssl: sslConfig });
24472
24473
  } else {
24473
24474
  this.pool = arg;
24474
24475
  }
@@ -24620,7 +24621,7 @@ var CloudConfigSchema = exports_external.object({
24620
24621
  password_env: exports_external.string().default("HASNA_RDS_PASSWORD"),
24621
24622
  ssl: exports_external.boolean().default(true)
24622
24623
  }).default({}),
24623
- mode: exports_external.enum(["local", "cloud", "hybrid"]).default("local"),
24624
+ mode: exports_external.enum(["local", "cloud", "hybrid"]).default("hybrid"),
24624
24625
  auto_sync_interval_minutes: exports_external.number().default(0),
24625
24626
  feedback_endpoint: exports_external.string().default("https://feedback.hasna.com/api/v1/feedback"),
24626
24627
  sync: exports_external.object({
@@ -24646,7 +24647,10 @@ function getConnectionString(dbName) {
24646
24647
  if (!host || !username) {
24647
24648
  throw new Error("Cloud RDS not configured. Run `cloud setup` to configure.");
24648
24649
  }
24649
- const password = process.env[password_env] ?? "";
24650
+ const password = process.env[password_env];
24651
+ if (password === undefined || password === "") {
24652
+ throw new Error(`RDS password not set. Export ${password_env} in your shell or add it to ~/.secrets/hasna/rds/live.env`);
24653
+ }
24650
24654
  const sslParam = ssl ? "?sslmode=require" : "";
24651
24655
  return `postgres://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbName}${sslParam}`;
24652
24656
  }
@@ -25051,7 +25055,7 @@ var CloudConfigSchema2 = exports_external.object({
25051
25055
  password_env: exports_external.string().default("HASNA_RDS_PASSWORD"),
25052
25056
  ssl: exports_external.boolean().default(true)
25053
25057
  }).default({}),
25054
- mode: exports_external.enum(["local", "cloud", "hybrid"]).default("local"),
25058
+ mode: exports_external.enum(["local", "cloud", "hybrid"]).default("hybrid"),
25055
25059
  auto_sync_interval_minutes: exports_external.number().default(0),
25056
25060
  feedback_endpoint: exports_external.string().default("https://feedback.hasna.com/api/v1/feedback"),
25057
25061
  sync: exports_external.object({
@@ -25220,7 +25224,8 @@ class PgAdapterAsync {
25220
25224
  pool;
25221
25225
  constructor(arg) {
25222
25226
  if (typeof arg === "string") {
25223
- this.pool = new esm_default.Pool({ connectionString: arg });
25227
+ const sslConfig = arg.includes("sslmode=require") || arg.includes("ssl=true") ? { rejectUnauthorized: false } : undefined;
25228
+ this.pool = new esm_default.Pool({ connectionString: arg, ssl: sslConfig });
25224
25229
  } else {
25225
25230
  this.pool = arg;
25226
25231
  }
@@ -9014,7 +9014,8 @@ class PgAdapterAsync {
9014
9014
  pool;
9015
9015
  constructor(arg) {
9016
9016
  if (typeof arg === "string") {
9017
- this.pool = new esm_default.Pool({ connectionString: arg });
9017
+ const sslConfig = arg.includes("sslmode=require") || arg.includes("ssl=true") ? { rejectUnauthorized: false } : undefined;
9018
+ this.pool = new esm_default.Pool({ connectionString: arg, ssl: sslConfig });
9018
9019
  } else {
9019
9020
  this.pool = arg;
9020
9021
  }
@@ -9095,7 +9096,7 @@ var CloudConfigSchema = exports_external.object({
9095
9096
  password_env: exports_external.string().default("HASNA_RDS_PASSWORD"),
9096
9097
  ssl: exports_external.boolean().default(true)
9097
9098
  }).default({}),
9098
- mode: exports_external.enum(["local", "cloud", "hybrid"]).default("local"),
9099
+ mode: exports_external.enum(["local", "cloud", "hybrid"]).default("hybrid"),
9099
9100
  auto_sync_interval_minutes: exports_external.number().default(0),
9100
9101
  feedback_endpoint: exports_external.string().default("https://feedback.hasna.com/api/v1/feedback"),
9101
9102
  sync: exports_external.object({
@@ -9121,7 +9122,10 @@ function getConnectionString(dbName) {
9121
9122
  if (!host || !username) {
9122
9123
  throw new Error("Cloud RDS not configured. Run `cloud setup` to configure.");
9123
9124
  }
9124
- const password = process.env[password_env] ?? "";
9125
+ const password = process.env[password_env];
9126
+ if (password === undefined || password === "") {
9127
+ throw new Error(`RDS password not set. Export ${password_env} in your shell or add it to ~/.secrets/hasna/rds/live.env`);
9128
+ }
9125
9129
  const sslParam = ssl ? "?sslmode=require" : "";
9126
9130
  return `postgres://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbName}${sslParam}`;
9127
9131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/cloud",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Shared cloud infrastructure — database adapter (SQLite + PostgreSQL), sync engine, feedback system, unified dotfile config",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",