@cchistory/lite 0.4.5 → 0.5.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.
- package/INSTALL.md +1 -1
- package/apps/lite-cli/dist/agent-contract.d.ts +4 -5
- package/apps/lite-cli/dist/agent-contract.d.ts.map +1 -1
- package/apps/lite-cli/dist/agent-contract.js +32 -25
- package/apps/lite-cli/dist/agent-contract.js.map +1 -1
- package/apps/lite-cli/dist/bin.js +3 -3
- package/apps/lite-cli/dist/bin.js.map +1 -1
- package/apps/lite-cli/dist/index.d.ts.map +1 -1
- package/apps/lite-cli/dist/index.js +147 -66
- package/apps/lite-cli/dist/index.js.map +1 -1
- package/apps/lite-cli/dist/index.test.js +76 -60
- package/apps/lite-cli/dist/index.test.js.map +1 -1
- package/apps/lite-cli/dist/query.d.ts +4 -1
- package/apps/lite-cli/dist/query.d.ts.map +1 -1
- package/apps/lite-cli/dist/query.js +45 -29
- package/apps/lite-cli/dist/query.js.map +1 -1
- package/apps/lite-cli/dist/resource-errors.d.ts +3 -0
- package/apps/lite-cli/dist/resource-errors.d.ts.map +1 -0
- package/apps/lite-cli/dist/resource-errors.js +17 -0
- package/apps/lite-cli/dist/resource-errors.js.map +1 -0
- package/apps/lite-cli/dist/shell.d.ts +12 -2
- package/apps/lite-cli/dist/shell.d.ts.map +1 -1
- package/apps/lite-cli/dist/shell.js +129 -57
- package/apps/lite-cli/dist/shell.js.map +1 -1
- package/apps/lite-cli/dist/sql-query.test.d.ts +2 -0
- package/apps/lite-cli/dist/sql-query.test.d.ts.map +1 -0
- package/apps/lite-cli/dist/sql-query.test.js +290 -0
- package/apps/lite-cli/dist/sql-query.test.js.map +1 -0
- package/apps/lite-cli/dist/version.d.ts +1 -1
- package/apps/lite-cli/dist/version.js +1 -1
- package/apps/lite-tui/dist/bin.js +3 -3
- package/apps/lite-tui/dist/bin.js.map +1 -1
- package/apps/lite-tui/dist/index.d.ts.map +1 -1
- package/apps/lite-tui/dist/index.js +2 -2
- package/apps/lite-tui/dist/index.js.map +1 -1
- package/apps/lite-tui/dist/index.test.js +5 -3
- package/apps/lite-tui/dist/index.test.js.map +1 -1
- package/apps/lite-tui/dist/render.d.ts +1 -1
- package/apps/lite-tui/dist/version.d.ts +1 -1
- package/apps/lite-tui/dist/version.js +1 -1
- package/bin/cchistory-lite-tui.mjs +3 -3
- package/bin/cchistory-lite.mjs +3 -3
- package/docs/guide/for-agents.md +65 -46
- package/docs/guide/lite.md +49 -11
- package/docs/guide/queries/latest-sessions.sql +4 -0
- package/docs/guide/queries/latest-turns.sql +1 -0
- package/docs/guide/queries/list-sessions.sql +2 -0
- package/docs/guide/query.md +153 -0
- package/node_modules/@cchistory/canonical/dist/directory-scope.d.ts +7 -0
- package/node_modules/@cchistory/canonical/dist/directory-scope.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/directory-scope.js +11 -0
- package/node_modules/@cchistory/canonical/dist/directory-scope.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.d.ts +5 -1
- package/node_modules/@cchistory/canonical/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.js +5 -1
- package/node_modules/@cchistory/canonical/dist/index.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/query.d.ts +15 -0
- package/node_modules/@cchistory/canonical/dist/query.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/query.js +208 -0
- package/node_modules/@cchistory/canonical/dist/query.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-family.d.ts +1 -0
- package/node_modules/@cchistory/canonical/dist/session-family.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-family.js +3 -0
- package/node_modules/@cchistory/canonical/dist/session-family.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-family.test.js +61 -0
- package/node_modules/@cchistory/canonical/dist/session-family.test.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts +30 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js +713 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.d.ts +2 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.js +56 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.js.map +1 -0
- package/node_modules/@cchistory/canonical/package.json +1 -1
- package/node_modules/@cchistory/domain/dist/evidence-atoms.d.ts +7 -0
- package/node_modules/@cchistory/domain/dist/evidence-atoms.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/evidence-atoms.js +36 -0
- package/node_modules/@cchistory/domain/dist/evidence-atoms.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.d.ts +26 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.js +80 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/index.d.ts +6 -0
- package/node_modules/@cchistory/domain/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/domain/dist/index.js +5 -0
- package/node_modules/@cchistory/domain/dist/index.js.map +1 -1
- package/node_modules/@cchistory/domain/dist/masks.d.ts +31 -0
- package/node_modules/@cchistory/domain/dist/masks.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/masks.js +342 -0
- package/node_modules/@cchistory/domain/dist/masks.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.d.ts +58 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.js +2 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/query.d.ts +67 -0
- package/node_modules/@cchistory/domain/dist/query.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/query.js +2 -0
- package/node_modules/@cchistory/domain/dist/query.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.d.ts +14 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.js +247 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.js.map +1 -0
- package/node_modules/@cchistory/domain/package.json +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts +0 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.js +0 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts +30 -9
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.js +263 -142
- package/node_modules/@cchistory/live-runtime/dist/index.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.test.js +177 -20
- package/node_modules/@cchistory/live-runtime/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.d.ts +16 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.js +55 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.js +192 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.d.ts +21 -22
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.js +53 -41
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js +266 -57
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts +47 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.js +15 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.js +166 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.d.ts +37 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.js +301 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.js +67 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.js +14 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.d.ts +13 -10
- package/node_modules/@cchistory/live-runtime/dist/system-memory.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/system-memory.js +61 -34
- package/node_modules/@cchistory/live-runtime/dist/system-memory.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.js +76 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/package.json +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/discovery.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/discovery.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/factories.d.ts +2 -4
- package/node_modules/@cchistory/source-adapters/dist/core/factories.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/factories.js +1 -23
- package/node_modules/@cchistory/source-adapters/dist/core/factories.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.d.ts +25 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.js +80 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.js +122 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.d.ts +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.js +2 -11
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js +4 -4
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts +8 -6
- package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/probe.js +54 -36
- package/node_modules/@cchistory/source-adapters/dist/core/probe.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.d.ts +2 -28
- package/node_modules/@cchistory/source-adapters/dist/core/projections.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.js +2 -695
- package/node_modules/@cchistory/source-adapters/dist/core/projections.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts +18 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js +27 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js +75 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.d.ts +6 -0
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.d.ts +1 -13
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.js +1 -246
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.d.ts +1 -25
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.js +1 -79
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts +6 -35
- package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.js +14 -10
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.d.ts +6 -0
- package/node_modules/@cchistory/source-adapters/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.js +4 -0
- package/node_modules/@cchistory/source-adapters/dist/index.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.test.js +2 -0
- package/node_modules/@cchistory/source-adapters/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/masks.d.ts +1 -30
- package/node_modules/@cchistory/source-adapters/dist/masks.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/masks.js +1 -341
- package/node_modules/@cchistory/source-adapters/dist/masks.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/accio.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/accio.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/claude.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/claude.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.d.ts +14 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.js +103 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.js +5 -3
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.js +24 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js +11 -9
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.d.ts +8 -0
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.js +7 -0
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/test-helpers.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/package.json +1 -1
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +428 -0
- package/node_modules/commander/index.js +1224 -0
- package/node_modules/commander/package.json +38 -0
- package/node_modules/commander/typings/index.d.ts +310 -0
- package/node_modules/discontinuous-range/.npmignore +28 -0
- package/node_modules/discontinuous-range/.travis.yml +4 -0
- package/node_modules/discontinuous-range/LICENSE +21 -0
- package/node_modules/discontinuous-range/README.md +23 -0
- package/node_modules/discontinuous-range/index.js +144 -0
- package/node_modules/discontinuous-range/package.json +27 -0
- package/node_modules/discontinuous-range/test/main-test.js +96 -0
- package/node_modules/moo/LICENSE +29 -0
- package/node_modules/moo/README.md +385 -0
- package/node_modules/moo/moo.js +645 -0
- package/node_modules/moo/package.json +29 -0
- package/node_modules/nearley/LICENSE.txt +21 -0
- package/node_modules/nearley/README.md +80 -0
- package/node_modules/nearley/bin/nearley-railroad.js +121 -0
- package/node_modules/nearley/bin/nearley-test.js +64 -0
- package/node_modules/nearley/bin/nearley-unparse.js +29 -0
- package/node_modules/nearley/bin/nearleyc.js +38 -0
- package/node_modules/nearley/builtin/cow.ne +2 -0
- package/node_modules/nearley/builtin/number.ne +51 -0
- package/node_modules/nearley/builtin/postprocessors.ne +36 -0
- package/node_modules/nearley/builtin/string.ne +26 -0
- package/node_modules/nearley/builtin/whitespace.ne +5 -0
- package/node_modules/nearley/lib/compile.js +307 -0
- package/node_modules/nearley/lib/generate.js +244 -0
- package/node_modules/nearley/lib/lint.js +28 -0
- package/node_modules/nearley/lib/nearley-language-bootstrapped.js +132 -0
- package/node_modules/nearley/lib/nearley-language-bootstrapped.ne +126 -0
- package/node_modules/nearley/lib/nearley.js +564 -0
- package/node_modules/nearley/lib/stream.js +18 -0
- package/node_modules/nearley/lib/unparse.js +139 -0
- package/node_modules/nearley/package.json +63 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.d.ts +237 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.d.ts +33 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/index.d.ts +11 -0
- package/node_modules/pgsql-ast-parser/index.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/index.js +6484 -0
- package/node_modules/pgsql-ast-parser/index.js.map +1 -0
- package/node_modules/pgsql-ast-parser/interfaces.d.ts +1 -0
- package/node_modules/pgsql-ast-parser/interfaces.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/keywords.d.ts +2 -0
- package/node_modules/pgsql-ast-parser/keywords.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/lexer.d.ts +15 -0
- package/node_modules/pgsql-ast-parser/lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/lexer.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/lexer.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-builder.d.ts +10 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-builder.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/package.json +69 -0
- package/node_modules/pgsql-ast-parser/parser.d.ts +33 -0
- package/node_modules/pgsql-ast-parser/parser.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/pg-escape.d.ts +2 -0
- package/node_modules/pgsql-ast-parser/pg-escape.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/readme.md +255 -0
- package/node_modules/pgsql-ast-parser/src/ast-mapper.spec.ts +296 -0
- package/node_modules/pgsql-ast-parser/src/ast-mapper.ts +1378 -0
- package/node_modules/pgsql-ast-parser/src/ast-visitor.spec.ts +57 -0
- package/node_modules/pgsql-ast-parser/src/ast-visitor.ts +101 -0
- package/node_modules/pgsql-ast-parser/src/index.ts +10 -0
- package/node_modules/pgsql-ast-parser/src/interfaces.ts +0 -0
- package/node_modules/pgsql-ast-parser/src/keywords.ts +8 -0
- package/node_modules/pgsql-ast-parser/src/lexer.spec.ts +245 -0
- package/node_modules/pgsql-ast-parser/src/lexer.ts +267 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/array-lexer.ts +27 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/array.ne +18 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/array.spec.ts +55 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/geometric-lexer.ts +26 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/geometric.ne +88 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/geometric.spec.ts +131 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-builder.ts +148 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-iso-lexer.ts +17 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-iso.ne +53 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-lexer.ts +26 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval.ne +54 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval.spec.ts +106 -0
- package/node_modules/pgsql-ast-parser/src/parser.ts +142 -0
- package/node_modules/pgsql-ast-parser/src/pg-escape.ts +14 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-index.ne +29 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-index.spec.ts +35 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-table.ne +123 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-table.spec.ts +476 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-type.ne +33 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-type.spec.ts +29 -0
- package/node_modules/pgsql-ast-parser/src/syntax/ast.ts +1150 -0
- package/node_modules/pgsql-ast-parser/src/syntax/base.ne +369 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-extension.ne +17 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-extension.spec.ts +37 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-index.ne +62 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-index.spec.ts +245 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-table.ne +174 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-table.spec.ts +761 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-type.ne +40 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-type.spec.ts +32 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-view.ne +68 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-view.spec.ts +187 -0
- package/node_modules/pgsql-ast-parser/src/syntax/deallocate.ne +13 -0
- package/node_modules/pgsql-ast-parser/src/syntax/deallocate.spec.ts +19 -0
- package/node_modules/pgsql-ast-parser/src/syntax/delete.ne +36 -0
- package/node_modules/pgsql-ast-parser/src/syntax/delete.spec.ts +71 -0
- package/node_modules/pgsql-ast-parser/src/syntax/drop.ne +28 -0
- package/node_modules/pgsql-ast-parser/src/syntax/drop.spec.ts +77 -0
- package/node_modules/pgsql-ast-parser/src/syntax/edge-cases.spec.ts +41 -0
- package/node_modules/pgsql-ast-parser/src/syntax/expr.ne +350 -0
- package/node_modules/pgsql-ast-parser/src/syntax/expr.spec.ts +1638 -0
- package/node_modules/pgsql-ast-parser/src/syntax/functions.ne +114 -0
- package/node_modules/pgsql-ast-parser/src/syntax/functions.spec.ts +235 -0
- package/node_modules/pgsql-ast-parser/src/syntax/insert.ne +63 -0
- package/node_modules/pgsql-ast-parser/src/syntax/insert.spec.ts +292 -0
- package/node_modules/pgsql-ast-parser/src/syntax/main.ne +77 -0
- package/node_modules/pgsql-ast-parser/src/syntax/nearley.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/src/syntax/prepare.ne +8 -0
- package/node_modules/pgsql-ast-parser/src/syntax/prepare.spec.ts +44 -0
- package/node_modules/pgsql-ast-parser/src/syntax/refresh-materialized-view.ne +19 -0
- package/node_modules/pgsql-ast-parser/src/syntax/refresh-materialized-view.spec.ts +42 -0
- package/node_modules/pgsql-ast-parser/src/syntax/select.ne +223 -0
- package/node_modules/pgsql-ast-parser/src/syntax/select.spec.ts +1063 -0
- package/node_modules/pgsql-ast-parser/src/syntax/sequence.ne +101 -0
- package/node_modules/pgsql-ast-parser/src/syntax/sequence.spec.ts +103 -0
- package/node_modules/pgsql-ast-parser/src/syntax/simple-statements.ne +168 -0
- package/node_modules/pgsql-ast-parser/src/syntax/simple-statements.spec.ts +327 -0
- package/node_modules/pgsql-ast-parser/src/syntax/spec-utils.ts +333 -0
- package/node_modules/pgsql-ast-parser/src/syntax/union.ne +18 -0
- package/node_modules/pgsql-ast-parser/src/syntax/union.spec.ts +125 -0
- package/node_modules/pgsql-ast-parser/src/syntax/update.ne +56 -0
- package/node_modules/pgsql-ast-parser/src/syntax/update.spec.ts +87 -0
- package/node_modules/pgsql-ast-parser/src/syntax/with.ne +41 -0
- package/node_modules/pgsql-ast-parser/src/syntax/with.spec.ts +155 -0
- package/node_modules/pgsql-ast-parser/src/to-sql.spec.ts +85 -0
- package/node_modules/pgsql-ast-parser/src/to-sql.ts +1555 -0
- package/node_modules/pgsql-ast-parser/src/utils.ts +47 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-index.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-index.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-table.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-table.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-type.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-type.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/ast.d.ts +826 -0
- package/node_modules/pgsql-ast-parser/syntax/ast.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-extension.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-extension.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-index.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-index.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-table.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-table.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-type.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-type.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-view.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-view.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/deallocate.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/deallocate.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/delete.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/delete.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/drop.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/drop.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/edge-cases.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/edge-cases.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/expr.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/expr.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/functions.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/functions.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/insert.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/insert.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/main.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/syntax/main.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/prepare.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/prepare.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/refresh-materialized-view.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/refresh-materialized-view.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/select.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/select.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/sequence.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/sequence.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/simple-statements.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/simple-statements.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/spec-utils.d.ts +35 -0
- package/node_modules/pgsql-ast-parser/syntax/spec-utils.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/union.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/union.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/update.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/update.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/with.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/with.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/to-sql.d.ts +7 -0
- package/node_modules/pgsql-ast-parser/to-sql.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/to-sql.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/to-sql.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/utils.d.ts +16 -0
- package/node_modules/pgsql-ast-parser/utils.d.ts.map +1 -0
- package/node_modules/railroad-diagrams/.gitattributes +22 -0
- package/node_modules/railroad-diagrams/.npmignore +163 -0
- package/node_modules/railroad-diagrams/README.md +86 -0
- package/node_modules/railroad-diagrams/css-example.py-js +183 -0
- package/node_modules/railroad-diagrams/example.html +141 -0
- package/node_modules/railroad-diagrams/generator.html +59 -0
- package/node_modules/railroad-diagrams/package.json +23 -0
- package/node_modules/railroad-diagrams/railroad-diagrams.css +23 -0
- package/node_modules/railroad-diagrams/railroad-diagrams.js +524 -0
- package/node_modules/railroad-diagrams/railroad_diagrams.py +427 -0
- package/node_modules/randexp/LICENSE +19 -0
- package/node_modules/randexp/README.md +134 -0
- package/node_modules/randexp/lib/randexp.js +245 -0
- package/node_modules/randexp/package.json +48 -0
- package/node_modules/ret/LICENSE +19 -0
- package/node_modules/ret/README.md +183 -0
- package/node_modules/ret/lib/index.js +282 -0
- package/node_modules/ret/lib/positions.js +17 -0
- package/node_modules/ret/lib/sets.js +82 -0
- package/node_modules/ret/lib/types.js +10 -0
- package/node_modules/ret/lib/util.js +111 -0
- package/node_modules/ret/package.json +35 -0
- package/package.json +22 -6
- package/schemas/cchistory-lite-agent-v1.schema.json +6 -7
- package/schemas/cchistory-lite-error-v1.schema.json +58 -8
- package/schemas/cchistory-lite-query-result-v2.schema.json +66 -11
- package/schemas/cchistory-lite-query-result-v3.schema.json +219 -0
- package/schemas/cchistory-lite-query-v3.schema.json +57 -0
- package/schemas/cchistory-lite-source-inventory-v1.schema.json +72 -0
- package/skills/using-cchistory-lite/SKILL.md +125 -55
- package/node_modules/@cchistory/live-runtime/dist/node-memory.d.ts +0 -8
- package/node_modules/@cchistory/live-runtime/dist/node-memory.d.ts.map +0 -1
- package/node_modules/@cchistory/live-runtime/dist/node-memory.js +0 -110
- package/node_modules/@cchistory/live-runtime/dist/node-memory.js.map +0 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
var ret = require('ret');
|
|
2
|
+
var DRange = require('discontinuous-range');
|
|
3
|
+
var types = ret.types;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* If code is alphabetic, converts to other case.
|
|
8
|
+
* If not alphabetic, returns back code.
|
|
9
|
+
*
|
|
10
|
+
* @param {Number} code
|
|
11
|
+
* @return {Number}
|
|
12
|
+
*/
|
|
13
|
+
function toOtherCase(code) {
|
|
14
|
+
return code + (97 <= code && code <= 122 ? -32 :
|
|
15
|
+
65 <= code && code <= 90 ? 32 : 0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Randomly returns a true or false value.
|
|
21
|
+
*
|
|
22
|
+
* @return {Boolean}
|
|
23
|
+
*/
|
|
24
|
+
function randBool() {
|
|
25
|
+
return !this.randInt(0, 1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Randomly selects and returns a value from the array.
|
|
31
|
+
*
|
|
32
|
+
* @param {Array.<Object>} arr
|
|
33
|
+
* @return {Object}
|
|
34
|
+
*/
|
|
35
|
+
function randSelect(arr) {
|
|
36
|
+
if (arr instanceof DRange) {
|
|
37
|
+
return arr.index(this.randInt(0, arr.length - 1));
|
|
38
|
+
}
|
|
39
|
+
return arr[this.randInt(0, arr.length - 1)];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* expands a token to a DiscontinuousRange of characters which has a
|
|
45
|
+
* length and an index function (for random selecting)
|
|
46
|
+
*
|
|
47
|
+
* @param {Object} token
|
|
48
|
+
* @return {DiscontinuousRange}
|
|
49
|
+
*/
|
|
50
|
+
function expand(token) {
|
|
51
|
+
if (token.type === ret.types.CHAR) {
|
|
52
|
+
return new DRange(token.value);
|
|
53
|
+
} else if (token.type === ret.types.RANGE) {
|
|
54
|
+
return new DRange(token.from, token.to);
|
|
55
|
+
} else {
|
|
56
|
+
var drange = new DRange();
|
|
57
|
+
for (var i = 0; i < token.set.length; i++) {
|
|
58
|
+
var subrange = expand.call(this, token.set[i]);
|
|
59
|
+
drange.add(subrange);
|
|
60
|
+
if (this.ignoreCase) {
|
|
61
|
+
for (var j = 0; j < subrange.length; j++) {
|
|
62
|
+
var code = subrange.index(j);
|
|
63
|
+
var otherCaseCode = toOtherCase(code);
|
|
64
|
+
if (code !== otherCaseCode) {
|
|
65
|
+
drange.add(otherCaseCode);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (token.not) {
|
|
71
|
+
return this.defaultRange.clone().subtract(drange);
|
|
72
|
+
} else {
|
|
73
|
+
return drange;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Checks if some custom properties have been set for this regexp.
|
|
81
|
+
*
|
|
82
|
+
* @param {RandExp} randexp
|
|
83
|
+
* @param {RegExp} regexp
|
|
84
|
+
*/
|
|
85
|
+
function checkCustom(randexp, regexp) {
|
|
86
|
+
if (typeof regexp.max === 'number') {
|
|
87
|
+
randexp.max = regexp.max;
|
|
88
|
+
}
|
|
89
|
+
if (regexp.defaultRange instanceof DRange) {
|
|
90
|
+
randexp.defaultRange = regexp.defaultRange;
|
|
91
|
+
}
|
|
92
|
+
if (typeof regexp.randInt === 'function') {
|
|
93
|
+
randexp.randInt = regexp.randInt;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @constructor
|
|
100
|
+
* @param {RegExp|String} regexp
|
|
101
|
+
* @param {String} m
|
|
102
|
+
*/
|
|
103
|
+
var RandExp = module.exports = function(regexp, m) {
|
|
104
|
+
this.defaultRange = this.defaultRange.clone();
|
|
105
|
+
if (regexp instanceof RegExp) {
|
|
106
|
+
this.ignoreCase = regexp.ignoreCase;
|
|
107
|
+
this.multiline = regexp.multiline;
|
|
108
|
+
checkCustom(this, regexp);
|
|
109
|
+
regexp = regexp.source;
|
|
110
|
+
|
|
111
|
+
} else if (typeof regexp === 'string') {
|
|
112
|
+
this.ignoreCase = m && m.indexOf('i') !== -1;
|
|
113
|
+
this.multiline = m && m.indexOf('m') !== -1;
|
|
114
|
+
} else {
|
|
115
|
+
throw new Error('Expected a regexp or string');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
this.tokens = ret(regexp);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
// When a repetitional token has its max set to Infinite,
|
|
123
|
+
// randexp won't actually generate a random amount between min and Infinite
|
|
124
|
+
// instead it will see Infinite as min + 100.
|
|
125
|
+
RandExp.prototype.max = 100;
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
// Generates the random string.
|
|
129
|
+
RandExp.prototype.gen = function() {
|
|
130
|
+
return gen.call(this, this.tokens, []);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
// Enables use of randexp with a shorter call.
|
|
135
|
+
RandExp.randexp = function(regexp, m) {
|
|
136
|
+
var randexp;
|
|
137
|
+
if (regexp._randexp === undefined) {
|
|
138
|
+
randexp = new RandExp(regexp, m);
|
|
139
|
+
regexp._randexp = randexp;
|
|
140
|
+
} else {
|
|
141
|
+
randexp = regexp._randexp;
|
|
142
|
+
}
|
|
143
|
+
checkCustom(randexp, regexp);
|
|
144
|
+
return randexp.gen();
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
// This enables sugary /regexp/.gen syntax.
|
|
149
|
+
RandExp.sugar = function() {
|
|
150
|
+
/* jshint freeze:false */
|
|
151
|
+
RegExp.prototype.gen = function() {
|
|
152
|
+
return RandExp.randexp(this);
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// This allows expanding to include additional characters
|
|
157
|
+
// for instance: RandExp.defaultRange.add(0, 65535);
|
|
158
|
+
RandExp.prototype.defaultRange = new DRange(32, 126);
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Randomly generates and returns a number between a and b (inclusive).
|
|
163
|
+
*
|
|
164
|
+
* @param {Number} a
|
|
165
|
+
* @param {Number} b
|
|
166
|
+
* @return {Number}
|
|
167
|
+
*/
|
|
168
|
+
RandExp.prototype.randInt = function(a, b) {
|
|
169
|
+
return a + Math.floor(Math.random() * (1 + b - a));
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Generate random string modeled after given tokens.
|
|
175
|
+
*
|
|
176
|
+
* @param {Object} token
|
|
177
|
+
* @param {Array.<String>} groups
|
|
178
|
+
* @return {String}
|
|
179
|
+
*/
|
|
180
|
+
function gen(token, groups) {
|
|
181
|
+
var stack, str, n, i, l;
|
|
182
|
+
|
|
183
|
+
switch (token.type) {
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
case types.ROOT:
|
|
187
|
+
case types.GROUP:
|
|
188
|
+
// Ignore lookaheads for now.
|
|
189
|
+
if (token.followedBy || token.notFollowedBy) { return ''; }
|
|
190
|
+
|
|
191
|
+
// Insert placeholder until group string is generated.
|
|
192
|
+
if (token.remember && token.groupNumber === undefined) {
|
|
193
|
+
token.groupNumber = groups.push(null) - 1;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
stack = token.options ?
|
|
197
|
+
randSelect.call(this, token.options) : token.stack;
|
|
198
|
+
|
|
199
|
+
str = '';
|
|
200
|
+
for (i = 0, l = stack.length; i < l; i++) {
|
|
201
|
+
str += gen.call(this, stack[i], groups);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (token.remember) {
|
|
205
|
+
groups[token.groupNumber] = str;
|
|
206
|
+
}
|
|
207
|
+
return str;
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
case types.POSITION:
|
|
211
|
+
// Do nothing for now.
|
|
212
|
+
return '';
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
case types.SET:
|
|
216
|
+
var expandedSet = expand.call(this, token);
|
|
217
|
+
if (!expandedSet.length) { return ''; }
|
|
218
|
+
return String.fromCharCode(randSelect.call(this, expandedSet));
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
case types.REPETITION:
|
|
222
|
+
// Randomly generate number between min and max.
|
|
223
|
+
n = this.randInt(token.min,
|
|
224
|
+
token.max === Infinity ? token.min + this.max : token.max);
|
|
225
|
+
|
|
226
|
+
str = '';
|
|
227
|
+
for (i = 0; i < n; i++) {
|
|
228
|
+
str += gen.call(this, token.value, groups);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return str;
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
case types.REFERENCE:
|
|
235
|
+
return groups[token.value - 1] || '';
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
case types.CHAR:
|
|
239
|
+
var code = this.ignoreCase && randBool.call(this) ?
|
|
240
|
+
toOtherCase(token.value) : token.value;
|
|
241
|
+
return String.fromCharCode(code);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "randexp",
|
|
3
|
+
"description": "Create random strings that match a given regular expression.",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"regex",
|
|
6
|
+
"regexp",
|
|
7
|
+
"regular expression",
|
|
8
|
+
"random",
|
|
9
|
+
"test"
|
|
10
|
+
],
|
|
11
|
+
"version": "0.4.6",
|
|
12
|
+
"homepage": "http://fent.github.io/randexp.js/",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git://github.com/fent/randexp.js.git"
|
|
16
|
+
},
|
|
17
|
+
"author": "Roly Fentanes (https://github.com/fent)",
|
|
18
|
+
"main": "./lib/randexp.js",
|
|
19
|
+
"files": [
|
|
20
|
+
"lib"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"version": "gulp build && git add build",
|
|
24
|
+
"test": "istanbul cover node_modules/.bin/_mocha -- test/*-test.js"
|
|
25
|
+
},
|
|
26
|
+
"directories": {
|
|
27
|
+
"lib": "./lib"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"discontinuous-range": "1.0.0",
|
|
31
|
+
"ret": "~0.1.10"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"browserify": "^14.0.0",
|
|
35
|
+
"gulp": "^3.9.0",
|
|
36
|
+
"gulp-header": "^1.7.1",
|
|
37
|
+
"gulp-insert": "^0.5.0",
|
|
38
|
+
"gulp-uglify": "^3.0.0",
|
|
39
|
+
"istanbul": "*",
|
|
40
|
+
"mocha": "*",
|
|
41
|
+
"vinyl-buffer": "^1.0.0",
|
|
42
|
+
"vinyl-source-stream": "^1.1.0"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=0.12"
|
|
46
|
+
},
|
|
47
|
+
"license": "MIT"
|
|
48
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (C) 2011 by Roly Fentanes
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Regular Expression Tokenizer
|
|
2
|
+
|
|
3
|
+
Tokenizes strings that represent a regular expressions.
|
|
4
|
+
|
|
5
|
+
[](http://travis-ci.org/fent/ret.js)
|
|
6
|
+
[](https://david-dm.org/fent/ret.js)
|
|
7
|
+
[](https://codecov.io/gh/fent/ret.js)
|
|
8
|
+
|
|
9
|
+
# Usage
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
var ret = require('ret');
|
|
13
|
+
|
|
14
|
+
var tokens = ret(/foo|bar/.source);
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`tokens` will contain the following object
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
{
|
|
21
|
+
"type": ret.types.ROOT
|
|
22
|
+
"options": [
|
|
23
|
+
[ { "type": ret.types.CHAR, "value", 102 },
|
|
24
|
+
{ "type": ret.types.CHAR, "value", 111 },
|
|
25
|
+
{ "type": ret.types.CHAR, "value", 111 } ],
|
|
26
|
+
[ { "type": ret.types.CHAR, "value", 98 },
|
|
27
|
+
{ "type": ret.types.CHAR, "value", 97 },
|
|
28
|
+
{ "type": ret.types.CHAR, "value", 114 } ]
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
# Token Types
|
|
34
|
+
|
|
35
|
+
`ret.types` is a collection of the various token types exported by ret.
|
|
36
|
+
|
|
37
|
+
### ROOT
|
|
38
|
+
|
|
39
|
+
Only used in the root of the regexp. This is needed due to the posibility of the root containing a pipe `|` character. In that case, the token will have an `options` key that will be an array of arrays of tokens. If not, it will contain a `stack` key that is an array of tokens.
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
{
|
|
43
|
+
"type": ret.types.ROOT,
|
|
44
|
+
"stack": [token1, token2...],
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
{
|
|
50
|
+
"type": ret.types.ROOT,
|
|
51
|
+
"options" [
|
|
52
|
+
[token1, token2...],
|
|
53
|
+
[othertoken1, othertoken2...]
|
|
54
|
+
...
|
|
55
|
+
],
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### GROUP
|
|
60
|
+
|
|
61
|
+
Groups contain tokens that are inside of a parenthesis. If the group begins with `?` followed by another character, it's a special type of group. A ':' tells the group not to be remembered when `exec` is used. '=' means the previous token matches only if followed by this group, and '!' means the previous token matches only if NOT followed.
|
|
62
|
+
|
|
63
|
+
Like root, it can contain an `options` key instead of `stack` if there is a pipe.
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
{
|
|
67
|
+
"type": ret.types.GROUP,
|
|
68
|
+
"remember" true,
|
|
69
|
+
"followedBy": false,
|
|
70
|
+
"notFollowedBy": false,
|
|
71
|
+
"stack": [token1, token2...],
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
{
|
|
77
|
+
"type": ret.types.GROUP,
|
|
78
|
+
"remember" true,
|
|
79
|
+
"followedBy": false,
|
|
80
|
+
"notFollowedBy": false,
|
|
81
|
+
"options" [
|
|
82
|
+
[token1, token2...],
|
|
83
|
+
[othertoken1, othertoken2...]
|
|
84
|
+
...
|
|
85
|
+
],
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### POSITION
|
|
90
|
+
|
|
91
|
+
`\b`, `\B`, `^`, and `$` specify positions in the regexp.
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
{
|
|
95
|
+
"type": ret.types.POSITION,
|
|
96
|
+
"value": "^",
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### SET
|
|
101
|
+
|
|
102
|
+
Contains a key `set` specifying what tokens are allowed and a key `not` specifying if the set should be negated. A set can contain other sets, ranges, and characters.
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
{
|
|
106
|
+
"type": ret.types.SET,
|
|
107
|
+
"set": [token1, token2...],
|
|
108
|
+
"not": false,
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### RANGE
|
|
113
|
+
|
|
114
|
+
Used in set tokens to specify a character range. `from` and `to` are character codes.
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
{
|
|
118
|
+
"type": ret.types.RANGE,
|
|
119
|
+
"from": 97,
|
|
120
|
+
"to": 122,
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### REPETITION
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
{
|
|
128
|
+
"type": ret.types.REPETITION,
|
|
129
|
+
"min": 0,
|
|
130
|
+
"max": Infinity,
|
|
131
|
+
"value": token,
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### REFERENCE
|
|
136
|
+
|
|
137
|
+
References a group token. `value` is 1-9.
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
{
|
|
141
|
+
"type": ret.types.REFERENCE,
|
|
142
|
+
"value": 1,
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### CHAR
|
|
147
|
+
|
|
148
|
+
Represents a single character token. `value` is the character code. This might seem a bit cluttering instead of concatenating characters together. But since repetition tokens only repeat the last token and not the last clause like the pipe, it's simpler to do it this way.
|
|
149
|
+
|
|
150
|
+
```js
|
|
151
|
+
{
|
|
152
|
+
"type": ret.types.CHAR,
|
|
153
|
+
"value": 123,
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Errors
|
|
158
|
+
|
|
159
|
+
ret.js will throw errors if given a string with an invalid regular expression. All possible errors are
|
|
160
|
+
|
|
161
|
+
* Invalid group. When a group with an immediate `?` character is followed by an invalid character. It can only be followed by `!`, `=`, or `:`. Example: `/(?_abc)/`
|
|
162
|
+
* Nothing to repeat. Thrown when a repetitional token is used as the first token in the current clause, as in right in the beginning of the regexp or group, or right after a pipe. Example: `/foo|?bar/`, `/{1,3}foo|bar/`, `/foo(+bar)/`
|
|
163
|
+
* Unmatched ). A group was not opened, but was closed. Example: `/hello)2u/`
|
|
164
|
+
* Unterminated group. A group was not closed. Example: `/(1(23)4/`
|
|
165
|
+
* Unterminated character class. A custom character set was not closed. Example: `/[abc/`
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
# Install
|
|
169
|
+
|
|
170
|
+
npm install ret
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
# Tests
|
|
174
|
+
|
|
175
|
+
Tests are written with [vows](http://vowsjs.org/)
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npm test
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
# License
|
|
182
|
+
|
|
183
|
+
MIT
|