passport-bridge 0.35.1 → 0.37.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/README.md +13 -0
- package/dist/cliArgs.d.ts +1 -1
- package/dist/cliArgs.js +2 -1
- package/dist/cliAutopilotPolicy.d.ts +2 -0
- package/dist/cliConnections.d.ts +40 -0
- package/dist/cliConnections.js +125 -0
- package/dist/cliExec.d.ts +1 -2
- package/dist/cliExec.js +17 -38
- package/dist/cliGitCredential.js +28 -10
- package/dist/cliHookDecide.js +36 -16
- package/dist/cliMain.js +2 -0
- package/dist/cliOutput.js +6 -0
- package/dist/cliPolicyV2.js +6 -4
- package/dist/cliResult.js +6 -2
- package/dist/completion.js +1 -0
- package/dist/connectorKit/cli.generated.d.ts +15 -0
- package/dist/connectorKit/cli.generated.js +244 -0
- package/dist/connectorKit/engine.generated.d.ts +50 -0
- package/dist/connectorKit/engine.generated.js +475 -0
- package/dist/connectorKit/manifest.generated.d.ts +317 -0
- package/dist/connectorKit/manifest.generated.js +18 -0
- package/dist/connectorKit/manifests/flagSpec.generated.d.ts +6 -0
- package/dist/connectorKit/manifests/flagSpec.generated.js +20 -0
- package/dist/connectorKit/manifests/github.generated.d.ts +17 -0
- package/dist/connectorKit/manifests/github.generated.js +82 -0
- package/dist/connectorKit/manifests/githubCapture.generated.d.ts +2 -0
- package/dist/connectorKit/manifests/githubCapture.generated.js +307 -0
- package/dist/connectorKit/manifests/githubHooks.generated.d.ts +23 -0
- package/dist/connectorKit/manifests/githubHooks.generated.js +401 -0
- package/dist/connectorKit/manifests/githubReads.generated.d.ts +6 -0
- package/dist/connectorKit/manifests/githubReads.generated.js +200 -0
- package/dist/connectorKit/manifests/railway.generated.d.ts +6 -0
- package/dist/connectorKit/manifests/railway.generated.js +121 -0
- package/dist/connectorKit/manifests/railwayCapture.generated.d.ts +3 -0
- package/dist/connectorKit/manifests/railwayCapture.generated.js +375 -0
- package/dist/connectorKit/manifests/railwayHooks.generated.d.ts +25 -0
- package/dist/connectorKit/manifests/railwayHooks.generated.js +487 -0
- package/dist/connectorKit/manifests/supabase.generated.d.ts +3 -0
- package/dist/connectorKit/manifests/supabase.generated.js +34 -0
- package/dist/connectorKit/manifests/supabaseApi.generated.d.ts +3 -0
- package/dist/connectorKit/manifests/supabaseApi.generated.js +632 -0
- package/dist/connectorKit/manifests/supabaseCapture.generated.d.ts +9 -0
- package/dist/connectorKit/manifests/supabaseCapture.generated.js +421 -0
- package/dist/connectorKit/manifests/supabaseCatalog.generated.d.ts +11 -0
- package/dist/connectorKit/manifests/supabaseCatalog.generated.js +70 -0
- package/dist/connectorKit/manifests/supabaseCli.generated.d.ts +10 -0
- package/dist/connectorKit/manifests/supabaseCli.generated.js +581 -0
- package/dist/connectorKit/manifests/supabasePlatform.generated.d.ts +7 -0
- package/dist/connectorKit/manifests/supabasePlatform.generated.js +283 -0
- package/dist/connectorKit/manifests/supabaseProbes.generated.d.ts +5 -0
- package/dist/connectorKit/manifests/supabaseProbes.generated.js +580 -0
- package/dist/connectorKit/params.generated.d.ts +25 -0
- package/dist/connectorKit/params.generated.js +193 -0
- package/dist/connectorKit/pgParser.d.ts +9 -0
- package/dist/connectorKit/pgParser.js +13 -0
- package/dist/connectorKit/shadow.generated.d.ts +58 -0
- package/dist/connectorKit/shadow.generated.js +184 -0
- package/dist/connectorKit/shell.generated.d.ts +73 -0
- package/dist/connectorKit/shell.generated.js +516 -0
- package/dist/connectorKit/sourcegen.generated.d.ts +50 -0
- package/dist/connectorKit/sourcegen.generated.js +208 -0
- package/dist/connectorKit/sources/supabase/api-operations.generated.d.ts +187 -0
- package/dist/connectorKit/sources/supabase/api-operations.generated.js +2 -0
- package/dist/connectorKit/sources/supabase/cli-flags.generated.d.ts +1236 -0
- package/dist/connectorKit/sources/supabase/cli-flags.generated.js +2 -0
- package/dist/connectorKit/sources/supabase/mcp-tools.generated.d.ts +35 -0
- package/dist/connectorKit/sources/supabase/mcp-tools.generated.js +2 -0
- package/dist/connectorKit/sql.generated.d.ts +29 -0
- package/dist/connectorKit/sql.generated.js +420 -0
- package/dist/connectorKit/sqlFingerprint.generated.d.ts +8 -0
- package/dist/connectorKit/sqlFingerprint.generated.js +105 -0
- package/dist/connectorKit/template.generated.d.ts +21 -0
- package/dist/connectorKit/template.generated.js +89 -0
- package/dist/connectorKit/types.generated.d.ts +81 -0
- package/dist/connectorKit/types.generated.js +6 -0
- package/dist/controlPlane.generated.d.ts +46 -2
- package/dist/controlPlane.generated.js +10 -1
- package/dist/controlPlaneExec.d.ts +21 -2
- package/dist/controlPlaneExec.js +83 -5
- package/dist/controlPlaneGithub.generated.js +4 -8
- package/dist/controlPlaneGuard.js +29 -4
- package/dist/controlPlaneIds.d.ts +39 -0
- package/dist/controlPlaneIds.js +175 -0
- package/dist/controlPlaneModel.generated.d.ts +67 -0
- package/dist/controlPlaneModel.generated.js +153 -0
- package/dist/controlPlaneRailwayGuard.js +13 -3
- package/dist/controlPlaneSupabase.d.ts +84 -0
- package/dist/controlPlaneSupabase.js +278 -0
- package/dist/execGithubRepo.d.ts +2 -0
- package/dist/execGithubRepo.js +30 -0
- package/dist/gitPush.d.ts +20 -0
- package/dist/gitPush.js +45 -7
- package/dist/kitShadow.d.ts +90 -0
- package/dist/kitShadow.js +261 -0
- package/dist/kitShadowBudget.d.ts +10 -0
- package/dist/kitShadowBudget.js +15 -0
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/supabaseDecisions.d.ts +9 -0
- package/dist/supabaseDecisions.js +98 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/completion.js
CHANGED
|
@@ -12,6 +12,7 @@ const DESCRIPTIONS = {
|
|
|
12
12
|
describe: "Show one exact tool definition",
|
|
13
13
|
run: "Run a governed tool",
|
|
14
14
|
connect: "Connect member app accounts",
|
|
15
|
+
connections: "Your connections, and your connections page",
|
|
15
16
|
request: "Ask an admin for an app or for Full access",
|
|
16
17
|
resources: "List or read MCP resources",
|
|
17
18
|
prompts: "List or get MCP prompts",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A CLI line, normalized: the program found behind its launchers, the command
|
|
3
|
+
* (aliases resolved), flags parsed with the vendor's own tables the way its
|
|
4
|
+
* framework does, positional arguments as $1..$n. Anything the vendor's spec
|
|
5
|
+
* wouldn't accept is a `problem`: the request fails closed.
|
|
6
|
+
*/
|
|
7
|
+
import type { Manifest } from "./manifest.generated.js";
|
|
8
|
+
import type { Normalized, Value } from "./types.generated.js";
|
|
9
|
+
/** Every command the manifest knows, longest first. */
|
|
10
|
+
export declare function knownOps(m: Manifest): string[];
|
|
11
|
+
export declare const present: (value: Value | undefined) => boolean;
|
|
12
|
+
export declare const programName: (word: string) => string;
|
|
13
|
+
/** Strip what runs a program without changing it: env assignments, env, sudo, time, package runners. */
|
|
14
|
+
export declare function stripLaunchers(words: string[], programs: readonly string[]): void;
|
|
15
|
+
export declare function normalizeCli(m: Manifest, argv: readonly string[], given?: string): Normalized | null;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
// Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* A CLI line, normalized: the program found behind its launchers, the command
|
|
4
|
+
* (aliases resolved), flags parsed with the vendor's own tables the way its
|
|
5
|
+
* framework does, positional arguments as $1..$n. Anything the vendor's spec
|
|
6
|
+
* wouldn't accept is a `problem`: the request fails closed.
|
|
7
|
+
*/
|
|
8
|
+
const COBRA_TRUE = new Set(["1", "t", "T", "true", "TRUE", "True"]);
|
|
9
|
+
const COBRA_FALSE = new Set(["0", "f", "F", "false", "FALSE", "False"]);
|
|
10
|
+
const tables = new WeakMap();
|
|
11
|
+
/** A CLI's command list and flag table, built once per manifest. */
|
|
12
|
+
function tablesOf(m) {
|
|
13
|
+
const cli = m.capture.cli;
|
|
14
|
+
const hit = tables.get(cli);
|
|
15
|
+
if (hit)
|
|
16
|
+
return hit;
|
|
17
|
+
const ops = [
|
|
18
|
+
...new Set([...Object.keys(cli.flags.commands), ...cli.rules.map((r) => r.match), ...Object.keys(cli.reads)])
|
|
19
|
+
].sort((a, b) => b.split(" ").length - a.split(" ").length);
|
|
20
|
+
// Any flag that takes a value anywhere consumes its value while looking for the command.
|
|
21
|
+
const anyFlags = new Map();
|
|
22
|
+
for (const spec of [...cli.flags.global, ...(cli.legacyFlags ?? []), ...Object.values(cli.flags.commands).flat()])
|
|
23
|
+
if (!anyFlags.has(spec.long) || spec.value === "required")
|
|
24
|
+
anyFlags.set(spec.long, spec);
|
|
25
|
+
const built = { ops, topWords: new Set(ops.map((op) => op.split(" ")[0])), anyFlags: [...anyFlags.values()] };
|
|
26
|
+
tables.set(cli, built);
|
|
27
|
+
return built;
|
|
28
|
+
}
|
|
29
|
+
/** Every command the manifest knows, longest first. */
|
|
30
|
+
export function knownOps(m) {
|
|
31
|
+
return tablesOf(m).ops;
|
|
32
|
+
}
|
|
33
|
+
function flagTable(specs) {
|
|
34
|
+
const long = new Map();
|
|
35
|
+
const short = new Map();
|
|
36
|
+
for (const spec of specs) {
|
|
37
|
+
long.set(spec.long, spec);
|
|
38
|
+
if (spec.short)
|
|
39
|
+
short.set(spec.short, spec);
|
|
40
|
+
}
|
|
41
|
+
return { long, short };
|
|
42
|
+
}
|
|
43
|
+
/** Parse argv with one flag table, the way cobra (or Vercel's arg) does. */
|
|
44
|
+
function parseArgs(words, specs, strict, framework) {
|
|
45
|
+
const { long, short } = flagTable(specs);
|
|
46
|
+
const out = { positional: [], flags: {} };
|
|
47
|
+
const fail = (problem) => {
|
|
48
|
+
out.problem ??= problem;
|
|
49
|
+
};
|
|
50
|
+
const set = (spec, value) => {
|
|
51
|
+
if (spec.value === "optional" && value === "") {
|
|
52
|
+
fail(`--${spec.long}= is empty`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (spec.value !== "none") {
|
|
56
|
+
const earlier = out.flags[spec.long];
|
|
57
|
+
if (spec.repeat && typeof value === "string")
|
|
58
|
+
out.flags[spec.long] = [
|
|
59
|
+
...(Array.isArray(earlier) ? earlier : typeof earlier === "string" ? [earlier] : []),
|
|
60
|
+
value
|
|
61
|
+
];
|
|
62
|
+
else
|
|
63
|
+
out.flags[spec.long] = value;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (value === true)
|
|
67
|
+
out.flags[spec.long] = true;
|
|
68
|
+
else if (framework === "arg")
|
|
69
|
+
fail(`--${spec.long} takes no value`);
|
|
70
|
+
else if (COBRA_TRUE.has(value))
|
|
71
|
+
out.flags[spec.long] = true;
|
|
72
|
+
else if (COBRA_FALSE.has(value))
|
|
73
|
+
out.flags[spec.long] = false;
|
|
74
|
+
else
|
|
75
|
+
fail(`--${spec.long} takes true or false`);
|
|
76
|
+
};
|
|
77
|
+
for (let i = 0; i < words.length; i++) {
|
|
78
|
+
const word = words[i];
|
|
79
|
+
if (word === "--") {
|
|
80
|
+
out.positional.push(...words.slice(i + 1));
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
if (word.startsWith("--")) {
|
|
84
|
+
const eq = word.indexOf("=");
|
|
85
|
+
const name = eq < 0 ? word.slice(2) : word.slice(2, eq);
|
|
86
|
+
const spec = long.get(name);
|
|
87
|
+
if (!spec) {
|
|
88
|
+
if (strict)
|
|
89
|
+
fail(`unknown flag --${name}`);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (eq >= 0)
|
|
93
|
+
set(spec, word.slice(eq + 1));
|
|
94
|
+
else if (spec.value === "required") {
|
|
95
|
+
if (i + 1 >= words.length)
|
|
96
|
+
fail(`--${name} needs a value`);
|
|
97
|
+
else
|
|
98
|
+
set(spec, words[++i]);
|
|
99
|
+
}
|
|
100
|
+
else
|
|
101
|
+
set(spec, true);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (word.startsWith("-") && word.length > 1) {
|
|
105
|
+
const letters = word.slice(1);
|
|
106
|
+
for (let j = 0; j < letters.length; j++) {
|
|
107
|
+
const spec = short.get(letters[j]);
|
|
108
|
+
if (!spec) {
|
|
109
|
+
if (strict)
|
|
110
|
+
fail(`unknown flag -${letters[j]}`);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
if (spec.value === "none") {
|
|
114
|
+
if (letters[j + 1] === "=") {
|
|
115
|
+
set(spec, letters.slice(j + 2));
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
set(spec, true);
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const inline = letters.slice(j + 1).replace(/^=/, "");
|
|
122
|
+
if (inline)
|
|
123
|
+
set(spec, inline);
|
|
124
|
+
else if (i + 1 >= words.length)
|
|
125
|
+
fail(`-${letters[j]} needs a value`);
|
|
126
|
+
else
|
|
127
|
+
set(spec, words[++i]);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
out.positional.push(word);
|
|
133
|
+
}
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
export const present = (value) => value !== undefined && value !== false && value !== "" && !(Array.isArray(value) && !value.length);
|
|
137
|
+
/** Command words with the vendor's aliases replaced, a level at a time ("projects rm" -> "project remove"). */
|
|
138
|
+
function canonicalWords(words, aliases) {
|
|
139
|
+
const out = [...words];
|
|
140
|
+
for (let depth = 1; depth <= Math.min(4, out.length); depth++) {
|
|
141
|
+
// Own keys only: a command word like "constructor" is no alias.
|
|
142
|
+
const key = out.slice(0, depth).join(" ");
|
|
143
|
+
const found = Object.hasOwn(aliases, key) ? aliases[key] : undefined;
|
|
144
|
+
if (found)
|
|
145
|
+
out.splice(0, depth, ...found.split(" "));
|
|
146
|
+
}
|
|
147
|
+
return out;
|
|
148
|
+
}
|
|
149
|
+
export const programName = (word) => word
|
|
150
|
+
.split(/[\\/]/)
|
|
151
|
+
.pop()
|
|
152
|
+
.replace(/@.*$/, "")
|
|
153
|
+
.replace(/\.(exe|cmd|ps1)$/i, "");
|
|
154
|
+
/** Strip what runs a program without changing it: env assignments, env, sudo, time, package runners. */
|
|
155
|
+
export function stripLaunchers(words, programs) {
|
|
156
|
+
const runners = /^(npx|bunx|pnpx|env|sudo|doas|time|nohup|command|exec|nice)$/;
|
|
157
|
+
for (let guard = 0; guard < 32 && words.length; guard++) {
|
|
158
|
+
const first = words[0];
|
|
159
|
+
if (programs.includes(programName(first)))
|
|
160
|
+
return;
|
|
161
|
+
if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(first))
|
|
162
|
+
words.shift();
|
|
163
|
+
else if (/^(npm|pnpm|yarn)$/.test(first) && /^(exec|x|dlx)$/.test(words[1] ?? ""))
|
|
164
|
+
words.splice(0, 2);
|
|
165
|
+
else if (runners.test(first))
|
|
166
|
+
words.shift();
|
|
167
|
+
else if (first === "--" || /^-/.test(first)) {
|
|
168
|
+
// A runner's own option, and its value when it takes one (npx -p supabase, sudo -u admin).
|
|
169
|
+
const valued = /^(-p|--package|-u|--user|-g|--group|-C|--chdir|-n)$/.test(first);
|
|
170
|
+
words.shift();
|
|
171
|
+
if (valued)
|
|
172
|
+
words.shift();
|
|
173
|
+
}
|
|
174
|
+
else
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/** The command the words name (aliases resolved), or the CLI's default command when the first word isn't one. */
|
|
179
|
+
function findOp(m, words) {
|
|
180
|
+
const cli = m.capture.cli;
|
|
181
|
+
const { ops, topWords, anyFlags } = tablesOf(m);
|
|
182
|
+
const named = canonicalWords(parseArgs(words, anyFlags, false, cli.framework).positional, cli.aliases ?? {});
|
|
183
|
+
const op = ops.find((candidate) => candidate.split(" ").every((part, i) => named[i] === part));
|
|
184
|
+
if (op)
|
|
185
|
+
return { op, defaulted: false };
|
|
186
|
+
const defaulted = cli.defaultCommand !== undefined && (named.length === 0 || !topWords.has(named[0]));
|
|
187
|
+
return { op: defaulted ? cli.defaultCommand : undefined, defaulted };
|
|
188
|
+
}
|
|
189
|
+
/** More arguments than the vendor's usage line allows means something we can't read rides along. */
|
|
190
|
+
function tooManyArgs(usage, count) {
|
|
191
|
+
if (usage === undefined || usage.includes("..."))
|
|
192
|
+
return false;
|
|
193
|
+
return count > (usage.match(/[<[][^>\]]+[>\]]/g) ?? []).filter((p) => !/flags/.test(p)).length;
|
|
194
|
+
}
|
|
195
|
+
export function normalizeCli(m, argv, given) {
|
|
196
|
+
const cli = m.capture.cli;
|
|
197
|
+
const programs = [...cli.programs, ...(cli.aliasPrograms ?? [])];
|
|
198
|
+
const words = [...argv];
|
|
199
|
+
stripLaunchers(words, programs);
|
|
200
|
+
if (!programs.includes(programName(words.shift() ?? ""))) {
|
|
201
|
+
// A known program anywhere in the line, behind a launcher we don't know: never call it a read.
|
|
202
|
+
if (argv.some((word) => programs.includes(programName(word))))
|
|
203
|
+
return { iface: "cli", op: "", params: {}, local: false, remote: false, problem: "unrecognised launcher" };
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
const { op, defaulted } = findOp(m, words);
|
|
207
|
+
const own = op ? (cli.flags.commands[op] ?? []) : [];
|
|
208
|
+
// Deprecated target flags (--linked, --local, --db-url) still work only where the command takes a target.
|
|
209
|
+
const legacy = own.some((flag) => flag.long === "remote") ? (cli.legacyFlags ?? []) : [];
|
|
210
|
+
const exact = parseArgs(words, [...cli.flags.global, ...legacy, ...own], true, cli.framework);
|
|
211
|
+
const opWords = op && !defaulted ? op.split(" ") : [];
|
|
212
|
+
const positional = canonicalWords(exact.positional, cli.aliases ?? {});
|
|
213
|
+
const args = positional.slice(opWords.length);
|
|
214
|
+
const params = { ...exact.flags };
|
|
215
|
+
args.forEach((value, index) => (params[`$${index + 1}`] = value));
|
|
216
|
+
const localFlagsUsed = cli.localFlags.filter((flag) => exact.flags[flag] === true);
|
|
217
|
+
const remote = cli.remoteFlags.some((flag) => present(exact.flags[flag]));
|
|
218
|
+
const problem = given ??
|
|
219
|
+
exact.problem ??
|
|
220
|
+
(op && !opWords.every((part, i) => positional[i] === part) ? "flags moved the command" : undefined) ??
|
|
221
|
+
(op && tooManyArgs(cli.usage?.[op], args.length) ? "more arguments than the command takes" : undefined) ??
|
|
222
|
+
(remote && localFlagsUsed.some((flag) => flag === "local" || !own.some((spec) => spec.long === flag))
|
|
223
|
+
? "remote and local together"
|
|
224
|
+
: undefined);
|
|
225
|
+
// Another folder: its link, not this folder's, decides the target.
|
|
226
|
+
const contextFlag = (cli.contextFlags ?? []).find((flag) => typeof exact.flags[flag] === "string");
|
|
227
|
+
const folderIndex = op ? cli.folderArgs?.[op] : undefined;
|
|
228
|
+
const folder = contextFlag
|
|
229
|
+
? exact.flags[contextFlag]
|
|
230
|
+
: folderIndex !== undefined
|
|
231
|
+
? args[folderIndex]
|
|
232
|
+
: undefined;
|
|
233
|
+
const info = (cli.infoFlags ?? []).some((flag) => exact.flags[flag] === true);
|
|
234
|
+
return {
|
|
235
|
+
iface: "cli",
|
|
236
|
+
op: op ?? positional.slice(0, 2).join(" "),
|
|
237
|
+
params,
|
|
238
|
+
local: info || localFlagsUsed.length > 0,
|
|
239
|
+
remote,
|
|
240
|
+
...(localFlagsUsed.length ? { localFlagsUsed } : {}),
|
|
241
|
+
...(folder ? { folder } : {}),
|
|
242
|
+
...(problem ? { problem } : {})
|
|
243
|
+
};
|
|
244
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one Level 1 engine: any manifest, any request (a CLI line, an MCP tool
|
|
3
|
+
* call, an API call), to the governed Actions it takes. Pure and synchronous,
|
|
4
|
+
* like every connector's `classify` (spec Part 2): no network, no platform
|
|
5
|
+
* names. Summaries are templates filled with safe names only.
|
|
6
|
+
*
|
|
7
|
+
* Fails closed. These all become the manifest's Unclassified Action (kind
|
|
8
|
+
* delete, blocked by default): a command, tool or route the manifest doesn't
|
|
9
|
+
* name; a flag the vendor's spec doesn't list; a boolean the CLI framework
|
|
10
|
+
* wouldn't accept; a value flag with no value; an argument no rule names; a
|
|
11
|
+
* known operation whose conditions no rule matches; a SQL rule with no SQL; a
|
|
12
|
+
* field sent twice with two values; a list where a rule takes one value; a
|
|
13
|
+
* node whose parent can't be resolved from the request or the inventory; a
|
|
14
|
+
* hook that's missing; a problem the guard's resolver found (`shell.ts`).
|
|
15
|
+
* Only a reviewed read (a reads entry or a "read" rule), a local-only command,
|
|
16
|
+
* or SQL the parser shows only reads returns null.
|
|
17
|
+
*/
|
|
18
|
+
import { type Classification, type DiscoveredNode } from "../controlPlane.generated.js";
|
|
19
|
+
import { type Manifest } from "./manifest.generated.js";
|
|
20
|
+
import type { ClassifyContext, ConnectorHooks, Normalized, Request } from "./types.generated.js";
|
|
21
|
+
export { at, fill, parseTemplate, placeholders, render, safeName } from "./template.generated.js";
|
|
22
|
+
export type * from "./types.generated.js";
|
|
23
|
+
export declare function normalize(m: Manifest, request: Request): Normalized | null;
|
|
24
|
+
export type Chain = {
|
|
25
|
+
nodeId: string;
|
|
26
|
+
chain: DiscoveredNode[];
|
|
27
|
+
unresolved?: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The node a request lands on and its chain from the service down. The
|
|
31
|
+
* requested type, or its nearest ancestor the params can name; every
|
|
32
|
+
* ancestor above it must be named by the params or found in the inventory
|
|
33
|
+
* (context.parents, hooks.resolveParent), or the chain is `unresolved` and
|
|
34
|
+
* the caller fails closed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function nodeChain(m: Manifest, type: string, params: Readonly<Record<string, unknown>>, context?: ClassifyContext, hooks?: ConnectorHooks): Chain;
|
|
37
|
+
export declare function assertSchema(m: Manifest): void;
|
|
38
|
+
/**
|
|
39
|
+
* How a request was decided: `rule` (a capture rule or its hook named the Actions, which may include the
|
|
40
|
+
* Unclassified Action on purpose), `read` (a reviewed read or a local-only command), `failed` (nothing
|
|
41
|
+
* named it, or what named it couldn't be resolved: Unclassified), or `none` (not this platform's).
|
|
42
|
+
*/
|
|
43
|
+
export type Explained = {
|
|
44
|
+
found: Classification[];
|
|
45
|
+
via: "rule" | "read" | "failed" | "none";
|
|
46
|
+
};
|
|
47
|
+
/** The Actions a request takes: one, several for a bundle, or null when it only reads or isn't this platform's. */
|
|
48
|
+
export declare function classify(m: Manifest, request: Request, context?: ClassifyContext, hooks?: ConnectorHooks): Classification | Classification[] | null;
|
|
49
|
+
/** `classify`, with how it was decided. */
|
|
50
|
+
export declare function explain(m: Manifest, request: Request, context?: ClassifyContext, hooks?: ConnectorHooks): Explained;
|