isomorphic-jj 1.4.3 → 1.7.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,14 +1,14 @@
1
1
  /**
2
2
  * JJError - Custom error class for isomorphic-jj
3
- *
3
+ *
4
4
  * Provides structured errors with error codes, context, and user-actionable suggestions.
5
5
  */
6
6
  export class JJError extends Error {
7
7
  /**
8
8
  * @param {string} code - Error code (e.g., 'CHANGE_NOT_FOUND')
9
9
  * @param {string} message - Human-readable error message
10
- * @param {Object} [context={}] - Additional error context
11
- * @param {string} [context.suggestion] - User-actionable suggestion
10
+ * @param {Object.<string, any>} [context] - Additional error context. May
11
+ * include a `suggestion` string plus any other diagnostic fields.
12
12
  */
13
13
  constructor(code, message, context = {}) {
14
14
  super(message);
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * ID Generation utilities for isomorphic-jj
3
- *
3
+ *
4
4
  * Generates stable change IDs and operation IDs using cryptographically secure random values.
5
5
  */
6
6
 
7
7
  /**
8
8
  * Generate a stable change ID
9
- *
9
+ *
10
10
  * Uses 128-bit cryptographically random value encoded as 32-character hex string.
11
11
  * Collision probability is negligible (2^128 space).
12
- *
12
+ *
13
13
  * @returns {string} 32-character lowercase hex string
14
14
  */
15
15
  export function generateChangeId() {
@@ -22,7 +22,7 @@ export function generateChangeId() {
22
22
  *
23
23
  * Uses SHA-256 hash of operation content for integrity verification.
24
24
  *
25
- * @param {Object} operation - Operation data
25
+ * @param {Object.<string, any>} operation - Operation data
26
26
  * @returns {Promise<string>} 64-character lowercase hex string (SHA-256)
27
27
  */
28
28
  export async function generateOperationId(operation) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Validation utilities for isomorphic-jj
3
- *
3
+ *
4
4
  * Provides validation functions for change IDs, paths, bookmark names, etc.
5
5
  */
6
6
 
@@ -8,7 +8,7 @@ import { JJError } from './errors.js';
8
8
 
9
9
  /**
10
10
  * Validate a change ID
11
- *
11
+ *
12
12
  * @param {string} changeId - Change ID to validate
13
13
  * @throws {JJError} If change ID is invalid
14
14
  */
@@ -84,7 +84,7 @@ export function validatePath(path) {
84
84
 
85
85
  /**
86
86
  * Validate a bookmark name (follows Git ref name rules)
87
- *
87
+ *
88
88
  * @param {string} name - Bookmark name to validate
89
89
  * @throws {JJError} If bookmark name is invalid
90
90
  */
@@ -115,13 +115,9 @@ export function validateBookmarkName(name) {
115
115
  }
116
116
 
117
117
  if (name.startsWith('.') || name.endsWith('.')) {
118
- throw new JJError(
119
- 'INVALID_BOOKMARK_NAME',
120
- 'Bookmark name cannot start or end with "."',
121
- {
122
- name,
123
- }
124
- );
118
+ throw new JJError('INVALID_BOOKMARK_NAME', 'Bookmark name cannot start or end with "."', {
119
+ name,
120
+ });
125
121
  }
126
122
 
127
123
  if (name.endsWith('.lock')) {