@raisindb/client 0.1.37 → 0.1.38

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.mjs CHANGED
@@ -390,6 +390,7 @@ var RequestType = /* @__PURE__ */ ((RequestType2) => {
390
390
  RequestType2["NodeReorder"] = "node_reorder";
391
391
  RequestType2["NodeMoveChildBefore"] = "node_move_child_before";
392
392
  RequestType2["NodeMoveChildAfter"] = "node_move_child_after";
393
+ RequestType2["NodeApplyChildOrder"] = "node_apply_child_order";
393
394
  RequestType2["PropertyGet"] = "property_get";
394
395
  RequestType2["PropertyUpdate"] = "property_update";
395
396
  RequestType2["RelationAdd"] = "relation_add";
@@ -409,6 +410,7 @@ var RequestType = /* @__PURE__ */ ((RequestType2) => {
409
410
  RequestType2["BranchUpdateHead"] = "branch_update_head";
410
411
  RequestType2["BranchMerge"] = "branch_merge";
411
412
  RequestType2["BranchCompare"] = "branch_compare";
413
+ RequestType2["BranchDiff"] = "branch_diff";
412
414
  RequestType2["TagCreate"] = "tag_create";
413
415
  RequestType2["TagGet"] = "tag_get";
414
416
  RequestType2["TagList"] = "tag_list";
@@ -906,6 +908,40 @@ var NodeOperations = class {
906
908
  const result = await this.sendRequest(payload);
907
909
  return result;
908
910
  }
911
+ /**
912
+ * Create a node, auto-creating any missing ancestor folders.
913
+ *
914
+ * @param options - Node creation options (with optional `parentNodeType`)
915
+ * @returns Created node
916
+ */
917
+ async createDeep(options) {
918
+ const payload = {
919
+ node_type: options.type,
920
+ path: options.path,
921
+ properties: options.properties ?? {},
922
+ content: options.content,
923
+ parent_node_type: options.parentNodeType
924
+ };
925
+ const result = await this.sendRequest(payload, "node_create_deep");
926
+ return result;
927
+ }
928
+ /**
929
+ * Upsert a node by path (create-or-update), auto-creating any missing ancestor folders.
930
+ *
931
+ * @param options - Node creation options (with optional `parentNodeType`)
932
+ * @returns Upserted node
933
+ */
934
+ async upsertDeep(options) {
935
+ const payload = {
936
+ node_type: options.type,
937
+ path: options.path,
938
+ properties: options.properties ?? {},
939
+ content: options.content,
940
+ parent_node_type: options.parentNodeType
941
+ };
942
+ const result = await this.sendRequest(payload, "node_upsert_deep");
943
+ return result;
944
+ }
909
945
  /**
910
946
  * Update an existing node
911
947
  *
@@ -955,6 +991,75 @@ var NodeOperations = class {
955
991
  throw error;
956
992
  }
957
993
  }
994
+ /**
995
+ * List a node's revision history (git-style "file history"), newest first.
996
+ *
997
+ * Each entry carries the `revision` (usable with `atRevision()` reads to
998
+ * fetch the full snapshot), plus when/who and whether the node was deleted
999
+ * at that revision. Always available regardless of the NodeType `auditable`
1000
+ * flag — it reflects the structural MVCC version history.
1001
+ *
1002
+ * @param id - Node ID
1003
+ * @param options - Optional `{ limit }` to cap the number of revisions
1004
+ * @returns Array of revision entries (newest first)
1005
+ *
1006
+ * @example
1007
+ * ```typescript
1008
+ * const history = await ws.nodes().history(nodeId, { limit: 50 });
1009
+ * for (const rev of history) {
1010
+ * const snapshot = await ws.atRevision(rev.revision).nodes().get(nodeId);
1011
+ * }
1012
+ * ```
1013
+ */
1014
+ async history(id, options) {
1015
+ const payload = {
1016
+ node_id: id,
1017
+ limit: options?.limit
1018
+ };
1019
+ const result = await this.sendRequest(payload, "node_history");
1020
+ return result ?? [];
1021
+ }
1022
+ /**
1023
+ * List a node's revision history by path (newest first).
1024
+ *
1025
+ * @param path - Node path
1026
+ * @param options - Optional `{ limit }` to cap the number of revisions
1027
+ * @returns Array of revision entries (newest first)
1028
+ */
1029
+ async historyByPath(path, options) {
1030
+ const payload = {
1031
+ path,
1032
+ limit: options?.limit
1033
+ };
1034
+ const result = await this.sendRequest(payload, "node_history");
1035
+ return result ?? [];
1036
+ }
1037
+ /**
1038
+ * Query a node's audit-log entries by ID.
1039
+ *
1040
+ * Audit logs are only produced for NodeTypes marked `auditable`. This is
1041
+ * distinct from {@link history}, which is the always-on structural revision
1042
+ * history available for every node.
1043
+ *
1044
+ * @param id - Node ID
1045
+ * @returns Array of audit-log entries
1046
+ */
1047
+ async auditLog(id) {
1048
+ const payload = { node_id: id };
1049
+ const result = await this.sendRequest(payload, "audit_query");
1050
+ return result ?? [];
1051
+ }
1052
+ /**
1053
+ * Query a node's audit-log entries by path.
1054
+ *
1055
+ * @param path - Node path
1056
+ * @returns Array of audit-log entries
1057
+ */
1058
+ async auditLogByPath(path) {
1059
+ const payload = { path };
1060
+ const result = await this.sendRequest(payload, "audit_query");
1061
+ return result ?? [];
1062
+ }
958
1063
  /**
959
1064
  * Query nodes
960
1065
  *
@@ -1122,7 +1227,7 @@ var NodeOperations = class {
1122
1227
  */
1123
1228
  async rename(nodePath, newName) {
1124
1229
  const payload = {
1125
- node_path: nodePath,
1230
+ old_path: nodePath,
1126
1231
  new_name: newName
1127
1232
  };
1128
1233
  const result = await this.sendRequest(payload, "node_rename");
@@ -1138,9 +1243,8 @@ var NodeOperations = class {
1138
1243
  */
1139
1244
  async copy(fromPath, toParentPath, newName) {
1140
1245
  const payload = {
1141
- from_path: fromPath,
1142
- to_parent_path: toParentPath,
1143
- deep: false
1246
+ source_path: fromPath,
1247
+ target_parent: toParentPath
1144
1248
  };
1145
1249
  if (newName !== void 0) {
1146
1250
  payload.new_name = newName;
@@ -1158,9 +1262,8 @@ var NodeOperations = class {
1158
1262
  */
1159
1263
  async copyTree(fromPath, toParentPath, newName) {
1160
1264
  const payload = {
1161
- from_path: fromPath,
1162
- to_parent_path: toParentPath,
1163
- deep: true
1265
+ source_path: fromPath,
1266
+ target_parent: toParentPath
1164
1267
  };
1165
1268
  if (newName !== void 0) {
1166
1269
  payload.new_name = newName;
@@ -1217,6 +1320,24 @@ var NodeOperations = class {
1217
1320
  const result = await this.sendRequest(payload, "node_move_child_after");
1218
1321
  return result;
1219
1322
  }
1323
+ /**
1324
+ * Replay a parent's child order from another branch onto the current branch.
1325
+ *
1326
+ * Carries node sibling-order across branches — useful for selective publish
1327
+ * flows, where copying node content (e.g. via SQL) does not move the ordering
1328
+ * index. Only children that exist under the parent on both branches are
1329
+ * reordered. The target branch is the connection's current branch.
1330
+ *
1331
+ * @param parentPath - Parent node path
1332
+ * @param sourceBranch - Branch to copy the child order FROM
1333
+ */
1334
+ async applyChildOrder(parentPath, sourceBranch) {
1335
+ const payload = {
1336
+ parent_path: parentPath,
1337
+ source_branch: sourceBranch
1338
+ };
1339
+ await this.sendRequest(payload, "node_apply_child_order");
1340
+ }
1220
1341
  // ========================================================================
1221
1342
  // Relationship Operations
1222
1343
  // ========================================================================
@@ -2512,6 +2633,21 @@ var Branches = class {
2512
2633
  "branch_compare" /* BranchCompare */
2513
2634
  );
2514
2635
  }
2636
+ /**
2637
+ * Per-node diff of `branch` relative to `baseBranch` (added/modified/deleted).
2638
+ *
2639
+ * Cheaper than reading both branch listings: cost scales with the number of
2640
+ * changed nodes since the branches diverged, not the total content.
2641
+ */
2642
+ async diff(branch, baseBranch) {
2643
+ return this.sendRequest(
2644
+ {
2645
+ branch,
2646
+ base_branch: baseBranch
2647
+ },
2648
+ "branch_diff" /* BranchDiff */
2649
+ );
2650
+ }
2515
2651
  };
2516
2652
 
2517
2653
  // src/tags.ts