+// Definitions: https://github.com/Marak/colors.js
+
+export const enabled: boolean;
+export function enable(): void;
+export function disable(): void;
+export function setTheme(theme: any): void;
+
+export function strip(str: string): string;
+export function stripColors(str: string): string;
+
+export function black(str: string): string;
+export function red(str: string): string;
+export function green(str: string): string;
+export function yellow(str: string): string;
+export function blue(str: string): string;
+export function magenta(str: string): string;
+export function cyan(str: string): string;
+export function white(str: string): string;
+export function gray(str: string): string;
+export function grey(str: string): string;
+
+export function brightRed(str: string): string;
+export function brightGreen(str: string): string;
+export function brightYellow(str: string): string;
+export function brightBlue(str: string): string;
+export function brightMagenta(str: string): string;
+export function brightCyan(str: string): string;
+export function brightWhite(str: string): string;
+
+export function bgBlack(str: string): string;
+export function bgRed(str: string): string;
+export function bgGreen(str: string): string;
+export function bgYellow(str: string): string;
+export function bgBlue(str: string): string;
+export function bgMagenta(str: string): string;
+export function bgCyan(str: string): string;
+export function bgWhite(str: string): string;
+
+export function bgBrightRed(str: string): string;
+export function bgBrightGreen(str: string): string;
+export function bgBrightYellow(str: string): string;
+export function bgBrightBlue(str: string): string;
+export function bgBrightMagenta(str: string): string;
+export function bgBrightCyan(str: string): string;
+export function bgBrightWhite(str: string): string;
+
+export function reset(str: string): string;
+export function bold(str: string): string;
+export function dim(str: string): string;
+export function italic(str: string): string;
+export function underline(str: string): string;
+export function inverse(str: string): string;
+export function hidden(str: string): string;
+export function strikethrough(str: string): string;
+
+export function rainbow(str: string): string;
+export function zebra(str: string): string;
+export function america(str: string): string;
+export function trap(str: string): string;
+export function random(str: string): string;
+export function zalgo(str: string): string;
diff --git a/sdk/node_modules/@colors/colors/safe.js b/sdk/node_modules/@colors/colors/safe.js
new file mode 100644
index 00000000..a013d542
--- /dev/null
+++ b/sdk/node_modules/@colors/colors/safe.js
@@ -0,0 +1,10 @@
+//
+// Remark: Requiring this file will use the "safe" colors API,
+// which will not touch String.prototype.
+//
+// var colors = require('colors/safe');
+// colors.red("foo")
+//
+//
+var colors = require('./lib/colors');
+module['exports'] = colors;
diff --git a/sdk/node_modules/@colors/colors/themes/generic-logging.js b/sdk/node_modules/@colors/colors/themes/generic-logging.js
new file mode 100644
index 00000000..63adfe4a
--- /dev/null
+++ b/sdk/node_modules/@colors/colors/themes/generic-logging.js
@@ -0,0 +1,12 @@
+module['exports'] = {
+ silly: 'rainbow',
+ input: 'grey',
+ verbose: 'cyan',
+ prompt: 'grey',
+ info: 'green',
+ data: 'grey',
+ help: 'cyan',
+ warn: 'yellow',
+ debug: 'blue',
+ error: 'red',
+};
diff --git a/sdk/node_modules/@dabh/diagnostics/CHANGELOG.md b/sdk/node_modules/@dabh/diagnostics/CHANGELOG.md
new file mode 100644
index 00000000..b04af38b
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/CHANGELOG.md
@@ -0,0 +1,26 @@
+# CHANGELOG
+
+### 2.0.2
+
+- Bump to kuler 2.0, which removes colornames as dependency, which we
+ never used. So smaller install size, less dependencies for all.
+
+### 2.0.1
+
+- Use `storag-engine@3.0` which will automatically detect the correct
+ AsyncStorage implementation.
+- The upgrade also fixes a bug where it the `debug` and `diagnostics` values
+ to be JSON encoded instead of regular plain text.
+
+### 2.0.0
+
+- Documentation improvements.
+- Fixed a issue where async adapters were incorrectly detected.
+- Correctly inherit colors after applying colors the browser's console.
+
+### 2.0.0-alpha
+
+- Complete rewrite of all internals, now comes with separate builds for `browser`
+ `node` and `react-native` as well as dedicated builds for `production` and
+ `development` environments. Various utility methods and properties have
+ been added to the returned logger to make your lives even easier.
diff --git a/sdk/node_modules/@dabh/diagnostics/LICENSE b/sdk/node_modules/@dabh/diagnostics/LICENSE
new file mode 100644
index 00000000..9beaab11
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Arnout Kazemier, Martijn Swaagman, the Contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/sdk/node_modules/@dabh/diagnostics/README.md b/sdk/node_modules/@dabh/diagnostics/README.md
new file mode 100644
index 00000000..0cd25195
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/README.md
@@ -0,0 +1,473 @@
+# `diagnostics`
+
+Diagnostics in the evolution of debug pattern that is used in the Node.js core,
+this extremely small but powerful technique can best be compared as feature
+flags for loggers. The created debug logger is disabled by default but can be
+enabled without changing a line of code, using flags.
+
+- Allows debugging in multiple JavaScript environments such as Node.js, browsers
+ and React-Native.
+- Separated development and production builds to minimize impact on your
+ application when bundled.
+- Allows for customization of logger, messages, and much more.
+
+
+
+## Installation
+
+The module is released in the public npm registry and can be installed by
+running:
+
+```
+npm install --save @dabh/diagnostics
+```
+
+## Usage
+
+- [Introduction](#introduction)
+- [Advanced usage](#advanced-usage)
+ - [Production and development builds](#production-and-development-builds)
+ - [WebPack](#webpack)
+ - [Node.js](#nodejs)
+- [API](#api)
+ - [.enabled](#enabled)
+ - [.namespace](#namespace)
+ - [.dev/prod](#devprod)
+ - [set](#set)
+ - [modify](#modify)
+ - [use](#use)
+- [Modifiers](#modifiers)
+ - [namespace](#namespace-1)
+- [Adapters](#adapters)
+ - [process.env](#process-env)
+ - [hash](#hash)
+ - [localStorage](#localstorage)
+ - [AsyncStorage](#asyncstorage)
+- [Loggers](#loggers)
+
+### Introduction
+
+To create a new logger simply `require` the `@dabh/diagnostics` module and call
+the returned function. It accepts 2 arguments:
+
+1. `namespace` **Required** This is the namespace of your logger so we know if we need to
+ enable your logger when a debug flag is used. Generally you use the name of
+ your library or application as first root namespace. For example if you're
+ building a parser in a library (example) you would set namespace
+ `example:parser`.
+2. `options` An object with additional configuration for the logger.
+ following keys are recognized:
+ - `force` Force the logger to be enabled.
+ - `colors` Colors are enabled by default for the logs, but you can set this
+ option to `false` to disable it.
+
+```js
+const debug = require('@dabh/diagnostics')('foo:bar:baz');
+const debug = require('@dabh/diagnostics')('foo:bar:baz', { options });
+
+debug('this is a log message %s', 'that will only show up when enabled');
+debug('that is pretty neat', { log: 'more', data: 1337 });
+```
+
+Unlike `console.log` statements that add and remove during your development
+lifecycle you create meaningful log statements that will give you insight in
+the library or application that you're developing.
+
+The created debugger uses different "adapters" to extract the debug flag
+out of the JavaScript environment. To learn more about enabling the debug flag
+in your specific environment click on one of the enabled adapters below.
+
+- **browser**: [localStorage](#localstorage), [hash](#hash)
+- **node.js**: [environment variables](#processenv)
+- **react-native**: [AsyncStorage](#asyncstorage)
+
+Please note that the returned logger is fully configured out of the box, you
+do not need to set any of the adapters/modifiers your self, they are there
+for when you want more advanced control over the process. But if you want to
+learn more about that, read the next section.
+
+### Advanced usage
+
+There are 2 specific usage patterns for `diagnostic`, library developers who
+implement it as part of their modules and applications developers who either
+use it in their application or are searching for ways to consume the messages.
+
+With the simple log interface as discussed in the [introduction](#introduction)
+section we make it easy for developers to add it as part of their libraries
+and applications, and with powerful [API](#api) we allow infinite customization
+by allowing custom adapters, loggers and modifiers to ensure that this library
+maintains relevant. These methods not only allow introduction of new loggers,
+but allow you think outside the box. For example you can maintain a history
+of past log messages, and output those when an uncaught exception happens in
+your application so you have additional context
+
+```js
+const diagnostics = require('@dabh/diagnostics');
+
+let index = 0;
+const limit = 200;
+const history = new Array(limit);
+
+//
+// Force all `diagnostic` loggers to be enabled.
+//
+diagnostics.force = process.env.NODE_ENV === 'prod';
+diagnostics.set(function customLogger(meta, message) {
+ history[index]= { meta, message, now: Date.now() };
+ if (index++ === limit) index = 0;
+
+ //
+ // We're running a development build, so output.
+ //
+ if (meta.dev) console.log.apply(console, message);
+});
+
+process.on('uncaughtException', async function (err) {
+ await saveErrorToDisk(err, history);
+ process.exit(1);
+});
+```
+
+The small snippet above will maintain a 200 limited FIFO (First In First Out)
+queue of all debug messages that can be referenced when your application crashes
+
+#### Production and development builds
+
+When you `require` the `@dabh/diagnostics` module you will be given a logger that is
+optimized for `development` so it can provide the best developer experience
+possible.
+
+The development logger enables all the [adapters](#adapters) for your
+JavaScript environment, adds a logger that outputs the messages to `console.log`
+and registers our message modifiers so log messages will be prefixed with the
+supplied namespace so you know where the log messages originates from.
+
+The development logger does not have any adapter, modifier and logger enabled
+by default. This ensures that your log messages never accidentally show up in
+production. However this does not mean that it's not possible to get debug
+messages in production. You can `force` the debugger to be enabled, and
+supply a [custom logger](#loggers).
+
+```js
+const diagnostics = require('@dabh/diagnostics');
+const debug = debug('foo:bar', { force: true });
+
+//
+// Or enable _every_ diagnostic instance:
+//
+diagnostics.force = true;
+```
+
+##### WebPack
+
+WebPack has the concept of [mode](https://webpack.js.org/concepts/mode/#usage)'s
+which creates different
+
+```js
+module.exports = {
+ mode: 'development' // 'production'
+}
+```
+
+When you are building your app using the WebPack CLI you can use the `--mode`
+flag:
+
+```
+webpack --mode=production app.js -o /dist/bundle.js
+```
+
+##### Node.js
+
+When you are running your app using `Node.js` you should the `NODE_ENV`
+environment variable to `production` to ensure that you libraries that you
+import are optimized for production.
+
+```
+NODE_ENV=production node app.js
+```
+
+### API
+
+The returned logger exposes some addition properties that can be used used in
+your application or library:
+
+#### .enabled
+
+The returned logger will have a `.enabled` property assigned to it. This boolean
+can be used to check if the logger was enabled:
+
+```js
+const debug = require('@dabh/diagnostics')('foo:bar');
+
+if (debug.enabled) {
+ //
+ // Do something special
+ //
+}
+```
+
+This property is exposed as:
+
+- Property on the logger.
+- Property on the meta/options object.
+
+#### .namespace
+
+This is the namespace that you originally provided to the function.
+
+```js
+const debug = require('@dabh/diagnostics')('foo:bar');
+
+console.log(debug.namespace); // foo:bar
+```
+
+This property is exposed as:
+
+- Property on the logger.
+- Property on the meta/options object.
+
+#### .dev/prod
+
+There are different builds available of `diagnostics`, when you create a
+production build of your application using `NODE_ENV=production` you will be
+given an optimized, smaller build of `diagnostics` to reduce your bundle size.
+The `dev` and `prod` booleans on the returned logger indicate if you have a
+production or development version of the logger.
+
+```js
+const debug = require('@dabh/diagnostics')('foo:bar');
+
+if (debug.prod) {
+ // do stuff
+}
+```
+
+This property is exposed as:
+
+- Property on the logger.
+- Property on the meta/options object.
+
+#### set
+
+Sets a new logger as default for **all** `diagnostic` instances. The passed
+argument should be a function that write the log messages to where ever you
+want. It receives 2 arguments:
+
+1. `meta` An object with all the options that was provided to the original
+ logger that wants to write the log message as well as properties of the
+ debugger such as `prod`, `dev`, `namespace`, `enabled`. See [API](#api) for
+ all exposed properties.
+2. `args` An array of the log messages that needs to be written.
+
+```js
+const debug = require('@dabh/diagnostics')('foo:more:namespaces');
+
+debug.use(function logger(meta, args) {
+ console.log(meta);
+ console.debug(...args);
+});
+```
+
+This method is exposed as:
+
+- Method on the logger.
+- Method on the meta/options object.
+- Method on `diagnostics` module.
+
+#### modify
+
+The modify method allows you add a new message modifier to **all** `diagnostic`
+instances. The passed argument should be a function that returns the passed
+message after modification. The function receives 2 arguments:
+
+1. `message`, Array, the log message.
+2. `options`, Object, the options that were passed into the logger when it was
+ initially created.
+
+```js
+const debug = require('@dabh/diagnostics')('example:modifiers');
+
+debug.modify(function (message, options) {
+ return messages;
+});
+```
+
+This method is exposed as:
+
+- Method on the logger.
+- Method on the meta/options object.
+- Method on `diagnostics` module.
+
+See [modifiers](#modifiers) for more information.
+
+#### use
+
+Adds a new `adapter` to **all** `diagnostic` instances. The passed argument
+should be a function returns a boolean that indicates if the passed in
+`namespace` is allowed to write log messages.
+
+```js
+const diagnostics = require('@dabh/diagnostics');
+const debug = diagnostics('foo:bar');
+
+debug.use(function (namespace) {
+ return namespace === 'foo:bar';
+});
+```
+
+This method is exposed as:
+
+- Method on the logger.
+- Method on the meta/options object.
+- Method on `diagnostics` module.
+
+See [adapters](#adapters) for more information.
+
+### Modifiers
+
+To be as flexible as possible when it comes to transforming messages we've
+come up with the concept of `modifiers` which can enhance the debug messages.
+This allows you to introduce functionality or details that you find important
+for debug messages, and doesn't require us to add additional bloat to the
+`diagnostic` core.
+
+For example, you want the messages to be prefixed with the date-time of when
+the log message occured:
+
+```js
+const diagnostics = require('@dabh/diagnostics');
+
+diagnostics.modify(function datetime(args, options) {
+ args.unshift(new Date());
+ return args;
+});
+```
+
+Now all messages will be prefixed with date that is outputted by `new Date()`.
+The following modifiers are shipped with `diagnostics` and are enabled in
+**development** mode only:
+
+- [namespace](#namespace)
+
+#### namespace
+
+This modifier is enabled for all debug instances and prefixes the messages
+with the name of namespace under which it is logged. The namespace is colored
+using the `colorspace` module which groups similar namespaces under the same
+colorspace. You can have multiple namespaces for the debuggers where each
+namespace should be separated by a `:`
+
+```
+foo
+foo:bar
+foo:bar:baz
+```
+
+For console based output the `namespace-ansi` is used.
+
+### Adapters
+
+Adapters allows `diagnostics` to pull the `DEBUG` and `DIAGNOSTICS` environment
+variables from different sources. Not every JavaScript environment has a
+`process.env` that we can leverage. Adapters allows us to have different
+adapters for different environments. It means you can write your own custom
+adapter if needed as well.
+
+The `adapter` function should be passed a function as argument, this function
+will receive the `namespace` of a logger as argument and it should return a
+boolean that indicates if that logger should be enabled or not.
+
+```js
+const debug = require('@dabh/diagnostics')('example:namespace');
+
+debug.adapter(require('@dabh/diagnostics/adapters/localstorage'));
+```
+
+The modifiers are only enabled for `development`. The following adapters are
+available are available:
+
+#### process.env
+
+This adapter is enabled for `node.js`.
+
+Uses the `DEBUG` or `DIAGNOSTICS` (both are recognized) environment variables to
+pass in debug flag:
+
+**UNIX/Linux/Mac**
+```
+DEBUG=foo* node index.js
+```
+
+Using environment variables on Windows is a bit different, and also depends on
+toolchain you are using:
+
+**Windows**
+```
+set DEBUG=foo* & node index.js
+```
+
+**Powershell**
+```
+$env:DEBUG='foo*';node index.js
+```
+
+#### hash
+
+This adapter is enabled for `browsers`.
+
+This adapter uses the `window.location.hash` of as source for the environment
+variables. It assumes that hash is formatted using the same syntax as query
+strings:
+
+```js
+http://example.com/foo/bar#debug=foo*
+```
+
+It triggers on both the `debug=` and `diagnostics=` names.
+
+#### localStorage
+
+This adapter is enabled for `browsers`.
+
+This adapter uses the `localStorage` of the browser to store the debug flags.
+You can set the debug flag your self in your application code, but you can
+also open browser WebInspector and enable it through the console.
+
+```js
+localStorage.setItem('debug', 'foo*');
+```
+
+It triggers on both the `debug` and `diagnostics` storage items. (Please note
+that these keys should be entered in lowercase)
+
+#### AsyncStorage
+
+This adapter is enabled for `react-native`.
+
+This adapter uses the `AsyncStorage` API that is exposed by the `react-native`
+library to store and read the `debug` or `diagnostics` storage items.
+
+```js
+import { AsyncStorage } from 'react-native';
+
+AsyncStorage.setItem('debug', 'foo*');
+```
+
+Unlike other adapters, this is the only adapter that is `async` so that means
+that we're not able to instantly determine if a created logger should be
+enabled or disabled. So when a logger is created in `react-native` we initially
+assume it's disabled, any message that send during period will be queued
+internally.
+
+Once we've received the data from the `AsyncStorage` API we will determine
+if the logger should be enabled, flush the queued messages if needed and set
+all `enabled` properties accordingly on the returned logger.
+
+### Loggers
+
+By default it will log all messages to `console.log` in when the logger is
+enabled using the debug flag that is set using one of the adapters.
+
+## License
+
+[MIT](LICENSE)
diff --git a/sdk/node_modules/@dabh/diagnostics/adapters/hash.js b/sdk/node_modules/@dabh/diagnostics/adapters/hash.js
new file mode 100644
index 00000000..a41aae5c
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/adapters/hash.js
@@ -0,0 +1,11 @@
+var adapter = require('./');
+
+/**
+ * Extracts the values from process.env.
+ *
+ * @type {Function}
+ * @public
+ */
+module.exports = adapter(function hash() {
+ return /(debug|diagnostics)=([^&]+)/i.exec(window.location.hash)[2];
+});
diff --git a/sdk/node_modules/@dabh/diagnostics/adapters/index.js b/sdk/node_modules/@dabh/diagnostics/adapters/index.js
new file mode 100644
index 00000000..d60aaea5
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/adapters/index.js
@@ -0,0 +1,18 @@
+var enabled = require('enabled');
+
+/**
+ * Creates a new Adapter.
+ *
+ * @param {Function} fn Function that returns the value.
+ * @returns {Function} The adapter logic.
+ * @public
+ */
+module.exports = function create(fn) {
+ return function adapter(namespace) {
+ try {
+ return enabled(namespace, fn());
+ } catch (e) { /* Any failure means that we found nothing */ }
+
+ return false;
+ };
+}
diff --git a/sdk/node_modules/@dabh/diagnostics/adapters/localstorage.js b/sdk/node_modules/@dabh/diagnostics/adapters/localstorage.js
new file mode 100644
index 00000000..bb889875
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/adapters/localstorage.js
@@ -0,0 +1,11 @@
+var adapter = require('./');
+
+/**
+ * Extracts the values from process.env.
+ *
+ * @type {Function}
+ * @public
+ */
+module.exports = adapter(function storage() {
+ return localStorage.getItem('debug') || localStorage.getItem('diagnostics');
+});
diff --git a/sdk/node_modules/@dabh/diagnostics/adapters/process.env.js b/sdk/node_modules/@dabh/diagnostics/adapters/process.env.js
new file mode 100644
index 00000000..5ab166a4
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/adapters/process.env.js
@@ -0,0 +1,11 @@
+var adapter = require('./');
+
+/**
+ * Extracts the values from process.env.
+ *
+ * @type {Function}
+ * @public
+ */
+module.exports = adapter(function processenv() {
+ return process.env.DEBUG || process.env.DIAGNOSTICS;
+});
diff --git a/sdk/node_modules/@dabh/diagnostics/browser/development.js b/sdk/node_modules/@dabh/diagnostics/browser/development.js
new file mode 100644
index 00000000..e36dfaa5
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/browser/development.js
@@ -0,0 +1,35 @@
+var create = require('../diagnostics');
+
+/**
+ * Create a new diagnostics logger.
+ *
+ * @param {String} namespace The namespace it should enable.
+ * @param {Object} options Additional options.
+ * @returns {Function} The logger.
+ * @public
+ */
+var diagnostics = create(function dev(namespace, options) {
+ options = options || {};
+ options.namespace = namespace;
+ options.prod = false;
+ options.dev = true;
+
+ if (!dev.enabled(namespace) && !(options.force || dev.force)) {
+ return dev.nope(options);
+ }
+
+ return dev.yep(options);
+});
+
+//
+// Configure the logger for the given environment.
+//
+diagnostics.modify(require('../modifiers/namespace'));
+diagnostics.use(require('../adapters/localstorage'));
+diagnostics.use(require('../adapters/hash'));
+diagnostics.set(require('../logger/console'));
+
+//
+// Expose the diagnostics logger.
+//
+module.exports = diagnostics;
diff --git a/sdk/node_modules/@dabh/diagnostics/browser/index.js b/sdk/node_modules/@dabh/diagnostics/browser/index.js
new file mode 100644
index 00000000..ae0f2f80
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/browser/index.js
@@ -0,0 +1,8 @@
+//
+// Select the correct build version depending on the environment.
+//
+if (process.env.NODE_ENV === 'production') {
+ module.exports = require('./production.js');
+} else {
+ module.exports = require('./development.js');
+}
diff --git a/sdk/node_modules/@dabh/diagnostics/browser/override.js b/sdk/node_modules/@dabh/diagnostics/browser/override.js
new file mode 100644
index 00000000..8f363772
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/browser/override.js
@@ -0,0 +1,6 @@
+var diagnostics = require('./');
+
+//
+// No way to override `debug` with `diagnostics` in the browser.
+//
+module.exports = diagnostics;
diff --git a/sdk/node_modules/@dabh/diagnostics/browser/production.js b/sdk/node_modules/@dabh/diagnostics/browser/production.js
new file mode 100644
index 00000000..1a19ce39
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/browser/production.js
@@ -0,0 +1,24 @@
+var create = require('../diagnostics');
+
+/**
+ * Create a new diagnostics logger.
+ *
+ * @param {String} namespace The namespace it should enable.
+ * @param {Object} options Additional options.
+ * @returns {Function} The logger.
+ * @public
+ */
+var diagnostics = create(function prod(namespace, options) {
+ options = options || {};
+ options.namespace = namespace;
+ options.prod = true;
+ options.dev = false;
+
+ if (!(options.force || prod.force)) return prod.nope(options);
+ return prod.yep(options);
+});
+
+//
+// Expose the diagnostics logger.
+//
+module.exports = diagnostics;
diff --git a/sdk/node_modules/@dabh/diagnostics/diagnostics.js b/sdk/node_modules/@dabh/diagnostics/diagnostics.js
new file mode 100644
index 00000000..12dc1f35
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/diagnostics.js
@@ -0,0 +1,212 @@
+/**
+ * Contains all configured adapters for the given environment.
+ *
+ * @type {Array}
+ * @public
+ */
+var adapters = [];
+
+/**
+ * Contains all modifier functions.
+ *
+ * @typs {Array}
+ * @public
+ */
+var modifiers = [];
+
+/**
+ * Our default logger.
+ *
+ * @public
+ */
+var logger = function devnull() {};
+
+/**
+ * Register a new adapter that will used to find environments.
+ *
+ * @param {Function} adapter A function that will return the possible env.
+ * @returns {Boolean} Indication of a successful add.
+ * @public
+ */
+function use(adapter) {
+ if (~adapters.indexOf(adapter)) return false;
+
+ adapters.push(adapter);
+ return true;
+}
+
+/**
+ * Assign a new log method.
+ *
+ * @param {Function} custom The log method.
+ * @public
+ */
+function set(custom) {
+ logger = custom;
+}
+
+/**
+ * Check if the namespace is allowed by any of our adapters.
+ *
+ * @param {String} namespace The namespace that needs to be enabled
+ * @returns {Boolean|Promise} Indication if the namespace is enabled by our adapters.
+ * @public
+ */
+function enabled(namespace) {
+ var async = [];
+
+ for (var i = 0; i < adapters.length; i++) {
+ if (adapters[i].async) {
+ async.push(adapters[i]);
+ continue;
+ }
+
+ if (adapters[i](namespace)) return true;
+ }
+
+ if (!async.length) return false;
+
+ //
+ // Now that we know that we Async functions, we know we run in an ES6
+ // environment and can use all the API's that they offer, in this case
+ // we want to return a Promise so that we can `await` in React-Native
+ // for an async adapter.
+ //
+ return new Promise(function pinky(resolve) {
+ Promise.all(
+ async.map(function prebind(fn) {
+ return fn(namespace);
+ })
+ ).then(function resolved(values) {
+ resolve(values.some(Boolean));
+ });
+ });
+}
+
+/**
+ * Add a new message modifier to the debugger.
+ *
+ * @param {Function} fn Modification function.
+ * @returns {Boolean} Indication of a successful add.
+ * @public
+ */
+function modify(fn) {
+ if (~modifiers.indexOf(fn)) return false;
+
+ modifiers.push(fn);
+ return true;
+}
+
+/**
+ * Write data to the supplied logger.
+ *
+ * @param {Object} meta Meta information about the log.
+ * @param {Array} args Arguments for console.log.
+ * @public
+ */
+function write() {
+ logger.apply(logger, arguments);
+}
+
+/**
+ * Process the message with the modifiers.
+ *
+ * @param {Mixed} message The message to be transformed by modifers.
+ * @returns {String} Transformed message.
+ * @public
+ */
+function process(message) {
+ for (var i = 0; i < modifiers.length; i++) {
+ message = modifiers[i].apply(modifiers[i], arguments);
+ }
+
+ return message;
+}
+
+/**
+ * Introduce options to the logger function.
+ *
+ * @param {Function} fn Calback function.
+ * @param {Object} options Properties to introduce on fn.
+ * @returns {Function} The passed function
+ * @public
+ */
+function introduce(fn, options) {
+ var has = Object.prototype.hasOwnProperty;
+
+ for (var key in options) {
+ if (has.call(options, key)) {
+ fn[key] = options[key];
+ }
+ }
+
+ return fn;
+}
+
+/**
+ * Nope, we're not allowed to write messages.
+ *
+ * @returns {Boolean} false
+ * @public
+ */
+function nope(options) {
+ options.enabled = false;
+ options.modify = modify;
+ options.set = set;
+ options.use = use;
+
+ return introduce(function diagnopes() {
+ return false;
+ }, options);
+}
+
+/**
+ * Yep, we're allowed to write debug messages.
+ *
+ * @param {Object} options The options for the process.
+ * @returns {Function} The function that does the logging.
+ * @public
+ */
+function yep(options) {
+ /**
+ * The function that receives the actual debug information.
+ *
+ * @returns {Boolean} indication that we're logging.
+ * @public
+ */
+ function diagnostics() {
+ var args = Array.prototype.slice.call(arguments, 0);
+
+ write.call(write, options, process(args, options));
+ return true;
+ }
+
+ options.enabled = true;
+ options.modify = modify;
+ options.set = set;
+ options.use = use;
+
+ return introduce(diagnostics, options);
+}
+
+/**
+ * Simple helper function to introduce various of helper methods to our given
+ * diagnostics function.
+ *
+ * @param {Function} diagnostics The diagnostics function.
+ * @returns {Function} diagnostics
+ * @public
+ */
+module.exports = function create(diagnostics) {
+ diagnostics.introduce = introduce;
+ diagnostics.enabled = enabled;
+ diagnostics.process = process;
+ diagnostics.modify = modify;
+ diagnostics.write = write;
+ diagnostics.nope = nope;
+ diagnostics.yep = yep;
+ diagnostics.set = set;
+ diagnostics.use = use;
+
+ return diagnostics;
+}
diff --git a/sdk/node_modules/@dabh/diagnostics/logger/console.js b/sdk/node_modules/@dabh/diagnostics/logger/console.js
new file mode 100644
index 00000000..7423eff9
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/logger/console.js
@@ -0,0 +1,19 @@
+/**
+ * An idiot proof logger to be used as default. We've wrapped it in a try/catch
+ * statement to ensure the environments without the `console` API do not crash
+ * as well as an additional fix for ancient browsers like IE8 where the
+ * `console.log` API doesn't have an `apply`, so we need to use the Function's
+ * apply functionality to apply the arguments.
+ *
+ * @param {Object} meta Options of the logger.
+ * @param {Array} messages The actuall message that needs to be logged.
+ * @public
+ */
+module.exports = function (meta, messages) {
+ //
+ // So yea. IE8 doesn't have an apply so we need a work around to puke the
+ // arguments in place.
+ //
+ try { Function.prototype.apply.call(console.log, console, messages); }
+ catch (e) {}
+}
diff --git a/sdk/node_modules/@dabh/diagnostics/modifiers/namespace-ansi.js b/sdk/node_modules/@dabh/diagnostics/modifiers/namespace-ansi.js
new file mode 100644
index 00000000..a1f7353d
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/modifiers/namespace-ansi.js
@@ -0,0 +1,20 @@
+var colorspace = require('@so-ric/colorspace');
+var kuler = require('kuler');
+
+/**
+ * Prefix the messages with a colored namespace.
+ *
+ * @param {Array} args The messages array that is getting written.
+ * @param {Object} options Options for diagnostics.
+ * @returns {Array} Altered messages array.
+ * @public
+ */
+module.exports = function ansiModifier(args, options) {
+ var namespace = options.namespace;
+ var ansi = options.colors !== false
+ ? kuler(namespace +':', colorspace(namespace))
+ : namespace +':';
+
+ args[0] = ansi +' '+ args[0];
+ return args;
+};
diff --git a/sdk/node_modules/@dabh/diagnostics/modifiers/namespace.js b/sdk/node_modules/@dabh/diagnostics/modifiers/namespace.js
new file mode 100644
index 00000000..5a9dd876
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/modifiers/namespace.js
@@ -0,0 +1,32 @@
+var colorspace = require('@so-ric/colorspace');
+
+/**
+ * Prefix the messages with a colored namespace.
+ *
+ * @param {Array} messages The messages array that is getting written.
+ * @param {Object} options Options for diagnostics.
+ * @returns {Array} Altered messages array.
+ * @public
+ */
+module.exports = function colorNamespace(args, options) {
+ var namespace = options.namespace;
+
+ if (options.colors === false) {
+ args[0] = namespace +': '+ args[0];
+ return args;
+ }
+
+ var color = colorspace(namespace);
+
+ //
+ // The console API supports a special %c formatter in browsers. This is used
+ // to style console messages with any CSS styling, in our case we want to
+ // use colorize the namespace for clarity. As these are formatters, and
+ // we need to inject our CSS string as second messages argument so it
+ // gets picked up correctly.
+ //
+ args[0] = '%c'+ namespace +':%c '+ args[0];
+ args.splice(1, 0, 'color:'+ color, 'color:inherit');
+
+ return args;
+};
diff --git a/sdk/node_modules/@dabh/diagnostics/node/development.js b/sdk/node_modules/@dabh/diagnostics/node/development.js
new file mode 100644
index 00000000..51dc51b6
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/node/development.js
@@ -0,0 +1,36 @@
+var create = require('../diagnostics');
+var tty = require('tty').isatty(1);
+
+/**
+ * Create a new diagnostics logger.
+ *
+ * @param {String} namespace The namespace it should enable.
+ * @param {Object} options Additional options.
+ * @returns {Function} The logger.
+ * @public
+ */
+var diagnostics = create(function dev(namespace, options) {
+ options = options || {};
+ options.colors = 'colors' in options ? options.colors : tty;
+ options.namespace = namespace;
+ options.prod = false;
+ options.dev = true;
+
+ if (!dev.enabled(namespace) && !(options.force || dev.force)) {
+ return dev.nope(options);
+ }
+
+ return dev.yep(options);
+});
+
+//
+// Configure the logger for the given environment.
+//
+diagnostics.modify(require('../modifiers/namespace-ansi'));
+diagnostics.use(require('../adapters/process.env'));
+diagnostics.set(require('../logger/console'));
+
+//
+// Expose the diagnostics logger.
+//
+module.exports = diagnostics;
diff --git a/sdk/node_modules/@dabh/diagnostics/node/index.js b/sdk/node_modules/@dabh/diagnostics/node/index.js
new file mode 100644
index 00000000..ae0f2f80
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/node/index.js
@@ -0,0 +1,8 @@
+//
+// Select the correct build version depending on the environment.
+//
+if (process.env.NODE_ENV === 'production') {
+ module.exports = require('./production.js');
+} else {
+ module.exports = require('./development.js');
+}
diff --git a/sdk/node_modules/@dabh/diagnostics/node/override.js b/sdk/node_modules/@dabh/diagnostics/node/override.js
new file mode 100644
index 00000000..936e28be
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/node/override.js
@@ -0,0 +1,21 @@
+const diagnostics = require('./');
+
+//
+// Override the existing `debug` call so it will use `diagnostics` instead
+// of the `debug` module.
+//
+try {
+ var key = require.resolve('debug');
+
+ require.cache[key] = {
+ exports: diagnostics,
+ filename: key,
+ loaded: true,
+ id: key
+ };
+} catch (e) { /* We don't really care if it fails */ }
+
+//
+// Export the default import as exports again.
+//
+module.exports = diagnostics;
diff --git a/sdk/node_modules/@dabh/diagnostics/node/production.js b/sdk/node_modules/@dabh/diagnostics/node/production.js
new file mode 100644
index 00000000..1a19ce39
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/node/production.js
@@ -0,0 +1,24 @@
+var create = require('../diagnostics');
+
+/**
+ * Create a new diagnostics logger.
+ *
+ * @param {String} namespace The namespace it should enable.
+ * @param {Object} options Additional options.
+ * @returns {Function} The logger.
+ * @public
+ */
+var diagnostics = create(function prod(namespace, options) {
+ options = options || {};
+ options.namespace = namespace;
+ options.prod = true;
+ options.dev = false;
+
+ if (!(options.force || prod.force)) return prod.nope(options);
+ return prod.yep(options);
+});
+
+//
+// Expose the diagnostics logger.
+//
+module.exports = diagnostics;
diff --git a/sdk/node_modules/@dabh/diagnostics/package.json b/sdk/node_modules/@dabh/diagnostics/package.json
new file mode 100644
index 00000000..89f86508
--- /dev/null
+++ b/sdk/node_modules/@dabh/diagnostics/package.json
@@ -0,0 +1,64 @@
+{
+ "name": "@dabh/diagnostics",
+ "version": "2.0.8",
+ "description": "Tools for debugging your node.js modules and event loop",
+ "main": "./node",
+ "browser": "./browser",
+ "scripts": {
+ "test:basic": "mocha --require test/mock.js test/*.test.js",
+ "test:node": "mocha --require test/mock test/node.js",
+ "test:browser": "mocha --require test/mock test/browser.js",
+ "test:runner": "npm run test:basic && npm run test:node && npm run test:browser",
+ "webpack:node:prod": "webpack --mode=production node/index.js -o /dev/null --json | webpack-bundle-size-analyzer",
+ "webpack:node:dev": "webpack --mode=development node/index.js -o /dev/null --json | webpack-bundle-size-analyzer",
+ "webpack:browser:prod": "webpack --mode=production browser/index.js -o /dev/null --json | webpack-bundle-size-analyzer",
+ "webpack:browser:dev": "webpack --mode=development browser/index.js -o /dev/null --json | webpack-bundle-size-analyzer",
+ "test": "nyc --reporter=text --reporter=lcov npm run test:runner"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/DABH/diagnostics.git"
+ },
+ "keywords": [
+ "debug",
+ "debugger",
+ "debugging",
+ "diagnostic",
+ "diagnostics",
+ "event",
+ "loop",
+ "metrics",
+ "stats"
+ ],
+ "author": "Arnout Kazemier",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/DABH/diagnostics/issues"
+ },
+ "homepage": "https://github.com/DABH/diagnostics",
+ "devDependencies": {
+ "assume": "2.3.x",
+ "asyncstorageapi": "^1.0.2",
+ "mocha": "^11.7.2",
+ "nyc": "^17.1.0",
+ "objstorage": "^1.0.0",
+ "pre-commit": "github:metcalfc/pre-commit#b36c649fd5348d7604a86b7b2f3429c780d1478f",
+ "require-poisoning": "^2.0.0",
+ "webpack": "5.x",
+ "webpack-bundle-size-analyzer": "^3.0.0",
+ "webpack-cli": "6.x"
+ },
+ "dependencies": {
+ "@so-ric/colorspace": "^1.1.6",
+ "enabled": "2.0.x",
+ "kuler": "^2.0.0"
+ },
+ "contributors": [
+ "Martijn Swaagman (https://github.com/swaagie)",
+ "Jarrett Cruger (https://github.com/jcrugzz)",
+ "Sevastos (https://github.com/sevastos)"
+ ],
+ "directories": {
+ "test": "test"
+ }
+}
diff --git a/sdk/node_modules/@esbuild/darwin-arm64/README.md b/sdk/node_modules/@esbuild/darwin-arm64/README.md
new file mode 100644
index 00000000..c2c0398d
--- /dev/null
+++ b/sdk/node_modules/@esbuild/darwin-arm64/README.md
@@ -0,0 +1,3 @@
+# esbuild
+
+This is the macOS ARM 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
diff --git a/sdk/node_modules/@esbuild/darwin-arm64/bin/esbuild b/sdk/node_modules/@esbuild/darwin-arm64/bin/esbuild
new file mode 100755
index 00000000..5b2a9793
Binary files /dev/null and b/sdk/node_modules/@esbuild/darwin-arm64/bin/esbuild differ
diff --git a/sdk/node_modules/@esbuild/darwin-arm64/package.json b/sdk/node_modules/@esbuild/darwin-arm64/package.json
new file mode 100644
index 00000000..8a825f37
--- /dev/null
+++ b/sdk/node_modules/@esbuild/darwin-arm64/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "@esbuild/darwin-arm64",
+ "version": "0.18.20",
+ "description": "The macOS ARM 64-bit binary for esbuild, a JavaScript bundler.",
+ "repository": "https://github.com/evanw/esbuild",
+ "license": "MIT",
+ "preferUnplugged": true,
+ "engines": {
+ "node": ">=12"
+ },
+ "os": [
+ "darwin"
+ ],
+ "cpu": [
+ "arm64"
+ ]
+}
diff --git a/sdk/node_modules/@fastify/ajv-compiler/.gitattributes b/sdk/node_modules/@fastify/ajv-compiler/.gitattributes
new file mode 100644
index 00000000..a0e7df93
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/.gitattributes
@@ -0,0 +1,2 @@
+# Set default behavior to automatically convert line endings
+* text=auto eol=lf
diff --git a/sdk/node_modules/@fastify/ajv-compiler/.github/.stale.yml b/sdk/node_modules/@fastify/ajv-compiler/.github/.stale.yml
new file mode 100644
index 00000000..2ee12691
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/.github/.stale.yml
@@ -0,0 +1,21 @@
+# Number of days of inactivity before an issue becomes stale
+daysUntilStale: 15
+# Number of days of inactivity before a stale issue is closed
+daysUntilClose: 7
+# Issues with these labels will never be considered stale
+exemptLabels:
+ - "discussion"
+ - "feature request"
+ - "bug"
+ - "help wanted"
+ - "plugin suggestion"
+ - "good first issue"
+# Label to use when marking an issue as stale
+staleLabel: stale
+# Comment to post when marking an issue as stale. Set to `false` to disable
+markComment: >
+ This issue has been automatically marked as stale because it has not had
+ recent activity. It will be closed if no further activity occurs. Thank you
+ for your contributions.
+# Comment to post when closing a stale issue. Set to `false` to disable
+closeComment: false
\ No newline at end of file
diff --git a/sdk/node_modules/@fastify/ajv-compiler/.github/dependabot.yml b/sdk/node_modules/@fastify/ajv-compiler/.github/dependabot.yml
new file mode 100644
index 00000000..dfa7fa6c
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/.github/dependabot.yml
@@ -0,0 +1,13 @@
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "monthly"
+ open-pull-requests-limit: 10
+
+ - package-ecosystem: "npm"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ open-pull-requests-limit: 10
diff --git a/sdk/node_modules/@fastify/ajv-compiler/.github/tests_checker.yml b/sdk/node_modules/@fastify/ajv-compiler/.github/tests_checker.yml
new file mode 100644
index 00000000..769469b2
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/.github/tests_checker.yml
@@ -0,0 +1,8 @@
+comment: |
+ Hello! Thank you for contributing!
+ It appears that you have changed the code, but the tests that verify your change are missing. Could you please add them?
+fileExtensions:
+ - '.ts'
+ - '.js'
+
+testDir: 'test'
\ No newline at end of file
diff --git a/sdk/node_modules/@fastify/ajv-compiler/.github/workflows/ci.yml b/sdk/node_modules/@fastify/ajv-compiler/.github/workflows/ci.yml
new file mode 100644
index 00000000..f3df83a4
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/.github/workflows/ci.yml
@@ -0,0 +1,26 @@
+name: Continuous Integration
+
+on:
+ push:
+ branches:
+ - main
+ - master
+ - next
+ - 'v*'
+ paths-ignore:
+ - 'docs/**'
+ - '*.md'
+ pull_request:
+ paths-ignore:
+ - 'docs/**'
+ - '*.md'
+
+env:
+ TZ: 'UTC'
+
+jobs:
+ test:
+ uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
+ with:
+ lint: true
+ license-check: true
diff --git a/sdk/node_modules/@fastify/ajv-compiler/.taprc b/sdk/node_modules/@fastify/ajv-compiler/.taprc
new file mode 100644
index 00000000..7695d35c
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/.taprc
@@ -0,0 +1,2 @@
+files:
+ - test/**/*.test.js
\ No newline at end of file
diff --git a/sdk/node_modules/@fastify/ajv-compiler/LICENSE b/sdk/node_modules/@fastify/ajv-compiler/LICENSE
new file mode 100644
index 00000000..7f6f4824
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/LICENSE
@@ -0,0 +1,24 @@
+MIT License
+
+Copyright (c) The Fastify Team
+
+The Fastify team members are listed at https://github.com/fastify/fastify#team
+and in the README file.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/sdk/node_modules/@fastify/ajv-compiler/README.md b/sdk/node_modules/@fastify/ajv-compiler/README.md
new file mode 100644
index 00000000..bb62ca3a
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/README.md
@@ -0,0 +1,236 @@
+# @fastify/ajv-compiler
+
+[](http://standardjs.com/)
+[](https://github.com/fastify/ajv-compiler/actions/workflows/ci.yml)
+
+This module manages the [`ajv`](https://www.npmjs.com/package/ajv) instances for the Fastify framework.
+It isolates the `ajv` dependency so that the AJV version is not tightly coupled to the Fastify version.
+This allows the user to decide which version of AJV to use in their Fastify based application.
+
+
+## Versions
+
+| `@fastify/ajv-compiler` | `ajv` | Default in `fastify` |
+|------------------------:|------:|---------------------:|
+| v1.x | v6.x | ^3.14 |
+| v2.x | v8.x | - |
+| v3.x | v8.x | ^4.x |
+
+
+### AJV Configuration
+
+The Fastify's default [`ajv` options](https://github.com/ajv-validator/ajv/tree/v6#options) are:
+
+```js
+{
+ coerceTypes: 'array',
+ useDefaults: true,
+ removeAdditional: true,
+ uriResolver: require('fast-uri'),
+ addUsedSchema: false,
+ // Explicitly set allErrors to `false`.
+ // When set to `true`, a DoS attack is possible.
+ allErrors: false
+}
+```
+
+Moreover, the [`ajv-formats`](https://www.npmjs.com/package/ajv-formats) module is included by default.
+If you need to customize it, check the _usage_ section below.
+
+To customize the `ajv`'s options, see how in the [Fastify official docs](https://fastify.dev/docs/latest/Reference/Server/#ajv).
+
+
+## Usage
+
+This module is already used as default by Fastify.
+If you need to provide to your server instance a different version, refer to [the official doc](https://fastify.dev/docs/latest/Reference/Server/#schemacontroller).
+
+### Customize the `ajv-formats` plugin
+
+The `format` keyword is not part of the official `ajv` module since v7. To use it, you need to install the `ajv-formats` module and this module
+does it for you with the default configuration.
+
+If you need to configure the `ajv-formats` plugin you can do it using the standard Fastify configuration:
+
+```js
+const app = fastify({
+ ajv: {
+ plugins: [[require('ajv-formats'), { mode: 'fast' }]]
+ }
+})
+```
+
+In this way, your setup will have precendence over the `@fastify/ajv-compiler` default configuration.
+
+### Customize the `ajv` instance
+
+If you need to customize the `ajv` instance and take full control of its configuration, you can do it by
+using the `onCreate` option in the Fastify configuration that accepts a syncronous function that receives the `ajv` instance:
+
+```js
+const app = fastify({
+ ajv: {
+ onCreate: (ajv) => {
+ // Modify the ajv instance as you need.
+ ajv.addFormat('myFormat', (data) => typeof data === 'string')
+ }
+ }
+})
+```
+
+### Fastify with JTD
+
+The [JSON Type Definition](https://jsontypedef.com/) feature is supported by AJV v8.x and you can benefit from it in your Fastify application.
+
+With Fastify v3.20.x and higher, you can use the `@fastify/ajv-compiler` module to load JSON Type Definitions like so:
+
+```js
+const factory = require('@fastify/ajv-compiler')()
+
+const app = fastify({
+ jsonShorthand: false,
+ ajv: {
+ customOptions: { }, // additional JTD options
+ mode: 'JTD'
+ },
+ schemaController: {
+ compilersFactory: {
+ buildValidator: factory
+ }
+ }
+})
+```
+
+The defaults AJV JTD options are the same as the [Fastify's default options](#AJV-Configuration).
+
+#### Fastify with JTD and serialization
+
+You can use JTD Schemas to serialize your response object too:
+
+```js
+const factoryValidator = require('@fastify/ajv-compiler')()
+const factorySerializer = require('@fastify/ajv-compiler')({ jtdSerializer: true })
+
+const app = fastify({
+ jsonShorthand: false,
+ ajv: {
+ customOptions: { }, // additional JTD options
+ mode: 'JTD'
+ },
+ schemaController: {
+ compilersFactory: {
+ buildValidator: factoryValidator,
+ buildSerializer: factorySerializer
+ }
+ }
+})
+```
+
+
+### AJV Standalone
+
+AJV v8 introduces the [standalone feature](https://ajv.js.org/standalone.html) that let you to pre-compile your schemas and use them in your application for a faster startup.
+
+To use this feature, you must be aware of the following:
+
+1. You must generate and save the application's compiled schemas.
+2. Read the compiled schemas from the file and provide them back to your Fastify application.
+
+
+#### Generate and save the compiled schemas
+
+Fastify helps you to generate the validation schemas functions and it is your choice to save them where you want.
+To accomplish this, you must use a new compiler: `StandaloneValidator`.
+
+You must provide 2 parameters to this compiler:
+
+- `readMode: false`: a boolean to indicate that you want generate the schemas functions string.
+- `storeFunction`" a sync function that must store the source code of the schemas functions. You may provide an async function too, but you must manage errors.
+
+When `readMode: false`, **the compiler is meant to be used in development ONLY**.
+
+
+```js
+const { StandaloneValidator } = require('@fastify/ajv-compiler')
+const factory = StandaloneValidator({
+ readMode: false,
+ storeFunction (routeOpts, schemaValidationCode) {
+ // routeOpts is like: { schema, method, url, httpPart }
+ // schemaValidationCode is a string source code that is the compiled schema function
+ const fileName = generateFileName(routeOpts)
+ fs.writeFileSync(path.join(__dirname, fileName), schemaValidationCode)
+ }
+})
+
+const app = fastify({
+ jsonShorthand: false,
+ schemaController: {
+ compilersFactory: {
+ buildValidator: factory
+ }
+ }
+})
+
+// ... add all your routes with schemas ...
+
+app.ready().then(() => {
+ // at this stage all your schemas are compiled and stored in the file system
+ // now it is important to turn off the readMode
+})
+```
+
+#### Read the compiled schemas functions
+
+At this stage, you should have a file for every route's schema.
+To use them, you must use the `StandaloneValidator` with the parameters:
+
+- `readMode: true`: a boolean to indicate that you want read and use the schemas functions string.
+- `restoreFunction`" a sync function that must return a function to validate the route.
+
+Important keep away before you continue reading the documentation:
+
+- when you use the `readMode: true`, the application schemas are not compiled (they are ignored). So, if you change your schemas, you must recompile them!
+- as you can see, you must relate the route's schema to the file name using the `routeOpts` object. You may use the `routeOpts.schema.$id` field to do so, it is up to you to define a unique schema identifier.
+
+```js
+const { StandaloneValidator } = require('@fastify/ajv-compiler')
+const factory = StandaloneValidator({
+ readMode: true,
+ restoreFunction (routeOpts) {
+ // routeOpts is like: { schema, method, url, httpPart }
+ const fileName = generateFileName(routeOpts)
+ return require(path.join(__dirname, fileName))
+ }
+})
+
+const app = fastify({
+ jsonShorthand: false,
+ schemaController: {
+ compilersFactory: {
+ buildValidator: factory
+ }
+ }
+})
+
+// ... add all your routes with schemas as before...
+
+app.listen({ port: 3000 })
+```
+
+### How it works
+
+This module provide a factory function to produce [Validator Compilers](https://fastify.dev/docs/latest/Reference/Server/#validatorcompiler) functions.
+
+The Fastify factory function is just one per server instance and it is called for every encapsulated context created by the application through the `fastify.register()` call.
+
+Every Validator Compiler produced, has a dedicated AJV instance, so, this factory will try to produce as less as possible AJV instances to reduce the memory footprint and the startup time.
+
+The variables involved to choose if a Validator Compiler can be reused are:
+
+- the AJV configuration: it is [one per server](https://fastify.dev/docs/latest/Reference/Server/#ajv)
+- the external JSON schemas: once a new schema is added to a fastify's context, calling `fastify.addSchema()`, it will cause a new AJV inizialization
+
+
+## License
+
+Licensed under [MIT](./LICENSE).
diff --git a/sdk/node_modules/@fastify/ajv-compiler/benchmark/small-object.mjs b/sdk/node_modules/@fastify/ajv-compiler/benchmark/small-object.mjs
new file mode 100644
index 00000000..a2065823
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/benchmark/small-object.mjs
@@ -0,0 +1,37 @@
+import cronometro from 'cronometro'
+
+import fjs from 'fast-json-stringify'
+import AjvCompiler from '../index.js'
+
+const fjsSerialize = buildFJSSerializerFunction({
+ type: 'object',
+ properties: {
+ hello: { type: 'string' },
+ name: { type: 'string' }
+ }
+})
+const ajvSerialize = buildAJVSerializerFunction({
+ properties: {
+ hello: { type: 'string' },
+ name: { type: 'string' }
+ }
+})
+
+await cronometro({
+ 'fast-json-stringify': function () {
+ fjsSerialize({ hello: 'Ciao', name: 'Manuel' })
+ },
+ 'ajv serializer': function () {
+ ajvSerialize({ hello: 'Ciao', name: 'Manuel' })
+ }
+})
+
+function buildFJSSerializerFunction (schema) {
+ return fjs(schema)
+}
+
+function buildAJVSerializerFunction (schema) {
+ const factory = AjvCompiler({ jtdSerializer: true })
+ const compiler = factory({}, { customOptions: {} })
+ return compiler({ schema })
+}
diff --git a/sdk/node_modules/@fastify/ajv-compiler/index.js b/sdk/node_modules/@fastify/ajv-compiler/index.js
new file mode 100644
index 00000000..2274766b
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/index.js
@@ -0,0 +1,53 @@
+'use strict'
+
+const AjvReference = Symbol.for('fastify.ajv-compiler.reference')
+const ValidatorCompiler = require('./lib/validator-compiler')
+const SerializerCompiler = require('./lib/serializer-compiler')
+
+function AjvCompiler (opts) {
+ const validatorPool = new Map()
+ const serializerPool = new Map()
+
+ if (opts && opts.jtdSerializer === true) {
+ return function buildSerializerFromPool (externalSchemas, serializerOpts) {
+ const uniqueAjvKey = getPoolKey({}, serializerOpts)
+ if (serializerPool.has(uniqueAjvKey)) {
+ return serializerPool.get(uniqueAjvKey)
+ }
+
+ const compiler = new SerializerCompiler(externalSchemas, serializerOpts)
+ const ret = compiler.buildSerializerFunction.bind(compiler)
+ serializerPool.set(uniqueAjvKey, ret)
+
+ return ret
+ }
+ }
+
+ return function buildCompilerFromPool (externalSchemas, options) {
+ const uniqueAjvKey = getPoolKey(externalSchemas, options.customOptions)
+ if (validatorPool.has(uniqueAjvKey)) {
+ return validatorPool.get(uniqueAjvKey)
+ }
+
+ const compiler = new ValidatorCompiler(externalSchemas, options)
+ const ret = compiler.buildValidatorFunction.bind(compiler)
+ validatorPool.set(uniqueAjvKey, ret)
+
+ if (options.customOptions.code !== undefined) {
+ ret[AjvReference] = compiler
+ }
+
+ return ret
+ }
+}
+
+function getPoolKey (externalSchemas, options) {
+ const externals = JSON.stringify(externalSchemas)
+ const ajvConfig = JSON.stringify(options)
+ return `${externals}${ajvConfig}`
+}
+module.exports = AjvCompiler
+module.exports.default = AjvCompiler
+module.exports.AjvCompiler = AjvCompiler
+module.exports.AjvReference = AjvReference
+module.exports.StandaloneValidator = require('./standalone')
diff --git a/sdk/node_modules/@fastify/ajv-compiler/lib/default-ajv-options.js b/sdk/node_modules/@fastify/ajv-compiler/lib/default-ajv-options.js
new file mode 100644
index 00000000..57c1fd8b
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/lib/default-ajv-options.js
@@ -0,0 +1,14 @@
+'use strict'
+
+const fastUri = require('fast-uri')
+
+module.exports = Object.freeze({
+ coerceTypes: 'array',
+ useDefaults: true,
+ removeAdditional: true,
+ uriResolver: fastUri,
+ addUsedSchema: false,
+ // Explicitly set allErrors to `false`.
+ // When set to `true`, a DoS attack is possible.
+ allErrors: false
+})
diff --git a/sdk/node_modules/@fastify/ajv-compiler/lib/serializer-compiler.js b/sdk/node_modules/@fastify/ajv-compiler/lib/serializer-compiler.js
new file mode 100644
index 00000000..9d1298ca
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/lib/serializer-compiler.js
@@ -0,0 +1,27 @@
+'use strict'
+
+const AjvJTD = require('ajv/dist/jtd')
+
+const defaultAjvOptions = require('./default-ajv-options')
+
+class SerializerCompiler {
+ constructor (externalSchemas, options) {
+ this.ajv = new AjvJTD(Object.assign({}, defaultAjvOptions, options))
+
+ /**
+ * https://ajv.js.org/json-type-definition.html#ref-form
+ * Unlike JSON Schema, JTD does not allow to reference:
+ * - any schema fragment other than root level definitions member
+ * - root of the schema - there is another way to define a self-recursive schema (see Example 2)
+ * - another schema file (but you can still combine schemas from multiple files using JavaScript).
+ *
+ * So we ignore the externalSchemas parameter.
+ */
+ }
+
+ buildSerializerFunction ({ schema/*, method, url, httpStatus */ }) {
+ return this.ajv.compileSerializer(schema)
+ }
+}
+
+module.exports = SerializerCompiler
diff --git a/sdk/node_modules/@fastify/ajv-compiler/lib/validator-compiler.js b/sdk/node_modules/@fastify/ajv-compiler/lib/validator-compiler.js
new file mode 100644
index 00000000..890d0041
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/lib/validator-compiler.js
@@ -0,0 +1,58 @@
+'use strict'
+
+const Ajv = require('ajv').default
+const AjvJTD = require('ajv/dist/jtd')
+
+const defaultAjvOptions = require('./default-ajv-options')
+
+class ValidatorCompiler {
+ constructor (externalSchemas, options) {
+ // This instance of Ajv is private
+ // it should not be customized or used
+ if (options.mode === 'JTD') {
+ this.ajv = new AjvJTD(Object.assign({}, defaultAjvOptions, options.customOptions))
+ } else {
+ this.ajv = new Ajv(Object.assign({}, defaultAjvOptions, options.customOptions))
+ }
+
+ let addFormatPlugin = true
+ if (options.plugins && options.plugins.length > 0) {
+ for (const plugin of options.plugins) {
+ if (Array.isArray(plugin)) {
+ addFormatPlugin = addFormatPlugin && plugin[0].name !== 'formatsPlugin'
+ plugin[0](this.ajv, plugin[1])
+ } else {
+ addFormatPlugin = addFormatPlugin && plugin.name !== 'formatsPlugin'
+ plugin(this.ajv)
+ }
+ }
+ }
+
+ if (addFormatPlugin) {
+ require('ajv-formats')(this.ajv)
+ }
+
+ options.onCreate?.(this.ajv)
+
+ const sourceSchemas = Object.values(externalSchemas)
+ for (const extSchema of sourceSchemas) {
+ this.ajv.addSchema(extSchema)
+ }
+ }
+
+ buildValidatorFunction ({ schema/*, method, url, httpPart */ }) {
+ // Ajv does not support compiling two schemas with the same
+ // id inside the same instance. Therefore if we have already
+ // compiled the schema with the given id, we just return it.
+ if (schema.$id) {
+ const stored = this.ajv.getSchema(schema.$id)
+ if (stored) {
+ return stored
+ }
+ }
+
+ return this.ajv.compile(schema)
+ }
+}
+
+module.exports = ValidatorCompiler
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.gitattributes b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.gitattributes
new file mode 100644
index 00000000..a0e7df93
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.gitattributes
@@ -0,0 +1,2 @@
+# Set default behavior to automatically convert line endings
+* text=auto eol=lf
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/.stale.yml b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/.stale.yml
new file mode 100644
index 00000000..2ee12691
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/.stale.yml
@@ -0,0 +1,21 @@
+# Number of days of inactivity before an issue becomes stale
+daysUntilStale: 15
+# Number of days of inactivity before a stale issue is closed
+daysUntilClose: 7
+# Issues with these labels will never be considered stale
+exemptLabels:
+ - "discussion"
+ - "feature request"
+ - "bug"
+ - "help wanted"
+ - "plugin suggestion"
+ - "good first issue"
+# Label to use when marking an issue as stale
+staleLabel: stale
+# Comment to post when marking an issue as stale. Set to `false` to disable
+markComment: >
+ This issue has been automatically marked as stale because it has not had
+ recent activity. It will be closed if no further activity occurs. Thank you
+ for your contributions.
+# Comment to post when closing a stale issue. Set to `false` to disable
+closeComment: false
\ No newline at end of file
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/dependabot.yml b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/dependabot.yml
new file mode 100644
index 00000000..dfa7fa6c
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/dependabot.yml
@@ -0,0 +1,13 @@
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "monthly"
+ open-pull-requests-limit: 10
+
+ - package-ecosystem: "npm"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ open-pull-requests-limit: 10
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/tests_checker.yml b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/tests_checker.yml
new file mode 100644
index 00000000..769469b2
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/tests_checker.yml
@@ -0,0 +1,8 @@
+comment: |
+ Hello! Thank you for contributing!
+ It appears that you have changed the code, but the tests that verify your change are missing. Could you please add them?
+fileExtensions:
+ - '.ts'
+ - '.js'
+
+testDir: 'test'
\ No newline at end of file
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/workflows/ci.yml b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/workflows/ci.yml
new file mode 100644
index 00000000..babd56de
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/workflows/ci.yml
@@ -0,0 +1,22 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - main
+ - master
+ - next
+ - 'v*'
+ paths-ignore:
+ - 'docs/**'
+ - '*.md'
+ pull_request:
+ paths-ignore:
+ - 'docs/**'
+ - '*.md'
+
+jobs:
+ test:
+ uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
+ with:
+ license-check: true
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/workflows/package-manager-ci.yml b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/workflows/package-manager-ci.yml
new file mode 100644
index 00000000..89d450f7
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.github/workflows/package-manager-ci.yml
@@ -0,0 +1,20 @@
+name: package-manager-ci
+
+on:
+ push:
+ branches:
+ - main
+ - master
+ - next
+ - 'v*'
+ paths-ignore:
+ - 'docs/**'
+ - '*.md'
+ pull_request:
+ paths-ignore:
+ - 'docs/**'
+ - '*.md'
+
+jobs:
+ test:
+ uses: fastify/workflows/.github/workflows/plugins-ci-package-manager.yml@v3
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.taprc b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.taprc
new file mode 100644
index 00000000..d51127c4
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/.taprc
@@ -0,0 +1 @@
+check-coverage: false
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/LICENSE b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/LICENSE
new file mode 100644
index 00000000..a8d3465e
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c) 2021 The Fastify Team
+Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * The names of any contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ * * *
+
+The complete list of contributors can be found at:
+- https://github.com/garycourt/uri-js/graphs/contributors
\ No newline at end of file
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/README.md b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/README.md
new file mode 100644
index 00000000..fe12d92c
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/README.md
@@ -0,0 +1,125 @@
+# fast-uri
+
+
+
+[](https://github.com/fastify/fast-uri/actions/workflows/ci.yml)
+[](https://standardjs.com/)
+
+
+
+Dependency free RFC 3986 URI toolbox.
+
+## Usage
+
+## Options
+
+All of the above functions can accept an additional options argument that is an object that can contain one or more of the following properties:
+
+* `scheme` (string)
+ Indicates the scheme that the URI should be treated as, overriding the URI's normal scheme parsing behavior.
+
+* `reference` (string)
+ If set to `"suffix"`, it indicates that the URI is in the suffix format and the parser will use the option's `scheme` property to determine the URI's scheme.
+
+* `tolerant` (boolean, false)
+ If set to `true`, the parser will relax URI resolving rules.
+
+* `absolutePath` (boolean, false)
+ If set to `true`, the serializer will not resolve a relative `path` component.
+
+* `unicodeSupport` (boolean, false)
+ If set to `true`, the parser will unescape non-ASCII characters in the parsed output as per [RFC 3987](http://www.ietf.org/rfc/rfc3987.txt).
+
+* `domainHost` (boolean, false)
+ If set to `true`, the library will treat the `host` component as a domain name, and convert IDNs (International Domain Names) as per [RFC 5891](http://www.ietf.org/rfc/rfc5891.txt).
+
+### Parse
+
+```js
+const uri = require('fast-uri')
+uri.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body')
+// Output
+{
+ scheme : "uri",
+ userinfo : "user:pass",
+ host : "example.com",
+ port : 123,
+ path : "/one/two.three",
+ query : "q1=a1&q2=a2",
+ fragment : "body"
+}
+```
+
+### Serialize
+
+```js
+const uri = require('fast-uri')
+uri.serialize({scheme : "http", host : "example.com", fragment : "footer"})
+// Output
+"http://example.com/#footer"
+
+```
+
+### Resolve
+
+```js
+const uri = require('fast-uri')
+uri.resolve("uri://a/b/c/d?q", "../../g")
+// Output
+"uri://a/g"
+```
+
+### Equal
+
+```js
+const uri = require('fast-uri')
+uri.equal("example://a/b/c/%7Bfoo%7D", "eXAMPLE://a/./b/../b/%63/%7bfoo%7d")
+// Output
+true
+```
+
+## Scheme supports
+
+fast-uri supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_scheme) dependent processing rules. Currently, fast-uri has built in support for the following schemes:
+
+* http \[[RFC 2616](http://www.ietf.org/rfc/rfc2616.txt)\]
+* https \[[RFC 2818](http://www.ietf.org/rfc/rfc2818.txt)\]
+* ws \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\]
+* wss \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\]
+* urn \[[RFC 2141](http://www.ietf.org/rfc/rfc2141.txt)\]
+* urn:uuid \[[RFC 4122](http://www.ietf.org/rfc/rfc4122.txt)\]
+
+
+## Benchmarks
+
+```
+fast-uri: parse domain x 1,306,864 ops/sec ±0.31% (100 runs sampled)
+urijs: parse domain x 483,001 ops/sec ±0.09% (99 runs sampled)
+WHATWG URL: parse domain x 862,461 ops/sec ±0.18% (97 runs sampled)
+fast-uri: parse IPv4 x 2,381,452 ops/sec ±0.26% (96 runs sampled)
+urijs: parse IPv4 x 384,705 ops/sec ±0.34% (99 runs sampled)
+WHATWG URL: parse IPv4 NOT SUPPORTED
+fast-uri: parse IPv6 x 923,519 ops/sec ±0.09% (100 runs sampled)
+urijs: parse IPv6 x 289,070 ops/sec ±0.07% (95 runs sampled)
+WHATWG URL: parse IPv6 NOT SUPPORTED
+fast-uri: parse URN x 2,596,395 ops/sec ±0.42% (98 runs sampled)
+urijs: parse URN x 1,152,412 ops/sec ±0.09% (97 runs sampled)
+WHATWG URL: parse URN x 1,183,307 ops/sec ±0.38% (100 runs sampled)
+fast-uri: parse URN uuid x 1,666,861 ops/sec ±0.10% (98 runs sampled)
+urijs: parse URN uuid x 852,724 ops/sec ±0.17% (95 runs sampled)
+WHATWG URL: parse URN uuid NOT SUPPORTED
+fast-uri: serialize uri x 1,741,499 ops/sec ±0.57% (95 runs sampled)
+urijs: serialize uri x 389,014 ops/sec ±0.28% (93 runs sampled)
+fast-uri: serialize IPv6 x 441,095 ops/sec ±0.37% (97 runs sampled)
+urijs: serialize IPv6 x 255,443 ops/sec ±0.58% (94 runs sampled)
+fast-uri: serialize ws x 1,448,667 ops/sec ±0.25% (97 runs sampled)
+urijs: serialize ws x 352,884 ops/sec ±0.08% (96 runs sampled)
+fast-uri: resolve x 340,084 ops/sec ±0.98% (98 runs sampled)
+urijs: resolve x 225,759 ops/sec ±0.37% (95 runs sampled)
+```
+
+## TODO
+
+- [ ] Support MailTo
+- [ ] Be 100% iso compatible with uri-js
+- [ ] Add browser test stack
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/benchmark.js b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/benchmark.js
new file mode 100644
index 00000000..5eed73e0
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/benchmark.js
@@ -0,0 +1,105 @@
+'use strict'
+
+const benchmark = require('benchmark')
+const suite = new benchmark.Suite()
+const fasturi = require('./')
+const urijs = require('uri-js')
+
+const base = 'uri://a/b/c/d;p?q'
+
+const domain = 'https://example.com/foo#bar$fiz'
+const ipv4 = '//10.10.10.10'
+const ipv6 = '//[2001:db8::7]'
+const urn = 'urn:foo:a123,456'
+const urnuuid = 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
+
+// Initialization as there is a lot to parse at first
+// eg: regexes
+fasturi.parse(domain)
+urijs.parse(domain)
+
+suite.add('fast-uri: parse domain', function () {
+ fasturi.parse(domain)
+})
+suite.add('urijs: parse domain', function () {
+ urijs.parse(domain)
+})
+suite.add('WHATWG URL: parse domain', function () {
+ // eslint-disable-next-line
+ new URL(domain)
+})
+suite.add('fast-uri: parse IPv4', function () {
+ fasturi.parse(ipv4)
+})
+suite.add('urijs: parse IPv4', function () {
+ urijs.parse(ipv4)
+})
+suite.add('fast-uri: parse IPv6', function () {
+ fasturi.parse(ipv6)
+})
+suite.add('urijs: parse IPv6', function () {
+ urijs.parse(ipv6)
+})
+suite.add('fast-uri: parse URN', function () {
+ fasturi.parse(urn)
+})
+suite.add('urijs: parse URN', function () {
+ urijs.parse(urn)
+})
+suite.add('WHATWG URL: parse URN', function () {
+ // eslint-disable-next-line
+ new URL(urn)
+})
+suite.add('fast-uri: parse URN uuid', function () {
+ fasturi.parse(urnuuid)
+})
+suite.add('urijs: parse URN uuid', function () {
+ urijs.parse(urnuuid)
+})
+suite.add('fast-uri: serialize uri', function () {
+ fasturi.serialize({
+ scheme: 'uri',
+ userinfo: 'foo:bar',
+ host: 'example.com',
+ port: 1,
+ path: 'path',
+ query: 'query',
+ fragment: 'fragment'
+ })
+})
+suite.add('urijs: serialize uri', function () {
+ urijs.serialize({
+ scheme: 'uri',
+ userinfo: 'foo:bar',
+ host: 'example.com',
+ port: 1,
+ path: 'path',
+ query: 'query',
+ fragment: 'fragment'
+ })
+})
+suite.add('fast-uri: serialize IPv6', function () {
+ fasturi.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' })
+})
+suite.add('urijs: serialize IPv6', function () {
+ urijs.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' })
+})
+suite.add('fast-uri: serialize ws', function () {
+ fasturi.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true })
+})
+suite.add('urijs: serialize ws', function () {
+ urijs.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true })
+})
+suite.add('fast-uri: resolve', function () {
+ fasturi.resolve(base, '../../../g')
+})
+suite.add('urijs: resolve', function () {
+ urijs.resolve(base, '../../../g')
+})
+suite.on('cycle', cycle)
+
+suite.run()
+
+function cycle (e) {
+ console.log(e.target.toString())
+}
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/index.js b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/index.js
new file mode 100644
index 00000000..a2cd183c
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/index.js
@@ -0,0 +1,304 @@
+'use strict'
+
+const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = require('./lib/utils')
+const SCHEMES = require('./lib/schemes')
+
+function normalize (uri, options) {
+ if (typeof uri === 'string') {
+ uri = serialize(parse(uri, options), options)
+ } else if (typeof uri === 'object') {
+ uri = parse(serialize(uri, options), options)
+ }
+ return uri
+}
+
+function resolve (baseURI, relativeURI, options) {
+ const schemelessOptions = Object.assign({ scheme: 'null' }, options)
+ const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true)
+ return serialize(resolved, { ...schemelessOptions, skipEscape: true })
+}
+
+function resolveComponents (base, relative, options, skipNormalization) {
+ const target = {}
+ if (!skipNormalization) {
+ base = parse(serialize(base, options), options) // normalize base components
+ relative = parse(serialize(relative, options), options) // normalize relative components
+ }
+ options = options || {}
+
+ if (!options.tolerant && relative.scheme) {
+ target.scheme = relative.scheme
+ // target.authority = relative.authority;
+ target.userinfo = relative.userinfo
+ target.host = relative.host
+ target.port = relative.port
+ target.path = removeDotSegments(relative.path || '')
+ target.query = relative.query
+ } else {
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
+ // target.authority = relative.authority;
+ target.userinfo = relative.userinfo
+ target.host = relative.host
+ target.port = relative.port
+ target.path = removeDotSegments(relative.path || '')
+ target.query = relative.query
+ } else {
+ if (!relative.path) {
+ target.path = base.path
+ if (relative.query !== undefined) {
+ target.query = relative.query
+ } else {
+ target.query = base.query
+ }
+ } else {
+ if (relative.path.charAt(0) === '/') {
+ target.path = removeDotSegments(relative.path)
+ } else {
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
+ target.path = '/' + relative.path
+ } else if (!base.path) {
+ target.path = relative.path
+ } else {
+ target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path
+ }
+ target.path = removeDotSegments(target.path)
+ }
+ target.query = relative.query
+ }
+ // target.authority = base.authority;
+ target.userinfo = base.userinfo
+ target.host = base.host
+ target.port = base.port
+ }
+ target.scheme = base.scheme
+ }
+
+ target.fragment = relative.fragment
+
+ return target
+}
+
+function equal (uriA, uriB, options) {
+ if (typeof uriA === 'string') {
+ uriA = unescape(uriA)
+ uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true })
+ } else if (typeof uriA === 'object') {
+ uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true })
+ }
+
+ if (typeof uriB === 'string') {
+ uriB = unescape(uriB)
+ uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true })
+ } else if (typeof uriB === 'object') {
+ uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true })
+ }
+
+ return uriA.toLowerCase() === uriB.toLowerCase()
+}
+
+function serialize (cmpts, opts) {
+ const components = {
+ host: cmpts.host,
+ scheme: cmpts.scheme,
+ userinfo: cmpts.userinfo,
+ port: cmpts.port,
+ path: cmpts.path,
+ query: cmpts.query,
+ nid: cmpts.nid,
+ nss: cmpts.nss,
+ uuid: cmpts.uuid,
+ fragment: cmpts.fragment,
+ reference: cmpts.reference,
+ resourceName: cmpts.resourceName,
+ secure: cmpts.secure,
+ error: ''
+ }
+ const options = Object.assign({}, opts)
+ const uriTokens = []
+
+ // find scheme handler
+ const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()]
+
+ // perform scheme specific serialization
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options)
+
+ if (components.path !== undefined) {
+ if (!options.skipEscape) {
+ components.path = escape(components.path)
+
+ if (components.scheme !== undefined) {
+ components.path = components.path.split('%3A').join(':')
+ }
+ } else {
+ components.path = unescape(components.path)
+ }
+ }
+
+ if (options.reference !== 'suffix' && components.scheme) {
+ uriTokens.push(components.scheme)
+ uriTokens.push(':')
+ }
+
+ const authority = recomposeAuthority(components, options)
+ if (authority !== undefined) {
+ if (options.reference !== 'suffix') {
+ uriTokens.push('//')
+ }
+
+ uriTokens.push(authority)
+
+ if (components.path && components.path.charAt(0) !== '/') {
+ uriTokens.push('/')
+ }
+ }
+ if (components.path !== undefined) {
+ let s = components.path
+
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
+ s = removeDotSegments(s)
+ }
+
+ if (authority === undefined) {
+ s = s.replace(/^\/\//u, '/%2F') // don't allow the path to start with "//"
+ }
+
+ uriTokens.push(s)
+ }
+
+ if (components.query !== undefined) {
+ uriTokens.push('?')
+ uriTokens.push(components.query)
+ }
+
+ if (components.fragment !== undefined) {
+ uriTokens.push('#')
+ uriTokens.push(components.fragment)
+ }
+ return uriTokens.join('')
+}
+
+const hexLookUp = Array.from({ length: 127 }, (v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)))
+
+function nonSimpleDomain (value) {
+ let code = 0
+ for (let i = 0, len = value.length; i < len; ++i) {
+ code = value.charCodeAt(i)
+ if (code > 126 || hexLookUp[code]) {
+ return true
+ }
+ }
+ return false
+}
+
+const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u
+
+function parse (uri, opts) {
+ const options = Object.assign({}, opts)
+ const parsed = {
+ scheme: undefined,
+ userinfo: undefined,
+ host: '',
+ port: undefined,
+ path: '',
+ query: undefined,
+ fragment: undefined
+ }
+ const gotEncoding = uri.indexOf('%') !== -1
+ if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri
+
+ const matches = uri.match(URI_PARSE)
+
+ if (matches) {
+ // store each component
+ parsed.scheme = matches[1]
+ parsed.userinfo = matches[3]
+ parsed.host = matches[4]
+ parsed.port = parseInt(matches[5], 10)
+ parsed.path = matches[6] || ''
+ parsed.query = matches[7]
+ parsed.fragment = matches[8]
+
+ // fix port number
+ if (isNaN(parsed.port)) {
+ parsed.port = matches[5]
+ }
+ if (parsed.host) {
+ const ipv4result = normalizeIPv4(parsed.host)
+ if (ipv4result.isIPV4 === false) {
+ parsed.host = normalizeIPv6(ipv4result.host, { isIPV4: false }).host.toLowerCase()
+ } else {
+ parsed.host = ipv4result.host
+ }
+ }
+ if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && !parsed.path && parsed.query === undefined) {
+ parsed.reference = 'same-document'
+ } else if (parsed.scheme === undefined) {
+ parsed.reference = 'relative'
+ } else if (parsed.fragment === undefined) {
+ parsed.reference = 'absolute'
+ } else {
+ parsed.reference = 'uri'
+ }
+
+ // check for reference errors
+ if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
+ parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.'
+ }
+
+ // find scheme handler
+ const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()]
+
+ // check if scheme can't handle IRIs
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
+ // if host component is a domain name
+ if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && nonSimpleDomain(parsed.host)) {
+ // convert Unicode IDN -> ASCII IDN
+ try {
+ parsed.host = URL.domainToASCII(parsed.host.toLowerCase())
+ } catch (e) {
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e
+ }
+ }
+ // convert IRI -> URI
+ }
+
+ if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
+ if (gotEncoding && parsed.scheme !== undefined) {
+ parsed.scheme = unescape(parsed.scheme)
+ }
+ if (gotEncoding && parsed.userinfo !== undefined) {
+ parsed.userinfo = unescape(parsed.userinfo)
+ }
+ if (gotEncoding && parsed.host !== undefined) {
+ parsed.host = unescape(parsed.host)
+ }
+ if (parsed.path !== undefined && parsed.path.length) {
+ parsed.path = escape(unescape(parsed.path))
+ }
+ if (parsed.fragment !== undefined && parsed.fragment.length) {
+ parsed.fragment = encodeURI(decodeURI(parsed.fragment))
+ }
+ }
+
+ // perform scheme specific parsing
+ if (schemeHandler && schemeHandler.parse) {
+ schemeHandler.parse(parsed, options)
+ }
+ } else {
+ parsed.error = parsed.error || 'URI can not be parsed.'
+ }
+ return parsed
+}
+
+const fastUri = {
+ normalize,
+ resolve,
+ resolveComponents,
+ equal,
+ serialize,
+ parse
+}
+
+module.exports = fastUri
+module.exports.default = fastUri
+module.exports.fastUri = fastUri
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/lib/schemes.js b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/lib/schemes.js
new file mode 100644
index 00000000..45d06fe3
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/lib/schemes.js
@@ -0,0 +1,188 @@
+'use strict'
+
+const UUID_REG = /^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu
+const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu
+
+function isSecure (wsComponents) {
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
+}
+
+function httpParse (components) {
+ if (!components.host) {
+ components.error = components.error || 'HTTP URIs must have a host.'
+ }
+
+ return components
+}
+
+function httpSerialize (components) {
+ const secure = String(components.scheme).toLowerCase() === 'https'
+
+ // normalize the default port
+ if (components.port === (secure ? 443 : 80) || components.port === '') {
+ components.port = undefined
+ }
+
+ // normalize the empty path
+ if (!components.path) {
+ components.path = '/'
+ }
+
+ // NOTE: We do not parse query strings for HTTP URIs
+ // as WWW Form Url Encoded query strings are part of the HTML4+ spec,
+ // and not the HTTP spec.
+
+ return components
+}
+
+function wsParse (wsComponents) {
+// indicate if the secure flag is set
+ wsComponents.secure = isSecure(wsComponents)
+
+ // construct resouce name
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '')
+ wsComponents.path = undefined
+ wsComponents.query = undefined
+
+ return wsComponents
+}
+
+function wsSerialize (wsComponents) {
+// normalize the default port
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
+ wsComponents.port = undefined
+ }
+
+ // ensure scheme matches secure flag
+ if (typeof wsComponents.secure === 'boolean') {
+ wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws')
+ wsComponents.secure = undefined
+ }
+
+ // reconstruct path from resource name
+ if (wsComponents.resourceName) {
+ const [path, query] = wsComponents.resourceName.split('?')
+ wsComponents.path = (path && path !== '/' ? path : undefined)
+ wsComponents.query = query
+ wsComponents.resourceName = undefined
+ }
+
+ // forbid fragment component
+ wsComponents.fragment = undefined
+
+ return wsComponents
+}
+
+function urnParse (urnComponents, options) {
+ if (!urnComponents.path) {
+ urnComponents.error = 'URN can not be parsed'
+ return urnComponents
+ }
+ const matches = urnComponents.path.match(URN_REG)
+ if (matches) {
+ const scheme = options.scheme || urnComponents.scheme || 'urn'
+ urnComponents.nid = matches[1].toLowerCase()
+ urnComponents.nss = matches[2]
+ const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`
+ const schemeHandler = SCHEMES[urnScheme]
+ urnComponents.path = undefined
+
+ if (schemeHandler) {
+ urnComponents = schemeHandler.parse(urnComponents, options)
+ }
+ } else {
+ urnComponents.error = urnComponents.error || 'URN can not be parsed.'
+ }
+
+ return urnComponents
+}
+
+function urnSerialize (urnComponents, options) {
+ const scheme = options.scheme || urnComponents.scheme || 'urn'
+ const nid = urnComponents.nid.toLowerCase()
+ const urnScheme = `${scheme}:${options.nid || nid}`
+ const schemeHandler = SCHEMES[urnScheme]
+
+ if (schemeHandler) {
+ urnComponents = schemeHandler.serialize(urnComponents, options)
+ }
+
+ const uriComponents = urnComponents
+ const nss = urnComponents.nss
+ uriComponents.path = `${nid || options.nid}:${nss}`
+
+ options.skipEscape = true
+ return uriComponents
+}
+
+function urnuuidParse (urnComponents, options) {
+ const uuidComponents = urnComponents
+ uuidComponents.uuid = uuidComponents.nss
+ uuidComponents.nss = undefined
+
+ if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
+ uuidComponents.error = uuidComponents.error || 'UUID is not valid.'
+ }
+
+ return uuidComponents
+}
+
+function urnuuidSerialize (uuidComponents) {
+ const urnComponents = uuidComponents
+ // normalize UUID
+ urnComponents.nss = (uuidComponents.uuid || '').toLowerCase()
+ return urnComponents
+}
+
+const http = {
+ scheme: 'http',
+ domainHost: true,
+ parse: httpParse,
+ serialize: httpSerialize
+}
+
+const https = {
+ scheme: 'https',
+ domainHost: http.domainHost,
+ parse: httpParse,
+ serialize: httpSerialize
+}
+
+const ws = {
+ scheme: 'ws',
+ domainHost: true,
+ parse: wsParse,
+ serialize: wsSerialize
+}
+
+const wss = {
+ scheme: 'wss',
+ domainHost: ws.domainHost,
+ parse: ws.parse,
+ serialize: ws.serialize
+}
+
+const urn = {
+ scheme: 'urn',
+ parse: urnParse,
+ serialize: urnSerialize,
+ skipNormalize: true
+}
+
+const urnuuid = {
+ scheme: 'urn:uuid',
+ parse: urnuuidParse,
+ serialize: urnuuidSerialize,
+ skipNormalize: true
+}
+
+const SCHEMES = {
+ http,
+ https,
+ ws,
+ wss,
+ urn,
+ 'urn:uuid': urnuuid
+}
+
+module.exports = SCHEMES
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/lib/scopedChars.js b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/lib/scopedChars.js
new file mode 100644
index 00000000..d4a61103
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/lib/scopedChars.js
@@ -0,0 +1,30 @@
+'use strict'
+
+const HEX = {
+ 0: 0,
+ 1: 1,
+ 2: 2,
+ 3: 3,
+ 4: 4,
+ 5: 5,
+ 6: 6,
+ 7: 7,
+ 8: 8,
+ 9: 9,
+ a: 10,
+ A: 10,
+ b: 11,
+ B: 11,
+ c: 12,
+ C: 12,
+ d: 13,
+ D: 13,
+ e: 14,
+ E: 14,
+ f: 15,
+ F: 15
+}
+
+module.exports = {
+ HEX
+}
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/lib/utils.js b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/lib/utils.js
new file mode 100644
index 00000000..78134c62
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/lib/utils.js
@@ -0,0 +1,236 @@
+'use strict'
+
+const { HEX } = require('./scopedChars')
+
+function normalizeIPv4 (host) {
+ if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
+ const matches = host.match(/^(\b[01]?\d{1,2}|\b2[0-4]\d|\b25[0-5])(\.([01]?\d{1,2}|2[0-4]\d|25[0-5])){3}$/u) || []
+ const [address] = matches
+ if (address) {
+ return { host: stripLeadingZeros(address, '.'), isIPV4: true }
+ } else {
+ return { host, isIPV4: false }
+ }
+}
+
+function stringToHexStripped (input) {
+ let acc = ''
+ let strip = true
+ for (const c of input) {
+ if (c !== '0' && strip === true) strip = false
+ if (HEX[c] === undefined) return undefined
+ if (!strip) acc += c
+ }
+ return acc
+}
+
+function getIPV6 (input) {
+ let tokenCount = 0
+ const output = { error: false, address: '', zone: '' }
+ const address = []
+ const buffer = []
+ let isZone = false
+ let endipv6Encountered = false
+ let endIpv6 = false
+
+ function consume () {
+ if (buffer.length) {
+ if (isZone === false) {
+ const hex = stringToHexStripped(buffer.join(''))
+ if (hex !== undefined) {
+ address.push(hex)
+ } else {
+ output.error = true
+ return false
+ }
+ }
+ buffer.length = 0
+ }
+ return true
+ }
+
+ for (let i = 0; i < input.length; i++) {
+ const cursor = input[i]
+ if (cursor === '[' || cursor === ']') { continue }
+ if (cursor === ':') {
+ if (endipv6Encountered === true) {
+ endIpv6 = true
+ }
+ if (!consume()) { break }
+ tokenCount++
+ address.push(':')
+ if (tokenCount > 7) {
+ // not valid
+ output.error = true
+ break
+ }
+ if (i - 1 >= 0 && input[i - 1] === ':') {
+ endipv6Encountered = true
+ }
+ continue
+ } else if (cursor === '%') {
+ if (!consume()) { break }
+ // switch to zone detection
+ isZone = true
+ } else {
+ buffer.push(cursor)
+ continue
+ }
+ }
+ if (buffer.length) {
+ if (isZone) {
+ output.zone = buffer.join('')
+ } else if (endIpv6) {
+ address.push(buffer.join(''))
+ } else {
+ address.push(stringToHexStripped(buffer.join('')))
+ }
+ }
+ output.address = address.join('')
+ return output
+}
+
+function normalizeIPv6 (host, opts = {}) {
+ if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
+ const ipv6 = getIPV6(host)
+
+ if (!ipv6.error) {
+ let newHost = ipv6.address
+ let escapedHost = ipv6.address
+ if (ipv6.zone) {
+ newHost += '%' + ipv6.zone
+ escapedHost += '%25' + ipv6.zone
+ }
+ return { host: newHost, escapedHost, isIPV6: true }
+ } else {
+ return { host, isIPV6: false }
+ }
+}
+
+function stripLeadingZeros (str, token) {
+ let out = ''
+ let skip = true
+ const l = str.length
+ for (let i = 0; i < l; i++) {
+ const c = str[i]
+ if (c === '0' && skip) {
+ if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
+ out += c
+ skip = false
+ }
+ } else {
+ if (c === token) {
+ skip = true
+ } else {
+ skip = false
+ }
+ out += c
+ }
+ }
+ return out
+}
+
+function findToken (str, token) {
+ let ind = 0
+ for (let i = 0; i < str.length; i++) {
+ if (str[i] === token) ind++
+ }
+ return ind
+}
+
+const RDS1 = /^\.\.?\//u
+const RDS2 = /^\/\.(?:\/|$)/u
+const RDS3 = /^\/\.\.(?:\/|$)/u
+const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u
+
+function removeDotSegments (input) {
+ const output = []
+
+ while (input.length) {
+ if (input.match(RDS1)) {
+ input = input.replace(RDS1, '')
+ } else if (input.match(RDS2)) {
+ input = input.replace(RDS2, '/')
+ } else if (input.match(RDS3)) {
+ input = input.replace(RDS3, '/')
+ output.pop()
+ } else if (input === '.' || input === '..') {
+ input = ''
+ } else {
+ const im = input.match(RDS5)
+ if (im) {
+ const s = im[0]
+ input = input.slice(s.length)
+ output.push(s)
+ } else {
+ throw new Error('Unexpected dot segment condition')
+ }
+ }
+ }
+ return output.join('')
+}
+
+function normalizeComponentEncoding (components, esc) {
+ const func = esc !== true ? escape : unescape
+ if (components.scheme !== undefined) {
+ components.scheme = func(components.scheme)
+ }
+ if (components.userinfo !== undefined) {
+ components.userinfo = func(components.userinfo)
+ }
+ if (components.host !== undefined) {
+ components.host = func(components.host)
+ }
+ if (components.path !== undefined) {
+ components.path = func(components.path)
+ }
+ if (components.query !== undefined) {
+ components.query = func(components.query)
+ }
+ if (components.fragment !== undefined) {
+ components.fragment = func(components.fragment)
+ }
+ return components
+}
+
+function recomposeAuthority (components, options) {
+ const uriTokens = []
+
+ if (components.userinfo !== undefined) {
+ uriTokens.push(components.userinfo)
+ uriTokens.push('@')
+ }
+
+ if (components.host !== undefined) {
+ let host = unescape(components.host)
+ const ipV4res = normalizeIPv4(host)
+
+ if (ipV4res.isIPV4) {
+ host = ipV4res.host
+ } else {
+ const ipV6res = normalizeIPv6(ipV4res.host, { isIPV4: false })
+ if (ipV6res.isIPV6 === true) {
+ host = `[${ipV6res.escapedHost}]`
+ } else {
+ host = components.host
+ }
+ }
+ uriTokens.push(host)
+ }
+
+ if (typeof components.port === 'number' || typeof components.port === 'string') {
+ uriTokens.push(':')
+ uriTokens.push(String(components.port))
+ }
+
+ return uriTokens.length ? uriTokens.join('') : undefined
+};
+
+module.exports = {
+ recomposeAuthority,
+ normalizeComponentEncoding,
+ removeDotSegments,
+ normalizeIPv4,
+ normalizeIPv6,
+ stringToHexStripped
+}
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/package.json b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/package.json
new file mode 100644
index 00000000..44e13dfa
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "fast-uri",
+ "description": "Dependency free RFC 3986 URI toolbox",
+ "version": "2.4.0",
+ "main": "index.js",
+ "type": "commonjs",
+ "types": "types/index.d.ts",
+ "license": "MIT",
+ "author": "Vincent Le Goff (https://github.com/zekth)",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/fastify/fast-uri.git"
+ },
+ "bugs": {
+ "url": "https://github.com/fastify/fast-uri/issues"
+ },
+ "homepage": "https://github.com/fastify/fast-uri",
+ "scripts": {
+ "bench": "node benchmark.js",
+ "lint:fix": "standard --fix",
+ "test:lint": "standard | snazzy",
+ "test:typescript": "tsd",
+ "test:unit": "tap -J test/*.test.js",
+ "test:unit:dev": "tap -J test/*.test.js --coverage-report=html",
+ "test": "npm run test:lint && npm run test:unit && npm run test:typescript",
+ "test:ci": "npm run test:lint && npm run test:unit -- --cov --coverage-report=lcovonly && npm run test:typescript"
+ },
+ "devDependencies": {
+ "benchmark": "^2.1.4",
+ "coveralls": "^3.1.1",
+ "snazzy": "^9.0.0",
+ "standard": "^17.0.0",
+ "tap": "^16.0.0",
+ "tsd": "^0.31.0",
+ "uri-js": "^4.4.1"
+ }
+}
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/.gitkeep b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/compatibility.test.js b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/compatibility.test.js
new file mode 100644
index 00000000..5c5edc49
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/compatibility.test.js
@@ -0,0 +1,130 @@
+'use strict'
+
+const tap = require('tap')
+const test = tap.test
+const fastifyURI = require('../')
+const urijs = require('uri-js')
+
+test('compatibility Parse', (t) => {
+ const toParse = [
+ '//www.g.com/error\n/bleh/bleh',
+ 'https://fastify.org',
+ '/definitions/Record%3Cstring%2CPerson%3E',
+ '//10.10.10.10',
+ '//10.10.000.10',
+ '//[2001:db8::7%en0]',
+ '//[2001:dbZ::1]:80',
+ '//[2001:db8::1]:80',
+ '//[2001:db8::001]:80',
+ 'uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body',
+ 'http://user:pass@example.com:123/one/space in.url?q1=a1&q2=a2#body',
+ '//[::ffff:129.144.52.38]',
+ 'uri://10.10.10.10.example.com/en/process',
+ '//[2606:2800:220:1:248:1893:25c8:1946]/test',
+ 'ws://example.com/chat',
+ 'ws://example.com/foo?bar=baz',
+ 'wss://example.com/?bar=baz',
+ 'wss://example.com/chat',
+ 'wss://example.com/foo?bar=baz',
+ 'wss://example.com/?bar=baz',
+ 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6',
+ 'urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6',
+ 'urn:example:%D0%B0123,z456',
+ '//[2606:2800:220:1:248:1893:25c8:1946:43209]',
+ 'http://foo.bar',
+ 'http://',
+ '#/$defs/stringMap',
+ '#/$defs/string%20Map',
+ '#/$defs/string Map',
+ '//?json=%7B%22foo%22%3A%22bar%22%7D'
+ // 'mailto:chris@example.com'-203845,
+ // 'mailto:infobot@example.com?subject=current-issue',
+ // 'mailto:infobot@example.com?body=send%20current-issue',
+ // 'mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index',
+ // 'mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E',
+ // 'mailto:majordomo@example.com?body=subscribe%20bamboo-l',
+ // 'mailto:joe@example.com?cc=bob@example.com&body=hello',
+ // 'mailto:gorby%25kremvax@example.com',
+ // 'mailto:unlikely%3Faddress@example.com?blat=foop',
+ // 'mailto:Mike%26family@example.org',
+ // 'mailto:%22not%40me%22@example.org',
+ // 'mailto:%22oh%5C%5Cno%22@example.org',
+ // 'mailto:%22%5C%5C%5C%22it\'s%5C%20ugly%5C%5C%5C%22%22@example.org',
+ // 'mailto:user@example.org?subject=caf%C3%A9',
+ // 'mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D',
+ // 'mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D',
+ // 'mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9',
+ // 'mailto:user@%E7%B4%8D%E8%B1%86.example.org?subject=Test&body=NATTO'
+ ]
+ toParse.forEach((x) => {
+ t.same(fastifyURI.parse(x), urijs.parse(x), 'Compatibility parse: ' + x)
+ })
+ t.end()
+})
+
+test('compatibility serialize', (t) => {
+ const toSerialize = [
+ { host: '10.10.10.10.example.com' },
+ { host: '2001:db8::7' },
+ { host: '::ffff:129.144.52.38' },
+ { host: '2606:2800:220:1:248:1893:25c8:1946' },
+ { host: '10.10.10.10.example.com' },
+ { host: '10.10.10.10' },
+ { path: '?query' },
+ { path: 'foo:bar' },
+ { path: '//path' },
+ {
+ scheme: 'uri',
+ host: 'example.com',
+ port: '9000'
+ },
+ {
+ scheme: 'uri',
+ userinfo: 'foo:bar',
+ host: 'example.com',
+ port: 1,
+ path: 'path',
+ query: 'query',
+ fragment: 'fragment'
+ },
+ {
+ scheme: '',
+ userinfo: '',
+ host: '',
+ port: 0,
+ path: '',
+ query: '',
+ fragment: ''
+ },
+ {
+ scheme: undefined,
+ userinfo: undefined,
+ host: undefined,
+ port: undefined,
+ path: undefined,
+ query: undefined,
+ fragment: undefined
+ },
+ { host: 'fe80::a%en1' },
+ { host: 'fe80::a%25en1' },
+ {
+ scheme: 'ws',
+ host: 'example.com',
+ resourceName: '/foo?bar',
+ secure: true
+ },
+ {
+ scheme: 'scheme',
+ path: 'with:colon'
+ }
+ ]
+ toSerialize.forEach((x) => {
+ const r = JSON.stringify(x)
+ t.same(
+ fastifyURI.serialize(x),
+ urijs.serialize(x),
+ 'Compatibility serialize: ' + JSON.stringify(r)
+ )
+ })
+ t.end()
+})
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/equal.test.js b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/equal.test.js
new file mode 100644
index 00000000..69783de8
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/equal.test.js
@@ -0,0 +1,104 @@
+'use strict'
+
+const tap = require('tap')
+const test = tap.test
+const URI = require('../')
+
+const fn = URI.equal
+const runTest = (t, suite) => {
+ suite.forEach(s => {
+ const operator = s.result ? '==' : '!='
+ t.equal(fn(s.pair[0], s.pair[1]), s.result, `${s.pair[0]} ${operator} ${s.pair[1]}`)
+ t.equal(fn(s.pair[1], s.pair[0]), s.result, `${s.pair[1]} ${operator} ${s.pair[0]}`)
+ })
+}
+
+test('URI Equals', (t) => {
+ const suite = [
+ { pair: ['example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'], result: true }, // test from RFC 3986
+ { pair: ['http://example.org/~user', 'http://example.org/%7euser'], result: true } // test from RFC 3987
+ ]
+ runTest(t, suite)
+ t.end()
+})
+
+// test('IRI Equals', (t) => {
+// // example from RFC 3987
+// t.equal(URI.equal('example://a/b/c/%7Bfoo%7D/ros\xE9', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9', IRI_OPTION), true)
+// t.end()
+// })
+
+test('HTTP Equals', (t) => {
+ const suite = [
+ // test from RFC 2616
+ { pair: ['http://abc.com:80/~smith/home.html', 'http://abc.com/~smith/home.html'], result: true },
+ { pair: [{ scheme: 'http', host: 'abc.com', port: 80, path: '/~smith/home.html' }, 'http://abc.com/~smith/home.html'], result: true },
+ { pair: ['http://ABC.com/%7Esmith/home.html', 'http://abc.com/~smith/home.html'], result: true },
+ { pair: ['http://ABC.com:/%7esmith/home.html', 'http://abc.com/~smith/home.html'], result: true },
+ { pair: ['HTTP://ABC.COM', 'http://abc.com/'], result: true },
+ // test from RFC 3986
+ { pair: ['http://example.com:/', 'http://example.com:80/'], result: true }
+ ]
+ runTest(t, suite)
+ t.end()
+})
+
+test('HTTPS Equals', (t) => {
+ const suite = [
+ { pair: ['https://example.com', 'https://example.com:443/'], result: true },
+ { pair: ['https://example.com:/', 'https://example.com:443/'], result: true }
+ ]
+ runTest(t, suite)
+ t.end()
+})
+
+test('URN Equals', (t) => {
+ const suite = [
+ // test from RFC 2141
+ { pair: ['urn:foo:a123,456', 'urn:foo:a123,456'], result: true },
+ { pair: ['urn:foo:a123,456', 'URN:foo:a123,456'], result: true },
+ { pair: ['urn:foo:a123,456', 'urn:FOO:a123,456'], result: true }
+ ]
+
+ // Disabling for now as the whole equal logic might need
+ // to be refactored
+ // t.equal(URI.equal('urn:foo:a123,456', 'urn:foo:A123,456'), false)
+ // t.equal(URI.equal('urn:foo:a123%2C456', 'URN:FOO:a123%2c456'), true)
+
+ runTest(t, suite)
+ t.end()
+})
+
+test('UUID Equals', (t) => {
+ const suite = [
+ { pair: ['URN:UUID:F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6', 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'], result: true }
+ ]
+
+ runTest(t, suite)
+ t.end()
+})
+
+// test('Mailto Equals', (t) => {
+// // tests from RFC 6068
+// t.equal(URI.equal('mailto:addr1@an.example,addr2@an.example', 'mailto:?to=addr1@an.example,addr2@an.example'), true)
+// t.equal(URI.equal('mailto:?to=addr1@an.example,addr2@an.example', 'mailto:addr1@an.example?to=addr2@an.example'), true)
+// t.end()
+// })
+
+test('WS Equal', (t) => {
+ const suite = [
+ { pair: ['WS://ABC.COM:80/chat#one', 'ws://abc.com/chat'], result: true }
+ ]
+
+ runTest(t, suite)
+ t.end()
+})
+
+test('WSS Equal', (t) => {
+ const suite = [
+ { pair: ['WSS://ABC.COM:443/chat#one', 'wss://abc.com/chat'], result: true }
+ ]
+
+ runTest(t, suite)
+ t.end()
+})
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/parse.test.js b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/parse.test.js
new file mode 100644
index 00000000..2fe21339
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/parse.test.js
@@ -0,0 +1,310 @@
+'use strict'
+
+const tap = require('tap')
+const test = tap.test
+const URI = require('../')
+
+test('URI parse', (t) => {
+ let components
+
+ // scheme
+ components = URI.parse('uri:')
+ t.equal(components.error, undefined, 'scheme errors')
+ t.equal(components.scheme, 'uri', 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // userinfo
+ components = URI.parse('//@')
+ t.equal(components.error, undefined, 'userinfo errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, "@", "authority");
+ t.equal(components.userinfo, '', 'userinfo')
+ t.equal(components.host, '', 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // host
+ components = URI.parse('//')
+ t.equal(components.error, undefined, 'host errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, "", "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, '', 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // port
+ components = URI.parse('//:')
+ t.equal(components.error, undefined, 'port errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, ":", "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, '', 'host')
+ t.equal(components.port, '', 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // path
+ components = URI.parse('')
+ t.equal(components.error, undefined, 'path errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // query
+ components = URI.parse('?')
+ t.equal(components.error, undefined, 'query errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, '', 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // fragment
+ components = URI.parse('#')
+ t.equal(components.error, undefined, 'fragment errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, '', 'fragment')
+
+ // fragment with character tabulation
+ components = URI.parse('#\t')
+ t.equal(components.error, undefined, 'path errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, '%09', 'fragment')
+
+ // fragment with line feed
+ components = URI.parse('#\n')
+ t.equal(components.error, undefined, 'path errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, '%0A', 'fragment')
+
+ // fragment with line tabulation
+ components = URI.parse('#\v')
+ t.equal(components.error, undefined, 'path errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, '%0B', 'fragment')
+
+ // fragment with form feed
+ components = URI.parse('#\f')
+ t.equal(components.error, undefined, 'path errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, '%0C', 'fragment')
+
+ // fragment with carriage return
+ components = URI.parse('#\r')
+ t.equal(components.error, undefined, 'path errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, '%0D', 'fragment')
+
+ // all
+ components = URI.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body')
+ t.equal(components.error, undefined, 'all errors')
+ t.equal(components.scheme, 'uri', 'scheme')
+ // t.equal(components.authority, "user:pass@example.com:123", "authority");
+ t.equal(components.userinfo, 'user:pass', 'userinfo')
+ t.equal(components.host, 'example.com', 'host')
+ t.equal(components.port, 123, 'port')
+ t.equal(components.path, '/one/two.three', 'path')
+ t.equal(components.query, 'q1=a1&q2=a2', 'query')
+ t.equal(components.fragment, 'body', 'fragment')
+
+ // IPv4address
+ components = URI.parse('//10.10.10.10')
+ t.equal(components.error, undefined, 'IPv4address errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, '10.10.10.10', 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // IPv4address with unformated 0
+ components = URI.parse('//10.10.000.10')
+ t.equal(components.error, undefined, 'IPv4address errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, '10.10.0.10', 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // IPv6address
+ components = URI.parse('//[2001:db8::7]')
+ t.equal(components.error, undefined, 'IPv4address errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, '2001:db8::7', 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // invalid IPv6
+ components = URI.parse('//[2001:dbZ::7]')
+ t.equal(components.host, '[2001:dbz::7]')
+
+ // mixed IPv4address & IPv6address
+ components = URI.parse('//[::ffff:129.144.52.38]')
+ t.equal(components.error, undefined, 'IPv4address errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, '::ffff:129.144.52.38', 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
+ components = URI.parse('uri://10.10.10.10.example.com/en/process')
+ t.equal(components.error, undefined, 'mixed errors')
+ t.equal(components.scheme, 'uri', 'scheme')
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, '10.10.10.10.example.com', 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '/en/process', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // IPv6address, example from bkw (https://github.com/garycourt/uri-js/pull/16)
+ components = URI.parse('//[2606:2800:220:1:248:1893:25c8:1946]/test')
+ t.equal(components.error, undefined, 'IPv6address errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, '2606:2800:220:1:248:1893:25c8:1946', 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '/test', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // IPv6address, example from RFC 5952
+ components = URI.parse('//[2001:db8::1]:80')
+ t.equal(components.error, undefined, 'IPv6address errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, '2001:db8::1', 'host')
+ t.equal(components.port, 80, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // IPv6address with zone identifier, RFC 6874
+ components = URI.parse('//[fe80::a%25en1]')
+ t.equal(components.error, undefined, 'IPv4address errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, 'fe80::a%en1', 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // IPv6address with an unescaped interface specifier, example from pekkanikander (https://github.com/garycourt/uri-js/pull/22)
+ components = URI.parse('//[2001:db8::7%en0]')
+ t.equal(components.error, undefined, 'IPv6address interface errors')
+ t.equal(components.scheme, undefined, 'scheme')
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, '2001:db8::7%en0', 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, '', 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+
+ // UUID V1
+ components = URI.parse('urn:uuid:b571b0bc-4713-11ec-81d3-0242ac130003')
+ t.equal(components.error, undefined, 'errors')
+ t.equal(components.scheme, 'urn', 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, undefined, 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+ t.equal(components.nid, 'uuid', 'nid')
+ t.equal(components.nss, undefined, 'nss')
+ t.equal(components.uuid, 'b571b0bc-4713-11ec-81d3-0242ac130003', 'uuid')
+
+ // UUID v4
+ components = URI.parse('urn:uuid:97a32222-89b7-420e-8507-4360723e2c2a')
+ t.equal(components.uuid, '97a32222-89b7-420e-8507-4360723e2c2a', 'uuid')
+
+ components = URI.parse('urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6')
+ t.notSame(components.error, undefined, 'errors')
+
+ components = URI.parse('urn:foo:a123,456')
+ t.equal(components.error, undefined, 'errors')
+ t.equal(components.scheme, 'urn', 'scheme')
+ // t.equal(components.authority, undefined, "authority");
+ t.equal(components.userinfo, undefined, 'userinfo')
+ t.equal(components.host, undefined, 'host')
+ t.equal(components.port, undefined, 'port')
+ t.equal(components.path, undefined, 'path')
+ t.equal(components.query, undefined, 'query')
+ t.equal(components.fragment, undefined, 'fragment')
+ t.equal(components.nid, 'foo', 'nid')
+ t.equal(components.nss, 'a123,456', 'nss')
+
+ components = URI.parse('//[2606:2800:220:1:248:1893:25c8:1946:43209]')
+ t.equal(components.host, '[2606:2800:220:1:248:1893:25c8:1946:43209]')
+
+ components = URI.parse('urn:foo:|\\24fpl')
+ t.equal(components.error, 'URN can not be parsed.')
+ t.end()
+})
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/resolve.test.js b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/resolve.test.js
new file mode 100644
index 00000000..ab38188f
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/resolve.test.js
@@ -0,0 +1,76 @@
+'use strict'
+
+const tap = require('tap')
+const test = tap.test
+const URI = require('../')
+
+test('URI Resolving', (t) => {
+ // normal examples from RFC 3986
+ const base = 'uri://a/b/c/d;p?q'
+ t.equal(URI.resolve(base, 'g:h'), 'g:h', 'g:h')
+ t.equal(URI.resolve(base, 'g:h'), 'g:h', 'g:h')
+ t.equal(URI.resolve(base, 'g'), 'uri://a/b/c/g', 'g')
+ t.equal(URI.resolve(base, './g'), 'uri://a/b/c/g', './g')
+ t.equal(URI.resolve(base, 'g/'), 'uri://a/b/c/g/', 'g/')
+ t.equal(URI.resolve(base, '/g'), 'uri://a/g', '/g')
+ t.equal(URI.resolve(base, '//g'), 'uri://g', '//g')
+ t.equal(URI.resolve(base, '?y'), 'uri://a/b/c/d;p?y', '?y')
+ t.equal(URI.resolve(base, 'g?y'), 'uri://a/b/c/g?y', 'g?y')
+ t.equal(URI.resolve(base, '#s'), 'uri://a/b/c/d;p?q#s', '#s')
+ t.equal(URI.resolve(base, 'g#s'), 'uri://a/b/c/g#s', 'g#s')
+ t.equal(URI.resolve(base, 'g?y#s'), 'uri://a/b/c/g?y#s', 'g?y#s')
+ t.equal(URI.resolve(base, ';x'), 'uri://a/b/c/;x', ';x')
+ t.equal(URI.resolve(base, 'g;x'), 'uri://a/b/c/g;x', 'g;x')
+ t.equal(URI.resolve(base, 'g;x?y#s'), 'uri://a/b/c/g;x?y#s', 'g;x?y#s')
+ t.equal(URI.resolve(base, ''), 'uri://a/b/c/d;p?q', '')
+ t.equal(URI.resolve(base, '.'), 'uri://a/b/c/', '.')
+ t.equal(URI.resolve(base, './'), 'uri://a/b/c/', './')
+ t.equal(URI.resolve(base, '..'), 'uri://a/b/', '..')
+ t.equal(URI.resolve(base, '../'), 'uri://a/b/', '../')
+ t.equal(URI.resolve(base, '../g'), 'uri://a/b/g', '../g')
+ t.equal(URI.resolve(base, '../..'), 'uri://a/', '../..')
+ t.equal(URI.resolve(base, '../../'), 'uri://a/', '../../')
+ t.equal(URI.resolve(base, '../../g'), 'uri://a/g', '../../g')
+
+ // abnormal examples from RFC 3986
+ t.equal(URI.resolve(base, '../../../g'), 'uri://a/g', '../../../g')
+ t.equal(URI.resolve(base, '../../../../g'), 'uri://a/g', '../../../../g')
+
+ t.equal(URI.resolve(base, '/./g'), 'uri://a/g', '/./g')
+ t.equal(URI.resolve(base, '/../g'), 'uri://a/g', '/../g')
+ t.equal(URI.resolve(base, 'g.'), 'uri://a/b/c/g.', 'g.')
+ t.equal(URI.resolve(base, '.g'), 'uri://a/b/c/.g', '.g')
+ t.equal(URI.resolve(base, 'g..'), 'uri://a/b/c/g..', 'g..')
+ t.equal(URI.resolve(base, '..g'), 'uri://a/b/c/..g', '..g')
+
+ t.equal(URI.resolve(base, './../g'), 'uri://a/b/g', './../g')
+ t.equal(URI.resolve(base, './g/.'), 'uri://a/b/c/g/', './g/.')
+ t.equal(URI.resolve(base, 'g/./h'), 'uri://a/b/c/g/h', 'g/./h')
+ t.equal(URI.resolve(base, 'g/../h'), 'uri://a/b/c/h', 'g/../h')
+ t.equal(URI.resolve(base, 'g;x=1/./y'), 'uri://a/b/c/g;x=1/y', 'g;x=1/./y')
+ t.equal(URI.resolve(base, 'g;x=1/../y'), 'uri://a/b/c/y', 'g;x=1/../y')
+
+ t.equal(URI.resolve(base, 'g?y/./x'), 'uri://a/b/c/g?y/./x', 'g?y/./x')
+ t.equal(URI.resolve(base, 'g?y/../x'), 'uri://a/b/c/g?y/../x', 'g?y/../x')
+ t.equal(URI.resolve(base, 'g#s/./x'), 'uri://a/b/c/g#s/./x', 'g#s/./x')
+ t.equal(URI.resolve(base, 'g#s/../x'), 'uri://a/b/c/g#s/../x', 'g#s/../x')
+
+ t.equal(URI.resolve(base, 'uri:g'), 'uri:g', 'uri:g')
+ t.equal(URI.resolve(base, 'uri:g', { tolerant: true }), 'uri://a/b/c/g', 'uri:g')
+
+ // examples by PAEz
+ // example was provided to avoid infinite loop within regex
+ // this is not the case anymore
+ // t.equal(URI.resolve('//www.g.com/', '/adf\ngf'), '//www.g.com/adf%0Agf', '/adf\\ngf')
+ // t.equal(URI.resolve('//www.g.com/error\n/bleh/bleh', '..'), '//www.g.com/error%0A/', '//www.g.com/error\\n/bleh/bleh')
+ t.end()
+})
+
+test('URN Resolving', (t) => {
+ // example from epoberezkin
+ t.equal(URI.resolve('', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
+ t.equal(URI.resolve('#', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
+ t.equal(URI.resolve('urn:some:ip:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
+ t.equal(URI.resolve('urn:some:other:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
+ t.end()
+})
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/serialize.test.js b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/serialize.test.js
new file mode 100644
index 00000000..db84820b
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/test/serialize.test.js
@@ -0,0 +1,144 @@
+'use strict'
+
+const tap = require('tap')
+const test = tap.test
+const URI = require('../')
+
+test('URI Serialize', (t) => {
+ let components = {
+ scheme: undefined,
+ userinfo: undefined,
+ host: undefined,
+ port: undefined,
+ path: undefined,
+ query: undefined,
+ fragment: undefined
+ }
+ t.equal(URI.serialize(components), '', 'Undefined Components')
+
+ components = {
+ scheme: '',
+ userinfo: '',
+ host: '',
+ port: 0,
+ path: '',
+ query: '',
+ fragment: ''
+ }
+ t.equal(URI.serialize(components), '//@:0?#', 'Empty Components')
+
+ components = {
+ scheme: 'uri',
+ userinfo: 'foo:bar',
+ host: 'example.com',
+ port: 1,
+ path: 'path',
+ query: 'query',
+ fragment: 'fragment'
+ }
+ t.equal(URI.serialize(components), 'uri://foo:bar@example.com:1/path?query#fragment', 'All Components')
+
+ components = {
+ scheme: 'uri',
+ host: 'example.com',
+ port: '9000'
+ }
+ t.equal(URI.serialize(components), 'uri://example.com:9000', 'String port')
+
+ t.equal(URI.serialize({ path: '//path' }), '/%2Fpath', 'Double slash path')
+ t.equal(URI.serialize({ path: 'foo:bar' }), 'foo%3Abar', 'Colon path')
+ t.equal(URI.serialize({ path: '?query' }), '%3Fquery', 'Query path')
+
+ t.equal(URI.serialize({ host: '10.10.10.10' }), '//10.10.10.10', 'IPv4address')
+
+ // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
+ t.equal(URI.serialize({ host: '10.10.10.10.example.com' }), '//10.10.10.10.example.com', 'Mixed IPv4address & reg-name')
+
+ // IPv6address
+ t.equal(URI.serialize({ host: '2001:db8::7' }), '//[2001:db8::7]', 'IPv6 Host')
+ t.equal(URI.serialize({ host: '::ffff:129.144.52.38' }), '//[::ffff:129.144.52.38]', 'IPv6 Mixed Host')
+ t.equal(URI.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }), '//[2606:2800:220:1:248:1893:25c8:1946]', 'IPv6 Full Host')
+
+ // IPv6address with zone identifier, RFC 6874
+ t.equal(URI.serialize({ host: 'fe80::a%en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Unescaped Host')
+ t.equal(URI.serialize({ host: 'fe80::a%25en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Escaped Host')
+
+ t.end()
+})
+
+test('WS serialize', (t) => {
+ t.equal(URI.serialize({ scheme: 'ws' }), 'ws:')
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com' }), 'ws://example.com')
+ t.equal(URI.serialize({ scheme: 'ws', resourceName: '/' }), 'ws:')
+ t.equal(URI.serialize({ scheme: 'ws', resourceName: '/foo' }), 'ws:/foo')
+ t.equal(URI.serialize({ scheme: 'ws', resourceName: '/foo?bar' }), 'ws:/foo?bar')
+ t.equal(URI.serialize({ scheme: 'ws', secure: false }), 'ws:')
+ t.equal(URI.serialize({ scheme: 'ws', secure: true }), 'wss:')
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo' }), 'ws://example.com/foo')
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar' }), 'ws://example.com/foo?bar')
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', secure: false }), 'ws://example.com')
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', secure: true }), 'wss://example.com')
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar')
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar')
+ t.end()
+})
+
+test('WSS serialize', (t) => {
+ t.equal(URI.serialize({ scheme: 'wss' }), 'wss:')
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com' }), 'wss://example.com')
+ t.equal(URI.serialize({ scheme: 'wss', resourceName: '/' }), 'wss:')
+ t.equal(URI.serialize({ scheme: 'wss', resourceName: '/foo' }), 'wss:/foo')
+ t.equal(URI.serialize({ scheme: 'wss', resourceName: '/foo?bar' }), 'wss:/foo?bar')
+ t.equal(URI.serialize({ scheme: 'wss', secure: false }), 'ws:')
+ t.equal(URI.serialize({ scheme: 'wss', secure: true }), 'wss:')
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo' }), 'wss://example.com/foo')
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar' }), 'wss://example.com/foo?bar')
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', secure: false }), 'ws://example.com')
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', secure: true }), 'wss://example.com')
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar')
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar')
+
+ t.end()
+})
+
+test('URN serialize', (t) => {
+// example from RFC 2141
+ const components = {
+ scheme: 'urn',
+ nid: 'foo',
+ nss: 'a123,456'
+ }
+ t.equal(URI.serialize(components), 'urn:foo:a123,456')
+ // example from RFC 4122
+ let uuidcomponents = {
+ scheme: 'urn',
+ nid: 'uuid',
+ uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
+ }
+ t.equal(URI.serialize(uuidcomponents), 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
+
+ uuidcomponents = {
+ scheme: 'urn',
+ nid: 'uuid',
+ uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6'
+ }
+ t.equal(URI.serialize(uuidcomponents), 'urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6')
+ t.end()
+})
+test('URN NID Override', (t) => {
+ let components = URI.parse('urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', { nid: 'uuid' })
+ t.equal(components.error, undefined, 'errors')
+ t.equal(components.scheme, 'urn', 'scheme')
+ t.equal(components.path, undefined, 'path')
+ t.equal(components.nid, 'foo', 'nid')
+ t.equal(components.nss, undefined, 'nss')
+ t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid')
+
+ components = {
+ scheme: 'urn',
+ nid: 'foo',
+ uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
+ }
+ t.equal(URI.serialize(components, { nid: 'uuid' }), 'urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
+ t.end()
+})
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/types/index.d.ts b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/types/index.d.ts
new file mode 100644
index 00000000..b00d8b11
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/types/index.d.ts
@@ -0,0 +1,53 @@
+type FastUri = typeof fastUri
+
+declare namespace fastUri {
+ export interface URIComponent {
+ scheme?: string;
+ userinfo?: string;
+ host?: string;
+ port?: number | string;
+ path?: string;
+ query?: string;
+ fragment?: string;
+ reference?: string;
+ error?: string;
+ }
+ export interface Options {
+ scheme?: string;
+ reference?: string;
+ unicodeSupport?: boolean;
+ domainHost?: boolean;
+ absolutePath?: boolean;
+ tolerant?: boolean;
+ }
+
+ /**
+ * @deprecated Use Options instead
+ */
+ export type options = Options
+ /**
+ * @deprecated Use URIComponent instead
+ */
+ export type URIComponents = URIComponent
+
+ export function normalize(uri: string, opts?: Options): string;
+ export function normalize(uri: URIComponent, opts?: Options): URIComponent;
+ export function normalize(uri: any, opts?: Options): any;
+
+ export function resolve(baseURI: string, relativeURI: string, options?: Options): string
+
+ export function resolveComponent(base: URIComponent, relative: URIComponent, options?: Options, skipNormalization?: boolean): URIComponent
+
+ export function parse(uri: string, opts?: Options): URIComponent;
+
+ export function serialize(component: URIComponent, opts?: Options): string;
+
+ export function equal(uriA: string, uriB: string): boolean;
+
+ export function resolve(base: string, path: string): string;
+
+ export const fastUri: FastUri
+ export { fastUri as default }
+}
+
+export = fastUri
diff --git a/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/types/index.test-d.ts b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/types/index.test-d.ts
new file mode 100644
index 00000000..1e2e2475
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/node_modules/fast-uri/types/index.test-d.ts
@@ -0,0 +1,17 @@
+import uri, { URIComponents, URIComponent, Options, options } from "..";
+import { expectDeprecated, expectType } from "tsd";
+
+const parsed = uri.parse("foo");
+expectType(parsed);
+const parsed2 = uri.parse("foo", {
+ domainHost: true,
+ scheme: 'https',
+ unicodeSupport: false
+})
+expectType(parsed2);
+
+expectType({} as URIComponents)
+expectDeprecated({} as URIComponents)
+
+expectType({} as options)
+expectDeprecated({} as options)
diff --git a/sdk/node_modules/@fastify/ajv-compiler/package.json b/sdk/node_modules/@fastify/ajv-compiler/package.json
new file mode 100644
index 00000000..c57612d6
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/package.json
@@ -0,0 +1,54 @@
+{
+ "name": "@fastify/ajv-compiler",
+ "version": "3.6.0",
+ "description": "Build and manage the AJV instances for the fastify framework",
+ "main": "index.js",
+ "type": "commonjs",
+ "types": "types/index.d.ts",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "lint": "standard",
+ "lint:fix": "standard --fix",
+ "unit": "tap",
+ "test": "npm run unit && npm run test:typescript",
+ "test:typescript": "tsd",
+ "ajv:compile": "ajv compile -s test/source.json -o test/validate_schema.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/fastify/ajv-compiler.git"
+ },
+ "keywords": [
+ "ajv",
+ "validator",
+ "schema",
+ "compiler",
+ "fastify"
+ ],
+ "author": "Manuel Spigolon (https://github.com/Eomm)",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/fastify/ajv-compiler/issues"
+ },
+ "homepage": "https://github.com/fastify/ajv-compiler#readme",
+ "devDependencies": {
+ "ajv-cli": "^5.0.0",
+ "ajv-errors": "^3.0.0",
+ "ajv-i18n": "^4.0.1",
+ "ajv-merge-patch": "^5.0.1",
+ "cronometro": "^3.0.1",
+ "fastify": "^4.0.0",
+ "require-from-string": "^2.0.2",
+ "sanitize-filename": "^1.6.3",
+ "standard": "^17.0.0",
+ "tap": "^16.2.0",
+ "tsd": "^0.31.0"
+ },
+ "dependencies": {
+ "ajv": "^8.11.0",
+ "ajv-formats": "^2.1.1",
+ "fast-uri": "^2.0.0"
+ }
+}
diff --git a/sdk/node_modules/@fastify/ajv-compiler/standalone.js b/sdk/node_modules/@fastify/ajv-compiler/standalone.js
new file mode 100644
index 00000000..42428a0d
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/standalone.js
@@ -0,0 +1,44 @@
+'use strict'
+
+const ValidatorSelector = require('./index')
+const standaloneCode = require('ajv/dist/standalone').default
+
+function StandaloneValidator (options = { readMode: true }) {
+ if (options.readMode === true && !options.restoreFunction) {
+ throw new Error('You must provide a restoreFunction options when readMode ON')
+ }
+
+ if (options.readMode !== true && !options.storeFunction) {
+ throw new Error('You must provide a storeFunction options when readMode OFF')
+ }
+
+ if (options.readMode === true) {
+ // READ MODE: it behalf only in the restore function provided by the user
+ return function wrapper () {
+ return function (opts) {
+ return options.restoreFunction(opts)
+ }
+ }
+ }
+
+ // WRITE MODE: it behalf on the default ValidatorSelector, wrapping the API to run the Ajv Standalone code generation
+ const factory = ValidatorSelector()
+ return function wrapper (externalSchemas, ajvOptions = {}) {
+ if (!ajvOptions.customOptions || !ajvOptions.customOptions.code) {
+ // to generate the validation source code, these options are mandatory
+ ajvOptions.customOptions = Object.assign({}, ajvOptions.customOptions, { code: { source: true } })
+ }
+
+ const compiler = factory(externalSchemas, ajvOptions)
+ return function (opts) { // { schema/*, method, url, httpPart */ }
+ const validationFunc = compiler(opts)
+
+ const schemaValidationCode = standaloneCode(compiler[ValidatorSelector.AjvReference].ajv, validationFunc)
+ options.storeFunction(opts, schemaValidationCode)
+
+ return validationFunc
+ }
+ }
+}
+
+module.exports = StandaloneValidator
diff --git a/sdk/node_modules/@fastify/ajv-compiler/test/.gitkeep b/sdk/node_modules/@fastify/ajv-compiler/test/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/sdk/node_modules/@fastify/ajv-compiler/test/duplicated-id-compile.test.js b/sdk/node_modules/@fastify/ajv-compiler/test/duplicated-id-compile.test.js
new file mode 100644
index 00000000..849016c6
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/test/duplicated-id-compile.test.js
@@ -0,0 +1,59 @@
+'use strict'
+
+const t = require('tap')
+const AjvCompiler = require('../index')
+
+const postSchema = Object.freeze({
+ $schema: 'http://json-schema.org/draft-07/schema#',
+ type: 'object',
+ $id: 'http://mydomain.com/user',
+ title: 'User schema',
+ description: 'Contains all user fields',
+ properties: {
+ username: { type: 'string', minLength: 4 },
+ firstName: { type: 'string', minLength: 1 },
+ lastName: { type: 'string', minLength: 1 },
+ email: { type: 'string' },
+ password: { type: 'string', minLength: 6 },
+ bio: { type: 'string' }
+ },
+ required: ['username', 'firstName', 'lastName', 'email', 'bio', 'password']
+})
+
+const patchSchema = Object.freeze({
+ $schema: 'http://json-schema.org/draft-07/schema#',
+ type: 'object',
+ $id: 'http://mydomain.com/user',
+ title: 'User schema',
+ description: 'Contains all user fields',
+ properties: {
+ firstName: { type: 'string', minLength: 1 },
+ lastName: { type: 'string', minLength: 1 },
+ bio: { type: 'string' }
+ }
+})
+
+const fastifyAjvOptionsDefault = Object.freeze({
+ customOptions: {}
+})
+
+t.test('must not store schema on compile', t => {
+ t.plan(4)
+ const factory = AjvCompiler()
+ const compiler = factory({}, fastifyAjvOptionsDefault)
+ const postFn = compiler({ schema: postSchema })
+ const patchFn = compiler({ schema: patchSchema })
+
+ const resultForPost = postFn({})
+ t.equal(resultForPost, false)
+ t.has(postFn.errors, [
+ {
+ keyword: 'required',
+ message: "must have required property 'username'"
+ }
+ ])
+
+ const resultForPatch = patchFn({})
+ t.ok(resultForPatch)
+ t.notOk(patchFn.errors)
+})
diff --git a/sdk/node_modules/@fastify/ajv-compiler/test/index.test.js b/sdk/node_modules/@fastify/ajv-compiler/test/index.test.js
new file mode 100644
index 00000000..fe1427ce
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/test/index.test.js
@@ -0,0 +1,307 @@
+'use strict'
+
+const t = require('tap')
+const fastify = require('fastify')
+const AjvCompiler = require('../index')
+
+const sym = Symbol.for('fastify.ajv-compiler.reference')
+
+const sampleSchema = Object.freeze({
+ $id: 'example1',
+ type: 'object',
+ properties: {
+ name: { type: 'string' }
+ }
+})
+
+const externalSchemas1 = Object.freeze({})
+const externalSchemas2 = Object.freeze({
+ foo: {
+ $id: 'foo',
+ type: 'object',
+ properties: {
+ name: { type: 'string' }
+ }
+ }
+})
+
+const fastifyAjvOptionsDefault = Object.freeze({
+ customOptions: {}
+})
+
+const fastifyJtdDefault = Object.freeze({
+ customOptions: { },
+ mode: 'JTD'
+})
+
+const fastifyAjvOptionsCustom = Object.freeze({
+ customOptions: {
+ allErrors: true,
+ removeAdditional: false
+ },
+ plugins: [
+ require('ajv-formats'),
+ [require('ajv-errors'), { singleError: false }]
+ ]
+})
+
+t.test('basic usage', t => {
+ t.plan(1)
+ const factory = AjvCompiler()
+ const compiler = factory(externalSchemas1, fastifyAjvOptionsDefault)
+ const validatorFunc = compiler({ schema: sampleSchema })
+ const result = validatorFunc({ name: 'hello' })
+ t.equal(result, true)
+})
+
+t.test('array coercion', t => {
+ t.plan(2)
+ const factory = AjvCompiler()
+ const compiler = factory(externalSchemas1, fastifyAjvOptionsDefault)
+
+ const arraySchema = {
+ $id: 'example1',
+ type: 'object',
+ properties: {
+ name: { type: 'array', items: { type: 'string' } }
+ }
+ }
+
+ const validatorFunc = compiler({ schema: arraySchema })
+
+ const inputObj = { name: 'hello' }
+ t.equal(validatorFunc(inputObj), true)
+ t.same(inputObj, { name: ['hello'] }, 'the name property should be coerced to an array')
+})
+
+t.test('nullable default', t => {
+ t.plan(2)
+ const factory = AjvCompiler()
+ const compiler = factory({}, fastifyAjvOptionsDefault)
+ const validatorFunc = compiler({
+ schema: {
+ type: 'object',
+ properties: {
+ nullable: { type: 'string', nullable: true },
+ notNullable: { type: 'string' }
+ }
+ }
+ })
+ const input = { nullable: null, notNullable: null }
+ const result = validatorFunc(input)
+ t.equal(result, true)
+ t.same(input, { nullable: null, notNullable: '' }, 'the notNullable field has been coerced')
+})
+
+t.test('plugin loading', t => {
+ t.plan(3)
+ const factory = AjvCompiler()
+ const compiler = factory(externalSchemas1, fastifyAjvOptionsCustom)
+ const validatorFunc = compiler({
+ schema: {
+ type: 'object',
+ properties: {
+ q: {
+ type: 'string',
+ format: 'date',
+ formatMinimum: '2016-02-06',
+ formatExclusiveMaximum: '2016-12-27'
+ }
+ },
+ required: ['q'],
+ errorMessage: 'hello world'
+ }
+ })
+ const result = validatorFunc({ q: '2016-10-02' })
+ t.equal(result, true)
+
+ const resultFail = validatorFunc({})
+ t.equal(resultFail, false)
+ t.equal(validatorFunc.errors[0].message, 'hello world')
+})
+
+t.test('optimization - cache ajv instance', t => {
+ t.plan(5)
+ const factory = AjvCompiler()
+ const compiler1 = factory(externalSchemas1, fastifyAjvOptionsDefault)
+ const compiler2 = factory(externalSchemas1, fastifyAjvOptionsDefault)
+ t.equal(compiler1, compiler2, 'same instance')
+ t.same(compiler1, compiler2, 'same instance')
+
+ const compiler3 = factory(externalSchemas2, fastifyAjvOptionsDefault)
+ t.not(compiler3, compiler1, 'new ajv instance when externa schema change')
+
+ const compiler4 = factory(externalSchemas1, fastifyAjvOptionsCustom)
+ t.not(compiler4, compiler1, 'new ajv instance when externa schema change')
+ t.not(compiler4, compiler3, 'new ajv instance when externa schema change')
+})
+
+t.test('the onCreate callback can enhance the ajv instance', t => {
+ t.plan(2)
+ const factory = AjvCompiler()
+
+ const fastifyAjvCustomOptionsFormats = Object.freeze({
+ onCreate (ajv) {
+ for (const [formatName, format] of Object.entries(this.customOptions.formats)) {
+ ajv.addFormat(formatName, format)
+ }
+ },
+ customOptions: {
+ formats: {
+ date: /foo/
+ }
+ }
+ })
+
+ const compiler1 = factory(externalSchemas1, fastifyAjvCustomOptionsFormats)
+ const validatorFunc = compiler1({
+ schema: {
+ type: 'string',
+ format: 'date'
+ }
+ })
+ const result = validatorFunc('foo')
+ t.equal(result, true)
+
+ const resultFail = validatorFunc('2016-10-02')
+ t.equal(resultFail, false)
+})
+
+// https://github.com/fastify/fastify/pull/2969
+t.test('compile same $id when in external schema', t => {
+ t.plan(3)
+ const factory = AjvCompiler()
+
+ const base = {
+ $id: 'urn:schema:base',
+ definitions: {
+ hello: { type: 'string' }
+ },
+ type: 'object',
+ properties: {
+ hello: { $ref: '#/definitions/hello' }
+ }
+ }
+
+ const refSchema = {
+ $id: 'urn:schema:ref',
+ type: 'object',
+ properties: {
+ hello: { $ref: 'urn:schema:base#/definitions/hello' }
+ }
+ }
+
+ const compiler = factory({
+ [base.$id]: base,
+ [refSchema.$id]: refSchema
+
+ }, fastifyAjvOptionsDefault)
+
+ t.notOk(compiler[sym], 'the ajv reference do not exists if code is not activated')
+
+ const validatorFunc1 = compiler({
+ schema: {
+ $id: 'urn:schema:ref'
+ }
+ })
+
+ const validatorFunc2 = compiler({
+ schema: {
+ $id: 'urn:schema:ref'
+ }
+ })
+
+ t.pass('the compile does not fail if the schema compiled is already in the external schemas')
+ t.equal(validatorFunc1, validatorFunc2, 'the returned function is the same')
+})
+
+t.test('JTD MODE', t => {
+ t.plan(2)
+
+ t.test('compile jtd schema', t => {
+ t.plan(4)
+ const factory = AjvCompiler()
+
+ const jtdSchema = {
+ discriminator: 'version',
+ mapping: {
+ 1: {
+ properties: {
+ foo: { type: 'uint8' }
+ }
+ },
+ 2: {
+ properties: {
+ foo: { type: 'string' }
+ }
+ }
+ }
+ }
+
+ const compiler = factory({}, fastifyJtdDefault)
+ const validatorFunc = compiler({ schema: jtdSchema })
+ t.pass('generated validation function for JTD SCHEMA')
+
+ const result = validatorFunc({
+ version: '2',
+ foo: []
+ })
+ t.notOk(result, 'failed validation')
+ t.type(validatorFunc.errors, 'Array')
+
+ const success = validatorFunc({
+ version: '1',
+ foo: 42
+ })
+ t.ok(success)
+ })
+
+ t.test('fastify integration', async t => {
+ const factory = AjvCompiler()
+
+ const app = fastify({
+ jsonShorthand: false,
+ ajv: {
+ customOptions: { },
+ mode: 'JTD'
+ },
+ schemaController: {
+ compilersFactory: {
+ buildValidator: factory
+ }
+ }
+ })
+
+ app.post('/', {
+ schema: {
+ body: {
+ discriminator: 'version',
+ mapping: {
+ 1: {
+ properties: {
+ foo: { type: 'uint8' }
+ }
+ },
+ 2: {
+ properties: {
+ foo: { type: 'string' }
+ }
+ }
+ }
+ }
+ }
+ }, () => {})
+
+ const res = await app.inject({
+ url: '/',
+ method: 'POST',
+ payload: {
+ version: '1',
+ foo: 'this is not a number'
+ }
+ })
+
+ t.equal(res.statusCode, 400)
+ t.equal(res.json().message, 'body/foo must be uint8')
+ })
+})
diff --git a/sdk/node_modules/@fastify/ajv-compiler/test/plugins.test.js b/sdk/node_modules/@fastify/ajv-compiler/test/plugins.test.js
new file mode 100644
index 00000000..dacb0e89
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/test/plugins.test.js
@@ -0,0 +1,264 @@
+'use strict'
+
+const t = require('tap')
+const fastify = require('fastify')
+const AjvCompiler = require('../index')
+
+const ajvFormats = require('ajv-formats')
+const ajvErrors = require('ajv-errors')
+const localize = require('ajv-i18n')
+
+t.test('Format Baseline test', async (t) => {
+ const app = buildApplication({
+ customOptions: {
+ validateFormats: false
+ }
+ })
+
+ const res = await app.inject({
+ url: '/hello',
+ headers: {
+ 'x-foo': 'hello',
+ 'x-date': 'not a date',
+ 'x-email': 'not an email'
+ },
+ query: {
+ foo: 'hello',
+ date: 'not a date',
+ email: 'not an email'
+ }
+ })
+ t.equal(res.statusCode, 200, 'format validation does not apply as configured')
+ t.equal(res.payload, 'hello')
+})
+
+t.test('Custom Format plugin loading test', (t) => {
+ t.plan(6)
+ const app = buildApplication({
+ customOptions: {
+ validateFormats: true
+ },
+ plugins: [[ajvFormats, { mode: 'fast' }]]
+ })
+
+ app.inject('/hello', (err, res) => {
+ t.error(err)
+ t.equal(res.statusCode, 400, 'format validation applies')
+ })
+
+ app.inject('/2ad0612c-7578-4b18-9a6f-579863f40e0b', (err, res) => {
+ t.error(err)
+ t.equal(res.statusCode, 400, 'format validation applies')
+ })
+
+ app.inject({
+ url: '/2ad0612c-7578-4b18-9a6f-579863f40e0b',
+ headers: {
+ 'x-foo': 'hello',
+ 'x-date': new Date().toISOString(),
+ 'x-email': 'foo@bar.baz'
+ },
+ query: {
+ foo: 'hello',
+ date: new Date().toISOString(),
+ email: 'foo@bar.baz'
+ }
+ }, (err, res) => {
+ t.error(err)
+ t.equal(res.statusCode, 200)
+ })
+})
+
+t.test('Format plugin set by default test', (t) => {
+ t.plan(6)
+ const app = buildApplication({})
+
+ app.inject('/hello', (err, res) => {
+ t.error(err)
+ t.equal(res.statusCode, 400, 'format validation applies')
+ })
+
+ app.inject('/2ad0612c-7578-4b18-9a6f-579863f40e0b', (err, res) => {
+ t.error(err)
+ t.equal(res.statusCode, 400, 'format validation applies')
+ })
+
+ app.inject({
+ url: '/2ad0612c-7578-4b18-9a6f-579863f40e0b',
+ headers: {
+ 'x-foo': 'hello',
+ 'x-date': new Date().toISOString(),
+ 'x-email': 'foo@bar.baz'
+ },
+ query: {
+ foo: 'hello',
+ date: new Date().toISOString(),
+ email: 'foo@bar.baz'
+ }
+ }, (err, res) => {
+ t.error(err)
+ t.equal(res.statusCode, 200)
+ })
+})
+
+t.test('Custom error messages', (t) => {
+ t.plan(9)
+
+ const app = buildApplication({
+ customOptions: {
+ removeAdditional: false,
+ allErrors: true
+ },
+ plugins: [ajvFormats, ajvErrors]
+ })
+
+ const errorMessage = {
+ required: 'custom miss',
+ type: 'custom type', // will not replace internal "type" error for the property "foo"
+ _: 'custom type', // this prop will do it
+ additionalProperties: 'custom too many params'
+ }
+
+ app.post('/', {
+ handler: () => { t.fail('dont call me') },
+ schema: {
+ body: {
+ type: 'object',
+ required: ['foo'],
+ properties: {
+ foo: { type: 'integer' }
+ },
+ additionalProperties: false,
+ errorMessage
+ }
+ }
+ })
+
+ app.inject({
+ url: '/',
+ method: 'post',
+ payload: {}
+ }, (err, res) => {
+ t.error(err)
+ t.equal(res.statusCode, 400)
+ t.match(res.json().message, errorMessage.required)
+ })
+
+ app.inject({
+ url: '/',
+ method: 'post',
+ payload: { foo: 'not a number' }
+ }, (err, res) => {
+ t.error(err)
+ t.equal(res.statusCode, 400)
+ t.match(res.json().message, errorMessage.type)
+ })
+
+ app.inject({
+ url: '/',
+ method: 'post',
+ payload: { foo: 3, bar: 'ops' }
+ }, (err, res) => {
+ t.error(err)
+ t.equal(res.statusCode, 400)
+ t.match(res.json().message, errorMessage.additionalProperties)
+ })
+})
+
+t.test('Custom i18n error messages', (t) => {
+ t.plan(3)
+
+ const app = buildApplication({
+ customOptions: {
+ allErrors: true,
+ messages: false
+ },
+ plugins: [ajvFormats]
+ })
+
+ app.post('/', {
+ handler: () => { t.fail('dont call me') },
+ schema: {
+ body: {
+ type: 'object',
+ required: ['foo'],
+ properties: {
+ foo: { type: 'integer' }
+ }
+ }
+ }
+ })
+
+ app.setErrorHandler((error, request, reply) => {
+ t.pass('Error handler executed')
+ if (error.validation) {
+ localize.ru(error.validation)
+ reply.status(400).send(error.validation)
+ return
+ }
+ t.fail('not other errors')
+ })
+
+ app.inject({
+ method: 'POST',
+ url: '/',
+ payload: {
+ foo: 'string'
+ }
+ }, (err, res) => {
+ t.error(err)
+ t.equal(res.json()[0].message, 'должно быть integer')
+ })
+})
+
+function buildApplication (ajvOptions) {
+ const factory = AjvCompiler()
+
+ const app = fastify({
+ ajv: ajvOptions,
+ schemaController: {
+ compilersFactory: {
+ buildValidator: factory
+ }
+ }
+ })
+
+ app.get('/:id', {
+ schema: {
+ headers: {
+ type: 'object',
+ required: [
+ 'x-foo',
+ 'x-date',
+ 'x-email'
+ ],
+ properties: {
+ 'x-foo': { type: 'string' },
+ 'x-date': { type: 'string', format: 'date-time' },
+ 'x-email': { type: 'string', format: 'email' }
+ }
+ },
+ query: {
+ type: 'object',
+ required: [
+ 'foo',
+ 'date',
+ 'email'
+ ],
+ properties: {
+ foo: { type: 'string' },
+ date: { type: 'string', format: 'date-time' },
+ email: { type: 'string', format: 'email' }
+ }
+ },
+ params: {
+ type: 'object',
+ properties: {
+ id: { type: 'string', format: 'uuid' }
+ }
+ }
+ }
+ }, async () => 'hello')
+
+ return app
+}
diff --git a/sdk/node_modules/@fastify/ajv-compiler/test/serialization.test.js b/sdk/node_modules/@fastify/ajv-compiler/test/serialization.test.js
new file mode 100644
index 00000000..20821e0d
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/test/serialization.test.js
@@ -0,0 +1,279 @@
+'use strict'
+
+const t = require('tap')
+const fastify = require('fastify')
+const AjvCompiler = require('../index')
+
+const jtdSchema = {
+ discriminator: 'version',
+ mapping: {
+ 1: {
+ properties: {
+ foo: { type: 'uint8' }
+ }
+ },
+ 2: {
+ properties: {
+ foo: { type: 'string' }
+ }
+ }
+ }
+}
+
+const externalSchemas1 = Object.freeze({})
+const externalSchemas2 = Object.freeze({
+ foo: {
+ definitions: {
+ coordinates: {
+ properties: {
+ lat: { type: 'float32' },
+ lng: { type: 'float32' }
+ }
+ }
+ }
+ }
+})
+
+const fastifyAjvOptionsDefault = Object.freeze({
+ customOptions: {}
+})
+
+t.test('basic serializer usage', t => {
+ t.plan(4)
+ const factory = AjvCompiler({ jtdSerializer: true })
+ const compiler = factory(externalSchemas1, fastifyAjvOptionsDefault)
+ const serializeFunc = compiler({ schema: jtdSchema })
+ t.equal(serializeFunc({ version: '1', foo: 42 }), '{"version":"1","foo":42}')
+ t.equal(serializeFunc({ version: '2', foo: 'hello' }), '{"version":"2","foo":"hello"}')
+ t.equal(serializeFunc({ version: '3', foo: 'hello' }), '{"version":"3"}')
+ t.equal(serializeFunc({ version: '2', foo: ['not', 1, { string: 'string' }] }), '{"version":"2","foo":"not,1,[object Object]"}')
+})
+
+t.test('external schemas are ignored', t => {
+ t.plan(1)
+ const factory = AjvCompiler({ jtdSerializer: true })
+ const compiler = factory(externalSchemas2, fastifyAjvOptionsDefault)
+ const serializeFunc = compiler({
+ schema: {
+ definitions: {
+ coordinates: {
+ properties: {
+ lat: { type: 'float32' },
+ lng: { type: 'float32' }
+ }
+ }
+ },
+ properties: {
+ userLoc: { ref: 'coordinates' },
+ serverLoc: { ref: 'coordinates' }
+ }
+ }
+ })
+ t.equal(serializeFunc(
+ { userLoc: { lat: 50, lng: -90 }, serverLoc: { lat: -15, lng: 50 } }),
+ '{"userLoc":{"lat":50,"lng":-90},"serverLoc":{"lat":-15,"lng":50}}'
+ )
+})
+
+t.test('fastify integration within JTD serializer', async t => {
+ const factoryValidator = AjvCompiler()
+ const factorySerializer = AjvCompiler({ jtdSerializer: true })
+
+ const app = fastify({
+ jsonShorthand: false,
+ ajv: {
+ customOptions: { },
+ mode: 'JTD'
+ },
+ schemaController: {
+ compilersFactory: {
+ buildValidator: factoryValidator,
+ buildSerializer: factorySerializer
+ }
+ }
+ })
+
+ app.post('/', {
+ schema: {
+ body: jtdSchema,
+ response: {
+ 200: {
+ properties: {
+ id: { type: 'string' },
+ createdAt: { type: 'timestamp' },
+ karma: { type: 'int32' },
+ isAdmin: { type: 'boolean' }
+ }
+ },
+ 400: jtdSchema
+ }
+ }
+ }, async () => {
+ return {
+ id: '123',
+ createdAt: new Date('1999-01-31T23:00:00.000Z'),
+ karma: 42,
+ isAdmin: true,
+ remove: 'me'
+ }
+ })
+
+ {
+ const res = await app.inject({
+ url: '/',
+ method: 'POST',
+ payload: {
+ version: '1',
+ foo: 'not a number'
+ }
+ })
+
+ t.equal(res.statusCode, 400)
+ t.same(res.json(), { version: 'undefined' })
+ }
+
+ {
+ const res = await app.inject({
+ url: '/',
+ method: 'POST',
+ payload: {
+ version: '1',
+ foo: 32
+ }
+ })
+
+ t.equal(res.statusCode, 200)
+ t.same(res.json(), {
+ id: '123',
+ createdAt: '1999-01-31T23:00:00.000Z',
+ karma: 42,
+ isAdmin: true
+ })
+ }
+})
+
+t.test('fastify integration and cached serializer', async t => {
+ const factoryValidator = AjvCompiler()
+ const factorySerializer = AjvCompiler({ jtdSerializer: true })
+
+ const app = fastify({
+ jsonShorthand: false,
+ ajv: {
+ customOptions: { },
+ mode: 'JTD'
+ },
+ schemaController: {
+ compilersFactory: {
+ buildValidator: factoryValidator,
+ buildSerializer: factorySerializer
+ }
+ }
+ })
+
+ app.register(async function plugin (app, opts) {
+ app.post('/', {
+ schema: {
+ body: jtdSchema,
+ response: {
+ 200: {
+ properties: {
+ id: { type: 'string' },
+ createdAt: { type: 'timestamp' },
+ karma: { type: 'int32' },
+ isAdmin: { type: 'boolean' }
+ }
+ },
+ 400: jtdSchema
+ }
+ }
+ }, async () => {
+ return {
+ id: '123',
+ createdAt: new Date('1999-01-31T23:00:00.000Z'),
+ karma: 42,
+ isAdmin: true,
+ remove: 'me'
+ }
+ })
+ })
+
+ app.register(async function plugin (app, opts) {
+ app.post('/two', {
+ schema: {
+ body: jtdSchema,
+ response: {
+ 400: jtdSchema
+ }
+ }
+ }, () => {})
+ })
+
+ {
+ const res = await app.inject({
+ url: '/',
+ method: 'POST',
+ payload: {
+ version: '1',
+ foo: 'not a number'
+ }
+ })
+
+ t.equal(res.statusCode, 400)
+ t.same(res.json(), { version: 'undefined' })
+ }
+
+ {
+ const res = await app.inject({
+ url: '/',
+ method: 'POST',
+ payload: {
+ version: '1',
+ foo: 32
+ }
+ })
+
+ t.equal(res.statusCode, 200)
+ t.same(res.json(), {
+ id: '123',
+ createdAt: '1999-01-31T23:00:00.000Z',
+ karma: 42,
+ isAdmin: true
+ })
+ }
+})
+
+t.test('fastify integration within JTD serializer and custom options', async t => {
+ const factorySerializer = AjvCompiler({ jtdSerializer: true })
+
+ const app = fastify({
+ jsonShorthand: false,
+ serializerOpts: {
+ allErrors: true,
+ logger: 'wrong-value'
+ },
+ schemaController: {
+ compilersFactory: {
+ buildSerializer: factorySerializer
+ }
+ }
+ })
+
+ app.post('/', {
+ schema: {
+ response: {
+ 200: {
+ properties: {
+ test: { type: 'boolean' }
+ }
+ }
+ }
+ }
+ }, async () => { })
+
+ try {
+ await app.ready()
+ t.fail('should throw')
+ } catch (error) {
+ t.equal(error.message, 'logger must implement log, warn and error methods', 'the wrong setting is forwarded to ajv/jtd')
+ }
+})
diff --git a/sdk/node_modules/@fastify/ajv-compiler/test/standalone.test.js b/sdk/node_modules/@fastify/ajv-compiler/test/standalone.test.js
new file mode 100644
index 00000000..f32fcbac
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/test/standalone.test.js
@@ -0,0 +1,203 @@
+'use strict'
+
+const fs = require('node:fs')
+const path = require('node:path')
+const t = require('tap')
+const fastify = require('fastify')
+const sanitize = require('sanitize-filename')
+
+const { StandaloneValidator: AjvStandaloneValidator } = require('../')
+
+function generateFileName (routeOpts) {
+ return `/ajv-generated-${sanitize(routeOpts.schema.$id)}-${routeOpts.method}-${routeOpts.httpPart}-${sanitize(routeOpts.url)}.js`
+}
+
+const generatedFileNames = []
+
+t.test('standalone', t => {
+ t.plan(4)
+
+ t.teardown(async () => {
+ for (const fileName of generatedFileNames) {
+ await fs.promises.unlink(path.join(__dirname, fileName))
+ }
+ })
+
+ t.test('errors', t => {
+ t.plan(2)
+ t.throws(() => {
+ AjvStandaloneValidator()
+ }, 'missing restoreFunction')
+ t.throws(() => {
+ AjvStandaloneValidator({ readMode: false })
+ }, 'missing storeFunction')
+ })
+
+ t.test('generate standalone code', t => {
+ t.plan(5)
+
+ const base = {
+ $id: 'urn:schema:base',
+ definitions: {
+ hello: { type: 'string' }
+ },
+ type: 'object',
+ properties: {
+ hello: { $ref: '#/definitions/hello' }
+ }
+ }
+
+ const refSchema = {
+ $id: 'urn:schema:ref',
+ type: 'object',
+ properties: {
+ hello: { $ref: 'urn:schema:base#/definitions/hello' }
+ }
+ }
+
+ const endpointSchema = {
+ schema: {
+ $id: 'urn:schema:endpoint',
+ $ref: 'urn:schema:ref'
+ }
+ }
+
+ const schemaMap = {
+ [base.$id]: base,
+ [refSchema.$id]: refSchema
+ }
+
+ const factory = AjvStandaloneValidator({
+ readMode: false,
+ storeFunction (routeOpts, schemaValidationCode) {
+ t.same(routeOpts, endpointSchema)
+ t.type(schemaValidationCode, 'string')
+ fs.writeFileSync(path.join(__dirname, '/ajv-generated.js'), schemaValidationCode)
+ generatedFileNames.push('/ajv-generated.js')
+ t.pass('stored the validation function')
+ }
+ })
+
+ const compiler = factory(schemaMap)
+ compiler(endpointSchema)
+ t.pass('compiled the endpoint schema')
+
+ t.test('usage standalone code', t => {
+ t.plan(3)
+ const standaloneValidate = require('./ajv-generated')
+
+ const valid = standaloneValidate({ hello: 'world' })
+ t.ok(valid)
+
+ const invalid = standaloneValidate({ hello: [] })
+ t.notOk(invalid)
+
+ t.ok(standaloneValidate)
+ })
+ })
+
+ t.test('fastify integration - writeMode', async t => {
+ t.plan(6)
+
+ const factory = AjvStandaloneValidator({
+ readMode: false,
+ storeFunction (routeOpts, schemaValidationCode) {
+ const fileName = generateFileName(routeOpts)
+ t.ok(routeOpts)
+ fs.writeFileSync(path.join(__dirname, fileName), schemaValidationCode)
+ t.pass('stored the validation function')
+ generatedFileNames.push(fileName)
+ },
+ restoreFunction () {
+ t.fail('write mode ON')
+ }
+ })
+
+ const app = buildApp(factory)
+ await app.ready()
+ })
+
+ t.test('fastify integration - readMode', async t => {
+ t.plan(6)
+
+ const factory = AjvStandaloneValidator({
+ readMode: true,
+ storeFunction () {
+ t.fail('read mode ON')
+ },
+ restoreFunction (routeOpts) {
+ t.pass('restore the validation function')
+ const fileName = generateFileName(routeOpts)
+ return require(path.join(__dirname, fileName))
+ }
+ })
+
+ const app = buildApp(factory)
+ await app.ready()
+
+ let res = await app.inject({
+ url: '/foo',
+ method: 'POST',
+ payload: { hello: [] }
+ })
+ t.equal(res.statusCode, 400)
+
+ res = await app.inject({
+ url: '/bar?lang=invalid',
+ method: 'GET'
+ })
+ t.equal(res.statusCode, 400)
+
+ res = await app.inject({
+ url: '/bar?lang=it',
+ method: 'GET'
+ })
+ t.equal(res.statusCode, 200)
+ })
+
+ function buildApp (factory) {
+ const app = fastify({
+ jsonShorthand: false,
+ schemaController: {
+ compilersFactory: {
+ buildValidator: factory
+ }
+ }
+ })
+
+ app.addSchema({
+ $id: 'urn:schema:foo',
+ type: 'object',
+ properties: {
+ name: { type: 'string' },
+ id: { type: 'integer' }
+ }
+ })
+
+ app.post('/foo', {
+ schema: {
+ body: {
+ $id: 'urn:schema:body',
+ type: 'object',
+ properties: {
+ hello: { $ref: 'urn:schema:foo#/properties/name' }
+ }
+ }
+ }
+ }, () => { return 'ok' })
+
+ app.get('/bar', {
+ schema: {
+ query: {
+ $id: 'urn:schema:query',
+ type: 'object',
+ properties: {
+ lang: { type: 'string', enum: ['it', 'en'] }
+ }
+ }
+ }
+ }, () => { return 'ok' })
+
+ return app
+ }
+})
diff --git a/sdk/node_modules/@fastify/ajv-compiler/types/index.d.ts b/sdk/node_modules/@fastify/ajv-compiler/types/index.d.ts
new file mode 100644
index 00000000..5feb2455
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/types/index.d.ts
@@ -0,0 +1,72 @@
+import { AnySchema, default as _ajv, Options as AjvOptions, ValidateFunction } from "ajv";
+import { default as AjvJTD, JTDOptions } from "ajv/dist/jtd";
+import type { Options, ErrorObject } from "ajv";
+import { AnyValidateFunction } from "ajv/dist/core";
+
+type Ajv = _ajv;
+type AjvSerializerGenerator = typeof AjvCompiler
+
+type AjvJTDCompile = AjvJTD['compileSerializer']
+type AjvCompile = (schema: AnySchema, _meta?: boolean) => AnyValidateFunction
+
+declare namespace AjvCompiler {
+ export type { Options, ErrorObject }
+ export { Ajv };
+
+ export type BuildSerializerFromPool = typeof buildSerializerFromPool
+
+ export type BuildCompilerFromPool = typeof buildCompilerFromPool
+
+ export const AjvReference: Symbol
+
+ export enum HttpParts {
+ Body = "body",
+ Headers = "headers",
+ Params = "params",
+ Query = "querystring",
+ }
+
+ export type RouteDefinition = {
+ method: string,
+ url: string,
+ httpPart: HttpParts,
+ schema?: unknown,
+ }
+
+ export type StandaloneRestoreFunction = (opts: RouteDefinition) => ValidateFunction
+
+ export type StandaloneStoreFunction = (opts: RouteDefinition, schemaValidationCode: string) => void
+
+ export type StandaloneOptionsReadModeOn = {
+ readMode: true;
+ restoreFunction?: StandaloneRestoreFunction
+ }
+
+ export type StandaloneOptionsReadModeOff = {
+ readMode?: false | undefined;
+ storeFunction?: StandaloneStoreFunction;
+ }
+
+ export type StandaloneOptions = StandaloneOptionsReadModeOn | StandaloneOptionsReadModeOff
+
+ export type ValidatorFactory = BuildCompilerFromPool | BuildSerializerFromPool
+
+ export type ValidatorCompiler = ReturnType
+
+ export { StandaloneValidator }
+
+ export const AjvCompiler: AjvSerializerGenerator
+ export { AjvCompiler as default }
+}
+
+declare function buildCompilerFromPool(externalSchemas: { [key: string]: AnySchema | AnySchema[] }, options?: { mode: 'JTD'; customOptions?: JTDOptions; onCreate?: (ajvInstance: Ajv) => void }): AjvCompile
+declare function buildCompilerFromPool(externalSchemas: { [key: string]: AnySchema | AnySchema[] }, options?: { mode?: never; customOptions?: AjvOptions; onCreate?: (ajvInstance: Ajv) => void }): AjvCompile
+
+declare function buildSerializerFromPool(externalSchemas: any, serializerOpts?: { mode?: never; } & JTDOptions): AjvJTDCompile
+
+declare function AjvCompiler(opts: { jtdSerializer: true }): AjvCompiler.BuildSerializerFromPool
+declare function AjvCompiler(opts?: { jtdSerializer?: false }): AjvCompiler.BuildCompilerFromPool
+
+declare function StandaloneValidator(options: AjvCompiler.StandaloneOptions): AjvCompiler.BuildCompilerFromPool;
+
+export = AjvCompiler
diff --git a/sdk/node_modules/@fastify/ajv-compiler/types/index.test-d.ts b/sdk/node_modules/@fastify/ajv-compiler/types/index.test-d.ts
new file mode 100644
index 00000000..22ff4678
--- /dev/null
+++ b/sdk/node_modules/@fastify/ajv-compiler/types/index.test-d.ts
@@ -0,0 +1,227 @@
+import { AnySchemaObject, ValidateFunction } from "ajv";
+import { AnyValidateFunction } from "ajv/dist/core";
+import { expectAssignable, expectType } from "tsd";
+import AjvCompiler, { AjvReference, ValidatorFactory, StandaloneValidator, RouteDefinition, ErrorObject, BuildCompilerFromPool, BuildSerializerFromPool, ValidatorCompiler } from "..";
+
+{
+ const compiler = AjvCompiler({});
+ expectType(compiler);
+}
+{
+ const compiler = AjvCompiler();
+ expectType(compiler);
+}
+{
+ const compiler = AjvCompiler({ jtdSerializer: false});
+ expectType(compiler);
+}
+
+{
+ const factory = AjvCompiler({ jtdSerializer: false });
+ expectType(factory);
+ factory({}, {
+ onCreate(ajv) {
+ expectType(ajv)
+ }
+ });
+}
+
+{
+ const compiler = AjvCompiler({ jtdSerializer: true});
+ expectType(compiler);
+}
+const reader = StandaloneValidator({
+ readMode: true,
+ restoreFunction: (route: RouteDefinition) => {
+ expectAssignable(route)
+ return {} as ValidateFunction
+ },
+});
+expectAssignable(reader);
+
+const writer = StandaloneValidator({
+ readMode: false,
+ storeFunction: (route: RouteDefinition, code: string) => {
+ expectAssignable(route)
+ expectAssignable(code)
+ },
+});
+expectAssignable(writer);
+
+expectType(({} as ErrorObject).data)
+expectType(({} as ErrorObject).instancePath)
+expectType(({} as ErrorObject).keyword)
+expectType(({} as ErrorObject).message)
+expectType>(({} as ErrorObject).params)
+expectType(({} as ErrorObject).parentSchema)
+expectType(({} as ErrorObject).propertyName)
+expectType(({} as ErrorObject).schema)
+expectType(({} as ErrorObject).schemaPath)
+
+expectType(AjvReference)
+
+{
+ const jtdSchema = {
+ discriminator: 'version',
+ mapping: {
+ 1: {
+ properties: {
+ foo: { type: 'uint8' }
+ }
+ },
+ 2: {
+ properties: {
+ foo: { type: 'string' }
+ }
+ }
+ }
+ }
+
+ const externalSchemas1 = {
+ foo: {
+ definitions: {
+ coordinates: {
+ properties: {
+ lat: { type: 'float32' },
+ lng: { type: 'float32' }
+ }
+ }
+ }
+ }
+ }
+
+ const factory = AjvCompiler({ jtdSerializer: true })
+ expectType(factory)
+ const compiler = factory(externalSchemas1, {})
+ expectAssignable(compiler)
+ const serializeFunc = compiler({ schema: jtdSchema })
+ expectType<(data: unknown) => string>(serializeFunc)
+ expectType(serializeFunc({ version: '1', foo: 42 }))
+}
+// JTD
+{
+
+ const factory = AjvCompiler()
+ expectType(factory)
+
+ const jtdSchema = {
+ discriminator: 'version',
+ mapping: {
+ 1: {
+ properties: {
+ foo: { type: 'uint8' }
+ }
+ },
+ 2: {
+ properties: {
+ foo: { type: 'string' }
+ }
+ }
+ }
+ }
+
+ const compiler = factory({}, {
+ customOptions: {},
+ mode: 'JTD'
+ })
+ expectAssignable(compiler)
+ const validatorFunc = compiler({ schema: jtdSchema })
+ expectAssignable(validatorFunc)
+
+ expectType>(validatorFunc({
+ version: '2',
+ foo: []
+ }))
+}
+
+// generate standalone code
+{
+ const base = {
+ $id: 'urn:schema:base',
+ definitions: {
+ hello: { type: 'string' }
+ },
+ type: 'object',
+ properties: {
+ hello: { $ref: '#/definitions/hello' }
+ }
+ }
+
+ const refSchema = {
+ $id: 'urn:schema:ref',
+ type: 'object',
+ properties: {
+ hello: { $ref: 'urn:schema:base#/definitions/hello' }
+ }
+ }
+
+ const endpointSchema = {
+ schema: {
+ $id: 'urn:schema:endpoint',
+ $ref: 'urn:schema:ref'
+ }
+ }
+
+ const schemaMap = {
+ [base.$id]: base,
+ [refSchema.$id]: refSchema
+ }
+
+ const factory = StandaloneValidator({
+ readMode: false,
+ storeFunction(routeOpts, schemaValidationCode) {
+ expectType(routeOpts)
+ expectType(schemaValidationCode)
+ }
+ })
+ expectAssignable(factory)
+
+ const compiler = factory(schemaMap)
+ expectAssignable(compiler)
+ expectAssignable(compiler(endpointSchema))
+}
+
+{
+ const base = {
+ $id: 'urn:schema:base',
+ definitions: {
+ hello: { type: 'string' }
+ },
+ type: 'object',
+ properties: {
+ hello: { $ref: '#/definitions/hello' }
+ }
+ }
+
+ const refSchema = {
+ $id: 'urn:schema:ref',
+ type: 'object',
+ properties: {
+ hello: { $ref: 'urn:schema:base#/definitions/hello' }
+ }
+ }
+
+ const endpointSchema = {
+ schema: {
+ $id: 'urn:schema:endpoint',
+ $ref: 'urn:schema:ref'
+ }
+ }
+
+ const schemaMap = {
+ [base.$id]: base,
+ [refSchema.$id]: refSchema
+ }
+ const factory = StandaloneValidator({
+ readMode: true,
+ restoreFunction(routeOpts) {
+ expectType(routeOpts)
+ return {} as ValidateFunction
+ }
+ })
+ expectAssignable(factory)
+
+ const compiler = factory(schemaMap)
+ expectAssignable(compiler)
+ expectType>(compiler(endpointSchema))
+}
diff --git a/sdk/node_modules/@fastify/error/.gitattributes b/sdk/node_modules/@fastify/error/.gitattributes
new file mode 100644
index 00000000..a0e7df93
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/.gitattributes
@@ -0,0 +1,2 @@
+# Set default behavior to automatically convert line endings
+* text=auto eol=lf
diff --git a/sdk/node_modules/@fastify/error/.github/dependabot.yml b/sdk/node_modules/@fastify/error/.github/dependabot.yml
new file mode 100644
index 00000000..dfa7fa6c
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/.github/dependabot.yml
@@ -0,0 +1,13 @@
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "monthly"
+ open-pull-requests-limit: 10
+
+ - package-ecosystem: "npm"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ open-pull-requests-limit: 10
diff --git a/sdk/node_modules/@fastify/error/.github/workflows/ci.yml b/sdk/node_modules/@fastify/error/.github/workflows/ci.yml
new file mode 100644
index 00000000..7b002766
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/.github/workflows/ci.yml
@@ -0,0 +1,23 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - main
+ - master
+ - next
+ - 'v*'
+ paths-ignore:
+ - 'docs/**'
+ - '*.md'
+ pull_request:
+ paths-ignore:
+ - 'docs/**'
+ - '*.md'
+
+jobs:
+ test:
+ uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
+ with:
+ license-check: true
+ lint: true
diff --git a/sdk/node_modules/@fastify/error/.taprc b/sdk/node_modules/@fastify/error/.taprc
new file mode 100644
index 00000000..7695d35c
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/.taprc
@@ -0,0 +1,2 @@
+files:
+ - test/**/*.test.js
\ No newline at end of file
diff --git a/sdk/node_modules/@fastify/error/LICENSE b/sdk/node_modules/@fastify/error/LICENSE
new file mode 100644
index 00000000..08250b88
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2020 Fastify
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/sdk/node_modules/@fastify/error/README.md b/sdk/node_modules/@fastify/error/README.md
new file mode 100644
index 00000000..ee705d0f
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/README.md
@@ -0,0 +1,62 @@
+# @fastify/error
+
+
+[](https://www.npmjs.com/package/@fastify/error)
+[](https://standardjs.com/)
+
+A small utility, used by Fastify itself, for generating consistent error objects across your codebase and plugins.
+
+### Install
+```
+npm i @fastify/error
+```
+
+### Usage
+
+The module exports a function that you can use for consistent error objects, it takes 4 parameters:
+
+```
+createError(code, message [, statusCode [, Base]])
+```
+
+- `code` (`string`, required) - The error code, you can access it later with `error.code`. For consistency, we recommend prefixing plugin error codes with `FST_`
+- `message` (`string`, required) - The error message. You can also use interpolated strings for formatting the message.
+- `statusCode` (`number`, optional) - The status code that Fastify will use if the error is sent via HTTP.
+- `Base` (`ErrorConstructor`, optional) - The base error object that will be used. (eg `TypeError`, `RangeError`)
+
+```js
+const createError = require('@fastify/error')
+const CustomError = createError('ERROR_CODE', 'Hello')
+console.log(new CustomError()) // error.message => 'Hello'
+```
+
+How to use an interpolated string:
+```js
+const createError = require('@fastify/error')
+const CustomError = createError('ERROR_CODE', 'Hello %s')
+console.log(new CustomError('world')) // error.message => 'Hello world'
+```
+
+How to add cause:
+```js
+const createError = require('@fastify/error')
+const CustomError = createError('ERROR_CODE', 'Hello %s')
+console.log(new CustomError('world', {cause: new Error('cause')}))
+// error.message => 'Hello world'
+// error.cause => Error('cause')
+```
+
+### TypeScript
+
+It is possible to limit your error constructor with a generic type using TypeScript:
+
+```ts
+const CustomError = createError<[string]>('ERROR_CODE', 'Hello %s')
+new CustomError('world')
+//@ts-expect-error
+new CustomError(1)
+```
+
+## License
+
+Licensed under [MIT](./LICENSE).
diff --git a/sdk/node_modules/@fastify/error/benchmarks/create.js b/sdk/node_modules/@fastify/error/benchmarks/create.js
new file mode 100644
index 00000000..bb9abbfe
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/benchmarks/create.js
@@ -0,0 +1,9 @@
+'use strict'
+
+const benchmark = require('benchmark')
+const createError = require('..')
+
+new benchmark.Suite()
+ .add('create FastifyError', function () { createError('CODE', 'Not available') }, { minSamples: 100 })
+ .on('cycle', function onCycle (event) { console.log(String(event.target)) })
+ .run({ async: false })
diff --git a/sdk/node_modules/@fastify/error/benchmarks/instantiate.js b/sdk/node_modules/@fastify/error/benchmarks/instantiate.js
new file mode 100644
index 00000000..890aaf0a
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/benchmarks/instantiate.js
@@ -0,0 +1,18 @@
+'use strict'
+
+const benchmark = require('benchmark')
+const createError = require('..')
+
+const FastifyError = createError('CODE', 'Not available')
+const FastifyError1 = createError('CODE', 'Not %s available')
+const FastifyError2 = createError('CODE', 'Not %s available %s')
+
+const cause = new Error('cause')
+new benchmark.Suite()
+ .add('instantiate Error', function () { new Error() }, { minSamples: 100 }) // eslint-disable-line no-new
+ .add('instantiate FastifyError', function () { new FastifyError() }, { minSamples: 100 }) // eslint-disable-line no-new
+ .add('instantiate FastifyError arg 1', function () { new FastifyError1('q') }, { minSamples: 100 }) // eslint-disable-line no-new
+ .add('instantiate FastifyError arg 2', function () { new FastifyError2('qq', 'ss') }, { minSamples: 100 }) // eslint-disable-line no-new
+ .add('instantiate FastifyError cause', function () { new FastifyError2({ cause }) }, { minSamples: 100 }) // eslint-disable-line no-new
+ .on('cycle', function onCycle (event) { console.log(String(event.target)) })
+ .run({ async: false })
diff --git a/sdk/node_modules/@fastify/error/benchmarks/no-stack.js b/sdk/node_modules/@fastify/error/benchmarks/no-stack.js
new file mode 100644
index 00000000..b626b5c7
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/benchmarks/no-stack.js
@@ -0,0 +1,13 @@
+'use strict'
+
+const benchmark = require('benchmark')
+const createError = require('..')
+
+const FastifyError = createError('CODE', 'Not available')
+Error.stackTraceLimit = 0
+
+new benchmark.Suite()
+ .add('no-stack instantiate Error', function () { new Error() }, { minSamples: 100 }) // eslint-disable-line no-new
+ .add('no-stack instantiate FastifyError', function () { new FastifyError() }, { minSamples: 100 }) // eslint-disable-line no-new
+ .on('cycle', function onCycle (event) { console.log(String(event.target)) })
+ .run({ async: false })
diff --git a/sdk/node_modules/@fastify/error/benchmarks/toString.js b/sdk/node_modules/@fastify/error/benchmarks/toString.js
new file mode 100644
index 00000000..11915492
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/benchmarks/toString.js
@@ -0,0 +1,11 @@
+'use strict'
+
+const benchmark = require('benchmark')
+const createError = require('..')
+
+const FastifyError = createError('CODE', 'Not available')
+
+new benchmark.Suite()
+ .add('FastifyError toString', function () { new FastifyError().toString() }, { minSamples: 100 })
+ .on('cycle', function onCycle (event) { console.log(String(event.target)) })
+ .run({ async: false })
diff --git a/sdk/node_modules/@fastify/error/index.js b/sdk/node_modules/@fastify/error/index.js
new file mode 100644
index 00000000..257cd7c7
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/index.js
@@ -0,0 +1,53 @@
+'use strict'
+
+const { format } = require('node:util')
+
+function toString () {
+ return `${this.name} [${this.code}]: ${this.message}`
+}
+
+function createError (code, message, statusCode = 500, Base = Error) {
+ if (!code) throw new Error('Fastify error code must not be empty')
+ if (!message) throw new Error('Fastify error message must not be empty')
+
+ code = code.toUpperCase()
+ !statusCode && (statusCode = undefined)
+
+ function FastifyError (...args) {
+ if (!new.target) {
+ return new FastifyError(...args)
+ }
+
+ this.code = code
+ this.name = 'FastifyError'
+ this.statusCode = statusCode
+
+ const lastElement = args.length - 1
+ if (lastElement !== -1 && args[lastElement] && typeof args[lastElement] === 'object' && 'cause' in args[lastElement]) {
+ this.cause = args.pop().cause
+ }
+
+ this.message = format(message, ...args)
+
+ Error.stackTraceLimit !== 0 && Error.captureStackTrace(this, FastifyError)
+ }
+
+ FastifyError.prototype = Object.create(Base.prototype, {
+ constructor: {
+ value: FastifyError,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ }
+ })
+
+ FastifyError.prototype[Symbol.toStringTag] = 'Error'
+
+ FastifyError.prototype.toString = toString
+
+ return FastifyError
+}
+
+module.exports = createError
+module.exports.default = createError
+module.exports.createError = createError
diff --git a/sdk/node_modules/@fastify/error/package.json b/sdk/node_modules/@fastify/error/package.json
new file mode 100644
index 00000000..805b9ac9
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@fastify/error",
+ "version": "3.4.1",
+ "description": "A small utility, used by Fastify itself, for generating consistent error objects across your codebase and plugins.",
+ "main": "index.js",
+ "type": "commonjs",
+ "types": "types/index.d.ts",
+ "scripts": {
+ "lint": "standard",
+ "lint:fix": "standard --fix",
+ "test": "npm run test:unit && npm run test:typescript",
+ "test:unit": "tap",
+ "test:typescript": "tsd"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/fastify/fastify-error.git"
+ },
+ "keywords": [
+ "fastify",
+ "error",
+ "utility",
+ "plugin"
+ ],
+ "author": "Tomas Della Vedova",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/fastify/fastify-error/issues"
+ },
+ "homepage": "https://github.com/fastify/fastify-error#readme",
+ "devDependencies": {
+ "benchmark": "^2.1.4",
+ "standard": "^17.0.0",
+ "tap": "^16.0.0",
+ "tsd": "^0.29.0"
+ },
+ "tsd": {
+ "compilerOptions": {
+ "esModuleInterop": true
+ }
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/sdk/node_modules/@fastify/error/test/index.test.js b/sdk/node_modules/@fastify/error/test/index.test.js
new file mode 100644
index 00000000..2fabd6fa
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/test/index.test.js
@@ -0,0 +1,184 @@
+'use strict'
+
+const { test } = require('tap')
+const createError = require('..')
+
+test('Create error with zero parameter', t => {
+ t.plan(6)
+
+ const NewError = createError('CODE', 'Not available')
+ const err = new NewError()
+ t.ok(err instanceof Error)
+ t.equal(err.name, 'FastifyError')
+ t.equal(err.message, 'Not available')
+ t.equal(err.code, 'CODE')
+ t.equal(err.statusCode, 500)
+ t.ok(err.stack)
+})
+
+test('Create error with 1 parameter', t => {
+ t.plan(6)
+
+ const NewError = createError('CODE', 'hey %s')
+ const err = new NewError('alice')
+ t.ok(err instanceof Error)
+ t.equal(err.name, 'FastifyError')
+ t.equal(err.message, 'hey alice')
+ t.equal(err.code, 'CODE')
+ t.equal(err.statusCode, 500)
+ t.ok(err.stack)
+})
+
+test('Create error with 1 parameter set to undefined', t => {
+ t.plan(1)
+
+ const NewError = createError('CODE', 'hey %s')
+ const err = new NewError(undefined)
+ t.equal(err.message, 'hey undefined')
+})
+
+test('Create error with 2 parameters', (t) => {
+ t.plan(6)
+
+ const NewError = createError('CODE', 'hey %s, I like your %s')
+ const err = new NewError('alice', 'attitude')
+ t.ok(err instanceof Error)
+ t.equal(err.name, 'FastifyError')
+ t.equal(err.message, 'hey alice, I like your attitude')
+ t.equal(err.code, 'CODE')
+ t.equal(err.statusCode, 500)
+ t.ok(err.stack)
+})
+
+test('Create error with 2 parameters set to undefined', t => {
+ t.plan(1)
+
+ const NewError = createError('CODE', 'hey %s, I like your %s')
+ const err = new NewError(undefined, undefined)
+ t.equal(err.message, 'hey undefined, I like your undefined')
+})
+
+test('Create error with 3 parameters', t => {
+ t.plan(6)
+
+ const NewError = createError('CODE', 'hey %s, I like your %s %s')
+ const err = new NewError('alice', 'attitude', 'see you')
+ t.ok(err instanceof Error)
+ t.equal(err.name, 'FastifyError')
+ t.equal(err.message, 'hey alice, I like your attitude see you')
+ t.equal(err.code, 'CODE')
+ t.equal(err.statusCode, 500)
+ t.ok(err.stack)
+})
+
+test('Create error with 3 parameters set to undefined', t => {
+ t.plan(4)
+
+ const NewError = createError('CODE', 'hey %s, I like your %s %s')
+ const err = new NewError(undefined, undefined, undefined)
+ t.equal(err.message, 'hey undefined, I like your undefined undefined')
+ t.equal(err.code, 'CODE')
+ t.equal(err.statusCode, 500)
+ t.ok(err.stack)
+})
+
+test('Create error with 4 parameters set to undefined', t => {
+ t.plan(4)
+
+ const NewError = createError('CODE', 'hey %s, I like your %s %s and %s')
+ const err = new NewError(undefined, undefined, undefined, undefined)
+ t.equal(err.message, 'hey undefined, I like your undefined undefined and undefined')
+ t.equal(err.code, 'CODE')
+ t.equal(err.statusCode, 500)
+ t.ok(err.stack)
+})
+
+test('Create error with no statusCode property', t => {
+ t.plan(6)
+
+ const NewError = createError('CODE', 'hey %s', 0)
+ const err = new NewError('dude')
+ t.ok(err instanceof Error)
+ t.equal(err.name, 'FastifyError')
+ t.equal(err.message, 'hey dude')
+ t.equal(err.code, 'CODE')
+ t.equal(err.statusCode, undefined)
+ t.ok(err.stack)
+})
+
+test('Should throw when error code has no fastify code', t => {
+ t.plan(1)
+
+ t.throws(() => createError(), new Error('Fastify error code must not be empty'))
+})
+
+test('Should throw when error code has no message', t => {
+ t.plan(1)
+
+ t.throws(() => createError('code'), new Error('Fastify error message must not be empty'))
+})
+
+test('Create error with different base', t => {
+ t.plan(7)
+
+ const NewError = createError('CODE', 'hey %s', 500, TypeError)
+ const err = new NewError('dude')
+ t.ok(err instanceof Error)
+ t.ok(err instanceof TypeError)
+ t.equal(err.name, 'FastifyError')
+ t.equal(err.message, 'hey dude')
+ t.equal(err.code, 'CODE')
+ t.equal(err.statusCode, 500)
+ t.ok(err.stack)
+})
+
+test('FastifyError.toString returns code', t => {
+ t.plan(1)
+
+ const NewError = createError('CODE', 'foo')
+ const err = new NewError()
+ t.equal(err.toString(), 'FastifyError [CODE]: foo')
+})
+
+test('Create the error without the new keyword', t => {
+ t.plan(6)
+
+ const NewError = createError('CODE', 'Not available')
+ const err = NewError()
+ t.ok(err instanceof Error)
+ t.equal(err.name, 'FastifyError')
+ t.equal(err.message, 'Not available')
+ t.equal(err.code, 'CODE')
+ t.equal(err.statusCode, 500)
+ t.ok(err.stack)
+})
+
+test('Create an error with cause', t => {
+ t.plan(2)
+ const cause = new Error('HEY')
+ const NewError = createError('CODE', 'Not available')
+ const err = NewError({ cause })
+
+ t.ok(err instanceof Error)
+ t.equal(err.cause, cause)
+})
+
+test('Create an error with cause and message', t => {
+ t.plan(2)
+ const cause = new Error('HEY')
+ const NewError = createError('CODE', 'Not available: %s')
+ const err = NewError('foo', { cause })
+
+ t.ok(err instanceof Error)
+ t.equal(err.cause, cause)
+})
+
+test('Create an error with last argument null', t => {
+ t.plan(2)
+ const cause = new Error('HEY')
+ const NewError = createError('CODE', 'Not available')
+ const err = NewError({ cause }, null)
+
+ t.ok(err instanceof Error)
+ t.notOk(err.cause)
+})
diff --git a/sdk/node_modules/@fastify/error/types/index.d.ts b/sdk/node_modules/@fastify/error/types/index.d.ts
new file mode 100644
index 00000000..332b1b6b
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/types/index.d.ts
@@ -0,0 +1,44 @@
+declare function createError (
+ code: C,
+ message: string,
+ statusCode: SC,
+ Base?: ErrorConstructor
+): createError.FastifyErrorConstructor<{ code: C, statusCode: SC }, Arg>
+
+declare function createError (
+ code: C,
+ message: string,
+ statusCode?: number,
+ Base?: ErrorConstructor
+): createError.FastifyErrorConstructor<{ code: C }, Arg>
+
+declare function createError (
+ code: string,
+ message: string,
+ statusCode?: number,
+ Base?: ErrorConstructor
+): createError.FastifyErrorConstructor<{ code: string }, Arg>
+
+type CreateError = typeof createError
+
+declare namespace createError {
+ export interface FastifyError extends Error {
+ code: string
+ name: string
+ statusCode?: number
+ }
+
+ export interface FastifyErrorConstructor<
+ E extends { code: string, statusCode?: number } = { code: string, statusCode?: number },
+ T extends unknown[] = [any?, any?, any?]
+ > {
+ new(...arg: T): FastifyError & E
+ (...arg: T): FastifyError & E
+ readonly prototype: FastifyError & E
+ }
+
+ export const createError: CreateError
+ export { createError as default }
+}
+
+export = createError
diff --git a/sdk/node_modules/@fastify/error/types/index.test-d.ts b/sdk/node_modules/@fastify/error/types/index.test-d.ts
new file mode 100644
index 00000000..cf5ea564
--- /dev/null
+++ b/sdk/node_modules/@fastify/error/types/index.test-d.ts
@@ -0,0 +1,72 @@
+import createError, { FastifyError, FastifyErrorConstructor } from '..'
+import { expectType, expectError } from 'tsd'
+
+const CustomError = createError('ERROR_CODE', 'message')
+expectType>(CustomError)
+const err = new CustomError()
+expectType(err)
+expectType<'ERROR_CODE'>(err.code)
+expectType(err.message)
+expectType(err.statusCode)
+
+const CustomTypedError = createError('OTHER_CODE', 'message', 400)
+expectType>(CustomTypedError)
+const typed = new CustomTypedError()
+expectType(typed)
+expectType<'OTHER_CODE'>(typed.code)
+expectType(typed.message)
+expectType<400>(typed.statusCode)
+
+/* eslint-disable no-new */
+const CustomTypedArgError = createError<[string]>('OTHER_CODE', 'expect %s message', 400)
+CustomTypedArgError('a')
+expectError(CustomTypedArgError('a', 'b'))
+expectError(new CustomTypedArgError('a', 'b'))
+expectError(CustomTypedArgError(1))
+expectError(new CustomTypedArgError(1))
+
+const CustomTypedArgError2 = createError('OTHER_CODE', 'expect %s message', 400)
+CustomTypedArgError2('a')
+expectError(CustomTypedArgError2('a', 'b'))
+expectError(new CustomTypedArgError2('a', 'b'))
+expectError(CustomTypedArgError2(1))
+expectError(new CustomTypedArgError2(1))
+
+const CustomTypedArgError3 = createError('OTHER_CODE', 'expect %s message but got %s', 400)
+expectError(CustomTypedArgError3('a'))
+CustomTypedArgError3('a', 'b')
+new CustomTypedArgError3('a', 'b')
+expectError(CustomTypedArgError3(1))
+expectError(new CustomTypedArgError3(1))
+expectError(new CustomTypedArgError3(1, 2))
+expectError(new CustomTypedArgError3('1', 2))
+expectError(new CustomTypedArgError3(1, '2'))
+
+const CustomTypedArgError4 = createError('OTHER_CODE', 'expect %s message but got %s', 400)
+expectError(CustomTypedArgError4('a'))
+CustomTypedArgError4('a', 'b')
+new CustomTypedArgError4('a', 'b')
+expectError(CustomTypedArgError4(1))
+expectError(new CustomTypedArgError4(1))
+expectError(new CustomTypedArgError4(1, 2))
+expectError(new CustomTypedArgError4('1', 2))
+expectError(new CustomTypedArgError4(1, '2'))
+
+const CustomTypedArgError5 = createError<[string, string, string, string]>('OTHER_CODE', 'expect %s message but got %s. Please contact %s by emailing to %s', 400)
+expectError(CustomTypedArgError5('a'))
+expectError(new CustomTypedArgError5('a', 'b'))
+expectError(new CustomTypedArgError5('a', 'b', 'c'))
+CustomTypedArgError5('a', 'b', 'c', 'd')
+expectError(new CustomTypedArgError5('a', 'b', 'c', 'd', 'e'))
+
+const CustomTypedArgError6 = createError('OTHER_CODE', 'expect %s message but got %s. Please contact %s by emailing to %s', 400)
+expectError(CustomTypedArgError6('a'))
+expectError(new CustomTypedArgError6('a', 'b'))
+expectError(new CustomTypedArgError6('a', 'b', 'c'))
+CustomTypedArgError6('a', 'b', 'c', 'd')
+expectError(new CustomTypedArgError6('a', 'b', 'c', 'd', 'e'))
+
+
+const CustomErrorWithErrorConstructor = createError('ERROR_CODE', 'message', 500, TypeError)
+expectType>(CustomErrorWithErrorConstructor)
+CustomErrorWithErrorConstructor({cause: new Error('Error')})
\ No newline at end of file
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/.eslintrc b/sdk/node_modules/@fastify/fast-json-stringify-compiler/.eslintrc
new file mode 100644
index 00000000..185ff2ec
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/.eslintrc
@@ -0,0 +1 @@
+{"extends": "standard"}
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/.github/dependabot.yml b/sdk/node_modules/@fastify/fast-json-stringify-compiler/.github/dependabot.yml
new file mode 100644
index 00000000..dfa7fa6c
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/.github/dependabot.yml
@@ -0,0 +1,13 @@
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "monthly"
+ open-pull-requests-limit: 10
+
+ - package-ecosystem: "npm"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ open-pull-requests-limit: 10
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/ci.yml b/sdk/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/ci.yml
new file mode 100644
index 00000000..079a8f01
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/ci.yml
@@ -0,0 +1,18 @@
+name: CI
+
+on:
+ push:
+ paths-ignore:
+ - 'docs/**'
+ - '*.md'
+ pull_request:
+ paths-ignore:
+ - 'docs/**'
+ - '*.md'
+
+jobs:
+ test:
+ uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
+ with:
+ license-check: true
+ lint: true
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/LICENSE b/sdk/node_modules/@fastify/fast-json-stringify-compiler/LICENSE
new file mode 100644
index 00000000..5559f4f5
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 Fastify
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/README.md b/sdk/node_modules/@fastify/fast-json-stringify-compiler/README.md
new file mode 100644
index 00000000..911f7e02
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/README.md
@@ -0,0 +1,127 @@
+# @fastify/fast-json-stringify-compiler
+Build and manage the [`fast-json-stringify`](https://www.npmjs.com/package/fast-json-stringify) instances for the fastify framework.
+This package is responsible for compiling the application's `response` JSON schemas into optimized functions to speed up the response time.
+
+[](http://standardjs.com/)
+[](https://github.com/fastify/fast-json-stringify-compiler/actions/workflows/ci.yml)
+
+
+## Versions
+
+| `@fastify/fast-json-stringify-compiler` | `fast-json-stringify` | Supported `fastify` |
+|----------------------------------------:|----------------------:|--------------------:|
+| v1.x | v3.x | ^3.x |
+| v2.x | v3.x | ^4.x |
+| v3.x | v4.x | ^4.x |
+| v4.x | v5.x | ^4.x |
+
+### fast-json-stringify Configuration
+
+The `fast-json-stringify` configuration is the default one. You can check it the default settings in the [`fast-json-stringify` option](https://github.com/fastify/fast-json-stringify/#options) documentation.
+
+You can also override the default configuration by passing the [`serializerOpts`](https://www.fastify.io/docs/latest/Reference/Server/#serializeropts) configuration to the Fastify instance.
+
+## Usage
+
+This module is already used as default by Fastify.
+If you need to provide to your server instance a different version, refer to [the official doc](https://www.fastify.io/docs/latest/Reference/Server/#schemacontroller).
+
+### fast-json-stringify Standalone
+
+`fast-json-stringify@v4.1.0` introduces the [standalone feature](https://github.com/fastify/fast-json-stringify#standalone) that let you to pre-compile your schemas and use them in your application for a faster startup.
+
+To use this feature, you must be aware of the following:
+
+1. You must generate and save the application's compiled schemas.
+2. Read the compiled schemas from the file and provide them back to your Fastify application.
+
+
+#### Generate and save the compiled schemas
+
+Fastify helps you to generate the serialization schemas functions and it is your choice to save them where you want.
+To accomplish this, you must use a new compiler: `@fastify/fast-json-stringify-compiler/standalone`.
+
+You must provide 2 parameters to this compiler:
+
+- `readMode: false`: a boolean to indicate that you want generate the schemas functions string.
+- `storeFunction`" a sync function that must store the source code of the schemas functions. You may provide an async function too, but you must manage errors.
+
+When `readMode: false`, **the compiler is meant to be used in development ONLY**.
+
+
+```js
+const { StandaloneSerializer } = require('@fastify/fast-json-stringify-compiler')
+
+const factory = StandaloneSerializer({
+ readMode: false,
+ storeFunction (routeOpts, schemaSerializationCode) {
+ // routeOpts is like: { schema, method, url, httpStatus }
+ // schemaSerializationCode is a string source code that is the compiled schema function
+ const fileName = generateFileName(routeOpts)
+ fs.writeFileSync(path.join(__dirname, fileName), schemaSerializationCode)
+ }
+})
+
+const app = fastify({
+ jsonShorthand: false,
+ schemaController: {
+ compilersFactory: {
+ buildSerializer: factory
+ }
+ }
+})
+
+// ... add all your routes with schemas ...
+
+app.ready().then(() => {
+ // at this stage all your schemas are compiled and stored in the file system
+ // now it is important to turn off the readMode
+})
+```
+
+#### Read the compiled schemas functions
+
+At this stage, you should have a file for every route's schema.
+To use them, you must use the `@fastify/fast-json-stringify-compiler/standalone` with the parameters:
+
+- `readMode: true`: a boolean to indicate that you want read and use the schemas functions string.
+- `restoreFunction`" a sync function that must return a function to serialize the route's payload.
+
+Important keep away before you continue reading the documentation:
+
+- when you use the `readMode: true`, the application schemas are not compiled (they are ignored). So, if you change your schemas, you must recompile them!
+- as you can see, you must relate the route's schema to the file name using the `routeOpts` object. You may use the `routeOpts.schema.$id` field to do so, it is up to you to define a unique schema identifier.
+
+```js
+const { StandaloneSerializer } = require('@fastify/fast-json-stringify-compiler')
+
+const factory = StandaloneSerializer({
+ readMode: true,
+ restoreFunction (routeOpts) {
+ // routeOpts is like: { schema, method, url, httpStatus }
+ const fileName = generateFileName(routeOpts)
+ return require(path.join(__dirname, fileName))
+ }
+})
+
+const app = fastify({
+ jsonShorthand: false,
+ schemaController: {
+ compilersFactory: {
+ buildSerializer: factory
+ }
+ }
+})
+
+// ... add all your routes with schemas as before...
+
+app.listen({ port: 3000 })
+```
+
+### How it works
+
+This module provide a factory function to produce [Serializer Compilers](https://www.fastify.io/docs/latest/Reference/Server/#serializercompiler) functions.
+
+## License
+
+Licensed under [MIT](./LICENSE).
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/index.js b/sdk/node_modules/@fastify/fast-json-stringify-compiler/index.js
new file mode 100644
index 00000000..a021ea14
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/index.js
@@ -0,0 +1,23 @@
+'use strict'
+
+const fastJsonStringify = require('fast-json-stringify')
+
+function SerializerSelector () {
+ return function buildSerializerFactory (externalSchemas, serializerOpts) {
+ const fjsOpts = Object.assign({}, serializerOpts, { schema: externalSchemas })
+ return responseSchemaCompiler.bind(null, fjsOpts)
+ }
+}
+
+function responseSchemaCompiler (fjsOpts, { schema /* method, url, httpStatus */ }) {
+ if (fjsOpts.schema && schema.$id && fjsOpts.schema[schema.$id]) {
+ fjsOpts.schema = { ...fjsOpts.schema }
+ delete fjsOpts.schema[schema.$id]
+ }
+ return fastJsonStringify(schema, fjsOpts)
+}
+
+module.exports = SerializerSelector
+module.exports.default = SerializerSelector
+module.exports.SerializerSelector = SerializerSelector
+module.exports.StandaloneSerializer = require('./standalone')
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/package.json b/sdk/node_modules/@fastify/fast-json-stringify-compiler/package.json
new file mode 100644
index 00000000..c9511bdd
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/package.json
@@ -0,0 +1,40 @@
+{
+ "name": "@fastify/fast-json-stringify-compiler",
+ "description": "Build and manage the fast-json-stringify instances for the fastify framework",
+ "version": "4.3.0",
+ "main": "index.js",
+ "types": "types/index.d.ts",
+ "scripts": {
+ "lint": "standard",
+ "lint:fix": "standard --fix",
+ "unit": "tap test/**/*.test.js",
+ "test": "npm run unit && npm run test:typescript",
+ "test:typescript": "tsd"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/fastify/fast-json-stringify-compiler.git"
+ },
+ "keywords": [],
+ "author": "Manuel Spigolon (https://github.com/Eomm)",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/fastify/fast-json-stringify-compiler/issues"
+ },
+ "homepage": "https://github.com/fastify/fast-json-stringify-compiler#readme",
+ "devDependencies": {
+ "@fastify/pre-commit": "^2.0.2",
+ "fastify": "^4.0.0",
+ "sanitize-filename": "^1.6.3",
+ "standard": "^17.0.0",
+ "tap": "^16.0.0",
+ "tsd": "^0.28.0"
+ },
+ "pre-commit": [
+ "lint",
+ "test"
+ ],
+ "dependencies": {
+ "fast-json-stringify": "^5.7.0"
+ }
+}
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/standalone.js b/sdk/node_modules/@fastify/fast-json-stringify-compiler/standalone.js
new file mode 100644
index 00000000..39b4937d
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/standalone.js
@@ -0,0 +1,42 @@
+'use strict'
+
+const SerializerSelector = require('./index')
+
+function StandaloneSerializer (options = { readMode: true }) {
+ if (options.readMode === true && typeof options.restoreFunction !== 'function') {
+ throw new Error('You must provide a function for the restoreFunction-option when readMode ON')
+ }
+
+ if (options.readMode !== true && typeof options.storeFunction !== 'function') {
+ throw new Error('You must provide a function for the storeFunction-option when readMode OFF')
+ }
+
+ if (options.readMode === true) {
+ // READ MODE: it behalf only in the restore function provided by the user
+ return function wrapper () {
+ return function (opts) {
+ return options.restoreFunction(opts)
+ }
+ }
+ }
+
+ // WRITE MODE: it behalf on the default SerializerSelector, wrapping the API to run the Ajv Standalone code generation
+ const factory = SerializerSelector()
+ return function wrapper (externalSchemas, serializerOpts = {}) {
+ // to generate the serialization source code, this option is mandatory
+ serializerOpts.mode = 'standalone'
+
+ const compiler = factory(externalSchemas, serializerOpts)
+ return function (opts) { // { schema/*, method, url, httpPart */ }
+ const serializeFuncCode = compiler(opts)
+
+ options.storeFunction(opts, serializeFuncCode)
+
+ // eslint-disable-next-line no-new-func
+ return new Function(serializeFuncCode)
+ }
+ }
+}
+
+module.exports = StandaloneSerializer
+module.exports.default = StandaloneSerializer
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/test/duplicate-schema.test.js b/sdk/node_modules/@fastify/fast-json-stringify-compiler/test/duplicate-schema.test.js
new file mode 100644
index 00000000..d6904edf
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/test/duplicate-schema.test.js
@@ -0,0 +1,26 @@
+'use strict'
+
+const t = require('tap')
+const FjsCompiler = require('../index')
+
+t.test('Use input schema duplicate in the externalSchemas', async t => {
+ t.plan(1)
+ const externalSchemas = {
+ schema1: {
+ $id: 'schema1',
+ type: 'number'
+ },
+ schema2: {
+ $id: 'schema2',
+ type: 'string'
+ }
+ }
+
+ const factory = FjsCompiler()
+ const compiler = factory(externalSchemas)
+
+ compiler({ schema: externalSchemas.schema1 })
+ compiler({ schema: externalSchemas.schema2 })
+
+ t.pass()
+})
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/test/plugin.test.js b/sdk/node_modules/@fastify/fast-json-stringify-compiler/test/plugin.test.js
new file mode 100644
index 00000000..df2582b1
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/test/plugin.test.js
@@ -0,0 +1,78 @@
+'use strict'
+
+const t = require('tap')
+const fastify = require('fastify')
+const FjsCompiler = require('../index')
+
+const echo = async (req, reply) => { return req.body }
+
+const sampleSchema = Object.freeze({
+ $id: 'example1',
+ type: 'object',
+ properties: {
+ name: { type: 'string' }
+ }
+})
+
+const externalSchemas1 = Object.freeze({})
+const externalSchemas2 = Object.freeze({
+ foo: {
+ $id: 'foo',
+ type: 'object',
+ properties: {
+ name: { type: 'string' }
+ }
+ }
+})
+
+const fastifyFjsOptionsDefault = Object.freeze({})
+
+t.test('basic usage', t => {
+ t.plan(1)
+ const factory = FjsCompiler()
+ const compiler = factory(externalSchemas1, fastifyFjsOptionsDefault)
+ const serializeFunc = compiler({ schema: sampleSchema })
+ const result = serializeFunc({ name: 'hello' })
+ t.equal(result, '{"name":"hello"}')
+})
+
+t.test('fastify integration', async t => {
+ const factory = FjsCompiler()
+
+ const app = fastify({
+ serializerOpts: {
+ rounding: 'ceil'
+ },
+ schemaController: {
+ compilersFactory: {
+ buildSerializer: factory
+ }
+ }
+ })
+
+ app.addSchema(externalSchemas2.foo)
+
+ app.post('/', {
+ handler: echo,
+ schema: {
+ response: {
+ 200: {
+ $ref: 'foo#'
+ }
+ }
+ }
+ })
+
+ const res = await app.inject({
+ url: '/',
+ method: 'POST',
+ payload: {
+ version: '1',
+ foo: 'this is not a number',
+ name: 'serialize me'
+ }
+ })
+
+ t.equal(res.statusCode, 200)
+ t.same(res.json(), { name: 'serialize me' })
+})
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/test/standalone.test.js b/sdk/node_modules/@fastify/fast-json-stringify-compiler/test/standalone.test.js
new file mode 100644
index 00000000..51f773c5
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/test/standalone.test.js
@@ -0,0 +1,230 @@
+'use strict'
+
+const fs = require('fs')
+const path = require('path')
+const t = require('tap')
+const fastify = require('fastify')
+const sanitize = require('sanitize-filename')
+
+const { StandaloneSerializer: FjsStandaloneCompiler } = require('../')
+
+const generatedFileNames = []
+
+function generateFileName (routeOpts) {
+ const fileName = `/fjs-generated-${sanitize(routeOpts.schema.$id)}-${routeOpts.method}-${routeOpts.httpPart}-${sanitize(routeOpts.url)}.js`
+ generatedFileNames.push(fileName)
+ return fileName
+}
+
+t.test('standalone', t => {
+ t.plan(5)
+
+ t.teardown(async () => {
+ for (const fileName of generatedFileNames) {
+ try {
+ await fs.promises.unlink(path.join(__dirname, fileName))
+ } catch (e) {}
+ }
+ })
+
+ t.test('errors', t => {
+ t.plan(2)
+ t.throws(() => {
+ FjsStandaloneCompiler()
+ }, 'missing restoreFunction')
+ t.throws(() => {
+ FjsStandaloneCompiler({ readMode: false })
+ }, 'missing storeFunction')
+ })
+
+ t.test('generate standalone code', t => {
+ t.plan(5)
+
+ const base = {
+ $id: 'urn:schema:base',
+ definitions: {
+ hello: { type: 'string' }
+ },
+ type: 'object',
+ properties: {
+ hello: { $ref: '#/definitions/hello' }
+ }
+ }
+
+ const refSchema = {
+ $id: 'urn:schema:ref',
+ type: 'object',
+ properties: {
+ hello: { $ref: 'urn:schema:base#/definitions/hello' }
+ }
+ }
+
+ const endpointSchema = {
+ schema: {
+ $id: 'urn:schema:endpoint',
+ $ref: 'urn:schema:ref'
+ }
+ }
+
+ const schemaMap = {
+ [base.$id]: base,
+ [refSchema.$id]: refSchema
+ }
+
+ const factory = FjsStandaloneCompiler({
+ readMode: false,
+ storeFunction (routeOpts, schemaSerializerCode) {
+ t.same(routeOpts, endpointSchema)
+ t.type(schemaSerializerCode, 'string')
+ fs.writeFileSync(path.join(__dirname, '/fjs-generated.js'), schemaSerializerCode)
+ generatedFileNames.push('/fjs-generated.js')
+ t.pass('stored the serializer function')
+ }
+ })
+
+ const compiler = factory(schemaMap)
+ compiler(endpointSchema)
+ t.pass('compiled the endpoint schema')
+
+ t.test('usage standalone code', t => {
+ t.plan(3)
+ const standaloneSerializer = require('./fjs-generated')
+ t.ok(standaloneSerializer)
+
+ const valid = standaloneSerializer({ hello: 'world' })
+ t.same(valid, JSON.stringify({ hello: 'world' }))
+
+ const invalid = standaloneSerializer({ hello: [] })
+ t.same(invalid, '{"hello":""}')
+ })
+ })
+
+ t.test('fastify integration - writeMode', async t => {
+ t.plan(4)
+
+ const factory = FjsStandaloneCompiler({
+ readMode: false,
+ storeFunction (routeOpts, schemaSerializationCode) {
+ const fileName = generateFileName(routeOpts)
+ t.ok(routeOpts)
+ fs.writeFileSync(path.join(__dirname, fileName), schemaSerializationCode)
+ t.pass(`stored the serializer function ${fileName}`)
+ },
+ restoreFunction () {
+ t.fail('write mode ON')
+ }
+ })
+
+ const app = buildApp(factory)
+ await app.ready()
+ })
+
+ t.test('fastify integration - writeMode forces standalone', async t => {
+ t.plan(4)
+
+ const factory = FjsStandaloneCompiler({
+ readMode: false,
+ storeFunction (routeOpts, schemaSerializationCode) {
+ const fileName = generateFileName(routeOpts)
+ t.ok(routeOpts)
+ fs.writeFileSync(path.join(__dirname, fileName), schemaSerializationCode)
+ t.pass(`stored the serializer function ${fileName}`)
+ },
+ restoreFunction () {
+ t.fail('write mode ON')
+ }
+ })
+
+ const app = buildApp(factory, {
+ mode: 'not-standalone',
+ rounding: 'ceil'
+ })
+
+ await app.ready()
+ })
+
+ t.test('fastify integration - readMode', async t => {
+ t.plan(6)
+
+ const factory = FjsStandaloneCompiler({
+ readMode: true,
+ storeFunction () {
+ t.fail('read mode ON')
+ },
+ restoreFunction (routeOpts) {
+ const fileName = generateFileName(routeOpts)
+ t.pass(`restore the serializer function ${fileName}}`)
+ return require(path.join(__dirname, fileName))
+ }
+ })
+
+ const app = buildApp(factory)
+ await app.ready()
+
+ let res = await app.inject({
+ url: '/foo',
+ method: 'POST'
+ })
+ t.equal(res.statusCode, 200)
+ t.equal(res.payload, JSON.stringify({ hello: 'world' }))
+
+ res = await app.inject({
+ url: '/bar?lang=it',
+ method: 'GET'
+ })
+ t.equal(res.statusCode, 200)
+ t.equal(res.payload, JSON.stringify({ lang: 'en' }))
+ })
+
+ function buildApp (factory, serializerOpts) {
+ const app = fastify({
+ exposeHeadRoutes: false,
+ jsonShorthand: false,
+ schemaController: {
+ compilersFactory: {
+ buildSerializer: factory
+ }
+ },
+ serializerOpts
+ })
+
+ app.addSchema({
+ $id: 'urn:schema:foo',
+ type: 'object',
+ properties: {
+ name: { type: 'string' },
+ id: { type: 'integer' }
+ }
+ })
+
+ app.post('/foo', {
+ schema: {
+ response: {
+ 200: {
+ $id: 'urn:schema:response',
+ type: 'object',
+ properties: {
+ hello: { $ref: 'urn:schema:foo#/properties/name' }
+ }
+ }
+ }
+ }
+ }, () => { return { hello: 'world' } })
+
+ app.get('/bar', {
+ schema: {
+ response: {
+ 200: {
+ $id: 'urn:schema:response:bar',
+ type: 'object',
+ properties: {
+ lang: { type: 'string', enum: ['it', 'en'] }
+ }
+ }
+ }
+ }
+ }, () => { return { lang: 'en' } })
+
+ return app
+ }
+})
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/types/index.d.ts b/sdk/node_modules/@fastify/fast-json-stringify-compiler/types/index.d.ts
new file mode 100644
index 00000000..26bbf1f3
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/types/index.d.ts
@@ -0,0 +1,45 @@
+import { Options } from 'fast-json-stringify'
+
+type FastJsonStringifyFactory = () => SerializerSelector.SerializerFactory
+
+declare namespace SerializerSelector {
+ export type SerializerFactory = (
+ externalSchemas?: unknown,
+ options?: Options
+ ) => SerializerCompiler;
+
+ export type SerializerCompiler = (
+ externalSchemas?: unknown,
+ options?: Options
+ ) => Serializer;
+
+ export type Serializer = (doc: any) => string
+
+ export type RouteDefinition = {
+ method: string;
+ url: string;
+ httpStatus: string;
+ schema?: unknown;
+ }
+
+ export type StandaloneOptions = StandaloneOptionsReadModeOn | StandaloneOptionsReadModeOff
+
+ export type StandaloneOptionsReadModeOn = {
+ readMode: true;
+ restoreFunction?(opts: RouteDefinition): Serializer;
+ }
+
+ export type StandaloneOptionsReadModeOff = {
+ readMode?: false | undefined;
+ storeFunction?(opts: RouteDefinition, schemaSerializationCode: string): void;
+ }
+
+ export type { Options }
+ export const SerializerSelector: FastJsonStringifyFactory;
+ export function StandaloneSerializer(options: StandaloneOptions): SerializerFactory;
+
+ export { SerializerSelector as default }
+}
+
+declare function SerializerSelector(...params: Parameters): ReturnType
+export = SerializerSelector
diff --git a/sdk/node_modules/@fastify/fast-json-stringify-compiler/types/index.test-d.ts b/sdk/node_modules/@fastify/fast-json-stringify-compiler/types/index.test-d.ts
new file mode 100644
index 00000000..d1dbd85c
--- /dev/null
+++ b/sdk/node_modules/@fastify/fast-json-stringify-compiler/types/index.test-d.ts
@@ -0,0 +1,141 @@
+import { expectAssignable, expectError, expectType } from "tsd";
+import SerializerSelector, {
+ RouteDefinition,
+ Serializer,
+ SerializerCompiler,
+ SerializerFactory,
+ SerializerSelector as SerializerSelectorNamed,
+ StandaloneSerializer,
+} from "..";
+
+/**
+ * SerializerSelector
+ */
+
+{
+ const compiler = SerializerSelector();
+ expectType(compiler);
+}
+
+{
+ const compiler = SerializerSelectorNamed();
+ expectType(compiler);
+}
+
+{
+ {
+ const sampleSchema = {
+ $id: 'example1',
+ type: 'object',
+ properties: {
+ name: { type: 'string' }
+ }
+ }
+
+ const externalSchemas1 = {}
+
+ const factory = SerializerSelector()
+ expectType(factory);
+ const compiler = factory(externalSchemas1, {})
+ expectType(compiler);
+ const serializeFunc = compiler({ schema: sampleSchema })
+ expectType(serializeFunc);
+
+ expectType(serializeFunc({ name: 'hello' }))
+ }
+}
+
+/**
+ * StandaloneSerializer
+ */
+
+const reader = StandaloneSerializer({
+ readMode: true,
+ restoreFunction: (route: RouteDefinition) => {
+ expectAssignable(route)
+ return {} as Serializer
+ },
+});
+expectType(reader);
+
+const writer = StandaloneSerializer({
+ readMode: false,
+ storeFunction: (route: RouteDefinition, code: string) => {
+ expectAssignable(route)
+ expectAssignable(code)
+ },
+});
+expectType(writer);
+
+{
+ const base = {
+ $id: 'urn:schema:base',
+ definitions: {
+ hello: { type: 'string' }
+ },
+ type: 'object',
+ properties: {
+ hello: { $ref: '#/definitions/hello' }
+ }
+ }
+
+ const refSchema = {
+ $id: 'urn:schema:ref',
+ type: 'object',
+ properties: {
+ hello: { $ref: 'urn:schema:base#/definitions/hello' }
+ }
+ }
+
+ const endpointSchema = {
+ schema: {
+ $id: 'urn:schema:endpoint',
+ $ref: 'urn:schema:ref'
+ }
+ }
+
+ const schemaMap = {
+ [base.$id]: base,
+ [refSchema.$id]: refSchema
+ }
+
+ expectError(StandaloneSerializer({
+ readMode: true,
+ storeFunction () { }
+ }))
+ expectError(StandaloneSerializer({
+ readMode: false,
+ restoreFunction () {}
+ }))
+ expectError(StandaloneSerializer({
+ restoreFunction () {}
+ }))
+
+ expectType(StandaloneSerializer({
+ storeFunction (routeOpts, schemaSerializerCode) {
+ expectType(routeOpts)
+ expectType(schemaSerializerCode)
+ }
+ }))
+
+ expectType(StandaloneSerializer({
+ readMode: true,
+ restoreFunction (routeOpts) {
+ expectType(routeOpts)
+ return {} as Serializer
+ }
+ }))
+
+ const factory = StandaloneSerializer({
+ readMode: false,
+ storeFunction (routeOpts, schemaSerializerCode) {
+ expectType(routeOpts)
+ expectType(schemaSerializerCode)
+ }
+ })
+ expectType(factory)
+
+ const compiler = factory(schemaMap)
+ expectType(compiler)
+ expectType(compiler(endpointSchema))
+}
diff --git a/sdk/node_modules/@fastify/merge-json-schemas/.gitattributes b/sdk/node_modules/@fastify/merge-json-schemas/.gitattributes
new file mode 100644
index 00000000..83beb313
--- /dev/null
+++ b/sdk/node_modules/@fastify/merge-json-schemas/.gitattributes
@@ -0,0 +1,2 @@
+# Set default behavior to automatically convert line endings
+* text=auto eol=lf
\ No newline at end of file
diff --git a/sdk/node_modules/@fastify/merge-json-schemas/.github/test.yml b/sdk/node_modules/@fastify/merge-json-schemas/.github/test.yml
new file mode 100644
index 00000000..fce3203a
--- /dev/null
+++ b/sdk/node_modules/@fastify/merge-json-schemas/.github/test.yml
@@ -0,0 +1,32 @@
+name: Run Tests
+
+on: [push, pull_request]
+
+permissions:
+ contents: read
+
+jobs:
+ test:
+ name: Test
+ runs-on: ${{ matrix.os }}
+
+ strategy:
+ matrix:
+ node-version: [18.x, 20.x]
+ os: [ubuntu-latest, windows-latest, macOS-latest]
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v3
+ with:
+ node-version: ${{ matrix.node-version }}
+
+ - name: Install
+ run: |
+ npm install
+
+ - name: Test
+ run: |
+ npm run test
diff --git a/sdk/node_modules/@fastify/merge-json-schemas/LICENSE b/sdk/node_modules/@fastify/merge-json-schemas/LICENSE
new file mode 100644
index 00000000..226c5a9d
--- /dev/null
+++ b/sdk/node_modules/@fastify/merge-json-schemas/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2024 Fastify
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/sdk/node_modules/@fastify/merge-json-schemas/README.md b/sdk/node_modules/@fastify/merge-json-schemas/README.md
new file mode 100644
index 00000000..fe05f90e
--- /dev/null
+++ b/sdk/node_modules/@fastify/merge-json-schemas/README.md
@@ -0,0 +1,115 @@
+# @fastify/merge-json-schema
+
+__merge-json-schema__ is a javascript library that build a logical product (AND) for multiple [JSON schemas](https://json-schema.org/draft/2020-12/json-schema-core#name-introduction).
+
+- [Installation](#installation)
+- [Usage](#usage)
+- [API](#api)
+ - [mergeSchemas(schemas, options)](#mergeschemasschemas-options)
+ - [resolvers](#resolvers)
+ - [defaultResolver](#defaultresolver)
+- [License](#license)
+
+
+
+## Installation
+
+```bash
+npm install @fastify/merge-json-schema
+```
+
+
+
+## Usage
+
+```javascript
+const assert = require('node:assert')
+const { mergeSchemas } = require('merge-json-schema')
+
+const schema1 = {
+ $id: 'schema1',
+ type: 'object',
+ properties: {
+ foo: { type: 'string', enum: ['foo1', 'foo2'] },
+ bar: { type: 'string', minLength: 3 }
+ }
+}
+
+const schema2 = {
+ $id: 'schema1',
+ type: 'object',
+ properties: {
+ foo: { type: 'string', enum: ['foo1', 'foo3'] },
+ bar: { type: 'string', minLength: 5 }
+ },
+ required: ['foo']
+}
+
+const mergedSchema = mergeSchemas([schema1, schema2])
+assert.deepStrictEqual(mergedSchema, {
+ $id: 'schema1',
+ type: 'object',
+ properties: {
+ foo: { type: 'string', enum: ['foo1'] },
+ bar: { type: 'string', minLength: 5 }
+ },
+ required: ['foo']
+})
+```
+
+
+
+## API
+
+
+
+#### mergeSchemas(schemas, options)
+
+Builds a logical conjunction (AND) of multiple [JSON schemas](https://json-schema.org/draft/2020-12/json-schema-core#name-introduction).
+
+- `schemas` __\__ - list of JSON schemas to merge.
+- `options` __\