@valbuild/core 0.41.0 → 0.43.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.
@@ -1,4 +1,4 @@
1
- import { ApiGetPatchResponse, ApiPostPatchResponse, ApiTreeResponse } from "./index.js";
1
+ import { ApiCommitResponse, ApiGetPatchResponse, ApiPostPatchResponse, ApiTreeResponse } from "./index.js";
2
2
  import { result } from "./fp/index.js";
3
3
  import { PatchJSON } from "./patch/index.js";
4
4
  import { ModuleId } from "./val/index.js";
@@ -32,5 +32,9 @@ export declare class ValApi {
32
32
  treePath?: string;
33
33
  headers?: Record<string, string> | undefined;
34
34
  }): Promise<result.Result<ApiTreeResponse, FetchError>>;
35
+ postCommit({ patches, headers, }: {
36
+ patches?: Record<ModuleId, string[]>;
37
+ headers?: Record<string, string> | undefined;
38
+ }): Promise<result.Result<ApiCommitResponse, FetchError>>;
35
39
  }
36
40
  export {};
@@ -1,5 +1,5 @@
1
1
  export { initVal } from "./initVal.js";
2
- export type { InitVal, ValConfig } from "./initVal.js";
2
+ export type { InitVal, ValConfig, ValConstructor } from "./initVal.js";
3
3
  export { Schema, type SerializedSchema } from "./schema/index.js";
4
4
  export type { ImageMetadata } from "./schema/image.js";
5
5
  export type { LinkSource } from "./source/link.js";
@@ -37,6 +37,17 @@ export type { SerializedImageSchema } from "./schema/image.js";
37
37
  export type { SerializedRichTextSchema } from "./schema/richtext.js";
38
38
  export type { SerializedUnionSchema } from "./schema/union.js";
39
39
  export type { SerializedLiteralSchema } from "./schema/literal.js";
40
+ export type ApiCommitResponse = {
41
+ modules: Record<ModuleId, {
42
+ patches: {
43
+ applied: string[];
44
+ };
45
+ }>;
46
+ git: {
47
+ commit?: string;
48
+ branch?: string;
49
+ };
50
+ };
40
51
  export type ApiTreeResponse = {
41
52
  git: {
42
53
  commit?: string;
@@ -4,7 +4,7 @@ import { getValPath as getPath } from "./val/index.js";
4
4
  import { file } from "./source/file.js";
5
5
  import { richtext } from "./source/richtext.js";
6
6
  import { link } from "./source/link.js";
7
- type ValConstructor = {
7
+ export type ValConstructor = {
8
8
  content: typeof content;
9
9
  getPath: typeof getPath;
10
10
  file: typeof file;
@@ -22,4 +22,3 @@ export type InitVal = {
22
22
  config: ValConfig;
23
23
  };
24
24
  export declare const initVal: () => InitVal;
25
- export {};
@@ -1507,6 +1507,23 @@ var ValApi = /*#__PURE__*/function () {
1507
1507
  return parse(res);
1508
1508
  })["catch"](createError);
1509
1509
  }
1510
+ }, {
1511
+ key: "postCommit",
1512
+ value: function postCommit(_ref3) {
1513
+ var patches = _ref3.patches,
1514
+ headers = _ref3.headers;
1515
+ return fetch("".concat(this.host, "/commit"), {
1516
+ method: "POST",
1517
+ body: JSON.stringify({
1518
+ patches: patches
1519
+ }),
1520
+ headers: headers || {
1521
+ "Content-Type": "application/json"
1522
+ }
1523
+ }).then(function (res) {
1524
+ return parse(res);
1525
+ })["catch"](createError);
1526
+ }
1510
1527
  }]);
1511
1528
  return ValApi;
1512
1529
  }();
@@ -1547,9 +1564,9 @@ function _parse() {
1547
1564
  return _context2.abrupt("return", result.err({
1548
1565
  statusCode: res.status,
1549
1566
  message: json.message || res.statusText,
1550
- details: json.details || Object.fromEntries(Object.entries(json).filter(function (_ref3) {
1551
- var _ref4 = index._slicedToArray(_ref3, 1),
1552
- key = _ref4[0];
1567
+ details: json.details || Object.fromEntries(Object.entries(json).filter(function (_ref4) {
1568
+ var _ref5 = index._slicedToArray(_ref4, 1),
1569
+ key = _ref5[0];
1553
1570
  return key !== "message";
1554
1571
  }))
1555
1572
  }));
@@ -1507,6 +1507,23 @@ var ValApi = /*#__PURE__*/function () {
1507
1507
  return parse(res);
1508
1508
  })["catch"](createError);
1509
1509
  }
1510
+ }, {
1511
+ key: "postCommit",
1512
+ value: function postCommit(_ref3) {
1513
+ var patches = _ref3.patches,
1514
+ headers = _ref3.headers;
1515
+ return fetch("".concat(this.host, "/commit"), {
1516
+ method: "POST",
1517
+ body: JSON.stringify({
1518
+ patches: patches
1519
+ }),
1520
+ headers: headers || {
1521
+ "Content-Type": "application/json"
1522
+ }
1523
+ }).then(function (res) {
1524
+ return parse(res);
1525
+ })["catch"](createError);
1526
+ }
1510
1527
  }]);
1511
1528
  return ValApi;
1512
1529
  }();
@@ -1547,9 +1564,9 @@ function _parse() {
1547
1564
  return _context2.abrupt("return", result.err({
1548
1565
  statusCode: res.status,
1549
1566
  message: json.message || res.statusText,
1550
- details: json.details || Object.fromEntries(Object.entries(json).filter(function (_ref3) {
1551
- var _ref4 = index._slicedToArray(_ref3, 1),
1552
- key = _ref4[0];
1567
+ details: json.details || Object.fromEntries(Object.entries(json).filter(function (_ref4) {
1568
+ var _ref5 = index._slicedToArray(_ref4, 1),
1569
+ key = _ref5[0];
1553
1570
  return key !== "message";
1554
1571
  }))
1555
1572
  }));
@@ -1504,6 +1504,23 @@ var ValApi = /*#__PURE__*/function () {
1504
1504
  return parse(res);
1505
1505
  })["catch"](createError);
1506
1506
  }
1507
+ }, {
1508
+ key: "postCommit",
1509
+ value: function postCommit(_ref3) {
1510
+ var patches = _ref3.patches,
1511
+ headers = _ref3.headers;
1512
+ return fetch("".concat(this.host, "/commit"), {
1513
+ method: "POST",
1514
+ body: JSON.stringify({
1515
+ patches: patches
1516
+ }),
1517
+ headers: headers || {
1518
+ "Content-Type": "application/json"
1519
+ }
1520
+ }).then(function (res) {
1521
+ return parse(res);
1522
+ })["catch"](createError);
1523
+ }
1507
1524
  }]);
1508
1525
  return ValApi;
1509
1526
  }();
@@ -1544,9 +1561,9 @@ function _parse() {
1544
1561
  return _context2.abrupt("return", err({
1545
1562
  statusCode: res.status,
1546
1563
  message: json.message || res.statusText,
1547
- details: json.details || Object.fromEntries(Object.entries(json).filter(function (_ref3) {
1548
- var _ref4 = _slicedToArray(_ref3, 1),
1549
- key = _ref4[0];
1564
+ details: json.details || Object.fromEntries(Object.entries(json).filter(function (_ref4) {
1565
+ var _ref5 = _slicedToArray(_ref4, 1),
1566
+ key = _ref5[0];
1550
1567
  return key !== "message";
1551
1568
  }))
1552
1569
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.41.0",
3
+ "version": "0.43.0",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "scripts": {