@niledatabase/server 4.1.1-alpha.2 → 4.2.0-alpha.0

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.d.mts CHANGED
@@ -257,6 +257,7 @@ declare class Tenants extends Config {
257
257
  get tenantUrl(): string;
258
258
  createTenant: <T = Tenant | Response>(req: NileRequest<{
259
259
  name: string;
260
+ id?: string;
260
261
  }> | Headers | string, init?: RequestInit) => Promise<T>;
261
262
  getTenant: <T = Tenant | Response>(req: NileRequest<{
262
263
  id: string;
package/dist/index.d.ts CHANGED
@@ -257,6 +257,7 @@ declare class Tenants extends Config {
257
257
  get tenantUrl(): string;
258
258
  createTenant: <T = Tenant | Response>(req: NileRequest<{
259
259
  name: string;
260
+ id?: string;
260
261
  }> | Headers | string, init?: RequestInit) => Promise<T>;
261
262
  getTenant: <T = Tenant | Response>(req: NileRequest<{
262
263
  id: string;
package/dist/index.js CHANGED
@@ -325,12 +325,12 @@ var getPassword = (cfg) => {
325
325
  const log = logProtector(logger);
326
326
  const { info } = Logger(config, "[password]");
327
327
  if (stringCheck(config?.password)) {
328
- log && info(`${logger}[config] ${config?.password}`);
328
+ log && info(`${logger}[config] ***`);
329
329
  return String(config?.password);
330
330
  }
331
331
  const pass = stringCheck(process.env.NILEDB_PASSWORD);
332
332
  if (pass) {
333
- logger && info(`${logger}[NILEDB_PASSWORD] ${pass}`);
333
+ logger && info(`${logger}[NILEDB_PASSWORD] ***`);
334
334
  return pass;
335
335
  }
336
336
  const pg2 = stringCheck(process.env.NILEDB_POSTGRES_URL);
@@ -619,7 +619,9 @@ var Config = class {
619
619
  database: this.databaseName,
620
620
  ...dbConfig
621
621
  };
622
- info("[config set]", { db: this.db, api: this.api });
622
+ const cloned = { ...this.db };
623
+ cloned.password = "***";
624
+ info("[config set]", { db: cloned, api: this.api });
623
625
  return this;
624
626
  } else {
625
627
  const msg = [];
@@ -807,7 +809,9 @@ var NileDatabase = class {
807
809
  const { afterCreate, ...remaining } = poolConfig;
808
810
  config.db = poolConfig;
809
811
  this.config = config;
810
- debug(`Connection pool config ${JSON.stringify(this.config.db)}`);
812
+ const cloned = { ...this.config.db };
813
+ cloned.password = "***";
814
+ debug(`Connection pool config ${JSON.stringify(cloned)}`);
811
815
  this.pool = createProxyForPool(new pg__default.default.Pool(remaining), this.config);
812
816
  if (typeof afterCreate === "function") {
813
817
  warn(
@@ -2305,6 +2309,14 @@ var Tenants = class extends Config {
2305
2309
  "content-type": "application/json"
2306
2310
  }
2307
2311
  });
2312
+ } else if ("name" in req || "id" in req) {
2313
+ _req = new Request(`${this.api.basePath}${this.tenantsUrl}`, {
2314
+ body: JSON.stringify(req),
2315
+ method: "POST",
2316
+ headers: {
2317
+ "content-type": "application/json"
2318
+ }
2319
+ });
2308
2320
  } else {
2309
2321
  _req = req;
2310
2322
  }