Merge branch 'main' into dependabot/npm_and_yarn/sinon-11.1.2
This commit is contained in:
commit
e1828d5291
79 changed files with 1043 additions and 41056 deletions
32
node_modules/.package-lock.json
generated
vendored
32
node_modules/.package-lock.json
generated
vendored
|
|
@ -5,8 +5,9 @@
|
|||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@actions/artifact": {
|
||||
"version": "0.5.1",
|
||||
"license": "MIT",
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-0.5.2.tgz",
|
||||
"integrity": "sha512-q/r8WSqyxBJ0ffLCRrtjCBTGnAYqP+ID4yG7f7YSlhrQ4thNg/d+Tq9f1YkLPKX46ZR97OWtGDY+oU/nxcqvLw==",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/http-client": "^1.0.11",
|
||||
|
|
@ -389,21 +390,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@octokit/plugin-retry": {
|
||||
"version": "3.0.3",
|
||||
"license": "MIT",
|
||||
"version": "3.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-3.0.9.tgz",
|
||||
"integrity": "sha512-r+fArdP5+TG6l1Rv/C9hVoty6tldw6cE2pRHNGmFPdyfrc696R6JjrQ3d7HdVqGwuzfyrcaLAKD7K8TX8aehUQ==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^5.0.0",
|
||||
"@octokit/types": "^6.0.3",
|
||||
"bottleneck": "^2.15.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/plugin-retry/node_modules/@octokit/types": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.5.0.tgz",
|
||||
"integrity": "sha512-UZ1pErDue6bZNjYOotCNveTXArOMZQFG6hKJfOnGnulVCMcVVi7YIIuuR4WfBhjo7zgpmzn/BkPDnUXtNx+PcQ==",
|
||||
"dependencies": {
|
||||
"@types/node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/request": {
|
||||
"version": "5.4.9",
|
||||
"license": "MIT",
|
||||
|
|
@ -552,9 +546,10 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@types/long": {
|
||||
"version": "4.0.0",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz",
|
||||
"integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/minimatch": {
|
||||
"version": "3.0.3",
|
||||
|
|
@ -3534,8 +3529,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/jsonschema": {
|
||||
"version": "1.2.6",
|
||||
"license": "MIT",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz",
|
||||
"integrity": "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
|
|
|
|||
2
node_modules/@actions/artifact/lib/internal/requestUtils.d.ts
generated
vendored
2
node_modules/@actions/artifact/lib/internal/requestUtils.d.ts
generated
vendored
|
|
@ -1,3 +1,3 @@
|
|||
import { IHttpClientResponse } from '@actions/http-client/interfaces';
|
||||
export declare function retry(name: string, operation: () => Promise<IHttpClientResponse>, customErrorMessages: Map<number, string>, maxAttempts: number): Promise<IHttpClientResponse>;
|
||||
export declare function retryHttpClientRequest<T>(name: string, method: () => Promise<IHttpClientResponse>, customErrorMessages?: Map<number, string>, maxAttempts?: number): Promise<IHttpClientResponse>;
|
||||
export declare function retryHttpClientRequest(name: string, method: () => Promise<IHttpClientResponse>, customErrorMessages?: Map<number, string>, maxAttempts?: number): Promise<IHttpClientResponse>;
|
||||
|
|
|
|||
3
node_modules/@actions/artifact/lib/internal/utils.js
generated
vendored
3
node_modules/@actions/artifact/lib/internal/utils.js
generated
vendored
|
|
@ -69,8 +69,9 @@ function isRetryableStatusCode(statusCode) {
|
|||
}
|
||||
const retryableStatusCodes = [
|
||||
http_client_1.HttpCodes.BadGateway,
|
||||
http_client_1.HttpCodes.ServiceUnavailable,
|
||||
http_client_1.HttpCodes.GatewayTimeout,
|
||||
http_client_1.HttpCodes.InternalServerError,
|
||||
http_client_1.HttpCodes.ServiceUnavailable,
|
||||
http_client_1.HttpCodes.TooManyRequests,
|
||||
413 // Payload Too Large
|
||||
];
|
||||
|
|
|
|||
2
node_modules/@actions/artifact/lib/internal/utils.js.map
generated
vendored
2
node_modules/@actions/artifact/lib/internal/utils.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@actions/artifact/package.json
generated
vendored
2
node_modules/@actions/artifact/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@actions/artifact",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"preview": true,
|
||||
"description": "Actions artifact lib",
|
||||
"keywords": [
|
||||
|
|
|
|||
8
node_modules/@octokit/plugin-retry/README.md
generated
vendored
8
node_modules/@octokit/plugin-retry/README.md
generated
vendored
|
|
@ -13,12 +13,12 @@
|
|||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `@octokit/plugin-retry` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [cdn.pika.dev](https://cdn.pika.dev)
|
||||
Load `@octokit/plugin-retry` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [cdn.skypack.dev](https://cdn.skypack.dev)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { Octokit } from "https://cdn.pika.dev/@octokit/core";
|
||||
import { retry } from "https://cdn.pika.dev/@octokit/plugin-retry";
|
||||
import { Octokit } from "https://cdn.skypack.dev/@octokit/core";
|
||||
import { retry } from "https://cdn.skypack.dev/@octokit/plugin-retry";
|
||||
</script>
|
||||
```
|
||||
|
||||
|
|
@ -38,8 +38,6 @@ const { retry } = require("@octokit/plugin-retry");
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
**Note**: If you use it with `@octokit/rest` v16, install `@octokit/core` as a devDependency. This is only temporary and will no longer be necessary with `@octokit/rest` v17.
|
||||
|
||||
```js
|
||||
const MyOctokit = Octokit.plugin(retry);
|
||||
const octokit = new MyOctokit({ auth: "secret123" });
|
||||
|
|
|
|||
31
node_modules/@octokit/plugin-retry/dist-node/index.js
generated
vendored
31
node_modules/@octokit/plugin-retry/dist-node/index.js
generated
vendored
|
|
@ -43,30 +43,31 @@ async function wrapRequest(state, request, options) {
|
|||
return limiter.schedule(request, options);
|
||||
}
|
||||
|
||||
const VERSION = "3.0.3";
|
||||
function retry(octokit, octokitOptions = {}) {
|
||||
const VERSION = "3.0.9";
|
||||
function retry(octokit, octokitOptions) {
|
||||
const state = Object.assign({
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1000,
|
||||
doNotRetry: [400, 401, 403, 404, 422],
|
||||
retries: 3
|
||||
}, octokitOptions.retry);
|
||||
octokit.retry = {
|
||||
retryRequest: (error, retries, retryAfter) => {
|
||||
error.request.request = Object.assign({}, error.request.request, {
|
||||
retries: retries,
|
||||
retryAfter: retryAfter
|
||||
});
|
||||
return error;
|
||||
}
|
||||
};
|
||||
|
||||
if (!state.enabled) {
|
||||
return;
|
||||
if (state.enabled) {
|
||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||
}
|
||||
|
||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||
return {
|
||||
retry: {
|
||||
retryRequest: (error, retries, retryAfter) => {
|
||||
error.request.request = Object.assign({}, error.request.request, {
|
||||
retries: retries,
|
||||
retryAfter: retryAfter
|
||||
});
|
||||
return error;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
retry.VERSION = VERSION;
|
||||
|
||||
|
|
|
|||
2
node_modules/@octokit/plugin-retry/dist-node/index.js.map
generated
vendored
2
node_modules/@octokit/plugin-retry/dist-node/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
27
node_modules/@octokit/plugin-retry/dist-src/index.js
generated
vendored
27
node_modules/@octokit/plugin-retry/dist-src/index.js
generated
vendored
|
|
@ -1,26 +1,27 @@
|
|||
import { errorRequest } from "./error-request";
|
||||
import { wrapRequest } from "./wrap-request";
|
||||
export const VERSION = "0.0.0-development";
|
||||
export function retry(octokit, octokitOptions = {}) {
|
||||
export function retry(octokit, octokitOptions) {
|
||||
const state = Object.assign({
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1000,
|
||||
doNotRetry: [400, 401, 403, 404, 422],
|
||||
retries: 3,
|
||||
}, octokitOptions.retry);
|
||||
octokit.retry = {
|
||||
retryRequest: (error, retries, retryAfter) => {
|
||||
error.request.request = Object.assign({}, error.request.request, {
|
||||
retries: retries,
|
||||
retryAfter: retryAfter,
|
||||
});
|
||||
return error;
|
||||
if (state.enabled) {
|
||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||
}
|
||||
return {
|
||||
retry: {
|
||||
retryRequest: (error, retries, retryAfter) => {
|
||||
error.request.request = Object.assign({}, error.request.request, {
|
||||
retries: retries,
|
||||
retryAfter: retryAfter,
|
||||
});
|
||||
return error;
|
||||
},
|
||||
},
|
||||
};
|
||||
if (!state.enabled) {
|
||||
return;
|
||||
}
|
||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||
}
|
||||
retry.VERSION = VERSION;
|
||||
|
|
|
|||
2
node_modules/@octokit/plugin-retry/dist-src/version.js
generated
vendored
2
node_modules/@octokit/plugin-retry/dist-src/version.js
generated
vendored
|
|
@ -1 +1 @@
|
|||
export const VERSION = "3.0.3";
|
||||
export const VERSION = "3.0.9";
|
||||
|
|
|
|||
7
node_modules/@octokit/plugin-retry/dist-types/index.d.ts
generated
vendored
7
node_modules/@octokit/plugin-retry/dist-types/index.d.ts
generated
vendored
|
|
@ -1,6 +1,11 @@
|
|||
import { Octokit } from "@octokit/core";
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
export declare const VERSION = "0.0.0-development";
|
||||
export declare function retry(octokit: Octokit, octokitOptions?: ConstructorParameters<typeof Octokit>[0]): void;
|
||||
export declare function retry(octokit: Octokit, octokitOptions: any): {
|
||||
retry: {
|
||||
retryRequest: (error: RequestError, retries: number, retryAfter: number) => RequestError;
|
||||
};
|
||||
};
|
||||
export declare namespace retry {
|
||||
var VERSION: string;
|
||||
}
|
||||
|
|
|
|||
2
node_modules/@octokit/plugin-retry/dist-types/version.d.ts
generated
vendored
2
node_modules/@octokit/plugin-retry/dist-types/version.d.ts
generated
vendored
|
|
@ -1 +1 @@
|
|||
export declare const VERSION = "3.0.3";
|
||||
export declare const VERSION = "3.0.9";
|
||||
|
|
|
|||
29
node_modules/@octokit/plugin-retry/dist-web/index.js
generated
vendored
29
node_modules/@octokit/plugin-retry/dist-web/index.js
generated
vendored
|
|
@ -34,28 +34,29 @@ async function wrapRequest(state, request, options) {
|
|||
return limiter.schedule(request, options);
|
||||
}
|
||||
|
||||
const VERSION = "3.0.3";
|
||||
function retry(octokit, octokitOptions = {}) {
|
||||
const VERSION = "3.0.9";
|
||||
function retry(octokit, octokitOptions) {
|
||||
const state = Object.assign({
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1000,
|
||||
doNotRetry: [400, 401, 403, 404, 422],
|
||||
retries: 3,
|
||||
}, octokitOptions.retry);
|
||||
octokit.retry = {
|
||||
retryRequest: (error, retries, retryAfter) => {
|
||||
error.request.request = Object.assign({}, error.request.request, {
|
||||
retries: retries,
|
||||
retryAfter: retryAfter,
|
||||
});
|
||||
return error;
|
||||
if (state.enabled) {
|
||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||
}
|
||||
return {
|
||||
retry: {
|
||||
retryRequest: (error, retries, retryAfter) => {
|
||||
error.request.request = Object.assign({}, error.request.request, {
|
||||
retries: retries,
|
||||
retryAfter: retryAfter,
|
||||
});
|
||||
return error;
|
||||
},
|
||||
},
|
||||
};
|
||||
if (!state.enabled) {
|
||||
return;
|
||||
}
|
||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||
}
|
||||
retry.VERSION = VERSION;
|
||||
|
||||
|
|
|
|||
2
node_modules/@octokit/plugin-retry/dist-web/index.js.map
generated
vendored
2
node_modules/@octokit/plugin-retry/dist-web/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sources":["../dist-src/error-request.js","../dist-src/wrap-request.js","../dist-src/index.js"],"sourcesContent":["// @ts-ignore\nexport async function errorRequest(octokit, state, error, options) {\n if (!error.request || !error.request.request) {\n // address https://github.com/octokit/plugin-retry.js/issues/8\n throw error;\n }\n // retry all >= 400 && not doNotRetry\n if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {\n const retries = options.request.retries != null ? options.request.retries : state.retries;\n const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);\n throw octokit.retry.retryRequest(error, retries, retryAfter);\n }\n // Maybe eventually there will be more cases here\n throw error;\n}\n","// @ts-ignore\nimport Bottleneck from \"bottleneck/light\";\n// @ts-ignore\nexport async function wrapRequest(state, request, options) {\n const limiter = new Bottleneck();\n // @ts-ignore\n limiter.on(\"failed\", function (error, info) {\n const maxRetries = ~~error.request.request.retries;\n const after = ~~error.request.request.retryAfter;\n options.request.retryCount = info.retryCount + 1;\n if (maxRetries > info.retryCount) {\n // Returning a number instructs the limiter to retry\n // the request after that number of milliseconds have passed\n return after * state.retryAfterBaseValue;\n }\n });\n return limiter.schedule(request, options);\n}\n","import { errorRequest } from \"./error-request\";\nimport { wrapRequest } from \"./wrap-request\";\nexport const VERSION = \"3.0.3\";\nexport function retry(octokit, octokitOptions = {}) {\n const state = Object.assign({\n enabled: true,\n retryAfterBaseValue: 1000,\n doNotRetry: [400, 401, 403, 404, 422],\n retries: 3,\n }, octokitOptions.retry);\n octokit.retry = {\n retryRequest: (error, retries, retryAfter) => {\n error.request.request = Object.assign({}, error.request.request, {\n retries: retries,\n retryAfter: retryAfter,\n });\n return error;\n },\n };\n if (!state.enabled) {\n return;\n }\n octokit.hook.error(\"request\", errorRequest.bind(null, octokit, state));\n octokit.hook.wrap(\"request\", wrapRequest.bind(null, state));\n}\nretry.VERSION = VERSION;\n"],"names":[],"mappings":";;AAAA;AACO,eAAe,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE;AACnE,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;AAClD;AACA,QAAQ,MAAM,KAAK,CAAC;AACpB,KAAK;AACL;AACA,IAAI,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACzE,QAAQ,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAClG,QAAQ,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9E,QAAQ,MAAM,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AACrE,KAAK;AACL;AACA,IAAI,MAAM,KAAK,CAAC;AAChB;;ACdA;AACA,AACA;AACA,AAAO,eAAe,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE;AAC3D,IAAI,MAAM,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC;AACrC;AACA,IAAI,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,KAAK,EAAE,IAAI,EAAE;AAChD,QAAQ,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;AAC3D,QAAQ,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;AACzD,QAAQ,OAAO,CAAC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;AACzD,QAAQ,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE;AAC1C;AACA;AACA,YAAY,OAAO,KAAK,GAAG,KAAK,CAAC,mBAAmB,CAAC;AACrD,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;;ACfW,MAAC,OAAO,GAAG,mBAAmB,CAAC;AAC3C,AAAO,SAAS,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG,EAAE,EAAE;AACpD,IAAI,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;AAChC,QAAQ,OAAO,EAAE,IAAI;AACrB,QAAQ,mBAAmB,EAAE,IAAI;AACjC,QAAQ,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAC7C,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;AAC7B,IAAI,OAAO,CAAC,KAAK,GAAG;AACpB,QAAQ,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,KAAK;AACtD,YAAY,KAAK,CAAC,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;AAC7E,gBAAgB,OAAO,EAAE,OAAO;AAChC,gBAAgB,UAAU,EAAE,UAAU;AACtC,aAAa,CAAC,CAAC;AACf,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3E,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAChE,CAAC;AACD,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;;;;"}
|
||||
{"version":3,"file":"index.js","sources":["../dist-src/error-request.js","../dist-src/wrap-request.js","../dist-src/index.js"],"sourcesContent":["// @ts-ignore\nexport async function errorRequest(octokit, state, error, options) {\n if (!error.request || !error.request.request) {\n // address https://github.com/octokit/plugin-retry.js/issues/8\n throw error;\n }\n // retry all >= 400 && not doNotRetry\n if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {\n const retries = options.request.retries != null ? options.request.retries : state.retries;\n const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);\n throw octokit.retry.retryRequest(error, retries, retryAfter);\n }\n // Maybe eventually there will be more cases here\n throw error;\n}\n","// @ts-ignore\nimport Bottleneck from \"bottleneck/light\";\n// @ts-ignore\nexport async function wrapRequest(state, request, options) {\n const limiter = new Bottleneck();\n // @ts-ignore\n limiter.on(\"failed\", function (error, info) {\n const maxRetries = ~~error.request.request.retries;\n const after = ~~error.request.request.retryAfter;\n options.request.retryCount = info.retryCount + 1;\n if (maxRetries > info.retryCount) {\n // Returning a number instructs the limiter to retry\n // the request after that number of milliseconds have passed\n return after * state.retryAfterBaseValue;\n }\n });\n return limiter.schedule(request, options);\n}\n","import { errorRequest } from \"./error-request\";\nimport { wrapRequest } from \"./wrap-request\";\nexport const VERSION = \"3.0.9\";\nexport function retry(octokit, octokitOptions) {\n const state = Object.assign({\n enabled: true,\n retryAfterBaseValue: 1000,\n doNotRetry: [400, 401, 403, 404, 422],\n retries: 3,\n }, octokitOptions.retry);\n if (state.enabled) {\n octokit.hook.error(\"request\", errorRequest.bind(null, octokit, state));\n octokit.hook.wrap(\"request\", wrapRequest.bind(null, state));\n }\n return {\n retry: {\n retryRequest: (error, retries, retryAfter) => {\n error.request.request = Object.assign({}, error.request.request, {\n retries: retries,\n retryAfter: retryAfter,\n });\n return error;\n },\n },\n };\n}\nretry.VERSION = VERSION;\n"],"names":[],"mappings":";;AAAA;AACO,eAAe,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE;AACnE,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;AAClD;AACA,QAAQ,MAAM,KAAK,CAAC;AACpB,KAAK;AACL;AACA,IAAI,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACzE,QAAQ,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAClG,QAAQ,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9E,QAAQ,MAAM,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AACrE,KAAK;AACL;AACA,IAAI,MAAM,KAAK,CAAC;AAChB;;ACdA;AACA,AACA;AACA,AAAO,eAAe,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE;AAC3D,IAAI,MAAM,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC;AACrC;AACA,IAAI,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,KAAK,EAAE,IAAI,EAAE;AAChD,QAAQ,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;AAC3D,QAAQ,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;AACzD,QAAQ,OAAO,CAAC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;AACzD,QAAQ,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE;AAC1C;AACA;AACA,YAAY,OAAO,KAAK,GAAG,KAAK,CAAC,mBAAmB,CAAC;AACrD,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;;ACfW,MAAC,OAAO,GAAG,mBAAmB,CAAC;AAC3C,AAAO,SAAS,KAAK,CAAC,OAAO,EAAE,cAAc,EAAE;AAC/C,IAAI,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;AAChC,QAAQ,OAAO,EAAE,IAAI;AACrB,QAAQ,mBAAmB,EAAE,IAAI;AACjC,QAAQ,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAC7C,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;AAC7B,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE;AACvB,QAAQ,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/E,QAAQ,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AACpE,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,KAAK,EAAE;AACf,YAAY,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,KAAK;AAC1D,gBAAgB,KAAK,CAAC,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;AACjF,oBAAoB,OAAO,EAAE,OAAO;AACpC,oBAAoB,UAAU,EAAE,UAAU;AAC1C,iBAAiB,CAAC,CAAC;AACnB,gBAAgB,OAAO,KAAK,CAAC;AAC7B,aAAa;AACb,SAAS;AACT,KAAK,CAAC;AACN,CAAC;AACD,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;;;;"}
|
||||
7
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/LICENSE
generated
vendored
7
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/LICENSE
generated
vendored
|
|
@ -1,7 +0,0 @@
|
|||
MIT License Copyright (c) 2019 Octokit 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 (including the next paragraph) 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.
|
||||
64
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/README.md
generated
vendored
64
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/README.md
generated
vendored
|
|
@ -1,64 +0,0 @@
|
|||
# types.ts
|
||||
|
||||
> Shared TypeScript definitions for Octokit projects
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/types)
|
||||
[](https://github.com/octokit/types.ts/actions?workflow=Test)
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [Examples](#examples)
|
||||
- [Get parameter and response data types for a REST API endpoint](#get-parameter-and-response-data-types-for-a-rest-api-endpoint)
|
||||
- [Get response types from endpoint methods](#get-response-types-from-endpoint-methods)
|
||||
- [Contributing](#contributing)
|
||||
- [License](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
See all exported types at https://octokit.github.io/types.ts
|
||||
|
||||
## Examples
|
||||
|
||||
### Get parameter and response data types for a REST API endpoint
|
||||
|
||||
```ts
|
||||
import { Endpoints } from "@octokit/types";
|
||||
|
||||
type listUserReposParameters = Endpoints["GET /repos/:owner/:repo"]["parameters"];
|
||||
type listUserReposResponse = Endpoints["GET /repos/:owner/:repo"]["response"];
|
||||
|
||||
async function listRepos(
|
||||
options: listUserReposParameters
|
||||
): listUserReposResponse["data"] {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### Get response types from endpoint methods
|
||||
|
||||
```ts
|
||||
import {
|
||||
GetResponseTypeFromEndpointMethod,
|
||||
GetResponseDataTypeFromEndpointMethod,
|
||||
} from "@octokit/types";
|
||||
import { Octokit } from "@octokit/rest";
|
||||
|
||||
const octokit = new Octokit();
|
||||
type CreateLabelResponseType = GetResponseTypeFromEndpointMethod<
|
||||
typeof octokit.issues.createLabel
|
||||
>;
|
||||
type CreateLabelResponseDataType = GetResponseDataTypeFromEndpointMethod<
|
||||
typeof octokit.issues.createLabel
|
||||
>;
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
8
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-node/index.js
generated
vendored
8
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-node/index.js
generated
vendored
|
|
@ -1,8 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
const VERSION = "5.5.0";
|
||||
|
||||
exports.VERSION = VERSION;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.js","sources":["../dist-src/VERSION.js"],"sourcesContent":["export const VERSION = \"0.0.0-development\";\n"],"names":["VERSION"],"mappings":";;;;MAAaA,OAAO,GAAG;;;;"}
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/Fetch.js
generated
vendored
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/Fetch.js
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/Route.js
generated
vendored
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/Route.js
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/Signal.js
generated
vendored
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/Signal.js
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/Url.js
generated
vendored
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/Url.js
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/VERSION.js
generated
vendored
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/VERSION.js
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
export const VERSION = "5.5.0";
|
||||
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
21
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/index.js
generated
vendored
21
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-src/index.js
generated
vendored
|
|
@ -1,21 +0,0 @@
|
|||
export * from "./AuthInterface";
|
||||
export * from "./EndpointDefaults";
|
||||
export * from "./EndpointInterface";
|
||||
export * from "./EndpointOptions";
|
||||
export * from "./Fetch";
|
||||
export * from "./OctokitResponse";
|
||||
export * from "./RequestError";
|
||||
export * from "./RequestHeaders";
|
||||
export * from "./RequestInterface";
|
||||
export * from "./RequestMethod";
|
||||
export * from "./RequestOptions";
|
||||
export * from "./RequestParameters";
|
||||
export * from "./RequestRequestOptions";
|
||||
export * from "./ResponseHeaders";
|
||||
export * from "./Route";
|
||||
export * from "./Signal";
|
||||
export * from "./StrategyInterface";
|
||||
export * from "./Url";
|
||||
export * from "./VERSION";
|
||||
export * from "./GetResponseTypeFromEndpointMethod";
|
||||
export * from "./generated/Endpoints";
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
import { EndpointOptions } from "./EndpointOptions";
|
||||
import { OctokitResponse } from "./OctokitResponse";
|
||||
import { RequestInterface } from "./RequestInterface";
|
||||
import { RequestParameters } from "./RequestParameters";
|
||||
import { Route } from "./Route";
|
||||
/**
|
||||
* Interface to implement complex authentication strategies for Octokit.
|
||||
* An object Implementing the AuthInterface can directly be passed as the
|
||||
* `auth` option in the Octokit constructor.
|
||||
*
|
||||
* For the official implementations of the most common authentication
|
||||
* strategies, see https://github.com/octokit/auth.js
|
||||
*/
|
||||
export interface AuthInterface<AuthOptions extends any[], Authentication extends any> {
|
||||
(...args: AuthOptions): Promise<Authentication>;
|
||||
hook: {
|
||||
/**
|
||||
* Sends a request using the passed `request` instance
|
||||
*
|
||||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<T = any>(request: RequestInterface, options: EndpointOptions): Promise<OctokitResponse<T>>;
|
||||
/**
|
||||
* Sends a request using the passed `request` instance
|
||||
*
|
||||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
|
||||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<T = any>(request: RequestInterface, route: Route, parameters?: RequestParameters): Promise<OctokitResponse<T>>;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
import { RequestHeaders } from "./RequestHeaders";
|
||||
import { RequestMethod } from "./RequestMethod";
|
||||
import { RequestParameters } from "./RequestParameters";
|
||||
import { Url } from "./Url";
|
||||
/**
|
||||
* The `.endpoint()` method is guaranteed to set all keys defined by RequestParameters
|
||||
* as well as the method property.
|
||||
*/
|
||||
export declare type EndpointDefaults = RequestParameters & {
|
||||
baseUrl: Url;
|
||||
method: RequestMethod;
|
||||
url?: Url;
|
||||
headers: RequestHeaders & {
|
||||
accept: string;
|
||||
"user-agent": string;
|
||||
};
|
||||
mediaType: {
|
||||
format: string;
|
||||
previews: string[];
|
||||
};
|
||||
};
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
import { EndpointDefaults } from "./EndpointDefaults";
|
||||
import { RequestOptions } from "./RequestOptions";
|
||||
import { RequestParameters } from "./RequestParameters";
|
||||
import { Route } from "./Route";
|
||||
import { Endpoints } from "./generated/Endpoints";
|
||||
export interface EndpointInterface<D extends object = object> {
|
||||
/**
|
||||
* Transforms a GitHub REST API endpoint into generic request options
|
||||
*
|
||||
* @param {object} endpoint Must set `url` unless it's set defaults. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<O extends RequestParameters = RequestParameters>(options: O & {
|
||||
method?: string;
|
||||
} & ("url" extends keyof D ? {
|
||||
url?: string;
|
||||
} : {
|
||||
url: string;
|
||||
})): RequestOptions & Pick<D & O, keyof RequestOptions>;
|
||||
/**
|
||||
* Transforms a GitHub REST API endpoint into generic request options
|
||||
*
|
||||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
|
||||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<R extends Route, P extends RequestParameters = R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters>(route: keyof Endpoints | R, parameters?: P): (R extends keyof Endpoints ? Endpoints[R]["request"] : RequestOptions) & Pick<P, keyof RequestOptions>;
|
||||
/**
|
||||
* Object with current default route and parameters
|
||||
*/
|
||||
DEFAULTS: D & EndpointDefaults;
|
||||
/**
|
||||
* Returns a new `endpoint` interface with new defaults
|
||||
*/
|
||||
defaults: <O extends RequestParameters = RequestParameters>(newDefaults: O) => EndpointInterface<D & O>;
|
||||
merge: {
|
||||
/**
|
||||
* Merges current endpoint defaults with passed route and parameters,
|
||||
* without transforming them into request options.
|
||||
*
|
||||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
|
||||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*
|
||||
*/
|
||||
<R extends Route, P extends RequestParameters = R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters>(route: keyof Endpoints | R, parameters?: P): D & (R extends keyof Endpoints ? Endpoints[R]["request"] & Endpoints[R]["parameters"] : EndpointDefaults) & P;
|
||||
/**
|
||||
* Merges current endpoint defaults with passed route and parameters,
|
||||
* without transforming them into request options.
|
||||
*
|
||||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<P extends RequestParameters = RequestParameters>(options: P): EndpointDefaults & D & P;
|
||||
/**
|
||||
* Returns current default options.
|
||||
*
|
||||
* @deprecated use endpoint.DEFAULTS instead
|
||||
*/
|
||||
(): D & EndpointDefaults;
|
||||
};
|
||||
/**
|
||||
* Stateless method to turn endpoint options into request options.
|
||||
* Calling `endpoint(options)` is the same as calling `endpoint.parse(endpoint.merge(options))`.
|
||||
*
|
||||
* @param {object} options `method`, `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
parse: <O extends EndpointDefaults = EndpointDefaults>(options: O) => RequestOptions & Pick<O, keyof RequestOptions>;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
import { RequestMethod } from "./RequestMethod";
|
||||
import { Url } from "./Url";
|
||||
import { RequestParameters } from "./RequestParameters";
|
||||
export declare type EndpointOptions = RequestParameters & {
|
||||
method: RequestMethod;
|
||||
url: Url;
|
||||
};
|
||||
4
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/Fetch.d.ts
generated
vendored
4
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/Fetch.d.ts
generated
vendored
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* Browser's fetch method (or compatible such as fetch-mock)
|
||||
*/
|
||||
export declare type Fetch = any;
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
declare type Unwrap<T> = T extends Promise<infer U> ? U : T;
|
||||
declare type AnyFunction = (...args: any[]) => any;
|
||||
export declare type GetResponseTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>;
|
||||
export declare type GetResponseDataTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>["data"];
|
||||
export {};
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
import { ResponseHeaders } from "./ResponseHeaders";
|
||||
import { Url } from "./Url";
|
||||
export declare type OctokitResponse<T> = {
|
||||
headers: ResponseHeaders;
|
||||
/**
|
||||
* http response code
|
||||
*/
|
||||
status: number;
|
||||
/**
|
||||
* URL of response after all redirects
|
||||
*/
|
||||
url: Url;
|
||||
/**
|
||||
* This is the data you would see in https://developer.Octokit.com/v3/
|
||||
*/
|
||||
data: T;
|
||||
};
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
export declare type RequestError = {
|
||||
name: string;
|
||||
status: number;
|
||||
documentation_url: string;
|
||||
errors?: Array<{
|
||||
resource: string;
|
||||
code: string;
|
||||
field: string;
|
||||
message?: string;
|
||||
}>;
|
||||
};
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
export declare type RequestHeaders = {
|
||||
/**
|
||||
* Avoid setting `headers.accept`, use `mediaType.{format|previews}` option instead.
|
||||
*/
|
||||
accept?: string;
|
||||
/**
|
||||
* Use `authorization` to send authenticated request, remember `token ` / `bearer ` prefixes. Example: `token 1234567890abcdef1234567890abcdef12345678`
|
||||
*/
|
||||
authorization?: string;
|
||||
/**
|
||||
* `user-agent` is set do a default and can be overwritten as needed.
|
||||
*/
|
||||
"user-agent"?: string;
|
||||
[header: string]: string | number | undefined;
|
||||
};
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
import { EndpointInterface } from "./EndpointInterface";
|
||||
import { OctokitResponse } from "./OctokitResponse";
|
||||
import { RequestParameters } from "./RequestParameters";
|
||||
import { Route } from "./Route";
|
||||
import { Endpoints } from "./generated/Endpoints";
|
||||
export interface RequestInterface<D extends object = object> {
|
||||
/**
|
||||
* Sends a request based on endpoint options
|
||||
*
|
||||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<T = any, O extends RequestParameters = RequestParameters>(options: O & {
|
||||
method?: string;
|
||||
} & ("url" extends keyof D ? {
|
||||
url?: string;
|
||||
} : {
|
||||
url: string;
|
||||
})): Promise<OctokitResponse<T>>;
|
||||
/**
|
||||
* Sends a request based on endpoint options
|
||||
*
|
||||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
|
||||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<R extends Route>(route: keyof Endpoints | R, options?: R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters): R extends keyof Endpoints ? Promise<Endpoints[R]["response"]> : Promise<OctokitResponse<any>>;
|
||||
/**
|
||||
* Returns a new `request` with updated route and parameters
|
||||
*/
|
||||
defaults: <O extends RequestParameters = RequestParameters>(newDefaults: O) => RequestInterface<D & O>;
|
||||
/**
|
||||
* Octokit endpoint API, see {@link https://github.com/octokit/endpoint.js|@octokit/endpoint}
|
||||
*/
|
||||
endpoint: EndpointInterface<D>;
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* HTTP Verb supported by GitHub's REST API
|
||||
*/
|
||||
export declare type RequestMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
import { RequestHeaders } from "./RequestHeaders";
|
||||
import { RequestMethod } from "./RequestMethod";
|
||||
import { RequestRequestOptions } from "./RequestRequestOptions";
|
||||
import { Url } from "./Url";
|
||||
/**
|
||||
* Generic request options as they are returned by the `endpoint()` method
|
||||
*/
|
||||
export declare type RequestOptions = {
|
||||
method: RequestMethod;
|
||||
url: Url;
|
||||
headers: RequestHeaders;
|
||||
body?: any;
|
||||
request?: RequestRequestOptions;
|
||||
};
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
import { RequestRequestOptions } from "./RequestRequestOptions";
|
||||
import { RequestHeaders } from "./RequestHeaders";
|
||||
import { Url } from "./Url";
|
||||
/**
|
||||
* Parameters that can be passed into `request(route, parameters)` or `endpoint(route, parameters)` methods
|
||||
*/
|
||||
export declare type RequestParameters = {
|
||||
/**
|
||||
* Base URL to be used when a relative URL is passed, such as `/orgs/:org`.
|
||||
* If `baseUrl` is `https://enterprise.acme-inc.com/api/v3`, then the request
|
||||
* will be sent to `https://enterprise.acme-inc.com/api/v3/orgs/:org`.
|
||||
*/
|
||||
baseUrl?: Url;
|
||||
/**
|
||||
* HTTP headers. Use lowercase keys.
|
||||
*/
|
||||
headers?: RequestHeaders;
|
||||
/**
|
||||
* Media type options, see {@link https://developer.github.com/v3/media/|GitHub Developer Guide}
|
||||
*/
|
||||
mediaType?: {
|
||||
/**
|
||||
* `json` by default. Can be `raw`, `text`, `html`, `full`, `diff`, `patch`, `sha`, `base64`. Depending on endpoint
|
||||
*/
|
||||
format?: string;
|
||||
/**
|
||||
* Custom media type names of {@link https://developer.github.com/v3/media/|API Previews} without the `-preview` suffix.
|
||||
* Example for single preview: `['squirrel-girl']`.
|
||||
* Example for multiple previews: `['squirrel-girl', 'mister-fantastic']`.
|
||||
*/
|
||||
previews?: string[];
|
||||
};
|
||||
/**
|
||||
* Pass custom meta information for the request. The `request` object will be returned as is.
|
||||
*/
|
||||
request?: RequestRequestOptions;
|
||||
/**
|
||||
* Any additional parameter will be passed as follows
|
||||
* 1. URL parameter if `':parameter'` or `{parameter}` is part of `url`
|
||||
* 2. Query parameter if `method` is `'GET'` or `'HEAD'`
|
||||
* 3. Request body if `parameter` is `'data'`
|
||||
* 4. JSON in the request body in the form of `body[parameter]` unless `parameter` key is `'data'`
|
||||
*/
|
||||
[parameter: string]: unknown;
|
||||
};
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
/// <reference types="node" />
|
||||
import { Agent } from "http";
|
||||
import { Fetch } from "./Fetch";
|
||||
import { Signal } from "./Signal";
|
||||
/**
|
||||
* Octokit-specific request options which are ignored for the actual request, but can be used by Octokit or plugins to manipulate how the request is sent or how a response is handled
|
||||
*/
|
||||
export declare type RequestRequestOptions = {
|
||||
/**
|
||||
* Node only. Useful for custom proxy, certificate, or dns lookup.
|
||||
*/
|
||||
agent?: Agent;
|
||||
/**
|
||||
* Custom replacement for built-in fetch method. Useful for testing or request hooks.
|
||||
*/
|
||||
fetch?: Fetch;
|
||||
/**
|
||||
* Use an `AbortController` instance to cancel a request. In node you can only cancel streamed requests.
|
||||
*/
|
||||
signal?: Signal;
|
||||
/**
|
||||
* Node only. Request/response timeout in ms, it resets on redirect. 0 to disable (OS limit applies). `options.request.signal` is recommended instead.
|
||||
*/
|
||||
timeout?: number;
|
||||
[option: string]: any;
|
||||
};
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
export declare type ResponseHeaders = {
|
||||
"cache-control"?: string;
|
||||
"content-length"?: number;
|
||||
"content-type"?: string;
|
||||
date?: string;
|
||||
etag?: string;
|
||||
"last-modified"?: string;
|
||||
link?: string;
|
||||
location?: string;
|
||||
server?: string;
|
||||
status?: string;
|
||||
vary?: string;
|
||||
"x-github-mediatype"?: string;
|
||||
"x-github-request-id"?: string;
|
||||
"x-oauth-scopes"?: string;
|
||||
"x-ratelimit-limit"?: string;
|
||||
"x-ratelimit-remaining"?: string;
|
||||
"x-ratelimit-reset"?: string;
|
||||
[header: string]: string | number | undefined;
|
||||
};
|
||||
4
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/Route.d.ts
generated
vendored
4
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/Route.d.ts
generated
vendored
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* String consisting of an optional HTTP method and relative path or absolute URL. Examples: `'/orgs/:org'`, `'PUT /orgs/:org'`, `GET https://example.com/foo/bar`
|
||||
*/
|
||||
export declare type Route = string;
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
/**
|
||||
* Abort signal
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
||||
*/
|
||||
export declare type Signal = any;
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
import { AuthInterface } from "./AuthInterface";
|
||||
export interface StrategyInterface<StrategyOptions extends any[], AuthOptions extends any[], Authentication extends object> {
|
||||
(...args: StrategyOptions): AuthInterface<AuthOptions, Authentication>;
|
||||
}
|
||||
4
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/Url.d.ts
generated
vendored
4
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/Url.d.ts
generated
vendored
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* Relative or absolute URL. Examples: `'/orgs/:org'`, `https://example.com/foo/bar`
|
||||
*/
|
||||
export declare type Url = string;
|
||||
|
|
@ -1 +0,0 @@
|
|||
export declare const VERSION = "5.5.0";
|
||||
39835
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/generated/Endpoints.d.ts
generated
vendored
39835
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/generated/Endpoints.d.ts
generated
vendored
File diff suppressed because it is too large
Load diff
21
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/index.d.ts
generated
vendored
21
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/index.d.ts
generated
vendored
|
|
@ -1,21 +0,0 @@
|
|||
export * from "./AuthInterface";
|
||||
export * from "./EndpointDefaults";
|
||||
export * from "./EndpointInterface";
|
||||
export * from "./EndpointOptions";
|
||||
export * from "./Fetch";
|
||||
export * from "./OctokitResponse";
|
||||
export * from "./RequestError";
|
||||
export * from "./RequestHeaders";
|
||||
export * from "./RequestInterface";
|
||||
export * from "./RequestMethod";
|
||||
export * from "./RequestOptions";
|
||||
export * from "./RequestParameters";
|
||||
export * from "./RequestRequestOptions";
|
||||
export * from "./ResponseHeaders";
|
||||
export * from "./Route";
|
||||
export * from "./Signal";
|
||||
export * from "./StrategyInterface";
|
||||
export * from "./Url";
|
||||
export * from "./VERSION";
|
||||
export * from "./GetResponseTypeFromEndpointMethod";
|
||||
export * from "./generated/Endpoints";
|
||||
4
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-web/index.js
generated
vendored
4
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-web/index.js
generated
vendored
|
|
@ -1,4 +0,0 @@
|
|||
const VERSION = "5.5.0";
|
||||
|
||||
export { VERSION };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-web/index.js.map
generated
vendored
1
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-web/index.js.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.js","sources":["../dist-src/VERSION.js"],"sourcesContent":["export const VERSION = \"0.0.0-development\";\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
|
||||
49
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/package.json
generated
vendored
49
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/package.json
generated
vendored
|
|
@ -1,49 +0,0 @@
|
|||
{
|
||||
"name": "@octokit/types",
|
||||
"description": "Shared TypeScript definitions for Octokit projects",
|
||||
"version": "5.5.0",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist-*/",
|
||||
"bin/"
|
||||
],
|
||||
"pika": true,
|
||||
"sideEffects": false,
|
||||
"keywords": [
|
||||
"github",
|
||||
"api",
|
||||
"sdk",
|
||||
"toolkit",
|
||||
"typescript"
|
||||
],
|
||||
"repository": "https://github.com/octokit/types.ts",
|
||||
"dependencies": {
|
||||
"@types/node": ">= 8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/graphql": "^4.2.2",
|
||||
"@pika/pack": "^0.5.0",
|
||||
"@pika/plugin-build-node": "^0.9.0",
|
||||
"@pika/plugin-build-web": "^0.9.0",
|
||||
"@pika/plugin-ts-standard-pkg": "^0.9.0",
|
||||
"handlebars": "^4.7.6",
|
||||
"json-schema-to-typescript": "^9.1.0",
|
||||
"lodash.set": "^4.3.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"pascal-case": "^3.1.1",
|
||||
"prettier": "^2.0.0",
|
||||
"semantic-release": "^17.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"sort-keys": "^4.0.0",
|
||||
"string-to-jsdoc-comment": "^1.0.0",
|
||||
"typedoc": "^0.19.0",
|
||||
"typescript": "^4.0.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"source": "dist-src/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"main": "dist-node/index.js",
|
||||
"module": "dist-web/index.js"
|
||||
}
|
||||
23
node_modules/@octokit/plugin-retry/package.json
generated
vendored
23
node_modules/@octokit/plugin-retry/package.json
generated
vendored
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@octokit/plugin-retry",
|
||||
"description": "Automatic retry plugin for octokit",
|
||||
"version": "3.0.3",
|
||||
"version": "3.0.9",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist-*/",
|
||||
|
|
@ -9,20 +9,13 @@
|
|||
],
|
||||
"pika": true,
|
||||
"sideEffects": false,
|
||||
"homepage": "https://github.com/octokit/plugin-retry.js#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/octokit/plugin-retry.js/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/octokit/plugin-retry.js.git"
|
||||
},
|
||||
"repository": "github:octokit/plugin-retry.js",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^5.0.0",
|
||||
"@octokit/types": "^6.0.3",
|
||||
"bottleneck": "^2.15.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/core": "^2.0.0",
|
||||
"@octokit/core": "^3.0.0",
|
||||
"@octokit/request-error": "^2.0.0",
|
||||
"@pika/pack": "^0.5.0",
|
||||
"@pika/plugin-build-node": "^0.9.0",
|
||||
|
|
@ -32,12 +25,12 @@
|
|||
"@types/jest": "^26.0.0",
|
||||
"@types/node": "^14.0.0",
|
||||
"fetch-mock": "^9.0.0",
|
||||
"jest": "^26.0.1",
|
||||
"prettier": "^2.0.1",
|
||||
"jest": "^27.0.0",
|
||||
"prettier": "2.3.1",
|
||||
"semantic-release": "^17.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"ts-jest": "^26.0.0",
|
||||
"typescript": "^3.7.2"
|
||||
"ts-jest": "^27.0.0-next.12",
|
||||
"typescript": "^4.0.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
|
|
|||
10
node_modules/@types/long/README.md
generated
vendored
10
node_modules/@types/long/README.md
generated
vendored
|
|
@ -5,12 +5,12 @@
|
|||
This package contains type definitions for long.js (https://github.com/dcodeIO/long.js).
|
||||
|
||||
# Details
|
||||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/long
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/long.
|
||||
|
||||
Additional Details
|
||||
* Last updated: Wed, 25 Apr 2018 00:38:11 GMT
|
||||
### Additional Details
|
||||
* Last updated: Wed, 22 Jan 2020 19:19:46 GMT
|
||||
* Dependencies: none
|
||||
* Global values: Long
|
||||
* Global values: `Long`
|
||||
|
||||
# Credits
|
||||
These definitions were written by Peter Kooijmans <https://github.com/peterkooijmans>.
|
||||
These definitions were written by Peter Kooijmans (https://github.com/peterkooijmans).
|
||||
|
|
|
|||
774
node_modules/@types/long/index.d.ts
generated
vendored
774
node_modules/@types/long/index.d.ts
generated
vendored
|
|
@ -1,385 +1,389 @@
|
|||
// Type definitions for long.js 4.0.0
|
||||
// Project: https://github.com/dcodeIO/long.js
|
||||
// Definitions by: Peter Kooijmans <https://github.com/peterkooijmans>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Definitions by: Denis Cappellin <https://github.com/cappellin>
|
||||
|
||||
export = Long;
|
||||
export as namespace Long;
|
||||
|
||||
declare namespace Long {}
|
||||
declare class Long
|
||||
{
|
||||
/**
|
||||
* Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs.
|
||||
*/
|
||||
constructor( low: number, high?: number, unsigned?: boolean );
|
||||
|
||||
/**
|
||||
* Maximum unsigned value.
|
||||
*/
|
||||
static MAX_UNSIGNED_VALUE: Long;
|
||||
|
||||
/**
|
||||
* Maximum signed value.
|
||||
*/
|
||||
static MAX_VALUE: Long;
|
||||
|
||||
/**
|
||||
* Minimum signed value.
|
||||
*/
|
||||
static MIN_VALUE: Long;
|
||||
|
||||
/**
|
||||
* Signed negative one.
|
||||
*/
|
||||
static NEG_ONE: Long;
|
||||
|
||||
/**
|
||||
* Signed one.
|
||||
*/
|
||||
static ONE: Long;
|
||||
|
||||
/**
|
||||
* Unsigned one.
|
||||
*/
|
||||
static UONE: Long;
|
||||
|
||||
/**
|
||||
* Unsigned zero.
|
||||
*/
|
||||
static UZERO: Long;
|
||||
|
||||
/**
|
||||
* Signed zero
|
||||
*/
|
||||
static ZERO: Long;
|
||||
|
||||
/**
|
||||
* The high 32 bits as a signed value.
|
||||
*/
|
||||
high: number;
|
||||
|
||||
/**
|
||||
* The low 32 bits as a signed value.
|
||||
*/
|
||||
low: number;
|
||||
|
||||
/**
|
||||
* Whether unsigned or not.
|
||||
*/
|
||||
unsigned: boolean;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
|
||||
*/
|
||||
static fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given 32 bit integer value.
|
||||
*/
|
||||
static fromInt( value: number, unsigned?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
|
||||
*/
|
||||
static fromNumber( value: number, unsigned?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representation of the given string, written using the specified radix.
|
||||
*/
|
||||
static fromString( str: string, unsigned?: boolean | number, radix?: number ): Long;
|
||||
|
||||
/**
|
||||
* Creates a Long from its byte representation.
|
||||
*/
|
||||
static fromBytes( bytes: number[], unsigned?: boolean, le?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Creates a Long from its little endian byte representation.
|
||||
*/
|
||||
static fromBytesLE( bytes: number[], unsigned?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Creates a Long from its little endian byte representation.
|
||||
*/
|
||||
static fromBytesBE( bytes: number[], unsigned?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Tests if the specified object is a Long.
|
||||
*/
|
||||
static isLong( obj: any ): boolean;
|
||||
|
||||
/**
|
||||
* Converts the specified value to a Long.
|
||||
*/
|
||||
static fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long;
|
||||
|
||||
/**
|
||||
* Returns the sum of this and the specified Long.
|
||||
*/
|
||||
add( addend: number | Long | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise AND of this Long and the specified.
|
||||
*/
|
||||
and( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Compares this Long's value with the specified's.
|
||||
*/
|
||||
compare( other: Long | number | string ): number;
|
||||
|
||||
/**
|
||||
* Compares this Long's value with the specified's.
|
||||
*/
|
||||
comp( other: Long | number | string ): number;
|
||||
|
||||
/**
|
||||
* Returns this Long divided by the specified.
|
||||
*/
|
||||
divide( divisor: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long divided by the specified.
|
||||
*/
|
||||
div( divisor: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals the specified's.
|
||||
*/
|
||||
equals( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals the specified's.
|
||||
*/
|
||||
eq( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as a signed integer.
|
||||
*/
|
||||
getHighBits(): number;
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as an unsigned integer.
|
||||
*/
|
||||
getHighBitsUnsigned(): number;
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as a signed integer.
|
||||
*/
|
||||
getLowBits(): number;
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as an unsigned integer.
|
||||
*/
|
||||
getLowBitsUnsigned(): number;
|
||||
|
||||
/**
|
||||
* Gets the number of bits needed to represent the absolute value of this Long.
|
||||
*/
|
||||
getNumBitsAbs(): number;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than the specified's.
|
||||
*/
|
||||
greaterThan( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than the specified's.
|
||||
*/
|
||||
gt( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than or equal the specified's.
|
||||
*/
|
||||
greaterThanOrEqual( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than or equal the specified's.
|
||||
*/
|
||||
gte( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is even.
|
||||
*/
|
||||
isEven(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is negative.
|
||||
*/
|
||||
isNegative(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is odd.
|
||||
*/
|
||||
isOdd(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is positive.
|
||||
*/
|
||||
isPositive(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals zero.
|
||||
*/
|
||||
isZero(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than the specified's.
|
||||
*/
|
||||
lessThan( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than the specified's.
|
||||
*/
|
||||
lt( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than or equal the specified's.
|
||||
*/
|
||||
lessThanOrEqual( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than or equal the specified's.
|
||||
*/
|
||||
lte( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Returns this Long modulo the specified.
|
||||
*/
|
||||
modulo( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long modulo the specified.
|
||||
*/
|
||||
mod( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the product of this and the specified Long.
|
||||
*/
|
||||
multiply( multiplier: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the product of this and the specified Long.
|
||||
*/
|
||||
mul( multiplier: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Negates this Long's value.
|
||||
*/
|
||||
negate(): Long;
|
||||
|
||||
/**
|
||||
* Negates this Long's value.
|
||||
*/
|
||||
neg(): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise NOT of this Long.
|
||||
*/
|
||||
not(): Long;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value differs from the specified's.
|
||||
*/
|
||||
notEquals( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value differs from the specified's.
|
||||
*/
|
||||
neq( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Returns the bitwise OR of this Long and the specified.
|
||||
*/
|
||||
or( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the left by the given amount.
|
||||
*/
|
||||
shiftLeft( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the left by the given amount.
|
||||
*/
|
||||
shl( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits arithmetically shifted to the right by the given amount.
|
||||
*/
|
||||
shiftRight( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits arithmetically shifted to the right by the given amount.
|
||||
*/
|
||||
shr( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits logically shifted to the right by the given amount.
|
||||
*/
|
||||
shiftRightUnsigned( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits logically shifted to the right by the given amount.
|
||||
*/
|
||||
shru( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns the difference of this and the specified Long.
|
||||
*/
|
||||
subtract( subtrahend: number | Long | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the difference of this and the specified Long.
|
||||
*/
|
||||
sub( subtrahend: number | Long |string ): Long;
|
||||
|
||||
/**
|
||||
* Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
|
||||
*/
|
||||
toInt(): number;
|
||||
|
||||
/**
|
||||
* Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
|
||||
*/
|
||||
toNumber(): number;
|
||||
|
||||
/**
|
||||
* Converts this Long to its byte representation.
|
||||
*/
|
||||
|
||||
toBytes( le?: boolean ): number[];
|
||||
|
||||
/**
|
||||
* Converts this Long to its little endian byte representation.
|
||||
*/
|
||||
|
||||
toBytesLE(): number[];
|
||||
|
||||
/**
|
||||
* Converts this Long to its big endian byte representation.
|
||||
*/
|
||||
|
||||
toBytesBE(): number[];
|
||||
|
||||
/**
|
||||
* Converts this Long to signed.
|
||||
*/
|
||||
toSigned(): Long;
|
||||
|
||||
/**
|
||||
* Converts the Long to a string written in the specified radix.
|
||||
*/
|
||||
toString( radix?: number ): string;
|
||||
|
||||
/**
|
||||
* Converts this Long to unsigned.
|
||||
*/
|
||||
toUnsigned(): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise XOR of this Long and the given one.
|
||||
*/
|
||||
xor( other: Long | number | string ): Long;
|
||||
}
|
||||
// Type definitions for long.js 4.0.0
|
||||
// Project: https://github.com/dcodeIO/long.js
|
||||
// Definitions by: Peter Kooijmans <https://github.com/peterkooijmans>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Definitions by: Denis Cappellin <https://github.com/cappellin>
|
||||
|
||||
export = Long;
|
||||
export as namespace Long;
|
||||
|
||||
declare const Long: Long.LongConstructor;
|
||||
type Long = Long.Long;
|
||||
declare namespace Long {
|
||||
interface LongConstructor {
|
||||
/**
|
||||
* Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs.
|
||||
*/
|
||||
new( low: number, high?: number, unsigned?: boolean ): Long;
|
||||
prototype: Long;
|
||||
/**
|
||||
* Maximum unsigned value.
|
||||
*/
|
||||
MAX_UNSIGNED_VALUE: Long;
|
||||
|
||||
/**
|
||||
* Maximum signed value.
|
||||
*/
|
||||
MAX_VALUE: Long;
|
||||
|
||||
/**
|
||||
* Minimum signed value.
|
||||
*/
|
||||
MIN_VALUE: Long;
|
||||
|
||||
/**
|
||||
* Signed negative one.
|
||||
*/
|
||||
NEG_ONE: Long;
|
||||
|
||||
/**
|
||||
* Signed one.
|
||||
*/
|
||||
ONE: Long;
|
||||
|
||||
/**
|
||||
* Unsigned one.
|
||||
*/
|
||||
UONE: Long;
|
||||
|
||||
/**
|
||||
* Unsigned zero.
|
||||
*/
|
||||
UZERO: Long;
|
||||
|
||||
/**
|
||||
* Signed zero
|
||||
*/
|
||||
ZERO: Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
|
||||
*/
|
||||
fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given 32 bit integer value.
|
||||
*/
|
||||
fromInt( value: number, unsigned?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
|
||||
*/
|
||||
fromNumber( value: number, unsigned?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representation of the given string, written using the specified radix.
|
||||
*/
|
||||
fromString( str: string, unsigned?: boolean | number, radix?: number ): Long;
|
||||
|
||||
/**
|
||||
* Creates a Long from its byte representation.
|
||||
*/
|
||||
fromBytes( bytes: number[], unsigned?: boolean, le?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Creates a Long from its little endian byte representation.
|
||||
*/
|
||||
fromBytesLE( bytes: number[], unsigned?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Creates a Long from its little endian byte representation.
|
||||
*/
|
||||
fromBytesBE( bytes: number[], unsigned?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Tests if the specified object is a Long.
|
||||
*/
|
||||
isLong( obj: any ): obj is Long;
|
||||
|
||||
/**
|
||||
* Converts the specified value to a Long.
|
||||
*/
|
||||
fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long;
|
||||
}
|
||||
interface Long
|
||||
{
|
||||
/**
|
||||
* The high 32 bits as a signed value.
|
||||
*/
|
||||
high: number;
|
||||
|
||||
/**
|
||||
* The low 32 bits as a signed value.
|
||||
*/
|
||||
low: number;
|
||||
|
||||
/**
|
||||
* Whether unsigned or not.
|
||||
*/
|
||||
unsigned: boolean;
|
||||
|
||||
/**
|
||||
* Returns the sum of this and the specified Long.
|
||||
*/
|
||||
add( addend: number | Long | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise AND of this Long and the specified.
|
||||
*/
|
||||
and( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Compares this Long's value with the specified's.
|
||||
*/
|
||||
compare( other: Long | number | string ): number;
|
||||
|
||||
/**
|
||||
* Compares this Long's value with the specified's.
|
||||
*/
|
||||
comp( other: Long | number | string ): number;
|
||||
|
||||
/**
|
||||
* Returns this Long divided by the specified.
|
||||
*/
|
||||
divide( divisor: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long divided by the specified.
|
||||
*/
|
||||
div( divisor: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals the specified's.
|
||||
*/
|
||||
equals( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals the specified's.
|
||||
*/
|
||||
eq( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as a signed integer.
|
||||
*/
|
||||
getHighBits(): number;
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as an unsigned integer.
|
||||
*/
|
||||
getHighBitsUnsigned(): number;
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as a signed integer.
|
||||
*/
|
||||
getLowBits(): number;
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as an unsigned integer.
|
||||
*/
|
||||
getLowBitsUnsigned(): number;
|
||||
|
||||
/**
|
||||
* Gets the number of bits needed to represent the absolute value of this Long.
|
||||
*/
|
||||
getNumBitsAbs(): number;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than the specified's.
|
||||
*/
|
||||
greaterThan( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than the specified's.
|
||||
*/
|
||||
gt( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than or equal the specified's.
|
||||
*/
|
||||
greaterThanOrEqual( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than or equal the specified's.
|
||||
*/
|
||||
gte( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is even.
|
||||
*/
|
||||
isEven(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is negative.
|
||||
*/
|
||||
isNegative(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is odd.
|
||||
*/
|
||||
isOdd(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is positive.
|
||||
*/
|
||||
isPositive(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals zero.
|
||||
*/
|
||||
isZero(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than the specified's.
|
||||
*/
|
||||
lessThan( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than the specified's.
|
||||
*/
|
||||
lt( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than or equal the specified's.
|
||||
*/
|
||||
lessThanOrEqual( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than or equal the specified's.
|
||||
*/
|
||||
lte( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Returns this Long modulo the specified.
|
||||
*/
|
||||
modulo( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long modulo the specified.
|
||||
*/
|
||||
mod( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the product of this and the specified Long.
|
||||
*/
|
||||
multiply( multiplier: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the product of this and the specified Long.
|
||||
*/
|
||||
mul( multiplier: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Negates this Long's value.
|
||||
*/
|
||||
negate(): Long;
|
||||
|
||||
/**
|
||||
* Negates this Long's value.
|
||||
*/
|
||||
neg(): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise NOT of this Long.
|
||||
*/
|
||||
not(): Long;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value differs from the specified's.
|
||||
*/
|
||||
notEquals( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value differs from the specified's.
|
||||
*/
|
||||
neq( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Returns the bitwise OR of this Long and the specified.
|
||||
*/
|
||||
or( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the left by the given amount.
|
||||
*/
|
||||
shiftLeft( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the left by the given amount.
|
||||
*/
|
||||
shl( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits arithmetically shifted to the right by the given amount.
|
||||
*/
|
||||
shiftRight( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits arithmetically shifted to the right by the given amount.
|
||||
*/
|
||||
shr( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits logically shifted to the right by the given amount.
|
||||
*/
|
||||
shiftRightUnsigned( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits logically shifted to the right by the given amount.
|
||||
*/
|
||||
shru( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns the difference of this and the specified Long.
|
||||
*/
|
||||
subtract( subtrahend: number | Long | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the difference of this and the specified Long.
|
||||
*/
|
||||
sub( subtrahend: number | Long |string ): Long;
|
||||
|
||||
/**
|
||||
* Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
|
||||
*/
|
||||
toInt(): number;
|
||||
|
||||
/**
|
||||
* Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
|
||||
*/
|
||||
toNumber(): number;
|
||||
|
||||
/**
|
||||
* Converts this Long to its byte representation.
|
||||
*/
|
||||
|
||||
toBytes( le?: boolean ): number[];
|
||||
|
||||
/**
|
||||
* Converts this Long to its little endian byte representation.
|
||||
*/
|
||||
|
||||
toBytesLE(): number[];
|
||||
|
||||
/**
|
||||
* Converts this Long to its big endian byte representation.
|
||||
*/
|
||||
|
||||
toBytesBE(): number[];
|
||||
|
||||
/**
|
||||
* Converts this Long to signed.
|
||||
*/
|
||||
toSigned(): Long;
|
||||
|
||||
/**
|
||||
* Converts the Long to a string written in the specified radix.
|
||||
*/
|
||||
toString( radix?: number ): string;
|
||||
|
||||
/**
|
||||
* Converts this Long to unsigned.
|
||||
*/
|
||||
toUnsigned(): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise XOR of this Long and the given one.
|
||||
*/
|
||||
xor( other: Long | number | string ): Long;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
node_modules/@types/long/package.json
generated
vendored
10
node_modules/@types/long/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@types/long",
|
||||
"version": "4.0.0",
|
||||
"version": "4.0.1",
|
||||
"description": "TypeScript definitions for long.js",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
|
|
@ -11,12 +11,14 @@
|
|||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/long"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "cc3246302180c8c161d2e2c0c3f0a419226efa475d2cd5afbe51986d60cd8287",
|
||||
"typeScriptVersion": "2.0"
|
||||
"typesPublisherContentHash": "5a2ae1424989c49d7303e1f5cc510288bfab1e71e0e2143cdcb9d24ff1c3dc8e",
|
||||
"typeScriptVersion": "2.8"
|
||||
}
|
||||
227
node_modules/jsonschema/README.md
generated
vendored
227
node_modules/jsonschema/README.md
generated
vendored
|
|
@ -1,18 +1,22 @@
|
|||
[](http://travis-ci.org/tdegrunt/jsonschema)
|
||||
|
||||
# jsonschema
|
||||
|
||||
[JSON schema](http://json-schema.org/) validator, which is designed to be fast and simple to use.
|
||||
The latest IETF published draft is v6, this library is mostly v4 compatible.
|
||||
|
||||
## Contributing & bugs
|
||||
|
||||
Please fork the repository, make the changes in your fork and include tests. Once you're done making changes, send in a pull request.
|
||||
|
||||
### Bug reports
|
||||
|
||||
Please include a test which shows why the code fails.
|
||||
|
||||
## Usage
|
||||
|
||||
### Simple
|
||||
|
||||
Simple object validation using JSON schemas.
|
||||
|
||||
```javascript
|
||||
|
|
@ -78,6 +82,7 @@ v.addSchema(addressSchema, '/SimpleAddress');
|
|||
console.log(v.validate(p, schema));
|
||||
```
|
||||
### Example for Array schema
|
||||
|
||||
```json
|
||||
var arraySchema = {
|
||||
"type": "array",
|
||||
|
|
@ -95,21 +100,42 @@ For a comprehensive, annotated example illustrating all possible validation opti
|
|||
## Features
|
||||
|
||||
### Definitions
|
||||
|
||||
All schema definitions are supported, $schema is ignored.
|
||||
|
||||
### Types
|
||||
|
||||
All types are supported
|
||||
|
||||
### Handling `undefined`
|
||||
|
||||
`undefined` is not a value known to JSON, and by default, the validator treats it as if it is not invalid. i.e., it will return valid.
|
||||
|
||||
```javascript
|
||||
var res = validate(undefined, {type: 'string'});
|
||||
res.valid // true
|
||||
```
|
||||
|
||||
This behavior may be changed with the "required" option:
|
||||
|
||||
```javascript
|
||||
var res = validate(undefined, {type: 'string'}, {required: true});
|
||||
res.valid // false
|
||||
```
|
||||
|
||||
### Formats
|
||||
|
||||
#### Disabling the format keyword.
|
||||
|
||||
You may disable format validation by providing `disableFormat: true` to the validator
|
||||
options.
|
||||
|
||||
#### String Formats
|
||||
|
||||
All formats are supported, phone numbers are expected to follow the [E.123](http://en.wikipedia.org/wiki/E.123) standard.
|
||||
|
||||
#### Custom Formats
|
||||
|
||||
You may add your own custom format functions. Format functions accept the input
|
||||
being validated and return a boolean value. If the returned value is `true`, then
|
||||
validation succeeds. If the returned value is `false`, then validation fails.
|
||||
|
|
@ -133,27 +159,86 @@ validator.validate('foo', {type: 'string', format: 'myFormat'}).valid; // false
|
|||
```
|
||||
|
||||
### Results
|
||||
The first error found will be thrown as an `Error` object if `options.throwError` is `true`. Otherwise all results will be appended to the `result.errors` array which also contains the success flag `result.valid`.
|
||||
|
||||
When `oneOf` or `anyOf` validations fail, errors that caused any of the sub-schemas referenced therein to fail are not reported, unless `options.nestedErrors` is truthy. This option may be useful when troubleshooting validation errors in complex schemas.
|
||||
By default, results will be returned in a `ValidatorResult` object with the following properties:
|
||||
|
||||
### Custom properties
|
||||
Specify your own JSON Schema properties with the validator.attributes property:
|
||||
* `instance`: any.
|
||||
* `schema`: Schema.
|
||||
* `errors`: ValidationError[].
|
||||
* `valid`: boolean.
|
||||
|
||||
Each item in `errors` is a `ValidationError` with the following properties:
|
||||
|
||||
* path: array. An array of property keys or array offsets, indicating where inside objects or arrays the instance was found.
|
||||
* property: string. Describes the property path. Starts with `instance`, and is delimited with a dot (`.`).
|
||||
* message: string. A human-readable message for debugging use. Provided in English and subject to change.
|
||||
* schema: object. The schema containing the keyword that failed
|
||||
* instance: any. The instance that failed
|
||||
* name: string. The keyword within the schema that failed.
|
||||
* argument: any. Provides information about the keyword that failed.
|
||||
|
||||
The validator can be configured to throw in the event of a validation error:
|
||||
|
||||
* If the `throwFirst` option is set, the validator will terminate validation at the first encountered error and throw a `ValidatorResultError` object.
|
||||
|
||||
* If the `throwAll` option is set, the validator will throw a `ValidatorResultError` object after the entire instance has been validated.
|
||||
|
||||
* If the `throwError` option is set, it will throw at the first encountered validation error (like `throwFirst`), but the `ValidationError` object itself will be thrown. Note that, despite the name, this does not inherit from Error like `ValidatorResultError` does.
|
||||
|
||||
The `ValidatorResultError` object has the same properties as `ValidatorResult` and additionally inherits from Error.
|
||||
|
||||
#### "nestedErrors" option
|
||||
|
||||
When `oneOf` or `anyOf` validations fail, errors that caused any of the sub-schemas referenced therein to fail are normally suppressed, because it is not necessary to fix all of them. And in the case of `oneOf`, it would itself be an error to fix all of the listed errors.
|
||||
|
||||
This behavior may be configured with `options.nestedErrors`. If truthy, it will emit all the errors from the subschemas. This option may be useful when troubleshooting validation errors in complex schemas:
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
oneOf: [
|
||||
{ type: 'string', minLength: 32, maxLength: 32 },
|
||||
{ type: 'string', maxLength: 16 },
|
||||
{ type: 'number' },
|
||||
]
|
||||
};
|
||||
var validator = new Validator();
|
||||
var result = validator.validate('This string is 28 chars long', schema, {nestedErrors: true});
|
||||
|
||||
// result.toString() reads out:
|
||||
// 0: instance does not meet minimum length of 32
|
||||
// 1: instance does not meet maximum length of 16
|
||||
// 2: instance is not of a type(s) number
|
||||
// 3: instance is not exactly one from [subschema 0],[subschema 1],[subschema 2]
|
||||
```
|
||||
|
||||
#### Localizing Error Messages
|
||||
|
||||
To provide localized, human-readable errors, use the `name` string as a translation key. Feel free to open an issue for support relating to localizing error messages. For example:
|
||||
|
||||
```
|
||||
var localized = result.errors.map(function(err){
|
||||
return localeService.translate(err.name);
|
||||
});
|
||||
```
|
||||
|
||||
### Custom keywords
|
||||
|
||||
Specify your own JSON Schema keywords with the validator.attributes property:
|
||||
|
||||
```javascript
|
||||
validator.attributes.contains = function validateContains(instance, schema, options, ctx) {
|
||||
if(typeof instance!='string') return;
|
||||
if(typeof schema.contains!='string') throw new jsonschema.SchemaError('"contains" expects a string', schema);
|
||||
if(typeof instance !== 'string') return;
|
||||
if(typeof schema.contains !== 'string') throw new jsonschema.SchemaError('"contains" expects a string', schema);
|
||||
if(instance.indexOf(schema.contains)<0){
|
||||
return 'does not contain the string ' + JSON.stringify(schema.contains);
|
||||
}
|
||||
}
|
||||
var result = validator.validate("i am an instance", { type:"string", contains: "i am" });
|
||||
var result = validator.validate("I am an instance", { type:"string", contains: "I am" });
|
||||
// result.valid === true;
|
||||
```
|
||||
|
||||
The instance passes validation if the function returns nothing. A single validation error is produced
|
||||
if the fuction returns a string. Any number of errors (maybe none at all) may be returned by passing a
|
||||
if the function returns a string. Any number of errors (maybe none at all) may be returned by passing a
|
||||
`ValidatorResult` object, which may be used like so:
|
||||
|
||||
```javascript
|
||||
|
|
@ -165,6 +250,7 @@ if the fuction returns a string. Any number of errors (maybe none at all) may be
|
|||
```
|
||||
|
||||
### Dereferencing schemas
|
||||
|
||||
Sometimes you may want to download schemas from remote sources, like a database, or over HTTP. When importing a schema,
|
||||
unknown references are inserted into the `validator.unresolvedRefs` Array. Asynchronously shift elements off this array and import
|
||||
them:
|
||||
|
|
@ -184,44 +270,119 @@ function importNextSchema(){
|
|||
importNextSchema();
|
||||
```
|
||||
|
||||
### Default base URI
|
||||
|
||||
Schemas should typically have an `id` with an absolute, full URI. However if the schema you are using contains only relative URI references, the `base` option will be used to resolve these.
|
||||
|
||||
This following example would throw a `SchemaError` if the `base` option were unset:
|
||||
|
||||
```javascript
|
||||
var result = validate(["Name"], {
|
||||
id: "/schema.json",
|
||||
type: "array",
|
||||
items: { $ref: "http://example.com/schema.json#/definitions/item" },
|
||||
definitions: {
|
||||
item: { type: "string" },
|
||||
},
|
||||
}, { base: 'http://example.com/' });
|
||||
```
|
||||
|
||||
### Rewrite Hook
|
||||
|
||||
The `rewrite` option lets you change the value of an instance after it has successfully been validated. This will mutate the `instance` passed to the validate function. This can be useful for unmarshalling data and parsing it into native instances, such as changing a string to a `Date` instance.
|
||||
|
||||
The `rewrite` option accepts a function with the following arguments:
|
||||
|
||||
* instance: any
|
||||
* schema: object
|
||||
* options: object
|
||||
* ctx: object
|
||||
* return value: any new value for the instance
|
||||
|
||||
The value may be removed by returning `undefined`.
|
||||
If you don't want to change the value, call `return instance`.
|
||||
|
||||
Here is an example that can convert a property expecting a date into a Date instance:
|
||||
|
||||
```javascript
|
||||
const schema = {
|
||||
properties: {
|
||||
date: {id: 'http://example.com/date', type: 'string'},
|
||||
},
|
||||
};
|
||||
|
||||
const value = {
|
||||
date: '2020-09-30T23:39:27.060Z',
|
||||
};
|
||||
|
||||
function unmarshall(instance, schema){
|
||||
if(schema.id === 'http://example.com/date'){
|
||||
return new Date(instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
const v = new Validator();
|
||||
const res = v.validate(value, schema, {rewrite: unmarshall});
|
||||
|
||||
assert(res.instance.date instanceof Date);
|
||||
```
|
||||
|
||||
|
||||
### Pre-Property Validation Hook
|
||||
|
||||
If some processing of properties is required prior to validation a function may be passed via the options parameter of the validate function. For example, say you needed to perform type coercion for some properties:
|
||||
|
||||
```javascript
|
||||
const coercionHook = function (instance, property, schema, options, ctx) {
|
||||
var value = instance[property];
|
||||
// See examples/coercion.js
|
||||
function preValidateProperty(object, key, schema, options, ctx) {
|
||||
var value = object[key];
|
||||
if (typeof value === 'undefined') return;
|
||||
|
||||
// Skip nulls and undefineds
|
||||
if (value === null || typeof value == 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the schema declares a type and the property fails type validation.
|
||||
if (schema.type && this.attributes.type.call(this, instance, schema, options, ctx.makeChild(schema, property))) {
|
||||
var types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
||||
var coerced = undefined;
|
||||
|
||||
// Go through the declared types until we find something that we can
|
||||
// coerce the value into.
|
||||
for (var i = 0; typeof coerced == 'undefined' && i < types.length; i++) {
|
||||
// If we support coercion to this type
|
||||
if (lib.coercions[types[i]]) {
|
||||
// ...attempt it.
|
||||
coerced = lib.coercions[types[i]](value);
|
||||
}
|
||||
// Test if the schema declares a type, but the type keyword fails validation
|
||||
if (schema.type && validator.attributes.type.call(validator, value, schema, options, ctx.makeChild(schema, key))) {
|
||||
// If the type is "number" but the instance is not a number, cast it
|
||||
if(schema.type==='number' && typeof value!=='number'){
|
||||
object[key] = parseFloat(value);
|
||||
return;
|
||||
}
|
||||
// If we got a successful coercion we modify the property of the instance.
|
||||
if (typeof coerced != 'undefined') {
|
||||
instance[property] = coerced;
|
||||
// If the type is "string" but the instance is not a string, cast it
|
||||
if(schema.type==='string' && typeof value!=='string'){
|
||||
object[key] = String(value).toString();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}.bind(validator)
|
||||
};
|
||||
|
||||
// And now, to actually perform validation with the coercion hook!
|
||||
v.validate(instance, schema, { preValidateProperty: coercionHook });
|
||||
v.validate(instance, schema, { preValidateProperty });
|
||||
```
|
||||
|
||||
### Skip validation of certain keywords
|
||||
|
||||
Use the "skipAttributes" option to skip validation of certain keywords. Provide an array of keywords to ignore.
|
||||
|
||||
For skipping the "format" keyword, see the disableFormat option.
|
||||
|
||||
### Fail on unknown keywords
|
||||
|
||||
By default, JSON Schema is supposed to ignore unknown schema keywords.
|
||||
|
||||
You can change this behavior to require that all keywords used in a schema have a defined behavior, by using setting the "allowUnknownAttributes" option to false.
|
||||
|
||||
This example will throw a `SchemaError`:
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
type: "string",
|
||||
format: "email",
|
||||
example: "foo",
|
||||
};
|
||||
var result = validate("Name", schema, { allowUnknownAttributes: false });
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
Uses [JSON Schema Test Suite](https://github.com/json-schema/JSON-Schema-Test-Suite) as well as our own tests.
|
||||
You'll need to update and init the git submodules:
|
||||
|
||||
|
|
|
|||
266
node_modules/jsonschema/lib/attribute.js
generated
vendored
266
node_modules/jsonschema/lib/attribute.js
generated
vendored
|
|
@ -16,13 +16,13 @@ attribute.ignoreProperties = {
|
|||
'description': true,
|
||||
'title': true,
|
||||
// arguments to other properties
|
||||
'exclusiveMinimum': true,
|
||||
'exclusiveMaximum': true,
|
||||
'additionalItems': true,
|
||||
'then': true,
|
||||
'else': true,
|
||||
// special-handled properties
|
||||
'$schema': true,
|
||||
'$ref': true,
|
||||
'extends': true
|
||||
'extends': true,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -47,7 +47,9 @@ validators.type = function validateType (instance, schema, options, ctx) {
|
|||
var types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
||||
if (!types.some(this.testType.bind(this, instance, schema, options, ctx))) {
|
||||
var list = types.map(function (v) {
|
||||
return v.id && ('<' + v.id + '>') || (v+'');
|
||||
if(!v) return;
|
||||
var id = v.$id || v.id;
|
||||
return id ? ('<' + id + '>') : (v+'');
|
||||
});
|
||||
result.addError({
|
||||
name: 'type',
|
||||
|
|
@ -60,9 +62,12 @@ validators.type = function validateType (instance, schema, options, ctx) {
|
|||
|
||||
function testSchemaNoThrow(instance, options, ctx, callback, schema){
|
||||
var throwError = options.throwError;
|
||||
var throwAll = options.throwAll;
|
||||
options.throwError = false;
|
||||
options.throwAll = false;
|
||||
var res = this.validateSchema(instance, schema, options, ctx);
|
||||
options.throwError = throwError;
|
||||
options.throwAll = throwAll;
|
||||
|
||||
if (!res.valid && callback instanceof Function) {
|
||||
callback(res);
|
||||
|
|
@ -91,9 +96,11 @@ validators.anyOf = function validateAnyOf (instance, schema, options, ctx) {
|
|||
if (!schema.anyOf.some(
|
||||
testSchemaNoThrow.bind(
|
||||
this, instance, options, ctx, function(res){inner.importErrors(res);}
|
||||
))) {
|
||||
))) {
|
||||
var list = schema.anyOf.map(function (v, i) {
|
||||
return (v.id && ('<' + v.id + '>')) || (v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';
|
||||
var id = v.$id || v.id;
|
||||
if(id) return '<' + id + '>';
|
||||
return(v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';
|
||||
});
|
||||
if (options.nestedErrors) {
|
||||
result.importErrors(inner);
|
||||
|
|
@ -128,7 +135,8 @@ validators.allOf = function validateAllOf (instance, schema, options, ctx) {
|
|||
schema.allOf.forEach(function(v, i){
|
||||
var valid = self.validateSchema(instance, v, options, ctx);
|
||||
if(!valid.valid){
|
||||
var msg = (v.id && ('<' + v.id + '>')) || (v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';
|
||||
var id = v.$id || v.id;
|
||||
var msg = id || (v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';
|
||||
result.addError({
|
||||
name: 'allOf',
|
||||
argument: { id: msg, length: valid.errors.length, valid: valid },
|
||||
|
|
@ -161,9 +169,10 @@ validators.oneOf = function validateOneOf (instance, schema, options, ctx) {
|
|||
var count = schema.oneOf.filter(
|
||||
testSchemaNoThrow.bind(
|
||||
this, instance, options, ctx, function(res) {inner.importErrors(res);}
|
||||
) ).length;
|
||||
) ).length;
|
||||
var list = schema.oneOf.map(function (v, i) {
|
||||
return (v.id && ('<' + v.id + '>')) || (v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';
|
||||
var id = v.$id || v.id;
|
||||
return id || (v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';
|
||||
});
|
||||
if (count!==1) {
|
||||
if (options.nestedErrors) {
|
||||
|
|
@ -178,6 +187,70 @@ validators.oneOf = function validateOneOf (instance, schema, options, ctx) {
|
|||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Validates "then" or "else" depending on the result of validating "if"
|
||||
* @param instance
|
||||
* @param schema
|
||||
* @param options
|
||||
* @param ctx
|
||||
* @return {String|null}
|
||||
*/
|
||||
validators.if = function validateIf (instance, schema, options, ctx) {
|
||||
// Ignore undefined instances
|
||||
if (instance === undefined) return null;
|
||||
if (!helpers.isSchema(schema.if)) throw new Error('Expected "if" keyword to be a schema');
|
||||
var ifValid = testSchemaNoThrow.call(this, instance, options, ctx, null, schema.if);
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
var res;
|
||||
if(ifValid){
|
||||
if (schema.then === undefined) return;
|
||||
if (!helpers.isSchema(schema.then)) throw new Error('Expected "then" keyword to be a schema');
|
||||
res = this.validateSchema(instance, schema.then, options, ctx.makeChild(schema.then));
|
||||
result.importErrors(res);
|
||||
}else{
|
||||
if (schema.else === undefined) return;
|
||||
if (!helpers.isSchema(schema.else)) throw new Error('Expected "else" keyword to be a schema');
|
||||
res = this.validateSchema(instance, schema.else, options, ctx.makeChild(schema.else));
|
||||
result.importErrors(res);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
function getEnumerableProperty(object, key){
|
||||
// Determine if `key` shows up in `for(var key in object)`
|
||||
// First test Object.hasOwnProperty.call as an optimization: that guarantees it does
|
||||
if(Object.hasOwnProperty.call(object, key)) return object[key];
|
||||
// Test `key in object` as an optimization; false means it won't
|
||||
if(!(key in object)) return;
|
||||
while( (object = Object.getPrototypeOf(object)) ){
|
||||
if(Object.propertyIsEnumerable.call(object, key)) return object[key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates propertyNames
|
||||
* @param instance
|
||||
* @param schema
|
||||
* @param options
|
||||
* @param ctx
|
||||
* @return {String|null|ValidatorResult}
|
||||
*/
|
||||
validators.propertyNames = function validatePropertyNames (instance, schema, options, ctx) {
|
||||
if(!this.types.object(instance)) return;
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
var subschema = schema.propertyNames!==undefined ? schema.propertyNames : {};
|
||||
if(!helpers.isSchema(subschema)) throw new SchemaError('Expected "propertyNames" to be a schema (object or boolean)');
|
||||
|
||||
for (var property in instance) {
|
||||
if(getEnumerableProperty(instance, property) !== undefined){
|
||||
var res = this.validateSchema(property, subschema, options, ctx.makeChild(subschema));
|
||||
result.importErrors(res);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Validates properties
|
||||
* @param instance
|
||||
|
|
@ -191,12 +264,17 @@ validators.properties = function validateProperties (instance, schema, options,
|
|||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
var properties = schema.properties || {};
|
||||
for (var property in properties) {
|
||||
if (typeof options.preValidateProperty == 'function') {
|
||||
options.preValidateProperty(instance, property, properties[property], options, ctx);
|
||||
var subschema = properties[property];
|
||||
if(subschema===undefined){
|
||||
continue;
|
||||
}else if(subschema===null){
|
||||
throw new SchemaError('Unexpected null, expected schema in "properties"');
|
||||
}
|
||||
|
||||
var prop = Object.hasOwnProperty.call(instance, property) ? instance[property] : undefined;
|
||||
var res = this.validateSchema(prop, properties[property], options, ctx.makeChild(properties[property], property));
|
||||
if (typeof options.preValidateProperty == 'function') {
|
||||
options.preValidateProperty(instance, property, subschema, options, ctx);
|
||||
}
|
||||
var prop = getEnumerableProperty(instance, property);
|
||||
var res = this.validateSchema(prop, subschema, options, ctx.makeChild(subschema, property));
|
||||
if(res.instance !== result.instance[property]) result.instance[property] = res.instance;
|
||||
result.importErrors(res);
|
||||
}
|
||||
|
|
@ -206,7 +284,7 @@ validators.properties = function validateProperties (instance, schema, options,
|
|||
/**
|
||||
* Test a specific property within in instance against the additionalProperties schema attribute
|
||||
* This ignores properties with definitions in the properties schema attribute, but no other attributes.
|
||||
* If too many more types of property-existance tests pop up they may need their own class of tests (like `type` has)
|
||||
* If too many more types of property-existence tests pop up they may need their own class of tests (like `type` has)
|
||||
* @private
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
|
@ -219,7 +297,7 @@ function testAdditionalProperty (instance, schema, options, ctx, property, resul
|
|||
result.addError({
|
||||
name: 'additionalProperties',
|
||||
argument: property,
|
||||
message: "additionalProperty " + JSON.stringify(property) + " exists in instance when not allowed",
|
||||
message: "is not allowed to have the additional property " + JSON.stringify(property),
|
||||
});
|
||||
} else {
|
||||
var additionalProperties = schema.additionalProperties || {};
|
||||
|
|
@ -250,17 +328,29 @@ validators.patternProperties = function validatePatternProperties (instance, sch
|
|||
for (var property in instance) {
|
||||
var test = true;
|
||||
for (var pattern in patternProperties) {
|
||||
var expr = new RegExp(pattern);
|
||||
if (!expr.test(property)) {
|
||||
var subschema = patternProperties[pattern];
|
||||
if(subschema===undefined){
|
||||
continue;
|
||||
}else if(subschema===null){
|
||||
throw new SchemaError('Unexpected null, expected schema in "patternProperties"');
|
||||
}
|
||||
try {
|
||||
var regexp = new RegExp(pattern, 'u');
|
||||
} catch(_e) {
|
||||
// In the event the stricter handling causes an error, fall back on the forgiving handling
|
||||
// DEPRECATED
|
||||
regexp = new RegExp(pattern);
|
||||
}
|
||||
if (!regexp.test(property)) {
|
||||
continue;
|
||||
}
|
||||
test = false;
|
||||
|
||||
if (typeof options.preValidateProperty == 'function') {
|
||||
options.preValidateProperty(instance, property, patternProperties[pattern], options, ctx);
|
||||
options.preValidateProperty(instance, property, subschema, options, ctx);
|
||||
}
|
||||
|
||||
var res = this.validateSchema(instance[property], patternProperties[pattern], options, ctx.makeChild(patternProperties[pattern], property));
|
||||
var res = this.validateSchema(instance[property], subschema, options, ctx.makeChild(subschema, property));
|
||||
if(res.instance !== result.instance[property]) result.instance[property] = res.instance;
|
||||
result.importErrors(res);
|
||||
}
|
||||
|
|
@ -308,7 +398,7 @@ validators.minProperties = function validateMinProperties (instance, schema, opt
|
|||
name: 'minProperties',
|
||||
argument: schema.minProperties,
|
||||
message: "does not meet minimum property length of " + schema.minProperties,
|
||||
})
|
||||
});
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
|
@ -375,18 +465,22 @@ validators.items = function validateItems (instance, schema, options, ctx) {
|
|||
validators.minimum = function validateMinimum (instance, schema, options, ctx) {
|
||||
if (!this.types.number(instance)) return;
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
var valid = true;
|
||||
if (schema.exclusiveMinimum && schema.exclusiveMinimum === true) {
|
||||
valid = instance > schema.minimum;
|
||||
if(!(instance > schema.minimum)){
|
||||
result.addError({
|
||||
name: 'minimum',
|
||||
argument: schema.minimum,
|
||||
message: "must be greater than " + schema.minimum,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
valid = instance >= schema.minimum;
|
||||
}
|
||||
if (!valid) {
|
||||
result.addError({
|
||||
name: 'minimum',
|
||||
argument: schema.minimum,
|
||||
message: "must have a minimum value of " + schema.minimum,
|
||||
});
|
||||
if(!(instance >= schema.minimum)){
|
||||
result.addError({
|
||||
name: 'minimum',
|
||||
argument: schema.minimum,
|
||||
message: "must be greater than or equal to " + schema.minimum,
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
|
@ -400,17 +494,65 @@ validators.minimum = function validateMinimum (instance, schema, options, ctx) {
|
|||
validators.maximum = function validateMaximum (instance, schema, options, ctx) {
|
||||
if (!this.types.number(instance)) return;
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
var valid;
|
||||
if (schema.exclusiveMaximum && schema.exclusiveMaximum === true) {
|
||||
valid = instance < schema.maximum;
|
||||
if(!(instance < schema.maximum)){
|
||||
result.addError({
|
||||
name: 'maximum',
|
||||
argument: schema.maximum,
|
||||
message: "must be less than " + schema.maximum,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
valid = instance <= schema.maximum;
|
||||
if(!(instance <= schema.maximum)){
|
||||
result.addError({
|
||||
name: 'maximum',
|
||||
argument: schema.maximum,
|
||||
message: "must be less than or equal to " + schema.maximum,
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Validates the number form of exclusiveMinimum when the type of the instance value is a number.
|
||||
* @param instance
|
||||
* @param schema
|
||||
* @return {String|null}
|
||||
*/
|
||||
validators.exclusiveMinimum = function validateExclusiveMinimum (instance, schema, options, ctx) {
|
||||
// Support the boolean form of exclusiveMinimum, which is handled by the "minimum" keyword.
|
||||
if(typeof schema.exclusiveMaximum === 'boolean') return;
|
||||
if (!this.types.number(instance)) return;
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
var valid = instance > schema.exclusiveMinimum;
|
||||
if (!valid) {
|
||||
result.addError({
|
||||
name: 'maximum',
|
||||
argument: schema.maximum,
|
||||
message: "must have a maximum value of " + schema.maximum,
|
||||
name: 'exclusiveMinimum',
|
||||
argument: schema.exclusiveMinimum,
|
||||
message: "must be strictly greater than " + schema.exclusiveMinimum,
|
||||
});
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Validates the number form of exclusiveMaximum when the type of the instance value is a number.
|
||||
* @param instance
|
||||
* @param schema
|
||||
* @return {String|null}
|
||||
*/
|
||||
validators.exclusiveMaximum = function validateExclusiveMaximum (instance, schema, options, ctx) {
|
||||
// Support the boolean form of exclusiveMaximum, which is handled by the "maximum" keyword.
|
||||
if(typeof schema.exclusiveMaximum === 'boolean') return;
|
||||
if (!this.types.number(instance)) return;
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
var valid = instance < schema.exclusiveMaximum;
|
||||
if (!valid) {
|
||||
result.addError({
|
||||
name: 'exclusiveMaximum',
|
||||
argument: schema.exclusiveMaximum,
|
||||
message: "must be strictly less than " + schema.exclusiveMaximum,
|
||||
});
|
||||
}
|
||||
return result;
|
||||
|
|
@ -444,7 +586,7 @@ var validateMultipleOfOrDivisbleBy = function validateMultipleOfOrDivisbleBy (in
|
|||
result.addError({
|
||||
name: validationType,
|
||||
argument: validationArgument,
|
||||
message: errorMessage + JSON.stringify(validationArgument)
|
||||
message: errorMessage + JSON.stringify(validationArgument),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -458,7 +600,7 @@ var validateMultipleOfOrDivisbleBy = function validateMultipleOfOrDivisbleBy (in
|
|||
* @return {String|null}
|
||||
*/
|
||||
validators.multipleOf = function validateMultipleOf (instance, schema, options, ctx) {
|
||||
return validateMultipleOfOrDivisbleBy.call(this, instance, schema, options, ctx, "multipleOf", "is not a multiple of (divisible by) ");
|
||||
return validateMultipleOfOrDivisbleBy.call(this, instance, schema, options, ctx, "multipleOf", "is not a multiple of (divisible by) ");
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -480,14 +622,14 @@ validators.divisibleBy = function validateDivisibleBy (instance, schema, options
|
|||
validators.required = function validateRequired (instance, schema, options, ctx) {
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
if (instance === undefined && schema.required === true) {
|
||||
// A boolean form is implemented for reverse-compatability with schemas written against older drafts
|
||||
// A boolean form is implemented for reverse-compatibility with schemas written against older drafts
|
||||
result.addError({
|
||||
name: 'required',
|
||||
message: "is required"
|
||||
message: "is required",
|
||||
});
|
||||
} else if (this.types.object(instance) && Array.isArray(schema.required)) {
|
||||
schema.required.forEach(function(n){
|
||||
if(instance[n]===undefined){
|
||||
if(getEnumerableProperty(instance, n)===undefined){
|
||||
result.addError({
|
||||
name: 'required',
|
||||
argument: n,
|
||||
|
|
@ -508,7 +650,15 @@ validators.required = function validateRequired (instance, schema, options, ctx)
|
|||
validators.pattern = function validatePattern (instance, schema, options, ctx) {
|
||||
if (!this.types.string(instance)) return;
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
if (!instance.match(schema.pattern)) {
|
||||
var pattern = schema.pattern;
|
||||
try {
|
||||
var regexp = new RegExp(pattern, 'u');
|
||||
} catch(_e) {
|
||||
// In the event the stricter handling causes an error, fall back on the forgiving handling
|
||||
// DEPRECATED
|
||||
regexp = new RegExp(pattern);
|
||||
}
|
||||
if (!instance.match(regexp)) {
|
||||
result.addError({
|
||||
name: 'pattern',
|
||||
argument: schema.pattern,
|
||||
|
|
@ -633,32 +783,6 @@ validators.maxItems = function validateMaxItems (instance, schema, options, ctx)
|
|||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Validates that every item in an instance array is unique, when instance is an array
|
||||
* @param instance
|
||||
* @param schema
|
||||
* @param options
|
||||
* @param ctx
|
||||
* @return {String|null|ValidatorResult}
|
||||
*/
|
||||
validators.uniqueItems = function validateUniqueItems (instance, schema, options, ctx) {
|
||||
if (!this.types.array(instance)) return;
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
function testArrays (v, i, a) {
|
||||
for (var j = i + 1; j < a.length; j++) if (helpers.deepCompareStrict(v, a[j])) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!instance.every(testArrays)) {
|
||||
result.addError({
|
||||
name: 'uniqueItems',
|
||||
message: "contains duplicate item",
|
||||
});
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Deep compares arrays for duplicates
|
||||
* @param v
|
||||
|
|
@ -683,6 +807,7 @@ function testArrays (v, i, a) {
|
|||
* @return {String|null}
|
||||
*/
|
||||
validators.uniqueItems = function validateUniqueItems (instance, schema, options, ctx) {
|
||||
if (schema.uniqueItems!==true) return;
|
||||
if (!this.types.array(instance)) return;
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
if (!instance.every(testArrays)) {
|
||||
|
|
@ -806,7 +931,8 @@ validators.not = validators.disallow = function validateNot (instance, schema, o
|
|||
if(!Array.isArray(notTypes)) notTypes=[notTypes];
|
||||
notTypes.forEach(function (type) {
|
||||
if (self.testType(instance, schema, options, ctx, type)) {
|
||||
var schemaId = type && type.id && ('<' + type.id + '>') || type;
|
||||
var id = type && (type.$id || type.id);
|
||||
var schemaId = id || type;
|
||||
result.addError({
|
||||
name: 'not',
|
||||
argument: schemaId,
|
||||
|
|
|
|||
99
node_modules/jsonschema/lib/helpers.js
generated
vendored
99
node_modules/jsonschema/lib/helpers.js
generated
vendored
|
|
@ -2,21 +2,23 @@
|
|||
|
||||
var uri = require('url');
|
||||
|
||||
var ValidationError = exports.ValidationError = function ValidationError (message, instance, schema, propertyPath, name, argument) {
|
||||
if (propertyPath) {
|
||||
this.property = propertyPath;
|
||||
var ValidationError = exports.ValidationError = function ValidationError (message, instance, schema, path, name, argument) {
|
||||
if(Array.isArray(path)){
|
||||
this.path = path;
|
||||
this.property = path.reduce(function(sum, item){
|
||||
return sum + makeSuffix(item);
|
||||
}, 'instance');
|
||||
}else if(path !== undefined){
|
||||
this.property = path;
|
||||
}
|
||||
if (message) {
|
||||
this.message = message;
|
||||
}
|
||||
if (schema) {
|
||||
if (schema.id) {
|
||||
this.schema = schema.id;
|
||||
} else {
|
||||
this.schema = schema;
|
||||
}
|
||||
var id = schema.$id || schema.id;
|
||||
this.schema = id || schema;
|
||||
}
|
||||
if (instance) {
|
||||
if (instance !== undefined) {
|
||||
this.instance = instance;
|
||||
}
|
||||
this.name = name;
|
||||
|
|
@ -31,27 +33,33 @@ ValidationError.prototype.toString = function toString() {
|
|||
var ValidatorResult = exports.ValidatorResult = function ValidatorResult(instance, schema, options, ctx) {
|
||||
this.instance = instance;
|
||||
this.schema = schema;
|
||||
this.options = options;
|
||||
this.path = ctx.path;
|
||||
this.propertyPath = ctx.propertyPath;
|
||||
this.errors = [];
|
||||
this.throwError = options && options.throwError;
|
||||
this.throwFirst = options && options.throwFirst;
|
||||
this.throwAll = options && options.throwAll;
|
||||
this.disableFormat = options && options.disableFormat === true;
|
||||
};
|
||||
|
||||
ValidatorResult.prototype.addError = function addError(detail) {
|
||||
var err;
|
||||
if (typeof detail == 'string') {
|
||||
err = new ValidationError(detail, this.instance, this.schema, this.propertyPath);
|
||||
err = new ValidationError(detail, this.instance, this.schema, this.path);
|
||||
} else {
|
||||
if (!detail) throw new Error('Missing error detail');
|
||||
if (!detail.message) throw new Error('Missing error message');
|
||||
if (!detail.name) throw new Error('Missing validator type');
|
||||
err = new ValidationError(detail.message, this.instance, this.schema, this.propertyPath, detail.name, detail.argument);
|
||||
err = new ValidationError(detail.message, this.instance, this.schema, this.path, detail.name, detail.argument);
|
||||
}
|
||||
|
||||
if (this.throwError) {
|
||||
this.errors.push(err);
|
||||
if (this.throwFirst) {
|
||||
throw new ValidatorResultError(this);
|
||||
}else if(this.throwError){
|
||||
throw err;
|
||||
}
|
||||
this.errors.push(err);
|
||||
return err;
|
||||
};
|
||||
|
||||
|
|
@ -74,6 +82,20 @@ Object.defineProperty(ValidatorResult.prototype, "valid", { get: function() {
|
|||
return !this.errors.length;
|
||||
} });
|
||||
|
||||
module.exports.ValidatorResultError = ValidatorResultError;
|
||||
function ValidatorResultError(result) {
|
||||
if(Error.captureStackTrace){
|
||||
Error.captureStackTrace(this, ValidatorResultError);
|
||||
}
|
||||
this.instance = result.instance;
|
||||
this.schema = result.schema;
|
||||
this.options = result.options;
|
||||
this.errors = result.errors;
|
||||
}
|
||||
ValidatorResultError.prototype = new Error();
|
||||
ValidatorResultError.prototype.constructor = ValidatorResultError;
|
||||
ValidatorResultError.prototype.name = "Validation Error";
|
||||
|
||||
/**
|
||||
* Describes a problem with a Schema which prevents validation of an instance
|
||||
* @name SchemaError
|
||||
|
|
@ -86,14 +108,22 @@ var SchemaError = exports.SchemaError = function SchemaError (msg, schema) {
|
|||
Error.captureStackTrace(this, SchemaError);
|
||||
};
|
||||
SchemaError.prototype = Object.create(Error.prototype,
|
||||
{ constructor: {value: SchemaError, enumerable: false}
|
||||
, name: {value: 'SchemaError', enumerable: false}
|
||||
{
|
||||
constructor: {value: SchemaError, enumerable: false},
|
||||
name: {value: 'SchemaError', enumerable: false},
|
||||
});
|
||||
|
||||
var SchemaContext = exports.SchemaContext = function SchemaContext (schema, options, propertyPath, base, schemas) {
|
||||
var SchemaContext = exports.SchemaContext = function SchemaContext (schema, options, path, base, schemas) {
|
||||
this.schema = schema;
|
||||
this.options = options;
|
||||
this.propertyPath = propertyPath;
|
||||
if(Array.isArray(path)){
|
||||
this.path = path;
|
||||
this.propertyPath = path.reduce(function(sum, item){
|
||||
return sum + makeSuffix(item);
|
||||
}, 'instance');
|
||||
}else{
|
||||
this.propertyPath = path;
|
||||
}
|
||||
this.base = base;
|
||||
this.schemas = schemas;
|
||||
};
|
||||
|
|
@ -103,14 +133,15 @@ SchemaContext.prototype.resolve = function resolve (target) {
|
|||
};
|
||||
|
||||
SchemaContext.prototype.makeChild = function makeChild(schema, propertyName){
|
||||
var propertyPath = (propertyName===undefined) ? this.propertyPath : this.propertyPath+makeSuffix(propertyName);
|
||||
var base = uri.resolve(this.base, schema.id||'');
|
||||
var ctx = new SchemaContext(schema, this.options, propertyPath, base, Object.create(this.schemas));
|
||||
if(schema.id && !ctx.schemas[base]){
|
||||
var path = (propertyName===undefined) ? this.path : this.path.concat([propertyName]);
|
||||
var id = schema.$id || schema.id;
|
||||
var base = uri.resolve(this.base, id||'');
|
||||
var ctx = new SchemaContext(schema, this.options, path, base, Object.create(this.schemas));
|
||||
if(id && !ctx.schemas[base]){
|
||||
ctx.schemas[base] = schema;
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
};
|
||||
|
||||
var FORMAT_REGEXPS = exports.FORMAT_REGEXPS = {
|
||||
'date-time': /^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,
|
||||
|
|
@ -120,7 +151,11 @@ var FORMAT_REGEXPS = exports.FORMAT_REGEXPS = {
|
|||
'email': /^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,
|
||||
'ip-address': /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
|
||||
'ipv6': /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,
|
||||
|
||||
// TODO: A more accurate regular expression for "uri" goes:
|
||||
// [A-Za-z][+\-.0-9A-Za-z]*:((/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?)?#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])|/?%[0-9A-Fa-f]{2}|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*(#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?)?
|
||||
'uri': /^[a-zA-Z][a-zA-Z0-9+-.]*:[^\s]*$/,
|
||||
'uri-reference': /^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,
|
||||
|
||||
'color': /^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,
|
||||
|
||||
|
|
@ -143,7 +178,7 @@ var FORMAT_REGEXPS = exports.FORMAT_REGEXPS = {
|
|||
return result;
|
||||
},
|
||||
'style': /\s*(.+?):\s*([^;]+);?/,
|
||||
'phone': /^\+(?:[0-9] ?){6,14}[0-9]$/
|
||||
'phone': /^\+(?:[0-9] ?){6,14}[0-9]$/,
|
||||
};
|
||||
|
||||
FORMAT_REGEXPS.regexp = FORMAT_REGEXPS.regex;
|
||||
|
|
@ -212,10 +247,10 @@ exports.deepCompareStrict = function deepCompareStrict (a, b) {
|
|||
|
||||
function deepMerger (target, dst, e, i) {
|
||||
if (typeof e === 'object') {
|
||||
dst[i] = deepMerge(target[i], e)
|
||||
dst[i] = deepMerge(target[i], e);
|
||||
} else {
|
||||
if (target.indexOf(e) === -1) {
|
||||
dst.push(e)
|
||||
dst.push(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -232,7 +267,7 @@ function copyistWithDeepMerge (target, src, dst, key) {
|
|||
if (!target[key]) {
|
||||
dst[key] = src[key];
|
||||
} else {
|
||||
dst[key] = deepMerge(target[key], src[key])
|
||||
dst[key] = deepMerge(target[key], src[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -253,7 +288,7 @@ function deepMerge (target, src) {
|
|||
}
|
||||
|
||||
return dst;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.deepMerge = deepMerge;
|
||||
|
||||
|
|
@ -284,9 +319,9 @@ function pathEncoder (v) {
|
|||
* @return {String}
|
||||
*/
|
||||
exports.encodePath = function encodePointer(a){
|
||||
// ~ must be encoded explicitly because hacks
|
||||
// the slash is encoded by encodeURIComponent
|
||||
return a.map(pathEncoder).join('');
|
||||
// ~ must be encoded explicitly because hacks
|
||||
// the slash is encoded by encodeURIComponent
|
||||
return a.map(pathEncoder).join('');
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -323,3 +358,7 @@ exports.getDecimalPlaces = function getDecimalPlaces(number) {
|
|||
return decimalPlaces;
|
||||
};
|
||||
|
||||
exports.isSchema = function isSchema(val){
|
||||
return (typeof val === 'object' && val) || (typeof val === 'boolean');
|
||||
};
|
||||
|
||||
|
|
|
|||
19
node_modules/jsonschema/lib/index.d.ts
generated
vendored
19
node_modules/jsonschema/lib/index.d.ts
generated
vendored
|
|
@ -29,6 +29,7 @@ export declare class ValidatorResult {
|
|||
|
||||
export declare class ValidationError {
|
||||
constructor(message?: string, instance?: any, schema?: Schema, propertyPath?: any, name?: string, argument?: any);
|
||||
path: (string|number)[];
|
||||
property: string;
|
||||
message: string;
|
||||
schema: string|Schema;
|
||||
|
|
@ -48,6 +49,7 @@ export declare class SchemaError extends Error{
|
|||
export declare function validate(instance: any, schema: any, options?: Options): ValidatorResult
|
||||
|
||||
export interface Schema {
|
||||
$id?: string
|
||||
id?: string
|
||||
$schema?: string
|
||||
$ref?: string
|
||||
|
|
@ -55,9 +57,9 @@ export interface Schema {
|
|||
description?: string
|
||||
multipleOf?: number
|
||||
maximum?: number
|
||||
exclusiveMaximum?: boolean
|
||||
exclusiveMaximum?: number | boolean
|
||||
minimum?: number
|
||||
exclusiveMinimum?: boolean
|
||||
exclusiveMinimum?: number | boolean
|
||||
maxLength?: number
|
||||
minLength?: number
|
||||
pattern?: string | RegExp
|
||||
|
|
@ -82,6 +84,7 @@ export interface Schema {
|
|||
dependencies?: {
|
||||
[name: string]: Schema | string[]
|
||||
}
|
||||
const?: any
|
||||
'enum'?: any[]
|
||||
type?: string | string[]
|
||||
format?: string
|
||||
|
|
@ -89,21 +92,31 @@ export interface Schema {
|
|||
anyOf?: Schema[]
|
||||
oneOf?: Schema[]
|
||||
not?: Schema
|
||||
if?: Schema
|
||||
then?: Schema
|
||||
else?: Schema
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
skipAttributes?: string[];
|
||||
allowUnknownAttributes?: boolean;
|
||||
preValidateProperty?: PreValidatePropertyFunction;
|
||||
rewrite?: RewriteFunction;
|
||||
propertyName?: string;
|
||||
base?: string;
|
||||
throwError?: boolean;
|
||||
throwFirst?: boolean;
|
||||
throwAll?: boolean;
|
||||
nestedErrors?: boolean;
|
||||
}
|
||||
|
||||
export interface RewriteFunction {
|
||||
(instance: any, schema: Schema, options: Options, ctx: SchemaContext): any;
|
||||
}
|
||||
|
||||
export interface PreValidatePropertyFunction {
|
||||
(instance: any, key: string, schema: Schema, options: Options, ctx: SchemaContext): any;
|
||||
}
|
||||
|
||||
export interface SchemaContext {
|
||||
schema: Schema;
|
||||
options: Options;
|
||||
|
|
|
|||
1
node_modules/jsonschema/lib/index.js
generated
vendored
1
node_modules/jsonschema/lib/index.js
generated
vendored
|
|
@ -3,6 +3,7 @@
|
|||
var Validator = module.exports.Validator = require('./validator');
|
||||
|
||||
module.exports.ValidatorResult = require('./helpers').ValidatorResult;
|
||||
module.exports.ValidatorResultError = require('./helpers').ValidatorResultError;
|
||||
module.exports.ValidationError = require('./helpers').ValidationError;
|
||||
module.exports.SchemaError = require('./helpers').SchemaError;
|
||||
module.exports.SchemaScanResult = require('./scan').SchemaScanResult;
|
||||
|
|
|
|||
9
node_modules/jsonschema/lib/scan.js
generated
vendored
9
node_modules/jsonschema/lib/scan.js
generated
vendored
|
|
@ -1,3 +1,4 @@
|
|||
"use strict";
|
||||
|
||||
var urilib = require('url');
|
||||
var helpers = require('./helpers');
|
||||
|
|
@ -23,13 +24,14 @@ module.exports.scan = function scan(base, schema){
|
|||
ref[resolvedUri] = ref[resolvedUri] ? ref[resolvedUri]+1 : 0;
|
||||
return;
|
||||
}
|
||||
var ourBase = schema.id ? urilib.resolve(baseuri, schema.id) : baseuri;
|
||||
var id = schema.$id || schema.id;
|
||||
var ourBase = id ? urilib.resolve(baseuri, id) : baseuri;
|
||||
if (ourBase) {
|
||||
// If there's no fragment, append an empty one
|
||||
if(ourBase.indexOf('#')<0) ourBase += '#';
|
||||
if(found[ourBase]){
|
||||
if(!helpers.deepCompareStrict(found[ourBase], schema)){
|
||||
throw new Error('Schema <'+schema+'> already exists with different definition');
|
||||
throw new Error('Schema <'+ourBase+'> already exists with different definition');
|
||||
}
|
||||
return found[ourBase];
|
||||
}
|
||||
|
|
@ -68,7 +70,6 @@ module.exports.scan = function scan(base, schema){
|
|||
|
||||
var found = {};
|
||||
var ref = {};
|
||||
var schemaUri = base;
|
||||
scanSchema(base, schema);
|
||||
return new SchemaScanResult(found, ref);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
52
node_modules/jsonschema/lib/validator.js
generated
vendored
52
node_modules/jsonschema/lib/validator.js
generated
vendored
|
|
@ -6,6 +6,7 @@ var attribute = require('./attribute');
|
|||
var helpers = require('./helpers');
|
||||
var scanSchema = require('./scan').scan;
|
||||
var ValidatorResult = helpers.ValidatorResult;
|
||||
var ValidatorResultError = helpers.ValidatorResultError;
|
||||
var SchemaError = helpers.SchemaError;
|
||||
var SchemaContext = helpers.SchemaContext;
|
||||
//var anonymousBase = 'vnd.jsonschema:///';
|
||||
|
|
@ -49,13 +50,15 @@ Validator.prototype.addSchema = function addSchema (schema, base) {
|
|||
return null;
|
||||
}
|
||||
var scan = scanSchema(base||anonymousBase, schema);
|
||||
var ourUri = base || schema.id;
|
||||
var ourUri = base || schema.$id || schema.id;
|
||||
for(var uri in scan.id){
|
||||
this.schemas[uri] = scan.id[uri];
|
||||
}
|
||||
for(var uri in scan.ref){
|
||||
// If this schema is already defined, it will be filtered out by the next step
|
||||
this.unresolvedRefs.push(uri);
|
||||
}
|
||||
// Remove newly defined schemas from unresolvedRefs
|
||||
this.unresolvedRefs = this.unresolvedRefs.filter(function(uri){
|
||||
return typeof self.schemas[uri]==='undefined';
|
||||
});
|
||||
|
|
@ -103,14 +106,18 @@ Validator.prototype.getSchema = function getSchema (urn) {
|
|||
* @return {Array}
|
||||
*/
|
||||
Validator.prototype.validate = function validate (instance, schema, options, ctx) {
|
||||
if((typeof schema !== 'boolean' && typeof schema !== 'object') || schema === null){
|
||||
throw new SchemaError('Expected `schema` to be an object or boolean');
|
||||
}
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
var propertyName = options.propertyName || 'instance';
|
||||
// This section indexes subschemas in the provided schema, so they don't need to be added with Validator#addSchema
|
||||
// This will work so long as the function at uri.resolve() will resolve a relative URI to a relative URI
|
||||
var base = urilib.resolve(options.base||anonymousBase, schema.id||'');
|
||||
var id = schema.$id || schema.id;
|
||||
var base = urilib.resolve(options.base||anonymousBase, id||'');
|
||||
if(!ctx){
|
||||
ctx = new SchemaContext(schema, options, propertyName, base, Object.create(this.schemas));
|
||||
ctx = new SchemaContext(schema, options, [], base, Object.create(this.schemas));
|
||||
if (!ctx.schemas[base]) {
|
||||
ctx.schemas[base] = schema;
|
||||
}
|
||||
|
|
@ -120,14 +127,18 @@ Validator.prototype.validate = function validate (instance, schema, options, ctx
|
|||
ctx.schemas[n] = sch;
|
||||
}
|
||||
}
|
||||
if (schema) {
|
||||
var result = this.validateSchema(instance, schema, options, ctx);
|
||||
if (!result) {
|
||||
throw new Error('Result undefined');
|
||||
}
|
||||
if(options.required && instance===undefined){
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
result.addError('is required, but is undefined');
|
||||
return result;
|
||||
}
|
||||
throw new SchemaError('no schema specified', schema);
|
||||
var result = this.validateSchema(instance, schema, options, ctx);
|
||||
if (!result) {
|
||||
throw new Error('Result undefined');
|
||||
}else if(options.throwAll && result.errors.length){
|
||||
throw new ValidatorResultError(result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -152,7 +163,7 @@ function shouldResolve(schema) {
|
|||
Validator.prototype.validateSchema = function validateSchema (instance, schema, options, ctx) {
|
||||
var result = new ValidatorResult(instance, schema, options, ctx);
|
||||
|
||||
// Support for the true/false schemas
|
||||
// Support for the true/false schemas
|
||||
if(typeof schema==='boolean') {
|
||||
if(schema===true){
|
||||
// `true` is always valid
|
||||
|
|
@ -180,10 +191,10 @@ Validator.prototype.validateSchema = function validateSchema (instance, schema,
|
|||
}
|
||||
|
||||
// If passed a string argument, load that schema URI
|
||||
var switchSchema;
|
||||
if (switchSchema = shouldResolve(schema)) {
|
||||
var switchSchema = shouldResolve(schema);
|
||||
if (switchSchema) {
|
||||
var resolved = this.resolve(schema, switchSchema, ctx);
|
||||
var subctx = new SchemaContext(resolved.subschema, options, ctx.propertyPath, resolved.switchSchema, ctx.schemas);
|
||||
var subctx = new SchemaContext(resolved.subschema, options, ctx.path, resolved.switchSchema, ctx.schemas);
|
||||
return this.validateSchema(instance, resolved.subschema, options, subctx);
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +231,7 @@ Validator.prototype.validateSchema = function validateSchema (instance, schema,
|
|||
*/
|
||||
Validator.prototype.schemaTraverser = function schemaTraverser (schemaobj, s) {
|
||||
schemaobj.schema = helpers.deepMerge(schemaobj.schema, this.superResolve(s, schemaobj.ctx));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
|
@ -229,12 +240,12 @@ Validator.prototype.schemaTraverser = function schemaTraverser (schemaobj, s) {
|
|||
* @returns Object schema or resolved schema
|
||||
*/
|
||||
Validator.prototype.superResolve = function superResolve (schema, ctx) {
|
||||
var ref;
|
||||
if(ref = shouldResolve(schema)) {
|
||||
var ref = shouldResolve(schema);
|
||||
if(ref) {
|
||||
return this.resolve(schema, ref, ctx).subschema;
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
|
@ -275,6 +286,11 @@ Validator.prototype.resolve = function resolve (schema, switchSchema, ctx) {
|
|||
* @return {boolean}
|
||||
*/
|
||||
Validator.prototype.testType = function validateType (instance, schema, options, ctx, type) {
|
||||
if(type===undefined){
|
||||
return;
|
||||
}else if(type===null){
|
||||
throw new SchemaError('Unexpected null in "type" keyword');
|
||||
}
|
||||
if (typeof this.types[type] == 'function') {
|
||||
return this.types[type].call(this, instance);
|
||||
}
|
||||
|
|
|
|||
12
node_modules/jsonschema/package.json
generated
vendored
12
node_modules/jsonschema/package.json
generated
vendored
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"author": "Tom de Grunt <tom@degrunt.nl>",
|
||||
"name": "jsonschema",
|
||||
"version": "1.2.6",
|
||||
"version": "1.4.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {},
|
||||
"contributors": [
|
||||
|
|
@ -9,12 +9,15 @@
|
|||
"name": "Austin Wright"
|
||||
}
|
||||
],
|
||||
"main": "./lib",
|
||||
"main": "./lib/index.js",
|
||||
"typings": "./lib/index.d.ts",
|
||||
"devDependencies": {
|
||||
"@stryker-mutator/core": "^4.0.0",
|
||||
"@stryker-mutator/mocha-runner": "^4.0.0",
|
||||
"chai": "~4.2.0",
|
||||
"eslint": "^7.7.0",
|
||||
"json-metaschema": "^1.2.0",
|
||||
"mocha": "~3",
|
||||
"chai": "~1.5.0"
|
||||
"mocha": "~8.1.1"
|
||||
},
|
||||
"optionalDependencies": {},
|
||||
"engines": {
|
||||
|
|
@ -33,6 +36,7 @@
|
|||
},
|
||||
"description": "A fast and easy to use JSON Schema validator",
|
||||
"scripts": {
|
||||
"stryker": "stryker run",
|
||||
"test": "./node_modules/.bin/mocha -R spec"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue