Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 36 additions & 1 deletion src/chronicle.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,39 @@ export function createChronicle(db, options = {}) {
};
}

export { withCause, currentCause };
/**
* Run a function within a causal context so that all nodes created during
* execution carry `causeId` as their causal parent.
*
* Re-exported from `@plures/chronos/causal` for convenience.
*
* @param {string} causeId - ID of the parent node to set as the active cause
* @param {Function} fn - Synchronous or async function to execute inside the scope
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSDoc uses @param {Function} fn here, but elsewhere (notably src/causal.js) function parameters are typed as lowercase {function}. Aligning to {function} would keep the public re-export docs consistent with the source API docs and avoid any tooling differences between Function vs function.

Suggested change
* @param {Function} fn - Synchronous or async function to execute inside the scope
* @param {function} fn - Synchronous or async function to execute inside the scope

Copilot uses AI. Check for mistakes.
* @returns {*} The return value of `fn`
*
* @example
* ```js
* import { withCause } from '@plures/chronos/chronicle';
*
* withCause('chrono:1699000000000-1', () => {
* // All chronicle nodes created here carry the causeId
* });
* ```
*/
export { withCause };

/**
* Get the current causal parent ID.
*
* Re-exported from `@plures/chronos/causal` for convenience.
*
* @returns {string|null} The active causal parent ID, or `null` outside a causal scope.
*
* @example
* ```js
* import { currentCause } from '@plures/chronos/chronicle';
*
* console.log(currentCause()); // null (outside any causal scope)
* ```
*/
export { currentCause };
37 changes: 36 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,39 @@ export function createChronos(db, options = {}) {
};
}

export { withCause, currentCause };
/**
* Run a function within a causal context so that all nodes created during
* execution carry `causeId` as their causal parent.
*
* Re-exported from `@plures/chronos/causal` for convenience.
*
* @param {string} causeId - ID of the parent node to set as the active cause
* @param {Function} fn - Synchronous or async function to execute inside the scope
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSDoc uses @param {Function} fn here, but elsewhere (e.g. src/causal.js) the project documents function parameters with the lowercase {function} type. Consider changing this to {function} for consistency (and to avoid any doc-tool quirks around the built-in Function constructor type).

Suggested change
* @param {Function} fn - Synchronous or async function to execute inside the scope
* @param {function} fn - Synchronous or async function to execute inside the scope

Copilot uses AI. Check for mistakes.
* @returns {*} The return value of `fn`
*
* @example
* ```js
* import { withCause } from '@plures/chronos';
*
* withCause('chrono:1699000000000-1', () => {
* // All nodes created here carry the causeId
* });
* ```
*/
export { withCause };

/**
* Get the current causal parent ID.
*
* Re-exported from `@plures/chronos/causal` for convenience.
*
* @returns {string|null} The active causal parent ID, or `null` outside a causal scope.
*
* @example
* ```js
* import { currentCause } from '@plures/chronos';
*
* console.log(currentCause()); // null (outside any causal scope)
* ```
*/
export { currentCause };
55 changes: 55 additions & 0 deletions src/praxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,63 @@ export function createChronosEngine(options = {}) {
}

// Re-export all rule modules and event tag constants for convenience
/**
* Praxis module bundling all diff-classification rules and constraints.
*
* Re-exported from `@plures/chronos/rules` for convenience.
*
* @type {object}
*
* @example
* ```js
* import { diffClassificationModule } from '@plures/chronos/praxis';
* registry.registerModule(diffClassificationModule);
* ```
*/
export { diffClassificationModule } from './rules/diff-classification.js';

/**
* Praxis module bundling all retention-policy rules and constraints.
*
* Re-exported from `@plures/chronos/rules` for convenience.
*
* @type {object}
*
* @example
* ```js
* import { retentionPolicyModule } from '@plures/chronos/praxis';
* registry.registerModule(retentionPolicyModule);
* ```
*/
export { retentionPolicyModule } from './rules/retention-policy.js';

/**
* Praxis module bundling all alerting rules and constraints.
*
* Re-exported from `@plures/chronos/rules` for convenience.
*
* @type {object}
*
* @example
* ```js
* import { alertingModule } from '@plures/chronos/praxis';
* registry.registerModule(alertingModule);
* ```
*/
export { alertingModule } from './rules/alerting.js';

/**
* Praxis module bundling all integrity rules and constraints.
*
* Re-exported from `@plures/chronos/rules` for convenience.
*
* @type {object}
*
* @example
* ```js
* import { integrityModule } from '@plures/chronos/praxis';
* registry.registerModule(integrityModule);
* ```
*/
export { integrityModule } from './rules/integrity.js';
export * from './rules/index.js';
Loading