diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..82da0b16e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# http://editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.eslintignore b/.eslintignore index 1f80e8eea..aea1a7094 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,5 +2,5 @@ *.js.map *.d.ts -node_modules -dist +node_modules/ +dist/ diff --git a/.eslintrc.js b/.eslintrc.js index 517dcd695..1e9e42f80 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,35 +1,45 @@ module.exports = { - "env": { - "browser": true, - "es2021": true, - "node": true + env: { + browser: true, + es6: true, + node: true }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended" - ], - "overrides": [ - { - "env": { - "node": true - }, - "files": [ - ".eslintrc.{js,cjs}" - ], - "parserOptions": { - "sourceType": "script" - } - } - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" + extends: ['@microsoft/eslint-config-msgraph'], + parser: '@typescript-eslint/parser', + parserOptions: { + project: [ + 'packages/abstractions/tsconfig.json', + 'packages/authentication/azure/tsconfig.json', + 'packages/authentication/azure/tsconfig.json', + 'packages/http/fetch/tsconfig.json', + 'packages/serialization/form/tsconfig.json', + 'packages/serialization/json/tsconfig.json', + 'packages/serialization/multipart/tsconfig.json', + 'packages/authentication/azure/tsconfig.json', + 'packages/test/tsconfig.json' + ], + sourceType: 'module' }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "@typescript-eslint/consistent-type-imports": "error" + plugins: ['eslint-plugin-jsdoc', 'eslint-plugin-prefer-arrow', 'eslint-plugin-react', '@typescript-eslint', 'header'], + root: true, + ignorePatterns: ['.eslintrc.js', '*.mjs'], + rules: { + '@typescript-eslint/no-explicit-any': 'warn', + 'prefer-arrow/prefer-arrow-functions': 'warn', + // prefer-nullish-coalescing requires strictNullChecking to be turned on + '@typescript-eslint/prefer-nullish-coalescing': 'off', + 'header/header': [ + 2, + 'block', + [ + '*', + ' * -------------------------------------------------------------------------------------------', + ' * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.', + ' * See License in the project root for license information.', + ' * -------------------------------------------------------------------------------------------', + ' ' + ], + 1 + ] } -} + }; \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 83bd205e8..1abfc405e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -125,3 +125,7 @@ updates: eslint: patterns: - "*eslint*" + vitest: + patterns: + - "*vitest*" + diff --git a/.github/workflows/build_test_validate.yml b/.github/workflows/build_test_validate.yml index aa6cca49a..5fb07d12d 100644 --- a/.github/workflows/build_test_validate.yml +++ b/.github/workflows/build_test_validate.yml @@ -26,7 +26,6 @@ jobs: shell: pwsh working-directory: ./ - run: npm ci - - run: npm install -g mocha@10.X - run: npm run build - name: Archive dist folders # archive dist folders to verify if they are transpiled correctly and available for publishing uses: actions/upload-artifact@v4 @@ -40,14 +39,14 @@ jobs: packages/serialization/text/dist packages/http/fetch/dist packages/authentication/azure/dist - - run: npx lerna run test:integrated + - run: npm run test:integrated if: ${{env.TENANT_ID != '' }} env: TENANT_ID: ${{secrets.tenant_id}} CLIENT_ID: ${{secrets.client_id}} CLIENT_SECRET: ${{secrets.client_secret}} USER_ID: "813956a3-4a30-4596-914f-bfd86a657a09" - - run: npx lerna run test --parallel + - run: npm run test publish-npm: if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'auto dependabot')}} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..4d298357d --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +/scripts +packages/**/*/lib/ +packages/**/*.js +packages/**/*.js.map +packages/**/*.d.ts diff --git a/package-lock.json b/package-lock.json index cba737cda..a64f9a068 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,32 +13,26 @@ "packages/authentication/*" ], "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.7", - "@rollup/plugin-node-resolve": "^15.2.3", - "@types/chai": "^4.3.11", - "@types/mocha": "^10.0.6", + "@microsoft/eslint-config-msgraph": "^2.0.0", "@types/node": "^20.11.15", "@types/sinon": "^17.0.3", - "@typescript-eslint/eslint-plugin": "^7.0.1", - "@typescript-eslint/parser": "^7.0.1", - "chai": "4.3.10", + "@vitest/coverage-v8": "^1.3.1", + "@vitest/ui": "^1.3.1", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", + "eslint-plugin-header": "^3.1.1", + "eslint-plugin-jsdoc": "^46.10.1", + "eslint-plugin-prefer-arrow": "^1.2.3", "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-react": "^7.33.2", "eslint-plugin-simple-import-sort": "^12.0.0", - "karma": "^6.4.2", - "karma-chai": "^0.1.0", - "karma-chrome-launcher": "^3.2.0", - "karma-firefox-launcher": "^2.1.2", - "karma-mocha": "^2.0.1", - "karma-typescript": "^5.5.4", + "husky": "^9.0.11", "lerna": "^8.0.2", - "mocha": "^10.2.0", "prettier": "^3.2.4", - "rollup": "2.79.1", - "rollup-plugin-terser": "^7.0.2", "sinon": "^17.0.1", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "vitest": "^1.3.1", + "webdriverio": "^8.33.1" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -351,189 +345,6 @@ "node": ">=4" } }, - "node_modules/@babel/compat-data": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", - "integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.9.tgz", - "integrity": "sha512-5q0175NOjddqpvvzU+kDiSOAk4PfdO6FvwCWoQ6RO7rTzEe8vlo+4HVfcnAREhD4npMs0e9uZypjTwzZPCf/cw==", - "dev": true, - "dependencies": { - "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.23.5", - "@babel/generator": "^7.23.6", - "@babel/helper-compilation-targets": "^7.23.6", - "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.23.9", - "@babel/parser": "^7.23.9", - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/core/node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true - }, - "node_modules/@babel/core/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/generator": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", - "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", - "dev": true, - "dependencies": { - "@babel/types": "^7.23.6", - "@jridgewell/gen-mapping": "^0.3.2", - "@jridgewell/trace-mapping": "^0.3.17", - "jsesc": "^2.5.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz", - "integrity": "sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==", - "dev": true, - "dependencies": { - "@babel/compat-data": "^7.23.5", - "@babel/helper-validator-option": "^7.23.5", - "browserslist": "^4.22.2", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", - "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", - "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", - "dev": true, - "dependencies": { - "@babel/template": "^7.22.15", - "@babel/types": "^7.23.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", - "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", - "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.15" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz", - "integrity": "sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==", - "dev": true, - "dependencies": { - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-simple-access": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/helper-validator-identifier": "^7.22.20" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", - "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.22.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", - "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-string-parser": { "version": "7.23.4", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", @@ -552,29 +363,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-validator-option": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz", - "integrity": "sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.9.tgz", - "integrity": "sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ==", - "dev": true, - "dependencies": { - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/highlight": { "version": "7.23.4", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", @@ -683,50 +471,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/template": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", - "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.23.5", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", - "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.23.5", - "@babel/generator": "^7.23.6", - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-function-name": "^7.23.0", - "@babel/helper-hoist-variables": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9", - "debug": "^4.3.1", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse/node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/types": { "version": "7.23.9", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", @@ -741,111 +485,490 @@ "node": ">=6.9.0" } }, - "node_modules/@colors/colors": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", - "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", - "dev": true, - "engines": { - "node": ">=0.1.90" - } + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "node_modules/@es-joy/jsdoccomment": { + "version": "0.41.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.41.0.tgz", + "integrity": "sha512-aKUhyn1QI5Ksbqcr3fFJj16p99QdjUxXAEuFst1Z47DRyoiMwivIH9MV/ARcJOCXVjPfjITciej8ZD2O/6qUmw==", "dev": true, "dependencies": { - "eslint-visitor-keys": "^3.3.0" + "comment-parser": "1.4.1", + "esquery": "^1.5.0", + "jsdoc-type-pratt-parser": "~4.0.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + "node": ">=16" } }, - "node_modules/@eslint-community/regexpp": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", - "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", + "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", + "cpu": [ + "ppc64" + ], "dev": true, + "optional": true, + "os": [ + "aix" + ], "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + "node": ">=12" } }, - "node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "node_modules/@esbuild/android-arm": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", + "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", + "cpu": [ + "arm" + ], "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": ">=12" } }, - "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "node_modules/@esbuild/android-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", + "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" } }, - "node_modules/@eslint/eslintrc/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/@esbuild/android-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", + "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": "*" + "node": ">=12" } }, - "node_modules/@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", + "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", + "cpu": [ + "arm64" + ], "dev": true, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=12" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", + "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "@humanwhocodes/object-schema": "^2.0.2", - "debug": "^4.3.1", - "minimatch": "^3.0.5" - }, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=10.10.0" + "node": ">=12" } }, - "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", + "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", + "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", + "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", + "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", + "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", + "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", + "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", + "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", + "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", + "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", + "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", + "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", + "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", + "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", + "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", + "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", + "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { "balanced-match": "^1.0.0", @@ -1046,6 +1169,8 @@ "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.0", "@jridgewell/trace-mapping": "^0.3.9" @@ -1288,6 +1413,21 @@ "node": ">=12" } }, + "node_modules/@microsoft/eslint-config-msgraph": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@microsoft/eslint-config-msgraph/-/eslint-config-msgraph-2.0.0.tgz", + "integrity": "sha512-+BPNAA24ZiFYE5vV3WdawTQ5o/Ev4TC4qJoBbrj/stP1e1s7aYdYqHGw3ZFkqAf+3nkIn0PI0PKCSj09Xaz88A==", + "dev": true, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": "^6.7.2", + "@typescript-eslint/parser": "^6.7.2", + "eslint": "^8.49.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.32.2", + "prettier": "^3.0.3" + } + }, "node_modules/@microsoft/kiota-abstractions": { "resolved": "packages/abstractions", "link": true @@ -2001,77 +2141,219 @@ "url": "https://opencollective.com/unts" } }, - "node_modules/@rollup/plugin-commonjs": { - "version": "25.0.7", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz", - "integrity": "sha512-nEvcR+LRjEjsaSsc4x3XZfCCvZIaSMenZu/OiwOKGN2UhQpAYI7ru7czFvyWbErlpoGjnSX3D5Ch5FcMA3kRWQ==", + "node_modules/@polka/url": { + "version": "1.0.0-next.25", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.25.tgz", + "integrity": "sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==", + "dev": true + }, + "node_modules/@puppeteer/browsers": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.9.1.tgz", + "integrity": "sha512-PuvK6xZzGhKPvlx3fpfdM2kYY3P/hB1URtK8wA7XUJ6prn6pp22zvJHu48th0SGcHL9SutbPHrFuQgfXTFobWA==", "dev": true, "dependencies": { - "@rollup/pluginutils": "^5.0.1", - "commondir": "^1.0.1", - "estree-walker": "^2.0.2", - "glob": "^8.0.3", - "is-reference": "1.2.1", - "magic-string": "^0.30.3" - }, - "engines": { - "node": ">=14.0.0" + "debug": "4.3.4", + "extract-zip": "2.0.1", + "progress": "2.0.3", + "proxy-agent": "6.3.1", + "tar-fs": "3.0.4", + "unbzip2-stream": "1.4.3", + "yargs": "17.7.2" }, - "peerDependencies": { - "rollup": "^2.68.0||^3.0.0||^4.0.0" + "bin": { + "browsers": "lib/cjs/main-cli.js" }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } + "engines": { + "node": ">=16.3.0" } }, - "node_modules/@rollup/plugin-node-resolve": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.3.tgz", - "integrity": "sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==", + "node_modules/@puppeteer/browsers/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dev": true, "dependencies": { - "@rollup/pluginutils": "^5.0.1", - "@types/resolve": "1.20.2", - "deepmerge": "^4.2.2", - "is-builtin-module": "^3.2.1", - "is-module": "^1.0.0", - "resolve": "^1.22.1" + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" }, "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^2.78.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } + "node": ">=12" } }, - "node_modules/@rollup/pluginutils": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.0.tgz", - "integrity": "sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==", + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.12.1.tgz", + "integrity": "sha512-iU2Sya8hNn1LhsYyf0N+L4Gf9Qc+9eBTJJJsaOGUp+7x4n2M9dxTt8UvhJl3oeftSjblSlpCfvjA/IfP3g5VjQ==", + "cpu": [ + "arm" + ], "dev": true, - "dependencies": { - "@types/estree": "^1.0.0", - "estree-walker": "^2.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.12.1.tgz", + "integrity": "sha512-wlzcWiH2Ir7rdMELxFE5vuM7D6TsOcJ2Yw0c3vaBR3VOsJFVTx9xvwnAvhgU5Ii8Gd6+I11qNHwndDscIm0HXg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.12.1.tgz", + "integrity": "sha512-YRXa1+aZIFN5BaImK+84B3uNK8C6+ynKLPgvn29X9s0LTVCByp54TB7tdSMHDR7GTV39bz1lOmlLDuedgTwwHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.12.1.tgz", + "integrity": "sha512-opjWJ4MevxeA8FhlngQWPBOvVWYNPFkq6/25rGgG+KOy0r8clYwL1CFd+PGwRqqMFVQ4/Qd3sQu5t7ucP7C/Uw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.12.1.tgz", + "integrity": "sha512-uBkwaI+gBUlIe+EfbNnY5xNyXuhZbDSx2nzzW8tRMjUmpScd6lCQYKY2V9BATHtv5Ef2OBq6SChEP8h+/cxifQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.12.1.tgz", + "integrity": "sha512-0bK9aG1kIg0Su7OcFTlexkVeNZ5IzEsnz1ept87a0TUgZ6HplSgkJAnFpEVRW7GRcikT4GlPV0pbtVedOaXHQQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.12.1.tgz", + "integrity": "sha512-qB6AFRXuP8bdkBI4D7UPUbE7OQf7u5OL+R94JE42Z2Qjmyj74FtDdLGeriRyBDhm4rQSvqAGCGC01b8Fu2LthQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.12.1.tgz", + "integrity": "sha512-sHig3LaGlpNgDj5o8uPEoGs98RII8HpNIqFtAI8/pYABO8i0nb1QzT0JDoXF/pxzqO+FkxvwkHZo9k0NJYDedg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.12.1.tgz", + "integrity": "sha512-nD3YcUv6jBJbBNFvSbp0IV66+ba/1teuBcu+fBBPZ33sidxitc6ErhON3JNavaH8HlswhWMC3s5rgZpM4MtPqQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.12.1.tgz", + "integrity": "sha512-7/XVZqgBby2qp/cO0TQ8uJK+9xnSdJ9ct6gSDdEr4MfABrjTyrW6Bau7HQ73a2a5tPB7hno49A0y1jhWGDN9OQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.12.1.tgz", + "integrity": "sha512-CYc64bnICG42UPL7TrhIwsJW4QcKkIt9gGlj21gq3VV0LL6XNb1yAdHVp1pIi9gkts9gGcT3OfUYHjGP7ETAiw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.12.1.tgz", + "integrity": "sha512-LN+vnlZ9g0qlHGlS920GR4zFCqAwbv2lULrR29yGaWP9u7wF5L7GqWu9Ah6/kFZPXPUkpdZwd//TNR+9XC9hvA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.12.1.tgz", + "integrity": "sha512-n+vkrSyphvmU0qkQ6QBNXCGr2mKjhP08mPRM/Xp5Ck2FV4NrHU+y6axzDeixUrCBHVUS51TZhjqrKBBsHLKb2Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] }, "node_modules/@sigstore/bundle": { "version": "1.1.0", @@ -2346,6 +2628,18 @@ "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", "dev": true }, + "node_modules/@sindresorhus/is": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz", + "integrity": "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, "node_modules/@sinonjs/commons": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", @@ -2390,17 +2684,23 @@ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", "dev": true }, - "node_modules/@socket.io/component-emitter": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", - "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==", - "dev": true - }, "node_modules/@std-uritemplate/std-uritemplate": { "version": "0.0.57", "resolved": "https://registry.npmjs.org/@std-uritemplate/std-uritemplate/-/std-uritemplate-0.0.57.tgz", "integrity": "sha512-tl79y8TIh4Wc1gar9Cv5cnTls7IY1EDSuiI/gM0kShAj2HcyukilPu2ppFIosgBNItTuE+5N5TZzVFu6tBCaDw==" }, + "node_modules/@szmarczak/http-timer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", + "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "dev": true, + "dependencies": { + "defer-to-connect": "^2.0.1" + }, + "engines": { + "node": ">=14.16" + } + }, "node_modules/@tootallnate/once": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", @@ -2409,6 +2709,12 @@ "node": ">= 10" } }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", + "dev": true + }, "node_modules/@tufjs/canonical-json": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz", @@ -2436,38 +2742,30 @@ "resolved": "https://registry.npmjs.org/@types/adal-angular/-/adal-angular-1.0.1.tgz", "integrity": "sha512-2sRGxJYrluhvIz8ae98i5k5woe9Fics4dMFHTcNfY2xAkj5QGZor+sfZzlgM58Fpw7Kklau9Gn6OhgJP25dKug==" }, - "node_modules/@types/chai": { - "version": "4.3.11", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.11.tgz", - "integrity": "sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==", - "dev": true - }, - "node_modules/@types/cookie": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", - "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==", - "dev": true - }, - "node_modules/@types/cors": { - "version": "2.8.17", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz", - "integrity": "sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, + "node_modules/@types/http-cache-semantics": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", + "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==", + "dev": true + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true + "dev": true, + "peer": true }, "node_modules/@types/lodash": { "version": "4.14.117", @@ -2486,12 +2784,6 @@ "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", "dev": true }, - "node_modules/@types/mocha": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.6.tgz", - "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==", - "dev": true - }, "node_modules/@types/node": { "version": "20.12.11", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz", @@ -2507,17 +2799,12 @@ "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", "dev": true }, - "node_modules/@types/resolve": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", - "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", - "dev": true - }, "node_modules/@types/semver": { "version": "7.5.8", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/@types/sinon": { "version": "17.0.3", @@ -2540,201 +2827,612 @@ "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==", "dev": true }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.5.0.tgz", - "integrity": "sha512-HpqNTH8Du34nLxbKgVMGljZMG0rJd2O9ecvr2QLYp+7512ty1j42KnsFwspPXg1Vh8an9YImf6CokUBltisZFQ==", + "node_modules/@types/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/which/-/which-2.0.2.tgz", + "integrity": "sha512-113D3mDkZDjo+EeUEHCFy0qniNc1ZpecGiAU7WSo7YDoSzolZIQKpYFHrPpjkB2nuyahcKfrmLXeQlh7gqJYdw==", + "dev": true + }, + "node_modules/@types/ws": { + "version": "8.5.10", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", + "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "dev": true, + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", + "dev": true, + "peer": true, + "dependencies": { + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", + "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", + "dev": true, + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "peer": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", + "dev": true, + "peer": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "peer": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "peer": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", + "dev": true, + "peer": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "peer": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, + "node_modules/@vitest/browser": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/browser/-/browser-1.3.1.tgz", + "integrity": "sha512-pRof8G8nqRWwg3ouyIctyhfIVk5jXgF056uF//sqdi37+pVtDz9kBI/RMu0xlc8tgCyJ2aEMfbgJZPUydlEVaQ==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@vitest/utils": "1.3.1", + "magic-string": "^0.30.5", + "sirv": "^2.0.4" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "playwright": "*", + "vitest": "1.3.1", + "webdriverio": "*" + }, + "peerDependenciesMeta": { + "playwright": { + "optional": true + }, + "safaridriver": { + "optional": true + }, + "webdriverio": { + "optional": true + } + } + }, + "node_modules/@vitest/coverage-v8": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-1.3.1.tgz", + "integrity": "sha512-UuBnkSJUNE9rdHjDCPyJ4fYuMkoMtnghes1XohYa4At0MS3OQSAo97FrbwSLRshYsXThMZy1+ybD/byK5llyIg==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.1", + "@bcoe/v8-coverage": "^0.2.3", + "debug": "^4.3.4", + "istanbul-lib-coverage": "^3.2.2", + "istanbul-lib-report": "^3.0.1", + "istanbul-lib-source-maps": "^4.0.1", + "istanbul-reports": "^3.1.6", + "magic-string": "^0.30.5", + "magicast": "^0.3.3", + "picocolors": "^1.0.0", + "std-env": "^3.5.0", + "test-exclude": "^6.0.0", + "v8-to-istanbul": "^9.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "vitest": "1.3.1" + } + }, + "node_modules/@vitest/expect": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.3.1.tgz", + "integrity": "sha512-xofQFwIzfdmLLlHa6ag0dPV8YsnKOCP1KdAeVVh34vSjN2dcUiXYCD9htu/9eM7t8Xln4v03U9HLxLpPlsXdZw==", + "dev": true, + "dependencies": { + "@vitest/spy": "1.3.1", + "@vitest/utils": "1.3.1", + "chai": "^4.3.10" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.3.1.tgz", + "integrity": "sha512-5FzF9c3jG/z5bgCnjr8j9LNq/9OxV2uEBAITOXfoe3rdZJTdO7jzThth7FXv/6b+kdY65tpRQB7WaKhNZwX+Kg==", + "dev": true, + "dependencies": { + "@vitest/utils": "1.3.1", + "p-limit": "^5.0.0", + "pathe": "^1.1.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner/node_modules/p-limit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", + "integrity": "sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/runner/node_modules/yocto-queue": { + "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" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/snapshot": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.3.1.tgz", + "integrity": "sha512-EF++BZbt6RZmOlE3SuTPu/NfwBF6q4ABS37HHXzs2LUVPBLx2QoY/K0fKpRChSo8eLiuxcbCVfqKgx/dplCDuQ==", + "dev": true, + "dependencies": { + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.3.1.tgz", + "integrity": "sha512-xAcW+S099ylC9VLU7eZfdT9myV67Nor9w9zhf0mGCYJSO+zM2839tOeROTdikOi/8Qeusffvxb/MyBSOja1Uig==", "dev": true, "dependencies": { - "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.5.0", - "@typescript-eslint/type-utils": "7.5.0", - "@typescript-eslint/utils": "7.5.0", - "@typescript-eslint/visitor-keys": "7.5.0", - "debug": "^4.3.4", - "graphemer": "^1.4.0", - "ignore": "^5.2.4", - "natural-compare": "^1.4.0", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" + "tinyspy": "^2.2.0" }, - "engines": { - "node": "^18.18.0 || >=20.0.0" + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/ui": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-1.3.1.tgz", + "integrity": "sha512-2UrFLJ62c/eJGPHcclstMKlAR7E1WB1ITe1isuowEPJJHi3HfqofvsUqQ1cGrEF7kitG1DJuwURUA3HLDtQkXA==", + "dev": true, + "dependencies": { + "@vitest/utils": "1.3.1", + "fast-glob": "^3.3.2", + "fflate": "^0.8.1", + "flatted": "^3.2.9", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "sirv": "^2.0.4" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "@typescript-eslint/parser": "^7.0.0", - "eslint": "^8.56.0" + "vitest": "1.3.1" + } + }, + "node_modules/@vitest/utils": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.3.1.tgz", + "integrity": "sha512-d3Waie/299qqRyHTm2DjADeTaNdNSVsnwHPWrs20JMpjh6eiVq7ggggweO8rc4arhf6rRkWuHKwvxGvejUXZZQ==", + "dev": true, + "dependencies": { + "diff-sequences": "^29.6.3", + "estree-walker": "^3.0.3", + "loupe": "^2.3.7", + "pretty-format": "^29.7.0" }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "funding": { + "url": "https://opencollective.com/vitest" } }, - "node_modules/@typescript-eslint/parser": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.5.0.tgz", - "integrity": "sha512-cj+XGhNujfD2/wzR1tabNsidnYRaFfEkcULdcIyVBYcXjBvBKOes+mpMBP7hMpOyk+gBcfXsrg4NBGAStQyxjQ==", + "node_modules/@vitest/utils/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.5.0", - "@typescript-eslint/types": "7.5.0", - "@typescript-eslint/typescript-estree": "7.5.0", - "@typescript-eslint/visitor-keys": "7.5.0", - "debug": "^4.3.4" + "@types/estree": "^1.0.0" + } + }, + "node_modules/@wdio/config": { + "version": "8.33.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.33.1.tgz", + "integrity": "sha512-JB7+tRkEsDJ4QAgJIZ3AaZvlp8pfBH6A5cKcGsaOuLVYMnsRPVkEGQc6n2akN9EPlDA2UjyrPOX6KZHbsSty7w==", + "dev": true, + "dependencies": { + "@wdio/logger": "8.28.0", + "@wdio/types": "8.32.4", + "@wdio/utils": "8.33.1", + "decamelize": "^6.0.0", + "deepmerge-ts": "^5.0.0", + "glob": "^10.2.2", + "import-meta-resolve": "^4.0.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^16.13 || >=18" + } + }, + "node_modules/@wdio/config/node_modules/decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.5.0.tgz", - "integrity": "sha512-Z1r7uJY0MDeUlql9XJ6kRVgk/sP11sr3HKXn268HZyqL7i4cEfrdFuSSY/0tUqT37l5zT0tJOsuDP16kio85iA==", + "node_modules/@wdio/config/node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.5.0", - "@typescript-eslint/visitor-keys": "7.5.0" + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": ">=16 || 14 >=14.17" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@typescript-eslint/type-utils": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.5.0.tgz", - "integrity": "sha512-A021Rj33+G8mx2Dqh0nMO9GyjjIBK3MqgVgZ2qlKf6CJy51wY/lkkFqq3TqqnH34XyAHUkq27IjlUkWlQRpLHw==", + "node_modules/@wdio/logger": { + "version": "8.28.0", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.28.0.tgz", + "integrity": "sha512-/s6zNCqwy1hoc+K4SJypis0Ud0dlJ+urOelJFO1x0G0rwDRWyFiUP6ijTaCcFxAm29jYEcEPWijl2xkVIHwOyA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.5.0", - "@typescript-eslint/utils": "7.5.0", - "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^7.1.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^16.13 || >=18" + } + }, + "node_modules/@wdio/logger/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/@typescript-eslint/types": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.5.0.tgz", - "integrity": "sha512-tv5B4IHeAdhR7uS4+bf8Ov3k793VEVHd45viRRkehIUZxm0WF82VPiLgHzA/Xl4TGPg1ZD49vfxBKFPecD5/mg==", + "node_modules/@wdio/logger/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", "dev": true, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^12.17.0 || ^14.13 || >=16.0.0" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.5.0.tgz", - "integrity": "sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==", + "node_modules/@wdio/logger/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.5.0", - "@typescript-eslint/visitor-keys": "7.5.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" + "ansi-regex": "^6.0.1" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": ">=12" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/@typescript-eslint/utils": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.5.0.tgz", - "integrity": "sha512-3vZl9u0R+/FLQcpy2EHyRGNqAS/ofJ3Ji8aebilfJe+fobK8+LbIFmrHciLVDxjDoONmufDcnVSF38KwMEOjzw==", + "node_modules/@wdio/protocols": { + "version": "8.32.0", + "resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-8.32.0.tgz", + "integrity": "sha512-inLJRrtIGdTz/YPbcsvpSvPlYQFTVtF3OYBwAXhG2FiP1ZwE1CQNLP/xgRGye1ymdGCypGkexRqIx3KBGm801Q==", + "dev": true + }, + "node_modules/@wdio/repl": { + "version": "8.24.12", + "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-8.24.12.tgz", + "integrity": "sha512-321F3sWafnlw93uRTSjEBVuvWCxTkWNDs7ektQS15drrroL3TMeFOynu4rDrIz0jXD9Vas0HCD2Tq/P0uxFLdw==", "dev": true, "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.5.0", - "@typescript-eslint/types": "7.5.0", - "@typescript-eslint/typescript-estree": "7.5.0", - "semver": "^7.5.4" + "@types/node": "^20.1.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "node": "^16.13 || >=18" + } + }, + "node_modules/@wdio/types": { + "version": "8.32.4", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.32.4.tgz", + "integrity": "sha512-pDPGcCvq0MQF8u0sjw9m4aMI2gAKn6vphyBB2+1IxYriL777gbbxd7WQ+PygMBvYVprCYIkLPvhUFwF85WakmA==", + "dev": true, + "dependencies": { + "@types/node": "^20.1.0" }, - "peerDependencies": { - "eslint": "^8.56.0" + "engines": { + "node": "^16.13 || >=18" } }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.5.0.tgz", - "integrity": "sha512-mcuHM/QircmA6O7fy6nn2w/3ditQkj+SgtOc8DW3uQ10Yfj42amm2i+6F2K4YAOPNNTmE6iM1ynM6lrSwdendA==", + "node_modules/@wdio/utils": { + "version": "8.33.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.33.1.tgz", + "integrity": "sha512-W0ArrZbs4M23POv8+FPsgHDFxg+wwklfZgLSsjVq2kpCmBCfIPxKSAOgTo/XrcH4We/OnshgBzxLcI+BHDgi4w==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.5.0", - "eslint-visitor-keys": "^3.4.1" + "@puppeteer/browsers": "^1.6.0", + "@wdio/logger": "8.28.0", + "@wdio/types": "8.32.4", + "decamelize": "^6.0.0", + "deepmerge-ts": "^5.1.0", + "edgedriver": "^5.3.5", + "geckodriver": "^4.3.1", + "get-port": "^7.0.0", + "import-meta-resolve": "^4.0.0", + "locate-app": "^2.1.0", + "safaridriver": "^0.1.0", + "split2": "^4.2.0", + "wait-port": "^1.0.4" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^16.13 || >=18" + } + }, + "node_modules/@wdio/utils/node_modules/decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", - "dev": true + "node_modules/@wdio/utils/node_modules/get-port": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-7.0.0.tgz", + "integrity": "sha512-mDHFgApoQd+azgMdwylJrv2DX47ywGq1i5VFJE7fZ0dttNq3iQMfsU4IvEgBHojA3KqEudyu7Vq+oN8kNaNkWw==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@wdio/utils/node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "dev": true, + "engines": { + "node": ">= 10.x" + } }, "node_modules/@yarnpkg/lockfile": { "version": "1.1.0", @@ -2798,17 +3496,16 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", "dev": true, "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" + "event-target-shim": "^5.0.0" }, "engines": { - "node": ">= 0.6" + "node": ">=6.5" } }, "node_modules/acorn": { @@ -2945,49 +3642,153 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/aproba": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", + "dev": true + }, + "node_modules/archiver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-7.0.0.tgz", + "integrity": "sha512-R9HM9egs8FfktSqUqyjlKmvF4U+CWNqm/2tlROV+lOFg79MLdT67ae1l3hU47pGy8twSXxHoiefMCh43w0BriQ==", + "dev": true, + "dependencies": { + "archiver-utils": "^5.0.0", + "async": "^3.2.4", + "buffer-crc32": "^1.0.0", + "readable-stream": "^4.0.0", + "readdir-glob": "^1.1.2", + "tar-stream": "^3.0.0", + "zip-stream": "^6.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/archiver-utils": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-5.0.1.tgz", + "integrity": "sha512-MMAoLdMvT/nckofX1tCLrf7uJce4jTNkiT6smA2u57AOImc1nce7mR3EDujxL5yv6/MnILuQH4sAsPtDS8kTvg==", + "dev": true, + "dependencies": { + "glob": "^10.0.0", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash": "^4.17.15", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/archiver-utils/node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/archiver/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/archiver/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", "dev": true, + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, "engines": { - "node": ">=8" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/archiver/node_modules/tar-stream": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", "dev": true, "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "node_modules/are-docs-informative": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz", + "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==", "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, "engines": { - "node": ">= 8" + "node": ">=14" } }, - "node_modules/aproba": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", - "dev": true - }, "node_modules/are-we-there-yet": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", @@ -3007,6 +3808,31 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", + "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array-differ": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", @@ -3022,6 +3848,26 @@ "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", "dev": true }, + "node_modules/array-includes": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", + "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", @@ -3031,44 +3877,116 @@ "node": ">=8" } }, - "node_modules/arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "node_modules/array.prototype.findlast": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", + "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "node_modules/array.prototype.flat": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", "dev": true, "dependencies": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/asn1.js/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true + "node_modules/array.prototype.flatmap": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/assert": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", - "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", + "node_modules/array.prototype.toreversed": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/array.prototype.toreversed/-/array.prototype.toreversed-1.1.2.tgz", + "integrity": "sha512-wwDCoT4Ck4Cz7sLtgUmzR5UV3YF5mFHUlbChCzZBQZ+0m2cl/DH3tKgvphv1nKgFsJ48oCSg6p91q2Vm0I/ZMA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "is-nan": "^1.3.2", - "object-is": "^1.1.5", - "object.assign": "^4.1.4", - "util": "^0.12.5" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + } + }, + "node_modules/array.prototype.tosorted": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.3.tgz", + "integrity": "sha512-/DdH4TiTmOKzyQbp/eadcCVexiCb36xJg7HshYOYJnNZFDj33GEv0P7GxsynpShhq4OLYJzbGcBDkLsDt7MnNg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.3", + "es-errors": "^1.1.0", + "es-shim-unscopables": "^1.0.2" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", + "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.3", + "es-errors": "^1.2.1", + "get-intrinsic": "^1.2.3", + "is-array-buffer": "^3.0.4", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "dev": true, + "engines": { + "node": ">=0.10.0" } }, "node_modules/assertion-error": { @@ -3080,6 +3998,18 @@ "node": "*" } }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dev": true, + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/async": { "version": "3.2.5", "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", @@ -3093,10 +4023,13 @@ "dev": true }, "node_modules/available-typed-arrays": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.6.tgz", - "integrity": "sha512-j1QzY8iPNPG4o4xmO3ptzpRxTciqD3MgEHtifP/YnJpIo58Xu+ne4BejlbkuaLfXn/nz6HFiw29bLpj2PNMdGg==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -3115,12 +4048,55 @@ "proxy-from-env": "^1.1.0" } }, + "node_modules/b4a": { + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.6.tgz", + "integrity": "sha512-5Tk1HLk6b6ctmjIkAcU/Ujv/1WqiDl0F0JdRCR80VsOcUlHcu7pWeWRlOqQLHfDEsVx9YH/aif5AG4ehoCtTmg==", + "dev": true + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/bare-events": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.2.1.tgz", + "integrity": "sha512-9GYPpsPFvrWBkelIhOhTWtkeZxVxZOdb3VnFTCzlOo3OjvmTvzLoZFUT8kNFACx0vJej6QPney1Cf9BvzCNE/A==", + "dev": true, + "optional": true + }, + "node_modules/bare-fs": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-2.2.1.tgz", + "integrity": "sha512-+CjmZANQDFZWy4PGbVdmALIwmt33aJg8qTkVjClU6X4WmZkTPBDxRHiBn7fpqEWEfF3AC2io++erpViAIQbSjg==", + "dev": true, + "optional": true, + "dependencies": { + "bare-events": "^2.0.0", + "bare-os": "^2.0.0", + "bare-path": "^2.0.0", + "streamx": "^2.13.0" + } + }, + "node_modules/bare-os": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.2.0.tgz", + "integrity": "sha512-hD0rOPfYWOMpVirTACt4/nK8mC55La12K5fY1ij8HAdfQakD62M+H4o4tpfKzVGLgRDTuk3vjA4GqGXXCeFbag==", + "dev": true, + "optional": true + }, + "node_modules/bare-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-2.1.0.tgz", + "integrity": "sha512-DIIg7ts8bdRKwJRJrUMy/PICEaQZaPGZ26lsSx9MJSwIhSrcdHn7/C8W+XmnG/rKi6BaRcz+JO00CjZteybDtw==", + "dev": true, + "optional": true, + "dependencies": { + "bare-os": "^2.1.0" + } + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -3141,13 +4117,13 @@ } ] }, - "node_modules/base64id": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", - "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "node_modules/basic-ftp": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", + "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", "dev": true, "engines": { - "node": "^4.5.0 || >= 5.9" + "node": ">=10.0.0" } }, "node_modules/before-after-hook": { @@ -3156,13 +4132,26 @@ "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", "dev": true }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "node_modules/big-integer": { + "version": "1.6.52", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", + "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==", "dev": true, "engines": { - "node": ">=8" + "node": ">=0.6" + } + }, + "node_modules/binary": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", + "integrity": "sha512-D4H1y5KYwpJgK8wk1Cue5LLPgmwHKYSChkbspQg5JtVuR5ulGckxfR62H3AE9UDkdMC8yyXlqYihuz3Aqg2XZg==", + "dev": true, + "dependencies": { + "buffers": "~0.1.1", + "chainsaw": "~0.1.0" + }, + "engines": { + "node": "*" } }, "node_modules/bl": { @@ -3176,49 +4165,10 @@ "readable-stream": "^3.4.0" } }, - "node_modules/bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", - "dev": true - }, - "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", - "dev": true, - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/body-parser/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/body-parser/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "node_modules/bluebird": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", + "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==", "dev": true }, "node_modules/brace-expansion": { @@ -3229,146 +4179,17 @@ "dependencies": { "balanced-match": "^1.0.0" } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", - "dev": true - }, - "node_modules/browser-resolve": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz", - "integrity": "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==", - "dev": true, - "dependencies": { - "resolve": "^1.17.0" - } - }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "node_modules/browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, - "dependencies": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dev": true, - "dependencies": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "node_modules/browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", - "dev": true, - "dependencies": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/browserify-rsa": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", - "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", - "dev": true, - "dependencies": { - "bn.js": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "node_modules/browserify-sign": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz", - "integrity": "sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==", - "dev": true, - "dependencies": { - "bn.js": "^5.2.1", - "browserify-rsa": "^4.1.0", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.4", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.6", - "readable-stream": "^3.6.2", - "safe-buffer": "^5.2.1" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "dev": true, - "dependencies": { - "pako": "~1.0.5" - } - }, - "node_modules/browserslist": { - "version": "4.22.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz", - "integrity": "sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, "dependencies": { - "caniuse-lite": "^1.0.30001580", - "electron-to-chromium": "^1.4.648", - "node-releases": "^2.0.14", - "update-browserslist-db": "^1.0.13" - }, - "bin": { - "browserslist": "cli.js" + "fill-range": "^7.0.1" }, "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + "node": ">=8" } }, "node_modules/buffer": { @@ -3395,6 +4216,15 @@ "ieee754": "^1.1.13" } }, + "node_modules/buffer-crc32": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz", + "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/buffer-equal-constant-time": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", @@ -3406,11 +4236,23 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "node_modules/buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", - "dev": true + "node_modules/buffer-indexof-polyfill": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", + "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/buffers": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", + "integrity": "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==", + "dev": true, + "engines": { + "node": ">=0.2.0" + } }, "node_modules/builtin-modules": { "version": "3.3.0", @@ -3424,12 +4266,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", - "dev": true - }, "node_modules/builtins": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", @@ -3448,13 +4284,13 @@ "node": ">=12.17" } }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "node_modules/cac": { + "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": ">= 0.8" + "node": ">=8" } }, "node_modules/cacache": { @@ -3523,15 +4359,59 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/cacheable-lookup": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", + "integrity": "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==", + "dev": true, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/cacheable-request": { + "version": "10.2.14", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.14.tgz", + "integrity": "sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ==", + "dev": true, + "dependencies": { + "@types/http-cache-semantics": "^4.0.2", + "get-stream": "^6.0.1", + "http-cache-semantics": "^4.1.1", + "keyv": "^4.5.3", + "mimic-response": "^4.0.0", + "normalize-url": "^8.0.0", + "responselike": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/call-bind": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", - "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dev": true, "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.1", - "set-function-length": "^1.1.1" + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3572,26 +4452,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/caniuse-lite": { - "version": "1.0.30001582", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001582.tgz", - "integrity": "sha512-vsJG3V5vgfduaQGVxL53uSX/HUzxyr2eA8xCo36OLal7sRcSZbibJtLeh0qja4sFOr/QQGt4opB4tOy+eOgAxg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ] - }, "node_modules/chai": { "version": "4.3.10", "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", @@ -3610,6 +4470,18 @@ "node": ">=4" } }, + "node_modules/chainsaw": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", + "integrity": "sha512-75kWfWt6MEKNC8xYXIdRpDehRYY/tNSgwKaJq+dbbDcxORuVrrQ+SEHoWsniVn9XPYfP4gmdWIeDk/4YNp1rNQ==", + "dev": true, + "dependencies": { + "traverse": ">=0.3.0 <0.4" + }, + "engines": { + "node": "*" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -3644,45 +4516,6 @@ "node": "*" } }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -3692,6 +4525,18 @@ "node": ">=10" } }, + "node_modules/chromium-bidi": { + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.16.tgz", + "integrity": "sha512-7ZbXdWERxRxSwo3txsBjjmc/NLxqb1Bk30mRb0BMS4YIaiV6zvKZqL/UAH+DdqcDYayDWk2n/y8klkBDODrPvA==", + "dev": true, + "dependencies": { + "mitt": "3.0.0" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -3707,16 +4552,6 @@ "node": ">=8" } }, - "node_modules/cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -3882,33 +4717,6 @@ "node": ">=8.0.0" } }, - "node_modules/combine-source-map": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", - "integrity": "sha512-UlxQ9Vw0b/Bt/KYwCFqdEwsQ1eL8d1gibiFb7lxQJFdvTgc2hIZi6ugsg+kyhzhPV+QEpUiEIwInIAIrgoEkrg==", - "dev": true, - "dependencies": { - "convert-source-map": "~1.1.0", - "inline-source-map": "~0.6.0", - "lodash.memoize": "~3.0.3", - "source-map": "~0.5.3" - } - }, - "node_modules/combine-source-map/node_modules/convert-source-map": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", - "integrity": "sha512-Y8L5rp6jo+g9VEPgvqNfEopjTR4OTYct8lXlS8iVQdmnjDvbdbzYe9rjtFCB9egC86JoNCU61WRY+ScjkZpnIg==", - "dev": true - }, - "node_modules/combine-source-map/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -3925,13 +4733,16 @@ "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "devOptional": true + "optional": true }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", - "dev": true + "node_modules/comment-parser": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", + "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", + "dev": true, + "engines": { + "node": ">= 12.0.0" + } }, "node_modules/compare-func": { "version": "2.0.0", @@ -3943,6 +4754,61 @@ "dot-prop": "^5.1.0" } }, + "node_modules/compress-commons": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.1.tgz", + "integrity": "sha512-l7occIJn8YwlCEbWUCrG6gPms9qnJTCZSaznCa5HaV+yJMH4kM8BDc7q9NyoQuoiB2O6jKgTcTeY462qw6MyHw==", + "dev": true, + "dependencies": { + "crc-32": "^1.2.0", + "crc32-stream": "^6.0.0", + "normalize-path": "^3.0.0", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/compress-commons/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/compress-commons/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dev": true, + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -3964,63 +4830,12 @@ "typedarray": "^0.0.6" } }, - "node_modules/connect": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", - "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", - "dev": true, - "dependencies": { - "debug": "2.6.9", - "finalhandler": "1.1.2", - "parseurl": "~1.3.3", - "utils-merge": "1.0.1" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/connect/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/connect/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "node_modules/console-browserify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", - "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", - "dev": true - }, "node_modules/console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", "dev": true }, - "node_modules/constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ==", - "dev": true - }, - "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/conventional-changelog-angular": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", @@ -4137,40 +4952,12 @@ "node": ">=14" } }, - "node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true - }, - "node_modules/cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "dev": true }, - "node_modules/cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "dev": true, - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/cosmiconfig": { "version": "8.3.6", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", @@ -4197,47 +4984,98 @@ } } }, - "node_modules/create-ecdh": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", - "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "dev": true, + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/crc32-stream": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-6.0.0.tgz", + "integrity": "sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==", + "dev": true, + "dependencies": { + "crc-32": "^1.2.0", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/crc32-stream/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/crc32-stream/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", "dev": true, "dependencies": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/create-ecdh/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, - "node_modules/create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "node_modules/cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", "dev": true, "dependencies": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" + "node-fetch": "^2.6.12" } }, - "node_modules/create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "node_modules/cross-fetch/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": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } } }, "node_modules/cross-spawn": { @@ -4254,32 +5092,16 @@ "node": ">= 8" } }, - "node_modules/crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "dev": true, - "dependencies": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - }, - "engines": { - "node": "*" - } + "node_modules/css-shorthand-properties": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/css-shorthand-properties/-/css-shorthand-properties-1.1.1.tgz", + "integrity": "sha512-Md+Juc7M3uOdbAFwOYlTrccIZ7oCFuzrhKYQjdeUEW/sE1hv17Jp/Bws+ReOPpGVBTYCBoYo+G17V5Qo8QQ75A==", + "dev": true }, - "node_modules/custom-event": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", - "integrity": "sha512-GAj5FOq0Hd+RsCGVJxZuKaIDXDf3h6GQoNEjFgbLLI/trgtavwUbSnZ5pVfg27DVCaWjIohryS0JFwIJyT2cMg==", + "node_modules/css-value": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/css-value/-/css-value-0.0.1.tgz", + "integrity": "sha512-FUV3xaJ63buRLgHrLQVlVgQnQdR4yqdLGaDu7g8CQcWjInDfM9plBTPI9FRfpahju1UBSaMckeb2/46ApS/V1Q==", "dev": true }, "node_modules/dargs": { @@ -4291,13 +5113,64 @@ "node": ">=8" } }, - "node_modules/date-format": { - "version": "4.0.14", - "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz", - "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==", + "node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", "dev": true, "engines": { - "node": ">=4.0" + "node": ">= 14" + } + }, + "node_modules/data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/dateformat": { @@ -4359,6 +5232,33 @@ "node": ">=0.10.0" } }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -4383,13 +5283,13 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "node_modules/deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "node_modules/deepmerge-ts": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/deepmerge-ts/-/deepmerge-ts-5.1.0.tgz", + "integrity": "sha512-eS8dRJOckyo9maw9Tu5O5RUi/4inFLrnoLkBe3cPfDMx3WZioXtmOew4TXQaxq7Rhl4xjDtR7c6x8nNTxOvbFw==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=16.0.0" } }, "node_modules/defaults": { @@ -4404,18 +5304,30 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/define-data-property": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", - "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.1", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/define-lazy-prop": { @@ -4443,6 +5355,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dev": true, + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -4458,39 +5384,19 @@ "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", "dev": true }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "dev": true, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/deprecation": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", "dev": true }, - "node_modules/des.js": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", - "integrity": "sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==", - "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", "dev": true, "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" + "node": ">=6" } }, "node_modules/detect-indent": { @@ -4502,21 +5408,12 @@ "node": ">=4" } }, - "node_modules/di": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", - "integrity": "sha512-uJaamHkagcZtHPqCIHZxnFrXlunQXgBOsZSUOWwFw31QJCAbyTBoHMW75YOTur5ZNx8pIeAKgf6GWIgaqqiLhA==", + "node_modules/devtools-protocol": { + "version": "0.0.1263784", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1263784.tgz", + "integrity": "sha512-k0SCZMwj587w4F8QYbP5iIbSonL6sd3q8aVJch036r9Tv2t9b5/Oq7AiJ/FJvRuORm/pJNXZtrdNNWlpRnl56A==", "dev": true }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/diff-sequences": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", @@ -4526,23 +5423,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "dev": true, - "dependencies": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - } - }, - "node_modules/diffie-hellman/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -4567,30 +5447,6 @@ "node": ">=6.0.0" } }, - "node_modules/dom-serialize": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", - "integrity": "sha512-Yra4DbvoW7/Z6LBN560ZwXMjoNOSAN2wRsKFGc4iBeso+mpIA6qj1vfdf9HpMaKAqG6wXTy+1SYEzmNpKXOSsQ==", - "dev": true, - "dependencies": { - "custom-event": "~1.0.0", - "ent": "~2.2.0", - "extend": "^3.0.0", - "void-elements": "^2.0.0" - } - }, - "node_modules/domain-browser": { - "version": "4.23.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-4.23.0.tgz", - "integrity": "sha512-ArzcM/II1wCCujdCNyQjXrAFwS4mrLh4C7DZWlaI8mdh7h3BfKdNd3bKXITfl2PT9FtfQqaGvhi1vPRQPimjGA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://bevry.me/fund" - } - }, "node_modules/dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -4609,47 +5465,177 @@ "integrity": "sha512-HTlk5nmhkm8F6JcdXvHIzaorzCoziNQT9mGxLPVXW8wJF1TiGSL60ZGB4gHWabHOaMmWmhvk2/lPHfnBiT78AQ==", "dev": true, "engines": { - "node": ">=12" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, + "node_modules/dotenv-expand": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-10.0.0.tgz", + "integrity": "sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", + "dev": true + }, + "node_modules/duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", + "dev": true, + "dependencies": { + "readable-stream": "^2.0.2" + } + }, + "node_modules/duplexer2/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/duplexer2/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/duplexer2/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/edge-paths": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/edge-paths/-/edge-paths-3.0.5.tgz", + "integrity": "sha512-sB7vSrDnFa4ezWQk9nZ/n0FdpdUuC6R1EOrlU3DL+bovcNFK28rqu2emmAUjujYEJTWIgQGqgVVWUZXMnc8iWg==", + "dev": true, + "dependencies": { + "@types/which": "^2.0.1", + "which": "^2.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/shirshak55" + } + }, + "node_modules/edgedriver": { + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/edgedriver/-/edgedriver-5.3.10.tgz", + "integrity": "sha512-RFSHYMNtcF1PjaGZCA2rdQQ8hSTLPZgcYgeY1V6dC+tR4NhZXwFAku+8hCbRYh7ZlwKKrTbVu9FwknjFddIuuw==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@wdio/logger": "^8.28.0", + "decamelize": "^6.0.0", + "edge-paths": "^3.0.5", + "node-fetch": "^3.3.2", + "unzipper": "^0.10.14", + "which": "^4.0.0" + }, + "bin": { + "edgedriver": "bin/edgedriver.js" + } + }, + "node_modules/edgedriver/node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/edgedriver/node_modules/decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/edgedriver/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/edgedriver/node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dev": true, + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { - "url": "https://github.com/motdotla/dotenv?sponsor=1" + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" } }, - "node_modules/dotenv-expand": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-10.0.0.tgz", - "integrity": "sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==", + "node_modules/edgedriver/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/duplexer": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", - "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", - "dev": true - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, - "node_modules/ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", "dependencies": { - "safe-buffer": "^5.0.1" + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" } }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", - "dev": true - }, "node_modules/ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -4665,48 +5651,12 @@ "node": ">=0.10.0" } }, - "node_modules/electron-to-chromium": { - "version": "1.4.653", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.653.tgz", - "integrity": "sha512-wA2A2LQCqnEwQAvwADQq3KpMpNwgAUBnRmrFgRzHnPhbQUFArTR32Ab46f4p0MovDLcg4uqd4nCsN2hTltslpA==", - "dev": true - }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dev": true, - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "dev": true, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/encoding": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", @@ -4737,36 +5687,6 @@ "once": "^1.4.0" } }, - "node_modules/engine.io": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.4.tgz", - "integrity": "sha512-KdVSDKhVKyOi+r5uEabrDLZw2qXStVvCsEB/LN3mw4WFi6Gx50jTyuxYVCwAAC0U46FdnzP/ScKRBTXb/NiEOg==", - "dev": true, - "dependencies": { - "@types/cookie": "^0.4.1", - "@types/cors": "^2.8.12", - "@types/node": ">=10.0.0", - "accepts": "~1.3.4", - "base64id": "2.0.0", - "cookie": "~0.4.1", - "cors": "~2.8.5", - "debug": "~4.3.1", - "engine.io-parser": "~5.2.1", - "ws": "~8.11.0" - }, - "engines": { - "node": ">=10.2.0" - } - }, - "node_modules/engine.io-parser": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz", - "integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==", - "dev": true, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -4779,12 +5699,6 @@ "node": ">=8.6" } }, - "node_modules/ent": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", - "integrity": "sha512-GHrMyVZQWvTIdDtpiEXdHZnFQKzeO09apj8Cbl4pKWy4i0Oprcq17usfDt5aO63swf0JOeMWjWQE/LzgSRuWpA==", - "dev": true - }, "node_modules/env-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", @@ -4821,11 +5735,207 @@ "is-arrayish": "^0.2.1" } }, + "node_modules/es-abstract": { + "version": "1.23.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.2.tgz", + "integrity": "sha512-60s3Xv2T2p1ICykc7c+DNDPLDMm9t4QxCOUU0K9JxiLjM3C1zB9YVdN7tjxrFd4+AkZ8CdX1ovUga4P2+1e+/w==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "arraybuffer.prototype.slice": "^1.0.3", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.0.3", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.4", + "get-symbol-description": "^1.0.2", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", + "has-symbols": "^1.0.3", + "hasown": "^2.0.2", + "internal-slot": "^1.0.7", + "is-array-buffer": "^3.0.4", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.1", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.3", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.13", + "is-weakref": "^1.0.2", + "object-inspect": "^1.13.1", + "object-keys": "^1.1.1", + "object.assign": "^4.1.5", + "regexp.prototype.flags": "^1.5.2", + "safe-array-concat": "^1.1.2", + "safe-regex-test": "^1.0.3", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", + "string.prototype.trimstart": "^1.0.7", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-length": "^1.0.1", + "typed-array-byte-offset": "^1.0.2", + "typed-array-length": "^1.0.5", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.15" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-iterator-helpers": { + "version": "1.0.18", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.0.18.tgz", + "integrity": "sha512-scxAJaewsahbqTYrGKJihhViaM6DDZDDoucfvzNbK0pOren1g/daDQ3IAhzn+1G14rBG7w+i5N+qul60++zlKA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-errors": "^1.3.0", + "es-set-tostringtag": "^2.0.3", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "globalthis": "^1.0.3", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.7", + "iterator.prototype": "^1.1.2", + "safe-array-concat": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", + "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", + "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.4", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", + "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" }, + "node_modules/esbuild": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", + "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.19.12", + "@esbuild/android-arm": "0.19.12", + "@esbuild/android-arm64": "0.19.12", + "@esbuild/android-x64": "0.19.12", + "@esbuild/darwin-arm64": "0.19.12", + "@esbuild/darwin-x64": "0.19.12", + "@esbuild/freebsd-arm64": "0.19.12", + "@esbuild/freebsd-x64": "0.19.12", + "@esbuild/linux-arm": "0.19.12", + "@esbuild/linux-arm64": "0.19.12", + "@esbuild/linux-ia32": "0.19.12", + "@esbuild/linux-loong64": "0.19.12", + "@esbuild/linux-mips64el": "0.19.12", + "@esbuild/linux-ppc64": "0.19.12", + "@esbuild/linux-riscv64": "0.19.12", + "@esbuild/linux-s390x": "0.19.12", + "@esbuild/linux-x64": "0.19.12", + "@esbuild/netbsd-x64": "0.19.12", + "@esbuild/openbsd-x64": "0.19.12", + "@esbuild/sunos-x64": "0.19.12", + "@esbuild/win32-arm64": "0.19.12", + "@esbuild/win32-ia32": "0.19.12", + "@esbuild/win32-x64": "0.19.12" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -4835,12 +5945,6 @@ "node": ">=6" } }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", - "dev": true - }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -4853,6 +5957,27 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, "node_modules/eslint": { "version": "8.57.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", @@ -4920,6 +6045,57 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-header": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz", + "integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==", + "dev": true, + "peerDependencies": { + "eslint": ">=7.7.0" + } + }, + "node_modules/eslint-plugin-jsdoc": { + "version": "46.10.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-46.10.1.tgz", + "integrity": "sha512-x8wxIpv00Y50NyweDUpa+58ffgSAI5sqe+zcZh33xphD0AVh+1kqr1ombaTRb7Fhpove1zfUuujlX9DWWBP5ag==", + "dev": true, + "dependencies": { + "@es-joy/jsdoccomment": "~0.41.0", + "are-docs-informative": "^0.0.2", + "comment-parser": "1.4.1", + "debug": "^4.3.4", + "escape-string-regexp": "^4.0.0", + "esquery": "^1.5.0", + "is-builtin-module": "^3.2.1", + "semver": "^7.5.4", + "spdx-expression-parse": "^4.0.0" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/spdx-expression-parse": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz", + "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/eslint-plugin-prefer-arrow": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prefer-arrow/-/eslint-plugin-prefer-arrow-1.2.3.tgz", + "integrity": "sha512-J9I5PKCOJretVuiZRGvPQxCbllxGAV/viI20JO3LYblAodofBxyMnZAJ+WGeClHgANnSJberTNoFWWjrWKBuXQ==", + "dev": true, + "peerDependencies": { + "eslint": ">=2.0.0" + } + }, "node_modules/eslint-plugin-prettier": { "version": "5.1.3", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", @@ -4941,13 +6117,105 @@ "eslint-config-prettier": "*", "prettier": ">=3.0.0" }, - "peerDependenciesMeta": { - "@types/eslint": { - "optional": true - }, - "eslint-config-prettier": { - "optional": true - } + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react": { + "version": "7.34.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.34.1.tgz", + "integrity": "sha512-N97CxlouPT1AHt8Jn0mhhN2RrADlUAsk1/atcT2KyA/l9Q/E6ll7OIGwNumFmWfZ9skV3XXccYS19h80rHtgkw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.7", + "array.prototype.findlast": "^1.2.4", + "array.prototype.flatmap": "^1.3.2", + "array.prototype.toreversed": "^1.1.2", + "array.prototype.tosorted": "^1.1.3", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.0.17", + "estraverse": "^5.3.0", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.7", + "object.fromentries": "^2.0.7", + "object.hasown": "^1.1.3", + "object.values": "^1.1.7", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.5", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.10" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" + } + }, + "node_modules/eslint-plugin-react/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-react/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-react/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-react/node_modules/resolve": { + "version": "2.0.0-next.5", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", + "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/eslint-plugin-react/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" } }, "node_modules/eslint-plugin-simple-import-sort": { @@ -5072,12 +6340,6 @@ "node": ">=4.0" } }, - "node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true - }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -5087,6 +6349,15 @@ "node": ">=0.10.0" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -5101,16 +6372,6 @@ "node": ">=0.8.x" } }, - "node_modules/evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, - "dependencies": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, "node_modules/execa": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/execa/-/execa-5.0.0.tgz", @@ -5140,12 +6401,6 @@ "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==", "dev": true }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, "node_modules/external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", @@ -5172,6 +6427,41 @@ "node": ">=0.6.0" } }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -5184,6 +6474,12 @@ "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", "dev": true }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", + "dev": true + }, "node_modules/fast-glob": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", @@ -5233,6 +6529,44 @@ "reusify": "^1.0.4" } }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "dev": true + }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -5302,51 +6636,6 @@ "node": ">=8" } }, - "node_modules/finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "dev": true, - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/finalhandler/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/finalhandler/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "node_modules/finalhandler/node_modules/on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==", - "dev": true, - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -5463,6 +6752,27 @@ "node": ">= 6" } }, + "node_modules/form-data-encoder": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.4.tgz", + "integrity": "sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==", + "dev": true, + "engines": { + "node": ">= 14.17" + } + }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dev": true, + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", @@ -5515,6 +6825,75 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/fstream/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/fstream/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fstream/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/fstream/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -5524,32 +6903,161 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/gauge": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", "dev": true, "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.3", - "console-control-strings": "^1.1.0", - "has-unicode": "^2.0.1", - "signal-exit": "^3.0.7", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.5" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.3", + "console-control-strings": "^1.1.0", + "has-unicode": "^2.0.1", + "signal-exit": "^3.0.7", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/geckodriver": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/geckodriver/-/geckodriver-4.3.3.tgz", + "integrity": "sha512-we2c2COgxFkLVuoknJNx+ioP+7VDq0sr6SCqWHTzlA4kzIbzR0EQ1Pps34s8WrsOnQqPC8a4sZV9dRPROOrkSg==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@wdio/logger": "^8.28.0", + "decamelize": "^6.0.0", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.4", + "node-fetch": "^3.3.2", + "tar-fs": "^3.0.5", + "unzipper": "^0.10.14", + "which": "^4.0.0" + }, + "bin": { + "geckodriver": "bin/geckodriver.js" + }, + "engines": { + "node": "^16.13 || >=18 || >=20" + } + }, + "node_modules/geckodriver/node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/geckodriver/node_modules/decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/geckodriver/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/geckodriver/node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dev": true, + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/geckodriver/node_modules/tar-fs": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.5.tgz", + "integrity": "sha512-JOgGAmZyMgbqpLwct7ZV8VzkEB6pxXFBVErLtb+XCOqzc6w1xiWKI9GVd6bwk68EX7eJ4DWmfXVmq8K2ziZTGg==", + "dev": true, + "dependencies": { + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + }, + "optionalDependencies": { + "bare-fs": "^2.1.1", + "bare-path": "^2.1.0" + } + }, + "node_modules/geckodriver/node_modules/tar-stream": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", + "dev": true, + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" } }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "node_modules/geckodriver/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", "dev": true, + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, "engines": { - "node": ">=6.9.0" + "node": "^16.13.0 || >=18.0.0" } }, "node_modules/get-caller-file": { @@ -5571,16 +7079,20 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", - "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dev": true, "dependencies": { + "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -5627,6 +7139,38 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/get-symbol-description": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", + "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-uri": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.3.tgz", + "integrity": "sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==", + "dev": true, + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4", + "fs-extra": "^11.2.0" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/git-raw-commits": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-3.0.0.tgz", @@ -5768,6 +7312,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -5800,11 +7359,54 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/got": { + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/got/-/got-12.6.1.tgz", + "integrity": "sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^5.2.0", + "@szmarczak/http-timer": "^5.0.1", + "cacheable-lookup": "^7.0.0", + "cacheable-request": "^10.2.8", + "decompress-response": "^6.0.0", + "form-data-encoder": "^2.1.2", + "get-stream": "^6.0.1", + "http2-wrapper": "^2.1.10", + "lowercase-keys": "^3.0.0", + "p-cancelable": "^3.0.0", + "responselike": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/got/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -5846,6 +7448,15 @@ "node": ">=6" } }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -5856,21 +7467,21 @@ } }, "node_modules/has-property-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", - "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.2" + "es-define-property": "^1.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", "dev": true, "engines": { "node": ">= 0.4" @@ -5892,12 +7503,12 @@ } }, "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", "dev": true, "dependencies": { - "has-symbols": "^1.0.2" + "has-symbols": "^1.0.3" }, "engines": { "node": ">= 0.4" @@ -5912,34 +7523,10 @@ "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", "dev": true }, - "node_modules/hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, "node_modules/hasown": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", - "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, "dependencies": { "function-bind": "^1.1.2" @@ -5948,26 +7535,6 @@ "node": ">= 0.4" } }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true, - "bin": { - "he": "bin/he" - } - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "dev": true, - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, "node_modules/hosted-git-info": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", @@ -6010,68 +7577,48 @@ "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", "dev": true }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" + "agent-base": "^7.1.0", + "debug": "^4.3.4" }, "engines": { - "node": ">= 0.8" - } - }, - "node_modules/http-errors/node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "dev": true, - "engines": { - "node": ">= 0.8" + "node": ">= 14" } }, - "node_modules/http-proxy": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", - "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "node_modules/http2-wrapper": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz", + "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==", "dev": true, "dependencies": { - "eventemitter3": "^4.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.2.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=10.19.0" } }, - "node_modules/http-proxy-agent": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", - "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "node_modules/http2-wrapper/node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", "dev": true, - "dependencies": { - "agent-base": "^7.1.0", - "debug": "^4.3.4" - }, "engines": { - "node": ">= 14" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", - "dev": true - }, "node_modules/https-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", - "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", "dev": true, "dependencies": { "agent-base": "^7.0.2", @@ -6099,6 +7646,21 @@ "ms": "^2.0.0" } }, + "node_modules/husky": { + "version": "9.0.11", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", + "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", + "dev": true, + "bin": { + "husky": "bin.mjs" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -6207,6 +7769,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/import-meta-resolve": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.0.0.tgz", + "integrity": "sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -6301,24 +7873,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/inline-source-map": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", - "integrity": "sha512-0mVWSSbNDvedDWIN4wxLsdPM4a7cIPcpyMxj3QZ406QRwQ6ePGB1YIHxVPjqpcUGbWQ5C+nHTwGNWAGvt7ggVA==", - "dev": true, - "dependencies": { - "source-map": "~0.5.3" - } - }, - "node_modules/inline-source-map/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/inquirer": { "version": "8.2.6", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.6.tgz", @@ -6345,20 +7899,34 @@ "node": ">=12.0.0" } }, + "node_modules/internal-slot": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", + "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/ip": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==", "dev": true }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "node_modules/is-array-buffer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", + "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "get-intrinsic": "^1.2.1" }, "engines": { "node": ">= 0.4" @@ -6373,16 +7941,47 @@ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "node_modules/is-async-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", + "integrity": "sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==", "dev": true, "dependencies": { - "binary-extensions": "^2.0.0" + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-builtin-module": { @@ -6436,6 +8035,36 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "dev": true, + "dependencies": { + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-docker": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", @@ -6459,6 +8088,18 @@ "node": ">=0.10.0" } }, + "node_modules/is-finalizationregistry": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.0.2.tgz", + "integrity": "sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -6510,21 +8151,23 @@ "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", "dev": true }, - "node_modules/is-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", - "dev": true + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/is-nan": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", - "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", "dev": true, - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3" - }, "engines": { "node": ">= 0.4" }, @@ -6541,6 +8184,21 @@ "node": ">=0.12.0" } }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", @@ -6577,13 +8235,47 @@ "node": ">=0.10.0" } }, - "node_modules/is-reference": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", - "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", + "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", "dev": true, "dependencies": { - "@types/estree": "*" + "call-bind": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-ssh": { @@ -6604,6 +8296,36 @@ "node": ">=8" } }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-text-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", @@ -6617,12 +8339,12 @@ } }, "node_modules/is-typed-array": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", - "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", "dev": true, "dependencies": { - "which-typed-array": "^1.1.11" + "which-typed-array": "^1.1.14" }, "engines": { "node": ">= 0.4" @@ -6643,6 +8365,46 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.3.tgz", + "integrity": "sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", @@ -6660,18 +8422,6 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", "dev": true }, - "node_modules/isbinaryfile": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", - "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==", - "dev": true, - "engines": { - "node": ">= 8.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/gjtorikian/" - } - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -6705,30 +8455,6 @@ "node": ">=8" } }, - "node_modules/istanbul-lib-instrument": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", - "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", - "dev": true, - "dependencies": { - "@babel/core": "^7.7.5", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-instrument/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/istanbul-lib-report": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", @@ -6770,6 +8496,19 @@ "node": ">=8" } }, + "node_modules/iterator.prototype": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.2.tgz", + "integrity": "sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "reflect.getprototypeof": "^1.0.4", + "set-function-name": "^2.0.1" + } + }, "node_modules/jackspeak": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", @@ -6852,20 +8591,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-worker": { - "version": "26.6.2", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz", - "integrity": "sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==", - "dev": true, - "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, "node_modules/jju": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", @@ -6889,16 +8614,13 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "node_modules/jsdoc-type-pratt-parser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz", + "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==", "dev": true, - "bin": { - "jsesc": "bin/jsesc" - }, "engines": { - "node": ">=4" + "node": ">=12.0.0" } }, "node_modules/json-buffer": { @@ -7032,280 +8754,44 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/just-extend": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", - "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", - "dev": true - }, - "node_modules/jwa": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", - "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/jws": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", - "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", - "dependencies": { - "jwa": "^2.0.0", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/karma": { - "version": "6.4.3", - "resolved": "https://registry.npmjs.org/karma/-/karma-6.4.3.tgz", - "integrity": "sha512-LuucC/RE92tJ8mlCwqEoRWXP38UMAqpnq98vktmS9SznSoUPPUJQbc91dHcxcunROvfQjdORVA/YFviH+Xci9Q==", - "dev": true, - "dependencies": { - "@colors/colors": "1.5.0", - "body-parser": "^1.19.0", - "braces": "^3.0.2", - "chokidar": "^3.5.1", - "connect": "^3.7.0", - "di": "^0.0.1", - "dom-serialize": "^2.2.1", - "glob": "^7.1.7", - "graceful-fs": "^4.2.6", - "http-proxy": "^1.18.1", - "isbinaryfile": "^4.0.8", - "lodash": "^4.17.21", - "log4js": "^6.4.1", - "mime": "^2.5.2", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.5", - "qjobs": "^1.2.0", - "range-parser": "^1.2.1", - "rimraf": "^3.0.2", - "socket.io": "^4.7.2", - "source-map": "^0.6.1", - "tmp": "^0.2.1", - "ua-parser-js": "^0.7.30", - "yargs": "^16.1.1" - }, - "bin": { - "karma": "bin/karma" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/karma-chai": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/karma-chai/-/karma-chai-0.1.0.tgz", - "integrity": "sha512-mqKCkHwzPMhgTYca10S90aCEX9+HjVjjrBFAsw36Zj7BlQNbokXXCAe6Ji04VUMsxcY5RLP7YphpfO06XOubdg==", - "dev": true, - "peerDependencies": { - "chai": "*", - "karma": ">=0.10.9" - } - }, - "node_modules/karma-chrome-launcher": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.2.0.tgz", - "integrity": "sha512-rE9RkUPI7I9mAxByQWkGJFXfFD6lE4gC5nPuZdobf/QdTEJI6EU4yIay/cfU/xV4ZxlM5JiTv7zWYgA64NpS5Q==", - "dev": true, - "dependencies": { - "which": "^1.2.1" - } - }, - "node_modules/karma-chrome-launcher/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/karma-firefox-launcher": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.3.tgz", - "integrity": "sha512-LMM2bseebLbYjODBOVt7TCPP9OI2vZIXCavIXhkO9m+10Uj5l7u/SKoeRmYx8FYHTVGZSpk6peX+3BMHC1WwNw==", - "dev": true, - "dependencies": { - "is-wsl": "^2.2.0", - "which": "^3.0.0" - } - }, - "node_modules/karma-firefox-launcher/node_modules/which": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", - "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/which.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/karma-mocha": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/karma-mocha/-/karma-mocha-2.0.1.tgz", - "integrity": "sha512-Tzd5HBjm8his2OA4bouAsATYEpZrp9vC7z5E5j4C5Of5Rrs1jY67RAwXNcVmd/Bnk1wgvQRou0zGVLey44G4tQ==", - "dev": true, - "dependencies": { - "minimist": "^1.2.3" - } - }, - "node_modules/karma-typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/karma-typescript/-/karma-typescript-5.5.4.tgz", - "integrity": "sha512-D7nQ96xu/UekuqCmiPimnCuOFqp8+BxiND6MU6IJVN37E7DgXzr7SUeTzwuTHtKSYpgxKv4iOTUteYTxpeZL9A==", - "dev": true, - "dependencies": { - "acorn": "^8.1.0", - "acorn-walk": "^8.0.2", - "assert": "^2.0.0", - "async": "^3.0.1", - "browser-resolve": "^2.0.0", - "browserify-zlib": "^0.2.0", - "buffer": "^5.4.3", - "combine-source-map": "^0.8.0", - "console-browserify": "^1.2.0", - "constants-browserify": "^1.0.0", - "convert-source-map": "^1.7.0", - "crypto-browserify": "^3.12.0", - "diff": "^4.0.1", - "domain-browser": "^4.16.0", - "events": "^3.2.0", - "glob": "^7.1.6", - "https-browserify": "^1.0.0", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^4.0.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.0", - "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.19", - "log4js": "^6.3.0", - "minimatch": "^3.0.4", - "os-browserify": "^0.3.0", - "pad": "^3.2.0", - "path-browserify": "^1.0.0", - "process": "^0.11.10", - "punycode": "^2.1.1", - "querystring-es3": "^0.2.1", - "readable-stream": "^3.1.1", - "source-map": "^0.7.3", - "stream-browserify": "^3.0.0", - "stream-http": "^3.1.0", - "string_decoder": "^1.3.0", - "timers-browserify": "^2.0.11", - "tmp": "^0.2.1", - "tty-browserify": "^0.0.1", - "url": "^0.11.0", - "util": "^0.12.1", - "vm-browserify": "^1.1.2" - }, - "peerDependencies": { - "karma": "1 || 2 || 3 || 4 || 5 || 6", - "typescript": "1 || 2 || 3 || 4 || 5" - } - }, - "node_modules/karma-typescript/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/karma-typescript/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/karma-typescript/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" }, "engines": { - "node": "*" - } - }, - "node_modules/karma-typescript/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, - "engines": { - "node": ">= 8" + "node": ">=4.0" } }, - "node_modules/karma/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } + "node_modules/just-extend": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", + "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", + "dev": true }, - "node_modules/karma/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, + "node_modules/jwa": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", + "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" } }, - "node_modules/karma/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, + "node_modules/jws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" + "jwa": "^2.0.0", + "safe-buffer": "^5.0.1" } }, "node_modules/keyv": { @@ -7326,6 +8812,60 @@ "node": ">=0.10.0" } }, + "node_modules/ky": { + "version": "0.33.3", + "resolved": "https://registry.npmjs.org/ky/-/ky-0.33.3.tgz", + "integrity": "sha512-CasD9OCEQSFIam2U8efFK81Yeg8vNMTBUqtMOHlrcWQHqUX3HeCl9Dr31u4toV7emlH8Mymk5+9p0lL6mKb/Xw==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/ky?sponsor=1" + } + }, + "node_modules/lazystream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", + "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", + "dev": true, + "dependencies": { + "readable-stream": "^2.0.5" + }, + "engines": { + "node": ">= 0.6.3" + } + }, + "node_modules/lazystream/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/lazystream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/lazystream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, "node_modules/lerna": { "version": "8.1.2", "resolved": "https://registry.npmjs.org/lerna/-/lerna-8.1.2.tgz", @@ -7713,6 +9253,12 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, + "node_modules/listenercount": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", + "integrity": "sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ==", + "dev": true + }, "node_modules/load-json-file": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-6.2.0.tgz", @@ -7737,6 +9283,45 @@ "node": ">=8" } }, + "node_modules/local-pkg": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", + "integrity": "sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==", + "dev": true, + "dependencies": { + "mlly": "^1.4.2", + "pkg-types": "^1.0.3" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/locate-app": { + "version": "2.2.22", + "resolved": "https://registry.npmjs.org/locate-app/-/locate-app-2.2.22.tgz", + "integrity": "sha512-JmhroTfxjQ7lvc7Ac4FwhWwt33qQcjEES3cAAQMgMD8Jubw4SjySaDVnZfdZfcT+eVCgjabY6hYxF0qrSq1/rQ==", + "dev": true, + "dependencies": { + "n12": "1.8.25", + "type-fest": "2.13.0", + "userhome": "1.0.0" + } + }, + "node_modules/locate-app/node_modules/type-fest": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.13.0.tgz", + "integrity": "sha512-lPfAm42MxE4/456+QyIaaVBAwgpJb6xZ8PRu09utnhPdWwcyj9vgy6Sq0Z5yNbJ21EdxB5dRU/Qg8bsyAMtlcw==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -7758,6 +9343,12 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "node_modules/lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", + "dev": true + }, "node_modules/lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", @@ -7804,12 +9395,6 @@ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" }, - "node_modules/lodash.memoize": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", - "integrity": "sha512-eDn9kqrAmVUC1wmZvlQ6Uhde44n+tXpqPrN8olQJbttgh0oKclk+SF54P47VEGE9CEiMeRwAP8BaM7UHvBkz2A==", - "dev": true - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -7821,6 +9406,12 @@ "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" }, + "node_modules/lodash.zip": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz", + "integrity": "sha512-C7IOaBBK/0gMORRBd8OETNx3kmOkgIWIPvyDpZSCTwUrpYmgZwJkjZeOD8ww4xbOUOs4/attY+pciKvadNfFbg==", + "dev": true + }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", @@ -7837,20 +9428,35 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log4js": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.9.1.tgz", - "integrity": "sha512-1somDdy9sChrr9/f4UlzhdaGfDR2c/SaD2a4T7qEkG4jTS57/B3qmnjLYePwQ8cqWnUHZI0iAKxMBpCZICiZ2g==", + "node_modules/loglevel": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.9.1.tgz", + "integrity": "sha512-hP3I3kCrDIMuRwAwHltphhDM1r8i55H33GgqjXbrisuJhF4kRhW1dNuxsRklp4bXl8DSdLaNLuiL4A/LWRfxvg==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + }, + "funding": { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/loglevel" + } + }, + "node_modules/loglevel-plugin-prefix": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.8.4.tgz", + "integrity": "sha512-WpG9CcFAOjz/FtNht+QJeGpvVl/cdR6P0z6OcXSkr8wFJOsV2GRj2j10JLfjuA4aYkcKCNIEqRGCyTife9R8/g==", + "dev": true + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", "dev": true, "dependencies": { - "date-format": "^4.0.14", - "debug": "^4.3.4", - "flatted": "^3.2.7", - "rfdc": "^1.3.0", - "streamroller": "^3.1.5" + "js-tokens": "^3.0.0 || ^4.0.0" }, - "engines": { - "node": ">=8.0" + "bin": { + "loose-envify": "cli.js" } }, "node_modules/loupe": { @@ -7862,13 +9468,16 @@ "get-func-name": "^2.0.1" } }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "node_modules/lowercase-keys": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", + "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", "dev": true, - "dependencies": { - "yallist": "^3.0.2" + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/magic-string": { @@ -7883,6 +9492,17 @@ "node": ">=12" } }, + "node_modules/magicast": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.3.tgz", + "integrity": "sha512-ZbrP1Qxnpoes8sz47AM0z08U+jW6TyRgZzcWy3Ma3vDhJttwMwAFDMMQFobwdBxByBD46JYmxRzeF7w2+wJEuw==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.23.6", + "@babel/types": "^7.23.6", + "source-map-js": "^1.0.2" + } + }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -7944,26 +9564,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "dev": true, - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/meow": { "version": "8.1.2", "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", @@ -8167,37 +9767,6 @@ "node": ">=8.6" } }, - "node_modules/miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "dev": true, - "dependencies": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - }, - "bin": { - "miller-rabin": "bin/miller-rabin" - } - }, - "node_modules/miller-rabin/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, - "node_modules/mime": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", - "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", - "dev": true, - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -8228,6 +9797,18 @@ "node": ">=6" } }, + "node_modules/mimic-response": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-4.0.0.tgz", + "integrity": "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -8237,18 +9818,6 @@ "node": ">=4" } }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", - "dev": true - }, "node_modules/minimatch": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", @@ -8474,6 +10043,12 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, + "node_modules/mitt": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.0.tgz", + "integrity": "sha512-7dX2/10ITVyqh4aOSVI9gdape+t9l2/8QxHrFmUXu4EEUpdlxl6RudZUPZoc+zuY2hk1j7XxVroIVIan/pD/SQ==", + "dev": true + }, "node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", @@ -8486,99 +10061,22 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/mocha": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.4.0.tgz", - "integrity": "sha512-eqhGB8JKapEYcC4ytX/xrzKforgEc3j1pGlAXVy3eRwrtAy5/nIfT1SvgGzfN0XZZxeLq0aQWkOUAmqIJiv+bA==", - "dev": true, - "dependencies": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "8.1.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha.js" - }, - "engines": { - "node": ">= 14.0.0" - } - }, - "node_modules/mocha/node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/mocha/node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/mocha/node_modules/minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", "dev": true }, - "node_modules/mocha/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "node_modules/mlly": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.6.1.tgz", + "integrity": "sha512-vLgaHvaeunuOXHSmEbZ9izxPx3USsk8KCQ8iC+aTlp5sKRSoZvwhHh5L9VbKSaVC6sJDqbyohIS76E2VmHIPAA==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/mocha/node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true, - "engines": { - "node": ">=10" + "acorn": "^8.11.3", + "pathe": "^1.1.2", + "pkg-types": "^1.0.3", + "ufo": "^1.3.2" } }, "node_modules/modify-values": { @@ -8587,7 +10085,16 @@ "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=0.10.0" + } + }, + "node_modules/mrmime": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", + "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==", + "dev": true, + "engines": { + "node": ">=10" } }, "node_modules/ms": { @@ -8669,6 +10176,30 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "node_modules/n12": { + "version": "1.8.25", + "resolved": "https://registry.npmjs.org/n12/-/n12-1.8.25.tgz", + "integrity": "sha512-YSZ69ROLCOT+Daw1Ya+mxEAEL9HsWr0kfte0nis2uwkXsb7BTVh26YYOzaIMQ3XMPy2H5FHMl8ZqFuOcReqFHw==", + "dev": true + }, + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -8690,6 +10221,15 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/nise": { "version": "5.1.9", "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.9.tgz", @@ -8703,6 +10243,25 @@ "path-to-regexp": "^6.2.1" } }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, "node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -8798,12 +10357,6 @@ "integrity": "sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==", "dev": true }, - "node_modules/node-releases": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", - "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", - "dev": true - }, "node_modules/nopt": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-7.2.0.tgz", @@ -8843,6 +10396,18 @@ "node": ">=0.10.0" } }, + "node_modules/normalize-url": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.1.tgz", + "integrity": "sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/npm-bundled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", @@ -9410,22 +10975,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object-is": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", - "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -9453,16 +11002,66 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "node_modules/object.entries": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.8.tgz", + "integrity": "sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ==", "dev": true, "dependencies": { - "ee-first": "1.1.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "engines": { - "node": ">= 0.8" + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.hasown": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", + "integrity": "sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.values": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", + "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/once": { @@ -9545,12 +11144,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==", - "dev": true - }, "node_modules/os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -9560,6 +11153,15 @@ "node": ">=0.10.0" } }, + "node_modules/p-cancelable": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", + "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==", + "dev": true, + "engines": { + "node": ">=12.20" + } + }, "node_modules/p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", @@ -9696,6 +11298,38 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/pac-proxy-agent": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.1.tgz", + "integrity": "sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==", + "dev": true, + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "pac-resolver": "^7.0.0", + "socks-proxy-agent": "^8.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "dev": true, + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/pacote": { "version": "17.0.6", "resolved": "https://registry.npmjs.org/pacote/-/pacote-17.0.6.tgz", @@ -9981,24 +11615,6 @@ "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/pad": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/pad/-/pad-3.2.0.tgz", - "integrity": "sha512-2u0TrjcGbOjBTJpyewEl4hBO3OeX5wWue7eIFPzQTg6wFSvoaHcBTTUY5m+n0hd04gmTCPuY0kCpVIVuw5etwg==", - "dev": true, - "dependencies": { - "wcwidth": "^1.0.1" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -10011,19 +11627,6 @@ "node": ">=6" } }, - "node_modules/parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", - "dev": true, - "dependencies": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -10066,21 +11669,6 @@ "parse-path": "^7.0.0" } }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "dev": true, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -10153,6 +11741,12 @@ "node": ">=8" } }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", + "dev": true + }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -10162,21 +11756,11 @@ "node": "*" } }, - "node_modules/pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", - "dev": true, - "dependencies": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - }, - "engines": { - "node": ">=0.12" - } + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true }, "node_modules/picocolors": { "version": "1.0.0", @@ -10272,6 +11856,54 @@ "node": ">=8" } }, + "node_modules/pkg-types": { + "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", + "pathe": "^1.1.0" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/postcss": { + "version": "8.4.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", + "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -10358,6 +11990,15 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -10389,80 +12030,215 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/prop-types/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true + }, "node_modules/protocols": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/protocols/-/protocols-2.0.1.tgz", "integrity": "sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q==", "dev": true }, + "node_modules/proxy-agent": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.1.tgz", + "integrity": "sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==", + "dev": true, + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.1", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", "dev": true }, - "node_modules/public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/puppeteer-core": { + "version": "20.9.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-20.9.0.tgz", + "integrity": "sha512-H9fYZQzMTRrkboEfPmf7m3CLDN6JvbxXA3qTtS+dFt27tR+CsFHzPsT6pzp6lYL6bJbAPaR0HaPO6uSi+F94Pg==", + "dev": true, + "dependencies": { + "@puppeteer/browsers": "1.4.6", + "chromium-bidi": "0.4.16", + "cross-fetch": "4.0.0", + "debug": "4.3.4", + "devtools-protocol": "0.0.1147663", + "ws": "8.13.0" + }, + "engines": { + "node": ">=16.3.0" + }, + "peerDependencies": { + "typescript": ">= 4.7.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/puppeteer-core/node_modules/@puppeteer/browsers": { + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.4.6.tgz", + "integrity": "sha512-x4BEjr2SjOPowNeiguzjozQbsc6h437ovD/wu+JpaenxVLm3jkgzHY2xOslMTp50HoTvQreMjiexiGQw1sqZlQ==", "dev": true, "dependencies": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" + "debug": "4.3.4", + "extract-zip": "2.0.1", + "progress": "2.0.3", + "proxy-agent": "6.3.0", + "tar-fs": "3.0.4", + "unbzip2-stream": "1.4.3", + "yargs": "17.7.1" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=16.3.0" + }, + "peerDependencies": { + "typescript": ">= 4.7.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/public-encrypt/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "node_modules/puppeteer-core/node_modules/devtools-protocol": { + "version": "0.0.1147663", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1147663.tgz", + "integrity": "sha512-hyWmRrexdhbZ1tcJUGpO95ivbRhWXz++F4Ko+n21AY5PNln2ovoJw+8ZMNDTtip+CNFQfrtLVh/w4009dXO/eQ==", "dev": true }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "node_modules/puppeteer-core/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", "dev": true, "engines": { - "node": ">=6" + "node": ">=12" } }, - "node_modules/qjobs": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", - "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==", + "node_modules/puppeteer-core/node_modules/proxy-agent": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.0.tgz", + "integrity": "sha512-0LdR757eTj/JfuU7TL2YCuAZnxWXu3tkJbg4Oq3geW/qFNT/32T0sp2HnZ9O0lMR4q3vwAt0+xCA8SR0WAD0og==", "dev": true, + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.1" + }, "engines": { - "node": ">=0.9" + "node": ">= 14" } }, - "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "node_modules/puppeteer-core/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "dev": true, - "dependencies": { - "side-channel": "^1.0.4" - }, "engines": { - "node": ">=0.6" + "node": ">=10.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, - "node_modules/querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==", + "node_modules/puppeteer-core/node_modules/yargs": { + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, "engines": { - "node": ">=0.4.x" + "node": ">=12" } }, + "node_modules/query-selector-shadow-dom": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/query-selector-shadow-dom/-/query-selector-shadow-dom-1.0.1.tgz", + "integrity": "sha512-lT5yCqEBgfoMYpf3F2xQRK7zEr1rhIIZuceDK6+xRkJQ4NMbHTwXqk4NkwDwQMNqXgG9r9fyHnzwNVs6zV5KRw==", + "dev": true + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -10483,6 +12259,12 @@ } ] }, + "node_modules/queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", + "dev": true + }, "node_modules/quick-lru": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", @@ -10492,49 +12274,6 @@ "node": ">=8" } }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dev": true, - "dependencies": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", - "dev": true, - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", @@ -10886,16 +12625,25 @@ "node": ">= 6" } }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "node_modules/readdir-glob": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", + "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", + "dev": true, + "dependencies": { + "minimatch": "^5.1.0" + } + }, + "node_modules/readdir-glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, "dependencies": { - "picomatch": "^2.2.1" + "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=8.10.0" + "node": ">=10" } }, "node_modules/redent": { @@ -10911,11 +12659,50 @@ "node": ">=8" } }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.6.tgz", + "integrity": "sha512-fmfw4XgoDke3kdI6h4xcUz1dG8uaiv5q9gcEwLS4Pnth2kxT+GZ7YehS1JTMGBQmtV7Y4GFGbs2re2NqhdozUg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.1", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "globalthis": "^1.0.3", + "which-builtin-type": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/regenerator-runtime": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", + "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "set-function-name": "^2.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -10925,12 +12712,6 @@ "node": ">=0.10.0" } }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true - }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -10948,6 +12729,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true + }, "node_modules/resolve-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", @@ -10978,6 +12765,36 @@ "node": ">=4" } }, + "node_modules/responselike": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", + "integrity": "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==", + "dev": true, + "dependencies": { + "lowercase-keys": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/resq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/resq/-/resq-1.11.0.tgz", + "integrity": "sha512-G10EBz+zAAy3zUd/CDoBbXRL6ia9kOo3xRHrMDsHljI0GDkhYlyjwoCx5+3eCC4swi1uCoZQhskuJkj7Gp57Bw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^2.0.1" + } + }, + "node_modules/resq/node_modules/fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==", + "dev": true + }, "node_modules/restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", @@ -11010,10 +12827,10 @@ "node": ">=0.10.0" } }, - "node_modules/rfdc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.1.tgz", - "integrity": "sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==", + "node_modules/rgb2hex": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.2.5.tgz", + "integrity": "sha512-22MOP1Rh7sAo1BZpDG6R5RFYzR2lYEgwq7HEmyW2qcsOqR2lQKmn+O//xV3YG/0rrhMC6KVX2hU+ZXuaw9a5bw==", "dev": true }, "node_modules/rimraf": { @@ -11073,56 +12890,6 @@ "node": "*" } }, - "node_modules/ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dev": true, - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "node_modules/rollup": { - "version": "2.79.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", - "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", - "dev": true, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=10.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/rollup-plugin-terser": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz", - "integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==", - "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.10.4", - "jest-worker": "^26.2.1", - "serialize-javascript": "^4.0.0", - "terser": "^5.0.0" - }, - "peerDependencies": { - "rollup": "^2.0.0" - } - }, - "node_modules/rollup-plugin-terser/node_modules/serialize-javascript": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", - "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", - "dev": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, "node_modules/run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", @@ -11164,6 +12931,36 @@ "tslib": "^2.1.0" } }, + "node_modules/safaridriver": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/safaridriver/-/safaridriver-0.1.2.tgz", + "integrity": "sha512-4R309+gWflJktzPXBQCobbWEHlzC4aK3a+Ov3tz2Ib2aBxiwd11phkdIBH1l0EO22x24CJMUQkpKFumRriCSRg==", + "dev": true + }, + "node_modules/safe-array-concat": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", + "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-array-concat/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -11183,6 +12980,23 @@ } ] }, + "node_modules/safe-regex-test": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", + "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-regex": "^1.1.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -11219,13 +13033,31 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, - "node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "node_modules/serialize-error": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-11.0.3.tgz", + "integrity": "sha512-2G2y++21dhj2R7iHAdd0FIzjGwuKZld+7Pl/bTU6YIkrC2ZMbVUjm+luj6A6V34Rv9XfKJDKpTWu9W4Gse1D9g==", "dev": true, "dependencies": { - "randombytes": "^2.1.0" + "type-fest": "^2.12.2" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/serialize-error/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/set-blocking": { @@ -11235,16 +13067,32 @@ "dev": true }, "node_modules/set-function-length": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", - "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "dev": true, "dependencies": { - "define-data-property": "^1.1.1", + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.2", + "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.1" + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -11256,25 +13104,6 @@ "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", "dev": true }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "dev": true - }, - "node_modules/sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - }, - "bin": { - "sha.js": "bin.js" - } - }, "node_modules/shallow-clone": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", @@ -11309,19 +13138,29 @@ } }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "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 + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -11558,63 +13397,37 @@ "node": ">=0.3.1" } }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/smart-buffer": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "dev": true, - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/socket.io": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.4.tgz", - "integrity": "sha512-DcotgfP1Zg9iP/dH9zvAQcWrE0TtbMVwXmlV4T4mqsvY+gw+LqUGPfx2AoVyRk0FLME+GQhufDMyacFmw7ksqw==", + "node_modules/sirv": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz", + "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==", "dev": true, "dependencies": { - "accepts": "~1.3.4", - "base64id": "~2.0.0", - "cors": "~2.8.5", - "debug": "~4.3.2", - "engine.io": "~6.5.2", - "socket.io-adapter": "~2.5.2", - "socket.io-parser": "~4.2.4" + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" }, "engines": { - "node": ">=10.2.0" + "node": ">= 10" } }, - "node_modules/socket.io-adapter": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz", - "integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==", + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, - "dependencies": { - "ws": "~8.11.0" + "engines": { + "node": ">=8" } }, - "node_modules/socket.io-parser": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", - "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", "dev": true, - "dependencies": { - "@socket.io/component-emitter": "~3.1.0", - "debug": "~4.3.1" - }, "engines": { - "node": ">=10.0.0" + "node": ">= 6.0.0", + "npm": ">= 3.0.0" } }, "node_modules/socks": { @@ -11666,11 +13479,22 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-js": { + "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" + } + }, "node_modules/source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -11765,14 +13589,17 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "node_modules/statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", - "dev": true, - "engines": { - "node": ">= 0.6" - } + "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 + }, + "node_modules/std-env": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.7.0.tgz", + "integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==", + "dev": true }, "node_modules/stoppable": { "version": "1.1.0", @@ -11783,72 +13610,17 @@ "npm": ">=6" } }, - "node_modules/stream-browserify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", - "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", - "dev": true, - "dependencies": { - "inherits": "~2.0.4", - "readable-stream": "^3.5.0" - } - }, - "node_modules/stream-http": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.2.0.tgz", - "integrity": "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==", - "dev": true, - "dependencies": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "xtend": "^4.0.2" - } - }, - "node_modules/streamroller": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.5.tgz", - "integrity": "sha512-KFxaM7XT+irxvdqSP1LGLgNWbYN7ay5owZ3r/8t77p+EtSUAfUgtl7be3xtqtOmGUl9K9YPO2ca8133RlTjvKw==", - "dev": true, - "dependencies": { - "date-format": "^4.0.14", - "debug": "^4.3.4", - "fs-extra": "^8.1.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/streamroller/node_modules/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "node_modules/streamx": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.16.1.tgz", + "integrity": "sha512-m9QYj6WygWyWa3H1YY69amr4nVgy61xfjys7xO7kviL5rfIEc2naf+ewFiOA+aEJD7y0JO3h2GoiUv4TDwEGzQ==", "dev": true, "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/streamroller/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/streamroller/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" + "bare-events": "^2.2.0" } }, "node_modules/string_decoder": { @@ -11889,6 +13661,81 @@ "node": ">=8" } }, + "node_modules/string.prototype.matchall": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz", + "integrity": "sha512-NUdh0aDavY2og7IbBPenWqR9exH+E26Sv8e0/eTe1tltDGZL+GtBkDAnnyBtmekfK6/Dq3MkcGtzXFEd1LQrtg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.7", + "regexp.prototype.flags": "^1.5.2", + "set-function-name": "^2.0.2", + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -11956,6 +13803,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strip-literal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.0.0.tgz", + "integrity": "sha512-f9vHgsCWBq2ugHAkGMiiYY+AYG0D/cbloKKg0nhaaaSNsujdGIpVXCNsrJpCKr5M0f4aI31mr13UjY6GAuXCKA==", + "dev": true, + "dependencies": { + "js-tokens": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/strip-literal/node_modules/js-tokens": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-8.0.3.tgz", + "integrity": "sha512-UfJMcSJc+SEXEl9lH/VLHSZbThQyLpw1vLO1Lb+j4RWDvG3N2f7yj3PVQA3cmkTBNldJ9eFnM+xEXxHIXrYiJw==", + "dev": true + }, "node_modules/strong-log-transformer": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz", @@ -12030,6 +13895,28 @@ "node": ">= 10" } }, + "node_modules/tar-fs": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz", + "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==", + "dev": true, + "dependencies": { + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + } + }, + "node_modules/tar-fs/node_modules/tar-stream": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", + "dev": true, + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, "node_modules/tar-stream": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", @@ -12102,6 +13989,8 @@ "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.0.tgz", "integrity": "sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.8.2", @@ -12115,6 +14004,62 @@ "node": ">=10" } }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/test-kiota-typescript-libraries": { "resolved": "packages/test", "link": true @@ -12180,28 +14125,40 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/timers-browserify": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz", - "integrity": "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==", - "dev": true, - "dependencies": { - "setimmediate": "^1.0.4" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/timsort": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", "integrity": "sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A==" }, + "node_modules/tinybench": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.6.0.tgz", + "integrity": "sha512-N8hW3PG/3aOoZAN5V/NSAEDz0ZixDSSt5b/a05iqtpgfLWMSVuCo7w0k2vVvEjdrIoeGqZzweX2WlyioNIHchA==", + "dev": true + }, "node_modules/tinyduration": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/tinyduration/-/tinyduration-3.3.0.tgz", "integrity": "sha512-sLR0iVUnnnyGEX/a3jhTA0QMK7UvakBqQJFLiibiuEYL6U1L85W+qApTZj6DcL1uoWQntYuL0gExoe9NU5B3PA==" }, + "node_modules/tinypool": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.2.tgz", + "integrity": "sha512-SUszKYe5wgsxnNOVlBYO6IC+8VGWdVGZWAqUxp3UErNBtptZvWbwyUOyzNL59zigz2rCA92QiL3wvG+JDSdJdQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", + "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -12235,13 +14192,13 @@ "node": ">=8.0" } }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "node_modules/totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", "dev": true, "engines": { - "node": ">=0.6" + "node": ">=6" } }, "node_modules/tr46": { @@ -12249,6 +14206,15 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, + "node_modules/traverse": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", + "integrity": "sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/trim-newlines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", @@ -12259,12 +14225,13 @@ } }, "node_modules/ts-api-utils": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", - "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", "dev": true, + "peer": true, "engines": { - "node": ">=16.13.0" + "node": ">=16" }, "peerDependencies": { "typescript": ">=4.2.0" @@ -12298,12 +14265,6 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, - "node_modules/tty-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", - "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", - "dev": true - }, "node_modules/tuf-js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/tuf-js/-/tuf-js-1.1.7.tgz", @@ -12535,17 +14496,77 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "node_modules/typed-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", + "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", + "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", + "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.5.tgz", + "integrity": "sha512-yMi0PlwuznKHxKmcpoOdeLwxBoVPkqZxd7q2FgMkmD3bNwvF5VW0+UlUQ1k1vmktTu4Yu13Q0RIxEP8+B+wloA==", "dev": true, "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0" }, "engines": { - "node": ">= 0.6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/typedarray": { @@ -12567,28 +14588,11 @@ "node": ">=14.17" } }, - "node_modules/ua-parser-js": { - "version": "0.7.37", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.37.tgz", - "integrity": "sha512-xV8kqRKM+jhMvcHWUKthV9fNebIzrNy//2O9ZwWcfiBFR5f25XVZPLlEajk/sf3Ra15V92isyQqnIEXRDaZWEA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/ua-parser-js" - }, - { - "type": "paypal", - "url": "https://paypal.me/faisalman" - }, - { - "type": "github", - "url": "https://github.com/sponsors/faisalman" - } - ], - "engines": { - "node": "*" - } + "node_modules/ufo": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.4.0.tgz", + "integrity": "sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==", + "dev": true }, "node_modules/uglify-js": { "version": "3.17.4", @@ -12603,6 +14607,31 @@ "node": ">=0.8.0" } }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dev": true, + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -12648,13 +14677,52 @@ "node": ">= 10.0.0" } }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "node_modules/unzipper": { + "version": "0.10.14", + "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.14.tgz", + "integrity": "sha512-ti4wZj+0bQTiX2KmKWuwj7lhV+2n//uXEotUmGuQqrbVZSEGFMbI68+c6JCQ8aAmUWYvtHEz2A8K6wXvueR/6g==", "dev": true, - "engines": { - "node": ">= 0.8" + "dependencies": { + "big-integer": "^1.6.17", + "binary": "~0.3.0", + "bluebird": "~3.4.1", + "buffer-indexof-polyfill": "~1.0.0", + "duplexer2": "~0.1.4", + "fstream": "^1.0.12", + "graceful-fs": "^4.2.2", + "listenercount": "~1.0.1", + "readable-stream": "~2.3.6", + "setimmediate": "~1.0.4" + } + }, + "node_modules/unzipper/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/unzipper/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/unzipper/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" } }, "node_modules/upath": { @@ -12667,168 +14735,424 @@ "yarn": "*" } }, - "node_modules/update-browserslist-db": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", - "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/userhome": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/userhome/-/userhome-1.0.0.tgz", + "integrity": "sha512-ayFKY3H+Pwfy4W98yPdtH1VqH4psDeyW8lYYFzfecR9d6hqLpqhecktvYR3SEEXt7vG0S1JEpciI3g94pMErig==", "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/v8-to-istanbul": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", + "integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/v8-to-istanbul/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/validate-npm-package-name": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.0.tgz", + "integrity": "sha512-YuKoXDAhBYxY7SfOKxHBDoSyENFeW5VvIIQp2TGQuit8gpK6MnWaQelBKxso72DoxTZfZdcP3W90LqpSkgPzLQ==", + "dev": true, + "dependencies": { + "builtins": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/validator": { + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", + "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/vite": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.5.tgz", + "integrity": "sha512-BdN1xh0Of/oQafhU+FvopafUp6WaYenLU/NFoL5WyJL++GxkNfieKzBhM24H3HVsPQrlAqB7iJYTHabzaRed5Q==", + "dev": true, + "dependencies": { + "esbuild": "^0.19.3", + "postcss": "^8.4.35", + "rollup": "^4.2.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" + "less": { + "optional": true }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true } - ], + } + }, + "node_modules/vite-node": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.3.1.tgz", + "integrity": "sha512-azbRrqRxlWTJEVbzInZCTchx0X69M/XPTCz4H+TLvlTcR/xH/3hkRqhOakT41fMJCMzXTu4UvegkZiEoJAWvng==", + "dev": true, "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "cac": "^6.7.14", + "debug": "^4.3.4", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^5.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite/node_modules/rollup": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.12.1.tgz", + "integrity": "sha512-ggqQKvx/PsB0FaWXhIvVkSWh7a/PCLQAsMjBc+nA2M8Rv2/HG0X6zvixAB7KyZBRtifBUhy5k8voQX/mRnABPg==", + "dev": true, + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.12.1", + "@rollup/rollup-android-arm64": "4.12.1", + "@rollup/rollup-darwin-arm64": "4.12.1", + "@rollup/rollup-darwin-x64": "4.12.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.12.1", + "@rollup/rollup-linux-arm64-gnu": "4.12.1", + "@rollup/rollup-linux-arm64-musl": "4.12.1", + "@rollup/rollup-linux-riscv64-gnu": "4.12.1", + "@rollup/rollup-linux-x64-gnu": "4.12.1", + "@rollup/rollup-linux-x64-musl": "4.12.1", + "@rollup/rollup-win32-arm64-msvc": "4.12.1", + "@rollup/rollup-win32-ia32-msvc": "4.12.1", + "@rollup/rollup-win32-x64-msvc": "4.12.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/vitest": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.3.1.tgz", + "integrity": "sha512-/1QJqXs8YbCrfv/GPQ05wAZf2eakUPLPa18vkJAKE7RXOKfVHqMZZ1WlTjiwl6Gcn65M5vpNUB6EFLnEdRdEXQ==", + "dev": true, + "dependencies": { + "@vitest/expect": "1.3.1", + "@vitest/runner": "1.3.1", + "@vitest/snapshot": "1.3.1", + "@vitest/spy": "1.3.1", + "@vitest/utils": "1.3.1", + "acorn-walk": "^8.3.2", + "chai": "^4.3.10", + "debug": "^4.3.4", + "execa": "^8.0.1", + "local-pkg": "^0.5.0", + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.5.0", + "strip-literal": "^2.0.0", + "tinybench": "^2.5.1", + "tinypool": "^0.8.2", + "vite": "^5.0.0", + "vite-node": "1.3.1", + "why-is-node-running": "^2.2.2" }, "bin": { - "update-browserslist-db": "cli.js" + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "browserslist": ">= 4.21.0" + "@edge-runtime/vm": "*", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "1.3.1", + "@vitest/ui": "1.3.1", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "node_modules/vitest/node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", "dev": true, "dependencies": { - "punycode": "^2.1.0" + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/vitest/node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/vitest/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/url": { - "version": "0.11.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.3.tgz", - "integrity": "sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==", + "node_modules/vitest/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", "dev": true, - "dependencies": { - "punycode": "^1.4.1", - "qs": "^6.11.2" + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/url/node_modules/punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", - "dev": true - }, - "node_modules/url/node_modules/qs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", - "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "node_modules/vitest/node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", "dev": true, "dependencies": { - "side-channel": "^1.0.4" + "path-key": "^4.0.0" }, "engines": { - "node": ">=0.6" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "node_modules/vitest/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", "dev": true, "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "dev": true, + "mimic-fn": "^4.0.0" + }, "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/bin/uuid" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "node_modules/vitest/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", "dev": true, - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/validate-npm-package-name": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.0.tgz", - "integrity": "sha512-YuKoXDAhBYxY7SfOKxHBDoSyENFeW5VvIIQp2TGQuit8gpK6MnWaQelBKxso72DoxTZfZdcP3W90LqpSkgPzLQ==", + "node_modules/vitest/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, - "dependencies": { - "builtins": "^5.0.0" - }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", + "node_modules/vitest/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, "engines": { - "node": ">= 0.10" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "node_modules/wait-port": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/wait-port/-/wait-port-1.1.0.tgz", + "integrity": "sha512-3e04qkoN3LxTMLakdqeWth8nih8usyg+sf1Bgdf9wwUkp05iuK1eSY/QpLvscT/+F/gA89+LpUmmgBtesbqI2Q==", "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "commander": "^9.3.0", + "debug": "^4.3.4" + }, + "bin": { + "wait-port": "bin/wait-port.js" + }, "engines": { - "node": ">= 0.8" + "node": ">=10" } }, - "node_modules/vm-browserify": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", - "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", - "dev": true - }, - "node_modules/void-elements": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", - "integrity": "sha512-qZKX4RnBzH2ugr8Lxa7x+0V6XD9Sb/ouARtiasEQCHB1EVU4NXtmHsDDrx1dO4ne5fc3J6EW05BP1Dl0z0iung==", + "node_modules/wait-port/node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": "^12.20.0 || >=14" } }, "node_modules/wcwidth": { @@ -12840,6 +15164,92 @@ "defaults": "^1.0.3" } }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/webdriver": { + "version": "8.33.1", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.33.1.tgz", + "integrity": "sha512-QREF4c08omN9BPh3QDmz5h+OEvjdzDliuEcrDuXoDnHSMxIj1rsonzsgRaM2PXhFZuPeMIiKZYqc7Qg9BGbh6A==", + "dev": true, + "dependencies": { + "@types/node": "^20.1.0", + "@types/ws": "^8.5.3", + "@wdio/config": "8.33.1", + "@wdio/logger": "8.28.0", + "@wdio/protocols": "8.32.0", + "@wdio/types": "8.32.4", + "@wdio/utils": "8.33.1", + "deepmerge-ts": "^5.1.0", + "got": "^12.6.1", + "ky": "^0.33.0", + "ws": "^8.8.0" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/webdriverio": { + "version": "8.33.1", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.33.1.tgz", + "integrity": "sha512-1DsF8sx1a46AoVYCUpEwJYU74iBAW/U2H5r6p+60ct7dIiFmxmc4uCbOqtf7NLOTgrIzAOaRnT0EsrRICpg5Qw==", + "dev": true, + "dependencies": { + "@types/node": "^20.1.0", + "@wdio/config": "8.33.1", + "@wdio/logger": "8.28.0", + "@wdio/protocols": "8.32.0", + "@wdio/repl": "8.24.12", + "@wdio/types": "8.32.4", + "@wdio/utils": "8.33.1", + "archiver": "^7.0.0", + "aria-query": "^5.0.0", + "css-shorthand-properties": "^1.1.1", + "css-value": "^0.0.1", + "devtools-protocol": "^0.0.1263784", + "grapheme-splitter": "^1.0.2", + "import-meta-resolve": "^4.0.0", + "is-plain-obj": "^4.1.0", + "lodash.clonedeep": "^4.5.0", + "lodash.zip": "^4.2.0", + "minimatch": "^9.0.0", + "puppeteer-core": "^20.9.0", + "query-selector-shadow-dom": "^1.0.0", + "resq": "^1.9.1", + "rgb2hex": "0.2.5", + "serialize-error": "^11.0.1", + "webdriver": "8.33.1" + }, + "engines": { + "node": "^16.13 || >=18" + }, + "peerDependencies": { + "devtools": "^8.14.0" + }, + "peerDependenciesMeta": { + "devtools": { + "optional": true + } + } + }, + "node_modules/webdriverio/node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -12874,17 +15284,83 @@ "node": ">= 8" } }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.1.3.tgz", + "integrity": "sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw==", + "dev": true, + "dependencies": { + "function.prototype.name": "^1.1.5", + "has-tostringtag": "^1.0.0", + "is-async-function": "^2.0.0", + "is-date-object": "^1.0.5", + "is-finalizationregistry": "^1.0.2", + "is-generator-function": "^1.0.10", + "is-regex": "^1.1.4", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/which-typed-array": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", - "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", "dev": true, "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -12893,6 +15369,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/why-is-node-running": { + "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" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wide-align": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", @@ -12908,12 +15400,6 @@ "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", "dev": true }, - "node_modules/workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", - "dev": true - }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -13098,12 +15584,6 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -13131,54 +15611,6 @@ "node": ">=12" } }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-unparser/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yargs-unparser/node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yargs-unparser/node_modules/is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/yargs/node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -13216,6 +15648,25 @@ "node": ">=10" } }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dev": true, + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/yauzl/node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", @@ -13247,6 +15698,60 @@ "commander": "^2.7.1" } }, + "node_modules/zip-stream": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-6.0.0.tgz", + "integrity": "sha512-X0WFquRRDtL9HR9hc1OrabOP/VKJEX7gAr2geayt3b7dLgXgSXI6ucC4CphLQP/aQt2GyHIYgmXxtC+dVdghAQ==", + "dev": true, + "dependencies": { + "archiver-utils": "^5.0.0", + "compress-commons": "^6.0.0", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/zip-stream/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/zip-stream/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dev": true, + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "packages/abstractions": { "name": "@microsoft/kiota-abstractions", "version": "1.0.0-preview.51", @@ -13270,17 +15775,18 @@ "license": "MIT", "dependencies": { "@azure/core-auth": "^1.5.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" - } + }, + "devDependencies": {} }, "packages/authentication/spfx": { "name": "@microsoft/kiota-authentication-spfx", "version": "1.0.0-preview.41", "license": "MIT", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "@microsoft/sp-http": "^1.15.2", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" @@ -13587,7 +16093,7 @@ "version": "1.0.0-preview.50", "license": "MIT", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "@opentelemetry/api": "^1.7.0", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" @@ -13598,7 +16104,7 @@ "version": "1.0.0-preview.40", "license": "MIT", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } @@ -13608,7 +16114,7 @@ "version": "1.0.0-preview.51", "license": "MIT", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } @@ -13618,12 +16124,12 @@ "version": "1.0.0-preview.29", "license": "MIT", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" }, "devDependencies": { - "@microsoft/kiota-serialization-json": "^1.0.0-preview.51" + "@microsoft/kiota-serialization-json": "*" } }, "packages/serialization/text": { @@ -13631,7 +16137,7 @@ "version": "1.0.0-preview.48", "license": "MIT", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } @@ -13641,12 +16147,12 @@ "version": "0.0.1-preview.7", "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.23", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.18", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.22", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.12", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.21", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.20" + "@microsoft/kiota-abstractions": "*", + "@microsoft/kiota-authentication-azure": "*", + "@microsoft/kiota-http-fetchlibrary": "*", + "@microsoft/kiota-serialization-form": "*", + "@microsoft/kiota-serialization-json": "*", + "@microsoft/kiota-serialization-text": "*" } } } diff --git a/package.json b/package.json index 41a1501fb..1da99e4e9 100644 --- a/package.json +++ b/package.json @@ -2,32 +2,26 @@ "name": "kiota-typescript", "private": true, "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.7", - "@rollup/plugin-node-resolve": "^15.2.3", - "@types/chai": "^4.3.11", - "@types/mocha": "^10.0.6", + "@microsoft/eslint-config-msgraph": "^2.0.0", "@types/node": "^20.11.15", "@types/sinon": "^17.0.3", - "@typescript-eslint/eslint-plugin": "^7.0.1", - "@typescript-eslint/parser": "^7.0.1", - "chai": "4.3.10", + "@vitest/coverage-v8": "^1.3.1", + "@vitest/ui": "^1.3.1", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", + "eslint-plugin-header": "^3.1.1", + "eslint-plugin-jsdoc": "^46.10.1", + "eslint-plugin-prefer-arrow": "^1.2.3", "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-react": "^7.33.2", "eslint-plugin-simple-import-sort": "^12.0.0", - "karma": "^6.4.2", - "karma-chai": "^0.1.0", - "karma-chrome-launcher": "^3.2.0", - "karma-firefox-launcher": "^2.1.2", - "karma-mocha": "^2.0.1", - "karma-typescript": "^5.5.4", + "husky": "^9.0.11", "lerna": "^8.0.2", - "mocha": "^10.2.0", "prettier": "^3.2.4", - "rollup": "2.79.1", - "rollup-plugin-terser": "^7.0.2", "sinon": "^17.0.1", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "vitest": "^1.3.1", + "webdriverio": "^8.33.1" }, "workspaces": [ "packages/test/", @@ -37,18 +31,21 @@ "packages/authentication/*" ], "scripts": { - "build": "npm run build:cjs && npm run build:esm", - "build:watch": "npm run build:watch:cjs & npm run build:watch:es", - "build:cjs": "tsc -b packages/test/tsconfig.cjs.json", - "build:watch:cjs": "tsc -b packages/test/tsconfig.cjs.json -w", - "build:esm": "tsc -b packages/test/tsconfig.es.json", - "build:sdk": "npm run build:sdk:es && npm run build:sdk:cjs", - "build:sdk:es": "tsc -b packages/test/tsconfig.sdk.es.json", - "build:sdk:cjs": "tsc -b packages/test/tsconfig.sdk.cjs.json", - "build:watch:es": "tsc -b packages/test/tsconfig.es.json -w", - "test": "lerna run test --parallel", + "build": "npm run prettier:check && npm run clean && npm run build:@microsoft/*", + "build:@microsoft/*": "lerna run build --scope \"@microsoft/*\"", + "clean": "lerna run --parallel --stream --scope \"@microsoft/*\" clean", + "test:browser": "lerna run --scope \"@microsoft/*\" test:browser", + "test:node": "lerna run --scope \"@microsoft/*\" test:node", + "test": "npm run test:node && npm run test:browser", + "test:integrated": "lerna run test:integrated", "tsc:version": "tsc --version", - "lint": "eslint . --ext .ts", - "lint:fix": "eslint . --ext .ts --fix" + "prettier:base": "prettier --parser typescript", + "prettier:check": "npm run prettier:base -- --check \"packages/**/*.{ts,tsx}\"", + "prettier:write": "npm run prettier:base -- --write \"packages/**/*.{ts,tsx}\"", + "lint": "npm run lint:eslint", + "lint:eslint": "eslint -c .eslintrc.js --quiet \"packages/*/src/**/*.ts\"", + "lint:eslint:fix": "npm run lint:eslint -- --fix", + "lint:eslint:loud": "eslint -c .eslintrc.js \"packages/*/src/**/*.ts\"", + "prepare": "husky" } } diff --git a/packages/abstractions/.eslintignore b/packages/abstractions/.eslintignore deleted file mode 100644 index 8942aa232..000000000 --- a/packages/abstractions/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -*.js -*.js.map -*.d.ts - -node_modules -lib -spec/development \ No newline at end of file diff --git a/packages/abstractions/.eslintrc.json b/packages/abstractions/.eslintrc.json deleted file mode 100644 index 80ab9b397..000000000 --- a/packages/abstractions/.eslintrc.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "prettier", - "simple-import-sort" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "rules": { - "@typescript-eslint/no-empty-interface": "warn", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/consistent-type-imports": "error", - "prettier/prettier": [ - "error", - { - "endOfLine": "auto" - } - ], - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "typeLike", - "format": [ - "PascalCase" - ], - "filter": { - "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "interface", - "format": [ - "PascalCase" - ], - "custom": { - "regex": "^I[A-Z]", - "match": false - }, - "filter": { - "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", - "match": false - } - }, - { - "selector": "variable", - "format": [ - "camelCase", - "PascalCase", - "UPPER_CASE" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "function", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "parameter", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", - "match": false - } - }, - { - "selector": "method", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "memberLike", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "enumMember", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "property", - "format": null - } - ], - "@typescript-eslint/semi": "error", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/prefer-for-of": "error", - "@typescript-eslint/prefer-function-type": "error", - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/quotes": [ - "error", - "double", - { - "avoidEscape": true, - "allowTemplateLiterals": true - } - ], - "@typescript-eslint/space-within-parens": [ - "off", - "never" - ], - "@typescript-eslint/triple-slash-reference": "error", - "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unified-signatures": "error", - "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", - "@typescript-eslint/consistent-type-definitions": [ - "error", - "interface" - ], - "@typescript-eslint/no-inferrable-types": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-this-alias": "error", - "no-unused-expressions": "off", - "@typescript-eslint/no-unused-expressions": [ - "error", - { - "allowTernary": true - } - ], - "@typescript-eslint/space-before-function-paren": "off", - "@typescript-eslint/consistent-type-assertions": "error", - "@typescript-eslint/explicit-member-accessibility": [ - "off", - { - "accessibility": "explicit" - } - ], - "@typescript-eslint/indent": "off", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/member-delimiter-style": [ - "off", - { - "multiline": { - "delimiter": "none", - "requireLast": true - }, - "singleline": { - "delimiter": "semi", - "requireLast": false - } - } - ], - "@typescript-eslint/member-ordering": "off", - "@typescript-eslint/no-empty-function": "error", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-parameter-properties": "off", - "@typescript-eslint/no-array-constructor": "error", - "no-useless-catch": "error", - "prefer-rest-params": "off", - "no-constant-condition": "error", - "simple-import-sort/imports": "error", - "brace-style": "error", - "constructor-super": "error", - "curly": [ - "error", - "multi-line" - ], - "dot-notation": "off", - "eqeqeq": "error", - "new-parens": "error", - "no-caller": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-empty": "error", - "no-eval": "error", - "no-extra-bind": "error", - "no-fallthrough": "error", - "no-new-func": "off", - "no-new-wrappers": "error", - "no-return-await": "off", - "no-sparse-arrays": "error", - "no-template-curly-in-string": "error", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-unsafe-finally": "error", - "no-unused-labels": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-const": "error", - "prefer-object-spread": "error", - "quote-props": "off", - "space-in-parens": "error", - "unicode-bom": [ - "error", - "never" - ], - "use-isnan": "error" - } -} \ No newline at end of file diff --git a/packages/abstractions/.npmignore b/packages/abstractions/.npmignore index 164fa84b7..15ae0ca0b 100644 --- a/packages/abstractions/.npmignore +++ b/packages/abstractions/.npmignore @@ -4,7 +4,6 @@ *.tgz **/test/**/* docs/ -karma.conf.js node_modules/ rollup.config.js src/ diff --git a/packages/abstractions/karma.conf.js b/packages/abstractions/karma.conf.js deleted file mode 100644 index ce3f349de..000000000 --- a/packages/abstractions/karma.conf.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function (config) { - config.set({ - frameworks: ["mocha", "chai", "karma-typescript"], - files: [{ pattern: "dist/es/test/index.js", type: "module" }], - preprocessors: { - "**/*.ts": ["karma-typescript"], - }, - karmaTypescriptConfig: { - tsconfig: "./tsconfig.cjs.json", - }, - browsers: ["ChromeHeadless"], - }); -}; diff --git a/packages/abstractions/package.json b/packages/abstractions/package.json index ad3b8b7e5..b0b59355f 100644 --- a/packages/abstractions/package.json +++ b/packages/abstractions/package.json @@ -2,19 +2,18 @@ "name": "@microsoft/kiota-abstractions", "version": "1.0.0-preview.51", "description": "Core abstractions for kiota generated libraries in TypeScript and JavaScript", - "main": "dist/cjs/src/index.js", + "main": "dist/es/src/index.js", "module": "dist/es/src/index.js", - "types": "dist/cjs/src/index.d.ts", + "types": "dist/es/src/index.d.ts", "scripts": { - "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc -p tsconfig.cjs.json", - "build:esm": "tsc -p tsconfig.es.json", + "build": "npm run build:esm", + "build:esm": "tsc", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "rm -r ./dist", - "karma": "npm run rollup && karma start --single-run --browsers ChromeHeadless karma.conf.js", - "rollup": "rollup -c", - "test": "npm run build && mocha 'dist/cjs/test/common/**/*.js'" + "clean": "rm -rf ./dist", + "test:browser": "vitest run --browser.name=chrome --browser.headless", + "test:node": "vitest --run", + "test": "npm run test:node && npm run test:browser" }, "repository": "git://github.com/microsoft/kiota-typescript.git", "keywords": [ diff --git a/packages/abstractions/rollup.config.js b/packages/abstractions/rollup.config.js deleted file mode 100644 index 33546e42e..000000000 --- a/packages/abstractions/rollup.config.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -import resolve from "@rollup/plugin-node-resolve"; -import commonjs from "@rollup/plugin-commonjs"; - -const config = [{ - input: ["dist/es/test/browser/index.js"], - output: { - file: "dist/es/test/index.js", - format: "esm", - name: "BrowserTest", - }, - plugins: [ - commonjs(), - resolve({ - browser: true, - preferBuiltins: false, - - }) - ], -}]; - -export default config; \ No newline at end of file diff --git a/packages/abstractions/src/apiClientBuilder.ts b/packages/abstractions/src/apiClientBuilder.ts index 7fdb45ecc..1cfadc8c0 100644 --- a/packages/abstractions/src/apiClientBuilder.ts +++ b/packages/abstractions/src/apiClientBuilder.ts @@ -1,120 +1,74 @@ -import { - type ParseNodeFactory, - ParseNodeFactoryRegistry, - type SerializationWriterFactory, - SerializationWriterFactoryRegistry -} from "./serialization"; -import { - BackingStoreParseNodeFactory, - BackingStoreSerializationWriterProxyFactory, -} from "./store"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { type ParseNodeFactory, ParseNodeFactoryRegistry, type SerializationWriterFactory, SerializationWriterFactoryRegistry } from "./serialization"; +import { BackingStoreParseNodeFactory, BackingStoreSerializationWriterProxyFactory } from "./store"; /** * Registers the default serializer to the registry. * @param type the class of the factory to be registered. */ -export function registerDefaultSerializer( - type: new () => SerializationWriterFactory -): void { - if (!type) throw new Error("Type is required"); - const serializer = new type(); - SerializationWriterFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.set( - serializer.getValidContentType(), - serializer - ); +export function registerDefaultSerializer(type: new () => SerializationWriterFactory): void { + if (!type) throw new Error("Type is required"); + const serializer = new type(); + SerializationWriterFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.set(serializer.getValidContentType(), serializer); } /** * Registers the default deserializer to the registry. * @param type the class of the factory to be registered. */ -export function registerDefaultDeserializer( - type: new () => ParseNodeFactory -): void { - if (!type) throw new Error("Type is required"); - const deserializer = new type(); - ParseNodeFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.set( - deserializer.getValidContentType(), - deserializer - ); +export function registerDefaultDeserializer(type: new () => ParseNodeFactory): void { + if (!type) throw new Error("Type is required"); + const deserializer = new type(); + ParseNodeFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.set(deserializer.getValidContentType(), deserializer); } /** * Enables the backing store on default serialization writers and the given serialization writer. * @param original The serialization writer to enable the backing store on. * @return A new serialization writer with the backing store enabled. */ -export function enableBackingStoreForSerializationWriterFactory( - original: SerializationWriterFactory -): SerializationWriterFactory { - if (!original) throw new Error("Original must be specified"); - let result = original; - if (original instanceof SerializationWriterFactoryRegistry) { - enableBackingStoreForSerializationRegistry( - original as SerializationWriterFactoryRegistry - ); - } else { - result = new BackingStoreSerializationWriterProxyFactory(original); - } - enableBackingStoreForSerializationRegistry( - SerializationWriterFactoryRegistry.defaultInstance - ); - enableBackingStoreForParseNodeRegistry( - ParseNodeFactoryRegistry.defaultInstance - ); - return result; +export function enableBackingStoreForSerializationWriterFactory(original: SerializationWriterFactory): SerializationWriterFactory { + if (!original) throw new Error("Original must be specified"); + let result = original; + if (original instanceof SerializationWriterFactoryRegistry) { + enableBackingStoreForSerializationRegistry(original); + } else { + result = new BackingStoreSerializationWriterProxyFactory(original); + } + enableBackingStoreForSerializationRegistry(SerializationWriterFactoryRegistry.defaultInstance); + enableBackingStoreForParseNodeRegistry(ParseNodeFactoryRegistry.defaultInstance); + return result; } /** * Enables the backing store on default parse node factories and the given parse node factory. * @param original The parse node factory to enable the backing store on. * @return A new parse node factory with the backing store enabled. */ -export function enableBackingStoreForParseNodeFactory( - original: ParseNodeFactory -): ParseNodeFactory { - if (!original) throw new Error("Original must be specified"); - let result = original; - if (original instanceof ParseNodeFactoryRegistry) { - enableBackingStoreForParseNodeRegistry( - original as ParseNodeFactoryRegistry - ); - } else { - result = new BackingStoreParseNodeFactory(original); - } - enableBackingStoreForParseNodeRegistry( - ParseNodeFactoryRegistry.defaultInstance - ); - return result; +export function enableBackingStoreForParseNodeFactory(original: ParseNodeFactory): ParseNodeFactory { + if (!original) throw new Error("Original must be specified"); + let result = original; + if (original instanceof ParseNodeFactoryRegistry) { + enableBackingStoreForParseNodeRegistry(original); + } else { + result = new BackingStoreParseNodeFactory(original); + } + enableBackingStoreForParseNodeRegistry(ParseNodeFactoryRegistry.defaultInstance); + return result; } -function enableBackingStoreForParseNodeRegistry( - registry: ParseNodeFactoryRegistry -): void { - for (const [k, v] of registry.contentTypeAssociatedFactories) { - if ( - !( - v instanceof BackingStoreParseNodeFactory || - v instanceof ParseNodeFactoryRegistry - ) - ) { - registry.contentTypeAssociatedFactories.set( - k, - new BackingStoreParseNodeFactory(v) - ); - } - } +function enableBackingStoreForParseNodeRegistry(registry: ParseNodeFactoryRegistry): void { + for (const [k, v] of registry.contentTypeAssociatedFactories) { + if (!(v instanceof BackingStoreParseNodeFactory || v instanceof ParseNodeFactoryRegistry)) { + registry.contentTypeAssociatedFactories.set(k, new BackingStoreParseNodeFactory(v)); + } + } } -function enableBackingStoreForSerializationRegistry( - registry: SerializationWriterFactoryRegistry -): void { - for (const [k, v] of registry.contentTypeAssociatedFactories) { - if ( - !( - v instanceof BackingStoreSerializationWriterProxyFactory || - v instanceof SerializationWriterFactoryRegistry - ) - ) { - registry.contentTypeAssociatedFactories.set( - k, - new BackingStoreSerializationWriterProxyFactory(v) - ); - } - } +function enableBackingStoreForSerializationRegistry(registry: SerializationWriterFactoryRegistry): void { + for (const [k, v] of registry.contentTypeAssociatedFactories) { + if (!(v instanceof BackingStoreSerializationWriterProxyFactory || v instanceof SerializationWriterFactoryRegistry)) { + registry.contentTypeAssociatedFactories.set(k, new BackingStoreSerializationWriterProxyFactory(v)); + } + } } diff --git a/packages/abstractions/src/apiClientProxifier.ts b/packages/abstractions/src/apiClientProxifier.ts index 62df794da..3210cce2f 100644 --- a/packages/abstractions/src/apiClientProxifier.ts +++ b/packages/abstractions/src/apiClientProxifier.ts @@ -1,468 +1,240 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { getPathParameters } from "./getPathParameters"; import { HttpMethod } from "./httpMethod"; -import type { - ErrorMappings, - PrimitiveTypesForDeserialization, - PrimitiveTypesForDeserializationType, - RequestAdapter, - SendMethods, -} from "./requestAdapter"; +import type { ErrorMappings, PrimitiveTypesForDeserialization, PrimitiveTypesForDeserializationType, RequestAdapter, SendMethods } from "./requestAdapter"; import type { RequestConfiguration } from "./requestConfiguration"; -import { - RequestInformation, - type RequestInformationSetContent, -} from "./requestInformation"; -import type { - ModelSerializerFunction, - Parsable, - ParsableFactory, -} from "./serialization"; +import { RequestInformation, type RequestInformationSetContent } from "./requestInformation"; +import type { ModelSerializerFunction, Parsable, ParsableFactory } from "./serialization"; function sanitizeMethodName(methodName: string): string { - if (methodName.startsWith("to")) { - return methodName - .substring(2) - .replace("RequestInformation", "") - .toLowerCase(); - } - return methodName; + if (methodName.startsWith("to")) { + return methodName.substring(2).replace("RequestInformation", "").toLowerCase(); + } + return methodName; } function getRequestMethod(key: string): KeysOfRequestsMetadata | undefined { - switch (sanitizeMethodName(key)) { - case "delete": - return "delete"; - case "get": - return "get"; - case "head": - return "head"; - case "options": - return "options"; - case "patch": - return "patch"; - case "post": - return "post"; - case "put": - return "put"; - default: - return undefined; - } + switch (sanitizeMethodName(key)) { + case "delete": + return "delete"; + case "get": + return "get"; + case "head": + return "head"; + case "options": + return "options"; + case "patch": + return "patch"; + case "post": + return "post"; + case "put": + return "put"; + default: + return undefined; + } } -function toRequestInformation( - urlTemplate: string, - pathParameters: Record, - metadata: RequestMetadata, - requestAdapter: RequestAdapter, - httpMethod: HttpMethod, - body: unknown | ArrayBuffer | undefined, - bodyMediaType: string | undefined, - requestConfiguration: RequestConfiguration | undefined, -): RequestInformation { - const requestInfo = new RequestInformation( - httpMethod, - urlTemplate, - pathParameters, - ); - requestInfo.configure(requestConfiguration, metadata.queryParametersMapper); - addAcceptHeaderIfPresent(metadata, requestInfo); - if (metadata.requestBodySerializer) { - if (!body) throw new Error("body cannot be undefined"); - if (typeof metadata.requestBodySerializer === "function") { - requestInfo.setContentFromParsable( - requestAdapter, - metadata.requestBodyContentType - ? metadata.requestBodyContentType - : bodyMediaType, - body, - metadata.requestBodySerializer, - ); - } else { - requestInfo.setContentFromScalar( - requestAdapter, - metadata.requestBodyContentType - ? metadata.requestBodyContentType - : bodyMediaType, - body as PrimitiveTypesForDeserializationType, - ); - } - } else if ( - metadata.requestInformationContentSetMethod === "setStreamContent" - ) { - if (!body) throw new Error("body cannot be undefined"); - requestInfo.setStreamContent( - body as ArrayBuffer, - metadata.requestBodyContentType - ? metadata.requestBodyContentType - : bodyMediaType, - ); - } - return requestInfo; +function toRequestInformation(urlTemplate: string, pathParameters: Record, metadata: RequestMetadata, requestAdapter: RequestAdapter, httpMethod: HttpMethod, body: unknown | ArrayBuffer | undefined, bodyMediaType: string | undefined, requestConfiguration: RequestConfiguration | undefined): RequestInformation { + const requestInfo = new RequestInformation(httpMethod, urlTemplate, pathParameters); + requestInfo.configure(requestConfiguration, metadata.queryParametersMapper); + addAcceptHeaderIfPresent(metadata, requestInfo); + if (metadata.requestBodySerializer) { + if (!body) throw new Error("body cannot be undefined"); + if (typeof metadata.requestBodySerializer === "function") { + requestInfo.setContentFromParsable(requestAdapter, metadata.requestBodyContentType ? metadata.requestBodyContentType : bodyMediaType, body, metadata.requestBodySerializer); + } else { + requestInfo.setContentFromScalar(requestAdapter, metadata.requestBodyContentType ? metadata.requestBodyContentType : bodyMediaType, body as PrimitiveTypesForDeserializationType); + } + } else if (metadata.requestInformationContentSetMethod === "setStreamContent") { + if (!body) throw new Error("body cannot be undefined"); + requestInfo.setStreamContent(body as ArrayBuffer, metadata.requestBodyContentType ? metadata.requestBodyContentType : bodyMediaType); + } + return requestInfo; } -function addAcceptHeaderIfPresent( - metadata: RequestMetadata, - requestInfo: RequestInformation, -): void { - if (metadata.responseBodyContentType) { - requestInfo.headers.tryAdd("Accept", metadata.responseBodyContentType); - } +function addAcceptHeaderIfPresent(metadata: RequestMetadata, requestInfo: RequestInformation): void { + if (metadata.responseBodyContentType) { + requestInfo.headers.tryAdd("Accept", metadata.responseBodyContentType); + } } -function getRequestMediaTypeUserDefinedValue( - requestMetadata: RequestMetadata, - args: any[], -) { - if ( - args.length > 2 && - !requestMetadata.requestBodySerializer && - requestMetadata.requestInformationContentSetMethod === "setStreamContent" - ) { - // request body with unknown media type so we have an argument for it. - return args[1]; - } - return undefined; +function getRequestMediaTypeUserDefinedValue(requestMetadata: RequestMetadata, args: any[]) { + if (args.length > 2 && !requestMetadata.requestBodySerializer && requestMetadata.requestInformationContentSetMethod === "setStreamContent") { + // request body with unknown media type so we have an argument for it. + return args[1]; + } + return undefined; } function getRequestConfigurationValue(args: any[]) { - if (args.length > 0) { - // request configuration is always the last argument - return args[args.length - 1]; - } - return undefined; + if (args.length > 0) { + // request configuration is always the last argument + return args[args.length - 1]; + } + return undefined; } -function send( - requestAdapter: RequestAdapter, - requestInfo: RequestInformation, - metadata: RequestMetadata, -) { - switch (metadata.adapterMethodName) { - case "send": - if (!metadata.responseBodyFactory) { - throw new Error("couldn't find response body factory"); - } - return requestAdapter.send( - requestInfo, - metadata.responseBodyFactory as ParsableFactory, - metadata.errorMappings, - ); - case "sendCollection": - if (!metadata.responseBodyFactory) { - throw new Error("couldn't find response body factory"); - } - return requestAdapter.sendCollection( - requestInfo, - metadata.responseBodyFactory as ParsableFactory, - metadata.errorMappings, - ); - case "sendEnum": - if (!metadata.enumObject) { - throw new Error("couldn't find response body factory"); - } - return requestAdapter.sendEnum( - requestInfo, - metadata.enumObject, - metadata.errorMappings, - ); - case "sendCollectionOfEnum": - if (!metadata.enumObject) { - throw new Error("couldn't find response body factory"); - } - return requestAdapter.sendCollectionOfEnum( - requestInfo, - metadata.enumObject, - metadata.errorMappings, - ); - case "sendCollectionOfPrimitive": - if (!metadata.responseBodyFactory) { - throw new Error("couldn't find response body factory"); - } - return requestAdapter.sendCollectionOfPrimitive( - requestInfo, - metadata.responseBodyFactory as Exclude< - PrimitiveTypesForDeserialization, - "ArrayBuffer" - >, - metadata.errorMappings, - ); - case "sendPrimitive": - if (!metadata.responseBodyFactory) { - throw new Error("couldn't find response body factory"); - } - return requestAdapter.sendPrimitive( - requestInfo, - metadata.responseBodyFactory as PrimitiveTypesForDeserialization, - metadata.errorMappings, - ); - case "sendNoResponseContent": - return requestAdapter.sendNoResponseContent( - requestInfo, - metadata.errorMappings, - ); - default: - throw new Error("couldn't find adapter method"); - } +function send(requestAdapter: RequestAdapter, requestInfo: RequestInformation, metadata: RequestMetadata) { + switch (metadata.adapterMethodName) { + case "send": + if (!metadata.responseBodyFactory) { + throw new Error("couldn't find response body factory"); + } + return requestAdapter.send(requestInfo, metadata.responseBodyFactory as ParsableFactory, metadata.errorMappings); + case "sendCollection": + if (!metadata.responseBodyFactory) { + throw new Error("couldn't find response body factory"); + } + return requestAdapter.sendCollection(requestInfo, metadata.responseBodyFactory as ParsableFactory, metadata.errorMappings); + case "sendEnum": + if (!metadata.enumObject) { + throw new Error("couldn't find response body factory"); + } + return requestAdapter.sendEnum(requestInfo, metadata.enumObject, metadata.errorMappings); + case "sendCollectionOfEnum": + if (!metadata.enumObject) { + throw new Error("couldn't find response body factory"); + } + return requestAdapter.sendCollectionOfEnum(requestInfo, metadata.enumObject, metadata.errorMappings); + case "sendCollectionOfPrimitive": + if (!metadata.responseBodyFactory) { + throw new Error("couldn't find response body factory"); + } + return requestAdapter.sendCollectionOfPrimitive(requestInfo, metadata.responseBodyFactory as Exclude, metadata.errorMappings); + case "sendPrimitive": + if (!metadata.responseBodyFactory) { + throw new Error("couldn't find response body factory"); + } + return requestAdapter.sendPrimitive(requestInfo, metadata.responseBodyFactory as PrimitiveTypesForDeserialization, metadata.errorMappings); + case "sendNoResponseContent": + return requestAdapter.sendNoResponseContent(requestInfo, metadata.errorMappings); + default: + throw new Error("couldn't find adapter method"); + } } -export function apiClientProxifier( - requestAdapter: RequestAdapter, - pathParameters: Record, - navigationMetadata?: Record, - requestsMetadata?: RequestsMetadata, -): T { - if (!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - if (!pathParameters) throw new Error("pathParameters cannot be undefined"); - return new Proxy({} as T, { - get(target, property) { - const name = String(property); - if (name === "withUrl") { - return (rawUrl: string) => { - if (!rawUrl) throw new Error("rawUrl cannot be undefined"); - return apiClientProxifier( - requestAdapter, - getPathParameters(rawUrl), - navigationMetadata, - requestsMetadata, - ); - }; - } - if (requestsMetadata) { - const metadataKey = getRequestMethod(name); - if (metadataKey) { - const metadata = requestsMetadata[metadataKey]; - if (metadata) { - switch (name) { - case "get": - return ( - requestConfiguration?: - | RequestConfiguration - | undefined, - ) => { - const requestInfo = toRequestInformation( - metadata.uriTemplate, - pathParameters, - metadata, - requestAdapter, - HttpMethod.GET, - undefined, - undefined, - requestConfiguration, - ); - return send(requestAdapter, requestInfo, metadata); - }; - case "patch": - return (...args: any[]) => { - const requestInfo = toRequestInformation( - metadata.uriTemplate, - pathParameters, - metadata, - requestAdapter, - HttpMethod.PATCH, - args.length > 0 ? args[0] : undefined, - getRequestMediaTypeUserDefinedValue(metadata, args), - getRequestConfigurationValue(args), - ); - return send(requestAdapter, requestInfo, metadata); - }; - case "put": - return (...args: any[]) => { - const requestInfo = toRequestInformation( - metadata.uriTemplate, - pathParameters, - metadata, - requestAdapter, - HttpMethod.PUT, - args.length > 0 ? args[0] : undefined, - getRequestMediaTypeUserDefinedValue(metadata, args), - getRequestConfigurationValue(args), - ); - return send(requestAdapter, requestInfo, metadata); - }; - case "delete": - return (...args: any[]) => { - const requestInfo = toRequestInformation( - metadata.uriTemplate, - pathParameters, - metadata, - requestAdapter, - HttpMethod.DELETE, - args.length > 0 ? args[0] : undefined, - getRequestMediaTypeUserDefinedValue(metadata, args), - getRequestConfigurationValue(args), - ); - return send(requestAdapter, requestInfo, metadata); - }; - case "post": - return (...args: any[]) => { - const requestInfo = toRequestInformation( - metadata.uriTemplate, - pathParameters, - metadata, - requestAdapter, - HttpMethod.POST, - args.length > 0 ? args[0] : undefined, - getRequestMediaTypeUserDefinedValue(metadata, args), - getRequestConfigurationValue(args), - ); - return send(requestAdapter, requestInfo, metadata); - }; - case "toGetRequestInformation": - return ( - requestConfiguration?: RequestConfiguration, - ) => { - return toRequestInformation( - metadata.uriTemplate, - pathParameters, - metadata, - requestAdapter, - HttpMethod.GET, - undefined, - undefined, - requestConfiguration, - ); - }; - case "toPatchRequestInformation": - return (...args: any[]) => { - return toRequestInformation( - metadata.uriTemplate, - pathParameters, - metadata, - requestAdapter, - HttpMethod.PATCH, - args.length > 0 ? args[0] : undefined, - getRequestMediaTypeUserDefinedValue(metadata, args), - getRequestConfigurationValue(args), - ); - }; - case "toPutRequestInformation": - return (...args: any[]) => { - return toRequestInformation( - metadata.uriTemplate, - pathParameters, - metadata, - requestAdapter, - HttpMethod.PUT, - args.length > 0 ? args[0] : undefined, - getRequestMediaTypeUserDefinedValue(metadata, args), - getRequestConfigurationValue(args), - ); - }; - case "toDeleteRequestInformation": - return (...args: any[]) => { - return toRequestInformation( - metadata.uriTemplate, - pathParameters, - metadata, - requestAdapter, - HttpMethod.DELETE, - args.length > 0 ? args[0] : undefined, - getRequestMediaTypeUserDefinedValue(metadata, args), - getRequestConfigurationValue(args), - ); - }; - case "toPostRequestInformation": - return (...args: any[]) => { - return toRequestInformation( - metadata.uriTemplate, - pathParameters, - metadata, - requestAdapter, - HttpMethod.POST, - args.length > 0 ? args[0] : undefined, - getRequestMediaTypeUserDefinedValue(metadata, args), - getRequestConfigurationValue(args), - ); - }; - default: - break; - } - } - } - } - if (navigationMetadata) { - const navigationCandidate = navigationMetadata[name]; - if (navigationCandidate) { - if ( - !navigationCandidate.pathParametersMappings || - navigationCandidate.pathParametersMappings.length === 0 - ) { - // navigation property - return apiClientProxifier( - requestAdapter, - getPathParameters(pathParameters), - navigationCandidate.navigationMetadata, - navigationCandidate.requestsMetadata, - ); - } - return (...argArray: any[]) => { - // navigation method like indexers or multiple path parameters - const downWardPathParameters = getPathParameters(pathParameters); - if ( - navigationCandidate.pathParametersMappings && - navigationCandidate.pathParametersMappings.length > 0 - ) { - for (let i = 0; i < argArray.length; i++) { - const element = argArray[i]; - downWardPathParameters[ - navigationCandidate.pathParametersMappings[i] - ] = element; - } - } - return apiClientProxifier( - requestAdapter, - downWardPathParameters, - navigationCandidate.navigationMetadata, - navigationCandidate.requestsMetadata, - ); - }; - } - throw new Error( - `couldn't find navigation property ${name} data: ${JSON.stringify( - navigationMetadata, - )}`, - ); - } - }, - }); +export function apiClientProxifier(requestAdapter: RequestAdapter, pathParameters: Record, navigationMetadata?: Record, requestsMetadata?: RequestsMetadata): T { + if (!requestAdapter) throw new Error("requestAdapter cannot be undefined"); + if (!pathParameters) throw new Error("pathParameters cannot be undefined"); + return new Proxy({} as T, { + get(target, property) { + const name = String(property); + if (name === "withUrl") { + return (rawUrl: string) => { + if (!rawUrl) throw new Error("rawUrl cannot be undefined"); + return apiClientProxifier(requestAdapter, getPathParameters(rawUrl), navigationMetadata, requestsMetadata); + }; + } + if (requestsMetadata) { + const metadataKey = getRequestMethod(name); + if (metadataKey) { + const metadata = requestsMetadata[metadataKey]; + if (metadata) { + switch (name) { + case "get": + return (requestConfiguration?: RequestConfiguration | undefined) => { + const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.GET, undefined, undefined, requestConfiguration); + return send(requestAdapter, requestInfo, metadata); + }; + case "patch": + return (...args: any[]) => { + const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.PATCH, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); + return send(requestAdapter, requestInfo, metadata); + }; + case "put": + return (...args: any[]) => { + const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.PUT, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); + return send(requestAdapter, requestInfo, metadata); + }; + case "delete": + return (...args: any[]) => { + const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.DELETE, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); + return send(requestAdapter, requestInfo, metadata); + }; + case "post": + return (...args: any[]) => { + const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.POST, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); + return send(requestAdapter, requestInfo, metadata); + }; + case "toGetRequestInformation": + return (requestConfiguration?: RequestConfiguration) => { + return toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.GET, undefined, undefined, requestConfiguration); + }; + case "toPatchRequestInformation": + return (...args: any[]) => { + return toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.PATCH, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); + }; + case "toPutRequestInformation": + return (...args: any[]) => { + return toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.PUT, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); + }; + case "toDeleteRequestInformation": + return (...args: any[]) => { + return toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.DELETE, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); + }; + case "toPostRequestInformation": + return (...args: any[]) => { + return toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.POST, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); + }; + default: + break; + } + } + } + } + if (navigationMetadata) { + const navigationCandidate = navigationMetadata[name]; + if (navigationCandidate) { + if (!navigationCandidate.pathParametersMappings || navigationCandidate.pathParametersMappings.length === 0) { + // navigation property + return apiClientProxifier(requestAdapter, getPathParameters(pathParameters), navigationCandidate.navigationMetadata, navigationCandidate.requestsMetadata); + } + return (...argArray: any[]) => { + // navigation method like indexers or multiple path parameters + const downWardPathParameters = getPathParameters(pathParameters); + if (navigationCandidate.pathParametersMappings && navigationCandidate.pathParametersMappings.length > 0) { + for (let i = 0; i < argArray.length; i++) { + const element = argArray[i]; + downWardPathParameters[navigationCandidate.pathParametersMappings[i]] = element; + } + } + return apiClientProxifier(requestAdapter, downWardPathParameters, navigationCandidate.navigationMetadata, navigationCandidate.requestsMetadata); + }; + } + throw new Error(`couldn't find navigation property ${name} data: ${JSON.stringify(navigationMetadata)}`); + } + }, + }); } export interface RequestMetadata { - requestBodyContentType?: string; - responseBodyContentType?: string; - errorMappings?: ErrorMappings; - adapterMethodName?: SendMethods; - responseBodyFactory?: - | ParsableFactory - | PrimitiveTypesForDeserialization; - requestBodySerializer?: - | ModelSerializerFunction - | PrimitiveTypesForDeserialization; - requestInformationContentSetMethod?: keyof RequestInformationSetContent; - queryParametersMapper?: Record; - uriTemplate: string; - enumObject?: EnumObject; + requestBodyContentType?: string; + responseBodyContentType?: string; + errorMappings?: ErrorMappings; + adapterMethodName?: SendMethods; + responseBodyFactory?: ParsableFactory | PrimitiveTypesForDeserialization; + requestBodySerializer?: ModelSerializerFunction | PrimitiveTypesForDeserialization; + requestInformationContentSetMethod?: keyof RequestInformationSetContent; + queryParametersMapper?: Record; + uriTemplate: string; + enumObject?: EnumObject; } export interface RequestsMetadata { - delete?: RequestMetadata; - get?: RequestMetadata; - head?: RequestMetadata; - options?: RequestMetadata; - patch?: RequestMetadata; - post?: RequestMetadata; - put?: RequestMetadata; + delete?: RequestMetadata; + get?: RequestMetadata; + head?: RequestMetadata; + options?: RequestMetadata; + patch?: RequestMetadata; + post?: RequestMetadata; + put?: RequestMetadata; } type KeysOfRequestsMetadata = keyof RequestsMetadata; export interface NavigationMetadata { - requestsMetadata?: RequestsMetadata; - navigationMetadata?: Record; - pathParametersMappings?: string[]; + requestsMetadata?: RequestsMetadata; + navigationMetadata?: Record; + pathParametersMappings?: string[]; } type EnumObject = Record> = T; -export type KeysToExcludeForNavigationMetadata = - | KeysOfRequestsMetadata - | "toDeleteRequestInformation" - | "toGetRequestInformation" - | "toHeadRequestInformation" - | "toOptionsRequestInformation" - | "toPatchRequestInformation" - | "toPostRequestInformation" - | "toPutRequestInformation" - | "withUrl"; +export type KeysToExcludeForNavigationMetadata = KeysOfRequestsMetadata | "toDeleteRequestInformation" | "toGetRequestInformation" | "toHeadRequestInformation" | "toOptionsRequestInformation" | "toPatchRequestInformation" | "toPostRequestInformation" | "toPutRequestInformation" | "withUrl"; diff --git a/packages/abstractions/src/apiError.ts b/packages/abstractions/src/apiError.ts index bea3dcb76..86c875f7d 100644 --- a/packages/abstractions/src/apiError.ts +++ b/packages/abstractions/src/apiError.ts @@ -1,16 +1,23 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /** Parent interface for errors thrown by the client when receiving failed responses to its requests. */ export interface ApiError extends Error { - /** The status code for the error. */ - responseStatusCode: number | undefined; + /** The status code for the error. */ + responseStatusCode: number | undefined; - /** The Response Headers. */ - responseHeaders: Record | undefined; + /** The Response Headers. */ + responseHeaders: Record | undefined; } /** Default error type used when no error mapping is registered for the status code */ export class DefaultApiError extends Error implements ApiError { - public constructor(message?: string) { - super(message); - } - public responseStatusCode: number | undefined; - public responseHeaders: Record | undefined = {}; + public constructor(message?: string) { + super(message); + } + public responseStatusCode: number | undefined; + public responseHeaders: Record | undefined = {}; } diff --git a/packages/abstractions/src/authentication/accessTokenProvider.ts b/packages/abstractions/src/authentication/accessTokenProvider.ts index 50ec0ebb2..400062d33 100644 --- a/packages/abstractions/src/authentication/accessTokenProvider.ts +++ b/packages/abstractions/src/authentication/accessTokenProvider.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { type AllowedHostsValidator } from "./allowedHostsValidator"; /** @@ -6,19 +12,16 @@ import { type AllowedHostsValidator } from "./allowedHostsValidator"; * to be used by an AuthenticationProvider implementation. */ export interface AccessTokenProvider { - /** - * Retrieves an access token for the given target URL. - * @param {string} url - The target URL. - * @param {Record} - The additional authentication context to pass to the authentication library. - * @returns {Promise} The access token. - */ - getAuthorizationToken: ( - url?: string, - additionalAuthenticationContext?: Record - ) => Promise; - /** - * Retrieves the allowed hosts validator. - * @returns {AllowedHostsValidator} The allowed hosts validator. - */ - getAllowedHostsValidator: () => AllowedHostsValidator; + /** + * Retrieves an access token for the given target URL. + * @param {string} url - The target URL. + * @param {Record} - The additional authentication context to pass to the authentication library. + * @returns {Promise} The access token. + */ + getAuthorizationToken: (url?: string, additionalAuthenticationContext?: Record) => Promise; + /** + * Retrieves the allowed hosts validator. + * @returns {AllowedHostsValidator} The allowed hosts validator. + */ + getAllowedHostsValidator: () => AllowedHostsValidator; } diff --git a/packages/abstractions/src/authentication/allowedHostsValidator.ts b/packages/abstractions/src/authentication/allowedHostsValidator.ts index 88486f29a..c717577c8 100644 --- a/packages/abstractions/src/authentication/allowedHostsValidator.ts +++ b/packages/abstractions/src/authentication/allowedHostsValidator.ts @@ -1,75 +1,83 @@ -/** Maintains a list of valid hosts and allows authentication providers to check whether a host is valid before authenticating a request */ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +/** Maintains a list of valid hosts and allows authentication providers to + * check whether a host is valid before authenticating a request */ +import { inNodeEnv } from "../utils"; + export class AllowedHostsValidator { - private allowedHosts: Set; - /** - * Creates a new AllowedHostsValidator object with provided values. - * @param allowedHosts A list of valid hosts. If the list is empty, all hosts are valid. - */ - public constructor(allowedHosts: Set = new Set()) { - this.validateHosts(allowedHosts); - this.allowedHosts = allowedHosts ?? new Set(); - } - /** - * Gets the list of valid hosts. If the list is empty, all hosts are valid. - * @returns A list of valid hosts. If the list is empty, all hosts are valid. - */ - public getAllowedHosts(): string[] { - return Array.from(this.allowedHosts); - } - /** - * Sets the list of valid hosts. If the list is empty, all hosts are valid. - * @param allowedHosts A list of valid hosts. If the list is empty, all hosts are valid. - */ - public setAllowedHosts(allowedHosts: Set): void { - this.validateHosts(allowedHosts); - this.allowedHosts = allowedHosts; - } - /** - * Checks whether the provided host is valid. - * @param url The url to check. - */ - public isUrlHostValid(url: string): boolean { - if (!url) return false; - if (this.allowedHosts.size === 0) return true; - const schemeAndRest = url.split("://"); - if (schemeAndRest.length >= 2) { - const rest = schemeAndRest[1]; - if (rest) { - return this.isHostAndPathValid(rest); - } - } else if (!url.startsWith("http")) { - // protocol relative URL domain.tld/path - return this.isHostAndPathValid(url); - } - //@ts-ignore - if (window && window.location && window.location.host) { - // we're in a browser, and we're using paths only ../path, ./path, /path, etc. - //@ts-ignore - return this.allowedHosts.has( - (window.location.host as string)?.toLowerCase() - ); - } - return false; - } - private isHostAndPathValid(rest: string): boolean { - const hostAndRest = rest.split("/"); - if (hostAndRest.length >= 2) { - const host = hostAndRest[0]; - if (host) { - return this.allowedHosts.has(host.toLowerCase()); - } - } - return false; - } + private allowedHosts: Set; + /** + * Creates a new AllowedHostsValidator object with provided values. + * @param allowedHosts A list of valid hosts. If the list is empty, all hosts are valid. + */ + public constructor(allowedHosts: Set = new Set()) { + this.validateHosts(allowedHosts); + this.allowedHosts = allowedHosts ?? new Set(); + } + /** + * Gets the list of valid hosts. If the list is empty, all hosts are valid. + * @returns A list of valid hosts. If the list is empty, all hosts are valid. + */ + public getAllowedHosts(): string[] { + return Array.from(this.allowedHosts); + } + /** + * Sets the list of valid hosts. If the list is empty, all hosts are valid. + * @param allowedHosts A list of valid hosts. If the list is empty, all hosts are valid. + */ + public setAllowedHosts(allowedHosts: Set): void { + this.validateHosts(allowedHosts); + this.allowedHosts = allowedHosts; + } + /** + * Checks whether the provided host is valid. + * @param url The url to check. + */ + public isUrlHostValid(url: string): boolean { + if (!url) return false; + if (this.allowedHosts.size === 0) return true; + const schemeAndRest = url.split("://"); + if (schemeAndRest.length >= 2) { + const rest = schemeAndRest[1]; + if (rest) { + return this.isHostAndPathValid(rest); + } + } else if (!url.startsWith("http")) { + // protocol relative URL domain.tld/path + return this.isHostAndPathValid(url); + } + // @ts-ignore + if (window && window.location && window.location.host) { + // we're in a browser, and we're using paths only ../path, ./path, /path, etc. + // @ts-ignore + return this.allowedHosts.has(window.location.host?.toLowerCase()); + } + return false; + } + private isHostAndPathValid(rest: string): boolean { + const hostAndRest = rest.split("/"); + if (hostAndRest.length >= 2) { + const host = hostAndRest[0]; + if (host) { + return this.allowedHosts.has(host.toLowerCase()); + } + } + return false; + } - private validateHosts(hostsToValidate: Set) { - if(!hostsToValidate) { - throw new Error("hostsToValidate cannot be null"); - } - hostsToValidate.forEach(host => { - if(host.toLowerCase().startsWith("http://") || host.toLowerCase().startsWith("https://")) { - throw new Error("host should not contain http or https prefix"); - } - }); - } + private validateHosts(hostsToValidate: Set) { + if (!hostsToValidate) { + throw new Error("hostsToValidate cannot be null"); + } + hostsToValidate.forEach((host) => { + if (host.toLowerCase().startsWith("http://") || host.toLowerCase().startsWith("https://")) { + throw new Error("host should not contain http or https prefix"); + } + }); + } } diff --git a/packages/abstractions/src/authentication/anonymousAuthenticationProvider.ts b/packages/abstractions/src/authentication/anonymousAuthenticationProvider.ts index ebff44f7c..854157667 100644 --- a/packages/abstractions/src/authentication/anonymousAuthenticationProvider.ts +++ b/packages/abstractions/src/authentication/anonymousAuthenticationProvider.ts @@ -1,14 +1,20 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { type RequestInformation } from "../requestInformation"; import { type AuthenticationProvider } from "./authenticationProvider"; /** This authentication provider does not perform any authentication. */ export class AnonymousAuthenticationProvider implements AuthenticationProvider { - public authenticateRequest = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _: RequestInformation, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _2?: Record - ): Promise => { - return Promise.resolve(); - }; + public authenticateRequest = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _: RequestInformation, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _2?: Record, + ): Promise => { + return Promise.resolve(); + }; } diff --git a/packages/abstractions/src/authentication/apiKeyAuthenticationProvider.ts b/packages/abstractions/src/authentication/apiKeyAuthenticationProvider.ts index 66b9db8e3..70462d939 100644 --- a/packages/abstractions/src/authentication/apiKeyAuthenticationProvider.ts +++ b/packages/abstractions/src/authentication/apiKeyAuthenticationProvider.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { type RequestInformation } from "../requestInformation"; import { AllowedHostsValidator } from "./allowedHostsValidator"; import type { AuthenticationProvider } from "./authenticationProvider"; @@ -5,63 +11,56 @@ import { validateProtocol } from "./validateProtocol"; /** Authenticate a request by using an API Key */ export class ApiKeyAuthenticationProvider implements AuthenticationProvider { - private readonly validator: AllowedHostsValidator; - /** - * @constructor Creates an instance of ApiKeyAuthenticationProvider - * @param apiKey The API Key to use for authentication - * @param parameterName The name of the parameter to use for authentication - * @param location The location of the parameter to use for authentication - * @param validHosts The hosts that are allowed to use this authentication provider - */ - public constructor( - private readonly apiKey: string, - private readonly parameterName: string, - private readonly location: ApiKeyLocation, - validHosts?: Set - ) { - if (apiKey === undefined || apiKey === "") { - throw new Error("apiKey cannot be null or empty"); - } - if (parameterName === undefined || parameterName === "") { - throw new Error("parameterName cannot be null or empty"); - } - if ( - location !== ApiKeyLocation.QueryParameter && - location !== ApiKeyLocation.Header - ) { - throw new Error("location must be either QueryParameter or Header"); - } - this.validator = new AllowedHostsValidator(validHosts); - } - public authenticateRequest( - request: RequestInformation, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - additionalAuthenticationContext?: Record | undefined - ): Promise { - const url = request.URL; - if (!url || !this.validator.isUrlHostValid(url)) { - return Promise.resolve(); - } - validateProtocol(url); - switch (this.location) { - case ApiKeyLocation.QueryParameter: - request.URL += - (url.indexOf("?") === -1 ? "?" : "&") + - this.parameterName + - "=" + - this.apiKey; - break; - case ApiKeyLocation.Header: - request.headers.add(this.parameterName, this.apiKey); - break; - } - return Promise.resolve(); - } + private readonly validator: AllowedHostsValidator; + /** + * @constructor Creates an instance of ApiKeyAuthenticationProvider + * @param apiKey The API Key to use for authentication + * @param parameterName The name of the parameter to use for authentication + * @param location The location of the parameter to use for authentication + * @param validHosts The hosts that are allowed to use this authentication provider + */ + public constructor( + private readonly apiKey: string, + private readonly parameterName: string, + private readonly location: ApiKeyLocation, + validHosts?: Set, + ) { + if (apiKey === undefined || apiKey === "") { + throw new Error("apiKey cannot be null or empty"); + } + if (parameterName === undefined || parameterName === "") { + throw new Error("parameterName cannot be null or empty"); + } + if (location !== ApiKeyLocation.QueryParameter && location !== ApiKeyLocation.Header) { + throw new Error("location must be either QueryParameter or Header"); + } + this.validator = new AllowedHostsValidator(validHosts); + } + public authenticateRequest( + request: RequestInformation, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + additionalAuthenticationContext?: Record | undefined, + ): Promise { + const url = request.URL; + if (!url || !this.validator.isUrlHostValid(url)) { + return Promise.resolve(); + } + validateProtocol(url); + switch (this.location) { + case ApiKeyLocation.QueryParameter: + request.URL += (url.indexOf("?") === -1 ? "?" : "&") + this.parameterName + "=" + this.apiKey; + break; + case ApiKeyLocation.Header: + request.headers.add(this.parameterName, this.apiKey); + break; + } + return Promise.resolve(); + } } /** The location for the API key */ export enum ApiKeyLocation { - /** The API key is in the query parameters */ - QueryParameter, - /** The API key is in the headers */ - Header, + /** The API key is in the query parameters */ + QueryParameter, + /** The API key is in the headers */ + Header, } diff --git a/packages/abstractions/src/authentication/authenticationProvider.ts b/packages/abstractions/src/authentication/authenticationProvider.ts index f2c16b553..4219e2bb8 100644 --- a/packages/abstractions/src/authentication/authenticationProvider.ts +++ b/packages/abstractions/src/authentication/authenticationProvider.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { type RequestInformation } from "../requestInformation"; /** @@ -6,14 +12,11 @@ import { type RequestInformation } from "../requestInformation"; * @property {Function} authenticateRequest - The function to authenticate the request. */ export interface AuthenticationProvider { - /** - * Authenticates the application and returns a token base on the provided Uri. - * @param request the request to authenticate. - * @param {Record} - The additional authentication context to pass to the authentication library. - * @return a Promise to await for the authentication to be completed. - */ - authenticateRequest: ( - request: RequestInformation, - additionalAuthenticationContext?: Record - ) => Promise; + /** + * Authenticates the application and returns a token base on the provided Uri. + * @param request the request to authenticate. + * @param {Record} - The additional authentication context to pass to the authentication library. + * @return a Promise to await for the authentication to be completed. + */ + authenticateRequest: (request: RequestInformation, additionalAuthenticationContext?: Record) => Promise; } diff --git a/packages/abstractions/src/authentication/baseBearerTokenAuthenticationProvider.ts b/packages/abstractions/src/authentication/baseBearerTokenAuthenticationProvider.ts index 224c5f454..45ab08484 100644 --- a/packages/abstractions/src/authentication/baseBearerTokenAuthenticationProvider.ts +++ b/packages/abstractions/src/authentication/baseBearerTokenAuthenticationProvider.ts @@ -1,57 +1,39 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { Headers } from "../headers"; import { type RequestInformation } from "../requestInformation"; import type { AccessTokenProvider } from "./accessTokenProvider"; import type { AuthenticationProvider } from "./authenticationProvider"; /** Provides a base class for implementing AuthenticationProvider for Bearer token scheme. */ -export class BaseBearerTokenAuthenticationProvider - implements AuthenticationProvider { - private static readonly authorizationHeaderKey = "Authorization"; +export class BaseBearerTokenAuthenticationProvider implements AuthenticationProvider { + private static readonly authorizationHeaderKey = "Authorization"; - /** - * - * @param accessTokenProvider - */ - public constructor( - public readonly accessTokenProvider: AccessTokenProvider - ) {} + /** + * + * @param accessTokenProvider + */ + public constructor(public readonly accessTokenProvider: AccessTokenProvider) {} - public authenticateRequest = async ( - request: RequestInformation, - additionalAuthenticationContext?: Record - ): Promise => { - if (!request) { - throw new Error("request info cannot be null"); - } - if ( - additionalAuthenticationContext && - additionalAuthenticationContext["claims"] && - request.headers.has( - BaseBearerTokenAuthenticationProvider.authorizationHeaderKey - ) - ) { - request.headers.delete( - BaseBearerTokenAuthenticationProvider.authorizationHeaderKey - ); - } - if ( - !request.headers || - !request.headers.has( - BaseBearerTokenAuthenticationProvider.authorizationHeaderKey - ) - ) { - const token = await this.accessTokenProvider.getAuthorizationToken( - request.URL, - additionalAuthenticationContext - ); - if (!request.headers) { - request.headers = new Headers(); - } - if (token) { - request.headers.add( - BaseBearerTokenAuthenticationProvider.authorizationHeaderKey, - `Bearer ${token}`); - } - } - }; + public authenticateRequest = async (request: RequestInformation, additionalAuthenticationContext?: Record): Promise => { + if (!request) { + throw new Error("request info cannot be null"); + } + if (additionalAuthenticationContext?.claims && request.headers.has(BaseBearerTokenAuthenticationProvider.authorizationHeaderKey)) { + request.headers.delete(BaseBearerTokenAuthenticationProvider.authorizationHeaderKey); + } + if (!request.headers || !request.headers.has(BaseBearerTokenAuthenticationProvider.authorizationHeaderKey)) { + const token = await this.accessTokenProvider.getAuthorizationToken(request.URL, additionalAuthenticationContext); + if (!request.headers) { + request.headers = new Headers(); + } + if (token) { + request.headers.add(BaseBearerTokenAuthenticationProvider.authorizationHeaderKey, `Bearer ${token}`); + } + } + }; } diff --git a/packages/abstractions/src/authentication/index.ts b/packages/abstractions/src/authentication/index.ts index ba226dcb0..f9c173d2d 100644 --- a/packages/abstractions/src/authentication/index.ts +++ b/packages/abstractions/src/authentication/index.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ export * from "./accessTokenProvider"; export * from "./allowedHostsValidator"; export * from "./apiKeyAuthenticationProvider"; diff --git a/packages/abstractions/src/authentication/validateProtocol.ts b/packages/abstractions/src/authentication/validateProtocol.ts index a4baf0bc7..1aededf22 100644 --- a/packages/abstractions/src/authentication/validateProtocol.ts +++ b/packages/abstractions/src/authentication/validateProtocol.ts @@ -1,20 +1,29 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { inNodeEnv } from "../utils"; const localhostStrings: Set = new Set(["localhost", "[::1]", "::1", "127.0.0.1"]); export function validateProtocol(url: string): void { - if(!isLocalhostUrl(url) && !url.toLocaleLowerCase().startsWith("https://") && !windowUrlStartsWithHttps()) { - throw new Error("Authentication scheme can only be used with https requests"); - } + if (!isLocalhostUrl(url) && !url.toLocaleLowerCase().startsWith("https://") && !windowUrlStartsWithHttps()) { + throw new Error("Authentication scheme can only be used with https requests"); + } } function windowUrlStartsWithHttps(): boolean { - // @ts-ignore - return typeof window !== "undefined" && typeof window.location !== "undefined" && (window.location.protocol as string).toLowerCase() !== "https:"; + if (!inNodeEnv()) { + return window.location.protocol.toLocaleLowerCase() === "https:"; + } + return false; } export function isLocalhostUrl(urlString: string): boolean { - try { - const url = new URL(urlString); - return localhostStrings.has(url.hostname); - } catch (e) { - return false; - } -} \ No newline at end of file + try { + const url = new URL(urlString); + return localhostStrings.has(url.hostname); + } catch (e) { + return false; + } +} diff --git a/packages/abstractions/src/baseRequestBuilder.ts b/packages/abstractions/src/baseRequestBuilder.ts index 92915c9f7..73341c129 100644 --- a/packages/abstractions/src/baseRequestBuilder.ts +++ b/packages/abstractions/src/baseRequestBuilder.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ export interface BaseRequestBuilder { - withUrl(rawUrl: string): T; + withUrl(rawUrl: string): T; } diff --git a/packages/abstractions/src/dateOnly.ts b/packages/abstractions/src/dateOnly.ts index 288efb84b..9e674c143 100644 --- a/packages/abstractions/src/dateOnly.ts +++ b/packages/abstractions/src/dateOnly.ts @@ -1,102 +1,100 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /** * Represents a date only. ISO 8601. */ export class DateOnly implements DateOnlyInterface { - /** - * Creates a new DateOnly from the given string. - * @returns The new DateOnly - * @throws An error if the year is invalid - * @throws An error if the month is invalid - * @throws An error if the day is invalid - */ - public constructor({ - year = 0, - month = 1, - day = 1, - }: Partial) { - this.day = day; - this.month = month; - this.year = year; - } - public year: number; - public month: number; - public day: number; - /** - * Creates a new DateOnly from the given date. - * @param date The date - * @returns The new DateOnly - * @throws An error if the date is invalid - */ - public static fromDate(date: Date): DateOnly { - if (!date) { - throw new Error("Date cannot be undefined"); - } - const result = new DateOnly({ - year: date.getFullYear(), - month: date.getMonth() + 1, - day: date.getDate(), - }); - return result; - } - /** - * Parses a string into a DateOnly. The string can be of the ISO 8601 time only format or a number representing the ticks of a Date. - * @param value The value to parse - * @returns The parsed DateOnly. - * @throws An error if the value is invalid - */ - public static parse(value: string | undefined): DateOnly | undefined { - if (!value || value.length === 0) { - return undefined; - } - const exec = - /^(?\d{4,})-(?0[1-9]|1[012])-(?0[1-9]|[12]\d|3[01])$/gi.exec( - value - ); - if (exec) { - const year = parseInt(exec.groups?.year ?? "", 10); - const month = parseInt(exec.groups?.month ?? "", 10); - const day = parseInt(exec.groups?.day ?? "", 10); - return new DateOnly({ year, month, day }); - } - const ticks = Date.parse(value); - if (!isNaN(ticks)) { - const date = new Date(ticks); - return this.fromDate(date); - } - throw new Error(`Value is not a valid date-only representation: ${value}`); - } - /** - * Returns a string representation of the date in the format YYYY-MM-DD - * @returns The date in the format YYYY-MM-DD ISO 8601 - */ - public toString(): string { - return `${formatSegment(this.year, 4)}-${formatSegment( - this.month - )}-${formatSegment(this.day)}`; - } + /** + * Creates a new DateOnly from the given string. + * @returns The new DateOnly + * @throws An error if the year is invalid + * @throws An error if the month is invalid + * @throws An error if the day is invalid + */ + public constructor({ year = 0, month = 1, day = 1 }: Partial) { + this.day = day; + this.month = month; + this.year = year; + } + public year: number; + public month: number; + public day: number; + /** + * Creates a new DateOnly from the given date. + * @param date The date + * @returns The new DateOnly + * @throws An error if the date is invalid + */ + public static fromDate(date: Date): DateOnly { + if (!date) { + throw new Error("Date cannot be undefined"); + } + const result = new DateOnly({ + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate(), + }); + return result; + } + /** + * Parses a string into a DateOnly. The string can be of the ISO 8601 time only format or a number representing the ticks of a Date. + * @param value The value to parse + * @returns The parsed DateOnly. + * @throws An error if the value is invalid + */ + public static parse(value: string | undefined): DateOnly | undefined { + if (!value || value.length === 0) { + return undefined; + } + const exec = /^(?\d{4,})-(?0[1-9]|1[012])-(?0[1-9]|[12]\d|3[01])$/gi.exec(value); + if (exec) { + const year = parseInt(exec.groups?.year ?? "", 10); + const month = parseInt(exec.groups?.month ?? "", 10); + const day = parseInt(exec.groups?.day ?? "", 10); + return new DateOnly({ year, month, day }); + } + const ticks = Date.parse(value); + if (!isNaN(ticks)) { + const date = new Date(ticks); + return this.fromDate(date); + } + throw new Error(`Value is not a valid date-only representation: ${value}`); + } + /** + * Returns a string representation of the date in the format YYYY-MM-DD + * @returns The date in the format YYYY-MM-DD ISO 8601 + */ + public toString(): string { + return `${formatSegment(this.year, 4)}-${formatSegment(this.month)}-${formatSegment(this.day)}`; + } } interface DateOnlyInterface { - /** - * The year - * @default 0 - * @minium 0 - */ - year: number; - /** - * The month - * @default 1 - * @minium 1 - * @maximum 12 - */ - month: number; - /** - * The day - * @default 1 - * @minium 1 - * @maximum 31 - */ - day: number; + /** + * The year + * @default 0 + * @minium 0 + */ + year: number; + /** + * The month + * @default 1 + * @minium 1 + * @maximum 12 + */ + month: number; + /** + * The day + * @default 1 + * @minium 1 + * @maximum 31 + */ + day: number; } export function formatSegment(segment: number, digits = 2): string { - return segment.toString().padStart(digits, "0"); + return segment.toString().padStart(digits, "0"); } diff --git a/packages/abstractions/src/duration.ts b/packages/abstractions/src/duration.ts index d30a0b146..dd4df1805 100644 --- a/packages/abstractions/src/duration.ts +++ b/packages/abstractions/src/duration.ts @@ -1,144 +1,139 @@ -import { - parse as parseDuration, - serialize as serializeDuration, -} from "tinyduration"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { parse as parseDuration, serialize as serializeDuration } from "tinyduration"; + /** * Represents a duration value. ISO 8601. */ export class Duration implements DurationInterface { - /** - * Creates a new Duration value from the given parameters. - * @returns The new Duration - * @throws An error if years is invalid - * @throws An error if months is invalid - * @throws An error if weeks is invalid - * @throws An error if days is invalid - * @throws An error if hours is invalid - * @throws An error if minutes is invalid - * @throws An error if seconds is invalid - * @throws An error if weeks is used in combination with years or months - */ - public constructor({ - years = 0, - months = 0, - weeks = 0, - days = 0, - hours = 0, - minutes = 0, - seconds = 0, - negative = false, - }: Partial) { - if (years < 0 || years > 9999) { - throw new Error("Year must be between 0 and 9999"); - } - if (months < 0 || months > 11) { - throw new Error("Month must be between 0 and 11"); - } - if (weeks < 0 || weeks > 53) { - throw new Error("Week must be between 0 and 53"); - } - if (days < 0 || days > 6) { - throw new Error("Day must be between 0 and 6"); - } - if (hours < 0 || hours > 23) { - throw new Error("Hour must be between 0 and 23"); - } - if (minutes < 0 || minutes > 59) { - throw new Error("Minute must be between 0 and 59"); - } - if (seconds < 0 || seconds > 59) { - throw new Error("Second must be between 0 and 59"); - } - if ((years > 0 || months > 0) && weeks > 0) { - throw new Error("Cannot have weeks and months or weeks and years"); - } - this.years = years; - this.months = months; - this.weeks = weeks; - this.days = days; - this.hours = hours; - this.minutes = minutes; - this.seconds = seconds; - this.negative = negative; - } - public years: number; - public months: number; - public weeks: number; - public days: number; - public hours: number; - public minutes: number; - public seconds: number; - public negative: boolean; - /** - * Parses a string into a Duration. The string can be of the ISO 8601 duration format. - * @param value The value to parse - * @returns The parsed Duration. - * @throws An error if the value is invalid - */ - public static parse(value: string | undefined): Duration | undefined { - if (!value || value.length === 0) { - return undefined; - } - const duration = parseDuration(value); - return new Duration({ - years: duration.years ?? 0, - months: duration.months ?? 0, - weeks: duration.weeks ?? 0, - days: duration.days ?? 0, - hours: duration.hours ?? 0, - minutes: duration.minutes ?? 0, - seconds: duration.seconds ?? 0, - negative: duration.negative ?? false, - }); - } - /** - * Serializes the duration to a string in the ISO 8601 duration format. - * @returns The serialized duration. - */ - public toString(): string { - return serializeDuration(this); - } + /** + * Creates a new Duration value from the given parameters. + * @returns The new Duration + * @throws An error if years is invalid + * @throws An error if months is invalid + * @throws An error if weeks is invalid + * @throws An error if days is invalid + * @throws An error if hours is invalid + * @throws An error if minutes is invalid + * @throws An error if seconds is invalid + * @throws An error if weeks is used in combination with years or months + */ + public constructor({ years = 0, months = 0, weeks = 0, days = 0, hours = 0, minutes = 0, seconds = 0, negative = false }: Partial) { + if (years < 0 || years > 9999) { + throw new Error("Year must be between 0 and 9999"); + } + if (months < 0 || months > 11) { + throw new Error("Month must be between 0 and 11"); + } + if (weeks < 0 || weeks > 53) { + throw new Error("Week must be between 0 and 53"); + } + if (days < 0 || days > 6) { + throw new Error("Day must be between 0 and 6"); + } + if (hours < 0 || hours > 23) { + throw new Error("Hour must be between 0 and 23"); + } + if (minutes < 0 || minutes > 59) { + throw new Error("Minute must be between 0 and 59"); + } + if (seconds < 0 || seconds > 59) { + throw new Error("Second must be between 0 and 59"); + } + if ((years > 0 || months > 0) && weeks > 0) { + throw new Error("Cannot have weeks and months or weeks and years"); + } + this.years = years; + this.months = months; + this.weeks = weeks; + this.days = days; + this.hours = hours; + this.minutes = minutes; + this.seconds = seconds; + this.negative = negative; + } + public years: number; + public months: number; + public weeks: number; + public days: number; + public hours: number; + public minutes: number; + public seconds: number; + public negative: boolean; + /** + * Parses a string into a Duration. The string can be of the ISO 8601 duration format. + * @param value The value to parse + * @returns The parsed Duration. + * @throws An error if the value is invalid + */ + public static parse(value: string | undefined): Duration | undefined { + if (!value || value.length === 0) { + return undefined; + } + const duration = parseDuration(value); + return new Duration({ + years: duration.years ?? 0, + months: duration.months ?? 0, + weeks: duration.weeks ?? 0, + days: duration.days ?? 0, + hours: duration.hours ?? 0, + minutes: duration.minutes ?? 0, + seconds: duration.seconds ?? 0, + negative: duration.negative ?? false, + }); + } + /** + * Serializes the duration to a string in the ISO 8601 duration format. + * @returns The serialized duration. + */ + public toString(): string { + return serializeDuration(this); + } } interface DurationInterface { - /** - * Years of the duration - * @default 0 - */ - years: number; - /** - * Months of the duration - * @default 0 - */ - months: number; - /** - * Weeks of the duration, can't be used together with years or months - * @default 0 - */ - weeks: number; - /** - * Days of the duration - * @default 0 - */ - days: number; - /** - * Hours of the duration - * @default 0 - */ - hours: number; - /** - * Minutes of the duration - * @default 0 - */ - minutes: number; - /** - * Seconds of the duration - * @default 0 - */ - seconds: number; - /** - * Whether the duration is negative - * @default false - */ - negative: boolean; + /** + * Years of the duration + * @default 0 + */ + years: number; + /** + * Months of the duration + * @default 0 + */ + months: number; + /** + * Weeks of the duration, can't be used together with years or months + * @default 0 + */ + weeks: number; + /** + * Days of the duration + * @default 0 + */ + days: number; + /** + * Hours of the duration + * @default 0 + */ + hours: number; + /** + * Minutes of the duration + * @default 0 + */ + minutes: number; + /** + * Seconds of the duration + * @default 0 + */ + seconds: number; + /** + * Whether the duration is negative + * @default false + */ + negative: boolean; } diff --git a/packages/abstractions/src/getPathParameters.ts b/packages/abstractions/src/getPathParameters.ts index 781804792..25285d269 100644 --- a/packages/abstractions/src/getPathParameters.ts +++ b/packages/abstractions/src/getPathParameters.ts @@ -1,15 +1,19 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { RequestInformation } from "./requestInformation"; -export function getPathParameters( - parameters: Record | string | undefined, -): Record { - const result: Record = {}; - if (typeof parameters === "string") { - result[RequestInformation.raw_url_key] = parameters; - } else if (parameters) { - for (const key in parameters) { - result[key] = parameters[key]; - } - } - return result; +export function getPathParameters(parameters: Record | string | undefined): Record { + const result: Record = {}; + if (typeof parameters === "string") { + result[RequestInformation.raw_url_key] = parameters; + } else if (parameters) { + for (const key in parameters) { + result[key] = parameters[key]; + } + } + return result; } diff --git a/packages/abstractions/src/headers.ts b/packages/abstractions/src/headers.ts index bebdba80d..41d93c08c 100644 --- a/packages/abstractions/src/headers.ts +++ b/packages/abstractions/src/headers.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { createRecordWithCaseInsensitiveKeys } from "./recordWithCaseInsensitiveKeys"; /** @@ -10,265 +16,247 @@ import { createRecordWithCaseInsensitiveKeys } from "./recordWithCaseInsensitive * ``` */ export class Headers extends Map> { - private headers: Record> = - createRecordWithCaseInsensitiveKeys>(); - private singleValueHeaders: Set = new Set([ - "Content-Type", - "Content-Encoding", - "Content-Length", - ]); + private headers: Record> = createRecordWithCaseInsensitiveKeys>(); + private readonly singleValueHeaders = new Set(["Content-Type", "Content-Encoding", "Content-Length"]); - /** - * Creates a new Headers object. - * @param entries An iterable object that contains key-value pairs. Each key-value pair must be an array with two elements: the key of the header, and the value of the header. - * @example - * ```typescript - * const entries: [string, Set][] = [ - * ['header1', new Set(['value1'])], - * ['header2', new Set(['value2', 'value3'])] - * ]; - * const headers = new Headers(entries); - * ``` - */ - public constructor( - entries?: readonly (readonly [string, Set])[] | null, - ) { - super(); - if (entries) { - entries.forEach(([key, value]) => { - this.headers[key] = value; - }); - } - } + /** + * Creates a new Headers object. + * @param entries An iterable object that contains key-value pairs. Each key-value pair must be an array with two elements: the key of the header, and the value of the header. + * @example + * ```typescript + * const entries: [string, Set][] = [ + * ['header1', new Set(['value1'])], + * ['header2', new Set(['value2', 'value3'])] + * ]; + * const headers = new Headers(entries); + * ``` + */ + public constructor(entries?: readonly (readonly [string, Set])[] | null) { + super(); + if (entries) { + entries.forEach(([key, value]) => { + this.headers[key] = value; + }); + } + } - /** - * Sets a header with the specified name and value. If a header with the same name already exists, its value is appended with the specified value. - * @param headerName the name of the header to set - * @param headerValue the value of the header to set - * @returns Headers object - */ - public set(headerName: string, headerValue: Set): this { - this.add(headerName, ...headerValue); - return this; - } + /** + * Sets a header with the specified name and value. If a header with the same name already exists, its value is appended with the specified value. + * @param headerName the name of the header to set + * @param headerValue the value of the header to set + * @returns Headers object + */ + public set(headerName: string, headerValue: Set): this { + this.add(headerName, ...headerValue); + return this; + } - /** - * Gets the values for the header with the specified name. - * @param headerName The name of the header to get the values for. - * @returns The values for the header with the specified name. - * @throws Error if headerName is null or empty - */ - public get(headerName: string): Set | undefined { - if (!headerName) { - throw new Error("headerName cannot be null or empty"); - } - return this.headers[headerName]; - } + /** + * Gets the values for the header with the specified name. + * @param headerName The name of the header to get the values for. + * @returns The values for the header with the specified name. + * @throws Error if headerName is null or empty + */ + public get(headerName: string): Set | undefined { + if (!headerName) { + throw new Error("headerName cannot be null or empty"); + } + return this.headers[headerName]; + } - /** - * Checks if a header exists. - * @param key The name of the header to check for. - */ - public has(key: string): boolean { - return !!key && !!this.headers[key]; - } + /** + * Checks if a header exists. + * @param key The name of the header to check for. + */ + public has(key: string): boolean { + return !!key && !!this.headers[key]; + } - /** - * Delete the header with the specified name. - * @param headerName The name of the header to delete. - * @returns Whether or not the header existed and was deleted. - * @throws Error if headerName is null or empty - */ - public delete(headerName: string): boolean { - if (!headerName) { - throw new Error("headerName cannot be null or empty"); - } - if (this.headers[headerName]) { - delete this.headers[headerName]; - return true; - } - return false; - } + /** + * Delete the header with the specified name. + * @param headerName The name of the header to delete. + * @returns Whether or not the header existed and was deleted. + * @throws Error if headerName is null or empty + */ + public delete(headerName: string): boolean { + if (!headerName) { + throw new Error("headerName cannot be null or empty"); + } + if (this.headers[headerName]) { + delete this.headers[headerName]; + return true; + } + return false; + } - /** - * clear the headers collection - */ - public clear(): void { - for (const header in this.headers) { - delete this.headers[header]; - } - } + /** + * clear the headers collection + */ + public clear(): void { + for (const header in this.headers) { + delete this.headers[header]; + } + } - /** - * execute a provided function once per each header - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each header in the dictionary. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - public forEach( - callbackfn: ( - value: Set, - key: string, - map: Map>, - ) => void, - thisArg?: any, - ): void { - for (const header in this.headers) { - callbackfn.call(thisArg, this.headers[header], header, this); - } - } + /** + * execute a provided function once per each header + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each header in the dictionary. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + public forEach(callbackfn: (value: Set, key: string, map: Map>) => void, thisArg?: any): void { + for (const header in this.headers) { + callbackfn.call(thisArg, this.headers[header], header, this); + } + } - /** - * Adds values to the header with the specified name. - * @param headerName The name of the header to add values to. - * @param headerValues The values to add to the header. - * @returns Whether or not the values were added to the header. - */ - public add(headerName: string, ...headerValues: string[]): boolean { - if (!headerName) { - console.error("headerName cannot be null or empty"); - return false; - } - if (!headerValues) { - console.error("headerValues cannot be null"); - return false; - } - if (headerValues.length === 0) { - return false; - } - if (this.singleValueHeaders.has(headerName)) { - this.headers[headerName] = new Set([headerValues[0]]); - } else if (this.headers[headerName]) { - headerValues.forEach((headerValue) => - this.headers[headerName].add(headerValue), - ); - } else { - this.headers[headerName] = new Set(headerValues); - } - return true; - } + /** + * Adds values to the header with the specified name. + * @param headerName The name of the header to add values to. + * @param headerValues The values to add to the header. + * @returns Whether or not the values were added to the header. + */ + public add(headerName: string, ...headerValues: string[]): boolean { + if (!headerName) { + console.error("headerName cannot be null or empty"); + return false; + } + if (!headerValues) { + console.error("headerValues cannot be null"); + return false; + } + if (headerValues.length === 0) { + return false; + } + if (this.singleValueHeaders.has(headerName)) { + this.headers[headerName] = new Set([headerValues[0]]); + } else if (this.headers[headerName]) { + headerValues.forEach((headerValue) => this.headers[headerName].add(headerValue)); + } else { + this.headers[headerName] = new Set(headerValues); + } + return true; + } - /** - * Adds values to the header with the specified name if it's not already present - * @param headerName The name of the header to add values to. - * @param headerValue The values to add to the header. - * @returns If the headerValue have been added to the Dictionary. - */ - public tryAdd(headerName: string, headerValue: string): boolean { - if (!headerName) { - throw new Error("headerName cannot be null or empty"); - } - if (!headerValue) { - throw new Error("headerValue cannot be null"); - } - if (!this.headers[headerName]) { - this.headers[headerName] = new Set([headerValue]); - return true; - } - return false; - } + /** + * Adds values to the header with the specified name if it's not already present + * @param headerName The name of the header to add values to. + * @param headerValue The values to add to the header. + * @returns If the headerValue have been added to the Dictionary. + */ + public tryAdd(headerName: string, headerValue: string): boolean { + if (!headerName) { + throw new Error("headerName cannot be null or empty"); + } + if (!headerValue) { + throw new Error("headerValue cannot be null"); + } + if (!this.headers[headerName]) { + this.headers[headerName] = new Set([headerValue]); + return true; + } + return false; + } - /** - * Removes the specified value from the header with the specified name. - * @param headerName The name of the header to remove the value from. - * @param headerValue The value to remove from the header. - * @returns Whether or not the header existed and was removed. - * @throws Error if headerName is null or empty - * @throws Error if headerValue is null - */ - public remove(headerName: string, headerValue: string): boolean { - if (!headerName) { - throw new Error("headerName cannot be null or empty"); - } - if (!headerValue) { - throw new Error("headerValue cannot be null"); - } - if (this.headers[headerName]) { - const result = this.headers[headerName].delete(headerValue); - if (this.headers[headerName].size === 0) { - delete this.headers[headerName]; - } - return result; - } - return false; - } + /** + * Removes the specified value from the header with the specified name. + * @param headerName The name of the header to remove the value from. + * @param headerValue The value to remove from the header. + * @returns Whether or not the header existed and was removed. + * @throws Error if headerName is null or empty + * @throws Error if headerValue is null + */ + public remove(headerName: string, headerValue: string): boolean { + if (!headerName) { + throw new Error("headerName cannot be null or empty"); + } + if (!headerValue) { + throw new Error("headerValue cannot be null"); + } + if (this.headers[headerName]) { + const result = this.headers[headerName].delete(headerValue); + if (this.headers[headerName].size === 0) { + delete this.headers[headerName]; + } + return result; + } + return false; + } - /** - * Adds all the headers values from the specified headers collection. - * @param headers The headers to update the current headers with. - * @throws Error if headers is null - */ - public addAll(headers: Headers): void { - if (!headers) { - throw new Error("headers cannot be null"); - } - for (const header in headers.headers) { - headers.headers[header].forEach((value) => this.add(header, value)); - } - } + /** + * Adds all the headers values from the specified headers collection. + * @param headers The headers to update the current headers with. + * @throws Error if headers is null + */ + public addAll(headers: Headers): void { + if (!headers) { + throw new Error("headers cannot be null"); + } + for (const header in headers.headers) { + headers.headers[header].forEach((value) => this.add(header, value)); + } + } - /** - * Adds all headers from the request configuration value to the current headers collection. - * Replaces any existing headers with the same key. - * @param headers The headers to update the current headers with. - * @throws Error if headers is null - */ - public addAllRaw(headers: Record): void { - if (!headers) { - throw new Error("headers cannot be null"); - } - for (const header in headers) { - const headerValues = headers[header]; - if (Array.isArray(headerValues)) { - this.add(header, ...headerValues); - } else { - this.add(header, headerValues); - } - } - } + /** + * Adds all headers from the request configuration value to the current headers collection. + * Replaces any existing headers with the same key. + * @param headers The headers to update the current headers with. + * @throws Error if headers is null + */ + public addAllRaw(headers: Record): void { + if (!headers) { + throw new Error("headers cannot be null"); + } + for (const header in headers) { + const headerValues = headers[header]; + if (Array.isArray(headerValues)) { + this.add(header, ...headerValues); + } else { + this.add(header, headerValues); + } + } + } - /** - * Gets the values for the header with the specified name. - * @param key The name of the header to get the values for. - * @returns The values for the header with the specified name. - * @throws Error if key is null or empty - */ - public tryGetValue(key: string): string[] | null { - if (!key) { - throw new Error("key cannot be null or empty"); - } - return this.headers[key] ? Array.from(this.headers[key]) : null; - } + /** + * Gets the values for the header with the specified name. + * @param key The name of the header to get the values for. + * @returns The values for the header with the specified name. + * @throws Error if key is null or empty + */ + public tryGetValue(key: string): string[] | null { + if (!key) { + throw new Error("key cannot be null or empty"); + } + return this.headers[key] ? Array.from(this.headers[key]) : null; + } - /** - * Override toString method for the headers collection - * @returns a string representation of the headers collection - */ - public toString(): string { - return JSON.stringify(this.headers, (_key, value) => - value instanceof Set ? [...value] : value, - ); - } + /** + * Override toString method for the headers collection + * @returns a string representation of the headers collection + */ + public toString(): string { + return JSON.stringify(this.headers, (_key, value) => (value instanceof Set ? [...value] : value)); + } - /** - * check if the headers collection is empty - */ - public isEmpty(): boolean { - return Object.keys(this.headers).length === 0; - } + /** + * check if the headers collection is empty + */ + public isEmpty(): boolean { + return Object.keys(this.headers).length === 0; + } - /** - * get keys of the headers collection - * @returns an iterator of keys - */ - public keys(): IterableIterator { - return Object.keys(this.headers)[Symbol.iterator](); - } + /** + * get keys of the headers collection + * @returns an iterator of keys + */ + public keys(): IterableIterator { + return Object.keys(this.headers)[Symbol.iterator](); + } - /** - * get entries - * @returns an iterator of entries - */ - public entries(): IterableIterator<[string, Set]> { - return Object.entries(this.headers)[Symbol.iterator](); - } + /** + * get entries + * @returns an iterator of entries + */ + public entries(): IterableIterator<[string, Set]> { + return Object.entries(this.headers)[Symbol.iterator](); + } } diff --git a/packages/abstractions/src/httpMethod.ts b/packages/abstractions/src/httpMethod.ts index 5c518b643..ee642059c 100644 --- a/packages/abstractions/src/httpMethod.ts +++ b/packages/abstractions/src/httpMethod.ts @@ -1,23 +1,30 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /** * Represents the HTTP method used by a request. */ export enum HttpMethod { - /** The HTTP GET method */ - GET = "GET", - /** The HTTP POST method */ - POST = "POST", - /** The HTTP PATCH method */ - PATCH = "PATCH", - /** The HTTP DELETE method */ - DELETE = "DELETE", - /** The HTTP OPTIONS method */ - OPTIONS = "OPTIONS", - /** The HTTP CONNECT method */ - CONNECT = "CONNECT", - /** The HTTP TRACE method */ - TRACE = "TRACE", - /** The HTTP HEAD method */ - HEAD = "HEAD", - /** The HTTP PUT method */ - PUT = "PUT", + /** The HTTP GET method */ + GET = "GET", + /** The HTTP POST method */ + POST = "POST", + /** The HTTP PATCH method */ + PATCH = "PATCH", + /** The HTTP DELETE method */ + DELETE = "DELETE", + /** The HTTP OPTIONS method */ + OPTIONS = "OPTIONS", + /** The HTTP CONNECT method */ + CONNECT = "CONNECT", + /** The HTTP TRACE method */ + TRACE = "TRACE", + /** The HTTP HEAD method */ + HEAD = "HEAD", + /** The HTTP PUT method */ + PUT = "PUT", } diff --git a/packages/abstractions/src/index.ts b/packages/abstractions/src/index.ts index b68d7b6f6..617188152 100644 --- a/packages/abstractions/src/index.ts +++ b/packages/abstractions/src/index.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ export * from "./apiClientBuilder"; export * from "./apiClientProxifier"; export * from "./apiError"; diff --git a/packages/abstractions/src/multipartBody.ts b/packages/abstractions/src/multipartBody.ts index 6df08b618..22cfcb057 100644 --- a/packages/abstractions/src/multipartBody.ts +++ b/packages/abstractions/src/multipartBody.ts @@ -1,187 +1,164 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { Guid } from "guid-typescript"; - import type { RequestAdapter } from "./requestAdapter"; -import type { - ModelSerializerFunction, - Parsable, - ParseNode, - SerializationWriter, -} from "./serialization"; +import type { ModelSerializerFunction, Parsable, ParseNode, SerializationWriter } from "./serialization"; + /** * Defines an interface for a multipart body for request or response. */ export class MultipartBody implements Parsable { - private readonly _boundary: string; - private readonly _parts: Record = {}; - public requestAdapter?: RequestAdapter; - /** - * Instantiates a new MultipartBody. - */ - public constructor() { - this._boundary = Guid.create().toString().replace(/-/g, ""); - } - /** - * Adds or replaces a part with the given name, content type and content. - * @param partName the name of the part to add or replace. - * @param partContentType the content type of the part to add or replace. - * @param content the content of the part to add or replace. - * @param serializationCallback the serialization callback to use when serializing the part. - */ - public addOrReplacePart( - partName: string, - partContentType: string, - content: T, - serializationCallback?: ModelSerializerFunction, - ): void { - if (!partName) throw new Error("partName cannot be undefined"); - if (!partContentType) { - throw new Error("partContentType cannot be undefined"); - } - if (!content) throw new Error("content cannot be undefined"); - const normalizePartName = this.normalizePartName(partName); - this._parts[normalizePartName] = { - contentType: partContentType, - content, - originalName: partName, - serializationCallback, - }; - } - /** - * Gets the content of the part with the given name. - * @param partName the name of the part to get the content for. - * @returns the content of the part with the given name. - */ - public getPartValue(partName: string): T | undefined { - if (!partName) throw new Error("partName cannot be undefined"); - const normalizePartName = this.normalizePartName(partName); - const candidate = this._parts[normalizePartName]; - if (!candidate) return undefined; - return candidate.content as T; - } - /** - * Removes the part with the given name. - * @param partName the name of the part to remove. - * @returns true if the part was removed, false if it did not exist. - */ - public removePart(partName: string): boolean { - if (!partName) throw new Error("partName cannot be undefined"); - const normalizePartName = this.normalizePartName(partName); - if (!this._parts[normalizePartName]) return false; - delete this._parts[normalizePartName]; - return true; - } - /** - * Gets the boundary used to separate each part. - * @returns the boundary value. - */ - public getBoundary(): string { - return this._boundary; - } + private readonly _boundary: string; + private readonly _parts: Record = {}; + public requestAdapter?: RequestAdapter; + /** + * Instantiates a new MultipartBody. + */ + public constructor() { + this._boundary = Guid.create().toString().replace(/-/g, ""); + } + /** + * Adds or replaces a part with the given name, content type and content. + * @param partName the name of the part to add or replace. + * @param partContentType the content type of the part to add or replace. + * @param content the content of the part to add or replace. + * @param serializationCallback the serialization callback to use when serializing the part. + */ + public addOrReplacePart(partName: string, partContentType: string, content: T, serializationCallback?: ModelSerializerFunction): void { + if (!partName) throw new Error("partName cannot be undefined"); + if (!partContentType) { + throw new Error("partContentType cannot be undefined"); + } + if (!content) throw new Error("content cannot be undefined"); + const normalizePartName = this.normalizePartName(partName); + this._parts[normalizePartName] = { + contentType: partContentType, + content, + originalName: partName, + serializationCallback, + }; + } + /** + * Gets the content of the part with the given name. + * @param partName the name of the part to get the content for. + * @returns the content of the part with the given name. + */ + public getPartValue(partName: string): T | undefined { + if (!partName) throw new Error("partName cannot be undefined"); + const normalizePartName = this.normalizePartName(partName); + const candidate = this._parts[normalizePartName]; + if (!candidate) return undefined; + return candidate.content as T; + } + /** + * Removes the part with the given name. + * @param partName the name of the part to remove. + * @returns true if the part was removed, false if it did not exist. + */ + public removePart(partName: string): boolean { + if (!partName) throw new Error("partName cannot be undefined"); + const normalizePartName = this.normalizePartName(partName); + if (!this._parts[normalizePartName]) return false; + delete this._parts[normalizePartName]; + return true; + } + /** + * Gets the boundary used to separate each part. + * @returns the boundary value. + */ + public getBoundary(): string { + return this._boundary; + } - private normalizePartName(original: string): string { - return original.toLocaleLowerCase(); - } - /** - * Lists all the parts in the multipart body. - * WARNING: meant for internal use only - * @returns the list of parts in the multipart body. - */ - public listParts(): Record { - return this._parts; - } + private normalizePartName(original: string): string { + return original.toLocaleLowerCase(); + } + /** + * Lists all the parts in the multipart body. + * WARNING: meant for internal use only + * @returns the list of parts in the multipart body. + */ + public listParts(): Record { + return this._parts; + } } interface MultipartEntry { - contentType: string; - content: any; - originalName: string; - serializationCallback?: ModelSerializerFunction; + contentType: string; + content: any; + originalName: string; + serializationCallback?: ModelSerializerFunction; } -export function serializeMultipartBody( - writer: SerializationWriter, - multipartBody: Partial = new MultipartBody(), -): void { - if (!writer) { - throw new Error("writer cannot be undefined"); - } - if (!multipartBody) { - throw new Error("multipartBody cannot be undefined"); - } - if (!multipartBody.listParts) { - throw new Error("multipartBody.listParts cannot be undefined"); - } - if (!multipartBody.getBoundary) { - throw new Error("multipartBody.getBoundary cannot be undefined"); - } - const parts = multipartBody.listParts(); - if (Object.keys(parts).length === 0) { - throw new Error("multipartBody cannot be empty"); - } - const boundary = multipartBody.getBoundary(); - let first = true; - for (const partName in parts) { - if (first) { - first = false; - } else { - writer.writeStringValue(undefined, ""); - } - writer.writeStringValue(undefined, "--" + boundary); - const part = parts[partName]; - writer.writeStringValue("Content-Type", part.contentType); - writer.writeStringValue( - "Content-Disposition", - 'form-data; name="' + part.originalName + '"', - ); - writer.writeStringValue(undefined, ""); - if (typeof part.content === "string") { - writer.writeStringValue(undefined, part.content); - } else if (part.content instanceof ArrayBuffer) { - writer.writeByteArrayValue(undefined, new Uint8Array(part.content)); - } else if (part.content instanceof Uint8Array) { - writer.writeByteArrayValue(undefined, part.content); - } else if (part.serializationCallback) { - if (!multipartBody.requestAdapter) { - throw new Error("requestAdapter cannot be undefined"); - } - const serializationWriterFactory = - multipartBody.requestAdapter.getSerializationWriterFactory(); - if (!serializationWriterFactory) { - throw new Error("serializationWriterFactory cannot be undefined"); - } - const partSerializationWriter = - serializationWriterFactory.getSerializationWriter(part.contentType); - if (!partSerializationWriter) { - throw new Error( - "no serialization writer factory for content type: " + - part.contentType, - ); - } - partSerializationWriter.writeObjectValue( - undefined, - part.content as Parsable, - part.serializationCallback, - ); - const partContent = partSerializationWriter.getSerializedContent(); - writer.writeByteArrayValue(undefined, new Uint8Array(partContent)); - } else { - throw new Error( - "unsupported content type for multipart body: " + typeof part.content, - ); - } - } - writer.writeStringValue(undefined, ""); - writer.writeStringValue(undefined, "--" + boundary + "--"); +export function serializeMultipartBody(writer: SerializationWriter, multipartBody: Partial = new MultipartBody()): void { + if (!writer) { + throw new Error("writer cannot be undefined"); + } + if (!multipartBody) { + throw new Error("multipartBody cannot be undefined"); + } + if (!multipartBody.listParts) { + throw new Error("multipartBody.listParts cannot be undefined"); + } + if (!multipartBody.getBoundary) { + throw new Error("multipartBody.getBoundary cannot be undefined"); + } + const parts = multipartBody.listParts(); + if (Object.keys(parts).length === 0) { + throw new Error("multipartBody cannot be empty"); + } + const boundary = multipartBody.getBoundary(); + let first = true; + for (const partName in parts) { + if (first) { + first = false; + } else { + writer.writeStringValue(undefined, ""); + } + writer.writeStringValue(undefined, "--" + boundary); + const part = parts[partName]; + writer.writeStringValue("Content-Type", part.contentType); + writer.writeStringValue("Content-Disposition", 'form-data; name="' + part.originalName + '"'); + writer.writeStringValue(undefined, ""); + if (typeof part.content === "string") { + writer.writeStringValue(undefined, part.content); + } else if (part.content instanceof ArrayBuffer) { + writer.writeByteArrayValue(undefined, new Uint8Array(part.content)); + } else if (part.content instanceof Uint8Array) { + writer.writeByteArrayValue(undefined, part.content); + } else if (part.serializationCallback) { + if (!multipartBody.requestAdapter) { + throw new Error("requestAdapter cannot be undefined"); + } + const serializationWriterFactory = multipartBody.requestAdapter.getSerializationWriterFactory(); + if (!serializationWriterFactory) { + throw new Error("serializationWriterFactory cannot be undefined"); + } + const partSerializationWriter = serializationWriterFactory.getSerializationWriter(part.contentType); + if (!partSerializationWriter) { + throw new Error("no serialization writer factory for content type: " + part.contentType); + } + partSerializationWriter.writeObjectValue(undefined, part.content as Parsable, part.serializationCallback); + const partContent = partSerializationWriter.getSerializedContent(); + writer.writeByteArrayValue(undefined, new Uint8Array(partContent)); + } else { + throw new Error("unsupported content type for multipart body: " + typeof part.content); + } + } + writer.writeStringValue(undefined, ""); + writer.writeStringValue(undefined, "--" + boundary + "--"); } export function deserializeIntoMultipartBody( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _: Partial | undefined = new MultipartBody(), + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _: Partial | undefined = new MultipartBody(), ): Record void> { - throw new Error("Not implemented"); + throw new Error("Not implemented"); } -export function createMessageFromDiscriminatorValue( - parseNode: ParseNode | undefined, -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeIntoMultipartBody; +export function createMessageFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeIntoMultipartBody; } diff --git a/packages/abstractions/src/nativeResponseHandler.ts b/packages/abstractions/src/nativeResponseHandler.ts index b2ffd14a6..131ec27b0 100644 --- a/packages/abstractions/src/nativeResponseHandler.ts +++ b/packages/abstractions/src/nativeResponseHandler.ts @@ -1,18 +1,21 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { ErrorMappings } from "./requestAdapter"; import type { ResponseHandler } from "./responseHandler"; /** Default response handler to access the native response object. */ export class NativeResponseHandler implements ResponseHandler { - /** Native response object as returned by the core service */ - public value?: any; - /** The error mappings for the response to use when deserializing failed responses bodies. Where an error code like 401 applies specifically to that status code, a class code like 4XX applies to all status codes within the range if an the specific error code is not present. */ - public errorMappings: ErrorMappings | undefined; - public handleResponse( - response: NativeResponseType, - errorMappings: ErrorMappings | undefined, - ): Promise { - this.value = response; - this.errorMappings = errorMappings; - return Promise.resolve(undefined as any); - } + /** Native response object as returned by the core service */ + public value?: any; + /** The error mappings for the response to use when deserializing failed responses bodies. Where an error code like 401 applies specifically to that status code, a class code like 4XX applies to all status codes within the range if an the specific error code is not present. */ + public errorMappings: ErrorMappings | undefined; + public handleResponse(response: NativeResponseType, errorMappings: ErrorMappings | undefined): Promise { + this.value = response; + this.errorMappings = errorMappings; + return Promise.resolve(undefined as any); + } } diff --git a/packages/abstractions/src/nativeResponseWrapper.ts b/packages/abstractions/src/nativeResponseWrapper.ts index 72d5e12fd..a961f5cd7 100644 --- a/packages/abstractions/src/nativeResponseWrapper.ts +++ b/packages/abstractions/src/nativeResponseWrapper.ts @@ -1,63 +1,26 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { NativeResponseHandler } from "./nativeResponseHandler"; import type { RequestOption } from "./requestOption"; import type { ResponseHandler } from "./responseHandler"; -type originalCallType = ( - q?: queryParametersType, - h?: headersType, - o?: RequestOption[] | undefined, - responseHandler?: ResponseHandler -) => Promise; -type originalCallWithBodyType< - modelType, - queryParametersType, - headersType, - requestBodyType -> = ( - requestBody: requestBodyType, - q?: queryParametersType, - h?: headersType, - o?: RequestOption[] | undefined, - responseHandler?: ResponseHandler -) => Promise; +type originalCallType = (q?: queryParametersType, h?: headersType, o?: RequestOption[] | undefined, responseHandler?: ResponseHandler) => Promise; +type originalCallWithBodyType = (requestBody: requestBodyType, q?: queryParametersType, h?: headersType, o?: RequestOption[] | undefined, responseHandler?: ResponseHandler) => Promise; /** This class can be used to wrap a request using the fluent API and get the native response object in return. */ export class NativeResponseWrapper { - public static CallAndGetNative = async < - modelType, - nativeResponseType, - queryParametersType, - headersType - >( - originalCall: originalCallType, - q?: queryParametersType, - h?: headersType, - o?: RequestOption[] | undefined - ): Promise => { - const responseHandler = new NativeResponseHandler(); - await originalCall(q, h, o, responseHandler); - return responseHandler.value as nativeResponseType; - }; - public static CallAndGetNativeWithBody = async < - modelType, - nativeResponseType, - queryParametersType, - headersType, - requestBodyType - >( - originalCall: originalCallWithBodyType< - modelType, - queryParametersType, - headersType, - requestBodyType - >, - requestBody: requestBodyType, - q?: queryParametersType, - h?: headersType, - o?: RequestOption[] | undefined - ): Promise => { - const responseHandler = new NativeResponseHandler(); - await originalCall(requestBody, q, h, o, responseHandler); - return responseHandler.value as nativeResponseType; - }; + public static CallAndGetNative = async (originalCall: originalCallType, q?: queryParametersType, h?: headersType, o?: RequestOption[] | undefined): Promise => { + const responseHandler = new NativeResponseHandler(); + await originalCall(q, h, o, responseHandler); + return responseHandler.value as nativeResponseType; + }; + public static CallAndGetNativeWithBody = async (originalCall: originalCallWithBodyType, requestBody: requestBodyType, q?: queryParametersType, h?: headersType, o?: RequestOption[] | undefined): Promise => { + const responseHandler = new NativeResponseHandler(); + await originalCall(requestBody, q, h, o, responseHandler); + return responseHandler.value as nativeResponseType; + }; } diff --git a/packages/abstractions/src/recordWithCaseInsensitiveKeys.ts b/packages/abstractions/src/recordWithCaseInsensitiveKeys.ts index 27ecbd773..b04b73c4f 100644 --- a/packages/abstractions/src/recordWithCaseInsensitiveKeys.ts +++ b/packages/abstractions/src/recordWithCaseInsensitiveKeys.ts @@ -1,64 +1,66 @@ /** - * A Proxy that allows implementation of a Object with case insensitive keys - * @param canon A function that takes a property name and returns its canonical form. - * @returns A new object that can be used as a dictionary with case-insensitive keys. + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- */ + function dictionaryWithCanonicalKeys(canon: (prop: keyof any) => string) { - const keysNormalizationMap = new Map(); - return new Proxy<{ [k: string]: V }>( - {}, - { - /** - * Intercept the get operation on the dictionary object and forward it to the target object using Reflect.get. - */ - get(target, prop) { - const normalKey = canon(prop); - return Reflect.get(target, normalKey); - }, - /** - * Intercept the set operation on the dictionary object and forward it to the target object using Reflect.set. - */ - set(target, prop, value) { - const nonNormalKey = prop.toString(); - const normalKey = canon(prop); - keysNormalizationMap.set(normalKey, nonNormalKey); - return Reflect.set(target, normalKey, value); - }, - /** - * Intercept the has operation on the dictionary object and forward it to the target object using Reflect.has. - */ - has(_, prop) { - const normalKey = canon(prop); - return keysNormalizationMap.has(normalKey); - }, - /** - * Intercept the defineProperty operation on the dictionary object and forward it to the target object using Reflect.defineProperty. - */ - defineProperty(target, prop, attribs) { - const nonNormalKey = prop.toString(); - const normalKey = canon(prop); - keysNormalizationMap.set(normalKey, nonNormalKey); - return Reflect.defineProperty(target, normalKey, attribs); - }, - /** - * Intercept the deleteProperty operation on the dictionary object and forward it to the target object using Reflect.deleteProperty. - */ - deleteProperty(target, prop) { - const normalKey = canon(prop); - keysNormalizationMap.delete(normalKey); - return Reflect.deleteProperty(target, normalKey); - }, - /** - * Intercept the getOwnPropertyDescriptor operation on the dictionary object and forward it to the target object using Reflect.getOwnPropertyDescriptor. - */ - getOwnPropertyDescriptor(target, prop) { - return Reflect.getOwnPropertyDescriptor(target, canon(prop)); - }, - ownKeys() { - return [...keysNormalizationMap.values()]; - }, - }, - ); + const keysNormalizationMap = new Map(); + return new Proxy<{ [k: string]: V }>( + {}, + { + /** + * Intercept the get operation on the dictionary object and forward it to the target object using Reflect.get. + */ + get(target, prop) { + const normalKey = canon(prop); + return Reflect.get(target, normalKey); + }, + /** + * Intercept the set operation on the dictionary object and forward it to the target object using Reflect.set. + */ + set(target, prop, value) { + const nonNormalKey = prop.toString(); + const normalKey = canon(prop); + keysNormalizationMap.set(normalKey, nonNormalKey); + return Reflect.set(target, normalKey, value); + }, + /** + * Intercept the has operation on the dictionary object and forward it to the target object using Reflect.has. + */ + has(_, prop) { + const normalKey = canon(prop); + return keysNormalizationMap.has(normalKey); + }, + /** + * Intercept the defineProperty operation on the dictionary object and forward it to the target object using Reflect.defineProperty. + */ + defineProperty(target, prop, attribs) { + const nonNormalKey = prop.toString(); + const normalKey = canon(prop); + keysNormalizationMap.set(normalKey, nonNormalKey); + return Reflect.defineProperty(target, normalKey, attribs); + }, + /** + * Intercept the deleteProperty operation on the dictionary object and forward it to the target object using Reflect.deleteProperty. + */ + deleteProperty(target, prop) { + const normalKey = canon(prop); + keysNormalizationMap.delete(normalKey); + return Reflect.deleteProperty(target, normalKey); + }, + /** + * Intercept the getOwnPropertyDescriptor operation on the dictionary object and forward it to the target object using Reflect.getOwnPropertyDescriptor. + */ + getOwnPropertyDescriptor(target, prop) { + return Reflect.getOwnPropertyDescriptor(target, canon(prop)); + }, + ownKeys() { + return [...keysNormalizationMap.values()]; + }, + }, + ); } /** @@ -66,13 +68,11 @@ function dictionaryWithCanonicalKeys(canon: (prop: keyof any) => string) { * @returns A new object that can be used as a dictionary with case-insensitive keys. */ export function createRecordWithCaseInsensitiveKeys(): Record { - /** - * A function that takes a property name and returns its canonical form. - * @param prop The property name to be canonicalized. - * @returns The canonical form of the property name. - */ - const record: Record = dictionaryWithCanonicalKeys((p) => - typeof p === "string" ? p.toLowerCase() : p.toString().toLowerCase(), - ); - return record; + /** + * A function that takes a property name and returns its canonical form. + * @param prop The property name to be canonicalized. + * @returns The canonical form of the property name. + */ + const record: Record = dictionaryWithCanonicalKeys((p) => (typeof p === "string" ? p.toLowerCase() : p.toString().toLowerCase())); + return record; } diff --git a/packages/abstractions/src/requestAdapter.ts b/packages/abstractions/src/requestAdapter.ts index 27a07f7ce..c64a00a40 100644 --- a/packages/abstractions/src/requestAdapter.ts +++ b/packages/abstractions/src/requestAdapter.ts @@ -1,165 +1,111 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { DateOnly } from "./dateOnly"; import type { Duration } from "./duration"; import { type RequestInformation } from "./requestInformation"; -import type { - Parsable, - ParsableFactory, - SerializationWriterFactory, -} from "./serialization"; +import type { Parsable, ParsableFactory, SerializationWriterFactory } from "./serialization"; import { type BackingStoreFactory } from "./store"; import type { TimeOnly } from "./timeOnly"; /** Service responsible for translating abstract Request Info into concrete native HTTP requests. */ export interface RequestAdapter { - /** - * Gets the serialization writer factory currently in use for the HTTP core service. - * @return the serialization writer factory currently in use for the HTTP core service. - */ - getSerializationWriterFactory(): SerializationWriterFactory; - /** - * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model. - * @param requestInfo the request info to execute. - * @param errorMappings the error factories mapping to use in case of a failed request. - * @param type the class of the response model to deserialize the response into. - * @typeParam ModelType the type of the response model to deserialize the response into. - * @return a {@link Promise} with the deserialized response model. - */ - send( - requestInfo: RequestInformation, - type: ParsableFactory, - errorMappings: ErrorMappings | undefined, - ): Promise; - /** - * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. - * @param requestInfo the request info to execute. - * @param errorMappings the error factories mapping to use in case of a failed request. - * @param type the class of the response model to deserialize the response into. - * @typeParam ModelType the type of the response model to deserialize the response into. - * @return a {@link Promise} with the deserialized response model collection. - */ - sendCollection( - requestInfo: RequestInformation, - type: ParsableFactory, - errorMappings: ErrorMappings | undefined, - ): Promise; - /** - * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. - * @param requestInfo the request info to execute. - * @param responseType the class of the response model to deserialize the response into. - * @param errorMappings the error factories mapping to use in case of a failed request. - * @param type the class of the response model to deserialize the response into. - * @typeParam ResponseType the type of the response model to deserialize the response into. - * @return a {@link Promise} with the deserialized response model collection. - */ - sendCollectionOfPrimitive< - ResponseType extends Exclude< - PrimitiveTypesForDeserializationType, - ArrayBuffer - >, - >( - requestInfo: RequestInformation, - responseType: Exclude, - errorMappings: ErrorMappings | undefined, - ): Promise; - /** - * Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model. - * @param requestInfo the request info to execute. - * @param errorMappings the error factories mapping to use in case of a failed request. - * @param responseType the class of the response model to deserialize the response into. - * @typeParam ResponseType the type of the response model to deserialize the response into. - * @return a {@link Promise} with the deserialized primitive response model. - */ - sendPrimitive( - requestInfo: RequestInformation, - responseType: PrimitiveTypesForDeserialization, - errorMappings: ErrorMappings | undefined, - ): Promise; - /** - * Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model. - * @param requestInfo the request info to execute. - * @param errorMappings the error factories mapping to use in case of a failed request. - * @return a {@link Promise} of void. - */ - sendNoResponseContent( - requestInfo: RequestInformation, - errorMappings: ErrorMappings | undefined, - ): Promise; - /** - * Executes the HTTP request specified by the given RequestInformation and returns the deserialized enum response model. - * - * @template EnumObject - The type of the enum object. Must extend Record. - * @param {RequestInformation} requestInfo - The request info to execute. - * @param {EnumObject} enumObject - The Enum object expected in the response. - * @param {ErrorMappings | undefined} errorMappings - the error factories mapping to use in case of a failed request. - * @returns {Promise} - A promise that resolves to the response of the request, or undefined if an error occurred. - */ - sendEnum>( - requestInfo: RequestInformation, - enumObject: EnumObject, - errorMappings: ErrorMappings | undefined, - ): Promise; - /** - * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. - * - * @template EnumObject - The type of the enum objects. Must extend Record. - * @param {RequestInformation} requestInfo - The request info to execute. - * @param {EnumObject} enumObject - The Enum object expected in the response. - * @param {ErrorMappings | undefined} errorMappings - the error factories mapping to use in case of a failed request. - * @returns {Promise} - with the deserialized response model collection. - */ - sendCollectionOfEnum>( - requestInfo: RequestInformation, - enumObject: EnumObject, - errorMappings: ErrorMappings | undefined, - ): Promise; - /** - * Enables the backing store proxies for the SerializationWriters and ParseNodes in use. - * @param backingStoreFactory the backing store factory to use. - */ - enableBackingStore( - backingStoreFactory?: BackingStoreFactory | undefined, - ): void; - /** The base url for every request. */ - baseUrl: string; - /** - * Converts the given RequestInformation into a native HTTP request used by the implementing adapter. - * @param requestInfo the request info to convert. - * @typeParam T the type of the native request. - * @return a {@link Promise} with the native request. - */ - convertToNativeRequest(requestInfo: RequestInformation): Promise; + /** + * Gets the serialization writer factory currently in use for the HTTP core service. + * @return the serialization writer factory currently in use for the HTTP core service. + */ + getSerializationWriterFactory(): SerializationWriterFactory; + /** + * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model. + * @param requestInfo the request info to execute. + * @param errorMappings the error factories mapping to use in case of a failed request. + * @param type the class of the response model to deserialize the response into. + * @typeParam ModelType the type of the response model to deserialize the response into. + * @return a {@link Promise} with the deserialized response model. + */ + send(requestInfo: RequestInformation, type: ParsableFactory, errorMappings: ErrorMappings | undefined): Promise; + /** + * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. + * @param requestInfo the request info to execute. + * @param errorMappings the error factories mapping to use in case of a failed request. + * @param type the class of the response model to deserialize the response into. + * @typeParam ModelType the type of the response model to deserialize the response into. + * @return a {@link Promise} with the deserialized response model collection. + */ + sendCollection(requestInfo: RequestInformation, type: ParsableFactory, errorMappings: ErrorMappings | undefined): Promise; + /** + * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. + * @param requestInfo the request info to execute. + * @param responseType the class of the response model to deserialize the response into. + * @param errorMappings the error factories mapping to use in case of a failed request. + * @param type the class of the response model to deserialize the response into. + * @typeParam ResponseType the type of the response model to deserialize the response into. + * @return a {@link Promise} with the deserialized response model collection. + */ + sendCollectionOfPrimitive>(requestInfo: RequestInformation, responseType: Exclude, errorMappings: ErrorMappings | undefined): Promise; + /** + * Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model. + * @param requestInfo the request info to execute. + * @param errorMappings the error factories mapping to use in case of a failed request. + * @param responseType the class of the response model to deserialize the response into. + * @typeParam ResponseType the type of the response model to deserialize the response into. + * @return a {@link Promise} with the deserialized primitive response model. + */ + sendPrimitive(requestInfo: RequestInformation, responseType: PrimitiveTypesForDeserialization, errorMappings: ErrorMappings | undefined): Promise; + /** + * Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model. + * @param requestInfo the request info to execute. + * @param errorMappings the error factories mapping to use in case of a failed request. + * @return a {@link Promise} of void. + */ + sendNoResponseContent(requestInfo: RequestInformation, errorMappings: ErrorMappings | undefined): Promise; + /** + * Executes the HTTP request specified by the given RequestInformation and returns the deserialized enum response model. + * + * @template EnumObject - The type of the enum object. Must extend Record. + * @param {RequestInformation} requestInfo - The request info to execute. + * @param {EnumObject} enumObject - The Enum object expected in the response. + * @param {ErrorMappings | undefined} errorMappings - the error factories mapping to use in case of a failed request. + * @returns {Promise} - A promise that resolves to the response of the request, or undefined if an error occurred. + */ + sendEnum>(requestInfo: RequestInformation, enumObject: EnumObject, errorMappings: ErrorMappings | undefined): Promise; + /** + * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. + * + * @template EnumObject - The type of the enum objects. Must extend Record. + * @param {RequestInformation} requestInfo - The request info to execute. + * @param {EnumObject} enumObject - The Enum object expected in the response. + * @param {ErrorMappings | undefined} errorMappings - the error factories mapping to use in case of a failed request. + * @returns {Promise} - with the deserialized response model collection. + */ + sendCollectionOfEnum>(requestInfo: RequestInformation, enumObject: EnumObject, errorMappings: ErrorMappings | undefined): Promise; + /** + * Enables the backing store proxies for the SerializationWriters and ParseNodes in use. + * @param backingStoreFactory the backing store factory to use. + */ + enableBackingStore(backingStoreFactory?: BackingStoreFactory | undefined): void; + /** The base url for every request. */ + baseUrl: string; + /** + * Converts the given RequestInformation into a native HTTP request used by the implementing adapter. + * @param requestInfo the request info to convert. + * @typeParam T the type of the native request. + * @return a {@link Promise} with the native request. + */ + convertToNativeRequest(requestInfo: RequestInformation): Promise; } export interface ErrorMappings { - _4XX?: ParsableFactory; - _5XX?: ParsableFactory; - XXX?: ParsableFactory; - [key: number]: ParsableFactory; + _4XX?: ParsableFactory; + _5XX?: ParsableFactory; + XXX?: ParsableFactory; + [key: number]: ParsableFactory; } -export type PrimitiveTypesForDeserializationType = - | string - | number - | boolean - | Date - | DateOnly - | TimeOnly - | Duration - | ArrayBuffer; +export type PrimitiveTypesForDeserializationType = string | number | boolean | Date | DateOnly | TimeOnly | Duration | ArrayBuffer; -export type PrimitiveTypesForDeserialization = - | "string" - | "number" - | "boolean" - | "Date" - | "DateOnly" - | "TimeOnly" - | "Duration" - | "ArrayBuffer"; +export type PrimitiveTypesForDeserialization = "string" | "number" | "boolean" | "Date" | "DateOnly" | "TimeOnly" | "Duration" | "ArrayBuffer"; -export type SendMethods = Exclude< - keyof RequestAdapter, - | "enableBackingStore" - | "getSerializationWriterFactory" - | "convertToNativeRequest" - | "baseUrl" ->; +export type SendMethods = Exclude; diff --git a/packages/abstractions/src/requestConfiguration.ts b/packages/abstractions/src/requestConfiguration.ts index e312f47c4..752c46da0 100644 --- a/packages/abstractions/src/requestConfiguration.ts +++ b/packages/abstractions/src/requestConfiguration.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { RequestOption } from "./requestOption"; /** @@ -5,16 +11,16 @@ import type { RequestOption } from "./requestOption"; * @template T Query parameters type */ export interface RequestConfiguration { - /** - * Request headers - */ - headers?: Record; - /** - * Request options - */ - options?: RequestOption[]; - /** - * Request query parameters - */ - queryParameters?: T; + /** + * Request headers + */ + headers?: Record; + /** + * Request options + */ + options?: RequestOption[]; + /** + * Request query parameters + */ + queryParameters?: T; } diff --git a/packages/abstractions/src/requestInformation.ts b/packages/abstractions/src/requestInformation.ts index 722304f1d..881aa64a5 100644 --- a/packages/abstractions/src/requestInformation.ts +++ b/packages/abstractions/src/requestInformation.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { trace } from "@opentelemetry/api"; import { StdUriTemplate } from "@std-uritemplate/std-uritemplate"; @@ -7,335 +13,258 @@ import { Headers } from "./headers"; import { type HttpMethod } from "./httpMethod"; import { MultipartBody } from "./multipartBody"; import { createRecordWithCaseInsensitiveKeys } from "./recordWithCaseInsensitiveKeys"; -import type { - PrimitiveTypesForDeserializationType, - RequestAdapter, -} from "./requestAdapter"; +import type { PrimitiveTypesForDeserializationType, RequestAdapter } from "./requestAdapter"; import type { RequestConfiguration } from "./requestConfiguration"; import type { RequestOption } from "./requestOption"; -import type { - ModelSerializerFunction, - Parsable, - SerializationWriter, -} from "./serialization"; +import type { ModelSerializerFunction, Parsable, SerializationWriter } from "./serialization"; import { TimeOnly } from "./timeOnly"; /** This class represents an abstract HTTP request. */ export class RequestInformation implements RequestInformationSetContent { - /** - * Initializes a request information instance with the provided values. - * @param httpMethod The HTTP method for the request. - * @param urlTemplate The URL template for the request. - * @param pathParameters The path parameters for the request. - */ - public constructor( - httpMethod?: HttpMethod, - urlTemplate?: string, - pathParameters?: Record, - ) { - if (httpMethod) { - this.httpMethod = httpMethod; - } - if (urlTemplate) { - this.urlTemplate = urlTemplate; - } - if (pathParameters) { - this.pathParameters = pathParameters; - } - } - /** The URI of the request. */ - private uri?: string; - /** The path parameters for the request. */ - public pathParameters: Record = - createRecordWithCaseInsensitiveKeys(); - /** The URL template for the request */ - public urlTemplate?: string; - /** Gets the URL of the request */ - // eslint-disable-next-line @typescript-eslint/naming-convention - public get URL(): string { - const rawUrl = this.pathParameters[ - RequestInformation.raw_url_key - ] as string; - if (this.uri) { - return this.uri; - } else if (rawUrl) { - this.URL = rawUrl; - return rawUrl; - } else if (!this.queryParameters) { - throw new Error("queryParameters cannot be undefined"); - } else if (!this.pathParameters) { - throw new Error("pathParameters cannot be undefined"); - } else if (!this.urlTemplate) { - throw new Error("urlTemplate cannot be undefined"); - } else { - const data = {} as { [key: string]: unknown }; - for (const key in this.queryParameters) { - if (this.queryParameters[key] !== null && this.queryParameters[key] !== undefined) { - data[key] = this.queryParameters[key]; - } - } - for (const key in this.pathParameters) { - if (this.pathParameters[key]) { - data[key] = this.pathParameters[key]; - } - } - return StdUriTemplate.expand(this.urlTemplate, data); - } - } - /** Sets the URL of the request */ - public set URL(url: string) { - if (!url) throw new Error("URL cannot be undefined"); - this.uri = url; - this.queryParameters = {}; - this.pathParameters = {}; - } - public static raw_url_key = "request-raw-url"; - /** The HTTP method for the request */ - public httpMethod?: HttpMethod; - /** The Request Body. */ - public content?: ArrayBuffer; - /** The Query Parameters of the request. */ - public queryParameters: Record< - string, - string | number | boolean | undefined - > = createRecordWithCaseInsensitiveKeys< - string | number | boolean | undefined - >(); - /** The Request Headers. */ - public headers: Headers = new Headers(); - private _requestOptions: Record = - createRecordWithCaseInsensitiveKeys(); - /** Gets the request options for the request. */ - public getRequestOptions() { - return this._requestOptions; - } - /** Adds the headers for the request. */ - public addRequestHeaders( - source: Record | undefined, - ) { - if (source) { - this.headers.addAllRaw(source); - } - } - /** Adds the request options for the request. */ - public addRequestOptions(options: RequestOption[] | undefined) { - if (!options || options.length === 0) return; - options.forEach((option) => { - this._requestOptions[option.getKey()] = option; - }); - } - /** Removes the request options for the request. */ - public removeRequestOptions(...options: RequestOption[]) { - if (!options || options.length === 0) return; - options.forEach((option) => { - delete this._requestOptions[option.getKey()]; - }); - } - private static readonly binaryContentType = "application/octet-stream"; - private static readonly contentTypeHeader = "Content-Type"; - private static readonly tracerKey = "@microsoft/kiota-abstractions"; - private static readonly requestTypeKey = "com.microsoft.kiota.request.type"; - /** - * Sets the request body from a model with the specified content type. - * @param value the models. - * @param contentType the content type. - * @param requestAdapter The adapter service to get the serialization writer from. - * @typeParam T the model type. - */ - public setContentFromParsable = ( - requestAdapter?: RequestAdapter | undefined, - contentType?: string | undefined, - value?: T[] | T, - modelSerializerFunction?: ModelSerializerFunction, - ): void => { - trace - .getTracer(RequestInformation.tracerKey) - .startActiveSpan("setContentFromParsable", (span) => { - try { - const writer = this.getSerializationWriter( - requestAdapter, - contentType, - value, - ); - if (value instanceof MultipartBody) { - contentType += "; boundary=" + value.getBoundary(); - } - if (!this.headers) { - this.headers = new Headers(); - } + /** + * Initializes a request information instance with the provided values. + * @param httpMethod The HTTP method for the request. + * @param urlTemplate The URL template for the request. + * @param pathParameters The path parameters for the request. + */ + public constructor(httpMethod?: HttpMethod, urlTemplate?: string, pathParameters?: Record) { + if (httpMethod) { + this.httpMethod = httpMethod; + } + if (urlTemplate) { + this.urlTemplate = urlTemplate; + } + if (pathParameters) { + this.pathParameters = pathParameters; + } + } + /** The URI of the request. */ + private uri?: string; + /** The path parameters for the request. */ + public pathParameters: Record = createRecordWithCaseInsensitiveKeys(); + /** The URL template for the request */ + public urlTemplate?: string; + /** Gets the URL of the request */ + // eslint-disable-next-line @typescript-eslint/naming-convention + public get URL(): string { + const rawUrl = this.pathParameters[RequestInformation.raw_url_key] as string; + if (this.uri) { + return this.uri; + } else if (rawUrl) { + this.URL = rawUrl; + return rawUrl; + } else if (!this.queryParameters) { + throw new Error("queryParameters cannot be undefined"); + } else if (!this.pathParameters) { + throw new Error("pathParameters cannot be undefined"); + } else if (!this.urlTemplate) { + throw new Error("urlTemplate cannot be undefined"); + } else { + const data = {} as { [key: string]: unknown }; + for (const key in this.queryParameters) { + if (this.queryParameters[key] !== null && this.queryParameters[key] !== undefined) { + data[key] = this.queryParameters[key]; + } + } + for (const key in this.pathParameters) { + if (this.pathParameters[key]) { + data[key] = this.pathParameters[key]; + } + } + return StdUriTemplate.expand(this.urlTemplate, data); + } + } + /** Sets the URL of the request */ + public set URL(url: string) { + if (!url) throw new Error("URL cannot be undefined"); + this.uri = url; + this.queryParameters = {}; + this.pathParameters = {}; + } + public static raw_url_key = "request-raw-url"; + /** The HTTP method for the request */ + public httpMethod?: HttpMethod; + /** The Request Body. */ + public content?: ArrayBuffer; + /** The Query Parameters of the request. */ + public queryParameters: Record = createRecordWithCaseInsensitiveKeys(); + /** The Request Headers. */ + public headers: Headers = new Headers(); + private _requestOptions: Record = createRecordWithCaseInsensitiveKeys(); + /** Gets the request options for the request. */ + public getRequestOptions() { + return this._requestOptions; + } + /** Adds the headers for the request. */ + public addRequestHeaders(source: Record | undefined) { + if (source) { + this.headers.addAllRaw(source); + } + } + /** Adds the request options for the request. */ + public addRequestOptions(options: RequestOption[] | undefined) { + if (!options || options.length === 0) return; + options.forEach((option) => { + this._requestOptions[option.getKey()] = option; + }); + } + /** Removes the request options for the request. */ + public removeRequestOptions(...options: RequestOption[]) { + if (!options || options.length === 0) return; + options.forEach((option) => { + delete this._requestOptions[option.getKey()]; + }); + } + private static readonly binaryContentType = "application/octet-stream"; + private static readonly contentTypeHeader = "Content-Type"; + private static readonly tracerKey = "@microsoft/kiota-abstractions"; + private static readonly requestTypeKey = "com.microsoft.kiota.request.type"; + /** + * Sets the request body from a model with the specified content type. + * @param value the models. + * @param contentType the content type. + * @param requestAdapter The adapter service to get the serialization writer from. + * @typeParam T the model type. + */ + public setContentFromParsable = (requestAdapter?: RequestAdapter | undefined, contentType?: string | undefined, value?: T[] | T, modelSerializerFunction?: ModelSerializerFunction): void => { + trace.getTracer(RequestInformation.tracerKey).startActiveSpan("setContentFromParsable", (span) => { + try { + const writer = this.getSerializationWriter(requestAdapter, contentType, value); + if (value instanceof MultipartBody) { + contentType += "; boundary=" + value.getBoundary(); + } + if (!this.headers) { + this.headers = new Headers(); + } - if (Array.isArray(value)) { - span.setAttribute(RequestInformation.requestTypeKey, "object[]"); - writer.writeCollectionOfObjectValues( - undefined, - value, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - modelSerializerFunction!, - ); - } else { - span.setAttribute(RequestInformation.requestTypeKey, "object"); - writer.writeObjectValue(undefined, value, modelSerializerFunction); - } - this.setContentAndContentType(writer, contentType); - } finally { - span.end(); - } - }); - }; - private setContentAndContentType = ( - writer: SerializationWriter, - contentType?: string | undefined, - ) => { - if (contentType) { - this.headers.tryAdd(RequestInformation.contentTypeHeader, contentType); - } - this.content = writer.getSerializedContent(); - }; - private getSerializationWriter = ( - requestAdapter?: RequestAdapter | undefined, - contentType?: string | undefined, - ...values: T[] - ): SerializationWriter => { - if (!requestAdapter) throw new Error("httpCore cannot be undefined"); - if (!contentType) throw new Error("contentType cannot be undefined"); - if (!values || values.length === 0) { - throw new Error("values cannot be undefined or empty"); - } - return requestAdapter - .getSerializationWriterFactory() - .getSerializationWriter(contentType); - }; - /** - * Sets the request body from a model with the specified content type. - * @param value the scalar values to serialize. - * @param contentType the content type. - * @param requestAdapter The adapter service to get the serialization writer from. - * @typeParam T the model type. - */ - public setContentFromScalar = < - T extends PrimitiveTypesForDeserializationType, - >( - requestAdapter: RequestAdapter | undefined, - contentType: string | undefined, - value: T[] | T, - ): void => { - trace - .getTracer(RequestInformation.tracerKey) - .startActiveSpan("setContentFromScalar", (span) => { - try { - const writer = this.getSerializationWriter( - requestAdapter, - contentType, - value, - ); - if (!this.headers) { - this.headers = new Headers(); - } + if (Array.isArray(value)) { + span.setAttribute(RequestInformation.requestTypeKey, "object[]"); + writer.writeCollectionOfObjectValues( + undefined, + value, + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + modelSerializerFunction, + ); + } else { + span.setAttribute(RequestInformation.requestTypeKey, "object"); + writer.writeObjectValue(undefined, value, modelSerializerFunction); + } + this.setContentAndContentType(writer, contentType); + } finally { + span.end(); + } + }); + }; + private readonly setContentAndContentType = (writer: SerializationWriter, contentType?: string | undefined) => { + if (contentType) { + this.headers.tryAdd(RequestInformation.contentTypeHeader, contentType); + } + this.content = writer.getSerializedContent(); + }; + private readonly getSerializationWriter = (requestAdapter?: RequestAdapter | undefined, contentType?: string | undefined, ...values: T[]): SerializationWriter => { + if (!requestAdapter) throw new Error("httpCore cannot be undefined"); + if (!contentType) throw new Error("contentType cannot be undefined"); + if (!values || values.length === 0) { + throw new Error("values cannot be undefined or empty"); + } + return requestAdapter.getSerializationWriterFactory().getSerializationWriter(contentType); + }; + /** + * Sets the request body from a model with the specified content type. + * @param value the scalar values to serialize. + * @param contentType the content type. + * @param requestAdapter The adapter service to get the serialization writer from. + * @typeParam T the model type. + */ + public setContentFromScalar = (requestAdapter: RequestAdapter | undefined, contentType: string | undefined, value: T[] | T): void => { + trace.getTracer(RequestInformation.tracerKey).startActiveSpan("setContentFromScalar", (span) => { + try { + const writer = this.getSerializationWriter(requestAdapter, contentType, value); + if (!this.headers) { + this.headers = new Headers(); + } - if (Array.isArray(value)) { - span.setAttribute(RequestInformation.requestTypeKey, "[]"); - writer.writeCollectionOfPrimitiveValues(undefined, value); - } else { - const valueType = typeof value; - span.setAttribute(RequestInformation.requestTypeKey, valueType); - if (!value) { - writer.writeNullValue(undefined); - } else if (valueType === "boolean") { - writer.writeBooleanValue(undefined, value as any as boolean); - } else if (valueType === "string") { - writer.writeStringValue(undefined, value as any as string); - } else if (value instanceof Date) { - writer.writeDateValue(undefined, value as any as Date); - } else if (value instanceof DateOnly) { - writer.writeDateOnlyValue(undefined, value as any as DateOnly); - } else if (value instanceof TimeOnly) { - writer.writeTimeOnlyValue(undefined, value as any as TimeOnly); - } else if (value instanceof Duration) { - writer.writeDurationValue(undefined, value as any as Duration); - } else if (valueType === "number") { - writer.writeNumberValue(undefined, value as any as number); - } else if (Array.isArray(value)) { - writer.writeCollectionOfPrimitiveValues(undefined, value); - } else { - throw new Error( - `encountered unknown value type during serialization ${valueType}`, - ); - } - } - this.setContentAndContentType(writer, contentType); - } finally { - span.end(); - } - }); - }; - /** - * Sets the request body to be a binary stream. - * @param value the binary stream - * @param contentType the content type. - */ - public setStreamContent = ( - value: ArrayBuffer, - contentType?: string, - ): void => { - if (!contentType) { - contentType = RequestInformation.binaryContentType; - } - this.headers.tryAdd(RequestInformation.contentTypeHeader, contentType); - this.content = value; - }; - /** - * Sets the query string parameters from a raw object. - * @param parameters the parameters. - * @param p the mapping from code symbol to URI template parameter name. - */ - public setQueryStringParametersFromRawObject( - q?: T, - p?: Record, - ): void { - if (q === null || q === undefined) return; - Object.entries(q).forEach(([k, v]) => { - let key = k; - if (p) { - const keyCandidate = p[key]; - if (keyCandidate) { - key = keyCandidate; - } - } - this.queryParameters[key] = v; - }); - } - /** - * Configure the current request with headers, query parameters and options. - * @param config the configuration object to use. - * @param queryParametersMapper mapping between code symbols and URI template parameter names. - */ - public configure( - config?: RequestConfiguration, - queryParametersMapper?: Record, - ): void { - if (!config) return; - this.addRequestHeaders(config.headers); - this.setQueryStringParametersFromRawObject( - config.queryParameters, - queryParametersMapper, - ); - this.addRequestOptions(config.options); - } + if (Array.isArray(value)) { + span.setAttribute(RequestInformation.requestTypeKey, "[]"); + writer.writeCollectionOfPrimitiveValues(undefined, value); + } else { + const valueType = typeof value; + span.setAttribute(RequestInformation.requestTypeKey, valueType); + if (!value) { + writer.writeNullValue(undefined); + } else if (valueType === "boolean") { + writer.writeBooleanValue(undefined, value as any as boolean); + } else if (valueType === "string") { + writer.writeStringValue(undefined, value as any as string); + } else if (value instanceof Date) { + writer.writeDateValue(undefined, value as any as Date); + } else if (value instanceof DateOnly) { + writer.writeDateOnlyValue(undefined, value as any as DateOnly); + } else if (value instanceof TimeOnly) { + writer.writeTimeOnlyValue(undefined, value as any as TimeOnly); + } else if (value instanceof Duration) { + writer.writeDurationValue(undefined, value as any as Duration); + } else if (valueType === "number") { + writer.writeNumberValue(undefined, value as any as number); + } else if (Array.isArray(value)) { + writer.writeCollectionOfPrimitiveValues(undefined, value); + } else { + throw new Error(`encountered unknown value type during serialization ${valueType}`); + } + } + this.setContentAndContentType(writer, contentType); + } finally { + span.end(); + } + }); + }; + /** + * Sets the request body to be a binary stream. + * @param value the binary stream + * @param contentType the content type. + */ + public setStreamContent = (value: ArrayBuffer, contentType?: string): void => { + if (!contentType) { + contentType = RequestInformation.binaryContentType; + } + this.headers.tryAdd(RequestInformation.contentTypeHeader, contentType); + this.content = value; + }; + /** + * Sets the query string parameters from a raw object. + * @param parameters the parameters. + * @param p the mapping from code symbol to URI template parameter name. + */ + public setQueryStringParametersFromRawObject(q?: T, p?: Record): void { + if (q === null || q === undefined) return; + Object.entries(q).forEach(([k, v]) => { + let key = k; + if (p) { + const keyCandidate = p[key]; + if (keyCandidate) { + key = keyCandidate; + } + } + this.queryParameters[key] = v; + }); + } + /** + * Configure the current request with headers, query parameters and options. + * @param config the configuration object to use. + * @param queryParametersMapper mapping between code symbols and URI template parameter names. + */ + public configure(config?: RequestConfiguration, queryParametersMapper?: Record): void { + if (!config) return; + this.addRequestHeaders(config.headers); + this.setQueryStringParametersFromRawObject(config.queryParameters, queryParametersMapper); + this.addRequestOptions(config.options); + } } /** * Describes the contract of request adapter set content methods so it can be used in request metadata. */ export interface RequestInformationSetContent { - setStreamContent(value: ArrayBuffer, contentType?: string): void; - setContentFromScalar( - requestAdapter: RequestAdapter | undefined, - contentType: string | undefined, - value: T[] | T, - ): void; - setContentFromParsable( - requestAdapter?: RequestAdapter | undefined, - contentType?: string | undefined, - value?: T[] | T, - modelSerializerFunction?: ModelSerializerFunction, - ): void; + setStreamContent(value: ArrayBuffer, contentType?: string): void; + setContentFromScalar(requestAdapter: RequestAdapter | undefined, contentType: string | undefined, value: T[] | T): void; + setContentFromParsable(requestAdapter?: RequestAdapter | undefined, contentType?: string | undefined, value?: T[] | T, modelSerializerFunction?: ModelSerializerFunction): void; } diff --git a/packages/abstractions/src/requestOption.ts b/packages/abstractions/src/requestOption.ts index 510de9ca9..a6ff8adaa 100644 --- a/packages/abstractions/src/requestOption.ts +++ b/packages/abstractions/src/requestOption.ts @@ -1,5 +1,12 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /** Represents a request option. */ export interface RequestOption { - /** Gets the option key for when adding it to a request. Must be unique. */ - getKey(): string; + /** Gets the option key for when adding it to a request. Must be unique. */ + getKey(): string; } diff --git a/packages/abstractions/src/responseHandler.ts b/packages/abstractions/src/responseHandler.ts index 685d9e3cd..2b2606bc4 100644 --- a/packages/abstractions/src/responseHandler.ts +++ b/packages/abstractions/src/responseHandler.ts @@ -1,17 +1,20 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { type ErrorMappings } from "./requestAdapter"; /** Defines the contract for a response handler. */ export interface ResponseHandler { - /** - * Callback method that is invoked when a response is received. - * @param response The native response object. - * @param errorMappings the error factories mapping to use in case of a failed request. - * @typeParam NativeResponseType The type of the native response object. - * @typeParam ModelType The type of the response model object. - * @return A {@link Promise} that represents the asynchronous operation and contains the deserialized response. - */ - handleResponse( - response: NativeResponseType, - errorMappings: ErrorMappings | undefined, - ): Promise; + /** + * Callback method that is invoked when a response is received. + * @param response The native response object. + * @param errorMappings the error factories mapping to use in case of a failed request. + * @typeParam NativeResponseType The type of the native response object. + * @typeParam ModelType The type of the response model object. + * @return A {@link Promise} that represents the asynchronous operation and contains the deserialized response. + */ + handleResponse(response: NativeResponseType, errorMappings: ErrorMappings | undefined): Promise; } diff --git a/packages/abstractions/src/responseHandlerOptions.ts b/packages/abstractions/src/responseHandlerOptions.ts index 6959cadb1..73521276e 100644 --- a/packages/abstractions/src/responseHandlerOptions.ts +++ b/packages/abstractions/src/responseHandlerOptions.ts @@ -16,12 +16,12 @@ export const ResponseHandlerOptionKey = "ResponseHandlerOptionKey"; * Options to intercept the request from the main pipeline. */ export class ResponseHandlerOption implements RequestOption { - /** - * @public - * The response handler to be used when processing the response. - */ - public responseHandler?: ResponseHandler; - public getKey(): string { - return ResponseHandlerOptionKey; - } + /** + * @public + * The response handler to be used when processing the response. + */ + public responseHandler?: ResponseHandler; + public getKey(): string { + return ResponseHandlerOptionKey; + } } diff --git a/packages/abstractions/src/serialization/additionalDataHolder.ts b/packages/abstractions/src/serialization/additionalDataHolder.ts index f06377a07..d3ca73c6b 100644 --- a/packages/abstractions/src/serialization/additionalDataHolder.ts +++ b/packages/abstractions/src/serialization/additionalDataHolder.ts @@ -1,8 +1,15 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /** Defines a contract for models that can hold additional data besides the described properties. */ export interface AdditionalDataHolder { - /** - * Gets the additional data for this object that did not belong to the properties. - * @return The additional data for this object. - */ - additionalData?: Record; + /** + * Gets the additional data for this object that did not belong to the properties. + * @return The additional data for this object. + */ + additionalData?: Record; } diff --git a/packages/abstractions/src/serialization/index.ts b/packages/abstractions/src/serialization/index.ts index 30196f7e2..b607ffdfe 100644 --- a/packages/abstractions/src/serialization/index.ts +++ b/packages/abstractions/src/serialization/index.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ export * from "./additionalDataHolder"; export * from "./kiotaJsonSerializer"; export * from "./kiotaSerializer"; diff --git a/packages/abstractions/src/serialization/kiotaJsonSerializer.ts b/packages/abstractions/src/serialization/kiotaJsonSerializer.ts index 84355927b..a3a7204d9 100644 --- a/packages/abstractions/src/serialization/kiotaJsonSerializer.ts +++ b/packages/abstractions/src/serialization/kiotaJsonSerializer.ts @@ -1,11 +1,10 @@ -import { - deserialize, - deserializeCollection, - serialize, - serializeCollection, - serializeCollectionToString as serializeCollectionAsString, - serializeToString as serializeAsString, -} from "./kiotaSerializer"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { deserialize, deserializeCollection, serialize, serializeCollection, serializeCollectionToString as serializeCollectionAsString, serializeToString as serializeAsString } from "./kiotaSerializer"; import type { Parsable } from "./parsable"; import type { ParsableFactory } from "./parsableFactory"; import type { ModelSerializerFunction } from "./serializationFunctionTypes"; @@ -17,11 +16,8 @@ const jsonContentType = "application/json"; * @param serializationFunction the serialization function for the model type * @returns a buffer containing the serialized value */ -export function serializeToJson( - value: T, - serializationFunction: ModelSerializerFunction, -): ArrayBuffer { - return serialize(jsonContentType, value, serializationFunction); +export function serializeToJson(value: T, serializationFunction: ModelSerializerFunction): ArrayBuffer { + return serialize(jsonContentType, value, serializationFunction); } /** @@ -30,11 +26,8 @@ export function serializeToJson( * @param serializationFunction the serialization function for the model type * @returns a string representing the serialized value */ -export function serializeToJsonAsString( - value: T, - serializationFunction: ModelSerializerFunction, -): string { - return serializeAsString(jsonContentType, value, serializationFunction); +export function serializeToJsonAsString(value: T, serializationFunction: ModelSerializerFunction): string { + return serializeAsString(jsonContentType, value, serializationFunction); } /** @@ -43,11 +36,8 @@ export function serializeToJsonAsString( * @param serializationFunction the serialization function for the model type * @returns a string representing the serialized value */ -export function serializeCollectionToJson( - values: T[], - serializationFunction: ModelSerializerFunction, -): ArrayBuffer { - return serializeCollection(jsonContentType, values, serializationFunction); +export function serializeCollectionToJson(values: T[], serializationFunction: ModelSerializerFunction): ArrayBuffer { + return serializeCollection(jsonContentType, values, serializationFunction); } /** @@ -56,15 +46,8 @@ export function serializeCollectionToJson( * @param serializationFunction the serialization function for the model type * @returns a string representing the serialized value */ -export function serializeCollectionToJsonAsString( - values: T[], - serializationFunction: ModelSerializerFunction, -): string { - return serializeCollectionAsString( - jsonContentType, - values, - serializationFunction, - ); +export function serializeCollectionToJsonAsString(values: T[], serializationFunction: ModelSerializerFunction): string { + return serializeCollectionAsString(jsonContentType, values, serializationFunction); } /** @@ -73,11 +56,8 @@ export function serializeCollectionToJsonAsString( * @param factory the factory for the model type * @returns the deserialized parsable object */ -export function deserializeFromJson( - bufferOrString: ArrayBuffer | string, - factory: ParsableFactory, -): Parsable { - return deserialize(jsonContentType, bufferOrString, factory); +export function deserializeFromJson(bufferOrString: ArrayBuffer | string, factory: ParsableFactory): Parsable { + return deserialize(jsonContentType, bufferOrString, factory); } /** @@ -86,9 +66,6 @@ export function deserializeFromJson( * @param factory the factory for the model type * @returns the deserialized collection of parsable objects */ -export function deserializeCollectionFromJson( - bufferOrString: ArrayBuffer | string, - factory: ParsableFactory, -): T[] | undefined { - return deserializeCollection(jsonContentType, bufferOrString, factory); +export function deserializeCollectionFromJson(bufferOrString: ArrayBuffer | string, factory: ParsableFactory): T[] | undefined { + return deserializeCollection(jsonContentType, bufferOrString, factory); } diff --git a/packages/abstractions/src/serialization/kiotaSerializer.ts b/packages/abstractions/src/serialization/kiotaSerializer.ts index aab4288dc..09b08a2f2 100644 --- a/packages/abstractions/src/serialization/kiotaSerializer.ts +++ b/packages/abstractions/src/serialization/kiotaSerializer.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { Parsable } from "./parsable"; import type { ParsableFactory } from "./parsableFactory"; import type { ParseNode } from "./parseNode"; @@ -13,18 +19,10 @@ import { SerializationWriterFactoryRegistry } from "./serializationWriterFactory * @param serializationFunction the serialization function for the model type * @returns a buffer containing the serialized value */ -export function serialize( - contentType: string, - value: T, - serializationFunction: ModelSerializerFunction, -): ArrayBuffer { - const writer = getSerializationWriter( - contentType, - value, - serializationFunction, - ); - writer.writeObjectValue(undefined, value, serializationFunction); - return writer.getSerializedContent(); +export function serialize(contentType: string, value: T, serializationFunction: ModelSerializerFunction): ArrayBuffer { + const writer = getSerializationWriter(contentType, value, serializationFunction); + writer.writeObjectValue(undefined, value, serializationFunction); + return writer.getSerializedContent(); } /** * Serializes a parsable object into a string representation @@ -33,13 +31,9 @@ export function serialize( * @param serializationFunction the serialization function for the model type * @returns a string representing the serialized value */ -export function serializeToString( - contentType: string, - value: T, - serializationFunction: ModelSerializerFunction, -): string { - const buffer = serialize(contentType, value, serializationFunction); - return getStringValueFromBuffer(buffer); +export function serializeToString(contentType: string, value: T, serializationFunction: ModelSerializerFunction): string { + const buffer = serialize(contentType, value, serializationFunction); + return getStringValueFromBuffer(buffer); } /** * Serializes a collection of parsable objects into a buffer @@ -48,22 +42,10 @@ export function serializeToString( * @param serializationFunction the serialization function for the model type * @returns a string representing the serialized value */ -export function serializeCollection( - contentType: string, - values: T[], - serializationFunction: ModelSerializerFunction, -): ArrayBuffer { - const writer = getSerializationWriter( - contentType, - values, - serializationFunction, - ); - writer.writeCollectionOfObjectValues( - undefined, - values, - serializationFunction, - ); - return writer.getSerializedContent(); +export function serializeCollection(contentType: string, values: T[], serializationFunction: ModelSerializerFunction): ArrayBuffer { + const writer = getSerializationWriter(contentType, values, serializationFunction); + writer.writeCollectionOfObjectValues(undefined, values, serializationFunction); + return writer.getSerializedContent(); } /** @@ -73,41 +55,27 @@ export function serializeCollection( * @param serializationFunction the serialization function for the model type * @returns a string representing the serialized value */ -export function serializeCollectionToString( - contentType: string, - values: T[], - serializationFunction: ModelSerializerFunction, -): string { - const buffer = serializeCollection( - contentType, - values, - serializationFunction, - ); - return getStringValueFromBuffer(buffer); +export function serializeCollectionToString(contentType: string, values: T[], serializationFunction: ModelSerializerFunction): string { + const buffer = serializeCollection(contentType, values, serializationFunction); + return getStringValueFromBuffer(buffer); } -function getSerializationWriter( - contentType: string, - value: unknown, - serializationFunction: unknown, -): SerializationWriter { - if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } - if (!value) { - throw new Error("value cannot be undefined"); - } - if (!serializationFunction) { - throw new Error("serializationFunction cannot be undefined"); - } - return SerializationWriterFactoryRegistry.defaultInstance.getSerializationWriter( - contentType, - ); +function getSerializationWriter(contentType: string, value: unknown, serializationFunction: unknown): SerializationWriter { + if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } + if (!value) { + throw new Error("value cannot be undefined"); + } + if (!serializationFunction) { + throw new Error("serializationFunction cannot be undefined"); + } + return SerializationWriterFactoryRegistry.defaultInstance.getSerializationWriter(contentType); } function getStringValueFromBuffer(buffer: ArrayBuffer): string { - const decoder = new TextDecoder(); - return decoder.decode(buffer); + const decoder = new TextDecoder(); + return decoder.decode(buffer); } /** @@ -117,35 +85,24 @@ function getStringValueFromBuffer(buffer: ArrayBuffer): string { * @param factory the factory for the model type * @returns the deserialized parsable object */ -export function deserialize( - contentType: string, - bufferOrString: ArrayBuffer | string, - factory: ParsableFactory, -): Parsable { - if (typeof bufferOrString === "string") { - bufferOrString = getBufferFromString(bufferOrString); - } - const reader = getParseNode(contentType, bufferOrString, factory); - return reader.getObjectValue(factory); +export function deserialize(contentType: string, bufferOrString: ArrayBuffer | string, factory: ParsableFactory): Parsable { + if (typeof bufferOrString === "string") { + bufferOrString = getBufferFromString(bufferOrString); + } + const reader = getParseNode(contentType, bufferOrString, factory); + return reader.getObjectValue(factory); } -function getParseNode( - contentType: string, - buffer: ArrayBuffer, - factory: unknown, -): ParseNode { - if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } - if (!buffer) { - throw new Error("buffer cannot be undefined"); - } - if (!factory) { - throw new Error("factory cannot be undefined"); - } - return ParseNodeFactoryRegistry.defaultInstance.getRootParseNode( - contentType, - buffer, - ); +function getParseNode(contentType: string, buffer: ArrayBuffer, factory: unknown): ParseNode { + if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } + if (!buffer) { + throw new Error("buffer cannot be undefined"); + } + if (!factory) { + throw new Error("factory cannot be undefined"); + } + return ParseNodeFactoryRegistry.defaultInstance.getRootParseNode(contentType, buffer); } /** * Deserializes a buffer into a a collection of parsable object @@ -154,19 +111,15 @@ function getParseNode( * @param factory the factory for the model type * @returns the deserialized collection of parsable objects */ -export function deserializeCollection( - contentType: string, - bufferOrString: ArrayBuffer | string, - factory: ParsableFactory, -): T[] | undefined { - if (typeof bufferOrString === "string") { - bufferOrString = getBufferFromString(bufferOrString); - } - const reader = getParseNode(contentType, bufferOrString, factory); - return reader.getCollectionOfObjectValues(factory); +export function deserializeCollection(contentType: string, bufferOrString: ArrayBuffer | string, factory: ParsableFactory): T[] | undefined { + if (typeof bufferOrString === "string") { + bufferOrString = getBufferFromString(bufferOrString); + } + const reader = getParseNode(contentType, bufferOrString, factory); + return reader.getCollectionOfObjectValues(factory); } function getBufferFromString(value: string): ArrayBuffer { - const encoder = new TextEncoder(); - return encoder.encode(value).buffer; + const encoder = new TextEncoder(); + return encoder.encode(value).buffer; } diff --git a/packages/abstractions/src/serialization/parsable.ts b/packages/abstractions/src/serialization/parsable.ts index 995ea48dc..5060826c7 100644 --- a/packages/abstractions/src/serialization/parsable.ts +++ b/packages/abstractions/src/serialization/parsable.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /** * Defines a serializable model object. */ diff --git a/packages/abstractions/src/serialization/parsableFactory.ts b/packages/abstractions/src/serialization/parsableFactory.ts index 216ae4c2a..d48ba49fb 100644 --- a/packages/abstractions/src/serialization/parsableFactory.ts +++ b/packages/abstractions/src/serialization/parsableFactory.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { Parsable } from "./parsable"; import type { ParseNode } from "./parseNode"; import type { DeserializeIntoModelFunction } from "./serializationFunctionTypes"; @@ -7,6 +13,4 @@ import type { DeserializeIntoModelFunction } from "./serializationFunctionTypes" * @param parseNode The node to parse use to get the discriminator value from the payload. * @returns The parsable object. */ -export type ParsableFactory = ( - parseNode: ParseNode | undefined -) => DeserializeIntoModelFunction; +export type ParsableFactory = (parseNode: ParseNode | undefined) => DeserializeIntoModelFunction; diff --git a/packages/abstractions/src/serialization/parseNode.ts b/packages/abstractions/src/serialization/parseNode.ts index 6098d09eb..d0eaafc87 100644 --- a/packages/abstractions/src/serialization/parseNode.ts +++ b/packages/abstractions/src/serialization/parseNode.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { Guid } from "guid-typescript"; import type { DateOnly } from "../dateOnly"; @@ -10,94 +16,92 @@ import type { ParsableFactory } from "./parsableFactory"; * Interface for a deserialization node in a parse tree. This interface provides an abstraction layer over serialization formats, libraries and implementations. */ export interface ParseNode { - /** - * Gets the string value of the node. - * @return the string value of the node. - */ - getStringValue(): string | undefined; - /** - * Gets a new parse node for the given identifier. - * @param identifier the identifier of the current node property. - * @return a new parse node for the given identifier. - */ - getChildNode(identifier: string): ParseNode | undefined; - /** - * Gets the boolean value of the node. - * @return the boolean value of the node. - */ - getBooleanValue(): boolean | undefined; - /** - * Gets the Number value of the node. - * @return the Number value of the node. - */ - getNumberValue(): number | undefined; - /** - * Gets the Guid value of the node. - * @return the Guid value of the node. - */ - getGuidValue(): Guid | undefined; - /** - * Gets the Date value of the node. - * @return the Date value of the node. - */ - getDateValue(): Date | undefined; - /** - * Gets the Duration value of the node. - * @return the Duration value of the node. - */ - getDurationValue(): Duration | undefined; - /** - * Gets the DateOnly value of the node. - * @return the DateOnly value of the node. - */ - getDateOnlyValue(): DateOnly | undefined; - /** - * Gets the TimeOnly value of the node. - * @return the TimeOnly value of the node. - */ - getTimeOnlyValue(): TimeOnly | undefined; - /** - * Gets the collection of primitive values of the node. - * @return the collection of primitive values of the node. - */ - getCollectionOfPrimitiveValues(): T[] | undefined; - /** - * Gets the collection of object values of the node. - * @return the collection of object values of the node. - */ - getCollectionOfObjectValues( - parsableFactory: ParsableFactory, - ): T[] | undefined; + /** + * Gets the string value of the node. + * @return the string value of the node. + */ + getStringValue(): string | undefined; + /** + * Gets a new parse node for the given identifier. + * @param identifier the identifier of the current node property. + * @return a new parse node for the given identifier. + */ + getChildNode(identifier: string): ParseNode | undefined; + /** + * Gets the boolean value of the node. + * @return the boolean value of the node. + */ + getBooleanValue(): boolean | undefined; + /** + * Gets the Number value of the node. + * @return the Number value of the node. + */ + getNumberValue(): number | undefined; + /** + * Gets the Guid value of the node. + * @return the Guid value of the node. + */ + getGuidValue(): Guid | undefined; + /** + * Gets the Date value of the node. + * @return the Date value of the node. + */ + getDateValue(): Date | undefined; + /** + * Gets the Duration value of the node. + * @return the Duration value of the node. + */ + getDurationValue(): Duration | undefined; + /** + * Gets the DateOnly value of the node. + * @return the DateOnly value of the node. + */ + getDateOnlyValue(): DateOnly | undefined; + /** + * Gets the TimeOnly value of the node. + * @return the TimeOnly value of the node. + */ + getTimeOnlyValue(): TimeOnly | undefined; + /** + * Gets the collection of primitive values of the node. + * @return the collection of primitive values of the node. + */ + getCollectionOfPrimitiveValues(): T[] | undefined; + /** + * Gets the collection of object values of the node. + * @return the collection of object values of the node. + */ + getCollectionOfObjectValues(parsableFactory: ParsableFactory): T[] | undefined; - /** - * Gets the model object value of the node. - * @return the model object value of the node. - */ - getObjectValue(parsableFactory: ParsableFactory): T; + /** + * Gets the model object value of the node. + * @return the model object value of the node. + */ + getObjectValue(parsableFactory: ParsableFactory): T; - /** - * Gets the Enum values of the node. - * @return the Enum values of the node. - */ - getCollectionOfEnumValues(type: any): T[]; - /** - * Gets the Enum value of the node. - * @return the Enum value of the node. - */ - getEnumValue(type: any): T | undefined; - /** - * Gets the callback called before the node is deserialized. - * @return the callback called before the node is deserialized. - */ - onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; - /** - * Gets the callback called after the node is deserialized. - * @return the callback called after the node is deserialized. - */ - onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; - /** - * Gets the byte array value of the node. - * @return the byte array value of the node. - */ - getByteArrayValue(): ArrayBuffer | undefined; + /** + * Gets the Enum values of the node. + * @return the Enum values of the node. + */ + getCollectionOfEnumValues(type: any): T[]; + /** + * Gets the Enum value of the node. + * @return the Enum value of the node. + */ + getEnumValue(type: any): T | undefined; + /** + * Gets the callback called before the node is deserialized. + * @return the callback called before the node is deserialized. + */ + onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; + /** + * Gets the callback called after the node is deserialized. + * @return the callback called after the node is deserialized. + */ + onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; + /** + * Gets the byte array value of the node. + * @return the byte array value of the node. + */ + getByteArrayValue(): ArrayBuffer | undefined; } diff --git a/packages/abstractions/src/serialization/parseNodeFactory.ts b/packages/abstractions/src/serialization/parseNodeFactory.ts index f6eb74447..24b4ebe9f 100644 --- a/packages/abstractions/src/serialization/parseNodeFactory.ts +++ b/packages/abstractions/src/serialization/parseNodeFactory.ts @@ -1,18 +1,24 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { ParseNode } from "./parseNode"; /** * Defines the contract for a factory that is used to create {@link ParseNode}s. */ export interface ParseNodeFactory { - /** - * Returns the content type this factory's parse nodes can deserialize. - */ - getValidContentType(): string; - /** - * Creates a {@link ParseNode} from the given {@link ArrayBuffer} and content type. - * @param content the {@link ArrayBuffer} to read from. - * @param contentType the content type of the {@link ArrayBuffer}. - * @return a {@link ParseNode} that can deserialize the given {@link ArrayBuffer}. - */ - getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode; + /** + * Returns the content type this factory's parse nodes can deserialize. + */ + getValidContentType(): string; + /** + * Creates a {@link ParseNode} from the given {@link ArrayBuffer} and content type. + * @param content the {@link ArrayBuffer} to read from. + * @param contentType the content type of the {@link ArrayBuffer}. + * @return a {@link ParseNode} that can deserialize the given {@link ArrayBuffer}. + */ + getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode; } diff --git a/packages/abstractions/src/serialization/parseNodeFactoryRegistry.ts b/packages/abstractions/src/serialization/parseNodeFactoryRegistry.ts index 984be25e8..909b0ba95 100644 --- a/packages/abstractions/src/serialization/parseNodeFactoryRegistry.ts +++ b/packages/abstractions/src/serialization/parseNodeFactoryRegistry.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { ParseNode } from "./parseNode"; import type { ParseNodeFactory } from "./parseNodeFactory"; @@ -5,42 +11,30 @@ import type { ParseNodeFactory } from "./parseNodeFactory"; * This factory holds a list of all the registered factories for the various types of nodes. */ export class ParseNodeFactoryRegistry implements ParseNodeFactory { - /** Default singleton instance of the registry to be used when registring new factories that should be available by default. */ - public static readonly defaultInstance = new ParseNodeFactoryRegistry(); - public getValidContentType(): string { - throw new Error( - "The registry supports multiple content types. Get the registered factory instead." - ); - } - /** List of factories that are registered by content type. */ - public contentTypeAssociatedFactories = new Map(); - public getRootParseNode( - contentType: string, - content: ArrayBuffer - ): ParseNode { - if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } - if (!content) { - throw new Error("content cannot be undefined or empty"); - } - const vendorSpecificContentType = contentType.split(";")[0]; - let factory = this.contentTypeAssociatedFactories.get( - vendorSpecificContentType - ); - if (factory) { - return factory.getRootParseNode(vendorSpecificContentType, content); - } - const cleanedContentType = vendorSpecificContentType.replace( - /[^/]+\+/gi, - "" - ); - factory = this.contentTypeAssociatedFactories.get(cleanedContentType); - if (factory) { - return factory.getRootParseNode(cleanedContentType, content); - } - throw new Error( - `Content type ${cleanedContentType} does not have a factory registered to be parsed` - ); - } + /** Default singleton instance of the registry to be used when registring new factories that should be available by default. */ + public static readonly defaultInstance = new ParseNodeFactoryRegistry(); + public getValidContentType(): string { + throw new Error("The registry supports multiple content types. Get the registered factory instead."); + } + /** List of factories that are registered by content type. */ + public contentTypeAssociatedFactories = new Map(); + public getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode { + if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } + if (!content) { + throw new Error("content cannot be undefined or empty"); + } + const vendorSpecificContentType = contentType.split(";")[0]; + let factory = this.contentTypeAssociatedFactories.get(vendorSpecificContentType); + if (factory) { + return factory.getRootParseNode(vendorSpecificContentType, content); + } + const cleanedContentType = vendorSpecificContentType.replace(/[^/]+\+/gi, ""); + factory = this.contentTypeAssociatedFactories.get(cleanedContentType); + if (factory) { + return factory.getRootParseNode(cleanedContentType, content); + } + throw new Error(`Content type ${cleanedContentType} does not have a factory registered to be parsed`); + } } diff --git a/packages/abstractions/src/serialization/parseNodeProxyFactory.ts b/packages/abstractions/src/serialization/parseNodeProxyFactory.ts index c225407a1..761e3c679 100644 --- a/packages/abstractions/src/serialization/parseNodeProxyFactory.ts +++ b/packages/abstractions/src/serialization/parseNodeProxyFactory.ts @@ -1,42 +1,45 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { Parsable } from "./parsable"; import type { ParseNode } from "./parseNode"; import type { ParseNodeFactory } from "./parseNodeFactory"; /** Proxy factory that allows the composition of before and after callbacks on existing factories. */ export abstract class ParseNodeProxyFactory implements ParseNodeFactory { - public getValidContentType(): string { - return this._concrete.getValidContentType(); - } - /** - * Creates a new proxy factory that wraps the specified concrete factory while composing the before and after callbacks. - * @param _concrete the concrete factory to wrap - * @param _onBefore the callback to invoke before the deserialization of any model object. - * @param _onAfter the callback to invoke after the deserialization of any model object. - */ - constructor( - private readonly _concrete: ParseNodeFactory, - private readonly _onBefore: (value: Parsable) => void, - private readonly _onAfter: (value: Parsable) => void - ) { - if (!_concrete) { - throw new Error("_concrete cannot be undefined"); - } - } - public getRootParseNode( - contentType: string, - content: ArrayBuffer - ): ParseNode { - const node = this._concrete.getRootParseNode(contentType, content); - const originalBefore = node.onBeforeAssignFieldValues; - const originalAfter = node.onAfterAssignFieldValues; - node.onBeforeAssignFieldValues = (value) => { - this._onBefore && this._onBefore(value); - originalBefore && originalBefore(value); - }; - node.onAfterAssignFieldValues = (value) => { - this._onAfter && this._onAfter(value); - originalAfter && originalAfter(value); - }; - return node; - } + public getValidContentType(): string { + return this._concrete.getValidContentType(); + } + /** + * Creates a new proxy factory that wraps the specified concrete factory while composing the before and after callbacks. + * @param _concrete the concrete factory to wrap + * @param _onBefore the callback to invoke before the deserialization of any model object. + * @param _onAfter the callback to invoke after the deserialization of any model object. + */ + constructor( + private readonly _concrete: ParseNodeFactory, + private readonly _onBefore: (value: Parsable) => void, + private readonly _onAfter: (value: Parsable) => void, + ) { + if (!_concrete) { + throw new Error("_concrete cannot be undefined"); + } + } + public getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode { + const node = this._concrete.getRootParseNode(contentType, content); + const originalBefore = node.onBeforeAssignFieldValues; + const originalAfter = node.onAfterAssignFieldValues; + node.onBeforeAssignFieldValues = (value) => { + this._onBefore && this._onBefore(value); + originalBefore && originalBefore(value); + }; + node.onAfterAssignFieldValues = (value) => { + this._onAfter && this._onAfter(value); + originalAfter && originalAfter(value); + }; + return node; + } } diff --git a/packages/abstractions/src/serialization/serializationFunctionTypes.ts b/packages/abstractions/src/serialization/serializationFunctionTypes.ts index b12e53a7b..920ae6130 100644 --- a/packages/abstractions/src/serialization/serializationFunctionTypes.ts +++ b/packages/abstractions/src/serialization/serializationFunctionTypes.ts @@ -1,12 +1,13 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { Parsable } from "./parsable"; import type { ParseNode } from "./parseNode"; import type { SerializationWriter } from "./serializationWriter"; -export type ModelSerializerFunction = ( - writer: SerializationWriter, - value?: Partial | undefined, -) => void; +export type ModelSerializerFunction = (writer: SerializationWriter, value?: Partial | undefined) => void; -export type DeserializeIntoModelFunction = ( - value?: Partial | undefined, -) => Record void>; +export type DeserializeIntoModelFunction = (value?: Partial | undefined) => Record void>; diff --git a/packages/abstractions/src/serialization/serializationWriter.ts b/packages/abstractions/src/serialization/serializationWriter.ts index 92951bcbc..07ae8faa1 100644 --- a/packages/abstractions/src/serialization/serializationWriter.ts +++ b/packages/abstractions/src/serialization/serializationWriter.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { Guid } from "guid-typescript"; import type { DateOnly } from "../dateOnly"; @@ -8,141 +14,113 @@ import type { ModelSerializerFunction } from "./serializationFunctionTypes"; /** Defines an interface for serialization of objects to a stream. */ export interface SerializationWriter { - /** - * Writes the specified byte array value to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeByteArrayValue(key?: string | undefined, value?: ArrayBuffer): void; - /** - * Writes the specified string value to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeStringValue(key?: string | undefined, value?: string | undefined): void; - /** - * Writes the specified boolean value to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeBooleanValue( - key?: string | undefined, - value?: boolean | undefined, - ): void; - /** - * Writes the specified number value to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeNumberValue(key?: string | undefined, value?: number | undefined): void; - /** - * Writes the specified Guid value to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeGuidValue(key?: string | undefined, value?: Guid | undefined): void; - /** - * Writes the specified Date value to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeDateValue(key?: string | undefined, value?: Date | undefined): void; - /** - * Writes the specified Duration value to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeDurationValue( - key?: string | undefined, - value?: Duration | undefined, - ): void; - /** - * Writes the specified TimeOnly value to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeTimeOnlyValue( - key?: string | undefined, - value?: TimeOnly | undefined, - ): void; - /** - * Writes the specified DateOnly value to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeDateOnlyValue( - key?: string | undefined, - value?: DateOnly | undefined, - ): void; - /** - * Writes the specified collection of primitive values to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeCollectionOfPrimitiveValues( - key?: string | undefined, - values?: T[] | undefined, - ): void; - /** - * Writes the specified collection of object values to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeCollectionOfObjectValues( - key?: string | undefined, - values?: T[], - serializerMethod?: ModelSerializerFunction, - ): void; - /** - * Writes the specified model object value to the stream with an optional given key. - * @param key the key to write the value with. - * @param value the value to write to the stream. - */ - writeObjectValue( - key?: string | undefined, - value?: T | undefined, - serializerMethod?: ModelSerializerFunction, - ): void; + /** + * Writes the specified byte array value to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeByteArrayValue(key?: string | undefined, value?: ArrayBuffer): void; + /** + * Writes the specified string value to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeStringValue(key?: string | undefined, value?: string | undefined): void; + /** + * Writes the specified boolean value to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeBooleanValue(key?: string | undefined, value?: boolean | undefined): void; + /** + * Writes the specified number value to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeNumberValue(key?: string | undefined, value?: number | undefined): void; + /** + * Writes the specified Guid value to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeGuidValue(key?: string | undefined, value?: Guid | undefined): void; + /** + * Writes the specified Date value to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeDateValue(key?: string | undefined, value?: Date | undefined): void; + /** + * Writes the specified Duration value to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeDurationValue(key?: string | undefined, value?: Duration | undefined): void; + /** + * Writes the specified TimeOnly value to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeTimeOnlyValue(key?: string | undefined, value?: TimeOnly | undefined): void; + /** + * Writes the specified DateOnly value to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeDateOnlyValue(key?: string | undefined, value?: DateOnly | undefined): void; + /** + * Writes the specified collection of primitive values to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeCollectionOfPrimitiveValues(key?: string | undefined, values?: T[] | undefined): void; + /** + * Writes the specified collection of object values to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeCollectionOfObjectValues(key?: string | undefined, values?: T[], serializerMethod?: ModelSerializerFunction): void; + /** + * Writes the specified model object value to the stream with an optional given key. + * @param key the key to write the value with. + * @param value the value to write to the stream. + */ + writeObjectValue(key?: string | undefined, value?: T | undefined, serializerMethod?: ModelSerializerFunction): void; - /** - * Writes the specified enum value to the stream with an optional given key. - * @param key the key to write the value with. - * @param values the value to write to the stream. - */ - writeEnumValue( - key?: string | undefined, - ...values: (T | undefined)[] - ): void; - /** - * Writes a null value for the specified key. - * @param key the key to write the value with. - */ - writeNullValue(key?: string | undefined): void; - /** - * Gets the value of the serialized content. - * @return the value of the serialized content. - */ - getSerializedContent(): ArrayBuffer; - /** - * Writes the specified additional data values to the stream with an optional given key. - * @param value the values to write to the stream. - */ - writeAdditionalData(value: Record | undefined): void; - /** - * Gets the callback called before the object gets serialized. - * @return the callback called before the object gets serialized. - */ - onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; - /** - * Gets the callback called after the object gets serialized. - * @return the callback called after the object gets serialized. - */ - onAfterObjectSerialization: ((value: Parsable) => void) | undefined; - /** - * Gets the callback called right after the serialization process starts. - * @return the callback called right after the serialization process starts. - */ - onStartObjectSerialization: - | ((value: Parsable, writer: SerializationWriter) => void) - | undefined; + /** + * Writes the specified enum value to the stream with an optional given key. + * @param key the key to write the value with. + * @param values the value to write to the stream. + */ + writeEnumValue(key?: string | undefined, ...values: (T | undefined)[]): void; + /** + * Writes a null value for the specified key. + * @param key the key to write the value with. + */ + writeNullValue(key?: string | undefined): void; + /** + * Gets the value of the serialized content. + * @return the value of the serialized content. + */ + getSerializedContent(): ArrayBuffer; + /** + * Writes the specified additional data values to the stream with an optional given key. + * @param value the values to write to the stream. + */ + writeAdditionalData(value: Record | undefined): void; + /** + * Gets the callback called before the object gets serialized. + * @return the callback called before the object gets serialized. + */ + onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; + /** + * Gets the callback called after the object gets serialized. + * @return the callback called after the object gets serialized. + */ + onAfterObjectSerialization: ((value: Parsable) => void) | undefined; + /** + * Gets the callback called right after the serialization process starts. + * @return the callback called right after the serialization process starts. + */ + onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; } diff --git a/packages/abstractions/src/serialization/serializationWriterFactory.ts b/packages/abstractions/src/serialization/serializationWriterFactory.ts index 81c3dea31..4a7736065 100644 --- a/packages/abstractions/src/serialization/serializationWriterFactory.ts +++ b/packages/abstractions/src/serialization/serializationWriterFactory.ts @@ -1,16 +1,22 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { SerializationWriter } from "./serializationWriter"; /** Defines the contract for a factory that creates SerializationWriter instances. */ export interface SerializationWriterFactory { - /** - * Gets the content type this factory creates serialization writers for. - * @return the content type this factory creates serialization writers for. - */ - getValidContentType(): string; - /** - * Creates a new SerializationWriter instance for the given content type. - * @param contentType the content type to create a serialization writer for. - * @return a new SerializationWriter instance for the given content type. - */ - getSerializationWriter(contentType: string): SerializationWriter; + /** + * Gets the content type this factory creates serialization writers for. + * @return the content type this factory creates serialization writers for. + */ + getValidContentType(): string; + /** + * Creates a new SerializationWriter instance for the given content type. + * @param contentType the content type to create a serialization writer for. + * @return a new SerializationWriter instance for the given content type. + */ + getSerializationWriter(contentType: string): SerializationWriter; } diff --git a/packages/abstractions/src/serialization/serializationWriterFactoryRegistry.ts b/packages/abstractions/src/serialization/serializationWriterFactoryRegistry.ts index ab651dca9..492972a01 100644 --- a/packages/abstractions/src/serialization/serializationWriterFactoryRegistry.ts +++ b/packages/abstractions/src/serialization/serializationWriterFactoryRegistry.ts @@ -1,43 +1,35 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { SerializationWriter } from "./serializationWriter"; import type { SerializationWriterFactory } from "./serializationWriterFactory"; /** This factory holds a list of all the registered factories for the various types of nodes. */ -export class SerializationWriterFactoryRegistry - implements SerializationWriterFactory { - /** Default singleton instance of the registry to be used when registring new factories that should be available by default. */ - public static readonly defaultInstance = - new SerializationWriterFactoryRegistry(); - public getValidContentType(): string { - throw new Error( - "The registry supports multiple content types. Get the registered factory instead." - ); - } - /** List of factories that are registered by content type. */ - public contentTypeAssociatedFactories = new Map< - string, - SerializationWriterFactory - >(); - public getSerializationWriter(contentType: string): SerializationWriter { - if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } - const vendorSpecificContentType = contentType.split(";")[0]; - let factory = this.contentTypeAssociatedFactories.get( - vendorSpecificContentType - ); - if (factory) { - return factory.getSerializationWriter(vendorSpecificContentType); - } - const cleanedContentType = vendorSpecificContentType.replace( - /[^/]+\+/gi, - "" - ); - factory = this.contentTypeAssociatedFactories.get(cleanedContentType); - if (factory) { - return factory.getSerializationWriter(cleanedContentType); - } - throw new Error( - `Content type ${cleanedContentType} does not have a factory registered to be serialized` - ); - } +export class SerializationWriterFactoryRegistry implements SerializationWriterFactory { + /** Default singleton instance of the registry to be used when registring new factories that should be available by default. */ + public static readonly defaultInstance = new SerializationWriterFactoryRegistry(); + public getValidContentType(): string { + throw new Error("The registry supports multiple content types. Get the registered factory instead."); + } + /** List of factories that are registered by content type. */ + public contentTypeAssociatedFactories = new Map(); + public getSerializationWriter(contentType: string): SerializationWriter { + if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } + const vendorSpecificContentType = contentType.split(";")[0]; + let factory = this.contentTypeAssociatedFactories.get(vendorSpecificContentType); + if (factory) { + return factory.getSerializationWriter(vendorSpecificContentType); + } + const cleanedContentType = vendorSpecificContentType.replace(/[^/]+\+/gi, ""); + factory = this.contentTypeAssociatedFactories.get(cleanedContentType); + if (factory) { + return factory.getSerializationWriter(cleanedContentType); + } + throw new Error(`Content type ${cleanedContentType} does not have a factory registered to be serialized`); + } } diff --git a/packages/abstractions/src/serialization/serializationWriterProxyFactory.ts b/packages/abstractions/src/serialization/serializationWriterProxyFactory.ts index 5fd7be192..569a92108 100644 --- a/packages/abstractions/src/serialization/serializationWriterProxyFactory.ts +++ b/packages/abstractions/src/serialization/serializationWriterProxyFactory.ts @@ -1,49 +1,52 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { Parsable } from "./parsable"; import type { SerializationWriter } from "./serializationWriter"; import type { SerializationWriterFactory } from "./serializationWriterFactory"; /** Proxy factory that allows the composition of before and after callbacks on existing factories. */ -export abstract class SerializationWriterProxyFactory - implements SerializationWriterFactory { - public getValidContentType(): string { - return this._concrete.getValidContentType(); - } - /** - * Creates a new proxy factory that wraps the specified concrete factory while composing the before and after callbacks. - * @param _concrete the concrete factory to wrap - * @param _onBefore the callback to invoke before the serialization of any model object. - * @param _onAfter the callback to invoke after the serialization of any model object. - * @param _onStart the callback to invoke when the serialization of a model object starts - */ - constructor( - private readonly _concrete: SerializationWriterFactory, - private readonly _onBefore?: ((value: Parsable) => void) | undefined, - private readonly _onAfter?: ((value: Parsable) => void) | undefined, - private readonly _onStart?: - | ((value: Parsable, writer: SerializationWriter) => void) - | undefined - ) { - if (!_concrete) { - throw new Error("_concrete cannot be undefined"); - } - } - public getSerializationWriter(contentType: string): SerializationWriter { - const writer = this._concrete.getSerializationWriter(contentType); - const originalBefore = writer.onBeforeObjectSerialization; - const originalAfter = writer.onAfterObjectSerialization; - const originalStart = writer.onStartObjectSerialization; - writer.onBeforeObjectSerialization = (value) => { - this._onBefore && this._onBefore(value); - originalBefore && originalBefore(value); - }; - writer.onAfterObjectSerialization = (value) => { - this._onAfter && this._onAfter(value); - originalAfter && originalAfter(value); - }; - writer.onStartObjectSerialization = (value, writer) => { - this._onStart && this._onStart(value, writer); - originalStart && originalStart(value, writer); - }; - return writer; - } +export abstract class SerializationWriterProxyFactory implements SerializationWriterFactory { + public getValidContentType(): string { + return this._concrete.getValidContentType(); + } + /** + * Creates a new proxy factory that wraps the specified concrete factory while composing the before and after callbacks. + * @param _concrete the concrete factory to wrap + * @param _onBefore the callback to invoke before the serialization of any model object. + * @param _onAfter the callback to invoke after the serialization of any model object. + * @param _onStart the callback to invoke when the serialization of a model object starts + */ + constructor( + private readonly _concrete: SerializationWriterFactory, + private readonly _onBefore?: ((value: Parsable) => void) | undefined, + private readonly _onAfter?: ((value: Parsable) => void) | undefined, + private readonly _onStart?: ((value: Parsable, writer: SerializationWriter) => void) | undefined, + ) { + if (!_concrete) { + throw new Error("_concrete cannot be undefined"); + } + } + public getSerializationWriter(contentType: string): SerializationWriter { + const writer = this._concrete.getSerializationWriter(contentType); + const originalBefore = writer.onBeforeObjectSerialization; + const originalAfter = writer.onAfterObjectSerialization; + const originalStart = writer.onStartObjectSerialization; + writer.onBeforeObjectSerialization = (value) => { + this._onBefore && this._onBefore(value); + originalBefore && originalBefore(value); + }; + writer.onAfterObjectSerialization = (value) => { + this._onAfter && this._onAfter(value); + originalAfter && originalAfter(value); + }; + writer.onStartObjectSerialization = (value, writer_) => { + this._onStart && this._onStart(value, writer_); + originalStart && originalStart(value, writer_); + }; + return writer; + } } diff --git a/packages/abstractions/src/serialization/untypedArray.ts b/packages/abstractions/src/serialization/untypedArray.ts index d97649195..63fa932ea 100644 --- a/packages/abstractions/src/serialization/untypedArray.ts +++ b/packages/abstractions/src/serialization/untypedArray.ts @@ -1,11 +1,17 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { isUntypedNode, UntypedNode } from "./untypedNode"; /** Defines an interface for defining an untyped array. */ export interface UntypedArray extends UntypedNode { - /** - * Gets the value of the UntypedNode as an array of UntypedNodes. - */ - getValue(): UntypedNode[]; + /** + * Gets the value of the UntypedNode as an array of UntypedNodes. + */ + getValue(): UntypedNode[]; } /** @@ -14,12 +20,8 @@ export interface UntypedArray extends UntypedNode { * @return boolean indicating if the node is an UntypedArray. */ export function isUntypedArray(node: UntypedNode): node is UntypedArray { - const proposedNode = node as UntypedArray; - return ( - proposedNode && - proposedNode.value instanceof Array && - proposedNode.value.every((item) => isUntypedNode(item)) - ); + const proposedNode = node as UntypedArray; + return proposedNode && proposedNode.value instanceof Array && proposedNode.value.every((item) => isUntypedNode(item)); } /** @@ -28,8 +30,8 @@ export function isUntypedArray(node: UntypedNode): node is UntypedArray { * @return The created UntypedArray. */ export function createUntypedArray(value: UntypedNode[]): UntypedArray { - return { - value: value, - getValue: () => value as UntypedNode[], - }; + return { + value, + getValue: () => value, + }; } diff --git a/packages/abstractions/src/serialization/untypedBoolean.ts b/packages/abstractions/src/serialization/untypedBoolean.ts index 9e71190d2..787d35451 100644 --- a/packages/abstractions/src/serialization/untypedBoolean.ts +++ b/packages/abstractions/src/serialization/untypedBoolean.ts @@ -1,11 +1,17 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { UntypedNode } from "./untypedNode"; /** Defines an interface for defining an untyped boolean. */ export interface UntypedBoolean extends UntypedNode { - /** - * Gets the value of the UntypedNode as a boolean value. - */ - getValue(): boolean; + /** + * Gets the value of the UntypedNode as a boolean value. + */ + getValue(): boolean; } /** @@ -14,8 +20,8 @@ export interface UntypedBoolean extends UntypedNode { * @return boolean indicating if the node is an UntypedBoolean. */ export function isUntypedBoolean(node: UntypedNode): node is UntypedBoolean { - const proposedNode = node as UntypedBoolean; - return proposedNode && typeof proposedNode.value === "boolean"; + const proposedNode = node as UntypedBoolean; + return proposedNode && typeof proposedNode.value === "boolean"; } /** @@ -24,8 +30,8 @@ export function isUntypedBoolean(node: UntypedNode): node is UntypedBoolean { * @return The created UntypedBoolean. */ export function createUntypedBoolean(value: boolean): UntypedBoolean { - return { - value: value, - getValue: () => value as boolean, - }; + return { + value, + getValue: () => value, + }; } diff --git a/packages/abstractions/src/serialization/untypedNode.ts b/packages/abstractions/src/serialization/untypedNode.ts index 314d4b9ea..64fa1a24b 100644 --- a/packages/abstractions/src/serialization/untypedNode.ts +++ b/packages/abstractions/src/serialization/untypedNode.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /* eslint-disable @typescript-eslint/no-unused-vars */ import type { Parsable } from "./parsable"; import type { ParseNode } from "./parseNode"; @@ -5,23 +12,21 @@ import type { SerializationWriter } from "./serializationWriter"; /** Defines the base interface for defining an untyped node. */ export interface UntypedNode extends Parsable { - /** - * Gets the value of the UntypedNode. - */ - getValue(): any; - /** - * The value represented by the UntypedNode. - */ - value?: any; + /** + * Gets the value of the UntypedNode. + */ + getValue(): any; + /** + * The value represented by the UntypedNode. + */ + value?: any; } /** * Factory to create an UntypedNode from a string during deserialization. */ -export function createUntypedNodeFromDiscriminatorValue( - _parseNode: ParseNode | undefined, -): (instance?: Parsable) => Record void> { - return deserializeIntoUntypedNode; +export function createUntypedNodeFromDiscriminatorValue(_parseNode: ParseNode | undefined): (_instance?: Parsable) => Record void> { + return deserializeIntoUntypedNode; } /** @@ -30,32 +35,27 @@ export function createUntypedNodeFromDiscriminatorValue( * @return boolean indicating if the node is an UntypedNode. */ export function isUntypedNode(node: any): node is UntypedNode { - const potentialNode = node as UntypedNode; - return potentialNode && potentialNode.getValue !== undefined; + const potentialNode = node as UntypedNode; + return potentialNode?.getValue !== undefined; } /** * The deserialization implementation for UntypedNode. */ -export function deserializeIntoUntypedNode( - untypedNode: Partial | undefined = {}, -): Record void> { - return { - value: (n) => { - untypedNode.value = null; - }, - getValue: (n) => { - untypedNode.getValue = () => untypedNode.value; - }, - }; +export function deserializeIntoUntypedNode(untypedNode: Partial | undefined = {}): Record void> { + return { + value: (_n) => { + untypedNode.value = null; + }, + getValue: (_n) => { + untypedNode.getValue = () => untypedNode.value; + }, + }; } /** * The serialization implementation for UntypedNode. */ -export function serializeUntypedNode( - _writer: SerializationWriter, - _errorDetails: Partial | undefined = {}, -): void { - return; +export function serializeUntypedNode(_writer: SerializationWriter, _errorDetails: Partial | undefined = {}): void { + return; } diff --git a/packages/abstractions/src/serialization/untypedNull.ts b/packages/abstractions/src/serialization/untypedNull.ts index bd7076c70..172df01d1 100644 --- a/packages/abstractions/src/serialization/untypedNull.ts +++ b/packages/abstractions/src/serialization/untypedNull.ts @@ -1,11 +1,17 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { UntypedNode } from "./untypedNode"; /** Defines the interface for defining an untyped null value. */ export interface UntypedNull extends UntypedNode { - /** - * Gets the value of the UntypedNode as null. - */ - getValue(): null; + /** + * Gets the value of the UntypedNode as null. + */ + getValue(): null; } /** @@ -14,7 +20,7 @@ export interface UntypedNull extends UntypedNode { * @return boolean indicating if the node is an UntypedNull. */ export function isUntypedNull(node: UntypedNode): node is UntypedNull { - return node.value === null; + return node.value === null; } /** @@ -22,8 +28,8 @@ export function isUntypedNull(node: UntypedNode): node is UntypedNull { * @return The created UntypedNull. */ export function createUntypedNull(): UntypedNull { - return { - value: null, - getValue: () => null, - }; + return { + value: null, + getValue: () => null, + }; } diff --git a/packages/abstractions/src/serialization/untypedNumber.ts b/packages/abstractions/src/serialization/untypedNumber.ts index 42822e1df..0b3a97bf5 100644 --- a/packages/abstractions/src/serialization/untypedNumber.ts +++ b/packages/abstractions/src/serialization/untypedNumber.ts @@ -1,11 +1,17 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { UntypedNode } from "./untypedNode"; /** Defines the interface for defining an untyped number value. */ export interface UntypedNumber extends UntypedNode { - /** - * Gets the value of the UntypedNode as a number. - */ - getValue(): number; + /** + * Gets the value of the UntypedNode as a number. + */ + getValue(): number; } /** @@ -14,8 +20,8 @@ export interface UntypedNumber extends UntypedNode { * @return boolean indicating if the node is an UntypedNumber. */ export function isUntypedNumber(node: UntypedNode): node is UntypedNumber { - const proposedNode = node as UntypedNumber; - return proposedNode && typeof proposedNode.value === "number"; + const proposedNode = node as UntypedNumber; + return proposedNode && typeof proposedNode.value === "number"; } /** @@ -24,8 +30,8 @@ export function isUntypedNumber(node: UntypedNode): node is UntypedNumber { * @return The created UntypedNumber. */ export function createUntypedNumber(value: number): UntypedNumber { - return { - value: value, - getValue: () => value as number, - }; + return { + value, + getValue: () => value, + }; } diff --git a/packages/abstractions/src/serialization/untypedObject.ts b/packages/abstractions/src/serialization/untypedObject.ts index 83c57f451..234335007 100644 --- a/packages/abstractions/src/serialization/untypedObject.ts +++ b/packages/abstractions/src/serialization/untypedObject.ts @@ -1,11 +1,17 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { isUntypedNode, UntypedNode } from "./untypedNode"; /** Defines the interface for defining an untyped object value. */ export interface UntypedObject extends UntypedNode { - /** - * Gets the value of the UntypedNode as a Record. - */ - getValue(): Record; + /** + * Gets the value of the UntypedNode as a Record. + */ + getValue(): Record; } /** @@ -14,13 +20,8 @@ export interface UntypedObject extends UntypedNode { * @return boolean indicating if the node is an UntypedObject. */ export function isUntypedObject(node: UntypedNode): node is UntypedObject { - const proposedNode = node as UntypedObject; - return ( - proposedNode && - proposedNode.value instanceof Object && - proposedNode.value instanceof Array === false && - Object.values(proposedNode.value).every((item) => isUntypedNode(item)) - ); + const proposedNode = node as UntypedObject; + return proposedNode && proposedNode.value instanceof Object && proposedNode.value instanceof Array === false && Object.values(proposedNode.value).every((item) => isUntypedNode(item)); } /** @@ -28,11 +29,9 @@ export function isUntypedObject(node: UntypedNode): node is UntypedObject { * @param value The Record value to create from. * @return The created UntypedObject. */ -export function createUntypedObject( - value: Record, -): UntypedObject { - return { - value: value, - getValue: () => value as Record, - }; +export function createUntypedObject(value: Record): UntypedObject { + return { + value, + getValue: () => value, + }; } diff --git a/packages/abstractions/src/serialization/untypedString.ts b/packages/abstractions/src/serialization/untypedString.ts index cbcbd6300..b6346f876 100644 --- a/packages/abstractions/src/serialization/untypedString.ts +++ b/packages/abstractions/src/serialization/untypedString.ts @@ -1,11 +1,17 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { UntypedNode } from "./untypedNode"; /** Defines the interface for defining an untyped string value. */ export interface UntypedString extends UntypedNode { - /** - * Gets the value of the UntypedNode as a Record. - */ - getValue(): string; + /** + * Gets the value of the UntypedNode as a Record. + */ + getValue(): string; } /** @@ -14,8 +20,8 @@ export interface UntypedString extends UntypedNode { * @return boolean indicating if the node is an UntypedString. */ export function isUntypedString(node: UntypedNode): node is UntypedString { - const proposedNode = node as UntypedString; - return proposedNode && typeof proposedNode.value === "string"; + const proposedNode = node as UntypedString; + return proposedNode && typeof proposedNode.value === "string"; } /** @@ -24,8 +30,8 @@ export function isUntypedString(node: UntypedNode): node is UntypedString { * @return The created UntypedString. */ export function createUntypedString(value: string): UntypedString { - return { - value: value, - getValue: () => value as string, - }; + return { + value, + getValue: () => value, + }; } diff --git a/packages/abstractions/src/store/backedModel.ts b/packages/abstractions/src/store/backedModel.ts index 068b6326f..14820ec3b 100644 --- a/packages/abstractions/src/store/backedModel.ts +++ b/packages/abstractions/src/store/backedModel.ts @@ -1,9 +1,15 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { BackingStore } from "./backingStore"; /** Defines the contracts for a model that is backed by a store. */ export interface BackedModel { - /** - * Gets the store that is backing the model. - */ - backingStore?: BackingStore; + /** + * Gets the store that is backing the model. + */ + backingStore?: BackingStore; } diff --git a/packages/abstractions/src/store/backedModelProxy.ts b/packages/abstractions/src/store/backedModelProxy.ts index 4e0ba9079..3531dc36f 100644 --- a/packages/abstractions/src/store/backedModelProxy.ts +++ b/packages/abstractions/src/store/backedModelProxy.ts @@ -1,31 +1,36 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { BackingStoreFactorySingleton } from "./backingStoreFactorySingleton"; // A method that creates a ProxyHandler for a generic model T and attaches it to a backing store. -export function createBackedModelProxyHandler(): ProxyHandler { +export function createBackedModelProxyHandler(): ProxyHandler { + // Each model has a backing store that is created by the BackingStoreFactorySingleton + const backingStore = BackingStoreFactorySingleton.instance.createBackingStore(); - // Each model has a backing store that is created by the BackingStoreFactorySingleton - const backingStore = BackingStoreFactorySingleton.instance.createBackingStore(); - - /** - * The ProxyHandler for the model. - */ - const handler: ProxyHandler = { - get(target, prop, receiver) { - if (prop === 'backingStore') { - return backingStore; - } - return backingStore.get(prop.toString()); - }, - set(target, prop, value, receiver) { - if (prop === 'backingStore') { - console.warn(`BackingStore - Ignoring attempt to set 'backingStore' property`); - return true; - } - // set the value on the target object as well to allow it to have keys needed for serialization/deserialization - Reflect.set(target, prop, value, receiver); - backingStore.set(prop.toString(), value); - return true; - }, - }; - return handler; -} \ No newline at end of file + /** + * The ProxyHandler for the model. + */ + const handler: ProxyHandler = { + get(_target, prop, _receiver) { + if (prop === "backingStore") { + return backingStore; + } + return backingStore.get(prop.toString()); + }, + set(target, prop, value, receiver) { + if (prop === "backingStore") { + console.warn(`BackingStore - Ignoring attempt to set 'backingStore' property`); + return true; + } + // set the value on the target object as well to allow it to have keys needed for serialization/deserialization + Reflect.set(target, prop, value, receiver); + backingStore.set(prop.toString(), value); + return true; + }, + }; + return handler; +} diff --git a/packages/abstractions/src/store/backingStore.ts b/packages/abstractions/src/store/backingStore.ts index bdad44099..e6a447611 100644 --- a/packages/abstractions/src/store/backingStore.ts +++ b/packages/abstractions/src/store/backingStore.ts @@ -1,55 +1,59 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /** * Stores model information in a different location than the object properties. Implementations can provide dirty tracking capabilities, caching capabilities or integration with 3rd party stores. */ export interface BackingStore { - /** - * Gets a value from the backing store based on its key. Returns null if the value hasn't changed and "ReturnOnlyChangedValues" is true. - * @return The value from the backing store. - * @param key The key to lookup the backing store with. - */ - get(key: string): T | undefined; - /** - * Sets or updates the stored value for the given key. - * Will trigger subscriptions callbacks. - * @param key The key to store and retrieve the information. - * @param value The value to be stored. - */ - set(key: string, value: T): void; - /** - * Enumerates all the values stored in the backing store. Values will be filtered if "ReturnOnlyChangedValues" is true. - * @return The values available in the backing store. - */ - enumerate(): { key: string; value: unknown }[]; - /** - * Enumerates the keys for all values that changed to null. - * @return The keys for the values that changed to null. - */ - enumerateKeysForValuesChangedToNull(): string[]; - /** - * Creates a subscription to any data change happening. - * @param callback Callback to be invoked on data changes where the first parameter is the data key, the second the previous value and the third the new value. - * @param subscriptionId The subscription Id to use. - * @return The subscription Id to use when removing the subscription - */ - subscribe( - callback: () => { key: string; previousValue: unknown; newValue: unknown }, - subscriptionId?: string | undefined - ): string; - /** - * Removes a subscription from the store based on its subscription id. - * @param subscriptionId The Id of the subscription to remove. - */ - unsubscribe(subscriptionId: string): void; - /** - * Clears the data stored in the backing store. Doesn't trigger any subscription. - */ - clear(): void; - /** - * Whether the initialization of the object and/or the initial deserialization has been completed to track whether objects have changed. - */ - initializationCompleted: boolean; - /** - * Whether to return only values that have changed since the initialization of the object when calling the Get and Enumerate methods. - */ - returnOnlyChangedValues: boolean; + /** + * Gets a value from the backing store based on its key. Returns null if the value hasn't changed and "ReturnOnlyChangedValues" is true. + * @return The value from the backing store. + * @param key The key to lookup the backing store with. + */ + get(key: string): T | undefined; + /** + * Sets or updates the stored value for the given key. + * Will trigger subscriptions callbacks. + * @param key The key to store and retrieve the information. + * @param value The value to be stored. + */ + set(key: string, value: T): void; + /** + * Enumerates all the values stored in the backing store. Values will be filtered if "ReturnOnlyChangedValues" is true. + * @return The values available in the backing store. + */ + enumerate(): { key: string; value: unknown }[]; + /** + * Enumerates the keys for all values that changed to null. + * @return The keys for the values that changed to null. + */ + enumerateKeysForValuesChangedToNull(): string[]; + /** + * Creates a subscription to any data change happening. + * @param callback Callback to be invoked on data changes where the first parameter is the data key, the second the previous value and the third the new value. + * @param subscriptionId The subscription Id to use. + * @return The subscription Id to use when removing the subscription + */ + subscribe(callback: () => { key: string; previousValue: unknown; newValue: unknown }, subscriptionId?: string | undefined): string; + /** + * Removes a subscription from the store based on its subscription id. + * @param subscriptionId The Id of the subscription to remove. + */ + unsubscribe(subscriptionId: string): void; + /** + * Clears the data stored in the backing store. Doesn't trigger any subscription. + */ + clear(): void; + /** + * Whether the initialization of the object and/or the initial deserialization has been completed to track whether objects have changed. + */ + initializationCompleted: boolean; + /** + * Whether to return only values that have changed since the initialization of the object when calling the Get and Enumerate methods. + */ + returnOnlyChangedValues: boolean; } diff --git a/packages/abstractions/src/store/backingStoreFactory.ts b/packages/abstractions/src/store/backingStoreFactory.ts index 373b0b1a1..61b44502c 100644 --- a/packages/abstractions/src/store/backingStoreFactory.ts +++ b/packages/abstractions/src/store/backingStoreFactory.ts @@ -1,10 +1,16 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { BackingStore } from "./backingStore"; /** Defines the contract for a factory that creates backing stores. */ export interface BackingStoreFactory { - /** - * Creates a new instance of the backing store. - * @return a new instance of the backing store. - */ - createBackingStore(): BackingStore; + /** + * Creates a new instance of the backing store. + * @return a new instance of the backing store. + */ + createBackingStore(): BackingStore; } diff --git a/packages/abstractions/src/store/backingStoreFactorySingleton.ts b/packages/abstractions/src/store/backingStoreFactorySingleton.ts index 906a2b782..5b6dc76b6 100644 --- a/packages/abstractions/src/store/backingStoreFactorySingleton.ts +++ b/packages/abstractions/src/store/backingStoreFactorySingleton.ts @@ -1,7 +1,12 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { BackingStoreFactory } from "./backingStoreFactory"; import { InMemoryBackingStoreFactory } from "./inMemoryBackingStoreFactory"; export class BackingStoreFactorySingleton { - public static instance: BackingStoreFactory = - new InMemoryBackingStoreFactory(); + public static instance: BackingStoreFactory = new InMemoryBackingStoreFactory(); } diff --git a/packages/abstractions/src/store/backingStoreParseNodeFactory.ts b/packages/abstractions/src/store/backingStoreParseNodeFactory.ts index 98b03cedd..9eb2bdc4d 100644 --- a/packages/abstractions/src/store/backingStoreParseNodeFactory.ts +++ b/packages/abstractions/src/store/backingStoreParseNodeFactory.ts @@ -1,27 +1,33 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { type ParseNodeFactory, ParseNodeProxyFactory } from "../serialization"; import type { BackedModel } from "./backedModel"; /** Proxy implementation of ParseNodeFactory for the backing store that automatically sets the state of the backing store when deserializing. */ export class BackingStoreParseNodeFactory extends ParseNodeProxyFactory { - /** - * Initializes a new instance of the BackingStoreParseNodeFactory class given the concrete implementation. - * @param concrete the concrete implementation of the ParseNodeFactory - */ - public constructor(concrete: ParseNodeFactory) { - super( - concrete, - (value) => { - const backedModel = value as unknown as BackedModel; - if (backedModel && backedModel.backingStore) { - backedModel.backingStore.initializationCompleted = false; - } - }, - (value) => { - const backedModel = value as unknown as BackedModel; - if (backedModel && backedModel.backingStore) { - backedModel.backingStore.initializationCompleted = true; - } - } - ); - } + /** + * Initializes a new instance of the BackingStoreParseNodeFactory class given the concrete implementation. + * @param concrete the concrete implementation of the ParseNodeFactory + */ + public constructor(concrete: ParseNodeFactory) { + super( + concrete, + (value) => { + const backedModel = value as unknown as BackedModel; + if (backedModel?.backingStore) { + backedModel.backingStore.initializationCompleted = false; + } + }, + (value) => { + const backedModel = value as unknown as BackedModel; + if (backedModel?.backingStore) { + backedModel.backingStore.initializationCompleted = true; + } + }, + ); + } } diff --git a/packages/abstractions/src/store/backingStoreSerializationWriterProxyFactory.ts b/packages/abstractions/src/store/backingStoreSerializationWriterProxyFactory.ts index 2d34c0050..dfe3281c4 100644 --- a/packages/abstractions/src/store/backingStoreSerializationWriterProxyFactory.ts +++ b/packages/abstractions/src/store/backingStoreSerializationWriterProxyFactory.ts @@ -1,38 +1,43 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { type SerializationWriterFactory, SerializationWriterProxyFactory } from "../serialization"; import type { BackedModel } from "./backedModel"; -/**Proxy implementation of SerializationWriterFactory for the backing store that automatically sets the state of the backing store when serializing. */ +/** Proxy implementation of SerializationWriterFactory for the backing store that automatically sets the state of the backing store when serializing. */ export class BackingStoreSerializationWriterProxyFactory extends SerializationWriterProxyFactory { - /** - * Initializes a new instance of the BackingStoreSerializationWriterProxyFactory class given a concrete implementation of SerializationWriterFactory. - * @param concrete a concrete implementation of SerializationWriterFactory to wrap. - */ - public constructor(concrete: SerializationWriterFactory) { - super( - concrete, - (value) => { - const backedModel = value as unknown as BackedModel; - if (backedModel && backedModel.backingStore) { - backedModel.backingStore.returnOnlyChangedValues = true; - } - }, - (value) => { - const backedModel = value as unknown as BackedModel; - if (backedModel && backedModel.backingStore) { - backedModel.backingStore.returnOnlyChangedValues = false; - backedModel.backingStore.initializationCompleted = true; - } - }, - (value, writer) => { - const backedModel = value as unknown as BackedModel; - if (backedModel && backedModel.backingStore) { - const keys = - backedModel.backingStore.enumerateKeysForValuesChangedToNull(); - for (const key of keys) { - writer.writeNullValue(key); - } - } - } - ); - } + /** + * Initializes a new instance of the BackingStoreSerializationWriterProxyFactory class given a concrete implementation of SerializationWriterFactory. + * @param concrete a concrete implementation of SerializationWriterFactory to wrap. + */ + public constructor(concrete: SerializationWriterFactory) { + super( + concrete, + (value) => { + const backedModel = value as unknown as BackedModel; + if (backedModel?.backingStore) { + backedModel.backingStore.returnOnlyChangedValues = true; + } + }, + (value) => { + const backedModel = value as unknown as BackedModel; + if (backedModel?.backingStore) { + backedModel.backingStore.returnOnlyChangedValues = false; + backedModel.backingStore.initializationCompleted = true; + } + }, + (value, writer) => { + const backedModel = value as unknown as BackedModel; + if (backedModel?.backingStore) { + const keys = backedModel.backingStore.enumerateKeysForValuesChangedToNull(); + for (const key of keys) { + writer.writeNullValue(key); + } + } + }, + ); + } } diff --git a/packages/abstractions/src/store/backingStoreUtils.ts b/packages/abstractions/src/store/backingStoreUtils.ts index 4cb224fa2..1608c7750 100644 --- a/packages/abstractions/src/store/backingStoreUtils.ts +++ b/packages/abstractions/src/store/backingStoreUtils.ts @@ -1,13 +1,19 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { type ParseNode } from "../serialization"; export const BackingStoreKey = "backingStoreEnabled"; /** - * Check if the object is an instance a BackedModel - * @param obj - * @returns - */ -export function isBackingStoreEnabled(fields: Record void> ): boolean { - // Check if the fields contain the backing store key - return Object.keys(fields).includes(BackingStoreKey); -}; \ No newline at end of file + * Check if the object is an instance a BackedModel + * @param obj + * @returns + */ +export function isBackingStoreEnabled(fields: Record void>): boolean { + // Check if the fields contain the backing store key + return Object.keys(fields).includes(BackingStoreKey); +} diff --git a/packages/abstractions/src/store/inMemoryBackingStore.ts b/packages/abstractions/src/store/inMemoryBackingStore.ts index ae2fefb12..283eb65ae 100644 --- a/packages/abstractions/src/store/inMemoryBackingStore.ts +++ b/packages/abstractions/src/store/inMemoryBackingStore.ts @@ -1,102 +1,91 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { v4 as uuidv4 } from "uuid"; import type { BackingStore } from "./backingStore"; interface storeEntryWrapper { - changed: boolean; - value: unknown; + changed: boolean; + value: unknown; } -type subscriptionCallback = ( - key: string, - previousValue: unknown, - newValue: unknown -) => void; +type subscriptionCallback = (key: string, previousValue: unknown, newValue: unknown) => void; interface storeEntry { - key: string; - value: unknown; + key: string; + value: unknown; } /** In-memory implementation of the backing store. Allows for dirty tracking of changes. */ export class InMemoryBackingStore implements BackingStore { - public get(key: string): T | undefined { - const wrapper = this.store.get(key); - if ( - wrapper && - ((this.returnOnlyChangedValues && wrapper.changed) || - !this.returnOnlyChangedValues) - ) { - return wrapper.value as T; - } - return undefined; - } - public set(key: string, value: T): void { - const oldValueWrapper = this.store.get(key); - const oldValue = oldValueWrapper?.value; - if (oldValueWrapper) { - oldValueWrapper.value = value; - oldValueWrapper.changed = this.initializationCompleted; - } else { - this.store.set(key, { - changed: this.initializationCompleted, - value, - }); - } - this.subscriptions.forEach((sub) => { - sub(key, oldValue, value); - }); - } - public enumerate(): storeEntry[] { - let filterableArray = [...this.store.entries()]; - if (this.returnOnlyChangedValues) { - filterableArray = filterableArray.filter(([_, v]) => v.changed); - } - return filterableArray.map(([key, value]) => { - return { key, value }; - }); - } - public enumerateKeysForValuesChangedToNull(): string[] { - const keys: string[] = []; - for (const [key, entry] of this.store) { - if (entry.changed && !entry.value) { - keys.push(key); - } - } - return keys; - } - public subscribe( - callback: subscriptionCallback, - subscriptionId?: string | undefined - ): string { - if (!callback) { - throw new Error("callback cannot be undefined"); - } - subscriptionId = subscriptionId ?? uuidv4(); - this.subscriptions.set(subscriptionId, callback); - return subscriptionId; - } - public unsubscribe(subscriptionId: string): void { - this.subscriptions.delete(subscriptionId); - } - public clear(): void { - this.store.clear(); - } - private readonly subscriptions: Map = new Map< - string, - subscriptionCallback - >(); - private readonly store: Map = new Map< - string, - storeEntryWrapper - >(); - public returnOnlyChangedValues = false; - private _initializationCompleted = true; - public set initializationCompleted(value: boolean) { - this._initializationCompleted = value; - this.store.forEach((v) => { - v.changed = !value; - }); - } - public get initializationCompleted() { - return this._initializationCompleted; - } + public get(key: string): T | undefined { + const wrapper = this.store.get(key); + if (wrapper && ((this.returnOnlyChangedValues && wrapper.changed) || !this.returnOnlyChangedValues)) { + return wrapper.value as T; + } + return undefined; + } + public set(key: string, value: T): void { + const oldValueWrapper = this.store.get(key); + const oldValue = oldValueWrapper?.value; + if (oldValueWrapper) { + oldValueWrapper.value = value; + oldValueWrapper.changed = this.initializationCompleted; + } else { + this.store.set(key, { + changed: this.initializationCompleted, + value, + }); + } + this.subscriptions.forEach((sub) => { + sub(key, oldValue, value); + }); + } + public enumerate(): storeEntry[] { + let filterableArray = [...this.store.entries()]; + if (this.returnOnlyChangedValues) { + filterableArray = filterableArray.filter(([_, v]) => v.changed); + } + return filterableArray.map(([key, value]) => { + return { key, value }; + }); + } + public enumerateKeysForValuesChangedToNull(): string[] { + const keys: string[] = []; + for (const [key, entry] of this.store) { + if (entry.changed && !entry.value) { + keys.push(key); + } + } + return keys; + } + public subscribe(callback: subscriptionCallback, subscriptionId?: string | undefined): string { + if (!callback) { + throw new Error("callback cannot be undefined"); + } + subscriptionId = subscriptionId ?? uuidv4(); + this.subscriptions.set(subscriptionId, callback); + return subscriptionId; + } + public unsubscribe(subscriptionId: string): void { + this.subscriptions.delete(subscriptionId); + } + public clear(): void { + this.store.clear(); + } + private readonly subscriptions: Map = new Map(); + private readonly store: Map = new Map(); + public returnOnlyChangedValues = false; + private _initializationCompleted = true; + public set initializationCompleted(value: boolean) { + this._initializationCompleted = value; + this.store.forEach((v) => { + v.changed = !value; + }); + } + public get initializationCompleted() { + return this._initializationCompleted; + } } diff --git a/packages/abstractions/src/store/inMemoryBackingStoreFactory.ts b/packages/abstractions/src/store/inMemoryBackingStoreFactory.ts index 0afaf8c90..b44bc7263 100644 --- a/packages/abstractions/src/store/inMemoryBackingStoreFactory.ts +++ b/packages/abstractions/src/store/inMemoryBackingStoreFactory.ts @@ -1,10 +1,16 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import type { BackingStore } from "./backingStore"; import type { BackingStoreFactory } from "./backingStoreFactory"; import { InMemoryBackingStore } from "./inMemoryBackingStore"; /** This class is used to create instances of InMemoryBackingStore */ export class InMemoryBackingStoreFactory implements BackingStoreFactory { - public createBackingStore(): BackingStore { - return new InMemoryBackingStore(); - } + public createBackingStore(): BackingStore { + return new InMemoryBackingStore(); + } } diff --git a/packages/abstractions/src/store/index.ts b/packages/abstractions/src/store/index.ts index 7e190b4c3..69ee24156 100644 --- a/packages/abstractions/src/store/index.ts +++ b/packages/abstractions/src/store/index.ts @@ -1,3 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ export * from "./backedModel"; export * from "./backingStore"; export * from "./backingStoreFactory"; diff --git a/packages/abstractions/src/timeOnly.ts b/packages/abstractions/src/timeOnly.ts index f52b8499d..c42c49034 100644 --- a/packages/abstractions/src/timeOnly.ts +++ b/packages/abstractions/src/timeOnly.ts @@ -1,138 +1,130 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { formatSegment } from "./dateOnly"; /* * Represents a time only. ISO 8601. */ export class TimeOnly implements TimeOnlyInterface { - /** - * Creates a new TimeOnly from the given parameters. - * @returns The new TimeOnly - * @throws An error if the milliseconds are invalid - * @throws An error if the seconds are invalid - * @throws An error if the minutes are invalid - * @throws An error if the hours are invalid - * @throws An error if the milliseconds are invalid - */ - public constructor({ - hours = 0, - minutes = 0, - seconds = 0, - picoseconds = 0, - }: Partial) { - if (hours < 0 || hours > 23) { - throw new Error("Hour must be between 0 and 23"); - } - if (minutes < 0 || minutes > 59) { - throw new Error("Minute must be between 0 and 59"); - } - if (seconds < 0 || seconds > 59) { - throw new Error("Second must be between 0 and 59"); - } - if (picoseconds < 0 || picoseconds > 999999999999) { - throw new Error("Millisecond must be between 0 and 999999999999"); - } - this.hours = hours; - this.minutes = minutes; - this.seconds = seconds; - this.picoseconds = picoseconds; - } - public hours: number; - public minutes: number; - public seconds: number; - public picoseconds: number; - /** - * Creates a new TimeOnly from the given date. - * @param date The date - * @returns The new TimeOnly - * @throws An error if the date is invalid - */ - public static fromDate(date: Date): TimeOnly { - if (!date) { - throw new Error("Date cannot be undefined"); - } - return new TimeOnly({ - hours: date.getHours(), - minutes: date.getMinutes(), - seconds: date.getSeconds(), - picoseconds: date.getMilliseconds() * 1000000000, - }); - } - /** - * Parses a string into a TimeOnly. The string can be of the ISO 8601 time only format or a number representing the ticks of a Date. - * @param value The value to parse - * @returns The parsed TimeOnly. - * @throws An error if the value is invalid - */ - public static parse(value: string | undefined): TimeOnly | undefined { - if (!value || value.length === 0) { - return undefined; - } - const ticks = Date.parse(value); - if (isNaN(ticks)) { - const exec = - /^(?[01]\d|2[0-3]):(?[0-5]\d):(?[0-5]\d)(?:[.](?\d{1,12}))?$/gi.exec( - value - ); - if (exec) { - const hours = parseInt(exec.groups?.hours ?? ""); - const minutes = parseInt(exec.groups?.minutes ?? ""); - const seconds = parseInt(exec.groups?.seconds ?? ""); - const milliseconds = parseInt(exec.groups?.milliseconds ?? "0"); - return new TimeOnly({ - hours, - minutes, - seconds, - picoseconds: milliseconds, - }); - } else { - throw new Error("Value is not a valid time-only representation"); - } - } else { - const date = new Date(ticks); - return this.fromDate(date); - } - } - /** - * Returns a string representation of the time in the format HH:MM:SS.SSSSSSSSSSSSSS - * @returns The time in the format HH:MM:SS.SSSSSSSSSSSSSS - * @throws An error if the time is invalid - */ - public toString(): string { - return `${formatSegment(this.hours, 2)}:${formatSegment( - this.minutes, - 2 - )}:${formatSegment(this.seconds, 2)}.${formatSegment( - this.picoseconds, - 12 - )}`; - } + /** + * Creates a new TimeOnly from the given parameters. + * @returns The new TimeOnly + * @throws An error if the milliseconds are invalid + * @throws An error if the seconds are invalid + * @throws An error if the minutes are invalid + * @throws An error if the hours are invalid + * @throws An error if the milliseconds are invalid + */ + public constructor({ hours = 0, minutes = 0, seconds = 0, picoseconds = 0 }: Partial) { + if (hours < 0 || hours > 23) { + throw new Error("Hour must be between 0 and 23"); + } + if (minutes < 0 || minutes > 59) { + throw new Error("Minute must be between 0 and 59"); + } + if (seconds < 0 || seconds > 59) { + throw new Error("Second must be between 0 and 59"); + } + if (picoseconds < 0 || picoseconds > 999999999999) { + throw new Error("Millisecond must be between 0 and 999999999999"); + } + this.hours = hours; + this.minutes = minutes; + this.seconds = seconds; + this.picoseconds = picoseconds; + } + public hours: number; + public minutes: number; + public seconds: number; + public picoseconds: number; + /** + * Creates a new TimeOnly from the given date. + * @param date The date + * @returns The new TimeOnly + * @throws An error if the date is invalid + */ + public static fromDate(date: Date): TimeOnly { + if (!date) { + throw new Error("Date cannot be undefined"); + } + return new TimeOnly({ + hours: date.getHours(), + minutes: date.getMinutes(), + seconds: date.getSeconds(), + picoseconds: date.getMilliseconds() * 1000000000, + }); + } + /** + * Parses a string into a TimeOnly. The string can be of the ISO 8601 time only format or a number representing the ticks of a Date. + * @param value The value to parse + * @returns The parsed TimeOnly. + * @throws An error if the value is invalid + */ + public static parse(value: string | undefined): TimeOnly | undefined { + if (!value || value.length === 0) { + return undefined; + } + const ticks = Date.parse(value); + if (isNaN(ticks)) { + const exec = /^(?[01]\d|2[0-3]):(?[0-5]\d):(?[0-5]\d)(?:[.](?\d{1,12}))?$/gi.exec(value); + if (exec) { + const hours = parseInt(exec.groups?.hours ?? ""); + const minutes = parseInt(exec.groups?.minutes ?? ""); + const seconds = parseInt(exec.groups?.seconds ?? ""); + const milliseconds = parseInt(exec.groups?.milliseconds ?? "0"); + return new TimeOnly({ + hours, + minutes, + seconds, + picoseconds: milliseconds, + }); + } else { + throw new Error("Value is not a valid time-only representation"); + } + } else { + const date = new Date(ticks); + return this.fromDate(date); + } + } + /** + * Returns a string representation of the time in the format HH:MM:SS.SSSSSSSSSSSSSS + * @returns The time in the format HH:MM:SS.SSSSSSSSSSSSSS + * @throws An error if the time is invalid + */ + public toString(): string { + return `${formatSegment(this.hours, 2)}:${formatSegment(this.minutes, 2)}:${formatSegment(this.seconds, 2)}.${formatSegment(this.picoseconds, 12)}`; + } } interface TimeOnlyInterface { - /** - * The hours - * @default 0 - * @minimum 0 - * @maximum 23 - */ - hours: number; - /** - * The minutes - * @default 0 - * @minimum 0 - * @maximum 59 - */ - minutes: number; - /** - * The seconds - * @default 0 - * @minimum 0 - * @maximum 59 - */ - seconds: number; - /** - * The milliseconds - * @default 0 - * @minimum 0 - * @maximum 999999999999 - */ - picoseconds: number; + /** + * The hours + * @default 0 + * @minimum 0 + * @maximum 23 + */ + hours: number; + /** + * The minutes + * @default 0 + * @minimum 0 + * @maximum 59 + */ + minutes: number; + /** + * The seconds + * @default 0 + * @minimum 0 + * @maximum 59 + */ + seconds: number; + /** + * The milliseconds + * @default 0 + * @minimum 0 + * @maximum 999999999999 + */ + picoseconds: number; } diff --git a/packages/abstractions/src/utils/guidUtils.ts b/packages/abstractions/src/utils/guidUtils.ts index ce14e019d..92709b023 100644 --- a/packages/abstractions/src/utils/guidUtils.ts +++ b/packages/abstractions/src/utils/guidUtils.ts @@ -1,9 +1,15 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { Guid } from "guid-typescript"; export function parseGuidString(source?: string): Guid | undefined { - if (source && Guid.isGuid(source)) { - return Guid.parse(source); - } else { - return undefined; - } -} \ No newline at end of file + if (source && Guid.isGuid(source)) { + return Guid.parse(source); + } else { + return undefined; + } +} diff --git a/packages/abstractions/src/utils/inNodeEnv.ts b/packages/abstractions/src/utils/inNodeEnv.ts new file mode 100644 index 000000000..b5dafd43d --- /dev/null +++ b/packages/abstractions/src/utils/inNodeEnv.ts @@ -0,0 +1,19 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * Checks if the runtime is in a browser or node environment. + * @returns true if in node, else false as it is running in a browser. + */ +export const inNodeEnv = (): boolean => { + try { + return !!Buffer && !!process; + } catch (err) { + // ReferenceError is thrown if you use node js APIs in a browser, + // cast it to a false if that's the case. + return !(err instanceof ReferenceError); + } +}; diff --git a/packages/abstractions/src/utils/index.ts b/packages/abstractions/src/utils/index.ts index 5b56844a0..0d5c0d6e2 100644 --- a/packages/abstractions/src/utils/index.ts +++ b/packages/abstractions/src/utils/index.ts @@ -1,2 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ export * from "./stringUtils"; -export * from "./guidUtils"; \ No newline at end of file +export * from "./guidUtils"; +export * from "./inNodeEnv"; diff --git a/packages/abstractions/src/utils/stringUtils.ts b/packages/abstractions/src/utils/stringUtils.ts index 6d09abc5f..296121101 100644 --- a/packages/abstractions/src/utils/stringUtils.ts +++ b/packages/abstractions/src/utils/stringUtils.ts @@ -1,7 +1,13 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ export function toFirstCharacterUpper(source?: string): string { - if (source && source.length > 0) { - return source.substring(0, 1).toLocaleUpperCase() + source.substring(1); - } else { - return ""; - } + if (source && source.length > 0) { + return source.substring(0, 1).toLocaleUpperCase() + source.substring(1); + } else { + return ""; + } } diff --git a/packages/abstractions/test/browser/index.ts b/packages/abstractions/test/browser/index.ts deleted file mode 100644 index e243fca2a..000000000 --- a/packages/abstractions/test/browser/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -export * from "../common/requestInformation"; diff --git a/packages/abstractions/test/common/authentication/allowedHostsValidator.ts b/packages/abstractions/test/common/authentication/allowedHostsValidator.ts index cacac9e79..2f0f3ebf2 100644 --- a/packages/abstractions/test/common/authentication/allowedHostsValidator.ts +++ b/packages/abstractions/test/common/authentication/allowedHostsValidator.ts @@ -1,40 +1,47 @@ -import { expect } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { expect, describe, beforeEach, it } from "vitest"; import { AllowedHostsValidator } from "../../../src/authentication"; -describe('AllowedHostsValidator', () => { - let validator: AllowedHostsValidator; +describe("AllowedHostsValidator", () => { + let validator: AllowedHostsValidator; - beforeEach(() => { - validator = new AllowedHostsValidator(new Set(['example.com', 'test.com'])); - }); + beforeEach(() => { + validator = new AllowedHostsValidator(new Set(["example.com", "test.com"])); + }); - it('constructor should validate hosts', () => { - expect(() => new AllowedHostsValidator(new Set(['http://invalid.com']))).to.throw('host should not contain http or https prefix'); - }); + it("constructor should validate hosts", () => { + expect(() => new AllowedHostsValidator(new Set(["http://invalid.com"]))).to.throw("host should not contain http or https prefix"); + }); - it('getAllowedHosts should return correct hosts', () => { - expect(JSON.stringify(validator.getAllowedHosts())).to.equal(JSON.stringify(['example.com', 'test.com'])); - }); + it("getAllowedHosts should return correct hosts", () => { + expect(JSON.stringify(validator.getAllowedHosts())).to.equal(JSON.stringify(["example.com", "test.com"])); + }); - it('setAllowedHosts should update allowed hosts', () => { - validator.setAllowedHosts(new Set(['newhost.com'])); - expect(JSON.stringify(validator.getAllowedHosts())).to.equal(JSON.stringify(['newhost.com'])); - }); + it("setAllowedHosts should update allowed hosts", () => { + validator.setAllowedHosts(new Set(["newhost.com"])); + expect(JSON.stringify(validator.getAllowedHosts())).to.equal(JSON.stringify(["newhost.com"])); + }); - it('setAllowedHosts should validate new hosts', () => { - expect(() => validator.setAllowedHosts(new Set(['https://invalid.com']))).to.throw('host should not contain http or https prefix'); - }); + it("setAllowedHosts should validate new hosts", () => { + expect(() => validator.setAllowedHosts(new Set(["https://invalid.com"]))).to.throw("host should not contain http or https prefix"); + }); - it('isUrlHostValid should return true for valid hosts', () => { - expect(validator.isUrlHostValid('http://example.com/path')).to.be.true; - expect(validator.isUrlHostValid('http://test.com/path')).to.be.true; - }); + it("isUrlHostValid should return true for valid hosts", () => { + expect(validator.isUrlHostValid("http://example.com/path")).to.be.true; + expect(validator.isUrlHostValid("http://test.com/path")).to.be.true; + }); - it('isUrlHostValid should return false for invalid hosts', () => { - expect(validator.isUrlHostValid('http://invalid.com/path')).to.be.false; - }); + it("isUrlHostValid should return false for invalid hosts", () => { + expect(validator.isUrlHostValid("http://invalid.com/path")).to.be.false; + }); - it('isUrlHostValid should return false for invalid URLs', () => { - expect(validator.isUrlHostValid('invalid')).to.be.false; - }); -}); \ No newline at end of file + it("isUrlHostValid should return false for invalid URLs", () => { + expect(validator.isUrlHostValid("invalid")).to.be.false; + }); +}); diff --git a/packages/abstractions/test/common/authentication/apiKeyAuthenticationProvider.ts b/packages/abstractions/test/common/authentication/apiKeyAuthenticationProvider.ts index 25bb88e41..0b7bf7e8a 100644 --- a/packages/abstractions/test/common/authentication/apiKeyAuthenticationProvider.ts +++ b/packages/abstractions/test/common/authentication/apiKeyAuthenticationProvider.ts @@ -5,77 +5,40 @@ * ------------------------------------------------------------------------------------------- */ -import * as chai from "chai"; +import { assert, describe, it } from "vitest"; -import { - ApiKeyAuthenticationProvider, - ApiKeyLocation, -} from "../../../src/authentication"; +import { ApiKeyAuthenticationProvider, ApiKeyLocation } from "../../../src/authentication"; import { RequestInformation } from "../../../src/requestInformation"; -const assert = chai.assert; describe("ApiKeyAuthenticationProvider", () => { - it("Throws on invalid initialization", () => { - assert.throws( - () => - new ApiKeyAuthenticationProvider( - "", - "param", - ApiKeyLocation.QueryParameter - ) - ); - assert.throws( - () => - new ApiKeyAuthenticationProvider( - "param", - "", - ApiKeyLocation.QueryParameter - ) - ); - assert.throws( - () => - new ApiKeyAuthenticationProvider( - "param", - "key", - 2 as unknown as ApiKeyLocation - ) - ); - }); - it("Adds in query parameters", async () => { - const provider = new ApiKeyAuthenticationProvider( - "key", - "param", - ApiKeyLocation.QueryParameter - ); - const request = new RequestInformation(); - request.urlTemplate = "https://localhost{?param1}"; - await provider.authenticateRequest(request); - assert.equal(request.URL, "https://localhost?param=key"); - assert.isNull(request.headers.tryGetValue("param")); - }); - it("Adds in query parameters with other parameters", async () => { - const provider = new ApiKeyAuthenticationProvider( - "key", - "param", - ApiKeyLocation.QueryParameter - ); - const request = new RequestInformation(); - request.urlTemplate = "https://localhost{?param1}"; - request.queryParameters["param1"] = "value1"; - await provider.authenticateRequest(request); - assert.equal(request.URL, "https://localhost?param1=value1¶m=key"); - assert.isNull(request.headers.tryGetValue("param")); - }); - it("Adds in headers", async () => { - const provider = new ApiKeyAuthenticationProvider( - "key", - "param", - ApiKeyLocation.Header - ); - const request = new RequestInformation(); - request.urlTemplate = "https://localhost{?param1}"; - await provider.authenticateRequest(request); - assert.equal(request.URL, "https://localhost"); - assert.equal(request.headers.tryGetValue("param")![0], "key"); - }); + it("Throws on invalid initialization", () => { + assert.throws(() => new ApiKeyAuthenticationProvider("", "param", ApiKeyLocation.QueryParameter)); + assert.throws(() => new ApiKeyAuthenticationProvider("param", "", ApiKeyLocation.QueryParameter)); + assert.throws(() => new ApiKeyAuthenticationProvider("param", "key", 2 as unknown as ApiKeyLocation)); + }); + it("Adds in query parameters", async () => { + const provider = new ApiKeyAuthenticationProvider("key", "param", ApiKeyLocation.QueryParameter); + const request = new RequestInformation(); + request.urlTemplate = "https://localhost{?param1}"; + await provider.authenticateRequest(request); + assert.equal(request.URL, "https://localhost?param=key"); + assert.isNull(request.headers.tryGetValue("param")); + }); + it("Adds in query parameters with other parameters", async () => { + const provider = new ApiKeyAuthenticationProvider("key", "param", ApiKeyLocation.QueryParameter); + const request = new RequestInformation(); + request.urlTemplate = "https://localhost{?param1}"; + request.queryParameters["param1"] = "value1"; + await provider.authenticateRequest(request); + assert.equal(request.URL, "https://localhost?param1=value1¶m=key"); + assert.isNull(request.headers.tryGetValue("param")); + }); + it("Adds in headers", async () => { + const provider = new ApiKeyAuthenticationProvider("key", "param", ApiKeyLocation.Header); + const request = new RequestInformation(); + request.urlTemplate = "https://localhost{?param1}"; + await provider.authenticateRequest(request); + assert.equal(request.URL, "https://localhost"); + assert.equal(request.headers.tryGetValue("param")![0], "key"); + }); }); diff --git a/packages/abstractions/test/common/authentication/validateProtocolTest.ts b/packages/abstractions/test/common/authentication/validateProtocolTest.ts index 8c4df7a51..9905454bd 100644 --- a/packages/abstractions/test/common/authentication/validateProtocolTest.ts +++ b/packages/abstractions/test/common/authentication/validateProtocolTest.ts @@ -1,35 +1,43 @@ -import { validateProtocol, isLocalhostUrl } from '../../../src/authentication'; -import { expect } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ -describe('validateProtocol', () => { - it('should throw an error for non-https and non-localhost URLs', () => { - expect(() => validateProtocol('http://example.com')).to.throw('Authentication scheme can only be used with https requests'); - }); +import { validateProtocol, isLocalhostUrl } from "../../../src/authentication"; +import { describe, it, expect } from "vitest"; - it('should not throw an error for https URLs', () => { - expect(() => validateProtocol('https://example.com')).to.not.throw(); - }); +describe("validateProtocol", () => { + // TODO: fix this test + it("should throw an error for non-https and non-localhost URLs", () => { + expect(() => validateProtocol("http://example.com")).to.throw("Authentication scheme can only be used with https requests"); + }); - it('should not throw an error for localhost URLs', () => { - expect(() => validateProtocol('http://localhost')).to.not.throw(); - expect(() => validateProtocol('HTTP://LOCALHOST')).to.not.throw(); - expect(() => validateProtocol('http://127.0.0.1')).to.not.throw(); - expect(() => validateProtocol('http://[::1]')).to.not.throw(); - }); + it("should not throw an error for https URLs", () => { + expect(() => validateProtocol("https://example.com")).to.not.throw(); + }); + + it("should not throw an error for localhost URLs", () => { + expect(() => validateProtocol("http://localhost")).to.not.throw(); + expect(() => validateProtocol("HTTP://LOCALHOST")).to.not.throw(); + expect(() => validateProtocol("http://127.0.0.1")).to.not.throw(); + expect(() => validateProtocol("http://[::1]")).to.not.throw(); + }); }); -describe('isLocalhostUrl', () => { - it('should return true for localhost URLs', () => { - expect(isLocalhostUrl('http://localhost')).to.be.true; - expect(isLocalhostUrl('http://127.0.0.1')).to.be.true; - expect(isLocalhostUrl('http://[::1]')).to.be.true; - }); +describe("isLocalhostUrl", () => { + it("should return true for localhost URLs", () => { + expect(isLocalhostUrl("http://localhost")).to.be.true; + expect(isLocalhostUrl("http://127.0.0.1")).to.be.true; + expect(isLocalhostUrl("http://[::1]")).to.be.true; + }); - it('should return false for non-localhost URLs', () => { - expect(isLocalhostUrl('https://example.com')).to.be.false; - }); + it("should return false for non-localhost URLs", () => { + expect(isLocalhostUrl("https://example.com")).to.be.false; + }); - it('should return false for invalid URLs', () => { - expect(isLocalhostUrl('not a url')).to.be.false; - }); -}); \ No newline at end of file + it("should return false for invalid URLs", () => { + expect(isLocalhostUrl("not a url")).to.be.false; + }); +}); diff --git a/packages/abstractions/test/common/dateOnly.ts b/packages/abstractions/test/common/dateOnly.ts index a5e9a9d81..981f22127 100644 --- a/packages/abstractions/test/common/dateOnly.ts +++ b/packages/abstractions/test/common/dateOnly.ts @@ -1,12 +1,19 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { DateOnly } from "../../src/dateOnly"; describe("DateOnly", () => { - it("parses date only", () => { - const result = DateOnly.parse("2017-09-04"); - assert.equal(result?.year, 2017); - assert.equal(result?.month, 9); - assert.equal(result?.day, 4); - }); + it("parses date only", () => { + const result = DateOnly.parse("2017-09-04"); + assert.equal(result?.year, 2017); + assert.equal(result?.month, 9); + assert.equal(result?.day, 4); + }); }); diff --git a/packages/abstractions/test/common/guidUtils.ts b/packages/abstractions/test/common/guidUtils.ts index 6ae3a7771..56060ad2e 100644 --- a/packages/abstractions/test/common/guidUtils.ts +++ b/packages/abstractions/test/common/guidUtils.ts @@ -1,30 +1,37 @@ -import { assert } from "chai"; -import { v1 as uuidv1, v4 as uuidv4, v5 as uuidv5} from "uuid"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ -import { parseGuidString } from "../../src/utils/guidUtils"; +import { assert, describe, it } from "vitest"; + +import { v1 as uuidv1, v4 as uuidv4, v5 as uuidv5 } from "uuid"; +import { parseGuidString } from "../../src/utils/guidUtils"; describe("ParseGuidString", () => { - it("parses a guid string", () => { - let result = parseGuidString(""); - assert.isUndefined(result); + it("parses a guid string", () => { + let result = parseGuidString(""); + assert.isUndefined(result); - result = parseGuidString(undefined); - assert.isUndefined(result); + result = parseGuidString(undefined); + assert.isUndefined(result); - result = parseGuidString("invalid-guid-string"); // invalid guid string - assert.isUndefined(result); + result = parseGuidString("invalid-guid-string"); // invalid guid string + assert.isUndefined(result); - const v1 = uuidv1(); - const v1Guid = parseGuidString(v1); - assert.isDefined(v1Guid); + const v1 = uuidv1(); + const v1Guid = parseGuidString(v1); + assert.isDefined(v1Guid); - const v4 = uuidv4(); - const v4Guid = parseGuidString(v4); - assert.isDefined(v4Guid); + const v4 = uuidv4(); + const v4Guid = parseGuidString(v4); + assert.isDefined(v4Guid); - const v5 = uuidv5("example.com", uuidv5.URL); - const v5Guid = parseGuidString(v5); - assert.isDefined(v5Guid); - }); -}); \ No newline at end of file + const v5 = uuidv5("example.com", uuidv5.URL); + const v5Guid = parseGuidString(v5); + assert.isDefined(v5Guid); + }); +}); diff --git a/packages/abstractions/test/common/headersTest.ts b/packages/abstractions/test/common/headersTest.ts index da845e563..2c940e3f9 100644 --- a/packages/abstractions/test/common/headersTest.ts +++ b/packages/abstractions/test/common/headersTest.ts @@ -1,185 +1,194 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import { Headers } from "../../src"; -import { assert, expect } from "chai"; +import { assert, describe, it, beforeEach, expect } from "vitest"; /** - * - * @param set1 - * @param set2 - * @returns + * + * @param set1 + * @param set2 + * @returns */ function areEqualSets(set1: Set, set2: Set): boolean { - if (set1.size !== set2.size) { - return false; - } - for (const item of set1) { - if (!set2.has(item)) { - return false; - } - } - return true; + if (set1.size !== set2.size) { + return false; + } + for (const item of set1) { + if (!set2.has(item)) { + return false; + } + } + return true; } -describe('RequestHeaders', () => { - let headers: Headers; - - beforeEach(() => { - headers = new Headers(); - }); - - it('should add a header with multiple values', () => { - const valuesArray = ['value1', 'value2']; - expect(headers.add('headerName', ...valuesArray)).eq(true); - assert.isTrue(areEqualSets(headers.get('headerName')!, new Set(valuesArray))); - }); - - it('should not add a header with no values', () => { - expect(headers.add('headerName', ...[])).eq(false); - }); - - it('should add a header with a single value if it is a singleValueHeader', () => { - const singleValueHeader = 'Content-Type'; - const valuesArray = ['value1', 'value2']; - expect(headers.add(singleValueHeader, ...valuesArray)).eq(true); - assert.isTrue(areEqualSets(headers.get(singleValueHeader)!, new Set(['value1']))); // only the first value is added - }); - - it('should add values to an existing header', () => { - headers.add('headerName', 'value1'); - expect(headers.add('headerName', 'value2')).eq(true); - assert.isTrue(areEqualSets(headers.get('headerName')!, new Set(['value1', 'value2']))); - }); - - it('should add a header if it does not already exist when using tryAdd', () => { - expect(headers.tryAdd('headerName', 'value1')).eq(true); - assert.isTrue(areEqualSets(headers.get('headerName')!, new Set(['value1']))); - }); - - it('should not add a header if it already exists when using tryAdd', () => { - headers.add('headerName', ...['value1']); - expect(headers.tryAdd('headerName', 'value2')).eq(false); - assert.isTrue(areEqualSets(headers.get('headerName')!, new Set(['value1']))); - }); - - it('should throw an error if tryAdd is called with an empty headerName', () => { - expect(() => headers.tryAdd('', 'value1')).throws("headerName cannot be null or empty"); - }); - - /** - * forEach method should loop through all headers - */ - it('should loop through all headers with forEach', () => { - let totalKeysValue = 0; - let totalValues = 0; - expect(headers.add('1', '1')).eq(true); - expect(headers.add('2', '2')).eq(true); - expect(headers.add('3', ...['3','4'])).eq(true); - headers.forEach((value, name) => { - // add up all the keys - totalKeysValue += parseInt(name); - // add up all the values - value.forEach(v => { - console.log(v); - totalValues += parseInt(v); - }); - }); - assert.equal(totalValues, 10); - assert.equal(totalKeysValue, 6); - }); - - it('should check if the headers is empty', () => { - expect(headers.isEmpty()).eq(true); - expect(headers.add('header', 'value')).eq(true); - expect(headers.isEmpty()).eq(false); - }); - - it('should be able to delete a header value', () => { - expect(headers.isEmpty()).eq(true); - expect(headers.add('header', 'value')).eq(true); - expect(headers.isEmpty()).eq(false); - expect(headers.delete('header')).eq(true); - expect(headers.isEmpty()).eq(true); - }); - - it('should add all headers from another Headers instance', () => { - const otherHeaders = new Headers(); - otherHeaders.add('header1', 'value1'); - otherHeaders.add('header2', 'value2'); - headers.addAll(otherHeaders); - assert.isTrue(areEqualSets(headers.get('header1')!, new Set(['value1']))); - assert.isTrue(areEqualSets(headers.get('header2')!, new Set(['value2']))); - }); - - it('should merge values for headers that exist in both instances', () => { - headers.add('header1', 'value1'); - const otherHeaders = new Headers(); - otherHeaders.add('header1', 'value2'); - headers.addAll(otherHeaders); - assert.isTrue(areEqualSets(headers.get('header1')!, new Set(['value1', 'value2']))); - }); - - it('should return a string representation of the headers', () => { - headers.add('header1', 'value1'); - headers.add('header2', 'value2'); - const headersString = headers.toString(); - expect(headersString).eq('{"header1":["value1"],"header2":["value2"]}'); - }); - - it('should return an empty object string if there are no headers', () => { - const headersString = headers.toString(); - expect(headersString).eq('{}'); - }); - - it('should return an iterator over the keys of the headers', () => { - headers.add('header1', 'value1'); - headers.add('header2', 'value2'); - const keysIterator = headers.keys(); - const keysArray = Array.from(keysIterator); - expect(JSON.stringify(keysArray)).eq(JSON.stringify(['header1', 'header2'])); - }); - - it('should return an empty iterator if there are no headers', () => { - const keysIterator = headers.keys(); - const keysArray = Array.from(keysIterator); - expect(JSON.stringify(keysArray)).eq(JSON.stringify([])); - }); - - it('should return an iterator over the entries of the headers', () => { - headers.add('header1', 'value1'); - headers.add('header2', 'value2'); - - const entriesIterator = headers.entries(); - const entriesArray = Array.from(entriesIterator); - - expect(JSON.stringify(entriesArray)).eq(JSON.stringify([ - ['header1', new Set(['value1'])], - ['header2', new Set(['value2'])] - ])); - }); - - it('should return an empty iterator if there are no headers', () => { - const entriesIterator = headers.entries(); - const entriesArray = Array.from(entriesIterator); - expect(JSON.stringify(entriesArray)).eq(JSON.stringify([])); - }); - - it('should initialize without entries', () => { - const headers = new Headers(); - assert.isDefined(headers); - }); - - it('should initialize with entries', () => { - const entries: [string, Set][] = [ - ['header1', new Set(['value1'])], - ['header2', new Set(['value2', 'value3'])] - ]; - const headers = new Headers(entries); - assert.isDefined(headers); - expect(JSON.stringify(Array.from(headers.entries()))).eq(JSON.stringify(entries)); - }); - - it('should ignore null entries', () => { - const headers = new Headers(null); - assert.isDefined(headers); - expect(JSON.stringify(Array.from(headers.entries()))).eq(JSON.stringify([])); - }); -}); \ No newline at end of file +describe("RequestHeaders", () => { + let headers: Headers; + + beforeEach(() => { + headers = new Headers(); + }); + + it("should add a header with multiple values", () => { + const valuesArray = ["value1", "value2"]; + expect(headers.add("headerName", ...valuesArray)).eq(true); + assert.isTrue(areEqualSets(headers.get("headerName")!, new Set(valuesArray))); + }); + + it("should not add a header with no values", () => { + expect(headers.add("headerName", ...[])).eq(false); + }); + + it("should add a header with a single value if it is a singleValueHeader", () => { + const singleValueHeader = "Content-Type"; + const valuesArray = ["value1", "value2"]; + expect(headers.add(singleValueHeader, ...valuesArray)).eq(true); + assert.isTrue(areEqualSets(headers.get(singleValueHeader)!, new Set(["value1"]))); // only the first value is added + }); + + it("should add values to an existing header", () => { + headers.add("headerName", "value1"); + expect(headers.add("headerName", "value2")).eq(true); + assert.isTrue(areEqualSets(headers.get("headerName")!, new Set(["value1", "value2"]))); + }); + + it("should add a header if it does not already exist when using tryAdd", () => { + expect(headers.tryAdd("headerName", "value1")).eq(true); + assert.isTrue(areEqualSets(headers.get("headerName")!, new Set(["value1"]))); + }); + + it("should not add a header if it already exists when using tryAdd", () => { + headers.add("headerName", ...["value1"]); + expect(headers.tryAdd("headerName", "value2")).eq(false); + assert.isTrue(areEqualSets(headers.get("headerName")!, new Set(["value1"]))); + }); + + it("should throw an error if tryAdd is called with an empty headerName", () => { + expect(() => headers.tryAdd("", "value1")).throws("headerName cannot be null or empty"); + }); + + /** + * forEach method should loop through all headers + */ + it("should loop through all headers with forEach", () => { + let totalKeysValue = 0; + let totalValues = 0; + expect(headers.add("1", "1")).eq(true); + expect(headers.add("2", "2")).eq(true); + expect(headers.add("3", ...["3", "4"])).eq(true); + headers.forEach((value, name) => { + // add up all the keys + totalKeysValue += parseInt(name); + // add up all the values + value.forEach((v) => { + console.log(v); + totalValues += parseInt(v); + }); + }); + assert.equal(totalValues, 10); + assert.equal(totalKeysValue, 6); + }); + + it("should check if the headers is empty", () => { + expect(headers.isEmpty()).eq(true); + expect(headers.add("header", "value")).eq(true); + expect(headers.isEmpty()).eq(false); + }); + + it("should be able to delete a header value", () => { + expect(headers.isEmpty()).eq(true); + expect(headers.add("header", "value")).eq(true); + expect(headers.isEmpty()).eq(false); + expect(headers.delete("header")).eq(true); + expect(headers.isEmpty()).eq(true); + }); + + it("should add all headers from another Headers instance", () => { + const otherHeaders = new Headers(); + otherHeaders.add("header1", "value1"); + otherHeaders.add("header2", "value2"); + headers.addAll(otherHeaders); + assert.isTrue(areEqualSets(headers.get("header1")!, new Set(["value1"]))); + assert.isTrue(areEqualSets(headers.get("header2")!, new Set(["value2"]))); + }); + + it("should merge values for headers that exist in both instances", () => { + headers.add("header1", "value1"); + const otherHeaders = new Headers(); + otherHeaders.add("header1", "value2"); + headers.addAll(otherHeaders); + assert.isTrue(areEqualSets(headers.get("header1")!, new Set(["value1", "value2"]))); + }); + + it("should return a string representation of the headers", () => { + headers.add("header1", "value1"); + headers.add("header2", "value2"); + const headersString = headers.toString(); + expect(headersString).eq('{"header1":["value1"],"header2":["value2"]}'); + }); + + it("should return an empty object string if there are no headers", () => { + const headersString = headers.toString(); + expect(headersString).eq("{}"); + }); + + it("should return an iterator over the keys of the headers", () => { + headers.add("header1", "value1"); + headers.add("header2", "value2"); + const keysIterator = headers.keys(); + const keysArray = Array.from(keysIterator); + expect(JSON.stringify(keysArray)).eq(JSON.stringify(["header1", "header2"])); + }); + + it("should return an empty iterator if there are no headers", () => { + const keysIterator = headers.keys(); + const keysArray = Array.from(keysIterator); + expect(JSON.stringify(keysArray)).eq(JSON.stringify([])); + }); + + it("should return an iterator over the entries of the headers", () => { + headers.add("header1", "value1"); + headers.add("header2", "value2"); + + const entriesIterator = headers.entries(); + const entriesArray = Array.from(entriesIterator); + + expect(JSON.stringify(entriesArray)).eq( + JSON.stringify([ + ["header1", new Set(["value1"])], + ["header2", new Set(["value2"])], + ]), + ); + }); + + it("should return an empty iterator if there are no headers", () => { + const entriesIterator = headers.entries(); + const entriesArray = Array.from(entriesIterator); + expect(JSON.stringify(entriesArray)).eq(JSON.stringify([])); + }); + + it("should initialize without entries", () => { + const headers = new Headers(); + assert.isDefined(headers); + }); + + it("should initialize with entries", () => { + const entries: [string, Set][] = [ + ["header1", new Set(["value1"])], + ["header2", new Set(["value2", "value3"])], + ]; + const headers = new Headers(entries); + assert.isDefined(headers); + expect(JSON.stringify(Array.from(headers.entries()))).eq(JSON.stringify(entries)); + }); + + it("should ignore null entries", () => { + const headers = new Headers(null); + assert.isDefined(headers); + expect(JSON.stringify(Array.from(headers.entries()))).eq(JSON.stringify([])); + }); +}); diff --git a/packages/abstractions/test/common/inNodeEnv.ts b/packages/abstractions/test/common/inNodeEnv.ts new file mode 100644 index 000000000..01a041008 --- /dev/null +++ b/packages/abstractions/test/common/inNodeEnv.ts @@ -0,0 +1,20 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { describe, expect, test } from "vitest"; +import { inNodeEnv } from "../../src/utils/inNodeEnv"; + +describe("Utility functions", () => { + test.runIf(inNodeEnv())("inNodeEnv - should return true in node environment", () => { + expect(inNodeEnv()).to.be.true; + }); + + test.runIf(!inNodeEnv())("inNodeEnv - should return false in node environment", () => { + expect(inNodeEnv()).to.be.false; + expect(typeof window).not.toBe(undefined); + }); +}); diff --git a/packages/abstractions/test/common/multipartBody.ts b/packages/abstractions/test/common/multipartBody.ts index d77402dd1..e3c1b063a 100644 --- a/packages/abstractions/test/common/multipartBody.ts +++ b/packages/abstractions/test/common/multipartBody.ts @@ -1,72 +1,42 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { MultipartBody, serializeMultipartBody } from "../../src/multipartBody"; import type { SerializationWriter } from "../../src/serialization"; describe("multipartBody", () => { - it("implements defensive programming", () => { - const mpBody = new MultipartBody(); - assert.throws( - () => mpBody.addOrReplacePart("", "application/json", "test"), - Error, - "partName cannot be undefined", - ); - assert.throws( - () => mpBody.addOrReplacePart("test", "", "test"), - Error, - "partContentType cannot be undefined", - ); - assert.throws( - () => mpBody.addOrReplacePart("test", "application/json", ""), - Error, - "content cannot be undefined", - ); - assert.throws( - () => mpBody.getPartValue(""), - Error, - "partName cannot be undefined", - ); - assert.throws( - () => mpBody.removePart(""), - Error, - "partName cannot be undefined", - ); - assert.throws( - () => - serializeMultipartBody(undefined as any as SerializationWriter, mpBody), - Error, - "writer cannot be undefined", - ); - assert.throws( - () => - serializeMultipartBody( - {} as any as SerializationWriter, - undefined as any as MultipartBody, - ), - Error, - "multipartBody cannot be empty", - ); - }); - it("requires parts for serialization", () => { - const mpBody = new MultipartBody(); - assert.throws( - () => serializeMultipartBody({} as any as SerializationWriter, mpBody), - Error, - "multipartBody cannot be empty", - ); - }); - it("adds parts", () => { - const mpBody = new MultipartBody(); - mpBody.addOrReplacePart("test", "application/json", "test"); - assert.strictEqual(mpBody.getPartValue("test"), "test"); - mpBody.addOrReplacePart("test", "application/json", "test2"); - assert.strictEqual(mpBody.getPartValue("test"), "test2"); - }); - it("removes parts", () => { - const mpBody = new MultipartBody(); - mpBody.addOrReplacePart("test", "application/json", "test"); - assert.strictEqual(mpBody.getPartValue("test"), "test"); - mpBody.removePart("test"); - assert.strictEqual(mpBody.getPartValue("test"), undefined); - }); - //serialize method is tested in the serialization library + it("implements defensive programming", () => { + const mpBody = new MultipartBody(); + assert.throws(() => mpBody.addOrReplacePart("", "application/json", "test"), Error, "partName cannot be undefined"); + assert.throws(() => mpBody.addOrReplacePart("test", "", "test"), Error, "partContentType cannot be undefined"); + assert.throws(() => mpBody.addOrReplacePart("test", "application/json", ""), Error, "content cannot be undefined"); + assert.throws(() => mpBody.getPartValue(""), Error, "partName cannot be undefined"); + assert.throws(() => mpBody.removePart(""), Error, "partName cannot be undefined"); + assert.throws(() => serializeMultipartBody(undefined as any as SerializationWriter, mpBody), Error, "writer cannot be undefined"); + assert.throws(() => serializeMultipartBody({} as any as SerializationWriter, undefined as any as MultipartBody), Error, "multipartBody cannot be empty"); + }); + it("requires parts for serialization", () => { + const mpBody = new MultipartBody(); + assert.throws(() => serializeMultipartBody({} as any as SerializationWriter, mpBody), Error, "multipartBody cannot be empty"); + }); + it("adds parts", () => { + const mpBody = new MultipartBody(); + mpBody.addOrReplacePart("test", "application/json", "test"); + assert.strictEqual(mpBody.getPartValue("test"), "test"); + mpBody.addOrReplacePart("test", "application/json", "test2"); + assert.strictEqual(mpBody.getPartValue("test"), "test2"); + }); + it("removes parts", () => { + const mpBody = new MultipartBody(); + mpBody.addOrReplacePart("test", "application/json", "test"); + assert.strictEqual(mpBody.getPartValue("test"), "test"); + mpBody.removePart("test"); + assert.strictEqual(mpBody.getPartValue("test"), undefined); + }); + //serialize method is tested in the serialization library }); diff --git a/packages/abstractions/test/common/recordWithCaseInsensitiveKeysTest.ts b/packages/abstractions/test/common/recordWithCaseInsensitiveKeysTest.ts index 321e30aa2..78d5a8ec8 100644 --- a/packages/abstractions/test/common/recordWithCaseInsensitiveKeysTest.ts +++ b/packages/abstractions/test/common/recordWithCaseInsensitiveKeysTest.ts @@ -1,39 +1,46 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { createRecordWithCaseInsensitiveKeys } from "../../src/recordWithCaseInsensitiveKeys"; describe("RecordWithCaseInsensitiveKeys", () => { - it("should create a record with case insensitive keys", () => { - const record = createRecordWithCaseInsensitiveKeys(); - assert.isUndefined(record["test"]); - record["test"] = 47; - assert.isDefined(record["test"]); - assert.equal(record["test"], record["TEST"]); - assert.equal(record["tEst"], record["TeSt"]); + it("should create a record with case insensitive keys", () => { + const record = createRecordWithCaseInsensitiveKeys(); + assert.isUndefined(record["test"]); + record["test"] = 47; + assert.isDefined(record["test"]); + assert.equal(record["test"], record["TEST"]); + assert.equal(record["tEst"], record["TeSt"]); - const record2 = createRecordWithCaseInsensitiveKeys(); - record2["Test-Header-Key"] = "test header value"; - assert.isDefined(record2["Test-Header-Key"]); - assert.equal(record2["Test-Header-Key"], record2["TEST-HEADER-KEY"]); + const record2 = createRecordWithCaseInsensitiveKeys(); + record2["Test-Header-Key"] = "test header value"; + assert.isDefined(record2["Test-Header-Key"]); + assert.equal(record2["Test-Header-Key"], record2["TEST-HEADER-KEY"]); - const record3 = createRecordWithCaseInsensitiveKeys(); - record3.Authorization = "bearer token"; - assert.isDefined(record3.Authorization); - assert.equal(record3.Authorization, record3.AUTHORIZATION); - }); + const record3 = createRecordWithCaseInsensitiveKeys(); + record3.Authorization = "bearer token"; + assert.isDefined(record3.Authorization); + assert.equal(record3.Authorization, record3.AUTHORIZATION); + }); - it("should delete case insensitive keys", () => { - const record = createRecordWithCaseInsensitiveKeys(); - assert.isUndefined(record["test"]); - record["test"] = 47; - assert.isDefined(record["test"]); - delete record["TEST"]; - assert.isUndefined(record["test"]); + it("should delete case insensitive keys", () => { + const record = createRecordWithCaseInsensitiveKeys(); + assert.isUndefined(record["test"]); + record["test"] = 47; + assert.isDefined(record["test"]); + delete record["TEST"]; + assert.isUndefined(record["test"]); - const record2 = createRecordWithCaseInsensitiveKeys(); - record2.Authorization = "bearer token"; - assert.isDefined(record2.Authorization); - delete record2.AUTHORIZATION; - assert.isUndefined(record2.Authorization); - }); -}); \ No newline at end of file + const record2 = createRecordWithCaseInsensitiveKeys(); + record2.Authorization = "bearer token"; + assert.isDefined(record2.Authorization); + delete record2.AUTHORIZATION; + assert.isUndefined(record2.Authorization); + }); +}); diff --git a/packages/abstractions/test/common/requestInformation.ts b/packages/abstractions/test/common/requestInformation.ts index 26f1064e6..201442680 100644 --- a/packages/abstractions/test/common/requestInformation.ts +++ b/packages/abstractions/test/common/requestInformation.ts @@ -5,336 +5,268 @@ * ------------------------------------------------------------------------------------------- */ -import * as chai from "chai"; -import { URL } from "url"; +import { assert, describe, it } from "vitest"; -const assert = chai.assert; - -import { - Headers, - HttpMethod, - type Parsable, - type RequestAdapter, - RequestInformation, - type SerializationWriter, - type SerializationWriterFactory, -} from "../../src"; +import { Headers, HttpMethod, type Parsable, type RequestAdapter, RequestInformation, type SerializationWriter, type SerializationWriterFactory } from "../../src"; import { MultipartBody } from "../../src/multipartBody"; import { TestEnum } from "./store/testEnum"; interface GetQueryParameters { - select?: string[]; - count?: boolean; - filter?: string; - orderby?: string[]; - search?: string; - dataset?: TestEnum; - datasets?: TestEnum[]; + select?: string[]; + count?: boolean; + filter?: string; + orderby?: string[]; + search?: string; + dataset?: TestEnum; + datasets?: TestEnum[]; } const getQueryParameterMapper: Record = { - select: "%24select", - count: "%24count", - filter: "%24filter", - orderby: "%24orderby", - search: "%24search", + select: "%24select", + count: "%24count", + filter: "%24filter", + orderby: "%24orderby", + search: "%24search", }; describe("RequestInformation", () => { - const baseUrl = "https://graph.microsoft.com/v1.0"; - it("Should set request information uri", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["baseurl"] = baseUrl; - requestInformation.urlTemplate = "{+baseurl}/users"; - assert.isNotNull(URL); - assert.equal( - requestInformation.URL, - "https://graph.microsoft.com/v1.0/users", - ); - }); + const baseUrl = "https://graph.microsoft.com/v1.0"; + it("Should set request information uri", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.urlTemplate = "{+baseurl}/users"; + assert.isNotNull(URL); + assert.equal(requestInformation.URL, "https://graph.microsoft.com/v1.0/users"); + }); - it("Should conserve parameters casing", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["BaseUrl"] = baseUrl; - requestInformation.urlTemplate = "{+BaseUrl}/users"; - assert.isNotNull(URL); - assert.equal( - requestInformation.URL, - "https://graph.microsoft.com/v1.0/users", - ); - }); + it("Should conserve parameters casing", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["BaseUrl"] = baseUrl; + requestInformation.urlTemplate = "{+BaseUrl}/users"; + assert.isNotNull(URL); + assert.equal(requestInformation.URL, "https://graph.microsoft.com/v1.0/users"); + }); - it("Sets select query parameter", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["baseurl"] = baseUrl; - requestInformation.urlTemplate = "http://localhost/me{?%24select}"; - requestInformation.setQueryStringParametersFromRawObject( - { select: ["id", "displayName"] }, - getQueryParameterMapper, - ); - assert.equal( - requestInformation.URL, - "http://localhost/me?%24select=id,displayName", - ); - }); + it("Sets select query parameter", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.urlTemplate = "http://localhost/me{?%24select}"; + requestInformation.setQueryStringParametersFromRawObject({ select: ["id", "displayName"] }, getQueryParameterMapper); + assert.equal(requestInformation.URL, "http://localhost/me?%24select=id,displayName"); + }); - it("Does not set empty select query parameter", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["baseurl"] = baseUrl; - requestInformation.urlTemplate = "http://localhost/me{?%24select}"; - requestInformation.setQueryStringParametersFromRawObject( - { select: [] }, - getQueryParameterMapper, - ); - assert.equal(requestInformation.URL, "http://localhost/me"); - }); + it("Does not set empty select query parameter", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.urlTemplate = "http://localhost/me{?%24select}"; + requestInformation.setQueryStringParametersFromRawObject({ select: [] }, getQueryParameterMapper); + assert.equal(requestInformation.URL, "http://localhost/me"); + }); - it("Allows empty search query parameter", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["baseurl"] = baseUrl; - requestInformation.urlTemplate = "http://localhost/me{?%24search}"; - requestInformation.setQueryStringParametersFromRawObject( - { search: ''}, - getQueryParameterMapper, - ); - assert.equal(requestInformation.URL, "http://localhost/me?%24search="); - }); + it("Allows empty search query parameter", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.urlTemplate = "http://localhost/me{?%24search}"; + requestInformation.setQueryStringParametersFromRawObject({ search: "" }, getQueryParameterMapper); + assert.equal(requestInformation.URL, "http://localhost/me?%24search="); + }); - it("Sets enum value in query parameters", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["baseurl"] = baseUrl; - requestInformation.urlTemplate = "http://localhost/me{?dataset}"; - requestInformation.setQueryStringParametersFromRawObject( - { dataset: TestEnum.first }, - ); - assert.equal(requestInformation.URL, "http://localhost/me?dataset=1"); - }); + it("Sets enum value in query parameters", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.urlTemplate = "http://localhost/me{?dataset}"; + requestInformation.setQueryStringParametersFromRawObject({ dataset: TestEnum.first }); + assert.equal(requestInformation.URL, "http://localhost/me?dataset=1"); + }); - it("Sets enum values in query parameters", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["baseurl"] = baseUrl; - requestInformation.urlTemplate = "http://localhost/me{?datasets}"; - requestInformation.setQueryStringParametersFromRawObject( - { datasets: [TestEnum.first, TestEnum.second] }, - ); - assert.equal(requestInformation.URL, "http://localhost/me?datasets=1,2"); - }); + it("Sets enum values in query parameters", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.urlTemplate = "http://localhost/me{?datasets}"; + requestInformation.setQueryStringParametersFromRawObject({ + datasets: [TestEnum.first, TestEnum.second], + }); + assert.equal(requestInformation.URL, "http://localhost/me?datasets=1,2"); + }); - it("Sets enum value in path parameters", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["baseurl"] = baseUrl; - requestInformation.pathParameters["dataset"] = TestEnum.first; - requestInformation.urlTemplate = "http://localhost/{dataset}"; - assert.equal(requestInformation.URL, "http://localhost/1"); - }); + it("Sets enum value in path parameters", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.pathParameters["dataset"] = TestEnum.first; + requestInformation.urlTemplate = "http://localhost/{dataset}"; + assert.equal(requestInformation.URL, "http://localhost/1"); + }); - it("Sets enum values in path parameters", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["baseurl"] = baseUrl; - requestInformation.pathParameters["dataset"] = [ - TestEnum.first, - TestEnum.second, - ]; - requestInformation.urlTemplate = "http://localhost/{dataset}"; - assert.equal(requestInformation.URL, "http://localhost/1,2"); - }); + it("Sets enum values in path parameters", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.pathParameters["dataset"] = [TestEnum.first, TestEnum.second]; + requestInformation.urlTemplate = "http://localhost/{dataset}"; + assert.equal(requestInformation.URL, "http://localhost/1,2"); + }); - it("Adds headers to requestInformation", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["baseurl"] = baseUrl; - requestInformation.urlTemplate = "http://localhost/me{?%24select}"; - requestInformation.addRequestHeaders({ ConsistencyLevel: "eventual" }); - assert.isTrue(requestInformation.headers.has("ConsistencyLevel")); - assert.equal(requestInformation.headers.tryGetValue("ConsistencyLevel")![0], "eventual"); - }); + it("Adds headers to requestInformation", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.urlTemplate = "http://localhost/me{?%24select}"; + requestInformation.addRequestHeaders({ ConsistencyLevel: "eventual" }); + assert.isTrue(requestInformation.headers.has("ConsistencyLevel")); + assert.equal(requestInformation.headers.tryGetValue("ConsistencyLevel")![0], "eventual"); + }); - it("Try to add headers to requestInformation", () => { - const requestInformation = new RequestInformation(); - requestInformation.pathParameters["baseurl"] = baseUrl; - requestInformation.urlTemplate = "http://localhost/me{?%24select}"; - assert.isTrue(requestInformation.headers.tryAdd("key", "value1")); - assert.equal(Array.from(requestInformation.headers.keys()).length, 1); - assert.equal(requestInformation.headers.tryGetValue("key")!.length, 1); - assert.equal(requestInformation.headers.tryGetValue("key")![0], "value1"); - assert.isTrue(requestInformation.headers.add("key", "value2")); - assert.equal(Array.from(requestInformation.headers.keys()).length, 1); - assert.equal(requestInformation.headers.tryGetValue("key")!.length, 2); - assert.equal(requestInformation.headers.tryGetValue("key")![0], "value1"); - assert.equal(requestInformation.headers.tryGetValue("key")![1], "value2"); - }); + it("Try to add headers to requestInformation", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.urlTemplate = "http://localhost/me{?%24select}"; + assert.isTrue(requestInformation.headers.tryAdd("key", "value1")); + assert.equal(Array.from(requestInformation.headers.keys()).length, 1); + assert.equal(requestInformation.headers.tryGetValue("key")!.length, 1); + assert.equal(requestInformation.headers.tryGetValue("key")![0], "value1"); + assert.isTrue(requestInformation.headers.add("key", "value2")); + assert.equal(Array.from(requestInformation.headers.keys()).length, 1); + assert.equal(requestInformation.headers.tryGetValue("key")!.length, 2); + assert.equal(requestInformation.headers.tryGetValue("key")![0], "value1"); + assert.equal(requestInformation.headers.tryGetValue("key")![1], "value2"); + }); - it("Sets a parsable content", () => { - const requestInformation = new RequestInformation(); - let methodCalledCount = 0; - const mockRequestAdapter = { - getSerializationWriterFactory: () => { - return { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - getSerializationWriter: (_: string) => { - return { - writeObjectValue: ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - key?: string | undefined, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - value?: T | undefined, - ) => { - methodCalledCount++; - }, - getSerializedContent: () => { - return new ArrayBuffer(0); - }, - } as unknown as SerializationWriter; - }, - } as SerializationWriterFactory; - }, - } as RequestAdapter; - requestInformation.setContentFromParsable( - mockRequestAdapter, - "application/json", - {} as unknown as Parsable, - ); - requestInformation.addRequestHeaders({ ConsistencyLevel: "eventual" }); - //assert.isNotEmpty(requestInformation.headers.entries()); - assert.equal(methodCalledCount, 1); - }); + it("Sets a parsable content", () => { + const requestInformation = new RequestInformation(); + let methodCalledCount = 0; + const mockRequestAdapter = { + getSerializationWriterFactory: () => { + return { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getSerializationWriter: (_: string) => { + return { + writeObjectValue: ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + key?: string | undefined, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + value?: T | undefined, + ) => { + methodCalledCount++; + }, + getSerializedContent: () => { + return new ArrayBuffer(0); + }, + } as unknown as SerializationWriter; + }, + } as SerializationWriterFactory; + }, + } as RequestAdapter; + requestInformation.setContentFromParsable(mockRequestAdapter, "application/json", {} as unknown as Parsable); + requestInformation.addRequestHeaders({ ConsistencyLevel: "eventual" }); + //assert.isNotEmpty(requestInformation.headers.entries()); + assert.equal(methodCalledCount, 1); + }); - it("Sets a parsable collection content", () => { - const requestInformation = new RequestInformation(); - let methodCalledCount = 0; - const mockRequestAdapter = { - getSerializationWriterFactory: () => { - return { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - getSerializationWriter: (_: string) => { - return { - writeCollectionOfObjectValues: ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - key?: string | undefined, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - values?: T[], - ) => { - methodCalledCount++; - }, - getSerializedContent: () => { - return new ArrayBuffer(0); - }, - } as unknown as SerializationWriter; - }, - } as SerializationWriterFactory; - }, - } as RequestAdapter; - requestInformation.setContentFromParsable( - mockRequestAdapter, - "application/json", - [{} as unknown as Parsable], - ); - requestInformation.addRequestHeaders({ ConsistencyLevel: "eventual" }); - assert.equal(methodCalledCount, 1); - }); + it("Sets a parsable collection content", () => { + const requestInformation = new RequestInformation(); + let methodCalledCount = 0; + const mockRequestAdapter = { + getSerializationWriterFactory: () => { + return { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getSerializationWriter: (_: string) => { + return { + writeCollectionOfObjectValues: ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + key?: string | undefined, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + values?: T[], + ) => { + methodCalledCount++; + }, + getSerializedContent: () => { + return new ArrayBuffer(0); + }, + } as unknown as SerializationWriter; + }, + } as SerializationWriterFactory; + }, + } as RequestAdapter; + requestInformation.setContentFromParsable(mockRequestAdapter, "application/json", [{} as unknown as Parsable]); + requestInformation.addRequestHeaders({ ConsistencyLevel: "eventual" }); + assert.equal(methodCalledCount, 1); + }); - it("Sets a scalar content", () => { - const requestInformation = new RequestInformation(); - let writtenValue = ""; - const mockRequestAdapter = { - getSerializationWriterFactory: () => { - return { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - getSerializationWriter: (_: string) => { - return { - writeStringValue: ( - key?: string | undefined, - value?: string | undefined, - ) => { - writtenValue = value as unknown as string; - }, - getSerializedContent: () => { - return new ArrayBuffer(0); - }, - } as unknown as SerializationWriter; - }, - } as SerializationWriterFactory; - }, - } as RequestAdapter; - requestInformation.setContentFromScalar( - mockRequestAdapter, - "application/json", - "some content", - ); - requestInformation.addRequestHeaders({ ConsistencyLevel: "eventual" }); - assert.equal(writtenValue, "some content"); - }); + it("Sets a scalar content", () => { + const requestInformation = new RequestInformation(); + let writtenValue = ""; + const mockRequestAdapter = { + getSerializationWriterFactory: () => { + return { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getSerializationWriter: (_: string) => { + return { + writeStringValue: (key?: string | undefined, value?: string | undefined) => { + writtenValue = value as unknown as string; + }, + getSerializedContent: () => { + return new ArrayBuffer(0); + }, + } as unknown as SerializationWriter; + }, + } as SerializationWriterFactory; + }, + } as RequestAdapter; + requestInformation.setContentFromScalar(mockRequestAdapter, "application/json", "some content"); + requestInformation.addRequestHeaders({ ConsistencyLevel: "eventual" }); + assert.equal(writtenValue, "some content"); + }); - it("Sets a scalar collection content", () => { - const requestInformation = new RequestInformation(); - let writtenValue = ""; - const mockRequestAdapter = { - getSerializationWriterFactory: () => { - return { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - getSerializationWriter: (_: string) => { - return { - writeCollectionOfPrimitiveValues: ( - key?: string | undefined, - values?: T[] | undefined, - ) => { - writtenValue = JSON.stringify(values); - }, - getSerializedContent: () => { - return new ArrayBuffer(0); - }, - } as unknown as SerializationWriter; - }, - } as SerializationWriterFactory; - }, - } as RequestAdapter; - requestInformation.setContentFromScalar( - mockRequestAdapter, - "application/json", - ["some content"], - ); - requestInformation.addRequestHeaders({ ConsistencyLevel: "eventual" }); - assert.equal(writtenValue, '["some content"]'); - }); + it("Sets a scalar collection content", () => { + const requestInformation = new RequestInformation(); + let writtenValue = ""; + const mockRequestAdapter = { + getSerializationWriterFactory: () => { + return { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getSerializationWriter: (_: string) => { + return { + writeCollectionOfPrimitiveValues: (key?: string | undefined, values?: T[] | undefined) => { + writtenValue = JSON.stringify(values); + }, + getSerializedContent: () => { + return new ArrayBuffer(0); + }, + } as unknown as SerializationWriter; + }, + } as SerializationWriterFactory; + }, + } as RequestAdapter; + requestInformation.setContentFromScalar(mockRequestAdapter, "application/json", ["some content"]); + requestInformation.addRequestHeaders({ ConsistencyLevel: "eventual" }); + assert.equal(writtenValue, '["some content"]'); + }); - it("Sets the boundary on multipart content", () => { - const requestInformation = new RequestInformation(); - requestInformation.urlTemplate = - "http://localhost/{URITemplate}/ParameterMapping?IsCaseSensitive={IsCaseSensitive}"; - requestInformation.httpMethod = HttpMethod.POST; - const mpBody = new MultipartBody(); - const mockRequestAdapter = { - getSerializationWriterFactory: () => { - return { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - getSerializationWriter: (_: string) => { - return { - writeObjectValue: ( - key?: string | undefined, - value?: T | undefined, - ) => { - if (key === "value") { - mpBody.addOrReplacePart("1", "application/json", value); - } - }, - getSerializedContent: () => { - return new ArrayBuffer(0); - }, - } as unknown as SerializationWriter; - }, - } as SerializationWriterFactory; - }, - } as RequestAdapter; - requestInformation.setContentFromParsable( - mockRequestAdapter, - "multipart/form-data", - mpBody, - ); - const contentTypeHeaderValue = - requestInformation.headers.tryGetValue("Content-Type")![0]; - assert.equal( - contentTypeHeaderValue, - `multipart/form-data; boundary=${mpBody.getBoundary()}`, - ); - assert.isNotEmpty(mpBody.getBoundary()); - }); + it("Sets the boundary on multipart content", () => { + const requestInformation = new RequestInformation(); + requestInformation.urlTemplate = "http://localhost/{URITemplate}/ParameterMapping?IsCaseSensitive={IsCaseSensitive}"; + requestInformation.httpMethod = HttpMethod.POST; + const mpBody = new MultipartBody(); + const mockRequestAdapter = { + getSerializationWriterFactory: () => { + return { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getSerializationWriter: (_: string) => { + return { + writeObjectValue: (key?: string | undefined, value?: T | undefined) => { + if (key === "value") { + mpBody.addOrReplacePart("1", "application/json", value); + } + }, + getSerializedContent: () => { + return new ArrayBuffer(0); + }, + } as unknown as SerializationWriter; + }, + } as SerializationWriterFactory; + }, + } as RequestAdapter; + requestInformation.setContentFromParsable(mockRequestAdapter, "multipart/form-data", mpBody); + const contentTypeHeaderValue = requestInformation.headers.tryGetValue("Content-Type")![0]; + assert.equal(contentTypeHeaderValue, `multipart/form-data; boundary=${mpBody.getBoundary()}`); + assert.isNotEmpty(mpBody.getBoundary()); + }); }); diff --git a/packages/abstractions/test/common/store/backedModelProxyTest.ts b/packages/abstractions/test/common/store/backedModelProxyTest.ts index 8eb3f071c..4739338db 100644 --- a/packages/abstractions/test/common/store/backedModelProxyTest.ts +++ b/packages/abstractions/test/common/store/backedModelProxyTest.ts @@ -1,86 +1,92 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ import { type BackedModel, type BackingStore, BackingStoreFactorySingleton, createBackedModelProxyHandler } from "../../../src/store"; -import { assert } from "chai"; +import { assert, describe, it, beforeEach, afterEach } from "vitest"; export interface Model extends BackedModel { - name?: string; - age?: number; + name?: string; + age?: number; } -describe('createBackedModelProxyHandler', () => { - let backingStoreFactorySingleton: BackingStoreFactorySingleton; - const fakeBackingStore = {} as BackingStore; - - beforeEach(() => { - backingStoreFactorySingleton = BackingStoreFactorySingleton.instance; - }); - - afterEach(() => { - // Reset the backing store factory if required - }); - - it('should get a property from the backing store', () => { - // Arrange - const handler = createBackedModelProxyHandler(); - const model = new Proxy({backingStore: fakeBackingStore}, handler); - - // Act - model.backingStore?.set("name", "Bob"); - - // Assert - assert.equal(model.backingStore?.get("name"), 'Bob'); - }); - - it('should set a property in the backing store', () => { - // Arrange - const handler = createBackedModelProxyHandler<{name?: string}>(); - const model = new Proxy({backingStore: fakeBackingStore}, handler); - - // Act - model.name = 'Bob'; - - // Assert - assert.equal(model.backingStore?.get("name"), 'Bob'); - }); - - it('should get and set multiple properties in the backing store', () => { - // Arrange - const handler = createBackedModelProxyHandler(); - const model = new Proxy({backingStore: fakeBackingStore}, handler); - - // Act - model.name = 'Bob'; - model.age = 30; - const name = model.name; - const age = model.age; - - // Assert - assert.equal(model.backingStore?.get("name"), name); - assert.equal(model.backingStore?.get("age"), age); - }); - - it('should ignore setting the backingStore property', () => { - // Arrange - const handler = createBackedModelProxyHandler(); - const model = new Proxy({backingStore: fakeBackingStore}, handler); - - // Act - const dummyBackingStore = {} as BackingStore; - model.backingStore = dummyBackingStore; - - // Assert - assert.notEqual(model.backingStore, dummyBackingStore); - }); - - it('should return the backing store when the property itself is backingStore', () => { - // Arrange - const handler = createBackedModelProxyHandler(); - const model = new Proxy({backingStore: fakeBackingStore}, handler); - - // Act - const backingStore = model.backingStore; - - // Assert - assert.isDefined(model.backingStore); - assert.notEqual(model.backingStore, fakeBackingStore); - }); -}); \ No newline at end of file +describe("createBackedModelProxyHandler", () => { + let backingStoreFactorySingleton: BackingStoreFactorySingleton; + const fakeBackingStore = {} as BackingStore; + + beforeEach(() => { + backingStoreFactorySingleton = BackingStoreFactorySingleton.instance; + }); + + afterEach(() => { + // Reset the backing store factory if required + }); + + it("should get a property from the backing store", () => { + // Arrange + const handler = createBackedModelProxyHandler(); + const model = new Proxy({ backingStore: fakeBackingStore }, handler); + + // Act + model.backingStore?.set("name", "Bob"); + + // Assert + assert.equal(model.backingStore?.get("name"), "Bob"); + }); + + it("should set a property in the backing store", () => { + // Arrange + const handler = createBackedModelProxyHandler<{ name?: string }>(); + const model = new Proxy({ backingStore: fakeBackingStore }, handler); + + // Act + model.name = "Bob"; + + // Assert + assert.equal(model.backingStore?.get("name"), "Bob"); + }); + + it("should get and set multiple properties in the backing store", () => { + // Arrange + const handler = createBackedModelProxyHandler(); + const model = new Proxy({ backingStore: fakeBackingStore }, handler); + + // Act + model.name = "Bob"; + model.age = 30; + const name = model.name; + const age = model.age; + + // Assert + assert.equal(model.backingStore?.get("name"), name); + assert.equal(model.backingStore?.get("age"), age); + }); + + it("should ignore setting the backingStore property", () => { + // Arrange + const handler = createBackedModelProxyHandler(); + const model = new Proxy({ backingStore: fakeBackingStore }, handler); + + // Act + const dummyBackingStore = {} as BackingStore; + model.backingStore = dummyBackingStore; + + // Assert + assert.notEqual(model.backingStore, dummyBackingStore); + }); + + it("should return the backing store when the property itself is backingStore", () => { + // Arrange + const handler = createBackedModelProxyHandler(); + const model = new Proxy({ backingStore: fakeBackingStore }, handler); + + // Act + const backingStore = model.backingStore; + + // Assert + assert.isDefined(model.backingStore); + assert.notEqual(model.backingStore, fakeBackingStore); + }); +}); diff --git a/packages/abstractions/test/common/store/backingStoreUtilsTest.ts b/packages/abstractions/test/common/store/backingStoreUtilsTest.ts index 06c206f94..08f0a689c 100644 --- a/packages/abstractions/test/common/store/backingStoreUtilsTest.ts +++ b/packages/abstractions/test/common/store/backingStoreUtilsTest.ts @@ -1,18 +1,25 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, it } from "vitest"; import { isBackingStoreEnabled } from "../../../src/store/backingStoreUtils"; import { type TestBackedModel, createTestBackedModelFromDiscriminatorValue, createTestParserFromDiscriminatorValue } from "./testEntity"; import { type ParseNode } from "../../../src"; it("Test backing store should be enabled if the parsableFactory has backingStore property", async () => { - const testBackedModel = {} as TestBackedModel; - const fields = createTestBackedModelFromDiscriminatorValue({} as ParseNode)(testBackedModel); - const backingStoreEnabled = isBackingStoreEnabled(fields); - assert.isTrue(backingStoreEnabled); + const testBackedModel = {} as TestBackedModel; + const fields = createTestBackedModelFromDiscriminatorValue({} as ParseNode)(testBackedModel); + const backingStoreEnabled = isBackingStoreEnabled(fields); + assert.isTrue(backingStoreEnabled); }); it("Test backing store should not be enabled if the parsableFactory lacks backingStore property", async () => { - const testModel = {} as TestBackedModel; - const fields = createTestParserFromDiscriminatorValue({} as ParseNode)(testModel); - const backingStoreEnabled = isBackingStoreEnabled(fields); - assert.isFalse(backingStoreEnabled); -}); \ No newline at end of file + const testModel = {} as TestBackedModel; + const fields = createTestParserFromDiscriminatorValue({} as ParseNode)(testModel); + const backingStoreEnabled = isBackingStoreEnabled(fields); + assert.isFalse(backingStoreEnabled); +}); diff --git a/packages/abstractions/test/common/store/testEntity.ts b/packages/abstractions/test/common/store/testEntity.ts index b54138734..ee7b4e230 100644 --- a/packages/abstractions/test/common/store/testEntity.ts +++ b/packages/abstractions/test/common/store/testEntity.ts @@ -1,100 +1,91 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { BackedModel, BackingStore, Parsable, ParseNode } from "../../../src"; const fakeBackingStore: BackingStore = {} as BackingStore; export interface TestParser { - testString?: string | undefined; - foos?: FooResponse[] | undefined; + testString?: string | undefined; + foos?: FooResponse[] | undefined; } export interface TestBackedModel extends TestParser, BackedModel { - backingStoreEnabled?: boolean | undefined; + backingStoreEnabled?: boolean | undefined; } export interface FooResponse extends Parsable { - id?: string | undefined; - bars?: BarResponse[] | undefined; + id?: string | undefined; + bars?: BarResponse[] | undefined; } export interface BarResponse extends Parsable { - propA?: string | undefined; - propB?: string | undefined; - propC?: Date | undefined; + propA?: string | undefined; + propB?: string | undefined; + propC?: Date | undefined; } -export function createTestParserFromDiscriminatorValue( - parseNode: ParseNode | undefined -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeTestParser; +export function createTestParserFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeTestParser; } -export function createTestBackedModelFromDiscriminatorValue( - parseNode: ParseNode | undefined -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeTestBackedModel; +export function createTestBackedModelFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeTestBackedModel; } -export function createFooParserFromDiscriminatorValue( - parseNode: ParseNode | undefined -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeFooParser; +export function createFooParserFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeFooParser; } -export function createBarParserFromDiscriminatorValue( - parseNode: ParseNode | undefined -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeBarParser; +export function createBarParserFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeBarParser; } -export function deserializeTestParser( - testParser: TestParser | undefined = {} -): Record void> { - return { - foos: (n) => { - testParser.foos = n.getCollectionOfObjectValues(createFooParserFromDiscriminatorValue); - } - }; +export function deserializeTestParser(testParser: TestParser | undefined = {}): Record void> { + return { + foos: (n) => { + testParser.foos = n.getCollectionOfObjectValues(createFooParserFromDiscriminatorValue); + }, + }; } -export function deserializeTestBackedModel( - testParser: TestBackedModel | undefined = {} -): Record void> { - return { - backingStoreEnabled: (n) => { - testParser.backingStoreEnabled = true; - }, - foos: (n) => { - testParser.foos = n.getCollectionOfObjectValues(createFooParserFromDiscriminatorValue); - } - }; +export function deserializeTestBackedModel(testParser: TestBackedModel | undefined = {}): Record void> { + return { + backingStoreEnabled: (n) => { + testParser.backingStoreEnabled = true; + }, + foos: (n) => { + testParser.foos = n.getCollectionOfObjectValues(createFooParserFromDiscriminatorValue); + }, + }; } -export function deserializeFooParser( - fooResponse: FooResponse | undefined = {} -): Record void> { - return { - id: (n) => { - fooResponse.id = n.getStringValue(); - }, - bars: (n) => { - fooResponse.bars = n.getCollectionOfObjectValues(createBarParserFromDiscriminatorValue); - } - }; +export function deserializeFooParser(fooResponse: FooResponse | undefined = {}): Record void> { + return { + id: (n) => { + fooResponse.id = n.getStringValue(); + }, + bars: (n) => { + fooResponse.bars = n.getCollectionOfObjectValues(createBarParserFromDiscriminatorValue); + }, + }; } -export function deserializeBarParser( - barResponse: BarResponse | undefined = {} -): Record void> { - return { - propA: (n) => { - barResponse.propA = n.getStringValue(); - }, - propB: (n) => { - barResponse.propB = n.getStringValue(); - }, - propC: (n) => { - barResponse.propC = n.getDateValue(); - } - }; +export function deserializeBarParser(barResponse: BarResponse | undefined = {}): Record void> { + return { + propA: (n) => { + barResponse.propA = n.getStringValue(); + }, + propB: (n) => { + barResponse.propB = n.getStringValue(); + }, + propC: (n) => { + barResponse.propC = n.getDateValue(); + }, + }; } diff --git a/packages/abstractions/test/common/store/testEnum.ts b/packages/abstractions/test/common/store/testEnum.ts index a0b7e88b3..6428d2f20 100644 --- a/packages/abstractions/test/common/store/testEnum.ts +++ b/packages/abstractions/test/common/store/testEnum.ts @@ -1,4 +1,11 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export enum TestEnum { - first = "1", - second = "2", + first = "1", + second = "2", } diff --git a/packages/abstractions/test/common/stringUtils.ts b/packages/abstractions/test/common/stringUtils.ts index 1395422d5..5aba08a41 100644 --- a/packages/abstractions/test/common/stringUtils.ts +++ b/packages/abstractions/test/common/stringUtils.ts @@ -1,20 +1,26 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ -import { toFirstCharacterUpper } from "../../src/utils"; +import { assert, describe, it } from "vitest"; +import { toFirstCharacterUpper } from "../../src/utils"; describe("ToFirstCharacterUpper", () => { - it("converts the first character to uppercase", () => { - const undefinedString = toFirstCharacterUpper(undefined); - assert.equal(undefinedString, ""); + it("converts the first character to uppercase", () => { + const undefinedString = toFirstCharacterUpper(undefined); + assert.equal(undefinedString, ""); - const emptyString = toFirstCharacterUpper(""); - assert.equal(emptyString, ""); + const emptyString = toFirstCharacterUpper(""); + assert.equal(emptyString, ""); - const dummyString = toFirstCharacterUpper("dummyString"); - assert.equal(dummyString, "DummyString"); + const dummyString = toFirstCharacterUpper("dummyString"); + assert.equal(dummyString, "DummyString"); - const _underscoreString = toFirstCharacterUpper("_underscoreString"); - assert.equal(_underscoreString, "_underscoreString"); - }); -}); \ No newline at end of file + const _underscoreString = toFirstCharacterUpper("_underscoreString"); + assert.equal(_underscoreString, "_underscoreString"); + }); +}); diff --git a/packages/abstractions/tsconfig.base.json b/packages/abstractions/tsconfig.base.json deleted file mode 100644 index e1feaca5a..000000000 --- a/packages/abstractions/tsconfig.base.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "importHelpers": true, - "noEmitOnError": true, - "moduleResolution": "node", - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "composite": true - } -} \ No newline at end of file diff --git a/packages/abstractions/tsconfig.cjs.json b/packages/abstractions/tsconfig.cjs.json deleted file mode 100644 index 3be854dac..000000000 --- a/packages/abstractions/tsconfig.cjs.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2017", - "module": "commonjs", - "outDir": "./dist/cjs" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test"] -} \ No newline at end of file diff --git a/packages/abstractions/tsconfig.es.json b/packages/abstractions/tsconfig.es.json deleted file mode 100644 index 63b42d5e0..000000000 --- a/packages/abstractions/tsconfig.es.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "dist/es/" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test/**/*.ts"] -} \ No newline at end of file diff --git a/packages/abstractions/tsconfig.json b/packages/abstractions/tsconfig.json new file mode 100644 index 000000000..ed085ce72 --- /dev/null +++ b/packages/abstractions/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist/es/" + }, + "include": [ + "./src/**/*.ts", + ] +} \ No newline at end of file diff --git a/packages/abstractions/vite.config.mts b/packages/abstractions/vite.config.mts new file mode 100644 index 000000000..4a6f89f2f --- /dev/null +++ b/packages/abstractions/vite.config.mts @@ -0,0 +1,11 @@ +import { defineConfig, configDefaults } from "vitest/config"; + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude, "**/test{Entity,Enum}.ts"], + include: [...configDefaults.include, "test/**/*.ts"], + coverage: { + reporter: ["html"], + }, + }, +}); \ No newline at end of file diff --git a/packages/authentication/azure/.eslintignore b/packages/authentication/azure/.eslintignore deleted file mode 100644 index 8942aa232..000000000 --- a/packages/authentication/azure/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -*.js -*.js.map -*.d.ts - -node_modules -lib -spec/development \ No newline at end of file diff --git a/packages/authentication/azure/.eslintrc.json b/packages/authentication/azure/.eslintrc.json deleted file mode 100644 index 80ab9b397..000000000 --- a/packages/authentication/azure/.eslintrc.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "prettier", - "simple-import-sort" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "rules": { - "@typescript-eslint/no-empty-interface": "warn", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/consistent-type-imports": "error", - "prettier/prettier": [ - "error", - { - "endOfLine": "auto" - } - ], - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "typeLike", - "format": [ - "PascalCase" - ], - "filter": { - "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "interface", - "format": [ - "PascalCase" - ], - "custom": { - "regex": "^I[A-Z]", - "match": false - }, - "filter": { - "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", - "match": false - } - }, - { - "selector": "variable", - "format": [ - "camelCase", - "PascalCase", - "UPPER_CASE" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "function", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "parameter", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", - "match": false - } - }, - { - "selector": "method", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "memberLike", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "enumMember", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "property", - "format": null - } - ], - "@typescript-eslint/semi": "error", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/prefer-for-of": "error", - "@typescript-eslint/prefer-function-type": "error", - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/quotes": [ - "error", - "double", - { - "avoidEscape": true, - "allowTemplateLiterals": true - } - ], - "@typescript-eslint/space-within-parens": [ - "off", - "never" - ], - "@typescript-eslint/triple-slash-reference": "error", - "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unified-signatures": "error", - "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", - "@typescript-eslint/consistent-type-definitions": [ - "error", - "interface" - ], - "@typescript-eslint/no-inferrable-types": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-this-alias": "error", - "no-unused-expressions": "off", - "@typescript-eslint/no-unused-expressions": [ - "error", - { - "allowTernary": true - } - ], - "@typescript-eslint/space-before-function-paren": "off", - "@typescript-eslint/consistent-type-assertions": "error", - "@typescript-eslint/explicit-member-accessibility": [ - "off", - { - "accessibility": "explicit" - } - ], - "@typescript-eslint/indent": "off", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/member-delimiter-style": [ - "off", - { - "multiline": { - "delimiter": "none", - "requireLast": true - }, - "singleline": { - "delimiter": "semi", - "requireLast": false - } - } - ], - "@typescript-eslint/member-ordering": "off", - "@typescript-eslint/no-empty-function": "error", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-parameter-properties": "off", - "@typescript-eslint/no-array-constructor": "error", - "no-useless-catch": "error", - "prefer-rest-params": "off", - "no-constant-condition": "error", - "simple-import-sort/imports": "error", - "brace-style": "error", - "constructor-super": "error", - "curly": [ - "error", - "multi-line" - ], - "dot-notation": "off", - "eqeqeq": "error", - "new-parens": "error", - "no-caller": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-empty": "error", - "no-eval": "error", - "no-extra-bind": "error", - "no-fallthrough": "error", - "no-new-func": "off", - "no-new-wrappers": "error", - "no-return-await": "off", - "no-sparse-arrays": "error", - "no-template-curly-in-string": "error", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-unsafe-finally": "error", - "no-unused-labels": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-const": "error", - "prefer-object-spread": "error", - "quote-props": "off", - "space-in-parens": "error", - "unicode-bom": [ - "error", - "never" - ], - "use-isnan": "error" - } -} \ No newline at end of file diff --git a/packages/authentication/azure/.npmignore b/packages/authentication/azure/.npmignore index 164fa84b7..15ae0ca0b 100644 --- a/packages/authentication/azure/.npmignore +++ b/packages/authentication/azure/.npmignore @@ -4,7 +4,6 @@ *.tgz **/test/**/* docs/ -karma.conf.js node_modules/ rollup.config.js src/ diff --git a/packages/authentication/azure/package.json b/packages/authentication/azure/package.json index 9ec9f7996..b19c9ed33 100644 --- a/packages/authentication/azure/package.json +++ b/packages/authentication/azure/package.json @@ -2,17 +2,18 @@ "name": "@microsoft/kiota-authentication-azure", "version": "1.0.0-preview.46", "description": "Authentication provider for Kiota using Azure Identity", - "main": "dist/cjs/src/index.js", + "main": "dist/es/src/index.js", "module": "dist/es/src/index.js", - "types": "dist/cjs/src/index.d.ts", + "types": "dist/es/src/index.d.ts", "scripts": { - "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc -b tsconfig.cjs.json", - "build:esm": "tsc -b tsconfig.es.json", - "test": "npm run build && mocha 'dist/cjs/test/**/*.js'", + "build": "npm run build:esm", + "build:esm": "tsc", + "test:node": "vitest run", + "test:browser": "vitest run --browser.name=chrome --browser.headless", + "test": "npm run test:node && npm run test:browser", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "rm -r ./dist" + "clean": "rm -rf ./dist" }, "repository": "git://github.com/microsoft/kiota-typescript.git", "keywords": [ @@ -30,11 +31,12 @@ "homepage": "https://github.com/microsoft/kiota-typescript#readme", "dependencies": { "@azure/core-auth": "^1.5.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" }, "publishConfig": { "access": "public" - } + }, + "devDependencies": {} } diff --git a/packages/authentication/azure/src/azureIdentityAccessTokenProvider.ts b/packages/authentication/azure/src/azureIdentityAccessTokenProvider.ts index e38533980..a62f7de50 100644 --- a/packages/authentication/azure/src/azureIdentityAccessTokenProvider.ts +++ b/packages/authentication/azure/src/azureIdentityAccessTokenProvider.ts @@ -1,137 +1,111 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { GetTokenOptions, TokenCredential } from "@azure/core-auth"; -import { - type AccessTokenProvider, - AllowedHostsValidator, - validateProtocol, -} from "@microsoft/kiota-abstractions"; +import { type AccessTokenProvider, AllowedHostsValidator, validateProtocol, inNodeEnv } from "@microsoft/kiota-abstractions"; import { type Span, trace } from "@opentelemetry/api"; import { type ObservabilityOptions, ObservabilityOptionsImpl } from "./observabilityOptions"; /** Access token provider that leverages the Azure Identity library to retrieve an access token. */ export class AzureIdentityAccessTokenProvider implements AccessTokenProvider { - /** - *@constructor - *@param credentials The tokenCredential implementation to use for authentication. - *@param scopes The scopes to use for authentication. - *@param options The options to use for authentication. - *@param allowedHosts The allowed hosts to use for authentication. - */ - public constructor( - private readonly credentials: TokenCredential, - private readonly scopes: string[] = [], - private readonly options?: GetTokenOptions, - allowedHosts: Set = new Set(), - private readonly observabilityOptions: ObservabilityOptions = new ObservabilityOptionsImpl() - ) { - if (!credentials) { - throw new Error("parameter credentials cannot be null"); - } - if (!scopes) { - throw new Error("scopes cannot be null"); - } - if (!observabilityOptions) { - throw new Error("observabilityOptions cannot be null"); - } - this.allowedHostsValidator = new AllowedHostsValidator(allowedHosts); - } - private readonly allowedHostsValidator: AllowedHostsValidator; - private static readonly claimsKey = "claims"; - /** - * @inheritdoc - */ - public getAuthorizationToken = ( - url?: string, - additionalAuthenticationContext?: Record - ): Promise => { - return trace - .getTracer(this.observabilityOptions.getTracerInstrumentationName()) - .startActiveSpan("getAuthorizationToken", (span) => { - try { - return this.getAuthorizationTokenInternal( - url, - additionalAuthenticationContext, - span - ); - } finally { - span.end(); - } - }); - }; - private getAuthorizationTokenInternal = async ( - url?: string, - additionalAuthenticationContext?: Record, - span?: Span - ): Promise => { - if (!url || !this.allowedHostsValidator.isUrlHostValid(url)) { - span?.setAttribute( - "com.microsoft.kiota.authentication.is_url_valid", - false - ); - return ""; - } - validateProtocol(url); - span?.setAttribute("com.microsoft.kiota.authentication.is_url_valid", true); - let decodedClaims = ""; - if ( - additionalAuthenticationContext && - additionalAuthenticationContext[ - AzureIdentityAccessTokenProvider.claimsKey - ] - ) { - const rawClaims = additionalAuthenticationContext[ - AzureIdentityAccessTokenProvider.claimsKey - ] as string; - decodedClaims = Buffer.from(rawClaims, "base64").toString(); - } - span?.setAttribute( - "com.microsoft.kiota.authentication.additional_claims_provided", - decodedClaims !== "" - ); - const localOptions = { ...this.options }; - if (decodedClaims) { - (localOptions as any).claims = decodedClaims; // the field is defined in a derived interface for some reason https://github.com/Azure/azure-sdk-for-js/blob/4498fecbede71563fee5daae2ad537ff57de3640/sdk/identity/identity/src/msal/credentials.ts#L29 - } - if (this.scopes.length === 0) { - const [scheme, host] = this.getSchemeAndHostFromUrl(url); - this.scopes.push(`${scheme}://${host}/.default`); - } - span?.setAttribute( - "com.microsoft.kiota.authentication.scopes", - this.scopes.join(",") - ); - const result = await this.credentials.getToken(this.scopes, localOptions); - return result?.token ?? ""; - }; - private getSchemeAndHostFromUrl = (url: string): string[] => { - const urlParts = url.split("://"); - if (urlParts.length === 0) { - // relative url - return [this.getSchemeFromLocation(), this.getHostFromLocation()]; - } else if (urlParts.length === 1) { - // protocol relative url - return [this.getSchemeFromLocation(), urlParts[0].split("/")[0]]; - } else if (urlParts.length >= 2) { - // absolute url - return [urlParts[0], urlParts[1].split("/")[0]]; - } else { - throw new Error("invalid url"); - } - }; - private getSchemeFromLocation = (): string => { - if (window && window.location && window.location.protocol) { - return window.location.protocol.replace(":", ""); - } - return ""; - }; - private getHostFromLocation = (): string => { - if (window && window.location && window.location.host) { - return window.location.host; - } - return ""; - }; - /** - * @inheritdoc - */ - public getAllowedHostsValidator = () => this.allowedHostsValidator; + /** + *@constructor + *@param credentials The tokenCredential implementation to use for authentication. + *@param scopes The scopes to use for authentication. + *@param options The options to use for authentication. + *@param allowedHosts The allowed hosts to use for authentication. + */ + public constructor( + private readonly credentials: TokenCredential, + private readonly scopes: string[] = [], + private readonly options?: GetTokenOptions, + allowedHosts: Set = new Set(), + private readonly observabilityOptions: ObservabilityOptions = new ObservabilityOptionsImpl(), + ) { + if (!credentials) { + throw new Error("parameter credentials cannot be null"); + } + if (!scopes) { + throw new Error("scopes cannot be null"); + } + if (!observabilityOptions) { + throw new Error("observabilityOptions cannot be null"); + } + this.allowedHostsValidator = new AllowedHostsValidator(allowedHosts); + } + private readonly allowedHostsValidator: AllowedHostsValidator; + private static readonly claimsKey = "claims"; + /** + * @inheritdoc + */ + public getAuthorizationToken = (url?: string, additionalAuthenticationContext?: Record): Promise => { + return trace.getTracer(this.observabilityOptions.getTracerInstrumentationName()).startActiveSpan("getAuthorizationToken", (span) => { + try { + return this.getAuthorizationTokenInternal(url, additionalAuthenticationContext, span); + } finally { + span.end(); + } + }); + }; + private getAuthorizationTokenInternal = async (url?: string, additionalAuthenticationContext?: Record, span?: Span): Promise => { + if (!url || !this.allowedHostsValidator.isUrlHostValid(url)) { + span?.setAttribute("com.microsoft.kiota.authentication.is_url_valid", false); + return ""; + } + validateProtocol(url); + span?.setAttribute("com.microsoft.kiota.authentication.is_url_valid", true); + let decodedClaims = ""; + if (additionalAuthenticationContext && additionalAuthenticationContext[AzureIdentityAccessTokenProvider.claimsKey]) { + const rawClaims = additionalAuthenticationContext[AzureIdentityAccessTokenProvider.claimsKey] as string; + decodedClaims = inNodeEnv() ? Buffer.from(rawClaims, "base64").toString() : atob(rawClaims); + } + span?.setAttribute("com.microsoft.kiota.authentication.additional_claims_provided", decodedClaims !== ""); + const localOptions = { ...this.options }; + if (decodedClaims) { + (localOptions as any).claims = decodedClaims; // the field is defined in a derived interface for some reason https://github.com/Azure/azure-sdk-for-js/blob/4498fecbede71563fee5daae2ad537ff57de3640/sdk/identity/identity/src/msal/credentials.ts#L29 + } + if (this.scopes.length === 0) { + const [scheme, host] = this.getSchemeAndHostFromUrl(url); + this.scopes.push(`${scheme}://${host}/.default`); + } + span?.setAttribute("com.microsoft.kiota.authentication.scopes", this.scopes.join(",")); + const result = await this.credentials.getToken(this.scopes, localOptions); + return result?.token ?? ""; + }; + private getSchemeAndHostFromUrl = (url: string): string[] => { + const urlParts = url.split("://"); + if (urlParts.length === 0) { + // relative url + return [this.getSchemeFromLocation(), this.getHostFromLocation()]; + } else if (urlParts.length === 1) { + // protocol relative url + return [this.getSchemeFromLocation(), urlParts[0].split("/")[0]]; + } else if (urlParts.length >= 2) { + // absolute url + return [urlParts[0], urlParts[1].split("/")[0]]; + } else { + throw new Error("invalid url"); + } + }; + private getSchemeFromLocation = (): string => { + if (!inNodeEnv()) { + return window.location.protocol.replace(":", ""); + } + return ""; + }; + private getHostFromLocation = (): string => { + if (!inNodeEnv()) { + return window.location.host; + } + return ""; + }; + /** + * @inheritdoc + */ + public getAllowedHostsValidator = () => this.allowedHostsValidator; } diff --git a/packages/authentication/azure/src/azureIdentityAuthenticationProvider.ts b/packages/authentication/azure/src/azureIdentityAuthenticationProvider.ts index fd63b0b94..543e8291f 100644 --- a/packages/authentication/azure/src/azureIdentityAuthenticationProvider.ts +++ b/packages/authentication/azure/src/azureIdentityAuthenticationProvider.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { GetTokenOptions, TokenCredential } from "@azure/core-auth"; import { BaseBearerTokenAuthenticationProvider } from "@microsoft/kiota-abstractions"; @@ -5,35 +12,14 @@ import { AzureIdentityAccessTokenProvider } from "./azureIdentityAccessTokenProv import { type ObservabilityOptions, ObservabilityOptionsImpl } from "./observabilityOptions"; export class AzureIdentityAuthenticationProvider extends BaseBearerTokenAuthenticationProvider { - /** - *@constructor - *@param credentials The tokenCredential implementation to use for authentication. - *@param scopes The scopes to use for authentication. - *@param options The options to use for authentication. - *@param allowedHosts The allowed hosts to use for authentication. - */ - public constructor( - credentials: TokenCredential, - scopes: string[] = ["https://graph.microsoft.com/.default"], - options?: GetTokenOptions, - allowedHosts: Set = new Set([ - "graph.microsoft.com", - "graph.microsoft.us", - "dod-graph.microsoft.us", - "graph.microsoft.de", - "microsoftgraph.chinacloudapi.cn", - "canary.graph.microsoft.com", - ]), - observabilityOptions: ObservabilityOptions = new ObservabilityOptionsImpl() - ) { - super( - new AzureIdentityAccessTokenProvider( - credentials, - scopes, - options, - allowedHosts, - observabilityOptions, - ) - ); - } + /** + *@constructor + *@param credentials The tokenCredential implementation to use for authentication. + *@param scopes The scopes to use for authentication. + *@param options The options to use for authentication. + *@param allowedHosts The allowed hosts to use for authentication. + */ + public constructor(credentials: TokenCredential, scopes: string[] = ["https://graph.microsoft.com/.default"], options?: GetTokenOptions, allowedHosts: Set = new Set(["graph.microsoft.com", "graph.microsoft.us", "dod-graph.microsoft.us", "graph.microsoft.de", "microsoftgraph.chinacloudapi.cn", "canary.graph.microsoft.com"]), observabilityOptions: ObservabilityOptions = new ObservabilityOptionsImpl()) { + super(new AzureIdentityAccessTokenProvider(credentials, scopes, options, allowedHosts, observabilityOptions)); + } } diff --git a/packages/authentication/azure/src/index.ts b/packages/authentication/azure/src/index.ts index 0047a807d..d0bea5b00 100644 --- a/packages/authentication/azure/src/index.ts +++ b/packages/authentication/azure/src/index.ts @@ -1,2 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "./azureIdentityAuthenticationProvider"; export * from "./azureIdentityAccessTokenProvider"; diff --git a/packages/authentication/azure/src/observabilityOptions.ts b/packages/authentication/azure/src/observabilityOptions.ts index f4cc7ada5..c54880666 100644 --- a/packages/authentication/azure/src/observabilityOptions.ts +++ b/packages/authentication/azure/src/observabilityOptions.ts @@ -1,9 +1,16 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export interface ObservabilityOptions { - getTracerInstrumentationName(): string; + getTracerInstrumentationName(): string; } export class ObservabilityOptionsImpl implements ObservabilityOptions { - getTracerInstrumentationName(): string { - return "@microsoft/kiota-authentication-azure"; - } + getTracerInstrumentationName(): string { + return "@microsoft/kiota-authentication-azure"; + } } diff --git a/packages/authentication/azure/test/azureIdentityAuthenticationTest.ts b/packages/authentication/azure/test/azureIdentityAuthenticationTest.ts index b629756ce..5d6c4f4b6 100644 --- a/packages/authentication/azure/test/azureIdentityAuthenticationTest.ts +++ b/packages/authentication/azure/test/azureIdentityAuthenticationTest.ts @@ -6,147 +6,104 @@ */ import { type AccessToken, ClientSecretCredential } from "@azure/identity"; -import { - BaseBearerTokenAuthenticationProvider, - RequestInformation, -} from "@microsoft/kiota-abstractions"; -import { assert } from "chai"; +import { BaseBearerTokenAuthenticationProvider, RequestInformation } from "@microsoft/kiota-abstractions"; +import { assert, describe, it } from "vitest"; import * as sinon from "sinon"; import { AzureIdentityAuthenticationProvider } from "../src"; import { AzureIdentityAccessTokenProvider } from "../src/azureIdentityAccessTokenProvider"; describe("Test authentication using @azure/identity", () => { - const tenantId = "0000-1111-2222-3333"; - const clientId = "CLIENT_ID"; - const clientSecret = "CLIENT_SECRET"; - const scopes = ["test_scopes"]; - it("AccessToken is returned correctly from getAuthorizationToken function", async () => { - const clientCredential = new ClientSecretCredential( - tenantId, - clientId, - clientSecret - ); - - if (typeof clientCredential.getToken !== "function") { - throw new Error("Method definition for getToken is not found"); - } - - const accessToken: AccessToken = { - token: "dummy_valid_token", - expiresOnTimestamp: 1, - }; - - const moq = sinon.mock(clientCredential); - moq.expects("getToken").resolves(accessToken); - const accessTokenProvider = new AzureIdentityAccessTokenProvider( - clientCredential, - scopes, - undefined, - new Set(["graph.microsoft.com"]) - ); - const access = await accessTokenProvider.getAuthorizationToken( - "https://graph.microsoft.com/v1.0" - ); - assert.equal(access, accessToken.token); - }); - - it("AccessToken is appended correctly in header by AzureIdentityAuthenticationProvider", async () => { - const clientCredential = new ClientSecretCredential( - tenantId, - clientId, - clientSecret - ); - - if (typeof clientCredential.getToken !== "function") { - throw new Error("Method definition for getToken is not found"); - } - - const accessToken: AccessToken = { - token: "dummy_valid_token", - expiresOnTimestamp: 1, - }; - - const moq = sinon.mock(clientCredential); - moq.expects("getToken").resolves(accessToken); - const request: RequestInformation = new RequestInformation(); - request.urlTemplate = "test"; - request.URL = "https://graph.microsoft.com/v1.0"; - const tokenCredentialAuthenticationProvider = - new AzureIdentityAuthenticationProvider(clientCredential, scopes); - await tokenCredentialAuthenticationProvider.authenticateRequest(request); - assert.equal( - request.headers.tryGetValue("Authorization")![0], - "Bearer " + accessToken.token - ); - }); - - it("AccessToken is appended correctly in header by BaseBearerTokenAuthenticationProvider", async () => { - const clientCredential = new ClientSecretCredential( - tenantId, - clientId, - clientSecret - ); - - if (typeof clientCredential.getToken !== "function") { - throw new Error("Method definition for getToken is not found"); - } - - const accessToken: AccessToken = { - token: "dummy_valid_token", - expiresOnTimestamp: 1, - }; - - const moq = sinon.mock(clientCredential); - moq.expects("getToken").resolves(accessToken); - const request: RequestInformation = new RequestInformation(); - request.urlTemplate = "test"; - request.URL = "https://graph.microsoft.com/v1.0"; - const accessTokenProvider = new AzureIdentityAccessTokenProvider( - clientCredential, - scopes - ); - const tokenCredentialAuthenticationProvider = - new BaseBearerTokenAuthenticationProvider(accessTokenProvider); - await tokenCredentialAuthenticationProvider.authenticateRequest(request); - assert.equal( - request.headers.tryGetValue("Authorization")![0], - "Bearer " + accessToken.token - ); - }); - - it("adds the claims to the token context", async () => { - const clientCredential = new ClientSecretCredential( - tenantId, - clientId, - clientSecret - ); - const accessToken: AccessToken = { - token: "dummy_valid_token", - expiresOnTimestamp: 1, - }; - - const moq = sinon.mock(clientCredential); - moq - .expects("getToken") - .exactly(1) - .callsFake((_, options) => { - assert.equal( - options.claims, - '{"access_token":{"nbf":{"essential":true, "value":"1652813508"}}}' - ); - return Promise.resolve(accessToken); - }); - const request: RequestInformation = new RequestInformation(); - request.urlTemplate = "test"; - request.URL = "https://graph.microsoft.com/v1.0"; - request.headers.tryAdd("Authorization", ...["Bearer dummy_valid_token"]); - const tokenCredentialAuthenticationProvider = - new AzureIdentityAuthenticationProvider(clientCredential, scopes); - await tokenCredentialAuthenticationProvider.authenticateRequest(request, { - claims: - "eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTY1MjgxMzUwOCJ9fX0=", - }); - moq.verify(); - }); + const tenantId = "0000-1111-2222-3333"; + const clientId = "CLIENT_ID"; + const clientSecret = "CLIENT_SECRET"; + const scopes = ["test_scopes"]; + it("AccessToken is returned correctly from getAuthorizationToken function", async () => { + const clientCredential = new ClientSecretCredential(tenantId, clientId, clientSecret); + + if (typeof clientCredential.getToken !== "function") { + throw new Error("Method definition for getToken is not found"); + } + + const accessToken: AccessToken = { + token: "dummy_valid_token", + expiresOnTimestamp: 1, + }; + + const moq = sinon.mock(clientCredential); + moq.expects("getToken").resolves(accessToken); + const accessTokenProvider = new AzureIdentityAccessTokenProvider(clientCredential, scopes, undefined, new Set(["graph.microsoft.com"])); + const access = await accessTokenProvider.getAuthorizationToken("https://graph.microsoft.com/v1.0"); + assert.equal(access, accessToken.token); + }); + + it("AccessToken is appended correctly in header by AzureIdentityAuthenticationProvider", async () => { + const clientCredential = new ClientSecretCredential(tenantId, clientId, clientSecret); + + if (typeof clientCredential.getToken !== "function") { + throw new Error("Method definition for getToken is not found"); + } + + const accessToken: AccessToken = { + token: "dummy_valid_token", + expiresOnTimestamp: 1, + }; + + const moq = sinon.mock(clientCredential); + moq.expects("getToken").resolves(accessToken); + const request: RequestInformation = new RequestInformation(); + request.urlTemplate = "test"; + request.URL = "https://graph.microsoft.com/v1.0"; + const tokenCredentialAuthenticationProvider = new AzureIdentityAuthenticationProvider(clientCredential, scopes); + await tokenCredentialAuthenticationProvider.authenticateRequest(request); + assert.equal(request.headers.tryGetValue("Authorization")![0], "Bearer " + accessToken.token); + }); + + it("AccessToken is appended correctly in header by BaseBearerTokenAuthenticationProvider", async () => { + const clientCredential = new ClientSecretCredential(tenantId, clientId, clientSecret); + + if (typeof clientCredential.getToken !== "function") { + throw new Error("Method definition for getToken is not found"); + } + + const accessToken: AccessToken = { + token: "dummy_valid_token", + expiresOnTimestamp: 1, + }; + + const moq = sinon.mock(clientCredential); + moq.expects("getToken").resolves(accessToken); + const request: RequestInformation = new RequestInformation(); + request.urlTemplate = "test"; + request.URL = "https://graph.microsoft.com/v1.0"; + const accessTokenProvider = new AzureIdentityAccessTokenProvider(clientCredential, scopes); + const tokenCredentialAuthenticationProvider = new BaseBearerTokenAuthenticationProvider(accessTokenProvider); + await tokenCredentialAuthenticationProvider.authenticateRequest(request); + assert.equal(request.headers.tryGetValue("Authorization")![0], "Bearer " + accessToken.token); + }); + + it("adds the claims to the token context", async () => { + const clientCredential = new ClientSecretCredential(tenantId, clientId, clientSecret); + const accessToken: AccessToken = { + token: "dummy_valid_token", + expiresOnTimestamp: 1, + }; + + const moq = sinon.mock(clientCredential); + moq.expects("getToken") + .exactly(1) + .callsFake((_, options) => { + assert.equal(options.claims, '{"access_token":{"nbf":{"essential":true, "value":"1652813508"}}}'); + return Promise.resolve(accessToken); + }); + const request: RequestInformation = new RequestInformation(); + request.urlTemplate = "test"; + request.URL = "https://graph.microsoft.com/v1.0"; + request.headers.tryAdd("Authorization", ...["Bearer dummy_valid_token"]); + const tokenCredentialAuthenticationProvider = new AzureIdentityAuthenticationProvider(clientCredential, scopes); + await tokenCredentialAuthenticationProvider.authenticateRequest(request, { + claims: "eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTY1MjgxMzUwOCJ9fX0=", + }); + moq.verify(); + }); }); diff --git a/packages/authentication/azure/tsconfig.base.json b/packages/authentication/azure/tsconfig.base.json deleted file mode 100644 index 18512f53d..000000000 --- a/packages/authentication/azure/tsconfig.base.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "importHelpers": true, - "noEmitOnError": true, - "moduleResolution": "node", - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "declarationMap": true, - "composite": true, - "paths": { - "@microsoft/kiota-abstractions": [ - "../../abstractions" - ], - } - } -} \ No newline at end of file diff --git a/packages/authentication/azure/tsconfig.cjs.json b/packages/authentication/azure/tsconfig.cjs.json deleted file mode 100644 index 2c38a55da..000000000 --- a/packages/authentication/azure/tsconfig.cjs.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2015", - "module": "commonjs", - "outDir": "./dist/cjs" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test"], - "references": [ - { - "path": "../../abstractions/tsconfig.cjs.json" - }, - ] -} \ No newline at end of file diff --git a/packages/authentication/azure/tsconfig.es.json b/packages/authentication/azure/tsconfig.es.json deleted file mode 100644 index 01f26ef4b..000000000 --- a/packages/authentication/azure/tsconfig.es.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "dist/es/" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "references": [ - { - "path": "../../abstractions/tsconfig.es.json" - }, - ] -} diff --git a/packages/authentication/azure/tsconfig.json b/packages/authentication/azure/tsconfig.json new file mode 100644 index 000000000..a3091e909 --- /dev/null +++ b/packages/authentication/azure/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist/es/" + }, + "include": [ + "./src/**/*.ts", + ] +} \ No newline at end of file diff --git a/packages/authentication/azure/vitest.config.mts b/packages/authentication/azure/vitest.config.mts new file mode 100644 index 000000000..4a6f89f2f --- /dev/null +++ b/packages/authentication/azure/vitest.config.mts @@ -0,0 +1,11 @@ +import { defineConfig, configDefaults } from "vitest/config"; + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude, "**/test{Entity,Enum}.ts"], + include: [...configDefaults.include, "test/**/*.ts"], + coverage: { + reporter: ["html"], + }, + }, +}); \ No newline at end of file diff --git a/packages/authentication/spfx/.eslintignore b/packages/authentication/spfx/.eslintignore deleted file mode 100644 index 8942aa232..000000000 --- a/packages/authentication/spfx/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -*.js -*.js.map -*.d.ts - -node_modules -lib -spec/development \ No newline at end of file diff --git a/packages/authentication/spfx/.eslintrc.json b/packages/authentication/spfx/.eslintrc.json deleted file mode 100644 index 80ab9b397..000000000 --- a/packages/authentication/spfx/.eslintrc.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "prettier", - "simple-import-sort" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "rules": { - "@typescript-eslint/no-empty-interface": "warn", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/consistent-type-imports": "error", - "prettier/prettier": [ - "error", - { - "endOfLine": "auto" - } - ], - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "typeLike", - "format": [ - "PascalCase" - ], - "filter": { - "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "interface", - "format": [ - "PascalCase" - ], - "custom": { - "regex": "^I[A-Z]", - "match": false - }, - "filter": { - "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", - "match": false - } - }, - { - "selector": "variable", - "format": [ - "camelCase", - "PascalCase", - "UPPER_CASE" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "function", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "parameter", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", - "match": false - } - }, - { - "selector": "method", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "memberLike", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "enumMember", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "property", - "format": null - } - ], - "@typescript-eslint/semi": "error", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/prefer-for-of": "error", - "@typescript-eslint/prefer-function-type": "error", - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/quotes": [ - "error", - "double", - { - "avoidEscape": true, - "allowTemplateLiterals": true - } - ], - "@typescript-eslint/space-within-parens": [ - "off", - "never" - ], - "@typescript-eslint/triple-slash-reference": "error", - "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unified-signatures": "error", - "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", - "@typescript-eslint/consistent-type-definitions": [ - "error", - "interface" - ], - "@typescript-eslint/no-inferrable-types": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-this-alias": "error", - "no-unused-expressions": "off", - "@typescript-eslint/no-unused-expressions": [ - "error", - { - "allowTernary": true - } - ], - "@typescript-eslint/space-before-function-paren": "off", - "@typescript-eslint/consistent-type-assertions": "error", - "@typescript-eslint/explicit-member-accessibility": [ - "off", - { - "accessibility": "explicit" - } - ], - "@typescript-eslint/indent": "off", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/member-delimiter-style": [ - "off", - { - "multiline": { - "delimiter": "none", - "requireLast": true - }, - "singleline": { - "delimiter": "semi", - "requireLast": false - } - } - ], - "@typescript-eslint/member-ordering": "off", - "@typescript-eslint/no-empty-function": "error", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-parameter-properties": "off", - "@typescript-eslint/no-array-constructor": "error", - "no-useless-catch": "error", - "prefer-rest-params": "off", - "no-constant-condition": "error", - "simple-import-sort/imports": "error", - "brace-style": "error", - "constructor-super": "error", - "curly": [ - "error", - "multi-line" - ], - "dot-notation": "off", - "eqeqeq": "error", - "new-parens": "error", - "no-caller": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-empty": "error", - "no-eval": "error", - "no-extra-bind": "error", - "no-fallthrough": "error", - "no-new-func": "off", - "no-new-wrappers": "error", - "no-return-await": "off", - "no-sparse-arrays": "error", - "no-template-curly-in-string": "error", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-unsafe-finally": "error", - "no-unused-labels": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-const": "error", - "prefer-object-spread": "error", - "quote-props": "off", - "space-in-parens": "error", - "unicode-bom": [ - "error", - "never" - ], - "use-isnan": "error" - } -} \ No newline at end of file diff --git a/packages/authentication/spfx/.npmignore b/packages/authentication/spfx/.npmignore index 164fa84b7..15ae0ca0b 100644 --- a/packages/authentication/spfx/.npmignore +++ b/packages/authentication/spfx/.npmignore @@ -4,7 +4,6 @@ *.tgz **/test/**/* docs/ -karma.conf.js node_modules/ rollup.config.js src/ diff --git a/packages/authentication/spfx/package.json b/packages/authentication/spfx/package.json index 5f635eb47..7c414e960 100644 --- a/packages/authentication/spfx/package.json +++ b/packages/authentication/spfx/package.json @@ -2,17 +2,18 @@ "name": "@microsoft/kiota-authentication-spfx", "version": "1.0.0-preview.41", "description": "Authentication provider for using Kiota in SPFx solutions", - "main": "dist/cjs/src/index.js", + "main": "dist/es/src/index.js", "module": "dist/es/src/index.js", - "types": "dist/cjs/src/index.d.ts", + "types": "dist/es/src/index.d.ts", "scripts": { - "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc -b tsconfig.cjs.json", - "build:esm": "tsc -b tsconfig.es.json", - "test": "npm run build && mocha 'dist/cjs/test/**/*.js'", + "build": "npm run build:esm", + "build:esm": "tsc", + "test:browser": "vitest run --browser.name=chrome --browser.headless", + "test:node": "vitest --run", + "test": "npm run test:node && npm run test:browser", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "rm -r ./dist" + "clean": "rm -rf ./dist" }, "repository": "git://github.com/microsoft/kiota-typescript.git", "keywords": [ @@ -39,7 +40,7 @@ }, "homepage": "https://github.com/microsoft/kiota-typescript#readme", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "@microsoft/sp-http": "^1.15.2", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" @@ -47,4 +48,4 @@ "publishConfig": { "access": "public" } -} +} \ No newline at end of file diff --git a/packages/authentication/spfx/src/azureAdSpfxAccessTokenProvider.ts b/packages/authentication/spfx/src/azureAdSpfxAccessTokenProvider.ts index 7c17f64bf..5fe07bddf 100644 --- a/packages/authentication/spfx/src/azureAdSpfxAccessTokenProvider.ts +++ b/packages/authentication/spfx/src/azureAdSpfxAccessTokenProvider.ts @@ -1,94 +1,79 @@ -import { - type AccessTokenProvider, - AllowedHostsValidator, - validateProtocol, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { type AccessTokenProvider, AllowedHostsValidator, validateProtocol } from "@microsoft/kiota-abstractions"; import { type AadTokenProvider } from "@microsoft/sp-http"; import { type Span, trace } from "@opentelemetry/api"; import { type ObservabilityOptions, ObservabilityOptionsImpl } from "./observabilityOptions"; export class AzureAdSpfxAccessTokenProvider implements AccessTokenProvider { - private readonly allowedHostsValidator: AllowedHostsValidator; + private readonly allowedHostsValidator: AllowedHostsValidator; - /** - *@constructor - *@param tokenProvider The tokenProvider provided by the SharePoint framework - *@param applicationIdUri The application ID URI of the Azure AD App that we want to Authenticate - *@param allowedHosts The allowed hosts to use for authentication. - *@param useCachedToken Allows the developer to specify if cached tokens should be returned. - */ - public constructor( - private readonly tokenProvider: AadTokenProvider, - private readonly applicationIdUri: string, - allowedHosts: Set = new Set(), - private readonly useCachedToken?: boolean, - private readonly observabilityOptions: ObservabilityOptions = new ObservabilityOptionsImpl() - ) { - if (!tokenProvider) { - throw new Error("parameter tokenProvider cannot be null"); - } - if (!applicationIdUri) { - throw new Error("applicationIdUri cannot be null or empty"); - } - if (!observabilityOptions) { - throw new Error("observabilityOptions cannot be null"); - } - this.allowedHostsValidator = new AllowedHostsValidator(allowedHosts); - } + /** + *@constructor + *@param tokenProvider The tokenProvider provided by the SharePoint framework + *@param applicationIdUri The application ID URI of the Azure AD App that we want to Authenticate + *@param allowedHosts The allowed hosts to use for authentication. + *@param useCachedToken Allows the developer to specify if cached tokens should be returned. + */ + public constructor( + private readonly tokenProvider: AadTokenProvider, + private readonly applicationIdUri: string, + allowedHosts: Set = new Set(), + private readonly useCachedToken?: boolean, + private readonly observabilityOptions: ObservabilityOptions = new ObservabilityOptionsImpl(), + ) { + if (!tokenProvider) { + throw new Error("parameter tokenProvider cannot be null"); + } + if (!applicationIdUri) { + throw new Error("applicationIdUri cannot be null or empty"); + } + if (!observabilityOptions) { + throw new Error("observabilityOptions cannot be null"); + } + this.allowedHostsValidator = new AllowedHostsValidator(allowedHosts); + } - /** - * @inheritdoc - */ - public getAuthorizationToken = ( - url?: string, - additionalAuthenticationContext?: Record - ): Promise => { - return trace - .getTracer(this.observabilityOptions.getTracerInstrumentationName()) - .startActiveSpan("getAuthorizationToken", (span) => { - try { - return this.getAuthorizationTokenInternal( - url, - additionalAuthenticationContext, - span - ); - } finally { - span.end(); - } - }); - }; - private getAuthorizationTokenInternal = async ( - url?: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - additionalAuthenticationContext?: Record, - span?: Span - ): Promise => { - if (!url || !this.allowedHostsValidator.isUrlHostValid(url)) { - span?.setAttribute( - "com.microsoft.kiota.authentication.is_url_valid", - false - ); - return ""; - } + /** + * @inheritdoc + */ + public getAuthorizationToken = (url?: string, additionalAuthenticationContext?: Record): Promise => { + return trace.getTracer(this.observabilityOptions.getTracerInstrumentationName()).startActiveSpan("getAuthorizationToken", (span) => { + try { + return this.getAuthorizationTokenInternal(url, additionalAuthenticationContext, span); + } finally { + span.end(); + } + }); + }; + private getAuthorizationTokenInternal = async ( + url?: string, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + additionalAuthenticationContext?: Record, + span?: Span, + ): Promise => { + if (!url || !this.allowedHostsValidator.isUrlHostValid(url)) { + span?.setAttribute("com.microsoft.kiota.authentication.is_url_valid", false); + return ""; + } - validateProtocol(url); - span?.setAttribute("com.microsoft.kiota.authentication.is_url_valid", true); + validateProtocol(url); + span?.setAttribute("com.microsoft.kiota.authentication.is_url_valid", true); - span?.setAttribute( - "com.microsoft.kiota.authentication.scopes", - this.applicationIdUri - ); - const accessToken: string = await this.tokenProvider.getToken( - this.applicationIdUri, - this.useCachedToken - ); + span?.setAttribute("com.microsoft.kiota.authentication.scopes", this.applicationIdUri); + const accessToken: string = await this.tokenProvider.getToken(this.applicationIdUri, this.useCachedToken); - return accessToken ?? ""; - }; + return accessToken ?? ""; + }; - /** - * @inheritdoc - */ - public getAllowedHostsValidator = () => this.allowedHostsValidator; + /** + * @inheritdoc + */ + public getAllowedHostsValidator = () => this.allowedHostsValidator; } diff --git a/packages/authentication/spfx/src/azureAdSpfxAuthenticationProvider.ts b/packages/authentication/spfx/src/azureAdSpfxAuthenticationProvider.ts index cd345bf77..fa1b7cf40 100644 --- a/packages/authentication/spfx/src/azureAdSpfxAuthenticationProvider.ts +++ b/packages/authentication/spfx/src/azureAdSpfxAuthenticationProvider.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import { BaseBearerTokenAuthenticationProvider } from "@microsoft/kiota-abstractions"; import { type AadTokenProvider } from "@microsoft/sp-http"; @@ -5,34 +12,14 @@ import { AzureAdSpfxAccessTokenProvider } from "./azureAdSpfxAccessTokenProvider import { type ObservabilityOptions, ObservabilityOptionsImpl } from "./observabilityOptions"; export class AzureAdSpfxAuthenticationProvider extends BaseBearerTokenAuthenticationProvider { - /** - *@constructor - *@param tokenProvider The tokenProvider provided by the SharePoint framework - *@param applicationIdUri The application ID URI of the Azure AD App that we want to Authenticate - *@param allowedHosts The allowed hosts to use for authentication. - *@param useCachedToken Allows the developer to specify if cached tokens should be returned. - */ - public constructor( - tokenProvider: AadTokenProvider, - applicationIdUri: string, - allowedHosts: Set = new Set([ - "graph.microsoft.com", - "graph.microsoft.us", - "dod-graph.microsoft.us", - "graph.microsoft.de", - "microsoftgraph.chinacloudapi.cn", - "canary.graph.microsoft.com", - ]), - useCachedToken?: boolean, - observabilityOptions: ObservabilityOptions = new ObservabilityOptionsImpl() - ) { - super( - new AzureAdSpfxAccessTokenProvider( - tokenProvider, - applicationIdUri, - allowedHosts, - useCachedToken, - observabilityOptions - )); - } + /** + *@constructor + *@param tokenProvider The tokenProvider provided by the SharePoint framework + *@param applicationIdUri The application ID URI of the Azure AD App that we want to Authenticate + *@param allowedHosts The allowed hosts to use for authentication. + *@param useCachedToken Allows the developer to specify if cached tokens should be returned. + */ + public constructor(tokenProvider: AadTokenProvider, applicationIdUri: string, allowedHosts: Set = new Set(["graph.microsoft.com", "graph.microsoft.us", "dod-graph.microsoft.us", "graph.microsoft.de", "microsoftgraph.chinacloudapi.cn", "canary.graph.microsoft.com"]), useCachedToken?: boolean, observabilityOptions: ObservabilityOptions = new ObservabilityOptionsImpl()) { + super(new AzureAdSpfxAccessTokenProvider(tokenProvider, applicationIdUri, allowedHosts, useCachedToken, observabilityOptions)); + } } diff --git a/packages/authentication/spfx/src/index.ts b/packages/authentication/spfx/src/index.ts index abc100ce3..1a5d6b88d 100644 --- a/packages/authentication/spfx/src/index.ts +++ b/packages/authentication/spfx/src/index.ts @@ -1,2 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "./azureAdSpfxAuthenticationProvider"; export * from "./azureAdSpfxAccessTokenProvider"; diff --git a/packages/authentication/spfx/src/observabilityOptions.ts b/packages/authentication/spfx/src/observabilityOptions.ts index 401ff6d69..de43525eb 100644 --- a/packages/authentication/spfx/src/observabilityOptions.ts +++ b/packages/authentication/spfx/src/observabilityOptions.ts @@ -1,9 +1,16 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export interface ObservabilityOptions { - getTracerInstrumentationName(): string; + getTracerInstrumentationName(): string; } export class ObservabilityOptionsImpl implements ObservabilityOptions { - getTracerInstrumentationName(): string { - return "@microsoft/kiota-authentication-spfx"; - } + getTracerInstrumentationName(): string { + return "@microsoft/kiota-authentication-spfx"; + } } diff --git a/packages/authentication/spfx/test/azureAdSpfxAuthenticationTest.ts b/packages/authentication/spfx/test/azureAdSpfxAuthenticationTest.ts index 7851a64d6..5e8ae0c3d 100644 --- a/packages/authentication/spfx/test/azureAdSpfxAuthenticationTest.ts +++ b/packages/authentication/spfx/test/azureAdSpfxAuthenticationTest.ts @@ -1,72 +1,60 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import { RequestInformation } from "@microsoft/kiota-abstractions"; -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; -import { AzureAdSpfxAccessTokenProvider,AzureAdSpfxAuthenticationProvider } from "../src"; +import { AzureAdSpfxAccessTokenProvider, AzureAdSpfxAuthenticationProvider } from "../src"; import { MockAadTokenProvider } from "./mockAadTokenProvider"; describe("Test authentication using SharePoint Framework", () => { + it("AccessToken is returned correctly from getAuthorizationToken function", async () => { + const expectedToken = "dummy_valid_token"; + const appIdUri = "api://api_client_id"; + const allowedHosts: Set = new Set(["myapi.azurewebsites.net"]); - it("AccessToken is returned correctly from getAuthorizationToken function", async () => { - const expectedToken = "dummy_valid_token"; - const appIdUri = "api://api_client_id"; - const allowedHosts: Set = new Set([ - "myapi.azurewebsites.net" - ]); - - const mockTokenProvider = new MockAadTokenProvider(expectedToken); + const mockTokenProvider = new MockAadTokenProvider(expectedToken); - const accessTokenProvider = new AzureAdSpfxAccessTokenProvider( - mockTokenProvider as any, - appIdUri, - allowedHosts); + const accessTokenProvider = new AzureAdSpfxAccessTokenProvider(mockTokenProvider as any, appIdUri, allowedHosts); - const accessToken: string = await accessTokenProvider.getAuthorizationToken( - "https://myapi.azurewebsites.net/endpoint"); + const accessToken: string = await accessTokenProvider.getAuthorizationToken("https://myapi.azurewebsites.net/endpoint"); - assert.equal(expectedToken, accessToken); - }); + assert.equal(expectedToken, accessToken); + }); - it("AccessToken is empty when requested URL is not in allowedHosts", async () => { - const expectedToken = "dummy_valid_token"; - const appIdUri = "api://api_client_id"; - const allowedHosts: Set = new Set([ - "myapi.azurewebsites.net" - ]); + it("AccessToken is empty when requested URL is not in allowedHosts", async () => { + const expectedToken = "dummy_valid_token"; + const appIdUri = "api://api_client_id"; + const allowedHosts: Set = new Set(["myapi.azurewebsites.net"]); - const mockTokenProvider = new MockAadTokenProvider(expectedToken); + const mockTokenProvider = new MockAadTokenProvider(expectedToken); - const accessTokenProvider = new AzureAdSpfxAccessTokenProvider( - mockTokenProvider as any, - appIdUri, - allowedHosts); + const accessTokenProvider = new AzureAdSpfxAccessTokenProvider(mockTokenProvider as any, appIdUri, allowedHosts); - const accessToken: string = await accessTokenProvider.getAuthorizationToken( - "https://notallowedhost.azurewebsites.net/endpoint"); + const accessToken: string = await accessTokenProvider.getAuthorizationToken("https://notallowedhost.azurewebsites.net/endpoint"); - assert.equal("", accessToken); - }); + assert.equal("", accessToken); + }); - it("AccessToken is appended correctly in header by AzureAdSpfxAuthenticationProvider", async () => { - const expectedToken = "dummy_valid_token"; - const appIdUri = "api://api_client_id"; - const allowedHosts: Set = new Set([ - "myapi.azurewebsites.net" - ]); + it("AccessToken is appended correctly in header by AzureAdSpfxAuthenticationProvider", async () => { + const expectedToken = "dummy_valid_token"; + const appIdUri = "api://api_client_id"; + const allowedHosts: Set = new Set(["myapi.azurewebsites.net"]); - const mockTokenProvider = new MockAadTokenProvider(expectedToken); + const mockTokenProvider = new MockAadTokenProvider(expectedToken); - const azureAdSpfxAuthProvider = new AzureAdSpfxAuthenticationProvider( - mockTokenProvider as any, appIdUri, allowedHosts); + const azureAdSpfxAuthProvider = new AzureAdSpfxAuthenticationProvider(mockTokenProvider as any, appIdUri, allowedHosts); - const request: RequestInformation = new RequestInformation(); - request.urlTemplate = "test"; - request.URL = "https://myapi.azurewebsites.net/v1.0/endpoint"; + const request: RequestInformation = new RequestInformation(); + request.urlTemplate = "test"; + request.URL = "https://myapi.azurewebsites.net/v1.0/endpoint"; - await azureAdSpfxAuthProvider.authenticateRequest(request); + await azureAdSpfxAuthProvider.authenticateRequest(request); - assert.equal( - request.headers.tryGetValue("Authorization")![0], - "Bearer " + expectedToken - ); - }); -}); \ No newline at end of file + assert.equal(request.headers.tryGetValue("Authorization")![0], "Bearer " + expectedToken); + }); +}); diff --git a/packages/authentication/spfx/test/mockAadTokenProvider.ts b/packages/authentication/spfx/test/mockAadTokenProvider.ts index 287344ad1..1bccf25e9 100644 --- a/packages/authentication/spfx/test/mockAadTokenProvider.ts +++ b/packages/authentication/spfx/test/mockAadTokenProvider.ts @@ -1,9 +1,14 @@ -export class MockAadTokenProvider { +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ - constructor(private readonly mockAccessToken: string) { - } +export class MockAadTokenProvider { + constructor(private readonly mockAccessToken: string) {} - public getToken(resourceEndpoint: string, useCachedToken?: boolean | undefined): Promise { - return Promise.resolve(this.mockAccessToken); - } -} \ No newline at end of file + public getToken(resourceEndpoint: string, useCachedToken?: boolean | undefined): Promise { + return Promise.resolve(this.mockAccessToken); + } +} diff --git a/packages/authentication/spfx/tsconfig.base.json b/packages/authentication/spfx/tsconfig.base.json deleted file mode 100644 index e8481355d..000000000 --- a/packages/authentication/spfx/tsconfig.base.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "importHelpers": true, - "noEmitOnError": true, - "moduleResolution": "node", - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "declarationMap": true, - "composite": true, - "paths": { - "@microsoft/kiota-abstractions": [ - "../../abstractions" - ], - }, - - "skipLibCheck": true - } -} \ No newline at end of file diff --git a/packages/authentication/spfx/tsconfig.cjs.json b/packages/authentication/spfx/tsconfig.cjs.json deleted file mode 100644 index 2c38a55da..000000000 --- a/packages/authentication/spfx/tsconfig.cjs.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2015", - "module": "commonjs", - "outDir": "./dist/cjs" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test"], - "references": [ - { - "path": "../../abstractions/tsconfig.cjs.json" - }, - ] -} \ No newline at end of file diff --git a/packages/authentication/spfx/tsconfig.es.json b/packages/authentication/spfx/tsconfig.es.json deleted file mode 100644 index 01f26ef4b..000000000 --- a/packages/authentication/spfx/tsconfig.es.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "dist/es/" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "references": [ - { - "path": "../../abstractions/tsconfig.es.json" - }, - ] -} diff --git a/packages/authentication/spfx/tsconfig.json b/packages/authentication/spfx/tsconfig.json new file mode 100644 index 000000000..eed00eebe --- /dev/null +++ b/packages/authentication/spfx/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist/es/", + "skipLibCheck": true + }, + "include": [ + "./src/**/*.ts", + ] +} \ No newline at end of file diff --git a/packages/authentication/spfx/vitest.config.mts b/packages/authentication/spfx/vitest.config.mts new file mode 100644 index 000000000..fea50b1b5 --- /dev/null +++ b/packages/authentication/spfx/vitest.config.mts @@ -0,0 +1,11 @@ +import { defineConfig, configDefaults } from "vitest/config"; + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude, "**/mockAadTokenProvider.ts"], + include: [...configDefaults.include, "test/**/*.ts"], + coverage: { + reporter: ["html"], + }, + }, +}); \ No newline at end of file diff --git a/packages/http/fetch/.eslintignore b/packages/http/fetch/.eslintignore deleted file mode 100644 index 1f80e8eea..000000000 --- a/packages/http/fetch/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -*.js -*.js.map -*.d.ts - -node_modules -dist diff --git a/packages/http/fetch/.eslintrc.json b/packages/http/fetch/.eslintrc.json deleted file mode 100644 index 80ab9b397..000000000 --- a/packages/http/fetch/.eslintrc.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "prettier", - "simple-import-sort" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "rules": { - "@typescript-eslint/no-empty-interface": "warn", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/consistent-type-imports": "error", - "prettier/prettier": [ - "error", - { - "endOfLine": "auto" - } - ], - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "typeLike", - "format": [ - "PascalCase" - ], - "filter": { - "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "interface", - "format": [ - "PascalCase" - ], - "custom": { - "regex": "^I[A-Z]", - "match": false - }, - "filter": { - "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", - "match": false - } - }, - { - "selector": "variable", - "format": [ - "camelCase", - "PascalCase", - "UPPER_CASE" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "function", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "parameter", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", - "match": false - } - }, - { - "selector": "method", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "memberLike", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "enumMember", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "property", - "format": null - } - ], - "@typescript-eslint/semi": "error", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/prefer-for-of": "error", - "@typescript-eslint/prefer-function-type": "error", - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/quotes": [ - "error", - "double", - { - "avoidEscape": true, - "allowTemplateLiterals": true - } - ], - "@typescript-eslint/space-within-parens": [ - "off", - "never" - ], - "@typescript-eslint/triple-slash-reference": "error", - "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unified-signatures": "error", - "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", - "@typescript-eslint/consistent-type-definitions": [ - "error", - "interface" - ], - "@typescript-eslint/no-inferrable-types": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-this-alias": "error", - "no-unused-expressions": "off", - "@typescript-eslint/no-unused-expressions": [ - "error", - { - "allowTernary": true - } - ], - "@typescript-eslint/space-before-function-paren": "off", - "@typescript-eslint/consistent-type-assertions": "error", - "@typescript-eslint/explicit-member-accessibility": [ - "off", - { - "accessibility": "explicit" - } - ], - "@typescript-eslint/indent": "off", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/member-delimiter-style": [ - "off", - { - "multiline": { - "delimiter": "none", - "requireLast": true - }, - "singleline": { - "delimiter": "semi", - "requireLast": false - } - } - ], - "@typescript-eslint/member-ordering": "off", - "@typescript-eslint/no-empty-function": "error", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-parameter-properties": "off", - "@typescript-eslint/no-array-constructor": "error", - "no-useless-catch": "error", - "prefer-rest-params": "off", - "no-constant-condition": "error", - "simple-import-sort/imports": "error", - "brace-style": "error", - "constructor-super": "error", - "curly": [ - "error", - "multi-line" - ], - "dot-notation": "off", - "eqeqeq": "error", - "new-parens": "error", - "no-caller": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-empty": "error", - "no-eval": "error", - "no-extra-bind": "error", - "no-fallthrough": "error", - "no-new-func": "off", - "no-new-wrappers": "error", - "no-return-await": "off", - "no-sparse-arrays": "error", - "no-template-curly-in-string": "error", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-unsafe-finally": "error", - "no-unused-labels": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-const": "error", - "prefer-object-spread": "error", - "quote-props": "off", - "space-in-parens": "error", - "unicode-bom": [ - "error", - "never" - ], - "use-isnan": "error" - } -} \ No newline at end of file diff --git a/packages/http/fetch/.npmignore b/packages/http/fetch/.npmignore index 164fa84b7..15ae0ca0b 100644 --- a/packages/http/fetch/.npmignore +++ b/packages/http/fetch/.npmignore @@ -4,7 +4,6 @@ *.tgz **/test/**/* docs/ -karma.conf.js node_modules/ rollup.config.js src/ diff --git a/packages/http/fetch/docs/design/testing.md b/packages/http/fetch/docs/design/testing.md index f54988cb2..ee905a0b9 100644 --- a/packages/http/fetch/docs/design/testing.md +++ b/packages/http/fetch/docs/design/testing.md @@ -1,25 +1,10 @@ ## Testing for node and browser +Testing is done using [vitest](https://vitest.dev). The configuration is set to run from the root folder([workspace mode](https://vitest.dev/guide/workspace.html)) as well as the root of every project folder in `packages`. Each project has been configured to allow running the tests in either the node or the browser environment. When you run the workspace test using the script command `test` from the root of the project folder, both node and browser environment tests are run in each of the project folders in `packages`. ### Testing for node -- Tests targeting the node environment are in `/test/node` and `/test/common` folder and use `mocha` and `chai` JS libraries. -- Test formats: - - script to test `CommonJS` modules: `npm run test:cjs` - - script to test `ES` modules: `npm run test:es` -- Examples of node environment specific tests: Test `middlewareFactory.ts`. - +All the tests in the project's `test/*` folder can be run in a node environment using the script command `test:node`. Any browser related code will fail this test run. ### Testing for browser - -- Tests targeting the node environment are in `/test/browser` and `/test/common` folder and use `mocha` and `chai` JS libraries. -- To test for browsers, the tests and the source code are bundled using `rollup` and the bundled file is tested using `karma`. -- Test formats: - - script to test: `npm run karma`. -- Examples of node environment specific tests: Test `DefaultFetchHandler` using dom - `fetch`. - ---- -**NOTE** - -The bundled file considers the `package.json browser spec` during the rollup process. The entry point of the source code for the tests will be `src/browser/index.js` and the `package.json browser spec` file mapping should work. ---- +All the tests in the project's `test/*` folder can be run in a browser environment using the script command `test:browser`. Any node related code will fail this test run. diff --git a/packages/http/fetch/karma.conf.js b/packages/http/fetch/karma.conf.js deleted file mode 100644 index ed70e0053..000000000 --- a/packages/http/fetch/karma.conf.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function(config) { - config.set({ - frameworks: ["mocha", "chai", "karma-typescript"], - files: [{ pattern: "dist/es/test/index.js", type: "module" }], - preprocessors: { - "**/*.ts": ["karma-typescript"], - }, - karmaTypescriptConfig: { - tsconfig: "./tsconfig.cjs.json", - }, - browsers: ["ChromeHeadless"], - }); -}; \ No newline at end of file diff --git a/packages/http/fetch/package.json b/packages/http/fetch/package.json index 9293f9f08..8ed57a0fd 100644 --- a/packages/http/fetch/package.json +++ b/packages/http/fetch/package.json @@ -18,27 +18,21 @@ }, "license": "MIT", "author": "Microsoft", - "main": "dist/cjs/src/index.js", - "browser": { - "./dist/es/src/index.js": "./dist/es/src/browser/index.js", - "./dist/es/src/middlewares/middlewareFactory.js": "./dist/es/src/middlewares/browser/middlewareFactory.js" - }, - "types": "dist/cjs/src/index.d.ts", + "main": "dist/es/src/index.js", + "module": "dist/es/src/index.js", + "types": "dist/es/src/index.d.ts", "scripts": { - "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc -b tsconfig.cjs.json", - "build:esm": "tsc -b tsconfig.es.json", - "build:test": "tsc -b tsconfig.cjs.test.json && tsc -b tsconfig.es.test.json", - "clean": "rm -r ./dist", - "karma": "npm run rollup && karma start --single-run --browsers ChromeHeadless karma.conf.js", + "build": "npm run build:esm", + "build:esm": "tsc", + "clean": "rm -rf ./dist", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "rollup": "rollup -c", - "test": "npm run build && npm run build:test && npm run test:cjs && npm run karma", - "test:cjs": "mocha 'dist/cjs/test/common/**/*.js' && mocha 'dist/cjs/test/node/**/*.js'" + "test:browser": "vitest run --browser.name=chrome --browser.headless", + "test:node": "vitest --run", + "test": "npm run test:node && npm run test:browser" }, "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "@opentelemetry/api": "^1.7.0", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" @@ -46,4 +40,4 @@ "publishConfig": { "access": "public" } -} +} \ No newline at end of file diff --git a/packages/http/fetch/rollup.config.js b/packages/http/fetch/rollup.config.js deleted file mode 100644 index 70df92e5e..000000000 --- a/packages/http/fetch/rollup.config.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -import commonjs from "@rollup/plugin-commonjs"; -import resolve from "@rollup/plugin-node-resolve"; - -const config = [ - { - input: ["dist/es/test/browser/index.js"], - output: { - file: "dist/es/test/index.js", - format: "esm", - name: "BrowserTest", - }, - plugins: [ - commonjs(), - resolve({ - browser: true, - preferBuiltins: false, - }), - ], - }, -]; - -export default config; diff --git a/packages/http/fetch/src/fetchRequestAdapter.ts b/packages/http/fetch/src/fetchRequestAdapter.ts index 99b4ab856..5f01ee902 100644 --- a/packages/http/fetch/src/fetchRequestAdapter.ts +++ b/packages/http/fetch/src/fetchRequestAdapter.ts @@ -1,4 +1,11 @@ -import { type ApiError, type AuthenticationProvider, type BackingStoreFactory, BackingStoreFactorySingleton, type DateOnly, DefaultApiError, type Duration, enableBackingStoreForParseNodeFactory, enableBackingStoreForSerializationWriterFactory, type ErrorMappings, type Parsable, type ParsableFactory, type ParseNode, type ParseNodeFactory, ParseNodeFactoryRegistry, type PrimitiveTypesForDeserialization, type PrimitiveTypesForDeserializationType,type RequestAdapter, type RequestInformation, type ResponseHandler, type ResponseHandlerOption, ResponseHandlerOptionKey, type SerializationWriterFactory, SerializationWriterFactoryRegistry, type TimeOnly } from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { type ApiError, type AuthenticationProvider, type BackingStoreFactory, BackingStoreFactorySingleton, type DateOnly, DefaultApiError, type Duration, enableBackingStoreForParseNodeFactory, enableBackingStoreForSerializationWriterFactory, type ErrorMappings, type Parsable, type ParsableFactory, type ParseNode, type ParseNodeFactory, ParseNodeFactoryRegistry, type PrimitiveTypesForDeserialization, type PrimitiveTypesForDeserializationType, type RequestAdapter, type RequestInformation, type ResponseHandler, type ResponseHandlerOption, ResponseHandlerOptionKey, type SerializationWriterFactory, SerializationWriterFactoryRegistry, type TimeOnly } from "@microsoft/kiota-abstractions"; import { type Span, SpanStatusCode, trace } from "@opentelemetry/api"; import { HttpClient } from "./httpClient"; @@ -314,7 +321,7 @@ export class FetchRequestAdapter implements RequestAdapter { span.end(); } }) as Promise; - } + }; public sendCollectionOfEnum = >(requestInfo: RequestInformation, enumObject: EnumObject, errorMappings: ErrorMappings | undefined): Promise => { if (!requestInfo) { throw new Error("requestInfo cannot be null"); @@ -348,7 +355,7 @@ export class FetchRequestAdapter implements RequestAdapter { span.end(); } }); - } + }; public enableBackingStore = (backingStoreFactory?: BackingStoreFactory | undefined): void => { this.parseNodeFactory = enableBackingStoreForParseNodeFactory(this.parseNodeFactory); this.serializationWriterFactory = enableBackingStoreForSerializationWriterFactory(this.serializationWriterFactory); diff --git a/packages/http/fetch/src/httpClient.ts b/packages/http/fetch/src/httpClient.ts index edb8b9b91..abece54d6 100644 --- a/packages/http/fetch/src/httpClient.ts +++ b/packages/http/fetch/src/httpClient.ts @@ -24,7 +24,10 @@ export class HttpClient { * @param {(request: string, init?: RequestInit) => Promise < Response >} custom fetch function - a Fetch API implementation * */ - public constructor(private customFetch?: (request: string, init: RequestInit) => Promise, ...middlewares: Middleware[]) { + public constructor( + private customFetch?: (request: string, init: RequestInit) => Promise, + ...middlewares: Middleware[] + ) { // If no middlewares are provided, use the default ones middlewares = middlewares?.length && middlewares[0] ? middlewares : MiddlewareFactory.getDefaultMiddlewares(customFetch); @@ -32,7 +35,7 @@ export class HttpClient { if (this.customFetch) { middlewares.push(new CustomFetchHandler(customFetch as any)); } - + // Set the middleware chain this.setMiddleware(...middlewares); } @@ -45,7 +48,7 @@ export class HttpClient { * @returns Nothing */ private setMiddleware(...middleware: Middleware[]): void { - for (let i = 0; i < middleware.length - 1; i++) { + for (let i = 0; i < middleware.length - 1; i++) { middleware[i].next = middleware[i + 1]; } this.middleware = middleware[0]; @@ -63,7 +66,7 @@ export class HttpClient { } else if (this.customFetch) { return this.customFetch(url, requestInit); } - + throw new Error("Please provide middlewares or a custom fetch function to execute the request"); } } diff --git a/packages/http/fetch/src/kiotaClientFactory.ts b/packages/http/fetch/src/kiotaClientFactory.ts index f844ca2f8..2370cded4 100644 --- a/packages/http/fetch/src/kiotaClientFactory.ts +++ b/packages/http/fetch/src/kiotaClientFactory.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import { Middleware, MiddlewareFactory } from "."; import { HttpClient } from "./httpClient"; @@ -9,7 +16,7 @@ export class KiotaClientFactory { /** * @public * @static - * Returns an instance of HttpClient with the provided middlewares and custom fetch implementation both parameters are optional. + * Returns an instance of HttpClient with the provided middlewares and custom fetch implementation both parameters are optional. * if not provided, the default fetch implementation and middlewares will be used. * @param {(request: string, init?: RequestInit) => Promise < Response >} customFetch - a Fetch API implementation * @param {Middleware[]} middlewares - an aray of Middleware handlers @@ -17,8 +24,8 @@ export class KiotaClientFactory { * Set middlewares to `null` if you do not wish to use middlewares. * If custom fetch is undefined, the httpClient instance uses the `DefaultFetchHandler` * @returns a HttpClient instance - * @example - * ```Typescript + * @example + * ```Typescript * // Example usage of KiotaClientFactory.create method with both customFetch and middlewares parameters provided * KiotaClientFactory.create(customFetch, [middleware1, middleware2]); * ``` diff --git a/packages/http/fetch/src/middlewares/browser/middlewareFactory.ts b/packages/http/fetch/src/middlewares/browser/middlewareFactory.ts index 13c03f2b1..84c56b962 100644 --- a/packages/http/fetch/src/middlewares/browser/middlewareFactory.ts +++ b/packages/http/fetch/src/middlewares/browser/middlewareFactory.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import { CustomFetchHandler } from "../customFetchHandler"; import { HeadersInspectionHandler } from "../headersInspectionHandler"; import { Middleware } from "../middleware"; @@ -18,12 +25,6 @@ export class MiddlewareFactory { */ public static getDefaultMiddlewares(customFetch: (request: string, init: RequestInit) => Promise = (...args) => fetch(...args) as any): Middleware[] { // Browsers handles redirection automatically and do not require the redirectionHandler - return [ - new RetryHandler(), - new ParametersNameDecodingHandler(), - new UserAgentHandler(), - new HeadersInspectionHandler(), - new CustomFetchHandler(customFetch) - ]; + return [new RetryHandler(), new ParametersNameDecodingHandler(), new UserAgentHandler(), new HeadersInspectionHandler(), new CustomFetchHandler(customFetch)]; } } diff --git a/packages/http/fetch/src/middlewares/middleware.ts b/packages/http/fetch/src/middlewares/middleware.ts index 0dcbe1bed..12453e6d5 100644 --- a/packages/http/fetch/src/middlewares/middleware.ts +++ b/packages/http/fetch/src/middlewares/middleware.ts @@ -4,7 +4,7 @@ * See License in the project root for license information. * ------------------------------------------------------------------------------------------- */ -import type {RequestOption} from "@microsoft/kiota-abstractions"; +import type { RequestOption } from "@microsoft/kiota-abstractions"; // use import types /** Defines the contract for a middleware in the request execution pipeline. */ export interface Middleware { diff --git a/packages/http/fetch/src/middlewares/middlewareFactory.ts b/packages/http/fetch/src/middlewares/middlewareFactory.ts index c52f66521..5192f88f1 100644 --- a/packages/http/fetch/src/middlewares/middlewareFactory.ts +++ b/packages/http/fetch/src/middlewares/middlewareFactory.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import { CustomFetchHandler } from "./customFetchHandler"; import { HeadersInspectionHandler } from "./headersInspectionHandler"; import { Middleware } from "./middleware"; @@ -18,13 +25,6 @@ export class MiddlewareFactory { * @returns an array of the middleware handlers of the default middleware chain */ public static getDefaultMiddlewares(customFetch: (request: string, init: RequestInit) => Promise = (...args) => fetch(...args) as any): Middleware[] { - return [ - new RetryHandler(), - new RedirectHandler(), - new ParametersNameDecodingHandler(), - new UserAgentHandler(), - new HeadersInspectionHandler(), - new CustomFetchHandler(customFetch) - ]; + return [new RetryHandler(), new RedirectHandler(), new ParametersNameDecodingHandler(), new UserAgentHandler(), new HeadersInspectionHandler(), new CustomFetchHandler(customFetch)]; } } diff --git a/packages/http/fetch/src/middlewares/options/headersInspectionOptions.ts b/packages/http/fetch/src/middlewares/options/headersInspectionOptions.ts index b2654d41b..d913dc459 100644 --- a/packages/http/fetch/src/middlewares/options/headersInspectionOptions.ts +++ b/packages/http/fetch/src/middlewares/options/headersInspectionOptions.ts @@ -1,4 +1,12 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import { type RequestOption, Headers } from "@microsoft/kiota-abstractions"; + export const HeadersInspectionOptionsKey = "HeadersInspectionOptionsKey"; /** diff --git a/packages/http/fetch/src/middlewares/options/parametersNameDecodingOptions.ts b/packages/http/fetch/src/middlewares/options/parametersNameDecodingOptions.ts index f5a7b4e4d..c41fd8366 100644 --- a/packages/http/fetch/src/middlewares/options/parametersNameDecodingOptions.ts +++ b/packages/http/fetch/src/middlewares/options/parametersNameDecodingOptions.ts @@ -62,5 +62,5 @@ export class ParametersNameDecodingHandlerOptions implements RequestOption { public constructor(options: Partial = {}) { this.enable = options.enable ?? true; this.charactersToDecode = options.charactersToDecode ?? [".", "-", "~", "$"]; - } + } } diff --git a/packages/http/fetch/src/middlewares/options/redirectHandlerOptions.ts b/packages/http/fetch/src/middlewares/options/redirectHandlerOptions.ts index 94183d392..72dbb4de4 100644 --- a/packages/http/fetch/src/middlewares/options/redirectHandlerOptions.ts +++ b/packages/http/fetch/src/middlewares/options/redirectHandlerOptions.ts @@ -55,12 +55,12 @@ export class RedirectHandlerOptions implements RequestOption { * A member holding the max redirects value */ public maxRedirects: number; - + /** * @public * A member holding the should redirect callback */ - public shouldRedirect: ShouldRedirect; + public shouldRedirect: ShouldRedirect; /** * @public @@ -73,18 +73,18 @@ export class RedirectHandlerOptions implements RequestOption { */ public constructor(options: Partial = {}) { if (options.maxRedirects && options.maxRedirects > RedirectHandlerOptions.MAX_MAX_REDIRECTS) { - const error = new Error(`MaxRedirects should not be more than ${RedirectHandlerOptions.MAX_MAX_REDIRECTS}`); - error.name = "MaxLimitExceeded"; - throw error; + const error = new Error(`MaxRedirects should not be more than ${RedirectHandlerOptions.MAX_MAX_REDIRECTS}`); + error.name = "MaxLimitExceeded"; + throw error; } if (options.maxRedirects !== undefined && options.maxRedirects < 0) { - const error = new Error(`MaxRedirects should not be negative`); - error.name = "MinExpectationNotMet"; - throw error; + const error = new Error(`MaxRedirects should not be negative`); + error.name = "MinExpectationNotMet"; + throw error; } this.maxRedirects = options.maxRedirects ?? RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS; this.shouldRedirect = options.shouldRedirect ?? RedirectHandlerOptions.defaultShouldRetry; - } + } public getKey(): string { return RedirectHandlerOptionKey; diff --git a/packages/http/fetch/src/middlewares/options/urlReplaceHandlerOptions.ts b/packages/http/fetch/src/middlewares/options/urlReplaceHandlerOptions.ts index 9f4429e00..e6a9b6dd7 100644 --- a/packages/http/fetch/src/middlewares/options/urlReplaceHandlerOptions.ts +++ b/packages/http/fetch/src/middlewares/options/urlReplaceHandlerOptions.ts @@ -1,8 +1,17 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { RequestOption } from "@microsoft/kiota-abstractions"; + /** * Key for the url replace handler options. */ export const UrlReplaceHandlerOptionsKey = "UrlReplaceHandlerOptionsKey"; + /** * Options for the url replace handler. */ @@ -43,6 +52,7 @@ export class UrlReplaceHandlerOptions implements RequestOption { return this._urlReplacements; } } + /** * Parameters for the UrlReplaceHandlerOptions class constructor */ diff --git a/packages/http/fetch/src/middlewares/options/userAgentHandlerOptions.ts b/packages/http/fetch/src/middlewares/options/userAgentHandlerOptions.ts index 409b7e48a..356071e7d 100644 --- a/packages/http/fetch/src/middlewares/options/userAgentHandlerOptions.ts +++ b/packages/http/fetch/src/middlewares/options/userAgentHandlerOptions.ts @@ -6,8 +6,8 @@ */ import type { RequestOption } from "@microsoft/kiota-abstractions"; - import { libraryVersion } from "./version"; + export const UserAgentHandlerOptionsKey = "UserAgentHandlerOptionKey"; /** @@ -16,8 +16,7 @@ export const UserAgentHandlerOptionsKey = "UserAgentHandlerOptionKey"; * @property {boolean} [enable = true] - Whether to add the user agent header to the request * @property {string} [productName = "kiota-typescript"] - The product name to be added to the user agent header * @property {string} [productVersion = "1.0.0-preview.12"] - The product version to be added to the user agent header - */ -/** + * * Represents the options for the UserAgentHandler. */ export interface UserAgentHandlerOptionsParams { @@ -56,13 +55,13 @@ export class UserAgentHandlerOptions implements RequestOption { * @default "kiota-typescript" * The product name to be added to the user agent header */ - public productName: string; + public productName: string; /** * @member * The product version to be added to the user agent header */ - public productVersion: string; + public productVersion: string; getKey(): string { return UserAgentHandlerOptionsKey; diff --git a/packages/http/fetch/src/middlewares/urlReplaceHandler.ts b/packages/http/fetch/src/middlewares/urlReplaceHandler.ts index e0c9c538b..f16ba7398 100644 --- a/packages/http/fetch/src/middlewares/urlReplaceHandler.ts +++ b/packages/http/fetch/src/middlewares/urlReplaceHandler.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { RequestOption } from "@microsoft/kiota-abstractions"; import { trace } from "@opentelemetry/api"; diff --git a/packages/http/fetch/test/browser/httpClient.ts b/packages/http/fetch/test/browser/httpClient.ts index cb0d99b7d..b5413e43f 100644 --- a/packages/http/fetch/test/browser/httpClient.ts +++ b/packages/http/fetch/test/browser/httpClient.ts @@ -5,9 +5,9 @@ * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; -import { CustomFetchHandler, HeadersInspectionHandler, HttpClient, ParametersNameDecodingHandler, RetryHandler, UserAgentHandler } from "../../src"; +import { CustomFetchHandler, HeadersInspectionHandler, HttpClient, Middleware, ParametersNameDecodingHandler, RedirectHandler, RetryHandler, UserAgentHandler } from "../../src"; import { DummyFetchHandler } from "../common/middleware/dummyFetchHandler"; describe("browser - HTTPClient.ts", () => { @@ -15,7 +15,7 @@ describe("browser - HTTPClient.ts", () => { const dummyFetchHandler: DummyFetchHandler = new DummyFetchHandler(); const dummyCustomFetch = (): Promise => { - return null; + return Promise.resolve(null as unknown as Response); }; it("Should create an instance and populate middleware member", async () => { const httpClient: HttpClient = new HttpClient(undefined, dummyFetchHandler); @@ -33,13 +33,14 @@ describe("browser - HTTPClient.ts", () => { const client = new HttpClient(); assert.isNotNull(client["middleware"]); - const next = client["middleware"].next; + const next = client["middleware"]?.next; assert.isTrue(client["middleware"] instanceof RetryHandler); - assert.isTrue(next instanceof ParametersNameDecodingHandler); - assert.isTrue(next?.next instanceof UserAgentHandler); - assert.isTrue(next?.next?.next instanceof HeadersInspectionHandler); - assert.isTrue(next?.next?.next?.next instanceof CustomFetchHandler); + assert.isTrue(next instanceof RedirectHandler); + assert.isTrue(next?.next instanceof ParametersNameDecodingHandler); + assert.isTrue(next?.next?.next instanceof UserAgentHandler); + assert.isTrue(next?.next?.next?.next instanceof HeadersInspectionHandler); + assert.isTrue(next?.next?.next?.next?.next instanceof CustomFetchHandler); }); it("Should set default middleware array with customFetchHandler if middleware parameter is undefined && customFetch is defined", () => { @@ -48,17 +49,17 @@ describe("browser - HTTPClient.ts", () => { assert.isNotNull(client["middleware"]); assert.isNotNull(client[""]); - const next = client["middleware"].next; + const next = client["middleware"]?.next; - assert.isTrue(client["middleware"] instanceof RetryHandler); - assert.isTrue(next instanceof ParametersNameDecodingHandler); - assert.isTrue(next?.next instanceof UserAgentHandler); - assert.isTrue(next?.next?.next instanceof HeadersInspectionHandler); - assert.isTrue(next?.next?.next?.next instanceof CustomFetchHandler); + assert.isTrue(next instanceof RedirectHandler); + assert.isTrue(next?.next instanceof ParametersNameDecodingHandler); + assert.isTrue(next?.next?.next instanceof UserAgentHandler); + assert.isTrue(next?.next?.next?.next instanceof HeadersInspectionHandler); + assert.isTrue(next?.next?.next?.next?.next instanceof CustomFetchHandler); }); it("Should set to default fetch handler middleware array if middleware parameter is null && customFetch is undefined", () => { - const client = new HttpClient(undefined, null); + const client = new HttpClient(undefined); assert.isNotNull(client["middleware"]); @@ -66,11 +67,11 @@ describe("browser - HTTPClient.ts", () => { }); it("Should set to custom fetch with default middleware chain if middleware parameter is null && customFetch is defined", () => { - const client = new HttpClient(dummyCustomFetch, null); + const client = new HttpClient(dummyCustomFetch); assert.isDefined(client["middleware"]); assert.equal(client["customFetch"], dummyCustomFetch); - assert.isTrue(client["middleware"].next?.next?.next?.next instanceof CustomFetchHandler); + assert.isTrue(client["middleware"]?.next?.next?.next?.next?.next instanceof CustomFetchHandler); }); }); }); diff --git a/packages/http/fetch/test/browser/index.ts b/packages/http/fetch/test/browser/index.ts index 5a4ca03e8..2f1ebea5d 100644 --- a/packages/http/fetch/test/browser/index.ts +++ b/packages/http/fetch/test/browser/index.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "../common/middleware/headersUtil"; export * from "../common/middleware/retryHandler"; export * from "../common/middleware/retryHandlerOptions"; diff --git a/packages/http/fetch/test/browser/kiotaClientFactory.ts b/packages/http/fetch/test/browser/kiotaClientFactory.ts index 44dec861c..e5be21b3b 100644 --- a/packages/http/fetch/test/browser/kiotaClientFactory.ts +++ b/packages/http/fetch/test/browser/kiotaClientFactory.ts @@ -5,8 +5,9 @@ * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; -import { CustomFetchHandler, HeadersInspectionHandler, KiotaClientFactory, ParametersNameDecodingHandler, RetryHandler, UserAgentHandler } from "../../src"; +import { assert, describe, it } from "vitest"; + +import { CustomFetchHandler, HeadersInspectionHandler, KiotaClientFactory, ParametersNameDecodingHandler, RedirectHandler, RetryHandler, UserAgentHandler } from "../../src"; describe("browser - KiotaClientFactory", () => { it("Should return the http client", () => { @@ -15,9 +16,10 @@ describe("browser - KiotaClientFactory", () => { assert.isDefined(httpClient["middleware"]); const middleware = httpClient["middleware"]; assert.isTrue(middleware instanceof RetryHandler); - assert.isTrue(middleware?.next instanceof ParametersNameDecodingHandler); - assert.isTrue(middleware?.next?.next instanceof UserAgentHandler); - assert.isTrue(middleware?.next?.next?.next instanceof HeadersInspectionHandler); - assert.isTrue(middleware?.next?.next?.next?.next instanceof CustomFetchHandler); + assert.isTrue(middleware?.next instanceof RedirectHandler); + assert.isTrue(middleware?.next?.next instanceof ParametersNameDecodingHandler); + assert.isTrue(middleware?.next?.next?.next instanceof UserAgentHandler); + assert.isTrue(middleware?.next?.next?.next?.next instanceof HeadersInspectionHandler); + assert.isTrue(middleware?.next?.next?.next?.next?.next instanceof CustomFetchHandler); }); }); diff --git a/packages/http/fetch/test/browser/middlewareFactory.ts b/packages/http/fetch/test/browser/middlewareFactory.ts index 802f026a6..9d67d9e54 100644 --- a/packages/http/fetch/test/browser/middlewareFactory.ts +++ b/packages/http/fetch/test/browser/middlewareFactory.ts @@ -5,17 +5,18 @@ * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; -import { CustomFetchHandler, HeadersInspectionHandler, MiddlewareFactory, ParametersNameDecodingHandler, RetryHandler, UserAgentHandler } from "../../src"; +import { assert, describe, it } from "vitest"; +import { CustomFetchHandler, HeadersInspectionHandler, MiddlewareFactory, ParametersNameDecodingHandler, RedirectHandler, RetryHandler, UserAgentHandler } from "../../src"; describe("browser - MiddlewareFactory", () => { it("Should return the default pipeline", () => { const defaultMiddleWareArray = MiddlewareFactory.getDefaultMiddlewares(); - assert.equal(defaultMiddleWareArray.length, 5); + assert.equal(defaultMiddleWareArray.length, 6); assert.isTrue(defaultMiddleWareArray[0] instanceof RetryHandler); - assert.isTrue(defaultMiddleWareArray[1] instanceof ParametersNameDecodingHandler); - assert.isTrue(defaultMiddleWareArray[2] instanceof UserAgentHandler); - assert.isTrue(defaultMiddleWareArray[3] instanceof HeadersInspectionHandler); - assert.isTrue(defaultMiddleWareArray[4] instanceof CustomFetchHandler); + assert.isTrue(defaultMiddleWareArray[1] instanceof RedirectHandler); + assert.isTrue(defaultMiddleWareArray[2] instanceof ParametersNameDecodingHandler); + assert.isTrue(defaultMiddleWareArray[3] instanceof UserAgentHandler); + assert.isTrue(defaultMiddleWareArray[4] instanceof HeadersInspectionHandler); + assert.isTrue(defaultMiddleWareArray[5] instanceof CustomFetchHandler); }); }); diff --git a/packages/http/fetch/test/common/ChaosHandler.ts b/packages/http/fetch/test/common/ChaosHandler.ts index 6f67a356b..9c9859714 100644 --- a/packages/http/fetch/test/common/ChaosHandler.ts +++ b/packages/http/fetch/test/common/ChaosHandler.ts @@ -6,7 +6,7 @@ */ import { HttpMethod } from "@microsoft/kiota-abstractions"; -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { ChaosHandler, ChaosStrategy, type FetchRequestInit } from "../../src"; import { DummyFetchHandler } from "./middleware/dummyFetchHandler"; diff --git a/packages/http/fetch/test/common/fetchRequestAdapter.ts b/packages/http/fetch/test/common/fetchRequestAdapter.ts index 63dd436a3..80fb063ae 100644 --- a/packages/http/fetch/test/common/fetchRequestAdapter.ts +++ b/packages/http/fetch/test/common/fetchRequestAdapter.ts @@ -6,7 +6,7 @@ */ /* eslint-disable @typescript-eslint/no-unused-vars*/ import { AnonymousAuthenticationProvider, HttpMethod, RequestInformation, type RequestOption } from "@microsoft/kiota-abstractions"; -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { FetchRequestAdapter } from "../../src/fetchRequestAdapter"; import { HttpClient } from "../../src/httpClient"; @@ -26,7 +26,7 @@ if (typeof Response !== "object") { const TestEnumObject = { A: "a", B: "b", - C: "c" + C: "c", } as const; type TestEnum = (typeof TestEnumObject)[keyof typeof TestEnumObject]; @@ -167,7 +167,7 @@ describe("FetchRequestAdapter.ts", () => { const response = new Response(enumResponse, { status: statusCode, } as ResponseInit); - response.headers.set("Content-Type", "application/json"); + response.headers.set("Content-Type", "application/json"); return Promise.resolve(response); }; const mockFactory = new JsonParseNodeFactory(); diff --git a/packages/http/fetch/test/common/middleware/headersInspectionHandler.ts b/packages/http/fetch/test/common/middleware/headersInspectionHandler.ts index 6880f2d82..ee537bc2f 100644 --- a/packages/http/fetch/test/common/middleware/headersInspectionHandler.ts +++ b/packages/http/fetch/test/common/middleware/headersInspectionHandler.ts @@ -5,7 +5,7 @@ * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { HeadersInspectionHandler, HeadersInspectionOptions } from "../../../src"; import { DummyFetchHandler } from "./dummyFetchHandler"; @@ -24,7 +24,7 @@ describe("HeadersInspectionHandler.ts", () => { }); describe("gets request headers", () => { it("Should return request headers", async () => { - const options = new HeadersInspectionOptions({inspectRequestHeaders: true}); + const options = new HeadersInspectionOptions({ inspectRequestHeaders: true }); const handler = new HeadersInspectionHandler(options); const dummyFetchHandler = new DummyFetchHandler(); dummyFetchHandler.setResponses([ diff --git a/packages/http/fetch/test/common/middleware/headersUtil.ts b/packages/http/fetch/test/common/middleware/headersUtil.ts index 1d2f3b0ea..c6f3e5775 100644 --- a/packages/http/fetch/test/common/middleware/headersUtil.ts +++ b/packages/http/fetch/test/common/middleware/headersUtil.ts @@ -6,7 +6,7 @@ */ /* eslint-disable @typescript-eslint/no-unused-vars*/ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import type { FetchRequestInit } from "../../../src/utils/fetchDefinitions"; import { appendRequestHeader, getRequestHeader, setRequestHeader } from "../../../src/utils/headersUtil"; diff --git a/packages/http/fetch/test/common/middleware/parametersNameDecodingHandler.ts b/packages/http/fetch/test/common/middleware/parametersNameDecodingHandler.ts index 90d58aa5b..1ca51a4ff 100644 --- a/packages/http/fetch/test/common/middleware/parametersNameDecodingHandler.ts +++ b/packages/http/fetch/test/common/middleware/parametersNameDecodingHandler.ts @@ -4,7 +4,7 @@ * See License in the project root for license information. * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { ParametersNameDecodingHandler } from "../../../src/middlewares/parametersNameDecodingHandler"; import { TestCallBackMiddleware } from "./testCallBackMiddleware"; diff --git a/packages/http/fetch/test/common/middleware/retryHandler.ts b/packages/http/fetch/test/common/middleware/retryHandler.ts index 7794fcbf0..5d6962b7d 100644 --- a/packages/http/fetch/test/common/middleware/retryHandler.ts +++ b/packages/http/fetch/test/common/middleware/retryHandler.ts @@ -4,7 +4,7 @@ * See License in the project root for license information. * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { RetryHandlerOptionKey, RetryHandlerOptions, type ShouldRetry } from "../../../src/middlewares/options/retryHandlerOptions"; import { RetryHandler } from "../../../src/middlewares/retryHandler"; @@ -17,8 +17,7 @@ var Response = Response; if (typeof Response !== "object") { Response = getResponse(); } -describe("RetryHandler.ts", function () { - this.timeout(20 * 1000); +describe("RetryHandler.ts", () => { const retryHandler = new RetryHandler(); const retryHandlerOptions = new RetryHandlerOptions(); const tooManyRequestsResponseWithRetryAfterDelay = new Response("", { @@ -162,7 +161,7 @@ describe("RetryHandler.ts", function () { const delay = 1; const maxRetries = 2; const shouldRetry: ShouldRetry = () => false; - const options = new RetryHandlerOptions({delay, maxRetries, shouldRetry}); + const options = new RetryHandlerOptions({ delay, maxRetries, shouldRetry }); const requestUrl = "url"; const fetchRequestInit = { @@ -201,7 +200,7 @@ describe("RetryHandler.ts", function () { const fetchRequestInit = { method: "GET", }; - const opts = new RetryHandlerOptions(); + const opts = new RetryHandlerOptions(); it("Should return non retried response incase of maxRetries busted out", async () => { dummyFetchHandler.setResponses([new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); @@ -229,22 +228,30 @@ describe("RetryHandler.ts", function () { assert.equal(response.status, 429); }); - it("Should successfully retry and return ok response", async () => { - const opts = new RetryHandlerOptions({delay: 1}); - const handler = new RetryHandler(opts); - handler.next = dummyFetchHandler; - dummyFetchHandler.setResponses([new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); - const response = await handler["executeWithRetry"](requestUrl, fetchRequestInit, 0, opts); - assert.equal(response.status, 200); - }); - - it("Should fail by exceeding max retries", async () => { - const opts = new RetryHandlerOptions({delay: 1, maxRetries: 2}); - const handler = new RetryHandler(opts); - handler.next = dummyFetchHandler; - dummyFetchHandler.setResponses([new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); - const response = await handler["executeWithRetry"](requestUrl, fetchRequestInit, 0, opts); - assert.equal(response.status, 429); - }); + it( + "Should successfully retry and return ok response", + async () => { + const opts = new RetryHandlerOptions({ delay: 1 }); + const handler = new RetryHandler(opts); + handler.next = dummyFetchHandler; + dummyFetchHandler.setResponses([new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); + const response = await handler["executeWithRetry"](requestUrl, fetchRequestInit, 0, opts); + assert.equal(response.status, 200); + }, + 20 * 1000, + ); + + it( + "Should fail by exceeding max retries", + async () => { + const opts = new RetryHandlerOptions({ delay: 1, maxRetries: 2 }); + const handler = new RetryHandler(opts); + handler.next = dummyFetchHandler; + dummyFetchHandler.setResponses([new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); + const response = await handler["executeWithRetry"](requestUrl, fetchRequestInit, 0, opts); + assert.equal(response.status, 429); + }, + 20 * 1000, + ); }); }); diff --git a/packages/http/fetch/test/common/middleware/retryHandlerOptions.ts b/packages/http/fetch/test/common/middleware/retryHandlerOptions.ts index f5577f25e..c12c8d876 100644 --- a/packages/http/fetch/test/common/middleware/retryHandlerOptions.ts +++ b/packages/http/fetch/test/common/middleware/retryHandlerOptions.ts @@ -5,7 +5,7 @@ * ------------------------------------------------------------------------------------------- */ /* eslint-disable @typescript-eslint/no-unused-vars*/ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { RetryHandlerOptions, type ShouldRetry } from "../../../src/middlewares/options/retryHandlerOptions"; @@ -20,7 +20,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for both delay and maxRetries are higher than the limit", () => { try { - const options = new RetryHandlerOptions({ delay: 1000, maxRetries: 1000}); + const options = new RetryHandlerOptions({ delay: 1000, maxRetries: 1000 }); throw new Error("Test Failed - Something wrong with the delay and maxRetries max limit validation"); } catch (error) { assert.equal((error as Error).name, "MaxLimitExceeded"); @@ -29,7 +29,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for delay is higher than the limit", () => { try { - const options = new RetryHandlerOptions({delay: 1000, maxRetries: 2}); + const options = new RetryHandlerOptions({ delay: 1000, maxRetries: 2 }); throw new Error("Test Failed - Test Failed - Something wrong with the delay max limit validation"); } catch (error) { assert.equal((error as Error).name, "MaxLimitExceeded"); @@ -38,7 +38,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for maxRetries is higher than the limit", () => { try { - const options = new RetryHandlerOptions({delay: 1, maxRetries: 2000}); + const options = new RetryHandlerOptions({ delay: 1, maxRetries: 2000 }); throw new Error("Test Failed - Something wrong with the maxRetries max limit validation"); } catch (error) { assert.equal((error as Error).name, "MaxLimitExceeded"); @@ -47,7 +47,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for both delay and maxRetries are negative", () => { try { - const options = new RetryHandlerOptions({delay: -1, maxRetries: -100}); + const options = new RetryHandlerOptions({ delay: -1, maxRetries: -100 }); throw new Error("Test Failed - Something wrong with the delay and maxRetries max limit validation"); } catch (error) { assert.equal((error as Error).name, "MinExpectationNotMet"); @@ -57,7 +57,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for delay is negative", () => { try { // eslint-disable-next-line @typescript-eslint/no-unused-vars - const options = new RetryHandlerOptions({delay: -5, maxRetries: 2}); + const options = new RetryHandlerOptions({ delay: -5, maxRetries: 2 }); throw new Error("Test Failed - Something wrong with the delay max limit validation"); } catch (error) { assert.equal((error as Error).name, "MinExpectationNotMet"); @@ -66,7 +66,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for maxRetries is negative", () => { try { - const options = new RetryHandlerOptions({delay: 1, maxRetries: -10}); + const options = new RetryHandlerOptions({ delay: 1, maxRetries: -10 }); throw new Error("Test Failed - Something wrong with the maxRetries max limit validation"); } catch (error) { assert.equal((error as Error).name, "MinExpectationNotMet"); @@ -79,7 +79,7 @@ describe("RetryHandlerOptions.ts", () => { const shouldRetry: ShouldRetry = (d, a, req, o, res) => { return false; }; - const options = new RetryHandlerOptions({delay, maxRetries, shouldRetry}); + const options = new RetryHandlerOptions({ delay, maxRetries, shouldRetry }); assert.equal(options.delay, delay); assert.equal(options.maxRetries, maxRetries); assert.equal(options.shouldRetry, shouldRetry); diff --git a/packages/http/fetch/test/common/middleware/testCallBackMiddleware.ts b/packages/http/fetch/test/common/middleware/testCallBackMiddleware.ts index 7050cd7d6..b384a6da6 100644 --- a/packages/http/fetch/test/common/middleware/testCallBackMiddleware.ts +++ b/packages/http/fetch/test/common/middleware/testCallBackMiddleware.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { RequestOption } from "@microsoft/kiota-abstractions"; import type { Middleware } from "../../../src/middlewares/middleware"; @@ -11,7 +18,10 @@ if (typeof Response !== "object") { } export class TestCallBackMiddleware implements Middleware { - constructor(private callback: (url: string) => void, nextMiddleware: Middleware = new DummyFetchHandler()) { + constructor( + private callback: (url: string) => void, + nextMiddleware: Middleware = new DummyFetchHandler(), + ) { this.next = nextMiddleware; } next: Middleware; diff --git a/packages/http/fetch/test/common/middleware/urlReplaceHandler.ts b/packages/http/fetch/test/common/middleware/urlReplaceHandler.ts index 912f68c42..b71454133 100644 --- a/packages/http/fetch/test/common/middleware/urlReplaceHandler.ts +++ b/packages/http/fetch/test/common/middleware/urlReplaceHandler.ts @@ -1,4 +1,11 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { UrlReplaceHandlerOptions } from "../../../src/middlewares/options/urlReplaceHandlerOptions"; import { UrlReplaceHandler } from "../../../src/middlewares/urlReplaceHandler"; diff --git a/packages/http/fetch/test/common/middleware/userAgentHandler.ts b/packages/http/fetch/test/common/middleware/userAgentHandler.ts index 2be3a0697..ee35e4509 100644 --- a/packages/http/fetch/test/common/middleware/userAgentHandler.ts +++ b/packages/http/fetch/test/common/middleware/userAgentHandler.ts @@ -1,4 +1,11 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { UserAgentHandler, UserAgentHandlerOptions } from "../../../src"; import { getResponse } from "../../testUtils"; diff --git a/packages/http/fetch/test/common/mockEntity.ts b/packages/http/fetch/test/common/mockEntity.ts index 31d2e7b17..598f9864d 100644 --- a/packages/http/fetch/test/common/mockEntity.ts +++ b/packages/http/fetch/test/common/mockEntity.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { Parsable, ParseNode, SerializationWriter } from "@microsoft/kiota-abstractions"; export type MockEntity = Parsable; diff --git a/packages/http/fetch/test/common/mockParseNodeFactory.ts b/packages/http/fetch/test/common/mockParseNodeFactory.ts index 6408a718a..a9cb424a5 100644 --- a/packages/http/fetch/test/common/mockParseNodeFactory.ts +++ b/packages/http/fetch/test/common/mockParseNodeFactory.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /* eslint-disable @typescript-eslint/no-unused-vars */ import type { DateOnly, Duration, Parsable, ParsableFactory, ParseNode, ParseNodeFactory, TimeOnly } from "@microsoft/kiota-abstractions"; import type { Guid } from "guid-typescript"; diff --git a/packages/http/fetch/test/node/MiddlewareFactory.ts b/packages/http/fetch/test/node/MiddlewareFactory.ts index 1fc7268a5..42ef779cc 100644 --- a/packages/http/fetch/test/node/MiddlewareFactory.ts +++ b/packages/http/fetch/test/node/MiddlewareFactory.ts @@ -5,7 +5,7 @@ * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { CustomFetchHandler, HeadersInspectionHandler, MiddlewareFactory, ParametersNameDecodingHandler, RedirectHandler, RetryHandler, UserAgentHandler } from "../../src"; diff --git a/packages/http/fetch/test/node/RedirectHandler.ts b/packages/http/fetch/test/node/RedirectHandler.ts index 7950e2778..c16029a6c 100644 --- a/packages/http/fetch/test/node/RedirectHandler.ts +++ b/packages/http/fetch/test/node/RedirectHandler.ts @@ -5,7 +5,7 @@ * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { RedirectHandlerOptionKey, RedirectHandlerOptions } from "../../src/middlewares/options/redirectHandlerOptions"; import { RedirectHandler } from "../../src/middlewares/redirectHandler"; @@ -270,7 +270,7 @@ describe("RedirectHandler.ts", () => { }); it("Should not redirect for shouldRedirect callback returning false", async () => { - const options = new RedirectHandlerOptions({maxRedirects: undefined, shouldRedirect: () => false }); + const options = new RedirectHandlerOptions({ maxRedirects: undefined, shouldRedirect: () => false }); const handler = new RedirectHandler(options); handler.next = dummyFetchHandler; dummyFetchHandler.setResponses([new Response("", { status: 301 }), new Response("ok", { status: 200 }) as any]); diff --git a/packages/http/fetch/test/node/RedirectHandlerOptions.ts b/packages/http/fetch/test/node/RedirectHandlerOptions.ts index 399acef1f..a45cce115 100644 --- a/packages/http/fetch/test/node/RedirectHandlerOptions.ts +++ b/packages/http/fetch/test/node/RedirectHandlerOptions.ts @@ -5,7 +5,7 @@ * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { RedirectHandlerOptions } from "../../src/middlewares/options/redirectHandlerOptions"; diff --git a/packages/http/fetch/test/node/httpClient.ts b/packages/http/fetch/test/node/httpClient.ts index bbb36229f..4dc04028b 100644 --- a/packages/http/fetch/test/node/httpClient.ts +++ b/packages/http/fetch/test/node/httpClient.ts @@ -5,7 +5,7 @@ * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { CustomFetchHandler, HeadersInspectionHandler, HttpClient, ParametersNameDecodingHandler, RedirectHandler, RetryHandler, UserAgentHandler } from "../../src"; import { DummyFetchHandler } from "../common/middleware/dummyFetchHandler"; diff --git a/packages/http/fetch/test/node/kiotaClientFactory.ts b/packages/http/fetch/test/node/kiotaClientFactory.ts index b3945c578..6868c8a48 100644 --- a/packages/http/fetch/test/node/kiotaClientFactory.ts +++ b/packages/http/fetch/test/node/kiotaClientFactory.ts @@ -5,7 +5,7 @@ * ------------------------------------------------------------------------------------------- */ -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { CustomFetchHandler, HeadersInspectionHandler, KiotaClientFactory, ParametersNameDecodingHandler, RedirectHandler, RetryHandler, UserAgentHandler } from "../../src"; describe("browser - KiotaClientFactory", () => { @@ -23,13 +23,7 @@ describe("browser - KiotaClientFactory", () => { }); it("Should maintain the middleware array order", () => { - const middlewares = [ - new UserAgentHandler(), - new ParametersNameDecodingHandler(), - new RetryHandler(), - new RedirectHandler(), - new HeadersInspectionHandler(), - ]; + const middlewares = [new UserAgentHandler(), new ParametersNameDecodingHandler(), new RetryHandler(), new RedirectHandler(), new HeadersInspectionHandler()]; const httpClient = KiotaClientFactory.create(undefined, middlewares); assert.isDefined(httpClient); diff --git a/packages/http/fetch/test/testUtils.ts b/packages/http/fetch/test/testUtils.ts index c3d697b5e..c8fbb342b 100644 --- a/packages/http/fetch/test/testUtils.ts +++ b/packages/http/fetch/test/testUtils.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export function getResponse() { return Response; } diff --git a/packages/http/fetch/tsconfig.base.json b/packages/http/fetch/tsconfig.base.json deleted file mode 100644 index 8de536b79..000000000 --- a/packages/http/fetch/tsconfig.base.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "importHelpers": true, - "noEmitOnError": true, - "moduleResolution": "node", - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "declarationMap": true, - "composite": true, - "paths": { - "@microsoft/kiota-abstractions": [ - "../../abstractions/*" - ], - }, - } -} diff --git a/packages/http/fetch/tsconfig.cjs.json b/packages/http/fetch/tsconfig.cjs.json deleted file mode 100644 index 6d8bd08e7..000000000 --- a/packages/http/fetch/tsconfig.cjs.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2015", - "module": "commonjs", - "outDir": "./dist/cjs", - "composite": true - }, - "files": [], - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts"], - "references": [ - { - "path": "../../abstractions/tsconfig.cjs.json" - }, - ] -} \ No newline at end of file diff --git a/packages/http/fetch/tsconfig.cjs.test.json b/packages/http/fetch/tsconfig.cjs.test.json deleted file mode 100644 index 52d87d4a5..000000000 --- a/packages/http/fetch/tsconfig.cjs.test.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2015", - "module": "commonjs", - "outDir": "./dist/cjs/", - "noEmitOnError": true, - "noImplicitAny": false, - "moduleResolution": "node", - "removeComments": false, - "strictFunctionTypes": false, - "strictNullChecks": false, - "sourceMap": false, - "declaration": true, - "strict": false, - "noImplicitThis": false - }, - "exclude": ["node_modules", "dist"], - "include": ["./test"], - "references": [ - { - "path": "./tsconfig.cjs.json" - } - ] - -} \ No newline at end of file diff --git a/packages/http/fetch/tsconfig.es.json b/packages/http/fetch/tsconfig.es.json deleted file mode 100644 index b2f167da0..000000000 --- a/packages/http/fetch/tsconfig.es.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "dist/es/", - "composite": true - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts"], - "references": [ - { - "path": "../../abstractions/tsconfig.es.json" - }, - ] -} diff --git a/packages/http/fetch/tsconfig.es.test.json b/packages/http/fetch/tsconfig.es.test.json deleted file mode 100644 index 1758fc2d8..000000000 --- a/packages/http/fetch/tsconfig.es.test.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "dist/es/", - "noEmitOnError": true, - "noImplicitAny": false, - "removeComments": false, - "strictFunctionTypes": false, - "strictNullChecks": false, - "sourceMap": false, - "strict": false, - "noImplicitThis": false - }, - "exclude": ["node_modules", "dist","src"], - "include": [ "./test/**/*.ts"], - "references": [ - { - "path": "./tsconfig.es.json" - } - ] -} diff --git a/packages/http/fetch/tsconfig.json b/packages/http/fetch/tsconfig.json new file mode 100644 index 000000000..980fb2fca --- /dev/null +++ b/packages/http/fetch/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist/es/", + }, + "include": [ + "./src/**/*.ts" + ], +} \ No newline at end of file diff --git a/packages/http/fetch/vitest.config.mts b/packages/http/fetch/vitest.config.mts new file mode 100644 index 000000000..838c4e31b --- /dev/null +++ b/packages/http/fetch/vitest.config.mts @@ -0,0 +1,11 @@ +import { defineConfig, configDefaults } from "vitest/config"; + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude, "**/*/{testUtils,dummyFetchHandler,testCallBackMiddleware,mockEntity,mockParseNodeFactory,index}.ts"], + include: [...configDefaults.include, "test/**/*.ts"], + coverage: { + reporter: ["html"], + }, + }, +}); \ No newline at end of file diff --git a/packages/serialization/form/.eslintignore b/packages/serialization/form/.eslintignore deleted file mode 100644 index 8942aa232..000000000 --- a/packages/serialization/form/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -*.js -*.js.map -*.d.ts - -node_modules -lib -spec/development \ No newline at end of file diff --git a/packages/serialization/form/.eslintrc.json b/packages/serialization/form/.eslintrc.json deleted file mode 100644 index 80ab9b397..000000000 --- a/packages/serialization/form/.eslintrc.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "prettier", - "simple-import-sort" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "rules": { - "@typescript-eslint/no-empty-interface": "warn", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/consistent-type-imports": "error", - "prettier/prettier": [ - "error", - { - "endOfLine": "auto" - } - ], - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "typeLike", - "format": [ - "PascalCase" - ], - "filter": { - "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "interface", - "format": [ - "PascalCase" - ], - "custom": { - "regex": "^I[A-Z]", - "match": false - }, - "filter": { - "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", - "match": false - } - }, - { - "selector": "variable", - "format": [ - "camelCase", - "PascalCase", - "UPPER_CASE" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "function", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "parameter", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", - "match": false - } - }, - { - "selector": "method", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "memberLike", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "enumMember", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "property", - "format": null - } - ], - "@typescript-eslint/semi": "error", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/prefer-for-of": "error", - "@typescript-eslint/prefer-function-type": "error", - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/quotes": [ - "error", - "double", - { - "avoidEscape": true, - "allowTemplateLiterals": true - } - ], - "@typescript-eslint/space-within-parens": [ - "off", - "never" - ], - "@typescript-eslint/triple-slash-reference": "error", - "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unified-signatures": "error", - "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", - "@typescript-eslint/consistent-type-definitions": [ - "error", - "interface" - ], - "@typescript-eslint/no-inferrable-types": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-this-alias": "error", - "no-unused-expressions": "off", - "@typescript-eslint/no-unused-expressions": [ - "error", - { - "allowTernary": true - } - ], - "@typescript-eslint/space-before-function-paren": "off", - "@typescript-eslint/consistent-type-assertions": "error", - "@typescript-eslint/explicit-member-accessibility": [ - "off", - { - "accessibility": "explicit" - } - ], - "@typescript-eslint/indent": "off", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/member-delimiter-style": [ - "off", - { - "multiline": { - "delimiter": "none", - "requireLast": true - }, - "singleline": { - "delimiter": "semi", - "requireLast": false - } - } - ], - "@typescript-eslint/member-ordering": "off", - "@typescript-eslint/no-empty-function": "error", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-parameter-properties": "off", - "@typescript-eslint/no-array-constructor": "error", - "no-useless-catch": "error", - "prefer-rest-params": "off", - "no-constant-condition": "error", - "simple-import-sort/imports": "error", - "brace-style": "error", - "constructor-super": "error", - "curly": [ - "error", - "multi-line" - ], - "dot-notation": "off", - "eqeqeq": "error", - "new-parens": "error", - "no-caller": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-empty": "error", - "no-eval": "error", - "no-extra-bind": "error", - "no-fallthrough": "error", - "no-new-func": "off", - "no-new-wrappers": "error", - "no-return-await": "off", - "no-sparse-arrays": "error", - "no-template-curly-in-string": "error", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-unsafe-finally": "error", - "no-unused-labels": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-const": "error", - "prefer-object-spread": "error", - "quote-props": "off", - "space-in-parens": "error", - "unicode-bom": [ - "error", - "never" - ], - "use-isnan": "error" - } -} \ No newline at end of file diff --git a/packages/serialization/form/.npmignore b/packages/serialization/form/.npmignore index 164fa84b7..15ae0ca0b 100644 --- a/packages/serialization/form/.npmignore +++ b/packages/serialization/form/.npmignore @@ -4,7 +4,6 @@ *.tgz **/test/**/* docs/ -karma.conf.js node_modules/ rollup.config.js src/ diff --git a/packages/serialization/form/karma.conf.js b/packages/serialization/form/karma.conf.js deleted file mode 100644 index ed70e0053..000000000 --- a/packages/serialization/form/karma.conf.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function(config) { - config.set({ - frameworks: ["mocha", "chai", "karma-typescript"], - files: [{ pattern: "dist/es/test/index.js", type: "module" }], - preprocessors: { - "**/*.ts": ["karma-typescript"], - }, - karmaTypescriptConfig: { - tsconfig: "./tsconfig.cjs.json", - }, - browsers: ["ChromeHeadless"], - }); -}; \ No newline at end of file diff --git a/packages/serialization/form/package.json b/packages/serialization/form/package.json index da42802f6..eecd42940 100644 --- a/packages/serialization/form/package.json +++ b/packages/serialization/form/package.json @@ -2,24 +2,22 @@ "name": "@microsoft/kiota-serialization-form", "version": "1.0.0-preview.40", "description": "Implementation of Kiota Serialization interfaces for URI from encoded", - "main": "dist/cjs/src/index.js", + "main": "dist/es/src/index.js", "browser": { "./dist/es/src/index.js": "./dist/es/src/browser/index.js", "./dist/es/src/formParseNodeFactory.js": "./dist/es/src/browser/formParseNodeFactory.js" }, "module": "dist/es/src/index.js", - "types": "dist/cjs/src/index.d.ts", + "types": "dist/es/src/index.d.ts", "scripts": { - "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc -b tsconfig.cjs.json", - "build:esm": "tsc -b tsconfig.es.json", + "build": "npm run build:esm", + "build:esm": "tsc -b", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "rm -r ./dist", - "karma": "npm run rollup && karma start --single-run --browsers ChromeHeadless karma.conf.js", - "rollup": "rollup -c", - "test": "npm run test:cjs && npm run karma", - "test:cjs": "npm run build && mocha 'dist/cjs/test/common/**/*.js'" + "clean": "rm -rf ./dist", + "test:browser": "vitest run --browser.name=chrome --browser.headless", + "test:node": "vitest --run", + "test": "npm run test:node && npm run test:browser" }, "repository": { "type": "git", @@ -39,11 +37,11 @@ }, "homepage": "https://github.com/microsoft/kiota-typescript#readme", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" }, "publishConfig": { "access": "public" } -} +} \ No newline at end of file diff --git a/packages/serialization/form/rollup.config.js b/packages/serialization/form/rollup.config.js deleted file mode 100644 index 33546e42e..000000000 --- a/packages/serialization/form/rollup.config.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -import resolve from "@rollup/plugin-node-resolve"; -import commonjs from "@rollup/plugin-commonjs"; - -const config = [{ - input: ["dist/es/test/browser/index.js"], - output: { - file: "dist/es/test/index.js", - format: "esm", - name: "BrowserTest", - }, - plugins: [ - commonjs(), - resolve({ - browser: true, - preferBuiltins: false, - - }) - ], -}]; - -export default config; \ No newline at end of file diff --git a/packages/serialization/form/src/browser/formParseNodeFactory.ts b/packages/serialization/form/src/browser/formParseNodeFactory.ts index 888c41be5..8271ea31e 100644 --- a/packages/serialization/form/src/browser/formParseNodeFactory.ts +++ b/packages/serialization/form/src/browser/formParseNodeFactory.ts @@ -1,27 +1,31 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { ParseNode, ParseNodeFactory } from "@microsoft/kiota-abstractions"; import { FormParseNode } from "./../formParseNode"; export class FormParseNodeFactory implements ParseNodeFactory { - public getValidContentType(): string { - return "application/x-www-form-urlencoded"; - } - public getRootParseNode( - contentType: string, - content: ArrayBuffer - ): ParseNode { - if (!content) { - throw new Error("content cannot be undefined of empty"); - } else if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } else if (this.getValidContentType() !== contentType) { - throw new Error(`expected a ${this.getValidContentType()} content type`); - } - return new FormParseNode(this.convertArrayBufferToString(content)); - } + public getValidContentType(): string { + return "application/x-www-form-urlencoded"; + } + public getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode { + if (!content) { + throw new Error("content cannot be undefined of empty"); + } else if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } else if (this.getValidContentType() !== contentType) { + throw new Error(`expected a ${this.getValidContentType()} content type`); + } + return new FormParseNode(this.convertArrayBufferToString(content)); + } - private convertArrayBufferToString(content: ArrayBuffer) { - const decoder = new TextDecoder(); - return decoder.decode(content); - } + private convertArrayBufferToString(content: ArrayBuffer) { + const decoder = new TextDecoder(); + return decoder.decode(content); + } } diff --git a/packages/serialization/form/src/browser/index.ts b/packages/serialization/form/src/browser/index.ts index 95e52c11f..819b896bb 100644 --- a/packages/serialization/form/src/browser/index.ts +++ b/packages/serialization/form/src/browser/index.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "./../formParseNode"; export * from "./../formSerializationWriter"; export * from "./formParseNodeFactory"; diff --git a/packages/serialization/form/src/formParseNode.ts b/packages/serialization/form/src/formParseNode.ts index 7ac4be38d..2c0c507d6 100644 --- a/packages/serialization/form/src/formParseNode.ts +++ b/packages/serialization/form/src/formParseNode.ts @@ -1,147 +1,130 @@ -import { - BackedModel, - createBackedModelProxyHandler, - DateOnly, - Duration, - type Parsable, - type ParsableFactory, - parseGuidString, - type ParseNode, - TimeOnly, - isBackingStoreEnabled, - toFirstCharacterUpper, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { createBackedModelProxyHandler, DateOnly, Duration, type Parsable, type ParsableFactory, parseGuidString, type ParseNode, TimeOnly, isBackingStoreEnabled, toFirstCharacterUpper } from "@microsoft/kiota-abstractions"; export class FormParseNode implements ParseNode { - private readonly _fields: Record = {}; - /** - * - */ - constructor(private readonly _rawString: string) { - if (!_rawString) { - throw new Error("rawString cannot be undefined"); - } - _rawString - .split("&") - .map((x) => x.split("=")) - .filter((x) => x.length === 2) - .forEach((x) => { - const key = this.normalizeKey(x[0]); - if (this._fields[key]) { - this._fields[key] += "," + x[1]; - } else { - this._fields[key] = x[1]; - } - }); - } - private normalizeKey = (key: string): string => - decodeURIComponent(key).trim(); - public getByteArrayValue(): ArrayBuffer | undefined { - throw new Error( - "serialization of byt arrays is not supported with URI encoding", - ); - } - public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; - public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; - public getStringValue = (): string => decodeURIComponent(this._rawString); - public getChildNode = (identifier: string): ParseNode | undefined => { - if (this._fields[identifier]) { - return new FormParseNode(this._fields[identifier]); - } - return undefined; - }; - public getBooleanValue = () => { - const value = this.getStringValue()?.toLowerCase(); - if (value === "true" || value === "1") { - return true; - } else if (value === "false" || value === "0") { - return false; - } - return undefined; - }; - public getNumberValue = () => parseFloat(this.getStringValue()); - public getGuidValue = () => parseGuidString(this.getStringValue()); - public getDateValue = () => new Date(Date.parse(this.getStringValue())); - public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); - public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); - public getDurationValue = () => Duration.parse(this.getStringValue()); - public getCollectionOfPrimitiveValues = (): T[] | undefined => { - return (this._rawString.split(",") as unknown[]).map((x) => { - const currentParseNode = new FormParseNode(x as string); - const typeOfX = typeof x; - if (typeOfX === "boolean") { - return currentParseNode.getBooleanValue() as unknown as T; - } else if (typeOfX === "string") { - return currentParseNode.getStringValue() as unknown as T; - } else if (typeOfX === "number") { - return currentParseNode.getNumberValue() as unknown as T; - } else if (x instanceof Date) { - return currentParseNode.getDateValue() as unknown as T; - } else if (x instanceof DateOnly) { - return currentParseNode.getDateValue() as unknown as T; - } else if (x instanceof TimeOnly) { - return currentParseNode.getDateValue() as unknown as T; - } else if (x instanceof Duration) { - return currentParseNode.getDateValue() as unknown as T; - } else { - throw new Error( - `encountered an unknown type during deserialization ${typeof x}`, - ); - } - }); - }; - public getCollectionOfObjectValues = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - parsableFactory: ParsableFactory, - ): T[] | undefined => { - throw new Error( - `serialization of collections is not supported with URI encoding`, - ); - }; - public getObjectValue = ( - parsableFactory: ParsableFactory, - ): T => { - const temp: T = {} as T; - const enableBackingStore = isBackingStoreEnabled(parsableFactory(this)(temp)); - const value: T = enableBackingStore ? new Proxy(temp, createBackedModelProxyHandler()) : temp; - if (this.onBeforeAssignFieldValues) { - this.onBeforeAssignFieldValues(value); - } - this.assignFieldValues(value, parsableFactory); - if (this.onAfterAssignFieldValues) { - this.onAfterAssignFieldValues(value); - } - return value; - }; - public getCollectionOfEnumValues = (type: any): T[] => { - const rawValues = this.getStringValue(); - if (!rawValues) { - return []; - } - return rawValues.split(",").map((x) => type[toFirstCharacterUpper(x)] as T); - }; - public getEnumValue = (type: any): T | undefined => { - const values = this.getCollectionOfEnumValues(type); - if (values.length > 0) { - return values[0] as T; - } else { - return undefined; - } - }; - private assignFieldValues = ( - model: T, - parsableFactory: ParsableFactory, - ): void => { - const fields = parsableFactory(this)(model); - Object.entries(this._fields) - .filter((x) => !/^null$/i.test(x[1])) - .forEach(([k, v]) => { - const deserializer = fields[k]; - if (deserializer) { - deserializer(new FormParseNode(v)); - } else { - (model as Record)[k] = v; - } - }); - }; + private readonly _fields: Record = {}; + /** + * + */ + constructor(private readonly _rawString: string) { + if (!_rawString) { + throw new Error("rawString cannot be undefined"); + } + _rawString + .split("&") + .map((x) => x.split("=")) + .filter((x) => x.length === 2) + .forEach((x) => { + const key = this.normalizeKey(x[0]); + if (this._fields[key]) { + this._fields[key] += "," + x[1]; + } else { + this._fields[key] = x[1]; + } + }); + } + private normalizeKey = (key: string): string => decodeURIComponent(key).trim(); + public getByteArrayValue(): ArrayBuffer | undefined { + throw new Error("serialization of byt arrays is not supported with URI encoding"); + } + public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; + public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; + public getStringValue = (): string => decodeURIComponent(this._rawString); + public getChildNode = (identifier: string): ParseNode | undefined => { + if (this._fields[identifier]) { + return new FormParseNode(this._fields[identifier]); + } + return undefined; + }; + public getBooleanValue = () => { + const value = this.getStringValue()?.toLowerCase(); + if (value === "true" || value === "1") { + return true; + } else if (value === "false" || value === "0") { + return false; + } + return undefined; + }; + public getNumberValue = () => parseFloat(this.getStringValue()); + public getGuidValue = () => parseGuidString(this.getStringValue()); + public getDateValue = () => new Date(Date.parse(this.getStringValue())); + public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); + public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); + public getDurationValue = () => Duration.parse(this.getStringValue()); + public getCollectionOfPrimitiveValues = (): T[] | undefined => { + return (this._rawString.split(",") as unknown[]).map((x) => { + const currentParseNode = new FormParseNode(x as string); + const typeOfX = typeof x; + if (typeOfX === "boolean") { + return currentParseNode.getBooleanValue() as unknown as T; + } else if (typeOfX === "string") { + return currentParseNode.getStringValue() as unknown as T; + } else if (typeOfX === "number") { + return currentParseNode.getNumberValue() as unknown as T; + } else if (x instanceof Date) { + return currentParseNode.getDateValue() as unknown as T; + } else if (x instanceof DateOnly) { + return currentParseNode.getDateValue() as unknown as T; + } else if (x instanceof TimeOnly) { + return currentParseNode.getDateValue() as unknown as T; + } else if (x instanceof Duration) { + return currentParseNode.getDateValue() as unknown as T; + } else { + throw new Error(`encountered an unknown type during deserialization ${typeof x}`); + } + }); + }; + public getCollectionOfObjectValues = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + parsableFactory: ParsableFactory, + ): T[] | undefined => { + throw new Error(`serialization of collections is not supported with URI encoding`); + }; + public getObjectValue = (parsableFactory: ParsableFactory): T => { + const temp: T = {} as T; + const enableBackingStore = isBackingStoreEnabled(parsableFactory(this)(temp)); + const value: T = enableBackingStore ? new Proxy(temp, createBackedModelProxyHandler()) : temp; + if (this.onBeforeAssignFieldValues) { + this.onBeforeAssignFieldValues(value); + } + this.assignFieldValues(value, parsableFactory); + if (this.onAfterAssignFieldValues) { + this.onAfterAssignFieldValues(value); + } + return value; + }; + public getCollectionOfEnumValues = (type: any): T[] => { + const rawValues = this.getStringValue(); + if (!rawValues) { + return []; + } + return rawValues.split(",").map((x) => type[toFirstCharacterUpper(x)] as T); + }; + public getEnumValue = (type: any): T | undefined => { + const values = this.getCollectionOfEnumValues(type); + if (values.length > 0) { + return values[0] as T; + } else { + return undefined; + } + }; + private assignFieldValues = (model: T, parsableFactory: ParsableFactory): void => { + const fields = parsableFactory(this)(model); + Object.entries(this._fields) + .filter((x) => !/^null$/i.test(x[1])) + .forEach(([k, v]) => { + const deserializer = fields[k]; + if (deserializer) { + deserializer(new FormParseNode(v)); + } else { + (model as Record)[k] = v; + } + }); + }; } diff --git a/packages/serialization/form/src/formParseNodeFactory.ts b/packages/serialization/form/src/formParseNodeFactory.ts index 92d3610be..14d56ad02 100644 --- a/packages/serialization/form/src/formParseNodeFactory.ts +++ b/packages/serialization/form/src/formParseNodeFactory.ts @@ -1,28 +1,31 @@ -import type { ParseNode, ParseNodeFactory} from "@microsoft/kiota-abstractions"; -import { TextDecoder } from "util"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import type { ParseNode, ParseNodeFactory } from "@microsoft/kiota-abstractions"; import { FormParseNode } from "./formParseNode"; export class FormParseNodeFactory implements ParseNodeFactory { - public getValidContentType(): string { - return "application/x-www-form-urlencoded"; - } - public getRootParseNode( - contentType: string, - content: ArrayBuffer - ): ParseNode { - if (!content) { - throw new Error("content cannot be undefined of empty"); - } else if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } else if (this.getValidContentType() !== contentType) { - throw new Error(`expected a ${this.getValidContentType()} content type`); - } - return new FormParseNode(this.convertArrayBufferToString(content)); - } + public getValidContentType(): string { + return "application/x-www-form-urlencoded"; + } + public getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode { + if (!content) { + throw new Error("content cannot be undefined of empty"); + } else if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } else if (this.getValidContentType() !== contentType) { + throw new Error(`expected a ${this.getValidContentType()} content type`); + } + return new FormParseNode(this.convertArrayBufferToString(content)); + } - private convertArrayBufferToString(content: ArrayBuffer) { - const decoder = new TextDecoder(); - return decoder.decode(content); - } + private convertArrayBufferToString(content: ArrayBuffer) { + const decoder = new TextDecoder(); + return decoder.decode(content); + } } diff --git a/packages/serialization/form/src/formSerializationWriter.ts b/packages/serialization/form/src/formSerializationWriter.ts index 6077d2a62..a2870f694 100644 --- a/packages/serialization/form/src/formSerializationWriter.ts +++ b/packages/serialization/form/src/formSerializationWriter.ts @@ -1,183 +1,148 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /* eslint-disable @typescript-eslint/no-unused-expressions */ -import { - DateOnly, - Duration, - type ModelSerializerFunction, - type Parsable, - type SerializationWriter, - TimeOnly, -} from "@microsoft/kiota-abstractions"; +import { DateOnly, Duration, type ModelSerializerFunction, type Parsable, type SerializationWriter, TimeOnly } from "@microsoft/kiota-abstractions"; import type { Guid } from "guid-typescript"; export class FormSerializationWriter implements SerializationWriter { - public writeByteArrayValue( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - key?: string | undefined, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - value?: ArrayBuffer | undefined, - ): void { - throw new Error( - "serialization of byt arrays is not supported with URI encoding", - ); - } - private readonly writer: string[] = []; - private static propertySeparator = `&`; - private depth = -1; - public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; - public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; - public onStartObjectSerialization: - | ((value: Parsable, writer: SerializationWriter) => void) - | undefined; - public writeStringValue = (key?: string, value?: string): void => { - if (key && value) { - this.writePropertyName(key); - this.writer.push(`=${encodeURIComponent(value)}`); - this.writer.push(FormSerializationWriter.propertySeparator); - } - }; - private writePropertyName = (key: string): void => { - this.writer.push(encodeURIComponent(key)); - }; - public writeBooleanValue = (key?: string, value?: boolean): void => { - value !== null && - value !== undefined && - this.writeStringValue(key, `${value}`); - }; - public writeNumberValue = (key?: string, value?: number): void => { - value && this.writeStringValue(key, `${value}`); - }; - public writeGuidValue = (key?: string, value?: Guid): void => { - value && this.writeStringValue(key, `${value}`); - }; - public writeDateValue = (key?: string, value?: Date): void => { - value && this.writeStringValue(key, value.toISOString()); - }; - public writeDateOnlyValue = (key?: string, value?: DateOnly): void => { - value && this.writeStringValue(key, value.toString()); - }; - public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => { - value && this.writeStringValue(key, value.toString()); - }; - public writeDurationValue = (key?: string, value?: Duration): void => { - value && this.writeStringValue(key, value.toString()); - }; - public writeNullValue = (key?: string): void => { - this.writeStringValue(key, `null`); - }; - public writeCollectionOfPrimitiveValues = ( - _key?: string, - _values?: T[] - ): void => { - if (_key && _values) { - _values.forEach((val) => { - this.writeAnyValue(_key, val); - }); - } - }; - public writeCollectionOfObjectValues = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _key?: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _values?: T[] - ): void => { - throw new Error( - `serialization of collections is not supported with URI encoding` - ); - }; - public writeObjectValue = ( - key: string | undefined, - value: T | undefined, - serializerMethod: ModelSerializerFunction - ): void => { - if (++this.depth > 0) { - throw new Error( - `serialization of nested objects is not supported with URI encoding` - ); - } - if (value) { - if (key) { - this.writePropertyName(key); - } - this.onBeforeObjectSerialization && - this.onBeforeObjectSerialization(value); - this.onStartObjectSerialization && - this.onStartObjectSerialization(value, this); - serializerMethod(this, value); - this.onAfterObjectSerialization && this.onAfterObjectSerialization(value); - if ( - this.writer.length > 0 && - this.writer[this.writer.length - 1] === - FormSerializationWriter.propertySeparator - ) { - //removing the last separator - this.writer.pop(); - } - key && this.writer.push(FormSerializationWriter.propertySeparator); - } - }; - public writeEnumValue = ( - key?: string | undefined, - ...values: (T | undefined)[] - ): void => { - if (values.length > 0) { - const rawValues = values - .filter((x) => x !== undefined) - .map((x) => `${x}`); - if (rawValues.length > 0) { - this.writeStringValue( - key, - rawValues.reduce((x, y) => `${x}, ${y}`) - ); - } - } - }; - public getSerializedContent = (): ArrayBuffer => { - return this.convertStringToArrayBuffer(this.writer.join(``)); - }; + public writeByteArrayValue( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + key?: string | undefined, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + value?: ArrayBuffer | undefined, + ): void { + throw new Error("serialization of byt arrays is not supported with URI encoding"); + } + private readonly writer: string[] = []; + private static propertySeparator = `&`; + private depth = -1; + public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; + public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; + public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; + public writeStringValue = (key?: string, value?: string): void => { + if (key && value) { + this.writePropertyName(key); + this.writer.push(`=${encodeURIComponent(value)}`); + this.writer.push(FormSerializationWriter.propertySeparator); + } + }; + private writePropertyName = (key: string): void => { + this.writer.push(encodeURIComponent(key)); + }; + public writeBooleanValue = (key?: string, value?: boolean): void => { + value !== null && value !== undefined && this.writeStringValue(key, `${value}`); + }; + public writeNumberValue = (key?: string, value?: number): void => { + value && this.writeStringValue(key, `${value}`); + }; + public writeGuidValue = (key?: string, value?: Guid): void => { + value && this.writeStringValue(key, `${value}`); + }; + public writeDateValue = (key?: string, value?: Date): void => { + value && this.writeStringValue(key, value.toISOString()); + }; + public writeDateOnlyValue = (key?: string, value?: DateOnly): void => { + value && this.writeStringValue(key, value.toString()); + }; + public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => { + value && this.writeStringValue(key, value.toString()); + }; + public writeDurationValue = (key?: string, value?: Duration): void => { + value && this.writeStringValue(key, value.toString()); + }; + public writeNullValue = (key?: string): void => { + this.writeStringValue(key, `null`); + }; + public writeCollectionOfPrimitiveValues = (_key?: string, _values?: T[]): void => { + if (_key && _values) { + _values.forEach((val) => { + this.writeAnyValue(_key, val); + }); + } + }; + public writeCollectionOfObjectValues = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _key?: string, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _values?: T[], + ): void => { + throw new Error(`serialization of collections is not supported with URI encoding`); + }; + public writeObjectValue = (key: string | undefined, value: T | undefined, serializerMethod: ModelSerializerFunction): void => { + if (++this.depth > 0) { + throw new Error(`serialization of nested objects is not supported with URI encoding`); + } + if (value) { + if (key) { + this.writePropertyName(key); + } + this.onBeforeObjectSerialization && this.onBeforeObjectSerialization(value); + this.onStartObjectSerialization && this.onStartObjectSerialization(value, this); + serializerMethod(this, value); + this.onAfterObjectSerialization && this.onAfterObjectSerialization(value); + if (this.writer.length > 0 && this.writer[this.writer.length - 1] === FormSerializationWriter.propertySeparator) { + //removing the last separator + this.writer.pop(); + } + key && this.writer.push(FormSerializationWriter.propertySeparator); + } + }; + public writeEnumValue = (key?: string | undefined, ...values: (T | undefined)[]): void => { + if (values.length > 0) { + const rawValues = values.filter((x) => x !== undefined).map((x) => `${x}`); + if (rawValues.length > 0) { + this.writeStringValue( + key, + rawValues.reduce((x, y) => `${x}, ${y}`), + ); + } + } + }; + public getSerializedContent = (): ArrayBuffer => { + return this.convertStringToArrayBuffer(this.writer.join(``)); + }; - private convertStringToArrayBuffer = (str: string): ArrayBuffer => { - const encoder = new TextEncoder(); - const encodedString = encoder.encode(str); - return encodedString.buffer; - }; + private convertStringToArrayBuffer = (str: string): ArrayBuffer => { + const encoder = new TextEncoder(); + const encodedString = encoder.encode(str); + return encodedString.buffer; + }; - public writeAdditionalData = ( - additionalData: Record | undefined - ): void => { - // Do not use !value here, because value can be `false`. - if (additionalData === undefined) return; - for (const key in additionalData) { - this.writeAnyValue(key, additionalData[key]); - } - }; + public writeAdditionalData = (additionalData: Record | undefined): void => { + // Do not use !value here, because value can be `false`. + if (additionalData === undefined) return; + for (const key in additionalData) { + this.writeAnyValue(key, additionalData[key]); + } + }; - private writeAnyValue = ( - key?: string | undefined, - value?: unknown | undefined - ): void => { - if (value !== null && value !== undefined) { - const valueType = typeof value; - if (valueType === "boolean") { - this.writeBooleanValue(key, value as any as boolean); - } else if (valueType === "string") { - this.writeStringValue(key, value as any as string); - } else if (value instanceof Date) { - this.writeDateValue(key, value as any as Date); - } else if (value instanceof DateOnly) { - this.writeDateOnlyValue(key, value as any as DateOnly); - } else if (value instanceof TimeOnly) { - this.writeTimeOnlyValue(key, value as any as TimeOnly); - } else if (value instanceof Duration) { - this.writeDurationValue(key, value as any as Duration); - } else if (valueType === "number") { - this.writeNumberValue(key, value as any as number); - } else { - throw new Error( - `encountered unknown ${value} value type during serialization ${valueType} for key ${key}` - ); - } - } else { - this.writeNullValue(key); - } - }; + private writeAnyValue = (key?: string | undefined, value?: unknown | undefined): void => { + if (value !== null && value !== undefined) { + const valueType = typeof value; + if (valueType === "boolean") { + this.writeBooleanValue(key, value as any as boolean); + } else if (valueType === "string") { + this.writeStringValue(key, value as any as string); + } else if (value instanceof Date) { + this.writeDateValue(key, value as any as Date); + } else if (value instanceof DateOnly) { + this.writeDateOnlyValue(key, value as any as DateOnly); + } else if (value instanceof TimeOnly) { + this.writeTimeOnlyValue(key, value as any as TimeOnly); + } else if (value instanceof Duration) { + this.writeDurationValue(key, value as any as Duration); + } else if (valueType === "number") { + this.writeNumberValue(key, value as any as number); + } else { + throw new Error(`encountered unknown ${value} value type during serialization ${valueType} for key ${key}`); + } + } else { + this.writeNullValue(key); + } + }; } diff --git a/packages/serialization/form/src/formSerializationWriterFactory.ts b/packages/serialization/form/src/formSerializationWriterFactory.ts index d99fd4d71..b473068a2 100644 --- a/packages/serialization/form/src/formSerializationWriterFactory.ts +++ b/packages/serialization/form/src/formSerializationWriterFactory.ts @@ -1,21 +1,24 @@ -import type { - SerializationWriter, - SerializationWriterFactory, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import type { SerializationWriter, SerializationWriterFactory } from "@microsoft/kiota-abstractions"; import { FormSerializationWriter } from "./formSerializationWriter"; -export class FormSerializationWriterFactory - implements SerializationWriterFactory { - public getValidContentType(): string { - return "application/x-www-form-urlencoded"; - } - public getSerializationWriter(contentType: string): SerializationWriter { - if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } else if (this.getValidContentType() !== contentType) { - throw new Error(`expected a ${this.getValidContentType()} content type`); - } - return new FormSerializationWriter(); - } +export class FormSerializationWriterFactory implements SerializationWriterFactory { + public getValidContentType(): string { + return "application/x-www-form-urlencoded"; + } + public getSerializationWriter(contentType: string): SerializationWriter { + if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } else if (this.getValidContentType() !== contentType) { + throw new Error(`expected a ${this.getValidContentType()} content type`); + } + return new FormSerializationWriter(); + } } diff --git a/packages/serialization/form/src/index.ts b/packages/serialization/form/src/index.ts index 21959bb81..7b89f9246 100644 --- a/packages/serialization/form/src/index.ts +++ b/packages/serialization/form/src/index.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "./formParseNode"; export * from "./formSerializationWriter"; export * from "./formParseNodeFactory"; diff --git a/packages/serialization/form/test/browser/index.ts b/packages/serialization/form/test/browser/index.ts index 92aa9c788..ae745aca0 100644 --- a/packages/serialization/form/test/browser/index.ts +++ b/packages/serialization/form/test/browser/index.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "../common/formParseNode"; export * from "../common/formParseNodeFactory"; export * from "../common/formSerializationWriter"; diff --git a/packages/serialization/form/test/common/formParseNode.ts b/packages/serialization/form/test/common/formParseNode.ts index 9b7cb7421..3cbb52bed 100644 --- a/packages/serialization/form/test/common/formParseNode.ts +++ b/packages/serialization/form/test/common/formParseNode.ts @@ -1,60 +1,58 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { FormParseNode } from "../../src/index"; -import { createTestParserFromDiscriminatorValue,type TestEntity } from "../testEntity"; +import { createTestParserFromDiscriminatorValue, type TestEntity } from "../testEntity"; describe("FormParseNode", () => { - const testUserForm = - "displayName=Megan+Bowen&" + - "numbers=one,two,thirtytwo&" + - "givenName=Megan&" + - "accountEnabled=true&" + - "createdDateTime=2017-07-29T03:07:25Z&" + - "jobTitle=Auditor&" + - "mail=MeganB@M365x214355.onmicrosoft.com&" + - "mobilePhone=null&" + - "officeLocation=null&" + - "preferredLanguage=en-US&" + - "surname=Bowen&" + - "workDuration=PT1H&" + - "startWorkTime=08:00:00.0000000&" + - "endWorkTime=17:00:00.0000000&" + - "userPrincipalName=MeganB@M365x214355.onmicrosoft.com&" + - "birthday=2017-09-04&" + - "deviceNames=device1&deviceNames=device2&"+ //collection property - "id=48d31887-5fad-4d73-a9f5-3c356e68a038"; - it("getsEntityValueFromForm", () => { - const parseNode = new FormParseNode(testUserForm); - const testEntity = parseNode.getObjectValue( - createTestParserFromDiscriminatorValue - ) as TestEntity; - assert.isNotNull(testEntity); - assert.isUndefined(testEntity.officeLocation); - assert.equal(testEntity.id, "48d31887-5fad-4d73-a9f5-3c356e68a038"); - assert.equal((testEntity as any)["jobTitle"], "Auditor"); - assert.equal( - Object.prototype.hasOwnProperty.call(testEntity, "mobilePhone"), - false - ); - assert.equal(testEntity.workDuration?.toString(), "PT1H"); - assert.equal(2, testEntity.deviceNames?.length); - assert.equal(testEntity.deviceNames?.[0], "device1"); - assert.equal(testEntity.deviceNames?.[1], "device2"); - assert.equal(testEntity.startWorkTime?.toString(), "08:00:00.000000000000"); - assert.equal(testEntity.endWorkTime?.toString(), "17:00:00.000000000000"); - assert.equal(testEntity.birthday?.toString(), "2017-09-04"); - }); - it("getCollectionOfObjectValuesFromForm", () => { - const parseNode = new FormParseNode(testUserForm); - assert.throw(() => - parseNode.getCollectionOfObjectValues( - createTestParserFromDiscriminatorValue - ) - ); - }); - it("returnsDefaultIfChildNodeDoesNotExist", () => { - const parseNode = new FormParseNode(testUserForm); - const imaginaryNode = parseNode.getChildNode("imaginaryNode"); - assert.isUndefined(imaginaryNode); - }); + const testUserForm = + "displayName=Megan+Bowen&" + + "numbers=one,two,thirtytwo&" + + "givenName=Megan&" + + "accountEnabled=true&" + + "createdDateTime=2017-07-29T03:07:25Z&" + + "jobTitle=Auditor&" + + "mail=MeganB@M365x214355.onmicrosoft.com&" + + "mobilePhone=null&" + + "officeLocation=null&" + + "preferredLanguage=en-US&" + + "surname=Bowen&" + + "workDuration=PT1H&" + + "startWorkTime=08:00:00.0000000&" + + "endWorkTime=17:00:00.0000000&" + + "userPrincipalName=MeganB@M365x214355.onmicrosoft.com&" + + "birthday=2017-09-04&" + + "deviceNames=device1&deviceNames=device2&" + //collection property + "id=48d31887-5fad-4d73-a9f5-3c356e68a038"; + it("getsEntityValueFromForm", () => { + const parseNode = new FormParseNode(testUserForm); + const testEntity = parseNode.getObjectValue(createTestParserFromDiscriminatorValue) as TestEntity; + assert.isNotNull(testEntity); + assert.isUndefined(testEntity.officeLocation); + assert.equal(testEntity.id, "48d31887-5fad-4d73-a9f5-3c356e68a038"); + assert.equal((testEntity as any)["jobTitle"], "Auditor"); + assert.equal(Object.prototype.hasOwnProperty.call(testEntity, "mobilePhone"), false); + assert.equal(testEntity.workDuration?.toString(), "PT1H"); + assert.equal(2, testEntity.deviceNames?.length); + assert.equal(testEntity.deviceNames?.[0], "device1"); + assert.equal(testEntity.deviceNames?.[1], "device2"); + assert.equal(testEntity.startWorkTime?.toString(), "08:00:00.000000000000"); + assert.equal(testEntity.endWorkTime?.toString(), "17:00:00.000000000000"); + assert.equal(testEntity.birthday?.toString(), "2017-09-04"); + }); + it("getCollectionOfObjectValuesFromForm", () => { + const parseNode = new FormParseNode(testUserForm); + assert.throw(() => parseNode.getCollectionOfObjectValues(createTestParserFromDiscriminatorValue)); + }); + it("returnsDefaultIfChildNodeDoesNotExist", () => { + const parseNode = new FormParseNode(testUserForm); + const imaginaryNode = parseNode.getChildNode("imaginaryNode"); + assert.isUndefined(imaginaryNode); + }); }); diff --git a/packages/serialization/form/test/common/formParseNodeFactory.ts b/packages/serialization/form/test/common/formParseNodeFactory.ts index d199ddbf8..1a17de7dd 100644 --- a/packages/serialization/form/test/common/formParseNodeFactory.ts +++ b/packages/serialization/form/test/common/formParseNodeFactory.ts @@ -1,47 +1,46 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { FormParseNodeFactory } from "../../src/index"; describe("formParseNodeFactory", () => { - it("formParseNodeFactory", () => { - const formParseNodeFactory = new FormParseNodeFactory(); - assert.isDefined(formParseNodeFactory); - }); - it("formParseNodeFactory:getsWriterForFormContentType", () => { - const factory = new FormParseNodeFactory(); - - const expectedForm = "subject=subject-value"; - const sampleArrayBuffer = new TextEncoder().encode(expectedForm); - - const formParseNode = factory.getRootParseNode( - factory.getValidContentType(), - sampleArrayBuffer - ); - assert.isDefined(formParseNode); - }); - it("formParseNodeFactory:throwsForInvalidContentType", () => { - const factory = new FormParseNodeFactory(); - - const expectedForm = "subject=subject-value"; - const sampleArrayBuffer = new TextEncoder().encode(expectedForm); - - assert.throw(() => - factory.getRootParseNode("application/json", sampleArrayBuffer) - ); - }); - it("formParseNodeFactory:throwsForNoContentType", () => { - const factory = new FormParseNodeFactory(); - - assert.throw(() => { - const sampleArrayBuffer = new TextEncoder().encode("foo"); - factory.getRootParseNode("", sampleArrayBuffer); - }); - assert.throw(() => { - const sampleArrayBuffer = new TextEncoder().encode("foo"); - factory.getRootParseNode( - undefined as unknown as string, - sampleArrayBuffer - ); - }); - }); + it("formParseNodeFactory", () => { + const formParseNodeFactory = new FormParseNodeFactory(); + assert.isDefined(formParseNodeFactory); + }); + it("formParseNodeFactory:getsWriterForFormContentType", () => { + const factory = new FormParseNodeFactory(); + + const expectedForm = "subject=subject-value"; + const sampleArrayBuffer = new TextEncoder().encode(expectedForm); + + const formParseNode = factory.getRootParseNode(factory.getValidContentType(), sampleArrayBuffer); + assert.isDefined(formParseNode); + }); + it("formParseNodeFactory:throwsForInvalidContentType", () => { + const factory = new FormParseNodeFactory(); + + const expectedForm = "subject=subject-value"; + const sampleArrayBuffer = new TextEncoder().encode(expectedForm); + + assert.throw(() => factory.getRootParseNode("application/json", sampleArrayBuffer)); + }); + it("formParseNodeFactory:throwsForNoContentType", () => { + const factory = new FormParseNodeFactory(); + + assert.throw(() => { + const sampleArrayBuffer = new TextEncoder().encode("foo"); + factory.getRootParseNode("", sampleArrayBuffer); + }); + assert.throw(() => { + const sampleArrayBuffer = new TextEncoder().encode("foo"); + factory.getRootParseNode(undefined as unknown as string, sampleArrayBuffer); + }); + }); }); diff --git a/packages/serialization/form/test/common/formSerializationWriter.ts b/packages/serialization/form/test/common/formSerializationWriter.ts index 288bea281..6db1e0cf6 100644 --- a/packages/serialization/form/test/common/formSerializationWriter.ts +++ b/packages/serialization/form/test/common/formSerializationWriter.ts @@ -1,87 +1,86 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import { DateOnly, Duration, TimeOnly } from "@microsoft/kiota-abstractions"; -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { FormSerializationWriter } from "../../src"; -import { serializeTestEntity,type TestEntity } from "../testEntity"; +import { serializeTestEntity, type TestEntity } from "../testEntity"; describe("FormSerializationWriter", () => { - it("writesSampleObjectValue", () => { - const testEntity = {} as TestEntity; - testEntity.id = "48d31887-5fad-4d73-a9f5-3c356e68a038"; - testEntity.workDuration = new Duration({ - hours: 1, - }); - testEntity.startWorkTime = new TimeOnly({ - hours: 8, - }); - testEntity.birthday = new DateOnly({ - year: 2017, - month: 9, - day: 4, - }); - testEntity.additionalData = {}; - testEntity.additionalData["mobilePhone"] = null; - testEntity.additionalData["accountEnabled"] = false; - testEntity.additionalData["jobTitle"] = "Author"; - testEntity.additionalData["createdDateTime"] = new Date(0); - testEntity.deviceNames = ["device1", "device2"]; - const formSerializationWriter = new FormSerializationWriter(); - formSerializationWriter.writeObjectValue( - undefined, - testEntity, - serializeTestEntity - ); - const formContent = formSerializationWriter.getSerializedContent(); - const form = new TextDecoder().decode(formContent); - const expectedString = [ - "id=48d31887-5fad-4d73-a9f5-3c356e68a038", - "birthday=2017-09-04", // Serializes dates - "workDuration=PT1H", // Serializes timespans - "startWorkTime=08%3A00%3A00.000000000000", //Serializes times - "mobilePhone=null", // Serializes null values - "accountEnabled=false", - "jobTitle=Author", - "createdDateTime=1970-01-01T00%3A00%3A00.000Z", - "deviceNames=device1", - "deviceNames=device2", // Serializes collections - ]; - const arr = form.split("&"); - let count = 0; - expectedString.forEach((expected) => { - const index = arr.indexOf(expected); - if (index >= 0) { - arr.splice(index, 1); - count++; - } - }); - assert.equal(expectedString.length, count); - assert.equal(arr.length, 0); - }); + it("writesSampleObjectValue", () => { + const testEntity = {} as TestEntity; + testEntity.id = "48d31887-5fad-4d73-a9f5-3c356e68a038"; + testEntity.workDuration = new Duration({ + hours: 1, + }); + testEntity.startWorkTime = new TimeOnly({ + hours: 8, + }); + testEntity.birthday = new DateOnly({ + year: 2017, + month: 9, + day: 4, + }); + testEntity.additionalData = {}; + testEntity.additionalData["mobilePhone"] = null; + testEntity.additionalData["accountEnabled"] = false; + testEntity.additionalData["jobTitle"] = "Author"; + testEntity.additionalData["createdDateTime"] = new Date(0); + testEntity.deviceNames = ["device1", "device2"]; + const formSerializationWriter = new FormSerializationWriter(); + formSerializationWriter.writeObjectValue(undefined, testEntity, serializeTestEntity); + const formContent = formSerializationWriter.getSerializedContent(); + const form = new TextDecoder().decode(formContent); + const expectedString = [ + "id=48d31887-5fad-4d73-a9f5-3c356e68a038", + "birthday=2017-09-04", // Serializes dates + "workDuration=PT1H", // Serializes timespans + "startWorkTime=08%3A00%3A00.000000000000", //Serializes times + "mobilePhone=null", // Serializes null values + "accountEnabled=false", + "jobTitle=Author", + "createdDateTime=1970-01-01T00%3A00%3A00.000Z", + "deviceNames=device1", + "deviceNames=device2", // Serializes collections + ]; + const arr = form.split("&"); + let count = 0; + expectedString.forEach((expected) => { + const index = arr.indexOf(expected); + if (index >= 0) { + arr.splice(index, 1); + count++; + } + }); + assert.equal(expectedString.length, count); + assert.equal(arr.length, 0); + }); - it("writesSampleCollectionOfObjectValues", () => { - const testEntity = {} as TestEntity; - testEntity.id = "48d31887-5fad-4d73-a9f5-3c356e68a038"; - testEntity.workDuration = new Duration({ - hours: 1, - }); - testEntity.startWorkTime = new TimeOnly({ - hours: 8, - }); - testEntity.birthday = new DateOnly({ - year: 2017, - month: 9, - day: 4, - }); - testEntity.additionalData = {}; - testEntity.additionalData["mobilePhone"] = null; - testEntity.additionalData["accountEnabled"] = false; - testEntity.additionalData["jobTitle"] = "Author"; - testEntity["createdDateTime"] = new Date(0); - const formSerializationWriter = new FormSerializationWriter(); - assert.throw(() => - formSerializationWriter.writeCollectionOfObjectValues(undefined, [ - testEntity, - ]) - ); - }); + it("writesSampleCollectionOfObjectValues", () => { + const testEntity = {} as TestEntity; + testEntity.id = "48d31887-5fad-4d73-a9f5-3c356e68a038"; + testEntity.workDuration = new Duration({ + hours: 1, + }); + testEntity.startWorkTime = new TimeOnly({ + hours: 8, + }); + testEntity.birthday = new DateOnly({ + year: 2017, + month: 9, + day: 4, + }); + testEntity.additionalData = {}; + testEntity.additionalData["mobilePhone"] = null; + testEntity.additionalData["accountEnabled"] = false; + testEntity.additionalData["jobTitle"] = "Author"; + testEntity["createdDateTime"] = new Date(0); + const formSerializationWriter = new FormSerializationWriter(); + assert.throw(() => formSerializationWriter.writeCollectionOfObjectValues(undefined, [testEntity])); + }); }); diff --git a/packages/serialization/form/test/common/formSerializationWriterFactory.ts b/packages/serialization/form/test/common/formSerializationWriterFactory.ts index dc7126fb8..b264ec7dd 100644 --- a/packages/serialization/form/test/common/formSerializationWriterFactory.ts +++ b/packages/serialization/form/test/common/formSerializationWriterFactory.ts @@ -1,28 +1,33 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { FormSerializationWriterFactory } from "../../src/index"; describe("formSerializationWriterFactory", () => { - it("formSerializationWriterFactory", () => { - const factory = new FormSerializationWriterFactory(); - assert.isDefined(factory); - }); - it("formSerializationWriterFactory:getsWriterForFormContentType", () => { - const factory = new FormSerializationWriterFactory(); + it("formSerializationWriterFactory", () => { + const factory = new FormSerializationWriterFactory(); + assert.isDefined(factory); + }); + it("formSerializationWriterFactory:getsWriterForFormContentType", () => { + const factory = new FormSerializationWriterFactory(); - const formParseNode = factory.getSerializationWriter( - factory.getValidContentType() - ); - assert.isDefined(formParseNode); - }); - it("formSerializationWriterFactory:throwsForInvalidContentType", () => { - const factory = new FormSerializationWriterFactory(); + const formParseNode = factory.getSerializationWriter(factory.getValidContentType()); + assert.isDefined(formParseNode); + }); + it("formSerializationWriterFactory:throwsForInvalidContentType", () => { + const factory = new FormSerializationWriterFactory(); - assert.throw(() => factory.getSerializationWriter("application/json")); - }); - it("formSerializationWriterFactory:throwsForNoContentType", () => { - const factory = new FormSerializationWriterFactory(); + assert.throw(() => factory.getSerializationWriter("application/json")); + }); + it("formSerializationWriterFactory:throwsForNoContentType", () => { + const factory = new FormSerializationWriterFactory(); - assert.throw(() => factory.getSerializationWriter("")); - }); + assert.throw(() => factory.getSerializationWriter("")); + }); }); diff --git a/packages/serialization/form/test/testEntity.ts b/packages/serialization/form/test/testEntity.ts index 89cbf20fe..e25a08003 100644 --- a/packages/serialization/form/test/testEntity.ts +++ b/packages/serialization/form/test/testEntity.ts @@ -1,72 +1,64 @@ -import type { - AdditionalDataHolder, - DateOnly, - Duration, - Parsable, - ParseNode, - SerializationWriter, - TimeOnly, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import type { AdditionalDataHolder, DateOnly, Duration, Parsable, ParseNode, SerializationWriter, TimeOnly } from "@microsoft/kiota-abstractions"; export interface TestEntity extends Parsable, AdditionalDataHolder { - id?: string; - birthday?: DateOnly; - createdDateTime?: Date; - workDuration?: Duration; - startWorkTime?: TimeOnly; - endWorkTime?: TimeOnly; - officeLocation?: string; - deviceNames?: string[]; + id?: string; + birthday?: DateOnly; + createdDateTime?: Date; + workDuration?: Duration; + startWorkTime?: TimeOnly; + endWorkTime?: TimeOnly; + officeLocation?: string; + deviceNames?: string[]; } -export function createTestParserFromDiscriminatorValue( - parseNode: ParseNode | undefined -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeTestEntity; +export function createTestParserFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeTestEntity; } -export function deserializeTestEntity( - testEntity: TestEntity | undefined = {} -): Record void> { - return { - id: (n) => { - testEntity.id = n.getStringValue(); - }, - birthday: (n) => { - testEntity.birthday = n.getDateOnlyValue(); - }, - createdDateTime: (n) => { - testEntity.createdDateTime = n.getDateValue(); - }, - workDuration: (n) => { - testEntity.workDuration = n.getDurationValue(); - }, - startWorkTime: (n) => { - testEntity.startWorkTime = n.getTimeOnlyValue(); - }, - endWorkTime: (n) => { - testEntity.endWorkTime = n.getTimeOnlyValue(); - }, - officeLocation: (n) => { - testEntity.officeLocation = n.getStringValue(); - }, - deviceNames: (n) => { - testEntity.deviceNames = n.getCollectionOfPrimitiveValues(); - }, - }; +export function deserializeTestEntity(testEntity: TestEntity | undefined = {}): Record void> { + return { + id: (n) => { + testEntity.id = n.getStringValue(); + }, + birthday: (n) => { + testEntity.birthday = n.getDateOnlyValue(); + }, + createdDateTime: (n) => { + testEntity.createdDateTime = n.getDateValue(); + }, + workDuration: (n) => { + testEntity.workDuration = n.getDurationValue(); + }, + startWorkTime: (n) => { + testEntity.startWorkTime = n.getTimeOnlyValue(); + }, + endWorkTime: (n) => { + testEntity.endWorkTime = n.getTimeOnlyValue(); + }, + officeLocation: (n) => { + testEntity.officeLocation = n.getStringValue(); + }, + deviceNames: (n) => { + testEntity.deviceNames = n.getCollectionOfPrimitiveValues(); + }, + }; } -export function serializeTestEntity( - writer: SerializationWriter, - testEntity: TestEntity | undefined = {} -): void { - writer.writeStringValue("id", testEntity.id); - writer.writeDateOnlyValue("birthday", testEntity.birthday); - writer.writeDateValue("createdDateTime", testEntity.createdDateTime); - writer.writeDurationValue("workDuration", testEntity.workDuration); - writer.writeTimeOnlyValue("startWorkTime", testEntity.startWorkTime); - writer.writeTimeOnlyValue("endWorkTime", testEntity.endWorkTime); - writer.writeStringValue("officeLocation", testEntity.officeLocation); - writer.writeAdditionalData(testEntity.additionalData); - writer.writeCollectionOfPrimitiveValues("deviceNames",testEntity.deviceNames); +export function serializeTestEntity(writer: SerializationWriter, testEntity: TestEntity | undefined = {}): void { + writer.writeStringValue("id", testEntity.id); + writer.writeDateOnlyValue("birthday", testEntity.birthday); + writer.writeDateValue("createdDateTime", testEntity.createdDateTime); + writer.writeDurationValue("workDuration", testEntity.workDuration); + writer.writeTimeOnlyValue("startWorkTime", testEntity.startWorkTime); + writer.writeTimeOnlyValue("endWorkTime", testEntity.endWorkTime); + writer.writeStringValue("officeLocation", testEntity.officeLocation); + writer.writeAdditionalData(testEntity.additionalData); + writer.writeCollectionOfPrimitiveValues("deviceNames", testEntity.deviceNames); } diff --git a/packages/serialization/form/tsconfig.base.json b/packages/serialization/form/tsconfig.base.json deleted file mode 100644 index 2499c53ed..000000000 --- a/packages/serialization/form/tsconfig.base.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "importHelpers": true, - "noEmitOnError": true, - "moduleResolution": "node", - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "declarationMap": true, - "composite": true, - "paths": { - "@microsoft/kiota-abstractions/*": [ - "../../abstractions/*" - ], - } - } -} \ No newline at end of file diff --git a/packages/serialization/form/tsconfig.cjs.json b/packages/serialization/form/tsconfig.cjs.json deleted file mode 100644 index 00b535503..000000000 --- a/packages/serialization/form/tsconfig.cjs.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2017", - "module": "commonjs", - "outDir": "./dist/cjs" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test"], - "references": [ - { - "path": "../../abstractions/tsconfig.cjs.json" - }, - ] -} \ No newline at end of file diff --git a/packages/serialization/form/tsconfig.es.json b/packages/serialization/form/tsconfig.es.json deleted file mode 100644 index 67107d65f..000000000 --- a/packages/serialization/form/tsconfig.es.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "dist/es/" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "references": [ - { - "path": "../../abstractions/tsconfig.es.json" - }, - ] -} \ No newline at end of file diff --git a/packages/serialization/form/tsconfig.json b/packages/serialization/form/tsconfig.json new file mode 100644 index 000000000..7d941c5a6 --- /dev/null +++ b/packages/serialization/form/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist/es/" + }, + "exclude": [ + "node_modules", + "dist", + "./test/**/*.ts" + ], + "include": [ + "./src/**/*.ts", + ] +} \ No newline at end of file diff --git a/packages/serialization/form/vitest.config.mts b/packages/serialization/form/vitest.config.mts new file mode 100644 index 000000000..16577bafc --- /dev/null +++ b/packages/serialization/form/vitest.config.mts @@ -0,0 +1,11 @@ +import { defineConfig, configDefaults } from "vitest/config"; + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude, "**/*/{testEntity,index}.ts"], + include: [...configDefaults.include, "test/**/*.ts"], + coverage: { + reporter: ["html"], + }, + }, +}); \ No newline at end of file diff --git a/packages/serialization/json/.eslintignore b/packages/serialization/json/.eslintignore deleted file mode 100644 index 8942aa232..000000000 --- a/packages/serialization/json/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -*.js -*.js.map -*.d.ts - -node_modules -lib -spec/development \ No newline at end of file diff --git a/packages/serialization/json/.eslintrc.json b/packages/serialization/json/.eslintrc.json deleted file mode 100644 index 80ab9b397..000000000 --- a/packages/serialization/json/.eslintrc.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "prettier", - "simple-import-sort" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "rules": { - "@typescript-eslint/no-empty-interface": "warn", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/consistent-type-imports": "error", - "prettier/prettier": [ - "error", - { - "endOfLine": "auto" - } - ], - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "typeLike", - "format": [ - "PascalCase" - ], - "filter": { - "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "interface", - "format": [ - "PascalCase" - ], - "custom": { - "regex": "^I[A-Z]", - "match": false - }, - "filter": { - "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", - "match": false - } - }, - { - "selector": "variable", - "format": [ - "camelCase", - "PascalCase", - "UPPER_CASE" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "function", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "parameter", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", - "match": false - } - }, - { - "selector": "method", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "memberLike", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "enumMember", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "property", - "format": null - } - ], - "@typescript-eslint/semi": "error", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/prefer-for-of": "error", - "@typescript-eslint/prefer-function-type": "error", - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/quotes": [ - "error", - "double", - { - "avoidEscape": true, - "allowTemplateLiterals": true - } - ], - "@typescript-eslint/space-within-parens": [ - "off", - "never" - ], - "@typescript-eslint/triple-slash-reference": "error", - "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unified-signatures": "error", - "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", - "@typescript-eslint/consistent-type-definitions": [ - "error", - "interface" - ], - "@typescript-eslint/no-inferrable-types": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-this-alias": "error", - "no-unused-expressions": "off", - "@typescript-eslint/no-unused-expressions": [ - "error", - { - "allowTernary": true - } - ], - "@typescript-eslint/space-before-function-paren": "off", - "@typescript-eslint/consistent-type-assertions": "error", - "@typescript-eslint/explicit-member-accessibility": [ - "off", - { - "accessibility": "explicit" - } - ], - "@typescript-eslint/indent": "off", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/member-delimiter-style": [ - "off", - { - "multiline": { - "delimiter": "none", - "requireLast": true - }, - "singleline": { - "delimiter": "semi", - "requireLast": false - } - } - ], - "@typescript-eslint/member-ordering": "off", - "@typescript-eslint/no-empty-function": "error", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-parameter-properties": "off", - "@typescript-eslint/no-array-constructor": "error", - "no-useless-catch": "error", - "prefer-rest-params": "off", - "no-constant-condition": "error", - "simple-import-sort/imports": "error", - "brace-style": "error", - "constructor-super": "error", - "curly": [ - "error", - "multi-line" - ], - "dot-notation": "off", - "eqeqeq": "error", - "new-parens": "error", - "no-caller": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-empty": "error", - "no-eval": "error", - "no-extra-bind": "error", - "no-fallthrough": "error", - "no-new-func": "off", - "no-new-wrappers": "error", - "no-return-await": "off", - "no-sparse-arrays": "error", - "no-template-curly-in-string": "error", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-unsafe-finally": "error", - "no-unused-labels": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-const": "error", - "prefer-object-spread": "error", - "quote-props": "off", - "space-in-parens": "error", - "unicode-bom": [ - "error", - "never" - ], - "use-isnan": "error" - } -} \ No newline at end of file diff --git a/packages/serialization/json/.npmignore b/packages/serialization/json/.npmignore index 164fa84b7..15ae0ca0b 100644 --- a/packages/serialization/json/.npmignore +++ b/packages/serialization/json/.npmignore @@ -4,7 +4,6 @@ *.tgz **/test/**/* docs/ -karma.conf.js node_modules/ rollup.config.js src/ diff --git a/packages/serialization/json/karma.conf.js b/packages/serialization/json/karma.conf.js deleted file mode 100644 index ed70e0053..000000000 --- a/packages/serialization/json/karma.conf.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function(config) { - config.set({ - frameworks: ["mocha", "chai", "karma-typescript"], - files: [{ pattern: "dist/es/test/index.js", type: "module" }], - preprocessors: { - "**/*.ts": ["karma-typescript"], - }, - karmaTypescriptConfig: { - tsconfig: "./tsconfig.cjs.json", - }, - browsers: ["ChromeHeadless"], - }); -}; \ No newline at end of file diff --git a/packages/serialization/json/package.json b/packages/serialization/json/package.json index 612a59609..024458726 100644 --- a/packages/serialization/json/package.json +++ b/packages/serialization/json/package.json @@ -2,24 +2,22 @@ "name": "@microsoft/kiota-serialization-json", "version": "1.0.0-preview.51", "description": "Implementation of Kiota Serialization interfaces for JSON", - "main": "dist/cjs/src/index.js", + "main": "dist/es/src/index.js", "browser": { "./dist/es/src/index.js": "./dist/es/src/browser/index.js", "./dist/es/src/jsonParseNodeFactory.js": "./dist/es/src/browser/jsonParseNodeFactory.js" }, "module": "dist/es/src/index.js", - "types": "dist/cjs/src/index.d.ts", + "types": "dist/es/src/index.d.ts", "scripts": { - "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc -b tsconfig.cjs.json", - "build:esm": "tsc -b tsconfig.es.json", + "build": "npm run clean && npm run build:esm", + "build:esm": "tsc -b", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "rm -r ./dist", - "karma": "npm run rollup && karma start --single-run --browsers ChromeHeadless karma.conf.js", - "rollup": "rollup -c", - "test": "npm run test:cjs && npm run karma", - "test:cjs": "npm run build && mocha 'dist/cjs/test/common/**/*.js'" + "clean": "rm -rf ./dist", + "test:browser": "vitest run --browser.name=chrome --browser.headless", + "test:node": "vitest --run", + "test": "npm run test:node && npm run test:browser" }, "repository": { "type": "git", @@ -39,11 +37,11 @@ }, "homepage": "https://github.com/microsoft/kiota-typescript#readme", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" }, "publishConfig": { "access": "public" } -} +} \ No newline at end of file diff --git a/packages/serialization/json/rollup.config.js b/packages/serialization/json/rollup.config.js deleted file mode 100644 index 33546e42e..000000000 --- a/packages/serialization/json/rollup.config.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -import resolve from "@rollup/plugin-node-resolve"; -import commonjs from "@rollup/plugin-commonjs"; - -const config = [{ - input: ["dist/es/test/browser/index.js"], - output: { - file: "dist/es/test/index.js", - format: "esm", - name: "BrowserTest", - }, - plugins: [ - commonjs(), - resolve({ - browser: true, - preferBuiltins: false, - - }) - ], -}]; - -export default config; \ No newline at end of file diff --git a/packages/serialization/json/src/browser/index.ts b/packages/serialization/json/src/browser/index.ts index 4b95c4be8..98b40a179 100644 --- a/packages/serialization/json/src/browser/index.ts +++ b/packages/serialization/json/src/browser/index.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "./../jsonParseNode"; export * from "./../jsonSerializationWriter"; export * from "./jsonParseNodeFactory"; diff --git a/packages/serialization/json/src/browser/jsonParseNodeFactory.ts b/packages/serialization/json/src/browser/jsonParseNodeFactory.ts index 47c650b1b..e4386fee1 100644 --- a/packages/serialization/json/src/browser/jsonParseNodeFactory.ts +++ b/packages/serialization/json/src/browser/jsonParseNodeFactory.ts @@ -1,28 +1,32 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { ParseNode, ParseNodeFactory } from "@microsoft/kiota-abstractions"; import { JsonParseNode } from "./../jsonParseNode"; export class JsonParseNodeFactory implements ParseNodeFactory { - public getValidContentType(): string { - return "application/json"; - } - public getRootParseNode( - contentType: string, - content: ArrayBuffer - ): ParseNode { - if (!content) { - throw new Error("content cannot be undefined of empty"); - } else if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } else if (this.getValidContentType() !== contentType) { - throw new Error(`expected a ${this.getValidContentType()} content type`); - } - return new JsonParseNode(this.convertArrayBufferToJson(content)); - } + public getValidContentType(): string { + return "application/json"; + } + public getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode { + if (!content) { + throw new Error("content cannot be undefined of empty"); + } else if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } else if (this.getValidContentType() !== contentType) { + throw new Error(`expected a ${this.getValidContentType()} content type`); + } + return new JsonParseNode(this.convertArrayBufferToJson(content)); + } - private convertArrayBufferToJson(content: ArrayBuffer) { - const decoder = new TextDecoder(); - const contentAsStr = decoder.decode(content); - return JSON.parse(contentAsStr); - } + private convertArrayBufferToJson(content: ArrayBuffer) { + const decoder = new TextDecoder(); + const contentAsStr = decoder.decode(content); + return JSON.parse(contentAsStr); + } } diff --git a/packages/serialization/json/src/index.ts b/packages/serialization/json/src/index.ts index effc7e2ce..68eb7c47e 100644 --- a/packages/serialization/json/src/index.ts +++ b/packages/serialization/json/src/index.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "./jsonParseNode"; export * from "./jsonSerializationWriter"; export * from "./jsonParseNodeFactory"; diff --git a/packages/serialization/json/src/jsonParseNode.ts b/packages/serialization/json/src/jsonParseNode.ts index 75ce95179..0157973a6 100644 --- a/packages/serialization/json/src/jsonParseNode.ts +++ b/packages/serialization/json/src/jsonParseNode.ts @@ -1,188 +1,135 @@ -import { - createBackedModelProxyHandler, - DateOnly, - Duration, - type Parsable, - type ParsableFactory, - parseGuidString, - type ParseNode, - TimeOnly, - isBackingStoreEnabled, - toFirstCharacterUpper, - isUntypedNode, - UntypedNode, - UntypedArray, - UntypedBoolean, - UntypedNumber, - UntypedObject, - UntypedString, - createUntypedNodeFromDiscriminatorValue, - UntypedNull, - createUntypedBoolean, - createUntypedString, - createUntypedNumber, - createUntypedArray, - createUntypedObject, - createUntypedNull, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { DateOnly, Duration, TimeOnly, UntypedNode, createBackedModelProxyHandler, createUntypedArray, createUntypedBoolean, createUntypedNodeFromDiscriminatorValue, createUntypedNull, createUntypedNumber, createUntypedObject, createUntypedString, inNodeEnv, isBackingStoreEnabled, isUntypedNode, parseGuidString, toFirstCharacterUpper, type Parsable, type ParsableFactory, type ParseNode } from "@microsoft/kiota-abstractions"; export class JsonParseNode implements ParseNode { - /** - * - */ - constructor(private readonly _jsonNode: unknown) {} - public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; - public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; - public getStringValue = () => this._jsonNode as string; - public getChildNode = (identifier: string): ParseNode | undefined => - this._jsonNode && - typeof this._jsonNode === "object" && - (this._jsonNode as { [key: string]: any })[identifier] !== undefined - ? new JsonParseNode( - (this._jsonNode as { [key: string]: any })[identifier] - ) - : undefined; - public getBooleanValue = () => this._jsonNode as boolean; - public getNumberValue = () => this._jsonNode as number; - public getGuidValue = () => parseGuidString(this.getStringValue()); - public getDateValue = () => - this._jsonNode ? new Date(this._jsonNode as string) : undefined; - public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); - public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); - public getDurationValue = () => Duration.parse(this.getStringValue()); - public getCollectionOfPrimitiveValues = (): T[] | undefined => { - if (!Array.isArray(this._jsonNode)){ - return undefined; - } - return (this._jsonNode as unknown[]).map((x) => { - const currentParseNode = new JsonParseNode(x); - const typeOfX = typeof x; - if (typeOfX === "boolean") { - return currentParseNode.getBooleanValue() as unknown as T; - } else if (typeOfX === "string") { - return currentParseNode.getStringValue() as unknown as T; - } else if (typeOfX === "number") { - return currentParseNode.getNumberValue() as unknown as T; - } else if (x instanceof Date) { - return currentParseNode.getDateValue() as unknown as T; - } else if (x instanceof DateOnly) { - return currentParseNode.getDateValue() as unknown as T; - } else if (x instanceof TimeOnly) { - return currentParseNode.getDateValue() as unknown as T; - } else if (x instanceof Duration) { - return currentParseNode.getDateValue() as unknown as T; - } else { - throw new Error( - `encountered an unknown type during deserialization ${typeof x}` - ); - } - }); - }; - public getByteArrayValue(): ArrayBuffer | undefined { - const strValue = this.getStringValue(); - if (strValue && strValue.length > 0) { - return Buffer.from(strValue, "base64").buffer; - } - return undefined; - } - public getCollectionOfObjectValues = ( - method: ParsableFactory - ): T[] | undefined => { - if (!Array.isArray(this._jsonNode)){ - return undefined; - } - return this._jsonNode - ? (this._jsonNode as unknown[]) - .map((x) => new JsonParseNode(x)) - .map((x) => x.getObjectValue(method)) - : undefined; - }; + constructor(private readonly _jsonNode: unknown) {} + public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; + public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; + public getStringValue = () => this._jsonNode as string; + public getChildNode = (identifier: string): ParseNode | undefined => (this._jsonNode && typeof this._jsonNode === "object" && (this._jsonNode as { [key: string]: any })[identifier] !== undefined ? new JsonParseNode((this._jsonNode as { [key: string]: any })[identifier]) : undefined); + public getBooleanValue = () => this._jsonNode as boolean; + public getNumberValue = () => this._jsonNode as number; + public getGuidValue = () => parseGuidString(this.getStringValue()); + public getDateValue = () => (this._jsonNode ? new Date(this._jsonNode as string) : undefined); + public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); + public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); + public getDurationValue = () => Duration.parse(this.getStringValue()); + public getCollectionOfPrimitiveValues = (): T[] | undefined => { + if (!Array.isArray(this._jsonNode)) { + return undefined; + } + return (this._jsonNode as unknown[]).map((x) => { + const currentParseNode = new JsonParseNode(x); + const typeOfX = typeof x; + if (typeOfX === "boolean") { + return currentParseNode.getBooleanValue() as unknown as T; + } else if (typeOfX === "string") { + return currentParseNode.getStringValue() as unknown as T; + } else if (typeOfX === "number") { + return currentParseNode.getNumberValue() as unknown as T; + } else if (x instanceof Date) { + return currentParseNode.getDateValue() as unknown as T; + } else if (x instanceof DateOnly) { + return currentParseNode.getDateValue() as unknown as T; + } else if (x instanceof TimeOnly) { + return currentParseNode.getDateValue() as unknown as T; + } else if (x instanceof Duration) { + return currentParseNode.getDateValue() as unknown as T; + } else { + throw new Error(`encountered an unknown type during deserialization ${typeof x}`); + } + }); + }; + public getByteArrayValue(): ArrayBuffer | undefined { + const strValue = this.getStringValue(); + if (strValue && strValue.length > 0) { + return inNodeEnv() ? Buffer.from(strValue, "base64").buffer : new TextEncoder().encode(strValue); + } + return undefined; + } + public getCollectionOfObjectValues = (method: ParsableFactory): T[] | undefined => { + if (!Array.isArray(this._jsonNode)) { + return undefined; + } + return this._jsonNode ? (this._jsonNode as unknown[]).map((x) => new JsonParseNode(x)).map((x) => x.getObjectValue(method)) : undefined; + }; - public getObjectValue = ( - parsableFactory: ParsableFactory - ): T => { - const temp: T = {} as T; - if (isUntypedNode(parsableFactory(this)(temp))) { - const valueType = typeof this._jsonNode; - let value: T = temp; - if (valueType === "boolean") { - value = createUntypedBoolean(this._jsonNode as boolean) as any as T; - } else if (valueType === "string") { - value = createUntypedString(this._jsonNode as string) as any as T; - } else if (valueType === "number") { - value = createUntypedNumber(this._jsonNode as number) as any as T; - } else if (Array.isArray(this._jsonNode)) { - const nodes: UntypedNode[] = []; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (this._jsonNode as any[]).forEach((x) => { - nodes.push( - new JsonParseNode(x).getObjectValue( - createUntypedNodeFromDiscriminatorValue - ) - ); - }); - value = createUntypedArray(nodes) as any as T; - } else if (this._jsonNode && valueType === "object") { - const properties: Record = {}; - Object.entries(this._jsonNode as any).forEach(([k, v]) => { - properties[k] = new JsonParseNode(v).getObjectValue( - createUntypedNodeFromDiscriminatorValue - ); - }); - value = createUntypedObject(properties) as any as T; - } else if (!this._jsonNode) { - value = createUntypedNull() as any as T; - } - return value; - } - const enableBackingStore = isBackingStoreEnabled( - parsableFactory(this)(temp) - ); - const value: T = enableBackingStore - ? new Proxy(temp, createBackedModelProxyHandler()) - : temp; - if (this.onBeforeAssignFieldValues) { - this.onBeforeAssignFieldValues(value); - } - this.assignFieldValues(value, parsableFactory); - if (this.onAfterAssignFieldValues) { - this.onAfterAssignFieldValues(value); - } - return value; - }; + public getObjectValue = (parsableFactory: ParsableFactory): T => { + const temp: T = {} as T; + if (isUntypedNode(parsableFactory(this)(temp))) { + const valueType = typeof this._jsonNode; + let value: T = temp; + if (valueType === "boolean") { + value = createUntypedBoolean(this._jsonNode as boolean) as any as T; + } else if (valueType === "string") { + value = createUntypedString(this._jsonNode as string) as any as T; + } else if (valueType === "number") { + value = createUntypedNumber(this._jsonNode as number) as any as T; + } else if (Array.isArray(this._jsonNode)) { + const nodes: UntypedNode[] = []; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (this._jsonNode as any[]).forEach((x) => { + nodes.push(new JsonParseNode(x).getObjectValue(createUntypedNodeFromDiscriminatorValue)); + }); + value = createUntypedArray(nodes) as any as T; + } else if (this._jsonNode && valueType === "object") { + const properties: Record = {}; + Object.entries(this._jsonNode as any).forEach(([k, v]) => { + properties[k] = new JsonParseNode(v).getObjectValue(createUntypedNodeFromDiscriminatorValue); + }); + value = createUntypedObject(properties) as any as T; + } else if (!this._jsonNode) { + value = createUntypedNull() as any as T; + } + return value; + } + const enableBackingStore = isBackingStoreEnabled(parsableFactory(this)(temp)); + const value: T = enableBackingStore ? new Proxy(temp, createBackedModelProxyHandler()) : temp; + if (this.onBeforeAssignFieldValues) { + this.onBeforeAssignFieldValues(value); + } + this.assignFieldValues(value, parsableFactory); + if (this.onAfterAssignFieldValues) { + this.onAfterAssignFieldValues(value); + } + return value; + }; - private assignFieldValues = ( - model: T, - parsableFactory: ParsableFactory - ): void => { - const fields = parsableFactory(this)(model); - if (!this._jsonNode) return; - Object.entries(this._jsonNode as any).forEach(([k, v]) => { - const deserializer = fields[k]; - if (deserializer) { - deserializer(new JsonParseNode(v)); - } else { - // additional properties - (model as Record)[k] = v; - } - }); - }; - public getCollectionOfEnumValues = (type: any): T[] => { - if (Array.isArray(this._jsonNode)) { - return this._jsonNode - .map((x) => { - const node = new JsonParseNode(x); - return node.getEnumValue(type) as T; - }) - .filter(Boolean); - } - return []; - }; - public getEnumValue = (type: any): T | undefined => { - const rawValue = this.getStringValue(); - if (!rawValue) { - return undefined; - } - return type[toFirstCharacterUpper(rawValue)]; - }; + private assignFieldValues = (model: T, parsableFactory: ParsableFactory): void => { + const fields = parsableFactory(this)(model); + if (!this._jsonNode) return; + Object.entries(this._jsonNode as any).forEach(([k, v]) => { + const deserializer = fields[k]; + if (deserializer) { + deserializer(new JsonParseNode(v)); + } else { + // additional properties + (model as Record)[k] = v; + } + }); + }; + public getCollectionOfEnumValues = (type: any): T[] => { + if (Array.isArray(this._jsonNode)) { + return this._jsonNode + .map((x) => { + const node = new JsonParseNode(x); + return node.getEnumValue(type) as T; + }) + .filter(Boolean); + } + return []; + }; + public getEnumValue = (type: any): T | undefined => { + const rawValue = this.getStringValue(); + if (!rawValue) { + return undefined; + } + return type[toFirstCharacterUpper(rawValue)]; + }; } diff --git a/packages/serialization/json/src/jsonParseNodeFactory.ts b/packages/serialization/json/src/jsonParseNodeFactory.ts index 5274a0c66..42889849a 100644 --- a/packages/serialization/json/src/jsonParseNodeFactory.ts +++ b/packages/serialization/json/src/jsonParseNodeFactory.ts @@ -1,29 +1,32 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { ParseNode, ParseNodeFactory } from "@microsoft/kiota-abstractions"; -import { TextDecoder } from "util"; import { JsonParseNode } from "./jsonParseNode"; export class JsonParseNodeFactory implements ParseNodeFactory { - public getValidContentType(): string { - return "application/json"; - } - public getRootParseNode( - contentType: string, - content: ArrayBuffer - ): ParseNode { - if (!content) { - throw new Error("content cannot be undefined of empty"); - } else if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } else if (this.getValidContentType() !== contentType) { - throw new Error(`expected a ${this.getValidContentType()} content type`); - } - return new JsonParseNode(this.convertArrayBufferToJson(content)); - } + public getValidContentType(): string { + return "application/json"; + } + public getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode { + if (!content) { + throw new Error("content cannot be undefined of empty"); + } else if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } else if (this.getValidContentType() !== contentType) { + throw new Error(`expected a ${this.getValidContentType()} content type`); + } + return new JsonParseNode(this.convertArrayBufferToJson(content)); + } - private convertArrayBufferToJson(content: ArrayBuffer) { - const decoder = new TextDecoder(); - const contentAsStr = decoder.decode(content); - return JSON.parse(contentAsStr); - } + private convertArrayBufferToJson(content: ArrayBuffer) { + const decoder = new TextDecoder(); + const contentAsStr = decoder.decode(content); + return JSON.parse(contentAsStr); + } } diff --git a/packages/serialization/json/src/jsonSerializationWriter.ts b/packages/serialization/json/src/jsonSerializationWriter.ts index 7aba0baa8..4bf01e30f 100644 --- a/packages/serialization/json/src/jsonSerializationWriter.ts +++ b/packages/serialization/json/src/jsonSerializationWriter.ts @@ -1,287 +1,224 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /* eslint-disable @typescript-eslint/no-unused-expressions */ -import { - DateOnly, - Duration, - isUntypedNode, - type ModelSerializerFunction, - type Parsable, - type SerializationWriter, - TimeOnly, - type UntypedNode, - isUntypedBoolean, - isUntypedString, - isUntypedNull, - isUntypedNumber, - isUntypedObject, - isUntypedArray, -} from "@microsoft/kiota-abstractions"; +import { DateOnly, Duration, isUntypedNode, type ModelSerializerFunction, type Parsable, type SerializationWriter, TimeOnly, type UntypedNode, isUntypedBoolean, isUntypedString, isUntypedNull, isUntypedNumber, isUntypedObject, isUntypedArray, inNodeEnv } from "@microsoft/kiota-abstractions"; import type { Guid } from "guid-typescript"; export class JsonSerializationWriter implements SerializationWriter { - public writeByteArrayValue( - key?: string | undefined, - value?: ArrayBuffer | undefined, - ): void { - if (!value) { - throw new Error("value cannot be undefined"); - } - const b64 = Buffer.from(value).toString("base64"); - this.writeStringValue(key, b64); - } - private readonly writer: string[] = []; - private static propertySeparator = `,`; - public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; - public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; - public onStartObjectSerialization: - | ((value: Parsable, writer: SerializationWriter) => void) - | undefined; - public writeStringValue = (key?: string, value?: string): void => { - if (value !== null && value !== undefined) { - key && this.writePropertyName(key); - this.writer.push(JSON.stringify(value)); - key && this.writer.push(JsonSerializationWriter.propertySeparator); - } - }; - private writePropertyName = (key: string): void => { - this.writer.push(`"${key}":`); - }; - public writeBooleanValue = (key?: string, value?: boolean): void => { - if (value !== null && value !== undefined) { - key && this.writePropertyName(key); - this.writer.push(`${value}`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); - } - }; - public writeNumberValue = (key?: string, value?: number): void => { - if (value !== null && value !== undefined) { - key && this.writePropertyName(key); - this.writer.push(`${value}`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); - } - }; - public writeGuidValue = (key?: string, value?: Guid): void => { - if(value) { - key && this.writePropertyName(key); - this.writer.push(`"${value}"`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); - } - }; - public writeDateValue = (key?: string, value?: Date): void => this.writeStringValue(key, value?.toISOString()); - public writeDateOnlyValue = (key?: string, value?: DateOnly): void => this.writeStringValue(key, value?.toString()); - public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => this.writeStringValue(key, value?.toString()); - public writeDurationValue = (key?: string, value?: Duration): void => this.writeStringValue(key, value?.toString()); - public writeNullValue = (key?: string): void => { - key && this.writePropertyName(key); - this.writer.push(`null`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); - }; - public writeCollectionOfPrimitiveValues = ( - key?: string, - values?: T[], - ): void => { - if (values) { - key && this.writePropertyName(key); - this.writer.push(`[`); - values.forEach((v, idx) => { - this.writeAnyValue(undefined, v); - idx + 1 < values.length && - this.writer.push(JsonSerializationWriter.propertySeparator); - }); - this.writer.push(`]`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); - } - }; - public writeCollectionOfObjectValues = ( - key: string, - values: T[], - serializerMethod: ModelSerializerFunction, - ): void => { - if (values) { - key && this.writePropertyName(key); - this.writer.push(`[`); - values.forEach((v) => { - this.writeObjectValue(undefined, v, serializerMethod); - this.writer.push(JsonSerializationWriter.propertySeparator); - }); - if (values.length > 0) { - //removing the last separator - this.writer.pop(); - } - this.writer.push(`]`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); - } - }; + public writeByteArrayValue(key?: string | undefined, value?: ArrayBuffer | undefined): void { + if (!value) { + throw new Error("value cannot be undefined"); + } + const b64 = inNodeEnv() ? Buffer.from(value).toString("base64") : btoa(new TextDecoder().decode(value)); + this.writeStringValue(key, b64); + } + private readonly writer: string[] = []; + private static propertySeparator = `,`; + public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; + public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; + public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; + public writeStringValue = (key?: string, value?: string): void => { + if (value !== null && value !== undefined) { + key && this.writePropertyName(key); + this.writer.push(JSON.stringify(value)); + key && this.writer.push(JsonSerializationWriter.propertySeparator); + } + }; + private writePropertyName = (key: string): void => { + this.writer.push(`"${key}":`); + }; + public writeBooleanValue = (key?: string, value?: boolean): void => { + if (value !== null && value !== undefined) { + key && this.writePropertyName(key); + this.writer.push(`${value}`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); + } + }; + public writeNumberValue = (key?: string, value?: number): void => { + if (value !== null && value !== undefined) { + key && this.writePropertyName(key); + this.writer.push(`${value}`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); + } + }; + public writeGuidValue = (key?: string, value?: Guid): void => { + if (value) { + key && this.writePropertyName(key); + this.writer.push(`"${value}"`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); + } + }; + public writeDateValue = (key?: string, value?: Date): void => this.writeStringValue(key, value?.toISOString()); + public writeDateOnlyValue = (key?: string, value?: DateOnly): void => this.writeStringValue(key, value?.toString()); + public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => this.writeStringValue(key, value?.toString()); + public writeDurationValue = (key?: string, value?: Duration): void => this.writeStringValue(key, value?.toString()); + public writeNullValue = (key?: string): void => { + key && this.writePropertyName(key); + this.writer.push(`null`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); + }; + public writeCollectionOfPrimitiveValues = (key?: string, values?: T[]): void => { + if (values) { + key && this.writePropertyName(key); + this.writer.push(`[`); + values.forEach((v, idx) => { + this.writeAnyValue(undefined, v); + idx + 1 < values.length && this.writer.push(JsonSerializationWriter.propertySeparator); + }); + this.writer.push(`]`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); + } + }; + public writeCollectionOfObjectValues = (key: string, values: T[], serializerMethod: ModelSerializerFunction): void => { + if (values) { + key && this.writePropertyName(key); + this.writer.push(`[`); + values.forEach((v) => { + this.writeObjectValue(undefined, v, serializerMethod); + this.writer.push(JsonSerializationWriter.propertySeparator); + }); + if (values.length > 0) { + //removing the last separator + this.writer.pop(); + } + this.writer.push(`]`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); + } + }; - public writeObjectValue( - key: string | undefined, - value: T, - serializerMethod: ModelSerializerFunction, - ): void { - if (isUntypedNode(value)) { - const untypedNode = value as UntypedNode; - if (isUntypedBoolean(untypedNode)) { - this.writeBooleanValue(key, untypedNode.getValue()); - } else if (isUntypedString(untypedNode)) { - this.writeStringValue(key, untypedNode.getValue()); - } else if (isUntypedNull(untypedNode)) { - this.writeNullValue(key); - } else if (isUntypedNumber(untypedNode)) { - this.writeNumberValue(key, untypedNode.getValue()); - } else if (isUntypedObject(untypedNode)) { - const value = untypedNode.getValue(); - if (key && value) { - this.writePropertyName(key); - } - value && this.writer.push(`{`); - for (const key in value) { - this.writeObjectValue( - key, - value[key] as unknown as T, - serializerMethod, - ); - } - if ( - this.writer.length > 0 && - this.writer[this.writer.length - 1] === - JsonSerializationWriter.propertySeparator - ) { - //removing the last separator - this.writer.pop(); - } - value && this.writer.push(`}`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); - } else if (isUntypedArray(untypedNode)) { - if (key) { - this.writePropertyName(key); - } - const value = untypedNode.getValue(); - this.writer.push(`[`); - value.forEach((v, idx) => { - this.writeObjectValue(undefined, v as unknown as T, serializerMethod); - idx + 1 < value.length && - this.writer.push(JsonSerializationWriter.propertySeparator); - }); - if ( - this.writer.length > 0 && - this.writer[this.writer.length - 1] === - JsonSerializationWriter.propertySeparator - ) { - //removing the last separator - this.writer.pop(); - } - this.writer.push(`]`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); - } else { - this.writeAnyValue(key, untypedNode.getValue()); - } - return; // nothing to do here, the value has been written - } + public writeObjectValue(key: string | undefined, value: T, serializerMethod: ModelSerializerFunction): void { + if (isUntypedNode(value)) { + const untypedNode = value as UntypedNode; + if (isUntypedBoolean(untypedNode)) { + this.writeBooleanValue(key, untypedNode.getValue()); + } else if (isUntypedString(untypedNode)) { + this.writeStringValue(key, untypedNode.getValue()); + } else if (isUntypedNull(untypedNode)) { + this.writeNullValue(key); + } else if (isUntypedNumber(untypedNode)) { + this.writeNumberValue(key, untypedNode.getValue()); + } else if (isUntypedObject(untypedNode)) { + const value = untypedNode.getValue(); + if (key && value) { + this.writePropertyName(key); + } + value && this.writer.push(`{`); + for (const key in value) { + this.writeObjectValue(key, value[key] as unknown as T, serializerMethod); + } + if (this.writer.length > 0 && this.writer[this.writer.length - 1] === JsonSerializationWriter.propertySeparator) { + //removing the last separator + this.writer.pop(); + } + value && this.writer.push(`}`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); + } else if (isUntypedArray(untypedNode)) { + if (key) { + this.writePropertyName(key); + } + const value = untypedNode.getValue(); + this.writer.push(`[`); + value.forEach((v, idx) => { + this.writeObjectValue(undefined, v as unknown as T, serializerMethod); + idx + 1 < value.length && this.writer.push(JsonSerializationWriter.propertySeparator); + }); + if (this.writer.length > 0 && this.writer[this.writer.length - 1] === JsonSerializationWriter.propertySeparator) { + //removing the last separator + this.writer.pop(); + } + this.writer.push(`]`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); + } else { + this.writeAnyValue(key, untypedNode.getValue()); + } + return; // nothing to do here, the value has been written + } - if (key && value) { - this.writePropertyName(key); - } - this.onBeforeObjectSerialization && - this.onBeforeObjectSerialization(value as unknown as Parsable); - value && this.writer.push(`{`); + if (key && value) { + this.writePropertyName(key); + } + this.onBeforeObjectSerialization && this.onBeforeObjectSerialization(value as unknown as Parsable); + value && this.writer.push(`{`); - this.onStartObjectSerialization && - this.onStartObjectSerialization(value as unknown as Parsable, this); - value && serializerMethod && serializerMethod(this, value); - this.onAfterObjectSerialization && - this.onAfterObjectSerialization(value as unknown as Parsable); + this.onStartObjectSerialization && this.onStartObjectSerialization(value as unknown as Parsable, this); + value && serializerMethod && serializerMethod(this, value); + this.onAfterObjectSerialization && this.onAfterObjectSerialization(value as unknown as Parsable); - if ( - this.writer.length > 0 && - this.writer[this.writer.length - 1] === - JsonSerializationWriter.propertySeparator - ) { - //removing the last separator - this.writer.pop(); - } - value && this.writer.push(`}`); + if (this.writer.length > 0 && this.writer[this.writer.length - 1] === JsonSerializationWriter.propertySeparator) { + //removing the last separator + this.writer.pop(); + } + value && this.writer.push(`}`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); - } + key && this.writer.push(JsonSerializationWriter.propertySeparator); + } - public writeEnumValue = ( - key?: string | undefined, - ...values: (T | undefined)[] - ): void => { - if (values.length > 0) { - const rawValues = values - .filter((x) => x !== undefined) - .map((x) => `${x}`); - if (rawValues.length > 0) { - this.writeStringValue( - key, - rawValues.reduce((x, y) => `${x}, ${y}`), - ); - } - } - }; - public getSerializedContent = (): ArrayBuffer => { - return this.convertStringToArrayBuffer(this.writer.join(``)); - }; + public writeEnumValue = (key?: string | undefined, ...values: (T | undefined)[]): void => { + if (values.length > 0) { + const rawValues = values.filter((x) => x !== undefined).map((x) => `${x}`); + if (rawValues.length > 0) { + this.writeStringValue( + key, + rawValues.reduce((x, y) => `${x}, ${y}`), + ); + } + } + }; + public getSerializedContent = (): ArrayBuffer => { + return this.convertStringToArrayBuffer(this.writer.join(``)); + }; - private convertStringToArrayBuffer = (str: string): ArrayBuffer => { - const encoder = new TextEncoder(); - const encodedString = encoder.encode(str); - return encodedString.buffer; - }; + private convertStringToArrayBuffer = (str: string): ArrayBuffer => { + const encoder = new TextEncoder(); + const encodedString = encoder.encode(str); + return encodedString.buffer; + }; - public writeAdditionalData = ( - additionalData: Record | undefined, - ): void => { - // !value will fail to serialize false and null values which can be valid input - if (additionalData === undefined) return; - for (const key in additionalData) { - this.writeAnyValue(key, additionalData[key]); - } - }; + public writeAdditionalData = (additionalData: Record | undefined): void => { + // !value will fail to serialize false and null values which can be valid input + if (additionalData === undefined) return; + for (const key in additionalData) { + this.writeAnyValue(key, additionalData[key]); + } + }; - private writeNonParsableObjectValue = ( - key?: string | undefined, - value?: object | undefined, - ) => { - if (key) { - this.writePropertyName(key); - } - this.writer.push( - JSON.stringify(value), - JsonSerializationWriter.propertySeparator, - ); - }; - private writeAnyValue = ( - key?: string | undefined, - value?: unknown | undefined, - ): void => { - if (value !== undefined && value !== null) { - const valueType = typeof value; - if (valueType === "boolean") { - this.writeBooleanValue(key, value as any as boolean); - } else if (valueType === "string") { - this.writeStringValue(key, value as any as string); - } else if (value instanceof Date) { - this.writeDateValue(key, value as any as Date); - } else if (value instanceof DateOnly) { - this.writeDateOnlyValue(key, value as any as DateOnly); - } else if (value instanceof TimeOnly) { - this.writeTimeOnlyValue(key, value as any as TimeOnly); - } else if (value instanceof Duration) { - this.writeDurationValue(key, value as any as Duration); - } else if (valueType === "number") { - this.writeNumberValue(key, value as any as number); - } else if (Array.isArray(value)) { - this.writeCollectionOfPrimitiveValues(key, value); - } else if (valueType === "object") { - this.writeNonParsableObjectValue(key, value as any as object); - } else { - throw new Error( - `encountered unknown value type during serialization ${valueType}`, - ); - } - } else { - this.writeNullValue(key); - } - }; + private writeNonParsableObjectValue = (key?: string | undefined, value?: object | undefined) => { + if (key) { + this.writePropertyName(key); + } + this.writer.push(JSON.stringify(value), JsonSerializationWriter.propertySeparator); + }; + private writeAnyValue = (key?: string | undefined, value?: unknown | undefined): void => { + if (value !== undefined && value !== null) { + const valueType = typeof value; + if (valueType === "boolean") { + this.writeBooleanValue(key, value as any as boolean); + } else if (valueType === "string") { + this.writeStringValue(key, value as any as string); + } else if (value instanceof Date) { + this.writeDateValue(key, value as any as Date); + } else if (value instanceof DateOnly) { + this.writeDateOnlyValue(key, value as any as DateOnly); + } else if (value instanceof TimeOnly) { + this.writeTimeOnlyValue(key, value as any as TimeOnly); + } else if (value instanceof Duration) { + this.writeDurationValue(key, value as any as Duration); + } else if (valueType === "number") { + this.writeNumberValue(key, value as any as number); + } else if (Array.isArray(value)) { + this.writeCollectionOfPrimitiveValues(key, value); + } else if (valueType === "object") { + this.writeNonParsableObjectValue(key, value as any as object); + } else { + throw new Error(`encountered unknown value type during serialization ${valueType}`); + } + } else { + this.writeNullValue(key); + } + }; } diff --git a/packages/serialization/json/src/jsonSerializationWriterFactory.ts b/packages/serialization/json/src/jsonSerializationWriterFactory.ts index 521b6f3fd..623e2fd3d 100644 --- a/packages/serialization/json/src/jsonSerializationWriterFactory.ts +++ b/packages/serialization/json/src/jsonSerializationWriterFactory.ts @@ -1,21 +1,24 @@ -import type { - SerializationWriter, - SerializationWriterFactory, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import type { SerializationWriter, SerializationWriterFactory } from "@microsoft/kiota-abstractions"; import { JsonSerializationWriter } from "./jsonSerializationWriter"; -export class JsonSerializationWriterFactory - implements SerializationWriterFactory { - public getValidContentType(): string { - return "application/json"; - } - public getSerializationWriter(contentType: string): SerializationWriter { - if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } else if (this.getValidContentType() !== contentType) { - throw new Error(`expected a ${this.getValidContentType()} content type`); - } - return new JsonSerializationWriter(); - } +export class JsonSerializationWriterFactory implements SerializationWriterFactory { + public getValidContentType(): string { + return "application/json"; + } + public getSerializationWriter(contentType: string): SerializationWriter { + if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } else if (this.getValidContentType() !== contentType) { + throw new Error(`expected a ${this.getValidContentType()} content type`); + } + return new JsonSerializationWriter(); + } } diff --git a/packages/serialization/json/test/browser/index.ts b/packages/serialization/json/test/browser/index.ts index 1d1e75bfa..0ffc8ef34 100644 --- a/packages/serialization/json/test/browser/index.ts +++ b/packages/serialization/json/test/browser/index.ts @@ -1 +1,8 @@ -export * from "../common/jsonParseNodeFactory"; \ No newline at end of file +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +export * from "../common/jsonParseNodeFactory"; diff --git a/packages/serialization/json/test/common/JsonParseNode.ts b/packages/serialization/json/test/common/JsonParseNode.ts index 84e2113d3..f43745f8b 100644 --- a/packages/serialization/json/test/common/JsonParseNode.ts +++ b/packages/serialization/json/test/common/JsonParseNode.ts @@ -1,260 +1,243 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { JsonParseNode } from "../../src/index"; -import { - createTestParserFromDiscriminatorValue, - type TestBackedModel, - createTestBackedModelFromDiscriminatorValue, - type TestParser -} from "./testEntity"; +import { createTestParserFromDiscriminatorValue, type TestBackedModel, createTestBackedModelFromDiscriminatorValue, type TestParser } from "./testEntity"; import { UntypedTestEntity, createUntypedTestEntityFromDiscriminatorValue } from "./untypedTestEntiy"; import { UntypedNode, UntypedObject, isUntypedArray, isUntypedBoolean, isUntypedNode, isUntypedNumber, isUntypedObject } from "@microsoft/kiota-abstractions"; describe("JsonParseNode", () => { - it("jsonParseNode:initializes", async () => { - const jsonParseNode = new JsonParseNode(null); - assert.isDefined(jsonParseNode); - }); - - it("Test object creation", async () => { - const result = new JsonParseNode(null).getObjectValue( - createTestParserFromDiscriminatorValue - ); - assert.isDefined(result); - - const stringValueResult = new JsonParseNode({ - testCollection: ["2", "3"], - testString: "test", - additionalProperty: "addnProp", - }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; - assert.equal(stringValueResult.testCollection?.length, 2); - assert.equal(stringValueResult.testCollection?.shift(), "2"); - }); - - it("Test date value hydration", async () => { - const dateStr = "2023-08-31T00:00:00Z"; - const jsDate = new Date(dateStr); - - const stringValueResult = new JsonParseNode({ - testDate: dateStr - }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; - - assert.equal(stringValueResult.testDate?.getTime(), jsDate.getTime()); - }); - - it("Test undefined dates staying as undefined", async () => { - const stringValueResult = new JsonParseNode({ - testDate: undefined - }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; - - assert.equal(stringValueResult.testDate, undefined); - - }); - - it("Test enum values", async () => { - const TestEnumObject = { - A: "a", - B: "b", - C: "c" - } as const; - - type TestEnum = (typeof TestEnumObject)[keyof typeof TestEnumObject]; - - const result = new JsonParseNode([ - "a", - "b", - "c" - ]).getCollectionOfEnumValues(TestEnumObject) as TestEnum[]; - assert.equal(result.length, 3); - assert.equal(result.shift(), "a"); - - const enumValuesResult = new JsonParseNode([ - "d", - "b", - "c" - ]).getCollectionOfEnumValues(TestEnumObject) as TestEnum[]; - assert.equal(enumValuesResult.length, 2); - assert.equal(enumValuesResult.shift(), "b") - - const enumValueResult = new JsonParseNode( - "a" - ).getEnumValue(TestEnumObject) as TestEnum; - assert.equal(enumValueResult, TestEnumObject.A); - }); - - it("Test a null collection of object values", async () => { - const result = new JsonParseNode({ - "foos": [ - { - "id": "b089d1f1-e527-4b8a-ba96-094922af6e40", - "bars": null - } - ] - }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; - assert.equal(result.foos![0].bars, undefined); - }); - - it("Test collection of object values", async () => { - const result = new JsonParseNode({ - "foos": [ - { - "id": "b089d1f1-e527-4b8a-ba96-094922af6e40", - "bars": [ - { - "propA": "property A test value", - "propB": "property B test value", - "propC": null - } - ] - } - ] - }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; - assert.equal(result.foos![0].bars![0].propA, "property A test value"); - }); - - it("Test collection of backed object values", async () => { - const result = new JsonParseNode({ - "foos": [ - { - "id": "b089d1f1-e527-4b8a-ba96-094922af6e40", - "bars": [ - { - "propA": "property A test value", - "propB": "property B test value", - "propC": null - } - ] - } - ] - }).getObjectValue(createTestBackedModelFromDiscriminatorValue) as TestBackedModel; - assert.equal(result.foos![0].bars![0].propA, "property A test value"); - const backingStore = result.backingStore; - result.testString = "test"; - assert.equal(backingStore?.get("testString"), "test"); - }); - - it("backing store shouldn't interfere with JSON.stringify", async () => { - - const jsonObject = { - "foos": [ - { - "id": "b089d1f1-e527-4b8a-ba96-094922af6e40", - "bars": [ - { - "propA": "property A test value", - "propB": "property B test value" - } - ] - } - ] - }; - - const result = new JsonParseNode(jsonObject).getObjectValue(createTestBackedModelFromDiscriminatorValue) as TestBackedModel; - assert.equal(result.foos![0].bars![0].propA, "property A test value"); - let jsonObjectStr = JSON.stringify(jsonObject); - let resultStr = JSON.stringify(result); - assert.equal(jsonObjectStr, resultStr); - - // update the object then check stringify again - result.testString = "testStringValue"; - jsonObjectStr = JSON.stringify(jsonObject); - resultStr = JSON.stringify(result); - assert.notEqual(jsonObjectStr, resultStr); - - // update the backing store and check stringify again - const updateTestStrValue = "test string value"; - const backingStore = result.backingStore; - backingStore?.set("testString", updateTestStrValue); - const updatedJsonObject = {...jsonObject, testString: updateTestStrValue}; - jsonObjectStr = JSON.stringify(updatedJsonObject); - resultStr = JSON.stringify(result); - assert.equal(jsonObjectStr, resultStr); - }); - - it("untyped nodes are deserialized correctly", async () => { - const jsonObject = { - id: "1", - title: "title", - location: { - address: { - city: "Redmond", - postalCode: "98052", - state: "Washington", - street: "NE 36th St", - }, - coordinates: { - latitude: 47.678581, - longitude: -122.131577, - }, - displayName: "Microsoft Building 25", - floorCount: 50, - hasReception: true, - contact: null, - }, - keywords: [ - { - created: "2023-07-26T10:41:26Z", - label: "Keyword1", - termGuid: "10e9cc83-b5a4-4c8d-8dab-4ada1252dd70", - wssId: 6442450941, - }, - { - created: "2023-07-26T10:51:26Z", - label: "Keyword2", - termGuid: "2cae6c6a-9bb8-4a78-afff-81b88e735fef", - wssId: 6442450942, - }, - ], - extra: { - value: { - createdDateTime: { - value: "2024-01-15T00:00:00+00:00", - }, - }, - }, - table: [ - [1, 2, 3], - [4, 5, 6], - [7, 8, 9], - ], - }; - - const result = new JsonParseNode(jsonObject).getObjectValue( - createUntypedTestEntityFromDiscriminatorValue, - ) as UntypedTestEntity; - assert.equal(result.id, "1"); - assert.equal(result.title, "title"); - assert.isNotNull(result.location); - assert.isTrue(isUntypedNode(result.location)); - const location = result.location as UntypedObject; - const locationProperties = location.getValue(); - assert.isTrue(isUntypedObject(location)); - assert.isTrue(isUntypedObject(locationProperties["address"])); - assert.isTrue(isUntypedObject(locationProperties["coordinates"])); - assert.isTrue(isUntypedBoolean(locationProperties["hasReception"])); - assert.isTrue(isUntypedNumber(locationProperties["floorCount"])); - assert.isTrue(isUntypedBoolean(locationProperties["hasReception"])); - assert.equal(locationProperties["hasReception"].getValue(), true); - assert.equal(locationProperties["contact"].getValue(), null); - assert.equal(locationProperties["floorCount"].getValue(), 50); - const keywords = result.keywords as UntypedNode; - assert.isTrue(isUntypedArray(keywords)); - assert.equal( - locationProperties["displayName"].getValue(), - "Microsoft Building 25", - ); - const table = result.table as UntypedNode; - if (isUntypedArray(table)) { - table.getValue().forEach((row) => { - if (isUntypedArray(row)) { - row.getValue().forEach((cell) => { - assert.isTrue(isUntypedNumber(cell)); - }); - } else { - assert.fail("Expected row to be an array"); - } - }); - } else { - assert.fail("Expected table to be an array"); - } - }); + it("jsonParseNode:initializes", async () => { + const jsonParseNode = new JsonParseNode(null); + assert.isDefined(jsonParseNode); + }); + + it("Test object creation", async () => { + const result = new JsonParseNode(null).getObjectValue(createTestParserFromDiscriminatorValue); + assert.isDefined(result); + + const stringValueResult = new JsonParseNode({ + testCollection: ["2", "3"], + testString: "test", + additionalProperty: "addnProp", + }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; + assert.equal(stringValueResult.testCollection?.length, 2); + assert.equal(stringValueResult.testCollection?.shift(), "2"); + }); + + it("Test date value hydration", async () => { + const dateStr = "2023-08-31T00:00:00Z"; + const jsDate = new Date(dateStr); + + const stringValueResult = new JsonParseNode({ + testDate: dateStr, + }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; + + assert.equal(stringValueResult.testDate?.getTime(), jsDate.getTime()); + }); + + it("Test undefined dates staying as undefined", async () => { + const stringValueResult = new JsonParseNode({ + testDate: undefined, + }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; + + assert.equal(stringValueResult.testDate, undefined); + }); + + it("Test enum values", async () => { + const TestEnumObject = { + A: "a", + B: "b", + C: "c", + } as const; + + type TestEnum = (typeof TestEnumObject)[keyof typeof TestEnumObject]; + + const result = new JsonParseNode(["a", "b", "c"]).getCollectionOfEnumValues(TestEnumObject) as TestEnum[]; + assert.equal(result.length, 3); + assert.equal(result.shift(), "a"); + + const enumValuesResult = new JsonParseNode(["d", "b", "c"]).getCollectionOfEnumValues(TestEnumObject) as TestEnum[]; + assert.equal(enumValuesResult.length, 2); + assert.equal(enumValuesResult.shift(), "b"); + + const enumValueResult = new JsonParseNode("a").getEnumValue(TestEnumObject) as TestEnum; + assert.equal(enumValueResult, TestEnumObject.A); + }); + + it("Test a null collection of object values", async () => { + const result = new JsonParseNode({ + foos: [ + { + id: "b089d1f1-e527-4b8a-ba96-094922af6e40", + bars: null, + }, + ], + }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; + assert.equal(result.foos![0].bars, undefined); + }); + + it("Test collection of object values", async () => { + const result = new JsonParseNode({ + foos: [ + { + id: "b089d1f1-e527-4b8a-ba96-094922af6e40", + bars: [ + { + propA: "property A test value", + propB: "property B test value", + propC: null, + }, + ], + }, + ], + }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; + assert.equal(result.foos![0].bars![0].propA, "property A test value"); + }); + + it("Test collection of backed object values", async () => { + const result = new JsonParseNode({ + foos: [ + { + id: "b089d1f1-e527-4b8a-ba96-094922af6e40", + bars: [ + { + propA: "property A test value", + propB: "property B test value", + propC: null, + }, + ], + }, + ], + }).getObjectValue(createTestBackedModelFromDiscriminatorValue) as TestBackedModel; + assert.equal(result.foos![0].bars![0].propA, "property A test value"); + const backingStore = result.backingStore; + result.testString = "test"; + assert.equal(backingStore?.get("testString"), "test"); + }); + + it("backing store shouldn't interfere with JSON.stringify", async () => { + const jsonObject = { + foos: [ + { + id: "b089d1f1-e527-4b8a-ba96-094922af6e40", + bars: [ + { + propA: "property A test value", + propB: "property B test value", + }, + ], + }, + ], + }; + + const result = new JsonParseNode(jsonObject).getObjectValue(createTestBackedModelFromDiscriminatorValue) as TestBackedModel; + assert.equal(result.foos![0].bars![0].propA, "property A test value"); + let jsonObjectStr = JSON.stringify(jsonObject); + let resultStr = JSON.stringify(result); + assert.equal(jsonObjectStr, resultStr); + + // update the object then check stringify again + result.testString = "testStringValue"; + jsonObjectStr = JSON.stringify(jsonObject); + resultStr = JSON.stringify(result); + assert.notEqual(jsonObjectStr, resultStr); + + // update the backing store and check stringify again + const updateTestStrValue = "test string value"; + const backingStore = result.backingStore; + backingStore?.set("testString", updateTestStrValue); + const updatedJsonObject = { ...jsonObject, testString: updateTestStrValue }; + jsonObjectStr = JSON.stringify(updatedJsonObject); + resultStr = JSON.stringify(result); + assert.equal(jsonObjectStr, resultStr); + }); + + it("untyped nodes are deserialized correctly", async () => { + const jsonObject = { + id: "1", + title: "title", + location: { + address: { + city: "Redmond", + postalCode: "98052", + state: "Washington", + street: "NE 36th St", + }, + coordinates: { + latitude: 47.678581, + longitude: -122.131577, + }, + displayName: "Microsoft Building 25", + floorCount: 50, + hasReception: true, + contact: null, + }, + keywords: [ + { + created: "2023-07-26T10:41:26Z", + label: "Keyword1", + termGuid: "10e9cc83-b5a4-4c8d-8dab-4ada1252dd70", + wssId: 6442450941, + }, + { + created: "2023-07-26T10:51:26Z", + label: "Keyword2", + termGuid: "2cae6c6a-9bb8-4a78-afff-81b88e735fef", + wssId: 6442450942, + }, + ], + extra: { + value: { + createdDateTime: { + value: "2024-01-15T00:00:00+00:00", + }, + }, + }, + table: [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9], + ], + }; + + const result = new JsonParseNode(jsonObject).getObjectValue(createUntypedTestEntityFromDiscriminatorValue) as UntypedTestEntity; + assert.equal(result.id, "1"); + assert.equal(result.title, "title"); + assert.isNotNull(result.location); + assert.isTrue(isUntypedNode(result.location)); + const location = result.location as UntypedObject; + const locationProperties = location.getValue(); + assert.isTrue(isUntypedObject(location)); + assert.isTrue(isUntypedObject(locationProperties["address"])); + assert.isTrue(isUntypedObject(locationProperties["coordinates"])); + assert.isTrue(isUntypedBoolean(locationProperties["hasReception"])); + assert.isTrue(isUntypedNumber(locationProperties["floorCount"])); + assert.isTrue(isUntypedBoolean(locationProperties["hasReception"])); + assert.equal(locationProperties["hasReception"].getValue(), true); + assert.equal(locationProperties["contact"].getValue(), null); + assert.equal(locationProperties["floorCount"].getValue(), 50); + const keywords = result.keywords as UntypedNode; + assert.isTrue(isUntypedArray(keywords)); + assert.equal(locationProperties["displayName"].getValue(), "Microsoft Building 25"); + const table = result.table as UntypedNode; + if (isUntypedArray(table)) { + table.getValue().forEach((row) => { + if (isUntypedArray(row)) { + row.getValue().forEach((cell) => { + assert.isTrue(isUntypedNumber(cell)); + }); + } else { + assert.fail("Expected row to be an array"); + } + }); + } else { + assert.fail("Expected table to be an array"); + } + }); }); diff --git a/packages/serialization/json/test/common/jsonParseNodeFactory.ts b/packages/serialization/json/test/common/jsonParseNodeFactory.ts index 4d33ae3a4..e1632db5d 100644 --- a/packages/serialization/json/test/common/jsonParseNodeFactory.ts +++ b/packages/serialization/json/test/common/jsonParseNodeFactory.ts @@ -1,21 +1,27 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { JsonParseNodeFactory } from "../../src/index"; describe("jsonParseNodeFactory", () => { - it("jsonParseNodeFactory", async () => { - const jsonParseNodeFactory = new JsonParseNodeFactory(); - assert.isDefined(jsonParseNodeFactory); - }); - it("jsonParseNodeFactory:convertArrayBufferToJson should convert an array to json", async () => { - const jsonParseNodeFactory = new JsonParseNodeFactory(); + it("jsonParseNodeFactory", async () => { + const jsonParseNodeFactory = new JsonParseNodeFactory(); + assert.isDefined(jsonParseNodeFactory); + }); + it("jsonParseNodeFactory:convertArrayBufferToJson should convert an array to json", async () => { + const jsonParseNodeFactory = new JsonParseNodeFactory(); - const expectedJson = '{ "subject": "subject-value" }'; - const sampleArrayBuffer = new TextEncoder().encode(expectedJson); + const expectedJson = '{ "subject": "subject-value" }'; + const sampleArrayBuffer = new TextEncoder().encode(expectedJson); - const outputJson = - jsonParseNodeFactory["convertArrayBufferToJson"](sampleArrayBuffer); + const outputJson = jsonParseNodeFactory["convertArrayBufferToJson"](sampleArrayBuffer); - assert.equal(outputJson.subject, JSON.parse(expectedJson).subject); - }); + assert.equal(outputJson.subject, JSON.parse(expectedJson).subject); + }); }); diff --git a/packages/serialization/json/test/common/jsonSerializationWriter.ts b/packages/serialization/json/test/common/jsonSerializationWriter.ts index f4ec80624..1992f68d8 100644 --- a/packages/serialization/json/test/common/jsonSerializationWriter.ts +++ b/packages/serialization/json/test/common/jsonSerializationWriter.ts @@ -1,239 +1,233 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it, beforeEach } from "vitest"; import { JsonParseNode, JsonSerializationWriter } from "../../src/index"; -import { - createTestBackedModelFromDiscriminatorValue, - createTestParserFromDiscriminatorValue, - serializeTestParser, - TestBackedModel, - type TestParser, -} from "./testEntity"; +import { createTestBackedModelFromDiscriminatorValue, createTestParserFromDiscriminatorValue, serializeTestParser, TestBackedModel, type TestParser } from "./testEntity"; import { UntypedTestEntity, serializeUntypedTestEntity } from "./untypedTestEntiy"; import { BackingStore, BackingStoreFactorySingleton, createBackedModelProxyHandler, createUntypedArray, createUntypedBoolean, createUntypedNull, createUntypedNumber, createUntypedObject, createUntypedString } from "@microsoft/kiota-abstractions"; describe("JsonParseNode", () => { - let backingStoreFactorySingleton: BackingStoreFactorySingleton; - const dummyBackingStore = {} as BackingStore; - - beforeEach(() => { - backingStoreFactorySingleton = BackingStoreFactorySingleton.instance; - }); - - it("Test object serialization", async () => { - const testDate = new Date(); - const inputObject: TestParser = { - testCollection: ["2", "3"], - testString: "test", - testComplexString: - "A more \"complex\" string with \r\nlinebreaks and 'weird' characters", - testObject: { - additionalData: { - testObjectName: "str", - testObjectProp: { - someValue: 123, - }, - }, - }, - testDate, - }; - const expectedObject: TestParser = { - testCollection: ["2", "3"], - testString: "test", - testComplexString: - "A more \"complex\" string with \r\nlinebreaks and 'weird' characters", - testObject: { - testObjectName: "str", - testObjectProp: { - someValue: 123, - }, - }, - testDate, - }; - - const writer = new JsonSerializationWriter(); - writer.writeObjectValue("", inputObject, serializeTestParser); - const serializedContent = writer.getSerializedContent(); - const decoder = new TextDecoder(); - const contentAsStr = decoder.decode(serializedContent); - const result = JSON.parse(contentAsStr); - const stringValueResult = new JsonParseNode(result).getObjectValue( - createTestParserFromDiscriminatorValue, - ) as TestParser; - assert.deepEqual(stringValueResult, expectedObject); - }); - - it("encodes characters properly", async () => { - const inputObject: TestParser = { - testCollection: ["2", "3"], - testString: "test", - testComplexString: "BÅ‚onie", - testObject: { - additionalData: { - testObjectName: "str", - testObjectProp: { - someValue: 123, - }, - }, - }, - }; - const writer = new JsonSerializationWriter(); - writer.writeObjectValue("", inputObject, serializeTestParser); - const serializedContent = writer.getSerializedContent(); - const decoder = new TextDecoder(); - const contentAsStr = decoder.decode(serializedContent); - const result = JSON.parse(contentAsStr); - assert.equal(result.testComplexString, "BÅ‚onie"); - }); - - it("skip undefined objects from json body", async () => { - const inputObject: TestParser = { - testCollection: undefined, - testString: "test", - testObject: undefined, - }; - const writer = new JsonSerializationWriter(); - writer.writeObjectValue("", inputObject, serializeTestParser); - const serializedContent = writer.getSerializedContent(); - const decoder = new TextDecoder(); - const contentAsStr = decoder.decode(serializedContent); - const result = JSON.parse(contentAsStr); - assert.isFalse("testCollection" in result); - assert.isTrue("testString" in result); - assert.isFalse("testObject" in result); - }); - - it("skip undefined objects from json body boolean value", async () => { - const inputObject: TestParser = { - testCollection: undefined, - testString: "test", - testObject: undefined, - testBoolean: false, - id: "l", - testNumber: 0, - testGuid: undefined, - }; - - const writer = new JsonSerializationWriter(); - writer.writeObjectValue("", inputObject, serializeTestParser); - const serializedContent = writer.getSerializedContent(); - const decoder = new TextDecoder(); - const contentAsStr = decoder.decode(serializedContent); - const result = JSON.parse(contentAsStr); - - assert.isFalse("testCollection" in result); - assert.isTrue("testString" in result); - assert.isFalse("testObject" in result); - assert.isFalse("testGuid" in result); - assert.isTrue("testBoolean" in result); - assert.isTrue("id" in result); - }); - - it("skip undefined objects from json body when Backing store enabled", async () => { - const jsonObject = { - "testCollection": ["2", "3"], - "testString": undefined, - "testNumber": 0, - "testBoolean": false, - "id":"", // empty string are not skipped - "testGuid": "b089d1f1-e527-4b8a-ba96-094922af6e40", - "foos": [ - { - "id": "b089d1f1-e527-4b8a-ba96-094922af6e40", - "bars": [ - { - "propA": "property A test value", - "propB": "property B test value" - } - ] - } - ] - }; - - const backedModel: TestBackedModel = new JsonParseNode(jsonObject).getObjectValue(createTestBackedModelFromDiscriminatorValue) as TestBackedModel; - - const writer = new JsonSerializationWriter(); - writer.writeObjectValue("", backedModel, serializeTestParser); - const serializedContent = writer.getSerializedContent(); - const decoder = new TextDecoder(); - const contentAsStr = decoder.decode(serializedContent); - const result = JSON.parse(contentAsStr); - - assert.isTrue("testCollection" in result); - assert.isTrue("foos" in result); - assert.isFalse("testObject" in result); - assert.isFalse("testString" in result); - assert.isTrue("testNumber" in result); - assert.isTrue("id" in result); - assert.isTrue("testGuid" in result); - - const handler = createBackedModelProxyHandler(); - const model = new Proxy({backingStore: dummyBackingStore}, handler); - model.id = "abc"; - model.testCollection = ["2", "3"]; - model.testString = "test"; - - const modelWriter = new JsonSerializationWriter(); - modelWriter.writeObjectValue("", model, serializeTestParser); - const serializedModelContent = modelWriter.getSerializedContent(); - const modelContentAsString = decoder.decode(serializedModelContent); - const modelResult = JSON.parse(modelContentAsString); - - assert.isTrue("id" in modelResult); - assert.isTrue("testCollection" in modelResult); - assert.isFalse("testObject" in modelResult); - assert.isTrue("testString" in modelResult); - // backingStore property shouldn't be part of the serialized content - assert.isFalse("backingStore:" in modelResult); - }); - - it("serializes untyped nodes as expected", async () => { - const inputObject: UntypedTestEntity = { - id: "1", - title: "title", - location: createUntypedObject({ - address: createUntypedObject({ - city: createUntypedString("Redmond"), - postalCode: createUntypedString("98052"), - state: createUntypedString("Washington"), - street: createUntypedString("NE 36th St"), - }), - coordinates: createUntypedObject({ - latitude: createUntypedNumber(47.678581), - longitude: createUntypedNumber(-122.131577), - }), - displayName: createUntypedString("Microsoft Building 25"), - floorCount: createUntypedNumber(50), - hasReception: createUntypedBoolean(true), - contact: createUntypedNull(), - }), - keywords: createUntypedArray([ - createUntypedObject({ - created: createUntypedString("2023-07-26T10:41:26Z"), - label: createUntypedString("Keyword1"), - termGuid: createUntypedString("10e9cc83-b5a4-4c8d-8dab-4ada1252dd70"), - wssId: createUntypedNumber(6442450941), - }), - createUntypedObject({ - created: createUntypedString("2023-07-26T10:51:26Z"), - label: createUntypedString("Keyword2"), - termGuid: createUntypedString("2cae6c6a-9bb8-4a78-afff-81b88e735fef"), - wssId: createUntypedNumber(6442450942), - }), - ]), - additionalData: { - extra: createUntypedObject({ - createdDateTime: createUntypedString("2024-01-15T00:00:00+00:00"), - }), - }, - }; - const writer = new JsonSerializationWriter(); - writer.writeObjectValue("", inputObject, serializeUntypedTestEntity); - const serializedContent = writer.getSerializedContent(); - const decoder = new TextDecoder(); - const contentAsStr = decoder.decode(serializedContent); - assert.equal( - '{"id":"1","title":"title","location":{"address":{"city":"Redmond","postalCode":"98052","state":"Washington","street":"NE 36th St"},"coordinates":{"latitude":47.678581,"longitude":-122.131577},"displayName":"Microsoft Building 25","floorCount":50,"hasReception":true,"contact":null},"keywords":[{"created":"2023-07-26T10:41:26Z","label":"Keyword1","termGuid":"10e9cc83-b5a4-4c8d-8dab-4ada1252dd70","wssId":6442450941},{"created":"2023-07-26T10:51:26Z","label":"Keyword2","termGuid":"2cae6c6a-9bb8-4a78-afff-81b88e735fef","wssId":6442450942}],"extra":{"value":{"createdDateTime":{"value":"2024-01-15T00:00:00+00:00"}}}}', - contentAsStr, - ); - }); + let backingStoreFactorySingleton: BackingStoreFactorySingleton; + const dummyBackingStore = {} as BackingStore; + + beforeEach(() => { + backingStoreFactorySingleton = BackingStoreFactorySingleton.instance; + }); + + it("Test object serialization", async () => { + const testDate = new Date(); + const inputObject: TestParser = { + testCollection: ["2", "3"], + testString: "test", + testComplexString: "A more \"complex\" string with \r\nlinebreaks and 'weird' characters", + testObject: { + additionalData: { + testObjectName: "str", + testObjectProp: { + someValue: 123, + }, + }, + }, + testDate, + }; + const expectedObject: TestParser = { + testCollection: ["2", "3"], + testString: "test", + testComplexString: "A more \"complex\" string with \r\nlinebreaks and 'weird' characters", + testObject: { + testObjectName: "str", + testObjectProp: { + someValue: 123, + }, + }, + testDate, + }; + + const writer = new JsonSerializationWriter(); + writer.writeObjectValue("", inputObject, serializeTestParser); + const serializedContent = writer.getSerializedContent(); + const decoder = new TextDecoder(); + const contentAsStr = decoder.decode(serializedContent); + const result = JSON.parse(contentAsStr); + const stringValueResult = new JsonParseNode(result).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; + assert.deepEqual(stringValueResult, expectedObject); + }); + + it("encodes characters properly", async () => { + const inputObject: TestParser = { + testCollection: ["2", "3"], + testString: "test", + testComplexString: "BÅ‚onie", + testObject: { + additionalData: { + testObjectName: "str", + testObjectProp: { + someValue: 123, + }, + }, + }, + }; + const writer = new JsonSerializationWriter(); + writer.writeObjectValue("", inputObject, serializeTestParser); + const serializedContent = writer.getSerializedContent(); + const decoder = new TextDecoder(); + const contentAsStr = decoder.decode(serializedContent); + const result = JSON.parse(contentAsStr); + assert.equal(result.testComplexString, "BÅ‚onie"); + }); + + it("skip undefined objects from json body", async () => { + const inputObject: TestParser = { + testCollection: undefined, + testString: "test", + testObject: undefined, + }; + const writer = new JsonSerializationWriter(); + writer.writeObjectValue("", inputObject, serializeTestParser); + const serializedContent = writer.getSerializedContent(); + const decoder = new TextDecoder(); + const contentAsStr = decoder.decode(serializedContent); + const result = JSON.parse(contentAsStr); + assert.isFalse("testCollection" in result); + assert.isTrue("testString" in result); + assert.isFalse("testObject" in result); + }); + + it("skip undefined objects from json body boolean value", async () => { + const inputObject: TestParser = { + testCollection: undefined, + testString: "test", + testObject: undefined, + testBoolean: false, + id: "l", + testNumber: 0, + testGuid: undefined, + }; + + const writer = new JsonSerializationWriter(); + writer.writeObjectValue("", inputObject, serializeTestParser); + const serializedContent = writer.getSerializedContent(); + const decoder = new TextDecoder(); + const contentAsStr = decoder.decode(serializedContent); + const result = JSON.parse(contentAsStr); + + assert.isFalse("testCollection" in result); + assert.isTrue("testString" in result); + assert.isFalse("testObject" in result); + assert.isFalse("testGuid" in result); + assert.isTrue("testBoolean" in result); + assert.isTrue("id" in result); + }); + + it("skip undefined objects from json body when Backing store enabled", async () => { + const jsonObject = { + testCollection: ["2", "3"], + testString: undefined, + testNumber: 0, + testBoolean: false, + id: "", // empty string are not skipped + testGuid: "b089d1f1-e527-4b8a-ba96-094922af6e40", + foos: [ + { + id: "b089d1f1-e527-4b8a-ba96-094922af6e40", + bars: [ + { + propA: "property A test value", + propB: "property B test value", + }, + ], + }, + ], + }; + + const backedModel: TestBackedModel = new JsonParseNode(jsonObject).getObjectValue(createTestBackedModelFromDiscriminatorValue) as TestBackedModel; + + const writer = new JsonSerializationWriter(); + writer.writeObjectValue("", backedModel, serializeTestParser); + const serializedContent = writer.getSerializedContent(); + const decoder = new TextDecoder(); + const contentAsStr = decoder.decode(serializedContent); + const result = JSON.parse(contentAsStr); + + assert.isTrue("testCollection" in result); + assert.isTrue("foos" in result); + assert.isFalse("testObject" in result); + assert.isFalse("testString" in result); + assert.isTrue("testNumber" in result); + assert.isTrue("id" in result); + assert.isTrue("testGuid" in result); + + const handler = createBackedModelProxyHandler(); + const model = new Proxy({ backingStore: dummyBackingStore }, handler); + model.id = "abc"; + model.testCollection = ["2", "3"]; + model.testString = "test"; + + const modelWriter = new JsonSerializationWriter(); + modelWriter.writeObjectValue("", model, serializeTestParser); + const serializedModelContent = modelWriter.getSerializedContent(); + const modelContentAsString = decoder.decode(serializedModelContent); + const modelResult = JSON.parse(modelContentAsString); + + assert.isTrue("id" in modelResult); + assert.isTrue("testCollection" in modelResult); + assert.isFalse("testObject" in modelResult); + assert.isTrue("testString" in modelResult); + // backingStore property shouldn't be part of the serialized content + assert.isFalse("backingStore:" in modelResult); + }); + + it("serializes untyped nodes as expected", async () => { + const inputObject: UntypedTestEntity = { + id: "1", + title: "title", + location: createUntypedObject({ + address: createUntypedObject({ + city: createUntypedString("Redmond"), + postalCode: createUntypedString("98052"), + state: createUntypedString("Washington"), + street: createUntypedString("NE 36th St"), + }), + coordinates: createUntypedObject({ + latitude: createUntypedNumber(47.678581), + longitude: createUntypedNumber(-122.131577), + }), + displayName: createUntypedString("Microsoft Building 25"), + floorCount: createUntypedNumber(50), + hasReception: createUntypedBoolean(true), + contact: createUntypedNull(), + }), + keywords: createUntypedArray([ + createUntypedObject({ + created: createUntypedString("2023-07-26T10:41:26Z"), + label: createUntypedString("Keyword1"), + termGuid: createUntypedString("10e9cc83-b5a4-4c8d-8dab-4ada1252dd70"), + wssId: createUntypedNumber(6442450941), + }), + createUntypedObject({ + created: createUntypedString("2023-07-26T10:51:26Z"), + label: createUntypedString("Keyword2"), + termGuid: createUntypedString("2cae6c6a-9bb8-4a78-afff-81b88e735fef"), + wssId: createUntypedNumber(6442450942), + }), + ]), + additionalData: { + extra: createUntypedObject({ + createdDateTime: createUntypedString("2024-01-15T00:00:00+00:00"), + }), + }, + }; + const writer = new JsonSerializationWriter(); + writer.writeObjectValue("", inputObject, serializeUntypedTestEntity); + const serializedContent = writer.getSerializedContent(); + const decoder = new TextDecoder(); + const contentAsStr = decoder.decode(serializedContent); + assert.equal('{"id":"1","title":"title","location":{"address":{"city":"Redmond","postalCode":"98052","state":"Washington","street":"NE 36th St"},"coordinates":{"latitude":47.678581,"longitude":-122.131577},"displayName":"Microsoft Building 25","floorCount":50,"hasReception":true,"contact":null},"keywords":[{"created":"2023-07-26T10:41:26Z","label":"Keyword1","termGuid":"10e9cc83-b5a4-4c8d-8dab-4ada1252dd70","wssId":6442450941},{"created":"2023-07-26T10:51:26Z","label":"Keyword2","termGuid":"2cae6c6a-9bb8-4a78-afff-81b88e735fef","wssId":6442450942}],"extra":{"value":{"createdDateTime":{"value":"2024-01-15T00:00:00+00:00"}}}}', contentAsStr); + }); }); diff --git a/packages/serialization/json/test/common/kiotaSerializer.ts b/packages/serialization/json/test/common/kiotaSerializer.ts index 2aeb0ca01..96c472705 100644 --- a/packages/serialization/json/test/common/kiotaSerializer.ts +++ b/packages/serialization/json/test/common/kiotaSerializer.ts @@ -1,289 +1,150 @@ -import { - deserialize, - deserializeCollection, - deserializeFromJson, - type ModelSerializerFunction, - type Parsable, - type ParsableFactory, - type ParseNode, - type ParseNodeFactory, - ParseNodeFactoryRegistry, - type SerializationWriter, - type SerializationWriterFactory, - SerializationWriterFactoryRegistry, - serialize, - serializeCollection, - serializeCollectionToJsonAsString, - serializeCollectionToString, - serializeToJsonAsString, - serializeToString, -} from "@microsoft/kiota-abstractions"; -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ -import { - createTestBackedModelFromDiscriminatorValue, - serializeTestBackModel, - type TestBackedModel, -} from "./testEntity"; +import { deserialize, deserializeCollection, deserializeFromJson, type ModelSerializerFunction, type Parsable, type ParsableFactory, type ParseNode, type ParseNodeFactory, ParseNodeFactoryRegistry, type SerializationWriter, type SerializationWriterFactory, SerializationWriterFactoryRegistry, serialize, serializeCollection, serializeCollectionToJsonAsString, serializeCollectionToString, serializeToJsonAsString, serializeToString } from "@microsoft/kiota-abstractions"; +import { assert, describe, it } from "vitest"; + +import { createTestBackedModelFromDiscriminatorValue, serializeTestBackModel, type TestBackedModel } from "./testEntity"; const jsonContentType = "application/json"; describe("kiotaSerializer", () => { - it("defends serialize", () => { - assert.throws(() => - serialize( - "", - undefined as unknown as Parsable, - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serialize( - jsonContentType, - undefined as unknown as Parsable, - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serialize( - jsonContentType, - {} as unknown as Parsable, - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serializeCollection( - "", - undefined as unknown as Parsable[], - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serializeCollection( - jsonContentType, - undefined as unknown as Parsable[], - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serializeCollection( - jsonContentType, - [], - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serializeToString( - "", - undefined as unknown as Parsable, - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serializeToString( - jsonContentType, - undefined as unknown as Parsable, - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serializeToString( - jsonContentType, - {} as unknown as Parsable, - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serializeCollectionToString( - "", - undefined as unknown as Parsable[], - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serializeCollectionToString( - jsonContentType, - undefined as unknown as Parsable[], - undefined as unknown as ModelSerializerFunction, - ), - ); - assert.throws(() => - serializeCollectionToString( - jsonContentType, - [], - undefined as unknown as ModelSerializerFunction, - ), - ); - }); - it("defends deserialize", () => { - assert.throws(() => - deserialize( - "", - "", - undefined as unknown as ParsableFactory, - ), - ); - assert.throws(() => - deserialize( - jsonContentType, - "", - undefined as unknown as ParsableFactory, - ), - ); - assert.throws(() => - deserialize( - jsonContentType, - "{}", - undefined as unknown as ParsableFactory, - ), - ); - assert.throws(() => - deserializeCollection( - "", - "", - undefined as unknown as ParsableFactory, - ), - ); - assert.throws(() => - deserializeCollection( - jsonContentType, - "", - undefined as unknown as ParsableFactory, - ), - ); - assert.throws(() => - deserializeCollection( - jsonContentType, - "{}", - undefined as unknown as ParsableFactory, - ), - ); - }); - it("Serializes an object", () => { - registerMockSerializer(`{"id": "123"}`); - const testEntity = { - id: "123", - } as TestBackedModel; + it("defends serialize", () => { + assert.throws(() => serialize("", undefined as unknown as Parsable, undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serialize(jsonContentType, undefined as unknown as Parsable, undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serialize(jsonContentType, {} as unknown as Parsable, undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serializeCollection("", undefined as unknown as Parsable[], undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serializeCollection(jsonContentType, undefined as unknown as Parsable[], undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serializeCollection(jsonContentType, [], undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serializeToString("", undefined as unknown as Parsable, undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serializeToString(jsonContentType, undefined as unknown as Parsable, undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serializeToString(jsonContentType, {} as unknown as Parsable, undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serializeCollectionToString("", undefined as unknown as Parsable[], undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serializeCollectionToString(jsonContentType, undefined as unknown as Parsable[], undefined as unknown as ModelSerializerFunction)); + assert.throws(() => serializeCollectionToString(jsonContentType, [], undefined as unknown as ModelSerializerFunction)); + }); + it("defends deserialize", () => { + assert.throws(() => deserialize("", "", undefined as unknown as ParsableFactory)); + assert.throws(() => deserialize(jsonContentType, "", undefined as unknown as ParsableFactory)); + assert.throws(() => deserialize(jsonContentType, "{}", undefined as unknown as ParsableFactory)); + assert.throws(() => deserializeCollection("", "", undefined as unknown as ParsableFactory)); + assert.throws(() => deserializeCollection(jsonContentType, "", undefined as unknown as ParsableFactory)); + assert.throws(() => deserializeCollection(jsonContentType, "{}", undefined as unknown as ParsableFactory)); + }); + it("Serializes an object", () => { + registerMockSerializer(`{"id": "123"}`); + const testEntity = { + id: "123", + } as TestBackedModel; - const result = serializeToJsonAsString(testEntity, serializeTestBackModel); + const result = serializeToJsonAsString(testEntity, serializeTestBackModel); - assert.equal(result, `{"id": "123"}`); + assert.equal(result, `{"id": "123"}`); - SerializationWriterFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.clear(); - }); - it("Serializes a collection", () => { - registerMockSerializer(`[{"id": "123"}]`); - const testEntity = { - id: "123", - } as TestBackedModel; + SerializationWriterFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.clear(); + }); + it("Serializes a collection", () => { + registerMockSerializer(`[{"id": "123"}]`); + const testEntity = { + id: "123", + } as TestBackedModel; - const result = serializeCollectionToJsonAsString( - [testEntity], - serializeTestBackModel, - ); + const result = serializeCollectionToJsonAsString([testEntity], serializeTestBackModel); - assert.equal(result, `[{"id": "123"}]`); + assert.equal(result, `[{"id": "123"}]`); - SerializationWriterFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.clear(); - }); - it("Deserializes an object", () => { - registerMockParseNode({ - id: "123", - } as TestBackedModel); - const result = deserializeFromJson( - `{"id": "123"}`, - createTestBackedModelFromDiscriminatorValue, - ); + SerializationWriterFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.clear(); + }); + it("Deserializes an object", () => { + registerMockParseNode({ + id: "123", + } as TestBackedModel); + const result = deserializeFromJson(`{"id": "123"}`, createTestBackedModelFromDiscriminatorValue); - assert.deepEqual(result, { - id: "123", - } as TestBackedModel); + assert.deepEqual(result, { + id: "123", + } as TestBackedModel); - ParseNodeFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.clear(); - }); - it("Deserializes a collection", () => { - registerMockParseNode([ - { - id: "123", - } as TestBackedModel, - ]); - const result = deserializeFromJson( - `[{"id": "123"}]`, - createTestBackedModelFromDiscriminatorValue, - ); + ParseNodeFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.clear(); + }); + it("Deserializes a collection", () => { + registerMockParseNode([ + { + id: "123", + } as TestBackedModel, + ]); + const result = deserializeFromJson(`[{"id": "123"}]`, createTestBackedModelFromDiscriminatorValue); - assert.deepEqual(result, [ - { - id: "123", - } as TestBackedModel, - ]); + assert.deepEqual(result, [ + { + id: "123", + } as TestBackedModel, + ]); - ParseNodeFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.clear(); - }); + ParseNodeFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.clear(); + }); }); function registerMockParseNode(value: unknown): void { - const mockParseNode = { - getObjectValue( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - parsableFactory: ParsableFactory, - ): T { - return value as T; - }, - getCollectionOfObjectValues( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - parsableFactory: ParsableFactory, - ): T[] | undefined { - return value as T[]; - }, - } as unknown as ParseNode; - const mockParseNodeFactory = { - getRootParseNode( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - contentType: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - buffer: ArrayBuffer, - ) { - return mockParseNode; - }, - } as unknown as ParseNodeFactory; - ParseNodeFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.set( - jsonContentType, - mockParseNodeFactory, - ); + const mockParseNode = { + getObjectValue( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + parsableFactory: ParsableFactory, + ): T { + return value as T; + }, + getCollectionOfObjectValues( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + parsableFactory: ParsableFactory, + ): T[] | undefined { + return value as T[]; + }, + } as unknown as ParseNode; + const mockParseNodeFactory = { + getRootParseNode( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + contentType: string, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + buffer: ArrayBuffer, + ) { + return mockParseNode; + }, + } as unknown as ParseNodeFactory; + ParseNodeFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.set(jsonContentType, mockParseNodeFactory); } function registerMockSerializer(value: string): void { - const mockSerializationWriter = { - getSerializedContent(): ArrayBuffer { - const encoder = new TextEncoder(); - return encoder.encode(value).buffer; - }, - writeObjectValue( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - key?: string | undefined, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - value?: T | undefined, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - serializerMethod?: ModelSerializerFunction, - ): void { - return; - }, - writeCollectionOfObjectValues( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - key?: string | undefined, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - values?: T[], - // eslint-disable-next-line @typescript-eslint/no-unused-vars - serializerMethod?: ModelSerializerFunction, - ): void { - return; - }, - } as unknown as SerializationWriter; - const mockSerializationWriterFactory = { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - getSerializationWriter(contentType: string, value: unknown) { - return mockSerializationWriter; - }, - } as unknown as SerializationWriterFactory; - SerializationWriterFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.set( - jsonContentType, - mockSerializationWriterFactory, - ); + const mockSerializationWriter = { + getSerializedContent(): ArrayBuffer { + const encoder = new TextEncoder(); + return encoder.encode(value).buffer; + }, + writeObjectValue( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + key?: string | undefined, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + value?: T | undefined, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + serializerMethod?: ModelSerializerFunction, + ): void { + return; + }, + writeCollectionOfObjectValues( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + key?: string | undefined, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + values?: T[], + // eslint-disable-next-line @typescript-eslint/no-unused-vars + serializerMethod?: ModelSerializerFunction, + ): void { + return; + }, + } as unknown as SerializationWriter; + const mockSerializationWriterFactory = { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getSerializationWriter(contentType: string, value: unknown) { + return mockSerializationWriter; + }, + } as unknown as SerializationWriterFactory; + SerializationWriterFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.set(jsonContentType, mockSerializationWriterFactory); } diff --git a/packages/serialization/json/test/common/testEntity.ts b/packages/serialization/json/test/common/testEntity.ts index 8224c2c59..0f2ecbddb 100644 --- a/packages/serialization/json/test/common/testEntity.ts +++ b/packages/serialization/json/test/common/testEntity.ts @@ -1,176 +1,155 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { BackedModel, BackingStore, Parsable, ParseNode, SerializationWriter } from "@microsoft/kiota-abstractions"; import { Guid } from "guid-typescript"; const fakeBackingStore: BackingStore = {} as BackingStore; export interface TestParser { - testCollection?: string[] | undefined; - testString?: string | undefined; - testBoolean?: boolean | undefined; - testComplexString?: string | undefined; - testObject?: Record | undefined; - additionalData?: Record; - testDate?: Date | undefined; - foos?: FooResponse[] | undefined; - id?: string | undefined; - testNumber?: number | undefined; - testGuid?: Guid | undefined; + testCollection?: string[] | undefined; + testString?: string | undefined; + testBoolean?: boolean | undefined; + testComplexString?: string | undefined; + testObject?: Record | undefined; + additionalData?: Record; + testDate?: Date | undefined; + foos?: FooResponse[] | undefined; + id?: string | undefined; + testNumber?: number | undefined; + testGuid?: Guid | undefined; } export interface TestBackedModel extends TestParser, BackedModel { - backingStoreEnabled?: boolean | undefined; + backingStoreEnabled?: boolean | undefined; } export interface FooResponse extends Parsable { - id?: string | undefined; - bars?: BarResponse[] | undefined; + id?: string | undefined; + bars?: BarResponse[] | undefined; } export interface BarResponse extends Parsable { - propA?: string | undefined; - propB?: string | undefined; - propC?: Date | undefined; + propA?: string | undefined; + propB?: string | undefined; + propC?: Date | undefined; } -export function createTestParserFromDiscriminatorValue( - parseNode: ParseNode | undefined -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeTestParser; +export function createTestParserFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeTestParser; } -export function createTestBackedModelFromDiscriminatorValue( - parseNode: ParseNode | undefined -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeTestBackedModel; +export function createTestBackedModelFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeTestBackedModel; } -export function createFooParserFromDiscriminatorValue( - parseNode: ParseNode | undefined -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeFooParser; +export function createFooParserFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeFooParser; } -export function createBarParserFromDiscriminatorValue( - parseNode: ParseNode | undefined -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeBarParser; +export function createBarParserFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeBarParser; } -export function deserializeTestParser( - testParser: TestParser | undefined = {} -): Record void> { - return { - testCollection: (n) => { - testParser.testCollection = n.getCollectionOfPrimitiveValues(); - }, - testString: (n) => { - testParser.testString = n.getStringValue(); - }, - testBoolean: (n) => { - testParser.testBoolean = n.getBooleanValue(); - }, - textComplexString: (n) => { - testParser.testComplexString = n.getStringValue(); - }, - testDate: (n) => { - testParser.testDate = n.getDateValue(); - }, - foos: (n) => { - testParser.foos = n.getCollectionOfObjectValues(createFooParserFromDiscriminatorValue); - }, - id: (n) => { - testParser.id = n.getStringValue(); - }, - testNumber: (n) => { - testParser.testNumber = n.getNumberValue(); - }, - testGuid: (n) => { - testParser.testGuid = n.getGuidValue(); - } - }; +export function deserializeTestParser(testParser: TestParser | undefined = {}): Record void> { + return { + testCollection: (n) => { + testParser.testCollection = n.getCollectionOfPrimitiveValues(); + }, + testString: (n) => { + testParser.testString = n.getStringValue(); + }, + testBoolean: (n) => { + testParser.testBoolean = n.getBooleanValue(); + }, + textComplexString: (n) => { + testParser.testComplexString = n.getStringValue(); + }, + testDate: (n) => { + testParser.testDate = n.getDateValue(); + }, + foos: (n) => { + testParser.foos = n.getCollectionOfObjectValues(createFooParserFromDiscriminatorValue); + }, + id: (n) => { + testParser.id = n.getStringValue(); + }, + testNumber: (n) => { + testParser.testNumber = n.getNumberValue(); + }, + testGuid: (n) => { + testParser.testGuid = n.getGuidValue(); + }, + }; } -export function deserializeTestBackedModel( - testParser: TestBackedModel | undefined = {} -): Record void> { - return { - backingStoreEnabled: (n) => { - testParser.backingStoreEnabled = true; - }, - ...deserializeTestParser(testParser), - }; +export function deserializeTestBackedModel(testParser: TestBackedModel | undefined = {}): Record void> { + return { + backingStoreEnabled: (n) => { + testParser.backingStoreEnabled = true; + }, + ...deserializeTestParser(testParser), + }; } -export function deserializeFooParser( - fooResponse: FooResponse | undefined = {} -): Record void> { - return { - id: (n) => { - fooResponse.id = n.getStringValue(); - }, - bars: (n) => { - fooResponse.bars = n.getCollectionOfObjectValues(createBarParserFromDiscriminatorValue); - } - }; +export function deserializeFooParser(fooResponse: FooResponse | undefined = {}): Record void> { + return { + id: (n) => { + fooResponse.id = n.getStringValue(); + }, + bars: (n) => { + fooResponse.bars = n.getCollectionOfObjectValues(createBarParserFromDiscriminatorValue); + }, + }; } -export function deserializeBarParser( - barResponse: BarResponse | undefined = {} -): Record void> { - return { - propA: (n) => { - barResponse.propA = n.getStringValue(); - }, - propB: (n) => { - barResponse.propB = n.getStringValue(); - }, - propC: (n) => { - barResponse.propC = n.getDateValue(); - } - }; +export function deserializeBarParser(barResponse: BarResponse | undefined = {}): Record void> { + return { + propA: (n) => { + barResponse.propA = n.getStringValue(); + }, + propB: (n) => { + barResponse.propB = n.getStringValue(); + }, + propC: (n) => { + barResponse.propC = n.getDateValue(); + }, + }; } -export function serializeTestObject( - writer: SerializationWriter, - entity: { additionalData?: Record } | undefined = {} -): void { - writer.writeAdditionalData(entity.additionalData); -} -export function serializeTestParser( - writer: SerializationWriter, - entity: TestParser | undefined = {} -): void { - writer.writeStringValue("id", entity.id); - writer.writeCollectionOfPrimitiveValues( - "testCollection", - entity.testCollection - ); - writer.writeStringValue("testString", entity.testString); - writer.writeStringValue("testComplexString", entity.testComplexString); - writer.writeGuidValue("testGuid", entity.testGuid); - writer.writeDateValue("testDate", entity.testDate); - writer.writeNumberValue("testNumber", entity.testNumber); - writer.writeBooleanValue("testBoolean", entity.testBoolean); - writer.writeObjectValue("testObject", entity.testObject, serializeTestObject); - writer.writeCollectionOfObjectValues("foos", entity.foos, serializeFoo); - writer.writeAdditionalData(entity.additionalData); +export function serializeTestObject(writer: SerializationWriter, entity: { additionalData?: Record } | undefined = {}): void { + writer.writeAdditionalData(entity.additionalData); +} +export function serializeTestParser(writer: SerializationWriter, entity: TestParser | undefined = {}): void { + writer.writeStringValue("id", entity.id); + writer.writeCollectionOfPrimitiveValues("testCollection", entity.testCollection); + writer.writeStringValue("testString", entity.testString); + writer.writeStringValue("testComplexString", entity.testComplexString); + writer.writeGuidValue("testGuid", entity.testGuid); + writer.writeDateValue("testDate", entity.testDate); + writer.writeNumberValue("testNumber", entity.testNumber); + writer.writeBooleanValue("testBoolean", entity.testBoolean); + writer.writeObjectValue("testObject", entity.testObject, serializeTestObject); + writer.writeCollectionOfObjectValues("foos", entity.foos, serializeFoo); + writer.writeAdditionalData(entity.additionalData); } export function serializeFoo(writer: SerializationWriter, entity: FooResponse | undefined = {}): void { - writer.writeStringValue("id", entity.id); - writer.writeCollectionOfObjectValues("bars", entity.bars, serializeBar); + writer.writeStringValue("id", entity.id); + writer.writeCollectionOfObjectValues("bars", entity.bars, serializeBar); } export function serializeBar(writer: SerializationWriter, entity: BarResponse | undefined = {}): void { - writer.writeStringValue("propA", entity.propA); - writer.writeStringValue("propB", entity.propB); - writer.writeDateValue("propC", entity.propC); + writer.writeStringValue("propA", entity.propA); + writer.writeStringValue("propB", entity.propB); + writer.writeDateValue("propC", entity.propC); } -export function serializeTestBackModel( - writer: SerializationWriter, - entity: TestBackedModel | undefined = {}, -): void { - serializeTestParser(writer, entity); +export function serializeTestBackModel(writer: SerializationWriter, entity: TestBackedModel | undefined = {}): void { + serializeTestParser(writer, entity); } diff --git a/packages/serialization/json/test/common/untypedTestEntiy.ts b/packages/serialization/json/test/common/untypedTestEntiy.ts index db861d532..a82091ff2 100644 --- a/packages/serialization/json/test/common/untypedTestEntiy.ts +++ b/packages/serialization/json/test/common/untypedTestEntiy.ts @@ -1,69 +1,56 @@ -import { - createUntypedNodeFromDiscriminatorValue, - SerializationWriter, - type ParseNode, - type UntypedNode, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { createUntypedNodeFromDiscriminatorValue, SerializationWriter, type ParseNode, type UntypedNode } from "@microsoft/kiota-abstractions"; export interface UntypedTestEntity { - id?: string | undefined; - title?: string | undefined; - location?: UntypedNode | undefined; - keywords?: UntypedNode | undefined; - detail?: UntypedNode | undefined; - table?: UntypedNode | undefined; - additionalData?: Record; + id?: string | undefined; + title?: string | undefined; + location?: UntypedNode | undefined; + keywords?: UntypedNode | undefined; + detail?: UntypedNode | undefined; + table?: UntypedNode | undefined; + additionalData?: Record; } -export function createUntypedTestEntityFromDiscriminatorValue( - parseNode: ParseNode | undefined, -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeUntypedTestEntity; +export function createUntypedTestEntityFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeUntypedTestEntity; } -export function deserializeUntypedTestEntity( - untypedTestEntity: UntypedTestEntity | undefined = {}, -): Record void> { - return { - id: (n) => { - untypedTestEntity.id = n.getStringValue(); - }, - title: (n) => { - untypedTestEntity.title = n.getStringValue(); - }, - location: (n) => { - untypedTestEntity.location = n.getObjectValue( - createUntypedNodeFromDiscriminatorValue, - ); - }, - keywords: (n) => { - untypedTestEntity.keywords = n.getObjectValue( - createUntypedNodeFromDiscriminatorValue, - ); - }, - detail: (n) => { - untypedTestEntity.detail = n.getObjectValue( - createUntypedNodeFromDiscriminatorValue, - ); - }, - table: (n) => { - untypedTestEntity.table = n.getObjectValue( - createUntypedNodeFromDiscriminatorValue, - ); - }, - }; +export function deserializeUntypedTestEntity(untypedTestEntity: UntypedTestEntity | undefined = {}): Record void> { + return { + id: (n) => { + untypedTestEntity.id = n.getStringValue(); + }, + title: (n) => { + untypedTestEntity.title = n.getStringValue(); + }, + location: (n) => { + untypedTestEntity.location = n.getObjectValue(createUntypedNodeFromDiscriminatorValue); + }, + keywords: (n) => { + untypedTestEntity.keywords = n.getObjectValue(createUntypedNodeFromDiscriminatorValue); + }, + detail: (n) => { + untypedTestEntity.detail = n.getObjectValue(createUntypedNodeFromDiscriminatorValue); + }, + table: (n) => { + untypedTestEntity.table = n.getObjectValue(createUntypedNodeFromDiscriminatorValue); + }, + }; } -export function serializeUntypedTestEntity( - writer: SerializationWriter, - untypedTestEntity: UntypedTestEntity | undefined = {}, -): void { - writer.writeStringValue("id", untypedTestEntity.id); - writer.writeStringValue("title", untypedTestEntity.title); - writer.writeObjectValue("location", untypedTestEntity.location); - writer.writeObjectValue("keywords", untypedTestEntity.keywords); - writer.writeObjectValue("detail", untypedTestEntity.detail); - writer.writeObjectValue("table", untypedTestEntity.table); - writer.writeAdditionalData(untypedTestEntity.additionalData); +export function serializeUntypedTestEntity(writer: SerializationWriter, untypedTestEntity: UntypedTestEntity | undefined = {}): void { + writer.writeStringValue("id", untypedTestEntity.id); + writer.writeStringValue("title", untypedTestEntity.title); + writer.writeObjectValue("location", untypedTestEntity.location); + writer.writeObjectValue("keywords", untypedTestEntity.keywords); + writer.writeObjectValue("detail", untypedTestEntity.detail); + writer.writeObjectValue("table", untypedTestEntity.table); + writer.writeAdditionalData(untypedTestEntity.additionalData); } diff --git a/packages/serialization/json/tsconfig.base.json b/packages/serialization/json/tsconfig.base.json deleted file mode 100644 index 2499c53ed..000000000 --- a/packages/serialization/json/tsconfig.base.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "importHelpers": true, - "noEmitOnError": true, - "moduleResolution": "node", - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "declarationMap": true, - "composite": true, - "paths": { - "@microsoft/kiota-abstractions/*": [ - "../../abstractions/*" - ], - } - } -} \ No newline at end of file diff --git a/packages/serialization/json/tsconfig.cjs.json b/packages/serialization/json/tsconfig.cjs.json deleted file mode 100644 index 00b535503..000000000 --- a/packages/serialization/json/tsconfig.cjs.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2017", - "module": "commonjs", - "outDir": "./dist/cjs" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test"], - "references": [ - { - "path": "../../abstractions/tsconfig.cjs.json" - }, - ] -} \ No newline at end of file diff --git a/packages/serialization/json/tsconfig.es.json b/packages/serialization/json/tsconfig.es.json deleted file mode 100644 index 67107d65f..000000000 --- a/packages/serialization/json/tsconfig.es.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "dist/es/" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "references": [ - { - "path": "../../abstractions/tsconfig.es.json" - }, - ] -} \ No newline at end of file diff --git a/packages/serialization/json/tsconfig.json b/packages/serialization/json/tsconfig.json new file mode 100644 index 000000000..7d941c5a6 --- /dev/null +++ b/packages/serialization/json/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist/es/" + }, + "exclude": [ + "node_modules", + "dist", + "./test/**/*.ts" + ], + "include": [ + "./src/**/*.ts", + ] +} \ No newline at end of file diff --git a/packages/serialization/json/vitest.config.mts b/packages/serialization/json/vitest.config.mts new file mode 100644 index 000000000..1b00ba11e --- /dev/null +++ b/packages/serialization/json/vitest.config.mts @@ -0,0 +1,11 @@ +import { defineConfig, configDefaults } from "vitest/config"; + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude, "**/*/{testEntity,index,untypedTestEntiy}.ts"], + include: [...configDefaults.include, "test/**/*.ts"], + coverage: { + reporter: ["html"], + }, + }, +}); \ No newline at end of file diff --git a/packages/serialization/multipart/.eslintignore b/packages/serialization/multipart/.eslintignore deleted file mode 100644 index 8942aa232..000000000 --- a/packages/serialization/multipart/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -*.js -*.js.map -*.d.ts - -node_modules -lib -spec/development \ No newline at end of file diff --git a/packages/serialization/multipart/.eslintrc.json b/packages/serialization/multipart/.eslintrc.json deleted file mode 100644 index 80ab9b397..000000000 --- a/packages/serialization/multipart/.eslintrc.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "prettier", - "simple-import-sort" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "rules": { - "@typescript-eslint/no-empty-interface": "warn", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/consistent-type-imports": "error", - "prettier/prettier": [ - "error", - { - "endOfLine": "auto" - } - ], - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "typeLike", - "format": [ - "PascalCase" - ], - "filter": { - "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "interface", - "format": [ - "PascalCase" - ], - "custom": { - "regex": "^I[A-Z]", - "match": false - }, - "filter": { - "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", - "match": false - } - }, - { - "selector": "variable", - "format": [ - "camelCase", - "PascalCase", - "UPPER_CASE" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "function", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "parameter", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", - "match": false - } - }, - { - "selector": "method", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "memberLike", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "enumMember", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "property", - "format": null - } - ], - "@typescript-eslint/semi": "error", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/prefer-for-of": "error", - "@typescript-eslint/prefer-function-type": "error", - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/quotes": [ - "error", - "double", - { - "avoidEscape": true, - "allowTemplateLiterals": true - } - ], - "@typescript-eslint/space-within-parens": [ - "off", - "never" - ], - "@typescript-eslint/triple-slash-reference": "error", - "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unified-signatures": "error", - "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", - "@typescript-eslint/consistent-type-definitions": [ - "error", - "interface" - ], - "@typescript-eslint/no-inferrable-types": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-this-alias": "error", - "no-unused-expressions": "off", - "@typescript-eslint/no-unused-expressions": [ - "error", - { - "allowTernary": true - } - ], - "@typescript-eslint/space-before-function-paren": "off", - "@typescript-eslint/consistent-type-assertions": "error", - "@typescript-eslint/explicit-member-accessibility": [ - "off", - { - "accessibility": "explicit" - } - ], - "@typescript-eslint/indent": "off", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/member-delimiter-style": [ - "off", - { - "multiline": { - "delimiter": "none", - "requireLast": true - }, - "singleline": { - "delimiter": "semi", - "requireLast": false - } - } - ], - "@typescript-eslint/member-ordering": "off", - "@typescript-eslint/no-empty-function": "error", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-parameter-properties": "off", - "@typescript-eslint/no-array-constructor": "error", - "no-useless-catch": "error", - "prefer-rest-params": "off", - "no-constant-condition": "error", - "simple-import-sort/imports": "error", - "brace-style": "error", - "constructor-super": "error", - "curly": [ - "error", - "multi-line" - ], - "dot-notation": "off", - "eqeqeq": "error", - "new-parens": "error", - "no-caller": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-empty": "error", - "no-eval": "error", - "no-extra-bind": "error", - "no-fallthrough": "error", - "no-new-func": "off", - "no-new-wrappers": "error", - "no-return-await": "off", - "no-sparse-arrays": "error", - "no-template-curly-in-string": "error", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-unsafe-finally": "error", - "no-unused-labels": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-const": "error", - "prefer-object-spread": "error", - "quote-props": "off", - "space-in-parens": "error", - "unicode-bom": [ - "error", - "never" - ], - "use-isnan": "error" - } -} \ No newline at end of file diff --git a/packages/serialization/multipart/.npmignore b/packages/serialization/multipart/.npmignore index 164fa84b7..15ae0ca0b 100644 --- a/packages/serialization/multipart/.npmignore +++ b/packages/serialization/multipart/.npmignore @@ -4,7 +4,6 @@ *.tgz **/test/**/* docs/ -karma.conf.js node_modules/ rollup.config.js src/ diff --git a/packages/serialization/multipart/karma.conf.js b/packages/serialization/multipart/karma.conf.js deleted file mode 100644 index ed70e0053..000000000 --- a/packages/serialization/multipart/karma.conf.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function(config) { - config.set({ - frameworks: ["mocha", "chai", "karma-typescript"], - files: [{ pattern: "dist/es/test/index.js", type: "module" }], - preprocessors: { - "**/*.ts": ["karma-typescript"], - }, - karmaTypescriptConfig: { - tsconfig: "./tsconfig.cjs.json", - }, - browsers: ["ChromeHeadless"], - }); -}; \ No newline at end of file diff --git a/packages/serialization/multipart/package.json b/packages/serialization/multipart/package.json index 78781025a..a304eefa1 100644 --- a/packages/serialization/multipart/package.json +++ b/packages/serialization/multipart/package.json @@ -2,20 +2,18 @@ "name": "@microsoft/kiota-serialization-multipart", "version": "1.0.0-preview.29", "description": "Implementation of Kiota Serialization interfaces for multipart form data", - "main": "dist/cjs/src/index.js", + "main": "dist/es/src/index.js", "module": "dist/es/src/index.js", - "types": "dist/cjs/src/index.d.ts", + "types": "dist/es/src/index.d.ts", "scripts": { - "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc -b tsconfig.cjs.json", - "build:esm": "tsc -b tsconfig.es.json", + "build": "npm run build:esm", + "build:esm": "tsc -b", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "rm -r ./dist", - "karma": "npm run rollup && karma start --single-run --browsers ChromeHeadless karma.conf.js", - "rollup": "rollup -c", - "test": "npm run test:cjs && npm run karma", - "test:cjs": "npm run build && mocha 'dist/cjs/test/common/**/*.js'" + "clean": "rm -rf ./dist", + "test:browser": "vitest run --browser.name=chrome --browser.headless", + "test:node": "vitest --run", + "test": "npm run test:node && npm run test:browser" }, "repository": { "type": "git", @@ -35,14 +33,14 @@ }, "homepage": "https://github.com/microsoft/kiota-typescript#readme", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" }, "devDependencies": { - "@microsoft/kiota-serialization-json": "^1.0.0-preview.51" + "@microsoft/kiota-serialization-json": "*" }, "publishConfig": { "access": "public" } -} +} \ No newline at end of file diff --git a/packages/serialization/multipart/rollup.config.js b/packages/serialization/multipart/rollup.config.js deleted file mode 100644 index 33546e42e..000000000 --- a/packages/serialization/multipart/rollup.config.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -import resolve from "@rollup/plugin-node-resolve"; -import commonjs from "@rollup/plugin-commonjs"; - -const config = [{ - input: ["dist/es/test/browser/index.js"], - output: { - file: "dist/es/test/index.js", - format: "esm", - name: "BrowserTest", - }, - plugins: [ - commonjs(), - resolve({ - browser: true, - preferBuiltins: false, - - }) - ], -}]; - -export default config; \ No newline at end of file diff --git a/packages/serialization/multipart/src/index.ts b/packages/serialization/multipart/src/index.ts index 15bb4f421..d7d24685d 100644 --- a/packages/serialization/multipart/src/index.ts +++ b/packages/serialization/multipart/src/index.ts @@ -1,2 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "./multipartSerializationWriter"; export * from "./multipartSerializationWriterFactory"; diff --git a/packages/serialization/multipart/src/multipartSerializationWriter.ts b/packages/serialization/multipart/src/multipartSerializationWriter.ts index d1c3f95b9..e0562ec76 100644 --- a/packages/serialization/multipart/src/multipartSerializationWriter.ts +++ b/packages/serialization/multipart/src/multipartSerializationWriter.ts @@ -1,165 +1,131 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /* eslint-disable @typescript-eslint/no-unused-expressions */ -import { - type DateOnly, - type Duration, - MultipartBody, - type Parsable, - type SerializationWriter, - type ModelSerializerFunction, - type TimeOnly } from "@microsoft/kiota-abstractions"; +import { type DateOnly, type Duration, MultipartBody, type Parsable, type SerializationWriter, type ModelSerializerFunction, type TimeOnly } from "@microsoft/kiota-abstractions"; import type { Guid } from "guid-typescript"; /** Serialization writer for multipart/form-data */ export class MultipartSerializationWriter implements SerializationWriter { - public writeByteArrayValue( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - key?: string | undefined, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - value?: ArrayBuffer | undefined, - ): void { - if (!value) { - throw new Error("value cannot be undefined"); - } - const previousValue = this.writer; - this.writer = new ArrayBuffer(previousValue.byteLength + value.byteLength); - const pipe = new Uint8Array(this.writer); - pipe.set(new Uint8Array(previousValue), 0); - pipe.set(new Uint8Array(value), previousValue.byteLength); - } - private writer: ArrayBuffer = new ArrayBuffer(0); - public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; - public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; - public onStartObjectSerialization: - | ((value: Parsable, writer: SerializationWriter) => void) - | undefined; - public writeStringValue = (key?: string, value?: string): void => { - if (key) { - this.writeRawStringValue(key); - } - if (value) { - if (key) { - this.writeRawStringValue(": "); - } - this.writeRawStringValue(value); - } - this.writeRawStringValue("\r\n"); - }; - private writeRawStringValue = (value?: string): void => { - if (value) { - this.writeByteArrayValue( - undefined, - new TextEncoder().encode(value).buffer, - ); - } - }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeBooleanValue = (key?: string, value?: boolean): void => { - throw new Error( - `serialization of boolean values is not supported with multipart`, - ); - }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeNumberValue = (key?: string, value?: number): void => { - throw new Error( - `serialization of number values is not supported with multipart`, - ); - }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeGuidValue = (key?: string, value?: Guid): void => { - throw new Error( - `serialization of guid values is not supported with multipart`, - ); - }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeDateValue = (key?: string, value?: Date): void => { - throw new Error( - `serialization of date values is not supported with multipart`, - ); - }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeDateOnlyValue = (key?: string, value?: DateOnly): void => { - throw new Error( - `serialization of date only values is not supported with multipart`, - ); - }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => { - throw new Error( - `serialization of time only values is not supported with multipart`, - ); - }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeDurationValue = (key?: string, value?: Duration): void => { - throw new Error( - `serialization of duration values is not supported with multipart`, - ); - }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeNullValue = (key?: string): void => { - throw new Error( - `serialization of null values is not supported with multipart`, - ); - }; - public writeCollectionOfPrimitiveValues = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _key?: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _values?: T[], - ): void => { - throw new Error( - `serialization of collections is not supported with multipart`, - ); - }; - public writeCollectionOfObjectValues = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _key?: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _values?: T[], - ): void => { - throw new Error( - `serialization of collections is not supported with multipart`, - ); - }; - public writeObjectValue = ( - key: string | undefined, - value: T | undefined, - serializerMethod: ModelSerializerFunction, - ): void => { - if (!value) { - throw new Error(`value cannot be undefined`); - } - if (!(value instanceof MultipartBody)) { - throw new Error(`expected MultipartBody instance`); - } - if (!serializerMethod) { - throw new Error(`serializer method cannot be undefined`); - } - this.onBeforeObjectSerialization && this.onBeforeObjectSerialization(value); - this.onStartObjectSerialization && - this.onStartObjectSerialization(value, this); - serializerMethod(this, value); - this.onAfterObjectSerialization && this.onAfterObjectSerialization(value); - }; - public writeEnumValue = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - key?: string | undefined, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - ...values: (T | undefined)[] - ): void => { - throw new Error( - `serialization of enum values is not supported with multipart`, - ); - }; - public getSerializedContent = (): ArrayBuffer => { - return this.writer; - }; + public writeByteArrayValue( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + key?: string | undefined, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + value?: ArrayBuffer | undefined, + ): void { + if (!value) { + throw new Error("value cannot be undefined"); + } + const previousValue = this.writer; + this.writer = new ArrayBuffer(previousValue.byteLength + value.byteLength); + const pipe = new Uint8Array(this.writer); + pipe.set(new Uint8Array(previousValue), 0); + pipe.set(new Uint8Array(value), previousValue.byteLength); + } + private writer: ArrayBuffer = new ArrayBuffer(0); + public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; + public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; + public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; + public writeStringValue = (key?: string, value?: string): void => { + if (key) { + this.writeRawStringValue(key); + } + if (value) { + if (key) { + this.writeRawStringValue(": "); + } + this.writeRawStringValue(value); + } + this.writeRawStringValue("\r\n"); + }; + private writeRawStringValue = (value?: string): void => { + if (value) { + this.writeByteArrayValue(undefined, new TextEncoder().encode(value).buffer); + } + }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public writeBooleanValue = (key?: string, value?: boolean): void => { + throw new Error(`serialization of boolean values is not supported with multipart`); + }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public writeNumberValue = (key?: string, value?: number): void => { + throw new Error(`serialization of number values is not supported with multipart`); + }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public writeGuidValue = (key?: string, value?: Guid): void => { + throw new Error(`serialization of guid values is not supported with multipart`); + }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public writeDateValue = (key?: string, value?: Date): void => { + throw new Error(`serialization of date values is not supported with multipart`); + }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public writeDateOnlyValue = (key?: string, value?: DateOnly): void => { + throw new Error(`serialization of date only values is not supported with multipart`); + }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => { + throw new Error(`serialization of time only values is not supported with multipart`); + }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public writeDurationValue = (key?: string, value?: Duration): void => { + throw new Error(`serialization of duration values is not supported with multipart`); + }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public writeNullValue = (key?: string): void => { + throw new Error(`serialization of null values is not supported with multipart`); + }; + public writeCollectionOfPrimitiveValues = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _key?: string, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _values?: T[], + ): void => { + throw new Error(`serialization of collections is not supported with multipart`); + }; + public writeCollectionOfObjectValues = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _key?: string, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _values?: T[], + ): void => { + throw new Error(`serialization of collections is not supported with multipart`); + }; + public writeObjectValue = (key: string | undefined, value: T | undefined, serializerMethod: ModelSerializerFunction): void => { + if (!value) { + throw new Error(`value cannot be undefined`); + } + if (!(value instanceof MultipartBody)) { + throw new Error(`expected MultipartBody instance`); + } + if (!serializerMethod) { + throw new Error(`serializer method cannot be undefined`); + } + this.onBeforeObjectSerialization && this.onBeforeObjectSerialization(value); + this.onStartObjectSerialization && this.onStartObjectSerialization(value, this); + serializerMethod(this, value); + this.onAfterObjectSerialization && this.onAfterObjectSerialization(value); + }; + public writeEnumValue = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + key?: string | undefined, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + ...values: (T | undefined)[] + ): void => { + throw new Error(`serialization of enum values is not supported with multipart`); + }; + public getSerializedContent = (): ArrayBuffer => { + return this.writer; + }; - public writeAdditionalData = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - additionalData: Record | undefined, - ): void => { - throw new Error( - `serialization of additional data is not supported with multipart`, - ); - }; + public writeAdditionalData = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + additionalData: Record | undefined, + ): void => { + throw new Error(`serialization of additional data is not supported with multipart`); + }; } diff --git a/packages/serialization/multipart/src/multipartSerializationWriterFactory.ts b/packages/serialization/multipart/src/multipartSerializationWriterFactory.ts index 0436ff4d3..771a5704f 100644 --- a/packages/serialization/multipart/src/multipartSerializationWriterFactory.ts +++ b/packages/serialization/multipart/src/multipartSerializationWriterFactory.ts @@ -1,21 +1,24 @@ -import type { - SerializationWriter, - SerializationWriterFactory, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import type { SerializationWriter, SerializationWriterFactory } from "@microsoft/kiota-abstractions"; import { MultipartSerializationWriter } from "./multipartSerializationWriter"; -export class MultipartSerializationWriterFactory - implements SerializationWriterFactory { - public getValidContentType(): string { - return "multipart/form-data"; - } - public getSerializationWriter(contentType: string): SerializationWriter { - if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } else if (this.getValidContentType() !== contentType) { - throw new Error(`expected a ${this.getValidContentType()} content type`); - } - return new MultipartSerializationWriter(); - } +export class MultipartSerializationWriterFactory implements SerializationWriterFactory { + public getValidContentType(): string { + return "multipart/form-data"; + } + public getSerializationWriter(contentType: string): SerializationWriter { + if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } else if (this.getValidContentType() !== contentType) { + throw new Error(`expected a ${this.getValidContentType()} content type`); + } + return new MultipartSerializationWriter(); + } } diff --git a/packages/serialization/multipart/test/browser/index.ts b/packages/serialization/multipart/test/browser/index.ts index 0704da650..bebd6038f 100644 --- a/packages/serialization/multipart/test/browser/index.ts +++ b/packages/serialization/multipart/test/browser/index.ts @@ -1,2 +1,9 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "../common/multipartSerializationWriter"; export * from "../common/multipartSerializationWriterFactory"; diff --git a/packages/serialization/multipart/test/common/multipartSerializationWriter.ts b/packages/serialization/multipart/test/common/multipartSerializationWriter.ts index da89e8211..440834338 100644 --- a/packages/serialization/multipart/test/common/multipartSerializationWriter.ts +++ b/packages/serialization/multipart/test/common/multipartSerializationWriter.ts @@ -1,139 +1,109 @@ -import { - DateOnly, - Duration, - MultipartBody, - type RequestAdapter, - serializeMultipartBody, - TimeOnly, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { DateOnly, Duration, MultipartBody, type RequestAdapter, serializeMultipartBody, TimeOnly } from "@microsoft/kiota-abstractions"; import { JsonSerializationWriterFactory } from "@microsoft/kiota-serialization-json"; -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; import { MultipartSerializationWriter } from "../../src"; import { serializeTestEntity, type TestEntity } from "../testEntity"; describe("MultipartSerializationWriter", () => { - it("throws on parsable serialization", () => { - const testEntity = {} as TestEntity; - testEntity.id = "48d31887-5fad-4d73-a9f5-3c356e68a038"; - testEntity.workDuration = new Duration({ - hours: 1, - }); - testEntity.startWorkTime = new TimeOnly({ - hours: 8, - }); - testEntity.birthday = new DateOnly({ - year: 2017, - month: 9, - day: 4, - }); - testEntity.additionalData = {}; - testEntity.additionalData["mobilePhone"] = null; - testEntity.additionalData["accountEnabled"] = false; - testEntity.additionalData["jobTitle"] = "Author"; - testEntity.additionalData["createdDateTime"] = new Date(0); - const multipartSerializationWriter = new MultipartSerializationWriter(); - assert.throw(() => - multipartSerializationWriter.writeObjectValue( - undefined, - testEntity, - serializeTestEntity, - ), - ); - }); - const byteForTest = new Uint8Array([0x01, 0x02, 0x03]); - it("writes a byte array value", () => { - const multipartSerializationWriter = new MultipartSerializationWriter(); - multipartSerializationWriter.writeByteArrayValue("key", byteForTest); - const multipartContent = - multipartSerializationWriter.getSerializedContent(); - const multipart = new TextDecoder().decode(multipartContent); - assert.equal( - multipart, - byteForTest - .toString() - .split(",") - .map((x) => String.fromCharCode(parseInt(x))) - .join(""), - ); - }); - it("writes a structured object", () => { - const testEntity = {} as TestEntity; - testEntity.id = "48d31887-5fad-4d73-a9f5-3c356e68a038"; - testEntity.workDuration = new Duration({ - months: 1, - }); - testEntity.startWorkTime = new TimeOnly({ - hours: 8, - }); - testEntity.birthday = new DateOnly({ - year: 2017, - month: 9, - day: 4, - }); - testEntity.additionalData = {}; - testEntity.additionalData["mobilePhone"] = null; - testEntity.additionalData["accountEnabled"] = false; - testEntity.additionalData["jobTitle"] = "Author"; - testEntity.additionalData["createdDateTime"] = new Date(0); - const mpBody = new MultipartBody(); - mpBody.addOrReplacePart("image", "application/octet-stream", byteForTest); - mpBody.addOrReplacePart( - "testEntity", - "application/json", - testEntity, - serializeTestEntity, - ); - mpBody.requestAdapter = { - getSerializationWriterFactory: () => new JsonSerializationWriterFactory(), - } as RequestAdapter; - const multipartSerializationWriter = new MultipartSerializationWriter(); - multipartSerializationWriter.writeObjectValue( - undefined, - mpBody, - serializeMultipartBody, - ); - const multipartContent = - multipartSerializationWriter.getSerializedContent(); - const result = new TextDecoder().decode(multipartContent); + it("throws on parsable serialization", () => { + const testEntity = {} as TestEntity; + testEntity.id = "48d31887-5fad-4d73-a9f5-3c356e68a038"; + testEntity.workDuration = new Duration({ + hours: 1, + }); + testEntity.startWorkTime = new TimeOnly({ + hours: 8, + }); + testEntity.birthday = new DateOnly({ + year: 2017, + month: 9, + day: 4, + }); + testEntity.additionalData = {}; + testEntity.additionalData["mobilePhone"] = null; + testEntity.additionalData["accountEnabled"] = false; + testEntity.additionalData["jobTitle"] = "Author"; + testEntity.additionalData["createdDateTime"] = new Date(0); + const multipartSerializationWriter = new MultipartSerializationWriter(); + assert.throw(() => multipartSerializationWriter.writeObjectValue(undefined, testEntity, serializeTestEntity)); + }); + const byteForTest = new Uint8Array([0x01, 0x02, 0x03]); + it("writes a byte array value", () => { + const multipartSerializationWriter = new MultipartSerializationWriter(); + multipartSerializationWriter.writeByteArrayValue("key", byteForTest); + const multipartContent = multipartSerializationWriter.getSerializedContent(); + const multipart = new TextDecoder().decode(multipartContent); + assert.equal( + multipart, + byteForTest + .toString() + .split(",") + .map((x) => String.fromCharCode(parseInt(x))) + .join(""), + ); + }); + it("writes a structured object", () => { + const testEntity = {} as TestEntity; + testEntity.id = "48d31887-5fad-4d73-a9f5-3c356e68a038"; + testEntity.workDuration = new Duration({ + months: 1, + }); + testEntity.startWorkTime = new TimeOnly({ + hours: 8, + }); + testEntity.birthday = new DateOnly({ + year: 2017, + month: 9, + day: 4, + }); + testEntity.additionalData = {}; + testEntity.additionalData["mobilePhone"] = null; + testEntity.additionalData["accountEnabled"] = false; + testEntity.additionalData["jobTitle"] = "Author"; + testEntity.additionalData["createdDateTime"] = new Date(0); + const mpBody = new MultipartBody(); + mpBody.addOrReplacePart("image", "application/octet-stream", byteForTest); + mpBody.addOrReplacePart("testEntity", "application/json", testEntity, serializeTestEntity); + mpBody.requestAdapter = { + getSerializationWriterFactory: () => new JsonSerializationWriterFactory(), + } as RequestAdapter; + const multipartSerializationWriter = new MultipartSerializationWriter(); + multipartSerializationWriter.writeObjectValue(undefined, mpBody, serializeMultipartBody); + const multipartContent = multipartSerializationWriter.getSerializedContent(); + const result = new TextDecoder().decode(multipartContent); - const expectedString = - "--" + - mpBody.getBoundary() + - '\r\nContent-Type: application/octet-stream\r\nContent-Disposition: form-data; name="image"\r\n\r\n' + - new TextDecoder().decode(byteForTest) + - "\r\n--" + - mpBody.getBoundary() + - '\r\nContent-Type: application/json\r\nContent-Disposition: form-data; name="testEntity"\r\n\r\n{"id":"48d31887-5fad-4d73-a9f5-3c356e68a038","birthday":"2017-09-04","workDuration":"P1M","startWorkTime":"08:00:00.000000000000","mobilePhone":null,"accountEnabled":false,"jobTitle":"Author","createdDateTime":"1970-01-01T00:00:00.000Z"}\r\n--' + - mpBody.getBoundary() + - "--\r\n"; - assert.equal(result, expectedString); - }); + const expectedString = "--" + mpBody.getBoundary() + '\r\nContent-Type: application/octet-stream\r\nContent-Disposition: form-data; name="image"\r\n\r\n' + new TextDecoder().decode(byteForTest) + "\r\n--" + mpBody.getBoundary() + '\r\nContent-Type: application/json\r\nContent-Disposition: form-data; name="testEntity"\r\n\r\n{"id":"48d31887-5fad-4d73-a9f5-3c356e68a038","birthday":"2017-09-04","workDuration":"P1M","startWorkTime":"08:00:00.000000000000","mobilePhone":null,"accountEnabled":false,"jobTitle":"Author","createdDateTime":"1970-01-01T00:00:00.000Z"}\r\n--' + mpBody.getBoundary() + "--\r\n"; + assert.equal(result, expectedString); + }); - it("writesSampleCollectionOfObjectValues", () => { - const testEntity = {} as TestEntity; - testEntity.id = "48d31887-5fad-4d73-a9f5-3c356e68a038"; - testEntity.workDuration = new Duration({ - hours: 1, - }); - testEntity.startWorkTime = new TimeOnly({ - hours: 8, - }); - testEntity.birthday = new DateOnly({ - year: 2017, - month: 9, - day: 4, - }); - testEntity.additionalData = {}; - testEntity.additionalData["mobilePhone"] = null; - testEntity.additionalData["accountEnabled"] = false; - testEntity.additionalData["jobTitle"] = "Author"; - testEntity["createdDateTime"] = new Date(0); - const multipartSerializationWriter = new MultipartSerializationWriter(); - assert.throw(() => - multipartSerializationWriter.writeCollectionOfObjectValues(undefined, [ - testEntity, - ]), - ); - }); + it("writesSampleCollectionOfObjectValues", () => { + const testEntity = {} as TestEntity; + testEntity.id = "48d31887-5fad-4d73-a9f5-3c356e68a038"; + testEntity.workDuration = new Duration({ + hours: 1, + }); + testEntity.startWorkTime = new TimeOnly({ + hours: 8, + }); + testEntity.birthday = new DateOnly({ + year: 2017, + month: 9, + day: 4, + }); + testEntity.additionalData = {}; + testEntity.additionalData["mobilePhone"] = null; + testEntity.additionalData["accountEnabled"] = false; + testEntity.additionalData["jobTitle"] = "Author"; + testEntity["createdDateTime"] = new Date(0); + const multipartSerializationWriter = new MultipartSerializationWriter(); + assert.throw(() => multipartSerializationWriter.writeCollectionOfObjectValues(undefined, [testEntity])); + }); }); diff --git a/packages/serialization/multipart/test/common/multipartSerializationWriterFactory.ts b/packages/serialization/multipart/test/common/multipartSerializationWriterFactory.ts index 087393714..05e0a3d76 100644 --- a/packages/serialization/multipart/test/common/multipartSerializationWriterFactory.ts +++ b/packages/serialization/multipart/test/common/multipartSerializationWriterFactory.ts @@ -1,28 +1,33 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { MultipartSerializationWriterFactory } from "../../src/index"; describe("multipartSerializationWriterFactory", () => { - it("multipartSerializationWriterFactory", () => { - const factory = new MultipartSerializationWriterFactory(); - assert.isDefined(factory); - }); - it("multipartSerializationWriterFactory:getsWriterForMultipartContentType", () => { - const factory = new MultipartSerializationWriterFactory(); + it("multipartSerializationWriterFactory", () => { + const factory = new MultipartSerializationWriterFactory(); + assert.isDefined(factory); + }); + it("multipartSerializationWriterFactory:getsWriterForMultipartContentType", () => { + const factory = new MultipartSerializationWriterFactory(); - const multipartParseNode = factory.getSerializationWriter( - factory.getValidContentType(), - ); - assert.isDefined(multipartParseNode); - }); - it("multipartSerializationWriterFactory:throwsForInvalidContentType", () => { - const factory = new MultipartSerializationWriterFactory(); + const multipartParseNode = factory.getSerializationWriter(factory.getValidContentType()); + assert.isDefined(multipartParseNode); + }); + it("multipartSerializationWriterFactory:throwsForInvalidContentType", () => { + const factory = new MultipartSerializationWriterFactory(); - assert.throw(() => factory.getSerializationWriter("application/json")); - }); - it("multipartSerializationWriterFactory:throwsForNoContentType", () => { - const factory = new MultipartSerializationWriterFactory(); + assert.throw(() => factory.getSerializationWriter("application/json")); + }); + it("multipartSerializationWriterFactory:throwsForNoContentType", () => { + const factory = new MultipartSerializationWriterFactory(); - assert.throw(() => factory.getSerializationWriter("")); - }); + assert.throw(() => factory.getSerializationWriter("")); + }); }); diff --git a/packages/serialization/multipart/test/testEntity.ts b/packages/serialization/multipart/test/testEntity.ts index ceece38ed..9129ff3c8 100644 --- a/packages/serialization/multipart/test/testEntity.ts +++ b/packages/serialization/multipart/test/testEntity.ts @@ -1,67 +1,59 @@ -import type { - AdditionalDataHolder, - DateOnly, - Duration, - Parsable, - ParseNode, - SerializationWriter, - TimeOnly, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import type { AdditionalDataHolder, DateOnly, Duration, Parsable, ParseNode, SerializationWriter, TimeOnly } from "@microsoft/kiota-abstractions"; export interface TestEntity extends Parsable, AdditionalDataHolder { - id?: string; - birthday?: DateOnly; - createdDateTime?: Date; - workDuration?: Duration; - startWorkTime?: TimeOnly; - endWorkTime?: TimeOnly; - officeLocation?: string; + id?: string; + birthday?: DateOnly; + createdDateTime?: Date; + workDuration?: Duration; + startWorkTime?: TimeOnly; + endWorkTime?: TimeOnly; + officeLocation?: string; } -export function createTestParserFromDiscriminatorValue( - parseNode: ParseNode | undefined -) { - if (!parseNode) throw new Error("parseNode cannot be undefined"); - return deserializeTestEntity; +export function createTestParserFromDiscriminatorValue(parseNode: ParseNode | undefined) { + if (!parseNode) throw new Error("parseNode cannot be undefined"); + return deserializeTestEntity; } -export function deserializeTestEntity( - testEntity: TestEntity | undefined = {} -): Record void> { - return { - id: (n) => { - testEntity.id = n.getStringValue(); - }, - birthday: (n) => { - testEntity.birthday = n.getDateOnlyValue(); - }, - createdDateTime: (n) => { - testEntity.createdDateTime = n.getDateValue(); - }, - workDuration: (n) => { - testEntity.workDuration = n.getDurationValue(); - }, - startWorkTime: (n) => { - testEntity.startWorkTime = n.getTimeOnlyValue(); - }, - endWorkTime: (n) => { - testEntity.endWorkTime = n.getTimeOnlyValue(); - }, - officeLocation: (n) => { - testEntity.officeLocation = n.getStringValue(); - }, - }; +export function deserializeTestEntity(testEntity: TestEntity | undefined = {}): Record void> { + return { + id: (n) => { + testEntity.id = n.getStringValue(); + }, + birthday: (n) => { + testEntity.birthday = n.getDateOnlyValue(); + }, + createdDateTime: (n) => { + testEntity.createdDateTime = n.getDateValue(); + }, + workDuration: (n) => { + testEntity.workDuration = n.getDurationValue(); + }, + startWorkTime: (n) => { + testEntity.startWorkTime = n.getTimeOnlyValue(); + }, + endWorkTime: (n) => { + testEntity.endWorkTime = n.getTimeOnlyValue(); + }, + officeLocation: (n) => { + testEntity.officeLocation = n.getStringValue(); + }, + }; } -export function serializeTestEntity( - writer: SerializationWriter, - testEntity: TestEntity | undefined = {} -): void { - writer.writeStringValue("id", testEntity.id); - writer.writeDateOnlyValue("birthday", testEntity.birthday); - writer.writeDateValue("createdDateTime", testEntity.createdDateTime); - writer.writeDurationValue("workDuration", testEntity.workDuration); - writer.writeTimeOnlyValue("startWorkTime", testEntity.startWorkTime); - writer.writeTimeOnlyValue("endWorkTime", testEntity.endWorkTime); - writer.writeStringValue("officeLocation", testEntity.officeLocation); - writer.writeAdditionalData(testEntity.additionalData); +export function serializeTestEntity(writer: SerializationWriter, testEntity: TestEntity | undefined = {}): void { + writer.writeStringValue("id", testEntity.id); + writer.writeDateOnlyValue("birthday", testEntity.birthday); + writer.writeDateValue("createdDateTime", testEntity.createdDateTime); + writer.writeDurationValue("workDuration", testEntity.workDuration); + writer.writeTimeOnlyValue("startWorkTime", testEntity.startWorkTime); + writer.writeTimeOnlyValue("endWorkTime", testEntity.endWorkTime); + writer.writeStringValue("officeLocation", testEntity.officeLocation); + writer.writeAdditionalData(testEntity.additionalData); } diff --git a/packages/serialization/multipart/tsconfig.base.json b/packages/serialization/multipart/tsconfig.base.json deleted file mode 100644 index 2499c53ed..000000000 --- a/packages/serialization/multipart/tsconfig.base.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "importHelpers": true, - "noEmitOnError": true, - "moduleResolution": "node", - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "declarationMap": true, - "composite": true, - "paths": { - "@microsoft/kiota-abstractions/*": [ - "../../abstractions/*" - ], - } - } -} \ No newline at end of file diff --git a/packages/serialization/multipart/tsconfig.cjs.json b/packages/serialization/multipart/tsconfig.cjs.json deleted file mode 100644 index 00b535503..000000000 --- a/packages/serialization/multipart/tsconfig.cjs.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2017", - "module": "commonjs", - "outDir": "./dist/cjs" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test"], - "references": [ - { - "path": "../../abstractions/tsconfig.cjs.json" - }, - ] -} \ No newline at end of file diff --git a/packages/serialization/multipart/tsconfig.es.json b/packages/serialization/multipart/tsconfig.es.json deleted file mode 100644 index 67107d65f..000000000 --- a/packages/serialization/multipart/tsconfig.es.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "dist/es/" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "references": [ - { - "path": "../../abstractions/tsconfig.es.json" - }, - ] -} \ No newline at end of file diff --git a/packages/serialization/multipart/tsconfig.json b/packages/serialization/multipart/tsconfig.json new file mode 100644 index 000000000..45640bf1b --- /dev/null +++ b/packages/serialization/multipart/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist/es/" + }, + "exclude": [ + "node_modules", + "dist", + "./test/**/*.ts" + ], + "include": [ + "./src/**/*.ts", + ], +} \ No newline at end of file diff --git a/packages/serialization/multipart/vitest.config.mts b/packages/serialization/multipart/vitest.config.mts new file mode 100644 index 000000000..16577bafc --- /dev/null +++ b/packages/serialization/multipart/vitest.config.mts @@ -0,0 +1,11 @@ +import { defineConfig, configDefaults } from "vitest/config"; + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude, "**/*/{testEntity,index}.ts"], + include: [...configDefaults.include, "test/**/*.ts"], + coverage: { + reporter: ["html"], + }, + }, +}); \ No newline at end of file diff --git a/packages/serialization/text/.eslintignore b/packages/serialization/text/.eslintignore deleted file mode 100644 index 8942aa232..000000000 --- a/packages/serialization/text/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -*.js -*.js.map -*.d.ts - -node_modules -lib -spec/development \ No newline at end of file diff --git a/packages/serialization/text/.eslintrc.json b/packages/serialization/text/.eslintrc.json deleted file mode 100644 index 80ab9b397..000000000 --- a/packages/serialization/text/.eslintrc.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "prettier", - "simple-import-sort" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "rules": { - "@typescript-eslint/no-empty-interface": "warn", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/consistent-type-imports": "error", - "prettier/prettier": [ - "error", - { - "endOfLine": "auto" - } - ], - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "typeLike", - "format": [ - "PascalCase" - ], - "filter": { - "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "interface", - "format": [ - "PascalCase" - ], - "custom": { - "regex": "^I[A-Z]", - "match": false - }, - "filter": { - "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", - "match": false - } - }, - { - "selector": "variable", - "format": [ - "camelCase", - "PascalCase", - "UPPER_CASE" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", - "match": false - } - }, - { - "selector": "function", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "parameter", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", - "match": false - } - }, - { - "selector": "method", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "memberLike", - "format": [ - "camelCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "enumMember", - "format": [ - "camelCase", - "PascalCase" - ], - "leadingUnderscore": "allow", - "filter": { - "regex": "^[A-Za-z]+_[A-Za-z]+$", - "match": false - } - }, - { - "selector": "property", - "format": null - } - ], - "@typescript-eslint/semi": "error", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/prefer-for-of": "error", - "@typescript-eslint/prefer-function-type": "error", - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/quotes": [ - "error", - "double", - { - "avoidEscape": true, - "allowTemplateLiterals": true - } - ], - "@typescript-eslint/space-within-parens": [ - "off", - "never" - ], - "@typescript-eslint/triple-slash-reference": "error", - "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unified-signatures": "error", - "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", - "@typescript-eslint/consistent-type-definitions": [ - "error", - "interface" - ], - "@typescript-eslint/no-inferrable-types": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-this-alias": "error", - "no-unused-expressions": "off", - "@typescript-eslint/no-unused-expressions": [ - "error", - { - "allowTernary": true - } - ], - "@typescript-eslint/space-before-function-paren": "off", - "@typescript-eslint/consistent-type-assertions": "error", - "@typescript-eslint/explicit-member-accessibility": [ - "off", - { - "accessibility": "explicit" - } - ], - "@typescript-eslint/indent": "off", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/member-delimiter-style": [ - "off", - { - "multiline": { - "delimiter": "none", - "requireLast": true - }, - "singleline": { - "delimiter": "semi", - "requireLast": false - } - } - ], - "@typescript-eslint/member-ordering": "off", - "@typescript-eslint/no-empty-function": "error", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-parameter-properties": "off", - "@typescript-eslint/no-array-constructor": "error", - "no-useless-catch": "error", - "prefer-rest-params": "off", - "no-constant-condition": "error", - "simple-import-sort/imports": "error", - "brace-style": "error", - "constructor-super": "error", - "curly": [ - "error", - "multi-line" - ], - "dot-notation": "off", - "eqeqeq": "error", - "new-parens": "error", - "no-caller": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-empty": "error", - "no-eval": "error", - "no-extra-bind": "error", - "no-fallthrough": "error", - "no-new-func": "off", - "no-new-wrappers": "error", - "no-return-await": "off", - "no-sparse-arrays": "error", - "no-template-curly-in-string": "error", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-unsafe-finally": "error", - "no-unused-labels": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-const": "error", - "prefer-object-spread": "error", - "quote-props": "off", - "space-in-parens": "error", - "unicode-bom": [ - "error", - "never" - ], - "use-isnan": "error" - } -} \ No newline at end of file diff --git a/packages/serialization/text/.npmignore b/packages/serialization/text/.npmignore index 164fa84b7..15ae0ca0b 100644 --- a/packages/serialization/text/.npmignore +++ b/packages/serialization/text/.npmignore @@ -4,7 +4,6 @@ *.tgz **/test/**/* docs/ -karma.conf.js node_modules/ rollup.config.js src/ diff --git a/packages/serialization/text/karma.conf.js b/packages/serialization/text/karma.conf.js deleted file mode 100644 index ed70e0053..000000000 --- a/packages/serialization/text/karma.conf.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function(config) { - config.set({ - frameworks: ["mocha", "chai", "karma-typescript"], - files: [{ pattern: "dist/es/test/index.js", type: "module" }], - preprocessors: { - "**/*.ts": ["karma-typescript"], - }, - karmaTypescriptConfig: { - tsconfig: "./tsconfig.cjs.json", - }, - browsers: ["ChromeHeadless"], - }); -}; \ No newline at end of file diff --git a/packages/serialization/text/package.json b/packages/serialization/text/package.json index 7bf1cde36..778d132b6 100644 --- a/packages/serialization/text/package.json +++ b/packages/serialization/text/package.json @@ -2,24 +2,22 @@ "name": "@microsoft/kiota-serialization-text", "version": "1.0.0-preview.48", "description": "Implementation of Kiota Serialization interfaces for text", - "main": "dist/cjs/src/index.js", + "main": "dist/es/src/index.js", "browser": { "./dist/es/src/index.js": "./dist/es/src/browser/index.js", "./dist/es/src/textParseNodeFactory.js": "./dist/es/src/browser/textParseNodeFactory.js" }, "module": "dist/es/src/index.js", - "types": "dist/cjs/src/index.d.ts", + "types": "dist/es/src/index.d.ts", "scripts": { - "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc -b tsconfig.cjs.json", - "build:esm": "tsc -b tsconfig.es.json", + "build": "npm run build:esm", + "build:esm": "tsc", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "rm -r ./dist ./node_modules", - "karma": "npm run rollup && karma start --single-run --browsers ChromeHeadless karma.conf.js", - "rollup": "rollup -c", - "test": "npm run test:cjs && npm run rollup && npm run karma", - "test:cjs": "npm run build && mocha 'dist/cjs/test/common/**/*.js'" + "clean": "rm -rf ./dist", + "test:browser": "vitest run --browser.name=chrome --browser.headless", + "test:node": "vitest --run", + "test": "npm run test:node && npm run test:browser" }, "repository": { "type": "git", @@ -39,11 +37,11 @@ }, "homepage": "https://github.com/microsoft/kiota-typescript#readme", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.51", + "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" }, "publishConfig": { "access": "public" } -} +} \ No newline at end of file diff --git a/packages/serialization/text/rollup.config.js b/packages/serialization/text/rollup.config.js deleted file mode 100644 index 2c4236989..000000000 --- a/packages/serialization/text/rollup.config.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -import commonjs from "@rollup/plugin-commonjs"; -import resolve from "@rollup/plugin-node-resolve"; - -const config = [ - { - input: ["dist/es/test/browser/index.js"], - output: { - file: "dist/es/test/index.js", - format: "esm", - name: "BrowserTest", - }, - plugins: [ - commonjs(), - resolve({ - browser: true, - preferBuiltins: false, - }), - ], - }, -]; - -export default config; diff --git a/packages/serialization/text/src/browser/index.ts b/packages/serialization/text/src/browser/index.ts index d4d7ca58d..587493876 100644 --- a/packages/serialization/text/src/browser/index.ts +++ b/packages/serialization/text/src/browser/index.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "./../textParseNode"; export * from "./../textSerializationWriter"; export * from "./textParseNodeFactory"; diff --git a/packages/serialization/text/src/browser/textParseNodeFactory.ts b/packages/serialization/text/src/browser/textParseNodeFactory.ts index 4e0b89535..11dc77a87 100644 --- a/packages/serialization/text/src/browser/textParseNodeFactory.ts +++ b/packages/serialization/text/src/browser/textParseNodeFactory.ts @@ -1,27 +1,31 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { ParseNode, ParseNodeFactory } from "@microsoft/kiota-abstractions"; import { TextParseNode } from "./../textParseNode"; export class TextParseNodeFactory implements ParseNodeFactory { - public getValidContentType(): string { - return "text/plain"; - } - public getRootParseNode( - contentType: string, - content: ArrayBuffer - ): ParseNode { - if (!content) { - throw new Error("content cannot be undefined of empty"); - } else if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } else if (this.getValidContentType() !== contentType) { - throw new Error(`expected a ${this.getValidContentType()} content type`); - } - return new TextParseNode(this.convertArrayBufferToText(content)); - } + public getValidContentType(): string { + return "text/plain"; + } + public getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode { + if (!content) { + throw new Error("content cannot be undefined of empty"); + } else if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } else if (this.getValidContentType() !== contentType) { + throw new Error(`expected a ${this.getValidContentType()} content type`); + } + return new TextParseNode(this.convertArrayBufferToText(content)); + } - private convertArrayBufferToText(arrayBuffer: ArrayBuffer) { - const decoder = new TextDecoder(); - return decoder.decode(arrayBuffer); - } + private convertArrayBufferToText(arrayBuffer: ArrayBuffer) { + const decoder = new TextDecoder(); + return decoder.decode(arrayBuffer); + } } diff --git a/packages/serialization/text/src/index.ts b/packages/serialization/text/src/index.ts index f0563b0de..52e671b2c 100644 --- a/packages/serialization/text/src/index.ts +++ b/packages/serialization/text/src/index.ts @@ -1,3 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + export * from "./textParseNode"; export * from "./textSerializationWriter"; export * from "./textParseNodeFactory"; diff --git a/packages/serialization/text/src/textParseNode.ts b/packages/serialization/text/src/textParseNode.ts index ded69c6b5..d3f359059 100644 --- a/packages/serialization/text/src/textParseNode.ts +++ b/packages/serialization/text/src/textParseNode.ts @@ -1,81 +1,69 @@ -import { - DateOnly, - Duration, - type Parsable, - type ParsableFactory, - parseGuidString, - type ParseNode, - TimeOnly, - toFirstCharacterUpper, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { DateOnly, Duration, type Parsable, type ParsableFactory, parseGuidString, type ParseNode, TimeOnly, toFirstCharacterUpper, inNodeEnv } from "@microsoft/kiota-abstractions"; export class TextParseNode implements ParseNode { - private static noStructuredDataMessage = - "text does not support structured data"; - /** - * - */ - constructor(private readonly text: string) { - if ( - this.text && - this.text.length > 1 && - this.text.charAt(0) === '"' && - this.text.charAt(this.text.length - 1) === '"' - ) { - this.text = this.text.substring(1, this.text.length - 2); - } - } - public getByteArrayValue(): ArrayBuffer | undefined { - const strValue = this.getStringValue(); - if (strValue && strValue.length > 0) { - return Buffer.from(strValue, "base64").buffer; - } - return undefined; - } - public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; - public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; - public getStringValue = () => this.text; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public getChildNode = (identifier: string): ParseNode | undefined => { - throw new Error(TextParseNode.noStructuredDataMessage); - }; - public getBooleanValue = (): boolean | undefined => { - const value = this.getStringValue()?.toLowerCase(); - if (value === "true" || value === "1") { - return true; - } else if (value === "false" || value === "0") { - return false; - } - return undefined; - }; - public getNumberValue = () => Number(this.text); - public getGuidValue = () => parseGuidString(this.text); - public getDateValue = () => new Date(Date.parse(this.text)); - public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); - public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); - public getDurationValue = () => Duration.parse(this.getStringValue()); - public getCollectionOfPrimitiveValues = (): T[] | undefined => { - throw new Error(TextParseNode.noStructuredDataMessage); - }; - /* eslint-disable @typescript-eslint/no-unused-vars */ - public getCollectionOfObjectValues( - parsableFactory: ParsableFactory - ): T[] | undefined { - throw new Error(TextParseNode.noStructuredDataMessage); - } + private static noStructuredDataMessage = "text does not support structured data"; + /** + * + */ + constructor(private readonly text: string) { + if (this.text && this.text.length > 1 && this.text.charAt(0) === '"' && this.text.charAt(this.text.length - 1) === '"') { + this.text = this.text.substring(1, this.text.length - 2); + } + } + public getByteArrayValue(): ArrayBuffer | undefined { + const strValue = this.getStringValue(); + if (strValue && strValue.length > 0) { + return inNodeEnv() ? Buffer.from(strValue, "base64").buffer : new TextEncoder().encode(strValue); + } + return undefined; + } + public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; + public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; + public getStringValue = () => this.text; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public getChildNode = (identifier: string): ParseNode | undefined => { + throw new Error(TextParseNode.noStructuredDataMessage); + }; + public getBooleanValue = (): boolean | undefined => { + const value = this.getStringValue()?.toLowerCase(); + if (value === "true" || value === "1") { + return true; + } else if (value === "false" || value === "0") { + return false; + } + return undefined; + }; + public getNumberValue = () => Number(this.text); + public getGuidValue = () => parseGuidString(this.text); + public getDateValue = () => new Date(Date.parse(this.text)); + public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); + public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); + public getDurationValue = () => Duration.parse(this.getStringValue()); + public getCollectionOfPrimitiveValues = (): T[] | undefined => { + throw new Error(TextParseNode.noStructuredDataMessage); + }; + /* eslint-disable @typescript-eslint/no-unused-vars */ + public getCollectionOfObjectValues(parsableFactory: ParsableFactory): T[] | undefined { + throw new Error(TextParseNode.noStructuredDataMessage); + } - /* eslint-disable @typescript-eslint/no-unused-vars */ - public getObjectValue( - parsableFactory: ParsableFactory - ): T { - throw new Error(TextParseNode.noStructuredDataMessage); - } + /* eslint-disable @typescript-eslint/no-unused-vars */ + public getObjectValue(parsableFactory: ParsableFactory): T { + throw new Error(TextParseNode.noStructuredDataMessage); + } - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public getCollectionOfEnumValues = (type: any): T[] => { - throw new Error(TextParseNode.noStructuredDataMessage); - }; - public getEnumValue = (type: any): T | undefined => { - return type[toFirstCharacterUpper(this.text)] as T; - }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public getCollectionOfEnumValues = (type: any): T[] => { + throw new Error(TextParseNode.noStructuredDataMessage); + }; + public getEnumValue = (type: any): T | undefined => { + return type[toFirstCharacterUpper(this.text)] as T; + }; } diff --git a/packages/serialization/text/src/textParseNodeFactory.ts b/packages/serialization/text/src/textParseNodeFactory.ts index 54ad59c03..e6aac8f43 100644 --- a/packages/serialization/text/src/textParseNodeFactory.ts +++ b/packages/serialization/text/src/textParseNodeFactory.ts @@ -1,28 +1,31 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import type { ParseNode, ParseNodeFactory } from "@microsoft/kiota-abstractions"; -import { TextDecoder } from "util"; import { TextParseNode } from "./textParseNode"; export class TextParseNodeFactory implements ParseNodeFactory { - public getValidContentType(): string { - return "text/plain"; - } - public getRootParseNode( - contentType: string, - content: ArrayBuffer - ): ParseNode { - if (!content) { - throw new Error("content cannot be undefined of empty"); - } else if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } else if (this.getValidContentType() !== contentType) { - throw new Error(`expected a ${this.getValidContentType()} content type`); - } - return new TextParseNode(this.convertArrayBufferToText(content)); - } + public getValidContentType(): string { + return "text/plain"; + } + public getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode { + if (!content) { + throw new Error("content cannot be undefined of empty"); + } else if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } else if (this.getValidContentType() !== contentType) { + throw new Error(`expected a ${this.getValidContentType()} content type`); + } + return new TextParseNode(this.convertArrayBufferToText(content)); + } - private convertArrayBufferToText(arrayBuffer: ArrayBuffer) { - const decoder = new TextDecoder(); - return decoder.decode(arrayBuffer); - } + private convertArrayBufferToText(arrayBuffer: ArrayBuffer) { + const decoder = new TextDecoder(); + return decoder.decode(arrayBuffer); + } } diff --git a/packages/serialization/text/src/textSerializationWriter.ts b/packages/serialization/text/src/textSerializationWriter.ts index 6119d4898..437980c00 100644 --- a/packages/serialization/text/src/textSerializationWriter.ts +++ b/packages/serialization/text/src/textSerializationWriter.ts @@ -1,141 +1,127 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + /* eslint-disable @typescript-eslint/no-unused-vars */ -import type { - DateOnly, - Duration, - ModelSerializerFunction, - Parsable, - SerializationWriter, - TimeOnly, -} from "@microsoft/kiota-abstractions"; +import { inNodeEnv, type DateOnly, type Duration, type ModelSerializerFunction, type Parsable, type SerializationWriter, type TimeOnly } from "@microsoft/kiota-abstractions"; import type { Guid } from "guid-typescript"; export class TextSerializationWriter implements SerializationWriter { - public writeByteArrayValue( - key?: string | undefined, - value?: ArrayBuffer | undefined, - ): void { - if (!value) { - throw new Error("value cannot be undefined"); - } - const b64 = Buffer.from(value).toString("base64"); - this.writeStringValue(key, b64); - } - private static noStructuredDataMessage = - "text does not support structured data"; - private readonly writer: string[] = []; - public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; - public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; - public onStartObjectSerialization: - | ((value: Parsable, writer: SerializationWriter) => void) - | undefined; - public writeStringValue = (key?: string, value?: string): void => { - if (key || key !== "") { - throw new Error(TextSerializationWriter.noStructuredDataMessage); - } - if (value) { - if (this.writer.length > 0) { - throw new Error( - "a value was already written for this serialization writer, text content only supports a single value" - ); - } else { - this.writer.push(value); - } - } - }; - public writeBooleanValue = (key?: string, value?: boolean): void => { - if (value !== null && value !== undefined) { - this.writeStringValue(key, `${value}`); - } - }; - public writeNumberValue = (key?: string, value?: number): void => { - if (value) { - this.writeStringValue(key, `${value}`); - } - }; - public writeGuidValue = (key?: string, value?: Guid): void => { - if (value) { - this.writeStringValue(key, `"${value}"`); - } - }; - public writeDateValue = (key?: string, value?: Date): void => { - if (value) { - this.writeStringValue(key, `"${value.toISOString()}"`); - } - }; - public writeDateOnlyValue = (key?: string, value?: DateOnly): void => { - if (value) { - this.writeStringValue(key, `"${value.toString()}"`); - } - }; - public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => { - if (value) { - this.writeStringValue(key, `"${value.toString()}"`); - } - }; - public writeDurationValue = (key?: string, value?: Duration): void => { - if (value) { - this.writeStringValue(key, `"${value.toString()}"`); - } - }; - public writeNullValue = (key?: string): void => { - this.writeStringValue(key, `null`); - }; - public writeCollectionOfPrimitiveValues = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - key?: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - values?: T[] - ): void => { - throw new Error(TextSerializationWriter.noStructuredDataMessage); - }; - public writeCollectionOfObjectValues = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - key?: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - values?: T[], - serializerMethod?: ModelSerializerFunction - ): void => { - throw new Error(TextSerializationWriter.noStructuredDataMessage); - }; - public writeObjectValue = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - key?: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - value?: T, - serializerMethod?: ModelSerializerFunction - ): void => { - throw new Error(TextSerializationWriter.noStructuredDataMessage); - }; - public writeEnumValue = ( - key?: string | undefined, - ...values: (T | undefined)[] - ): void => { - if (values.length > 0) { - const rawValues = values - .filter((x) => x !== undefined) - .map((x) => `${x}`); - if (rawValues.length > 0) { - this.writeStringValue( - key, - rawValues.reduce((x, y) => `${x}, ${y}`) - ); - } - } - }; - public getSerializedContent = (): ArrayBuffer => { - return this.convertStringToArrayBuffer(this.writer.join(``)); - }; + public writeByteArrayValue(key?: string | undefined, value?: ArrayBuffer | undefined): void { + if (!value) { + throw new Error("value cannot be undefined"); + } + const b64 = inNodeEnv() ? Buffer.from(value).toString("base64") : btoa(new TextDecoder().decode(value)); + + this.writeStringValue(key, b64); + } + private static noStructuredDataMessage = "text does not support structured data"; + private readonly writer: string[] = []; + public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; + public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; + public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; + public writeStringValue = (key?: string, value?: string): void => { + if (key || key !== "") { + throw new Error(TextSerializationWriter.noStructuredDataMessage); + } + if (value) { + if (this.writer.length > 0) { + throw new Error("a value was already written for this serialization writer, text content only supports a single value"); + } else { + this.writer.push(value); + } + } + }; + public writeBooleanValue = (key?: string, value?: boolean): void => { + if (value !== null && value !== undefined) { + this.writeStringValue(key, `${value}`); + } + }; + public writeNumberValue = (key?: string, value?: number): void => { + if (value) { + this.writeStringValue(key, `${value}`); + } + }; + public writeGuidValue = (key?: string, value?: Guid): void => { + if (value) { + this.writeStringValue(key, `"${value}"`); + } + }; + public writeDateValue = (key?: string, value?: Date): void => { + if (value) { + this.writeStringValue(key, `"${value.toISOString()}"`); + } + }; + public writeDateOnlyValue = (key?: string, value?: DateOnly): void => { + if (value) { + this.writeStringValue(key, `"${value.toString()}"`); + } + }; + public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => { + if (value) { + this.writeStringValue(key, `"${value.toString()}"`); + } + }; + public writeDurationValue = (key?: string, value?: Duration): void => { + if (value) { + this.writeStringValue(key, `"${value.toString()}"`); + } + }; + public writeNullValue = (key?: string): void => { + this.writeStringValue(key, `null`); + }; + public writeCollectionOfPrimitiveValues = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + key?: string, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + values?: T[], + ): void => { + throw new Error(TextSerializationWriter.noStructuredDataMessage); + }; + public writeCollectionOfObjectValues = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + key?: string, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + values?: T[], + serializerMethod?: ModelSerializerFunction, + ): void => { + throw new Error(TextSerializationWriter.noStructuredDataMessage); + }; + public writeObjectValue = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + key?: string, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + value?: T, + serializerMethod?: ModelSerializerFunction, + ): void => { + throw new Error(TextSerializationWriter.noStructuredDataMessage); + }; + public writeEnumValue = (key?: string | undefined, ...values: (T | undefined)[]): void => { + if (values.length > 0) { + const rawValues = values.filter((x) => x !== undefined).map((x) => `${x}`); + if (rawValues.length > 0) { + this.writeStringValue( + key, + rawValues.reduce((x, y) => `${x}, ${y}`), + ); + } + } + }; + public getSerializedContent = (): ArrayBuffer => { + return this.convertStringToArrayBuffer(this.writer.join(``)); + }; - private convertStringToArrayBuffer = (str: string): ArrayBuffer => { - const encoder = new TextEncoder(); - const encodedString = encoder.encode(str); - return encodedString.buffer; - }; + private convertStringToArrayBuffer = (str: string): ArrayBuffer => { + const encoder = new TextEncoder(); + const encodedString = encoder.encode(str); + return encodedString.buffer; + }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeAdditionalData = ( - value: Record | undefined - ): void => { - throw new Error(TextSerializationWriter.noStructuredDataMessage); - }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public writeAdditionalData = (value: Record | undefined): void => { + throw new Error(TextSerializationWriter.noStructuredDataMessage); + }; } diff --git a/packages/serialization/text/src/textSerializationWriterFactory.ts b/packages/serialization/text/src/textSerializationWriterFactory.ts index 10536a951..ed6bdf6e8 100644 --- a/packages/serialization/text/src/textSerializationWriterFactory.ts +++ b/packages/serialization/text/src/textSerializationWriterFactory.ts @@ -1,21 +1,24 @@ -import type { - SerializationWriter, - SerializationWriterFactory, -} from "@microsoft/kiota-abstractions"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import type { SerializationWriter, SerializationWriterFactory } from "@microsoft/kiota-abstractions"; import { TextSerializationWriter } from "./textSerializationWriter"; -export class TextSerializationWriterFactory - implements SerializationWriterFactory { - public getValidContentType(): string { - return "text/plain"; - } - public getSerializationWriter(contentType: string): SerializationWriter { - if (!contentType) { - throw new Error("content type cannot be undefined or empty"); - } else if (this.getValidContentType() !== contentType) { - throw new Error(`expected a ${this.getValidContentType()} content type`); - } - return new TextSerializationWriter(); - } +export class TextSerializationWriterFactory implements SerializationWriterFactory { + public getValidContentType(): string { + return "text/plain"; + } + public getSerializationWriter(contentType: string): SerializationWriter { + if (!contentType) { + throw new Error("content type cannot be undefined or empty"); + } else if (this.getValidContentType() !== contentType) { + throw new Error(`expected a ${this.getValidContentType()} content type`); + } + return new TextSerializationWriter(); + } } diff --git a/packages/serialization/text/test/browser/index.ts b/packages/serialization/text/test/browser/index.ts index 424df1d81..da901f2f2 100644 --- a/packages/serialization/text/test/browser/index.ts +++ b/packages/serialization/text/test/browser/index.ts @@ -1 +1,8 @@ -export * from "../common/textParseNode"; \ No newline at end of file +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +export * from "../common/textParseNode"; diff --git a/packages/serialization/text/test/common/textParseNode.ts b/packages/serialization/text/test/common/textParseNode.ts index f8bf9da22..4e935ca75 100644 --- a/packages/serialization/text/test/common/textParseNode.ts +++ b/packages/serialization/text/test/common/textParseNode.ts @@ -1,31 +1,38 @@ -import { assert } from "chai"; -import { v1 as uuidv1, v4 as uuidv4, v5 as uuidv5} from "uuid"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; +import { v1 as uuidv1, v4 as uuidv4, v5 as uuidv5 } from "uuid"; import { TextParseNode } from "../../src/index"; describe("textParseNode", () => { - it("textParseNode", async () => { - const textParseNode = new TextParseNode("Test"); - assert.isDefined(textParseNode); - }); + it("textParseNode", async () => { + const textParseNode = new TextParseNode("Test"); + assert.isDefined(textParseNode); + }); - it("parses guid values", async () => { - const emptyGuidParseNode = new TextParseNode("00000000-0000-0000-0000-000000000000"); - assert.isDefined(emptyGuidParseNode); - assert.isDefined(emptyGuidParseNode.getGuidValue()); - const invalidGuidParseNode = new TextParseNode("invalid-guid-value"); - assert.isUndefined(invalidGuidParseNode.getGuidValue()); - // check V1 guid - const v1 = uuidv1(); - const v1Guid = new TextParseNode(v1); - assert.isDefined(v1Guid.getGuidValue()); - // check v4 guid - const v4 = uuidv4(); - const v4Guid = new TextParseNode(v4); - assert.isDefined(v4Guid.getGuidValue()); - // check v5 guid - const v5 = uuidv5("example.com", uuidv5.URL); - const v5Guid = new TextParseNode(v5); - assert.isDefined(v5Guid.getGuidValue()); - }); + it("parses guid values", async () => { + const emptyGuidParseNode = new TextParseNode("00000000-0000-0000-0000-000000000000"); + assert.isDefined(emptyGuidParseNode); + assert.isDefined(emptyGuidParseNode.getGuidValue()); + const invalidGuidParseNode = new TextParseNode("invalid-guid-value"); + assert.isUndefined(invalidGuidParseNode.getGuidValue()); + // check V1 guid + const v1 = uuidv1(); + const v1Guid = new TextParseNode(v1); + assert.isDefined(v1Guid.getGuidValue()); + // check v4 guid + const v4 = uuidv4(); + const v4Guid = new TextParseNode(v4); + assert.isDefined(v4Guid.getGuidValue()); + // check v5 guid + const v5 = uuidv5("example.com", uuidv5.URL); + const v5Guid = new TextParseNode(v5); + assert.isDefined(v5Guid.getGuidValue()); + }); }); diff --git a/packages/serialization/text/test/common/textParseNodeFactory.ts b/packages/serialization/text/test/common/textParseNodeFactory.ts index 35f3e7bde..ebe8cb564 100644 --- a/packages/serialization/text/test/common/textParseNodeFactory.ts +++ b/packages/serialization/text/test/common/textParseNodeFactory.ts @@ -1,21 +1,27 @@ -import { assert } from "chai"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert, describe, it } from "vitest"; import { TextParseNodeFactory } from "../../src/index"; describe("textParseNodeFactory", () => { - it("textParseNodeFactory", async () => { - const textParseNodeFactory = new TextParseNodeFactory(); - assert.isDefined(textParseNodeFactory); - }); - it("textParseNodeFactory:convertArrayBufferToText should convert an array to text", async () => { - const textParseNodeFactory = new TextParseNodeFactory(); + it("textParseNodeFactory", async () => { + const textParseNodeFactory = new TextParseNodeFactory(); + assert.isDefined(textParseNodeFactory); + }); + it("textParseNodeFactory:convertArrayBufferToText should convert an array to text", async () => { + const textParseNodeFactory = new TextParseNodeFactory(); - const expectedText = "hello serializer"; - const sampleArrayBuffer = new TextEncoder().encode(expectedText); + const expectedText = "hello serializer"; + const sampleArrayBuffer = new TextEncoder().encode(expectedText); - const outputText = - textParseNodeFactory["convertArrayBufferToText"](sampleArrayBuffer); + const outputText = textParseNodeFactory["convertArrayBufferToText"](sampleArrayBuffer); - assert.equal(outputText, expectedText); - }); + assert.equal(outputText, expectedText); + }); }); diff --git a/packages/serialization/text/tsconfig.base.json b/packages/serialization/text/tsconfig.base.json deleted file mode 100644 index 9c70359b1..000000000 --- a/packages/serialization/text/tsconfig.base.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "importHelpers": true, - "noEmitOnError": true, - "moduleResolution": "node", - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "declarationMap": true, - "composite": true, - "paths": { - "@microsoft/kiota-abstractions": [ - "../../abstractions" - ], - } - } -} \ No newline at end of file diff --git a/packages/serialization/text/tsconfig.cjs.json b/packages/serialization/text/tsconfig.cjs.json deleted file mode 100644 index 00b535503..000000000 --- a/packages/serialization/text/tsconfig.cjs.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2017", - "module": "commonjs", - "outDir": "./dist/cjs" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test"], - "references": [ - { - "path": "../../abstractions/tsconfig.cjs.json" - }, - ] -} \ No newline at end of file diff --git a/packages/serialization/text/tsconfig.es.json b/packages/serialization/text/tsconfig.es.json deleted file mode 100644 index 67107d65f..000000000 --- a/packages/serialization/text/tsconfig.es.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "dist/es/" - }, - "exclude": ["node_modules", "dist"], - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "references": [ - { - "path": "../../abstractions/tsconfig.es.json" - }, - ] -} \ No newline at end of file diff --git a/packages/serialization/text/tsconfig.json b/packages/serialization/text/tsconfig.json new file mode 100644 index 000000000..08e73eac1 --- /dev/null +++ b/packages/serialization/text/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist/es/" + }, + "include": [ + "./src/**/*.ts", + ], +} \ No newline at end of file diff --git a/packages/serialization/text/vitest.config.mts b/packages/serialization/text/vitest.config.mts new file mode 100644 index 000000000..16577bafc --- /dev/null +++ b/packages/serialization/text/vitest.config.mts @@ -0,0 +1,11 @@ +import { defineConfig, configDefaults } from "vitest/config"; + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude, "**/*/{testEntity,index}.ts"], + include: [...configDefaults.include, "test/**/*.ts"], + coverage: { + reporter: ["html"], + }, + }, +}); \ No newline at end of file diff --git a/packages/test/.eslintignore b/packages/test/.eslintignore deleted file mode 100644 index 1f80e8eea..000000000 --- a/packages/test/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -*.js -*.js.map -*.d.ts - -node_modules -dist diff --git a/packages/test/.eslintrc.js b/packages/test/.eslintrc.js deleted file mode 100644 index e228f5234..000000000 --- a/packages/test/.eslintrc.js +++ /dev/null @@ -1,37 +0,0 @@ -module.exports = { - "env": { - "browser": true, - "es2021": true, - "node": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended" - ], - "overrides": [ - { - "env": { - "node": true - }, - "files": [ - ".eslintrc.{js,cjs}" - ], - "parserOptions": { - "sourceType": "script" - } - } - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "@typescript-eslint/consistent-type-imports": "error", - "@typescript-eslint/no-unused-vars": "warn", - "no-extra-semi" : "warn" - } -} diff --git a/packages/test/generatedCode/apiClient.ts b/packages/test/generatedCode/apiClient.ts index b7c7406aa..e0d0b803a 100644 --- a/packages/test/generatedCode/apiClient.ts +++ b/packages/test/generatedCode/apiClient.ts @@ -1,41 +1,41 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { type UsersRequestBuilder, UsersRequestBuilderNavigationMetadata } from './users/'; -import { apiClientProxifier, registerDefaultDeserializer, registerDefaultSerializer, type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type RequestAdapter } from '@microsoft/kiota-abstractions'; -import { FormParseNodeFactory, FormSerializationWriterFactory } from '@microsoft/kiota-serialization-form'; -import { JsonParseNodeFactory, JsonSerializationWriterFactory } from '@microsoft/kiota-serialization-json'; -import { MultipartSerializationWriterFactory } from '@microsoft/kiota-serialization-multipart'; -import { TextParseNodeFactory, TextSerializationWriterFactory } from '@microsoft/kiota-serialization-text'; +import { type UsersRequestBuilder, UsersRequestBuilderNavigationMetadata } from "./users/"; +import { apiClientProxifier, registerDefaultDeserializer, registerDefaultSerializer, type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type RequestAdapter } from "@microsoft/kiota-abstractions"; +import { FormParseNodeFactory, FormSerializationWriterFactory } from "@microsoft/kiota-serialization-form"; +import { JsonParseNodeFactory, JsonSerializationWriterFactory } from "@microsoft/kiota-serialization-json"; +import { MultipartSerializationWriterFactory } from "@microsoft/kiota-serialization-multipart"; +import { TextParseNodeFactory, TextSerializationWriterFactory } from "@microsoft/kiota-serialization-text"; /** * The main entry point of the SDK, exposes the configuration and the fluent API. */ export interface ApiClient extends BaseRequestBuilder { - /** - * The users property - */ - get users(): UsersRequestBuilder; + /** + * The users property + */ + get users(): UsersRequestBuilder; } /** * Instantiates a new {@link ApiClient} and sets the default values. * @param requestAdapter The request adapter to use to execute the requests. */ export function createApiClient(requestAdapter: RequestAdapter) { - registerDefaultSerializer(JsonSerializationWriterFactory); - registerDefaultSerializer(TextSerializationWriterFactory); - registerDefaultSerializer(FormSerializationWriterFactory); - registerDefaultSerializer(MultipartSerializationWriterFactory); - registerDefaultDeserializer(JsonParseNodeFactory); - registerDefaultDeserializer(TextParseNodeFactory); - registerDefaultDeserializer(FormParseNodeFactory); - if (requestAdapter.baseUrl === undefined || requestAdapter.baseUrl === "") { - requestAdapter.baseUrl = "https://graph.microsoft.com/v1.0"; - } - const pathParameters: Record = { - "baseurl": requestAdapter.baseUrl, - }; - return apiClientProxifier(requestAdapter, pathParameters, ApiClientNavigationMetadata, undefined); + registerDefaultSerializer(JsonSerializationWriterFactory); + registerDefaultSerializer(TextSerializationWriterFactory); + registerDefaultSerializer(FormSerializationWriterFactory); + registerDefaultSerializer(MultipartSerializationWriterFactory); + registerDefaultDeserializer(JsonParseNodeFactory); + registerDefaultDeserializer(TextParseNodeFactory); + registerDefaultDeserializer(FormParseNodeFactory); + if (requestAdapter.baseUrl === undefined || requestAdapter.baseUrl === "") { + requestAdapter.baseUrl = "https://graph.microsoft.com/v1.0"; + } + const pathParameters: Record = { + baseurl: requestAdapter.baseUrl, + }; + return apiClientProxifier(requestAdapter, pathParameters, ApiClientNavigationMetadata, undefined); } /** * Uri template for the request builder. @@ -45,9 +45,9 @@ export const ApiClientUriTemplate = "{+baseurl}"; * Metadata for all the navigation properties in the request builder. */ export const ApiClientNavigationMetadata: Record, NavigationMetadata> = { - users: { - navigationMetadata: UsersRequestBuilderNavigationMetadata, - }, + users: { + navigationMetadata: UsersRequestBuilderNavigationMetadata, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/models/index.ts b/packages/test/generatedCode/models/index.ts index b8a9bae1b..48728fb59 100644 --- a/packages/test/generatedCode/models/index.ts +++ b/packages/test/generatedCode/models/index.ts @@ -1,43 +1,43 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { type AdditionalDataHolder, type Parsable, type ParseNode, type SerializationWriter } from '@microsoft/kiota-abstractions'; +import { type AdditionalDataHolder, type Parsable, type ParseNode, type SerializationWriter } from "@microsoft/kiota-abstractions"; export interface Attachment extends Entity, Parsable { - /** - * The MIME type. - */ - contentType?: string; - /** - * true if the attachment is an inline attachment; otherwise, false. - */ - isInline?: boolean; - /** - * The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z - */ - lastModifiedDateTime?: Date; - /** - * The attachment's file name. - */ - name?: string; - /** - * The length of the attachment in bytes. - */ - size?: number; + /** + * The MIME type. + */ + contentType?: string; + /** + * true if the attachment is an inline attachment; otherwise, false. + */ + isInline?: boolean; + /** + * The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z + */ + lastModifiedDateTime?: Date; + /** + * The attachment's file name. + */ + name?: string; + /** + * The length of the attachment in bytes. + */ + size?: number; } export interface AttachmentCollectionResponse extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The OdataNextLink property - */ - odataNextLink?: string; - /** - * The value property - */ - value?: Attachment[]; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The OdataNextLink property + */ + odataNextLink?: string; + /** + * The value property + */ + value?: Attachment[]; } export type BodyType = (typeof BodyTypeObject)[keyof typeof BodyTypeObject]; /** @@ -45,1522 +45,1785 @@ export type BodyType = (typeof BodyTypeObject)[keyof typeof BodyTypeObject]; * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {AttachmentCollectionResponse} */ -export function createAttachmentCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoAttachmentCollectionResponse; +export function createAttachmentCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoAttachmentCollectionResponse; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {Attachment} */ -export function createAttachmentFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoAttachment; +export function createAttachmentFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoAttachment; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {DateTimeTimeZone} */ -export function createDateTimeTimeZoneFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoDateTimeTimeZone; +export function createDateTimeTimeZoneFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoDateTimeTimeZone; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {EmailAddress} */ -export function createEmailAddressFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoEmailAddress; +export function createEmailAddressFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoEmailAddress; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {Entity} */ -export function createEntityFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoEntity; +export function createEntityFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoEntity; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {ExtensionCollectionResponse} */ -export function createExtensionCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoExtensionCollectionResponse; +export function createExtensionCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoExtensionCollectionResponse; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {Extension} */ -export function createExtensionFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoExtension; +export function createExtensionFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoExtension; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {FollowupFlag} */ -export function createFollowupFlagFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoFollowupFlag; +export function createFollowupFlagFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoFollowupFlag; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {InferenceClassification} */ -export function createInferenceClassificationFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoInferenceClassification; +export function createInferenceClassificationFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoInferenceClassification; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {InferenceClassificationOverrideCollectionResponse} */ -export function createInferenceClassificationOverrideCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoInferenceClassificationOverrideCollectionResponse; +export function createInferenceClassificationOverrideCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoInferenceClassificationOverrideCollectionResponse; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {InferenceClassificationOverride} */ -export function createInferenceClassificationOverrideFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoInferenceClassificationOverride; +export function createInferenceClassificationOverrideFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoInferenceClassificationOverride; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {InternetMessageHeader} */ -export function createInternetMessageHeaderFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoInternetMessageHeader; +export function createInternetMessageHeaderFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoInternetMessageHeader; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {ItemBody} */ -export function createItemBodyFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoItemBody; +export function createItemBodyFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoItemBody; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MailFolderCollectionResponse} */ -export function createMailFolderCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoMailFolderCollectionResponse; +export function createMailFolderCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoMailFolderCollectionResponse; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MailFolder} */ -export function createMailFolderFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoMailFolder; +export function createMailFolderFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoMailFolder; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MessageCollectionResponse} */ -export function createMessageCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoMessageCollectionResponse; +export function createMessageCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoMessageCollectionResponse; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {Message} */ -export function createMessageFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoMessage; +export function createMessageFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoMessage; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MessageRuleActions} */ -export function createMessageRuleActionsFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoMessageRuleActions; +export function createMessageRuleActionsFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoMessageRuleActions; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MessageRuleCollectionResponse} */ -export function createMessageRuleCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoMessageRuleCollectionResponse; +export function createMessageRuleCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoMessageRuleCollectionResponse; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MessageRule} */ -export function createMessageRuleFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoMessageRule; +export function createMessageRuleFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoMessageRule; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MessageRulePredicates} */ -export function createMessageRulePredicatesFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoMessageRulePredicates; +export function createMessageRulePredicatesFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoMessageRulePredicates; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MultiValueLegacyExtendedProperty} */ -export function createMultiValueLegacyExtendedPropertyFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoMultiValueLegacyExtendedProperty; +export function createMultiValueLegacyExtendedPropertyFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoMultiValueLegacyExtendedProperty; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {OutlookItem} */ -export function createOutlookItemFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoOutlookItem; +export function createOutlookItemFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoOutlookItem; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {Recipient} */ -export function createRecipientFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoRecipient; +export function createRecipientFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoRecipient; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {SingleValueLegacyExtendedProperty} */ -export function createSingleValueLegacyExtendedPropertyFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoSingleValueLegacyExtendedProperty; +export function createSingleValueLegacyExtendedPropertyFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoSingleValueLegacyExtendedProperty; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {SizeRange} */ -export function createSizeRangeFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoSizeRange; +export function createSizeRangeFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoSizeRange; } export interface DateTimeTimeZone extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * A single point of time in a combined date and time representation ({date}T{time}; for example, 2017-08-29T04:00:00.0000000). - */ - dateTime?: string; - /** - * Represents a time zone, for example, 'Pacific Standard Time'. See below for more possible values. - */ - timeZone?: string; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * A single point of time in a combined date and time representation ({date}T{time}; for example, 2017-08-29T04:00:00.0000000). + */ + dateTime?: string; + /** + * Represents a time zone, for example, 'Pacific Standard Time'. See below for more possible values. + */ + timeZone?: string; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoAttachment(attachment: Partial | undefined = {}) : Record void> { - return { - ...deserializeIntoEntity(attachment), - "contentType": n => { attachment.contentType = n.getStringValue(); }, - "isInline": n => { attachment.isInline = n.getBooleanValue(); }, - "lastModifiedDateTime": n => { attachment.lastModifiedDateTime = n.getDateValue(); }, - "name": n => { attachment.name = n.getStringValue(); }, - "size": n => { attachment.size = n.getNumberValue(); }, - } +export function deserializeIntoAttachment(attachment: Partial | undefined = {}): Record void> { + return { + ...deserializeIntoEntity(attachment), + contentType: (n) => { + attachment.contentType = n.getStringValue(); + }, + isInline: (n) => { + attachment.isInline = n.getBooleanValue(); + }, + lastModifiedDateTime: (n) => { + attachment.lastModifiedDateTime = n.getDateValue(); + }, + name: (n) => { + attachment.name = n.getStringValue(); + }, + size: (n) => { + attachment.size = n.getNumberValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoAttachmentCollectionResponse(attachmentCollectionResponse: Partial | undefined = {}) : Record void> { - return { - "@odata.nextLink": n => { attachmentCollectionResponse.odataNextLink = n.getStringValue(); }, - "value": n => { attachmentCollectionResponse.value = n.getCollectionOfObjectValues(createAttachmentFromDiscriminatorValue); }, - } +export function deserializeIntoAttachmentCollectionResponse(attachmentCollectionResponse: Partial | undefined = {}): Record void> { + return { + "@odata.nextLink": (n) => { + attachmentCollectionResponse.odataNextLink = n.getStringValue(); + }, + value: (n) => { + attachmentCollectionResponse.value = n.getCollectionOfObjectValues(createAttachmentFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoDateTimeTimeZone(dateTimeTimeZone: Partial | undefined = {}) : Record void> { - return { - "dateTime": n => { dateTimeTimeZone.dateTime = n.getStringValue(); }, - "timeZone": n => { dateTimeTimeZone.timeZone = n.getStringValue(); }, - } +export function deserializeIntoDateTimeTimeZone(dateTimeTimeZone: Partial | undefined = {}): Record void> { + return { + dateTime: (n) => { + dateTimeTimeZone.dateTime = n.getStringValue(); + }, + timeZone: (n) => { + dateTimeTimeZone.timeZone = n.getStringValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoEmailAddress(emailAddress: Partial | undefined = {}) : Record void> { - return { - "address": n => { emailAddress.address = n.getStringValue(); }, - "name": n => { emailAddress.name = n.getStringValue(); }, - } +export function deserializeIntoEmailAddress(emailAddress: Partial | undefined = {}): Record void> { + return { + address: (n) => { + emailAddress.address = n.getStringValue(); + }, + name: (n) => { + emailAddress.name = n.getStringValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoEntity(entity: Partial | undefined = {}) : Record void> { - return { - "id": n => { entity.id = n.getStringValue(); }, - } +export function deserializeIntoEntity(entity: Partial | undefined = {}): Record void> { + return { + id: (n) => { + entity.id = n.getStringValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoExtension(extension: Partial | undefined = {}) : Record void> { - return { - ...deserializeIntoEntity(extension), - } +export function deserializeIntoExtension(extension: Partial | undefined = {}): Record void> { + return { + ...deserializeIntoEntity(extension), + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoExtensionCollectionResponse(extensionCollectionResponse: Partial | undefined = {}) : Record void> { - return { - "@odata.nextLink": n => { extensionCollectionResponse.odataNextLink = n.getStringValue(); }, - "value": n => { extensionCollectionResponse.value = n.getCollectionOfObjectValues(createExtensionFromDiscriminatorValue); }, - } +export function deserializeIntoExtensionCollectionResponse(extensionCollectionResponse: Partial | undefined = {}): Record void> { + return { + "@odata.nextLink": (n) => { + extensionCollectionResponse.odataNextLink = n.getStringValue(); + }, + value: (n) => { + extensionCollectionResponse.value = n.getCollectionOfObjectValues(createExtensionFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoFollowupFlag(followupFlag: Partial | undefined = {}) : Record void> { - return { - "completedDateTime": n => { followupFlag.completedDateTime = n.getObjectValue(createDateTimeTimeZoneFromDiscriminatorValue); }, - "dueDateTime": n => { followupFlag.dueDateTime = n.getObjectValue(createDateTimeTimeZoneFromDiscriminatorValue); }, - "flagStatus": n => { followupFlag.flagStatus = n.getEnumValue(FollowupFlagStatusObject); }, - "startDateTime": n => { followupFlag.startDateTime = n.getObjectValue(createDateTimeTimeZoneFromDiscriminatorValue); }, - } +export function deserializeIntoFollowupFlag(followupFlag: Partial | undefined = {}): Record void> { + return { + completedDateTime: (n) => { + followupFlag.completedDateTime = n.getObjectValue(createDateTimeTimeZoneFromDiscriminatorValue); + }, + dueDateTime: (n) => { + followupFlag.dueDateTime = n.getObjectValue(createDateTimeTimeZoneFromDiscriminatorValue); + }, + flagStatus: (n) => { + followupFlag.flagStatus = n.getEnumValue(FollowupFlagStatusObject); + }, + startDateTime: (n) => { + followupFlag.startDateTime = n.getObjectValue(createDateTimeTimeZoneFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoInferenceClassification(inferenceClassification: Partial | undefined = {}) : Record void> { - return { - ...deserializeIntoEntity(inferenceClassification), - "overrides": n => { inferenceClassification.overrides = n.getCollectionOfObjectValues(createInferenceClassificationOverrideFromDiscriminatorValue); }, - } +export function deserializeIntoInferenceClassification(inferenceClassification: Partial | undefined = {}): Record void> { + return { + ...deserializeIntoEntity(inferenceClassification), + overrides: (n) => { + inferenceClassification.overrides = n.getCollectionOfObjectValues(createInferenceClassificationOverrideFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoInferenceClassificationOverride(inferenceClassificationOverride: Partial | undefined = {}) : Record void> { - return { - ...deserializeIntoEntity(inferenceClassificationOverride), - "classifyAs": n => { inferenceClassificationOverride.classifyAs = n.getEnumValue(InferenceClassificationTypeObject); }, - "senderEmailAddress": n => { inferenceClassificationOverride.senderEmailAddress = n.getObjectValue(createEmailAddressFromDiscriminatorValue); }, - } +export function deserializeIntoInferenceClassificationOverride(inferenceClassificationOverride: Partial | undefined = {}): Record void> { + return { + ...deserializeIntoEntity(inferenceClassificationOverride), + classifyAs: (n) => { + inferenceClassificationOverride.classifyAs = n.getEnumValue(InferenceClassificationTypeObject); + }, + senderEmailAddress: (n) => { + inferenceClassificationOverride.senderEmailAddress = n.getObjectValue(createEmailAddressFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoInferenceClassificationOverrideCollectionResponse(inferenceClassificationOverrideCollectionResponse: Partial | undefined = {}) : Record void> { - return { - "@odata.nextLink": n => { inferenceClassificationOverrideCollectionResponse.odataNextLink = n.getStringValue(); }, - "value": n => { inferenceClassificationOverrideCollectionResponse.value = n.getCollectionOfObjectValues(createInferenceClassificationOverrideFromDiscriminatorValue); }, - } +export function deserializeIntoInferenceClassificationOverrideCollectionResponse(inferenceClassificationOverrideCollectionResponse: Partial | undefined = {}): Record void> { + return { + "@odata.nextLink": (n) => { + inferenceClassificationOverrideCollectionResponse.odataNextLink = n.getStringValue(); + }, + value: (n) => { + inferenceClassificationOverrideCollectionResponse.value = n.getCollectionOfObjectValues(createInferenceClassificationOverrideFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoInternetMessageHeader(internetMessageHeader: Partial | undefined = {}) : Record void> { - return { - "name": n => { internetMessageHeader.name = n.getStringValue(); }, - "value": n => { internetMessageHeader.value = n.getStringValue(); }, - } +export function deserializeIntoInternetMessageHeader(internetMessageHeader: Partial | undefined = {}): Record void> { + return { + name: (n) => { + internetMessageHeader.name = n.getStringValue(); + }, + value: (n) => { + internetMessageHeader.value = n.getStringValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoItemBody(itemBody: Partial | undefined = {}) : Record void> { - return { - "content": n => { itemBody.content = n.getStringValue(); }, - "contentType": n => { itemBody.contentType = n.getEnumValue(BodyTypeObject); }, - } +export function deserializeIntoItemBody(itemBody: Partial | undefined = {}): Record void> { + return { + content: (n) => { + itemBody.content = n.getStringValue(); + }, + contentType: (n) => { + itemBody.contentType = n.getEnumValue(BodyTypeObject); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoMailFolder(mailFolder: Partial | undefined = {}) : Record void> { - return { - ...deserializeIntoEntity(mailFolder), - "childFolderCount": n => { mailFolder.childFolderCount = n.getNumberValue(); }, - "childFolders": n => { mailFolder.childFolders = n.getCollectionOfObjectValues(createMailFolderFromDiscriminatorValue); }, - "displayName": n => { mailFolder.displayName = n.getStringValue(); }, - "isHidden": n => { mailFolder.isHidden = n.getBooleanValue(); }, - "messageRules": n => { mailFolder.messageRules = n.getCollectionOfObjectValues(createMessageRuleFromDiscriminatorValue); }, - "messages": n => { mailFolder.messages = n.getCollectionOfObjectValues(createMessageFromDiscriminatorValue); }, - "multiValueExtendedProperties": n => { mailFolder.multiValueExtendedProperties = n.getCollectionOfObjectValues(createMultiValueLegacyExtendedPropertyFromDiscriminatorValue); }, - "parentFolderId": n => { mailFolder.parentFolderId = n.getStringValue(); }, - "singleValueExtendedProperties": n => { mailFolder.singleValueExtendedProperties = n.getCollectionOfObjectValues(createSingleValueLegacyExtendedPropertyFromDiscriminatorValue); }, - "totalItemCount": n => { mailFolder.totalItemCount = n.getNumberValue(); }, - "unreadItemCount": n => { mailFolder.unreadItemCount = n.getNumberValue(); }, - } +export function deserializeIntoMailFolder(mailFolder: Partial | undefined = {}): Record void> { + return { + ...deserializeIntoEntity(mailFolder), + childFolderCount: (n) => { + mailFolder.childFolderCount = n.getNumberValue(); + }, + childFolders: (n) => { + mailFolder.childFolders = n.getCollectionOfObjectValues(createMailFolderFromDiscriminatorValue); + }, + displayName: (n) => { + mailFolder.displayName = n.getStringValue(); + }, + isHidden: (n) => { + mailFolder.isHidden = n.getBooleanValue(); + }, + messageRules: (n) => { + mailFolder.messageRules = n.getCollectionOfObjectValues(createMessageRuleFromDiscriminatorValue); + }, + messages: (n) => { + mailFolder.messages = n.getCollectionOfObjectValues(createMessageFromDiscriminatorValue); + }, + multiValueExtendedProperties: (n) => { + mailFolder.multiValueExtendedProperties = n.getCollectionOfObjectValues(createMultiValueLegacyExtendedPropertyFromDiscriminatorValue); + }, + parentFolderId: (n) => { + mailFolder.parentFolderId = n.getStringValue(); + }, + singleValueExtendedProperties: (n) => { + mailFolder.singleValueExtendedProperties = n.getCollectionOfObjectValues(createSingleValueLegacyExtendedPropertyFromDiscriminatorValue); + }, + totalItemCount: (n) => { + mailFolder.totalItemCount = n.getNumberValue(); + }, + unreadItemCount: (n) => { + mailFolder.unreadItemCount = n.getNumberValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoMailFolderCollectionResponse(mailFolderCollectionResponse: Partial | undefined = {}) : Record void> { - return { - "@odata.nextLink": n => { mailFolderCollectionResponse.odataNextLink = n.getStringValue(); }, - "value": n => { mailFolderCollectionResponse.value = n.getCollectionOfObjectValues(createMailFolderFromDiscriminatorValue); }, - } +export function deserializeIntoMailFolderCollectionResponse(mailFolderCollectionResponse: Partial | undefined = {}): Record void> { + return { + "@odata.nextLink": (n) => { + mailFolderCollectionResponse.odataNextLink = n.getStringValue(); + }, + value: (n) => { + mailFolderCollectionResponse.value = n.getCollectionOfObjectValues(createMailFolderFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoMessage(message: Partial | undefined = {}) : Record void> { - return { - ...deserializeIntoOutlookItem(message), - "attachments": n => { message.attachments = n.getCollectionOfObjectValues(createAttachmentFromDiscriminatorValue); }, - "bccRecipients": n => { message.bccRecipients = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); }, - "body": n => { message.body = n.getObjectValue(createItemBodyFromDiscriminatorValue); }, - "bodyPreview": n => { message.bodyPreview = n.getStringValue(); }, - "ccRecipients": n => { message.ccRecipients = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); }, - "conversationId": n => { message.conversationId = n.getStringValue(); }, - "conversationIndex": n => { message.conversationIndex = n.getStringValue(); }, - "extensions": n => { message.extensions = n.getCollectionOfObjectValues(createExtensionFromDiscriminatorValue); }, - "flag": n => { message.flag = n.getObjectValue(createFollowupFlagFromDiscriminatorValue); }, - "from": n => { message.from = n.getObjectValue(createRecipientFromDiscriminatorValue); }, - "hasAttachments": n => { message.hasAttachments = n.getBooleanValue(); }, - "importance": n => { message.importance = n.getEnumValue(ImportanceObject); }, - "inferenceClassification": n => { message.inferenceClassification = n.getEnumValue(InferenceClassificationTypeObject); }, - "internetMessageHeaders": n => { message.internetMessageHeaders = n.getCollectionOfObjectValues(createInternetMessageHeaderFromDiscriminatorValue); }, - "internetMessageId": n => { message.internetMessageId = n.getStringValue(); }, - "isDeliveryReceiptRequested": n => { message.isDeliveryReceiptRequested = n.getBooleanValue(); }, - "isDraft": n => { message.isDraft = n.getBooleanValue(); }, - "isRead": n => { message.isRead = n.getBooleanValue(); }, - "isReadReceiptRequested": n => { message.isReadReceiptRequested = n.getBooleanValue(); }, - "multiValueExtendedProperties": n => { message.multiValueExtendedProperties = n.getCollectionOfObjectValues(createMultiValueLegacyExtendedPropertyFromDiscriminatorValue); }, - "parentFolderId": n => { message.parentFolderId = n.getStringValue(); }, - "receivedDateTime": n => { message.receivedDateTime = n.getDateValue(); }, - "replyTo": n => { message.replyTo = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); }, - "sender": n => { message.sender = n.getObjectValue(createRecipientFromDiscriminatorValue); }, - "sentDateTime": n => { message.sentDateTime = n.getDateValue(); }, - "singleValueExtendedProperties": n => { message.singleValueExtendedProperties = n.getCollectionOfObjectValues(createSingleValueLegacyExtendedPropertyFromDiscriminatorValue); }, - "subject": n => { message.subject = n.getStringValue(); }, - "toRecipients": n => { message.toRecipients = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); }, - "uniqueBody": n => { message.uniqueBody = n.getObjectValue(createItemBodyFromDiscriminatorValue); }, - "webLink": n => { message.webLink = n.getStringValue(); }, - } +export function deserializeIntoMessage(message: Partial | undefined = {}): Record void> { + return { + ...deserializeIntoOutlookItem(message), + attachments: (n) => { + message.attachments = n.getCollectionOfObjectValues(createAttachmentFromDiscriminatorValue); + }, + bccRecipients: (n) => { + message.bccRecipients = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); + }, + body: (n) => { + message.body = n.getObjectValue(createItemBodyFromDiscriminatorValue); + }, + bodyPreview: (n) => { + message.bodyPreview = n.getStringValue(); + }, + ccRecipients: (n) => { + message.ccRecipients = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); + }, + conversationId: (n) => { + message.conversationId = n.getStringValue(); + }, + conversationIndex: (n) => { + message.conversationIndex = n.getStringValue(); + }, + extensions: (n) => { + message.extensions = n.getCollectionOfObjectValues(createExtensionFromDiscriminatorValue); + }, + flag: (n) => { + message.flag = n.getObjectValue(createFollowupFlagFromDiscriminatorValue); + }, + from: (n) => { + message.from = n.getObjectValue(createRecipientFromDiscriminatorValue); + }, + hasAttachments: (n) => { + message.hasAttachments = n.getBooleanValue(); + }, + importance: (n) => { + message.importance = n.getEnumValue(ImportanceObject); + }, + inferenceClassification: (n) => { + message.inferenceClassification = n.getEnumValue(InferenceClassificationTypeObject); + }, + internetMessageHeaders: (n) => { + message.internetMessageHeaders = n.getCollectionOfObjectValues(createInternetMessageHeaderFromDiscriminatorValue); + }, + internetMessageId: (n) => { + message.internetMessageId = n.getStringValue(); + }, + isDeliveryReceiptRequested: (n) => { + message.isDeliveryReceiptRequested = n.getBooleanValue(); + }, + isDraft: (n) => { + message.isDraft = n.getBooleanValue(); + }, + isRead: (n) => { + message.isRead = n.getBooleanValue(); + }, + isReadReceiptRequested: (n) => { + message.isReadReceiptRequested = n.getBooleanValue(); + }, + multiValueExtendedProperties: (n) => { + message.multiValueExtendedProperties = n.getCollectionOfObjectValues(createMultiValueLegacyExtendedPropertyFromDiscriminatorValue); + }, + parentFolderId: (n) => { + message.parentFolderId = n.getStringValue(); + }, + receivedDateTime: (n) => { + message.receivedDateTime = n.getDateValue(); + }, + replyTo: (n) => { + message.replyTo = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); + }, + sender: (n) => { + message.sender = n.getObjectValue(createRecipientFromDiscriminatorValue); + }, + sentDateTime: (n) => { + message.sentDateTime = n.getDateValue(); + }, + singleValueExtendedProperties: (n) => { + message.singleValueExtendedProperties = n.getCollectionOfObjectValues(createSingleValueLegacyExtendedPropertyFromDiscriminatorValue); + }, + subject: (n) => { + message.subject = n.getStringValue(); + }, + toRecipients: (n) => { + message.toRecipients = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); + }, + uniqueBody: (n) => { + message.uniqueBody = n.getObjectValue(createItemBodyFromDiscriminatorValue); + }, + webLink: (n) => { + message.webLink = n.getStringValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoMessageCollectionResponse(messageCollectionResponse: Partial | undefined = {}) : Record void> { - return { - "@odata.nextLink": n => { messageCollectionResponse.odataNextLink = n.getStringValue(); }, - "value": n => { messageCollectionResponse.value = n.getCollectionOfObjectValues(createMessageFromDiscriminatorValue); }, - } +export function deserializeIntoMessageCollectionResponse(messageCollectionResponse: Partial | undefined = {}): Record void> { + return { + "@odata.nextLink": (n) => { + messageCollectionResponse.odataNextLink = n.getStringValue(); + }, + value: (n) => { + messageCollectionResponse.value = n.getCollectionOfObjectValues(createMessageFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoMessageRule(messageRule: Partial | undefined = {}) : Record void> { - return { - ...deserializeIntoEntity(messageRule), - "actions": n => { messageRule.actions = n.getObjectValue(createMessageRuleActionsFromDiscriminatorValue); }, - "conditions": n => { messageRule.conditions = n.getObjectValue(createMessageRulePredicatesFromDiscriminatorValue); }, - "displayName": n => { messageRule.displayName = n.getStringValue(); }, - "exceptions": n => { messageRule.exceptions = n.getObjectValue(createMessageRulePredicatesFromDiscriminatorValue); }, - "hasError": n => { messageRule.hasError = n.getBooleanValue(); }, - "isEnabled": n => { messageRule.isEnabled = n.getBooleanValue(); }, - "isReadOnly": n => { messageRule.isReadOnly = n.getBooleanValue(); }, - "sequence": n => { messageRule.sequence = n.getNumberValue(); }, - } +export function deserializeIntoMessageRule(messageRule: Partial | undefined = {}): Record void> { + return { + ...deserializeIntoEntity(messageRule), + actions: (n) => { + messageRule.actions = n.getObjectValue(createMessageRuleActionsFromDiscriminatorValue); + }, + conditions: (n) => { + messageRule.conditions = n.getObjectValue(createMessageRulePredicatesFromDiscriminatorValue); + }, + displayName: (n) => { + messageRule.displayName = n.getStringValue(); + }, + exceptions: (n) => { + messageRule.exceptions = n.getObjectValue(createMessageRulePredicatesFromDiscriminatorValue); + }, + hasError: (n) => { + messageRule.hasError = n.getBooleanValue(); + }, + isEnabled: (n) => { + messageRule.isEnabled = n.getBooleanValue(); + }, + isReadOnly: (n) => { + messageRule.isReadOnly = n.getBooleanValue(); + }, + sequence: (n) => { + messageRule.sequence = n.getNumberValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoMessageRuleActions(messageRuleActions: Partial | undefined = {}) : Record void> { - return { - "assignCategories": n => { messageRuleActions.assignCategories = n.getCollectionOfPrimitiveValues(); }, - "copyToFolder": n => { messageRuleActions.copyToFolder = n.getStringValue(); }, - "delete": n => { messageRuleActions.delete = n.getBooleanValue(); }, - "forwardAsAttachmentTo": n => { messageRuleActions.forwardAsAttachmentTo = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); }, - "forwardTo": n => { messageRuleActions.forwardTo = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); }, - "markAsRead": n => { messageRuleActions.markAsRead = n.getBooleanValue(); }, - "markImportance": n => { messageRuleActions.markImportance = n.getEnumValue(ImportanceObject); }, - "moveToFolder": n => { messageRuleActions.moveToFolder = n.getStringValue(); }, - "permanentDelete": n => { messageRuleActions.permanentDelete = n.getBooleanValue(); }, - "redirectTo": n => { messageRuleActions.redirectTo = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); }, - "stopProcessingRules": n => { messageRuleActions.stopProcessingRules = n.getBooleanValue(); }, - } +export function deserializeIntoMessageRuleActions(messageRuleActions: Partial | undefined = {}): Record void> { + return { + assignCategories: (n) => { + messageRuleActions.assignCategories = n.getCollectionOfPrimitiveValues(); + }, + copyToFolder: (n) => { + messageRuleActions.copyToFolder = n.getStringValue(); + }, + delete: (n) => { + messageRuleActions.delete = n.getBooleanValue(); + }, + forwardAsAttachmentTo: (n) => { + messageRuleActions.forwardAsAttachmentTo = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); + }, + forwardTo: (n) => { + messageRuleActions.forwardTo = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); + }, + markAsRead: (n) => { + messageRuleActions.markAsRead = n.getBooleanValue(); + }, + markImportance: (n) => { + messageRuleActions.markImportance = n.getEnumValue(ImportanceObject); + }, + moveToFolder: (n) => { + messageRuleActions.moveToFolder = n.getStringValue(); + }, + permanentDelete: (n) => { + messageRuleActions.permanentDelete = n.getBooleanValue(); + }, + redirectTo: (n) => { + messageRuleActions.redirectTo = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); + }, + stopProcessingRules: (n) => { + messageRuleActions.stopProcessingRules = n.getBooleanValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoMessageRuleCollectionResponse(messageRuleCollectionResponse: Partial | undefined = {}) : Record void> { - return { - "@odata.nextLink": n => { messageRuleCollectionResponse.odataNextLink = n.getStringValue(); }, - "value": n => { messageRuleCollectionResponse.value = n.getCollectionOfObjectValues(createMessageRuleFromDiscriminatorValue); }, - } +export function deserializeIntoMessageRuleCollectionResponse(messageRuleCollectionResponse: Partial | undefined = {}): Record void> { + return { + "@odata.nextLink": (n) => { + messageRuleCollectionResponse.odataNextLink = n.getStringValue(); + }, + value: (n) => { + messageRuleCollectionResponse.value = n.getCollectionOfObjectValues(createMessageRuleFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoMessageRulePredicates(messageRulePredicates: Partial | undefined = {}) : Record void> { - return { - "bodyContains": n => { messageRulePredicates.bodyContains = n.getCollectionOfPrimitiveValues(); }, - "bodyOrSubjectContains": n => { messageRulePredicates.bodyOrSubjectContains = n.getCollectionOfPrimitiveValues(); }, - "categories": n => { messageRulePredicates.categories = n.getCollectionOfPrimitiveValues(); }, - "fromAddresses": n => { messageRulePredicates.fromAddresses = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); }, - "hasAttachments": n => { messageRulePredicates.hasAttachments = n.getBooleanValue(); }, - "headerContains": n => { messageRulePredicates.headerContains = n.getCollectionOfPrimitiveValues(); }, - "importance": n => { messageRulePredicates.importance = n.getEnumValue(ImportanceObject); }, - "isApprovalRequest": n => { messageRulePredicates.isApprovalRequest = n.getBooleanValue(); }, - "isAutomaticForward": n => { messageRulePredicates.isAutomaticForward = n.getBooleanValue(); }, - "isAutomaticReply": n => { messageRulePredicates.isAutomaticReply = n.getBooleanValue(); }, - "isEncrypted": n => { messageRulePredicates.isEncrypted = n.getBooleanValue(); }, - "isMeetingRequest": n => { messageRulePredicates.isMeetingRequest = n.getBooleanValue(); }, - "isMeetingResponse": n => { messageRulePredicates.isMeetingResponse = n.getBooleanValue(); }, - "isNonDeliveryReport": n => { messageRulePredicates.isNonDeliveryReport = n.getBooleanValue(); }, - "isPermissionControlled": n => { messageRulePredicates.isPermissionControlled = n.getBooleanValue(); }, - "isReadReceipt": n => { messageRulePredicates.isReadReceipt = n.getBooleanValue(); }, - "isSigned": n => { messageRulePredicates.isSigned = n.getBooleanValue(); }, - "isVoicemail": n => { messageRulePredicates.isVoicemail = n.getBooleanValue(); }, - "messageActionFlag": n => { messageRulePredicates.messageActionFlag = n.getEnumValue(MessageActionFlagObject); }, - "notSentToMe": n => { messageRulePredicates.notSentToMe = n.getBooleanValue(); }, - "recipientContains": n => { messageRulePredicates.recipientContains = n.getCollectionOfPrimitiveValues(); }, - "senderContains": n => { messageRulePredicates.senderContains = n.getCollectionOfPrimitiveValues(); }, - "sensitivity": n => { messageRulePredicates.sensitivity = n.getEnumValue(SensitivityObject); }, - "sentCcMe": n => { messageRulePredicates.sentCcMe = n.getBooleanValue(); }, - "sentOnlyToMe": n => { messageRulePredicates.sentOnlyToMe = n.getBooleanValue(); }, - "sentToAddresses": n => { messageRulePredicates.sentToAddresses = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); }, - "sentToMe": n => { messageRulePredicates.sentToMe = n.getBooleanValue(); }, - "sentToOrCcMe": n => { messageRulePredicates.sentToOrCcMe = n.getBooleanValue(); }, - "subjectContains": n => { messageRulePredicates.subjectContains = n.getCollectionOfPrimitiveValues(); }, - "withinSizeRange": n => { messageRulePredicates.withinSizeRange = n.getObjectValue(createSizeRangeFromDiscriminatorValue); }, - } +export function deserializeIntoMessageRulePredicates(messageRulePredicates: Partial | undefined = {}): Record void> { + return { + bodyContains: (n) => { + messageRulePredicates.bodyContains = n.getCollectionOfPrimitiveValues(); + }, + bodyOrSubjectContains: (n) => { + messageRulePredicates.bodyOrSubjectContains = n.getCollectionOfPrimitiveValues(); + }, + categories: (n) => { + messageRulePredicates.categories = n.getCollectionOfPrimitiveValues(); + }, + fromAddresses: (n) => { + messageRulePredicates.fromAddresses = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); + }, + hasAttachments: (n) => { + messageRulePredicates.hasAttachments = n.getBooleanValue(); + }, + headerContains: (n) => { + messageRulePredicates.headerContains = n.getCollectionOfPrimitiveValues(); + }, + importance: (n) => { + messageRulePredicates.importance = n.getEnumValue(ImportanceObject); + }, + isApprovalRequest: (n) => { + messageRulePredicates.isApprovalRequest = n.getBooleanValue(); + }, + isAutomaticForward: (n) => { + messageRulePredicates.isAutomaticForward = n.getBooleanValue(); + }, + isAutomaticReply: (n) => { + messageRulePredicates.isAutomaticReply = n.getBooleanValue(); + }, + isEncrypted: (n) => { + messageRulePredicates.isEncrypted = n.getBooleanValue(); + }, + isMeetingRequest: (n) => { + messageRulePredicates.isMeetingRequest = n.getBooleanValue(); + }, + isMeetingResponse: (n) => { + messageRulePredicates.isMeetingResponse = n.getBooleanValue(); + }, + isNonDeliveryReport: (n) => { + messageRulePredicates.isNonDeliveryReport = n.getBooleanValue(); + }, + isPermissionControlled: (n) => { + messageRulePredicates.isPermissionControlled = n.getBooleanValue(); + }, + isReadReceipt: (n) => { + messageRulePredicates.isReadReceipt = n.getBooleanValue(); + }, + isSigned: (n) => { + messageRulePredicates.isSigned = n.getBooleanValue(); + }, + isVoicemail: (n) => { + messageRulePredicates.isVoicemail = n.getBooleanValue(); + }, + messageActionFlag: (n) => { + messageRulePredicates.messageActionFlag = n.getEnumValue(MessageActionFlagObject); + }, + notSentToMe: (n) => { + messageRulePredicates.notSentToMe = n.getBooleanValue(); + }, + recipientContains: (n) => { + messageRulePredicates.recipientContains = n.getCollectionOfPrimitiveValues(); + }, + senderContains: (n) => { + messageRulePredicates.senderContains = n.getCollectionOfPrimitiveValues(); + }, + sensitivity: (n) => { + messageRulePredicates.sensitivity = n.getEnumValue(SensitivityObject); + }, + sentCcMe: (n) => { + messageRulePredicates.sentCcMe = n.getBooleanValue(); + }, + sentOnlyToMe: (n) => { + messageRulePredicates.sentOnlyToMe = n.getBooleanValue(); + }, + sentToAddresses: (n) => { + messageRulePredicates.sentToAddresses = n.getCollectionOfObjectValues(createRecipientFromDiscriminatorValue); + }, + sentToMe: (n) => { + messageRulePredicates.sentToMe = n.getBooleanValue(); + }, + sentToOrCcMe: (n) => { + messageRulePredicates.sentToOrCcMe = n.getBooleanValue(); + }, + subjectContains: (n) => { + messageRulePredicates.subjectContains = n.getCollectionOfPrimitiveValues(); + }, + withinSizeRange: (n) => { + messageRulePredicates.withinSizeRange = n.getObjectValue(createSizeRangeFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoMultiValueLegacyExtendedProperty(multiValueLegacyExtendedProperty: Partial | undefined = {}) : Record void> { - return { - ...deserializeIntoEntity(multiValueLegacyExtendedProperty), - "value": n => { multiValueLegacyExtendedProperty.value = n.getCollectionOfPrimitiveValues(); }, - } +export function deserializeIntoMultiValueLegacyExtendedProperty(multiValueLegacyExtendedProperty: Partial | undefined = {}): Record void> { + return { + ...deserializeIntoEntity(multiValueLegacyExtendedProperty), + value: (n) => { + multiValueLegacyExtendedProperty.value = n.getCollectionOfPrimitiveValues(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoOutlookItem(outlookItem: Partial | undefined = {}) : Record void> { - return { - ...deserializeIntoEntity(outlookItem), - "categories": n => { outlookItem.categories = n.getCollectionOfPrimitiveValues(); }, - "changeKey": n => { outlookItem.changeKey = n.getStringValue(); }, - "createdDateTime": n => { outlookItem.createdDateTime = n.getDateValue(); }, - "lastModifiedDateTime": n => { outlookItem.lastModifiedDateTime = n.getDateValue(); }, - } +export function deserializeIntoOutlookItem(outlookItem: Partial | undefined = {}): Record void> { + return { + ...deserializeIntoEntity(outlookItem), + categories: (n) => { + outlookItem.categories = n.getCollectionOfPrimitiveValues(); + }, + changeKey: (n) => { + outlookItem.changeKey = n.getStringValue(); + }, + createdDateTime: (n) => { + outlookItem.createdDateTime = n.getDateValue(); + }, + lastModifiedDateTime: (n) => { + outlookItem.lastModifiedDateTime = n.getDateValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoRecipient(recipient: Partial | undefined = {}) : Record void> { - return { - "emailAddress": n => { recipient.emailAddress = n.getObjectValue(createEmailAddressFromDiscriminatorValue); }, - } +export function deserializeIntoRecipient(recipient: Partial | undefined = {}): Record void> { + return { + emailAddress: (n) => { + recipient.emailAddress = n.getObjectValue(createEmailAddressFromDiscriminatorValue); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoSingleValueLegacyExtendedProperty(singleValueLegacyExtendedProperty: Partial | undefined = {}) : Record void> { - return { - ...deserializeIntoEntity(singleValueLegacyExtendedProperty), - "value": n => { singleValueLegacyExtendedProperty.value = n.getStringValue(); }, - } +export function deserializeIntoSingleValueLegacyExtendedProperty(singleValueLegacyExtendedProperty: Partial | undefined = {}): Record void> { + return { + ...deserializeIntoEntity(singleValueLegacyExtendedProperty), + value: (n) => { + singleValueLegacyExtendedProperty.value = n.getStringValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoSizeRange(sizeRange: Partial | undefined = {}) : Record void> { - return { - "maximumSize": n => { sizeRange.maximumSize = n.getNumberValue(); }, - "minimumSize": n => { sizeRange.minimumSize = n.getNumberValue(); }, - } +export function deserializeIntoSizeRange(sizeRange: Partial | undefined = {}): Record void> { + return { + maximumSize: (n) => { + sizeRange.maximumSize = n.getNumberValue(); + }, + minimumSize: (n) => { + sizeRange.minimumSize = n.getNumberValue(); + }, + }; } export interface EmailAddress extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The email address of the person or entity. - */ - address?: string; - /** - * The display name of the person or entity. - */ - name?: string; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The email address of the person or entity. + */ + address?: string; + /** + * The display name of the person or entity. + */ + name?: string; } export interface Entity extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The unique identifier for an entity. Read-only. - */ - id?: string; -} -export interface Extension extends Entity, Parsable { -} + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The unique identifier for an entity. Read-only. + */ + id?: string; +} +export interface Extension extends Entity, Parsable {} export interface ExtensionCollectionResponse extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The OdataNextLink property - */ - odataNextLink?: string; - /** - * The value property - */ - value?: Extension[]; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The OdataNextLink property + */ + odataNextLink?: string; + /** + * The value property + */ + value?: Extension[]; } export interface FollowupFlag extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The completedDateTime property - */ - completedDateTime?: DateTimeTimeZone; - /** - * The dueDateTime property - */ - dueDateTime?: DateTimeTimeZone; - /** - * The flagStatus property - */ - flagStatus?: FollowupFlagStatus; - /** - * The startDateTime property - */ - startDateTime?: DateTimeTimeZone; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The completedDateTime property + */ + completedDateTime?: DateTimeTimeZone; + /** + * The dueDateTime property + */ + dueDateTime?: DateTimeTimeZone; + /** + * The flagStatus property + */ + flagStatus?: FollowupFlagStatus; + /** + * The startDateTime property + */ + startDateTime?: DateTimeTimeZone; } export type FollowupFlagStatus = (typeof FollowupFlagStatusObject)[keyof typeof FollowupFlagStatusObject]; export type Importance = (typeof ImportanceObject)[keyof typeof ImportanceObject]; export interface InferenceClassification extends Entity, Parsable { - /** - * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. - */ - overrides?: InferenceClassificationOverride[]; + /** + * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. + */ + overrides?: InferenceClassificationOverride[]; } export interface InferenceClassificationOverride extends Entity, Parsable { - /** - * The classifyAs property - */ - classifyAs?: InferenceClassificationType; - /** - * The senderEmailAddress property - */ - senderEmailAddress?: EmailAddress; + /** + * The classifyAs property + */ + classifyAs?: InferenceClassificationType; + /** + * The senderEmailAddress property + */ + senderEmailAddress?: EmailAddress; } export interface InferenceClassificationOverrideCollectionResponse extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The OdataNextLink property - */ - odataNextLink?: string; - /** - * The value property - */ - value?: InferenceClassificationOverride[]; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The OdataNextLink property + */ + odataNextLink?: string; + /** + * The value property + */ + value?: InferenceClassificationOverride[]; } export type InferenceClassificationType = (typeof InferenceClassificationTypeObject)[keyof typeof InferenceClassificationTypeObject]; export interface InternetMessageHeader extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * Represents the key in a key-value pair. - */ - name?: string; - /** - * The value in a key-value pair. - */ - value?: string; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * Represents the key in a key-value pair. + */ + name?: string; + /** + * The value in a key-value pair. + */ + value?: string; } export interface ItemBody extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The content of the item. - */ - content?: string; - /** - * The contentType property - */ - contentType?: BodyType; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The content of the item. + */ + content?: string; + /** + * The contentType property + */ + contentType?: BodyType; } export interface MailFolder extends Entity, Parsable { - /** - * The number of immediate child mailFolders in the current mailFolder. - */ - childFolderCount?: number; - /** - * The collection of child folders in the mailFolder. - */ - childFolders?: MailFolder[]; - /** - * The mailFolder's display name. - */ - displayName?: string; - /** - * Indicates whether the mailFolder is hidden. This property can be set only when creating the folder. Find more information in Hidden mail folders. - */ - isHidden?: boolean; - /** - * The collection of rules that apply to the user's Inbox folder. - */ - messageRules?: MessageRule[]; - /** - * The collection of messages in the mailFolder. - */ - messages?: Message[]; - /** - * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. - */ - multiValueExtendedProperties?: MultiValueLegacyExtendedProperty[]; - /** - * The unique identifier for the mailFolder's parent mailFolder. - */ - parentFolderId?: string; - /** - * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. - */ - singleValueExtendedProperties?: SingleValueLegacyExtendedProperty[]; - /** - * The number of items in the mailFolder. - */ - totalItemCount?: number; - /** - * The number of items in the mailFolder marked as unread. - */ - unreadItemCount?: number; + /** + * The number of immediate child mailFolders in the current mailFolder. + */ + childFolderCount?: number; + /** + * The collection of child folders in the mailFolder. + */ + childFolders?: MailFolder[]; + /** + * The mailFolder's display name. + */ + displayName?: string; + /** + * Indicates whether the mailFolder is hidden. This property can be set only when creating the folder. Find more information in Hidden mail folders. + */ + isHidden?: boolean; + /** + * The collection of rules that apply to the user's Inbox folder. + */ + messageRules?: MessageRule[]; + /** + * The collection of messages in the mailFolder. + */ + messages?: Message[]; + /** + * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. + */ + multiValueExtendedProperties?: MultiValueLegacyExtendedProperty[]; + /** + * The unique identifier for the mailFolder's parent mailFolder. + */ + parentFolderId?: string; + /** + * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. + */ + singleValueExtendedProperties?: SingleValueLegacyExtendedProperty[]; + /** + * The number of items in the mailFolder. + */ + totalItemCount?: number; + /** + * The number of items in the mailFolder marked as unread. + */ + unreadItemCount?: number; } export interface MailFolderCollectionResponse extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The OdataNextLink property - */ - odataNextLink?: string; - /** - * The value property - */ - value?: MailFolder[]; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The OdataNextLink property + */ + odataNextLink?: string; + /** + * The value property + */ + value?: MailFolder[]; } export interface Message extends OutlookItem, Parsable { - /** - * The fileAttachment and itemAttachment attachments for the message. - */ - attachments?: Attachment[]; - /** - * The Bcc: recipients for the message. - */ - bccRecipients?: Recipient[]; - /** - * The body property - */ - body?: ItemBody; - /** - * The first 255 characters of the message body. It is in text format. - */ - bodyPreview?: string; - /** - * The Cc: recipients for the message. - */ - ccRecipients?: Recipient[]; - /** - * The ID of the conversation the email belongs to. - */ - conversationId?: string; - /** - * Indicates the position of the message within the conversation. - */ - conversationIndex?: string; - /** - * The collection of open extensions defined for the message. Nullable. - */ - extensions?: Extension[]; - /** - * The flag property - */ - flag?: FollowupFlag; - /** - * The from property - */ - from?: Recipient; - /** - * Indicates whether the message has attachments. This property doesn't include inline attachments, so if a message contains only inline attachments, this property is false. To verify the existence of inline attachments, parse the body property to look for a src attribute, such as . - */ - hasAttachments?: boolean; - /** - * The importance property - */ - importance?: Importance; - /** - * The inferenceClassification property - */ - inferenceClassification?: InferenceClassificationType; - /** - * The internetMessageHeaders property - */ - internetMessageHeaders?: InternetMessageHeader[]; - /** - * The internetMessageId property - */ - internetMessageId?: string; - /** - * The isDeliveryReceiptRequested property - */ - isDeliveryReceiptRequested?: boolean; - /** - * The isDraft property - */ - isDraft?: boolean; - /** - * The isRead property - */ - isRead?: boolean; - /** - * The isReadReceiptRequested property - */ - isReadReceiptRequested?: boolean; - /** - * The collection of multi-value extended properties defined for the message. Nullable. - */ - multiValueExtendedProperties?: MultiValueLegacyExtendedProperty[]; - /** - * The parentFolderId property - */ - parentFolderId?: string; - /** - * The receivedDateTime property - */ - receivedDateTime?: Date; - /** - * The replyTo property - */ - replyTo?: Recipient[]; - /** - * The sender property - */ - sender?: Recipient; - /** - * The sentDateTime property - */ - sentDateTime?: Date; - /** - * The collection of single-value extended properties defined for the message. Nullable. - */ - singleValueExtendedProperties?: SingleValueLegacyExtendedProperty[]; - /** - * The subject property - */ - subject?: string; - /** - * The toRecipients property - */ - toRecipients?: Recipient[]; - /** - * The uniqueBody property - */ - uniqueBody?: ItemBody; - /** - * The webLink property - */ - webLink?: string; + /** + * The fileAttachment and itemAttachment attachments for the message. + */ + attachments?: Attachment[]; + /** + * The Bcc: recipients for the message. + */ + bccRecipients?: Recipient[]; + /** + * The body property + */ + body?: ItemBody; + /** + * The first 255 characters of the message body. It is in text format. + */ + bodyPreview?: string; + /** + * The Cc: recipients for the message. + */ + ccRecipients?: Recipient[]; + /** + * The ID of the conversation the email belongs to. + */ + conversationId?: string; + /** + * Indicates the position of the message within the conversation. + */ + conversationIndex?: string; + /** + * The collection of open extensions defined for the message. Nullable. + */ + extensions?: Extension[]; + /** + * The flag property + */ + flag?: FollowupFlag; + /** + * The from property + */ + from?: Recipient; + /** + * Indicates whether the message has attachments. This property doesn't include inline attachments, so if a message contains only inline attachments, this property is false. To verify the existence of inline attachments, parse the body property to look for a src attribute, such as . + */ + hasAttachments?: boolean; + /** + * The importance property + */ + importance?: Importance; + /** + * The inferenceClassification property + */ + inferenceClassification?: InferenceClassificationType; + /** + * The internetMessageHeaders property + */ + internetMessageHeaders?: InternetMessageHeader[]; + /** + * The internetMessageId property + */ + internetMessageId?: string; + /** + * The isDeliveryReceiptRequested property + */ + isDeliveryReceiptRequested?: boolean; + /** + * The isDraft property + */ + isDraft?: boolean; + /** + * The isRead property + */ + isRead?: boolean; + /** + * The isReadReceiptRequested property + */ + isReadReceiptRequested?: boolean; + /** + * The collection of multi-value extended properties defined for the message. Nullable. + */ + multiValueExtendedProperties?: MultiValueLegacyExtendedProperty[]; + /** + * The parentFolderId property + */ + parentFolderId?: string; + /** + * The receivedDateTime property + */ + receivedDateTime?: Date; + /** + * The replyTo property + */ + replyTo?: Recipient[]; + /** + * The sender property + */ + sender?: Recipient; + /** + * The sentDateTime property + */ + sentDateTime?: Date; + /** + * The collection of single-value extended properties defined for the message. Nullable. + */ + singleValueExtendedProperties?: SingleValueLegacyExtendedProperty[]; + /** + * The subject property + */ + subject?: string; + /** + * The toRecipients property + */ + toRecipients?: Recipient[]; + /** + * The uniqueBody property + */ + uniqueBody?: ItemBody; + /** + * The webLink property + */ + webLink?: string; } export type MessageActionFlag = (typeof MessageActionFlagObject)[keyof typeof MessageActionFlagObject]; export interface MessageCollectionResponse extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The OdataNextLink property - */ - odataNextLink?: string; - /** - * The value property - */ - value?: Message[]; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The OdataNextLink property + */ + odataNextLink?: string; + /** + * The value property + */ + value?: Message[]; } export interface MessageRule extends Entity, Parsable { - /** - * The actions property - */ - actions?: MessageRuleActions; - /** - * The conditions property - */ - conditions?: MessageRulePredicates; - /** - * The display name of the rule. - */ - displayName?: string; - /** - * The exceptions property - */ - exceptions?: MessageRulePredicates; - /** - * Indicates whether the rule is in an error condition. Read-only. - */ - hasError?: boolean; - /** - * Indicates whether the rule is enabled to be applied to messages. - */ - isEnabled?: boolean; - /** - * Indicates if the rule is read-only and cannot be modified or deleted by the rules REST API. - */ - isReadOnly?: boolean; - /** - * Indicates the order in which the rule is executed, among other rules. - */ - sequence?: number; + /** + * The actions property + */ + actions?: MessageRuleActions; + /** + * The conditions property + */ + conditions?: MessageRulePredicates; + /** + * The display name of the rule. + */ + displayName?: string; + /** + * The exceptions property + */ + exceptions?: MessageRulePredicates; + /** + * Indicates whether the rule is in an error condition. Read-only. + */ + hasError?: boolean; + /** + * Indicates whether the rule is enabled to be applied to messages. + */ + isEnabled?: boolean; + /** + * Indicates if the rule is read-only and cannot be modified or deleted by the rules REST API. + */ + isReadOnly?: boolean; + /** + * Indicates the order in which the rule is executed, among other rules. + */ + sequence?: number; } export interface MessageRuleActions extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * A list of categories to be assigned to a message. - */ - assignCategories?: string[]; - /** - * The ID of a folder that a message is to be copied to. - */ - copyToFolder?: string; - /** - * Indicates whether a message should be moved to the Deleted Items folder. - */ - delete?: boolean; - /** - * The email addresses of the recipients to which a message should be forwarded as an attachment. - */ - forwardAsAttachmentTo?: Recipient[]; - /** - * The email addresses of the recipients to which a message should be forwarded. - */ - forwardTo?: Recipient[]; - /** - * Indicates whether a message should be marked as read. - */ - markAsRead?: boolean; - /** - * The markImportance property - */ - markImportance?: Importance; - /** - * The ID of the folder that a message will be moved to. - */ - moveToFolder?: string; - /** - * Indicates whether a message should be permanently deleted and not saved to the Deleted Items folder. - */ - permanentDelete?: boolean; - /** - * The email addresses to which a message should be redirected. - */ - redirectTo?: Recipient[]; - /** - * Indicates whether subsequent rules should be evaluated. - */ - stopProcessingRules?: boolean; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * A list of categories to be assigned to a message. + */ + assignCategories?: string[]; + /** + * The ID of a folder that a message is to be copied to. + */ + copyToFolder?: string; + /** + * Indicates whether a message should be moved to the Deleted Items folder. + */ + delete?: boolean; + /** + * The email addresses of the recipients to which a message should be forwarded as an attachment. + */ + forwardAsAttachmentTo?: Recipient[]; + /** + * The email addresses of the recipients to which a message should be forwarded. + */ + forwardTo?: Recipient[]; + /** + * Indicates whether a message should be marked as read. + */ + markAsRead?: boolean; + /** + * The markImportance property + */ + markImportance?: Importance; + /** + * The ID of the folder that a message will be moved to. + */ + moveToFolder?: string; + /** + * Indicates whether a message should be permanently deleted and not saved to the Deleted Items folder. + */ + permanentDelete?: boolean; + /** + * The email addresses to which a message should be redirected. + */ + redirectTo?: Recipient[]; + /** + * Indicates whether subsequent rules should be evaluated. + */ + stopProcessingRules?: boolean; } export interface MessageRuleCollectionResponse extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The OdataNextLink property - */ - odataNextLink?: string; - /** - * The value property - */ - value?: MessageRule[]; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The OdataNextLink property + */ + odataNextLink?: string; + /** + * The value property + */ + value?: MessageRule[]; } export interface MessageRulePredicates extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * Represents the strings that should appear in the body of an incoming message in order for the condition or exception to apply. - */ - bodyContains?: string[]; - /** - * Represents the strings that should appear in the body or subject of an incoming message in order for the condition or exception to apply. - */ - bodyOrSubjectContains?: string[]; - /** - * Represents the categories that an incoming message should be labeled with in order for the condition or exception to apply. - */ - categories?: string[]; - /** - * Represents the specific sender email addresses of an incoming message in order for the condition or exception to apply. - */ - fromAddresses?: Recipient[]; - /** - * Indicates whether an incoming message must have attachments in order for the condition or exception to apply. - */ - hasAttachments?: boolean; - /** - * Represents the strings that appear in the headers of an incoming message in order for the condition or exception to apply. - */ - headerContains?: string[]; - /** - * The importance property - */ - importance?: Importance; - /** - * Indicates whether an incoming message must be an approval request in order for the condition or exception to apply. - */ - isApprovalRequest?: boolean; - /** - * Indicates whether an incoming message must be automatically forwarded in order for the condition or exception to apply. - */ - isAutomaticForward?: boolean; - /** - * Indicates whether an incoming message must be an auto reply in order for the condition or exception to apply. - */ - isAutomaticReply?: boolean; - /** - * Indicates whether an incoming message must be encrypted in order for the condition or exception to apply. - */ - isEncrypted?: boolean; - /** - * Indicates whether an incoming message must be a meeting request in order for the condition or exception to apply. - */ - isMeetingRequest?: boolean; - /** - * Indicates whether an incoming message must be a meeting response in order for the condition or exception to apply. - */ - isMeetingResponse?: boolean; - /** - * Indicates whether an incoming message must be a non-delivery report in order for the condition or exception to apply. - */ - isNonDeliveryReport?: boolean; - /** - * Indicates whether an incoming message must be permission controlled (RMS-protected) in order for the condition or exception to apply. - */ - isPermissionControlled?: boolean; - /** - * Indicates whether an incoming message must be a read receipt in order for the condition or exception to apply. - */ - isReadReceipt?: boolean; - /** - * Indicates whether an incoming message must be S/MIME-signed in order for the condition or exception to apply. - */ - isSigned?: boolean; - /** - * Indicates whether an incoming message must be a voice mail in order for the condition or exception to apply. - */ - isVoicemail?: boolean; - /** - * The messageActionFlag property - */ - messageActionFlag?: MessageActionFlag; - /** - * Indicates whether the owner of the mailbox must not be a recipient of an incoming message in order for the condition or exception to apply. - */ - notSentToMe?: boolean; - /** - * Represents the strings that appear in either the toRecipients or ccRecipients properties of an incoming message in order for the condition or exception to apply. - */ - recipientContains?: string[]; - /** - * Represents the strings that appear in the from property of an incoming message in order for the condition or exception to apply. - */ - senderContains?: string[]; - /** - * The sensitivity property - */ - sensitivity?: Sensitivity; - /** - * Indicates whether the owner of the mailbox must be in the ccRecipients property of an incoming message in order for the condition or exception to apply. - */ - sentCcMe?: boolean; - /** - * Indicates whether the owner of the mailbox must be the only recipient in an incoming message in order for the condition or exception to apply. - */ - sentOnlyToMe?: boolean; - /** - * Represents the email addresses that an incoming message must have been sent to in order for the condition or exception to apply. - */ - sentToAddresses?: Recipient[]; - /** - * Indicates whether the owner of the mailbox must be in the toRecipients property of an incoming message in order for the condition or exception to apply. - */ - sentToMe?: boolean; - /** - * Indicates whether the owner of the mailbox must be in either a toRecipients or ccRecipients property of an incoming message in order for the condition or exception to apply. - */ - sentToOrCcMe?: boolean; - /** - * Represents the strings that appear in the subject of an incoming message in order for the condition or exception to apply. - */ - subjectContains?: string[]; - /** - * The withinSizeRange property - */ - withinSizeRange?: SizeRange; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * Represents the strings that should appear in the body of an incoming message in order for the condition or exception to apply. + */ + bodyContains?: string[]; + /** + * Represents the strings that should appear in the body or subject of an incoming message in order for the condition or exception to apply. + */ + bodyOrSubjectContains?: string[]; + /** + * Represents the categories that an incoming message should be labeled with in order for the condition or exception to apply. + */ + categories?: string[]; + /** + * Represents the specific sender email addresses of an incoming message in order for the condition or exception to apply. + */ + fromAddresses?: Recipient[]; + /** + * Indicates whether an incoming message must have attachments in order for the condition or exception to apply. + */ + hasAttachments?: boolean; + /** + * Represents the strings that appear in the headers of an incoming message in order for the condition or exception to apply. + */ + headerContains?: string[]; + /** + * The importance property + */ + importance?: Importance; + /** + * Indicates whether an incoming message must be an approval request in order for the condition or exception to apply. + */ + isApprovalRequest?: boolean; + /** + * Indicates whether an incoming message must be automatically forwarded in order for the condition or exception to apply. + */ + isAutomaticForward?: boolean; + /** + * Indicates whether an incoming message must be an auto reply in order for the condition or exception to apply. + */ + isAutomaticReply?: boolean; + /** + * Indicates whether an incoming message must be encrypted in order for the condition or exception to apply. + */ + isEncrypted?: boolean; + /** + * Indicates whether an incoming message must be a meeting request in order for the condition or exception to apply. + */ + isMeetingRequest?: boolean; + /** + * Indicates whether an incoming message must be a meeting response in order for the condition or exception to apply. + */ + isMeetingResponse?: boolean; + /** + * Indicates whether an incoming message must be a non-delivery report in order for the condition or exception to apply. + */ + isNonDeliveryReport?: boolean; + /** + * Indicates whether an incoming message must be permission controlled (RMS-protected) in order for the condition or exception to apply. + */ + isPermissionControlled?: boolean; + /** + * Indicates whether an incoming message must be a read receipt in order for the condition or exception to apply. + */ + isReadReceipt?: boolean; + /** + * Indicates whether an incoming message must be S/MIME-signed in order for the condition or exception to apply. + */ + isSigned?: boolean; + /** + * Indicates whether an incoming message must be a voice mail in order for the condition or exception to apply. + */ + isVoicemail?: boolean; + /** + * The messageActionFlag property + */ + messageActionFlag?: MessageActionFlag; + /** + * Indicates whether the owner of the mailbox must not be a recipient of an incoming message in order for the condition or exception to apply. + */ + notSentToMe?: boolean; + /** + * Represents the strings that appear in either the toRecipients or ccRecipients properties of an incoming message in order for the condition or exception to apply. + */ + recipientContains?: string[]; + /** + * Represents the strings that appear in the from property of an incoming message in order for the condition or exception to apply. + */ + senderContains?: string[]; + /** + * The sensitivity property + */ + sensitivity?: Sensitivity; + /** + * Indicates whether the owner of the mailbox must be in the ccRecipients property of an incoming message in order for the condition or exception to apply. + */ + sentCcMe?: boolean; + /** + * Indicates whether the owner of the mailbox must be the only recipient in an incoming message in order for the condition or exception to apply. + */ + sentOnlyToMe?: boolean; + /** + * Represents the email addresses that an incoming message must have been sent to in order for the condition or exception to apply. + */ + sentToAddresses?: Recipient[]; + /** + * Indicates whether the owner of the mailbox must be in the toRecipients property of an incoming message in order for the condition or exception to apply. + */ + sentToMe?: boolean; + /** + * Indicates whether the owner of the mailbox must be in either a toRecipients or ccRecipients property of an incoming message in order for the condition or exception to apply. + */ + sentToOrCcMe?: boolean; + /** + * Represents the strings that appear in the subject of an incoming message in order for the condition or exception to apply. + */ + subjectContains?: string[]; + /** + * The withinSizeRange property + */ + withinSizeRange?: SizeRange; } export interface MultiValueLegacyExtendedProperty extends Entity, Parsable { - /** - * A collection of property values. - */ - value?: string[]; + /** + * A collection of property values. + */ + value?: string[]; } export interface OutlookItem extends Entity, Parsable { - /** - * The categories associated with the item - */ - categories?: string[]; - /** - * Identifies the version of the item. Every time the item is changed, changeKey changes as well. This allows Exchange to apply changes to the correct version of the object. Read-only. - */ - changeKey?: string; - /** - * The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z - */ - createdDateTime?: Date; - /** - * The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z - */ - lastModifiedDateTime?: Date; + /** + * The categories associated with the item + */ + categories?: string[]; + /** + * Identifies the version of the item. Every time the item is changed, changeKey changes as well. This allows Exchange to apply changes to the correct version of the object. Read-only. + */ + changeKey?: string; + /** + * The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z + */ + createdDateTime?: Date; + /** + * The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z + */ + lastModifiedDateTime?: Date; } export interface Recipient extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The emailAddress property - */ - emailAddress?: EmailAddress; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The emailAddress property + */ + emailAddress?: EmailAddress; } export type Sensitivity = (typeof SensitivityObject)[keyof typeof SensitivityObject]; /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeAttachment(writer: SerializationWriter, attachment: Partial | undefined = {}) : void { - serializeEntity(writer, attachment) - writer.writeStringValue("contentType", attachment.contentType); - writer.writeBooleanValue("isInline", attachment.isInline); - writer.writeDateValue("lastModifiedDateTime", attachment.lastModifiedDateTime); - writer.writeStringValue("name", attachment.name); - writer.writeNumberValue("size", attachment.size); +export function serializeAttachment(writer: SerializationWriter, attachment: Partial | undefined = {}): void { + serializeEntity(writer, attachment); + writer.writeStringValue("contentType", attachment.contentType); + writer.writeBooleanValue("isInline", attachment.isInline); + writer.writeDateValue("lastModifiedDateTime", attachment.lastModifiedDateTime); + writer.writeStringValue("name", attachment.name); + writer.writeNumberValue("size", attachment.size); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeAttachmentCollectionResponse(writer: SerializationWriter, attachmentCollectionResponse: Partial | undefined = {}) : void { - writer.writeStringValue("@odata.nextLink", attachmentCollectionResponse.odataNextLink); - writer.writeCollectionOfObjectValues("value", attachmentCollectionResponse.value, serializeAttachment); - writer.writeAdditionalData(attachmentCollectionResponse.additionalData); +export function serializeAttachmentCollectionResponse(writer: SerializationWriter, attachmentCollectionResponse: Partial | undefined = {}): void { + writer.writeStringValue("@odata.nextLink", attachmentCollectionResponse.odataNextLink); + writer.writeCollectionOfObjectValues("value", attachmentCollectionResponse.value, serializeAttachment); + writer.writeAdditionalData(attachmentCollectionResponse.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeDateTimeTimeZone(writer: SerializationWriter, dateTimeTimeZone: Partial | undefined = {}) : void { - writer.writeStringValue("dateTime", dateTimeTimeZone.dateTime); - writer.writeStringValue("timeZone", dateTimeTimeZone.timeZone); - writer.writeAdditionalData(dateTimeTimeZone.additionalData); +export function serializeDateTimeTimeZone(writer: SerializationWriter, dateTimeTimeZone: Partial | undefined = {}): void { + writer.writeStringValue("dateTime", dateTimeTimeZone.dateTime); + writer.writeStringValue("timeZone", dateTimeTimeZone.timeZone); + writer.writeAdditionalData(dateTimeTimeZone.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeEmailAddress(writer: SerializationWriter, emailAddress: Partial | undefined = {}) : void { - writer.writeStringValue("address", emailAddress.address); - writer.writeStringValue("name", emailAddress.name); - writer.writeAdditionalData(emailAddress.additionalData); +export function serializeEmailAddress(writer: SerializationWriter, emailAddress: Partial | undefined = {}): void { + writer.writeStringValue("address", emailAddress.address); + writer.writeStringValue("name", emailAddress.name); + writer.writeAdditionalData(emailAddress.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeEntity(writer: SerializationWriter, entity: Partial | undefined = {}) : void { - writer.writeStringValue("id", entity.id); - writer.writeAdditionalData(entity.additionalData); +export function serializeEntity(writer: SerializationWriter, entity: Partial | undefined = {}): void { + writer.writeStringValue("id", entity.id); + writer.writeAdditionalData(entity.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeExtension(writer: SerializationWriter, extension: Partial | undefined = {}) : void { - serializeEntity(writer, extension) +export function serializeExtension(writer: SerializationWriter, extension: Partial | undefined = {}): void { + serializeEntity(writer, extension); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeExtensionCollectionResponse(writer: SerializationWriter, extensionCollectionResponse: Partial | undefined = {}) : void { - writer.writeStringValue("@odata.nextLink", extensionCollectionResponse.odataNextLink); - writer.writeCollectionOfObjectValues("value", extensionCollectionResponse.value, serializeExtension); - writer.writeAdditionalData(extensionCollectionResponse.additionalData); +export function serializeExtensionCollectionResponse(writer: SerializationWriter, extensionCollectionResponse: Partial | undefined = {}): void { + writer.writeStringValue("@odata.nextLink", extensionCollectionResponse.odataNextLink); + writer.writeCollectionOfObjectValues("value", extensionCollectionResponse.value, serializeExtension); + writer.writeAdditionalData(extensionCollectionResponse.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeFollowupFlag(writer: SerializationWriter, followupFlag: Partial | undefined = {}) : void { - writer.writeObjectValue("completedDateTime", followupFlag.completedDateTime, serializeDateTimeTimeZone); - writer.writeObjectValue("dueDateTime", followupFlag.dueDateTime, serializeDateTimeTimeZone); - writer.writeEnumValue("flagStatus", followupFlag.flagStatus); - writer.writeObjectValue("startDateTime", followupFlag.startDateTime, serializeDateTimeTimeZone); - writer.writeAdditionalData(followupFlag.additionalData); +export function serializeFollowupFlag(writer: SerializationWriter, followupFlag: Partial | undefined = {}): void { + writer.writeObjectValue("completedDateTime", followupFlag.completedDateTime, serializeDateTimeTimeZone); + writer.writeObjectValue("dueDateTime", followupFlag.dueDateTime, serializeDateTimeTimeZone); + writer.writeEnumValue("flagStatus", followupFlag.flagStatus); + writer.writeObjectValue("startDateTime", followupFlag.startDateTime, serializeDateTimeTimeZone); + writer.writeAdditionalData(followupFlag.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeInferenceClassification(writer: SerializationWriter, inferenceClassification: Partial | undefined = {}) : void { - serializeEntity(writer, inferenceClassification) - writer.writeCollectionOfObjectValues("overrides", inferenceClassification.overrides, serializeInferenceClassificationOverride); +export function serializeInferenceClassification(writer: SerializationWriter, inferenceClassification: Partial | undefined = {}): void { + serializeEntity(writer, inferenceClassification); + writer.writeCollectionOfObjectValues("overrides", inferenceClassification.overrides, serializeInferenceClassificationOverride); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeInferenceClassificationOverride(writer: SerializationWriter, inferenceClassificationOverride: Partial | undefined = {}) : void { - serializeEntity(writer, inferenceClassificationOverride) - writer.writeEnumValue("classifyAs", inferenceClassificationOverride.classifyAs); - writer.writeObjectValue("senderEmailAddress", inferenceClassificationOverride.senderEmailAddress, serializeEmailAddress); +export function serializeInferenceClassificationOverride(writer: SerializationWriter, inferenceClassificationOverride: Partial | undefined = {}): void { + serializeEntity(writer, inferenceClassificationOverride); + writer.writeEnumValue("classifyAs", inferenceClassificationOverride.classifyAs); + writer.writeObjectValue("senderEmailAddress", inferenceClassificationOverride.senderEmailAddress, serializeEmailAddress); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeInferenceClassificationOverrideCollectionResponse(writer: SerializationWriter, inferenceClassificationOverrideCollectionResponse: Partial | undefined = {}) : void { - writer.writeStringValue("@odata.nextLink", inferenceClassificationOverrideCollectionResponse.odataNextLink); - writer.writeCollectionOfObjectValues("value", inferenceClassificationOverrideCollectionResponse.value, serializeInferenceClassificationOverride); - writer.writeAdditionalData(inferenceClassificationOverrideCollectionResponse.additionalData); +export function serializeInferenceClassificationOverrideCollectionResponse(writer: SerializationWriter, inferenceClassificationOverrideCollectionResponse: Partial | undefined = {}): void { + writer.writeStringValue("@odata.nextLink", inferenceClassificationOverrideCollectionResponse.odataNextLink); + writer.writeCollectionOfObjectValues("value", inferenceClassificationOverrideCollectionResponse.value, serializeInferenceClassificationOverride); + writer.writeAdditionalData(inferenceClassificationOverrideCollectionResponse.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeInternetMessageHeader(writer: SerializationWriter, internetMessageHeader: Partial | undefined = {}) : void { - writer.writeStringValue("name", internetMessageHeader.name); - writer.writeStringValue("value", internetMessageHeader.value); - writer.writeAdditionalData(internetMessageHeader.additionalData); +export function serializeInternetMessageHeader(writer: SerializationWriter, internetMessageHeader: Partial | undefined = {}): void { + writer.writeStringValue("name", internetMessageHeader.name); + writer.writeStringValue("value", internetMessageHeader.value); + writer.writeAdditionalData(internetMessageHeader.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeItemBody(writer: SerializationWriter, itemBody: Partial | undefined = {}) : void { - writer.writeStringValue("content", itemBody.content); - writer.writeEnumValue("contentType", itemBody.contentType); - writer.writeAdditionalData(itemBody.additionalData); +export function serializeItemBody(writer: SerializationWriter, itemBody: Partial | undefined = {}): void { + writer.writeStringValue("content", itemBody.content); + writer.writeEnumValue("contentType", itemBody.contentType); + writer.writeAdditionalData(itemBody.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeMailFolder(writer: SerializationWriter, mailFolder: Partial | undefined = {}) : void { - serializeEntity(writer, mailFolder) - writer.writeNumberValue("childFolderCount", mailFolder.childFolderCount); - writer.writeCollectionOfObjectValues("childFolders", mailFolder.childFolders, serializeMailFolder); - writer.writeStringValue("displayName", mailFolder.displayName); - writer.writeBooleanValue("isHidden", mailFolder.isHidden); - writer.writeCollectionOfObjectValues("messageRules", mailFolder.messageRules, serializeMessageRule); - writer.writeCollectionOfObjectValues("messages", mailFolder.messages, serializeMessage); - writer.writeCollectionOfObjectValues("multiValueExtendedProperties", mailFolder.multiValueExtendedProperties, serializeMultiValueLegacyExtendedProperty); - writer.writeStringValue("parentFolderId", mailFolder.parentFolderId); - writer.writeCollectionOfObjectValues("singleValueExtendedProperties", mailFolder.singleValueExtendedProperties, serializeSingleValueLegacyExtendedProperty); - writer.writeNumberValue("totalItemCount", mailFolder.totalItemCount); - writer.writeNumberValue("unreadItemCount", mailFolder.unreadItemCount); +export function serializeMailFolder(writer: SerializationWriter, mailFolder: Partial | undefined = {}): void { + serializeEntity(writer, mailFolder); + writer.writeNumberValue("childFolderCount", mailFolder.childFolderCount); + writer.writeCollectionOfObjectValues("childFolders", mailFolder.childFolders, serializeMailFolder); + writer.writeStringValue("displayName", mailFolder.displayName); + writer.writeBooleanValue("isHidden", mailFolder.isHidden); + writer.writeCollectionOfObjectValues("messageRules", mailFolder.messageRules, serializeMessageRule); + writer.writeCollectionOfObjectValues("messages", mailFolder.messages, serializeMessage); + writer.writeCollectionOfObjectValues("multiValueExtendedProperties", mailFolder.multiValueExtendedProperties, serializeMultiValueLegacyExtendedProperty); + writer.writeStringValue("parentFolderId", mailFolder.parentFolderId); + writer.writeCollectionOfObjectValues("singleValueExtendedProperties", mailFolder.singleValueExtendedProperties, serializeSingleValueLegacyExtendedProperty); + writer.writeNumberValue("totalItemCount", mailFolder.totalItemCount); + writer.writeNumberValue("unreadItemCount", mailFolder.unreadItemCount); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeMailFolderCollectionResponse(writer: SerializationWriter, mailFolderCollectionResponse: Partial | undefined = {}) : void { - writer.writeStringValue("@odata.nextLink", mailFolderCollectionResponse.odataNextLink); - writer.writeCollectionOfObjectValues("value", mailFolderCollectionResponse.value, serializeMailFolder); - writer.writeAdditionalData(mailFolderCollectionResponse.additionalData); +export function serializeMailFolderCollectionResponse(writer: SerializationWriter, mailFolderCollectionResponse: Partial | undefined = {}): void { + writer.writeStringValue("@odata.nextLink", mailFolderCollectionResponse.odataNextLink); + writer.writeCollectionOfObjectValues("value", mailFolderCollectionResponse.value, serializeMailFolder); + writer.writeAdditionalData(mailFolderCollectionResponse.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeMessage(writer: SerializationWriter, message: Partial | undefined = {}) : void { - serializeOutlookItem(writer, message) - writer.writeCollectionOfObjectValues("attachments", message.attachments, serializeAttachment); - writer.writeCollectionOfObjectValues("bccRecipients", message.bccRecipients, serializeRecipient); - writer.writeObjectValue("body", message.body, serializeItemBody); - writer.writeStringValue("bodyPreview", message.bodyPreview); - writer.writeCollectionOfObjectValues("ccRecipients", message.ccRecipients, serializeRecipient); - writer.writeStringValue("conversationId", message.conversationId); - writer.writeStringValue("conversationIndex", message.conversationIndex); - writer.writeCollectionOfObjectValues("extensions", message.extensions, serializeExtension); - writer.writeObjectValue("flag", message.flag, serializeFollowupFlag); - writer.writeObjectValue("from", message.from, serializeRecipient); - writer.writeBooleanValue("hasAttachments", message.hasAttachments); - writer.writeEnumValue("importance", message.importance); - writer.writeEnumValue("inferenceClassification", message.inferenceClassification); - writer.writeCollectionOfObjectValues("internetMessageHeaders", message.internetMessageHeaders, serializeInternetMessageHeader); - writer.writeStringValue("internetMessageId", message.internetMessageId); - writer.writeBooleanValue("isDeliveryReceiptRequested", message.isDeliveryReceiptRequested); - writer.writeBooleanValue("isDraft", message.isDraft); - writer.writeBooleanValue("isRead", message.isRead); - writer.writeBooleanValue("isReadReceiptRequested", message.isReadReceiptRequested); - writer.writeCollectionOfObjectValues("multiValueExtendedProperties", message.multiValueExtendedProperties, serializeMultiValueLegacyExtendedProperty); - writer.writeStringValue("parentFolderId", message.parentFolderId); - writer.writeDateValue("receivedDateTime", message.receivedDateTime); - writer.writeCollectionOfObjectValues("replyTo", message.replyTo, serializeRecipient); - writer.writeObjectValue("sender", message.sender, serializeRecipient); - writer.writeDateValue("sentDateTime", message.sentDateTime); - writer.writeCollectionOfObjectValues("singleValueExtendedProperties", message.singleValueExtendedProperties, serializeSingleValueLegacyExtendedProperty); - writer.writeStringValue("subject", message.subject); - writer.writeCollectionOfObjectValues("toRecipients", message.toRecipients, serializeRecipient); - writer.writeObjectValue("uniqueBody", message.uniqueBody, serializeItemBody); - writer.writeStringValue("webLink", message.webLink); +export function serializeMessage(writer: SerializationWriter, message: Partial | undefined = {}): void { + serializeOutlookItem(writer, message); + writer.writeCollectionOfObjectValues("attachments", message.attachments, serializeAttachment); + writer.writeCollectionOfObjectValues("bccRecipients", message.bccRecipients, serializeRecipient); + writer.writeObjectValue("body", message.body, serializeItemBody); + writer.writeStringValue("bodyPreview", message.bodyPreview); + writer.writeCollectionOfObjectValues("ccRecipients", message.ccRecipients, serializeRecipient); + writer.writeStringValue("conversationId", message.conversationId); + writer.writeStringValue("conversationIndex", message.conversationIndex); + writer.writeCollectionOfObjectValues("extensions", message.extensions, serializeExtension); + writer.writeObjectValue("flag", message.flag, serializeFollowupFlag); + writer.writeObjectValue("from", message.from, serializeRecipient); + writer.writeBooleanValue("hasAttachments", message.hasAttachments); + writer.writeEnumValue("importance", message.importance); + writer.writeEnumValue("inferenceClassification", message.inferenceClassification); + writer.writeCollectionOfObjectValues("internetMessageHeaders", message.internetMessageHeaders, serializeInternetMessageHeader); + writer.writeStringValue("internetMessageId", message.internetMessageId); + writer.writeBooleanValue("isDeliveryReceiptRequested", message.isDeliveryReceiptRequested); + writer.writeBooleanValue("isDraft", message.isDraft); + writer.writeBooleanValue("isRead", message.isRead); + writer.writeBooleanValue("isReadReceiptRequested", message.isReadReceiptRequested); + writer.writeCollectionOfObjectValues("multiValueExtendedProperties", message.multiValueExtendedProperties, serializeMultiValueLegacyExtendedProperty); + writer.writeStringValue("parentFolderId", message.parentFolderId); + writer.writeDateValue("receivedDateTime", message.receivedDateTime); + writer.writeCollectionOfObjectValues("replyTo", message.replyTo, serializeRecipient); + writer.writeObjectValue("sender", message.sender, serializeRecipient); + writer.writeDateValue("sentDateTime", message.sentDateTime); + writer.writeCollectionOfObjectValues("singleValueExtendedProperties", message.singleValueExtendedProperties, serializeSingleValueLegacyExtendedProperty); + writer.writeStringValue("subject", message.subject); + writer.writeCollectionOfObjectValues("toRecipients", message.toRecipients, serializeRecipient); + writer.writeObjectValue("uniqueBody", message.uniqueBody, serializeItemBody); + writer.writeStringValue("webLink", message.webLink); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeMessageCollectionResponse(writer: SerializationWriter, messageCollectionResponse: Partial | undefined = {}) : void { - writer.writeStringValue("@odata.nextLink", messageCollectionResponse.odataNextLink); - writer.writeCollectionOfObjectValues("value", messageCollectionResponse.value, serializeMessage); - writer.writeAdditionalData(messageCollectionResponse.additionalData); +export function serializeMessageCollectionResponse(writer: SerializationWriter, messageCollectionResponse: Partial | undefined = {}): void { + writer.writeStringValue("@odata.nextLink", messageCollectionResponse.odataNextLink); + writer.writeCollectionOfObjectValues("value", messageCollectionResponse.value, serializeMessage); + writer.writeAdditionalData(messageCollectionResponse.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeMessageRule(writer: SerializationWriter, messageRule: Partial | undefined = {}) : void { - serializeEntity(writer, messageRule) - writer.writeObjectValue("actions", messageRule.actions, serializeMessageRuleActions); - writer.writeObjectValue("conditions", messageRule.conditions, serializeMessageRulePredicates); - writer.writeStringValue("displayName", messageRule.displayName); - writer.writeObjectValue("exceptions", messageRule.exceptions, serializeMessageRulePredicates); - writer.writeBooleanValue("hasError", messageRule.hasError); - writer.writeBooleanValue("isEnabled", messageRule.isEnabled); - writer.writeBooleanValue("isReadOnly", messageRule.isReadOnly); - writer.writeNumberValue("sequence", messageRule.sequence); +export function serializeMessageRule(writer: SerializationWriter, messageRule: Partial | undefined = {}): void { + serializeEntity(writer, messageRule); + writer.writeObjectValue("actions", messageRule.actions, serializeMessageRuleActions); + writer.writeObjectValue("conditions", messageRule.conditions, serializeMessageRulePredicates); + writer.writeStringValue("displayName", messageRule.displayName); + writer.writeObjectValue("exceptions", messageRule.exceptions, serializeMessageRulePredicates); + writer.writeBooleanValue("hasError", messageRule.hasError); + writer.writeBooleanValue("isEnabled", messageRule.isEnabled); + writer.writeBooleanValue("isReadOnly", messageRule.isReadOnly); + writer.writeNumberValue("sequence", messageRule.sequence); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeMessageRuleActions(writer: SerializationWriter, messageRuleActions: Partial | undefined = {}) : void { - writer.writeCollectionOfPrimitiveValues("assignCategories", messageRuleActions.assignCategories); - writer.writeStringValue("copyToFolder", messageRuleActions.copyToFolder); - writer.writeBooleanValue("delete", messageRuleActions.delete); - writer.writeCollectionOfObjectValues("forwardAsAttachmentTo", messageRuleActions.forwardAsAttachmentTo, serializeRecipient); - writer.writeCollectionOfObjectValues("forwardTo", messageRuleActions.forwardTo, serializeRecipient); - writer.writeBooleanValue("markAsRead", messageRuleActions.markAsRead); - writer.writeEnumValue("markImportance", messageRuleActions.markImportance); - writer.writeStringValue("moveToFolder", messageRuleActions.moveToFolder); - writer.writeBooleanValue("permanentDelete", messageRuleActions.permanentDelete); - writer.writeCollectionOfObjectValues("redirectTo", messageRuleActions.redirectTo, serializeRecipient); - writer.writeBooleanValue("stopProcessingRules", messageRuleActions.stopProcessingRules); - writer.writeAdditionalData(messageRuleActions.additionalData); +export function serializeMessageRuleActions(writer: SerializationWriter, messageRuleActions: Partial | undefined = {}): void { + writer.writeCollectionOfPrimitiveValues("assignCategories", messageRuleActions.assignCategories); + writer.writeStringValue("copyToFolder", messageRuleActions.copyToFolder); + writer.writeBooleanValue("delete", messageRuleActions.delete); + writer.writeCollectionOfObjectValues("forwardAsAttachmentTo", messageRuleActions.forwardAsAttachmentTo, serializeRecipient); + writer.writeCollectionOfObjectValues("forwardTo", messageRuleActions.forwardTo, serializeRecipient); + writer.writeBooleanValue("markAsRead", messageRuleActions.markAsRead); + writer.writeEnumValue("markImportance", messageRuleActions.markImportance); + writer.writeStringValue("moveToFolder", messageRuleActions.moveToFolder); + writer.writeBooleanValue("permanentDelete", messageRuleActions.permanentDelete); + writer.writeCollectionOfObjectValues("redirectTo", messageRuleActions.redirectTo, serializeRecipient); + writer.writeBooleanValue("stopProcessingRules", messageRuleActions.stopProcessingRules); + writer.writeAdditionalData(messageRuleActions.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeMessageRuleCollectionResponse(writer: SerializationWriter, messageRuleCollectionResponse: Partial | undefined = {}) : void { - writer.writeStringValue("@odata.nextLink", messageRuleCollectionResponse.odataNextLink); - writer.writeCollectionOfObjectValues("value", messageRuleCollectionResponse.value, serializeMessageRule); - writer.writeAdditionalData(messageRuleCollectionResponse.additionalData); +export function serializeMessageRuleCollectionResponse(writer: SerializationWriter, messageRuleCollectionResponse: Partial | undefined = {}): void { + writer.writeStringValue("@odata.nextLink", messageRuleCollectionResponse.odataNextLink); + writer.writeCollectionOfObjectValues("value", messageRuleCollectionResponse.value, serializeMessageRule); + writer.writeAdditionalData(messageRuleCollectionResponse.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeMessageRulePredicates(writer: SerializationWriter, messageRulePredicates: Partial | undefined = {}) : void { - writer.writeCollectionOfPrimitiveValues("bodyContains", messageRulePredicates.bodyContains); - writer.writeCollectionOfPrimitiveValues("bodyOrSubjectContains", messageRulePredicates.bodyOrSubjectContains); - writer.writeCollectionOfPrimitiveValues("categories", messageRulePredicates.categories); - writer.writeCollectionOfObjectValues("fromAddresses", messageRulePredicates.fromAddresses, serializeRecipient); - writer.writeBooleanValue("hasAttachments", messageRulePredicates.hasAttachments); - writer.writeCollectionOfPrimitiveValues("headerContains", messageRulePredicates.headerContains); - writer.writeEnumValue("importance", messageRulePredicates.importance); - writer.writeBooleanValue("isApprovalRequest", messageRulePredicates.isApprovalRequest); - writer.writeBooleanValue("isAutomaticForward", messageRulePredicates.isAutomaticForward); - writer.writeBooleanValue("isAutomaticReply", messageRulePredicates.isAutomaticReply); - writer.writeBooleanValue("isEncrypted", messageRulePredicates.isEncrypted); - writer.writeBooleanValue("isMeetingRequest", messageRulePredicates.isMeetingRequest); - writer.writeBooleanValue("isMeetingResponse", messageRulePredicates.isMeetingResponse); - writer.writeBooleanValue("isNonDeliveryReport", messageRulePredicates.isNonDeliveryReport); - writer.writeBooleanValue("isPermissionControlled", messageRulePredicates.isPermissionControlled); - writer.writeBooleanValue("isReadReceipt", messageRulePredicates.isReadReceipt); - writer.writeBooleanValue("isSigned", messageRulePredicates.isSigned); - writer.writeBooleanValue("isVoicemail", messageRulePredicates.isVoicemail); - writer.writeEnumValue("messageActionFlag", messageRulePredicates.messageActionFlag); - writer.writeBooleanValue("notSentToMe", messageRulePredicates.notSentToMe); - writer.writeCollectionOfPrimitiveValues("recipientContains", messageRulePredicates.recipientContains); - writer.writeCollectionOfPrimitiveValues("senderContains", messageRulePredicates.senderContains); - writer.writeEnumValue("sensitivity", messageRulePredicates.sensitivity); - writer.writeBooleanValue("sentCcMe", messageRulePredicates.sentCcMe); - writer.writeBooleanValue("sentOnlyToMe", messageRulePredicates.sentOnlyToMe); - writer.writeCollectionOfObjectValues("sentToAddresses", messageRulePredicates.sentToAddresses, serializeRecipient); - writer.writeBooleanValue("sentToMe", messageRulePredicates.sentToMe); - writer.writeBooleanValue("sentToOrCcMe", messageRulePredicates.sentToOrCcMe); - writer.writeCollectionOfPrimitiveValues("subjectContains", messageRulePredicates.subjectContains); - writer.writeObjectValue("withinSizeRange", messageRulePredicates.withinSizeRange, serializeSizeRange); - writer.writeAdditionalData(messageRulePredicates.additionalData); +export function serializeMessageRulePredicates(writer: SerializationWriter, messageRulePredicates: Partial | undefined = {}): void { + writer.writeCollectionOfPrimitiveValues("bodyContains", messageRulePredicates.bodyContains); + writer.writeCollectionOfPrimitiveValues("bodyOrSubjectContains", messageRulePredicates.bodyOrSubjectContains); + writer.writeCollectionOfPrimitiveValues("categories", messageRulePredicates.categories); + writer.writeCollectionOfObjectValues("fromAddresses", messageRulePredicates.fromAddresses, serializeRecipient); + writer.writeBooleanValue("hasAttachments", messageRulePredicates.hasAttachments); + writer.writeCollectionOfPrimitiveValues("headerContains", messageRulePredicates.headerContains); + writer.writeEnumValue("importance", messageRulePredicates.importance); + writer.writeBooleanValue("isApprovalRequest", messageRulePredicates.isApprovalRequest); + writer.writeBooleanValue("isAutomaticForward", messageRulePredicates.isAutomaticForward); + writer.writeBooleanValue("isAutomaticReply", messageRulePredicates.isAutomaticReply); + writer.writeBooleanValue("isEncrypted", messageRulePredicates.isEncrypted); + writer.writeBooleanValue("isMeetingRequest", messageRulePredicates.isMeetingRequest); + writer.writeBooleanValue("isMeetingResponse", messageRulePredicates.isMeetingResponse); + writer.writeBooleanValue("isNonDeliveryReport", messageRulePredicates.isNonDeliveryReport); + writer.writeBooleanValue("isPermissionControlled", messageRulePredicates.isPermissionControlled); + writer.writeBooleanValue("isReadReceipt", messageRulePredicates.isReadReceipt); + writer.writeBooleanValue("isSigned", messageRulePredicates.isSigned); + writer.writeBooleanValue("isVoicemail", messageRulePredicates.isVoicemail); + writer.writeEnumValue("messageActionFlag", messageRulePredicates.messageActionFlag); + writer.writeBooleanValue("notSentToMe", messageRulePredicates.notSentToMe); + writer.writeCollectionOfPrimitiveValues("recipientContains", messageRulePredicates.recipientContains); + writer.writeCollectionOfPrimitiveValues("senderContains", messageRulePredicates.senderContains); + writer.writeEnumValue("sensitivity", messageRulePredicates.sensitivity); + writer.writeBooleanValue("sentCcMe", messageRulePredicates.sentCcMe); + writer.writeBooleanValue("sentOnlyToMe", messageRulePredicates.sentOnlyToMe); + writer.writeCollectionOfObjectValues("sentToAddresses", messageRulePredicates.sentToAddresses, serializeRecipient); + writer.writeBooleanValue("sentToMe", messageRulePredicates.sentToMe); + writer.writeBooleanValue("sentToOrCcMe", messageRulePredicates.sentToOrCcMe); + writer.writeCollectionOfPrimitiveValues("subjectContains", messageRulePredicates.subjectContains); + writer.writeObjectValue("withinSizeRange", messageRulePredicates.withinSizeRange, serializeSizeRange); + writer.writeAdditionalData(messageRulePredicates.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeMultiValueLegacyExtendedProperty(writer: SerializationWriter, multiValueLegacyExtendedProperty: Partial | undefined = {}) : void { - serializeEntity(writer, multiValueLegacyExtendedProperty) - writer.writeCollectionOfPrimitiveValues("value", multiValueLegacyExtendedProperty.value); +export function serializeMultiValueLegacyExtendedProperty(writer: SerializationWriter, multiValueLegacyExtendedProperty: Partial | undefined = {}): void { + serializeEntity(writer, multiValueLegacyExtendedProperty); + writer.writeCollectionOfPrimitiveValues("value", multiValueLegacyExtendedProperty.value); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeOutlookItem(writer: SerializationWriter, outlookItem: Partial | undefined = {}) : void { - serializeEntity(writer, outlookItem) - writer.writeCollectionOfPrimitiveValues("categories", outlookItem.categories); - writer.writeStringValue("changeKey", outlookItem.changeKey); - writer.writeDateValue("createdDateTime", outlookItem.createdDateTime); - writer.writeDateValue("lastModifiedDateTime", outlookItem.lastModifiedDateTime); +export function serializeOutlookItem(writer: SerializationWriter, outlookItem: Partial | undefined = {}): void { + serializeEntity(writer, outlookItem); + writer.writeCollectionOfPrimitiveValues("categories", outlookItem.categories); + writer.writeStringValue("changeKey", outlookItem.changeKey); + writer.writeDateValue("createdDateTime", outlookItem.createdDateTime); + writer.writeDateValue("lastModifiedDateTime", outlookItem.lastModifiedDateTime); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeRecipient(writer: SerializationWriter, recipient: Partial | undefined = {}) : void { - writer.writeObjectValue("emailAddress", recipient.emailAddress, serializeEmailAddress); - writer.writeAdditionalData(recipient.additionalData); +export function serializeRecipient(writer: SerializationWriter, recipient: Partial | undefined = {}): void { + writer.writeObjectValue("emailAddress", recipient.emailAddress, serializeEmailAddress); + writer.writeAdditionalData(recipient.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeSingleValueLegacyExtendedProperty(writer: SerializationWriter, singleValueLegacyExtendedProperty: Partial | undefined = {}) : void { - serializeEntity(writer, singleValueLegacyExtendedProperty) - writer.writeStringValue("value", singleValueLegacyExtendedProperty.value); +export function serializeSingleValueLegacyExtendedProperty(writer: SerializationWriter, singleValueLegacyExtendedProperty: Partial | undefined = {}): void { + serializeEntity(writer, singleValueLegacyExtendedProperty); + writer.writeStringValue("value", singleValueLegacyExtendedProperty.value); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeSizeRange(writer: SerializationWriter, sizeRange: Partial | undefined = {}) : void { - writer.writeNumberValue("maximumSize", sizeRange.maximumSize); - writer.writeNumberValue("minimumSize", sizeRange.minimumSize); - writer.writeAdditionalData(sizeRange.additionalData); +export function serializeSizeRange(writer: SerializationWriter, sizeRange: Partial | undefined = {}): void { + writer.writeNumberValue("maximumSize", sizeRange.maximumSize); + writer.writeNumberValue("minimumSize", sizeRange.minimumSize); + writer.writeAdditionalData(sizeRange.additionalData); } export interface SingleValueLegacyExtendedProperty extends Entity, Parsable { - /** - * A property value. - */ - value?: string; + /** + * A property value. + */ + value?: string; } export interface SizeRange extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The maximum size (in kilobytes) that an incoming message must have in order for a condition or exception to apply. - */ - maximumSize?: number; - /** - * The minimum size (in kilobytes) that an incoming message must have in order for a condition or exception to apply. - */ - minimumSize?: number; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The maximum size (in kilobytes) that an incoming message must have in order for a condition or exception to apply. + */ + maximumSize?: number; + /** + * The minimum size (in kilobytes) that an incoming message must have in order for a condition or exception to apply. + */ + minimumSize?: number; } export const BodyTypeObject = { - Text: "text", - Html: "html", + Text: "text", + Html: "html", } as const; export const FollowupFlagStatusObject = { - NotFlagged: "notFlagged", - Complete: "complete", - Flagged: "flagged", + NotFlagged: "notFlagged", + Complete: "complete", + Flagged: "flagged", } as const; export const ImportanceObject = { - Low: "low", - Normal: "normal", - High: "high", + Low: "low", + Normal: "normal", + High: "high", } as const; export const InferenceClassificationTypeObject = { - Focused: "focused", - Other: "other", + Focused: "focused", + Other: "other", } as const; export const MessageActionFlagObject = { - Any: "any", - Call: "call", - DoNotForward: "doNotForward", - FollowUp: "followUp", - Fyi: "fyi", - Forward: "forward", - NoResponseNecessary: "noResponseNecessary", - Read: "read", - Reply: "reply", - ReplyToAll: "replyToAll", - Review: "review", + Any: "any", + Call: "call", + DoNotForward: "doNotForward", + FollowUp: "followUp", + Fyi: "fyi", + Forward: "forward", + NoResponseNecessary: "noResponseNecessary", + Read: "read", + Reply: "reply", + ReplyToAll: "replyToAll", + Review: "review", } as const; export const SensitivityObject = { - Normal: "normal", - Personal: "personal", - Private: "private", - Confidential: "confidential", + Normal: "normal", + Personal: "personal", + Private: "private", + Confidential: "confidential", } as const; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/models/oDataErrors/index.ts b/packages/test/generatedCode/models/oDataErrors/index.ts index 2f883cef4..d52f76671 100644 --- a/packages/test/generatedCode/models/oDataErrors/index.ts +++ b/packages/test/generatedCode/models/oDataErrors/index.ts @@ -1,180 +1,198 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { type AdditionalDataHolder, type ApiError, type Parsable, type ParseNode, type SerializationWriter } from '@microsoft/kiota-abstractions'; +import { type AdditionalDataHolder, type ApiError, type Parsable, type ParseNode, type SerializationWriter } from "@microsoft/kiota-abstractions"; /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {ErrorDetails} */ -export function createErrorDetailsFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoErrorDetails; +export function createErrorDetailsFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoErrorDetails; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {InnerError} */ -export function createInnerErrorFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoInnerError; +export function createInnerErrorFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoInnerError; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MainError} */ -export function createMainErrorFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoMainError; +export function createMainErrorFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoMainError; } /** * Creates a new instance of the appropriate class based on discriminator value * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {ODataError} */ -export function createODataErrorFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { - return deserializeIntoODataError; +export function createODataErrorFromDiscriminatorValue(parseNode: ParseNode | undefined): (instance?: Parsable) => Record void> { + return deserializeIntoODataError; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoErrorDetails(errorDetails: Partial | undefined = {}) : Record void> { - return { - "code": n => { errorDetails.code = n.getStringValue(); }, - "message": n => { errorDetails.message = n.getStringValue(); }, - "target": n => { errorDetails.target = n.getStringValue(); }, - } +export function deserializeIntoErrorDetails(errorDetails: Partial | undefined = {}): Record void> { + return { + code: (n) => { + errorDetails.code = n.getStringValue(); + }, + message: (n) => { + errorDetails.message = n.getStringValue(); + }, + target: (n) => { + errorDetails.target = n.getStringValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoInnerError(innerError: Partial | undefined = {}) : Record void> { - return { - } +export function deserializeIntoInnerError(innerError: Partial | undefined = {}): Record void> { + return {}; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoMainError(mainError: Partial | undefined = {}) : Record void> { - return { - "code": n => { mainError.code = n.getStringValue(); }, - "details": n => { mainError.details = n.getCollectionOfObjectValues(createErrorDetailsFromDiscriminatorValue); }, - "innerError": n => { mainError.innerError = n.getObjectValue(createInnerErrorFromDiscriminatorValue); }, - "message": n => { mainError.message = n.getStringValue(); }, - "target": n => { mainError.target = n.getStringValue(); }, - } +export function deserializeIntoMainError(mainError: Partial | undefined = {}): Record void> { + return { + code: (n) => { + mainError.code = n.getStringValue(); + }, + details: (n) => { + mainError.details = n.getCollectionOfObjectValues(createErrorDetailsFromDiscriminatorValue); + }, + innerError: (n) => { + mainError.innerError = n.getObjectValue(createInnerErrorFromDiscriminatorValue); + }, + message: (n) => { + mainError.message = n.getStringValue(); + }, + target: (n) => { + mainError.target = n.getStringValue(); + }, + }; } /** * The deserialization information for the current model * @returns {Record void>} */ -export function deserializeIntoODataError(oDataError: Partial | undefined = {}) : Record void> { - return { - "error": n => { oDataError.errorEscaped = n.getObjectValue(createMainErrorFromDiscriminatorValue); oDataError.message = oDataError.errorEscaped?.message ?? ""; }, - } +export function deserializeIntoODataError(oDataError: Partial | undefined = {}): Record void> { + return { + error: (n) => { + oDataError.errorEscaped = n.getObjectValue(createMainErrorFromDiscriminatorValue); + oDataError.message = oDataError.errorEscaped?.message ?? ""; + }, + }; } export interface ErrorDetails extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The code property - */ - code?: string; - /** - * The message property - */ - message?: string; - /** - * The target property - */ - target?: string; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The code property + */ + code?: string; + /** + * The message property + */ + message?: string; + /** + * The target property + */ + target?: string; } /** * The structure of this object is service-specific */ export interface InnerError extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; } export interface MainError extends AdditionalDataHolder, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The code property - */ - code?: string; - /** - * The details property - */ - details?: ErrorDetails[]; - /** - * The structure of this object is service-specific - */ - innerError?: InnerError; - /** - * The message property - */ - message?: string; - /** - * The target property - */ - target?: string; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The code property + */ + code?: string; + /** + * The details property + */ + details?: ErrorDetails[]; + /** + * The structure of this object is service-specific + */ + innerError?: InnerError; + /** + * The message property + */ + message?: string; + /** + * The target property + */ + target?: string; } export interface ODataError extends AdditionalDataHolder, ApiError, Parsable { - /** - * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. - */ - additionalData?: Record; - /** - * The error property - */ - errorEscaped?: MainError; + /** + * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + */ + additionalData?: Record; + /** + * The error property + */ + errorEscaped?: MainError; } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeErrorDetails(writer: SerializationWriter, errorDetails: Partial | undefined = {}) : void { - writer.writeStringValue("code", errorDetails.code); - writer.writeStringValue("message", errorDetails.message); - writer.writeStringValue("target", errorDetails.target); - writer.writeAdditionalData(errorDetails.additionalData); +export function serializeErrorDetails(writer: SerializationWriter, errorDetails: Partial | undefined = {}): void { + writer.writeStringValue("code", errorDetails.code); + writer.writeStringValue("message", errorDetails.message); + writer.writeStringValue("target", errorDetails.target); + writer.writeAdditionalData(errorDetails.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeInnerError(writer: SerializationWriter, innerError: Partial | undefined = {}) : void { - writer.writeAdditionalData(innerError.additionalData); +export function serializeInnerError(writer: SerializationWriter, innerError: Partial | undefined = {}): void { + writer.writeAdditionalData(innerError.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeMainError(writer: SerializationWriter, mainError: Partial | undefined = {}) : void { - writer.writeStringValue("code", mainError.code); - writer.writeCollectionOfObjectValues("details", mainError.details, serializeErrorDetails); - writer.writeObjectValue("innerError", mainError.innerError, serializeInnerError); - writer.writeStringValue("message", mainError.message); - writer.writeStringValue("target", mainError.target); - writer.writeAdditionalData(mainError.additionalData); +export function serializeMainError(writer: SerializationWriter, mainError: Partial | undefined = {}): void { + writer.writeStringValue("code", mainError.code); + writer.writeCollectionOfObjectValues("details", mainError.details, serializeErrorDetails); + writer.writeObjectValue("innerError", mainError.innerError, serializeInnerError); + writer.writeStringValue("message", mainError.message); + writer.writeStringValue("target", mainError.target); + writer.writeAdditionalData(mainError.additionalData); } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ -export function serializeODataError(writer: SerializationWriter, oDataError: Partial | undefined = {}) : void { - writer.writeObjectValue("error", oDataError.errorEscaped, serializeMainError); - writer.writeAdditionalData(oDataError.additionalData); +export function serializeODataError(writer: SerializationWriter, oDataError: Partial | undefined = {}): void { + writer.writeObjectValue("error", oDataError.errorEscaped, serializeMainError); + writer.writeAdditionalData(oDataError.additionalData); } /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/index.ts b/packages/test/generatedCode/users/index.ts index 07ecaa69a..f8d6e9a17 100644 --- a/packages/test/generatedCode/users/index.ts +++ b/packages/test/generatedCode/users/index.ts @@ -1,19 +1,19 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { type UserItemRequestBuilder, UserItemRequestBuilderNavigationMetadata } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata } from '@microsoft/kiota-abstractions'; +import { type UserItemRequestBuilder, UserItemRequestBuilderNavigationMetadata } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users */ export interface UsersRequestBuilder extends BaseRequestBuilder { - /** - * Gets an item from the ApiSdk.users.item collection - * @param userId The unique identifier of user - * @returns {UserItemRequestBuilder} - */ - byUserId(userId: string) : UserItemRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item collection + * @param userId The unique identifier of user + * @returns {UserItemRequestBuilder} + */ + byUserId(userId: string): UserItemRequestBuilder; } /** * Uri template for the request builder. @@ -23,10 +23,10 @@ export const UsersRequestBuilderUriTemplate = "{+baseurl}/users"; * Metadata for all the navigation properties in the request builder. */ export const UsersRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byUserId: { - navigationMetadata: UserItemRequestBuilderNavigationMetadata, - pathParametersMappings: ["user%2Did"], - }, + byUserId: { + navigationMetadata: UserItemRequestBuilderNavigationMetadata, + pathParametersMappings: ["user%2Did"], + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/index.ts b/packages/test/generatedCode/users/item/index.ts index 646c97115..0b75b67cc 100644 --- a/packages/test/generatedCode/users/item/index.ts +++ b/packages/test/generatedCode/users/item/index.ts @@ -1,27 +1,27 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { InferenceClassificationRequestBuilderNavigationMetadata, InferenceClassificationRequestBuilderRequestsMetadata, type InferenceClassificationRequestBuilder } from './inferenceClassification/'; -import { MailFoldersRequestBuilderNavigationMetadata, MailFoldersRequestBuilderRequestsMetadata, type MailFoldersRequestBuilder } from './mailFolders/'; -import { MessagesRequestBuilderNavigationMetadata, MessagesRequestBuilderRequestsMetadata, type MessagesRequestBuilder } from './messages/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata } from '@microsoft/kiota-abstractions'; +import { InferenceClassificationRequestBuilderNavigationMetadata, InferenceClassificationRequestBuilderRequestsMetadata, type InferenceClassificationRequestBuilder } from "./inferenceClassification/"; +import { MailFoldersRequestBuilderNavigationMetadata, MailFoldersRequestBuilderRequestsMetadata, type MailFoldersRequestBuilder } from "./mailFolders/"; +import { MessagesRequestBuilderNavigationMetadata, MessagesRequestBuilderRequestsMetadata, type MessagesRequestBuilder } from "./messages/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id} */ export interface UserItemRequestBuilder extends BaseRequestBuilder { - /** - * The inferenceClassification property - */ - get inferenceClassification(): InferenceClassificationRequestBuilder; - /** - * The mailFolders property - */ - get mailFolders(): MailFoldersRequestBuilder; - /** - * The messages property - */ - get messages(): MessagesRequestBuilder; + /** + * The inferenceClassification property + */ + get inferenceClassification(): InferenceClassificationRequestBuilder; + /** + * The mailFolders property + */ + get mailFolders(): MailFoldersRequestBuilder; + /** + * The messages property + */ + get messages(): MessagesRequestBuilder; } /** * Uri template for the request builder. @@ -31,18 +31,18 @@ export const UserItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}"; * Metadata for all the navigation properties in the request builder. */ export const UserItemRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - inferenceClassification: { - requestsMetadata: InferenceClassificationRequestBuilderRequestsMetadata, - navigationMetadata: InferenceClassificationRequestBuilderNavigationMetadata, - }, - mailFolders: { - requestsMetadata: MailFoldersRequestBuilderRequestsMetadata, - navigationMetadata: MailFoldersRequestBuilderNavigationMetadata, - }, - messages: { - requestsMetadata: MessagesRequestBuilderRequestsMetadata, - navigationMetadata: MessagesRequestBuilderNavigationMetadata, - }, + inferenceClassification: { + requestsMetadata: InferenceClassificationRequestBuilderRequestsMetadata, + navigationMetadata: InferenceClassificationRequestBuilderNavigationMetadata, + }, + mailFolders: { + requestsMetadata: MailFoldersRequestBuilderRequestsMetadata, + navigationMetadata: MailFoldersRequestBuilderNavigationMetadata, + }, + messages: { + requestsMetadata: MessagesRequestBuilderRequestsMetadata, + navigationMetadata: MessagesRequestBuilderNavigationMetadata, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/inferenceClassification/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/index.ts index f2395d9fe..a078c3005 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/index.ts @@ -1,56 +1,56 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createInferenceClassificationFromDiscriminatorValue, serializeInferenceClassification, type InferenceClassification } from '../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../models/oDataErrors/'; -import { OverridesRequestBuilderNavigationMetadata, OverridesRequestBuilderRequestsMetadata, type OverridesRequestBuilder } from './overrides/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createInferenceClassificationFromDiscriminatorValue, serializeInferenceClassification, type InferenceClassification } from "../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../models/oDataErrors/"; +import { OverridesRequestBuilderNavigationMetadata, OverridesRequestBuilderRequestsMetadata, type OverridesRequestBuilder } from "./overrides/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/inferenceClassification */ export interface InferenceClassificationRequestBuilder extends BaseRequestBuilder { - /** - * The overrides property - */ - get overrides(): OverridesRequestBuilder; - /** - * Relevance classification of the user's messages based on explicit designations that override inferred relevance or importance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update the navigation property inferenceClassification in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - patch(body: InferenceClassification, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Relevance classification of the user's messages based on explicit designations that override inferred relevance or importance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update the navigation property inferenceClassification in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: InferenceClassification, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The overrides property + */ + get overrides(): OverridesRequestBuilder; + /** + * Relevance classification of the user's messages based on explicit designations that override inferred relevance or importance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update the navigation property inferenceClassification in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + patch(body: InferenceClassification, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Relevance classification of the user's messages based on explicit designations that override inferred relevance or importance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update the navigation property inferenceClassification in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: InferenceClassification, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Relevance classification of the user's messages based on explicit designations that override inferred relevance or importance. */ export interface InferenceClassificationRequestBuilderGetQueryParameters { - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -60,43 +60,43 @@ export const InferenceClassificationRequestBuilderUriTemplate = "{+baseurl}/user * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const InferenceClassificationRequestBuilderGetQueryParametersMapper: Record = { - "select": "%24select", + select: "%24select", }; /** * Metadata for all the navigation properties in the request builder. */ export const InferenceClassificationRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - overrides: { - requestsMetadata: OverridesRequestBuilderRequestsMetadata, - navigationMetadata: OverridesRequestBuilderNavigationMetadata, - }, + overrides: { + requestsMetadata: OverridesRequestBuilderRequestsMetadata, + navigationMetadata: OverridesRequestBuilderNavigationMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const InferenceClassificationRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: InferenceClassificationRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createInferenceClassificationFromDiscriminatorValue, - queryParametersMapper: InferenceClassificationRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: InferenceClassificationRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createInferenceClassificationFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeInferenceClassification, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: InferenceClassificationRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createInferenceClassificationFromDiscriminatorValue, + queryParametersMapper: InferenceClassificationRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: InferenceClassificationRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createInferenceClassificationFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeInferenceClassification, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts index 541683b00..aad72f1f7 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/inferenceClassification/overrides/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/infe * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts index 6fadc5d74..cc17a3096 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts @@ -1,85 +1,85 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createInferenceClassificationOverrideCollectionResponseFromDiscriminatorValue, createInferenceClassificationOverrideFromDiscriminatorValue, serializeInferenceClassificationOverride, type InferenceClassificationOverride, type InferenceClassificationOverrideCollectionResponse } from '../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { InferenceClassificationOverrideItemRequestBuilderRequestsMetadata, type InferenceClassificationOverrideItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createInferenceClassificationOverrideCollectionResponseFromDiscriminatorValue, createInferenceClassificationOverrideFromDiscriminatorValue, serializeInferenceClassificationOverride, type InferenceClassificationOverride, type InferenceClassificationOverrideCollectionResponse } from "../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { InferenceClassificationOverrideItemRequestBuilderRequestsMetadata, type InferenceClassificationOverrideItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/inferenceClassification/overrides */ export interface OverridesRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.inferenceClassification.overrides.item collection - * @param inferenceClassificationOverrideId The unique identifier of inferenceClassificationOverride - * @returns {InferenceClassificationOverrideItemRequestBuilder} - */ - byInferenceClassificationOverrideId(inferenceClassificationOverrideId: string) : InferenceClassificationOverrideItemRequestBuilder; - /** - * Get the overrides that a user has set up to always classify messages from certain senders in specific ways. Each override corresponds to an SMTP address of a sender. Initially, a user does not have any overrides. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/inferenceclassification-list-overrides?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Create an override for a sender identified by an SMTP address. Future messages from that SMTP address will be consistently classifiedas specified in the override. Note - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/inferenceclassification-post-overrides?view=graph-rest-1.0|Find more info here} - */ - post(body: InferenceClassificationOverride, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the overrides that a user has set up to always classify messages from certain senders in specific ways. Each override corresponds to an SMTP address of a sender. Initially, a user does not have any overrides. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Create an override for a sender identified by an SMTP address. Future messages from that SMTP address will be consistently classifiedas specified in the override. Note - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: InferenceClassificationOverride, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.inferenceClassification.overrides.item collection + * @param inferenceClassificationOverrideId The unique identifier of inferenceClassificationOverride + * @returns {InferenceClassificationOverrideItemRequestBuilder} + */ + byInferenceClassificationOverrideId(inferenceClassificationOverrideId: string): InferenceClassificationOverrideItemRequestBuilder; + /** + * Get the overrides that a user has set up to always classify messages from certain senders in specific ways. Each override corresponds to an SMTP address of a sender. Initially, a user does not have any overrides. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/inferenceclassification-list-overrides?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Create an override for a sender identified by an SMTP address. Future messages from that SMTP address will be consistently classifiedas specified in the override. Note + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/inferenceclassification-post-overrides?view=graph-rest-1.0|Find more info here} + */ + post(body: InferenceClassificationOverride, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the overrides that a user has set up to always classify messages from certain senders in specific ways. Each override corresponds to an SMTP address of a sender. Initially, a user does not have any overrides. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Create an override for a sender identified by an SMTP address. Future messages from that SMTP address will be consistently classifiedas specified in the override. Note + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: InferenceClassificationOverride, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the overrides that a user has set up to always classify messages from certain senders in specific ways. Each override corresponds to an SMTP address of a sender. Initially, a user does not have any overrides. */ export interface OverridesRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -89,51 +89,51 @@ export const OverridesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/ * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const OverridesRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const OverridesRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byInferenceClassificationOverrideId: { - requestsMetadata: InferenceClassificationOverrideItemRequestBuilderRequestsMetadata, - pathParametersMappings: ["inferenceClassificationOverride%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byInferenceClassificationOverrideId: { + requestsMetadata: InferenceClassificationOverrideItemRequestBuilderRequestsMetadata, + pathParametersMappings: ["inferenceClassificationOverride%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const OverridesRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: OverridesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createInferenceClassificationOverrideCollectionResponseFromDiscriminatorValue, - queryParametersMapper: OverridesRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: OverridesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createInferenceClassificationOverrideFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeInferenceClassificationOverride, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: OverridesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createInferenceClassificationOverrideCollectionResponseFromDiscriminatorValue, + queryParametersMapper: OverridesRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: OverridesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createInferenceClassificationOverrideFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeInferenceClassificationOverride, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts index ce0373197..1cd39aa82 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts @@ -1,66 +1,66 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createInferenceClassificationOverrideFromDiscriminatorValue, serializeInferenceClassificationOverride, type InferenceClassificationOverride } from '../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createInferenceClassificationOverrideFromDiscriminatorValue, serializeInferenceClassificationOverride, type InferenceClassificationOverride } from "../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/inferenceClassification/overrides/{inferenceClassificationOverride-id} */ export interface InferenceClassificationOverrideItemRequestBuilder extends BaseRequestBuilder { - /** - * Delete an override specified by its ID. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/inferenceclassificationoverride-delete?view=graph-rest-1.0|Find more info here} - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Change the classifyAs field of an override as specified. You cannot use PATCH to change any other fields in an inferenceClassificationOverride instance. If an override exists for a sender and the sender changes his/her display name, you can use POST to force an update to the name field in the existing override. If an override exists for a sender and the sender changes his/her SMTP address, deleting the existing override and creating a new one withthe new SMTP address is the only way to 'update' the override for this sender. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/inferenceclassificationoverride-update?view=graph-rest-1.0|Find more info here} - */ - patch(body: InferenceClassificationOverride, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete an override specified by its ID. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Change the classifyAs field of an override as specified. You cannot use PATCH to change any other fields in an inferenceClassificationOverride instance. If an override exists for a sender and the sender changes his/her display name, you can use POST to force an update to the name field in the existing override. If an override exists for a sender and the sender changes his/her SMTP address, deleting the existing override and creating a new one withthe new SMTP address is the only way to 'update' the override for this sender. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: InferenceClassificationOverride, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Delete an override specified by its ID. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/inferenceclassificationoverride-delete?view=graph-rest-1.0|Find more info here} + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Change the classifyAs field of an override as specified. You cannot use PATCH to change any other fields in an inferenceClassificationOverride instance. If an override exists for a sender and the sender changes his/her display name, you can use POST to force an update to the name field in the existing override. If an override exists for a sender and the sender changes his/her SMTP address, deleting the existing override and creating a new one withthe new SMTP address is the only way to 'update' the override for this sender. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/inferenceclassificationoverride-update?view=graph-rest-1.0|Find more info here} + */ + patch(body: InferenceClassificationOverride, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete an override specified by its ID. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Change the classifyAs field of an override as specified. You cannot use PATCH to change any other fields in an inferenceClassificationOverride instance. If an override exists for a sender and the sender changes his/her display name, you can use POST to force an update to the name field in the existing override. If an override exists for a sender and the sender changes his/her SMTP address, deleting the existing override and creating a new one withthe new SMTP address is the only way to 'update' the override for this sender. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: InferenceClassificationOverride, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. */ export interface InferenceClassificationOverrideItemRequestBuilderGetQueryParameters { - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -70,43 +70,43 @@ export const InferenceClassificationOverrideItemRequestBuilderUriTemplate = "{+b * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const InferenceClassificationOverrideItemRequestBuilderGetQueryParametersMapper: Record = { - "select": "%24select", + select: "%24select", }; /** * Metadata for all the requests in the request builder. */ export const InferenceClassificationOverrideItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: InferenceClassificationOverrideItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: InferenceClassificationOverrideItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createInferenceClassificationOverrideFromDiscriminatorValue, - queryParametersMapper: InferenceClassificationOverrideItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: InferenceClassificationOverrideItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createInferenceClassificationOverrideFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeInferenceClassificationOverride, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: InferenceClassificationOverrideItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: InferenceClassificationOverrideItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createInferenceClassificationOverrideFromDiscriminatorValue, + queryParametersMapper: InferenceClassificationOverrideItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: InferenceClassificationOverrideItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createInferenceClassificationOverrideFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeInferenceClassificationOverride, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/count/index.ts index dab850be8..736e27465 100644 --- a/packages/test/generatedCode/users/item/mailFolders/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mail * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/index.ts b/packages/test/generatedCode/users/item/mailFolders/index.ts index 6f1f6e571..aa763b647 100644 --- a/packages/test/generatedCode/users/item/mailFolders/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/index.ts @@ -1,93 +1,93 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMailFolderCollectionResponseFromDiscriminatorValue, createMailFolderFromDiscriminatorValue, serializeMailFolder, type MailFolder, type MailFolderCollectionResponse } from '../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { MailFolderItemRequestBuilderNavigationMetadata, MailFolderItemRequestBuilderRequestsMetadata, type MailFolderItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMailFolderCollectionResponseFromDiscriminatorValue, createMailFolderFromDiscriminatorValue, serializeMailFolder, type MailFolder, type MailFolderCollectionResponse } from "../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { MailFolderItemRequestBuilderNavigationMetadata, MailFolderItemRequestBuilderRequestsMetadata, type MailFolderItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders */ export interface MailFoldersRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.mailFolders.item collection - * @param mailFolderId The unique identifier of mailFolder - * @returns {MailFolderItemRequestBuilder} - */ - byMailFolderId(mailFolderId: string) : MailFolderItemRequestBuilder; - /** - * The user's mail folders. Read-only. Nullable. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/user-list-mailfolders?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Use this API to create a new mail folder in the root folder of the user's mailbox. If you intend a new folder to be hidden, you must set the isHidden property to true on creation. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/user-post-mailfolders?view=graph-rest-1.0|Find more info here} - */ - post(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * The user's mail folders. Read-only. Nullable. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Use this API to create a new mail folder in the root folder of the user's mailbox. If you intend a new folder to be hidden, you must set the isHidden property to true on creation. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.mailFolders.item collection + * @param mailFolderId The unique identifier of mailFolder + * @returns {MailFolderItemRequestBuilder} + */ + byMailFolderId(mailFolderId: string): MailFolderItemRequestBuilder; + /** + * The user's mail folders. Read-only. Nullable. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/user-list-mailfolders?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Use this API to create a new mail folder in the root folder of the user's mailbox. If you intend a new folder to be hidden, you must set the isHidden property to true on creation. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/user-post-mailfolders?view=graph-rest-1.0|Find more info here} + */ + post(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * The user's mail folders. Read-only. Nullable. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Use this API to create a new mail folder in the root folder of the user's mailbox. If you intend a new folder to be hidden, you must set the isHidden property to true on creation. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * The user's mail folders. Read-only. Nullable. */ export interface MailFoldersRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Include Hidden Folders - */ - includeHiddenFolders?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Include Hidden Folders + */ + includeHiddenFolders?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -97,53 +97,53 @@ export const MailFoldersRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MailFoldersRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const MailFoldersRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byMailFolderId: { - requestsMetadata: MailFolderItemRequestBuilderRequestsMetadata, - navigationMetadata: MailFolderItemRequestBuilderNavigationMetadata, - pathParametersMappings: ["mailFolder%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byMailFolderId: { + requestsMetadata: MailFolderItemRequestBuilderRequestsMetadata, + navigationMetadata: MailFolderItemRequestBuilderNavigationMetadata, + pathParametersMappings: ["mailFolder%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MailFoldersRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: MailFoldersRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMailFolderCollectionResponseFromDiscriminatorValue, - queryParametersMapper: MailFoldersRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: MailFoldersRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMailFolderFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMailFolder, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: MailFoldersRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMailFolderCollectionResponseFromDiscriminatorValue, + queryParametersMapper: MailFoldersRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: MailFoldersRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMailFolderFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMailFolder, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts index 14f222a31..4620aaabb 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mail * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts index 98a61e0f7..1676bb73b 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts @@ -1,93 +1,93 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMailFolderCollectionResponseFromDiscriminatorValue, createMailFolderFromDiscriminatorValue, serializeMailFolder, type MailFolder, type MailFolderCollectionResponse } from '../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { MailFolderItemRequestBuilderNavigationMetadata, MailFolderItemRequestBuilderRequestsMetadata, type MailFolderItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMailFolderCollectionResponseFromDiscriminatorValue, createMailFolderFromDiscriminatorValue, serializeMailFolder, type MailFolder, type MailFolderCollectionResponse } from "../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { MailFolderItemRequestBuilderNavigationMetadata, MailFolderItemRequestBuilderRequestsMetadata, type MailFolderItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders */ export interface ChildFoldersRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.mailFolders.item.childFolders.item collection - * @param mailFolderId1 The unique identifier of mailFolder - * @returns {MailFolderItemRequestBuilder} - */ - byMailFolderId1(mailFolderId1: string) : MailFolderItemRequestBuilder; - /** - * The collection of child folders in the mailFolder. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-childfolders?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Create a new mailSearchFolder in the specified user's mailbox. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailsearchfolder-post?view=graph-rest-1.0|Find more info here} - */ - post(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * The collection of child folders in the mailFolder. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Create a new mailSearchFolder in the specified user's mailbox. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.mailFolders.item.childFolders.item collection + * @param mailFolderId1 The unique identifier of mailFolder + * @returns {MailFolderItemRequestBuilder} + */ + byMailFolderId1(mailFolderId1: string): MailFolderItemRequestBuilder; + /** + * The collection of child folders in the mailFolder. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-childfolders?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Create a new mailSearchFolder in the specified user's mailbox. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailsearchfolder-post?view=graph-rest-1.0|Find more info here} + */ + post(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * The collection of child folders in the mailFolder. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Create a new mailSearchFolder in the specified user's mailbox. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * The collection of child folders in the mailFolder. */ export interface ChildFoldersRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Include Hidden Folders - */ - includeHiddenFolders?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Include Hidden Folders + */ + includeHiddenFolders?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -97,53 +97,53 @@ export const ChildFoldersRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Di * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const ChildFoldersRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const ChildFoldersRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byMailFolderId1: { - requestsMetadata: MailFolderItemRequestBuilderRequestsMetadata, - navigationMetadata: MailFolderItemRequestBuilderNavigationMetadata, - pathParametersMappings: ["mailFolder%2Did1"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byMailFolderId1: { + requestsMetadata: MailFolderItemRequestBuilderRequestsMetadata, + navigationMetadata: MailFolderItemRequestBuilderNavigationMetadata, + pathParametersMappings: ["mailFolder%2Did1"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const ChildFoldersRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: ChildFoldersRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMailFolderCollectionResponseFromDiscriminatorValue, - queryParametersMapper: ChildFoldersRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: ChildFoldersRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMailFolderFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMailFolder, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: ChildFoldersRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMailFolderCollectionResponseFromDiscriminatorValue, + queryParametersMapper: ChildFoldersRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: ChildFoldersRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMailFolderFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMailFolder, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts index 075fdd6f6..b2e10d541 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts @@ -1,82 +1,82 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMailFolderFromDiscriminatorValue, serializeMailFolder, type MailFolder } from '../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../models/oDataErrors/'; -import { MessageRulesRequestBuilderNavigationMetadata, MessageRulesRequestBuilderRequestsMetadata, type MessageRulesRequestBuilder } from './messageRules/'; -import { MessagesRequestBuilderNavigationMetadata, MessagesRequestBuilderRequestsMetadata, type MessagesRequestBuilder } from './messages/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMailFolderFromDiscriminatorValue, serializeMailFolder, type MailFolder } from "../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../models/oDataErrors/"; +import { MessageRulesRequestBuilderNavigationMetadata, MessageRulesRequestBuilderRequestsMetadata, type MessageRulesRequestBuilder } from "./messageRules/"; +import { MessagesRequestBuilderNavigationMetadata, MessagesRequestBuilderRequestsMetadata, type MessagesRequestBuilder } from "./messages/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1} */ export interface MailFolderItemRequestBuilder extends BaseRequestBuilder { - /** - * The messageRules property - */ - get messageRules(): MessageRulesRequestBuilder; - /** - * The messages property - */ - get messages(): MessagesRequestBuilder; - /** - * Delete navigation property childFolders for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * The collection of child folders in the mailFolder. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update the navigation property childFolders in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - patch(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete navigation property childFolders for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * The collection of child folders in the mailFolder. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update the navigation property childFolders in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The messageRules property + */ + get messageRules(): MessageRulesRequestBuilder; + /** + * The messages property + */ + get messages(): MessagesRequestBuilder; + /** + * Delete navigation property childFolders for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * The collection of child folders in the mailFolder. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update the navigation property childFolders in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + patch(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete navigation property childFolders for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * The collection of child folders in the mailFolder. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update the navigation property childFolders in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * The collection of child folders in the mailFolder. */ export interface MailFolderItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Include Hidden Folders - */ - includeHiddenFolders?: string; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Include Hidden Folders + */ + includeHiddenFolders?: string; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -86,57 +86,57 @@ export const MailFolderItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2 * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MailFolderItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the navigation properties in the request builder. */ export const MailFolderItemRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - messageRules: { - requestsMetadata: MessageRulesRequestBuilderRequestsMetadata, - navigationMetadata: MessageRulesRequestBuilderNavigationMetadata, - }, - messages: { - requestsMetadata: MessagesRequestBuilderRequestsMetadata, - navigationMetadata: MessagesRequestBuilderNavigationMetadata, - }, + messageRules: { + requestsMetadata: MessageRulesRequestBuilderRequestsMetadata, + navigationMetadata: MessageRulesRequestBuilderNavigationMetadata, + }, + messages: { + requestsMetadata: MessagesRequestBuilderRequestsMetadata, + navigationMetadata: MessagesRequestBuilderNavigationMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MailFolderItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: MailFolderItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: MailFolderItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMailFolderFromDiscriminatorValue, - queryParametersMapper: MailFolderItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: MailFolderItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMailFolderFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMailFolder, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: MailFolderItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: MailFolderItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMailFolderFromDiscriminatorValue, + queryParametersMapper: MailFolderItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: MailFolderItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMailFolderFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMailFolder, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts index 097d9d1cd..24b7e5208 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messageRules/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mail * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts index a6af4526f..ea6bd3d1e 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts @@ -1,85 +1,85 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMessageRuleCollectionResponseFromDiscriminatorValue, createMessageRuleFromDiscriminatorValue, serializeMessageRule, type MessageRule, type MessageRuleCollectionResponse } from '../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { MessageRuleItemRequestBuilderRequestsMetadata, type MessageRuleItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMessageRuleCollectionResponseFromDiscriminatorValue, createMessageRuleFromDiscriminatorValue, serializeMessageRule, type MessageRule, type MessageRuleCollectionResponse } from "../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { MessageRuleItemRequestBuilderRequestsMetadata, type MessageRuleItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messageRules */ export interface MessageRulesRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.mailFolders.item.childFolders.item.messageRules.item collection - * @param messageRuleId The unique identifier of messageRule - * @returns {MessageRuleItemRequestBuilder} - */ - byMessageRuleId(messageRuleId: string) : MessageRuleItemRequestBuilder; - /** - * Get all the messageRule objects defined for the user's inbox. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messagerules?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Create a messageRule object by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user's Inbox meets the specified conditions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-post-messagerules?view=graph-rest-1.0|Find more info here} - */ - post(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get all the messageRule objects defined for the user's inbox. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Create a messageRule object by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user's Inbox meets the specified conditions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.mailFolders.item.childFolders.item.messageRules.item collection + * @param messageRuleId The unique identifier of messageRule + * @returns {MessageRuleItemRequestBuilder} + */ + byMessageRuleId(messageRuleId: string): MessageRuleItemRequestBuilder; + /** + * Get all the messageRule objects defined for the user's inbox. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messagerules?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Create a messageRule object by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user's Inbox meets the specified conditions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-post-messagerules?view=graph-rest-1.0|Find more info here} + */ + post(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get all the messageRule objects defined for the user's inbox. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Create a messageRule object by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user's Inbox meets the specified conditions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get all the messageRule objects defined for the user's inbox. */ export interface MessageRulesRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -89,51 +89,51 @@ export const MessageRulesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Di * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessageRulesRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const MessageRulesRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byMessageRuleId: { - requestsMetadata: MessageRuleItemRequestBuilderRequestsMetadata, - pathParametersMappings: ["messageRule%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byMessageRuleId: { + requestsMetadata: MessageRuleItemRequestBuilderRequestsMetadata, + pathParametersMappings: ["messageRule%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MessageRulesRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: MessageRulesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageRuleCollectionResponseFromDiscriminatorValue, - queryParametersMapper: MessageRulesRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: MessageRulesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageRuleFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMessageRule, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: MessageRulesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageRuleCollectionResponseFromDiscriminatorValue, + queryParametersMapper: MessageRulesRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: MessageRulesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageRuleFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMessageRule, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts index 03e378386..77e6c16d7 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts @@ -1,67 +1,67 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMessageRuleFromDiscriminatorValue, serializeMessageRule, type MessageRule } from '../../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMessageRuleFromDiscriminatorValue, serializeMessageRule, type MessageRule } from "../../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messageRules/{messageRule-id} */ export interface MessageRuleItemRequestBuilder extends BaseRequestBuilder { - /** - * Delete the specified messageRule object. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/messagerule-delete?view=graph-rest-1.0|Find more info here} - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the properties and relationships of a messageRule object. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/messagerule-get?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Change writable properties on a messageRule object and save the changes. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/messagerule-update?view=graph-rest-1.0|Find more info here} - */ - patch(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete the specified messageRule object. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Get the properties and relationships of a messageRule object. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Change writable properties on a messageRule object and save the changes. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Delete the specified messageRule object. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/messagerule-delete?view=graph-rest-1.0|Find more info here} + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the properties and relationships of a messageRule object. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/messagerule-get?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Change writable properties on a messageRule object and save the changes. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/messagerule-update?view=graph-rest-1.0|Find more info here} + */ + patch(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete the specified messageRule object. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Get the properties and relationships of a messageRule object. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Change writable properties on a messageRule object and save the changes. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the properties and relationships of a messageRule object. */ export interface MessageRuleItemRequestBuilderGetQueryParameters { - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -71,43 +71,43 @@ export const MessageRuleItemRequestBuilderUriTemplate = "{+baseurl}/users/{user% * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessageRuleItemRequestBuilderGetQueryParametersMapper: Record = { - "select": "%24select", + select: "%24select", }; /** * Metadata for all the requests in the request builder. */ export const MessageRuleItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: MessageRuleItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: MessageRuleItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageRuleFromDiscriminatorValue, - queryParametersMapper: MessageRuleItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: MessageRuleItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageRuleFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMessageRule, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: MessageRuleItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: MessageRuleItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageRuleFromDiscriminatorValue, + queryParametersMapper: MessageRuleItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: MessageRuleItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageRuleFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMessageRule, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts index f6f580aed..d0c62bfdf 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts @@ -1,39 +1,39 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messages/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; - /** - * Search items by search phrases - */ - search?: string; + /** + * Filter items by property values + */ + filter?: string; + /** + * Search items by search phrases + */ + search?: string; } /** * Uri template for the request builder. @@ -43,23 +43,23 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mail * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", - "search": "%24search", + filter: "%24filter", + search: "%24search", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts index f1f7c50d6..6396525df 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts @@ -1,93 +1,93 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMessageCollectionResponseFromDiscriminatorValue, createMessageFromDiscriminatorValue, serializeMessage, type Message, type MessageCollectionResponse } from '../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { MessageItemRequestBuilderNavigationMetadata, MessageItemRequestBuilderRequestsMetadata, type MessageItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMessageCollectionResponseFromDiscriminatorValue, createMessageFromDiscriminatorValue, serializeMessage, type Message, type MessageCollectionResponse } from "../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { MessageItemRequestBuilderNavigationMetadata, MessageItemRequestBuilderRequestsMetadata, type MessageItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messages */ export interface MessagesRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.mailFolders.item.childFolders.item.messages.item collection - * @param messageId The unique identifier of message - * @returns {MessageItemRequestBuilder} - */ - byMessageId(messageId: string) : MessageItemRequestBuilder; - /** - * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Use this API to create a new Message in a mailfolder. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-post-messages?view=graph-rest-1.0|Find more info here} - */ - post(body: Message, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Use this API to create a new Message in a mailfolder. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.mailFolders.item.childFolders.item.messages.item collection + * @param messageId The unique identifier of message + * @returns {MessageItemRequestBuilder} + */ + byMessageId(messageId: string): MessageItemRequestBuilder; + /** + * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Use this API to create a new Message in a mailfolder. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-post-messages?view=graph-rest-1.0|Find more info here} + */ + post(body: Message, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Use this API to create a new Message in a mailfolder. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. */ export interface MessagesRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Search items by search phrases - */ - search?: string; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Search items by search phrases + */ + search?: string; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -97,54 +97,54 @@ export const MessagesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/m * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessagesRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "search": "%24search", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + search: "%24search", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const MessagesRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byMessageId: { - requestsMetadata: MessageItemRequestBuilderRequestsMetadata, - navigationMetadata: MessageItemRequestBuilderNavigationMetadata, - pathParametersMappings: ["message%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byMessageId: { + requestsMetadata: MessageItemRequestBuilderRequestsMetadata, + navigationMetadata: MessageItemRequestBuilderNavigationMetadata, + pathParametersMappings: ["message%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MessagesRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: MessagesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageCollectionResponseFromDiscriminatorValue, - queryParametersMapper: MessagesRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: MessagesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMessage, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: MessagesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageCollectionResponseFromDiscriminatorValue, + queryParametersMapper: MessagesRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: MessagesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMessage, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts index b45d7145f..a2f8cfa44 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messages/{message-id}/attachments/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mail * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts index ec6f999d4..0761a2342 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts @@ -1,81 +1,81 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createAttachmentCollectionResponseFromDiscriminatorValue, createAttachmentFromDiscriminatorValue, serializeAttachment, type Attachment, type AttachmentCollectionResponse } from '../../../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { AttachmentItemRequestBuilderRequestsMetadata, type AttachmentItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createAttachmentCollectionResponseFromDiscriminatorValue, createAttachmentFromDiscriminatorValue, serializeAttachment, type Attachment, type AttachmentCollectionResponse } from "../../../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { AttachmentItemRequestBuilderRequestsMetadata, type AttachmentItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messages/{message-id}/attachments */ export interface AttachmentsRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.mailFolders.item.childFolders.item.messages.item.attachments.item collection - * @param attachmentId The unique identifier of attachment - * @returns {AttachmentItemRequestBuilder} - */ - byAttachmentId(attachmentId: string) : AttachmentItemRequestBuilder; - /** - * Retrieve a list of attachment objects. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/eventmessage-list-attachments?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/eventmessage-post-attachments?view=graph-rest-1.0|Find more info here} - */ - post(body: Attachment, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Retrieve a list of attachment objects. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: Attachment, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.mailFolders.item.childFolders.item.messages.item.attachments.item collection + * @param attachmentId The unique identifier of attachment + * @returns {AttachmentItemRequestBuilder} + */ + byAttachmentId(attachmentId: string): AttachmentItemRequestBuilder; + /** + * Retrieve a list of attachment objects. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/eventmessage-list-attachments?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/eventmessage-post-attachments?view=graph-rest-1.0|Find more info here} + */ + post(body: Attachment, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Retrieve a list of attachment objects. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: Attachment, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Retrieve a list of attachment objects. */ export interface AttachmentsRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -85,50 +85,50 @@ export const AttachmentsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const AttachmentsRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", }; /** * Metadata for all the navigation properties in the request builder. */ export const AttachmentsRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byAttachmentId: { - requestsMetadata: AttachmentItemRequestBuilderRequestsMetadata, - pathParametersMappings: ["attachment%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byAttachmentId: { + requestsMetadata: AttachmentItemRequestBuilderRequestsMetadata, + pathParametersMappings: ["attachment%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const AttachmentsRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: AttachmentsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createAttachmentCollectionResponseFromDiscriminatorValue, - queryParametersMapper: AttachmentsRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: AttachmentsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createAttachmentFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeAttachment, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: AttachmentsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createAttachmentCollectionResponseFromDiscriminatorValue, + queryParametersMapper: AttachmentsRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: AttachmentsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createAttachmentFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeAttachment, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts index 362a1d5b7..2d2b33eed 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts @@ -1,54 +1,54 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createAttachmentFromDiscriminatorValue, type Attachment } from '../../../../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createAttachmentFromDiscriminatorValue, type Attachment } from "../../../../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messages/{message-id}/attachments/{attachment-id} */ export interface AttachmentItemRequestBuilder extends BaseRequestBuilder { - /** - * Delete navigation property attachments for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/attachment-get?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete navigation property attachments for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Delete navigation property attachments for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/attachment-get?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete navigation property attachments for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. */ export interface AttachmentItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -58,32 +58,32 @@ export const AttachmentItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2 * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const AttachmentItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the requests in the request builder. */ export const AttachmentItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: AttachmentItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: AttachmentItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createAttachmentFromDiscriminatorValue, - queryParametersMapper: AttachmentItemRequestBuilderGetQueryParametersMapper, - }, + delete: { + uriTemplate: AttachmentItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: AttachmentItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createAttachmentFromDiscriminatorValue, + queryParametersMapper: AttachmentItemRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts index 48af8fa9a..86ce9d99e 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messages/{message-id}/extensions/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mail * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts index 06dac35a1..eee0dcfe5 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts @@ -1,88 +1,88 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createExtensionCollectionResponseFromDiscriminatorValue, createExtensionFromDiscriminatorValue, serializeExtension, type Extension, type ExtensionCollectionResponse } from '../../../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { ExtensionItemRequestBuilderRequestsMetadata, type ExtensionItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createExtensionCollectionResponseFromDiscriminatorValue, createExtensionFromDiscriminatorValue, serializeExtension, type Extension, type ExtensionCollectionResponse } from "../../../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { ExtensionItemRequestBuilderRequestsMetadata, type ExtensionItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messages/{message-id}/extensions */ export interface ExtensionsRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.mailFolders.item.childFolders.item.messages.item.extensions.item collection - * @param extensionId The unique identifier of extension - * @returns {ExtensionItemRequestBuilder} - */ - byExtensionId(extensionId: string) : ExtensionItemRequestBuilder; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0|Find more info here} - */ - post(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.mailFolders.item.childFolders.item.messages.item.extensions.item collection + * @param extensionId The unique identifier of extension + * @returns {ExtensionItemRequestBuilder} + */ + byExtensionId(extensionId: string): ExtensionItemRequestBuilder; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0|Find more info here} + */ + post(body: Extension, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. */ export interface ExtensionsRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -92,52 +92,52 @@ export const ExtensionsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did} * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const ExtensionsRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const ExtensionsRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byExtensionId: { - requestsMetadata: ExtensionItemRequestBuilderRequestsMetadata, - pathParametersMappings: ["extension%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byExtensionId: { + requestsMetadata: ExtensionItemRequestBuilderRequestsMetadata, + pathParametersMappings: ["extension%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const ExtensionsRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: ExtensionsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionCollectionResponseFromDiscriminatorValue, - queryParametersMapper: ExtensionsRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: ExtensionsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeExtension, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: ExtensionsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionCollectionResponseFromDiscriminatorValue, + queryParametersMapper: ExtensionsRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: ExtensionsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeExtension, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts index e4dfce029..cddd611fd 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts @@ -1,70 +1,70 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createExtensionFromDiscriminatorValue, serializeExtension, type Extension } from '../../../../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createExtensionFromDiscriminatorValue, serializeExtension, type Extension } from "../../../../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messages/{message-id}/extensions/{extension-id} */ export interface ExtensionItemRequestBuilder extends BaseRequestBuilder { - /** - * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-delete?view=graph-rest-1.0|Find more info here} - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update the navigation property extensions in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - patch(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update the navigation property extensions in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-delete?view=graph-rest-1.0|Find more info here} + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update the navigation property extensions in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + patch(body: Extension, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update the navigation property extensions in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. */ export interface ExtensionItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -74,44 +74,44 @@ export const ExtensionItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2D * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const ExtensionItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the requests in the request builder. */ export const ExtensionItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: ExtensionItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: ExtensionItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionFromDiscriminatorValue, - queryParametersMapper: ExtensionItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: ExtensionItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeExtension, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: ExtensionItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: ExtensionItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionFromDiscriminatorValue, + queryParametersMapper: ExtensionItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: ExtensionItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeExtension, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts index 65ae3e468..c031f2331 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts @@ -1,83 +1,83 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMessageFromDiscriminatorValue, serializeMessage, type Message } from '../../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../models/oDataErrors/'; -import { AttachmentsRequestBuilderNavigationMetadata, AttachmentsRequestBuilderRequestsMetadata, type AttachmentsRequestBuilder } from './attachments/'; -import { ExtensionsRequestBuilderNavigationMetadata, ExtensionsRequestBuilderRequestsMetadata, type ExtensionsRequestBuilder } from './extensions/'; -import { ContentRequestBuilderRequestsMetadata, type ContentRequestBuilder } from './value/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMessageFromDiscriminatorValue, serializeMessage, type Message } from "../../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../models/oDataErrors/"; +import { AttachmentsRequestBuilderNavigationMetadata, AttachmentsRequestBuilderRequestsMetadata, type AttachmentsRequestBuilder } from "./attachments/"; +import { ExtensionsRequestBuilderNavigationMetadata, ExtensionsRequestBuilderRequestsMetadata, type ExtensionsRequestBuilder } from "./extensions/"; +import { ContentRequestBuilderRequestsMetadata, type ContentRequestBuilder } from "./value/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messages/{message-id} */ export interface MessageItemRequestBuilder extends BaseRequestBuilder { - /** - * The attachments property - */ - get attachments(): AttachmentsRequestBuilder; - /** - * The Content property - */ - get content(): ContentRequestBuilder; - /** - * The extensions property - */ - get extensions(): ExtensionsRequestBuilder; - /** - * Delete navigation property messages for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * The collection of messages in the mailFolder. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update the navigation property messages in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - patch(body: Message, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete navigation property messages for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * The collection of messages in the mailFolder. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update the navigation property messages in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The attachments property + */ + get attachments(): AttachmentsRequestBuilder; + /** + * The Content property + */ + get content(): ContentRequestBuilder; + /** + * The extensions property + */ + get extensions(): ExtensionsRequestBuilder; + /** + * Delete navigation property messages for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * The collection of messages in the mailFolder. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update the navigation property messages in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + patch(body: Message, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete navigation property messages for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * The collection of messages in the mailFolder. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update the navigation property messages in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * The collection of messages in the mailFolder. */ export interface MessageItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -87,60 +87,60 @@ export const MessageItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessageItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the navigation properties in the request builder. */ export const MessageItemRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - attachments: { - requestsMetadata: AttachmentsRequestBuilderRequestsMetadata, - navigationMetadata: AttachmentsRequestBuilderNavigationMetadata, - }, - content: { - requestsMetadata: ContentRequestBuilderRequestsMetadata, - }, - extensions: { - requestsMetadata: ExtensionsRequestBuilderRequestsMetadata, - navigationMetadata: ExtensionsRequestBuilderNavigationMetadata, - }, + attachments: { + requestsMetadata: AttachmentsRequestBuilderRequestsMetadata, + navigationMetadata: AttachmentsRequestBuilderNavigationMetadata, + }, + content: { + requestsMetadata: ContentRequestBuilderRequestsMetadata, + }, + extensions: { + requestsMetadata: ExtensionsRequestBuilderRequestsMetadata, + navigationMetadata: ExtensionsRequestBuilderNavigationMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MessageItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: MessageItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: MessageItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageFromDiscriminatorValue, - queryParametersMapper: MessageItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: MessageItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMessage, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: MessageItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: MessageItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageFromDiscriminatorValue, + queryParametersMapper: MessageItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: MessageItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMessage, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/value/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/value/index.ts index 4d649aaae..b3413aebe 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/value/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/value/index.ts @@ -1,51 +1,51 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}/messages/{message-id}/$value */ export interface ContentRequestBuilder extends BaseRequestBuilder { - /** - * Get media content for the navigation property messages from users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update media content for the navigation property messages in users - * @param body Binary request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - put(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get media content for the navigation property messages from users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update media content for the navigation property messages in users - * @param body Binary request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get media content for the navigation property messages from users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update media content for the navigation property messages in users + * @param body Binary request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + put(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get media content for the navigation property messages from users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update media content for the navigation property messages in users + * @param body Binary request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get media content for the navigation property messages from users */ export interface ContentRequestBuilderGetQueryParameters { - /** - * Format of the content - */ - format?: string; + /** + * Format of the content + */ + format?: string; } /** * Uri template for the request builder. @@ -55,33 +55,33 @@ export const ContentRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/ma * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const ContentRequestBuilderGetQueryParametersMapper: Record = { - "format": "%24format", + format: "%24format", }; /** * Metadata for all the requests in the request builder. */ export const ContentRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: ContentRequestBuilderUriTemplate, - responseBodyContentType: "application/octet-stream, application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - queryParametersMapper: ContentRequestBuilderGetQueryParametersMapper, - }, - put: { - uriTemplate: ContentRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - requestBodyContentType: "application/octet-stream", - requestInformationContentSetMethod: "setStreamContent", - }, + get: { + uriTemplate: ContentRequestBuilderUriTemplate, + responseBodyContentType: "application/octet-stream, application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + queryParametersMapper: ContentRequestBuilderGetQueryParametersMapper, + }, + put: { + uriTemplate: ContentRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + requestBodyContentType: "application/octet-stream", + requestInformationContentSetMethod: "setStreamContent", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/index.ts index c721b888a..a5b5a0087 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/index.ts @@ -1,90 +1,90 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMailFolderFromDiscriminatorValue, serializeMailFolder, type MailFolder } from '../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../models/oDataErrors/'; -import { ChildFoldersRequestBuilderNavigationMetadata, ChildFoldersRequestBuilderRequestsMetadata, type ChildFoldersRequestBuilder } from './childFolders/'; -import { MessageRulesRequestBuilderNavigationMetadata, MessageRulesRequestBuilderRequestsMetadata, type MessageRulesRequestBuilder } from './messageRules/'; -import { MessagesRequestBuilderNavigationMetadata, MessagesRequestBuilderRequestsMetadata, type MessagesRequestBuilder } from './messages/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMailFolderFromDiscriminatorValue, serializeMailFolder, type MailFolder } from "../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../models/oDataErrors/"; +import { ChildFoldersRequestBuilderNavigationMetadata, ChildFoldersRequestBuilderRequestsMetadata, type ChildFoldersRequestBuilder } from "./childFolders/"; +import { MessageRulesRequestBuilderNavigationMetadata, MessageRulesRequestBuilderRequestsMetadata, type MessageRulesRequestBuilder } from "./messageRules/"; +import { MessagesRequestBuilderNavigationMetadata, MessagesRequestBuilderRequestsMetadata, type MessagesRequestBuilder } from "./messages/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id} */ export interface MailFolderItemRequestBuilder extends BaseRequestBuilder { - /** - * The childFolders property - */ - get childFolders(): ChildFoldersRequestBuilder; - /** - * The messageRules property - */ - get messageRules(): MessageRulesRequestBuilder; - /** - * The messages property - */ - get messages(): MessagesRequestBuilder; - /** - * Delete the specified mailFolder. The folder can be a mailSearchFolder. You can specify a mail folder by its folder ID, or by its well-known folder name, if one exists. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-delete?view=graph-rest-1.0|Find more info here} - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * The user's mail folders. Read-only. Nullable. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-get?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update the properties of mailfolder object. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-update?view=graph-rest-1.0|Find more info here} - */ - patch(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete the specified mailFolder. The folder can be a mailSearchFolder. You can specify a mail folder by its folder ID, or by its well-known folder name, if one exists. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * The user's mail folders. Read-only. Nullable. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update the properties of mailfolder object. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The childFolders property + */ + get childFolders(): ChildFoldersRequestBuilder; + /** + * The messageRules property + */ + get messageRules(): MessageRulesRequestBuilder; + /** + * The messages property + */ + get messages(): MessagesRequestBuilder; + /** + * Delete the specified mailFolder. The folder can be a mailSearchFolder. You can specify a mail folder by its folder ID, or by its well-known folder name, if one exists. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-delete?view=graph-rest-1.0|Find more info here} + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * The user's mail folders. Read-only. Nullable. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-get?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update the properties of mailfolder object. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-update?view=graph-rest-1.0|Find more info here} + */ + patch(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete the specified mailFolder. The folder can be a mailSearchFolder. You can specify a mail folder by its folder ID, or by its well-known folder name, if one exists. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * The user's mail folders. Read-only. Nullable. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update the properties of mailfolder object. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: MailFolder, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * The user's mail folders. Read-only. Nullable. */ export interface MailFolderItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Include Hidden Folders - */ - includeHiddenFolders?: string; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Include Hidden Folders + */ + includeHiddenFolders?: string; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -94,61 +94,61 @@ export const MailFolderItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2 * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MailFolderItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the navigation properties in the request builder. */ export const MailFolderItemRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - childFolders: { - requestsMetadata: ChildFoldersRequestBuilderRequestsMetadata, - navigationMetadata: ChildFoldersRequestBuilderNavigationMetadata, - }, - messageRules: { - requestsMetadata: MessageRulesRequestBuilderRequestsMetadata, - navigationMetadata: MessageRulesRequestBuilderNavigationMetadata, - }, - messages: { - requestsMetadata: MessagesRequestBuilderRequestsMetadata, - navigationMetadata: MessagesRequestBuilderNavigationMetadata, - }, + childFolders: { + requestsMetadata: ChildFoldersRequestBuilderRequestsMetadata, + navigationMetadata: ChildFoldersRequestBuilderNavigationMetadata, + }, + messageRules: { + requestsMetadata: MessageRulesRequestBuilderRequestsMetadata, + navigationMetadata: MessageRulesRequestBuilderNavigationMetadata, + }, + messages: { + requestsMetadata: MessagesRequestBuilderRequestsMetadata, + navigationMetadata: MessagesRequestBuilderNavigationMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MailFolderItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: MailFolderItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: MailFolderItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMailFolderFromDiscriminatorValue, - queryParametersMapper: MailFolderItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: MailFolderItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMailFolderFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMailFolder, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: MailFolderItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: MailFolderItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMailFolderFromDiscriminatorValue, + queryParametersMapper: MailFolderItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: MailFolderItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMailFolderFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMailFolder, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts index b0c7a26cb..f4d483dba 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messageRules/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mail * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts index bd141607d..9f9de9988 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts @@ -1,85 +1,85 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMessageRuleCollectionResponseFromDiscriminatorValue, createMessageRuleFromDiscriminatorValue, serializeMessageRule, type MessageRule, type MessageRuleCollectionResponse } from '../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { MessageRuleItemRequestBuilderRequestsMetadata, type MessageRuleItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMessageRuleCollectionResponseFromDiscriminatorValue, createMessageRuleFromDiscriminatorValue, serializeMessageRule, type MessageRule, type MessageRuleCollectionResponse } from "../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { MessageRuleItemRequestBuilderRequestsMetadata, type MessageRuleItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messageRules */ export interface MessageRulesRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.mailFolders.item.messageRules.item collection - * @param messageRuleId The unique identifier of messageRule - * @returns {MessageRuleItemRequestBuilder} - */ - byMessageRuleId(messageRuleId: string) : MessageRuleItemRequestBuilder; - /** - * Get all the messageRule objects defined for the user's inbox. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messagerules?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Create a messageRule object by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user's Inbox meets the specified conditions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-post-messagerules?view=graph-rest-1.0|Find more info here} - */ - post(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get all the messageRule objects defined for the user's inbox. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Create a messageRule object by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user's Inbox meets the specified conditions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.mailFolders.item.messageRules.item collection + * @param messageRuleId The unique identifier of messageRule + * @returns {MessageRuleItemRequestBuilder} + */ + byMessageRuleId(messageRuleId: string): MessageRuleItemRequestBuilder; + /** + * Get all the messageRule objects defined for the user's inbox. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messagerules?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Create a messageRule object by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user's Inbox meets the specified conditions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-post-messagerules?view=graph-rest-1.0|Find more info here} + */ + post(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get all the messageRule objects defined for the user's inbox. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Create a messageRule object by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user's Inbox meets the specified conditions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get all the messageRule objects defined for the user's inbox. */ export interface MessageRulesRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -89,51 +89,51 @@ export const MessageRulesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Di * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessageRulesRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const MessageRulesRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byMessageRuleId: { - requestsMetadata: MessageRuleItemRequestBuilderRequestsMetadata, - pathParametersMappings: ["messageRule%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byMessageRuleId: { + requestsMetadata: MessageRuleItemRequestBuilderRequestsMetadata, + pathParametersMappings: ["messageRule%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MessageRulesRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: MessageRulesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageRuleCollectionResponseFromDiscriminatorValue, - queryParametersMapper: MessageRulesRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: MessageRulesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageRuleFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMessageRule, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: MessageRulesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageRuleCollectionResponseFromDiscriminatorValue, + queryParametersMapper: MessageRulesRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: MessageRulesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageRuleFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMessageRule, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts index 9e93b79df..567da7b85 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts @@ -1,67 +1,67 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMessageRuleFromDiscriminatorValue, serializeMessageRule, type MessageRule } from '../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMessageRuleFromDiscriminatorValue, serializeMessageRule, type MessageRule } from "../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messageRules/{messageRule-id} */ export interface MessageRuleItemRequestBuilder extends BaseRequestBuilder { - /** - * Delete the specified messageRule object. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/messagerule-delete?view=graph-rest-1.0|Find more info here} - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the properties and relationships of a messageRule object. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/messagerule-get?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Change writable properties on a messageRule object and save the changes. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/messagerule-update?view=graph-rest-1.0|Find more info here} - */ - patch(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete the specified messageRule object. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Get the properties and relationships of a messageRule object. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Change writable properties on a messageRule object and save the changes. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Delete the specified messageRule object. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/messagerule-delete?view=graph-rest-1.0|Find more info here} + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the properties and relationships of a messageRule object. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/messagerule-get?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Change writable properties on a messageRule object and save the changes. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/messagerule-update?view=graph-rest-1.0|Find more info here} + */ + patch(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete the specified messageRule object. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Get the properties and relationships of a messageRule object. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Change writable properties on a messageRule object and save the changes. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: MessageRule, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the properties and relationships of a messageRule object. */ export interface MessageRuleItemRequestBuilderGetQueryParameters { - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -71,43 +71,43 @@ export const MessageRuleItemRequestBuilderUriTemplate = "{+baseurl}/users/{user% * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessageRuleItemRequestBuilderGetQueryParametersMapper: Record = { - "select": "%24select", + select: "%24select", }; /** * Metadata for all the requests in the request builder. */ export const MessageRuleItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: MessageRuleItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: MessageRuleItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageRuleFromDiscriminatorValue, - queryParametersMapper: MessageRuleItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: MessageRuleItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageRuleFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMessageRule, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: MessageRuleItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: MessageRuleItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageRuleFromDiscriminatorValue, + queryParametersMapper: MessageRuleItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: MessageRuleItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageRuleFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMessageRule, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts index 90180360f..ba182c6e8 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts @@ -1,39 +1,39 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; - /** - * Search items by search phrases - */ - search?: string; + /** + * Filter items by property values + */ + filter?: string; + /** + * Search items by search phrases + */ + search?: string; } /** * Uri template for the request builder. @@ -43,23 +43,23 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mail * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", - "search": "%24search", + filter: "%24filter", + search: "%24search", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts index 0b5623095..03987d9f4 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts @@ -1,93 +1,93 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMessageCollectionResponseFromDiscriminatorValue, createMessageFromDiscriminatorValue, serializeMessage, type Message, type MessageCollectionResponse } from '../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { MessageItemRequestBuilderNavigationMetadata, MessageItemRequestBuilderRequestsMetadata, type MessageItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMessageCollectionResponseFromDiscriminatorValue, createMessageFromDiscriminatorValue, serializeMessage, type Message, type MessageCollectionResponse } from "../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { MessageItemRequestBuilderNavigationMetadata, MessageItemRequestBuilderRequestsMetadata, type MessageItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages */ export interface MessagesRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.mailFolders.item.messages.item collection - * @param messageId The unique identifier of message - * @returns {MessageItemRequestBuilder} - */ - byMessageId(messageId: string) : MessageItemRequestBuilder; - /** - * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Use this API to create a new Message in a mailfolder. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-post-messages?view=graph-rest-1.0|Find more info here} - */ - post(body: Message, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Use this API to create a new Message in a mailfolder. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.mailFolders.item.messages.item collection + * @param messageId The unique identifier of message + * @returns {MessageItemRequestBuilder} + */ + byMessageId(messageId: string): MessageItemRequestBuilder; + /** + * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Use this API to create a new Message in a mailfolder. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-post-messages?view=graph-rest-1.0|Find more info here} + */ + post(body: Message, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Use this API to create a new Message in a mailfolder. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. */ export interface MessagesRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Search items by search phrases - */ - search?: string; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Search items by search phrases + */ + search?: string; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -97,54 +97,54 @@ export const MessagesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/m * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessagesRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "search": "%24search", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + search: "%24search", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const MessagesRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byMessageId: { - requestsMetadata: MessageItemRequestBuilderRequestsMetadata, - navigationMetadata: MessageItemRequestBuilderNavigationMetadata, - pathParametersMappings: ["message%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byMessageId: { + requestsMetadata: MessageItemRequestBuilderRequestsMetadata, + navigationMetadata: MessageItemRequestBuilderNavigationMetadata, + pathParametersMappings: ["message%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MessagesRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: MessagesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageCollectionResponseFromDiscriminatorValue, - queryParametersMapper: MessagesRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: MessagesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMessage, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: MessagesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageCollectionResponseFromDiscriminatorValue, + queryParametersMapper: MessagesRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: MessagesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMessage, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts index 30e33225a..7256d4ac5 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/attachments/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mail * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts index 993fadd06..619030ba2 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts @@ -1,81 +1,81 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createAttachmentCollectionResponseFromDiscriminatorValue, createAttachmentFromDiscriminatorValue, serializeAttachment, type Attachment, type AttachmentCollectionResponse } from '../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { AttachmentItemRequestBuilderRequestsMetadata, type AttachmentItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createAttachmentCollectionResponseFromDiscriminatorValue, createAttachmentFromDiscriminatorValue, serializeAttachment, type Attachment, type AttachmentCollectionResponse } from "../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { AttachmentItemRequestBuilderRequestsMetadata, type AttachmentItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/attachments */ export interface AttachmentsRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.mailFolders.item.messages.item.attachments.item collection - * @param attachmentId The unique identifier of attachment - * @returns {AttachmentItemRequestBuilder} - */ - byAttachmentId(attachmentId: string) : AttachmentItemRequestBuilder; - /** - * Retrieve a list of attachment objects. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/eventmessage-list-attachments?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/eventmessage-post-attachments?view=graph-rest-1.0|Find more info here} - */ - post(body: Attachment, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Retrieve a list of attachment objects. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: Attachment, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.mailFolders.item.messages.item.attachments.item collection + * @param attachmentId The unique identifier of attachment + * @returns {AttachmentItemRequestBuilder} + */ + byAttachmentId(attachmentId: string): AttachmentItemRequestBuilder; + /** + * Retrieve a list of attachment objects. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/eventmessage-list-attachments?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/eventmessage-post-attachments?view=graph-rest-1.0|Find more info here} + */ + post(body: Attachment, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Retrieve a list of attachment objects. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: Attachment, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Retrieve a list of attachment objects. */ export interface AttachmentsRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -85,50 +85,50 @@ export const AttachmentsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const AttachmentsRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", }; /** * Metadata for all the navigation properties in the request builder. */ export const AttachmentsRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byAttachmentId: { - requestsMetadata: AttachmentItemRequestBuilderRequestsMetadata, - pathParametersMappings: ["attachment%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byAttachmentId: { + requestsMetadata: AttachmentItemRequestBuilderRequestsMetadata, + pathParametersMappings: ["attachment%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const AttachmentsRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: AttachmentsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createAttachmentCollectionResponseFromDiscriminatorValue, - queryParametersMapper: AttachmentsRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: AttachmentsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createAttachmentFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeAttachment, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: AttachmentsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createAttachmentCollectionResponseFromDiscriminatorValue, + queryParametersMapper: AttachmentsRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: AttachmentsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createAttachmentFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeAttachment, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts index d7bd34ddb..254849ebd 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts @@ -1,54 +1,54 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createAttachmentFromDiscriminatorValue, type Attachment } from '../../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createAttachmentFromDiscriminatorValue, type Attachment } from "../../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/attachments/{attachment-id} */ export interface AttachmentItemRequestBuilder extends BaseRequestBuilder { - /** - * Delete navigation property attachments for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/attachment-get?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete navigation property attachments for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Delete navigation property attachments for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/attachment-get?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete navigation property attachments for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. */ export interface AttachmentItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -58,32 +58,32 @@ export const AttachmentItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2 * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const AttachmentItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the requests in the request builder. */ export const AttachmentItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: AttachmentItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: AttachmentItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createAttachmentFromDiscriminatorValue, - queryParametersMapper: AttachmentItemRequestBuilderGetQueryParametersMapper, - }, + delete: { + uriTemplate: AttachmentItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: AttachmentItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createAttachmentFromDiscriminatorValue, + queryParametersMapper: AttachmentItemRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts index 53950e023..63701e274 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/extensions/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mail * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts index 708530cbd..ff596074e 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts @@ -1,88 +1,88 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createExtensionCollectionResponseFromDiscriminatorValue, createExtensionFromDiscriminatorValue, serializeExtension, type Extension, type ExtensionCollectionResponse } from '../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { ExtensionItemRequestBuilderRequestsMetadata, type ExtensionItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createExtensionCollectionResponseFromDiscriminatorValue, createExtensionFromDiscriminatorValue, serializeExtension, type Extension, type ExtensionCollectionResponse } from "../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { ExtensionItemRequestBuilderRequestsMetadata, type ExtensionItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/extensions */ export interface ExtensionsRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.mailFolders.item.messages.item.extensions.item collection - * @param extensionId The unique identifier of extension - * @returns {ExtensionItemRequestBuilder} - */ - byExtensionId(extensionId: string) : ExtensionItemRequestBuilder; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0|Find more info here} - */ - post(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.mailFolders.item.messages.item.extensions.item collection + * @param extensionId The unique identifier of extension + * @returns {ExtensionItemRequestBuilder} + */ + byExtensionId(extensionId: string): ExtensionItemRequestBuilder; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0|Find more info here} + */ + post(body: Extension, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. */ export interface ExtensionsRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -92,52 +92,52 @@ export const ExtensionsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did} * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const ExtensionsRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const ExtensionsRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byExtensionId: { - requestsMetadata: ExtensionItemRequestBuilderRequestsMetadata, - pathParametersMappings: ["extension%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byExtensionId: { + requestsMetadata: ExtensionItemRequestBuilderRequestsMetadata, + pathParametersMappings: ["extension%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const ExtensionsRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: ExtensionsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionCollectionResponseFromDiscriminatorValue, - queryParametersMapper: ExtensionsRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: ExtensionsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeExtension, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: ExtensionsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionCollectionResponseFromDiscriminatorValue, + queryParametersMapper: ExtensionsRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: ExtensionsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeExtension, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts index ef3858f8c..ba9f62442 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts @@ -1,70 +1,70 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createExtensionFromDiscriminatorValue, serializeExtension, type Extension } from '../../../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createExtensionFromDiscriminatorValue, serializeExtension, type Extension } from "../../../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/extensions/{extension-id} */ export interface ExtensionItemRequestBuilder extends BaseRequestBuilder { - /** - * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-delete?view=graph-rest-1.0|Find more info here} - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update the navigation property extensions in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - patch(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update the navigation property extensions in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-delete?view=graph-rest-1.0|Find more info here} + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update the navigation property extensions in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + patch(body: Extension, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update the navigation property extensions in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. */ export interface ExtensionItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -74,44 +74,44 @@ export const ExtensionItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2D * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const ExtensionItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the requests in the request builder. */ export const ExtensionItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: ExtensionItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: ExtensionItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionFromDiscriminatorValue, - queryParametersMapper: ExtensionItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: ExtensionItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeExtension, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: ExtensionItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: ExtensionItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionFromDiscriminatorValue, + queryParametersMapper: ExtensionItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: ExtensionItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeExtension, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts index cf3e1244d..1ed3c200f 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts @@ -1,83 +1,83 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMessageFromDiscriminatorValue, serializeMessage, type Message } from '../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../models/oDataErrors/'; -import { AttachmentsRequestBuilderNavigationMetadata, AttachmentsRequestBuilderRequestsMetadata, type AttachmentsRequestBuilder } from './attachments/'; -import { ExtensionsRequestBuilderNavigationMetadata, ExtensionsRequestBuilderRequestsMetadata, type ExtensionsRequestBuilder } from './extensions/'; -import { ContentRequestBuilderRequestsMetadata, type ContentRequestBuilder } from './value/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMessageFromDiscriminatorValue, serializeMessage, type Message } from "../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../models/oDataErrors/"; +import { AttachmentsRequestBuilderNavigationMetadata, AttachmentsRequestBuilderRequestsMetadata, type AttachmentsRequestBuilder } from "./attachments/"; +import { ExtensionsRequestBuilderNavigationMetadata, ExtensionsRequestBuilderRequestsMetadata, type ExtensionsRequestBuilder } from "./extensions/"; +import { ContentRequestBuilderRequestsMetadata, type ContentRequestBuilder } from "./value/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id} */ export interface MessageItemRequestBuilder extends BaseRequestBuilder { - /** - * The attachments property - */ - get attachments(): AttachmentsRequestBuilder; - /** - * The Content property - */ - get content(): ContentRequestBuilder; - /** - * The extensions property - */ - get extensions(): ExtensionsRequestBuilder; - /** - * Delete navigation property messages for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * The collection of messages in the mailFolder. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update the navigation property messages in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - patch(body: Message, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete navigation property messages for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * The collection of messages in the mailFolder. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update the navigation property messages in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The attachments property + */ + get attachments(): AttachmentsRequestBuilder; + /** + * The Content property + */ + get content(): ContentRequestBuilder; + /** + * The extensions property + */ + get extensions(): ExtensionsRequestBuilder; + /** + * Delete navigation property messages for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * The collection of messages in the mailFolder. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update the navigation property messages in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + patch(body: Message, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete navigation property messages for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * The collection of messages in the mailFolder. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update the navigation property messages in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * The collection of messages in the mailFolder. */ export interface MessageItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -87,60 +87,60 @@ export const MessageItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessageItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the navigation properties in the request builder. */ export const MessageItemRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - attachments: { - requestsMetadata: AttachmentsRequestBuilderRequestsMetadata, - navigationMetadata: AttachmentsRequestBuilderNavigationMetadata, - }, - content: { - requestsMetadata: ContentRequestBuilderRequestsMetadata, - }, - extensions: { - requestsMetadata: ExtensionsRequestBuilderRequestsMetadata, - navigationMetadata: ExtensionsRequestBuilderNavigationMetadata, - }, + attachments: { + requestsMetadata: AttachmentsRequestBuilderRequestsMetadata, + navigationMetadata: AttachmentsRequestBuilderNavigationMetadata, + }, + content: { + requestsMetadata: ContentRequestBuilderRequestsMetadata, + }, + extensions: { + requestsMetadata: ExtensionsRequestBuilderRequestsMetadata, + navigationMetadata: ExtensionsRequestBuilderNavigationMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MessageItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: MessageItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: MessageItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageFromDiscriminatorValue, - queryParametersMapper: MessageItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: MessageItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMessage, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: MessageItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: MessageItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageFromDiscriminatorValue, + queryParametersMapper: MessageItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: MessageItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMessage, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/index.ts index 368394386..f8f1c4dc0 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/index.ts @@ -1,51 +1,51 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/$value */ export interface ContentRequestBuilder extends BaseRequestBuilder { - /** - * Get media content for the navigation property messages from users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update media content for the navigation property messages in users - * @param body Binary request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - put(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get media content for the navigation property messages from users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update media content for the navigation property messages in users - * @param body Binary request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get media content for the navigation property messages from users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update media content for the navigation property messages in users + * @param body Binary request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + put(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get media content for the navigation property messages from users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update media content for the navigation property messages in users + * @param body Binary request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get media content for the navigation property messages from users */ export interface ContentRequestBuilderGetQueryParameters { - /** - * Format of the content - */ - format?: string; + /** + * Format of the content + */ + format?: string; } /** * Uri template for the request builder. @@ -55,33 +55,33 @@ export const ContentRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/ma * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const ContentRequestBuilderGetQueryParametersMapper: Record = { - "format": "%24format", + format: "%24format", }; /** * Metadata for all the requests in the request builder. */ export const ContentRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: ContentRequestBuilderUriTemplate, - responseBodyContentType: "application/octet-stream, application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - queryParametersMapper: ContentRequestBuilderGetQueryParametersMapper, - }, - put: { - uriTemplate: ContentRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - requestBodyContentType: "application/octet-stream", - requestInformationContentSetMethod: "setStreamContent", - }, + get: { + uriTemplate: ContentRequestBuilderUriTemplate, + responseBodyContentType: "application/octet-stream, application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + queryParametersMapper: ContentRequestBuilderGetQueryParametersMapper, + }, + put: { + uriTemplate: ContentRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + requestBodyContentType: "application/octet-stream", + requestInformationContentSetMethod: "setStreamContent", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/messages/count/index.ts b/packages/test/generatedCode/users/item/messages/count/index.ts index c0f5b69f8..e60630392 100644 --- a/packages/test/generatedCode/users/item/messages/count/index.ts +++ b/packages/test/generatedCode/users/item/messages/count/index.ts @@ -1,39 +1,39 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/messages/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; - /** - * Search items by search phrases - */ - search?: string; + /** + * Filter items by property values + */ + filter?: string; + /** + * Search items by search phrases + */ + search?: string; } /** * Uri template for the request builder. @@ -43,23 +43,23 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mess * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", - "search": "%24search", + filter: "%24filter", + search: "%24search", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/messages/index.ts b/packages/test/generatedCode/users/item/messages/index.ts index 303d3ab5a..5027f7473 100644 --- a/packages/test/generatedCode/users/item/messages/index.ts +++ b/packages/test/generatedCode/users/item/messages/index.ts @@ -1,97 +1,97 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMessageCollectionResponseFromDiscriminatorValue, createMessageFromDiscriminatorValue, serializeMessage, type Message, type MessageCollectionResponse } from '../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { MessageItemRequestBuilderNavigationMetadata, MessageItemRequestBuilderRequestsMetadata, type MessageItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMessageCollectionResponseFromDiscriminatorValue, createMessageFromDiscriminatorValue, serializeMessage, type Message, type MessageCollectionResponse } from "../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { MessageItemRequestBuilderNavigationMetadata, MessageItemRequestBuilderRequestsMetadata, type MessageItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/messages */ export interface MessagesRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.messages.item collection - * @param messageId The unique identifier of message - * @returns {MessageItemRequestBuilder} - */ - byMessageId(messageId: string) : MessageItemRequestBuilder; - /** - * The messages in a mailbox or folder. Read-only. Nullable. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/user-list-messages?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0|Find more info here} - */ - post(body: Message, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * The messages in a mailbox or folder. Read-only. Nullable. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.messages.item collection + * @param messageId The unique identifier of message + * @returns {MessageItemRequestBuilder} + */ + byMessageId(messageId: string): MessageItemRequestBuilder; + /** + * The messages in a mailbox or folder. Read-only. Nullable. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/user-list-messages?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0|Find more info here} + */ + post(body: Message, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * The messages in a mailbox or folder. Read-only. Nullable. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * The messages in a mailbox or folder. Read-only. Nullable. */ export interface MessagesRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Include Hidden Messages - */ - includeHiddenMessages?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Search items by search phrases - */ - search?: string; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Include Hidden Messages + */ + includeHiddenMessages?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Search items by search phrases + */ + search?: string; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -101,54 +101,54 @@ export const MessagesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/m * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessagesRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "search": "%24search", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + search: "%24search", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const MessagesRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byMessageId: { - requestsMetadata: MessageItemRequestBuilderRequestsMetadata, - navigationMetadata: MessageItemRequestBuilderNavigationMetadata, - pathParametersMappings: ["message%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byMessageId: { + requestsMetadata: MessageItemRequestBuilderRequestsMetadata, + navigationMetadata: MessageItemRequestBuilderNavigationMetadata, + pathParametersMappings: ["message%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MessagesRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: MessagesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageCollectionResponseFromDiscriminatorValue, - queryParametersMapper: MessagesRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: MessagesRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMessage, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: MessagesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageCollectionResponseFromDiscriminatorValue, + queryParametersMapper: MessagesRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: MessagesRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMessage, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts b/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts index 4258cf2cc..ed020db29 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/attachments/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mess * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/index.ts b/packages/test/generatedCode/users/item/messages/item/attachments/index.ts index 8feda9ed5..39b396c48 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/index.ts @@ -1,81 +1,81 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createAttachmentCollectionResponseFromDiscriminatorValue, createAttachmentFromDiscriminatorValue, serializeAttachment, type Attachment, type AttachmentCollectionResponse } from '../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { AttachmentItemRequestBuilderRequestsMetadata, type AttachmentItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createAttachmentCollectionResponseFromDiscriminatorValue, createAttachmentFromDiscriminatorValue, serializeAttachment, type Attachment, type AttachmentCollectionResponse } from "../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { AttachmentItemRequestBuilderRequestsMetadata, type AttachmentItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/attachments */ export interface AttachmentsRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.messages.item.attachments.item collection - * @param attachmentId The unique identifier of attachment - * @returns {AttachmentItemRequestBuilder} - */ - byAttachmentId(attachmentId: string) : AttachmentItemRequestBuilder; - /** - * Retrieve a list of attachment objects. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/eventmessage-list-attachments?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/eventmessage-post-attachments?view=graph-rest-1.0|Find more info here} - */ - post(body: Attachment, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Retrieve a list of attachment objects. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: Attachment, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.messages.item.attachments.item collection + * @param attachmentId The unique identifier of attachment + * @returns {AttachmentItemRequestBuilder} + */ + byAttachmentId(attachmentId: string): AttachmentItemRequestBuilder; + /** + * Retrieve a list of attachment objects. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/eventmessage-list-attachments?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/eventmessage-post-attachments?view=graph-rest-1.0|Find more info here} + */ + post(body: Attachment, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Retrieve a list of attachment objects. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: Attachment, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Retrieve a list of attachment objects. */ export interface AttachmentsRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -85,50 +85,50 @@ export const AttachmentsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const AttachmentsRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", }; /** * Metadata for all the navigation properties in the request builder. */ export const AttachmentsRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byAttachmentId: { - requestsMetadata: AttachmentItemRequestBuilderRequestsMetadata, - pathParametersMappings: ["attachment%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byAttachmentId: { + requestsMetadata: AttachmentItemRequestBuilderRequestsMetadata, + pathParametersMappings: ["attachment%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const AttachmentsRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: AttachmentsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createAttachmentCollectionResponseFromDiscriminatorValue, - queryParametersMapper: AttachmentsRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: AttachmentsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createAttachmentFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeAttachment, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: AttachmentsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createAttachmentCollectionResponseFromDiscriminatorValue, + queryParametersMapper: AttachmentsRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: AttachmentsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createAttachmentFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeAttachment, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts b/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts index 510881515..0db3afe82 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts @@ -1,54 +1,54 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createAttachmentFromDiscriminatorValue, type Attachment } from '../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createAttachmentFromDiscriminatorValue, type Attachment } from "../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/attachments/{attachment-id} */ export interface AttachmentItemRequestBuilder extends BaseRequestBuilder { - /** - * Delete navigation property attachments for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/attachment-get?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete navigation property attachments for users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Delete navigation property attachments for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/attachment-get?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete navigation property attachments for users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. */ export interface AttachmentItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -58,32 +58,32 @@ export const AttachmentItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2 * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const AttachmentItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the requests in the request builder. */ export const AttachmentItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: AttachmentItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: AttachmentItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createAttachmentFromDiscriminatorValue, - queryParametersMapper: AttachmentItemRequestBuilderGetQueryParametersMapper, - }, + delete: { + uriTemplate: AttachmentItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: AttachmentItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createAttachmentFromDiscriminatorValue, + queryParametersMapper: AttachmentItemRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts b/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts index 21ecb4815..0cfbfebed 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts @@ -1,35 +1,35 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/extensions/$count */ export interface CountRequestBuilder extends BaseRequestBuilder { - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get the number of the resource - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get the number of the resource + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get the number of the resource */ export interface CountRequestBuilderGetQueryParameters { - /** - * Filter items by property values - */ - filter?: string; + /** + * Filter items by property values + */ + filter?: string; } /** * Uri template for the request builder. @@ -39,22 +39,22 @@ export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mess * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { - "filter": "%24filter", + filter: "%24filter", }; /** * Metadata for all the requests in the request builder. */ export const CountRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: CountRequestBuilderUriTemplate, - responseBodyContentType: "text/plain;q=0.9", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "number", - queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, - }, + get: { + uriTemplate: CountRequestBuilderUriTemplate, + responseBodyContentType: "text/plain;q=0.9", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "number", + queryParametersMapper: CountRequestBuilderGetQueryParametersMapper, + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/index.ts b/packages/test/generatedCode/users/item/messages/item/extensions/index.ts index 9df06543b..481a206ce 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/index.ts @@ -1,88 +1,88 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createExtensionCollectionResponseFromDiscriminatorValue, createExtensionFromDiscriminatorValue, serializeExtension, type Extension, type ExtensionCollectionResponse } from '../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../models/oDataErrors/'; -import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from './count/'; -import { ExtensionItemRequestBuilderRequestsMetadata, type ExtensionItemRequestBuilder } from './item/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createExtensionCollectionResponseFromDiscriminatorValue, createExtensionFromDiscriminatorValue, serializeExtension, type Extension, type ExtensionCollectionResponse } from "../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../models/oDataErrors/"; +import { CountRequestBuilderRequestsMetadata, type CountRequestBuilder } from "./count/"; +import { ExtensionItemRequestBuilderRequestsMetadata, type ExtensionItemRequestBuilder } from "./item/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/extensions */ export interface ExtensionsRequestBuilder extends BaseRequestBuilder { - /** - * The Count property - */ - get count(): CountRequestBuilder; - /** - * Gets an item from the ApiSdk.users.item.messages.item.extensions.item collection - * @param extensionId The unique identifier of extension - * @returns {ExtensionItemRequestBuilder} - */ - byExtensionId(extensionId: string) : ExtensionItemRequestBuilder; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0|Find more info here} - */ - post(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPostRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The Count property + */ + get count(): CountRequestBuilder; + /** + * Gets an item from the ApiSdk.users.item.messages.item.extensions.item collection + * @param extensionId The unique identifier of extension + * @returns {ExtensionItemRequestBuilder} + */ + byExtensionId(extensionId: string): ExtensionItemRequestBuilder; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0|Find more info here} + */ + post(body: Extension, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPostRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. */ export interface ExtensionsRequestBuilderGetQueryParameters { - /** - * Include count of items - */ - count?: boolean; - /** - * Expand related entities - */ - expand?: string[]; - /** - * Filter items by property values - */ - filter?: string; - /** - * Order items by property values - */ - orderby?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; - /** - * Skip the first n items - */ - skip?: number; - /** - * Show only the first n items - */ - top?: number; + /** + * Include count of items + */ + count?: boolean; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Filter items by property values + */ + filter?: string; + /** + * Order items by property values + */ + orderby?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; + /** + * Skip the first n items + */ + skip?: number; + /** + * Show only the first n items + */ + top?: number; } /** * Uri template for the request builder. @@ -92,52 +92,52 @@ export const ExtensionsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did} * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const ExtensionsRequestBuilderGetQueryParametersMapper: Record = { - "count": "%24count", - "expand": "%24expand", - "filter": "%24filter", - "orderby": "%24orderby", - "select": "%24select", - "skip": "%24skip", - "top": "%24top", + count: "%24count", + expand: "%24expand", + filter: "%24filter", + orderby: "%24orderby", + select: "%24select", + skip: "%24skip", + top: "%24top", }; /** * Metadata for all the navigation properties in the request builder. */ export const ExtensionsRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - byExtensionId: { - requestsMetadata: ExtensionItemRequestBuilderRequestsMetadata, - pathParametersMappings: ["extension%2Did"], - }, - count: { - requestsMetadata: CountRequestBuilderRequestsMetadata, - }, + byExtensionId: { + requestsMetadata: ExtensionItemRequestBuilderRequestsMetadata, + pathParametersMappings: ["extension%2Did"], + }, + count: { + requestsMetadata: CountRequestBuilderRequestsMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const ExtensionsRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: ExtensionsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionCollectionResponseFromDiscriminatorValue, - queryParametersMapper: ExtensionsRequestBuilderGetQueryParametersMapper, - }, - post: { - uriTemplate: ExtensionsRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeExtension, - requestInformationContentSetMethod: "setContentFromParsable", - }, + get: { + uriTemplate: ExtensionsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionCollectionResponseFromDiscriminatorValue, + queryParametersMapper: ExtensionsRequestBuilderGetQueryParametersMapper, + }, + post: { + uriTemplate: ExtensionsRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeExtension, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts b/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts index 0fe540ece..6267b9df0 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts @@ -1,70 +1,70 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createExtensionFromDiscriminatorValue, serializeExtension, type Extension } from '../../../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createExtensionFromDiscriminatorValue, serializeExtension, type Extension } from "../../../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/extensions/{extension-id} */ export interface ExtensionItemRequestBuilder extends BaseRequestBuilder { - /** - * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-delete?view=graph-rest-1.0|Find more info here} - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update the navigation property extensions in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - patch(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update the navigation property extensions in users - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-delete?view=graph-rest-1.0|Find more info here} + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update the navigation property extensions in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + patch(body: Extension, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update the navigation property extensions in users + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: Extension, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. */ export interface ExtensionItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -74,44 +74,44 @@ export const ExtensionItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2D * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const ExtensionItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the requests in the request builder. */ export const ExtensionItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: ExtensionItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: ExtensionItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionFromDiscriminatorValue, - queryParametersMapper: ExtensionItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: ExtensionItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createExtensionFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeExtension, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: ExtensionItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: ExtensionItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionFromDiscriminatorValue, + queryParametersMapper: ExtensionItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: ExtensionItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createExtensionFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeExtension, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/messages/item/index.ts b/packages/test/generatedCode/users/item/messages/item/index.ts index 0119996ee..7e59b4155 100644 --- a/packages/test/generatedCode/users/item/messages/item/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/index.ts @@ -1,90 +1,90 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createMessageFromDiscriminatorValue, serializeMessage, type Message } from '../../../../models/'; -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../models/oDataErrors/'; -import { AttachmentsRequestBuilderNavigationMetadata, AttachmentsRequestBuilderRequestsMetadata, type AttachmentsRequestBuilder } from './attachments/'; -import { ExtensionsRequestBuilderNavigationMetadata, ExtensionsRequestBuilderRequestsMetadata, type ExtensionsRequestBuilder } from './extensions/'; -import { ContentRequestBuilderRequestsMetadata, type ContentRequestBuilder } from './value/'; -import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createMessageFromDiscriminatorValue, serializeMessage, type Message } from "../../../../models/"; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../models/oDataErrors/"; +import { AttachmentsRequestBuilderNavigationMetadata, AttachmentsRequestBuilderRequestsMetadata, type AttachmentsRequestBuilder } from "./attachments/"; +import { ExtensionsRequestBuilderNavigationMetadata, ExtensionsRequestBuilderRequestsMetadata, type ExtensionsRequestBuilder } from "./extensions/"; +import { ContentRequestBuilderRequestsMetadata, type ContentRequestBuilder } from "./value/"; +import { type BaseRequestBuilder, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/messages/{message-id} */ export interface MessageItemRequestBuilder extends BaseRequestBuilder { - /** - * The attachments property - */ - get attachments(): AttachmentsRequestBuilder; - /** - * The Content property - */ - get content(): ContentRequestBuilder; - /** - * The extensions property - */ - get extensions(): ExtensionsRequestBuilder; - /** - * Delete a message in the specified user's mailbox, or delete a relationship of the message. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/message-delete?view=graph-rest-1.0|Find more info here} - */ - delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * The messages in a mailbox or folder. Read-only. Nullable. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/singlevaluelegacyextendedproperty-get?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update the properties of a message object. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/message-update?view=graph-rest-1.0|Find more info here} - */ - patch(body: Message, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Delete a message in the specified user's mailbox, or delete a relationship of the message. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * The messages in a mailbox or folder. Read-only. Nullable. - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update the properties of a message object. - * @param body The request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPatchRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * The attachments property + */ + get attachments(): AttachmentsRequestBuilder; + /** + * The Content property + */ + get content(): ContentRequestBuilder; + /** + * The extensions property + */ + get extensions(): ExtensionsRequestBuilder; + /** + * Delete a message in the specified user's mailbox, or delete a relationship of the message. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/message-delete?view=graph-rest-1.0|Find more info here} + */ + delete(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * The messages in a mailbox or folder. Read-only. Nullable. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/singlevaluelegacyextendedproperty-get?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update the properties of a message object. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/message-update?view=graph-rest-1.0|Find more info here} + */ + patch(body: Message, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Delete a message in the specified user's mailbox, or delete a relationship of the message. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * The messages in a mailbox or folder. Read-only. Nullable. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update the properties of a message object. + * @param body The request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPatchRequestInformation(body: Message, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * The messages in a mailbox or folder. Read-only. Nullable. */ export interface MessageItemRequestBuilderGetQueryParameters { - /** - * Expand related entities - */ - expand?: string[]; - /** - * Include Hidden Messages - */ - includeHiddenMessages?: string; - /** - * Select properties to be returned - */ - select?: string[]; + /** + * Expand related entities + */ + expand?: string[]; + /** + * Include Hidden Messages + */ + includeHiddenMessages?: string; + /** + * Select properties to be returned + */ + select?: string[]; } /** * Uri template for the request builder. @@ -94,60 +94,60 @@ export const MessageItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessageItemRequestBuilderGetQueryParametersMapper: Record = { - "expand": "%24expand", - "select": "%24select", + expand: "%24expand", + select: "%24select", }; /** * Metadata for all the navigation properties in the request builder. */ export const MessageItemRequestBuilderNavigationMetadata: Record, NavigationMetadata> = { - attachments: { - requestsMetadata: AttachmentsRequestBuilderRequestsMetadata, - navigationMetadata: AttachmentsRequestBuilderNavigationMetadata, - }, - content: { - requestsMetadata: ContentRequestBuilderRequestsMetadata, - }, - extensions: { - requestsMetadata: ExtensionsRequestBuilderRequestsMetadata, - navigationMetadata: ExtensionsRequestBuilderNavigationMetadata, - }, + attachments: { + requestsMetadata: AttachmentsRequestBuilderRequestsMetadata, + navigationMetadata: AttachmentsRequestBuilderNavigationMetadata, + }, + content: { + requestsMetadata: ContentRequestBuilderRequestsMetadata, + }, + extensions: { + requestsMetadata: ExtensionsRequestBuilderRequestsMetadata, + navigationMetadata: ExtensionsRequestBuilderNavigationMetadata, + }, }; /** * Metadata for all the requests in the request builder. */ export const MessageItemRequestBuilderRequestsMetadata: RequestsMetadata = { - delete: { - uriTemplate: MessageItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - }, - get: { - uriTemplate: MessageItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageFromDiscriminatorValue, - queryParametersMapper: MessageItemRequestBuilderGetQueryParametersMapper, - }, - patch: { - uriTemplate: MessageItemRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "send", - responseBodyFactory: createMessageFromDiscriminatorValue, - requestBodyContentType: "application/json", - requestBodySerializer: serializeMessage, - requestInformationContentSetMethod: "setContentFromParsable", - }, + delete: { + uriTemplate: MessageItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, + get: { + uriTemplate: MessageItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageFromDiscriminatorValue, + queryParametersMapper: MessageItemRequestBuilderGetQueryParametersMapper, + }, + patch: { + uriTemplate: MessageItemRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "send", + responseBodyFactory: createMessageFromDiscriminatorValue, + requestBodyContentType: "application/json", + requestBodySerializer: serializeMessage, + requestInformationContentSetMethod: "setContentFromParsable", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/generatedCode/users/item/messages/item/value/index.ts b/packages/test/generatedCode/users/item/messages/item/value/index.ts index d46bb1cf0..98911bbf0 100644 --- a/packages/test/generatedCode/users/item/messages/item/value/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/value/index.ts @@ -1,51 +1,51 @@ /* tslint:disable */ /* eslint-disable */ // Generated by Microsoft Kiota -import { createODataErrorFromDiscriminatorValue, type ODataError } from '../../../../../models/oDataErrors/'; -import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions'; +import { createODataErrorFromDiscriminatorValue, type ODataError } from "../../../../../models/oDataErrors/"; +import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from "@microsoft/kiota-abstractions"; /** * Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/$value */ export interface ContentRequestBuilder extends BaseRequestBuilder { - /** - * Get media content for the navigation property messages from users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - * @see {@link https://learn.microsoft.com/graph/api/user-list-messages?view=graph-rest-1.0|Find more info here} - */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Update media content for the navigation property messages in users - * @param body Binary request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {Promise} - * @throws {ODataError} error when the service returns a 4XX or 5XX status code - */ - put(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : Promise; - /** - * Get media content for the navigation property messages from users - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; - /** - * Update media content for the navigation property messages in users - * @param body Binary request body - * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @returns {RequestInformation} - */ - toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + /** + * Get media content for the navigation property messages from users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + * @see {@link https://learn.microsoft.com/graph/api/user-list-messages?view=graph-rest-1.0|Find more info here} + */ + get(requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Update media content for the navigation property messages in users + * @param body Binary request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + put(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined): Promise; + /** + * Get media content for the navigation property messages from users + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined): RequestInformation; + /** + * Update media content for the navigation property messages in users + * @param body Binary request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} + */ + toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined): RequestInformation; } /** * Get media content for the navigation property messages from users */ export interface ContentRequestBuilderGetQueryParameters { - /** - * Format of the content - */ - format?: string; + /** + * Format of the content + */ + format?: string; } /** * Uri template for the request builder. @@ -55,33 +55,33 @@ export const ContentRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/me * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const ContentRequestBuilderGetQueryParametersMapper: Record = { - "format": "%24format", + format: "%24format", }; /** * Metadata for all the requests in the request builder. */ export const ContentRequestBuilderRequestsMetadata: RequestsMetadata = { - get: { - uriTemplate: ContentRequestBuilderUriTemplate, - responseBodyContentType: "application/octet-stream, application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - queryParametersMapper: ContentRequestBuilderGetQueryParametersMapper, - }, - put: { - uriTemplate: ContentRequestBuilderUriTemplate, - responseBodyContentType: "application/json", - errorMappings: { - XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, - }, - adapterMethodName: "sendPrimitive", - responseBodyFactory: "ArrayBuffer", - requestBodyContentType: "application/octet-stream", - requestInformationContentSetMethod: "setStreamContent", - }, + get: { + uriTemplate: ContentRequestBuilderUriTemplate, + responseBodyContentType: "application/octet-stream, application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + queryParametersMapper: ContentRequestBuilderGetQueryParametersMapper, + }, + put: { + uriTemplate: ContentRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + requestBodyContentType: "application/octet-stream", + requestInformationContentSetMethod: "setStreamContent", + }, }; /* tslint:enable */ /* eslint-enable */ diff --git a/packages/test/karma.conf.js b/packages/test/karma.conf.js deleted file mode 100644 index ed70e0053..000000000 --- a/packages/test/karma.conf.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function(config) { - config.set({ - frameworks: ["mocha", "chai", "karma-typescript"], - files: [{ pattern: "dist/es/test/index.js", type: "module" }], - preprocessors: { - "**/*.ts": ["karma-typescript"], - }, - karmaTypescriptConfig: { - tsconfig: "./tsconfig.cjs.json", - }, - browsers: ["ChromeHeadless"], - }); -}; \ No newline at end of file diff --git a/packages/test/package.json b/packages/test/package.json index 77eca3afc..aa12bf704 100644 --- a/packages/test/package.json +++ b/packages/test/package.json @@ -5,16 +5,17 @@ "main": "index.js", "private": true, "scripts": { - "test:integrated": "mocha --exit dist/cjs/tests/*.js" + "test:integrated": "vitest run" }, "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.23", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.18", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.22", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.12", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.21", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.20" + "@microsoft/kiota-abstractions": "*", + "@microsoft/kiota-authentication-azure": "*", + "@microsoft/kiota-http-fetchlibrary": "*", + "@microsoft/kiota-serialization-form": "*", + "@microsoft/kiota-serialization-json": "*", + "@microsoft/kiota-serialization-text": "*", + "@microsoft/kiota-serialization-multipart": "*" }, "files": [ "lib/" diff --git a/packages/test/rollup.config.js b/packages/test/rollup.config.js deleted file mode 100644 index 33546e42e..000000000 --- a/packages/test/rollup.config.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -import resolve from "@rollup/plugin-node-resolve"; -import commonjs from "@rollup/plugin-commonjs"; - -const config = [{ - input: ["dist/es/test/browser/index.js"], - output: { - file: "dist/es/test/index.js", - format: "esm", - name: "BrowserTest", - }, - plugins: [ - commonjs(), - resolve({ - browser: true, - preferBuiltins: false, - - }) - ], -}]; - -export default config; \ No newline at end of file diff --git a/packages/test/tests/getTest.ts b/packages/test/tests/getTest.ts index a19de4bfa..850a9542e 100644 --- a/packages/test/tests/getTest.ts +++ b/packages/test/tests/getTest.ts @@ -1,29 +1,35 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import { proxyClient, userId } from "./testClient"; -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; describe("TestGet", () => { - - it("should return a test", async () => { - const messages = await proxyClient.users.byUserId(userId).messages.get(); - assert.isDefined(messages?.value); - }); - it("should decode query parameters", async () => { - const messages = await proxyClient.users.byUserId(userId).messages.get({ - queryParameters: { - select: ["subject"], - search: "test", - count: true, - } - }); - const messagesRaw = proxyClient.users.withUrl("foo"); - assert.isDefined(messagesRaw); - const messagesRI = proxyClient.users.byUserId(userId).messages.toGetRequestInformation({ - queryParameters: { - count: true, - } - }); - assert.equal(`https://graph.microsoft.com/v1.0/users/${userId}/messages?%24count=true`, messagesRI.URL); - assert.isDefined(messages?.value); - }); -}); \ No newline at end of file + it("should return a test", async () => { + const messages = await proxyClient.users.byUserId(userId).messages.get(); + assert.isDefined(messages?.value); + }); + it("should decode query parameters", async () => { + const messages = await proxyClient.users.byUserId(userId).messages.get({ + queryParameters: { + select: ["subject"], + search: "test", + count: true, + }, + }); + const messagesRaw = proxyClient.users.withUrl("foo"); + assert.isDefined(messagesRaw); + const messagesRI = proxyClient.users.byUserId(userId).messages.toGetRequestInformation({ + queryParameters: { + count: true, + }, + }); + assert.equal(`https://graph.microsoft.com/v1.0/users/${userId}/messages?%24count=true`, messagesRI.URL); + assert.isDefined(messages?.value); + }); +}); diff --git a/packages/test/tests/postTest.ts b/packages/test/tests/postTest.ts index 3451f1754..cbf2e0667 100644 --- a/packages/test/tests/postTest.ts +++ b/packages/test/tests/postTest.ts @@ -1,19 +1,26 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + import { proxyClient, userId } from "./testClient"; -import { assert } from "chai"; +import { assert, describe, it } from "vitest"; + import { type Message } from "../generatedCode/models"; describe("TestPost", () => { - - it("should return a test", async () => { - const message:Message = {}; - message.subject = "Test Subject"; - message.body = { - content: "body content" - } - const postmessageResult = await proxyClient.users.byUserId(userId).messages.post(message); - assert.isDefined(postmessageResult?.id); - assert.equal(postmessageResult?.subject, message.subject); - await proxyClient.users.byUserId(userId).messages.byMessageId(postmessageResult!.id!).delete(); - }).timeout(10000); -}); \ No newline at end of file + it("should return a test", async () => { + const message: Message = {}; + message.subject = "Test Subject"; + message.body = { + content: "body content", + }; + const postmessageResult = await proxyClient.users.byUserId(userId).messages.post(message); + assert.isDefined(postmessageResult?.id); + assert.equal(postmessageResult?.subject, message.subject); + await proxyClient.users.byUserId(userId).messages.byMessageId(postmessageResult!.id!).delete(); + }, 10000); +}); diff --git a/packages/test/tests/secrets.ts b/packages/test/tests/secrets.ts index e69de29bb..1478fe240 100644 --- a/packages/test/tests/secrets.ts +++ b/packages/test/tests/secrets.ts @@ -0,0 +1,6 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ diff --git a/packages/test/tests/testClient.ts b/packages/test/tests/testClient.ts index c56820426..a0587bd47 100644 --- a/packages/test/tests/testClient.ts +++ b/packages/test/tests/testClient.ts @@ -1,12 +1,18 @@ -import {FetchRequestAdapter} from "@microsoft/kiota-http-fetchlibrary"; -import {AzureIdentityAuthenticationProvider} from "@microsoft/kiota-authentication-azure"; -import {ClientSecretCredential} from "@azure/identity"; +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary"; +import { AzureIdentityAuthenticationProvider } from "@microsoft/kiota-authentication-azure"; +import { ClientSecretCredential } from "@azure/identity"; import { createApiClient } from "../generatedCode/apiClient"; -const tokenCredential = new ClientSecretCredential(process.env.TENANT_ID!, process.env.CLIENT_ID!, process.env.CLIENT_SECRET! ); +const tokenCredential = new ClientSecretCredential(process.env.TENANT_ID!, process.env.CLIENT_ID!, process.env.CLIENT_SECRET!); const authProvider = new AzureIdentityAuthenticationProvider(tokenCredential, ["https://graph.microsoft.com/.default"]); -const fetchRequestAdapter = new FetchRequestAdapter(authProvider) +const fetchRequestAdapter = new FetchRequestAdapter(authProvider); export const proxyClient = createApiClient(fetchRequestAdapter); export const userId = process.env.USER_ID!; - diff --git a/packages/test/tsconfig.base.json b/packages/test/tsconfig.base.json deleted file mode 100644 index c71d119b2..000000000 --- a/packages/test/tsconfig.base.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "importHelpers": true, - "noEmitOnError": true, - "moduleResolution": "node", - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "composite": true, - "lib": ["es6"] - } -} \ No newline at end of file diff --git a/packages/test/tsconfig.cjs.json b/packages/test/tsconfig.cjs.json deleted file mode 100644 index 1554a26d8..000000000 --- a/packages/test/tsconfig.cjs.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2017", - "module": "commonjs", - "outDir": "./dist/cjs" - }, - "paths": { - "@microsoft/kiota-abstractions": [ - "../abstractions" - ], - "@microsoft/kiota-serialization-form": [ - "../serialization/form" - ], - "@microsoft/kiota-serialization-multipart": [ - "../serialization/multipart" - ], - "@microsoft/kiota-serialization-json": [ - "../serialization/json" - ], - "@microsoft/kiota-http-fetchlibrary": [ - "../http/fetchlibrary" - ], - "@microsoft/kiota-serialization-text": [ - "../serialization/text" - ], - "@microsoft/kiota-authentication-azure": [ - "../authentication/azure" - ], - "@microsoft/kiota-authentication-spfx": [ - "../authentication/spfx" - ], - }, - "files": [], - "references": [ - { - "path": "../abstractions/tsconfig.cjs.json" - }, - { - "path": "../serialization/form/tsconfig.cjs.json" - }, - { - "path": "../serialization/json/tsconfig.cjs.json" - }, - { - "path": "../serialization/text/tsconfig.cjs.json" - }, - { - "path": "../serialization/multipart/tsconfig.cjs.json" - }, - { - "path": "../http/fetch/tsconfig.cjs.json" - }, - { - "path": "../authentication/azure/tsconfig.cjs.json" - }, - { - "path": "../authentication/spfx/tsconfig.cjs.json" - } - ], - "exclude": ["node_modules", "dist"], - "include": ["./generatedCode/**/*.ts", "./tests"] -} \ No newline at end of file diff --git a/packages/test/tsconfig.es.json b/packages/test/tsconfig.es.json deleted file mode 100644 index 2ab43ce2b..000000000 --- a/packages/test/tsconfig.es.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "./dist/es/" - }, - "references": [ - { - "path": "../abstractions/tsconfig.es.json" - }, - { - "path": "../serialization/form/tsconfig.es.json" - }, - { - "path": "../serialization/json/tsconfig.es.json" - }, - { - "path": "../serialization/text/tsconfig.es.json" - }, - { - "path": "../serialization/multipart/tsconfig.es.json" - }, - { - "path": "../http/fetch/tsconfig.es.json" - }, - { - "path": "../authentication/azure/tsconfig.es.json" - }, - { - "path": "../authentication/spfx/tsconfig.es.json" - } - ], - "exclude": ["node_modules", "dist"], - "paths": { - "@microsoft/kiota-abstractions": [ - "../abstractions" - ], - "@microsoft/kiota-serialization-form": [ - "../serialization/form" - ], - "@microsoft/kiota-serialization-json": [ - "../serialization/json" - ], - "@microsoft/kiota-serialization-multipart": [ - "../serialization/multipart" - ], - "@microsoft/kiota-http-fetchlibrary": [ - "../http/fetchlibrary" - ], - "@microsoft/microsoft-graph-client": [ - "../graph" - ], - "@microsoft/kiota-serialization-text": [ - "../serialization/text" - ], - "@microsoft/kiota-authentication-azure": [ - "../authentication/azure" - ],"@microsoft/kiota-authentication-spfx": [ - "../authentication/spfx" - ], - }, - "include": ["./generatedCode/**/*.ts", "./tests/**/*.ts"] -} \ No newline at end of file diff --git a/packages/test/tsconfig.json b/packages/test/tsconfig.json new file mode 100644 index 000000000..5eba8d8ba --- /dev/null +++ b/packages/test/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./lib/sdk/es/" + }, + "include": [ + "./generatedCode/**/*.ts" + ] +} \ No newline at end of file diff --git a/packages/test/tsconfig.sdk.cjs.json b/packages/test/tsconfig.sdk.cjs.json deleted file mode 100644 index 4aa28c4df..000000000 --- a/packages/test/tsconfig.sdk.cjs.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions":{ - "target": "ES2017", - "module": "commonjs", - "outDir": "./lib/sdk/cjs" - }, - "paths": { - "@microsoft/kiota-abstractions": [ - "../abstractions" - ], - "@microsoft/kiota-serialization-form": [ - "../serialization/form" - ], - "@microsoft/kiota-serialization-json": [ - "../serialization/json" - ], - "@microsoft/kiota-http-fetchlibrary": [ - "../http/fetchlibrary" - ], - "@microsoft/kiota-serialization-text": [ - "../serialization/text" - ], - "@microsoft/kiota-authentication-azure": [ - "../authentication/azure" - ], - "@microsoft/kiota-authentication-spfx": [ - "../authentication/spfx" - ], - }, - "files": [], - "references": [ - { - "path": "../abstractions/tsconfig.cjs.json" - }, - { - "path": "../serialization/form/tsconfig.cjs.json" - }, - { - "path": "../serialization/json/tsconfig.cjs.json" - }, - { - "path": "../serialization/text/tsconfig.cjs.json" - }, - { - "path": "../http/fetch/tsconfig.cjs.json" - }, - { - "path": "../authentication/azure/tsconfig.cjs.json" - }, - { - "path": "../authentication/spfx/tsconfig.cjs.json" - } - ], - "exclude": ["node_modules", "dist", "tests"], - "include": ["./generatedCode/**/*.ts"] -} \ No newline at end of file diff --git a/packages/test/tsconfig.sdk.es.json b/packages/test/tsconfig.sdk.es.json deleted file mode 100644 index c757e24a6..000000000 --- a/packages/test/tsconfig.sdk.es.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2017", - "outDir": "./lib/sdk/es/" - }, - "references": [ - { - "path": "../abstractions/tsconfig.es.json" - }, - { - "path": "../serialization/form/tsconfig.es.json" - }, - { - "path": "../serialization/json/tsconfig.es.json" - }, - { - "path": "../serialization/text/tsconfig.es.json" - }, - { - "path": "../http/fetch/tsconfig.es.json" - }, - { - "path": "../authentication/azure/tsconfig.es.json" - }, - { - "path": "../authentication/spfx/tsconfig.es.json" - } - ], - "exclude": ["node_modules", "dist", "tests"], - "paths": { - "@microsoft/kiota-abstractions": [ - "../abstractions" - ], - "@microsoft/kiota-serialization-form": [ - "../serialization/form" - ], - "@microsoft/kiota-serialization-json": [ - "../serialization/json" - ], - "@microsoft/kiota-http-fetchlibrary": [ - "../http/fetchlibrary" - ], - "@microsoft/microsoft-graph-client": [ - "../graph" - ], - "@microsoft/kiota-serialization-text": [ - "../serialization/text" - ], - "@microsoft/kiota-authentication-azure": [ - "../authentication/azure" - ],"@microsoft/kiota-authentication-spfx": [ - "../authentication/spfx" - ], - }, - "include": ["./generatedCode/**/*.ts"] -} \ No newline at end of file diff --git a/packages/test/vitest.config.mts b/packages/test/vitest.config.mts new file mode 100644 index 000000000..15f51c48a --- /dev/null +++ b/packages/test/vitest.config.mts @@ -0,0 +1,11 @@ +import { defineConfig, configDefaults } from "vitest/config"; + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude, "tests/{testClient,secrets}.ts"], + include: [...configDefaults.include, "tests/**/*.ts"], + coverage: { + reporter: ["html"], + }, + }, +}); \ No newline at end of file diff --git a/prettier.config.cjs b/prettier.config.cjs new file mode 100644 index 000000000..d59b7e091 --- /dev/null +++ b/prettier.config.cjs @@ -0,0 +1,14 @@ +module.exports = { + ...require('@microsoft/eslint-config-msgraph/prettier.config'), + embeddedLanguageFormatting: "off", + "arrowParens": "always", + "bracketSpacing": true, + "jsxSingleQuote": false, + "printWidth": 5000, + "proseWrap": "never", + "semi": true, + "singleQuote": false, + "tabWidth": 4, + "trailingComma": "all", + "useTabs": true +} diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 000000000..dd208f6ce --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,81 @@ +{ + "compilerOptions": { + "importHelpers": true, + "noEmitOnError": true, + "moduleResolution": "Node", + "strict": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "composite": true, + "module": "ES6", + "target": "ES2017", + "lib": [ + "dom", + "es5", + "es6", + "DOM.Iterable" + ], + "outDir": "dist/es", + "paths": { + "@microsoft/kiota-abstractions": [ + "./abstractions" + ], + "@microsoft/kiota-serialization-form": [ + "./serialization/form" + ], + "@microsoft/kiota-serialization-json": [ + "./serialization/json" + ], + "@microsoft/kiota-http-fetchlibrary": [ + "./http/fetchlibrary" + ], + "@microsoft/microsoft-graph-client": [ + "./graph" + ], + "@microsoft/kiota-serialization-text": [ + "./serialization/text" + ], + "@microsoft/kiota-authentication-azure": [ + "./authentication/azure" + ], + "@microsoft/kiota-authentication-spfx": [ + "./authentication/spfx" + ], + }, + }, + "references": [ + { + "path": "./abstractions/tsconfig.json" + }, + { + "path": "./serialization/form/tsconfig.json" + }, + { + "path": "./serialization/json/tsconfig.json" + }, + { + "path": "./serialization/text/tsconfig.json" + }, + { + "path": "./http/fetch/tsconfig.json" + }, + { + "path": "./authentication/azure/tsconfig.json" + }, + { + "path": "./authentication/spfx/tsconfig.json" + } + ], + "exclude": [ + "node_modules", + "dist", + "tests", + "./test/**/*.ts" + ], +} \ No newline at end of file diff --git a/vitest.workspace.ts b/vitest.workspace.ts new file mode 100644 index 000000000..857be04cd --- /dev/null +++ b/vitest.workspace.ts @@ -0,0 +1,10 @@ +import { defineWorkspace, configDefaults } from 'vitest/config'; + +const workspace = defineWorkspace([ + 'packages/abstractions', + 'packages/authentication/*', + 'packages/http/fetch', + 'packages/serialization/*' +]) + +export default workspace; \ No newline at end of file