@partrocks/secrets 0.1.2 → 0.1.3

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/request.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type ClientOptions = {
2
- baseUrl: string;
3
2
  apiKey: string;
3
+ baseUrl?: string | null;
4
4
  };
5
5
  export type RequestOptions = {
6
6
  body?: unknown;
package/dist/request.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { PartRocksError } from "./error.js";
2
+ const DEFAULT_BASE_URL = "https://secrets.part.rocks";
2
3
  export function createRequest(options) {
3
- const baseUrl = options.baseUrl.replace(/\/+$/, "");
4
+ const trimmed = options.baseUrl?.trim() ?? "";
5
+ const baseUrl = (trimmed === "" ? DEFAULT_BASE_URL : trimmed).replace(/\/+$/, "");
4
6
  return async function request(method, path, extra = {}) {
5
7
  const headers = {
6
8
  Accept: "application/json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@partrocks/secrets",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Server-side PartRocks Secrets client",
5
5
  "type": "module",
6
6
  "license": "MIT",