@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,106 @@
|
|
|
1
|
+
import 'mocha';
|
|
2
|
+
import 'chai';
|
|
3
|
+
import { expect, assert } from 'chai';
|
|
4
|
+
import { checkInterval } from '../syntax/spec-utils';
|
|
5
|
+
import { intervalToString } from './interval-builder';
|
|
6
|
+
|
|
7
|
+
describe('Interval literals', () => {
|
|
8
|
+
checkInterval(['2 year',
|
|
9
|
+
'2 years',
|
|
10
|
+
'2 YEARS',
|
|
11
|
+
'2 yr',
|
|
12
|
+
'2 yrs',
|
|
13
|
+
'2yrs',
|
|
14
|
+
'2 y',
|
|
15
|
+
'2y',
|
|
16
|
+
'P2Y'], { years: 2 });
|
|
17
|
+
checkInterval(['2 mons',
|
|
18
|
+
'2 months',
|
|
19
|
+
'2 month',
|
|
20
|
+
'2month',
|
|
21
|
+
'P2M',
|
|
22
|
+
], { months: 2 })
|
|
23
|
+
|
|
24
|
+
checkInterval(['2 days',
|
|
25
|
+
'2 day',
|
|
26
|
+
'2 d',
|
|
27
|
+
'2d',
|
|
28
|
+
'P2D',
|
|
29
|
+
], { days: 2 });
|
|
30
|
+
|
|
31
|
+
checkInterval(['2 h',
|
|
32
|
+
'2 hours',
|
|
33
|
+
'2 hrs',
|
|
34
|
+
], { hours: 2 });
|
|
35
|
+
|
|
36
|
+
checkInterval(['2 m',
|
|
37
|
+
'2 min',
|
|
38
|
+
'2 mins',
|
|
39
|
+
], { minutes: 2 });
|
|
40
|
+
|
|
41
|
+
checkInterval(['2 sec',
|
|
42
|
+
'2 s',
|
|
43
|
+
'2 secs',
|
|
44
|
+
], { seconds: 2 });
|
|
45
|
+
|
|
46
|
+
checkInterval(['2 ms',
|
|
47
|
+
'2 millisecond',
|
|
48
|
+
'2 milliseconds',
|
|
49
|
+
], { milliseconds: 2 });
|
|
50
|
+
|
|
51
|
+
checkInterval('-1 hours', { hours: -1 });
|
|
52
|
+
|
|
53
|
+
checkInterval('P1W', { days: 7 });
|
|
54
|
+
|
|
55
|
+
checkInterval('P-1Y1D', { years: -1, days: 1 });
|
|
56
|
+
|
|
57
|
+
checkInterval('P-1.5Y1M2D', { years: -1, months: -5, days: 2 });
|
|
58
|
+
|
|
59
|
+
checkInterval('-2.5 hours', { hours: -2, minutes: -30 });
|
|
60
|
+
|
|
61
|
+
checkInterval('-2.5 hours 5 mins', { hours: -2, minutes: -25 });
|
|
62
|
+
|
|
63
|
+
checkInterval('1 hours -65 mins', { minutes: -5 });
|
|
64
|
+
|
|
65
|
+
checkInterval('P1.5D', { days: 1, hours: 12 });
|
|
66
|
+
|
|
67
|
+
checkInterval('P-1.5D', { days: -1, hours: -12 });
|
|
68
|
+
|
|
69
|
+
checkInterval('P-1.5DT2M', { days: -1, hours: -11, minutes: -58 });
|
|
70
|
+
|
|
71
|
+
checkInterval('P1D2M1Y', { days: 1, months: 2, years: 1 });
|
|
72
|
+
|
|
73
|
+
checkInterval('P1D2D', { days: 3 });
|
|
74
|
+
|
|
75
|
+
checkInterval('PT1M2M', { minutes: 3 });
|
|
76
|
+
|
|
77
|
+
checkInterval('PT-1MT2MT1H', { minutes: 1, hours: 1 });
|
|
78
|
+
|
|
79
|
+
checkInterval('PT70S', { minutes: 1, seconds: 10 });
|
|
80
|
+
checkInterval('PT120M', { hours: 2 });
|
|
81
|
+
checkInterval('P500D', { days: 500 });
|
|
82
|
+
|
|
83
|
+
checkInterval('1:00:00', { hours: 1 });
|
|
84
|
+
|
|
85
|
+
checkInterval('1:2:3.004', { hours: 1, minutes: 2, seconds: 3, milliseconds: 4 });
|
|
86
|
+
|
|
87
|
+
checkInterval('1:2.003 4y', { minutes: 1, seconds: 2, milliseconds: 3, years: 4 });
|
|
88
|
+
|
|
89
|
+
checkInterval('1 year 40 days 1 minute', { years: 1, days: 40, minutes: 1 });
|
|
90
|
+
|
|
91
|
+
checkInterval(`2 years 13 months 50 days`, { years: 3, months: 1, days: 50 });
|
|
92
|
+
|
|
93
|
+
checkInterval(`2 years 13 months`, { years: 3, months: 1 });
|
|
94
|
+
|
|
95
|
+
checkInterval(`2 years -13 months 50 days`, { months: 11, days: 50 });
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
it('produces a string', () => {
|
|
99
|
+
expect(intervalToString({ years: 1 })).to.equal('1 year');
|
|
100
|
+
expect(intervalToString({ years: -1 })).to.equal('-1 years');
|
|
101
|
+
expect(intervalToString({ years: 2 })).to.equal('2 years');
|
|
102
|
+
expect(intervalToString({ minutes: -2, seconds: 1 })).to.equal('-00:01:59');
|
|
103
|
+
expect(intervalToString({ milliseconds: 1 })).to.equal('00:00:00.001');
|
|
104
|
+
expect(intervalToString({ milliseconds: 10 })).to.equal('00:00:00.01');
|
|
105
|
+
});
|
|
106
|
+
});
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Statement, Expr, QName, GeometricLiteral, Point, Line, Segment, Box, Path, Polygon, Circle, Interval, PGComment } from './syntax/ast';
|
|
2
|
+
import { Parser, Grammar } from 'nearley';
|
|
3
|
+
import sqlGrammar from './syntax/main.ne';
|
|
4
|
+
import arrayGrammar from './literal-syntaxes/array.ne';
|
|
5
|
+
import geometricGrammar from './literal-syntaxes/geometric.ne';
|
|
6
|
+
import intervalTextGrammar from './literal-syntaxes/interval.ne';
|
|
7
|
+
import intervalIsoGrammar from './literal-syntaxes/interval-iso.ne';
|
|
8
|
+
import { buildInterval } from './literal-syntaxes/interval-builder';
|
|
9
|
+
import { tracking, trackingComments } from './lexer';
|
|
10
|
+
|
|
11
|
+
let sqlCompiled: Grammar;
|
|
12
|
+
let arrayCompiled: Grammar;
|
|
13
|
+
let geometricCompiled: Grammar;
|
|
14
|
+
let intervalTextCompiled: Grammar;
|
|
15
|
+
let intervalIsoCompiled: Grammar;
|
|
16
|
+
|
|
17
|
+
/** Parse the first SQL statement in the given text (discards the rest), and return its AST */
|
|
18
|
+
export function parseFirst(sql: string): Statement {
|
|
19
|
+
const first = parse(sql);
|
|
20
|
+
return first[0];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ParseOptions {
|
|
24
|
+
/**
|
|
25
|
+
* [Advanced usage only] This allows to parse sub-expressions, not necessarily full valid statements.
|
|
26
|
+
*
|
|
27
|
+
* For instance, `parse('2+2', {entry: 'expr'})` will return the AST of the given expression (which is not a valid statement)
|
|
28
|
+
*/
|
|
29
|
+
entry?: string;
|
|
30
|
+
|
|
31
|
+
/** If true, then a detailed location will be available on each node */
|
|
32
|
+
locationTracking?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Parse an AST from SQL, and get the comments */
|
|
36
|
+
export function parseWithComments(sql: string, options?: ParseOptions): { ast: Statement[]; comments: PGComment[] } {
|
|
37
|
+
return trackingComments(() => parse(sql, options));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Parse an AST from SQL */
|
|
41
|
+
export function parse(sql: string): Statement[];
|
|
42
|
+
export function parse(sql: string, entry: 'expr'): Expr;
|
|
43
|
+
export function parse(sql: string, entry: 'qualified_name'): QName;
|
|
44
|
+
export function parse(sql: string, options?: ParseOptions): Statement[];
|
|
45
|
+
export function parse(sql: string, optEntry?: string | ParseOptions): any {
|
|
46
|
+
if (!sqlCompiled) {
|
|
47
|
+
sqlCompiled = Grammar.fromCompiled(sqlGrammar);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const entry = typeof optEntry === 'string'
|
|
51
|
+
? optEntry
|
|
52
|
+
: optEntry?.entry;
|
|
53
|
+
const opts = typeof optEntry === 'string' ? null : optEntry;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
// parse sql
|
|
57
|
+
const doParse = () => _parse(sql, sqlCompiled, entry);
|
|
58
|
+
let parsed = opts?.locationTracking
|
|
59
|
+
? tracking(doParse)
|
|
60
|
+
: doParse();
|
|
61
|
+
|
|
62
|
+
// always return an array of statements.
|
|
63
|
+
if (typeof optEntry !== 'string' && !Array.isArray(parsed)) {
|
|
64
|
+
parsed = [parsed]
|
|
65
|
+
}
|
|
66
|
+
return parsed;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function parseArrayLiteral(sql: string): string[] {
|
|
70
|
+
if (!arrayCompiled) {
|
|
71
|
+
arrayCompiled = Grammar.fromCompiled(arrayGrammar);
|
|
72
|
+
}
|
|
73
|
+
return _parse(sql, arrayCompiled);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function parseIntervalLiteral(literal: string): Interval {
|
|
77
|
+
if (literal.startsWith('P')) {
|
|
78
|
+
if (!intervalIsoCompiled) {
|
|
79
|
+
intervalIsoCompiled = Grammar.fromCompiled(intervalIsoGrammar);
|
|
80
|
+
}
|
|
81
|
+
return buildInterval(literal, _parse(literal, intervalIsoCompiled));
|
|
82
|
+
} else {
|
|
83
|
+
if (!intervalTextCompiled) {
|
|
84
|
+
intervalTextCompiled = Grammar.fromCompiled(intervalTextGrammar);
|
|
85
|
+
}
|
|
86
|
+
const low = literal.toLowerCase(); // full text syntax is case insensitive
|
|
87
|
+
return buildInterval(literal, _parse(low, intervalTextCompiled));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
export function parseGeometricLiteral(sql: string, type: 'point'): Point;
|
|
93
|
+
export function parseGeometricLiteral(sql: string, type: 'line'): Line;
|
|
94
|
+
export function parseGeometricLiteral(sql: string, type: 'lseg'): Segment;
|
|
95
|
+
export function parseGeometricLiteral(sql: string, type: 'box'): Box;
|
|
96
|
+
export function parseGeometricLiteral(sql: string, type: 'path'): Path;
|
|
97
|
+
export function parseGeometricLiteral(sql: string, type: 'polygon'): Polygon;
|
|
98
|
+
export function parseGeometricLiteral(sql: string, type: 'circle'): Circle;
|
|
99
|
+
export function parseGeometricLiteral(sql: string, type: 'point' | 'line' | 'lseg' | 'box' | 'path' | 'polygon' | 'circle'): GeometricLiteral {
|
|
100
|
+
if (!geometricCompiled) {
|
|
101
|
+
geometricCompiled = Grammar.fromCompiled(geometricGrammar);
|
|
102
|
+
}
|
|
103
|
+
return _parse(sql, geometricCompiled, type);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function _parse(sql: string, grammar: Grammar, entry?: string): any {
|
|
107
|
+
try {
|
|
108
|
+
grammar.start = entry ?? 'main';
|
|
109
|
+
const parser = new Parser(grammar);
|
|
110
|
+
parser.feed(sql);
|
|
111
|
+
const asts = parser.finish();
|
|
112
|
+
if (!asts.length) {
|
|
113
|
+
throw new Error('Unexpected end of input');
|
|
114
|
+
} else if (asts.length !== 1) {
|
|
115
|
+
throw new Error(`💀 Ambiguous SQL syntax: Please file an issue stating the request that has failed at https://github.com/oguimbal/pgsql-ast-parser:
|
|
116
|
+
|
|
117
|
+
${sql}
|
|
118
|
+
|
|
119
|
+
`);
|
|
120
|
+
}
|
|
121
|
+
return asts[0];
|
|
122
|
+
} catch (e) {
|
|
123
|
+
if (typeof (e as any)?.message !== 'string') {
|
|
124
|
+
throw e;
|
|
125
|
+
}
|
|
126
|
+
let msg: string = (e as any).message;
|
|
127
|
+
// remove all the stack crap of nearley parser
|
|
128
|
+
let begin: string | null = null;
|
|
129
|
+
const parts: string[] = [];
|
|
130
|
+
const reg = /A (.+) token based on:/g;
|
|
131
|
+
let m: RegExpExecArray | null;
|
|
132
|
+
while (m = reg.exec(msg)) {
|
|
133
|
+
begin = begin ?? msg.substr(0, m.index);
|
|
134
|
+
parts.push(` - A "${m[1]}" token`);
|
|
135
|
+
}
|
|
136
|
+
if (begin) {
|
|
137
|
+
msg = begin + parts.join('\n') + '\n\n';
|
|
138
|
+
}
|
|
139
|
+
(e as any).message = msg;
|
|
140
|
+
throw e;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// stolen from https://github.com/segmentio/pg-escape/blob/master/index.js
|
|
2
|
+
|
|
3
|
+
export function literal(val: string) {
|
|
4
|
+
if (null == val) return 'NULL';
|
|
5
|
+
if (Array.isArray(val)) {
|
|
6
|
+
var vals: any[] = val.map(literal)
|
|
7
|
+
return "(" + vals.join(", ") + ")"
|
|
8
|
+
}
|
|
9
|
+
var backslash = ~val.indexOf('\\');
|
|
10
|
+
var prefix = backslash ? 'E' : '';
|
|
11
|
+
val = val.replace(/'/g, "''");
|
|
12
|
+
val = val.replace(/\\/g, '\\\\');
|
|
13
|
+
return prefix + "'" + val + "'";
|
|
14
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@lexer lexerAny
|
|
2
|
+
@include "base.ne"
|
|
3
|
+
@include "expr.ne"
|
|
4
|
+
|
|
5
|
+
# https://www.postgresql.org/docs/current/sql-alterindex.html
|
|
6
|
+
|
|
7
|
+
alterindex_statement -> kw_alter kw_index kw_ifexists:? table_ref alterindex_action {% x => track(x, {
|
|
8
|
+
type: 'alter index',
|
|
9
|
+
... x[2] ? {ifExists: true} : {},
|
|
10
|
+
index: unwrap(x[3]),
|
|
11
|
+
change: unwrap(x[4]),
|
|
12
|
+
}) %}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
alterindex_action
|
|
16
|
+
-> alterindex_rename
|
|
17
|
+
| alterindex_set_tablespace
|
|
18
|
+
# todo: other cases
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
alterindex_rename -> kw_rename %kw_to word {% x => track(x, {
|
|
22
|
+
type: 'rename',
|
|
23
|
+
to: asName(last(x)),
|
|
24
|
+
}) %}
|
|
25
|
+
|
|
26
|
+
alterindex_set_tablespace -> kw_set kw_tablespace word {% x => track(x, {
|
|
27
|
+
type: 'set tablespace',
|
|
28
|
+
tablespace: asName(last(x)),
|
|
29
|
+
}) %}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import 'mocha';
|
|
2
|
+
import 'chai';
|
|
3
|
+
import { checkAlterIndex, checkInvalid } from './spec-utils';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
describe('Alter index', () => {
|
|
7
|
+
|
|
8
|
+
checkAlterIndex(['alter index idx rename to newname'], {
|
|
9
|
+
type: 'alter index',
|
|
10
|
+
index: { name: 'idx' },
|
|
11
|
+
change: {
|
|
12
|
+
type: 'rename',
|
|
13
|
+
to: { name: 'newname' },
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
checkAlterIndex(['alter index if exists idx rename to newname'], {
|
|
18
|
+
type: 'alter index',
|
|
19
|
+
index: { name: 'idx' },
|
|
20
|
+
ifExists: true,
|
|
21
|
+
change: {
|
|
22
|
+
type: 'rename',
|
|
23
|
+
to: { name: 'newname' },
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
checkAlterIndex(['alter index idx set tablespace space'], {
|
|
28
|
+
type: 'alter index',
|
|
29
|
+
index: { name: 'idx' },
|
|
30
|
+
change: {
|
|
31
|
+
type: 'set tablespace',
|
|
32
|
+
tablespace: { name: 'space' },
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
@lexer lexerAny
|
|
2
|
+
@include "base.ne"
|
|
3
|
+
@include "expr.ne"
|
|
4
|
+
|
|
5
|
+
# https://www.postgresql.org/docs/12/sql-altertable.html
|
|
6
|
+
|
|
7
|
+
altertable_statement -> kw_alter %kw_table kw_ifexists:? %kw_only:? table_ref
|
|
8
|
+
altertable_actions {% x => track(x, {
|
|
9
|
+
type: 'alter table',
|
|
10
|
+
... x[2] ? {ifExists: true} : {},
|
|
11
|
+
... x[3] ? {only: true} : {},
|
|
12
|
+
table: unwrap(x[4]),
|
|
13
|
+
changes: unbox(x[5]).map(unwrap),
|
|
14
|
+
}) %}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
altertable_actions -> altertable_action (comma altertable_action {% last %}):* {% ([head, tail]) => {
|
|
18
|
+
return [head, ...(tail || [])];
|
|
19
|
+
} %}
|
|
20
|
+
|
|
21
|
+
altertable_action
|
|
22
|
+
-> altertable_rename_table
|
|
23
|
+
| altertable_rename_column
|
|
24
|
+
| altertable_rename_constraint
|
|
25
|
+
| altertable_add_column
|
|
26
|
+
| altertable_drop_column
|
|
27
|
+
| altertable_alter_column
|
|
28
|
+
| altertable_add_constraint
|
|
29
|
+
| altertable_drop_constraint
|
|
30
|
+
| altertable_owner
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
altertable_rename_table -> kw_rename %kw_to word {% x => track(x, {
|
|
34
|
+
type: 'rename',
|
|
35
|
+
to: asName(last(x)),
|
|
36
|
+
}) %}
|
|
37
|
+
|
|
38
|
+
altertable_rename_column -> kw_rename kw_column:? ident %kw_to ident {% x => track(x, {
|
|
39
|
+
type: 'rename column',
|
|
40
|
+
column: asName(x[2]),
|
|
41
|
+
to: asName(last(x)),
|
|
42
|
+
}) %}
|
|
43
|
+
|
|
44
|
+
altertable_rename_constraint -> kw_rename %kw_constraint ident %kw_to ident {% x => track(x, {
|
|
45
|
+
type: 'rename constraint',
|
|
46
|
+
constraint: asName(x[2]),
|
|
47
|
+
to: asName(last(x)),
|
|
48
|
+
}) %}
|
|
49
|
+
|
|
50
|
+
altertable_add_column -> kw_add kw_column:? kw_ifnotexists:? createtable_column {% x => track(x, {
|
|
51
|
+
type: 'add column',
|
|
52
|
+
... x[2] ? {ifNotExists: true} : {},
|
|
53
|
+
column: unwrap(x[3]),
|
|
54
|
+
}) %}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
altertable_drop_column -> kw_drop kw_column:? kw_ifexists:? ident (kw_restrict | kw_cascade):? {% x => track(x, {
|
|
58
|
+
type: 'drop column',
|
|
59
|
+
... x[2] ? {ifExists: true} : {},
|
|
60
|
+
column: asName(x[3]),
|
|
61
|
+
... x[4] ? {behaviour: toStr(x[4], ' ')} : {},
|
|
62
|
+
}) %}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
altertable_alter_column
|
|
66
|
+
-> kw_alter kw_column:? ident altercol {% x => track(x, {
|
|
67
|
+
type: 'alter column',
|
|
68
|
+
column: asName(x[2]),
|
|
69
|
+
alter: unwrap(x[3])
|
|
70
|
+
}) %}
|
|
71
|
+
|
|
72
|
+
altercol
|
|
73
|
+
-> (kw_set kw_data):? kw_type data_type {% x => track(x, { type: 'set type', dataType: unwrap(last(x)) }) %}
|
|
74
|
+
| kw_set %kw_default expr {% x => track(x, {type: 'set default', default: unwrap(last(x)) }) %}
|
|
75
|
+
| kw_drop %kw_default {% x => track(x, {type: 'drop default' }) %}
|
|
76
|
+
| (kw_set | kw_drop) kw_not_null {% x => track(x, {type: toStr(x, ' ') }) %}
|
|
77
|
+
| altercol_generated_add {% unwrap %}
|
|
78
|
+
|
|
79
|
+
altertable_add_constraint
|
|
80
|
+
-> kw_add createtable_constraint {% x => track(x, {
|
|
81
|
+
type: 'add constraint',
|
|
82
|
+
constraint: unwrap(last(x)),
|
|
83
|
+
}) %}
|
|
84
|
+
|
|
85
|
+
altertable_drop_constraint -> kw_drop %kw_constraint kw_ifexists:? ident (kw_restrict | kw_cascade):? {% x => track(x, {
|
|
86
|
+
type: 'drop constraint',
|
|
87
|
+
... x[2] ? {ifExists: true} : {},
|
|
88
|
+
constraint: asName(x[3]),
|
|
89
|
+
... x[4] ? {behaviour: toStr(x[4], ' ')} : {},
|
|
90
|
+
}) %}
|
|
91
|
+
|
|
92
|
+
altertable_owner
|
|
93
|
+
-> kw_owner %kw_to ident {% x => track(x, {
|
|
94
|
+
type:'owner',
|
|
95
|
+
to: asName(last(x)),
|
|
96
|
+
}) %}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
altercol_generated_add -> kw_add altercol_generated {% last %}
|
|
100
|
+
altercol_generated
|
|
101
|
+
-> kw_generated
|
|
102
|
+
(kw_always | kw_by %kw_default):?
|
|
103
|
+
(%kw_as kw_identity):?
|
|
104
|
+
(%kw_as lparen expr rparen {% get(2) %}):?
|
|
105
|
+
(lparen altercol_generated_seq rparen {% get(1) %}):?
|
|
106
|
+
(kw_stored):?
|
|
107
|
+
{% x => track(x, {
|
|
108
|
+
type: 'add generated',
|
|
109
|
+
...x[1] && { always: toStr(x[1], ' ') },
|
|
110
|
+
...x[3] && { expression: unwrap(x[3]) },
|
|
111
|
+
...x[4] && { sequence: unwrap(x[4]) },
|
|
112
|
+
...x[5] && { stored: true },
|
|
113
|
+
}) %}
|
|
114
|
+
|
|
115
|
+
altercol_generated_seq
|
|
116
|
+
-> (kw_sequence kw_name qualified_name):?
|
|
117
|
+
create_sequence_option:* {% x => {
|
|
118
|
+
const ret: any = {
|
|
119
|
+
...x[0] && { name: unwrap(last(x[0])) },
|
|
120
|
+
};
|
|
121
|
+
setSeqOpts(ret, x[1]);
|
|
122
|
+
return track(x, ret);
|
|
123
|
+
}%}
|