@cchistory/lite 0.4.5 → 0.6.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 +7 -5
- package/apps/lite-cli/dist/agent-contract.d.ts.map +1 -1
- package/apps/lite-cli/dist/agent-contract.js +36 -25
- package/apps/lite-cli/dist/agent-contract.js.map +1 -1
- package/apps/lite-cli/dist/bin.js +2 -2
- 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 +151 -66
- package/apps/lite-cli/dist/index.js.map +1 -1
- package/apps/lite-cli/dist/index.test.js +59 -89
- 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 +2 -2
- 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 +6 -2
- package/apps/lite-tui/dist/index.js.map +1 -1
- package/apps/lite-tui/dist/index.test.js +10 -8
- 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 +2 -2
- package/bin/cchistory-lite.mjs +2 -2
- package/docs/guide/for-agents.md +66 -46
- package/docs/guide/lite.md +53 -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 +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.js +1 -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 +314 -143
- 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/launcher-memory.d.ts +12 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.js +44 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.js +20 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.js +92 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.js.map +1 -0
- 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 +22 -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 -47
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js +287 -83
- 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 +171 -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 +81 -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/jsonl-records.test.js +31 -1
- package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts +4 -3
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js +32 -13
- 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 +46 -45
- 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 +76 -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 +126 -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,101 @@
|
|
|
1
|
+
@lexer lexerAny
|
|
2
|
+
@include "base.ne"
|
|
3
|
+
@include "expr.ne"
|
|
4
|
+
|
|
5
|
+
@{%
|
|
6
|
+
function setSeqOpts(ret: any, opts: any) {
|
|
7
|
+
const defs = new Set();
|
|
8
|
+
const unboxed = opts.map(unbox);
|
|
9
|
+
for (const [k, v] of unboxed) {
|
|
10
|
+
if (defs.has(k)) {
|
|
11
|
+
throw new Error('conflicting or redundant options');
|
|
12
|
+
}
|
|
13
|
+
defs.add(k);
|
|
14
|
+
ret[k] = unbox(v);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
%}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# =========== CREATE SEQUENCE ===============
|
|
21
|
+
|
|
22
|
+
# https://www.postgresql.org/docs/12/sql-createsequence.html
|
|
23
|
+
|
|
24
|
+
create_sequence_statement
|
|
25
|
+
-> %kw_create
|
|
26
|
+
(kw_temp | kw_temporary):?
|
|
27
|
+
kw_sequence
|
|
28
|
+
kw_ifnotexists:?
|
|
29
|
+
qualified_name
|
|
30
|
+
create_sequence_option:* {% x => {
|
|
31
|
+
const ret: any = {
|
|
32
|
+
type: 'create sequence',
|
|
33
|
+
...x[1] && { temp: true },
|
|
34
|
+
...x[3] && { ifNotExists: true },
|
|
35
|
+
name: unwrap(x[4]),
|
|
36
|
+
options: {},
|
|
37
|
+
};
|
|
38
|
+
setSeqOpts(ret.options, x[5]);
|
|
39
|
+
return track(x, ret);
|
|
40
|
+
}%}
|
|
41
|
+
|
|
42
|
+
create_sequence_option
|
|
43
|
+
-> %kw_as data_type {% x => box(x, ['as', x[1]]) %}
|
|
44
|
+
| kw_increment kw_by:? int {% x => box(x, ['incrementBy', x[2]]) %}
|
|
45
|
+
| create_sequence_minvalue {% x => box(x, ['minValue', x[0]]) %}
|
|
46
|
+
| create_sequence_maxvalue {% x => box(x, ['maxValue', x[0]]) %}
|
|
47
|
+
| kw_start %kw_with:? int {% x => box(x, ['startWith', x[2]]) %}
|
|
48
|
+
| kw_cache int {% x => box(x, ['cache', x[1]]) %}
|
|
49
|
+
| kw_no:? kw_cycle {% x => box(x, ['cycle', toStr(x, ' ')]) %}
|
|
50
|
+
| create_sequence_owned_by {% x => box(x, ['ownedBy', unwrap(x)]) %}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
create_sequence_minvalue
|
|
54
|
+
-> kw_minvalue int {% last %}
|
|
55
|
+
| kw_no kw_minvalue {% x => box(x, 'no minvalue') %}
|
|
56
|
+
|
|
57
|
+
create_sequence_maxvalue
|
|
58
|
+
-> kw_maxvalue int {% last %}
|
|
59
|
+
| kw_no kw_maxvalue {% x => box(x, 'no maxvalue') %}
|
|
60
|
+
|
|
61
|
+
create_sequence_owned_by
|
|
62
|
+
-> kw_owned kw_by (
|
|
63
|
+
kw_none
|
|
64
|
+
| qcolumn
|
|
65
|
+
) {% x => box(x, unwrap(last(x))) %}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# =========== ALTER SEQUENCE ===============
|
|
69
|
+
|
|
70
|
+
# https://www.postgresql.org/docs/12/sql-altersequence.html
|
|
71
|
+
|
|
72
|
+
alter_sequence_statement
|
|
73
|
+
-> kw_alter
|
|
74
|
+
kw_sequence
|
|
75
|
+
kw_ifexists:?
|
|
76
|
+
qualified_name
|
|
77
|
+
alter_sequence_statement_body {% x => {
|
|
78
|
+
const ret: any = {
|
|
79
|
+
type: 'alter sequence',
|
|
80
|
+
...x[2] && { ifExists: true },
|
|
81
|
+
name: unwrap(x[3]),
|
|
82
|
+
change: x[4],
|
|
83
|
+
};
|
|
84
|
+
return track(x, ret);
|
|
85
|
+
}%}
|
|
86
|
+
|
|
87
|
+
alter_sequence_statement_body
|
|
88
|
+
-> alter_sequence_option:+ {% x => {
|
|
89
|
+
const ret: any = {
|
|
90
|
+
type: 'set options',
|
|
91
|
+
};
|
|
92
|
+
setSeqOpts(ret, x[0]);
|
|
93
|
+
return track(x, ret);
|
|
94
|
+
}%}
|
|
95
|
+
| kw_owner %kw_to (ident | %kw_session_user | %kw_current_user) {% x => track(x, { type: 'owner to', owner: asName(last(x)), }) %}
|
|
96
|
+
| kw_rename %kw_to ident {% x => track(x, { type: 'rename', newName: asName(last(x)) }) %}
|
|
97
|
+
| kw_set kw_schema ident {% x => track(x, { type: 'set schema', newSchema: asName(last(x)) }) %}
|
|
98
|
+
|
|
99
|
+
alter_sequence_option
|
|
100
|
+
-> create_sequence_option {% unwrap %}
|
|
101
|
+
| kw_restart (%kw_with:? int {% last %}):? {% x => box(x, ['restart', typeof unbox(x[1]) === 'number' ? unbox(x[1]) : true]) %}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import 'mocha';
|
|
2
|
+
import 'chai';
|
|
3
|
+
import { checkCreateSequence, checkInvalidExpr, checkAlterSequence } from './spec-utils';
|
|
4
|
+
import { parse } from '../parser';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe('Sequence', () => {
|
|
8
|
+
|
|
9
|
+
checkCreateSequence(`CREATE SEQUENCE if not exists public.myseq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 as bigint cycle`, {
|
|
10
|
+
type: 'create sequence',
|
|
11
|
+
name: { name: 'myseq', schema: 'public', },
|
|
12
|
+
ifNotExists: true,
|
|
13
|
+
options: {
|
|
14
|
+
startWith: 1,
|
|
15
|
+
incrementBy: 1,
|
|
16
|
+
minValue: 'no minvalue',
|
|
17
|
+
maxValue: 'no maxvalue',
|
|
18
|
+
cache: 1,
|
|
19
|
+
as: { name: 'bigint' },
|
|
20
|
+
cycle: 'cycle',
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
checkCreateSequence(`CREATE temp SEQUENCE myseq owned by tbl.col`, {
|
|
26
|
+
type: 'create sequence',
|
|
27
|
+
name: { name: 'myseq', },
|
|
28
|
+
temp: true,
|
|
29
|
+
options: {
|
|
30
|
+
ownedBy: {
|
|
31
|
+
table: 'tbl',
|
|
32
|
+
column: 'col',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
checkCreateSequence(`CREATE SEQUENCE myseq NO CYCLE`, {
|
|
39
|
+
type: 'create sequence',
|
|
40
|
+
name: { name: 'myseq', },
|
|
41
|
+
options: {
|
|
42
|
+
cycle: 'no cycle',
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
checkCreateSequence(`CREATE SEQUENCE myseq cycle`, {
|
|
47
|
+
type: 'create sequence',
|
|
48
|
+
name: { name: 'myseq', },
|
|
49
|
+
options: {
|
|
50
|
+
cycle: 'cycle',
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
checkCreateSequence(`CREATE SEQUENCE myseq owned by none`, {
|
|
55
|
+
type: 'create sequence',
|
|
56
|
+
name: { name: 'myseq', },
|
|
57
|
+
options: {
|
|
58
|
+
ownedBy: 'none',
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
checkAlterSequence(`ALTER SEQUENCE myseq owned by none`, {
|
|
64
|
+
type: 'alter sequence',
|
|
65
|
+
name: { name: 'myseq', },
|
|
66
|
+
change: {
|
|
67
|
+
type: 'set options',
|
|
68
|
+
ownedBy: 'none',
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
checkAlterSequence(`ALTER SEQUENCE if exists myseq RESTART`, {
|
|
73
|
+
type: 'alter sequence',
|
|
74
|
+
name: { name: 'myseq', },
|
|
75
|
+
ifExists: true,
|
|
76
|
+
change: {
|
|
77
|
+
type: 'set options',
|
|
78
|
+
restart: true,
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
checkAlterSequence(`ALTER SEQUENCE myseq RESTART WITH 5`, {
|
|
83
|
+
type: 'alter sequence',
|
|
84
|
+
name: { name: 'myseq', },
|
|
85
|
+
change: {
|
|
86
|
+
type: 'set options',
|
|
87
|
+
restart: 5,
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
checkAlterSequence(`ALTER SEQUENCE public.seq OWNED BY public.tbl.col`, {
|
|
92
|
+
type: 'alter sequence',
|
|
93
|
+
name: { name: 'seq', schema: 'public', },
|
|
94
|
+
change: {
|
|
95
|
+
type: 'set options',
|
|
96
|
+
ownedBy: {
|
|
97
|
+
column: 'col',
|
|
98
|
+
table: 'tbl',
|
|
99
|
+
schema: 'public',
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
|
|
2
|
+
@lexer lexerAny
|
|
3
|
+
@include "base.ne"
|
|
4
|
+
@include "expr.ne"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
simplestatements_all
|
|
8
|
+
-> simplestatements_start_transaction
|
|
9
|
+
| simplestatements_commit
|
|
10
|
+
| simplestatements_rollback
|
|
11
|
+
| simplestatements_tablespace
|
|
12
|
+
| simplestatements_set
|
|
13
|
+
| simplestatements_show
|
|
14
|
+
| simplestatements_begin
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
array_of[EXP] -> $EXP (%comma $EXP {% last %}):* {% ([head, tail]) => {
|
|
18
|
+
return [unwrap(head), ...(tail.map(unwrap) || [])];
|
|
19
|
+
} %}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# https://www.postgresql.org/docs/12/sql-start-transaction.html
|
|
23
|
+
simplestatements_start_transaction -> (kw_start kw_transaction) {% x => track(x, { type: 'start transaction' }) %}
|
|
24
|
+
|
|
25
|
+
# https://www.postgresql.org/docs/12/sql-commit.html
|
|
26
|
+
simplestatements_commit -> kw_commit {% x => track(x, { type: 'commit' }) %}
|
|
27
|
+
|
|
28
|
+
# https://www.postgresql.org/docs/12/sql-rollback.html
|
|
29
|
+
simplestatements_rollback -> kw_rollback {% x => track(x, { type: 'rollback' }) %}
|
|
30
|
+
|
|
31
|
+
simplestatements_tablespace -> kw_tablespace word {% x => track(x, {
|
|
32
|
+
type: 'tablespace',
|
|
33
|
+
tablespace: asName(x[1]),
|
|
34
|
+
}) %}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
simplestatements_set -> kw_set (simplestatements_set_simple | simplestatements_set_timezone | simplestatements_set_names) {% last %}
|
|
38
|
+
|
|
39
|
+
simplestatements_set_timezone -> kw_time kw_zone simplestatements_set_timezone_val {% x => track(x, { type: 'set timezone', to: x[2] }) %}
|
|
40
|
+
|
|
41
|
+
simplestatements_set_timezone_val
|
|
42
|
+
-> (string | int) {% x => track(x, { type: 'value', value: unwrap(x[0]) }) %}
|
|
43
|
+
| kw_local {% x => track(x, { type: 'local'}) %}
|
|
44
|
+
| %kw_default {% x => track(x, { type: 'default'}) %}
|
|
45
|
+
| kw_interval string kw_hour %kw_to kw_minute {% x => track(x, { type: 'interval', value: unbox(x[1]) }) %}
|
|
46
|
+
|
|
47
|
+
simplestatements_set_names -> kw_names simplestatements_set_names_val {% x => track(x, { type: 'set names', to: x[1] }) %}
|
|
48
|
+
|
|
49
|
+
simplestatements_set_names_val
|
|
50
|
+
-> (string) {% x => track(x, { type: 'value', value: unwrap(x[0]) }) %}
|
|
51
|
+
|
|
52
|
+
simplestatements_set_simple -> (kw_local | kw_session):? ident (%op_eq | %kw_to) simplestatements_set_val {% x => track(x, {
|
|
53
|
+
type: 'set',
|
|
54
|
+
variable: asName(x[1]),
|
|
55
|
+
scope: unwrap(x[0])?.toLowerCase(),
|
|
56
|
+
set: unbox(x[3]),
|
|
57
|
+
}) %}
|
|
58
|
+
|
|
59
|
+
simplestatements_set_val
|
|
60
|
+
-> simplestatements_set_val_raw {% unwrap %}
|
|
61
|
+
| %kw_default {% x => track(x, {type: 'default'}) %}
|
|
62
|
+
| simplestatements_set_val_raw (comma simplestatements_set_val_raw):+ {% x => track(x, {
|
|
63
|
+
type: 'list',
|
|
64
|
+
values: [x[0], ...(x[1] || [])]
|
|
65
|
+
}) %}
|
|
66
|
+
|
|
67
|
+
simplestatements_set_val_raw
|
|
68
|
+
-> (string | int) {% x => track(x, { type: 'value', value: unwrap(x) }) %}
|
|
69
|
+
| (%word | %kw_on | %kw_true | %kw_false) {% x => track(x, { type: 'identifier', name: unwrap(x).value }) %}
|
|
70
|
+
| %quoted_word {% x => track(x, { type: 'identifier', doubleQuoted: true, name: unwrap(x).value }) %}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
simplestatements_show -> kw_show ident {% x => track(x, { type: 'show', variable: asName(x[1]) }) %}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# https://www.postgresql.org/docs/current/sql-createschema.html
|
|
77
|
+
create_schema -> (%kw_create kw_schema) kw_ifnotexists:? ident {% x => track(x, {
|
|
78
|
+
type: 'create schema',
|
|
79
|
+
name: asName(x[2]),
|
|
80
|
+
... !!x[1] ? { ifNotExists: true } : {},
|
|
81
|
+
}) %}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# https://www.postgresql.org/docs/13/plpgsql-errors-and-messages.html
|
|
85
|
+
raise_statement -> kw_raise
|
|
86
|
+
(%word {% anyKw('debug', 'log', 'info', 'notice', 'warning', 'exception') %}):?
|
|
87
|
+
string
|
|
88
|
+
(comma expr_list_raw {% last %}):?
|
|
89
|
+
raise_using:? {% x => track(x, {
|
|
90
|
+
type: 'raise',
|
|
91
|
+
format: toStr(x[2]),
|
|
92
|
+
...x[1] && { level: toStr(x[1]) },
|
|
93
|
+
...x[3] && x[3].length && { formatExprs: x[3] },
|
|
94
|
+
...x[4] && x[4].length && { using: x[4] },
|
|
95
|
+
}) %}
|
|
96
|
+
|
|
97
|
+
raise_using -> %kw_using array_of[raise_using_one] {% last %}
|
|
98
|
+
|
|
99
|
+
raise_using_one -> raise_using_what %op_eq expr {% x => track(x, {
|
|
100
|
+
type: toStr(x[0]),
|
|
101
|
+
value: x[2],
|
|
102
|
+
}) %}
|
|
103
|
+
|
|
104
|
+
raise_using_what -> %kw_table
|
|
105
|
+
| %word {% anyKw('message',
|
|
106
|
+
'detail',
|
|
107
|
+
'hint',
|
|
108
|
+
'errcode',
|
|
109
|
+
'column',
|
|
110
|
+
'constraint',
|
|
111
|
+
'datatype',
|
|
112
|
+
'schema') %}
|
|
113
|
+
|
|
114
|
+
# https://www.postgresql.org/docs/13/sql-comment.html
|
|
115
|
+
comment_statement -> kw_comment %kw_on comment_what %kw_is string {% x => track(x, {
|
|
116
|
+
type: 'comment',
|
|
117
|
+
comment: unbox(last(x)),
|
|
118
|
+
on: unwrap(x[2]),
|
|
119
|
+
}) %}
|
|
120
|
+
|
|
121
|
+
comment_what -> comment_what_col | comment_what_nm
|
|
122
|
+
|
|
123
|
+
comment_what_nm -> (%kw_table
|
|
124
|
+
| kw_materialized kw_view
|
|
125
|
+
| %word {% anyKw('database', 'index', 'trigger', 'type', 'view') %})
|
|
126
|
+
qualified_name {% x => track(x, {
|
|
127
|
+
type: toStr(x[0]),
|
|
128
|
+
name: x[1],
|
|
129
|
+
}) %}
|
|
130
|
+
|
|
131
|
+
comment_what_col -> kw_column qcolumn {% x => track(x, {
|
|
132
|
+
type: 'column',
|
|
133
|
+
column: last(x),
|
|
134
|
+
}) %}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
# https://www.postgresql.org/docs/current/sql-begin.html
|
|
138
|
+
simplestatements_begin -> kw_begin
|
|
139
|
+
(kw_transaction | kw_work):?
|
|
140
|
+
(simplestatements_begin_isol | simplestatements_begin_writ | simplestatements_begin_def):* {%
|
|
141
|
+
x => track(x, {
|
|
142
|
+
type: 'begin',
|
|
143
|
+
...x[2].reduce((a: any, b: any) => ({...unwrap(a), ...unwrap(b)}), {}),
|
|
144
|
+
})
|
|
145
|
+
%}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
simplestatements_begin_isol -> (kw_isolation kw_level)
|
|
149
|
+
( kw_serializable
|
|
150
|
+
| (word {% kw('repeatable') %}) kw_read
|
|
151
|
+
| kw_read (word {% kw('committed') %})
|
|
152
|
+
| kw_read (word {% kw('uncommitted') %})
|
|
153
|
+
)
|
|
154
|
+
{% x => track(x, {
|
|
155
|
+
isolationLevel: toStr(x[1], ' '),
|
|
156
|
+
}) %}
|
|
157
|
+
|
|
158
|
+
simplestatements_begin_writ
|
|
159
|
+
-> (kw_read kw_write | kw_read %kw_only)
|
|
160
|
+
{% x => track(x, {
|
|
161
|
+
writeable: toStr(x, ' '),
|
|
162
|
+
}) %}
|
|
163
|
+
|
|
164
|
+
simplestatements_begin_def
|
|
165
|
+
-> %kw_not:? %kw_deferrable
|
|
166
|
+
{% x => track(x, {
|
|
167
|
+
deferrable: !x[0]
|
|
168
|
+
}) %}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import 'mocha';
|
|
2
|
+
import 'chai';
|
|
3
|
+
import { binary, checkStatement, int, name, ref, tbl } from './spec-utils';
|
|
4
|
+
import { parseWithComments } from '../parser';
|
|
5
|
+
import { assert, expect } from 'chai';
|
|
6
|
+
|
|
7
|
+
describe('Simple statements', () => {
|
|
8
|
+
|
|
9
|
+
checkStatement(['start transaction'], {
|
|
10
|
+
type: 'start transaction',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
checkStatement(['commit'], {
|
|
14
|
+
type: 'commit',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
checkStatement(['rollback'], {
|
|
18
|
+
type: 'rollback',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
checkStatement(['show server_version', 'show SERVER_VERSION'], {
|
|
23
|
+
type: 'show',
|
|
24
|
+
variable: { name: 'server_version' },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
checkStatement(['tablespace abc'], {
|
|
30
|
+
type: 'tablespace',
|
|
31
|
+
tablespace: { name: 'abc' },
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
checkStatement(`SET statement_timeout = 0`, {
|
|
35
|
+
type: 'set',
|
|
36
|
+
variable: { name: 'statement_timeout' },
|
|
37
|
+
set: {
|
|
38
|
+
type: 'value',
|
|
39
|
+
value: 0,
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
checkStatement(`SET client_min_messages = warning`, {
|
|
44
|
+
type: 'set',
|
|
45
|
+
variable: { name: 'client_min_messages' },
|
|
46
|
+
set: {
|
|
47
|
+
type: 'identifier',
|
|
48
|
+
name: 'warning',
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
checkStatement(`SET standard_conforming_strings = on`, {
|
|
53
|
+
type: 'set',
|
|
54
|
+
variable: { name: 'standard_conforming_strings' },
|
|
55
|
+
set: {
|
|
56
|
+
type: 'identifier',
|
|
57
|
+
name: 'on',
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
checkStatement(`SET client_min_messages TO warning`, {
|
|
62
|
+
type: 'set',
|
|
63
|
+
variable: { name: 'client_min_messages' },
|
|
64
|
+
set: {
|
|
65
|
+
type: 'identifier',
|
|
66
|
+
name: 'warning',
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
checkStatement(`SET LOCAL lock_timeout = '50ms'`, {
|
|
71
|
+
type: 'set',
|
|
72
|
+
variable: { name: 'lock_timeout' },
|
|
73
|
+
scope: 'local',
|
|
74
|
+
set: {
|
|
75
|
+
type: 'value',
|
|
76
|
+
value: '50ms',
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
checkStatement(`SET SESSION lock_timeout = '50ms'`, {
|
|
81
|
+
type: 'set',
|
|
82
|
+
variable: { name: 'lock_timeout' },
|
|
83
|
+
scope: 'session',
|
|
84
|
+
set: {
|
|
85
|
+
type: 'value',
|
|
86
|
+
value: '50ms',
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
checkStatement(`SET TIME ZONE INTERVAL '+00:00' HOUR TO MINUTE`, {
|
|
91
|
+
type: 'set timezone',
|
|
92
|
+
to: {
|
|
93
|
+
type: 'interval',
|
|
94
|
+
value: '+00:00',
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
checkStatement(`SET TIME ZONE LOCAL`, {
|
|
99
|
+
type: 'set timezone',
|
|
100
|
+
to: {
|
|
101
|
+
type: 'local',
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
checkStatement(`SET TIME ZONE DEFAULT`, {
|
|
107
|
+
type: 'set timezone',
|
|
108
|
+
to: {
|
|
109
|
+
type: 'default',
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
checkStatement(`SET TIME ZONE '+8'`, {
|
|
114
|
+
type: 'set timezone',
|
|
115
|
+
to: {
|
|
116
|
+
type: 'value',
|
|
117
|
+
value: '+8',
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
checkStatement(`SET TIME ZONE -9`, {
|
|
122
|
+
type: 'set timezone',
|
|
123
|
+
to: {
|
|
124
|
+
type: 'value',
|
|
125
|
+
value: -9,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
checkStatement(`SET NAMES 'utf8'`, {
|
|
130
|
+
type: 'set names',
|
|
131
|
+
to: {
|
|
132
|
+
type: 'value',
|
|
133
|
+
value: 'utf8',
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
checkStatement(['create schema test'], {
|
|
138
|
+
type: 'create schema',
|
|
139
|
+
name: { name: 'test' },
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
checkStatement(['create schema if not exists test'], {
|
|
143
|
+
type: 'create schema',
|
|
144
|
+
name: { name: 'test' },
|
|
145
|
+
ifNotExists: true,
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
checkStatement(`RAISE 'message'`, {
|
|
149
|
+
type: 'raise',
|
|
150
|
+
format: 'message',
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
checkStatement(`RAISE NOTICE 'message'`, {
|
|
154
|
+
type: 'raise',
|
|
155
|
+
level: 'notice',
|
|
156
|
+
format: 'message',
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
checkStatement(`RAISE NOTICE 'message', 42`, {
|
|
160
|
+
type: 'raise',
|
|
161
|
+
level: 'notice',
|
|
162
|
+
format: 'message',
|
|
163
|
+
formatExprs: [{ type: 'integer', value: 42 }],
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
checkStatement(`RAISE NOTICE 'message', 2+2, 42`, {
|
|
167
|
+
type: 'raise',
|
|
168
|
+
level: 'notice',
|
|
169
|
+
format: 'message',
|
|
170
|
+
formatExprs: [{
|
|
171
|
+
type: 'binary',
|
|
172
|
+
op: '+',
|
|
173
|
+
left: { type: 'integer', value: 2 },
|
|
174
|
+
right: { type: 'integer', value: 2 },
|
|
175
|
+
}, { type: 'integer', value: 42 }],
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
checkStatement(`RAISE NOTICE 'message' USING hint='some hint'`, {
|
|
179
|
+
type: 'raise',
|
|
180
|
+
level: 'notice',
|
|
181
|
+
format: 'message',
|
|
182
|
+
using: [{
|
|
183
|
+
type: 'hint',
|
|
184
|
+
value: { type: 'string', value: 'some hint' },
|
|
185
|
+
}]
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
checkStatement(`RAISE WARNING 'message', 42 USING hint='some hint', message='some message'`, {
|
|
190
|
+
type: 'raise',
|
|
191
|
+
level: 'warning',
|
|
192
|
+
format: 'message',
|
|
193
|
+
formatExprs: [{ type: 'integer', value: 42 }],
|
|
194
|
+
using: [
|
|
195
|
+
{ type: 'hint', value: { type: 'string', value: 'some hint' }, },
|
|
196
|
+
{ type: 'message', value: { type: 'string', value: 'some message' }, },
|
|
197
|
+
],
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
checkStatement(`COMMENT ON TABLE groups is 'some text'`, {
|
|
201
|
+
type: 'comment',
|
|
202
|
+
comment: 'some text',
|
|
203
|
+
on: {
|
|
204
|
+
type: 'table',
|
|
205
|
+
name: { name: 'groups' }
|
|
206
|
+
}
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
checkStatement(`COMMENT ON TABLE public.groups is 'some text'`, {
|
|
210
|
+
type: 'comment',
|
|
211
|
+
comment: 'some text',
|
|
212
|
+
on: {
|
|
213
|
+
type: 'table',
|
|
214
|
+
name: { schema: 'public', name: 'groups', }
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
checkStatement(`COMMENT ON COLUMN groups.members is 'some text'`, {
|
|
219
|
+
type: 'comment',
|
|
220
|
+
comment: 'some text',
|
|
221
|
+
on: {
|
|
222
|
+
type: 'column',
|
|
223
|
+
column: { table: 'groups', column: 'members', }
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
checkStatement(`COMMENT ON COLUMN public.groups.members is 'some text'`, {
|
|
228
|
+
type: 'comment',
|
|
229
|
+
comment: 'some text',
|
|
230
|
+
on: {
|
|
231
|
+
type: 'column',
|
|
232
|
+
column: { schema: 'public', table: 'groups', column: 'members', }
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
it('can fetch comments', () => {
|
|
239
|
+
const { ast, comments } = parseWithComments('select /* comment a */ * from /* comment b */ tbl');
|
|
240
|
+
assert.deepEqual(ast, [{
|
|
241
|
+
type: 'select',
|
|
242
|
+
columns: [{ expr: { type: 'ref', name: '*' } }],
|
|
243
|
+
from: [tbl('tbl')],
|
|
244
|
+
}]);
|
|
245
|
+
assert.deepEqual(comments.map(c => c.comment), ['/* comment a */ ', '/* comment b */ '])
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// https://www.postgresql.org/docs/13/sql-syntax-lexical.html#SQL-SYNTAX-COMMENTS
|
|
249
|
+
it('can fetch nested comments', () => {
|
|
250
|
+
const { ast, comments } = parseWithComments('select /* comment /* nest */ a */ * from /* comment /* nest1 /* nest2 */ */ b */ tbl');
|
|
251
|
+
assert.deepEqual(ast, [{
|
|
252
|
+
type: 'select',
|
|
253
|
+
columns: [{ expr: { type: 'ref', name: '*' } }],
|
|
254
|
+
from: [tbl('tbl')],
|
|
255
|
+
}]);
|
|
256
|
+
assert.deepEqual(comments.map(c => c.comment), ['/* comment /* nest */ a */ ', '/* comment /* nest1 /* nest2 */ */ b */ '])
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
checkStatement(`begin isolation level read uncommitted isolation level read committed read write`, {
|
|
261
|
+
type: 'begin',
|
|
262
|
+
isolationLevel: 'read committed',
|
|
263
|
+
writeable: 'read write',
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
checkStatement(`begin deferrable`, {
|
|
267
|
+
type: 'begin',
|
|
268
|
+
deferrable: true,
|
|
269
|
+
})
|
|
270
|
+
|
|
271
|
+
checkStatement(`begin not deferrable`, {
|
|
272
|
+
type: 'begin',
|
|
273
|
+
deferrable: false,
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
checkStatement(`select * from (select a from mytable) myalias(col_renamed)`, {
|
|
278
|
+
type: 'select',
|
|
279
|
+
columns: [{ expr: { type: 'ref', name: '*' } }],
|
|
280
|
+
from: [{
|
|
281
|
+
type: 'statement',
|
|
282
|
+
statement: {
|
|
283
|
+
type: 'select',
|
|
284
|
+
columns: [{ expr: ref('a') }],
|
|
285
|
+
from: [tbl('mytable')],
|
|
286
|
+
},
|
|
287
|
+
alias: 'myalias',
|
|
288
|
+
columnNames: [name('col_renamed')],
|
|
289
|
+
}]
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
checkStatement(`select * from mytable "myAlias"(a)`, {
|
|
293
|
+
type: 'select',
|
|
294
|
+
columns: [{ expr: { type: 'ref', name: '*' } }],
|
|
295
|
+
from: [{
|
|
296
|
+
type: 'table',
|
|
297
|
+
name: {
|
|
298
|
+
name: 'mytable',
|
|
299
|
+
alias: 'myAlias',
|
|
300
|
+
columnNames: [name('a')],
|
|
301
|
+
},
|
|
302
|
+
}]
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
checkStatement(`select * from (select a,b from mytable) "myAlias"(x,y)`, {
|
|
306
|
+
type: 'select',
|
|
307
|
+
columns: [{ expr: { type: 'ref', name: '*' } }],
|
|
308
|
+
from: [{
|
|
309
|
+
type: 'statement',
|
|
310
|
+
statement: {
|
|
311
|
+
type: 'select',
|
|
312
|
+
columns: [{ expr: ref('a') }, { expr: ref('b') }],
|
|
313
|
+
from: [tbl('mytable')],
|
|
314
|
+
},
|
|
315
|
+
alias: 'myAlias',
|
|
316
|
+
columnNames: [name('x'), name('y')],
|
|
317
|
+
}]
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
// bugfix (Cannot select column named column) https://github.com/oguimbal/pgsql-ast-parser/issues/67
|
|
322
|
+
checkStatement(`SELECT something AS column FROM whatever`, {
|
|
323
|
+
type: 'select',
|
|
324
|
+
columns: [{ expr: ref('something'), alias: { name: 'column' } }],
|
|
325
|
+
from: [tbl('whatever')],
|
|
326
|
+
});
|
|
327
|
+
});
|