@seamapi/http 2.4.2 → 2.4.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.
@@ -1,2 +1,4 @@
1
- export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Keys extends keyof T ? Required<Pick<T, Keys>> & Partial<Omit<T, Keys>> : never;
1
+ export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Keys extends keyof T ? {
2
+ [Key in Keys]-?: Exclude<T[Key], undefined>;
3
+ } & Partial<Omit<T, Keys>> : never;
2
4
  export declare const assertValidRequestParameters: (parameters: unknown, path: string, hasRequiredParameters: boolean) => void;
@@ -10,8 +10,9 @@ export const assertValidRequestParameters = (parameters, path, hasRequiredParame
10
10
  Array.isArray(parameters)) {
11
11
  throw new TypeError(`Parameters for ${path} must be an object`);
12
12
  }
13
- if (hasRequiredParameters && Object.keys(parameters).length === 0) {
14
- throw new TypeError(`Parameters for ${path} must contain at least one property`);
13
+ if (hasRequiredParameters &&
14
+ Object.values(parameters).every((value) => value === undefined)) {
15
+ throw new TypeError(`At least one parameter is required for ${path}`);
15
16
  }
16
17
  };
17
18
  //# sourceMappingURL=request-parameters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-parameters.js","sourceRoot":"","sources":["../src/lib/request-parameters.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,UAAmB,EACnB,IAAY,EACZ,qBAA8B,EACxB,EAAE;IACR,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,IAAI,qBAAqB,EAAE,CAAC;YAC1B,MAAM,IAAI,SAAS,CAAC,+BAA+B,IAAI,EAAE,CAAC,CAAA;QAC5D,CAAC;QACD,OAAM;IACR,CAAC;IAED,IACE,UAAU,KAAK,IAAI;QACnB,OAAO,UAAU,KAAK,QAAQ;QAC9B,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EACzB,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,kBAAkB,IAAI,oBAAoB,CAAC,CAAA;IACjE,CAAC;IAED,IAAI,qBAAqB,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,SAAS,CACjB,kBAAkB,IAAI,qCAAqC,CAC5D,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
1
+ {"version":3,"file":"request-parameters.js","sourceRoot":"","sources":["../src/lib/request-parameters.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,UAAmB,EACnB,IAAY,EACZ,qBAA8B,EACxB,EAAE;IACR,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,IAAI,qBAAqB,EAAE,CAAC;YAC1B,MAAM,IAAI,SAAS,CAAC,+BAA+B,IAAI,EAAE,CAAC,CAAA;QAC5D,CAAC;QACD,OAAM;IACR,CAAC;IAED,IACE,UAAU,KAAK,IAAI;QACnB,OAAO,UAAU,KAAK,QAAQ;QAC9B,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EACzB,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,kBAAkB,IAAI,oBAAoB,CAAC,CAAA;IACjE,CAAC;IAED,IACE,qBAAqB;QACrB,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,EAC/D,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,0CAA0C,IAAI,EAAE,CAAC,CAAA;IACvE,CAAC;AACH,CAAC,CAAA"}
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const seamapiJavascriptHttpVersion = "2.4.2";
1
+ declare const seamapiJavascriptHttpVersion = "2.4.3";
2
2
  export default seamapiJavascriptHttpVersion;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '2.4.2';
1
+ const seamapiJavascriptHttpVersion = '2.4.3';
2
2
  export default seamapiJavascriptHttpVersion;
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamapi/http",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "JavaScript HTTP client for the Seam API written in TypeScript.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -2,7 +2,7 @@ export type RequireAtLeastOne<
2
2
  T,
3
3
  Keys extends keyof T = keyof T,
4
4
  > = Keys extends keyof T
5
- ? Required<Pick<T, Keys>> & Partial<Omit<T, Keys>>
5
+ ? { [Key in Keys]-?: Exclude<T[Key], undefined> } & Partial<Omit<T, Keys>>
6
6
  : never
7
7
 
8
8
  export const assertValidRequestParameters = (
@@ -25,9 +25,10 @@ export const assertValidRequestParameters = (
25
25
  throw new TypeError(`Parameters for ${path} must be an object`)
26
26
  }
27
27
 
28
- if (hasRequiredParameters && Object.keys(parameters).length === 0) {
29
- throw new TypeError(
30
- `Parameters for ${path} must contain at least one property`,
31
- )
28
+ if (
29
+ hasRequiredParameters &&
30
+ Object.values(parameters).every((value) => value === undefined)
31
+ ) {
32
+ throw new TypeError(`At least one parameter is required for ${path}`)
32
33
  }
33
34
  }
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '2.4.2'
1
+ const seamapiJavascriptHttpVersion = '2.4.3'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion