@scarn/sdk 0.0.0-stage → 0.8.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/dist/chunk-0y2fy5en.js +166 -0
- package/dist/chunk-3ctaaseb.js +1456 -0
- package/dist/chunk-4ggr8af6.js +30 -0
- package/dist/chunk-5zsavw98.js +91 -0
- package/dist/chunk-63f90zky.js +39 -0
- package/dist/chunk-700xe701.js +100 -0
- package/dist/chunk-ar6hcj1r.js +35 -0
- package/dist/chunk-cdanncng.js +74 -0
- package/dist/chunk-dp86pa6m.js +68 -0
- package/dist/chunk-e1h021kq.js +86 -0
- package/dist/chunk-gds7w7zh.js +330 -0
- package/dist/chunk-k4y5qt4y.js +14 -0
- package/dist/chunk-mz53r914.js +300 -0
- package/dist/chunk-ngy1fdcx.js +57 -0
- package/dist/chunk-p7yrcmqm.js +322 -0
- package/dist/chunk-rt9tq4j6.js +116 -0
- package/dist/chunk-skzxcba3.js +14282 -0
- package/dist/chunk-vfeytkqx.js +1687 -0
- package/dist/chunk-y2pv8d6a.js +162 -0
- package/dist/chunk-y64skrwp.js +17 -0
- package/dist/chunk-yjtaq94c.js +1094 -0
- package/dist/chunk-zm72ksz0.js +256 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +58 -0
- package/dist/contracts/artifact-markers.d.ts +42 -0
- package/dist/contracts/artifact-markers.js +16 -0
- package/dist/contracts/artifacts.d.ts +67 -0
- package/dist/contracts/artifacts.js +27 -0
- package/dist/contracts/pipeline-document/built-ins.d.ts +23 -0
- package/dist/contracts/pipeline-document/conditions/operators.d.ts +8 -0
- package/dist/contracts/pipeline-document/index.d.ts +11 -0
- package/dist/contracts/pipeline-document/index.js +99 -0
- package/dist/contracts/pipeline-document/json.d.ts +35 -0
- package/dist/contracts/pipeline-document/routes.d.ts +16 -0
- package/dist/contracts/pipeline-document/schema.d.ts +780 -0
- package/dist/contracts/pipeline-document/step-contract.d.ts +11 -0
- package/dist/contracts/step-artifact-submissions.d.ts +71 -0
- package/dist/contracts/step-artifact-submissions.js +171 -0
- package/dist/defaults/atomic-json-file.d.ts +10 -0
- package/dist/defaults/auth-file.d.ts +14 -0
- package/dist/defaults/base-url.d.ts +1 -0
- package/dist/defaults/config-file.d.ts +46 -0
- package/dist/defaults/home-dir.d.ts +3 -0
- package/dist/defaults/index.d.ts +12 -0
- package/dist/defaults/index.js +1240 -0
- package/dist/defaults/legacy-config-migration.d.ts +27 -0
- package/dist/defaults/load-push-defaults.d.ts +25 -0
- package/dist/defaults/project-config.d.ts +32 -0
- package/dist/defaults/project-ref.d.ts +34 -0
- package/dist/definitions/artifacts/artifact.d.ts +62 -0
- package/dist/definitions/artifacts/index.d.ts +1 -0
- package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +263 -0
- package/dist/definitions/pipelines/index.d.ts +3 -0
- package/dist/definitions/pipelines/index.js +26 -0
- package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +208 -0
- package/dist/definitions/pipelines/work-item-fields.d.ts +93 -0
- package/dist/definitions/steps/compile-mcps.d.ts +34 -0
- package/dist/definitions/steps/define-code-step.d.ts +84 -0
- package/dist/definitions/steps/define-mcp.d.ts +79 -0
- package/dist/definitions/steps/define-step.d.ts +137 -0
- package/dist/definitions/steps/env.d.ts +136 -0
- package/dist/definitions/steps/index.d.ts +14 -0
- package/dist/definitions/steps/index.js +76 -0
- package/dist/definitions/steps/mcp-server-config.d.ts +102 -0
- package/dist/definitions/steps/prompt-template.d.ts +24 -0
- package/dist/definitions/steps/repo.d.ts +67 -0
- package/dist/definitions/steps/runtime.d.ts +115 -0
- package/dist/definitions/steps/step-definitions-client.d.ts +400 -0
- package/dist/definitions/steps/step-features.d.ts +109 -0
- package/dist/definitions/steps/step-handle.d.ts +25 -0
- package/dist/definitions/steps/step-ref.d.ts +19 -0
- package/dist/definitions/validation/index.d.ts +2 -0
- package/dist/definitions/validation/index.js +19 -0
- package/dist/definitions/validation/validate-artifact-markers.d.ts +3 -0
- package/dist/definitions/validation/validate-artifacts.d.ts +7 -0
- package/dist/definitions/validation/validate-definition-specs.d.ts +16 -0
- package/dist/definitions/validation/validate-env.d.ts +15 -0
- package/dist/definitions/validation/validate-repo.d.ts +13 -0
- package/dist/definitions/validation/validate-runtime.d.ts +12 -0
- package/dist/definitions/validation/validation-issue.d.ts +11 -0
- package/dist/devcontainer-config-path.d.ts +21 -0
- package/dist/devcontainer-config-path.js +15 -0
- package/dist/env-vars.d.ts +136 -0
- package/dist/env-vars.js +37 -0
- package/dist/eslint.d.ts +42 -0
- package/dist/eslint.js +127 -0
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/index.d.ts +8 -0
- package/dist/generated/client/types.gen.d.ts +117 -0
- package/dist/generated/client/utils.gen.d.ts +33 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/core/auth.gen.d.ts +18 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/types.gen.d.ts +78 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/sdk.gen.d.ts +302 -0
- package/dist/generated/types.gen.d.ts +18375 -0
- package/dist/git-url/git-remote.d.ts +30 -0
- package/dist/git-url/git-repo-identity.d.ts +44 -0
- package/dist/git-url/git-repo-identity.js +161 -0
- package/dist/git-url/parse-git-host.d.ts +23 -0
- package/dist/health-checks.d.ts +169 -0
- package/dist/health-checks.js +21 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +296 -0
- package/dist/jsonc.d.ts +3 -0
- package/dist/jsonc.js +12 -0
- package/dist/managed-runtimes.d.ts +20 -0
- package/dist/managed-runtimes.js +15 -0
- package/dist/opencode-mcp.d.ts +313 -0
- package/dist/opencode-mcp.js +31 -0
- package/dist/pipelines/chain.d.ts +7 -0
- package/dist/pipelines/compile-args.d.ts +12 -0
- package/dist/pipelines/compile-chain.d.ts +9 -0
- package/dist/pipelines/compile-checks.d.ts +16 -0
- package/dist/pipelines/compile-state.d.ts +30 -0
- package/dist/pipelines/condition-data.d.ts +78 -0
- package/dist/pipelines/conditions.d.ts +47 -0
- package/dist/pipelines/context.d.ts +16 -0
- package/dist/pipelines/define-pipeline.d.ts +32 -0
- package/dist/pipelines/each.d.ts +5 -0
- package/dist/pipelines/errors.d.ts +26 -0
- package/dist/pipelines/handles.d.ts +29 -0
- package/dist/pipelines/index.d.ts +18 -0
- package/dist/pipelines/index.js +83 -0
- package/dist/pipelines/model.d.ts +103 -0
- package/dist/pipelines/nodes.d.ts +54 -0
- package/dist/pipelines/ref-types.d.ts +54 -0
- package/dist/pipelines/refs.d.ts +80 -0
- package/dist/pipelines/registry.d.ts +12 -0
- package/dist/pipelines/source.d.ts +17 -0
- package/dist/pipelines/types.d.ts +160 -0
- package/dist/push/code-step-lookup.d.ts +32 -0
- package/dist/push/code-step-lookup.js +12 -0
- package/dist/push/collect-definitions.d.ts +70 -0
- package/dist/push/collect-pipeline-documents.d.ts +14 -0
- package/dist/push/index.d.ts +6 -0
- package/dist/push/index.js +327 -0
- package/dist/push/push-from-directory.d.ts +37 -0
- package/dist/repo-config.d.ts +80 -0
- package/dist/repo-config.js +25 -0
- package/dist/scarn-config-parser.d.ts +29 -0
- package/dist/scarn-config-parser.js +10 -0
- package/dist/task-plane-client.d.ts +489 -0
- package/dist/z.d.ts +7 -0
- package/package.json +132 -4
- package/README.md +0 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Wire schema for a step's selected devcontainer config
|
|
4
|
+
* (`devcontainerConfigPath`): the full repo-relative path to the file the worker
|
|
5
|
+
* launches instead of searching for one.
|
|
6
|
+
*
|
|
7
|
+
* - Repo-relative: no leading `/`, no drive letter, no backslash, no `..`
|
|
8
|
+
* segment. A leading `./` is normalized away (`normalizeDevcontainerConfigPath`).
|
|
9
|
+
* - The basename is `devcontainer.json` or `.devcontainer.json`, the
|
|
10
|
+
* devcontainer CLI's own rule for `--config`.
|
|
11
|
+
* - At most 255 characters.
|
|
12
|
+
*
|
|
13
|
+
* Containment against symlinks is a runtime concern the worker re-checks with
|
|
14
|
+
* `realpath`; this schema is purely lexical.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MAX_DEVCONTAINER_CONFIG_PATH_LENGTH = 255;
|
|
17
|
+
export declare const DEVCONTAINER_CONFIG_BASENAMES: readonly string[];
|
|
18
|
+
/** Strips any leading `./` segments. Leaves every other character untouched. */
|
|
19
|
+
export declare function normalizeDevcontainerConfigPath(path: string): string;
|
|
20
|
+
export declare const devcontainerConfigPathSchema: z.ZodString;
|
|
21
|
+
export type DevcontainerConfigPath = z.output<typeof devcontainerConfigPathSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
DEVCONTAINER_CONFIG_BASENAMES,
|
|
4
|
+
MAX_DEVCONTAINER_CONFIG_PATH_LENGTH,
|
|
5
|
+
devcontainerConfigPathSchema,
|
|
6
|
+
normalizeDevcontainerConfigPath
|
|
7
|
+
} from "./chunk-4ggr8af6.js";
|
|
8
|
+
import"./chunk-skzxcba3.js";
|
|
9
|
+
import"./chunk-y64skrwp.js";
|
|
10
|
+
export {
|
|
11
|
+
DEVCONTAINER_CONFIG_BASENAMES,
|
|
12
|
+
MAX_DEVCONTAINER_CONFIG_PATH_LENGTH,
|
|
13
|
+
devcontainerConfigPathSchema,
|
|
14
|
+
normalizeDevcontainerConfigPath
|
|
15
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Wire schema for a step's declared environment variables (`envJson`).
|
|
4
|
+
*
|
|
5
|
+
* A step declares each variable one of two ways, discriminated on `source`:
|
|
6
|
+
*
|
|
7
|
+
* - `value`: a literal or `{{input.…}}` template, stored in the definition
|
|
8
|
+
* and rendered per run. `secret` only controls log masking.
|
|
9
|
+
* - `inherit`: read from the **worker** host at run time (`.scarn/.env`,
|
|
10
|
+
* then `process.env`). Only the variable *name* is stored. `mcp`, when set,
|
|
11
|
+
* is the step's `opencodeMcpJson` key of the ref'd MCP server the variable
|
|
12
|
+
* belongs to; absent means a plain step variable.
|
|
13
|
+
*
|
|
14
|
+
* `applies` says which process a variable reaches (default `agent`):
|
|
15
|
+
*
|
|
16
|
+
* - `agent`: the agent (or code step) process, as `docker exec -e` argv on a
|
|
17
|
+
* container run, hence the entry count and value length caps.
|
|
18
|
+
* - `setup`: only the `devcontainer up` process, so `initializeCommand` sees
|
|
19
|
+
* it. It overrides the worker's own variable of the same name. Scarn never
|
|
20
|
+
* adds it to `containerEnv`; the repo forwards it with
|
|
21
|
+
* `${localEnv:NAME:default}` if it wants it inside the container.
|
|
22
|
+
* - `both`: both of the above.
|
|
23
|
+
*
|
|
24
|
+
* `setup` and `both` need a container to set up, so they are rejected on a
|
|
25
|
+
* host (`no_workspace`) step, and on an MCP variable, since MCP servers run
|
|
26
|
+
* inside the agent.
|
|
27
|
+
*/
|
|
28
|
+
export declare const ENV_VAR_NAME_PATTERN: RegExp;
|
|
29
|
+
/** Names Scarn manages itself; a step may not declare them. */
|
|
30
|
+
export declare const RESERVED_ENV_VAR_NAMES: readonly string[];
|
|
31
|
+
export declare const RESERVED_ENV_VAR_PREFIX = "SCARN_";
|
|
32
|
+
export declare const MAX_ENV_VARS = 64;
|
|
33
|
+
export declare const MAX_ENV_VAR_NAME_LENGTH = 128;
|
|
34
|
+
export declare const MAX_ENV_VAR_VALUE_LENGTH = 4096;
|
|
35
|
+
/** True when `value` interpolates at least one `{{input.…}}` token. */
|
|
36
|
+
export declare function containsInputToken(value: string): boolean;
|
|
37
|
+
export declare function isReservedEnvVarName(name: string): boolean;
|
|
38
|
+
export declare const envVarAppliesValues: readonly ["agent", "setup", "both"];
|
|
39
|
+
export type EnvVarApplies = (typeof envVarAppliesValues)[number];
|
|
40
|
+
/** True when the variable reaches the agent (or code step) process. */
|
|
41
|
+
export declare function appliesToAgent(applies: EnvVarApplies): boolean;
|
|
42
|
+
/** True when the variable reaches the `devcontainer up` process. */
|
|
43
|
+
export declare function appliesToSetup(applies: EnvVarApplies): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* True when `name` is a worker-side variable an `inherit` entry may not read:
|
|
46
|
+
* `SCARN_*` carries the worker's own credentials and configuration, which
|
|
47
|
+
* must never be copied into a step's agent container.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isUninheritableWorkerEnvVarName(name: string): boolean;
|
|
50
|
+
export declare const envVarSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
51
|
+
name: z.ZodString;
|
|
52
|
+
source: z.ZodLiteral<"value">;
|
|
53
|
+
value: z.ZodString;
|
|
54
|
+
secret: z.ZodBoolean;
|
|
55
|
+
applies: z.ZodDefault<z.ZodEnum<{
|
|
56
|
+
agent: "agent";
|
|
57
|
+
setup: "setup";
|
|
58
|
+
both: "both";
|
|
59
|
+
}>>;
|
|
60
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
source: z.ZodLiteral<"inherit">;
|
|
63
|
+
from: z.ZodString;
|
|
64
|
+
secret: z.ZodBoolean;
|
|
65
|
+
optional: z.ZodBoolean;
|
|
66
|
+
default: z.ZodOptional<z.ZodString>;
|
|
67
|
+
mcp: z.ZodOptional<z.ZodString>;
|
|
68
|
+
applies: z.ZodDefault<z.ZodEnum<{
|
|
69
|
+
agent: "agent";
|
|
70
|
+
setup: "setup";
|
|
71
|
+
both: "both";
|
|
72
|
+
}>>;
|
|
73
|
+
}, z.core.$strict>], "source">;
|
|
74
|
+
/**
|
|
75
|
+
* The full value of a step's `envJson`: a bounded list of uniquely named
|
|
76
|
+
* entries.
|
|
77
|
+
*/
|
|
78
|
+
export declare const envVarsSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
source: z.ZodLiteral<"value">;
|
|
81
|
+
value: z.ZodString;
|
|
82
|
+
secret: z.ZodBoolean;
|
|
83
|
+
applies: z.ZodDefault<z.ZodEnum<{
|
|
84
|
+
agent: "agent";
|
|
85
|
+
setup: "setup";
|
|
86
|
+
both: "both";
|
|
87
|
+
}>>;
|
|
88
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
source: z.ZodLiteral<"inherit">;
|
|
91
|
+
from: z.ZodString;
|
|
92
|
+
secret: z.ZodBoolean;
|
|
93
|
+
optional: z.ZodBoolean;
|
|
94
|
+
default: z.ZodOptional<z.ZodString>;
|
|
95
|
+
mcp: z.ZodOptional<z.ZodString>;
|
|
96
|
+
applies: z.ZodDefault<z.ZodEnum<{
|
|
97
|
+
agent: "agent";
|
|
98
|
+
setup: "setup";
|
|
99
|
+
both: "both";
|
|
100
|
+
}>>;
|
|
101
|
+
}, z.core.$strict>], "source">>;
|
|
102
|
+
/**
|
|
103
|
+
* Read-side schema for `envJson` as persisted and served. Structural only:
|
|
104
|
+
* unknown keys are stripped and the write-time refinements (reserved names,
|
|
105
|
+
* caps, secret rules) are not re-applied, so tightening those rules can never
|
|
106
|
+
* make an already-stored row unreadable. Only a change to the stored shape
|
|
107
|
+
* itself can break it, and `test/env-vars-stored-compat.test.ts` pins that.
|
|
108
|
+
* `applies` reads as `agent` when absent, the behavior before it existed.
|
|
109
|
+
*/
|
|
110
|
+
export declare const storedEnvVarsSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
111
|
+
name: z.ZodString;
|
|
112
|
+
source: z.ZodLiteral<"value">;
|
|
113
|
+
value: z.ZodString;
|
|
114
|
+
secret: z.ZodBoolean;
|
|
115
|
+
applies: z.ZodDefault<z.ZodEnum<{
|
|
116
|
+
agent: "agent";
|
|
117
|
+
setup: "setup";
|
|
118
|
+
both: "both";
|
|
119
|
+
}>>;
|
|
120
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
121
|
+
name: z.ZodString;
|
|
122
|
+
source: z.ZodLiteral<"inherit">;
|
|
123
|
+
from: z.ZodString;
|
|
124
|
+
secret: z.ZodBoolean;
|
|
125
|
+
optional: z.ZodBoolean;
|
|
126
|
+
default: z.ZodOptional<z.ZodString>;
|
|
127
|
+
mcp: z.ZodOptional<z.ZodString>;
|
|
128
|
+
applies: z.ZodDefault<z.ZodEnum<{
|
|
129
|
+
agent: "agent";
|
|
130
|
+
setup: "setup";
|
|
131
|
+
both: "both";
|
|
132
|
+
}>>;
|
|
133
|
+
}, z.core.$strip>], "source">>;
|
|
134
|
+
export type EnvVarSpec = z.output<typeof envVarSpecSchema>;
|
|
135
|
+
export type EnvVarSpecInput = z.input<typeof envVarSpecSchema>;
|
|
136
|
+
export type EnvVarsInput = z.input<typeof envVarsSchema>;
|
package/dist/env-vars.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
ENV_VAR_NAME_PATTERN,
|
|
4
|
+
MAX_ENV_VARS,
|
|
5
|
+
MAX_ENV_VAR_NAME_LENGTH,
|
|
6
|
+
MAX_ENV_VAR_VALUE_LENGTH,
|
|
7
|
+
RESERVED_ENV_VAR_NAMES,
|
|
8
|
+
RESERVED_ENV_VAR_PREFIX,
|
|
9
|
+
appliesToAgent,
|
|
10
|
+
appliesToSetup,
|
|
11
|
+
containsInputToken,
|
|
12
|
+
envVarAppliesValues,
|
|
13
|
+
envVarSpecSchema,
|
|
14
|
+
envVarsSchema,
|
|
15
|
+
isReservedEnvVarName,
|
|
16
|
+
isUninheritableWorkerEnvVarName,
|
|
17
|
+
storedEnvVarsSchema
|
|
18
|
+
} from "./chunk-5zsavw98.js";
|
|
19
|
+
import"./chunk-skzxcba3.js";
|
|
20
|
+
import"./chunk-y64skrwp.js";
|
|
21
|
+
export {
|
|
22
|
+
ENV_VAR_NAME_PATTERN,
|
|
23
|
+
MAX_ENV_VARS,
|
|
24
|
+
MAX_ENV_VAR_NAME_LENGTH,
|
|
25
|
+
MAX_ENV_VAR_VALUE_LENGTH,
|
|
26
|
+
RESERVED_ENV_VAR_NAMES,
|
|
27
|
+
RESERVED_ENV_VAR_PREFIX,
|
|
28
|
+
appliesToAgent,
|
|
29
|
+
appliesToSetup,
|
|
30
|
+
containsInputToken,
|
|
31
|
+
envVarAppliesValues,
|
|
32
|
+
envVarSpecSchema,
|
|
33
|
+
envVarsSchema,
|
|
34
|
+
isReservedEnvVarName,
|
|
35
|
+
isUninheritableWorkerEnvVarName,
|
|
36
|
+
storedEnvVarsSchema
|
|
37
|
+
};
|
package/dist/eslint.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint plugin for pipeline files written with `@scarn/sdk/pipelines`.
|
|
3
|
+
*
|
|
4
|
+
* Pipeline callbacks (`when`, `to` and `otherwise` in `.next(...)`, `.catch`
|
|
5
|
+
* and `each`'s start) run once, at build time, with references in place of
|
|
6
|
+
* values. `.partial(args)` takes no callback; its args are checked as part of
|
|
7
|
+
* the `.next(...)` callback that builds them. JavaScript logic on a reference doesn't branch at run time, so
|
|
8
|
+
* `no-logic-in-pipeline-callbacks` reports `?:`, `&&`, `||`, `??`, `!`,
|
|
9
|
+
* comparisons and `if` statements written directly in such a callback.
|
|
10
|
+
*
|
|
11
|
+
* Scope:
|
|
12
|
+
* - Only the callback's own body is checked. Functions nested inside it, such
|
|
13
|
+
* as the item callbacks of `some`, `every` and `none`, are not.
|
|
14
|
+
* - `.catch` is only treated as a pipeline call with two arguments (`on`,
|
|
15
|
+
* `target`), so a Promise's one-argument `.catch(handler)` isn't reported.
|
|
16
|
+
* - `.next` is only treated as a pipeline call with one argument: a function,
|
|
17
|
+
* or an object literal with `routes` / `otherwise`. An iterator's
|
|
18
|
+
* `.next()` or `.next(value)` isn't reported.
|
|
19
|
+
* - `each` must be called as a plain identifier with an array reference and a
|
|
20
|
+
* start callback; a method named `each` isn't reported.
|
|
21
|
+
*
|
|
22
|
+
* Usage (flat config):
|
|
23
|
+
* ```js
|
|
24
|
+
* import scarn from "@scarn/sdk/eslint";
|
|
25
|
+
* export default [scarn.configs.recommended];
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* The plugin has no runtime dependencies; `eslint` is only a type import.
|
|
29
|
+
*/
|
|
30
|
+
import type { Linter, Rule } from "eslint";
|
|
31
|
+
declare const rule: Rule.RuleModule;
|
|
32
|
+
declare const plugin: {
|
|
33
|
+
meta: {
|
|
34
|
+
name: string;
|
|
35
|
+
};
|
|
36
|
+
rules: {
|
|
37
|
+
"no-logic-in-pipeline-callbacks": Rule.RuleModule;
|
|
38
|
+
};
|
|
39
|
+
configs: Record<"recommended", Linter.Config>;
|
|
40
|
+
};
|
|
41
|
+
export { rule as noLogicInPipelineCallbacks };
|
|
42
|
+
export default plugin;
|
package/dist/eslint.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./chunk-y64skrwp.js";
|
|
3
|
+
|
|
4
|
+
// src/eslint.ts
|
|
5
|
+
var comparisonOperators = new Set([
|
|
6
|
+
"<",
|
|
7
|
+
">",
|
|
8
|
+
"<=",
|
|
9
|
+
">=",
|
|
10
|
+
"==",
|
|
11
|
+
"===",
|
|
12
|
+
"!=",
|
|
13
|
+
"!=="
|
|
14
|
+
]);
|
|
15
|
+
function isFunction(node) {
|
|
16
|
+
return node?.type === "ArrowFunctionExpression" || node?.type === "FunctionExpression";
|
|
17
|
+
}
|
|
18
|
+
function propertyNamed(object, name) {
|
|
19
|
+
if (object?.type !== "ObjectExpression") {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
for (const property of object.properties) {
|
|
23
|
+
if (property.type === "Property" && !property.computed && (property.key.type === "Identifier" && property.key.name === name || property.key.type === "Literal" && property.key.value === name)) {
|
|
24
|
+
return property.value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
function nextCallbacks(arg) {
|
|
30
|
+
if (isFunction(arg)) {
|
|
31
|
+
return [arg];
|
|
32
|
+
}
|
|
33
|
+
const routes = propertyNamed(arg, "routes");
|
|
34
|
+
const otherwise = propertyNamed(arg, "otherwise");
|
|
35
|
+
if (routes === undefined && otherwise === undefined) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const fromRoutes = routes?.type === "ArrayExpression" ? routes.elements.flatMap((route) => route === null || route.type === "SpreadElement" ? [] : [propertyNamed(route, "when"), propertyNamed(route, "to")]) : [];
|
|
39
|
+
return [...fromRoutes, otherwise].filter((node) => isFunction(node));
|
|
40
|
+
}
|
|
41
|
+
function pipelineCallbacks(call) {
|
|
42
|
+
const { callee } = call;
|
|
43
|
+
const args = call.arguments;
|
|
44
|
+
if (callee.type === "Identifier" && callee.name === "each") {
|
|
45
|
+
const start = args.at(-1);
|
|
46
|
+
return args.length >= 2 && isFunction(start) ? [start] : [];
|
|
47
|
+
}
|
|
48
|
+
if (callee.type !== "MemberExpression" || callee.computed || callee.property.type !== "Identifier") {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
const method = callee.property.name;
|
|
52
|
+
if (method === "next" && args.length === 1) {
|
|
53
|
+
return nextCallbacks(args[0]);
|
|
54
|
+
}
|
|
55
|
+
if (method === "catch" && args.length === 2) {
|
|
56
|
+
return isFunction(args[1]) ? [args[1]] : [];
|
|
57
|
+
}
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
var rule = {
|
|
61
|
+
meta: {
|
|
62
|
+
type: "problem",
|
|
63
|
+
docs: {
|
|
64
|
+
description: "Disallow JavaScript logic inside pipeline callbacks, which run once at build time on references"
|
|
65
|
+
},
|
|
66
|
+
schema: [],
|
|
67
|
+
messages: {
|
|
68
|
+
logic: "{{kind}} in a pipeline callback runs once at build time on a reference, not at run time. Branch with `.next({ routes: [{ when, to }] })` and a condition helper (`equal`, `all`, `not`, ...) instead."
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
create(context) {
|
|
72
|
+
const callbacks = new WeakSet;
|
|
73
|
+
function report(node, kind) {
|
|
74
|
+
let current = node.parent;
|
|
75
|
+
while (current !== null) {
|
|
76
|
+
if (current.type === "ArrowFunctionExpression" || current.type === "FunctionExpression" || current.type === "FunctionDeclaration") {
|
|
77
|
+
if (callbacks.has(current)) {
|
|
78
|
+
context.report({ node, messageId: "logic", data: { kind } });
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
current = current.parent;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
CallExpression(node) {
|
|
87
|
+
for (const callback of pipelineCallbacks(node)) {
|
|
88
|
+
callbacks.add(callback);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
ConditionalExpression(node) {
|
|
92
|
+
report(node, "A conditional (`?:`)");
|
|
93
|
+
},
|
|
94
|
+
LogicalExpression(node) {
|
|
95
|
+
report(node, `\`${node.operator}\``);
|
|
96
|
+
},
|
|
97
|
+
BinaryExpression(node) {
|
|
98
|
+
if (comparisonOperators.has(node.operator)) {
|
|
99
|
+
report(node, `A comparison (\`${node.operator}\`)`);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
UnaryExpression(node) {
|
|
103
|
+
if (node.operator === "!") {
|
|
104
|
+
report(node, "`!`");
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
IfStatement(node) {
|
|
108
|
+
report(node, "An `if` statement");
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
var plugin = {
|
|
114
|
+
meta: { name: "@scarn/sdk/eslint" },
|
|
115
|
+
rules: { "no-logic-in-pipeline-callbacks": rule },
|
|
116
|
+
configs: {}
|
|
117
|
+
};
|
|
118
|
+
plugin.configs.recommended = {
|
|
119
|
+
name: "@scarn/sdk/eslint/recommended",
|
|
120
|
+
plugins: { scarn: plugin },
|
|
121
|
+
rules: { "scarn/no-logic-in-pipeline-callbacks": "error" }
|
|
122
|
+
};
|
|
123
|
+
var eslint_default = plugin;
|
|
124
|
+
export {
|
|
125
|
+
eslint_default as default,
|
|
126
|
+
rule as noLogicInPipelineCallbacks
|
|
127
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { Auth } from '../core/auth.gen';
|
|
2
|
+
export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
|
|
3
|
+
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
|
|
4
|
+
export { buildClientParams } from '../core/params.gen';
|
|
5
|
+
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
|
|
6
|
+
export { createClient } from './client.gen';
|
|
7
|
+
export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from './types.gen';
|
|
8
|
+
export { createConfig, mergeHeaders } from './utils.gen';
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { Auth } from '../core/auth.gen';
|
|
2
|
+
import type { ServerSentEventsOptions, ServerSentEventsResult } from '../core/serverSentEvents.gen';
|
|
3
|
+
import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen';
|
|
4
|
+
import type { Middleware } from './utils.gen';
|
|
5
|
+
export type ResponseStyle = 'data' | 'fields';
|
|
6
|
+
export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, CoreConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Base URL for all requests made by this client.
|
|
9
|
+
*/
|
|
10
|
+
baseUrl?: T['baseUrl'];
|
|
11
|
+
/**
|
|
12
|
+
* Fetch API implementation. You can use this option to provide a custom
|
|
13
|
+
* fetch instance.
|
|
14
|
+
*
|
|
15
|
+
* @default globalThis.fetch
|
|
16
|
+
*/
|
|
17
|
+
fetch?: typeof fetch;
|
|
18
|
+
/**
|
|
19
|
+
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
20
|
+
* options won't have any effect.
|
|
21
|
+
*
|
|
22
|
+
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
23
|
+
*/
|
|
24
|
+
next?: never;
|
|
25
|
+
/**
|
|
26
|
+
* Return the response data parsed in a specified format. By default, `auto`
|
|
27
|
+
* will infer the appropriate method from the `Content-Type` response header.
|
|
28
|
+
* You can override this behavior with any of the {@link Body} methods.
|
|
29
|
+
* Select `stream` if you don't want to parse response data at all.
|
|
30
|
+
*
|
|
31
|
+
* @default 'auto'
|
|
32
|
+
*/
|
|
33
|
+
parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
34
|
+
/**
|
|
35
|
+
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
36
|
+
*
|
|
37
|
+
* @default 'fields'
|
|
38
|
+
*/
|
|
39
|
+
responseStyle?: ResponseStyle;
|
|
40
|
+
/**
|
|
41
|
+
* Throw an error instead of returning it in the response?
|
|
42
|
+
*
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
throwOnError?: T['throwOnError'];
|
|
46
|
+
}
|
|
47
|
+
export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
48
|
+
responseStyle: TResponseStyle;
|
|
49
|
+
throwOnError: ThrowOnError;
|
|
50
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
51
|
+
/**
|
|
52
|
+
* Any body that you want to add to your request.
|
|
53
|
+
*
|
|
54
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
55
|
+
*/
|
|
56
|
+
body?: unknown;
|
|
57
|
+
path?: Record<string, unknown>;
|
|
58
|
+
query?: Record<string, unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Security mechanism(s) to use for the request.
|
|
61
|
+
*/
|
|
62
|
+
security?: ReadonlyArray<Auth>;
|
|
63
|
+
url: Url;
|
|
64
|
+
}
|
|
65
|
+
export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
66
|
+
serializedBody?: string;
|
|
67
|
+
}
|
|
68
|
+
export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
|
|
69
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
70
|
+
request: Request;
|
|
71
|
+
response: Response;
|
|
72
|
+
}> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
73
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
74
|
+
error: undefined;
|
|
75
|
+
} | {
|
|
76
|
+
data: undefined;
|
|
77
|
+
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
78
|
+
}) & {
|
|
79
|
+
request: Request;
|
|
80
|
+
response: Response;
|
|
81
|
+
}>;
|
|
82
|
+
export interface ClientOptions {
|
|
83
|
+
baseUrl?: string;
|
|
84
|
+
responseStyle?: ResponseStyle;
|
|
85
|
+
throwOnError?: boolean;
|
|
86
|
+
}
|
|
87
|
+
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
88
|
+
type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
89
|
+
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
90
|
+
type BuildUrlFn = <TData extends {
|
|
91
|
+
body?: unknown;
|
|
92
|
+
path?: Record<string, unknown>;
|
|
93
|
+
query?: Record<string, unknown>;
|
|
94
|
+
url: string;
|
|
95
|
+
}>(options: TData & Options<TData>) => string;
|
|
96
|
+
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
97
|
+
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* The `createClientConfig()` function will be called on client initialization
|
|
101
|
+
* and the returned object will become the client's initial configuration.
|
|
102
|
+
*
|
|
103
|
+
* You may want to initialize your client this way instead of calling
|
|
104
|
+
* `setConfig()`. This is useful for example if you're using Next.js
|
|
105
|
+
* to ensure your client always has the correct values.
|
|
106
|
+
*/
|
|
107
|
+
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
|
|
108
|
+
export interface TDataShape {
|
|
109
|
+
body?: unknown;
|
|
110
|
+
headers?: unknown;
|
|
111
|
+
path?: unknown;
|
|
112
|
+
query?: unknown;
|
|
113
|
+
url: string;
|
|
114
|
+
}
|
|
115
|
+
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
116
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
117
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { QuerySerializerOptions } from '../core/bodySerializer.gen';
|
|
2
|
+
import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
|
|
3
|
+
export declare const createQuerySerializer: <T = unknown>({ parameters, ...args }?: QuerySerializerOptions) => (queryParams: T) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Infers parseAs value from provided Content-Type header.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getParseAs: (contentType: string | null) => Exclude<Config["parseAs"], "auto">;
|
|
8
|
+
export declare const setAuthParams: ({ security, ...options }: Pick<Required<RequestOptions>, "security"> & Pick<RequestOptions, "auth" | "query"> & {
|
|
9
|
+
headers: Headers;
|
|
10
|
+
}) => Promise<void>;
|
|
11
|
+
export declare const buildUrl: Client['buildUrl'];
|
|
12
|
+
export declare const mergeConfigs: (a: Config, b: Config) => Config;
|
|
13
|
+
export declare const mergeHeaders: (...headers: Array<Required<Config>["headers"] | undefined>) => Headers;
|
|
14
|
+
type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
|
|
15
|
+
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
16
|
+
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
17
|
+
declare class Interceptors<Interceptor> {
|
|
18
|
+
fns: Array<Interceptor | null>;
|
|
19
|
+
clear(): void;
|
|
20
|
+
eject(id: number | Interceptor): void;
|
|
21
|
+
exists(id: number | Interceptor): boolean;
|
|
22
|
+
getInterceptorIndex(id: number | Interceptor): number;
|
|
23
|
+
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
24
|
+
use(fn: Interceptor): number;
|
|
25
|
+
}
|
|
26
|
+
export interface Middleware<Req, Res, Err, Options> {
|
|
27
|
+
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
|
|
28
|
+
request: Interceptors<ReqInterceptor<Req, Options>>;
|
|
29
|
+
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
|
30
|
+
}
|
|
31
|
+
export declare const createInterceptors: <Req, Res, Err, Options>() => Middleware<Req, Res, Err, Options>;
|
|
32
|
+
export declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ClientOptions, type Config } from './client';
|
|
2
|
+
import type { ClientOptions as ClientOptions2 } from './types.gen';
|
|
3
|
+
/**
|
|
4
|
+
* The `createClientConfig()` function will be called on client initialization
|
|
5
|
+
* and the returned object will become the client's initial configuration.
|
|
6
|
+
*
|
|
7
|
+
* You may want to initialize your client this way instead of calling
|
|
8
|
+
* `setConfig()`. This is useful for example if you're using Next.js
|
|
9
|
+
* to ensure your client always has the correct values.
|
|
10
|
+
*/
|
|
11
|
+
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
|
|
12
|
+
export declare const client: import("./client").Client;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type AuthToken = string | undefined;
|
|
2
|
+
export interface Auth {
|
|
3
|
+
/**
|
|
4
|
+
* Which part of the request do we use to send the auth?
|
|
5
|
+
*
|
|
6
|
+
* @default 'header'
|
|
7
|
+
*/
|
|
8
|
+
in?: 'header' | 'query' | 'cookie';
|
|
9
|
+
/**
|
|
10
|
+
* Header or query parameter name.
|
|
11
|
+
*
|
|
12
|
+
* @default 'Authorization'
|
|
13
|
+
*/
|
|
14
|
+
name?: string;
|
|
15
|
+
scheme?: 'basic' | 'bearer';
|
|
16
|
+
type: 'apiKey' | 'http';
|
|
17
|
+
}
|
|
18
|
+
export declare const getAuthToken: (auth: Auth, callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken) => Promise<string | undefined>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen';
|
|
2
|
+
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
3
|
+
export type BodySerializer = (body: any) => any;
|
|
4
|
+
type QuerySerializerOptionsObject = {
|
|
5
|
+
allowReserved?: boolean;
|
|
6
|
+
array?: Partial<SerializerOptions<ArrayStyle>>;
|
|
7
|
+
object?: Partial<SerializerOptions<ObjectStyle>>;
|
|
8
|
+
};
|
|
9
|
+
export type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
|
10
|
+
/**
|
|
11
|
+
* Per-parameter serialization overrides. When provided, these settings
|
|
12
|
+
* override the global array/object settings for specific parameter names.
|
|
13
|
+
*/
|
|
14
|
+
parameters?: Record<string, QuerySerializerOptionsObject>;
|
|
15
|
+
};
|
|
16
|
+
export declare const formDataBodySerializer: {
|
|
17
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => FormData;
|
|
18
|
+
};
|
|
19
|
+
export declare const jsonBodySerializer: {
|
|
20
|
+
bodySerializer: <T>(body: T) => string;
|
|
21
|
+
};
|
|
22
|
+
export declare const urlSearchParamsBodySerializer: {
|
|
23
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => string;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type Slot = 'body' | 'headers' | 'path' | 'query';
|
|
2
|
+
export type Field = {
|
|
3
|
+
in: Exclude<Slot, 'body'>;
|
|
4
|
+
/**
|
|
5
|
+
* Field name. This is the name we want the user to see and use.
|
|
6
|
+
*/
|
|
7
|
+
key: string;
|
|
8
|
+
/**
|
|
9
|
+
* Field mapped name. This is the name we want to use in the request.
|
|
10
|
+
* If omitted, we use the same value as `key`.
|
|
11
|
+
*/
|
|
12
|
+
map?: string;
|
|
13
|
+
} | {
|
|
14
|
+
in: Extract<Slot, 'body'>;
|
|
15
|
+
/**
|
|
16
|
+
* Key isn't required for bodies.
|
|
17
|
+
*/
|
|
18
|
+
key?: string;
|
|
19
|
+
map?: string;
|
|
20
|
+
} | {
|
|
21
|
+
/**
|
|
22
|
+
* Field name. This is the name we want the user to see and use.
|
|
23
|
+
*/
|
|
24
|
+
key: string;
|
|
25
|
+
/**
|
|
26
|
+
* Field mapped name. This is the name we want to use in the request.
|
|
27
|
+
* If `in` is omitted, `map` aliases `key` to the transport layer.
|
|
28
|
+
*/
|
|
29
|
+
map: Slot;
|
|
30
|
+
};
|
|
31
|
+
export interface Fields {
|
|
32
|
+
allowExtra?: Partial<Record<Slot, boolean>>;
|
|
33
|
+
args?: ReadonlyArray<Field>;
|
|
34
|
+
}
|
|
35
|
+
export type FieldsConfig = ReadonlyArray<Field | Fields>;
|
|
36
|
+
interface Params {
|
|
37
|
+
body: unknown;
|
|
38
|
+
headers: Record<string, unknown>;
|
|
39
|
+
path: Record<string, unknown>;
|
|
40
|
+
query: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export declare const buildClientParams: (args: ReadonlyArray<unknown>, fields: FieldsConfig) => Params;
|
|
43
|
+
export {};
|