@intentius/chant-lexicon-cedar 0.44.14 → 0.46.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 -4
- package/dist/avp/client.d.ts +18 -0
- package/dist/avp/client.d.ts.map +1 -1
- package/dist/codegen/docs.d.ts +5 -9
- package/dist/codegen/docs.d.ts.map +1 -1
- package/dist/codegen/generate.d.ts +35 -8
- package/dist/codegen/generate.d.ts.map +1 -1
- package/dist/commands.d.ts +14 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/config.d.ts +38 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/init-templates.d.ts +1 -1
- package/dist/integrity.json +4 -4
- package/dist/lint/post-synth/cede010.d.ts +5 -4
- package/dist/lint/post-synth/cede010.d.ts.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/rules/cede010.ts +5 -4
- package/dist/schema-artifact.d.ts +50 -0
- package/dist/schema-artifact.d.ts.map +1 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/skills/chant-cedar-authoring.md +9 -3
- package/dist/spec/fetch.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/avp/OWNERSHIP.md +4 -1
- package/src/avp/client.test.ts +35 -0
- package/src/avp/client.ts +29 -2
- package/src/codegen/docs.ts +5 -799
- package/src/codegen/generate-cli.ts +8 -6
- package/src/codegen/generate.ts +63 -14
- package/src/codegen/output-dir.test.ts +137 -0
- package/src/commands.test.ts +93 -0
- package/src/commands.ts +95 -0
- package/src/config.ts +50 -4
- package/src/index.ts +10 -2
- package/src/init-templates.test.ts +22 -4
- package/src/init-templates.ts +16 -16
- package/src/lint/post-synth/cede010.ts +5 -4
- package/src/plugin.ts +33 -8
- package/src/schema-artifact.test.ts +160 -0
- package/src/schema-artifact.ts +87 -0
- package/src/serializer.ts +17 -1
- package/src/skills/chant-cedar-authoring.md +9 -3
- package/src/spec/fetch.ts +23 -2
- package/dist/codegen/docs-dogwood.d.ts +0 -21
- package/dist/codegen/docs-dogwood.d.ts.map +0 -1
- package/src/codegen/docs-dogwood.ts +0 -1119
package/src/avp/client.ts
CHANGED
|
@@ -45,6 +45,15 @@
|
|
|
45
45
|
* signing against one would make every local lane need credentials to read
|
|
46
46
|
* what it just deployed. `signEndpointOverride` opts back in for an
|
|
47
47
|
* override that *is* real AWS — a VPC endpoint, a signing proxy.
|
|
48
|
+
*
|
|
49
|
+
* What counts as an override is {@link resolveEndpointOverride}: the
|
|
50
|
+
* `endpoint` option, else `AWS_ENDPOINT_URL_VERIFIEDPERMISSIONS`, else
|
|
51
|
+
* `AWS_ENDPOINT_URL` — the AWS SDK's own precedence, and the same rule the aws
|
|
52
|
+
* lexicon's `api/read-client.ts` applies to every transport it owns (#1694).
|
|
53
|
+
* It is restated here rather than imported for the reason above: cedar does
|
|
54
|
+
* not depend on the aws lexicon, and a lexicon build compiles against the
|
|
55
|
+
* published core, so a helper hoisted into core would reach neither lexicon
|
|
56
|
+
* until the next core release.
|
|
48
57
|
*/
|
|
49
58
|
|
|
50
59
|
const DEFAULT_REGION = "us-east-1";
|
|
@@ -166,6 +175,24 @@ export function avpUrl(endpoint?: string, region = DEFAULT_REGION): string {
|
|
|
166
175
|
return `${(endpoint ?? `https://${SERVICE}.${region}.amazonaws.com`).replace(/\/$/, "")}/`;
|
|
167
176
|
}
|
|
168
177
|
|
|
178
|
+
/** The service-specific endpoint variable the AWS SDK reads for Verified Permissions. */
|
|
179
|
+
const SERVICE_ENDPOINT_ENV_VAR = "AWS_ENDPOINT_URL_VERIFIEDPERMISSIONS";
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The one rule for what an endpoint override is (#1694): the `endpoint`
|
|
183
|
+
* option when given, else `AWS_ENDPOINT_URL_VERIFIEDPERMISSIONS`, else the
|
|
184
|
+
* ambient `AWS_ENDPOINT_URL`. The result is both the target and, through
|
|
185
|
+
* {@link requestHeaders}, the fact that decides whether the request is signed.
|
|
186
|
+
* Returns `undefined` for real AWS. Mirrors the aws lexicon's
|
|
187
|
+
* `resolveEndpointOverride` for this one service.
|
|
188
|
+
*/
|
|
189
|
+
export function resolveEndpointOverride(
|
|
190
|
+
endpoint: string | undefined,
|
|
191
|
+
env: Record<string, string | undefined> = process.env,
|
|
192
|
+
): string | undefined {
|
|
193
|
+
return endpoint || env[SERVICE_ENDPOINT_ENV_VAR] || env.AWS_ENDPOINT_URL || undefined;
|
|
194
|
+
}
|
|
195
|
+
|
|
169
196
|
/**
|
|
170
197
|
* Whether this process has anything to authenticate with.
|
|
171
198
|
*
|
|
@@ -176,7 +203,7 @@ export function avpUrl(endpoint?: string, region = DEFAULT_REGION): string {
|
|
|
176
203
|
*/
|
|
177
204
|
export function credentialsAvailable(env: Record<string, string | undefined> = process.env): boolean {
|
|
178
205
|
return Boolean(
|
|
179
|
-
env
|
|
206
|
+
resolveEndpointOverride(undefined, env) ||
|
|
180
207
|
env.AWS_ACCESS_KEY_ID ||
|
|
181
208
|
env.AWS_PROFILE ||
|
|
182
209
|
env.AWS_SESSION_TOKEN ||
|
|
@@ -256,7 +283,7 @@ export async function avpCall(
|
|
|
256
283
|
): Promise<Record<string, unknown>> {
|
|
257
284
|
const env = options.env ?? process.env;
|
|
258
285
|
const http = options.http ?? defaultHttp;
|
|
259
|
-
const endpoint = options.endpoint
|
|
286
|
+
const endpoint = resolveEndpointOverride(options.endpoint, env);
|
|
260
287
|
const url = avpUrl(endpoint, options.region);
|
|
261
288
|
const payloadJson = JSON.stringify(payload);
|
|
262
289
|
const res = await http(
|