@digitraffic/common 2024.8.16-1 → 2024.8.30-1
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/{test/asserter.mjs → __test__/asserter.js} +3 -3
- package/dist/{test/db-testutils.d.mts → __test__/db-testutils.d.ts} +1 -1
- package/dist/{test/db-testutils.mjs → __test__/db-testutils.js} +4 -3
- package/dist/__test__/{dependencies.test.mjs → dependencies.test.js} +1 -1
- package/dist/__test__/{imports.test.mjs → imports.test.js} +79 -79
- package/dist/__test__/infra/{acl-builder.test.mjs → acl-builder.test.js} +4 -4
- package/dist/__test__/infra/api/{handler-factory.test.mjs → handler-factory.test.js} +3 -4
- package/dist/__test__/infra/api/{response.test.mjs → response.test.js} +3 -11
- package/dist/__test__/infra/api/{static-integration.test.mjs → static-integration.test.js} +3 -3
- package/dist/__test__/infra/{documentation.test.mjs → documentation.test.js} +2 -2
- package/dist/__test__/infra/{scheduler.test.mjs → scheduler.test.js} +2 -2
- package/dist/__test__/infra/{security-rule.test.mjs → security-rule.test.js} +2 -2
- package/dist/__test__/marine/{id_utils.test.mjs → id_utils.test.js} +3 -3
- package/dist/{test/mock-ky.mjs → __test__/mock-ky.js} +1 -1
- package/dist/__test__/promise/{promise.test.mjs → promise.test.js} +9 -13
- package/dist/__test__/runtime/{dt-logger.test.mjs → dt-logger.test.js} +7 -7
- package/dist/__test__/secrets/{secret-holder.test.mjs → secret-holder.test.js} +6 -4
- package/dist/__test__/secrets/{secret.test.mjs → secret.test.js} +4 -2
- package/dist/__test__/stack/{rest-apis.test.mjs → rest-apis.test.js} +4 -4
- package/dist/__test__/test/{mock-ky.test.mjs → mock-ky.test.js} +3 -3
- package/dist/{test/testutils.mjs → __test__/testutils.js} +1 -2
- package/dist/__test__/types/{lambda-response.test.mjs → lambda-response.test.js} +2 -2
- package/dist/__test__/utils/{date-utils.test.mjs → date-utils.test.js} +3 -3
- package/dist/__test__/utils/{geometry.test.mjs → geometry.test.js} +3 -3
- package/dist/__test__/utils/{logging.test.mjs → logging.test.js} +4 -4
- package/dist/__test__/utils/{utils.test.mjs → utils.test.js} +2 -3
- package/dist/aws/infra/{acl-builder.d.mts → acl-builder.d.ts} +15 -8
- package/dist/aws/infra/{acl-builder.mjs → acl-builder.js} +77 -55
- package/dist/aws/infra/api/{handler-factory.d.mts → handler-factory.d.ts} +4 -4
- package/dist/aws/infra/api/{handler-factory.mjs → handler-factory.js} +7 -5
- package/dist/aws/infra/api/{integration.d.mts → integration.d.ts} +3 -1
- package/dist/aws/infra/api/{integration.mjs → integration.js} +31 -13
- package/dist/aws/infra/api/{response.d.mts → response.d.ts} +2 -2
- package/dist/aws/infra/api/{response.mjs → response.js} +4 -4
- package/dist/aws/infra/api/{responses.d.mts → responses.d.ts} +3 -3
- package/dist/aws/infra/api/{responses.mjs → responses.js} +4 -6
- package/dist/aws/infra/api/{static-integration.d.mts → static-integration.d.ts} +3 -9
- package/dist/aws/infra/api/{static-integration.mjs → static-integration.js} +3 -3
- package/dist/aws/infra/canaries/canary-alarm.d.ts +6 -0
- package/dist/aws/infra/canaries/{canary-alarm.mjs → canary-alarm.js} +1 -3
- package/dist/aws/infra/canaries/{canary-keys.mjs → canary-keys.js} +1 -1
- package/dist/aws/infra/canaries/{canary-parameters.d.mts → canary-parameters.d.ts} +1 -1
- package/dist/aws/infra/canaries/canary-parameters.js +2 -0
- package/dist/aws/infra/canaries/{canary-role.d.mts → canary-role.d.ts} +1 -1
- package/dist/aws/infra/canaries/{canary-role.mjs → canary-role.js} +2 -5
- package/dist/aws/infra/canaries/{canary.d.mts → canary.d.ts} +4 -4
- package/dist/aws/infra/canaries/{canary.mjs → canary.js} +3 -4
- package/dist/aws/infra/canaries/{database-canary.d.mts → database-canary.d.ts} +4 -5
- package/dist/aws/infra/canaries/{database-canary.mjs → database-canary.js} +4 -11
- package/dist/aws/infra/canaries/{database-checker.d.mts → database-checker.d.ts} +5 -5
- package/dist/aws/infra/canaries/{database-checker.mjs → database-checker.js} +15 -12
- package/dist/aws/infra/canaries/{url-canary.d.mts → url-canary.d.ts} +5 -5
- package/dist/aws/infra/canaries/{url-canary.mjs → url-canary.js} +7 -12
- package/dist/aws/infra/canaries/{url-checker.d.mts → url-checker.d.ts} +2 -2
- package/dist/aws/infra/canaries/{url-checker.mjs → url-checker.js} +12 -21
- package/dist/aws/infra/{documentation.d.mts → documentation.d.ts} +2 -2
- package/dist/aws/infra/{documentation.mjs → documentation.js} +4 -3
- package/dist/aws/infra/{import-util.d.mts → import-util.d.ts} +2 -2
- package/dist/aws/infra/{import-util.mjs → import-util.js} +3 -3
- package/dist/aws/infra/{scheduler.d.mts → scheduler.d.ts} +2 -2
- package/dist/aws/infra/{scheduler.mjs → scheduler.js} +1 -3
- package/dist/aws/infra/{security-rule.d.mts → security-rule.d.ts} +1 -1
- package/dist/aws/infra/{security-rule.mjs → security-rule.js} +1 -2
- package/dist/aws/infra/{sqs-integration.d.mts → sqs-integration.d.ts} +3 -3
- package/dist/aws/infra/{sqs-integration.mjs → sqs-integration.js} +3 -7
- package/dist/aws/infra/{sqs-queue.d.mts → sqs-queue.d.ts} +1 -1
- package/dist/aws/infra/{sqs-queue.mjs → sqs-queue.js} +19 -19
- package/dist/aws/infra/stack/{lambda-configs.d.mts → lambda-configs.d.ts} +4 -4
- package/dist/aws/infra/stack/{lambda-configs.mjs → lambda-configs.js} +3 -7
- package/dist/aws/infra/stack/{monitoredfunction.d.mts → monitoredfunction.d.ts} +15 -15
- package/dist/aws/infra/stack/{monitoredfunction.mjs → monitoredfunction.js} +42 -43
- package/dist/aws/infra/stack/{parameters.mjs → parameters.js} +1 -1
- package/dist/aws/infra/stack/{rest_apis.d.mts → rest_apis.d.ts} +12 -6
- package/dist/aws/infra/stack/{rest_apis.mjs → rest_apis.js} +26 -24
- package/dist/aws/infra/stack/{stack-checking-aspect.mjs → stack-checking-aspect.js} +7 -2
- package/dist/aws/infra/stack/{stack.d.mts → stack.d.ts} +4 -4
- package/dist/aws/infra/stack/{stack.mjs → stack.js} +2 -5
- package/dist/aws/infra/stack/{subscription.d.mts → subscription.d.ts} +4 -4
- package/dist/aws/infra/stack/{subscription.mjs → subscription.js} +2 -6
- package/dist/aws/infra/stacks/{db-dns-stack.d.mts → db-dns-stack.d.ts} +1 -1
- package/dist/aws/infra/stacks/{db-dns-stack.mjs → db-dns-stack.js} +4 -4
- package/dist/aws/infra/stacks/{db-proxy-stack.d.mts → db-proxy-stack.d.ts} +2 -2
- package/dist/aws/infra/stacks/{db-proxy-stack.mjs → db-proxy-stack.js} +5 -6
- package/dist/aws/infra/stacks/{db-stack.d.mts → db-stack.d.ts} +4 -4
- package/dist/aws/infra/stacks/{db-stack.mjs → db-stack.js} +7 -10
- package/dist/aws/infra/stacks/intra-stack-configuration.js +2 -0
- package/dist/aws/infra/stacks/{network-stack.d.mts → network-stack.d.ts} +2 -2
- package/dist/aws/infra/stacks/{network-stack.mjs → network-stack.js} +4 -7
- package/dist/aws/infra/{usage-plans.d.mts → usage-plans.d.ts} +1 -1
- package/dist/aws/infra/{usage-plans.mjs → usage-plans.js} +1 -2
- package/dist/aws/runtime/{apikey.mjs → apikey.js} +1 -1
- package/dist/aws/runtime/{digitraffic-integration-response.d.mts → digitraffic-integration-response.d.ts} +1 -1
- package/dist/aws/runtime/{digitraffic-integration-response.mjs → digitraffic-integration-response.js} +4 -6
- package/dist/aws/runtime/{dt-logger-default.d.mts → dt-logger-default.d.ts} +2 -2
- package/dist/aws/runtime/{dt-logger-default.mjs → dt-logger-default.js} +2 -2
- package/dist/aws/runtime/{dt-logger.mjs → dt-logger.js} +9 -4
- package/dist/aws/runtime/{environment.mjs → environment.js} +2 -2
- package/dist/aws/runtime/{s3.d.mts → s3.d.ts} +1 -1
- package/dist/aws/runtime/{s3.mjs → s3.js} +3 -3
- package/dist/aws/runtime/secrets/{dbsecret.d.mts → dbsecret.d.ts} +1 -1
- package/dist/aws/runtime/secrets/{dbsecret.mjs → dbsecret.js} +6 -2
- package/dist/aws/runtime/secrets/proxy-holder.js +25 -0
- package/dist/aws/runtime/secrets/rds-holder.js +25 -0
- package/dist/aws/runtime/secrets/{secret-holder.d.mts → secret-holder.d.ts} +6 -5
- package/dist/aws/runtime/secrets/{secret-holder.mjs → secret-holder.js} +11 -12
- package/dist/aws/runtime/secrets/{secret.mjs → secret.js} +7 -3
- package/dist/aws/types/{errors.mjs → errors.js} +1 -1
- package/dist/aws/types/{lambda-response.mjs → lambda-response.js} +1 -1
- package/dist/aws/types/{mediatypes.mjs → mediatypes.js} +1 -1
- package/dist/aws/types/{model-with-reference.d.mts → model-with-reference.d.ts} +1 -1
- package/dist/aws/types/model-with-reference.js +2 -0
- package/dist/aws/types/proxytypes.js +2 -0
- package/dist/aws/types/tags.js +4 -0
- package/dist/database/{cached.d.mts → cached.d.ts} +1 -1
- package/dist/database/{cached.mjs → cached.js} +2 -4
- package/dist/database/{database.mjs → database.js} +4 -8
- package/dist/database/{last-updated.d.mts → last-updated.d.ts} +1 -1
- package/dist/database/{last-updated.mjs → last-updated.js} +3 -1
- package/dist/database/models.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/marine/{id_utils.mjs → id_utils.js} +2 -2
- package/dist/marine/rtz.js +2 -0
- package/dist/types/{async-timeout-error.mjs → async-timeout-error.js} +1 -1
- package/dist/types/aws-env.js +2 -0
- package/dist/types/either.js +2 -0
- package/dist/types/{http-error.mjs → http-error.js} +1 -1
- package/dist/types/{input-error.mjs → input-error.js} +1 -1
- package/dist/types/{language.mjs → language.js} +1 -1
- package/dist/types/{nullable.d.mts → nullable.d.ts} +1 -1
- package/dist/types/nullable.js +2 -0
- package/dist/types/openapi-schema.d.ts +4342 -0
- package/dist/types/openapi-schema.js +134 -0
- package/dist/types/{traffictype.mjs → traffictype.js} +1 -1
- package/dist/types/urn.js +2 -0
- package/dist/types/util-types.js +2 -0
- package/dist/types/{validator.mjs → validator.js} +1 -1
- package/dist/utils/{api-model.d.mts → api-model.d.ts} +6 -5
- package/dist/utils/{api-model.mjs → api-model.js} +14 -15
- package/dist/utils/{base64.mjs → base64.js} +3 -3
- package/dist/utils/{date-utils.mjs → date-utils.js} +1 -1
- package/dist/utils/{geojson-types.d.mts → geojson-types.d.ts} +2 -2
- package/dist/utils/{geojson-types.mjs → geojson-types.js} +1 -1
- package/dist/utils/{geometry.d.mts → geometry.d.ts} +4 -3
- package/dist/utils/{geometry.mjs → geometry.js} +7 -4
- package/dist/utils/{logging.d.mts → logging.d.ts} +1 -1
- package/dist/utils/{logging.mjs → logging.js} +5 -8
- package/dist/utils/{retry.mjs → retry.js} +6 -8
- package/dist/utils/{slack.mjs → slack.js} +3 -3
- package/dist/utils/{utils.d.mts → utils.d.ts} +2 -3
- package/dist/utils/{utils.mjs → utils.js} +9 -5
- package/package.json +137 -131
- package/dist/aws/infra/canaries/canary-alarm.d.mts +0 -6
- package/dist/aws/infra/canaries/canary-parameters.mjs +0 -2
- package/dist/aws/infra/stacks/intra-stack-configuration.mjs +0 -2
- package/dist/aws/runtime/secrets/proxy-holder.mjs +0 -25
- package/dist/aws/runtime/secrets/rds-holder.mjs +0 -25
- package/dist/aws/types/model-with-reference.mjs +0 -2
- package/dist/aws/types/proxytypes.mjs +0 -2
- package/dist/aws/types/tags.mjs +0 -4
- package/dist/database/models.mjs +0 -2
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +0 -2
- package/dist/marine/rtz.mjs +0 -2
- package/dist/types/aws-env.mjs +0 -2
- package/dist/types/either.mjs +0 -2
- package/dist/types/nullable.mjs +0 -2
- package/dist/types/urn.mjs +0 -2
- package/dist/types/util-types.mjs +0 -2
- /package/dist/{test/asserter.d.mts → __test__/asserter.d.ts} +0 -0
- /package/dist/__test__/{dependencies.test.d.mts → dependencies.test.d.ts} +0 -0
- /package/dist/__test__/{imports.test.d.mts → imports.test.d.ts} +0 -0
- /package/dist/__test__/infra/{acl-builder.test.d.mts → acl-builder.test.d.ts} +0 -0
- /package/dist/__test__/infra/api/{handler-factory.test.d.mts → handler-factory.test.d.ts} +0 -0
- /package/dist/__test__/infra/api/{response.test.d.mts → response.test.d.ts} +0 -0
- /package/dist/__test__/infra/api/{static-integration.test.d.mts → static-integration.test.d.ts} +0 -0
- /package/dist/__test__/infra/{documentation.test.d.mts → documentation.test.d.ts} +0 -0
- /package/dist/__test__/infra/{scheduler.test.d.mts → scheduler.test.d.ts} +0 -0
- /package/dist/__test__/infra/{security-rule.test.d.mts → security-rule.test.d.ts} +0 -0
- /package/dist/__test__/marine/{id_utils.test.d.mts → id_utils.test.d.ts} +0 -0
- /package/dist/{test/mock-ky.d.mts → __test__/mock-ky.d.ts} +0 -0
- /package/dist/__test__/promise/{promise.test.d.mts → promise.test.d.ts} +0 -0
- /package/dist/__test__/runtime/{dt-logger.test.d.mts → dt-logger.test.d.ts} +0 -0
- /package/dist/__test__/secrets/{secret-holder.test.d.mts → secret-holder.test.d.ts} +0 -0
- /package/dist/__test__/secrets/{secret.test.d.mts → secret.test.d.ts} +0 -0
- /package/dist/__test__/stack/{rest-apis.test.d.mts → rest-apis.test.d.ts} +0 -0
- /package/dist/__test__/test/{mock-ky.test.d.mts → mock-ky.test.d.ts} +0 -0
- /package/dist/{test/testutils.d.mts → __test__/testutils.d.ts} +0 -0
- /package/dist/__test__/types/{lambda-response.test.d.mts → lambda-response.test.d.ts} +0 -0
- /package/dist/__test__/utils/{date-utils.test.d.mts → date-utils.test.d.ts} +0 -0
- /package/dist/__test__/utils/{geometry.test.d.mts → geometry.test.d.ts} +0 -0
- /package/dist/__test__/utils/{logging.test.d.mts → logging.test.d.ts} +0 -0
- /package/dist/__test__/utils/{utils.test.d.mts → utils.test.d.ts} +0 -0
- /package/dist/aws/infra/canaries/{canary-keys.d.mts → canary-keys.d.ts} +0 -0
- /package/dist/aws/infra/stack/{parameters.d.mts → parameters.d.ts} +0 -0
- /package/dist/aws/infra/stack/{stack-checking-aspect.d.mts → stack-checking-aspect.d.ts} +0 -0
- /package/dist/aws/infra/stacks/{intra-stack-configuration.d.mts → intra-stack-configuration.d.ts} +0 -0
- /package/dist/aws/runtime/{apikey.d.mts → apikey.d.ts} +0 -0
- /package/dist/aws/runtime/{dt-logger.d.mts → dt-logger.d.ts} +0 -0
- /package/dist/aws/runtime/{environment.d.mts → environment.d.ts} +0 -0
- /package/dist/aws/runtime/secrets/{proxy-holder.d.mts → proxy-holder.d.ts} +0 -0
- /package/dist/aws/runtime/secrets/{rds-holder.d.mts → rds-holder.d.ts} +0 -0
- /package/dist/aws/runtime/secrets/{secret.d.mts → secret.d.ts} +0 -0
- /package/dist/aws/types/{errors.d.mts → errors.d.ts} +0 -0
- /package/dist/aws/types/{lambda-response.d.mts → lambda-response.d.ts} +0 -0
- /package/dist/aws/types/{mediatypes.d.mts → mediatypes.d.ts} +0 -0
- /package/dist/aws/types/{proxytypes.d.mts → proxytypes.d.ts} +0 -0
- /package/dist/aws/types/{tags.d.mts → tags.d.ts} +0 -0
- /package/dist/database/{database.d.mts → database.d.ts} +0 -0
- /package/dist/database/{models.d.mts → models.d.ts} +0 -0
- /package/dist/marine/{id_utils.d.mts → id_utils.d.ts} +0 -0
- /package/dist/marine/{rtz.d.mts → rtz.d.ts} +0 -0
- /package/dist/types/{async-timeout-error.d.mts → async-timeout-error.d.ts} +0 -0
- /package/dist/types/{aws-env.d.mts → aws-env.d.ts} +0 -0
- /package/dist/types/{either.d.mts → either.d.ts} +0 -0
- /package/dist/types/{http-error.d.mts → http-error.d.ts} +0 -0
- /package/dist/types/{input-error.d.mts → input-error.d.ts} +0 -0
- /package/dist/types/{language.d.mts → language.d.ts} +0 -0
- /package/dist/types/{traffictype.d.mts → traffictype.d.ts} +0 -0
- /package/dist/types/{urn.d.mts → urn.d.ts} +0 -0
- /package/dist/types/{util-types.d.mts → util-types.d.ts} +0 -0
- /package/dist/types/{validator.d.mts → validator.d.ts} +0 -0
- /package/dist/utils/{base64.d.mts → base64.d.ts} +0 -0
- /package/dist/utils/{date-utils.d.mts → date-utils.d.ts} +0 -0
- /package/dist/utils/{retry.d.mts → retry.d.ts} +0 -0
- /package/dist/utils/{slack.d.mts → slack.d.ts} +0 -0
@@ -0,0 +1,134 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export const serverObject = z.object({
|
3
|
+
url: z.string(),
|
4
|
+
description: z.string().optional(),
|
5
|
+
variables: z.record(z.unknown()).optional(),
|
6
|
+
});
|
7
|
+
export const parameterObject = z.object({
|
8
|
+
name: z.string(),
|
9
|
+
in: z.enum(["query", "header", "path", "cookie"]),
|
10
|
+
description: z.string().optional(),
|
11
|
+
required: z.boolean().optional(),
|
12
|
+
deprecated: z.boolean().optional(),
|
13
|
+
allowEmptyValue: z.boolean().optional(),
|
14
|
+
style: z
|
15
|
+
.enum(["matrix", "label", "form", "simple", "spaceDelimited", "pipeDelimited", "deepObject"])
|
16
|
+
.optional(),
|
17
|
+
explode: z.string().optional(),
|
18
|
+
allowReserved: z.boolean().optional(),
|
19
|
+
schema: z.unknown().optional(),
|
20
|
+
example: z.unknown().optional(),
|
21
|
+
examples: z.record(z.unknown()).optional(),
|
22
|
+
content: z.record(z.unknown()).optional(),
|
23
|
+
});
|
24
|
+
export const referenceObject = z.object({
|
25
|
+
$ref: z.string(),
|
26
|
+
summary: z.string().optional(),
|
27
|
+
description: z.string().optional(),
|
28
|
+
});
|
29
|
+
export const openapiOperation = z
|
30
|
+
.object({
|
31
|
+
tags: z.array(z.string()),
|
32
|
+
summary: z.string(),
|
33
|
+
description: z.string(),
|
34
|
+
externalDocs: z.unknown(),
|
35
|
+
operationId: z.string(),
|
36
|
+
parameters: z.array(parameterObject.or(referenceObject)),
|
37
|
+
requestBody: z.unknown(),
|
38
|
+
responses: z.unknown(),
|
39
|
+
callbacks: z.unknown(),
|
40
|
+
deprecated: z.boolean(),
|
41
|
+
security: z.array(z.record(z.array(z.string()))),
|
42
|
+
servers: z.array(z.unknown()),
|
43
|
+
})
|
44
|
+
.partial();
|
45
|
+
// Path items have some fixed fields but also allow for extended fields starting with "x-".
|
46
|
+
//export const openapiPathItem = z.record(openapiOperation.or(serverObject).or(parameterObject));
|
47
|
+
export const openapiPathItem = z
|
48
|
+
.object({
|
49
|
+
summary: z.string(),
|
50
|
+
description: z.string(),
|
51
|
+
get: openapiOperation,
|
52
|
+
put: openapiOperation,
|
53
|
+
post: openapiOperation,
|
54
|
+
delete: openapiOperation,
|
55
|
+
options: openapiOperation,
|
56
|
+
head: openapiOperation,
|
57
|
+
patch: openapiOperation,
|
58
|
+
trace: openapiOperation,
|
59
|
+
servers: serverObject,
|
60
|
+
parameters: z.array(parameterObject),
|
61
|
+
})
|
62
|
+
.partial();
|
63
|
+
export const openapiSchema = z
|
64
|
+
.object({
|
65
|
+
openapi: z.string().regex(new RegExp("^3\\.0\\.\\d(-.+)?$")),
|
66
|
+
info: z
|
67
|
+
.object({
|
68
|
+
title: z.string(),
|
69
|
+
description: z.string().optional(),
|
70
|
+
termsOfService: z.string().optional(),
|
71
|
+
contact: z
|
72
|
+
.object({
|
73
|
+
name: z.string().optional(),
|
74
|
+
url: z.string().optional(),
|
75
|
+
email: z.string().email().optional(),
|
76
|
+
})
|
77
|
+
.strict()
|
78
|
+
.optional(),
|
79
|
+
license: z.object({ name: z.string(), url: z.string().optional() }).strict().optional(),
|
80
|
+
version: z.string(),
|
81
|
+
})
|
82
|
+
.strict(),
|
83
|
+
externalDocs: z.object({ description: z.string().optional(), url: z.string() }).strict().optional(),
|
84
|
+
servers: z
|
85
|
+
.array(z
|
86
|
+
.object({
|
87
|
+
url: z.string(),
|
88
|
+
description: z.string().optional(),
|
89
|
+
variables: z
|
90
|
+
.record(z
|
91
|
+
.object({
|
92
|
+
enum: z.array(z.string()).optional(),
|
93
|
+
default: z.string(),
|
94
|
+
description: z.string().optional(),
|
95
|
+
})
|
96
|
+
.strict())
|
97
|
+
.optional(),
|
98
|
+
})
|
99
|
+
.strict())
|
100
|
+
.optional(),
|
101
|
+
security: z.array(z.record(z.array(z.string()))).optional(),
|
102
|
+
tags: z
|
103
|
+
.array(z
|
104
|
+
.object({
|
105
|
+
name: z.string(),
|
106
|
+
description: z.string().optional(),
|
107
|
+
externalDocs: z
|
108
|
+
.object({
|
109
|
+
description: z.string().optional(),
|
110
|
+
url: z.string(),
|
111
|
+
})
|
112
|
+
.strict()
|
113
|
+
.optional(),
|
114
|
+
})
|
115
|
+
.strict())
|
116
|
+
.optional(),
|
117
|
+
paths: z.record(openapiPathItem),
|
118
|
+
components: z
|
119
|
+
.object({
|
120
|
+
schemas: z.record(z.any()).optional(),
|
121
|
+
responses: z.record(z.any()).optional(),
|
122
|
+
parameters: z.record(z.any()).optional(),
|
123
|
+
examples: z.record(z.any()).optional(),
|
124
|
+
requestBodies: z.record(z.any()).optional(),
|
125
|
+
headers: z.record(z.any()).optional(),
|
126
|
+
securitySchemes: z.record(z.any()).optional(),
|
127
|
+
links: z.record(z.any()).optional(),
|
128
|
+
callbacks: z.record(z.any()).optional(),
|
129
|
+
})
|
130
|
+
.strict()
|
131
|
+
.optional(),
|
132
|
+
})
|
133
|
+
.describe("The description of OpenAPI v3.0.x documents, as defined by https://spec.openapis.org/oas/v3.0.3");
|
134
|
+
//# sourceMappingURL=openapi-schema.js.map
|
@@ -1,12 +1,13 @@
|
|
1
|
-
import {
|
2
|
-
import type { ModelWithReference } from "../aws/types/model-with-reference.
|
1
|
+
import { type JsonSchema, JsonSchemaType, JsonSchemaVersion, type Model, type RequestValidator, type RestApi } from "aws-cdk-lib/aws-apigateway";
|
2
|
+
import type { ModelWithReference } from "../aws/types/model-with-reference.js";
|
3
|
+
type ModelReferenceUrl = `https://apigateway.amazonaws.com/restapis/${string}/models/${string}`;
|
3
4
|
/**
|
4
5
|
* Get a reference to an OpenAPI model object in a REST API.
|
5
6
|
* Can be used to supply a reference to properties of a GeoJSON feature.
|
6
7
|
* @param modelId Id of the referenced object
|
7
8
|
* @param restApiId Id of the REST API
|
8
9
|
*/
|
9
|
-
export declare function getModelReference(modelId: string, restApiId: string):
|
10
|
+
export declare function getModelReference(modelId: string, restApiId: string): ModelReferenceUrl;
|
10
11
|
/**
|
11
12
|
* Adds a request validator to a REST API to enforce request parameters/body requirements.
|
12
13
|
* https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-request-validation.html
|
@@ -29,7 +30,7 @@ export declare function addServiceModel(modelName: string, api: RestApi, schema:
|
|
29
30
|
* @param api
|
30
31
|
* @param contentType
|
31
32
|
*/
|
32
|
-
export declare function addSimpleServiceModel(modelName: string, api: RestApi, contentType?: string): Model;
|
33
|
+
export declare function addSimpleServiceModel(modelName: string, api: RestApi, contentType?: `${string}/${string}`): Model;
|
33
34
|
/**
|
34
35
|
* Adds a JSON Schema model to an API Gateway API. Can be used later to generate OpenAPI specifications.
|
35
36
|
* This method adds a schema for _an array._
|
@@ -62,7 +63,6 @@ export declare function featureSchema(modelReference: string): {
|
|
62
63
|
};
|
63
64
|
};
|
64
65
|
/**
|
65
|
-
*
|
66
66
|
* Creates a JSON Schema for a GeoJSON Feature Collection. Can be used to generate OpenAPI descriptions.
|
67
67
|
* @param modelReference Reference to a model object, in this case Features.
|
68
68
|
*/
|
@@ -85,3 +85,4 @@ export declare function geojsonSchema(modelReference: string): {
|
|
85
85
|
};
|
86
86
|
};
|
87
87
|
};
|
88
|
+
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { JsonSchemaType, JsonSchemaVersion, } from "aws-cdk-lib/aws-apigateway";
|
2
2
|
/**
|
3
3
|
* Get a reference to an OpenAPI model object in a REST API.
|
4
4
|
* Can be used to supply a reference to properties of a GeoJSON feature.
|
@@ -14,7 +14,7 @@ export function getModelReference(modelId, restApiId) {
|
|
14
14
|
* @param api REST API
|
15
15
|
*/
|
16
16
|
export function addDefaultValidator(api) {
|
17
|
-
return api.addRequestValidator(
|
17
|
+
return api.addRequestValidator("DefaultValidator", {
|
18
18
|
validateRequestParameters: true,
|
19
19
|
validateRequestBody: true,
|
20
20
|
});
|
@@ -29,7 +29,7 @@ export function addDefaultValidator(api) {
|
|
29
29
|
*/
|
30
30
|
export function addServiceModel(modelName, api, schema) {
|
31
31
|
const mwr = api.addModel(modelName, {
|
32
|
-
contentType:
|
32
|
+
contentType: "application/json",
|
33
33
|
modelName,
|
34
34
|
schema,
|
35
35
|
});
|
@@ -43,7 +43,7 @@ export function addServiceModel(modelName, api, schema) {
|
|
43
43
|
* @param api
|
44
44
|
* @param contentType
|
45
45
|
*/
|
46
|
-
export function addSimpleServiceModel(modelName, api, contentType =
|
46
|
+
export function addSimpleServiceModel(modelName, api, contentType = "application/xml") {
|
47
47
|
return api.addModel(modelName, {
|
48
48
|
contentType,
|
49
49
|
modelName,
|
@@ -72,26 +72,25 @@ export function featureSchema(modelReference) {
|
|
72
72
|
return {
|
73
73
|
schema: JsonSchemaVersion.DRAFT4,
|
74
74
|
type: JsonSchemaType.OBJECT,
|
75
|
-
description:
|
76
|
-
required: [
|
75
|
+
description: "GeoJson Feature",
|
76
|
+
required: ["type", "properties", "geometry"],
|
77
77
|
properties: {
|
78
78
|
type: {
|
79
79
|
type: JsonSchemaType.STRING,
|
80
|
-
description:
|
81
|
-
enum: [
|
80
|
+
description: "Feature",
|
81
|
+
enum: ["Feature"],
|
82
82
|
},
|
83
83
|
properties: {
|
84
84
|
ref: modelReference,
|
85
85
|
},
|
86
86
|
geometry: {
|
87
87
|
type: JsonSchemaType.OBJECT,
|
88
|
-
description:
|
88
|
+
description: "GeoJSON geometry",
|
89
89
|
},
|
90
90
|
},
|
91
91
|
};
|
92
92
|
}
|
93
93
|
/**
|
94
|
-
*
|
95
94
|
* Creates a JSON Schema for a GeoJSON Feature Collection. Can be used to generate OpenAPI descriptions.
|
96
95
|
* @param modelReference Reference to a model object, in this case Features.
|
97
96
|
*/
|
@@ -99,13 +98,13 @@ export function geojsonSchema(modelReference) {
|
|
99
98
|
return {
|
100
99
|
schema: JsonSchemaVersion.DRAFT4,
|
101
100
|
type: JsonSchemaType.OBJECT,
|
102
|
-
description:
|
103
|
-
required: [
|
101
|
+
description: "GeoJson FeatureCollection",
|
102
|
+
required: ["type", "features"],
|
104
103
|
properties: {
|
105
104
|
type: {
|
106
105
|
type: JsonSchemaType.STRING,
|
107
|
-
description:
|
108
|
-
enum: [
|
106
|
+
description: "FeatureCollection",
|
107
|
+
enum: ["FeatureCollection"],
|
109
108
|
},
|
110
109
|
features: {
|
111
110
|
type: JsonSchemaType.ARRAY,
|
@@ -116,4 +115,4 @@ export function geojsonSchema(modelReference) {
|
|
116
115
|
},
|
117
116
|
};
|
118
117
|
}
|
119
|
-
//# sourceMappingURL=api-model.
|
118
|
+
//# sourceMappingURL=api-model.js.map
|
@@ -3,7 +3,7 @@
|
|
3
3
|
* @param str string
|
4
4
|
*/
|
5
5
|
export function decodeBase64ToAscii(str) {
|
6
|
-
return decodeBase64(str,
|
6
|
+
return decodeBase64(str, "ascii");
|
7
7
|
}
|
8
8
|
/**
|
9
9
|
* Decode given string from base64 to given encoding
|
@@ -11,6 +11,6 @@ export function decodeBase64ToAscii(str) {
|
|
11
11
|
* @param encoding
|
12
12
|
*/
|
13
13
|
export function decodeBase64(str, encoding) {
|
14
|
-
return Buffer.from(str,
|
14
|
+
return Buffer.from(str, "base64").toString(encoding);
|
15
15
|
}
|
16
|
-
//# sourceMappingURL=base64.
|
16
|
+
//# sourceMappingURL=base64.js.map
|
@@ -3,12 +3,12 @@
|
|
3
3
|
*/
|
4
4
|
import type { LineString, Point, Position } from "geojson";
|
5
5
|
export declare class GeoJsonPoint implements Point {
|
6
|
-
readonly type
|
6
|
+
readonly type: "Point";
|
7
7
|
readonly coordinates: Position;
|
8
8
|
constructor(coordinates: Position);
|
9
9
|
}
|
10
10
|
export declare class GeoJsonLineString implements LineString {
|
11
|
-
readonly type
|
11
|
+
readonly type: "LineString";
|
12
12
|
readonly coordinates: Position[];
|
13
13
|
constructor(coordinates: Position[]);
|
14
14
|
}
|
@@ -32,8 +32,9 @@ export declare function areDistinctPositions(previous: Position, next: Position)
|
|
32
32
|
* @param pos2
|
33
33
|
*/
|
34
34
|
export declare function distanceBetweenPositionsInM(pos1: Position, pos2: Position): number;
|
35
|
-
export
|
36
|
-
srsName: string
|
35
|
+
export interface GmlLineString {
|
36
|
+
srsName: `${string}:${string}`;
|
37
37
|
posList: string;
|
38
|
-
}
|
38
|
+
}
|
39
|
+
export declare function createGmlLineString(geometry: Geometry, srsName?: `${string}:${string}`): GmlLineString;
|
39
40
|
export declare function positionToList(position: Position, precision?: number): string;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as geoJsonValidator from "geojson-validation";
|
2
|
-
import { logger } from "../aws/runtime/dt-logger-default.
|
2
|
+
import { logger } from "../aws/runtime/dt-logger-default.js";
|
3
3
|
export const SRID_WGS84 = 4326;
|
4
4
|
/**
|
5
5
|
* Creates WKT geometry from GeoJSON geometry
|
@@ -47,6 +47,7 @@ function coordinatePair(coordinate) {
|
|
47
47
|
* @param features List of Features
|
48
48
|
* @param lastUpdated Last updated date
|
49
49
|
*/
|
50
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
50
51
|
export function createFeatureCollection(features, lastUpdated) {
|
51
52
|
return {
|
52
53
|
type: "FeatureCollection",
|
@@ -94,10 +95,12 @@ function distanceBetweenWGS84PointsInKm(fromXLon, fromYLat, toXLon, toYLat) {
|
|
94
95
|
* @param pos2 second position
|
95
96
|
*/
|
96
97
|
export function distanceBetweenPositionsInKm(pos1, pos2) {
|
97
|
-
|
98
|
+
const [pos10, pos11] = pos1;
|
99
|
+
const [pos20, pos21] = pos2;
|
100
|
+
if (pos1.length > 3 || pos2.length > 3 || !pos10 || !pos11 || !pos20 || !pos21) {
|
98
101
|
throw Error(`Illegal Positions ${pos1.toString()} and ${pos2.toString()}. Both must have length between 2 or 3.`);
|
99
102
|
}
|
100
|
-
return distanceBetweenWGS84PointsInKm(
|
103
|
+
return distanceBetweenWGS84PointsInKm(pos10, pos11, pos20, pos21);
|
101
104
|
}
|
102
105
|
export function areDistinctPositions(previous, next) {
|
103
106
|
return previous[0] !== next[0] || previous[1] !== next[1];
|
@@ -142,4 +145,4 @@ export function positionToList(position, precision = 8) {
|
|
142
145
|
function toRadians(angdeg) {
|
143
146
|
return angdeg * DEGREES_TO_RADIANS;
|
144
147
|
}
|
145
|
-
//# sourceMappingURL=geometry.
|
148
|
+
//# sourceMappingURL=geometry.js.map
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { DtLogger } from "../aws/runtime/dt-logger.
|
2
|
-
import { getEnvVariableOrElse } from "./utils.
|
1
|
+
import { DtLogger } from "../aws/runtime/dt-logger.js";
|
2
|
+
import { getEnvVariableOrElse } from "./utils.js";
|
3
3
|
const functionName = getEnvVariableOrElse("AWS_LAMBDA_FUNCTION_NAME", "test");
|
4
4
|
/**
|
5
5
|
* Curried version of logException.
|
@@ -42,13 +42,10 @@ export function createExceptionLogger(logger = undefined, includeStack = false)
|
|
42
42
|
* @see {@link createExceptionLogger} for a curried setup
|
43
43
|
*/
|
44
44
|
export function logException(logger, error, includeStack = false) {
|
45
|
-
const message = error instanceof Error
|
46
|
-
? error.message
|
47
|
-
: typeof error === "string"
|
48
|
-
? error
|
49
|
-
: JSON.stringify(error);
|
45
|
+
const message = error instanceof Error ? error.message : typeof error === "string" ? error : JSON.stringify(error);
|
50
46
|
const stack = error instanceof Error && includeStack ? error.stack : undefined;
|
51
47
|
// In case error is AxiosError, log the custom code property.
|
48
|
+
// eslint-disable-next-line dot-notation
|
52
49
|
const customCode = error["code"];
|
53
50
|
logger.error({
|
54
51
|
type: "Error",
|
@@ -58,4 +55,4 @@ export function logException(logger, error, includeStack = false) {
|
|
58
55
|
stack,
|
59
56
|
});
|
60
57
|
}
|
61
|
-
//# sourceMappingURL=logging.
|
58
|
+
//# sourceMappingURL=logging.js.map
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { HttpError } from "../types/http-error.
|
2
|
-
import { AsyncTimeoutError } from "../types/async-timeout-error.
|
3
|
-
import { logger } from "../aws/runtime/dt-logger-default.
|
1
|
+
import { HttpError } from "../types/http-error.js";
|
2
|
+
import { AsyncTimeoutError } from "../types/async-timeout-error.js";
|
3
|
+
import { logger } from "../aws/runtime/dt-logger-default.js";
|
4
4
|
export var RetryLogError;
|
5
5
|
(function (RetryLogError) {
|
6
6
|
RetryLogError[RetryLogError["LOG_ALL_AS_ERRORS"] = 0] = "LOG_ALL_AS_ERRORS";
|
@@ -12,7 +12,6 @@ export var RetryLogError;
|
|
12
12
|
*/
|
13
13
|
export const timeoutFunctions = (function () {
|
14
14
|
return {
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
16
15
|
noTimeout: (_) => {
|
17
16
|
return 0;
|
18
17
|
},
|
@@ -38,7 +37,6 @@ export const retryPredicates = (function () {
|
|
38
37
|
}
|
39
38
|
return false;
|
40
39
|
},
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
42
40
|
alwaysRetry: (_) => {
|
43
41
|
return true;
|
44
42
|
},
|
@@ -62,10 +60,10 @@ async function retryRecursive(asyncFn, retries, retryCountInj, logError, timeout
|
|
62
60
|
}
|
63
61
|
try {
|
64
62
|
// NOTE, a Promise cannot be cancelled. So if the asyncFn calls multiple async/await paris and the first one takes 31 minutes to complete,
|
65
|
-
// then the rest of async/await pairs will be called even though
|
63
|
+
// then the rest of async/await pairs will be called even though AsyncTimeoutError is already thrown.
|
66
64
|
const result = await Promise.race([
|
67
65
|
asyncFn(),
|
68
|
-
new Promise((
|
66
|
+
new Promise((_resolve, reject) => setTimeout(() => reject(new AsyncTimeoutError()), asyncFnTimeout)),
|
69
67
|
]);
|
70
68
|
return result;
|
71
69
|
}
|
@@ -140,4 +138,4 @@ export async function retryRequest(request, ...args) {
|
|
140
138
|
const asyncFn = wrapArgsToFn(request, ...args);
|
141
139
|
return retry(asyncFn, 5, RetryLogError.LOG_LAST_RETRY_AS_ERROR_OTHERS_AS_WARNS, timeoutFunctions.exponentialTimeout, retryPredicates.retryBasedOnStatusCode);
|
142
140
|
}
|
143
|
-
//# sourceMappingURL=retry.
|
141
|
+
//# sourceMappingURL=retry.js.map
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import ky from "ky";
|
2
|
-
import { logger } from "../aws/runtime/dt-logger-default.
|
3
|
-
import { logException } from "./logging.
|
2
|
+
import { logger } from "../aws/runtime/dt-logger-default.js";
|
3
|
+
import { logException } from "./logging.js";
|
4
4
|
export class SlackApi {
|
5
5
|
url;
|
6
6
|
constructor(url) {
|
@@ -21,4 +21,4 @@ export class SlackApi {
|
|
21
21
|
}
|
22
22
|
}
|
23
23
|
}
|
24
|
-
//# sourceMappingURL=slack.
|
24
|
+
//# sourceMappingURL=slack.js.map
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { AwsEnv } from "../types/aws-env.
|
2
|
-
import type { Either } from "../types/either.
|
1
|
+
import type { AwsEnv } from "../types/aws-env.js";
|
2
|
+
import type { Either } from "../types/either.js";
|
3
3
|
/**
|
4
4
|
* Check if arrays have only elements that also exists also in other array.
|
5
5
|
* Individual element count doesn't matter.
|
@@ -90,7 +90,6 @@ export declare function hasOwnPropertySafe(object: object, propertyName: string)
|
|
90
90
|
*/
|
91
91
|
export declare function getErrorMessage(maybeError: unknown): string;
|
92
92
|
/**
|
93
|
-
*
|
94
93
|
* @param value
|
95
94
|
*/
|
96
95
|
export declare function isDefined<T>(value: T | undefined | null): value is T;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { EnvKeys } from "../aws/runtime/environment.
|
1
|
+
import { EnvKeys } from "../aws/runtime/environment.js";
|
2
2
|
/**
|
3
3
|
* Check if arrays have only elements that also exists also in other array.
|
4
4
|
* Individual element count doesn't matter.
|
@@ -20,7 +20,11 @@ import { EnvKeys } from "../aws/runtime/environment.mjs";
|
|
20
20
|
* @param a first array to compare
|
21
21
|
* @param b second array to compare
|
22
22
|
*/
|
23
|
-
export function bothArraysHasSameValues(
|
23
|
+
export function bothArraysHasSameValues(
|
24
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
25
|
+
a,
|
26
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
27
|
+
b) {
|
24
28
|
if ((a && !b) || (!a && b)) {
|
25
29
|
return false;
|
26
30
|
}
|
@@ -47,7 +51,7 @@ export function getFirst(array, sortFunction) {
|
|
47
51
|
return getFirstOrLast(true, array, sortFunction);
|
48
52
|
}
|
49
53
|
function getFirstOrLast(getFirst, array, sortFunction) {
|
50
|
-
if (array.length
|
54
|
+
if (array.length === 0) {
|
51
55
|
throw new Error(`can't get ${getFirst ? "first" : "last"} from empty array!`);
|
52
56
|
}
|
53
57
|
const index = getFirst ? 0 : array.length - 1;
|
@@ -154,10 +158,10 @@ export function getErrorMessage(maybeError) {
|
|
154
158
|
return String(maybeError);
|
155
159
|
}
|
156
160
|
/**
|
157
|
-
*
|
158
161
|
* @param value
|
159
162
|
*/
|
163
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
160
164
|
export function isDefined(value) {
|
161
165
|
return value !== undefined && value !== null;
|
162
166
|
}
|
163
|
-
//# sourceMappingURL=utils.
|
167
|
+
//# sourceMappingURL=utils.js.map
|