astromansion 0.1.0-alpha.1 → 0.1.0-alpha.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/dist/index.cjs CHANGED
@@ -392,7 +392,7 @@ var KEY_MASK = Object.freeze({
392
392
 
393
393
  // package.json
394
394
  var name = "astromansion";
395
- var version = "0.1.0-alpha.1";
395
+ var version = "0.1.0-alpha.2";
396
396
 
397
397
  // src/models/constants/package.ts
398
398
  var PACKAGE_IDENTITY = Object.freeze({
@@ -955,6 +955,27 @@ function isBatchResponse(value) {
955
955
  function isBodyRow(value) {
956
956
  return isJsonObject(value) && typeof value["name"] === "string" && (value["sign"] === void 0 || typeof value["sign"] === "string" || value["sign"] === null) && (value["dms"] === void 0 || typeof value["dms"] === "string" || value["dms"] === null) && (value["house"] === void 0 || Number.isInteger(value["house"]) || value["house"] === null) && typeof value["retrograde"] === "boolean";
957
957
  }
958
+ function isCustomBodyAspect(value) {
959
+ return isJsonObject(value) && typeof value["a"] === "string" && typeof value["b"] === "string" && typeof value["aspect"] === "string" && typeof value["orb"] === "number";
960
+ }
961
+ function isCustomBodyDeleteResponse(value) {
962
+ return isJsonObject(value) && typeof value["deleted"] === "boolean";
963
+ }
964
+ function isCustomBodyListResponse(value) {
965
+ return isJsonObject(value) && Number.isInteger(value["count"]) && isJsonArrayOf(value["bodies"], (item0) => isSavedCustomBody(item0));
966
+ }
967
+ function isCustomBodyPlacedResponse(value) {
968
+ return isJsonObject(value) && isCustomBodyPlacement(value["result"]);
969
+ }
970
+ function isCustomBodyPlacement(value) {
971
+ return isJsonObject(value) && isCustomBodyReading(value["body"]) && (value["wheel"] === void 0 || typeof value["wheel"] === "string") && (value["aspects"] === void 0 || isJsonArrayOf(value["aspects"], (item0) => isCustomBodyAspect(item0)));
972
+ }
973
+ function isCustomBodyReading(value) {
974
+ return isJsonObject(value) && typeof value["name"] === "string" && typeof value["lon"] === "number" && typeof value["lat"] === "number" && typeof value["sign"] === "string" && typeof value["dms"] === "string" && (value["house"] === void 0 || Number.isInteger(value["house"]) || value["house"] === null) && typeof value["speed"] === "number" && typeof value["retrograde"] === "boolean" && typeof value["type"] === "string";
975
+ }
976
+ function isCustomBodySaveResponse(value) {
977
+ return isJsonObject(value) && isCustomBodyPlacement(value["result"]) && typeof value["saved"] === "boolean";
978
+ }
958
979
  function isEclipseEvent(value) {
959
980
  return isJsonObject(value) && typeof value["kind"] === "string" && typeof value["type"] === "string" && typeof value["date"] === "string" && typeof value["time"] === "string" && typeof value["timestamp_utc"] === "string" && typeof value["sign"] === "string" && typeof value["dms"] === "string";
960
981
  }
@@ -1018,6 +1039,9 @@ function isSaturnReturnEvent(value) {
1018
1039
  function isSaturnReturnResponse(value) {
1019
1040
  return isJsonObject(value) && isJsonArrayOf(value["returns"], (item0) => isSaturnReturnEvent(item0));
1020
1041
  }
1042
+ function isSavedCustomBody(value) {
1043
+ return isJsonObject(value) && typeof value["name"] === "string" && typeof value["heliocentric"] === "boolean" && isJsonRecordOf(value["elements"], (member0) => typeof member0 === "number");
1044
+ }
1021
1045
  function isSummaryRow(value) {
1022
1046
  return isJsonObject(value) && typeof value["sign"] === "string" && typeof value["dms"] === "string";
1023
1047
  }
@@ -1416,7 +1440,7 @@ var EndpointMethods = class {
1416
1440
  * @param name - The name segment of the path, escaped into it.
1417
1441
  * @param fields - The request body, as {@link CustomBodyByNameRequest} describes it, sent as given. signal may stand beside its fields.
1418
1442
  * @param keywords - signal, and output for a document, when they come apart from the body.
1419
- * @returns The answer as a Result, checked against JsonObject.
1443
+ * @returns The answer as a Result, checked against {@link CustomBodyPlacedResponse}.
1420
1444
  * @throws {@link AstroMansionError} or the subclass that names the cause, as {@link AstroMansion.request} describes. The code unexpected_answer means the answer did not have its published shape.
1421
1445
  */
1422
1446
  async chartWithCustomBody(name2, fields, keywords) {
@@ -1432,10 +1456,15 @@ var EndpointMethods = class {
1432
1456
  {
1433
1457
  json: call.json,
1434
1458
  technique: "chart_with_custom_body",
1459
+ enveloped: false,
1435
1460
  signal: call.signal
1436
1461
  }
1437
1462
  );
1438
- return readFreeForm(answer, isJsonObject, "chartWithCustomBody");
1463
+ return readResult(
1464
+ answer,
1465
+ isCustomBodyPlacedResponse,
1466
+ "chartWithCustomBody"
1467
+ );
1439
1468
  }
1440
1469
  /**
1441
1470
  * Compatibility score from 0 to 100.
@@ -1508,7 +1537,7 @@ var EndpointMethods = class {
1508
1537
  * Return every custom body saved by the current identity.
1509
1538
  *
1510
1539
  * @param params - signal, which cancels the call.
1511
- * @returns The answer as a Result, checked against JsonObject.
1540
+ * @returns The answer as a Result, checked against {@link CustomBodyListResponse}.
1512
1541
  * @throws {@link AstroMansionError} or the subclass that names the cause, as {@link AstroMansion.request} describes. The code unexpected_answer means the answer did not have its published shape.
1513
1542
  */
1514
1543
  async customBodies(params2) {
@@ -1516,9 +1545,10 @@ var EndpointMethods = class {
1516
1545
  const answer = await this.request("GET", "/v1/custom-body/list", {
1517
1546
  params: call.params,
1518
1547
  technique: "custom_bodies",
1548
+ enveloped: false,
1519
1549
  signal: call.signal
1520
1550
  });
1521
- return readFreeForm(answer, isJsonObject, "customBodies");
1551
+ return readResult(answer, isCustomBodyListResponse, "customBodies");
1522
1552
  }
1523
1553
  /**
1524
1554
  * Custom elliptic or hyperbolic Keplerian body.
@@ -1626,7 +1656,7 @@ var EndpointMethods = class {
1626
1656
  *
1627
1657
  * @param name - The name segment of the path, escaped into it.
1628
1658
  * @param params - signal, which cancels the call.
1629
- * @returns The answer as a Result, checked against JsonObject.
1659
+ * @returns The answer as a Result, checked against {@link CustomBodyDeleteResponse}.
1630
1660
  * @throws {@link AstroMansionError} or the subclass that names the cause, as {@link AstroMansion.request} describes. The code unexpected_answer means the answer did not have its published shape.
1631
1661
  */
1632
1662
  async deleteCustomBody(name2, params2) {
@@ -1637,10 +1667,11 @@ var EndpointMethods = class {
1637
1667
  {
1638
1668
  params: call.params,
1639
1669
  technique: "delete_custom_body",
1670
+ enveloped: false,
1640
1671
  signal: call.signal
1641
1672
  }
1642
1673
  );
1643
- return readFreeForm(answer, isJsonObject, "deleteCustomBody");
1674
+ return readResult(answer, isCustomBodyDeleteResponse, "deleteCustomBody");
1644
1675
  }
1645
1676
  /**
1646
1677
  * Classical dignities and almuten.
@@ -2582,7 +2613,7 @@ var EndpointMethods = class {
2582
2613
  *
2583
2614
  * @param fields - The request body, as {@link CustomBodySaveRequest} describes it, sent as given. signal may stand beside its fields.
2584
2615
  * @param keywords - signal, and output for a document, when they come apart from the body.
2585
- * @returns The answer as a Result, checked against JsonObject.
2616
+ * @returns The answer as a Result, checked against {@link CustomBodySaveResponse}.
2586
2617
  * @throws {@link AstroMansionError} or the subclass that names the cause, as {@link AstroMansion.request} describes. The code unexpected_answer means the answer did not have its published shape.
2587
2618
  */
2588
2619
  async saveCustomBody(fields, keywords) {
@@ -2590,9 +2621,10 @@ var EndpointMethods = class {
2590
2621
  const answer = await this.request("POST", "/v1/custom-body/save", {
2591
2622
  json: call.json,
2592
2623
  technique: "save_custom_body",
2624
+ enveloped: false,
2593
2625
  signal: call.signal
2594
2626
  });
2595
- return readFreeForm(answer, isJsonObject, "saveCustomBody");
2627
+ return readResult(answer, isCustomBodySaveResponse, "saveCustomBody");
2596
2628
  }
2597
2629
  /**
2598
2630
  * Search place names.