@raisindb/client 0.1.37 → 0.1.54

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.js CHANGED
@@ -844,6 +844,7 @@ var RequestType = /* @__PURE__ */ ((RequestType2) => {
844
844
  RequestType2["NodeReorder"] = "node_reorder";
845
845
  RequestType2["NodeMoveChildBefore"] = "node_move_child_before";
846
846
  RequestType2["NodeMoveChildAfter"] = "node_move_child_after";
847
+ RequestType2["NodeApplyChildOrder"] = "node_apply_child_order";
847
848
  RequestType2["PropertyGet"] = "property_get";
848
849
  RequestType2["PropertyUpdate"] = "property_update";
849
850
  RequestType2["RelationAdd"] = "relation_add";
@@ -863,6 +864,7 @@ var RequestType = /* @__PURE__ */ ((RequestType2) => {
863
864
  RequestType2["BranchUpdateHead"] = "branch_update_head";
864
865
  RequestType2["BranchMerge"] = "branch_merge";
865
866
  RequestType2["BranchCompare"] = "branch_compare";
867
+ RequestType2["BranchDiff"] = "branch_diff";
866
868
  RequestType2["TagCreate"] = "tag_create";
867
869
  RequestType2["TagGet"] = "tag_get";
868
870
  RequestType2["TagList"] = "tag_list";
@@ -1360,6 +1362,40 @@ var NodeOperations = class {
1360
1362
  const result = await this.sendRequest(payload);
1361
1363
  return result;
1362
1364
  }
1365
+ /**
1366
+ * Create a node, auto-creating any missing ancestor folders.
1367
+ *
1368
+ * @param options - Node creation options (with optional `parentNodeType`)
1369
+ * @returns Created node
1370
+ */
1371
+ async createDeep(options) {
1372
+ const payload = {
1373
+ node_type: options.type,
1374
+ path: options.path,
1375
+ properties: options.properties ?? {},
1376
+ content: options.content,
1377
+ parent_node_type: options.parentNodeType
1378
+ };
1379
+ const result = await this.sendRequest(payload, "node_create_deep");
1380
+ return result;
1381
+ }
1382
+ /**
1383
+ * Upsert a node by path (create-or-update), auto-creating any missing ancestor folders.
1384
+ *
1385
+ * @param options - Node creation options (with optional `parentNodeType`)
1386
+ * @returns Upserted node
1387
+ */
1388
+ async upsertDeep(options) {
1389
+ const payload = {
1390
+ node_type: options.type,
1391
+ path: options.path,
1392
+ properties: options.properties ?? {},
1393
+ content: options.content,
1394
+ parent_node_type: options.parentNodeType
1395
+ };
1396
+ const result = await this.sendRequest(payload, "node_upsert_deep");
1397
+ return result;
1398
+ }
1363
1399
  /**
1364
1400
  * Update an existing node
1365
1401
  *
@@ -1409,6 +1445,75 @@ var NodeOperations = class {
1409
1445
  throw error;
1410
1446
  }
1411
1447
  }
1448
+ /**
1449
+ * List a node's revision history (git-style "file history"), newest first.
1450
+ *
1451
+ * Each entry carries the `revision` (usable with `atRevision()` reads to
1452
+ * fetch the full snapshot), plus when/who and whether the node was deleted
1453
+ * at that revision. Always available regardless of the NodeType `auditable`
1454
+ * flag — it reflects the structural MVCC version history.
1455
+ *
1456
+ * @param id - Node ID
1457
+ * @param options - Optional `{ limit }` to cap the number of revisions
1458
+ * @returns Array of revision entries (newest first)
1459
+ *
1460
+ * @example
1461
+ * ```typescript
1462
+ * const history = await ws.nodes().history(nodeId, { limit: 50 });
1463
+ * for (const rev of history) {
1464
+ * const snapshot = await ws.atRevision(rev.revision).nodes().get(nodeId);
1465
+ * }
1466
+ * ```
1467
+ */
1468
+ async history(id, options) {
1469
+ const payload = {
1470
+ node_id: id,
1471
+ limit: options?.limit
1472
+ };
1473
+ const result = await this.sendRequest(payload, "node_history");
1474
+ return result ?? [];
1475
+ }
1476
+ /**
1477
+ * List a node's revision history by path (newest first).
1478
+ *
1479
+ * @param path - Node path
1480
+ * @param options - Optional `{ limit }` to cap the number of revisions
1481
+ * @returns Array of revision entries (newest first)
1482
+ */
1483
+ async historyByPath(path, options) {
1484
+ const payload = {
1485
+ path,
1486
+ limit: options?.limit
1487
+ };
1488
+ const result = await this.sendRequest(payload, "node_history");
1489
+ return result ?? [];
1490
+ }
1491
+ /**
1492
+ * Query a node's audit-log entries by ID.
1493
+ *
1494
+ * Audit logs are only produced for NodeTypes marked `auditable`. This is
1495
+ * distinct from {@link history}, which is the always-on structural revision
1496
+ * history available for every node.
1497
+ *
1498
+ * @param id - Node ID
1499
+ * @returns Array of audit-log entries
1500
+ */
1501
+ async auditLog(id) {
1502
+ const payload = { node_id: id };
1503
+ const result = await this.sendRequest(payload, "audit_query");
1504
+ return result ?? [];
1505
+ }
1506
+ /**
1507
+ * Query a node's audit-log entries by path.
1508
+ *
1509
+ * @param path - Node path
1510
+ * @returns Array of audit-log entries
1511
+ */
1512
+ async auditLogByPath(path) {
1513
+ const payload = { path };
1514
+ const result = await this.sendRequest(payload, "audit_query");
1515
+ return result ?? [];
1516
+ }
1412
1517
  /**
1413
1518
  * Query nodes
1414
1519
  *
@@ -1576,7 +1681,7 @@ var NodeOperations = class {
1576
1681
  */
1577
1682
  async rename(nodePath, newName) {
1578
1683
  const payload = {
1579
- node_path: nodePath,
1684
+ old_path: nodePath,
1580
1685
  new_name: newName
1581
1686
  };
1582
1687
  const result = await this.sendRequest(payload, "node_rename");
@@ -1592,9 +1697,8 @@ var NodeOperations = class {
1592
1697
  */
1593
1698
  async copy(fromPath, toParentPath, newName) {
1594
1699
  const payload = {
1595
- from_path: fromPath,
1596
- to_parent_path: toParentPath,
1597
- deep: false
1700
+ source_path: fromPath,
1701
+ target_parent: toParentPath
1598
1702
  };
1599
1703
  if (newName !== void 0) {
1600
1704
  payload.new_name = newName;
@@ -1612,9 +1716,8 @@ var NodeOperations = class {
1612
1716
  */
1613
1717
  async copyTree(fromPath, toParentPath, newName) {
1614
1718
  const payload = {
1615
- from_path: fromPath,
1616
- to_parent_path: toParentPath,
1617
- deep: true
1719
+ source_path: fromPath,
1720
+ target_parent: toParentPath
1618
1721
  };
1619
1722
  if (newName !== void 0) {
1620
1723
  payload.new_name = newName;
@@ -1671,6 +1774,24 @@ var NodeOperations = class {
1671
1774
  const result = await this.sendRequest(payload, "node_move_child_after");
1672
1775
  return result;
1673
1776
  }
1777
+ /**
1778
+ * Replay a parent's child order from another branch onto the current branch.
1779
+ *
1780
+ * Carries node sibling-order across branches — useful for selective publish
1781
+ * flows, where copying node content (e.g. via SQL) does not move the ordering
1782
+ * index. Only children that exist under the parent on both branches are
1783
+ * reordered. The target branch is the connection's current branch.
1784
+ *
1785
+ * @param parentPath - Parent node path
1786
+ * @param sourceBranch - Branch to copy the child order FROM
1787
+ */
1788
+ async applyChildOrder(parentPath, sourceBranch) {
1789
+ const payload = {
1790
+ parent_path: parentPath,
1791
+ source_branch: sourceBranch
1792
+ };
1793
+ await this.sendRequest(payload, "node_apply_child_order");
1794
+ }
1674
1795
  // ========================================================================
1675
1796
  // Relationship Operations
1676
1797
  // ========================================================================
@@ -2966,6 +3087,21 @@ var Branches = class {
2966
3087
  "branch_compare" /* BranchCompare */
2967
3088
  );
2968
3089
  }
3090
+ /**
3091
+ * Per-node diff of `branch` relative to `baseBranch` (added/modified/deleted).
3092
+ *
3093
+ * Cheaper than reading both branch listings: cost scales with the number of
3094
+ * changed nodes since the branches diverged, not the total content.
3095
+ */
3096
+ async diff(branch, baseBranch) {
3097
+ return this.sendRequest(
3098
+ {
3099
+ branch,
3100
+ base_branch: baseBranch
3101
+ },
3102
+ "branch_diff" /* BranchDiff */
3103
+ );
3104
+ }
2969
3105
  };
2970
3106
 
2971
3107
  // src/tags.ts