From b1812d7eba0d1bb75344b4ae43907457ffc3aa80 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 13 Sep 2023 13:37:44 -0700 Subject: [PATCH 1/8] feat: pulling the core library out into a separate package --- .eslintignore | 12 +- package-lock.json | 477 +++++++++++------- packages/api/package.json | 10 - packages/api/tsconfig.json | 2 +- packages/core/.eslintrc | 17 + packages/core/.gitignore | 3 + packages/core/.npmignore | 7 + packages/core/LICENSE | 18 + packages/core/package.json | 48 ++ .../core => core/src}/errors/fetchError.ts | 0 packages/{api/src/core => core/src}/index.ts | 14 +- .../src/lib}/getJSONSchemaDefaults.ts | 0 .../core => core/src/lib}/parseResponse.ts | 2 +- .../src/core => core/src/lib}/prepareAuth.ts | 0 .../core => core/src/lib}/prepareParams.ts | 0 .../core => core/src/lib}/prepareServer.ts | 0 packages/core/test/.eslintrc | 3 + packages/core/test/global.d.ts | 1 + .../test/core => core/test}/index.test.ts | 17 +- .../test/lib}/getJSONSchemaDefaults.test.ts | 6 +- .../test/lib}/parseResponse.test.ts | 2 +- .../test/lib}/prepareAuth.test.ts | 6 +- .../test/lib}/prepareParams.test.ts | 24 +- packages/core/test/tsconfig.json | 8 + packages/core/tsconfig.json | 13 + packages/core/vitest.config.ts | 8 + packages/httpsnippet-client-api/tsconfig.json | 2 +- packages/test-utils/package.json | 20 + .../helpers => test-utils/src}/fetch-mock.ts | 22 +- .../src/fixtures}/definitions/alby.json | 0 .../fixtures}/definitions/auth-quirks.json | 0 .../src/fixtures}/definitions/basiq.json | 0 .../definitions/nested-defaults.json | 0 .../definitions/operationid-quirks.json | 0 .../definitions/optional-payload.json | 0 .../src/fixtures}/definitions/payloads.json | 0 .../definitions/response-title-quirks.json | 0 .../src/fixtures}/definitions/simple.json | 0 .../src/fixtures}/hello.jp.txt | 0 .../src/fixtures}/hello.txt | 0 .../src/fixtures}/owlbert-shrub.png | Bin .../src/fixtures}/owlbert.png | Bin .../helpers => test-utils/src}/load-spec.ts | 0 .../src}/vitest.matchers.ts | 26 +- packages/test-utils/tsconfig.json | 11 + 45 files changed, 518 insertions(+), 261 deletions(-) create mode 100644 packages/core/.eslintrc create mode 100644 packages/core/.gitignore create mode 100644 packages/core/.npmignore create mode 100644 packages/core/LICENSE create mode 100644 packages/core/package.json rename packages/{api/src/core => core/src}/errors/fetchError.ts (100%) rename packages/{api/src/core => core/src}/index.ts (91%) rename packages/{api/src/core => core/src/lib}/getJSONSchemaDefaults.ts (100%) rename packages/{api/src/core => core/src/lib}/parseResponse.ts (95%) rename packages/{api/src/core => core/src/lib}/prepareAuth.ts (100%) rename packages/{api/src/core => core/src/lib}/prepareParams.ts (100%) rename packages/{api/src/core => core/src/lib}/prepareServer.ts (100%) create mode 100644 packages/core/test/.eslintrc create mode 100644 packages/core/test/global.d.ts rename packages/{api/test/core => core/test}/index.test.ts (96%) rename packages/{api/test/core => core/test/lib}/getJSONSchemaDefaults.test.ts (86%) rename packages/{api/test/core => core/test/lib}/parseResponse.test.ts (98%) rename packages/{api/test/core => core/test/lib}/prepareAuth.test.ts (97%) rename packages/{api/test/core => core/test/lib}/prepareParams.test.ts (94%) create mode 100644 packages/core/test/tsconfig.json create mode 100644 packages/core/tsconfig.json create mode 100644 packages/core/vitest.config.ts create mode 100644 packages/test-utils/package.json rename packages/{api/test/helpers => test-utils/src}/fetch-mock.ts (72%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/definitions/alby.json (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/definitions/auth-quirks.json (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/definitions/basiq.json (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/definitions/nested-defaults.json (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/definitions/operationid-quirks.json (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/definitions/optional-payload.json (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/definitions/payloads.json (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/definitions/response-title-quirks.json (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/definitions/simple.json (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/hello.jp.txt (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/hello.txt (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/owlbert-shrub.png (100%) rename packages/{api/test/__fixtures__ => test-utils/src/fixtures}/owlbert.png (100%) rename packages/{api/test/helpers => test-utils/src}/load-spec.ts (100%) rename packages/{api/test/helpers => test-utils/src}/vitest.matchers.ts (83%) create mode 100644 packages/test-utils/tsconfig.json diff --git a/.eslintignore b/.eslintignore index 8ee5d6f0..4a88af8e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,12 +1,18 @@ !.alexrc.js -# api subpackage +# api packages/api/coverage/ packages/api/dist/ packages/api/test/__fixtures__/sdk/ -# httpsnippet-client-api subpackage +# core +packages/core/coverage/ +packages/core/dist/ + +# httpsnippet-client-api packages/httpsnippet-client-api/coverage/ packages/httpsnippet-client-api/dist/ -packages/httpsnippet-client-api/node_modules/ packages/httpsnippet-client-api/test/__datasets__/**/output.js + +# test-utils +packages/test-utils/src/fixtures/ diff --git a/package-lock.json b/package-lock.json index d0ba0787..9b28cf6e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,6 +44,14 @@ "node": ">=6.0.0" } }, + "node_modules/@api/core": { + "resolved": "packages/core", + "link": true + }, + "node_modules/@api/test-utils": { + "resolved": "packages/test-utils", + "link": true + }, "node_modules/@apidevtools/openapi-schemas": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz", @@ -984,12 +992,10 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "android" ], - "peer": true, "engines": { "node": ">=12" } @@ -1001,12 +1007,10 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "android" ], - "peer": true, "engines": { "node": ">=12" } @@ -1018,12 +1022,10 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "android" ], - "peer": true, "engines": { "node": ">=12" } @@ -1035,12 +1037,10 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=12" } @@ -1052,12 +1052,10 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=12" } @@ -1069,12 +1067,10 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "freebsd" ], - "peer": true, "engines": { "node": ">=12" } @@ -1086,12 +1082,10 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "freebsd" ], - "peer": true, "engines": { "node": ">=12" } @@ -1103,12 +1097,10 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -1120,12 +1112,10 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -1137,12 +1127,10 @@ "cpu": [ "ia32" ], - "dev": true, "optional": true, "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -1154,12 +1142,10 @@ "cpu": [ "loong64" ], - "dev": true, "optional": true, "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -1171,12 +1157,10 @@ "cpu": [ "mips64el" ], - "dev": true, "optional": true, "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -1188,12 +1172,10 @@ "cpu": [ "ppc64" ], - "dev": true, "optional": true, "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -1205,12 +1187,10 @@ "cpu": [ "riscv64" ], - "dev": true, "optional": true, "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -1222,12 +1202,10 @@ "cpu": [ "s390x" ], - "dev": true, "optional": true, "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -1239,12 +1217,10 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -1256,12 +1232,10 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "netbsd" ], - "peer": true, "engines": { "node": ">=12" } @@ -1273,12 +1247,10 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "openbsd" ], - "peer": true, "engines": { "node": ">=12" } @@ -1290,12 +1262,10 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "sunos" ], - "peer": true, "engines": { "node": ">=12" } @@ -1307,12 +1277,10 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "win32" ], - "peer": true, "engines": { "node": ">=12" } @@ -1324,12 +1292,10 @@ "cpu": [ "ia32" ], - "dev": true, "optional": true, "os": [ "win32" ], - "peer": true, "engines": { "node": ">=12" } @@ -1341,12 +1307,10 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "win32" ], - "peer": true, "engines": { "node": ">=12" } @@ -1914,7 +1878,6 @@ "version": "29.6.3", "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", - "dev": true, "dependencies": { "@sinclair/typebox": "^0.27.8" }, @@ -3243,6 +3206,11 @@ "prettier": "^3.0.0" } }, + "node_modules/@readme/http-status-codes": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@readme/http-status-codes/-/http-status-codes-7.2.0.tgz", + "integrity": "sha512-/dBh9qw3QhJYqlGwt2I+KUP/lQ6nytdCx3aq+GpMUhibLHF3O7fwoowNcTwlbnwtyJ+TJYTIIrp3oVUlRNx3fA==" + }, "node_modules/@readme/httpsnippet": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/@readme/httpsnippet/-/httpsnippet-4.0.3.tgz", @@ -3289,13 +3257,13 @@ } }, "node_modules/@readme/oas-to-har": { - "version": "20.0.2", - "resolved": "https://registry.npmjs.org/@readme/oas-to-har/-/oas-to-har-20.0.2.tgz", - "integrity": "sha512-yJ9IhEvb/UkleBYw+Br8/JlpHIKQC7EqW0BoFsXXxxbM6CQ19B2gcs2fFbNbV+hz4qXfaXZnXDw0b7KXjns3Sw==", + "version": "20.1.1", + "resolved": "https://registry.npmjs.org/@readme/oas-to-har/-/oas-to-har-20.1.1.tgz", + "integrity": "sha512-rz8YpdZw+Jqrd8VQhQaYrzctkCAYdBldoQ5qDQyF9vGvq2lpA1yMvQPgKCJXfPGXH8Cm+NjLbunxnYabKQeKeA==", "dependencies": { "@readme/data-urls": "^1.0.1", "@readme/oas-extensions": "^17.0.1", - "oas": "^20.3.0", + "oas": "^20.5.0", "qs": "^6.10.5", "remove-undefined-objects": "^2.0.2" }, @@ -3303,6 +3271,14 @@ "node": ">=14" } }, + "node_modules/@readme/oas-to-har/node_modules/remove-undefined-objects": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-2.0.2.tgz", + "integrity": "sha512-b6x4MUtR4YBW1aCoGx3tE4mA2PFjiXSmtSdNmLexQzUdZa4ybnJAItXLKpkcVgCUJIzJtk2DFG402sMSEMlonQ==", + "engines": { + "node": ">=14" + } + }, "node_modules/@readme/openapi-parser": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/@readme/openapi-parser/-/openapi-parser-2.5.0.tgz", @@ -3357,6 +3333,22 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, + "node_modules/@readme/postman-to-openapi": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@readme/postman-to-openapi/-/postman-to-openapi-4.1.0.tgz", + "integrity": "sha512-VvV2Hzjskz01m8doSn7Ypt6cSZzgjnypVqXy1ipThbyYD6SGiM74VSePXykOODj/43Y2m6zeYedPk/ZLts/HvQ==", + "dependencies": { + "@readme/http-status-codes": "^7.2.0", + "js-yaml": "^4.1.0", + "jsonc-parser": "3.2.0", + "lodash.camelcase": "^4.3.0", + "marked": "^4.3.0", + "mustache": "^4.2.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@sigstore/bundle": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-1.1.0.tgz", @@ -3408,8 +3400,7 @@ "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", - "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", - "dev": true + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==" }, "node_modules/@sindresorhus/is": { "version": "5.3.0", @@ -3671,14 +3662,12 @@ "node_modules/@types/chai": { "version": "4.3.5", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.5.tgz", - "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==", - "dev": true + "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==" }, "node_modules/@types/chai-subset": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", - "dev": true, "dependencies": { "@types/chai": "*" } @@ -3894,8 +3883,7 @@ "node_modules/@types/node": { "version": "18.11.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz", - "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==", - "dev": true + "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==" }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", @@ -4331,7 +4319,6 @@ "version": "0.34.4", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.34.4.tgz", "integrity": "sha512-XlMKX8HyYUqB8dsY8Xxrc64J2Qs9pKMt2Z8vFTL4mBWXJsg4yoALHzJfDWi8h5nkO4Zua4zjqtapQ/IluVkSnA==", - "dev": true, "dependencies": { "@vitest/spy": "0.34.4", "@vitest/utils": "0.34.4", @@ -4345,7 +4332,6 @@ "version": "0.34.4", "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.34.4.tgz", "integrity": "sha512-hwwdB1StERqUls8oV8YcpmTIpVeJMe4WgYuDongVzixl5hlYLT2G8afhcdADeDeqCaAmZcSgLTLtqkjPQF7x+w==", - "dev": true, "dependencies": { "@vitest/utils": "0.34.4", "p-limit": "^4.0.0", @@ -4359,7 +4345,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, "dependencies": { "yocto-queue": "^1.0.0" }, @@ -4374,7 +4359,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true, "engines": { "node": ">=12.20" }, @@ -4386,7 +4370,6 @@ "version": "0.34.4", "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.34.4.tgz", "integrity": "sha512-GCsh4coc3YUSL/o+BPUo7lHQbzpdttTxL6f4q0jRx2qVGoYz/cyTRDJHbnwks6TILi6560bVWoBpYC10PuTLHw==", - "dev": true, "dependencies": { "magic-string": "^0.30.1", "pathe": "^1.1.1", @@ -4400,7 +4383,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, "engines": { "node": ">=10" }, @@ -4412,7 +4394,6 @@ "version": "29.6.3", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.3.tgz", "integrity": "sha512-ZsBgjVhFAj5KeK+nHfF1305/By3lechHQSMWCTl8iHSbfOm2TN5nHEtFc/+W7fAyUeCs2n5iow72gld4gW0xDw==", - "dev": true, "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", @@ -4425,14 +4406,12 @@ "node_modules/@vitest/snapshot/node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, "node_modules/@vitest/spy": { "version": "0.34.4", "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.34.4.tgz", "integrity": "sha512-PNU+fd7DUPgA3Ya924b1qKuQkonAW6hL7YUjkON3wmBwSTIlhOSpy04SJ0NrRsEbrXgMMj6Morh04BMf8k+w0g==", - "dev": true, "dependencies": { "tinyspy": "^2.1.1" }, @@ -4444,7 +4423,6 @@ "version": "0.34.4", "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.34.4.tgz", "integrity": "sha512-yR2+5CHhp/K4ySY0Qtd+CAL9f5Yh1aXrKfAT42bq6CtlGPh92jIDDDSg7ydlRow1CP+dys4TrOrbELOyNInHSg==", - "dev": true, "dependencies": { "diff-sequences": "^29.4.3", "loupe": "^2.3.6", @@ -4458,7 +4436,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, "engines": { "node": ">=10" }, @@ -4470,7 +4447,6 @@ "version": "29.6.3", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.3.tgz", "integrity": "sha512-ZsBgjVhFAj5KeK+nHfF1305/By3lechHQSMWCTl8iHSbfOm2TN5nHEtFc/+W7fAyUeCs2n5iow72gld4gW0xDw==", - "dev": true, "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", @@ -4483,8 +4459,7 @@ "node_modules/@vitest/utils/node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, "node_modules/@yarnpkg/lockfile": { "version": "1.1.0", @@ -4552,7 +4527,6 @@ "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -4573,7 +4547,6 @@ "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, "engines": { "node": ">=0.4.0" } @@ -5347,7 +5320,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true, "engines": { "node": "*" } @@ -5869,7 +5841,6 @@ "version": "6.7.14", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, "engines": { "node": ">=8" } @@ -6073,7 +6044,6 @@ "version": "4.3.8", "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.8.tgz", "integrity": "sha512-vX4YvVVtxlfSZ2VecZgFUTU5qPCYsobVI2O9FmwEXBhDigYGQA6jRXCycIs1yJnnWbZ6/+a2zNIF5DfVCcJBFQ==", - "dev": true, "dependencies": { "assertion-error": "^1.1.0", "check-error": "^1.0.2", @@ -6163,7 +6133,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", - "dev": true, "engines": { "node": "*" } @@ -7048,7 +7017,6 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -7142,7 +7110,6 @@ "version": "4.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", - "dev": true, "dependencies": { "type-detect": "^4.0.0" }, @@ -7456,7 +7423,6 @@ "version": "29.4.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", - "dev": true, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } @@ -7834,7 +7800,6 @@ "version": "0.18.20", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", - "dev": true, "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" @@ -9544,7 +9509,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/formdata-to-string/-/formdata-to-string-1.0.0.tgz", "integrity": "sha512-VTseQXEHo086wgchDG6priy+GSUE6CGjdJ+02vQbDshiHZ70FmsheGfYVTF47NGMDX27zsH9tvVvcf+SENP4Rw==", - "dev": true, "dependencies": { "undici": "^5.24.0" }, @@ -9599,13 +9563,11 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ "darwin" ], - "peer": true, "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } @@ -9682,7 +9644,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", - "dev": true, "engines": { "node": "*" } @@ -13413,7 +13374,6 @@ "version": "0.4.3", "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", - "dev": true, "engines": { "node": ">=14" }, @@ -13567,7 +13527,6 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", - "dev": true, "dependencies": { "get-func-name": "^2.0.0" } @@ -13617,7 +13576,6 @@ "version": "0.30.2", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.2.tgz", "integrity": "sha512-lNZdu7pewtq/ZvWUp9Wpf/x7WzMTsR26TWV03BRZrXFsv+BI6dy8RAiKgm1uM/kyR0rCfUcqvOlXKG66KhIGug==", - "dev": true, "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, @@ -13628,8 +13586,7 @@ "node_modules/magic-string/node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.15", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" }, "node_modules/make-dir": { "version": "3.1.0", @@ -13743,9 +13700,9 @@ } }, "node_modules/marked": { - "version": "4.2.12", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.2.12.tgz", - "integrity": "sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", "bin": { "marked": "bin/marked.js" }, @@ -15130,7 +15087,6 @@ "version": "1.4.2", "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.2.tgz", "integrity": "sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==", - "dev": true, "dependencies": { "acorn": "^8.10.0", "pathe": "^1.1.1", @@ -15159,8 +15115,7 @@ "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/multimatch": { "version": "5.0.0", @@ -15208,7 +15163,6 @@ "version": "3.3.6", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", - "dev": true, "funding": [ { "type": "github", @@ -16014,9 +15968,9 @@ } }, "node_modules/oas": { - "version": "20.4.0", - "resolved": "https://registry.npmjs.org/oas/-/oas-20.4.0.tgz", - "integrity": "sha512-vExbxQHWHdRz/7PrXK3L110/+ff8SK6Tq7N1PqBZiX5/WunoYLyjjDP0lq52RsWFfeluU+EzIAFodKacI5BMHQ==", + "version": "20.10.3", + "resolved": "https://registry.npmjs.org/oas/-/oas-20.10.3.tgz", + "integrity": "sha512-dBxDuwn2ssggPMOqEKEzT4sjCqbkol8JozuWrpwD7chcmbKbverj5vpk2kmsczeyguFkLcKUOMcqUUimf9h+IQ==", "dependencies": { "@readme/json-schema-ref-parser": "^1.2.0", "@types/json-schema": "^7.0.11", @@ -16024,9 +15978,10 @@ "jsonpath-plus": "^7.2.0", "jsonpointer": "^5.0.0", "memoizee": "^0.4.14", - "oas-normalize": "^8.3.0", - "openapi-types": "^12.1.0", - "path-to-regexp": "^6.2.0" + "oas-normalize": "^8.4.0", + "openapi-types": "^12.1.1", + "path-to-regexp": "^6.2.0", + "remove-undefined-objects": "^3.0.0" }, "engines": { "node": ">=14" @@ -16054,15 +16009,15 @@ } }, "node_modules/oas-normalize": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-8.3.2.tgz", - "integrity": "sha512-xjPRdN9l27BxaR4+LYnJo/0SMw9nMBtCQ/NPejXT5dxw+is0j05PTgVnGxm6G+QTk2Y35hND4F9lNuPKk9Zw2A==", + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-8.4.1.tgz", + "integrity": "sha512-cGODg+AntZteJRHBiYDWKtcO2svWGMXuFWYu2I8b4hOrNiwB3hgDs/ScX3O9mYm6RpLsUIftt6rDHGc8eYG8aA==", "dependencies": { - "@readme/openapi-parser": "^2.4.0", + "@readme/openapi-parser": "^2.5.0", + "@readme/postman-to-openapi": "^4.1.0", "js-yaml": "^4.1.0", "node-fetch": "^2.6.1", "openapi-types": "^12.1.0", - "postman-to-openapi": "^3.0.1", "swagger2openapi": "^7.0.8" }, "engines": { @@ -16113,6 +16068,14 @@ "url": "https://github.com/Mermade/oas-kit?sponsor=1" } }, + "node_modules/oas/node_modules/remove-undefined-objects": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-3.0.0.tgz", + "integrity": "sha512-nxG1yYfc/Jxi+bNCBiqKhxVJPE+QvziIOKbD+Dxc93Uisz92v/ZYpo4WR0TJuf+dk2xE8lW2WPJsA3mDFzXy8w==", + "engines": { + "node": ">=16" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -16288,9 +16251,9 @@ } }, "node_modules/openapi-types": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.0.tgz", - "integrity": "sha512-XpeCy01X6L5EpP+6Hc3jWN7rMZJ+/k1lwki/kTmWzbVhdPie3jd5O2ZtedEx8Yp58icJ0osVldLMrTB/zslQXA==" + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz", + "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==" }, "node_modules/optionator": { "version": "0.9.3", @@ -16832,14 +16795,12 @@ "node_modules/pathe": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", - "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", - "dev": true + "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==" }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true, "engines": { "node": "*" } @@ -16855,8 +16816,7 @@ "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -16960,7 +16920,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", - "dev": true, "dependencies": { "jsonc-parser": "^3.2.0", "mlly": "^1.2.0", @@ -16980,7 +16939,6 @@ "version": "8.4.29", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.29.tgz", "integrity": "sha512-cbI+jaqIeu/VGqXEarWkRCCffhjgXc0qjBtXpqJhTBohMUjUQnbBr0xqX3vEKudc4iviTewcJo5ajcec5+wdJw==", - "dev": true, "funding": [ { "type": "opencollective", @@ -17004,33 +16962,6 @@ "node": "^10 || ^12 || >=14" } }, - "node_modules/postman-to-openapi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/postman-to-openapi/-/postman-to-openapi-3.0.1.tgz", - "integrity": "sha512-OUenC7fi5moe41nhO0yUj8jqVj6tchLCjPxG2d28Ai//Oujt3lL7tiFCL2P6pKUV1a7p5X/BJh7op65jjbrs3Q==", - "dependencies": { - "commander": "^8.3.0", - "js-yaml": "^4.1.0", - "jsonc-parser": "3.2.0", - "lodash.camelcase": "^4.3.0", - "marked": "^4.2.5", - "mustache": "^4.2.0" - }, - "bin": { - "p2o": "bin/cli.js" - }, - "engines": { - "node": ">=14 <20" - } - }, - "node_modules/postman-to-openapi/node_modules/commander": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", - "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", - "engines": { - "node": ">= 12" - } - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -17261,9 +17192,9 @@ "peer": true }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", + "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", "dependencies": { "side-channel": "^1.0.4" }, @@ -17900,11 +17831,11 @@ } }, "node_modules/remove-undefined-objects": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-2.0.2.tgz", - "integrity": "sha512-b6x4MUtR4YBW1aCoGx3tE4mA2PFjiXSmtSdNmLexQzUdZa4ybnJAItXLKpkcVgCUJIzJtk2DFG402sMSEMlonQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-4.0.2.tgz", + "integrity": "sha512-6Nh52HADM60lhewwWU30ujMzTjYJk4M5q/LhRYLAacP0hTbzjVWiBVlV84U5RsQA4wDKLwkL0r0qJvti2hRLeQ==", "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/require-directory": { @@ -18130,7 +18061,6 @@ "version": "3.29.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.0.tgz", "integrity": "sha512-nszM8DINnx1vSS+TpbWKMkxem0CDWk3cSit/WWCBVs9/JZ1I/XLwOsiUglYuYReaeWWSsW9kge5zE5NZtf/a4w==", - "dev": true, "bin": { "rollup": "dist/bin/rollup" }, @@ -18383,8 +18313,7 @@ "node_modules/siginfo": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==" }, "node_modules/signal-exit": { "version": "3.0.7", @@ -18493,7 +18422,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -18796,14 +18724,12 @@ "node_modules/stackback": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==" }, "node_modules/std-env": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.3.3.tgz", - "integrity": "sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg==", - "dev": true + "integrity": "sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg==" }, "node_modules/stop-iteration-iterator": { "version": "1.0.0", @@ -19084,7 +19010,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", "integrity": "sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==", - "dev": true, "dependencies": { "acorn": "^8.10.0" }, @@ -19316,14 +19241,12 @@ "node_modules/tinybench": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.0.tgz", - "integrity": "sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==", - "dev": true + "integrity": "sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==" }, "node_modules/tinypool": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.7.0.tgz", "integrity": "sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==", - "dev": true, "engines": { "node": ">=14.0.0" } @@ -19332,7 +19255,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.1.tgz", "integrity": "sha512-XPJL2uSzcOyBMky6OFrusqWlzfFrXtE0hPuMgW8A2HmaqrPo4ZQHRN/V0QXN3FSjKxpsbRrFc5LI7KOwBsT1/w==", - "dev": true, "engines": { "node": ">=14.0.0" } @@ -19595,7 +19517,6 @@ "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, "engines": { "node": ">=4" } @@ -19708,8 +19629,7 @@ "node_modules/ufo": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.0.tgz", - "integrity": "sha512-bRn3CsoojyNStCZe0BG0Mt4Nr/4KF+rhFlnNXybgqt5pXHNFRlqinSoQaTrGyzE4X8aHplSb+TorH+COin9Yxw==", - "dev": true + "integrity": "sha512-bRn3CsoojyNStCZe0BG0Mt4Nr/4KF+rhFlnNXybgqt5pXHNFRlqinSoQaTrGyzE4X8aHplSb+TorH+COin9Yxw==" }, "node_modules/uglify-js": { "version": "3.17.4", @@ -20544,7 +20464,6 @@ "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", "integrity": "sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==", - "dev": true, "dependencies": { "esbuild": "^0.18.10", "postcss": "^8.4.27", @@ -20599,7 +20518,6 @@ "version": "0.34.4", "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.34.4.tgz", "integrity": "sha512-ho8HtiLc+nsmbwZMw8SlghESEE3KxJNp04F/jPUCLVvaURwt0d+r9LxEqCX5hvrrOQ0GSyxbYr5ZfRYhQ0yVKQ==", - "dev": true, "dependencies": { "cac": "^6.7.14", "debug": "^4.3.4", @@ -20622,7 +20540,6 @@ "version": "0.34.4", "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.34.4.tgz", "integrity": "sha512-SE/laOsB6995QlbSE6BtkpXDeVNLJc1u2LHRG/OpnN4RsRzM3GQm4nm3PQCK5OBtrsUqnhzLdnT7se3aeNGdlw==", - "dev": true, "dependencies": { "@types/chai": "^4.3.5", "@types/chai-subset": "^1.3.3", @@ -20815,7 +20732,6 @@ "version": "2.2.2", "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", - "dev": true, "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" @@ -21159,29 +21075,21 @@ "version": "6.1.1", "license": "MIT", "dependencies": { - "@readme/oas-to-har": "^20.0.2", "@readme/openapi-parser": "^2.4.0", - "caseless": "^0.12.0", "chalk": "^4.1.2", "commander": "^11.0.0", - "datauri": "^4.1.0", "execa": "^5.1.1", - "fetch-har": "^10.0.0", "figures": "^3.2.0", - "get-stream": "^6.0.1", "js-yaml": "^4.1.0", "json-schema-to-ts": "^2.9.2", - "json-schema-traverse": "^1.0.0", "lodash.camelcase": "^4.3.0", "lodash.deburr": "^4.1.0", - "lodash.merge": "^4.6.2", "lodash.setwith": "^4.3.2", "lodash.startcase": "^4.4.0", "make-dir": "^3.1.0", "oas": "^20.4.0", "ora": "^5.4.1", "prompts": "^2.4.2", - "remove-undefined-objects": "^2.0.2", "semver": "^7.3.8", "ssri": "^10.0.1", "ts-morph": "^17.0.1", @@ -21192,11 +21100,9 @@ }, "devDependencies": { "@readme/oas-examples": "^5.12.0", - "@types/caseless": "^0.12.3", "@types/js-yaml": "^4.0.5", "@types/lodash.camelcase": "^4.3.7", "@types/lodash.deburr": "^4.1.7", - "@types/lodash.merge": "^4.6.7", "@types/lodash.setwith": "^4.3.7", "@types/lodash.startcase": "^4.4.7", "@types/prettier": "^3.0.0", @@ -21217,6 +21123,13 @@ "node": ">=18" } }, + "packages/api-testing": { + "extraneous": true, + "devDependencies": {}, + "engines": { + "node": ">=18" + } + }, "packages/api/node_modules/@types/prettier": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-3.0.0.tgz", @@ -21227,11 +21140,114 @@ "prettier": "*" } }, - "packages/api/node_modules/json-schema-traverse": { + "packages/core": { + "name": "@api/core", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@readme/oas-to-har": "^20.1.1", + "caseless": "^0.12.0", + "datauri": "^4.1.0", + "fetch-har": "^10.0.0", + "get-stream": "^6.0.1", + "json-schema-traverse": "^1.0.0", + "lodash.merge": "^4.6.2", + "oas": "^21.1.1", + "remove-undefined-objects": "^4.0.2" + }, + "devDependencies": { + "@api/test-utils": "file:../test-utils", + "@readme/oas-examples": "^5.12.0", + "@types/caseless": "^0.12.3", + "@types/lodash.merge": "^4.6.7", + "@vitest/coverage-v8": "^0.34.4", + "fetch-mock": "^9.11.0", + "typescript": "^5.2.2", + "vitest": "^0.34.4" + }, + "engines": { + "node": ">=18" + } + }, + "packages/core/node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, + "packages/core/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "packages/core/node_modules/oas": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/oas/-/oas-21.1.1.tgz", + "integrity": "sha512-d4qHiZIlySPPEsToEKg6P9sju6vq+MjycjrFC2lrrwWRble+c60qjpenoPY0bopqi7VStZ6AQpLa9hVDeBScyQ==", + "dependencies": { + "@readme/json-schema-ref-parser": "^1.2.0", + "@types/json-schema": "^7.0.11", + "json-schema-merge-allof": "^0.8.1", + "jsonpath-plus": "^7.2.0", + "jsonpointer": "^5.0.0", + "memoizee": "^0.4.14", + "oas-normalize": "^9.0.0", + "openapi-types": "^12.1.1", + "path-to-regexp": "^6.2.0", + "remove-undefined-objects": "^4.0.2" + }, + "engines": { + "node": ">=16" + } + }, + "packages/core/node_modules/oas-normalize": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-9.0.0.tgz", + "integrity": "sha512-6G4uRemkP3YAr73lzJve0F9sbUnn88G5uCkuMSyIMnB4ml6Y6eRL7zpaE/0Oj0IU7zgCw8dszB2HpYOd/kM9rQ==", + "dependencies": { + "@readme/openapi-parser": "^2.5.0", + "@readme/postman-to-openapi": "^4.1.0", + "js-yaml": "^4.1.0", + "node-fetch": "^2.7.0", + "openapi-types": "^12.1.3", + "swagger2openapi": "^7.0.8" + }, + "engines": { + "node": ">=14" + } + }, + "packages/core/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "packages/core/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "packages/core/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "packages/httpsnippet-client-api": { "version": "6.1.1", "license": "MIT", @@ -21255,6 +21271,101 @@ "@readme/httpsnippet": ">=4", "oas": "^20.0.0" } + }, + "packages/test-utils": { + "name": "@api/test-utils", + "version": "1.0.0", + "dependencies": { + "caseless": "^0.12.0", + "datauri": "^4.1.0", + "formdata-to-string": "^1.0.0", + "vitest": "^0.34.4" + }, + "devDependencies": { + "@types/caseless": "^0.12.3", + "oas": "^21.1.1", + "typescript": "^5.2.2" + } + }, + "packages/test-utils/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "packages/test-utils/node_modules/oas": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/oas/-/oas-21.1.1.tgz", + "integrity": "sha512-d4qHiZIlySPPEsToEKg6P9sju6vq+MjycjrFC2lrrwWRble+c60qjpenoPY0bopqi7VStZ6AQpLa9hVDeBScyQ==", + "dev": true, + "dependencies": { + "@readme/json-schema-ref-parser": "^1.2.0", + "@types/json-schema": "^7.0.11", + "json-schema-merge-allof": "^0.8.1", + "jsonpath-plus": "^7.2.0", + "jsonpointer": "^5.0.0", + "memoizee": "^0.4.14", + "oas-normalize": "^9.0.0", + "openapi-types": "^12.1.1", + "path-to-regexp": "^6.2.0", + "remove-undefined-objects": "^4.0.2" + }, + "engines": { + "node": ">=16" + } + }, + "packages/test-utils/node_modules/oas-normalize": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-9.0.0.tgz", + "integrity": "sha512-6G4uRemkP3YAr73lzJve0F9sbUnn88G5uCkuMSyIMnB4ml6Y6eRL7zpaE/0Oj0IU7zgCw8dszB2HpYOd/kM9rQ==", + "dev": true, + "dependencies": { + "@readme/openapi-parser": "^2.5.0", + "@readme/postman-to-openapi": "^4.1.0", + "js-yaml": "^4.1.0", + "node-fetch": "^2.7.0", + "openapi-types": "^12.1.3", + "swagger2openapi": "^7.0.8" + }, + "engines": { + "node": ">=14" + } + }, + "packages/test-utils/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true + }, + "packages/test-utils/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true + }, + "packages/test-utils/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } } } } diff --git a/packages/api/package.json b/packages/api/package.json index ae383a7a..3f48681d 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -36,29 +36,21 @@ "swagger" ], "dependencies": { - "@readme/oas-to-har": "^20.0.2", "@readme/openapi-parser": "^2.4.0", - "caseless": "^0.12.0", "chalk": "^4.1.2", "commander": "^11.0.0", - "datauri": "^4.1.0", "execa": "^5.1.1", - "fetch-har": "^10.0.0", "figures": "^3.2.0", - "get-stream": "^6.0.1", "js-yaml": "^4.1.0", "json-schema-to-ts": "^2.9.2", - "json-schema-traverse": "^1.0.0", "lodash.camelcase": "^4.3.0", "lodash.deburr": "^4.1.0", - "lodash.merge": "^4.6.2", "lodash.setwith": "^4.3.2", "lodash.startcase": "^4.4.0", "make-dir": "^3.1.0", "oas": "^20.4.0", "ora": "^5.4.1", "prompts": "^2.4.2", - "remove-undefined-objects": "^2.0.2", "semver": "^7.3.8", "ssri": "^10.0.1", "ts-morph": "^17.0.1", @@ -66,11 +58,9 @@ }, "devDependencies": { "@readme/oas-examples": "^5.12.0", - "@types/caseless": "^0.12.3", "@types/js-yaml": "^4.0.5", "@types/lodash.camelcase": "^4.3.7", "@types/lodash.deburr": "^4.1.7", - "@types/lodash.merge": "^4.6.7", "@types/lodash.setwith": "^4.3.7", "@types/lodash.startcase": "^4.4.7", "@types/prettier": "^3.0.0", diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 513f48fa..c04ee9df 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -4,7 +4,7 @@ "baseUrl": "./src", "declaration": true, "esModuleInterop": true, - "lib": ["dom", "dom.iterable", "es2020"], + "lib": ["DOM", "DOM.Iterable", "ES2020"], "noImplicitAny": true, "outDir": "dist/" }, diff --git a/packages/core/.eslintrc b/packages/core/.eslintrc new file mode 100644 index 00000000..18dbe708 --- /dev/null +++ b/packages/core/.eslintrc @@ -0,0 +1,17 @@ +{ + "globals": { + "fetch": true, + "Response": true + }, + "parserOptions": { + "ecmaVersion": 2020 + }, + "rules": { + "@typescript-eslint/no-explicit-any": "off", // @todo fix these eventually + + "no-restricted-imports": ["error", { + "name": "fs/promises", + "message": "Please use `fs` instead as some client frameworks don't polyfill `fs/promises`." + }] + } +} diff --git a/packages/core/.gitignore b/packages/core/.gitignore new file mode 100644 index 00000000..ef229ed3 --- /dev/null +++ b/packages/core/.gitignore @@ -0,0 +1,3 @@ +coverage/ +dist/ +node_modules/ diff --git a/packages/core/.npmignore b/packages/core/.npmignore new file mode 100644 index 00000000..5324474f --- /dev/null +++ b/packages/core/.npmignore @@ -0,0 +1,7 @@ +.api/ +coverage/ +test/ +.eslint* +.gitignore +.prettier* +vitest* diff --git a/packages/core/LICENSE b/packages/core/LICENSE new file mode 100644 index 00000000..8e096215 --- /dev/null +++ b/packages/core/LICENSE @@ -0,0 +1,18 @@ +Copyright © 2023 ReadMe + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/core/package.json b/packages/core/package.json new file mode 100644 index 00000000..6369274c --- /dev/null +++ b/packages/core/package.json @@ -0,0 +1,48 @@ +{ + "name": "@api/core", + "version": "1.0.0", + "description": "The magic behind `api` 🧙", + "scripts": { + "build": "tsc", + "lint:types": "tsc --noEmit", + "prebuild": "rm -rf dist/", + "prepack": "npm run build", + "test": "vitest run --coverage" + }, + "repository": { + "type": "git", + "url": "https://github.com/readmeio/api.git", + "directory": "packages/core" + }, + "homepage": "https://api.readme.dev", + "bugs": { + "url": "https://github.com/readmeio/api/issues" + }, + "author": "Jon Ursenbach ", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "dependencies": { + "@readme/oas-to-har": "^20.1.1", + "caseless": "^0.12.0", + "datauri": "^4.1.0", + "fetch-har": "^10.0.0", + "get-stream": "^6.0.1", + "json-schema-traverse": "^1.0.0", + "lodash.merge": "^4.6.2", + "oas": "^21.1.1", + "remove-undefined-objects": "^4.0.2" + }, + "devDependencies": { + "@api/test-utils": "file:../test-utils", + "@readme/oas-examples": "^5.12.0", + "@types/caseless": "^0.12.3", + "@types/lodash.merge": "^4.6.7", + "@vitest/coverage-v8": "^0.34.4", + "fetch-mock": "^9.11.0", + "typescript": "^5.2.2", + "vitest": "^0.34.4" + }, + "prettier": "@readme/eslint-config/prettier" +} diff --git a/packages/api/src/core/errors/fetchError.ts b/packages/core/src/errors/fetchError.ts similarity index 100% rename from packages/api/src/core/errors/fetchError.ts rename to packages/core/src/errors/fetchError.ts diff --git a/packages/api/src/core/index.ts b/packages/core/src/index.ts similarity index 91% rename from packages/api/src/core/index.ts rename to packages/core/src/index.ts index 09c2a71e..349c356c 100644 --- a/packages/api/src/core/index.ts +++ b/packages/core/src/index.ts @@ -6,11 +6,11 @@ import oasToHar from '@readme/oas-to-har'; import fetchHar from 'fetch-har'; import FetchError from './errors/fetchError'; -import getJSONSchemaDefaults from './getJSONSchemaDefaults'; -import parseResponse from './parseResponse'; -import prepareAuth from './prepareAuth'; -import prepareParams from './prepareParams'; -import prepareServer from './prepareServer'; +import getJSONSchemaDefaults from './lib/getJSONSchemaDefaults'; +import parseResponse from './lib/parseResponse'; +import prepareAuth from './lib/prepareAuth'; +import prepareParams from './lib/prepareParams'; +import prepareServer from './lib/prepareServer'; export interface ConfigOptions { /** @@ -104,12 +104,12 @@ export default class APICore { // @ts-expect-error `this.auth` typing is off. FIXME const har = oasToHar(this.spec, operation, data, prepareAuth(this.auth, operation)); - let timeoutSignal: any; + let timeoutSignal: NodeJS.Timeout; const init: RequestInit = {}; if (this.config.timeout) { const controller = new AbortController(); timeoutSignal = setTimeout(() => controller.abort(), this.config.timeout); - init.signal = controller.signal as any; + init.signal = controller.signal; } return fetchHar(har as any, { diff --git a/packages/api/src/core/getJSONSchemaDefaults.ts b/packages/core/src/lib/getJSONSchemaDefaults.ts similarity index 100% rename from packages/api/src/core/getJSONSchemaDefaults.ts rename to packages/core/src/lib/getJSONSchemaDefaults.ts diff --git a/packages/api/src/core/parseResponse.ts b/packages/core/src/lib/parseResponse.ts similarity index 95% rename from packages/api/src/core/parseResponse.ts rename to packages/core/src/lib/parseResponse.ts index 7e1f53b9..ec4db6e3 100644 --- a/packages/api/src/core/parseResponse.ts +++ b/packages/core/src/lib/parseResponse.ts @@ -8,7 +8,7 @@ export default async function getResponseBody(response: Response) { const responseBody = await response.text(); - let data = responseBody; + let data: any = responseBody; if (isJSON) { try { data = JSON.parse(responseBody); diff --git a/packages/api/src/core/prepareAuth.ts b/packages/core/src/lib/prepareAuth.ts similarity index 100% rename from packages/api/src/core/prepareAuth.ts rename to packages/core/src/lib/prepareAuth.ts diff --git a/packages/api/src/core/prepareParams.ts b/packages/core/src/lib/prepareParams.ts similarity index 100% rename from packages/api/src/core/prepareParams.ts rename to packages/core/src/lib/prepareParams.ts diff --git a/packages/api/src/core/prepareServer.ts b/packages/core/src/lib/prepareServer.ts similarity index 100% rename from packages/api/src/core/prepareServer.ts rename to packages/core/src/lib/prepareServer.ts diff --git a/packages/core/test/.eslintrc b/packages/core/test/.eslintrc new file mode 100644 index 00000000..716c33cc --- /dev/null +++ b/packages/core/test/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "@readme/eslint-config/testing/vitest" +} diff --git a/packages/core/test/global.d.ts b/packages/core/test/global.d.ts new file mode 100644 index 00000000..62cb4842 --- /dev/null +++ b/packages/core/test/global.d.ts @@ -0,0 +1 @@ +import '@api/test-utils/src/vitest.matchers'; diff --git a/packages/api/test/core/index.test.ts b/packages/core/test/index.test.ts similarity index 96% rename from packages/api/test/core/index.test.ts rename to packages/core/test/index.test.ts index b889571a..4736ace6 100644 --- a/packages/api/test/core/index.test.ts +++ b/packages/core/test/index.test.ts @@ -1,14 +1,14 @@ import assert from 'assert'; +import { responses as mockResponse } from '@api/test-utils/src/fetch-mock'; +import loadSpec from '@api/test-utils/src/load-spec'; import datauri from 'datauri'; import fetchMock from 'fetch-mock'; import Oas from 'oas'; import { describe, beforeEach, afterEach, it, expect } from 'vitest'; -import APICore from '../../src/core'; -import FetchError from '../../src/core/errors/fetchError'; -import { responses as mockResponse } from '../helpers/fetch-mock'; -import loadSpec from '../helpers/load-spec'; +import APICore from '../src'; +import FetchError from '../src/errors/fetchError'; describe('APICore', () => { let fileUploads: APICore; @@ -88,11 +88,13 @@ describe('APICore', () => { .fetch('/pets/{id}', 'delete', undefined, { id: petId }) .then(() => assert.fail()) .catch(err => { + /* eslint-disable vitest/no-conditional-expect */ expect(err).toBeInstanceOf(FetchError); expect(err.status).toBe(404); expect(err.data).toBe('Could not find that pet.'); expect(err.headers).toHaveHeader('content-type', /text\/plain/); expect(err.res.constructor.name).toBe('Response'); + /* eslint-enable vitest/no-conditional-expect */ }); }); }); @@ -238,7 +240,7 @@ describe('APICore', () => { it('should support `image/png` requests', async () => { fetchMock.post('https://httpbin.org/anything/image-png', mockResponse.datauri); - const file = `${__dirname}/../__fixtures__/owlbert.png`; + const file = require.resolve('@api/test-utils/src/fixtures/owlbert.png'); const { data } = await fileUploads.fetch('/anything/image-png', 'post', file); @@ -260,6 +262,7 @@ describe('APICore', () => { }; const { data } = await parametersStyle.fetch('/anything/form-data/form', 'post', body); + expect(data.uri).toBe('/anything/form-data/form'); expect(data.requestBody.split(`${data.boundary}`).filter(Boolean)).toStrictEqual([ '\r\nContent-Disposition: form-data; name="primitive"\r\n\r\nstring\r\n', @@ -276,7 +279,7 @@ describe('APICore', () => { const body = { orderId: 1234, userId: 5678, - documentFile: `${__dirname}/../__fixtures__/hello.txt`, + documentFile: require.resolve('@api/test-utils/src/fixtures/hello.txt'), }; const { data } = await fileUploads.fetch('/anything/multipart-formdata', 'post', body); @@ -293,7 +296,7 @@ describe('APICore', () => { fetchMock.post('https://httpbin.org/anything/multipart-formdata', mockResponse.multipart); const body = { - documentFile: `${__dirname}/../__fixtures__/hello.jp.txt`, + documentFile: require.resolve('@api/test-utils/src/fixtures/hello.jp.txt'), }; const { data } = await fileUploads.fetch('/anything/multipart-formdata', 'post', body); diff --git a/packages/api/test/core/getJSONSchemaDefaults.test.ts b/packages/core/test/lib/getJSONSchemaDefaults.test.ts similarity index 86% rename from packages/api/test/core/getJSONSchemaDefaults.test.ts rename to packages/core/test/lib/getJSONSchemaDefaults.test.ts index f931df20..7b8862fb 100644 --- a/packages/api/test/core/getJSONSchemaDefaults.test.ts +++ b/packages/core/test/lib/getJSONSchemaDefaults.test.ts @@ -1,8 +1,8 @@ +import loadSpec from '@api/test-utils/src/load-spec'; import Oas from 'oas'; import { describe, it, expect } from 'vitest'; -import getJSONSchemaDefaults from '../../src/core/getJSONSchemaDefaults'; -import loadSpec from '../helpers/load-spec'; +import getJSONSchemaDefaults from '../../src/lib/getJSONSchemaDefaults'; describe('#getJSONSchemaDefaults()', () => { it('should get defaults off an operation', async () => { @@ -24,7 +24,7 @@ describe('#getJSONSchemaDefaults()', () => { }); it('should be able to handle nested objects', async () => { - const oas = await loadSpec('../__fixtures__/definitions/nested-defaults.json').then(Oas.init); + const oas = await loadSpec('@api/test-utils/src/fixtures/definitions/nested-defaults.json').then(Oas.init); await oas.dereference(); const operation = oas.operation('/pet', 'post'); diff --git a/packages/api/test/core/parseResponse.test.ts b/packages/core/test/lib/parseResponse.test.ts similarity index 98% rename from packages/api/test/core/parseResponse.test.ts rename to packages/core/test/lib/parseResponse.test.ts index 42e9fc89..623ca556 100644 --- a/packages/api/test/core/parseResponse.test.ts +++ b/packages/core/test/lib/parseResponse.test.ts @@ -1,6 +1,6 @@ import { describe, beforeEach, it, expect } from 'vitest'; -import parseResponse from '../../src/core/parseResponse'; +import parseResponse from '../../src/lib/parseResponse'; const responseBody = JSON.stringify({ id: 9205436248879918000, diff --git a/packages/api/test/core/prepareAuth.test.ts b/packages/core/test/lib/prepareAuth.test.ts similarity index 97% rename from packages/api/test/core/prepareAuth.test.ts rename to packages/core/test/lib/prepareAuth.test.ts index 389c1a9f..341abbae 100644 --- a/packages/api/test/core/prepareAuth.test.ts +++ b/packages/core/test/lib/prepareAuth.test.ts @@ -1,10 +1,10 @@ import type { OASDocument } from 'oas/dist/rmoas.types'; +import loadSpec from '@api/test-utils/src/load-spec'; import Oas from 'oas'; import { describe, beforeAll, it, expect } from 'vitest'; -import prepareAuth from '../../src/core/prepareAuth'; -import loadSpec from '../helpers/load-spec'; +import prepareAuth from '../../src/lib/prepareAuth'; let oas: Oas; @@ -167,7 +167,7 @@ describe('#prepareAuth()', () => { let securityMultipleOas; beforeAll(async () => { - authQuirksOas = await loadSpec(require.resolve('../__fixtures__/definitions/auth-quirks.json')); + authQuirksOas = await loadSpec(require.resolve('@api/test-utils/src/fixtures/definitions/auth-quirks.json')); securityMultipleOas = await loadSpec('@readme/oas-examples/3.0/json/security-multiple.json'); }); diff --git a/packages/api/test/core/prepareParams.test.ts b/packages/core/test/lib/prepareParams.test.ts similarity index 94% rename from packages/api/test/core/prepareParams.test.ts rename to packages/core/test/lib/prepareParams.test.ts index 6af34051..979e2ff5 100644 --- a/packages/api/test/core/prepareParams.test.ts +++ b/packages/core/test/lib/prepareParams.test.ts @@ -1,11 +1,11 @@ import fs from 'fs'; +import payloadExamples from '@api/test-utils/src/fixtures/definitions/payloads.json'; +import loadSpec from '@api/test-utils/src/load-spec'; import Oas from 'oas'; import { describe, beforeEach, it, expect } from 'vitest'; -import prepareParams from '../../src/core/prepareParams'; -import payloadExamples from '../__fixtures__/definitions/payloads.json'; -import loadSpec from '../helpers/load-spec'; +import prepareParams from '../../src/lib/prepareParams'; describe('#prepareParams', () => { let fileUploads: Oas; @@ -165,7 +165,7 @@ describe('#prepareParams', () => { describe('image/png', () => { it('should support a file path payload', async () => { const operation = fileUploads.operation('/anything/image-png', 'post'); - const body = `${__dirname}/../__fixtures__/owlbert.png`; + const body = require.resolve('@api/test-utils/src/fixtures/owlbert.png'); const res = await prepareParams(operation, body); expect(res.body).toContain('data:image/png;name=owlbert.png;base64,'); @@ -174,7 +174,7 @@ describe('#prepareParams', () => { it('should support a file stream payload', async () => { const operation = fileUploads.operation('/anything/image-png', 'post'); - const body = fs.createReadStream('./test/__fixtures__/owlbert.png'); + const body = fs.createReadStream(require.resolve('@api/test-utils/src/fixtures/owlbert.png')); const res = await prepareParams(operation, body); expect(res.body).toContain('data:image/png;name=owlbert.png;base64,'); @@ -197,7 +197,7 @@ describe('#prepareParams', () => { it('should handle when the file path is relative', async () => { const operation = fileUploads.operation('/anything/multipart-formdata', 'post'); const body = { - documentFile: './test/__fixtures__/owlbert.png', + documentFile: require.resolve('@api/test-utils/src/fixtures/owlbert.png'), }; const res = await prepareParams(operation, body); @@ -208,7 +208,7 @@ describe('#prepareParams', () => { it('should handle a multipart body when a property is a file stream', async () => { const operation = fileUploads.operation('/anything/multipart-formdata', 'post'); const body = { - documentFile: fs.createReadStream('./test/__fixtures__/owlbert.png'), + documentFile: fs.createReadStream(require.resolve('@api/test-utils/src/fixtures/owlbert.png')), }; const res = await prepareParams(operation, body); @@ -236,12 +236,12 @@ describe('#prepareParams', () => { it("should not reject files that don't exist", async () => { const operation = fileUploads.operation('/anything/multipart-formdata', 'post'); const body = { - documentFile: './test/__fixtures__/owlbert.jpg', + documentFile: './owlbert.doesntexist.jpg', }; await expect(prepareParams(operation, body)).resolves.toStrictEqual({ body: { - documentFile: './test/__fixtures__/owlbert.jpg', + documentFile: './owlbert.doesntexist.jpg', }, }); }); @@ -381,7 +381,7 @@ describe('#prepareParams', () => { describe('quirks', () => { it('should not send special headers in body payloads', async () => { - const basiq = await import('../__fixtures__/definitions/basiq.json').then(Oas.init); + const basiq = await import('@api/test-utils/src/fixtures/definitions/basiq.json').then(Oas.init); await basiq.dereference(); const operation = basiq.operation('/token', 'post'); @@ -400,7 +400,7 @@ describe('#prepareParams', () => { }); it('should not duplicate a supplied header parameter if that header casing matches the spec', async () => { - const basiq = await import('../__fixtures__/definitions/basiq.json').then(Oas.init); + const basiq = await import('@api/test-utils/src/fixtures/definitions/basiq.json').then(Oas.init); await basiq.dereference(); const operation = basiq.operation('/token', 'post'); @@ -482,7 +482,7 @@ describe('#prepareParams', () => { describe('defaults', () => { it('should prefill defaults for required body parameters if not supplied', async () => { - const oas = await loadSpec('../__fixtures__/definitions/nested-defaults.json').then(Oas.init); + const oas = await loadSpec('@api/test-utils/src/fixtures/definitions/nested-defaults.json').then(Oas.init); await oas.dereference(); const operation = oas.operation('/pet', 'post'); diff --git a/packages/core/test/tsconfig.json b/packages/core/test/tsconfig.json new file mode 100644 index 00000000..5752383d --- /dev/null +++ b/packages/core/test/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "noImplicitAny": false, + "resolveJsonModule": true + }, + "include": ["../src/**/*", "*.ts", "**/*"] +} diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json new file mode 100644 index 00000000..5acf6120 --- /dev/null +++ b/packages/core/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "allowJs": true, + "baseUrl": "./src", + "declaration": true, + "esModuleInterop": true, + "lib": ["DOM", "DOM.Iterable", "ES2020"], + "noImplicitAny": true, + "outDir": "dist/", + "strict": false + }, + "include": ["./src/**/*"] +} diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts new file mode 100644 index 00000000..8d2efd6e --- /dev/null +++ b/packages/core/vitest.config.ts @@ -0,0 +1,8 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + setupFiles: ['@api/test-utils/src/vitest.matchers.ts'], + }, +}); diff --git a/packages/httpsnippet-client-api/tsconfig.json b/packages/httpsnippet-client-api/tsconfig.json index 058cffd5..b785b2bb 100644 --- a/packages/httpsnippet-client-api/tsconfig.json +++ b/packages/httpsnippet-client-api/tsconfig.json @@ -4,7 +4,7 @@ "baseUrl": "./src", "declaration": true, "esModuleInterop": true, - "lib": ["dom", "es2020"], + "lib": ["DOM", "ES2020"], "noImplicitAny": true, "outDir": "dist/" }, diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json new file mode 100644 index 00000000..da19dffd --- /dev/null +++ b/packages/test-utils/package.json @@ -0,0 +1,20 @@ +{ + "private": true, + "name": "@api/test-utils", + "version": "1.0.0", + "scripts": { + "lint:types": "tsc --noEmit" + }, + "dependencies": { + "caseless": "^0.12.0", + "datauri": "^4.1.0", + "formdata-to-string": "^1.0.0", + "vitest": "^0.34.4" + }, + "devDependencies": { + "@types/caseless": "^0.12.3", + "oas": "^21.1.1", + "typescript": "^5.2.2" + }, + "prettier": "@readme/eslint-config/prettier" +} diff --git a/packages/api/test/helpers/fetch-mock.ts b/packages/test-utils/src/fetch-mock.ts similarity index 72% rename from packages/api/test/helpers/fetch-mock.ts rename to packages/test-utils/src/fetch-mock.ts index e43d764f..d3076fe7 100644 --- a/packages/api/test/helpers/fetch-mock.ts +++ b/packages/test-utils/src/fetch-mock.ts @@ -11,7 +11,7 @@ export const response = { }; export const responses = { - all: (url, opts) => { + all: (url: string, opts: RequestInit) => { return { uri: new URL(url).pathname, headers: Object.fromEntries(opts.headers as unknown as []), @@ -19,7 +19,7 @@ export const responses = { }; }, - datauri: (url, opts) => { + datauri: (url: string, opts: RequestInit) => { const buffer = Buffer.from(opts.body as string, 'hex'); const parser = new DatauriParser(); @@ -30,21 +30,21 @@ export const responses = { }; }, - delay: (res, delay) => { + delay: (res: string | Record, delay: number) => { return new Promise(resolve => { setTimeout(() => resolve(res), delay); }); }, - headers: (url, opts) => { + headers: (url: string, opts: RequestInit) => { // `opts.headers` returns a `HeadersList` object instead of `Headers` as the typing suggests so // we need to convert it to an array before converting it to an object. return Object.fromEntries(opts.headers as unknown as []); }, - multipart: async (url, opts) => { - const headers = objectifyHeaders(opts.headers); - const payload = await formDataToString(opts.body); + multipart: async (url: string, opts: RequestInit) => { + const headers = objectifyHeaders(opts.headers as unknown as []); + const payload = await formDataToString(opts.body as FormData); return { uri: new URL(url).pathname, @@ -54,12 +54,12 @@ export const responses = { }; }, - real: res => { + real: (res: string | Record) => { return () => res; }, requestBody: () => { - return (url, opts) => { + return (url: string, opts: RequestInit) => { return { uri: new URL(url).pathname, requestBody: JSON.parse(opts.body as string), @@ -67,13 +67,13 @@ export const responses = { }; }, - searchParams: url => { + searchParams: (url: string) => { const res = new URL(url); return `${res.pathname}${res.search}`; }, url: (prop: keyof URL) => { - return url => { + return (url: string) => { return new URL(url)[prop]; }; }, diff --git a/packages/api/test/__fixtures__/definitions/alby.json b/packages/test-utils/src/fixtures/definitions/alby.json similarity index 100% rename from packages/api/test/__fixtures__/definitions/alby.json rename to packages/test-utils/src/fixtures/definitions/alby.json diff --git a/packages/api/test/__fixtures__/definitions/auth-quirks.json b/packages/test-utils/src/fixtures/definitions/auth-quirks.json similarity index 100% rename from packages/api/test/__fixtures__/definitions/auth-quirks.json rename to packages/test-utils/src/fixtures/definitions/auth-quirks.json diff --git a/packages/api/test/__fixtures__/definitions/basiq.json b/packages/test-utils/src/fixtures/definitions/basiq.json similarity index 100% rename from packages/api/test/__fixtures__/definitions/basiq.json rename to packages/test-utils/src/fixtures/definitions/basiq.json diff --git a/packages/api/test/__fixtures__/definitions/nested-defaults.json b/packages/test-utils/src/fixtures/definitions/nested-defaults.json similarity index 100% rename from packages/api/test/__fixtures__/definitions/nested-defaults.json rename to packages/test-utils/src/fixtures/definitions/nested-defaults.json diff --git a/packages/api/test/__fixtures__/definitions/operationid-quirks.json b/packages/test-utils/src/fixtures/definitions/operationid-quirks.json similarity index 100% rename from packages/api/test/__fixtures__/definitions/operationid-quirks.json rename to packages/test-utils/src/fixtures/definitions/operationid-quirks.json diff --git a/packages/api/test/__fixtures__/definitions/optional-payload.json b/packages/test-utils/src/fixtures/definitions/optional-payload.json similarity index 100% rename from packages/api/test/__fixtures__/definitions/optional-payload.json rename to packages/test-utils/src/fixtures/definitions/optional-payload.json diff --git a/packages/api/test/__fixtures__/definitions/payloads.json b/packages/test-utils/src/fixtures/definitions/payloads.json similarity index 100% rename from packages/api/test/__fixtures__/definitions/payloads.json rename to packages/test-utils/src/fixtures/definitions/payloads.json diff --git a/packages/api/test/__fixtures__/definitions/response-title-quirks.json b/packages/test-utils/src/fixtures/definitions/response-title-quirks.json similarity index 100% rename from packages/api/test/__fixtures__/definitions/response-title-quirks.json rename to packages/test-utils/src/fixtures/definitions/response-title-quirks.json diff --git a/packages/api/test/__fixtures__/definitions/simple.json b/packages/test-utils/src/fixtures/definitions/simple.json similarity index 100% rename from packages/api/test/__fixtures__/definitions/simple.json rename to packages/test-utils/src/fixtures/definitions/simple.json diff --git a/packages/api/test/__fixtures__/hello.jp.txt b/packages/test-utils/src/fixtures/hello.jp.txt similarity index 100% rename from packages/api/test/__fixtures__/hello.jp.txt rename to packages/test-utils/src/fixtures/hello.jp.txt diff --git a/packages/api/test/__fixtures__/hello.txt b/packages/test-utils/src/fixtures/hello.txt similarity index 100% rename from packages/api/test/__fixtures__/hello.txt rename to packages/test-utils/src/fixtures/hello.txt diff --git a/packages/api/test/__fixtures__/owlbert-shrub.png b/packages/test-utils/src/fixtures/owlbert-shrub.png similarity index 100% rename from packages/api/test/__fixtures__/owlbert-shrub.png rename to packages/test-utils/src/fixtures/owlbert-shrub.png diff --git a/packages/api/test/__fixtures__/owlbert.png b/packages/test-utils/src/fixtures/owlbert.png similarity index 100% rename from packages/api/test/__fixtures__/owlbert.png rename to packages/test-utils/src/fixtures/owlbert.png diff --git a/packages/api/test/helpers/load-spec.ts b/packages/test-utils/src/load-spec.ts similarity index 100% rename from packages/api/test/helpers/load-spec.ts rename to packages/test-utils/src/load-spec.ts diff --git a/packages/api/test/helpers/vitest.matchers.ts b/packages/test-utils/src/vitest.matchers.ts similarity index 83% rename from packages/api/test/helpers/vitest.matchers.ts rename to packages/test-utils/src/vitest.matchers.ts index 66c74b4b..a9f42206 100644 --- a/packages/api/test/helpers/vitest.matchers.ts +++ b/packages/test-utils/src/vitest.matchers.ts @@ -31,6 +31,7 @@ interface CustomMatchers { } declare module 'vitest' { + // eslint-disable-next-line @typescript-eslint/no-explicit-any interface Assertion extends CustomMatchers {} interface AsymmetricMatchersContaining extends CustomMatchers {} } @@ -51,25 +52,14 @@ expect.extend({ }; }, - toHaveCustomUserAgent(headers: string[]) { - const userAgent = headers['user-agent']; - const pass = userAgent.match(/^api \(node\)\/(\d+.\d+(.\d+|unit-testing))$/); - - if (!pass) { - return { - message: () => `expected a custom \`user-agent\` header to be present.\n\nreceived: ${userAgent}`, - pass: false, - }; - } - - return { - message: () => `expected a custom \`user-agent\` header to not be present\n\nreceived: ${userAgent}`, - pass: true, - }; - }, - toHaveHeader(obj: Headers, header: string, expected: RegExp | (string | number)[] | string) { - const headers = caseless(Object.fromEntries(Array.from(obj.entries()))); + const headers = caseless( + Object.fromEntries( + // @ts-expect-error Despite the Node typings saying otherwise `Headers.entries()` exists. + // https://developer.mozilla.org/en-US/docs/Web/API/Headers/entries + Array.from(obj.entries()), + ), + ); // Header value should match a given regex. if (expected instanceof RegExp) { diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json new file mode 100644 index 00000000..10e66b0b --- /dev/null +++ b/packages/test-utils/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "allowJs": true, + "baseUrl": "./src", + "declaration": true, + "esModuleInterop": true, + "noEmit": true, + "noImplicitAny": true + }, + "include": ["./src/**/*"] +} From 2da058c5ef9b25be49fd6e32ecba77d5fa696fb5 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 13 Sep 2023 17:39:03 -0700 Subject: [PATCH 2/8] refactor(core): splitting the core library out into an isolated package --- package-lock.json | 188 +----------------- packages/api/package.json | 4 +- .../src/cli/codegen/languages/typescript.ts | 12 +- .../api/test/__fixtures__/sdk/alby/index.ts | 8 +- .../api/test/__fixtures__/sdk/alby/schemas.ts | 88 ++++---- .../api/test/__fixtures__/sdk/alby/types.ts | 2 - .../sdk/operationid-quirks/index.ts | 6 +- .../sdk/optional-payload/index.ts | 6 +- .../test/__fixtures__/sdk/petstore/index.ts | 4 +- .../test/__fixtures__/sdk/petstore/schemas.ts | 2 +- .../api/test/__fixtures__/sdk/readme/index.ts | 6 +- .../test/__fixtures__/sdk/readme/schemas.ts | 38 +--- .../api/test/__fixtures__/sdk/readme/types.ts | 14 -- .../sdk/response-title-quirks/index.ts | 6 +- .../sdk/response-title-quirks/schemas.ts | 2 +- .../__fixtures__/sdk/simple-js-cjs/index.d.ts | 4 +- .../__fixtures__/sdk/simple-js-cjs/index.js | 4 +- .../sdk/simple-js-cjs/schemas.d.ts | 102 +--------- .../__fixtures__/sdk/simple-js-cjs/types.d.ts | 3 - .../__fixtures__/sdk/simple-js-esm/index.d.ts | 4 +- .../__fixtures__/sdk/simple-js-esm/index.js | 4 +- .../sdk/simple-js-esm/schemas.d.ts | 102 +--------- .../__fixtures__/sdk/simple-js-esm/types.d.ts | 3 - .../test/__fixtures__/sdk/simple-ts/index.ts | 8 +- .../__fixtures__/sdk/simple-ts/schemas.ts | 12 +- .../test/__fixtures__/sdk/simple-ts/types.ts | 3 - .../cli/codegen/languages/typescript.test.ts | 18 +- packages/api/test/cli/fetcher.test.ts | 2 +- packages/api/test/cli/storage.test.ts | 2 +- packages/api/test/global.d.ts | 2 +- packages/api/vitest.config.ts | 2 +- packages/core/package.json | 6 +- packages/core/src/index.ts | 23 ++- packages/core/src/lib/parseResponse.ts | 4 +- packages/test-utils/package.json | 2 +- .../src}/datasets/real-world-apis.json | 0 .../src}/datasets/refresh-dataset | 1 - packages/test-utils/src/vitest.matchers.ts | 5 - 38 files changed, 142 insertions(+), 560 deletions(-) rename packages/{api/test => test-utils/src}/datasets/real-world-apis.json (100%) rename packages/{api/test => test-utils/src}/datasets/refresh-dataset (99%) diff --git a/package-lock.json b/package-lock.json index 9b28cf6e..ed67e5b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16068,14 +16068,6 @@ "url": "https://github.com/Mermade/oas-kit?sponsor=1" } }, - "node_modules/oas/node_modules/remove-undefined-objects": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-3.0.0.tgz", - "integrity": "sha512-nxG1yYfc/Jxi+bNCBiqKhxVJPE+QvziIOKbD+Dxc93Uisz92v/ZYpo4WR0TJuf+dk2xE8lW2WPJsA3mDFzXy8w==", - "engines": { - "node": ">=16" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -17831,9 +17823,9 @@ } }, "node_modules/remove-undefined-objects": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-4.0.2.tgz", - "integrity": "sha512-6Nh52HADM60lhewwWU30ujMzTjYJk4M5q/LhRYLAacP0hTbzjVWiBVlV84U5RsQA4wDKLwkL0r0qJvti2hRLeQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-3.0.0.tgz", + "integrity": "sha512-nxG1yYfc/Jxi+bNCBiqKhxVJPE+QvziIOKbD+Dxc93Uisz92v/ZYpo4WR0TJuf+dk2xE8lW2WPJsA3mDFzXy8w==", "engines": { "node": ">=16" } @@ -21075,6 +21067,7 @@ "version": "6.1.1", "license": "MIT", "dependencies": { + "@api/core": "file:../core", "@readme/openapi-parser": "^2.4.0", "chalk": "^4.1.2", "commander": "^11.0.0", @@ -21099,20 +21092,19 @@ "api": "bin/api" }, "devDependencies": { + "@api/test-utils": "file:../test-utils", "@readme/oas-examples": "^5.12.0", "@types/js-yaml": "^4.0.5", "@types/lodash.camelcase": "^4.3.7", "@types/lodash.deburr": "^4.1.7", "@types/lodash.setwith": "^4.3.7", "@types/lodash.startcase": "^4.4.7", - "@types/prettier": "^3.0.0", "@types/prompts": "^2.4.4", "@types/semver": "^7.5.1", "@types/ssri": "^7.1.1", "@types/validate-npm-package-name": "^4.0.0", "@vitest/coverage-v8": "^0.34.1", "fetch-mock": "^9.11.0", - "formdata-to-string": "^1.0.0", "oas-normalize": "^8.3.2", "type-fest": "^4.3.1", "typescript": "^5.2.2", @@ -21130,16 +21122,6 @@ "node": ">=18" } }, - "packages/api/node_modules/@types/prettier": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-3.0.0.tgz", - "integrity": "sha512-mFMBfMOz8QxhYVbuINtswBp9VL2b4Y0QqYHwqLz3YbgtfAcat2Dl6Y1o4e22S/OVE6Ebl9m7wWiMT2lSbAs1wA==", - "deprecated": "This is a stub types definition. prettier provides its own type definitions, so you do not need this installed.", - "dev": true, - "dependencies": { - "prettier": "*" - } - }, "packages/core": { "name": "@api/core", "version": "1.0.0", @@ -21152,8 +21134,8 @@ "get-stream": "^6.0.1", "json-schema-traverse": "^1.0.0", "lodash.merge": "^4.6.2", - "oas": "^21.1.1", - "remove-undefined-objects": "^4.0.2" + "oas": "^20.10.3", + "remove-undefined-objects": "^3.0.0" }, "devDependencies": { "@api/test-utils": "file:../test-utils", @@ -21174,80 +21156,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, - "packages/core/node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "packages/core/node_modules/oas": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/oas/-/oas-21.1.1.tgz", - "integrity": "sha512-d4qHiZIlySPPEsToEKg6P9sju6vq+MjycjrFC2lrrwWRble+c60qjpenoPY0bopqi7VStZ6AQpLa9hVDeBScyQ==", - "dependencies": { - "@readme/json-schema-ref-parser": "^1.2.0", - "@types/json-schema": "^7.0.11", - "json-schema-merge-allof": "^0.8.1", - "jsonpath-plus": "^7.2.0", - "jsonpointer": "^5.0.0", - "memoizee": "^0.4.14", - "oas-normalize": "^9.0.0", - "openapi-types": "^12.1.1", - "path-to-regexp": "^6.2.0", - "remove-undefined-objects": "^4.0.2" - }, - "engines": { - "node": ">=16" - } - }, - "packages/core/node_modules/oas-normalize": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-9.0.0.tgz", - "integrity": "sha512-6G4uRemkP3YAr73lzJve0F9sbUnn88G5uCkuMSyIMnB4ml6Y6eRL7zpaE/0Oj0IU7zgCw8dszB2HpYOd/kM9rQ==", - "dependencies": { - "@readme/openapi-parser": "^2.5.0", - "@readme/postman-to-openapi": "^4.1.0", - "js-yaml": "^4.1.0", - "node-fetch": "^2.7.0", - "openapi-types": "^12.1.3", - "swagger2openapi": "^7.0.8" - }, - "engines": { - "node": ">=14" - } - }, - "packages/core/node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "packages/core/node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "packages/core/node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "packages/httpsnippet-client-api": { "version": "6.1.1", "license": "MIT", @@ -21283,89 +21191,9 @@ }, "devDependencies": { "@types/caseless": "^0.12.3", - "oas": "^21.1.1", + "oas": "^20.10.3", "typescript": "^5.2.2" } - }, - "packages/test-utils/node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "packages/test-utils/node_modules/oas": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/oas/-/oas-21.1.1.tgz", - "integrity": "sha512-d4qHiZIlySPPEsToEKg6P9sju6vq+MjycjrFC2lrrwWRble+c60qjpenoPY0bopqi7VStZ6AQpLa9hVDeBScyQ==", - "dev": true, - "dependencies": { - "@readme/json-schema-ref-parser": "^1.2.0", - "@types/json-schema": "^7.0.11", - "json-schema-merge-allof": "^0.8.1", - "jsonpath-plus": "^7.2.0", - "jsonpointer": "^5.0.0", - "memoizee": "^0.4.14", - "oas-normalize": "^9.0.0", - "openapi-types": "^12.1.1", - "path-to-regexp": "^6.2.0", - "remove-undefined-objects": "^4.0.2" - }, - "engines": { - "node": ">=16" - } - }, - "packages/test-utils/node_modules/oas-normalize": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-9.0.0.tgz", - "integrity": "sha512-6G4uRemkP3YAr73lzJve0F9sbUnn88G5uCkuMSyIMnB4ml6Y6eRL7zpaE/0Oj0IU7zgCw8dszB2HpYOd/kM9rQ==", - "dev": true, - "dependencies": { - "@readme/openapi-parser": "^2.5.0", - "@readme/postman-to-openapi": "^4.1.0", - "js-yaml": "^4.1.0", - "node-fetch": "^2.7.0", - "openapi-types": "^12.1.3", - "swagger2openapi": "^7.0.8" - }, - "engines": { - "node": ">=14" - } - }, - "packages/test-utils/node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true - }, - "packages/test-utils/node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true - }, - "packages/test-utils/node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } } } } diff --git a/packages/api/package.json b/packages/api/package.json index 3f48681d..e42d560a 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -36,6 +36,7 @@ "swagger" ], "dependencies": { + "@api/core": "file:../core", "@readme/openapi-parser": "^2.4.0", "chalk": "^4.1.2", "commander": "^11.0.0", @@ -57,20 +58,19 @@ "validate-npm-package-name": "^5.0.0" }, "devDependencies": { + "@api/test-utils": "file:../test-utils", "@readme/oas-examples": "^5.12.0", "@types/js-yaml": "^4.0.5", "@types/lodash.camelcase": "^4.3.7", "@types/lodash.deburr": "^4.1.7", "@types/lodash.setwith": "^4.3.7", "@types/lodash.startcase": "^4.4.7", - "@types/prettier": "^3.0.0", "@types/prompts": "^2.4.4", "@types/semver": "^7.5.1", "@types/ssri": "^7.1.1", "@types/validate-npm-package-name": "^4.0.0", "@vitest/coverage-v8": "^0.34.1", "fetch-mock": "^9.11.0", - "formdata-to-string": "^1.0.0", "oas-normalize": "^8.3.2", "type-fest": "^4.3.1", "typescript": "^5.2.2", diff --git a/packages/api/src/cli/codegen/languages/typescript.ts b/packages/api/src/cli/codegen/languages/typescript.ts index 8a95abf2..c3f1ea1e 100644 --- a/packages/api/src/cli/codegen/languages/typescript.ts +++ b/packages/api/src/cli/codegen/languages/typescript.ts @@ -87,7 +87,7 @@ export default class TSGenerator extends CodeGeneratorLanguage { this.requiredPackages = { api: { - reason: "Required for the `api/dist/core` library that the codegen'd SDK uses for making requests.", + reason: "Required for the `@api/core` library that the codegen'd SDK uses for making requests.", url: 'https://npm.im/api', }, 'json-schema-to-ts': { @@ -95,7 +95,7 @@ export default class TSGenerator extends CodeGeneratorLanguage { url: 'https://npm.im/json-schema-to-ts', }, oas: { - reason: 'Used within `api/dist/core` and is also loaded for TypeScript types.', + reason: 'Used within `@api/core` and is also loaded for TypeScript types.', url: 'https://npm.im/oas', }, }; @@ -230,7 +230,7 @@ export default class TSGenerator extends CodeGeneratorLanguage { sdkSource .getImportDeclarations() .find(id => id.getText().includes('HTTPMethodRange')) - .replaceWithText("import type { ConfigOptions, FetchResponse } from 'api/dist/core'"); + .replaceWithText("import type { ConfigOptions, FetchResponse } from '@api/core'"); } if (this.outputJS) { @@ -301,10 +301,10 @@ export default class TSGenerator extends CodeGeneratorLanguage { { // `HTTPMethodRange` will be conditionally removed later if it ends up not being used. defaultImport: 'type { ConfigOptions, FetchResponse, HTTPMethodRange }', - moduleSpecifier: 'api/dist/core', + moduleSpecifier: '@api/core', }, { defaultImport: 'Oas', moduleSpecifier: 'oas' }, - { defaultImport: 'APICore', moduleSpecifier: 'api/dist/core' }, + { defaultImport: 'APICore', moduleSpecifier: '@api/core' }, { defaultImport: 'definition', moduleSpecifier: this.specPath }, ]); @@ -711,7 +711,7 @@ sdk.server('https://eu.api.example.com/v14');`), // our `metadata` parameter is actually required for this operation this is the only way we're // able to have an optional `body` parameter be present before `metadata`. // - // Thankfully our core fetch work in `api/dist/core` is able to do the proper determination to + // Thankfully our core fetch work in `@api/core` is able to do the proper determination to // see if what the user is supplying is `metadata` or `body` content when they supply one or // both. operationIdAccessor.addParameters([ diff --git a/packages/api/test/__fixtures__/sdk/alby/index.ts b/packages/api/test/__fixtures__/sdk/alby/index.ts index 9f1f3ae7..2342b9c9 100644 --- a/packages/api/test/__fixtures__/sdk/alby/index.ts +++ b/packages/api/test/__fixtures__/sdk/alby/index.ts @@ -1,8 +1,8 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api/dist/core' +import type { ConfigOptions, FetchResponse } from '@api/core' import Oas from 'oas'; -import APICore from 'api/dist/core'; -import definition from '../../../__fixtures__/definitions/alby.json'; +import APICore from '@api/core'; +import definition from '@api/test-utils/src/fixtures/definitions/alby.json'; class SDK { spec: Oas; @@ -388,4 +388,4 @@ const createSDK = (() => { return new SDK(); })() export default createSDK; -export type { AmqpExternalRulePatch, AmqpExternalRulePost, AmqpExternalRuleResponse, AmqpRulePatch, AmqpRulePost, AmqpRuleResponse, AppPatch, AppPkcs12, AppPost, AppResponse, AwsAccessKeys, AwsAccessKeysResponse, AwsAssumeRole, AwsKinesisRulePatch, AwsKinesisRulePost, AwsKinesisRuleResponse, AwsLambdaRulePatch, AwsLambdaRulePost, AwsLambdaRuleResponse, AwsSqsRulePatch, AwsSqsRulePost, AwsSqsRuleResponse, AzureFunctionRulePatch, AzureFunctionRulePost, AzureFunctionRuleResponse, CloudflareWorkerRulePatch, CloudflareWorkerRulePost, CloudflareWorkerRuleResponse, DeleteAppsAppIdNamespacesNamespaceIdMetadataParam, DeleteAppsAppIdQueuesQueueIdMetadataParam, DeleteAppsAppIdRulesRuleIdMetadataParam, DeleteAppsIdMetadataParam, Error, GetAccountsAccountIdAppsMetadataParam, GetAccountsAccountIdAppsResponse200, GetAppsAppIdKeysMetadataParam, GetAppsAppIdKeysResponse200, GetAppsAppIdNamespacesMetadataParam, GetAppsAppIdNamespacesResponse200, GetAppsAppIdQueuesMetadataParam, GetAppsAppIdQueuesResponse200, GetAppsAppIdRulesMetadataParam, GetAppsAppIdRulesResponse200, GetAppsAppIdRulesRuleIdMetadataParam, GoogleCloudFunctionRulePatch, GoogleCloudFunctionRulePost, GoogleCloudFunctionRuleResponse, HttpRulePatch, HttpRulePost, HttpRuleResponse, IftttRulePatch, IftttRulePost, IftttRuleResponse, KeyPatch, KeyPost, KeyResponse, Me, NamespacePatch, NamespacePost, NamespaceResponse, PatchAppsAppIdKeysKeyIdMetadataParam, PatchAppsAppIdNamespacesNamespaceIdMetadataParam, PatchAppsAppIdRulesRuleIdMetadataParam, PatchAppsIdMetadataParam, PostAccountsAccountIdAppsMetadataParam, PostAppsAppIdKeysKeyIdRevokeMetadataParam, PostAppsAppIdKeysMetadataParam, PostAppsAppIdNamespacesMetadataParam, PostAppsAppIdQueuesMetadataParam, PostAppsAppIdRulesMetadataParam, PostAppsIdPkcs12MetadataParam, Queue, QueueResponse, RuleAttributes, RulePatch, RulePost, RuleResponse, RuleSource, RuleSourcePatch, UnsupportedRuleResponse, ZapierRulePatch, ZapierRulePost, ZapierRuleResponse } from './types'; +export type { AmqpExternalRulePatch, AmqpExternalRulePost, AmqpExternalRuleResponse, AmqpRulePatch, AmqpRulePost, AmqpRuleResponse, AppPatch, AppPkcs12, AppPost, AppResponse, AwsAccessKeys, AwsAccessKeysResponse, AwsAssumeRole, AwsKinesisRulePatch, AwsKinesisRulePost, AwsKinesisRuleResponse, AwsLambdaRulePatch, AwsLambdaRulePost, AwsLambdaRuleResponse, AwsSqsRulePatch, AwsSqsRulePost, AwsSqsRuleResponse, AzureFunctionRulePatch, AzureFunctionRulePost, AzureFunctionRuleResponse, CloudflareWorkerRulePatch, CloudflareWorkerRulePost, CloudflareWorkerRuleResponse, DeleteAppsAppIdNamespacesNamespaceIdMetadataParam, DeleteAppsAppIdQueuesQueueIdMetadataParam, DeleteAppsAppIdRulesRuleIdMetadataParam, DeleteAppsIdMetadataParam, Error, GetAccountsAccountIdAppsMetadataParam, GetAccountsAccountIdAppsResponse200, GetAppsAppIdKeysMetadataParam, GetAppsAppIdKeysResponse200, GetAppsAppIdNamespacesMetadataParam, GetAppsAppIdNamespacesResponse200, GetAppsAppIdQueuesMetadataParam, GetAppsAppIdQueuesResponse200, GetAppsAppIdRulesMetadataParam, GetAppsAppIdRulesResponse200, GetAppsAppIdRulesRuleIdMetadataParam, GoogleCloudFunctionRulePatch, GoogleCloudFunctionRulePost, GoogleCloudFunctionRuleResponse, HttpRulePatch, HttpRulePost, HttpRuleResponse, IftttRulePatch, IftttRulePost, IftttRuleResponse, KeyPatch, KeyPost, KeyResponse, Me, NamespacePatch, NamespacePost, NamespaceResponse, PatchAppsAppIdKeysKeyIdMetadataParam, PatchAppsAppIdNamespacesNamespaceIdMetadataParam, PatchAppsAppIdRulesRuleIdMetadataParam, PatchAppsIdMetadataParam, PostAccountsAccountIdAppsMetadataParam, PostAppsAppIdKeysKeyIdRevokeMetadataParam, PostAppsAppIdKeysMetadataParam, PostAppsAppIdNamespacesMetadataParam, PostAppsAppIdQueuesMetadataParam, PostAppsAppIdRulesMetadataParam, PostAppsIdPkcs12MetadataParam, Queue, QueueResponse, RulePatch, RulePost, RuleResponse, RuleSource, UnsupportedRuleResponse, ZapierRulePatch, ZapierRulePost, ZapierRuleResponse } from './types'; diff --git a/packages/api/test/__fixtures__/sdk/alby/schemas.ts b/packages/api/test/__fixtures__/sdk/alby/schemas.ts index 9af7f1c4..1a43dbc2 100644 --- a/packages/api/test/__fixtures__/sdk/alby/schemas.ts +++ b/packages/api/test/__fixtures__/sdk/alby/schemas.ts @@ -1,58 +1,58 @@ -const AmqpExternalRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP external (using Firehose). See the Ably documentation for further information.","enum":["amqp/external"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"mandatoryRoute":{"description":"Reject delivery of the message if the route does not exist, otherwise fail silently.","type":"boolean"},"messageTtl":{"description":"You can optionally override the default TTL on a queue and specify a TTL in minutes for messages to be persisted. It is unusual to change the default TTL, so if this field is left empty, the default TTL for the queue will be used.","type":"integer"},"persistentMessages":{"description":"Marks the message as persistent, instructing the broker to write it to disk if it is in a durable queue.","type":"boolean"},"routingKey":{"description":"The AMQP routing key. See this Ably knowledge base article for details.","type":"string"},"url":{"type":"string"}},"type":"object"}},"type":"object","title":"amqp_external_rule_patch","x-readme-ref-name":"amqp_external_rule_patch"} as const +const AmqpExternalRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP external (using Firehose). See the Ably documentation for further information.","enum":["amqp/external"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"mandatoryRoute":{"description":"Reject delivery of the message if the route does not exist, otherwise fail silently.","type":"boolean"},"messageTtl":{"description":"You can optionally override the default TTL on a queue and specify a TTL in minutes for messages to be persisted. It is unusual to change the default TTL, so if this field is left empty, the default TTL for the queue will be used.","type":"integer"},"persistentMessages":{"description":"Marks the message as persistent, instructing the broker to write it to disk if it is in a durable queue.","type":"boolean"},"routingKey":{"description":"The AMQP routing key. See this Ably knowledge base article for details.","type":"string"},"url":{"type":"string"}},"type":"object"}},"type":"object","title":"amqp_external_rule_patch","x-readme-ref-name":"amqp_external_rule_patch"} as const ; -const AmqpExternalRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP external (using Firehose). See the documentation for further information.","enum":["amqp/external"],"type":"string"},"source":RuleSource,"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"mandatoryRoute":{"description":"Reject delivery of the message if the route does not exist, otherwise fail silently.","type":"boolean"},"messageTtl":{"description":"You can optionally override the default TTL on a queue and specify a TTL in minutes for messages to be persisted. It is unusual to change the default TTL, so if this field is left empty, the default TTL for the queue will be used.","type":"integer"},"persistentMessages":{"description":"Marks the message as persistent, instructing the broker to write it to disk if it is in a durable queue.","type":"boolean"},"routingKey":{"description":"The AMQP routing key. See this Ably knowledge base article for details.","type":"string"},"url":{"type":"string"}},"required":["url","routingKey","mandatoryRoute","persistentMessages"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"amqp_external_rule_post","x-readme-ref-name":"amqp_external_rule_post"} as const +const AmqpExternalRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP external (using Firehose). See the documentation for further information.","enum":["amqp/external"],"type":"string"},"source":RuleSource,"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"mandatoryRoute":{"description":"Reject delivery of the message if the route does not exist, otherwise fail silently.","type":"boolean"},"messageTtl":{"description":"You can optionally override the default TTL on a queue and specify a TTL in minutes for messages to be persisted. It is unusual to change the default TTL, so if this field is left empty, the default TTL for the queue will be used.","type":"integer"},"persistentMessages":{"description":"Marks the message as persistent, instructing the broker to write it to disk if it is in a durable queue.","type":"boolean"},"routingKey":{"description":"The AMQP routing key. See this Ably knowledge base article for details.","type":"string"},"url":{"type":"string"}},"required":["url","routingKey","mandatoryRoute","persistentMessages"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"amqp_external_rule_post","x-readme-ref-name":"amqp_external_rule_post"} as const ; -const AmqpExternalRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP external (using Firehose). See the Ably documentation for further information.","enum":["amqp/external"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"mandatoryRoute":{"description":"Reject delivery of the message if the route does not exist, otherwise fail silently.","type":"boolean"},"messageTtl":{"description":"You can optionally override the default TTL on a queue and specify a TTL in minutes for messages to be persisted. It is unusual to change the default TTL, so if this field is left empty, the default TTL for the queue will be used.","type":"integer"},"persistentMessages":{"description":"Marks the message as persistent, instructing the broker to write it to disk if it is in a durable queue.","type":"boolean"},"routingKey":{"description":"The AMQP routing key. See this Ably knowledge base article for details.","type":"string"},"url":{"type":"string"}},"required":["url","routingKey","mandatoryRoute","persistentMessages"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"amqp_external_rule_response","x-readme-ref-name":"amqp_external_rule_response"} as const +const AmqpExternalRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.\n\n`single`","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP external (using Firehose). See the Ably documentation for further information.\n\n`amqp/external`","enum":["amqp/external"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"mandatoryRoute":{"description":"Reject delivery of the message if the route does not exist, otherwise fail silently.","type":"boolean"},"messageTtl":{"description":"You can optionally override the default TTL on a queue and specify a TTL in minutes for messages to be persisted. It is unusual to change the default TTL, so if this field is left empty, the default TTL for the queue will be used.","type":"integer"},"persistentMessages":{"description":"Marks the message as persistent, instructing the broker to write it to disk if it is in a durable queue.","type":"boolean"},"routingKey":{"description":"The AMQP routing key. See this Ably knowledge base article for details.","type":"string"},"url":{"type":"string"}},"required":["url","routingKey","mandatoryRoute","persistentMessages"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"amqp_external_rule_response","x-readme-ref-name":"amqp_external_rule_response"} as const ; -const AmqpRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP. See the documentation for further information.","enum":["amqp"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"queueId":{"type":"string"}},"type":"object"}},"type":"object","title":"amqp_rule_patch","x-readme-ref-name":"amqp_rule_patch"} as const +const AmqpRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP. See the documentation for further information.","enum":["amqp"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"queueId":{"type":"string"}},"type":"object"}},"type":"object","title":"amqp_rule_patch","x-readme-ref-name":"amqp_rule_patch"} as const ; -const AmqpRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP. See the documentation for further information.","enum":["amqp"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"queueId":{"type":"string"}},"required":["queueId"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"amqp_rule_post","x-readme-ref-name":"amqp_rule_post"} as const +const AmqpRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP. See the documentation for further information.","enum":["amqp"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"queueId":{"type":"string"}},"required":["queueId"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"amqp_rule_post","x-readme-ref-name":"amqp_rule_post"} as const ; -const AmqpRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP. See the documentation for further information.","enum":["amqp"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"queueId":{"type":"string"}},"required":["queueId"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"amqp_rule_response","x-readme-ref-name":"amqp_rule_response"} as const +const AmqpRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.\n\n`single`","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AMQP. See the documentation for further information.\n\n`amqp`","enum":["amqp"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"queueId":{"type":"string"}},"required":["queueId"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"amqp_rule_response","x-readme-ref-name":"amqp_rule_response"} as const ; -const AppPatch = {"additionalProperties":false,"properties":{"apnsCertificate":{"description":"The Apple Push Notification service certificate.","type":"string"},"apnsPrivateKey":{"description":"The Apple Push Notification service private key.","type":"string"},"apnsUseSandboxEndpoint":{"description":"The Apple Push Notification service sandbox endpoint.","type":"boolean"},"fcmKey":{"description":"The Firebase Cloud Messaging key.","type":"string","examples":[false]},"name":{"description":"The name of the application for your reference only.","type":"string","examples":["My App"]},"status":{"description":"The status of the application. Can be `enabled` or `disabled`. Enabled means available to accept inbound connections and all services are available.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"tlsOnly":{"description":"Enforce TLS for all connections.","type":"boolean","examples":[true]}},"type":"object","title":"app_patch","x-readme-ref-name":"app_patch"} as const +const AppPatch = {"additionalProperties":false,"properties":{"apnsCertificate":{"description":"The Apple Push Notification service certificate.","type":["string","null"]},"apnsPrivateKey":{"description":"The Apple Push Notification service private key.","type":["string","null"]},"apnsUseSandboxEndpoint":{"description":"The Apple Push Notification service sandbox endpoint.","type":["boolean","null"]},"fcmKey":{"description":"The Firebase Cloud Messaging key.","type":["string","null"],"examples":[false]},"name":{"description":"The name of the application for your reference only.","type":"string","examples":["My App"]},"status":{"description":"The status of the application. Can be `enabled` or `disabled`. Enabled means available to accept inbound connections and all services are available.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"tlsOnly":{"description":"Enforce TLS for all connections.","type":["boolean","null"],"examples":[true]}},"type":"object","title":"app_patch","x-readme-ref-name":"app_patch"} as const ; const AppPkcs12 = {"additionalProperties":false,"properties":{"p12File":{"description":"The `.p12` file containing the app's APNs information.","format":"binary","type":"string"},"p12Pass":{"description":"The password for the corresponding `.p12` file.","type":"string"}},"required":["p12File","p12Pass"],"type":"object","title":"app_pkcs12","x-readme-ref-name":"app_pkcs12"} as const ; -const AppPost = {"additionalProperties":false,"properties":{"apnsCertificate":{"description":"The Apple Push Notification service certificate.","type":"string"},"apnsPrivateKey":{"description":"The Apple Push Notification service private key.","type":"string"},"apnsUseSandboxEndpoint":{"description":"The Apple Push Notification service sandbox endpoint.","type":"boolean"},"fcmKey":{"description":"The Firebase Cloud Messaging key.","type":"string","examples":[false]},"name":{"description":"The name of the application for your reference only.","type":"string","examples":["My App"]},"status":{"description":"The status of the application. Can be `enabled` or `disabled`. Enabled means available to accept inbound connections and all services are available.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"tlsOnly":{"description":"Enforce TLS for all connections.","type":"boolean","examples":[true]}},"required":["name"],"type":"object","title":"app_post","x-readme-ref-name":"app_post"} as const +const AppPost = {"additionalProperties":false,"properties":{"apnsCertificate":{"description":"The Apple Push Notification service certificate.","type":["string","null"]},"apnsPrivateKey":{"description":"The Apple Push Notification service private key.","type":["string","null"]},"apnsUseSandboxEndpoint":{"description":"The Apple Push Notification service sandbox endpoint.","type":["boolean","null"]},"fcmKey":{"description":"The Firebase Cloud Messaging key.","type":["string","null"],"examples":[false]},"name":{"description":"The name of the application for your reference only.","type":"string","examples":["My App"]},"status":{"description":"The status of the application. Can be `enabled` or `disabled`. Enabled means available to accept inbound connections and all services are available.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"tlsOnly":{"description":"Enforce TLS for all connections.","type":["boolean","null"],"examples":[true]}},"required":["name"],"type":"object","title":"app_post","x-readme-ref-name":"app_post"} as const ; -const AppResponse = {"additionalProperties":false,"properties":{"_links":{"description":"A link self-referencing the app that has been created.","type":"object","additionalProperties":true},"accountId":{"description":"The ID of your Ably account.","type":"string","examples":["WgRpOB"]},"apnsUseSandboxEndpoint":{"description":"Apple Push Notification service endpoint.","type":"boolean","examples":[false]},"id":{"description":"The application ID.","type":"string","examples":["28AB6x"]},"name":{"description":"The application name.","type":"string","examples":["Default"]},"status":{"description":"The application status. Disabled applications will not accept new connections and will return an error to all clients.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"tlsOnly":{"description":"Enforce TLS for all connections. This setting overrides any channel setting.","type":"boolean","examples":[true]}},"type":"object","title":"app_response","x-readme-ref-name":"app_response"} as const +const AppResponse = {"additionalProperties":false,"properties":{"_links":{"description":"A link self-referencing the app that has been created.","type":["object","null"],"additionalProperties":true},"accountId":{"description":"The ID of your Ably account.","type":"string","examples":["WgRpOB"]},"apnsUseSandboxEndpoint":{"description":"Apple Push Notification service endpoint.","type":["boolean","null"],"examples":[false]},"id":{"description":"The application ID.","type":"string","examples":["28AB6x"]},"name":{"description":"The application name.","type":"string","examples":["Default"]},"status":{"description":"The application status. Disabled applications will not accept new connections and will return an error to all clients.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"tlsOnly":{"description":"Enforce TLS for all connections. This setting overrides any channel setting.","type":["boolean","null"],"examples":[true]}},"type":"object","title":"app_response","x-readme-ref-name":"app_response"} as const ; const AwsAccessKeys = {"additionalProperties":false,"properties":{"accessKeyId":{"description":"The AWS key ID for the AWS IAM user. See this Ably knowledge base article for details.","type":"string"},"authenticationMode":{"description":"Authentication method is using AWS credentials (AWS key ID and secret key).","enum":["credentials"],"type":"string"},"secretAccessKey":{"description":"The AWS secret key for the AWS IAM user. See this Ably knowledge base article for details.","type":"string"}},"required":["accessKeyId","secretAccessKey"],"type":"object","title":"aws_access_keys","x-readme-ref-name":"aws_access_keys"} as const ; -const AwsAccessKeysResponse = {"additionalProperties":false,"properties":{"accessKeyId":{"description":"The AWS key ID for the AWS IAM user. See this Ably knowledge base article for details.","type":"string"},"authenticationMode":{"description":"Authentication method is using AWS credentials (AWS key ID and secret key).","enum":["credentials"],"type":"string"}},"type":"object","title":"aws_access_keys_response","x-readme-ref-name":"aws_access_keys_response"} as const +const AwsAccessKeysResponse = {"additionalProperties":false,"properties":{"accessKeyId":{"description":"The AWS key ID for the AWS IAM user. See this Ably knowledge base article for details.","type":"string"},"authenticationMode":{"description":"Authentication method is using AWS credentials (AWS key ID and secret key).\n\n`credentials`","enum":["credentials"],"type":"string"}},"type":"object","title":"aws_access_keys_response","x-readme-ref-name":"aws_access_keys_response"} as const ; -const AwsAssumeRole = {"additionalProperties":false,"properties":{"assumeRoleArn":{"description":"If you are using the \"ARN of an assumable role\" authentication method, this is your Assume Role ARN. See this Ably knowledge base article for details.","type":"string"},"authenticationMode":{"description":"Authentication method is using the ARN of an assumable role. See this Ably knowledge base article for details.","enum":["assumeRole"],"type":"string"}},"required":["assumeRoleArn"],"type":"object","title":"aws_assume_role","x-readme-ref-name":"aws_assume_role"} as const +const AwsAssumeRole = {"additionalProperties":false,"properties":{"assumeRoleArn":{"description":"If you are using the \"ARN of an assumable role\" authentication method, this is your Assume Role ARN. See this Ably knowledge base article for details.","type":"string"},"authenticationMode":{"description":"Authentication method is using the ARN of an assumable role. See this Ably knowledge base article for details.\n\n`assumeRole`","enum":["assumeRole"],"type":"string"}},"required":["assumeRoleArn"],"type":"object","title":"aws_assume_role","x-readme-ref-name":"aws_assume_role"} as const ; -const AwsKinesisRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Kinesis. See the documentation for further information.","enum":["aws/kinesis"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"partitionKey":{"description":"The AWS Kinesis partition key. See this Ably knowledge base article for details.","type":"string"},"region":{"description":"The region is which AWS Kinesis is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]},"streamName":{"description":"The name of your AWS Kinesis Stream.","type":"string"}},"type":"object"}},"type":"object","title":"aws_kinesis_rule_patch","x-readme-ref-name":"aws_kinesis_rule_patch"} as const +const AwsKinesisRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Kinesis. See the documentation for further information.","enum":["aws/kinesis"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"partitionKey":{"description":"The AWS Kinesis partition key. See this Ably knowledge base article for details.","type":"string"},"region":{"description":"The region is which AWS Kinesis is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]},"streamName":{"description":"The name of your AWS Kinesis Stream.","type":"string"}},"type":"object"}},"type":"object","title":"aws_kinesis_rule_patch","x-readme-ref-name":"aws_kinesis_rule_patch"} as const ; -const AwsKinesisRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Kinesis. See the documentation for further information.","enum":["aws/kinesis"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"partitionKey":{"description":"The AWS Kinesis partition key. See this Ably knowledge base article for details.","type":"string"},"region":{"description":"The region is which AWS Kinesis is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]},"streamName":{"description":"The name of your AWS Kinesis Stream.","type":"string"}},"required":["region","streamName","partitionKey","authentication","format"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_kinesis_rule_post","x-readme-ref-name":"aws_kinesis_rule_post"} as const +const AwsKinesisRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Kinesis. See the documentation for further information.","enum":["aws/kinesis"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"partitionKey":{"description":"The AWS Kinesis partition key. See this Ably knowledge base article for details.","type":"string"},"region":{"description":"The region is which AWS Kinesis is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]},"streamName":{"description":"The name of your AWS Kinesis Stream.","type":"string"}},"required":["region","streamName","partitionKey","authentication","format"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_kinesis_rule_post","x-readme-ref-name":"aws_kinesis_rule_post"} as const ; -const AwsKinesisRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Kinesis. See the documentation for further information.","enum":["aws/kinesis"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys_response"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeysResponse,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"partitionKey":{"description":"The AWS Kinesis partition key. See this Ably knowledge base article for details.","type":"string"},"region":{"description":"The region is which AWS Kinesis is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]},"streamName":{"description":"The name of your AWS Kinesis Stream.","type":"string"}},"required":["region","streamName","partitionKey","authentication","format"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_kinesis_rule_response","x-readme-ref-name":"aws_kinesis_rule_response"} as const +const AwsKinesisRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.\n\n`single`","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Kinesis. See the documentation for further information.\n\n`aws/kinesis`","enum":["aws/kinesis"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys_response"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeysResponse,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a text-based encoding.\n\n`json`","enum":["json"],"type":"string"},"partitionKey":{"description":"The AWS Kinesis partition key. See this Ably knowledge base article for details.","type":"string"},"region":{"description":"The region is which AWS Kinesis is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]},"streamName":{"description":"The name of your AWS Kinesis Stream.","type":"string"}},"required":["region","streamName","partitionKey","authentication","format"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_kinesis_rule_response","x-readme-ref-name":"aws_kinesis_rule_response"} as const ; -const AwsLambdaRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Lambda. See the Ably documentation for further information.","enum":["aws/lambda"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"functionName":{"description":"The name of your AWS Lambda Function.","type":"string"},"region":{"description":"The region is which your AWS Lambda Function is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"required":["region","functionName","authentication"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_lambda_rule_patch","x-readme-ref-name":"aws_lambda_rule_patch"} as const +const AwsLambdaRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Lambda. See the Ably documentation for further information.","enum":["aws/lambda"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"functionName":{"description":"The name of your AWS Lambda Function.","type":"string"},"region":{"description":"The region is which your AWS Lambda Function is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"required":["region","functionName","authentication"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_lambda_rule_patch","x-readme-ref-name":"aws_lambda_rule_patch"} as const ; -const AwsLambdaRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Lambda. See the documentation for further information.","enum":["aws/lambda"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"functionName":{"description":"The name of your AWS Lambda Function.","type":"string"},"region":{"description":"The region is which your AWS Lambda Function is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"required":["region","functionName","authentication"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_lambda_rule_post","x-readme-ref-name":"aws_lambda_rule_post"} as const +const AwsLambdaRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Lambda. See the documentation for further information.","enum":["aws/lambda"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"functionName":{"description":"The name of your AWS Lambda Function.","type":"string"},"region":{"description":"The region is which your AWS Lambda Function is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"required":["region","functionName","authentication"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_lambda_rule_post","x-readme-ref-name":"aws_lambda_rule_post"} as const ; -const AwsLambdaRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Lambda. See the documentation for further information.","enum":["aws/lambda"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys_response"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeysResponse,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"type":"string"},"functionName":{"description":"The name of your AWS Lambda Function.","type":"string"},"region":{"description":"The region is which your AWS Lambda Function is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"required":["region","functionName","authentication"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_lambda_rule_response","x-readme-ref-name":"aws_lambda_rule_response"} as const +const AwsLambdaRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.\n\n`single`","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS Lambda. See the documentation for further information.\n\n`aws/lambda`","enum":["aws/lambda"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys_response"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeysResponse,AwsAssumeRole]},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"type":"string"},"functionName":{"description":"The name of your AWS Lambda Function.","type":"string"},"region":{"description":"The region is which your AWS Lambda Function is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"required":["region","functionName","authentication"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_lambda_rule_response","x-readme-ref-name":"aws_lambda_rule_response"} as const ; -const AwsSqsRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS SQS. See the documentation for further information.","enum":["aws/sqs"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"awsAccountId":{"description":"Your AWS account ID.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"type":"string"},"queueName":{"description":"The AWS SQS queue name.","type":"string"},"region":{"description":"The region is which AWS SQS is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"type":"object"}},"type":"object","title":"aws_sqs_rule_patch","x-readme-ref-name":"aws_sqs_rule_patch"} as const +const AwsSqsRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS SQS. See the documentation for further information.","enum":["aws/sqs"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"awsAccountId":{"description":"Your AWS account ID.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"type":"string"},"queueName":{"description":"The AWS SQS queue name.","type":"string"},"region":{"description":"The region is which AWS SQS is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"type":"object"}},"type":"object","title":"aws_sqs_rule_patch","x-readme-ref-name":"aws_sqs_rule_patch"} as const ; -const AwsSqsRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS SQS. See the documentation for further information.","enum":["aws/sqs"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"awsAccountId":{"description":"Your AWS account ID.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"type":"string"},"queueName":{"description":"The AWS SQS queue name.","type":"string"},"region":{"description":"The region is which AWS SQS is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"required":["region","awsAccountId","queueName","authentication"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_sqs_rule_post","x-readme-ref-name":"aws_sqs_rule_post"} as const +const AwsSqsRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS SQS. See the documentation for further information.","enum":["aws/sqs"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeys,AwsAssumeRole]},"awsAccountId":{"description":"Your AWS account ID.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"type":"string"},"queueName":{"description":"The AWS SQS queue name.","type":"string"},"region":{"description":"The region is which AWS SQS is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"required":["region","awsAccountId","queueName","authentication"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_sqs_rule_post","x-readme-ref-name":"aws_sqs_rule_post"} as const ; -const AwsSqsRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS SQS. See the documentation for further information.","enum":["aws/sqs"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys_response"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeysResponse,AwsAssumeRole]},"awsAccountId":{"description":"Your AWS account ID.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"type":"string"},"queueName":{"description":"The AWS SQS queue name.","type":"string"},"region":{"description":"The region is which AWS SQS is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"required":["region","awsAccountId","queueName","authentication"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_sqs_rule_response","x-readme-ref-name":"aws_sqs_rule_response"} as const +const AwsSqsRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.\n\n`single`","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case AWS SQS. See the documentation for further information.\n\n`aws/sqs`","enum":["aws/sqs"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"authentication":{"discriminator":{"mapping":{"assumeRole":"#/components/schemas/aws_assume_role","credentials":"#/components/schemas/aws_access_keys_response"},"propertyName":"authenticationMode"},"oneOf":[AwsAccessKeysResponse,AwsAssumeRole]},"awsAccountId":{"description":"Your AWS account ID.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"type":"string"},"queueName":{"description":"The AWS SQS queue name.","type":"string"},"region":{"description":"The region is which AWS SQS is hosted. See the AWS documentation for more detail.","type":"string","examples":["us-west-1"]}},"required":["region","awsAccountId","queueName","authentication"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"aws_sqs_rule_response","x-readme-ref-name":"aws_sqs_rule_response"} as const ; -const AzureFunctionRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Microsoft Azure Function. See the documentation for further information.","enum":["http/azure-function"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"azureAppId":{"description":"The Microsoft Azure Application ID. You can find your Microsoft Azure Application ID as shown in this article.","type":"string","examples":["d1e9f419-c438-6032b32df979"]},"azureFunctionName":{"description":"The name of your Microsoft Azure Function.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"}},"type":"object"}},"type":"object","title":"azure_function_rule_patch","x-readme-ref-name":"azure_function_rule_patch"} as const +const AzureFunctionRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Microsoft Azure Function. See the documentation for further information.","enum":["http/azure-function"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"azureAppId":{"description":"The Microsoft Azure Application ID. You can find your Microsoft Azure Application ID as shown in this article.","type":"string","examples":["d1e9f419-c438-6032b32df979"]},"azureFunctionName":{"description":"The name of your Microsoft Azure Function.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]}},"type":"object"}},"type":"object","title":"azure_function_rule_patch","x-readme-ref-name":"azure_function_rule_patch"} as const ; -const AzureFunctionRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Microsoft Azure Function. See the documentation for further information.","enum":["http/azure-function"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"azureAppId":{"description":"The Microsoft Azure Application ID. You can find your Microsoft Azure Application ID as shown in this article.","type":"string","examples":["d1e9f419-c438-6032b32df979"]},"azureFunctionName":{"description":"The name of your Microsoft Azure Function.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"}},"required":["azureAppId","azureFunctionName"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"azure_function_rule_post","x-readme-ref-name":"azure_function_rule_post"} as const +const AzureFunctionRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Microsoft Azure Function. See the documentation for further information.","enum":["http/azure-function"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"azureAppId":{"description":"The Microsoft Azure Application ID. You can find your Microsoft Azure Application ID as shown in this article.","type":"string","examples":["d1e9f419-c438-6032b32df979"]},"azureFunctionName":{"description":"The name of your Microsoft Azure Function.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]}},"required":["azureAppId","azureFunctionName"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"azure_function_rule_post","x-readme-ref-name":"azure_function_rule_post"} as const ; -const AzureFunctionRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Microsoft Azure Function. See the documentation for further information.","enum":["http/azure-function"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"azureAppId":{"description":"The Microsoft Azure Application ID. You can find your Microsoft Azure Application ID as shown in this article.","type":"string","examples":["d1e9f419-c438-6032b32df979"]},"azureFunctionName":{"description":"The name of your Microsoft Azure Function.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"}},"required":["azureAppId","azureFunctionName"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"azure_function_rule_response","x-readme-ref-name":"azure_function_rule_response"} as const +const AzureFunctionRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.\n\n`single` `batch`","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Microsoft Azure Function. See the documentation for further information.\n\n`http/azure-function`","enum":["http/azure-function"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"azureAppId":{"description":"The Microsoft Azure Application ID. You can find your Microsoft Azure Application ID as shown in this article.","type":"string","examples":["d1e9f419-c438-6032b32df979"]},"azureFunctionName":{"description":"The name of your Microsoft Azure Function.","type":"string"},"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a text-based encoding.\n\n`json`","enum":["json"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]}},"required":["azureAppId","azureFunctionName"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"azure_function_rule_response","x-readme-ref-name":"azure_function_rule_response"} as const ; -const CloudflareWorkerRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Cloudflare Worker. See the documentation for further information.","enum":["http/cloudflare-worker"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"},"url":{"type":"string"}},"type":"object"}},"type":"object","title":"cloudflare_worker_rule_patch","x-readme-ref-name":"cloudflare_worker_rule_patch"} as const +const CloudflareWorkerRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Cloudflare Worker. See the documentation for further information.","enum":["http/cloudflare-worker"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]},"url":{"type":"string"}},"type":"object"}},"type":"object","title":"cloudflare_worker_rule_patch","x-readme-ref-name":"cloudflare_worker_rule_patch"} as const ; -const CloudflareWorkerRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Cloudflare Worker. See the documentation for further information.","enum":["http/cloudflare-worker"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"},"url":{"type":"string"}},"required":["url"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"cloudflare_worker_rule_post","x-readme-ref-name":"cloudflare_worker_rule_post"} as const +const CloudflareWorkerRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Cloudflare Worker. See the documentation for further information.","enum":["http/cloudflare-worker"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]},"url":{"type":"string"}},"required":["url"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"cloudflare_worker_rule_post","x-readme-ref-name":"cloudflare_worker_rule_post"} as const ; -const CloudflareWorkerRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Cloudflare Worker. See the documentation for further information.","enum":["http/cloudflare-worker"],"type":"string","examples":["http/cloudflare-worker"]},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"},"url":{"type":"string"}},"required":["url"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"cloudflare_worker_rule_response","x-readme-ref-name":"cloudflare_worker_rule_response"} as const +const CloudflareWorkerRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.\n\n`single` `batch`","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Cloudflare Worker. See the documentation for further information.\n\n`http/cloudflare-worker`","enum":["http/cloudflare-worker"],"type":"string","examples":["http/cloudflare-worker"]},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]},"url":{"type":"string"}},"required":["url"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"cloudflare_worker_rule_response","x-readme-ref-name":"cloudflare_worker_rule_response"} as const ; const DeleteAppsAppIdNamespacesNamespaceId = {"metadata":{"allOf":[{"type":"object","properties":{"app_id":{"type":"string","$schema":"http://json-schema.org/draft-04/schema#","description":"The application ID."},"namespace_id":{"type":"string","$schema":"http://json-schema.org/draft-04/schema#","description":"The namespace ID."}},"required":["app_id","namespace_id"]}]}} as const ; @@ -62,7 +62,7 @@ const DeleteAppsAppIdRulesRuleId = {"metadata":{"allOf":[{"type":"object","prope ; const DeleteAppsId = {"metadata":{"allOf":[{"type":"object","properties":{"id":{"type":"string","$schema":"http://json-schema.org/draft-04/schema#","description":"The ID of the application to be deleted."}},"required":["id"]}]}} as const ; -const Error = {"additionalProperties":false,"properties":{"code":{"description":"The HTTP status code returned.","type":"integer"},"details":{"description":"Any additional details about the error message.","type":"object","additionalProperties":true},"href":{"description":"The URL to documentation about the error code.","type":"string"},"message":{"description":"The error message.","type":"string"},"statusCode":{"description":"The Ably error code.","type":"integer"}},"required":["message","code","statusCode","href"],"type":"object","title":"error","x-readme-ref-name":"error"} as const +const Error = {"additionalProperties":false,"properties":{"code":{"description":"The HTTP status code returned.","type":"integer"},"details":{"description":"Any additional details about the error message.","type":["object","null"],"additionalProperties":true},"href":{"description":"The URL to documentation about the error code.","type":"string"},"message":{"description":"The error message.","type":"string"},"statusCode":{"description":"The Ably error code.","type":"integer"}},"required":["message","code","statusCode","href"],"type":"object","title":"error","x-readme-ref-name":"error"} as const ; const GetAccountsAccountIdApps = {"metadata":{"allOf":[{"type":"object","properties":{"account_id":{"type":"string","$schema":"http://json-schema.org/draft-04/schema#","description":"The account ID for which to retrieve the associated applications."}},"required":["account_id"]}]},"response":{"200":{"items":AppResponse,"type":"array","$schema":"http://json-schema.org/draft-04/schema#"}}} as const ; @@ -76,29 +76,29 @@ const GetAppsAppIdRules = {"metadata":{"allOf":[{"type":"object","properties":{" ; const GetAppsAppIdRulesRuleId = {"metadata":{"allOf":[{"type":"object","properties":{"app_id":{"type":"string","$schema":"http://json-schema.org/draft-04/schema#","description":"The application ID."},"rule_id":{"type":"string","$schema":"http://json-schema.org/draft-04/schema#","description":"The rule ID."}},"required":["app_id","rule_id"]}]}} as const ; -const GoogleCloudFunctionRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Google Cloud Function. See the documentation for further information.","enum":["http/google-cloud-function"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"functionName":{"description":"The name of your Google Cloud Function.","type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"projectId":{"description":"The project ID for your Google Cloud Project that was generated when you created your project.","type":"string"},"region":{"description":"The region in which your Google Cloud Function is hosted. See the Google documentation for more details.","type":"string","examples":["us-west1"]},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"}},"type":"object"}},"type":"object","title":"google_cloud_function_rule_patch","x-readme-ref-name":"google_cloud_function_rule_patch"} as const +const GoogleCloudFunctionRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Google Cloud Function. See the documentation for further information.","enum":["http/google-cloud-function"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"functionName":{"description":"The name of your Google Cloud Function.","type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"projectId":{"description":"The project ID for your Google Cloud Project that was generated when you created your project.","type":"string"},"region":{"description":"The region in which your Google Cloud Function is hosted. See the Google documentation for more details.","type":"string","examples":["us-west1"]},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]}},"type":"object"}},"type":"object","title":"google_cloud_function_rule_patch","x-readme-ref-name":"google_cloud_function_rule_patch"} as const ; -const GoogleCloudFunctionRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Google Cloud Function. See the documentation for further information.","enum":["http/google-cloud-function"],"type":"string"},"source":RuleSource,"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"functionName":{"description":"The name of your Google Cloud Function.","type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"projectId":{"description":"The project ID for your Google Cloud Project that was generated when you created your project.","type":"string"},"region":{"description":"The region in which your Google Cloud Function is hosted. See the Google documentation for more details.","type":"string","examples":["us-west1"]},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"}},"required":["region","projectId","functionName"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"google_cloud_function_rule_post","x-readme-ref-name":"google_cloud_function_rule_post"} as const +const GoogleCloudFunctionRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Google Cloud Function. See the documentation for further information.","enum":["http/google-cloud-function"],"type":"string"},"source":RuleSource,"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"functionName":{"description":"The name of your Google Cloud Function.","type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"projectId":{"description":"The project ID for your Google Cloud Project that was generated when you created your project.","type":"string"},"region":{"description":"The region in which your Google Cloud Function is hosted. See the Google documentation for more details.","type":"string","examples":["us-west1"]},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]}},"required":["region","projectId","functionName"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"google_cloud_function_rule_post","x-readme-ref-name":"google_cloud_function_rule_post"} as const ; -const GoogleCloudFunctionRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Google Cloud Function. See the documentation for further information.","enum":["http/google-cloud-function"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a text-based encoding.","enum":["json"],"type":"string"},"functionName":{"description":"The name of your Google Cloud Function.","type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"projectId":{"description":"The project ID for your Google Cloud Project that was generated when you created your project.","type":"string"},"region":{"description":"The region in which your Google Cloud Function is hosted. See the Google documentation for more details.","type":"string","examples":["us-west1"]},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"}},"required":["region","projectId","functionName"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"google_cloud_function_rule_response","x-readme-ref-name":"google_cloud_function_rule_response"} as const +const GoogleCloudFunctionRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.\n\n`single` `batch`","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Google Cloud Function. See the documentation for further information.\n\n`http/google-cloud-function`","enum":["http/google-cloud-function"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a text-based encoding.\n\n`json`","enum":["json"],"type":"string"},"functionName":{"description":"The name of your Google Cloud Function.","type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"projectId":{"description":"The project ID for your Google Cloud Project that was generated when you created your project.","type":"string"},"region":{"description":"The region in which your Google Cloud Function is hosted. See the Google documentation for more details.","type":"string","examples":["us-west1"]},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]}},"required":["region","projectId","functionName"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"google_cloud_function_rule_response","x-readme-ref-name":"google_cloud_function_rule_response"} as const ; -const HttpRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. See the documentation for further information.","enum":["http"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding.","enum":["json","msgpack"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"},"url":{"type":"string"}},"type":"object"}},"type":"object","title":"http_rule_patch","x-readme-ref-name":"http_rule_patch"} as const +const HttpRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. See the documentation for further information.","enum":["http"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding.","enum":["json","msgpack"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]},"url":{"type":"string"}},"type":"object"}},"type":"object","title":"http_rule_patch","x-readme-ref-name":"http_rule_patch"} as const ; -const HttpRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. See the documentation for further information.","enum":["http"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding.","enum":["json","msgpack"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"},"url":{"description":"The URL of the endpoint that is invoked when events occur on Ably.","type":"string"}},"required":["url","format"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"http_rule_post","x-readme-ref-name":"http_rule_post"} as const +const HttpRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. See the documentation for further information.","enum":["http"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding.","enum":["json","msgpack"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]},"url":{"description":"The URL of the endpoint that is invoked when events occur on Ably.","type":"string"}},"required":["url","format"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"http_rule_post","x-readme-ref-name":"http_rule_post"} as const ; -const HttpRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. See the documentation for further information.","enum":["http"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":"boolean"},"format":{"description":"JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding.","enum":["json","msgpack"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"},"url":{"type":"string"}},"required":["url","format"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"http_rule_response","x-readme-ref-name":"http_rule_response"} as const +const HttpRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.\n\n`single` `batch`","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. See the documentation for further information.\n\n`http`","enum":["http"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"enveloped":{"description":"Messages delivered through Reactor are wrapped in an Ably envelope by default that contains metadata about the message and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by unchecking \"Enveloped\" when setting up the rule.","type":["boolean","null"]},"format":{"description":"JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding.\n\n`json` `msgpack`","enum":["json","msgpack"],"type":"string"},"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]},"url":{"type":"string"}},"required":["url","format"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"http_rule_response","x-readme-ref-name":"http_rule_response"} as const ; const IftttRulePatch = {"x-requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"example":"single","type":"string"},"x-ruleType":{"description":"The type of rule. In this case IFTTT. See the documentation for further information.","enum":["http/ifttt"],"type":"string"},"x-source":{"additionalProperties":false,"properties":{"channelFilter":{"description":"This field allows you to filter your rule based on a regular expression that is matched against the complete channel name. Leave this empty if you want the rule to apply to all channels.","type":"string"},"type":{"description":"The type `channel.message` delivers all messages published on a channel. The type `channel.presence` delivers all enter, update and leave events for members present on a channel. The type `channel.lifecycle` events for this rule type are currently not supported. Get in touch (https://ably.com/contact) if you need this feature. The type `channel.occupancy` delivers all occupancy events for the channel.","enum":["channel.message","channel.presence","channel.lifecycle","channel.occupancy"],"example":"channel.message","type":"string"}},"required":["channelFilter","type"],"type":"object","title":"rule_source","x-readme-ref-name":"rule_source"},"x-target":{"additionalProperties":false,"properties":{"eventName":{"type":"string"},"webhookKey":{"type":"string"}},"type":"object"},"title":"ifttt_rule_patch","x-readme-ref-name":"ifttt_rule_patch"} as const ; const IftttRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case IFTTT. See the documentation for further information.","enum":["http/ifttt"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"eventName":{"type":"string"},"webhookKey":{"type":"string"}},"required":["webhookKey","eventName"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"ifttt_rule_post","x-readme-ref-name":"ifttt_rule_post"} as const ; -const IftttRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case IFTTT. See the documentation for further information.","enum":["http/ifttt"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"eventName":{"type":"string"},"webhookKey":{"type":"string"}},"required":["webhookKey","eventName"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"ifttt_rule_response","x-readme-ref-name":"ifttt_rule_response"} as const +const IftttRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"Single request mode sends each event separately to the endpoint specified by the rule. You can read more about single request mode events in the Ably documentation.\n\n`single`","enum":["single"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case IFTTT. See the documentation for further information.\n\n`http/ifttt`","enum":["http/ifttt"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"eventName":{"type":"string"},"webhookKey":{"type":"string"}},"required":["webhookKey","eventName"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"ifttt_rule_response","x-readme-ref-name":"ifttt_rule_response"} as const ; const KeyPatch = {"additionalProperties":false,"properties":{"capabilities":{"description":"The capabilities that this key has. More information on capabilities can be found in the Ably documentation.","items":{"enum":["publish","subscribe","history","presence","channel-metadata","push-admin","push-subscribe","statistics"],"type":"string"},"type":"array"},"channels":{"description":"Specify the channels and queues that this key can be used with.","type":"string"},"name":{"description":"The name for your API key. This is a friendly name for your reference.","type":"string"}},"type":"object","title":"key_patch","x-readme-ref-name":"key_patch"} as const ; const KeyPost = {"additionalProperties":false,"properties":{"capabilities":{"description":"The capabilities that this key has. More information on capabilities can be found in the Ably documentation.","items":{"enum":["publish","subscribe","history","presence","channel-metadata","push-admin","push-subscribe","statistics"],"type":"string"},"type":"array"},"channels":{"description":"Specify the channels and queues that this key can be used with.","type":"string"},"name":{"description":"The name for your API key. This is a friendly name for your reference.","type":"string"}},"required":["name","channels","capabilities"],"type":"object","title":"key_post","x-readme-ref-name":"key_post"} as const ; -const KeyResponse = {"additionalProperties":false,"properties":{"appId":{"description":"The Ably application ID which this key is associated with.","type":"string","examples":["28GY6a"]},"capability":{"additionalProperties":{"items":{"enum":["publish","subscribe","history","presence","channel-metadata","push-admin","push-subscribe","statistics"],"type":"string"},"type":"array"},"description":"The capabilities that this key has. More information on capabilities can be found in the Ably documentation.","type":"object"},"created":{"description":"Unix timestamp representing the date and time of creation of the key.","type":"integer","examples":[1602844091815]},"id":{"description":"The key ID.","type":"string"},"key":{"description":"The complete API key including API secret.","type":"string"},"modified":{"description":"Unix timestamp representing the date and time of the last modification of the key.","type":"integer","examples":[1614679682091]},"name":{"description":"The name of the application this key is associated with.","type":"string"}},"type":"object","title":"key_response","x-readme-ref-name":"key_response"} as const +const KeyResponse = {"additionalProperties":false,"properties":{"appId":{"description":"The Ably application ID which this key is associated with.","type":"string","examples":["28GY6a"]},"capability":{"additionalProperties":{"items":{"enum":["publish","subscribe","history","presence","channel-metadata","push-admin","push-subscribe","statistics"],"type":"string","description":"`publish` `subscribe` `history` `presence` `channel-metadata` `push-admin` `push-subscribe` `statistics`"},"type":"array"},"description":"The capabilities that this key has. More information on capabilities can be found in the Ably documentation.","type":"object"},"created":{"description":"Unix timestamp representing the date and time of creation of the key.","type":"integer","examples":[1602844091815]},"id":{"description":"The key ID.","type":"string"},"key":{"description":"The complete API key including API secret.","type":"string"},"modified":{"description":"Unix timestamp representing the date and time of the last modification of the key.","type":"integer","examples":[1614679682091]},"name":{"description":"The name of the application this key is associated with.","type":"string"}},"type":"object","title":"key_response","x-readme-ref-name":"key_response"} as const ; const Me = {"additionalProperties":false,"properties":{"account":{"additionalProperties":false,"properties":{"id":{"description":"The account ID.","type":"string","examples":["VpWaOA"]},"name":{"description":"The name of the account.","type":"string","examples":["Free account"]}},"required":["id","name"],"type":"object"},"token":{"additionalProperties":false,"properties":{"capabilities":{"description":"An array containing the access capabilities associated with the access token.","items":{"type":"string"},"type":"array","examples":["write:namespace","read:namespace","write:queue","read:queue","write:rule","read:rule","write:key","read:key","write:app","read:app"]},"id":{"description":"The token ID. This is a UUID.","type":"integer","examples":["C95837C9-184B-4CC2-8779-B769F960FADB"]},"name":{"description":"The friendly name for the token.","type":"string","examples":["My Token"]}},"required":["id","name","capabilities"],"type":"object"},"user":{"additionalProperties":false,"properties":{"email":{"description":"Email address of the user associated with the account.","type":"string"},"id":{"description":"The user ID associated with the account. This is a UUID.","type":"integer","examples":["C95837C9-184B-4CC2-8779-B769F960FADB"]}},"required":["id","email"],"type":"object"}},"type":"object","title":"me","x-readme-ref-name":"me"} as const ; @@ -132,9 +132,7 @@ const PostAppsIdPkcs12 = {"metadata":{"allOf":[{"type":"object","properties":{"i ; const Queue = {"additionalProperties":false,"properties":{"maxLength":{"description":"Message limit in number of messages.","type":"integer","examples":[10000]},"name":{"description":"A friendly name for your queue.","type":"string","examples":["My queue"]},"region":{"description":"The data center region. US East (Virginia) or EU West (Ireland). Values are `us-east-1-a` or `eu-west-1-a`.","type":"string","examples":["us-east-1-a"]},"ttl":{"description":"TTL in minutes.","type":"integer","examples":[60]}},"required":["name","ttl","maxLength","region"],"type":"object","title":"queue","x-readme-ref-name":"queue"} as const ; -const QueueResponse = {"additionalProperties":false,"properties":{"amqp":{"additionalProperties":false,"properties":{"queueName":{"description":"Name of the Ably queue.","type":"string","examples":["28AB6w:My queue"]},"uri":{"description":"URI for the AMQP queue interface.","type":"string","examples":["amqps://us-east-1-a-queue.ably.io:5671/shared"]}},"type":"object"},"appId":{"description":"The Ably application ID.","type":"string","examples":["28AB6w"]},"deadletter":{"description":"A boolean that indicates whether this is a dead letter queue or not.","type":"boolean","examples":[false]},"deadletterId":{"type":"string","examples":["28AB6w:us-east-1-a:deadletter"]},"id":{"description":"The ID of the Ably queue","type":"string","examples":["28AB6w:us-east-1-a:My queue"]},"maxLength":{"description":"Message limit in number of messages.","type":"integer","examples":[10000]},"messages":{"additionalProperties":false,"description":"Details of messages in the queue.","properties":{"ready":{"description":"The number of ready messages in the queue.","type":"integer","examples":[0]},"total":{"description":"The total number of messages in the queue.","type":"integer","examples":[0]},"unacknowledged":{"description":"The number of unacknowledged messages in the queue.","type":"integer","examples":[0]}},"type":"object"},"name":{"description":"The friendly name of the queue.","type":"string","examples":["My queue"]},"region":{"description":"The data center region for the queue.","type":"string","examples":["eu-west-1-a"]},"state":{"description":"The current state of the queue.","type":"string","examples":["Running"]},"stats":{"additionalProperties":false,"properties":{"acknowledgementRate":{"description":"The rate at which messages are acknowledged. Rate is messages per minute.","type":"number"},"deliveryRate":{"description":"The rate at which messages are delivered from the queue. Rate is messages per minute.","type":"number"},"publishRate":{"description":"The rate at which messages are published to the queue. Rate is messages per minute.","type":"number"}},"type":"object"},"stomp":{"additionalProperties":false,"properties":{"destination":{"description":"Destination queue.","type":"string","examples":["/amqp/queue/28AB6w:My queue"]},"host":{"description":"The host type for the queue.","type":"string","examples":["shared"]},"uri":{"description":"URI for the STOMP queue interface.","type":"string","examples":["stomp://us-east-1-a-queue.ably.io:61614"]}},"type":"object"},"ttl":{"description":"TTL in minutes.","type":"integer","examples":[60]}},"type":"object","title":"queue_response","x-readme-ref-name":"queue_response"} as const -; -const RuleAttributes = {"additionalProperties":false,"properties":{"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"type":"object","title":"rule_attributes","x-readme-ref-name":"rule_attributes"} as const +const QueueResponse = {"additionalProperties":false,"properties":{"amqp":{"additionalProperties":false,"properties":{"queueName":{"description":"Name of the Ably queue.","type":"string","examples":["28AB6w:My queue"]},"uri":{"description":"URI for the AMQP queue interface.","type":"string","examples":["amqps://us-east-1-a-queue.ably.io:5671/shared"]}},"type":"object"},"appId":{"description":"The Ably application ID.","type":"string","examples":["28AB6w"]},"deadletter":{"description":"A boolean that indicates whether this is a dead letter queue or not.","type":"boolean","examples":[false]},"deadletterId":{"type":["string","null"],"examples":["28AB6w:us-east-1-a:deadletter"]},"id":{"description":"The ID of the Ably queue","type":"string","examples":["28AB6w:us-east-1-a:My queue"]},"maxLength":{"description":"Message limit in number of messages.","type":"integer","examples":[10000]},"messages":{"additionalProperties":false,"description":"Details of messages in the queue.","properties":{"ready":{"description":"The number of ready messages in the queue.","type":["integer","null"],"examples":[0]},"total":{"description":"The total number of messages in the queue.","type":["integer","null"],"examples":[0]},"unacknowledged":{"description":"The number of unacknowledged messages in the queue.","type":["integer","null"],"examples":[0]}},"type":"object"},"name":{"description":"The friendly name of the queue.","type":"string","examples":["My queue"]},"region":{"description":"The data center region for the queue.","type":"string","examples":["eu-west-1-a"]},"state":{"description":"The current state of the queue.","type":"string","examples":["Running"]},"stats":{"additionalProperties":false,"properties":{"acknowledgementRate":{"description":"The rate at which messages are acknowledged. Rate is messages per minute.","type":["number","null"]},"deliveryRate":{"description":"The rate at which messages are delivered from the queue. Rate is messages per minute.","type":["number","null"]},"publishRate":{"description":"The rate at which messages are published to the queue. Rate is messages per minute.","type":["number","null"]}},"type":"object"},"stomp":{"additionalProperties":false,"properties":{"destination":{"description":"Destination queue.","type":"string","examples":["/amqp/queue/28AB6w:My queue"]},"host":{"description":"The host type for the queue.","type":"string","examples":["shared"]},"uri":{"description":"URI for the STOMP queue interface.","type":"string","examples":["stomp://us-east-1-a-queue.ably.io:61614"]}},"type":"object"},"ttl":{"description":"TTL in minutes.","type":"integer","examples":[60]}},"type":"object","title":"queue_response","x-readme-ref-name":"queue_response"} as const ; const RulePatch = {"discriminator":{"mapping":{"amqp":"#/components/schemas/amqp_rule_patch","amqp/external":"#/components/schemas/amqp_external_rule_patch","aws/kinesis":"#/components/schemas/aws_kinesis_rule_patch","aws/lambda":"#/components/schemas/aws_lambda_rule_patch","aws/sqs":"#/components/schemas/aws_sqs_rule_patch","http":"#/components/schemas/http_rule_patch","http/azure-function":"#/components/schemas/azure_function_rule_patch","http/cloudflare-worker":"#/components/schemas/cloudflare_worker_rule_patch","http/google-cloud-function":"#/components/schemas/google_cloud_function_rule_patch","http/ifttt":"#/components/schemas/ifttt_rule_patch","http/zapier":"#/components/schemas/zapier_rule_patch"},"propertyName":"ruleType"},"oneOf":[HttpRulePatch,IftttRulePatch,ZapierRulePatch,CloudflareWorkerRulePatch,AzureFunctionRulePatch,GoogleCloudFunctionRulePatch,AwsLambdaRulePatch,AwsKinesisRulePatch,AwsSqsRulePatch,AmqpRulePatch,AmqpExternalRulePatch],"title":"rule_patch","x-readme-ref-name":"rule_patch"} as const ; @@ -142,16 +140,14 @@ const RulePost = {"discriminator":{"mapping":{"amqp":"#/components/schemas/amqp_ ; const RuleResponse = {"discriminator":{"mapping":{"amqp":"#/components/schemas/amqp_rule_response","amqp/external":"#/components/schemas/amqp_external_rule_response","aws/kinesis":"#/components/schemas/aws_kinesis_rule_response","aws/lambda":"#/components/schemas/aws_lambda_rule_response","aws/sqs":"#/components/schemas/aws_sqs_rule_response","http":"#/components/schemas/http_rule_response","http/azure-function":"#/components/schemas/azure_function_rule_response","http/cloudflare-worker":"#/components/schemas/cloudflare_worker_rule_response","http/google-cloud-function":"#/components/schemas/google_cloud_function_rule_response","http/ifttt":"#/components/schemas/ifttt_rule_response","http/zapier":"#/components/schemas/zapier_rule_response"},"propertyName":"ruleType"},"oneOf":[HttpRuleResponse,IftttRuleResponse,ZapierRuleResponse,CloudflareWorkerRuleResponse,AzureFunctionRuleResponse,GoogleCloudFunctionRuleResponse,AwsLambdaRuleResponse,AwsKinesisRuleResponse,AwsSqsRuleResponse,AmqpRuleResponse,AmqpExternalRuleResponse],"title":"rule_response","x-readme-ref-name":"rule_response"} as const ; -const RuleSource = {"additionalProperties":false,"properties":{"channelFilter":{"description":"This field allows you to filter your rule based on a regular expression that is matched against the complete channel name. Leave this empty if you want the rule to apply to all channels.","type":"string"},"type":{"description":"The type `channel.message` delivers all messages published on a channel. The type `channel.presence` delivers all enter, update and leave events for members present on a channel. The type `channel.lifecycle` events for this rule type are currently not supported. Get in touch (https://ably.com/contact) if you need this feature. The type `channel.occupancy` delivers all occupancy events for the channel.","enum":["channel.message","channel.presence","channel.lifecycle","channel.occupancy"],"type":"string","examples":["channel.message"]}},"required":["channelFilter","type"],"type":"object","title":"rule_source","x-readme-ref-name":"rule_source"} as const -; -const RuleSourcePatch = {"additionalProperties":false,"properties":{"channelFilter":{"description":"This field allows you to filter your rule based on a regular expression that is matched against the complete channel name. Leave this empty if you want the rule to apply to all channels.","type":"string"},"type":{"description":"The type `channel.message` delivers all messages published on a channel. The type `channel.presence` delivers all enter, update and leave events for members present on a channel. The type `channel.lifecycle` events for this rule type are currently not supported. Get in touch (https://ably.com/contact) if you need this feature. The type `channel.occupancy` delivers all occupancy events for the channel.","enum":["channel.message","channel.presence","channel.lifecycle","channel.occupancy"],"type":"string"}},"type":"object","title":"rule_source_patch","x-readme-ref-name":"rule_source_patch"} as const +const RuleSource = {"additionalProperties":false,"properties":{"channelFilter":{"description":"This field allows you to filter your rule based on a regular expression that is matched against the complete channel name. Leave this empty if you want the rule to apply to all channels.","type":"string"},"type":{"description":"The type `channel.message` delivers all messages published on a channel. The type `channel.presence` delivers all enter, update and leave events for members present on a channel. The type `channel.lifecycle` events for this rule type are currently not supported. Get in touch (https://ably.com/contact) if you need this feature. The type `channel.occupancy` delivers all occupancy events for the channel.\n\n`channel.message` `channel.presence` `channel.lifecycle` `channel.occupancy`","enum":["channel.message","channel.presence","channel.lifecycle","channel.occupancy"],"type":"string","examples":["channel.message"]}},"required":["channelFilter","type"],"type":"object","title":"rule_source","x-readme-ref-name":"rule_source"} as const ; -const UnsupportedRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"This rule type is currently unsupported.","enum":["unsupported"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"url":{"type":"string"}},"required":["url"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"unsupported_rule_response","x-readme-ref-name":"unsupported_rule_response"} as const +const UnsupportedRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"This rule type is currently unsupported.","enum":["unsupported"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"url":{"type":"string"}},"required":["url"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"unsupported_rule_response","x-readme-ref-name":"unsupported_rule_response"} as const ; -const ZapierRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Zapier. See the documentation for further information.","enum":["http/zapier"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"},"url":{"type":"string"}},"type":"object"}},"type":"object","title":"zapier_rule_patch","x-readme-ref-name":"zapier_rule_patch"} as const +const ZapierRulePatch = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Zapier. See the documentation for further information.","enum":["http/zapier"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]},"url":{"type":"string"}},"type":"object"}},"type":"object","title":"zapier_rule_patch","x-readme-ref-name":"zapier_rule_patch"} as const ; -const ZapierRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Zapier. See the documentation for further information.","enum":["http/zapier"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"},"url":{"type":"string"}},"required":["url"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"zapier_rule_post","x-readme-ref-name":"zapier_rule_post"} as const +const ZapierRulePost = {"additionalProperties":false,"properties":{"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Zapier. See the documentation for further information.","enum":["http/zapier"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]},"url":{"type":"string"}},"required":["url"],"type":"object"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"zapier_rule_post","x-readme-ref-name":"zapier_rule_post"} as const ; -const ZapierRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":"object","additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Zapier. See the documentation for further information.","enum":["http/zapier"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":"string"},"url":{"type":"string"}},"required":["url"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"zapier_rule_response","x-readme-ref-name":"zapier_rule_response"} as const +const ZapierRuleResponse = {"additionalProperties":false,"properties":{"_links":{"type":["object","null"],"additionalProperties":true},"appId":{"description":"The Ably application ID.","type":"string","examples":["28GY6a"]},"created":{"description":"Unix timestamp representing the date and time of creation of the rule.","type":"number","examples":[1602844091815]},"id":{"description":"The rule ID.","type":"string","examples":["83IzAB"]},"modified":{"description":"Unix timestamp representing the date and time of last modification of the rule.","type":"number","examples":[1614679682091]},"requestMode":{"description":"This is Single Request mode or Batch Request mode. Single Request mode sends each event separately to the endpoint specified by the rule. Batch Request mode rolls up multiple events into the same request. You can read more about the difference between single and batched events in the Ably documentation.\n\n`single` `batch`","enum":["single","batch"],"type":"string","examples":["single"]},"ruleType":{"description":"The type of rule. In this case Zapier. See the documentation for further information.\n\n`http/zapier`","enum":["http/zapier"],"type":"string"},"source":RuleSource,"status":{"description":"The status of the rule. Rules can be enabled or disabled.\n\n`enabled` `disabled`","enum":["enabled","disabled"],"type":"string","examples":["enabled"]},"target":{"additionalProperties":false,"properties":{"headers":{"description":"If you have additional information to send, you'll need to include the relevant headers.","items":{"properties":{"name":{"description":"The name of the header.","type":"string"},"value":{"description":"The value of the header.","type":"string"}},"type":"object"},"type":"array"},"signingKeyId":{"description":"The signing key ID for use in `batch` mode. Ably will optionally sign the payload using an API key ensuring your servers can validate the payload using the private API key. See the webhook security docs for more information.","type":["string","null"]},"url":{"type":"string"}},"required":["url"],"type":"object"},"version":{"description":"API version. Events and the format of their payloads are versioned. Please see the Events documentation.","type":"string"}},"required":["ruleType","requestMode","source","target"],"type":"object","title":"zapier_rule_response","x-readme-ref-name":"zapier_rule_response"} as const ; -export { AmqpExternalRulePatch, AmqpExternalRulePost, AmqpExternalRuleResponse, AmqpRulePatch, AmqpRulePost, AmqpRuleResponse, AppPatch, AppPkcs12, AppPost, AppResponse, AwsAccessKeys, AwsAccessKeysResponse, AwsAssumeRole, AwsKinesisRulePatch, AwsKinesisRulePost, AwsKinesisRuleResponse, AwsLambdaRulePatch, AwsLambdaRulePost, AwsLambdaRuleResponse, AwsSqsRulePatch, AwsSqsRulePost, AwsSqsRuleResponse, AzureFunctionRulePatch, AzureFunctionRulePost, AzureFunctionRuleResponse, CloudflareWorkerRulePatch, CloudflareWorkerRulePost, CloudflareWorkerRuleResponse, DeleteAppsAppIdNamespacesNamespaceId, DeleteAppsAppIdQueuesQueueId, DeleteAppsAppIdRulesRuleId, DeleteAppsId, Error, GetAccountsAccountIdApps, GetAppsAppIdKeys, GetAppsAppIdNamespaces, GetAppsAppIdQueues, GetAppsAppIdRules, GetAppsAppIdRulesRuleId, GoogleCloudFunctionRulePatch, GoogleCloudFunctionRulePost, GoogleCloudFunctionRuleResponse, HttpRulePatch, HttpRulePost, HttpRuleResponse, IftttRulePatch, IftttRulePost, IftttRuleResponse, KeyPatch, KeyPost, KeyResponse, Me, NamespacePatch, NamespacePost, NamespaceResponse, PatchAppsAppIdKeysKeyId, PatchAppsAppIdNamespacesNamespaceId, PatchAppsAppIdRulesRuleId, PatchAppsId, PostAccountsAccountIdApps, PostAppsAppIdKeys, PostAppsAppIdKeysKeyIdRevoke, PostAppsAppIdNamespaces, PostAppsAppIdQueues, PostAppsAppIdRules, PostAppsIdPkcs12, Queue, QueueResponse, RuleAttributes, RulePatch, RulePost, RuleResponse, RuleSource, RuleSourcePatch, UnsupportedRuleResponse, ZapierRulePatch, ZapierRulePost, ZapierRuleResponse } +export { AmqpExternalRulePatch, AmqpExternalRulePost, AmqpExternalRuleResponse, AmqpRulePatch, AmqpRulePost, AmqpRuleResponse, AppPatch, AppPkcs12, AppPost, AppResponse, AwsAccessKeys, AwsAccessKeysResponse, AwsAssumeRole, AwsKinesisRulePatch, AwsKinesisRulePost, AwsKinesisRuleResponse, AwsLambdaRulePatch, AwsLambdaRulePost, AwsLambdaRuleResponse, AwsSqsRulePatch, AwsSqsRulePost, AwsSqsRuleResponse, AzureFunctionRulePatch, AzureFunctionRulePost, AzureFunctionRuleResponse, CloudflareWorkerRulePatch, CloudflareWorkerRulePost, CloudflareWorkerRuleResponse, DeleteAppsAppIdNamespacesNamespaceId, DeleteAppsAppIdQueuesQueueId, DeleteAppsAppIdRulesRuleId, DeleteAppsId, Error, GetAccountsAccountIdApps, GetAppsAppIdKeys, GetAppsAppIdNamespaces, GetAppsAppIdQueues, GetAppsAppIdRules, GetAppsAppIdRulesRuleId, GoogleCloudFunctionRulePatch, GoogleCloudFunctionRulePost, GoogleCloudFunctionRuleResponse, HttpRulePatch, HttpRulePost, HttpRuleResponse, IftttRulePatch, IftttRulePost, IftttRuleResponse, KeyPatch, KeyPost, KeyResponse, Me, NamespacePatch, NamespacePost, NamespaceResponse, PatchAppsAppIdKeysKeyId, PatchAppsAppIdNamespacesNamespaceId, PatchAppsAppIdRulesRuleId, PatchAppsId, PostAccountsAccountIdApps, PostAppsAppIdKeys, PostAppsAppIdKeysKeyIdRevoke, PostAppsAppIdNamespaces, PostAppsAppIdQueues, PostAppsAppIdRules, PostAppsIdPkcs12, Queue, QueueResponse, RulePatch, RulePost, RuleResponse, RuleSource, UnsupportedRuleResponse, ZapierRulePatch, ZapierRulePost, ZapierRuleResponse } diff --git a/packages/api/test/__fixtures__/sdk/alby/types.ts b/packages/api/test/__fixtures__/sdk/alby/types.ts index 76065fca..d1a1a501 100644 --- a/packages/api/test/__fixtures__/sdk/alby/types.ts +++ b/packages/api/test/__fixtures__/sdk/alby/types.ts @@ -74,12 +74,10 @@ export type PostAppsAppIdRulesMetadataParam = FromSchema; export type Queue = FromSchema; export type QueueResponse = FromSchema; -export type RuleAttributes = FromSchema; export type RulePatch = FromSchema; export type RulePost = FromSchema; export type RuleResponse = FromSchema; export type RuleSource = FromSchema; -export type RuleSourcePatch = FromSchema; export type UnsupportedRuleResponse = FromSchema; export type ZapierRulePatch = FromSchema; export type ZapierRulePost = FromSchema; diff --git a/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts b/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts index c0d423b4..bfc0b74c 100644 --- a/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts +++ b/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts @@ -1,7 +1,7 @@ -import type { ConfigOptions, FetchResponse } from 'api/dist/core' +import type { ConfigOptions, FetchResponse } from '@api/core' import Oas from 'oas'; -import APICore from 'api/dist/core'; -import definition from '../../../__fixtures__/definitions/operationid-quirks.json'; +import APICore from '@api/core'; +import definition from '@api/test-utils/src/fixtures/definitions/operationid-quirks.json'; class SDK { spec: Oas; diff --git a/packages/api/test/__fixtures__/sdk/optional-payload/index.ts b/packages/api/test/__fixtures__/sdk/optional-payload/index.ts index d0a41be4..781ced8d 100644 --- a/packages/api/test/__fixtures__/sdk/optional-payload/index.ts +++ b/packages/api/test/__fixtures__/sdk/optional-payload/index.ts @@ -1,8 +1,8 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api/dist/core' +import type { ConfigOptions, FetchResponse } from '@api/core' import Oas from 'oas'; -import APICore from 'api/dist/core'; -import definition from '../../../__fixtures__/definitions/optional-payload.json'; +import APICore from '@api/core'; +import definition from '@api/test-utils/src/fixtures/definitions/optional-payload.json'; class SDK { spec: Oas; diff --git a/packages/api/test/__fixtures__/sdk/petstore/index.ts b/packages/api/test/__fixtures__/sdk/petstore/index.ts index 886d0817..ac5e3126 100644 --- a/packages/api/test/__fixtures__/sdk/petstore/index.ts +++ b/packages/api/test/__fixtures__/sdk/petstore/index.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api/dist/core' +import type { ConfigOptions, FetchResponse } from '@api/core' import Oas from 'oas'; -import APICore from 'api/dist/core'; +import APICore from '@api/core'; import definition from '@readme/oas-examples/3.0/json/petstore.json'; class SDK { diff --git a/packages/api/test/__fixtures__/sdk/petstore/schemas.ts b/packages/api/test/__fixtures__/sdk/petstore/schemas.ts index 8fbe5526..51d0899d 100644 --- a/packages/api/test/__fixtures__/sdk/petstore/schemas.ts +++ b/packages/api/test/__fixtures__/sdk/petstore/schemas.ts @@ -12,7 +12,7 @@ const DeletePet = {"metadata":{"allOf":[{"type":"object","properties":{"petId":{ ; const DeleteUser = {"metadata":{"allOf":[{"type":"object","properties":{"username":{"type":"string","$schema":"http://json-schema.org/draft-04/schema#","description":"The name that needs to be deleted"}},"required":["username"]}]}} as const ; -const FindPetsByStatus = {"metadata":{"allOf":[{"type":"object","properties":{"status":{"type":"array","items":{"type":"string","enum":["available","pending","sold"],"default":"available"},"$schema":"http://json-schema.org/draft-04/schema#","description":"Status values that need to be considered for filter"}},"required":["status"]}]},"response":{"200":{"type":"array","items":Pet,"$schema":"http://json-schema.org/draft-04/schema#"}}} as const +const FindPetsByStatus = {"metadata":{"allOf":[{"type":"object","properties":{"status":{"type":"array","items":{"type":"string","enum":["available","pending","sold"],"default":"available","description":"Default: available"},"$schema":"http://json-schema.org/draft-04/schema#","description":"Status values that need to be considered for filter"}},"required":["status"]}]},"response":{"200":{"type":"array","items":Pet,"$schema":"http://json-schema.org/draft-04/schema#"}}} as const ; const FindPetsByTags = {"metadata":{"allOf":[{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string"},"$schema":"http://json-schema.org/draft-04/schema#","description":"Tags to filter by"}},"required":["tags"]}]},"response":{"200":{"type":"array","items":Pet,"$schema":"http://json-schema.org/draft-04/schema#"}}} as const ; diff --git a/packages/api/test/__fixtures__/sdk/readme/index.ts b/packages/api/test/__fixtures__/sdk/readme/index.ts index 858cf8ab..462031c9 100644 --- a/packages/api/test/__fixtures__/sdk/readme/index.ts +++ b/packages/api/test/__fixtures__/sdk/readme/index.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api/dist/core' +import type { ConfigOptions, FetchResponse } from '@api/core' import Oas from 'oas'; -import APICore from 'api/dist/core'; +import APICore from '@api/core'; import definition from '@readme/oas-examples/3.0/json/readme.json'; class SDK { @@ -484,4 +484,4 @@ const createSDK = (() => { return new SDK(); })() export default createSDK; -export type { Apply, BaseError, Category, Changelog, CondensedProjectData, CreateCategoryMetadataParam, CreateCustomPageResponse401, CreateCustomPageResponse403, CreateDocMetadataParam, CreateDocResponse401, CreateDocResponse403, CreateVersionResponse400, CreateVersionResponse401, CreateVersionResponse403, CustomPage, DeleteApiSpecificationMetadataParam, DeleteApiSpecificationResponse401, DeleteApiSpecificationResponse403, DeleteCategoryMetadataParam, DeleteChangelogMetadataParam, DeleteCustomPageMetadataParam, DeleteCustomPageResponse401, DeleteCustomPageResponse403, DeleteDocMetadataParam, DeleteDocResponse401, DeleteDocResponse403, DeleteVersionMetadataParam, DeleteVersionResponse401, DeleteVersionResponse403, DocSchemaPost, DocSchemaPut, DocSchemaResponse, ErrorApikeyEmpty, ErrorApikeyMismatch, ErrorApikeyNotfound, ErrorApplyInvalidEmail, ErrorApplyInvalidJob, ErrorApplyInvalidName, ErrorCategoryInvalid, ErrorCategoryNotfound, ErrorChangelogInvalid, ErrorChangelogNotfound, ErrorCustompageInvalid, ErrorCustompageNotfound, ErrorDocInvalid, ErrorDocNotfound, ErrorEndpointNotfound, ErrorInternalError, ErrorProjectNeedsstaging, ErrorProjectNotfound, ErrorRateLimited, ErrorRegistryInvalid, ErrorRegistryNotfound, ErrorSpecFileEmpty, ErrorSpecIdDuplicate, ErrorSpecIdInvalid, ErrorSpecInvalid, ErrorSpecInvalidSchema, ErrorSpecNotfound, ErrorSpecTimeout, ErrorSpecVersionNotfound, ErrorUnexpectedError, ErrorVersionCantDemoteStable, ErrorVersionCantRemoveStable, ErrorVersionDuplicate, ErrorVersionEmpty, ErrorVersionForkEmpty, ErrorVersionForkNotfound, ErrorVersionInvalid, ErrorVersionNotfound, GetApiRegistryMetadataParam, GetApiRegistryResponse200, GetApiSchemaResponse200, GetApiSpecificationMetadataParam, GetApiSpecificationResponse200, GetApiSpecificationResponse401, GetApiSpecificationResponse403, GetCategoriesMetadataParam, GetCategoriesResponse200, GetCategoryDocsMetadataParam, GetCategoryMetadataParam, GetChangelogMetadataParam, GetChangelogsMetadataParam, GetChangelogsResponse200, GetCustomPageMetadataParam, GetCustomPageResponse401, GetCustomPageResponse403, GetCustomPagesMetadataParam, GetCustomPagesResponse200, GetCustomPagesResponse401, GetCustomPagesResponse403, GetDocMetadataParam, GetDocResponse401, GetDocResponse403, GetOpenRolesResponse200, GetProductionDocMetadataParam, GetProductionDocResponse401, GetProductionDocResponse403, GetProjectResponse401, GetProjectResponse403, GetVersionMetadataParam, GetVersionResponse401, GetVersionResponse403, GetVersionsResponse401, GetVersionsResponse403, JobOpening, SearchDocsMetadataParam, SearchDocsResponse401, SearchDocsResponse403, UpdateApiSpecificationBodyParam, UpdateApiSpecificationMetadataParam, UpdateApiSpecificationResponse400, UpdateApiSpecificationResponse401, UpdateApiSpecificationResponse403, UpdateCategoryMetadataParam, UpdateChangelogMetadataParam, UpdateCustomPageMetadataParam, UpdateCustomPageResponse401, UpdateCustomPageResponse403, UpdateDocMetadataParam, UpdateDocResponse401, UpdateDocResponse403, UpdateVersionMetadataParam, UpdateVersionResponse401, UpdateVersionResponse403, UploadApiSpecificationBodyParam, UploadApiSpecificationMetadataParam, UploadApiSpecificationResponse400, UploadApiSpecificationResponse401, UploadApiSpecificationResponse403, Version } from './types'; +export type { Apply, Category, Changelog, CondensedProjectData, CreateCategoryMetadataParam, CreateCustomPageResponse401, CreateCustomPageResponse403, CreateDocMetadataParam, CreateDocResponse401, CreateDocResponse403, CreateVersionResponse400, CreateVersionResponse401, CreateVersionResponse403, CustomPage, DeleteApiSpecificationMetadataParam, DeleteApiSpecificationResponse401, DeleteApiSpecificationResponse403, DeleteCategoryMetadataParam, DeleteChangelogMetadataParam, DeleteCustomPageMetadataParam, DeleteCustomPageResponse401, DeleteCustomPageResponse403, DeleteDocMetadataParam, DeleteDocResponse401, DeleteDocResponse403, DeleteVersionMetadataParam, DeleteVersionResponse401, DeleteVersionResponse403, DocSchemaPost, DocSchemaPut, DocSchemaResponse, ErrorApikeyEmpty, ErrorApikeyMismatch, ErrorApikeyNotfound, ErrorCategoryInvalid, ErrorCategoryNotfound, ErrorCustompageInvalid, ErrorCustompageNotfound, ErrorDocInvalid, ErrorDocNotfound, ErrorRegistryNotfound, ErrorSpecFileEmpty, ErrorSpecIdDuplicate, ErrorSpecIdInvalid, ErrorSpecInvalid, ErrorSpecInvalidSchema, ErrorSpecNotfound, ErrorSpecTimeout, ErrorSpecVersionNotfound, ErrorVersionCantDemoteStable, ErrorVersionCantRemoveStable, ErrorVersionDuplicate, ErrorVersionEmpty, ErrorVersionForkEmpty, ErrorVersionForkNotfound, ErrorVersionNotfound, GetApiRegistryMetadataParam, GetApiRegistryResponse200, GetApiSchemaResponse200, GetApiSpecificationMetadataParam, GetApiSpecificationResponse200, GetApiSpecificationResponse401, GetApiSpecificationResponse403, GetCategoriesMetadataParam, GetCategoriesResponse200, GetCategoryDocsMetadataParam, GetCategoryMetadataParam, GetChangelogMetadataParam, GetChangelogsMetadataParam, GetChangelogsResponse200, GetCustomPageMetadataParam, GetCustomPageResponse401, GetCustomPageResponse403, GetCustomPagesMetadataParam, GetCustomPagesResponse200, GetCustomPagesResponse401, GetCustomPagesResponse403, GetDocMetadataParam, GetDocResponse401, GetDocResponse403, GetOpenRolesResponse200, GetProductionDocMetadataParam, GetProductionDocResponse401, GetProductionDocResponse403, GetProjectResponse401, GetProjectResponse403, GetVersionMetadataParam, GetVersionResponse401, GetVersionResponse403, GetVersionsResponse401, GetVersionsResponse403, JobOpening, SearchDocsMetadataParam, SearchDocsResponse401, SearchDocsResponse403, UpdateApiSpecificationBodyParam, UpdateApiSpecificationMetadataParam, UpdateApiSpecificationResponse400, UpdateApiSpecificationResponse401, UpdateApiSpecificationResponse403, UpdateCategoryMetadataParam, UpdateChangelogMetadataParam, UpdateCustomPageMetadataParam, UpdateCustomPageResponse401, UpdateCustomPageResponse403, UpdateDocMetadataParam, UpdateDocResponse401, UpdateDocResponse403, UpdateVersionMetadataParam, UpdateVersionResponse401, UpdateVersionResponse403, UploadApiSpecificationBodyParam, UploadApiSpecificationMetadataParam, UploadApiSpecificationResponse400, UploadApiSpecificationResponse401, UploadApiSpecificationResponse403, Version } from './types'; diff --git a/packages/api/test/__fixtures__/sdk/readme/schemas.ts b/packages/api/test/__fixtures__/sdk/readme/schemas.ts index f9bef178..c4d023cd 100644 --- a/packages/api/test/__fixtures__/sdk/readme/schemas.ts +++ b/packages/api/test/__fixtures__/sdk/readme/schemas.ts @@ -1,10 +1,8 @@ -const Apply = {"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Your full name","default":"Your Name"},"email":{"type":"string","format":"email","description":"A valid email we can reach you at.","default":"you@example.com"},"job":{"type":"string","description":"The job you're looking to apply for (https://readme.com/careers).","enum":["Front End Engineer","Full Stack Engineer","Head of Product","Head of Solutions Engineering","Product Designer"],"default":"Front End Engineer"},"pronouns":{"type":"string","description":"Learn more at https://lgbtlifecenter.org/pronouns/"},"linkedin":{"type":"string","format":"url","description":"What have you been up to the past few years?"},"github":{"type":"string","description":"Or Bitbucket, Gitlab or anywhere else your code is hosted!","format":"url"},"coverLetter":{"type":"string","format":"blob","description":"What should we know about you?"},"dontReallyApply":{"type":"boolean","description":"Want to play with the API but not actually apply? Set this to true.","default":false}},"required":["name","email","job"],"title":"apply","x-readme-ref-name":"apply"} as const +const Apply = {"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Your full name","default":"Your Name"},"email":{"type":"string","format":"email","description":"A valid email we can reach you at.","default":"you@example.com"},"job":{"type":"string","description":"The job you're looking to apply for (https://readme.com/careers).\n\nDefault: `Front End Engineer`","enum":["Front End Engineer","Full Stack Engineer","Head of Product","Head of Solutions Engineering","Product Designer"],"default":"Front End Engineer"},"pronouns":{"type":"string","description":"Learn more at https://lgbtlifecenter.org/pronouns/"},"linkedin":{"type":"string","format":"url","description":"What have you been up to the past few years?"},"github":{"type":"string","description":"Or Bitbucket, Gitlab or anywhere else your code is hosted!","format":"url"},"coverLetter":{"type":"string","format":"blob","description":"What should we know about you?"},"dontReallyApply":{"type":"boolean","description":"Want to play with the API but not actually apply? Set this to true.","default":false}},"required":["name","email","job"],"title":"apply","x-readme-ref-name":"apply"} as const ; -const BaseError = {"type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received."},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}},"title":"baseError","x-readme-ref-name":"baseError"} as const +const Category = {"type":"object","title":"category","x-readme-ref-name":"category","required":["title"],"properties":{"title":{"type":"string","description":"A short title for the category. This is what will show in the sidebar."},"type":{"type":"string","enum":["reference","guide"],"default":"guide","description":"A category can be part of your reference or guide documentation, which is determined by this field.\n\nDefault: `guide`"}}} as const ; -const Category = {"type":"object","properties":{"title":{"type":"string","description":"A short title for the category. This is what will show in the sidebar."},"type":{"type":"string","enum":["reference","guide"],"default":"guide","description":"A category can be part of your reference or guide documentation, which is determined by this field."}},"title":"category","x-readme-ref-name":"category"} as const -; -const Changelog = {"type":"object","properties":{"title":{"type":"string","description":"Title of the changelog."},"type":{"type":"string","enum":["","added","fixed","improved","deprecated","removed"]},"body":{"type":"string","description":"Body content of the changelog."},"hidden":{"type":"boolean","description":"Visibility of the changelog.","default":true}},"required":["title","body"],"title":"changelog","x-readme-ref-name":"changelog"} as const +const Changelog = {"type":"object","properties":{"title":{"type":"string","description":"Title of the changelog."},"type":{"type":"string","enum":["","added","fixed","improved","deprecated","removed"],"description":"Default: "},"body":{"type":"string","description":"Body content of the changelog."},"hidden":{"type":"boolean","description":"Visibility of the changelog.","default":true}},"required":["title","body"],"title":"changelog","x-readme-ref-name":"changelog"} as const ; const CondensedProjectData = {"type":"object","properties":{"name":{"type":"string"},"subdomain":{"type":"string"},"jwtSecret":{"type":"string"},"baseUrl":{"type":"string","format":"url","description":"The base URL for the project. If the project is not running under a custom domain, it will be `https://projectSubdomain.readme.io`, otherwise it can either be or `https://example.com` or, in the case of an enterprise child project `https://example.com/projectSubdomain`."},"plan":{"type":"string"}},"title":"condensedProjectData","x-readme-ref-name":"condensedProjectData"} as const ; @@ -34,7 +32,7 @@ const DocSchemaPost = {"type":"object","oneOf":[{"required":["title","category"] ; const DocSchemaPut = {"type":"object","properties":{"title":{"type":"string","description":"Title of the page."},"type":{"type":"string","description":"Type of the page. The available types all show up under the /docs/ URL path of your docs project (also known as the \"guides\" section). Can be \"basic\" (most common), \"error\" (page desribing an API error), or \"link\" (page that redirects to an external link).","enum":["basic","error","link"]},"body":{"type":"string","description":"Body content of the page, formatted in [ReadMe-flavored Markdown](https://docs.readme.com/rdmd/docs)."},"category":{"type":"string","description":"Category ID of the page, which you can get through [the **Get all categories** endpoint](https://docs.readme.com/main/reference/getcategories)."},"hidden":{"type":"boolean","description":"Visibility of the page."},"order":{"type":"integer","description":"The position of the page in your project sidebar.","examples":[999]},"parentDoc":{"type":"string","description":"The parent doc's ID, if the page is a subpage."},"error":{"type":"object","properties":{"code":{"type":"string","description":"The error code for docs with the \"error\" type."}}},"categorySlug":{"type":"string","description":"The slug of the category this page is associated with. You can get this through [the **Get all categories** endpoint](https://docs.readme.com/main/reference/getcategories). This field is an alternative to the `category` field."},"parentDocSlug":{"type":"string","description":"If this page is a subpage, this field will be the slug of the parent document. You can get this through https://docs.readme.com/main/reference/docs#getdoc. This field is an alternative to the `parentDoc` field."}},"additionalProperties":true,"title":"docSchemaPut","x-readme-ref-name":"docSchemaPut"} as const ; -const DocSchemaResponse = {"type":"object","properties":{"title":{"type":"string","description":"Title of the page."},"type":{"type":"string","description":"Type of the page. The available types all show up under the /docs/ URL path of your docs project (also known as the \"guides\" section). Can be \"basic\" (most common), \"error\" (page desribing an API error), or \"link\" (page that redirects to an external link).","enum":["basic","error","link"]},"body":{"type":"string","description":"Body content of the page, formatted in [ReadMe-flavored Markdown](https://docs.readme.com/rdmd/docs)."},"category":{"type":"string","description":"Category ID of the page, which you can get through [the **Get all categories** endpoint](https://docs.readme.com/main/reference/getcategories)."},"hidden":{"type":"boolean","description":"Visibility of the page."},"order":{"type":"integer","description":"The position of the page in your project sidebar.","examples":[999]},"parentDoc":{"type":"string","description":"The parent doc's ID, if the page is a subpage."},"error":{"type":"object","properties":{"code":{"type":"string","description":"The error code for docs with the \"error\" type."}}}},"additionalProperties":true,"title":"docSchemaResponse","x-readme-ref-name":"docSchemaResponse"} as const +const DocSchemaResponse = {"type":"object","properties":{"title":{"type":"string","description":"Title of the page."},"type":{"type":"string","description":"Type of the page. The available types all show up under the /docs/ URL path of your docs project (also known as the \"guides\" section). Can be \"basic\" (most common), \"error\" (page desribing an API error), or \"link\" (page that redirects to an external link).\n\n`basic` `error` `link`","enum":["basic","error","link"]},"body":{"type":"string","description":"Body content of the page, formatted in [ReadMe-flavored Markdown](https://docs.readme.com/rdmd/docs)."},"category":{"type":"string","description":"Category ID of the page, which you can get through [the **Get all categories** endpoint](https://docs.readme.com/main/reference/getcategories)."},"hidden":{"type":"boolean","description":"Visibility of the page."},"order":{"type":"integer","description":"The position of the page in your project sidebar.","examples":[999]},"parentDoc":{"type":"string","description":"The parent doc's ID, if the page is a subpage."},"error":{"type":"object","properties":{"code":{"type":"string","description":"The error code for docs with the \"error\" type."}}}},"additionalProperties":true,"title":"docSchemaResponse","x-readme-ref-name":"docSchemaResponse"} as const ; const ErrorApikeyEmpty = {"title":"error_APIKEY_EMPTY","x-readme-ref-name":"error_APIKEY_EMPTY","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"APIKEY_EMPTY"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; @@ -42,20 +40,10 @@ const ErrorApikeyMismatch = {"title":"error_APIKEY_MISMATCH","x-readme-ref-name" ; const ErrorApikeyNotfound = {"title":"error_APIKEY_NOTFOUND","x-readme-ref-name":"error_APIKEY_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"APIKEY_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; -const ErrorApplyInvalidEmail = {"title":"error_APPLY_INVALID_EMAIL","x-readme-ref-name":"error_APPLY_INVALID_EMAIL","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"APPLY_INVALID_EMAIL"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; -const ErrorApplyInvalidJob = {"title":"error_APPLY_INVALID_JOB","x-readme-ref-name":"error_APPLY_INVALID_JOB","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"APPLY_INVALID_JOB"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; -const ErrorApplyInvalidName = {"title":"error_APPLY_INVALID_NAME","x-readme-ref-name":"error_APPLY_INVALID_NAME","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"APPLY_INVALID_NAME"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; const ErrorCategoryInvalid = {"title":"error_CATEGORY_INVALID","x-readme-ref-name":"error_CATEGORY_INVALID","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"CATEGORY_INVALID"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; const ErrorCategoryNotfound = {"title":"error_CATEGORY_NOTFOUND","x-readme-ref-name":"error_CATEGORY_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"CATEGORY_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; -const ErrorChangelogInvalid = {"title":"error_CHANGELOG_INVALID","x-readme-ref-name":"error_CHANGELOG_INVALID","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"CHANGELOG_INVALID"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; -const ErrorChangelogNotfound = {"title":"error_CHANGELOG_NOTFOUND","x-readme-ref-name":"error_CHANGELOG_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"CHANGELOG_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; const ErrorCustompageInvalid = {"title":"error_CUSTOMPAGE_INVALID","x-readme-ref-name":"error_CUSTOMPAGE_INVALID","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"CUSTOMPAGE_INVALID"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; const ErrorCustompageNotfound = {"title":"error_CUSTOMPAGE_NOTFOUND","x-readme-ref-name":"error_CUSTOMPAGE_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"CUSTOMPAGE_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const @@ -64,18 +52,6 @@ const ErrorDocInvalid = {"title":"error_DOC_INVALID","x-readme-ref-name":"error_ ; const ErrorDocNotfound = {"title":"error_DOC_NOTFOUND","x-readme-ref-name":"error_DOC_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"DOC_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; -const ErrorEndpointNotfound = {"title":"error_ENDPOINT_NOTFOUND","x-readme-ref-name":"error_ENDPOINT_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"ENDPOINT_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; -const ErrorInternalError = {"title":"error_INTERNAL_ERROR","x-readme-ref-name":"error_INTERNAL_ERROR","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"INTERNAL_ERROR"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; -const ErrorProjectNeedsstaging = {"title":"error_PROJECT_NEEDSSTAGING","x-readme-ref-name":"error_PROJECT_NEEDSSTAGING","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"PROJECT_NEEDSSTAGING"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; -const ErrorProjectNotfound = {"title":"error_PROJECT_NOTFOUND","x-readme-ref-name":"error_PROJECT_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"PROJECT_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; -const ErrorRateLimited = {"title":"error_RATE_LIMITED","x-readme-ref-name":"error_RATE_LIMITED","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"RATE_LIMITED"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; -const ErrorRegistryInvalid = {"title":"error_REGISTRY_INVALID","x-readme-ref-name":"error_REGISTRY_INVALID","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"REGISTRY_INVALID"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; const ErrorRegistryNotfound = {"title":"error_REGISTRY_NOTFOUND","x-readme-ref-name":"error_REGISTRY_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"REGISTRY_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; const ErrorSpecFileEmpty = {"title":"error_SPEC_FILE_EMPTY","x-readme-ref-name":"error_SPEC_FILE_EMPTY","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"SPEC_FILE_EMPTY"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const @@ -94,8 +70,6 @@ const ErrorSpecTimeout = {"title":"error_SPEC_TIMEOUT","x-readme-ref-name":"erro ; const ErrorSpecVersionNotfound = {"title":"error_SPEC_VERSION_NOTFOUND","x-readme-ref-name":"error_SPEC_VERSION_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"SPEC_VERSION_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; -const ErrorUnexpectedError = {"title":"error_UNEXPECTED_ERROR","x-readme-ref-name":"error_UNEXPECTED_ERROR","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"UNEXPECTED_ERROR"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; const ErrorVersionCantDemoteStable = {"title":"error_VERSION_CANT_DEMOTE_STABLE","x-readme-ref-name":"error_VERSION_CANT_DEMOTE_STABLE","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"VERSION_CANT_DEMOTE_STABLE"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; const ErrorVersionCantRemoveStable = {"title":"error_VERSION_CANT_REMOVE_STABLE","x-readme-ref-name":"error_VERSION_CANT_REMOVE_STABLE","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"VERSION_CANT_REMOVE_STABLE"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const @@ -108,8 +82,6 @@ const ErrorVersionForkEmpty = {"title":"error_VERSION_FORK_EMPTY","x-readme-ref- ; const ErrorVersionForkNotfound = {"title":"error_VERSION_FORK_NOTFOUND","x-readme-ref-name":"error_VERSION_FORK_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"VERSION_FORK_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; -const ErrorVersionInvalid = {"title":"error_VERSION_INVALID","x-readme-ref-name":"error_VERSION_INVALID","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"VERSION_INVALID"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const -; const ErrorVersionNotfound = {"title":"error_VERSION_NOTFOUND","x-readme-ref-name":"error_VERSION_NOTFOUND","type":"object","properties":{"error":{"type":"string","description":"An error code unique to the error received.","default":"VERSION_NOTFOUND"},"message":{"type":"string","description":"The reason why the error occured."},"suggestion":{"type":"string","description":"A helpful suggestion for how to alleviate the error."},"docs":{"type":"string","format":"url","description":"A [ReadMe Metrics](https://readme.com/metrics/) log URL where you can see more information the request that you made. If we have metrics URLs unavailable for your request, this URL will be a URL to our API Reference.","examples":["https://docs.readme.com/logs/6883d0ee-cf79-447a-826f-a48f7d5bdf5f"]},"help":{"type":"string","description":"Information on where you can receive additional assistance from our wonderful support team.","examples":["If you need help, email support@readme.io"]},"poem":{"type":"array","description":"A short poem we wrote you about your error.","items":{"type":"string"},"examples":["If you're seeing this error,","Things didn't quite go the way we hoped.","When we tried to process your request,","Maybe trying again it'll work—who knows!"]}}} as const ; const GetApiRegistry = {"metadata":{"allOf":[{"type":"object","properties":{"uuid":{"type":"string","$schema":"http://json-schema.org/draft-04/schema#","description":"An API Registry UUID. This can be found by navigating to your API Reference page and viewing code snippets for Node with the `api` library."}},"required":["uuid"]}]},"response":{"200":{"type":"object","additionalProperties":true,"$schema":"http://json-schema.org/draft-04/schema#"}}} as const @@ -164,4 +136,4 @@ const UploadApiSpecification = {"body":{"type":"object","properties":{"spec":{"d ; const Version = {"type":"object","properties":{"version":{"type":"string","description":"Semantic Version"},"codename":{"type":"string","description":"Dubbed name of version."},"from":{"type":"string","description":"Semantic Version to use as the base fork."},"is_stable":{"type":"boolean","description":"Should this be the **main** version?"},"is_beta":{"type":"boolean","default":true},"is_hidden":{"type":"boolean","description":"Should this be publically accessible?"},"is_deprecated":{"type":"boolean","description":"Should this be deprecated? Only allowed in PUT operations."}},"required":["version","from"],"title":"version","x-readme-ref-name":"version"} as const ; -export { Apply, BaseError, Category, Changelog, CondensedProjectData, CreateCategory, CreateCustomPage, CreateDoc, CreateVersion, CustomPage, DeleteApiSpecification, DeleteCategory, DeleteChangelog, DeleteCustomPage, DeleteDoc, DeleteVersion, DocSchemaPost, DocSchemaPut, DocSchemaResponse, ErrorApikeyEmpty, ErrorApikeyMismatch, ErrorApikeyNotfound, ErrorApplyInvalidEmail, ErrorApplyInvalidJob, ErrorApplyInvalidName, ErrorCategoryInvalid, ErrorCategoryNotfound, ErrorChangelogInvalid, ErrorChangelogNotfound, ErrorCustompageInvalid, ErrorCustompageNotfound, ErrorDocInvalid, ErrorDocNotfound, ErrorEndpointNotfound, ErrorInternalError, ErrorProjectNeedsstaging, ErrorProjectNotfound, ErrorRateLimited, ErrorRegistryInvalid, ErrorRegistryNotfound, ErrorSpecFileEmpty, ErrorSpecIdDuplicate, ErrorSpecIdInvalid, ErrorSpecInvalid, ErrorSpecInvalidSchema, ErrorSpecNotfound, ErrorSpecTimeout, ErrorSpecVersionNotfound, ErrorUnexpectedError, ErrorVersionCantDemoteStable, ErrorVersionCantRemoveStable, ErrorVersionDuplicate, ErrorVersionEmpty, ErrorVersionForkEmpty, ErrorVersionForkNotfound, ErrorVersionInvalid, ErrorVersionNotfound, GetApiRegistry, GetApiSchema, GetApiSpecification, GetCategories, GetCategory, GetCategoryDocs, GetChangelog, GetChangelogs, GetCustomPage, GetCustomPages, GetDoc, GetOpenRoles, GetProductionDoc, GetProject, GetVersion, GetVersions, JobOpening, SearchDocs, UpdateApiSpecification, UpdateCategory, UpdateChangelog, UpdateCustomPage, UpdateDoc, UpdateVersion, UploadApiSpecification, Version } +export { Apply, Category, Changelog, CondensedProjectData, CreateCategory, CreateCustomPage, CreateDoc, CreateVersion, CustomPage, DeleteApiSpecification, DeleteCategory, DeleteChangelog, DeleteCustomPage, DeleteDoc, DeleteVersion, DocSchemaPost, DocSchemaPut, DocSchemaResponse, ErrorApikeyEmpty, ErrorApikeyMismatch, ErrorApikeyNotfound, ErrorCategoryInvalid, ErrorCategoryNotfound, ErrorCustompageInvalid, ErrorCustompageNotfound, ErrorDocInvalid, ErrorDocNotfound, ErrorRegistryNotfound, ErrorSpecFileEmpty, ErrorSpecIdDuplicate, ErrorSpecIdInvalid, ErrorSpecInvalid, ErrorSpecInvalidSchema, ErrorSpecNotfound, ErrorSpecTimeout, ErrorSpecVersionNotfound, ErrorVersionCantDemoteStable, ErrorVersionCantRemoveStable, ErrorVersionDuplicate, ErrorVersionEmpty, ErrorVersionForkEmpty, ErrorVersionForkNotfound, ErrorVersionNotfound, GetApiRegistry, GetApiSchema, GetApiSpecification, GetCategories, GetCategory, GetCategoryDocs, GetChangelog, GetChangelogs, GetCustomPage, GetCustomPages, GetDoc, GetOpenRoles, GetProductionDoc, GetProject, GetVersion, GetVersions, JobOpening, SearchDocs, UpdateApiSpecification, UpdateCategory, UpdateChangelog, UpdateCustomPage, UpdateDoc, UpdateVersion, UploadApiSpecification, Version } diff --git a/packages/api/test/__fixtures__/sdk/readme/types.ts b/packages/api/test/__fixtures__/sdk/readme/types.ts index 16b7271e..317a54b2 100644 --- a/packages/api/test/__fixtures__/sdk/readme/types.ts +++ b/packages/api/test/__fixtures__/sdk/readme/types.ts @@ -2,7 +2,6 @@ import type { FromSchema } from 'json-schema-to-ts'; import * as schemas from './schemas'; export type Apply = FromSchema; -export type BaseError = FromSchema; export type Category = FromSchema; export type Changelog = FromSchema; export type CondensedProjectData = FromSchema; @@ -36,23 +35,12 @@ export type DocSchemaResponse = FromSchema; export type ErrorApikeyEmpty = FromSchema; export type ErrorApikeyMismatch = FromSchema; export type ErrorApikeyNotfound = FromSchema; -export type ErrorApplyInvalidEmail = FromSchema; -export type ErrorApplyInvalidJob = FromSchema; -export type ErrorApplyInvalidName = FromSchema; export type ErrorCategoryInvalid = FromSchema; export type ErrorCategoryNotfound = FromSchema; -export type ErrorChangelogInvalid = FromSchema; -export type ErrorChangelogNotfound = FromSchema; export type ErrorCustompageInvalid = FromSchema; export type ErrorCustompageNotfound = FromSchema; export type ErrorDocInvalid = FromSchema; export type ErrorDocNotfound = FromSchema; -export type ErrorEndpointNotfound = FromSchema; -export type ErrorInternalError = FromSchema; -export type ErrorProjectNeedsstaging = FromSchema; -export type ErrorProjectNotfound = FromSchema; -export type ErrorRateLimited = FromSchema; -export type ErrorRegistryInvalid = FromSchema; export type ErrorRegistryNotfound = FromSchema; export type ErrorSpecFileEmpty = FromSchema; export type ErrorSpecIdDuplicate = FromSchema; @@ -62,14 +50,12 @@ export type ErrorSpecInvalidSchema = FromSchema; export type ErrorSpecTimeout = FromSchema; export type ErrorSpecVersionNotfound = FromSchema; -export type ErrorUnexpectedError = FromSchema; export type ErrorVersionCantDemoteStable = FromSchema; export type ErrorVersionCantRemoveStable = FromSchema; export type ErrorVersionDuplicate = FromSchema; export type ErrorVersionEmpty = FromSchema; export type ErrorVersionForkEmpty = FromSchema; export type ErrorVersionForkNotfound = FromSchema; -export type ErrorVersionInvalid = FromSchema; export type ErrorVersionNotfound = FromSchema; export type GetApiRegistryMetadataParam = FromSchema; export type GetApiRegistryResponse200 = FromSchema; diff --git a/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts b/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts index e29950c2..bcfd9066 100644 --- a/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts +++ b/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts @@ -1,8 +1,8 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse, HTTPMethodRange } from 'api/dist/core'; +import type { ConfigOptions, FetchResponse, HTTPMethodRange } from '@api/core'; import Oas from 'oas'; -import APICore from 'api/dist/core'; -import definition from '../../../__fixtures__/definitions/response-title-quirks.json'; +import APICore from '@api/core'; +import definition from '@api/test-utils/src/fixtures/definitions/response-title-quirks.json'; class SDK { spec: Oas; diff --git a/packages/api/test/__fixtures__/sdk/response-title-quirks/schemas.ts b/packages/api/test/__fixtures__/sdk/response-title-quirks/schemas.ts index 1ace9bc3..5651e764 100644 --- a/packages/api/test/__fixtures__/sdk/response-title-quirks/schemas.ts +++ b/packages/api/test/__fixtures__/sdk/response-title-quirks/schemas.ts @@ -1,3 +1,3 @@ -const GetAnything = {"metadata":{"allOf":[{"type":"object","properties":{"status":{"type":"array","items":{"type":"string","enum":["available","pending","sold"],"default":"available"},"$schema":"https://json-schema.org/draft/2020-12/schema#","description":"Status values that need to be considered for filter"}},"required":["status"]}]},"response":{"2XX":{"oneOf":[{"title":"260 Created (token)","type":"object","properties":{"id":{"type":"string","examples":["e450ec69-dac2-4858-b4c9-6d3af44bb5f8"]}}},{"title":"260 Created","type":"object","properties":{"id":{"type":"string","examples":["e450ec69-dac2-4858-b4c9-6d3af44bb5f8"]}}}],"$schema":"https://json-schema.org/draft/2020-12/schema#"}}} as const +const GetAnything = {"metadata":{"allOf":[{"type":"object","properties":{"status":{"type":"array","items":{"type":"string","enum":["available","pending","sold"],"default":"available","description":"Default: available"},"$schema":"https://json-schema.org/draft/2020-12/schema#","description":"Status values that need to be considered for filter"}},"required":["status"]}]},"response":{"2XX":{"oneOf":[{"title":"260 Created (token)","type":"object","properties":{"id":{"type":"string","examples":["e450ec69-dac2-4858-b4c9-6d3af44bb5f8"]}}},{"title":"260 Created","type":"object","properties":{"id":{"type":"string","examples":["e450ec69-dac2-4858-b4c9-6d3af44bb5f8"]}}}],"$schema":"https://json-schema.org/draft/2020-12/schema#"}}} as const ; export { GetAnything } diff --git a/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.d.ts b/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.d.ts index 4d8b34cb..d2a7e7d5 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.d.ts +++ b/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.d.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api/dist/core'; +import type { ConfigOptions, FetchResponse } from '@api/core'; import Oas from 'oas'; -import APICore from 'api/dist/core'; +import APICore from '@api/core'; declare class SDK { spec: Oas; core: APICore; diff --git a/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js b/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js index 5958ae9e..3e54ef3f 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js +++ b/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js @@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var oas_1 = __importDefault(require("oas")); -var core_1 = __importDefault(require("api/dist/core")); -var simple_json_1 = __importDefault(require("../../../__fixtures__/definitions/simple.json")); +var core_1 = __importDefault(require("@api/core")); +var simple_json_1 = __importDefault(require("@api/test-utils/src/fixtures/definitions/simple.json")); var SDK = /** @class */ (function () { function SDK() { this.spec = oas_1.default.init(simple_json_1.default); diff --git a/packages/api/test/__fixtures__/sdk/simple-js-cjs/schemas.d.ts b/packages/api/test/__fixtures__/sdk/simple-js-cjs/schemas.d.ts index 71dd645d..11ee2ca4 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-cjs/schemas.d.ts +++ b/packages/api/test/__fixtures__/sdk/simple-js-cjs/schemas.d.ts @@ -1,22 +1,3 @@ -declare const ApiResponse: { - readonly type: "object"; - readonly properties: { - readonly code: { - readonly type: "integer"; - readonly format: "int32"; - readonly minimum: -2147483648; - readonly maximum: 2147483647; - }; - readonly type: { - readonly type: "string"; - }; - readonly message: { - readonly type: "string"; - }; - }; - readonly title: "ApiResponse"; - readonly "x-readme-ref-name": "ApiResponse"; -}; declare const Category: { readonly type: "object"; readonly properties: { @@ -44,6 +25,7 @@ declare const FindPetsByStatus: { readonly type: "string"; readonly enum: readonly ["available", "pending", "sold"]; readonly default: "available"; + readonly description: "Default: available"; }; readonly $schema: "http://json-schema.org/draft-04/schema#"; readonly description: "Status values that need to be considered for filter"; @@ -116,7 +98,7 @@ declare const FindPetsByStatus: { }; readonly status: { readonly type: "string"; - readonly description: "pet status in the store"; + readonly description: "pet status in the store\n\n`available` `pending` `sold`"; readonly enum: readonly ["available", "pending", "sold"]; }; }; @@ -127,44 +109,6 @@ declare const FindPetsByStatus: { }; }; }; -declare const Order: { - readonly type: "object"; - readonly properties: { - readonly id: { - readonly type: "integer"; - readonly format: "int64"; - readonly minimum: -9223372036854776000; - readonly maximum: 9223372036854776000; - }; - readonly petId: { - readonly type: "integer"; - readonly format: "int64"; - readonly minimum: -9223372036854776000; - readonly maximum: 9223372036854776000; - }; - readonly quantity: { - readonly type: "integer"; - readonly format: "int32"; - readonly minimum: -2147483648; - readonly maximum: 2147483647; - }; - readonly shipDate: { - readonly type: "string"; - readonly format: "date-time"; - }; - readonly status: { - readonly type: "string"; - readonly description: "Order Status"; - readonly enum: readonly ["placed", "approved", "delivered"]; - }; - readonly complete: { - readonly type: "boolean"; - readonly default: false; - }; - }; - readonly title: "Order"; - readonly "x-readme-ref-name": "Order"; -}; declare const Pet: { readonly type: "object"; readonly required: readonly ["name", "photoUrls"]; @@ -226,7 +170,7 @@ declare const Pet: { }; readonly status: { readonly type: "string"; - readonly description: "pet status in the store"; + readonly description: "pet status in the store\n\n`available` `pending` `sold`"; readonly enum: readonly ["available", "pending", "sold"]; }; }; @@ -249,42 +193,4 @@ declare const Tag: { readonly title: "Tag"; readonly "x-readme-ref-name": "Tag"; }; -declare const User: { - readonly type: "object"; - readonly properties: { - readonly id: { - readonly type: "integer"; - readonly format: "int64"; - readonly minimum: -9223372036854776000; - readonly maximum: 9223372036854776000; - }; - readonly username: { - readonly type: "string"; - }; - readonly firstName: { - readonly type: "string"; - }; - readonly lastName: { - readonly type: "string"; - }; - readonly email: { - readonly type: "string"; - }; - readonly password: { - readonly type: "string"; - }; - readonly phone: { - readonly type: "string"; - }; - readonly userStatus: { - readonly type: "integer"; - readonly format: "int32"; - readonly description: "User Status"; - readonly minimum: -2147483648; - readonly maximum: 2147483647; - }; - }; - readonly title: "User"; - readonly "x-readme-ref-name": "User"; -}; -export { ApiResponse, Category, FindPetsByStatus, Order, Pet, Tag, User }; +export { Category, FindPetsByStatus, Pet, Tag }; diff --git a/packages/api/test/__fixtures__/sdk/simple-js-cjs/types.d.ts b/packages/api/test/__fixtures__/sdk/simple-js-cjs/types.d.ts index 04a97fa1..5807822c 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-cjs/types.d.ts +++ b/packages/api/test/__fixtures__/sdk/simple-js-cjs/types.d.ts @@ -1,10 +1,7 @@ import type { FromSchema } from 'json-schema-to-ts'; import * as schemas from './schemas'; -export type ApiResponse = FromSchema; export type Category = FromSchema; export type FindPetsByStatusMetadataParam = FromSchema; export type FindPetsByStatusResponse200 = FromSchema; -export type Order = FromSchema; export type Pet = FromSchema; export type Tag = FromSchema; -export type User = FromSchema; diff --git a/packages/api/test/__fixtures__/sdk/simple-js-esm/index.d.ts b/packages/api/test/__fixtures__/sdk/simple-js-esm/index.d.ts index 1badaae1..f6f2d1f9 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-esm/index.d.ts +++ b/packages/api/test/__fixtures__/sdk/simple-js-esm/index.d.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api/dist/core'; +import type { ConfigOptions, FetchResponse } from '@api/core'; import Oas from 'oas'; -import APICore from 'api/dist/core'; +import APICore from '@api/core'; declare class SDK { spec: Oas; core: APICore; diff --git a/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js b/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js index cb078b80..73bdfbef 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js +++ b/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js @@ -1,6 +1,6 @@ import Oas from 'oas'; -import APICore from 'api/dist/core'; -import definition from '../../../__fixtures__/definitions/simple.json'; +import APICore from '@api/core'; +import definition from '@api/test-utils/src/fixtures/definitions/simple.json'; class SDK { constructor() { this.spec = Oas.init(definition); diff --git a/packages/api/test/__fixtures__/sdk/simple-js-esm/schemas.d.ts b/packages/api/test/__fixtures__/sdk/simple-js-esm/schemas.d.ts index 71dd645d..11ee2ca4 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-esm/schemas.d.ts +++ b/packages/api/test/__fixtures__/sdk/simple-js-esm/schemas.d.ts @@ -1,22 +1,3 @@ -declare const ApiResponse: { - readonly type: "object"; - readonly properties: { - readonly code: { - readonly type: "integer"; - readonly format: "int32"; - readonly minimum: -2147483648; - readonly maximum: 2147483647; - }; - readonly type: { - readonly type: "string"; - }; - readonly message: { - readonly type: "string"; - }; - }; - readonly title: "ApiResponse"; - readonly "x-readme-ref-name": "ApiResponse"; -}; declare const Category: { readonly type: "object"; readonly properties: { @@ -44,6 +25,7 @@ declare const FindPetsByStatus: { readonly type: "string"; readonly enum: readonly ["available", "pending", "sold"]; readonly default: "available"; + readonly description: "Default: available"; }; readonly $schema: "http://json-schema.org/draft-04/schema#"; readonly description: "Status values that need to be considered for filter"; @@ -116,7 +98,7 @@ declare const FindPetsByStatus: { }; readonly status: { readonly type: "string"; - readonly description: "pet status in the store"; + readonly description: "pet status in the store\n\n`available` `pending` `sold`"; readonly enum: readonly ["available", "pending", "sold"]; }; }; @@ -127,44 +109,6 @@ declare const FindPetsByStatus: { }; }; }; -declare const Order: { - readonly type: "object"; - readonly properties: { - readonly id: { - readonly type: "integer"; - readonly format: "int64"; - readonly minimum: -9223372036854776000; - readonly maximum: 9223372036854776000; - }; - readonly petId: { - readonly type: "integer"; - readonly format: "int64"; - readonly minimum: -9223372036854776000; - readonly maximum: 9223372036854776000; - }; - readonly quantity: { - readonly type: "integer"; - readonly format: "int32"; - readonly minimum: -2147483648; - readonly maximum: 2147483647; - }; - readonly shipDate: { - readonly type: "string"; - readonly format: "date-time"; - }; - readonly status: { - readonly type: "string"; - readonly description: "Order Status"; - readonly enum: readonly ["placed", "approved", "delivered"]; - }; - readonly complete: { - readonly type: "boolean"; - readonly default: false; - }; - }; - readonly title: "Order"; - readonly "x-readme-ref-name": "Order"; -}; declare const Pet: { readonly type: "object"; readonly required: readonly ["name", "photoUrls"]; @@ -226,7 +170,7 @@ declare const Pet: { }; readonly status: { readonly type: "string"; - readonly description: "pet status in the store"; + readonly description: "pet status in the store\n\n`available` `pending` `sold`"; readonly enum: readonly ["available", "pending", "sold"]; }; }; @@ -249,42 +193,4 @@ declare const Tag: { readonly title: "Tag"; readonly "x-readme-ref-name": "Tag"; }; -declare const User: { - readonly type: "object"; - readonly properties: { - readonly id: { - readonly type: "integer"; - readonly format: "int64"; - readonly minimum: -9223372036854776000; - readonly maximum: 9223372036854776000; - }; - readonly username: { - readonly type: "string"; - }; - readonly firstName: { - readonly type: "string"; - }; - readonly lastName: { - readonly type: "string"; - }; - readonly email: { - readonly type: "string"; - }; - readonly password: { - readonly type: "string"; - }; - readonly phone: { - readonly type: "string"; - }; - readonly userStatus: { - readonly type: "integer"; - readonly format: "int32"; - readonly description: "User Status"; - readonly minimum: -2147483648; - readonly maximum: 2147483647; - }; - }; - readonly title: "User"; - readonly "x-readme-ref-name": "User"; -}; -export { ApiResponse, Category, FindPetsByStatus, Order, Pet, Tag, User }; +export { Category, FindPetsByStatus, Pet, Tag }; diff --git a/packages/api/test/__fixtures__/sdk/simple-js-esm/types.d.ts b/packages/api/test/__fixtures__/sdk/simple-js-esm/types.d.ts index 04a97fa1..5807822c 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-esm/types.d.ts +++ b/packages/api/test/__fixtures__/sdk/simple-js-esm/types.d.ts @@ -1,10 +1,7 @@ import type { FromSchema } from 'json-schema-to-ts'; import * as schemas from './schemas'; -export type ApiResponse = FromSchema; export type Category = FromSchema; export type FindPetsByStatusMetadataParam = FromSchema; export type FindPetsByStatusResponse200 = FromSchema; -export type Order = FromSchema; export type Pet = FromSchema; export type Tag = FromSchema; -export type User = FromSchema; diff --git a/packages/api/test/__fixtures__/sdk/simple-ts/index.ts b/packages/api/test/__fixtures__/sdk/simple-ts/index.ts index 87da09ae..dd15f25d 100644 --- a/packages/api/test/__fixtures__/sdk/simple-ts/index.ts +++ b/packages/api/test/__fixtures__/sdk/simple-ts/index.ts @@ -1,8 +1,8 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api/dist/core' +import type { ConfigOptions, FetchResponse } from '@api/core' import Oas from 'oas'; -import APICore from 'api/dist/core'; -import definition from '../../../__fixtures__/definitions/simple.json'; +import APICore from '@api/core'; +import definition from '@api/test-utils/src/fixtures/definitions/simple.json'; class SDK { spec: Oas; @@ -88,4 +88,4 @@ const createSDK = (() => { return new SDK(); })() export default createSDK; -export type { ApiResponse, Category, FindPetsByStatusMetadataParam, FindPetsByStatusResponse200, Order, Pet, Tag, User } from './types'; +export type { Category, FindPetsByStatusMetadataParam, FindPetsByStatusResponse200, Pet, Tag } from './types'; diff --git a/packages/api/test/__fixtures__/sdk/simple-ts/schemas.ts b/packages/api/test/__fixtures__/sdk/simple-ts/schemas.ts index 49d9164f..a0e1b7ef 100644 --- a/packages/api/test/__fixtures__/sdk/simple-ts/schemas.ts +++ b/packages/api/test/__fixtures__/sdk/simple-ts/schemas.ts @@ -1,15 +1,9 @@ -const ApiResponse = {"type":"object","properties":{"code":{"type":"integer","format":"int32","minimum":-2147483648,"maximum":2147483647},"type":{"type":"string"},"message":{"type":"string"}},"title":"ApiResponse","x-readme-ref-name":"ApiResponse"} as const -; const Category = {"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":-9223372036854776000,"maximum":9223372036854776000},"name":{"type":"string"}},"title":"Category","x-readme-ref-name":"Category"} as const ; -const FindPetsByStatus = {"metadata":{"allOf":[{"type":"object","properties":{"status":{"type":"array","items":{"type":"string","enum":["available","pending","sold"],"default":"available"},"$schema":"http://json-schema.org/draft-04/schema#","description":"Status values that need to be considered for filter"}},"required":["status"]}]},"response":{"200":{"type":"array","items":Pet,"$schema":"http://json-schema.org/draft-04/schema#"}}} as const -; -const Order = {"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":-9223372036854776000,"maximum":9223372036854776000},"petId":{"type":"integer","format":"int64","minimum":-9223372036854776000,"maximum":9223372036854776000},"quantity":{"type":"integer","format":"int32","minimum":-2147483648,"maximum":2147483647},"shipDate":{"type":"string","format":"date-time"},"status":{"type":"string","description":"Order Status","enum":["placed","approved","delivered"]},"complete":{"type":"boolean","default":false}},"title":"Order","x-readme-ref-name":"Order"} as const +const FindPetsByStatus = {"metadata":{"allOf":[{"type":"object","properties":{"status":{"type":"array","items":{"type":"string","enum":["available","pending","sold"],"default":"available","description":"Default: available"},"$schema":"http://json-schema.org/draft-04/schema#","description":"Status values that need to be considered for filter"}},"required":["status"]}]},"response":{"200":{"type":"array","items":Pet,"$schema":"http://json-schema.org/draft-04/schema#"}}} as const ; -const Pet = {"type":"object","required":["name","photoUrls"],"properties":{"id":{"type":"integer","format":"int64","readOnly":true,"default":40,"examples":[25],"minimum":-9223372036854776000,"maximum":9223372036854776000},"category":Category,"name":{"type":"string","examples":["doggie"]},"photoUrls":{"type":"array","items":{"type":"string","examples":["https://example.com/photo.png"]}},"tags":{"type":"array","items":Tag},"status":{"type":"string","description":"pet status in the store","enum":["available","pending","sold"]}},"title":"Pet","x-readme-ref-name":"Pet"} as const +const Pet = {"type":"object","required":["name","photoUrls"],"properties":{"id":{"type":"integer","format":"int64","readOnly":true,"default":40,"examples":[25],"minimum":-9223372036854776000,"maximum":9223372036854776000},"category":Category,"name":{"type":"string","examples":["doggie"]},"photoUrls":{"type":"array","items":{"type":"string","examples":["https://example.com/photo.png"]}},"tags":{"type":"array","items":Tag},"status":{"type":"string","description":"pet status in the store\n\n`available` `pending` `sold`","enum":["available","pending","sold"]}},"title":"Pet","x-readme-ref-name":"Pet"} as const ; const Tag = {"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":-9223372036854776000,"maximum":9223372036854776000},"name":{"type":"string"}},"title":"Tag","x-readme-ref-name":"Tag"} as const ; -const User = {"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":-9223372036854776000,"maximum":9223372036854776000},"username":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"phone":{"type":"string"},"userStatus":{"type":"integer","format":"int32","description":"User Status","minimum":-2147483648,"maximum":2147483647}},"title":"User","x-readme-ref-name":"User"} as const -; -export { ApiResponse, Category, FindPetsByStatus, Order, Pet, Tag, User } +export { Category, FindPetsByStatus, Pet, Tag } diff --git a/packages/api/test/__fixtures__/sdk/simple-ts/types.ts b/packages/api/test/__fixtures__/sdk/simple-ts/types.ts index 53007759..4ea47267 100644 --- a/packages/api/test/__fixtures__/sdk/simple-ts/types.ts +++ b/packages/api/test/__fixtures__/sdk/simple-ts/types.ts @@ -1,11 +1,8 @@ import type { FromSchema } from 'json-schema-to-ts'; import * as schemas from './schemas'; -export type ApiResponse = FromSchema; export type Category = FromSchema; export type FindPetsByStatusMetadataParam = FromSchema; export type FindPetsByStatusResponse200 = FromSchema; -export type Order = FromSchema; export type Pet = FromSchema; export type Tag = FromSchema; -export type User = FromSchema; diff --git a/packages/api/test/cli/codegen/languages/typescript.test.ts b/packages/api/test/cli/codegen/languages/typescript.test.ts index 7386b408..12e57e81 100644 --- a/packages/api/test/cli/codegen/languages/typescript.test.ts +++ b/packages/api/test/cli/codegen/languages/typescript.test.ts @@ -3,6 +3,8 @@ import type { TSGeneratorOptions } from '../../../../src/cli/codegen/languages/t import { promises as fs } from 'fs'; import path from 'path'; +import { responses as mockResponse } from '@api/test-utils/src/fetch-mock'; +import loadSpec from '@api/test-utils/src/load-spec'; import fetchMock from 'fetch-mock'; import Oas from 'oas'; import uniqueTempDir from 'unique-temp-dir'; @@ -11,8 +13,6 @@ import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest'; import TSGenerator from '../../../../src/cli/codegen/languages/typescript'; import Storage from '../../../../src/cli/storage'; import * as packageInfo from '../../../../src/packageInfo'; -import { responses as mockResponse } from '../../../helpers/fetch-mock'; -import loadSpec from '../../../helpers/load-spec'; function assertSDKFixture(file: string, fixture: string, opts: TSGeneratorOptions = {}) { return async () => { @@ -121,12 +121,12 @@ describe('typescript', () => { describe('#generator', () => { it( 'should generate typescript (by default)', - assertSDKFixture('../../../__fixtures__/definitions/simple.json', 'simple-ts'), + assertSDKFixture('@api/test-utils/src/fixtures/definitions/simple.json', 'simple-ts'), ); it( 'should be able to generate valid TS when a body is optional but metadata isnt', - assertSDKFixture('../../../__fixtures__/definitions/optional-payload.json', 'optional-payload'), + assertSDKFixture('@api/test-utils/src/fixtures/definitions/optional-payload.json', 'optional-payload'), ); it('should work against the petstore', assertSDKFixture('@readme/oas-examples/3.0/json/petstore.json', 'petstore')); @@ -136,30 +136,30 @@ describe('typescript', () => { // This SDK only has an `index.ts` as it has no schemas. it( 'should handle some quirky `operationId` cases', - assertSDKFixture('../../../__fixtures__/definitions/operationid-quirks.json', 'operationid-quirks'), + assertSDKFixture('@api/test-utils/src/fixtures/definitions/operationid-quirks.json', 'operationid-quirks'), ); it( 'should handle `title` props that start with a number', - assertSDKFixture('../../../__fixtures__/definitions/response-title-quirks.json', 'response-title-quirks'), + assertSDKFixture('@api/test-utils/src/fixtures/definitions/response-title-quirks.json', 'response-title-quirks'), ); it.todo('should handle a operations with a `default` response'); it( 'should handle an api that has discriminators and no operation ids', - assertSDKFixture('../../../__fixtures__/definitions/alby.json', 'alby'), + assertSDKFixture('@api/test-utils/src/fixtures/definitions/alby.json', 'alby'), ); describe('javascript generation', () => { it( 'should generate a CommonJS library', - assertSDKFixture('../../../__fixtures__/definitions/simple.json', 'simple-js-cjs', { outputJS: true }), + assertSDKFixture('@api/test-utils/src/fixtures/definitions/simple.json', 'simple-js-cjs', { outputJS: true }), ); it( 'should generate am ESM library', - assertSDKFixture('../../../__fixtures__/definitions/simple.json', 'simple-js-esm', { + assertSDKFixture('@api/test-utils/src/fixtures/definitions/simple.json', 'simple-js-esm', { outputJS: true, compilerTarget: 'esm', }), diff --git a/packages/api/test/cli/fetcher.test.ts b/packages/api/test/cli/fetcher.test.ts index 4dd32f80..ca9b457d 100644 --- a/packages/api/test/cli/fetcher.test.ts +++ b/packages/api/test/cli/fetcher.test.ts @@ -1,11 +1,11 @@ import assert from 'assert'; import fs from 'fs/promises'; +import loadSpec from '@api/test-utils/src/load-spec'; import fetchMock from 'fetch-mock'; import { describe, beforeAll, it, expect } from 'vitest'; import Fetcher from '../../src/cli/fetcher'; -import loadSpec from '../helpers/load-spec'; let readmeSpec; diff --git a/packages/api/test/cli/storage.test.ts b/packages/api/test/cli/storage.test.ts index 6111fe46..deb3cfdd 100644 --- a/packages/api/test/cli/storage.test.ts +++ b/packages/api/test/cli/storage.test.ts @@ -4,13 +4,13 @@ import assert from 'assert'; import fs from 'fs/promises'; import path from 'path'; +import loadSpec from '@api/test-utils/src/load-spec'; import fetchMock from 'fetch-mock'; import uniqueTempDir from 'unique-temp-dir'; import { describe, beforeAll, beforeEach, afterEach, it, expect } from 'vitest'; import Storage from '../../src/cli/storage'; import { PACKAGE_VERSION } from '../../src/packageInfo'; -import loadSpec from '../helpers/load-spec'; let petstoreSimple; diff --git a/packages/api/test/global.d.ts b/packages/api/test/global.d.ts index 89196dab..62cb4842 100644 --- a/packages/api/test/global.d.ts +++ b/packages/api/test/global.d.ts @@ -1 +1 @@ -import './helpers/vitest.matchers'; +import '@api/test-utils/src/vitest.matchers'; diff --git a/packages/api/vitest.config.ts b/packages/api/vitest.config.ts index 8363a45e..374d97ce 100644 --- a/packages/api/vitest.config.ts +++ b/packages/api/vitest.config.ts @@ -11,7 +11,7 @@ export default defineConfig({ '**/helpers/**', '**/smoketest.test.ts', ], - setupFiles: ['./test/helpers/vitest.matchers.ts'], + setupFiles: ['@api/test-utils/src/vitest.matchers.ts'], testTimeout: 20000, }, }); diff --git a/packages/core/package.json b/packages/core/package.json index 6369274c..c0591b4f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,6 +2,8 @@ "name": "@api/core", "version": "1.0.0", "description": "The magic behind `api` 🧙", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", "scripts": { "build": "tsc", "lint:types": "tsc --noEmit", @@ -31,8 +33,8 @@ "get-stream": "^6.0.1", "json-schema-traverse": "^1.0.0", "lodash.merge": "^4.6.2", - "oas": "^21.1.1", - "remove-undefined-objects": "^4.0.2" + "oas": "^20.10.3", + "remove-undefined-objects": "^3.0.0" }, "devDependencies": { "@api/test-utils": "file:../test-utils", diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 349c356c..30d15a53 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -20,11 +20,11 @@ export interface ConfigOptions { timeout?: number; } -export interface FetchResponse { - data: data; +export interface FetchResponse { + data: Data; headers: Headers; res: Response; - status: status; + status: HTTPStatus; } // https://stackoverflow.com/a/39495173 @@ -81,13 +81,22 @@ export default class APICore { return this; } - async fetch(path: string, method: HttpMethods, body?: unknown, metadata?: Record) { + async fetch( + path: string, + method: HttpMethods, + body?: unknown, + metadata?: Record, + ) { const operation = this.spec.operation(path, method); - return this.fetchOperation(operation, body, metadata); + return this.fetchOperation(operation, body, metadata); } - async fetchOperation(operation: Operation, body?: unknown, metadata?: Record) { + async fetchOperation( + operation: Operation, + body?: unknown, + metadata?: Record, + ) { return prepareParams(operation, body, metadata).then(params => { const data = { ...params }; @@ -118,7 +127,7 @@ export default class APICore { userAgent: this.userAgent, }) .then(async (res: Response) => { - const parsed = await parseResponse(res); + const parsed = await parseResponse(res); if (res.status >= 400 && res.status <= 599) { throw new FetchError( diff --git a/packages/core/src/lib/parseResponse.ts b/packages/core/src/lib/parseResponse.ts index ec4db6e3..48095fff 100644 --- a/packages/core/src/lib/parseResponse.ts +++ b/packages/core/src/lib/parseResponse.ts @@ -2,7 +2,7 @@ import { utils } from 'oas'; const { matchesMimeType } = utils; -export default async function getResponseBody(response: Response) { +export default async function parseResponse(response: Response) { const contentType = response.headers.get('Content-Type'); const isJSON = contentType && (matchesMimeType.json(contentType) || matchesMimeType.wildcard(contentType)); @@ -19,7 +19,7 @@ export default async function getResponseBody(response: Response) { return { data, - status: response.status, + status: response.status as HTTPStatus, headers: response.headers, res: response, }; diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index da19dffd..2f032c4d 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -13,7 +13,7 @@ }, "devDependencies": { "@types/caseless": "^0.12.3", - "oas": "^21.1.1", + "oas": "^20.10.3", "typescript": "^5.2.2" }, "prettier": "@readme/eslint-config/prettier" diff --git a/packages/api/test/datasets/real-world-apis.json b/packages/test-utils/src/datasets/real-world-apis.json similarity index 100% rename from packages/api/test/datasets/real-world-apis.json rename to packages/test-utils/src/datasets/real-world-apis.json diff --git a/packages/api/test/datasets/refresh-dataset b/packages/test-utils/src/datasets/refresh-dataset similarity index 99% rename from packages/api/test/datasets/refresh-dataset rename to packages/test-utils/src/datasets/refresh-dataset index d2d875b6..b082e585 100755 --- a/packages/api/test/datasets/refresh-dataset +++ b/packages/test-utils/src/datasets/refresh-dataset @@ -7,7 +7,6 @@ */ /* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable no-param-reassign */ -/* eslint-disable vitest/require-hook */ const fs = require('fs'); fetch('https://api.apis.guru/v2/list.json') diff --git a/packages/test-utils/src/vitest.matchers.ts b/packages/test-utils/src/vitest.matchers.ts index a9f42206..ec6847a4 100644 --- a/packages/test-utils/src/vitest.matchers.ts +++ b/packages/test-utils/src/vitest.matchers.ts @@ -9,11 +9,6 @@ interface CustomMatchers { */ toBeDereferenced(): R; - /** - * Assert that a Response headers object has a custom API-identifying `User Agent` header. - */ - toHaveCustomUserAgent(): R; - /** * Determine if a given `Headers` object has a given header matching a specific value. * From ad29dbd5fd47e0d19ba54e67775e85f34cc7e562 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 13 Sep 2023 17:43:16 -0700 Subject: [PATCH 3/8] docs: adding a readme to core --- packages/core/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 packages/core/README.md diff --git a/packages/core/README.md b/packages/core/README.md new file mode 100644 index 00000000..7c7b4dca --- /dev/null +++ b/packages/core/README.md @@ -0,0 +1,16 @@ +# @api/core + +

+ NPM Version + Node Version + MIT License + Build status +

+ +

+The magic behind api 🧙 +

+ +

+Checkout api.readme.dev for more details. +

From afb2ba3ca27e51da4a523f04efa91a9c494572f9 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 13 Sep 2023 17:49:18 -0700 Subject: [PATCH 4/8] refactor: cleaning up the test-utils pkg --- .eslintignore | 2 +- .../api/test/__fixtures__/sdk/alby/index.ts | 2 +- .../sdk/operationid-quirks/index.ts | 2 +- .../sdk/optional-payload/index.ts | 2 +- .../sdk/response-title-quirks/index.ts | 2 +- .../__fixtures__/sdk/simple-js-cjs/index.js | 2 +- .../__fixtures__/sdk/simple-js-esm/index.js | 2 +- .../test/__fixtures__/sdk/simple-ts/index.ts | 2 +- .../cli/codegen/languages/typescript.test.ts | 18 +++++++++--------- .../languages/typescript/smoketest.test.ts | 2 +- packages/api/test/cli/fetcher.test.ts | 2 +- packages/api/test/cli/storage.test.ts | 2 +- packages/api/test/global.d.ts | 2 +- packages/api/vitest-smoketest.config.ts | 2 +- packages/api/vitest.config.ts | 2 +- packages/core/test/global.d.ts | 2 +- packages/core/test/index.test.ts | 10 +++++----- .../test/lib/getJSONSchemaDefaults.test.ts | 4 ++-- packages/core/test/lib/prepareAuth.test.ts | 4 ++-- packages/core/test/lib/prepareParams.test.ts | 18 +++++++++--------- packages/core/vitest.config.ts | 2 +- .../{src => }/datasets/real-world-apis.json | 0 .../{src => }/datasets/refresh-dataset | 0 .../{src/fixtures => }/definitions/alby.json | 0 .../definitions/auth-quirks.json | 0 .../{src/fixtures => }/definitions/basiq.json | 0 .../definitions/nested-defaults.json | 0 .../definitions/operationid-quirks.json | 0 .../definitions/optional-payload.json | 0 .../fixtures => }/definitions/payloads.json | 0 .../definitions/response-title-quirks.json | 0 .../fixtures => }/definitions/simple.json | 0 packages/test-utils/{src => }/fetch-mock.ts | 0 .../{src => }/fixtures/hello.jp.txt | 0 .../test-utils/{src => }/fixtures/hello.txt | 0 .../{src => }/fixtures/owlbert-shrub.png | Bin .../test-utils/{src => }/fixtures/owlbert.png | Bin packages/test-utils/{src => }/load-spec.ts | 0 packages/test-utils/tsconfig.json | 2 +- .../test-utils/{src => }/vitest.matchers.ts | 0 40 files changed, 44 insertions(+), 44 deletions(-) rename packages/test-utils/{src => }/datasets/real-world-apis.json (100%) rename packages/test-utils/{src => }/datasets/refresh-dataset (100%) rename packages/test-utils/{src/fixtures => }/definitions/alby.json (100%) rename packages/test-utils/{src/fixtures => }/definitions/auth-quirks.json (100%) rename packages/test-utils/{src/fixtures => }/definitions/basiq.json (100%) rename packages/test-utils/{src/fixtures => }/definitions/nested-defaults.json (100%) rename packages/test-utils/{src/fixtures => }/definitions/operationid-quirks.json (100%) rename packages/test-utils/{src/fixtures => }/definitions/optional-payload.json (100%) rename packages/test-utils/{src/fixtures => }/definitions/payloads.json (100%) rename packages/test-utils/{src/fixtures => }/definitions/response-title-quirks.json (100%) rename packages/test-utils/{src/fixtures => }/definitions/simple.json (100%) rename packages/test-utils/{src => }/fetch-mock.ts (100%) rename packages/test-utils/{src => }/fixtures/hello.jp.txt (100%) rename packages/test-utils/{src => }/fixtures/hello.txt (100%) rename packages/test-utils/{src => }/fixtures/owlbert-shrub.png (100%) rename packages/test-utils/{src => }/fixtures/owlbert.png (100%) rename packages/test-utils/{src => }/load-spec.ts (100%) rename packages/test-utils/{src => }/vitest.matchers.ts (100%) diff --git a/.eslintignore b/.eslintignore index 4a88af8e..e1e1171f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -15,4 +15,4 @@ packages/httpsnippet-client-api/dist/ packages/httpsnippet-client-api/test/__datasets__/**/output.js # test-utils -packages/test-utils/src/fixtures/ +packages/test-utils/fixtures/ diff --git a/packages/api/test/__fixtures__/sdk/alby/index.ts b/packages/api/test/__fixtures__/sdk/alby/index.ts index 2342b9c9..e9863e5f 100644 --- a/packages/api/test/__fixtures__/sdk/alby/index.ts +++ b/packages/api/test/__fixtures__/sdk/alby/index.ts @@ -2,7 +2,7 @@ import type * as types from './types'; import type { ConfigOptions, FetchResponse } from '@api/core' import Oas from 'oas'; import APICore from '@api/core'; -import definition from '@api/test-utils/src/fixtures/definitions/alby.json'; +import definition from '@api/test-utils/definitions/alby.json'; class SDK { spec: Oas; diff --git a/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts b/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts index bfc0b74c..68c072e3 100644 --- a/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts +++ b/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts @@ -1,7 +1,7 @@ import type { ConfigOptions, FetchResponse } from '@api/core' import Oas from 'oas'; import APICore from '@api/core'; -import definition from '@api/test-utils/src/fixtures/definitions/operationid-quirks.json'; +import definition from '@api/test-utils/definitions/operationid-quirks.json'; class SDK { spec: Oas; diff --git a/packages/api/test/__fixtures__/sdk/optional-payload/index.ts b/packages/api/test/__fixtures__/sdk/optional-payload/index.ts index 781ced8d..dd415336 100644 --- a/packages/api/test/__fixtures__/sdk/optional-payload/index.ts +++ b/packages/api/test/__fixtures__/sdk/optional-payload/index.ts @@ -2,7 +2,7 @@ import type * as types from './types'; import type { ConfigOptions, FetchResponse } from '@api/core' import Oas from 'oas'; import APICore from '@api/core'; -import definition from '@api/test-utils/src/fixtures/definitions/optional-payload.json'; +import definition from '@api/test-utils/definitions/optional-payload.json'; class SDK { spec: Oas; diff --git a/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts b/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts index bcfd9066..fa3b2b8e 100644 --- a/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts +++ b/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts @@ -2,7 +2,7 @@ import type * as types from './types'; import type { ConfigOptions, FetchResponse, HTTPMethodRange } from '@api/core'; import Oas from 'oas'; import APICore from '@api/core'; -import definition from '@api/test-utils/src/fixtures/definitions/response-title-quirks.json'; +import definition from '@api/test-utils/definitions/response-title-quirks.json'; class SDK { spec: Oas; diff --git a/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js b/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js index 3e54ef3f..99ee70ca 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js +++ b/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js @@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; var oas_1 = __importDefault(require("oas")); var core_1 = __importDefault(require("@api/core")); -var simple_json_1 = __importDefault(require("@api/test-utils/src/fixtures/definitions/simple.json")); +var simple_json_1 = __importDefault(require("@api/test-utils/definitions/simple.json")); var SDK = /** @class */ (function () { function SDK() { this.spec = oas_1.default.init(simple_json_1.default); diff --git a/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js b/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js index 73bdfbef..0b0bc280 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js +++ b/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js @@ -1,6 +1,6 @@ import Oas from 'oas'; import APICore from '@api/core'; -import definition from '@api/test-utils/src/fixtures/definitions/simple.json'; +import definition from '@api/test-utils/definitions/simple.json'; class SDK { constructor() { this.spec = Oas.init(definition); diff --git a/packages/api/test/__fixtures__/sdk/simple-ts/index.ts b/packages/api/test/__fixtures__/sdk/simple-ts/index.ts index dd15f25d..fef08cc4 100644 --- a/packages/api/test/__fixtures__/sdk/simple-ts/index.ts +++ b/packages/api/test/__fixtures__/sdk/simple-ts/index.ts @@ -2,7 +2,7 @@ import type * as types from './types'; import type { ConfigOptions, FetchResponse } from '@api/core' import Oas from 'oas'; import APICore from '@api/core'; -import definition from '@api/test-utils/src/fixtures/definitions/simple.json'; +import definition from '@api/test-utils/definitions/simple.json'; class SDK { spec: Oas; diff --git a/packages/api/test/cli/codegen/languages/typescript.test.ts b/packages/api/test/cli/codegen/languages/typescript.test.ts index 12e57e81..d1c6889b 100644 --- a/packages/api/test/cli/codegen/languages/typescript.test.ts +++ b/packages/api/test/cli/codegen/languages/typescript.test.ts @@ -3,8 +3,8 @@ import type { TSGeneratorOptions } from '../../../../src/cli/codegen/languages/t import { promises as fs } from 'fs'; import path from 'path'; -import { responses as mockResponse } from '@api/test-utils/src/fetch-mock'; -import loadSpec from '@api/test-utils/src/load-spec'; +import { responses as mockResponse } from '@api/test-utils/fetch-mock'; +import loadSpec from '@api/test-utils/load-spec'; import fetchMock from 'fetch-mock'; import Oas from 'oas'; import uniqueTempDir from 'unique-temp-dir'; @@ -121,12 +121,12 @@ describe('typescript', () => { describe('#generator', () => { it( 'should generate typescript (by default)', - assertSDKFixture('@api/test-utils/src/fixtures/definitions/simple.json', 'simple-ts'), + assertSDKFixture('@api/test-utils/definitions/simple.json', 'simple-ts'), ); it( 'should be able to generate valid TS when a body is optional but metadata isnt', - assertSDKFixture('@api/test-utils/src/fixtures/definitions/optional-payload.json', 'optional-payload'), + assertSDKFixture('@api/test-utils/definitions/optional-payload.json', 'optional-payload'), ); it('should work against the petstore', assertSDKFixture('@readme/oas-examples/3.0/json/petstore.json', 'petstore')); @@ -136,30 +136,30 @@ describe('typescript', () => { // This SDK only has an `index.ts` as it has no schemas. it( 'should handle some quirky `operationId` cases', - assertSDKFixture('@api/test-utils/src/fixtures/definitions/operationid-quirks.json', 'operationid-quirks'), + assertSDKFixture('@api/test-utils/definitions/operationid-quirks.json', 'operationid-quirks'), ); it( 'should handle `title` props that start with a number', - assertSDKFixture('@api/test-utils/src/fixtures/definitions/response-title-quirks.json', 'response-title-quirks'), + assertSDKFixture('@api/test-utils/definitions/response-title-quirks.json', 'response-title-quirks'), ); it.todo('should handle a operations with a `default` response'); it( 'should handle an api that has discriminators and no operation ids', - assertSDKFixture('@api/test-utils/src/fixtures/definitions/alby.json', 'alby'), + assertSDKFixture('@api/test-utils/definitions/alby.json', 'alby'), ); describe('javascript generation', () => { it( 'should generate a CommonJS library', - assertSDKFixture('@api/test-utils/src/fixtures/definitions/simple.json', 'simple-js-cjs', { outputJS: true }), + assertSDKFixture('@api/test-utils/definitions/simple.json', 'simple-js-cjs', { outputJS: true }), ); it( 'should generate am ESM library', - assertSDKFixture('@api/test-utils/src/fixtures/definitions/simple.json', 'simple-js-esm', { + assertSDKFixture('@api/test-utils/definitions/simple.json', 'simple-js-esm', { outputJS: true, compilerTarget: 'esm', }), diff --git a/packages/api/test/cli/codegen/languages/typescript/smoketest.test.ts b/packages/api/test/cli/codegen/languages/typescript/smoketest.test.ts index 97840bbd..ee9c65be 100644 --- a/packages/api/test/cli/codegen/languages/typescript/smoketest.test.ts +++ b/packages/api/test/cli/codegen/languages/typescript/smoketest.test.ts @@ -15,12 +15,12 @@ * @example Everything * npm run test:smoke */ +import realWorldAPIs from '@api/test-utils/datasets/real-world-apis.json'; import Oas from 'oas'; import OASNormalize from 'oas-normalize'; import { describe, it, expect } from 'vitest'; import TSGenerator from '../../../../../src/cli/codegen/languages/typescript'; -import realWorldAPIs from '../../../../datasets/real-world-apis.json'; // These APIs don't have any schemas so they should only be generating an `index.ts`. const APIS_WITHOUT_SCHEMAS = ['poemist.com']; diff --git a/packages/api/test/cli/fetcher.test.ts b/packages/api/test/cli/fetcher.test.ts index ca9b457d..22976622 100644 --- a/packages/api/test/cli/fetcher.test.ts +++ b/packages/api/test/cli/fetcher.test.ts @@ -1,7 +1,7 @@ import assert from 'assert'; import fs from 'fs/promises'; -import loadSpec from '@api/test-utils/src/load-spec'; +import loadSpec from '@api/test-utils/load-spec'; import fetchMock from 'fetch-mock'; import { describe, beforeAll, it, expect } from 'vitest'; diff --git a/packages/api/test/cli/storage.test.ts b/packages/api/test/cli/storage.test.ts index deb3cfdd..9dad3aca 100644 --- a/packages/api/test/cli/storage.test.ts +++ b/packages/api/test/cli/storage.test.ts @@ -4,7 +4,7 @@ import assert from 'assert'; import fs from 'fs/promises'; import path from 'path'; -import loadSpec from '@api/test-utils/src/load-spec'; +import loadSpec from '@api/test-utils/load-spec'; import fetchMock from 'fetch-mock'; import uniqueTempDir from 'unique-temp-dir'; import { describe, beforeAll, beforeEach, afterEach, it, expect } from 'vitest'; diff --git a/packages/api/test/global.d.ts b/packages/api/test/global.d.ts index 62cb4842..eace3e8b 100644 --- a/packages/api/test/global.d.ts +++ b/packages/api/test/global.d.ts @@ -1 +1 @@ -import '@api/test-utils/src/vitest.matchers'; +import '@api/test-utils/vitest.matchers'; diff --git a/packages/api/vitest-smoketest.config.ts b/packages/api/vitest-smoketest.config.ts index 5060a0bc..beaee9cd 100644 --- a/packages/api/vitest-smoketest.config.ts +++ b/packages/api/vitest-smoketest.config.ts @@ -4,7 +4,7 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { include: ['**/smoketest.test.ts'], - setupFiles: ['./test/helpers/vitest.matchers.ts'], + setupFiles: ['@api/test-utils/vitest.matchers.ts'], testTimeout: 20000, }, }); diff --git a/packages/api/vitest.config.ts b/packages/api/vitest.config.ts index 374d97ce..e5d0af9b 100644 --- a/packages/api/vitest.config.ts +++ b/packages/api/vitest.config.ts @@ -11,7 +11,7 @@ export default defineConfig({ '**/helpers/**', '**/smoketest.test.ts', ], - setupFiles: ['@api/test-utils/src/vitest.matchers.ts'], + setupFiles: ['@api/test-utils/vitest.matchers.ts'], testTimeout: 20000, }, }); diff --git a/packages/core/test/global.d.ts b/packages/core/test/global.d.ts index 62cb4842..eace3e8b 100644 --- a/packages/core/test/global.d.ts +++ b/packages/core/test/global.d.ts @@ -1 +1 @@ -import '@api/test-utils/src/vitest.matchers'; +import '@api/test-utils/vitest.matchers'; diff --git a/packages/core/test/index.test.ts b/packages/core/test/index.test.ts index 4736ace6..57598803 100644 --- a/packages/core/test/index.test.ts +++ b/packages/core/test/index.test.ts @@ -1,7 +1,7 @@ import assert from 'assert'; -import { responses as mockResponse } from '@api/test-utils/src/fetch-mock'; -import loadSpec from '@api/test-utils/src/load-spec'; +import { responses as mockResponse } from '@api/test-utils/fetch-mock'; +import loadSpec from '@api/test-utils/load-spec'; import datauri from 'datauri'; import fetchMock from 'fetch-mock'; import Oas from 'oas'; @@ -240,7 +240,7 @@ describe('APICore', () => { it('should support `image/png` requests', async () => { fetchMock.post('https://httpbin.org/anything/image-png', mockResponse.datauri); - const file = require.resolve('@api/test-utils/src/fixtures/owlbert.png'); + const file = require.resolve('@api/test-utils/fixtures/owlbert.png'); const { data } = await fileUploads.fetch('/anything/image-png', 'post', file); @@ -279,7 +279,7 @@ describe('APICore', () => { const body = { orderId: 1234, userId: 5678, - documentFile: require.resolve('@api/test-utils/src/fixtures/hello.txt'), + documentFile: require.resolve('@api/test-utils/fixtures/hello.txt'), }; const { data } = await fileUploads.fetch('/anything/multipart-formdata', 'post', body); @@ -296,7 +296,7 @@ describe('APICore', () => { fetchMock.post('https://httpbin.org/anything/multipart-formdata', mockResponse.multipart); const body = { - documentFile: require.resolve('@api/test-utils/src/fixtures/hello.jp.txt'), + documentFile: require.resolve('@api/test-utils/fixtures/hello.jp.txt'), }; const { data } = await fileUploads.fetch('/anything/multipart-formdata', 'post', body); diff --git a/packages/core/test/lib/getJSONSchemaDefaults.test.ts b/packages/core/test/lib/getJSONSchemaDefaults.test.ts index 7b8862fb..60799d30 100644 --- a/packages/core/test/lib/getJSONSchemaDefaults.test.ts +++ b/packages/core/test/lib/getJSONSchemaDefaults.test.ts @@ -1,4 +1,4 @@ -import loadSpec from '@api/test-utils/src/load-spec'; +import loadSpec from '@api/test-utils/load-spec'; import Oas from 'oas'; import { describe, it, expect } from 'vitest'; @@ -24,7 +24,7 @@ describe('#getJSONSchemaDefaults()', () => { }); it('should be able to handle nested objects', async () => { - const oas = await loadSpec('@api/test-utils/src/fixtures/definitions/nested-defaults.json').then(Oas.init); + const oas = await loadSpec('@api/test-utils/definitions/nested-defaults.json').then(Oas.init); await oas.dereference(); const operation = oas.operation('/pet', 'post'); diff --git a/packages/core/test/lib/prepareAuth.test.ts b/packages/core/test/lib/prepareAuth.test.ts index 341abbae..66bd5fb3 100644 --- a/packages/core/test/lib/prepareAuth.test.ts +++ b/packages/core/test/lib/prepareAuth.test.ts @@ -1,6 +1,6 @@ import type { OASDocument } from 'oas/dist/rmoas.types'; -import loadSpec from '@api/test-utils/src/load-spec'; +import loadSpec from '@api/test-utils/load-spec'; import Oas from 'oas'; import { describe, beforeAll, it, expect } from 'vitest'; @@ -167,7 +167,7 @@ describe('#prepareAuth()', () => { let securityMultipleOas; beforeAll(async () => { - authQuirksOas = await loadSpec(require.resolve('@api/test-utils/src/fixtures/definitions/auth-quirks.json')); + authQuirksOas = await loadSpec(require.resolve('@api/test-utils/definitions/auth-quirks.json')); securityMultipleOas = await loadSpec('@readme/oas-examples/3.0/json/security-multiple.json'); }); diff --git a/packages/core/test/lib/prepareParams.test.ts b/packages/core/test/lib/prepareParams.test.ts index 979e2ff5..0838cd29 100644 --- a/packages/core/test/lib/prepareParams.test.ts +++ b/packages/core/test/lib/prepareParams.test.ts @@ -1,7 +1,7 @@ import fs from 'fs'; -import payloadExamples from '@api/test-utils/src/fixtures/definitions/payloads.json'; -import loadSpec from '@api/test-utils/src/load-spec'; +import payloadExamples from '@api/test-utils/definitions/payloads.json'; +import loadSpec from '@api/test-utils/load-spec'; import Oas from 'oas'; import { describe, beforeEach, it, expect } from 'vitest'; @@ -165,7 +165,7 @@ describe('#prepareParams', () => { describe('image/png', () => { it('should support a file path payload', async () => { const operation = fileUploads.operation('/anything/image-png', 'post'); - const body = require.resolve('@api/test-utils/src/fixtures/owlbert.png'); + const body = require.resolve('@api/test-utils/fixtures/owlbert.png'); const res = await prepareParams(operation, body); expect(res.body).toContain('data:image/png;name=owlbert.png;base64,'); @@ -174,7 +174,7 @@ describe('#prepareParams', () => { it('should support a file stream payload', async () => { const operation = fileUploads.operation('/anything/image-png', 'post'); - const body = fs.createReadStream(require.resolve('@api/test-utils/src/fixtures/owlbert.png')); + const body = fs.createReadStream(require.resolve('@api/test-utils/fixtures/owlbert.png')); const res = await prepareParams(operation, body); expect(res.body).toContain('data:image/png;name=owlbert.png;base64,'); @@ -197,7 +197,7 @@ describe('#prepareParams', () => { it('should handle when the file path is relative', async () => { const operation = fileUploads.operation('/anything/multipart-formdata', 'post'); const body = { - documentFile: require.resolve('@api/test-utils/src/fixtures/owlbert.png'), + documentFile: require.resolve('@api/test-utils/fixtures/owlbert.png'), }; const res = await prepareParams(operation, body); @@ -208,7 +208,7 @@ describe('#prepareParams', () => { it('should handle a multipart body when a property is a file stream', async () => { const operation = fileUploads.operation('/anything/multipart-formdata', 'post'); const body = { - documentFile: fs.createReadStream(require.resolve('@api/test-utils/src/fixtures/owlbert.png')), + documentFile: fs.createReadStream(require.resolve('@api/test-utils/fixtures/owlbert.png')), }; const res = await prepareParams(operation, body); @@ -381,7 +381,7 @@ describe('#prepareParams', () => { describe('quirks', () => { it('should not send special headers in body payloads', async () => { - const basiq = await import('@api/test-utils/src/fixtures/definitions/basiq.json').then(Oas.init); + const basiq = await import('@api/test-utils/definitions/basiq.json').then(Oas.init); await basiq.dereference(); const operation = basiq.operation('/token', 'post'); @@ -400,7 +400,7 @@ describe('#prepareParams', () => { }); it('should not duplicate a supplied header parameter if that header casing matches the spec', async () => { - const basiq = await import('@api/test-utils/src/fixtures/definitions/basiq.json').then(Oas.init); + const basiq = await import('@api/test-utils/definitions/basiq.json').then(Oas.init); await basiq.dereference(); const operation = basiq.operation('/token', 'post'); @@ -482,7 +482,7 @@ describe('#prepareParams', () => { describe('defaults', () => { it('should prefill defaults for required body parameters if not supplied', async () => { - const oas = await loadSpec('@api/test-utils/src/fixtures/definitions/nested-defaults.json').then(Oas.init); + const oas = await loadSpec('@api/test-utils/definitions/nested-defaults.json').then(Oas.init); await oas.dereference(); const operation = oas.operation('/pet', 'post'); diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts index 8d2efd6e..8d5bc084 100644 --- a/packages/core/vitest.config.ts +++ b/packages/core/vitest.config.ts @@ -3,6 +3,6 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { - setupFiles: ['@api/test-utils/src/vitest.matchers.ts'], + setupFiles: ['@api/test-utils/vitest.matchers.ts'], }, }); diff --git a/packages/test-utils/src/datasets/real-world-apis.json b/packages/test-utils/datasets/real-world-apis.json similarity index 100% rename from packages/test-utils/src/datasets/real-world-apis.json rename to packages/test-utils/datasets/real-world-apis.json diff --git a/packages/test-utils/src/datasets/refresh-dataset b/packages/test-utils/datasets/refresh-dataset similarity index 100% rename from packages/test-utils/src/datasets/refresh-dataset rename to packages/test-utils/datasets/refresh-dataset diff --git a/packages/test-utils/src/fixtures/definitions/alby.json b/packages/test-utils/definitions/alby.json similarity index 100% rename from packages/test-utils/src/fixtures/definitions/alby.json rename to packages/test-utils/definitions/alby.json diff --git a/packages/test-utils/src/fixtures/definitions/auth-quirks.json b/packages/test-utils/definitions/auth-quirks.json similarity index 100% rename from packages/test-utils/src/fixtures/definitions/auth-quirks.json rename to packages/test-utils/definitions/auth-quirks.json diff --git a/packages/test-utils/src/fixtures/definitions/basiq.json b/packages/test-utils/definitions/basiq.json similarity index 100% rename from packages/test-utils/src/fixtures/definitions/basiq.json rename to packages/test-utils/definitions/basiq.json diff --git a/packages/test-utils/src/fixtures/definitions/nested-defaults.json b/packages/test-utils/definitions/nested-defaults.json similarity index 100% rename from packages/test-utils/src/fixtures/definitions/nested-defaults.json rename to packages/test-utils/definitions/nested-defaults.json diff --git a/packages/test-utils/src/fixtures/definitions/operationid-quirks.json b/packages/test-utils/definitions/operationid-quirks.json similarity index 100% rename from packages/test-utils/src/fixtures/definitions/operationid-quirks.json rename to packages/test-utils/definitions/operationid-quirks.json diff --git a/packages/test-utils/src/fixtures/definitions/optional-payload.json b/packages/test-utils/definitions/optional-payload.json similarity index 100% rename from packages/test-utils/src/fixtures/definitions/optional-payload.json rename to packages/test-utils/definitions/optional-payload.json diff --git a/packages/test-utils/src/fixtures/definitions/payloads.json b/packages/test-utils/definitions/payloads.json similarity index 100% rename from packages/test-utils/src/fixtures/definitions/payloads.json rename to packages/test-utils/definitions/payloads.json diff --git a/packages/test-utils/src/fixtures/definitions/response-title-quirks.json b/packages/test-utils/definitions/response-title-quirks.json similarity index 100% rename from packages/test-utils/src/fixtures/definitions/response-title-quirks.json rename to packages/test-utils/definitions/response-title-quirks.json diff --git a/packages/test-utils/src/fixtures/definitions/simple.json b/packages/test-utils/definitions/simple.json similarity index 100% rename from packages/test-utils/src/fixtures/definitions/simple.json rename to packages/test-utils/definitions/simple.json diff --git a/packages/test-utils/src/fetch-mock.ts b/packages/test-utils/fetch-mock.ts similarity index 100% rename from packages/test-utils/src/fetch-mock.ts rename to packages/test-utils/fetch-mock.ts diff --git a/packages/test-utils/src/fixtures/hello.jp.txt b/packages/test-utils/fixtures/hello.jp.txt similarity index 100% rename from packages/test-utils/src/fixtures/hello.jp.txt rename to packages/test-utils/fixtures/hello.jp.txt diff --git a/packages/test-utils/src/fixtures/hello.txt b/packages/test-utils/fixtures/hello.txt similarity index 100% rename from packages/test-utils/src/fixtures/hello.txt rename to packages/test-utils/fixtures/hello.txt diff --git a/packages/test-utils/src/fixtures/owlbert-shrub.png b/packages/test-utils/fixtures/owlbert-shrub.png similarity index 100% rename from packages/test-utils/src/fixtures/owlbert-shrub.png rename to packages/test-utils/fixtures/owlbert-shrub.png diff --git a/packages/test-utils/src/fixtures/owlbert.png b/packages/test-utils/fixtures/owlbert.png similarity index 100% rename from packages/test-utils/src/fixtures/owlbert.png rename to packages/test-utils/fixtures/owlbert.png diff --git a/packages/test-utils/src/load-spec.ts b/packages/test-utils/load-spec.ts similarity index 100% rename from packages/test-utils/src/load-spec.ts rename to packages/test-utils/load-spec.ts diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json index 10e66b0b..a0ae87dd 100644 --- a/packages/test-utils/tsconfig.json +++ b/packages/test-utils/tsconfig.json @@ -7,5 +7,5 @@ "noEmit": true, "noImplicitAny": true }, - "include": ["./src/**/*"] + "include": ["./**/*"] } diff --git a/packages/test-utils/src/vitest.matchers.ts b/packages/test-utils/vitest.matchers.ts similarity index 100% rename from packages/test-utils/src/vitest.matchers.ts rename to packages/test-utils/vitest.matchers.ts From 511991d462a3a996a576b5ce3e5bd7b65ef792af Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 13 Sep 2023 18:06:26 -0700 Subject: [PATCH 5/8] chore: config cleanup --- .eslintignore | 11 +++-------- .prettierignore | 14 ++++---------- packages/api/.eslintrc | 16 ---------------- packages/core/.eslintrc | 18 +++++++----------- 4 files changed, 14 insertions(+), 45 deletions(-) diff --git a/.eslintignore b/.eslintignore index e1e1171f..747d65dc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,17 +1,12 @@ !.alexrc.js +packages/**/coverage/ +packages/**/dist/ + # api -packages/api/coverage/ -packages/api/dist/ packages/api/test/__fixtures__/sdk/ -# core -packages/core/coverage/ -packages/core/dist/ - # httpsnippet-client-api -packages/httpsnippet-client-api/coverage/ -packages/httpsnippet-client-api/dist/ packages/httpsnippet-client-api/test/__datasets__/**/output.js # test-utils diff --git a/.prettierignore b/.prettierignore index 36c0b186..0513a70c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,17 +1,11 @@ CHANGELOG.md +packages/**/coverage/ +packages/**/dist/ -# api subpackage +# api packages/api/.api/ -packages/api/coverage/ -packages/api/.eslint* -packages/api/.gitignore -packages/api/.prettier* -packages/api/CHANGELOG.md -packages/api/dist/ packages/api/example.js packages/api/test/__fixtures__/sdk/ -# httpsnippet-client-api subpackage -packages/httpsnippet-client-api/coverage/ -packages/httpsnippet-client-api/dist/ +# httpsnippet-client-api packages/httpsnippet-client-api/test/__datasets__/**/output.js diff --git a/packages/api/.eslintrc b/packages/api/.eslintrc index d92803ea..a0f07c94 100644 --- a/packages/api/.eslintrc +++ b/packages/api/.eslintrc @@ -1,11 +1,4 @@ { - "globals": { - "fetch": true, - "Response": true - }, - "parserOptions": { - "ecmaVersion": 2020 - }, "rules": { "@typescript-eslint/no-explicit-any": "off" // @todo fix these eventually }, @@ -17,15 +10,6 @@ "import/no-unresolved": "off" } }, - { - "files": ["src/core/**/*.ts"], - "rules": { - "no-restricted-imports": ["error", { - "name": "fs/promises", - "message": "Please use `fs` instead as some client frameworks don't polyfill `fs/promises`." - }] - } - }, { "files": ["example.js"], "rules": { diff --git a/packages/core/.eslintrc b/packages/core/.eslintrc index 18dbe708..7ea05f4f 100644 --- a/packages/core/.eslintrc +++ b/packages/core/.eslintrc @@ -1,17 +1,13 @@ { - "globals": { - "fetch": true, - "Response": true - }, - "parserOptions": { - "ecmaVersion": 2020 - }, "rules": { "@typescript-eslint/no-explicit-any": "off", // @todo fix these eventually - "no-restricted-imports": ["error", { - "name": "fs/promises", - "message": "Please use `fs` instead as some client frameworks don't polyfill `fs/promises`." - }] + "no-restricted-imports": [ + "error", + { + "name": "fs/promises", + "message": "Please use `fs` instead as some client frameworks don't polyfill `fs/promises`." + } + ] } } From bea445b5c3e6c13ae8cbe8ac57f7af428270481f Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 13 Sep 2023 20:29:19 -0700 Subject: [PATCH 6/8] refactor(ts): strict mode Co-authored-by: Kanad Gupta --- packages/api/src/cli/codegen/language.ts | 3 +- .../src/cli/codegen/languages/typescript.ts | 25 +++++---- packages/api/src/cli/fetcher.ts | 2 +- packages/api/src/cli/storage.ts | 10 +++- packages/api/tsconfig.json | 4 +- packages/core/src/index.ts | 10 ++-- .../core/src/lib/getJSONSchemaDefaults.ts | 10 ++-- packages/core/src/lib/prepareAuth.ts | 5 +- packages/core/src/lib/prepareParams.ts | 56 +++++++++++-------- packages/core/tsconfig.json | 2 +- 10 files changed, 72 insertions(+), 55 deletions(-) diff --git a/packages/api/src/cli/codegen/language.ts b/packages/api/src/cli/codegen/language.ts index bc3f667d..314334ac 100644 --- a/packages/api/src/cli/codegen/language.ts +++ b/packages/api/src/cli/codegen/language.ts @@ -25,11 +25,12 @@ export default abstract class CodeGeneratorLanguage { userAgent: string; - requiredPackages: Record; + requiredPackages!: Record; constructor(spec: Oas, specPath: string, identifier: string) { this.spec = spec; this.specPath = specPath; + this.identifier = identifier; // User agents should be contextual to the spec in question and the version of `api` that was // used to generate the SDK. For example, this'll look like `petstore/1.0.0 (api/4.2.0)` for diff --git a/packages/api/src/cli/codegen/languages/typescript.ts b/packages/api/src/cli/codegen/languages/typescript.ts index c3f1ea1e..d784b887 100644 --- a/packages/api/src/cli/codegen/languages/typescript.ts +++ b/packages/api/src/cli/codegen/languages/typescript.ts @@ -3,6 +3,7 @@ import type { InstallerOptions } from '../language'; import type Oas from 'oas'; import type { Operation } from 'oas'; import type { HttpMethods, SchemaObject } from 'oas/dist/rmoas.types'; +import type { SemVer } from 'semver'; import type { ClassDeclaration, JSDocStructure, @@ -53,9 +54,9 @@ export default class TSGenerator extends CodeGeneratorLanguage { types: Map; - files: Record; + files?: Record; - sdk: ClassDeclaration; + sdk!: ClassDeclaration; schemas: Record< string, @@ -138,7 +139,7 @@ export default class TSGenerator extends CodeGeneratorLanguage { if (!pkgVersion) { // If the version that's in `info.version` isn't compatible with semver NPM won't be able to // handle it properly so we need to fallback to something it can. - pkgVersion = semver.coerce('0.0.0'); + pkgVersion = semver.coerce('0.0.0') as SemVer; } const pkg: PackageJson = { @@ -221,7 +222,7 @@ export default class TSGenerator extends CodeGeneratorLanguage { sdkSource .getImportDeclarations() .find(id => id.getText() === "import type * as types from './types';") - .remove(); + ?.remove(); } // If this SDK doesn't use the `HTTPMethodRange` interface for handling `2XX` response status @@ -230,7 +231,7 @@ export default class TSGenerator extends CodeGeneratorLanguage { sdkSource .getImportDeclarations() .find(id => id.getText().includes('HTTPMethodRange')) - .replaceWithText("import type { ConfigOptions, FetchResponse } from '@api/core'"); + ?.replaceWithText("import type { ConfigOptions, FetchResponse } from '@api/core'"); } if (this.outputJS) { @@ -656,7 +657,7 @@ sdk.server('https://eu.api.example.com/v14');`), // we should only add a docblock to the first overload we create because IDE Intellisense will // always use that and adding a docblock to all three will bloat the SDK with unused and // unsurfaced method documentation. - docs: shouldAddAltTypedOverloads ? null : Object.keys(docblock).length ? [docblock] : null, + docs: shouldAddAltTypedOverloads ? undefined : Object.keys(docblock).length ? [docblock] : undefined, statements: writer => { /** * @example return this.core.fetch('/pet/findByStatus', 'get', body, metadata); @@ -698,7 +699,7 @@ sdk.server('https://eu.api.example.com/v14');`), { ...parameters.metadata, hasQuestionToken: false }, ], returnType, - docs: Object.keys(docblock).length ? [docblock] : null, + docs: Object.keys(docblock).length ? [docblock] : undefined, }); // Create an overload that just has a single `metadata` parameter. @@ -739,13 +740,13 @@ sdk.server('https://eu.api.example.com/v14');`), */ loadOperationsAndMethods() { const operations: Record = {}; - const methods = new Set(); + const methods = new Set(); // Prepare all of the schemas that we need to process for every operation within this API // definition. Object.entries(this.spec.getPaths()).forEach(([, ops]) => { - Object.entries(ops).forEach(([method, operation]: [HttpMethods, Operation]) => { - methods.add(method); + Object.entries(ops).forEach(([method, operation]: [string, Operation]) => { + methods.add(method as HttpMethods); const operationId = operation.getOperationId({ // This `camelCase` option will clean up any weird characters that might be present in @@ -786,7 +787,7 @@ sdk.server('https://eu.api.example.com/v14');`), transformer: (s: SchemaObject) => { // As our schemas are dereferenced in the `oas` library we don't want to pollute our // codegen'd schemas file with duplicate schemas. - if ('x-readme-ref-name' in s) { + if ('x-readme-ref-name' in s && typeof s['x-readme-ref-name'] !== 'undefined') { const typeName = generateTypeName(s['x-readme-ref-name']); this.addSchemaToExport(s, typeName, typeName); @@ -844,7 +845,7 @@ sdk.server('https://eu.api.example.com/v14');`), transformer: (s: SchemaObject) => { // As our schemas are dereferenced in the `oas` library we don't want to pollute our // codegen'd schemas file with duplicate schemas. - if ('x-readme-ref-name' in s) { + if ('x-readme-ref-name' in s && typeof s['x-readme-ref-name'] !== 'undefined') { const typeName = generateTypeName(s['x-readme-ref-name']); this.addSchemaToExport(s, typeName, `${typeName}`); diff --git a/packages/api/src/cli/fetcher.ts b/packages/api/src/cli/fetcher.ts index 1f189c3b..cd5d6040 100644 --- a/packages/api/src/cli/fetcher.ts +++ b/packages/api/src/cli/fetcher.ts @@ -51,7 +51,7 @@ export default class Fetcher { return undefined; } - return matches.groups.project; + return matches.groups?.project; } async load() { diff --git a/packages/api/src/cli/storage.ts b/packages/api/src/cli/storage.ts index 55f0a882..d2b11b85 100644 --- a/packages/api/src/cli/storage.ts +++ b/packages/api/src/cli/storage.ts @@ -22,7 +22,7 @@ export default class Storage { */ source: string; - identifier: string; + identifier!: string; fetcher: Fetcher; @@ -32,7 +32,9 @@ export default class Storage { this.fetcher = new Fetcher(source); this.source = source; - this.identifier = identifier; + if (identifier) { + this.identifier = identifier; + } // This should default to false so we have awareness if we've looked at the lockfile yet. Storage.lockfile = false; @@ -117,7 +119,9 @@ export default class Storage { if (!isValidForNPM.validForNewPackages) { // `prompts` doesn't support surfacing multiple errors in a `validate` call so we can only // surface the first to the user. - throw new Error(`Identifier cannot be used for an NPM package: ${isValidForNPM.errors[0]}`); + throw new Error( + `Identifier cannot be used for an NPM package: ${isValidForNPM?.errors?.[0] || '[error unavailable]'}`, + ); } return true; diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index c04ee9df..62023664 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -6,7 +6,9 @@ "esModuleInterop": true, "lib": ["DOM", "DOM.Iterable", "ES2020"], "noImplicitAny": true, - "outDir": "dist/" + "outDir": "dist/", + "strict": true, + "useUnknownInCatchVariables": false }, "include": ["./src/**/*"] } diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 30d15a53..e7dd1429 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -37,24 +37,24 @@ export type HTTPMethodRange = Exclude; } = false; private config: ConfigOptions = {}; - private userAgent: string; + private userAgent!: string; constructor(spec?: Oas, userAgent?: string) { - this.spec = spec; - this.userAgent = userAgent; + if (spec) this.spec = spec; + if (userAgent) this.userAgent = userAgent; } setSpec(spec: Oas) { diff --git a/packages/core/src/lib/getJSONSchemaDefaults.ts b/packages/core/src/lib/getJSONSchemaDefaults.ts index 0c7cd5d4..cffc20dc 100644 --- a/packages/core/src/lib/getJSONSchemaDefaults.ts +++ b/packages/core/src/lib/getJSONSchemaDefaults.ts @@ -23,16 +23,16 @@ export default function getJSONSchemaDefaults(jsonSchemas: SchemaWrapper[]) { schema: SchemaObject, pointer: string, rootSchema: SchemaObject, - parentPointer: string, - parentKeyword: string, - parentSchema: SchemaObject, - indexProperty: string, + parentPointer?: string, + parentKeyword?: string, + parentSchema?: SchemaObject, + indexProperty?: string | number, ) => { if (!pointer.startsWith('/properties/')) { return; } - if (Array.isArray(parentSchema?.required) && parentSchema.required.includes(indexProperty)) { + if (Array.isArray(parentSchema?.required) && parentSchema?.required.includes(String(indexProperty))) { if (schema.type === 'object' && indexProperty) { defaults[indexProperty] = {}; } diff --git a/packages/core/src/lib/prepareAuth.ts b/packages/core/src/lib/prepareAuth.ts index 5f00ca66..6843e896 100644 --- a/packages/core/src/lib/prepareAuth.ts +++ b/packages/core/src/lib/prepareAuth.ts @@ -1,5 +1,6 @@ /* eslint-disable no-underscore-dangle */ import type { Operation } from 'oas'; +import type { KeyedSecuritySchemeObject } from 'oas/dist/rmoas.types'; export default function prepareAuth(authKey: (number | string)[], operation: Operation) { if (authKey.length === 0) { @@ -58,7 +59,7 @@ export default function prepareAuth(authKey: (number | string)[], operation: Ope ); } - const scheme = schemes.shift(); + const scheme = schemes.shift() as KeyedSecuritySchemeObject; preparedAuth[scheme._key] = { user: authKey[0], pass: authKey.length === 2 ? authKey[1] : '', @@ -76,7 +77,7 @@ export default function prepareAuth(authKey: (number | string)[], operation: Ope .map(([, ps]) => ps.filter(s => usableScheme === s._key)) .reduce((prev, next) => prev.concat(next), []); - const scheme = schemes.shift(); + const scheme = schemes.shift() as KeyedSecuritySchemeObject; switch (scheme.type) { case 'http': if (scheme.scheme === 'basic') { diff --git a/packages/core/src/lib/prepareParams.ts b/packages/core/src/lib/prepareParams.ts index 13f54fad..2e9a72d8 100644 --- a/packages/core/src/lib/prepareParams.ts +++ b/packages/core/src/lib/prepareParams.ts @@ -42,7 +42,7 @@ function digestParameters(parameters: ParameterObject[]): Record { +): Promise<{ base64?: string; buffer?: Buffer; filename: string; paramName?: string } | undefined> { if (typeof file === 'string') { // In order to support relative pathed files, we need to attempt to resolve them. const resolvedFile = path.resolve(file); @@ -103,7 +103,7 @@ function processFile( return resolve({ paramName, - base64: fileMetadata.content.replace(';base64', `;name=${payloadFilename};base64`), + base64: fileMetadata?.content?.replace(';base64', `;name=${payloadFilename};base64`), filename: payloadFilename, buffer: fileMetadata.buffer, }); @@ -118,7 +118,7 @@ function processFile( return { paramName, - base64: base64.replace(';base64', `;name=${payloadFilename};base64`), + base64: base64?.replace(';base64', `;name=${payloadFilename};base64`), filename: payloadFilename, buffer, }; @@ -228,7 +228,7 @@ export default async function prepareParams(operation: Operation, body?: unknown } }); - const intersection = Object.keys(body).filter(value => { + const intersection = Object.keys(body as NonNullable).filter(value => { if (Object.keys(digestedParameters).includes(value)) { return true; } else if (headerParams.has(value)) { @@ -238,10 +238,10 @@ export default async function prepareParams(operation: Operation, body?: unknown return false; }).length; - if (intersection && intersection / Object.keys(body).length > 0.25) { + // If more than 25% of the body intersects with the parameters that we've got on hand, then + // we should treat it as a metadata object and organize into parameters. + if (intersection && intersection / Object.keys(body as NonNullable).length > 0.25) { /* eslint-disable no-param-reassign */ - // If more than 25% of the body intersects with the parameters that we've got on hand, - // then we should treat it as a metadata object and organize into parameters. metadataIntersected = true; metadata = merge(params.body, body) as Record; body = undefined; @@ -304,7 +304,9 @@ export default async function prepareParams(operation: Operation, body?: unknown params.body = fileMetadata.base64; } - params.files[fileMetadata.filename] = fileMetadata.buffer; + if (fileMetadata.buffer && params?.files) { + params.files[fileMetadata.filename] = fileMetadata.buffer; + } }); }); } @@ -336,7 +338,7 @@ export default async function prepareParams(operation: Operation, body?: unknown } else if (param.in === 'header') { // Headers are sent case-insensitive so we need to make sure that we're properly // matching them when detecting what our incoming payload looks like. - metadataHeaderParam = Object.keys(metadata).find(k => k.toLowerCase() === paramName.toLowerCase()); + metadataHeaderParam = Object.keys(metadata).find(k => k.toLowerCase() === paramName.toLowerCase()) || ''; value = metadata[metadataHeaderParam]; } } @@ -348,20 +350,20 @@ export default async function prepareParams(operation: Operation, body?: unknown /* eslint-disable no-param-reassign */ switch (param.in) { case 'path': - params.path[paramName] = value; - delete metadata[paramName]; + (params.path as NonNullable)[paramName] = value; + if (metadata?.[paramName]) delete metadata[paramName]; break; case 'query': - params.query[paramName] = value; - delete metadata[paramName]; + (params.query as NonNullable)[paramName] = value; + if (metadata?.[paramName]) delete metadata[paramName]; break; case 'header': - params.header[paramName.toLowerCase()] = value; - delete metadata[metadataHeaderParam]; + (params.header as NonNullable)[paramName.toLowerCase()] = value; + if (metadataHeaderParam && metadata?.[metadataHeaderParam]) delete metadata[metadataHeaderParam]; break; case 'cookie': - params.cookie[paramName] = value; - delete metadata[paramName]; + (params.cookie as NonNullable)[paramName] = value; + if (metadata?.[paramName]) delete metadata[paramName]; break; default: // no-op } @@ -387,11 +389,17 @@ export default async function prepareParams(operation: Operation, body?: unknown // or specify a custom auth header (maybe we can't handle their auth case right) this is the // only way with this library that they can do that. specialHeaders.forEach(headerName => { - const headerParam = Object.keys(metadata).find(m => m.toLowerCase() === headerName); + const headerParam = Object.keys(metadata || {}).find(m => m.toLowerCase() === headerName); if (headerParam) { - params.header[headerName] = metadata[headerParam] as string; - // eslint-disable-next-line no-param-reassign - delete metadata[headerParam]; + // this if-statement below is a typeguard + if (typeof metadata === 'object') { + // this if-statement below is a typeguard + if (typeof params.header === 'object') { + params.header[headerName] = metadata[headerParam] as string; + } + // eslint-disable-next-line no-param-reassign + delete metadata[headerParam]; + } } }); } @@ -405,7 +413,7 @@ export default async function prepareParams(operation: Operation, body?: unknown } } - ['body', 'cookie', 'files', 'formData', 'header', 'path', 'query'].forEach((type: keyof typeof params) => { + (['body', 'cookie', 'files', 'formData', 'header', 'path', 'query'] as const).forEach((type: keyof typeof params) => { if (type in params && isEmpty(params[type])) { delete params[type]; } diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 5acf6120..4f40fdab 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -7,7 +7,7 @@ "lib": ["DOM", "DOM.Iterable", "ES2020"], "noImplicitAny": true, "outDir": "dist/", - "strict": false + "strict": true }, "include": ["./src/**/*"] } From ea5516ef8ac6acb25c579af920e030f006dd11c4 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 13 Sep 2023 20:39:12 -0700 Subject: [PATCH 7/8] fix: remaining ts strict issues --- packages/api/src/cli/codegen/languages/typescript.ts | 8 ++++---- packages/httpsnippet-client-api/src/index.ts | 10 +++------- packages/httpsnippet-client-api/tsconfig.json | 3 ++- packages/test-utils/tsconfig.json | 3 ++- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/packages/api/src/cli/codegen/languages/typescript.ts b/packages/api/src/cli/codegen/languages/typescript.ts index d784b887..194596f1 100644 --- a/packages/api/src/cli/codegen/languages/typescript.ts +++ b/packages/api/src/cli/codegen/languages/typescript.ts @@ -567,10 +567,10 @@ sdk.server('https://eu.api.example.com/v14');`), let hasOptionalBody = false; let hasOptionalMetadata = false; - const parameters: { - body?: OptionalKind; - metadata?: OptionalKind; - } = {}; + const parameters = {} as { + body: OptionalKind; + metadata: OptionalKind; + }; if (paramTypes) { // If an operation has a request body payload it will only ever have `body` or `formData`, diff --git a/packages/httpsnippet-client-api/src/index.ts b/packages/httpsnippet-client-api/src/index.ts index b5ea2fd3..d42c35a3 100644 --- a/packages/httpsnippet-client-api/src/index.ts +++ b/packages/httpsnippet-client-api/src/index.ts @@ -10,9 +10,6 @@ import stringifyObject from 'stringify-object'; const { matchesMimeType } = utils; -// This should really be an exported type in `oas`. -type SecurityType = 'Basic' | 'Bearer' | 'Query' | 'Header' | 'Cookie' | 'OAuth2' | 'http' | 'apiKey'; - function stringify(obj: any, opts = {}) { return stringifyObject(obj, { indent: ' ', ...opts }); } @@ -47,9 +44,8 @@ function getAuthSources(operation: Operation) { return matchers; } - const security = operation.prepareSecurity(); - Object.keys(security).forEach((id: SecurityType) => { - security[id].forEach(scheme => { + Object.entries(operation.prepareSecurity()).forEach(([, schemes]) => { + schemes.forEach(scheme => { if (scheme.type === 'http') { if (scheme.scheme === 'basic') { matchers.header.authorization = 'Basic'; @@ -95,7 +91,7 @@ const client: Client = { convert: ({ cookiesObj, headersObj, postData, queryObj, url, ...source }, options) => { const opts = { ...options, - }; + } as APIOptions; if (!('apiDefinitionUri' in opts)) { throw new Error('This HTTP Snippet client must have an `apiDefinitionUri` option supplied to it.'); diff --git a/packages/httpsnippet-client-api/tsconfig.json b/packages/httpsnippet-client-api/tsconfig.json index b785b2bb..c2f1e0a4 100644 --- a/packages/httpsnippet-client-api/tsconfig.json +++ b/packages/httpsnippet-client-api/tsconfig.json @@ -6,7 +6,8 @@ "esModuleInterop": true, "lib": ["DOM", "ES2020"], "noImplicitAny": true, - "outDir": "dist/" + "outDir": "dist/", + "strict": true }, "include": ["./src/**/*"] } diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json index a0ae87dd..c1d411a7 100644 --- a/packages/test-utils/tsconfig.json +++ b/packages/test-utils/tsconfig.json @@ -5,7 +5,8 @@ "declaration": true, "esModuleInterop": true, "noEmit": true, - "noImplicitAny": true + "noImplicitAny": true, + "strict": true }, "include": ["./**/*"] } From 05fcea31f5b86f853158e19c71123246f2c12361 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 14 Sep 2023 09:33:55 -0500 Subject: [PATCH 8/8] revert: don't mess with this --- packages/core/src/lib/prepareParams.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/lib/prepareParams.ts b/packages/core/src/lib/prepareParams.ts index 2e9a72d8..c4ef105b 100644 --- a/packages/core/src/lib/prepareParams.ts +++ b/packages/core/src/lib/prepareParams.ts @@ -42,7 +42,7 @@ function digestParameters(parameters: ParameterObject[]): Record