@pdpp/cli 0.15.0 → 0.15.2
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/package.json +1 -1
- package/src/read/commands.js +26 -1
package/package.json
CHANGED
package/src/read/commands.js
CHANGED
|
@@ -3,7 +3,7 @@ import { parseArgs, requirePositional } from '../ref/args.js';
|
|
|
3
3
|
import { PdppHttpError, PdppUsageError } from '../ref/errors.js';
|
|
4
4
|
import { resolveFormat, writeData, writeEnvelopeWarnings } from '../ref/output.js';
|
|
5
5
|
|
|
6
|
-
const COMMANDS = new Set(['schema', 'streams', 'query-records', 'fetch', 'search', 'aggregate']);
|
|
6
|
+
const COMMANDS = new Set(['schema', 'streams', 'query-records', 'fetch', 'field-window', 'search', 'aggregate']);
|
|
7
7
|
|
|
8
8
|
export function readHelp(binName = 'pdpp') {
|
|
9
9
|
return `Grant-scoped reads (uses pdpp connect/token cache, never owner credentials):
|
|
@@ -11,6 +11,7 @@ export function readHelp(binName = 'pdpp') {
|
|
|
11
11
|
${binName} read streams <provider-url> [--connection-id <cin>] [--cache-root <dir>] [--format json|table]
|
|
12
12
|
${binName} read query-records <provider-url> <stream> [--connection-id <cin>] [--limit <n>] [--cursor <cursor>] [--fields a,b] [--sort <spec>] [--count none|estimated|exact] [--filter-json <json>] [--format json|jsonl|table]
|
|
13
13
|
${binName} read fetch <provider-url> <stream> <record-id> [--connection-id <cin>] [--fields a,b] [--format json|table]
|
|
14
|
+
${binName} read field-window <provider-url> <stream> <record-id> --field <path> [--connection-id <cin>] [--q <text>] [--offset-chars <n>] [--limit-chars <n>] [--before-chars <n>] [--after-chars <n>] [--format json|table]
|
|
14
15
|
${binName} read search <provider-url> <query> [--connection-id <cin>] [--streams a,b] [--mode lexical|semantic|hybrid] [--limit <n>] [--format json|jsonl|table]
|
|
15
16
|
${binName} read aggregate <provider-url> <stream> --metric <metric> [--field <field>] [--connection-id <cin>] [--group-by <field> | --group-by-time <field> --granularity <unit>] [--limit <n>] [--format json|table]`;
|
|
16
17
|
}
|
|
@@ -105,6 +106,30 @@ export function buildReadRequest(command, positionals, flags, providerUrl) {
|
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
if (command === 'field-window') {
|
|
110
|
+
const stream = requirePositional(positionals, 0, 'stream');
|
|
111
|
+
const recordId = requirePositional(positionals, 1, 'record-id');
|
|
112
|
+
if (!flags.field) throw new PdppUsageError('Missing required flag: --field');
|
|
113
|
+
const query = pickQuery(flags, [
|
|
114
|
+
'connection-id',
|
|
115
|
+
'field',
|
|
116
|
+
'cursor',
|
|
117
|
+
'offset-chars',
|
|
118
|
+
'limit-chars',
|
|
119
|
+
'q',
|
|
120
|
+
'before-chars',
|
|
121
|
+
'after-chars',
|
|
122
|
+
]);
|
|
123
|
+
return {
|
|
124
|
+
method: 'GET',
|
|
125
|
+
url: buildUrl(
|
|
126
|
+
origin,
|
|
127
|
+
`/v1/streams/${encodeURIComponent(stream)}/records/${encodeURIComponent(recordId)}/field-window`,
|
|
128
|
+
query
|
|
129
|
+
),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
108
133
|
if (command === 'search') {
|
|
109
134
|
const queryText = requirePositional(positionals, 0, 'query');
|
|
110
135
|
const mode = flags.mode ? String(flags.mode) : undefined;
|