@parseapi/sdk 1.10.1 → 1.10.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/README.md CHANGED
@@ -258,6 +258,8 @@ const units = await parse.measure.units({ unit: 'm' });
258
258
 
259
259
  `amount` is a decimal string, such as `"180.34"`. Without `to`, the API returns the canonical unit for the measurement type. Pass `locale` for number formatting and `system` (`us` or `imperial`) when a customary unit needs context. Ambiguous input returns `valid: false`, a `reason`, and available `choices`. Invalid or incompatible target units use the normal API error.
260
260
 
261
+ Successful HTTP JSON contains `measure`, `valid`, `type`, `amount`, and `unit`. Invalid input adds `reason`. `choices` appears only when unit alternatives are available. The typed client keeps `reason` readable as `null` and `choices` as `[]` when omitted, while JSON serialization retains the API response shape.
262
+
261
263
  Unit discovery accepts optional `query`, `type`, and `unit` filters. `unit` selects compatible targets. Omit the filters for the reviewed catalog. Both operations use pooled requests.
262
264
 
263
265
  ## Place statistics and optional detail
package/dist/index.cjs CHANGED
@@ -285,7 +285,7 @@ var EmojiCatalog = class {
285
285
  };
286
286
 
287
287
  // src/index.ts
288
- var VERSION = "1.10.0";
288
+ var VERSION = "1.10.2";
289
289
  var API_VERSION = "2.0.0";
290
290
  var DEFAULT_BASE_URL = "https://api.parseapi.com";
291
291
  var DEFAULT_TIMEOUT_MS = 1e4;
@@ -612,7 +612,12 @@ function parseAPI(apiKey, options = {}) {
612
612
  },
613
613
  /** Parse a measurement or convert it to `to`. Without `to`, use its type's canonical unit. Invalid input is plain data with `valid: false`. */
614
614
  measure: Object.assign(
615
- (measure, opts) => request(`/measure/${enc(measure)}`, { to: opts?.to, locale: opts?.locale, system: opts?.system }, void 0, opts),
615
+ async (measure, opts) => {
616
+ const result = await request(`/measure/${enc(measure)}`, { to: opts?.to, locale: opts?.locale, system: opts?.system }, void 0, opts);
617
+ if (!Object.prototype.hasOwnProperty.call(result, "reason")) Object.defineProperty(result, "reason", { value: null, writable: true, configurable: true });
618
+ if (!Object.prototype.hasOwnProperty.call(result, "choices")) Object.defineProperty(result, "choices", { value: [], writable: true, configurable: true });
619
+ return result;
620
+ },
616
621
  {
617
622
  /** Discover reviewed units. Pass `unit` to find compatible conversion targets. */
618
623
  units: (opts) => request("/measure/units", { q: opts?.query, type: opts?.type, unit: opts?.unit }, void 0, opts)
package/dist/index.d.cts CHANGED
@@ -19,7 +19,9 @@ interface Measure {
19
19
  type: string | null;
20
20
  amount: string | null;
21
21
  unit: string | null;
22
+ /** Failure reason. Omitted wire fields remain readable as null. */
22
23
  reason: string | null;
24
+ /** Unit alternatives. Omitted wire fields remain readable as an empty array. */
23
25
  choices: MeasureChoice[];
24
26
  }
25
27
  interface MeasureUnit {
package/dist/index.d.ts CHANGED
@@ -19,7 +19,9 @@ interface Measure {
19
19
  type: string | null;
20
20
  amount: string | null;
21
21
  unit: string | null;
22
+ /** Failure reason. Omitted wire fields remain readable as null. */
22
23
  reason: string | null;
24
+ /** Unit alternatives. Omitted wire fields remain readable as an empty array. */
23
25
  choices: MeasureChoice[];
24
26
  }
25
27
  interface MeasureUnit {
package/dist/index.js CHANGED
@@ -256,7 +256,7 @@ var EmojiCatalog = class {
256
256
  };
257
257
 
258
258
  // src/index.ts
259
- var VERSION = "1.10.0";
259
+ var VERSION = "1.10.2";
260
260
  var API_VERSION = "2.0.0";
261
261
  var DEFAULT_BASE_URL = "https://api.parseapi.com";
262
262
  var DEFAULT_TIMEOUT_MS = 1e4;
@@ -583,7 +583,12 @@ function parseAPI(apiKey, options = {}) {
583
583
  },
584
584
  /** Parse a measurement or convert it to `to`. Without `to`, use its type's canonical unit. Invalid input is plain data with `valid: false`. */
585
585
  measure: Object.assign(
586
- (measure, opts) => request(`/measure/${enc(measure)}`, { to: opts?.to, locale: opts?.locale, system: opts?.system }, void 0, opts),
586
+ async (measure, opts) => {
587
+ const result = await request(`/measure/${enc(measure)}`, { to: opts?.to, locale: opts?.locale, system: opts?.system }, void 0, opts);
588
+ if (!Object.prototype.hasOwnProperty.call(result, "reason")) Object.defineProperty(result, "reason", { value: null, writable: true, configurable: true });
589
+ if (!Object.prototype.hasOwnProperty.call(result, "choices")) Object.defineProperty(result, "choices", { value: [], writable: true, configurable: true });
590
+ return result;
591
+ },
587
592
  {
588
593
  /** Discover reviewed units. Pass `unit` to find compatible conversion targets. */
589
594
  units: (opts) => request("/measure/units", { q: opts?.query, type: opts?.type, unit: opts?.unit }, void 0, opts)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parseapi/sdk",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "Official ParseAPI client for Node and TypeScript. One key, minimal JSON, fast.",
5
5
  "keywords": [
6
6
  "parseapi",