mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
deps: upgrade npm to 7.0.8
PR-URL: https://github.com/nodejs/node/pull/35953 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
147 files changed
+5669
-7140
No files matched your search
Vendored
+3
@@ -727,3 +727,6 @@ Jake Champion <me@jakechampion.name>
|
||||
takenspc <taken.spc@gmail.com>
|
||||
iraj <irajtaghlidi@gmail.com>
|
||||
Michele Azzolari <michele@azzolari.it>
|
||||
foxxyz <foxxyz@gmail.com>
|
||||
Dr <dr@dr.run>
|
||||
Jan Tojnar <jtojnar@gmail.com>
|
||||
Vendored
+67
-11
@@ -1,3 +1,59 @@
|
||||
## 7.0.8 (2020-11-03)
|
||||
|
||||
### DOCUMENTATION
|
||||
|
||||
* [`052e977b9`](https://github.com/npm/cli/commit/052e977b9d071e1b3654976881d10cd3ddcba788)
|
||||
[#1822](https://github.com/npm/cli/issues/1822)
|
||||
[#1247](https://github.com/npm/cli/issues/1247)
|
||||
add section on peerDependenciesMeta field in package.json
|
||||
([@foxxyz](https://github.com/foxxyz))
|
||||
* [`52d32d175`](https://github.com/npm/cli/commit/52d32d1758c5ebc58944a1e8d98d57e30048e527)
|
||||
[#1970](https://github.com/npm/cli/issues/1970)
|
||||
match npm-exec.md -p usage with lib/exec.js
|
||||
([@dr-js](https://github.com/dr-js))
|
||||
* [`48ee8d01e`](https://github.com/npm/cli/commit/48ee8d01edd11ed6186c483e1169ff4d2070b963)
|
||||
[#2096](https://github.com/npm/cli/issues/2096)
|
||||
Fix RFC links in changelog
|
||||
([@jtojnar](https://github.com/jtojnar))
|
||||
|
||||
|
||||
### BUG FIXES
|
||||
|
||||
* [`6cd3cd08a`](https://github.com/npm/cli/commit/6cd3cd08af56445e13757cac3af87f3e7d54ed27)
|
||||
Support *all* conf keys in publishConfig
|
||||
* [`a1f9be8a7`](https://github.com/npm/cli/commit/a1f9be8a7f9b7a3a813fc3e5e705bc982470b0e2)
|
||||
[#2074](https://github.com/npm/cli/issues/2074)
|
||||
Support publishing any kind of spec, not just directories
|
||||
|
||||
### DEPENDENCIES
|
||||
|
||||
* [`545382df6`](https://github.com/npm/cli/commit/545382df62e3014f3e51d7034e52498fb2b01a37)
|
||||
`libnpmpublish@4.0.0`:
|
||||
* Support publishing things other than folders
|
||||
* [`7d88f1719`](https://github.com/npm/cli/commit/7d88f17197e3c8cca9b277378d6f9b054b1b7886)
|
||||
`npm-registry-fetch@9.0.0`
|
||||
* [`823b40a4e`](https://github.com/npm/cli/commit/823b40a4e9c6ef76388af6fe01a3624f6f7675be)
|
||||
`pacote@11.1.12`
|
||||
* [`90bf57826`](https://github.com/npm/cli/commit/90bf57826edf2f78ddf8deb0793115ead8a8b556)
|
||||
`npm-profile@5.0.2`
|
||||
* [`e5a413577`](https://github.com/npm/cli/commit/e5a4135770d13cf114fac439167637181f87d824)
|
||||
`libnpmteam@2.0.2`
|
||||
* [`fc5aa7b4a`](https://github.com/npm/cli/commit/fc5aa7b4ad45cb65893f734e1229a6720f7966e5)
|
||||
`libnpmsearch@3.0.1`
|
||||
* [`9fc1dee13`](https://github.com/npm/cli/commit/9fc1dee138ca33ecdbd57e63142b27c60cf88f9b)
|
||||
`libnpmorg@2.0.1`
|
||||
* [`0ea870ec5`](https://github.com/npm/cli/commit/0ea870ec5d2be1d44f050ad8bc24ed936cc45fde)
|
||||
`libnpmhook@6.0.1`
|
||||
* [`32fd744ea`](https://github.com/npm/cli/commit/32fd744ea745f297f0be79a80955f077a57c4ac7)
|
||||
`libnpmaccess@4.0.1`
|
||||
* [`fc76f3d9f`](https://github.com/npm/cli/commit/fc76f3d9fcf19e65a9373ab3d9068c4326d2f782)
|
||||
`@npmcli/arborist@1.0.8`
|
||||
* Fix `cannot read property 'description' of undefined` in `npm ls`
|
||||
when `package-lock.json` is corrupted
|
||||
* Do not allow peerDependencies to be nested under dependents in any
|
||||
circumstances
|
||||
* Always resolve peerDependencies in `--prefer-dedupe` mode
|
||||
|
||||
## 7.0.7 (2020-10-30)
|
||||
|
||||
### BUG FIXES
|
||||
@@ -602,7 +658,7 @@
|
||||
sources ([@ruyadorno](https://github.com/ruyadorno))
|
||||
* [`3a63ecb6f`](https://github.com/npm/cli/commit/3a63ecb6f6a0b235660f73a3ffa329b1f131b0c3)
|
||||
[#1718](https://github.com/npm/cli/pull/1718)
|
||||
[RFC-0029](https://github.com/npm/rfcs/blob/latest/accepted/0029-add-ability-to-skip-hooks.md)
|
||||
[RFC-0029](https://github.com/npm/rfcs/blob/latest/implemented/0029-add-ability-to-skip-hooks.md)
|
||||
add ability to skip pre/post hooks to `npm run-script` by using
|
||||
`--ignore-scripts` ([@ruyadorno](https://github.com/ruyadorno))
|
||||
|
||||
@@ -829,7 +885,7 @@ Now on to the list of **BREAKING CHANGES**!
|
||||
### Programmatic Usage
|
||||
|
||||
- [RFC
|
||||
20](https://github.com/npm/rfcs/blob/latest/accepted/0020-npm-option-handling.md)
|
||||
20](https://github.com/npm/rfcs/blob/latest/implemented/0020-npm-option-handling.md)
|
||||
The CLI and its dependencies no longer use the `figgy-pudding` library
|
||||
for configs. Configuration is done using a flat plain old JavaScript
|
||||
object.
|
||||
@@ -859,7 +915,7 @@ The environment for lifecycle scripts (eg, build scripts, `npm test`, etc.)
|
||||
has changed.
|
||||
|
||||
- [RFC
|
||||
21](https://github.com/npm/rfcs/blob/latest/accepted/0021-reduce-lifecycle-script-environment.md)
|
||||
21](https://github.com/npm/rfcs/blob/latest/implemented/0021-reduce-lifecycle-script-environment.md)
|
||||
Environment no longer includes `npm_package_*` fields, or `npm_config_*`
|
||||
fields for default configs. `npm_package_json`, `npm_package_integrity`,
|
||||
`npm_package_resolved`, and `npm_command` environment variables added.
|
||||
@@ -868,13 +924,13 @@ has changed.
|
||||
release](https://github.com/npm/rfcs/pull/183))
|
||||
|
||||
- [RFC
|
||||
22](https://github.com/npm/rfcs/blob/latest/accepted/0022-quieter-install-scripts.md)
|
||||
22](https://github.com/npm/rfcs/blob/latest/implemented/0022-quieter-install-scripts.md)
|
||||
Scripts run during the normal course of installation are silenced unless
|
||||
they exit in error (ie, with a signal or non-zero exit status code), and
|
||||
are for a non-optional dependency.
|
||||
|
||||
- [RFC
|
||||
24](https://github.com/npm/rfcs/blob/latest/accepted/0024-npm-run-traverse-directory-tree.md)
|
||||
24](https://github.com/npm/rfcs/blob/latest/implemented/0024-npm-run-traverse-directory-tree.md)
|
||||
`PATH` environment variable includes all `node_modules/.bin` folders,
|
||||
even if found outside of an existing `node_modules` folder hierarchy.
|
||||
|
||||
@@ -924,7 +980,7 @@ We do intend to continue supporting the `npx` that npm ships; just not the
|
||||
### Files On Disk
|
||||
|
||||
- [RFC
|
||||
13](https://github.com/npm/rfcs/blob/latest/accepted/0013-no-package-json-_fields.md)
|
||||
13](https://github.com/npm/rfcs/blob/latest/implemented/0013-no-package-json-_fields.md)
|
||||
Installed `package.json` files no longer are mutated to include extra
|
||||
metadata. (This extra metadata is stored in the lockfile.)
|
||||
- `package-lock.json` is updated to a newer format, using
|
||||
@@ -940,7 +996,7 @@ These changes affect `install`, `ci`, `install-test`, `install-ci-test`,
|
||||
`update`, `prune`, `dedupe`, `uninstall`, `link`, and `audit fix`.
|
||||
|
||||
- [RFC
|
||||
25](https://github.com/npm/rfcs/blob/latest/accepted/0025-install-peer-deps.md)
|
||||
25](https://github.com/npm/rfcs/blob/latest/implemented/0025-install-peer-deps.md)
|
||||
`peerDependencies` are installed by default. This behavior can be
|
||||
disabled by setting the `legacy-peer-deps` configuration flag.
|
||||
|
||||
@@ -951,7 +1007,7 @@ These changes affect `install`, `ci`, `install-test`, `install-ci-test`,
|
||||
of correctness. Use the `--legacy-peer-deps` config flag if impacted.
|
||||
|
||||
- [RFC
|
||||
23](https://github.com/npm/rfcs/blob/latest/accepted/0023-acceptDependencies.md)
|
||||
23](https://github.com/npm/rfcs/blob/latest/implemented/0023-acceptDependencies.md)
|
||||
Support for `acceptDependencies` is added. This can result in dependency
|
||||
resolutions that previous versions of npm will incorrectly flag as invalid.
|
||||
|
||||
@@ -973,7 +1029,7 @@ These changes affect `install`, `ci`, `install-test`, `install-ci-test`,
|
||||
### Workspaces
|
||||
|
||||
- [RFC
|
||||
26](https://github.com/npm/rfcs/blob/latest/accepted/0026-workspaces.md)
|
||||
26](https://github.com/npm/rfcs/blob/latest/implemented/0026-workspaces.md)
|
||||
First phase of `workspaces` support is added. This changes npm's
|
||||
behavior when a root project's `package.json` file contains a
|
||||
`workspaces` field.
|
||||
@@ -981,7 +1037,7 @@ These changes affect `install`, `ci`, `install-test`, `install-ci-test`,
|
||||
### `npm update`
|
||||
|
||||
- [RFC
|
||||
19](https://github.com/npm/rfcs/blob/latest/accepted/0019-remove-update-depth-option.md)
|
||||
19](https://github.com/npm/rfcs/blob/latest/implemented/0019-remove-update-depth-option.md)
|
||||
Update all dependencies when `npm update` is run without any arguments.
|
||||
As it is no longer relevant, `--depth` config flag removed from `npm
|
||||
update`.
|
||||
@@ -989,7 +1045,7 @@ These changes affect `install`, `ci`, `install-test`, `install-ci-test`,
|
||||
### `npm outdated`
|
||||
|
||||
- [RFC
|
||||
27](https://github.com/npm/rfcs/blob/latest/accepted/0027-remove-depth-outdated.md)
|
||||
27](https://github.com/npm/rfcs/blob/latest/implemented/0027-remove-depth-outdated.md)
|
||||
Remove `--depth` config from `npm outdated`. Only top-level dependencies
|
||||
are shown, unless `--all` config option is set.
|
||||
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
if not defined npm_config_node_gyp (
|
||||
node "%~dp0\..\..\node_modules\node-gyp\bin\node-gyp.js" %*
|
||||
) else (
|
||||
if not defined npm_config_node_gyp (
|
||||
node "%~dp0\..\..\node_modules\node-gyp\bin\node-gyp.js" %*
|
||||
) else (
|
||||
node "%npm_config_node_gyp%" %*
|
||||
)
|
||||
)
|
||||
Vendored
+19
-19
@@ -1,19 +1,19 @@
|
||||
:: Created by npm, please don't edit manually.
|
||||
@ECHO OFF
|
||||
|
||||
SETLOCAL
|
||||
|
||||
SET "NODE_EXE=%~dp0\node.exe"
|
||||
IF NOT EXIST "%NODE_EXE%" (
|
||||
SET "NODE_EXE=node"
|
||||
)
|
||||
|
||||
SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
|
||||
FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_CLI_JS%" prefix -g') DO (
|
||||
SET "NPM_PREFIX_NPM_CLI_JS=%%F\node_modules\npm\bin\npm-cli.js"
|
||||
)
|
||||
IF EXIST "%NPM_PREFIX_NPM_CLI_JS%" (
|
||||
SET "NPM_CLI_JS=%NPM_PREFIX_NPM_CLI_JS%"
|
||||
)
|
||||
|
||||
"%NODE_EXE%" "%NPM_CLI_JS%" %*
|
||||
:: Created by npm, please don't edit manually.
|
||||
@ECHO OFF
|
||||
|
||||
SETLOCAL
|
||||
|
||||
SET "NODE_EXE=%~dp0\node.exe"
|
||||
IF NOT EXIST "%NODE_EXE%" (
|
||||
SET "NODE_EXE=node"
|
||||
)
|
||||
|
||||
SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
|
||||
FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_CLI_JS%" prefix -g') DO (
|
||||
SET "NPM_PREFIX_NPM_CLI_JS=%%F\node_modules\npm\bin\npm-cli.js"
|
||||
)
|
||||
IF EXIST "%NPM_PREFIX_NPM_CLI_JS%" (
|
||||
SET "NPM_CLI_JS=%NPM_PREFIX_NPM_CLI_JS%"
|
||||
)
|
||||
|
||||
"%NODE_EXE%" "%NPM_CLI_JS%" %*
|
||||
Vendored
+20
-20
@@ -1,20 +1,20 @@
|
||||
:: Created by npm, please don't edit manually.
|
||||
@ECHO OFF
|
||||
|
||||
SETLOCAL
|
||||
|
||||
SET "NODE_EXE=%~dp0\node.exe"
|
||||
IF NOT EXIST "%NODE_EXE%" (
|
||||
SET "NODE_EXE=node"
|
||||
)
|
||||
|
||||
SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
|
||||
SET "NPX_CLI_JS=%~dp0\node_modules\npm\bin\npx-cli.js"
|
||||
FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_CLI_JS%" prefix -g') DO (
|
||||
SET "NPM_PREFIX_NPX_CLI_JS=%%F\node_modules\npm\bin\npx-cli.js"
|
||||
)
|
||||
IF EXIST "%NPM_PREFIX_NPX_CLI_JS%" (
|
||||
SET "NPX_CLI_JS=%NPM_PREFIX_NPX_CLI_JS%"
|
||||
)
|
||||
|
||||
"%NODE_EXE%" "%NPX_CLI_JS%" %*
|
||||
:: Created by npm, please don't edit manually.
|
||||
@ECHO OFF
|
||||
|
||||
SETLOCAL
|
||||
|
||||
SET "NODE_EXE=%~dp0\node.exe"
|
||||
IF NOT EXIST "%NODE_EXE%" (
|
||||
SET "NODE_EXE=node"
|
||||
)
|
||||
|
||||
SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
|
||||
SET "NPX_CLI_JS=%~dp0\node_modules\npm\bin\npx-cli.js"
|
||||
FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_CLI_JS%" prefix -g') DO (
|
||||
SET "NPM_PREFIX_NPX_CLI_JS=%%F\node_modules\npm\bin\npx-cli.js"
|
||||
)
|
||||
IF EXIST "%NPM_PREFIX_NPX_CLI_JS%" (
|
||||
SET "NPX_CLI_JS=%NPM_PREFIX_NPX_CLI_JS%"
|
||||
)
|
||||
|
||||
"%NODE_EXE%" "%NPX_CLI_JS%" %*
|
||||
Vendored
+1
-1
@@ -1935,7 +1935,7 @@ helpful when community members go over our code and help clean it up, too!
|
||||
* [`9e5b76140`](https://github.com/npm/npm/commit/9e5b76140ffdb7dcd12aa402793644213fb8c5d7)
|
||||
[#17411](https://github.com/npm/npm/pull/17411)
|
||||
Convert all callback-style `move` usage to use Promises.
|
||||
([@vramana](https://github.com/vramana))
|
||||
([@vramana](https://github.com/vramana))
|
||||
* [`0711c08f7`](https://github.com/npm/npm/commit/0711c08f779ac641ec42ecc96f604c8861008b28)
|
||||
[#17394](https://github.com/npm/npm/pull/17394)
|
||||
Remove unused argument in `deepSortObject`.
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@ npm completion >> ~/.zshrc
|
||||
```
|
||||
|
||||
You may of course also pipe the output of `npm completion` to a file
|
||||
such as `/usr/local/etc/bash_completion.d/npm` or
|
||||
`/etc/bash_completion.d/npm` if you have a system that will read
|
||||
such as `/usr/local/etc/bash_completion.d/npm` or
|
||||
`/etc/bash_completion.d/npm` if you have a system that will read
|
||||
that file for you.
|
||||
|
||||
When `COMP_CWORD`, `COMP_LINE`, and `COMP_POINT` are defined in the
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@ npm deprecate my-thing@"< 0.2.3" "critical bug fixed in v0.2.3"
|
||||
Note that you must be the package owner to deprecate something. See the
|
||||
`owner` and `adduser` help topics.
|
||||
|
||||
To un-deprecate a package, specify an empty string (`""`) for the `message`
|
||||
argument. Note that you must use double quotes with no space between them to
|
||||
To un-deprecate a package, specify an empty string (`""`) for the `message`
|
||||
argument. Note that you must use double quotes with no space between them to
|
||||
format an empty string.
|
||||
|
||||
### See Also
|
||||
|
||||
+3
-3
@@ -30,9 +30,9 @@ This command allows you to run an arbitrary command from an npm package
|
||||
(either one installed locally, or fetched remotely), in a similar context
|
||||
as running it via `npm run`.
|
||||
|
||||
Whatever packages are specified by the `--package` or `-p` option will be
|
||||
Whatever packages are specified by the `--package` option will be
|
||||
provided in the `PATH` of the executed command, along with any locally
|
||||
installed package executables. The `--package` or `-p` option may be
|
||||
installed package executables. The `--package` option may be
|
||||
specified multiple times, to execute the supplied command in an environment
|
||||
where all specified packages are available.
|
||||
|
||||
@@ -48,7 +48,7 @@ only be considered a match if they have the exact same name and version as
|
||||
the local dependency.
|
||||
|
||||
If no `-c` or `--call` option is provided, then the positional arguments
|
||||
are used to generate the command string. If no `-p` or `--package` options
|
||||
are used to generate the command string. If no `--package` options
|
||||
are provided, then npm will attempt to determine the executable name from
|
||||
the package specifier provided as the first positional argument according
|
||||
to the following heuristic:
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ you're using a non-npmjs registry.
|
||||
| updated | 2017-10-02T21:29:45.922Z |
|
||||
+-----------------+---------------------------+
|
||||
```
|
||||
|
||||
|
||||
* `npm profile set <property> <value>`:
|
||||
Set the value of a profile property. You can set the following properties this way:
|
||||
email, fullname, homepage, freenode, twitter, github
|
||||
|
||||
+1
-1
@@ -60,5 +60,5 @@ This lets you list, create and revoke authentication tokens.
|
||||
* `npm token revoke <token|id>`:
|
||||
This removes an authentication token, making it immediately unusable. This can accept
|
||||
both complete tokens (as you get back from `npm token create` and will
|
||||
find in your `.npmrc`) and ids as seen in the `npm token list` output.
|
||||
find in your `.npmrc`) and ids as seen in the `npm token list` output.
|
||||
This will NOT accept the truncated token found in `npm token list` output.
|
||||
+1
-1
@@ -34,7 +34,7 @@ Even if a package version is unpublished, that specific name and
|
||||
version combination can never be reused. In order to publish the
|
||||
package again, a new version number must be used. If you unpublish the entire package, you may not publish any new versions of that package until 24 hours have passed.
|
||||
|
||||
To learn more about how unpublish is treated on the npm registry, see our <a href="https://www.npmjs.com/policies/unpublish" target="_blank" rel="noopener noreferrer"> unpublish policies</a>.
|
||||
To learn more about how unpublish is treated on the npm registry, see our <a href="https://www.npmjs.com/policies/unpublish" target="_blank" rel="noopener noreferrer"> unpublish policies</a>.
|
||||
|
||||
|
||||
### See Also
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ As of `npm@2.6.1`, the `npm update` will only inspect top-level packages.
|
||||
Prior versions of `npm` would also recursively inspect all dependencies.
|
||||
To get the old behavior, use `npm --depth 9999 update`.
|
||||
|
||||
As of `npm@5.0.0`, the `npm update` will change `package.json` to save the
|
||||
new version as the minimum required dependency. To get the old behavior,
|
||||
As of `npm@5.0.0`, the `npm update` will change `package.json` to save the
|
||||
new version as the minimum required dependency. To get the old behavior,
|
||||
use `npm update --no-save`.
|
||||
|
||||
### Example
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ and tag up to the server, and deletes the `build/temp` directory.
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Prevents throwing an error when `npm version` is used to set the new version
|
||||
Prevents throwing an error when `npm version` is used to set the new version
|
||||
to the same value as the current version.
|
||||
|
||||
#### git-tag-version
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ was required by each matching version of yui3:
|
||||
|
||||
```bash
|
||||
npm view yui3@'>0.5.4' dependencies.jsdom
|
||||
```
|
||||
```
|
||||
|
||||
To show the `connect` package version history, you can do
|
||||
this:
|
||||
|
||||
@@ -716,6 +716,30 @@ the host package's major version will break your plugin. Thus, if you've worked
|
||||
with every 1.x version of the host package, use `"^1.0"` or `"1.x"` to express
|
||||
this. If you depend on features introduced in 1.5.2, use `">= 1.5.2 < 2"`.
|
||||
|
||||
### peerDependenciesMeta
|
||||
|
||||
When a user installs your package, npm will emit warnings if packages specified in `peerDependencies` are not already installed. The `peerDependenciesMeta` field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer dependencies to be marked as optional.
|
||||
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "tea-latte",
|
||||
"version": "1.3.5",
|
||||
"peerDependencies": {
|
||||
"tea": "2.x",
|
||||
"soy-milk": "1.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"soy-milk": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Marking a peer dependency as optional ensures npm will not emit a warning if the `soy-milk` package is not installed on the host. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed.
|
||||
|
||||
### bundledDependencies
|
||||
|
||||
This defines an array of package names that will be bundled when publishing
|
||||
|
||||
+24
-24
@@ -141,14 +141,14 @@ suites, then those executables will be added to the `PATH` for
|
||||
executing the scripts. So, if your package.json has this:
|
||||
|
||||
```json
|
||||
{
|
||||
"name" : "foo",
|
||||
"dependencies" : {
|
||||
"bar" : "0.1.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start" : "bar ./test"
|
||||
}
|
||||
{
|
||||
"name" : "foo",
|
||||
"dependencies" : {
|
||||
"bar" : "0.1.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start" : "bar ./test"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -178,14 +178,14 @@ there is a config param of `<name>[@<version>]:<key>`. For example,
|
||||
if the package.json has this:
|
||||
|
||||
```json
|
||||
{
|
||||
"name" : "foo",
|
||||
"config" : {
|
||||
"port" : "8080"
|
||||
},
|
||||
"scripts" : {
|
||||
"start" : "node server.js"
|
||||
}
|
||||
{
|
||||
"name" : "foo",
|
||||
"config" : {
|
||||
"port" : "8080"
|
||||
},
|
||||
"scripts" : {
|
||||
"start" : "node server.js"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -221,10 +221,10 @@ process.env.npm_package_scripts_install === "foo.js"
|
||||
For example, if your package.json contains this:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts" : {
|
||||
"install" : "scripts/install.js",
|
||||
"postinstall" : "scripts/postinstall.js",
|
||||
{
|
||||
"scripts" : {
|
||||
"install" : "scripts/install.js",
|
||||
"postinstall" : "scripts/postinstall.js",
|
||||
"uninstall" : "scripts/uninstall.js"
|
||||
}
|
||||
}
|
||||
@@ -241,10 +241,10 @@ If you want to run a make command, you can do so. This works just
|
||||
fine:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts" : {
|
||||
"preinstall" : "./configure",
|
||||
"install" : "make && make install",
|
||||
{
|
||||
"scripts" : {
|
||||
"preinstall" : "./configure",
|
||||
"install" : "make && make install",
|
||||
"test" : "make test"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,3 +92,4 @@ nested workspaces to be consumed elsewhere.
|
||||
|
||||
* [npm install](/commands/npm-install)
|
||||
* [npm publish](/commands/npm-publish)
|
||||
|
||||
+3
-3
@@ -165,9 +165,9 @@ alias: npm x, npx
|
||||
<p>This command allows you to run an arbitrary command from an npm package
|
||||
(either one installed locally, or fetched remotely), in a similar context
|
||||
as running it via <code>npm run</code>.</p>
|
||||
<p>Whatever packages are specified by the <code>--package</code> or <code>-p</code> option will be
|
||||
<p>Whatever packages are specified by the <code>--package</code> option will be
|
||||
provided in the <code>PATH</code> of the executed command, along with any locally
|
||||
installed package executables. The <code>--package</code> or <code>-p</code> option may be
|
||||
installed package executables. The <code>--package</code> option may be
|
||||
specified multiple times, to execute the supplied command in an environment
|
||||
where all specified packages are available.</p>
|
||||
<p>If any requested packages are not present in the local project
|
||||
@@ -180,7 +180,7 @@ version exists in the local project. Package names with a specifier will
|
||||
only be considered a match if they have the exact same name and version as
|
||||
the local dependency.</p>
|
||||
<p>If no <code>-c</code> or <code>--call</code> option is provided, then the positional arguments
|
||||
are used to generate the command string. If no <code>-p</code> or <code>--package</code> options
|
||||
are used to generate the command string. If no <code>--package</code> options
|
||||
are provided, then npm will attempt to determine the executable name from
|
||||
the package specifier provided as the first positional argument according
|
||||
to the following heuristic:</p>
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ installed, as well as their dependencies, in a tree-structure.</p>
|
||||
limit the results to only the paths to the packages named. Note that
|
||||
nested packages will <em>also</em> show the paths to the specified packages.
|
||||
For example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
|
||||
<pre lang="bash"><code> npm@7.0.7 /path/to/npm
|
||||
<pre lang="bash"><code> npm@7.0.8 /path/to/npm
|
||||
└─┬ init-package-json@0.0.4
|
||||
└── promzard@0.1.5
|
||||
</code></pre>
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ npm command-line interface
|
||||
<pre lang="bash"><code>npm <command> [args]
|
||||
</code></pre>
|
||||
<h3 id="version">Version</h3>
|
||||
<p>7.0.7</p>
|
||||
<p>7.0.8</p>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>npm is the package manager for the Node JavaScript platform. It puts
|
||||
modules in place so that node can find them, and manages dependency
|
||||
|
||||
+19
-1
@@ -141,7 +141,7 @@ npm command-line interface
|
||||
|
||||
<section id="table_of_contents">
|
||||
<h2 id="table-of-contents">Table of contents</h2>
|
||||
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#name">name</a></li><li><a href="#version">version</a></li><li><a href="#description2">description</a></li><li><a href="#keywords">keywords</a></li><li><a href="#homepage">homepage</a></li><li><a href="#bugs">bugs</a></li><li><a href="#license">license</a></li><li><a href="#people-fields-author-contributors">people fields: author, contributors</a></li><li><a href="#funding">funding</a></li><li><a href="#files">files</a></li><li><a href="#main">main</a></li><li><a href="#browser">browser</a></li><li><a href="#bin">bin</a></li><li><a href="#man">man</a></li><li><a href="#directories">directories</a></li><ul><li><a href="#directorieslib">directories.lib</a></li><li><a href="#directoriesbin">directories.bin</a></li><li><a href="#directoriesman">directories.man</a></li><li><a href="#directoriesdoc">directories.doc</a></li><li><a href="#directoriesexample">directories.example</a></li><li><a href="#directoriestest">directories.test</a></li></ul><li><a href="#repository">repository</a></li><li><a href="#scripts">scripts</a></li><li><a href="#config">config</a></li><li><a href="#dependencies">dependencies</a></li><ul><li><a href="#urls-as-dependencies">URLs as Dependencies</a></li><li><a href="#git-urls-as-dependencies">Git URLs as Dependencies</a></li><li><a href="#github-urls">GitHub URLs</a></li><li><a href="#local-paths">Local Paths</a></li></ul><li><a href="#devdependencies">devDependencies</a></li><li><a href="#peerdependencies">peerDependencies</a></li><li><a href="#bundleddependencies">bundledDependencies</a></li><li><a href="#optionaldependencies">optionalDependencies</a></li><li><a href="#engines">engines</a></li><li><a href="#enginestrict">engineStrict</a></li><li><a href="#os">os</a></li><li><a href="#cpu">cpu</a></li><li><a href="#preferglobal">preferGlobal</a></li><li><a href="#private">private</a></li><li><a href="#publishconfig">publishConfig</a></li><li><a href="#workspaces">workspaces</a></li><li><a href="#default-values">DEFAULT VALUES</a></li><li><a href="#see-also">SEE ALSO</a></li></ul></div>
|
||||
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#name">name</a></li><li><a href="#version">version</a></li><li><a href="#description2">description</a></li><li><a href="#keywords">keywords</a></li><li><a href="#homepage">homepage</a></li><li><a href="#bugs">bugs</a></li><li><a href="#license">license</a></li><li><a href="#people-fields-author-contributors">people fields: author, contributors</a></li><li><a href="#funding">funding</a></li><li><a href="#files">files</a></li><li><a href="#main">main</a></li><li><a href="#browser">browser</a></li><li><a href="#bin">bin</a></li><li><a href="#man">man</a></li><li><a href="#directories">directories</a></li><ul><li><a href="#directorieslib">directories.lib</a></li><li><a href="#directoriesbin">directories.bin</a></li><li><a href="#directoriesman">directories.man</a></li><li><a href="#directoriesdoc">directories.doc</a></li><li><a href="#directoriesexample">directories.example</a></li><li><a href="#directoriestest">directories.test</a></li></ul><li><a href="#repository">repository</a></li><li><a href="#scripts">scripts</a></li><li><a href="#config">config</a></li><li><a href="#dependencies">dependencies</a></li><ul><li><a href="#urls-as-dependencies">URLs as Dependencies</a></li><li><a href="#git-urls-as-dependencies">Git URLs as Dependencies</a></li><li><a href="#github-urls">GitHub URLs</a></li><li><a href="#local-paths">Local Paths</a></li></ul><li><a href="#devdependencies">devDependencies</a></li><li><a href="#peerdependencies">peerDependencies</a></li><li><a href="#peerdependenciesmeta">peerDependenciesMeta</a></li><li><a href="#bundleddependencies">bundledDependencies</a></li><li><a href="#optionaldependencies">optionalDependencies</a></li><li><a href="#engines">engines</a></li><li><a href="#enginestrict">engineStrict</a></li><li><a href="#os">os</a></li><li><a href="#cpu">cpu</a></li><li><a href="#preferglobal">preferGlobal</a></li><li><a href="#private">private</a></li><li><a href="#publishconfig">publishConfig</a></li><li><a href="#workspaces">workspaces</a></li><li><a href="#default-values">DEFAULT VALUES</a></li><li><a href="#see-also">SEE ALSO</a></li></ul></div>
|
||||
</section>
|
||||
|
||||
<div id="_content"><h3 id="description">Description</h3>
|
||||
@@ -669,6 +669,24 @@ possible, and not to lock it down to specific patch versions.</p>
|
||||
the host package’s major version will break your plugin. Thus, if you’ve worked
|
||||
with every 1.x version of the host package, use <code>"^1.0"</code> or <code>"1.x"</code> to express
|
||||
this. If you depend on features introduced in 1.5.2, use <code>">= 1.5.2 < 2"</code>.</p>
|
||||
<h3 id="peerdependenciesmeta">peerDependenciesMeta</h3>
|
||||
<p>When a user installs your package, npm will emit warnings if packages specified in <code>peerDependencies</code> are not already installed. The <code>peerDependenciesMeta</code> field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer dependencies to be marked as optional.</p>
|
||||
<p>For example:</p>
|
||||
<pre lang="json"><code>{
|
||||
"name": "tea-latte",
|
||||
"version": "1.3.5",
|
||||
"peerDependencies": {
|
||||
"tea": "2.x",
|
||||
"soy-milk": "1.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"soy-milk": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<p>Marking a peer dependency as optional ensures npm will not emit a warning if the <code>soy-milk</code> package is not installed on the host. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed.</p>
|
||||
<h3 id="bundleddependencies">bundledDependencies</h3>
|
||||
<p>This defines an array of package names that will be bundled when publishing
|
||||
the package.</p>
|
||||
|
||||
+24
-24
@@ -266,14 +266,14 @@ the process.</p>
|
||||
<p>If you depend on modules that define executable scripts, like test
|
||||
suites, then those executables will be added to the <code>PATH</code> for
|
||||
executing the scripts. So, if your package.json has this:</p>
|
||||
<pre lang="json"><code>{
|
||||
"name" : "foo",
|
||||
"dependencies" : {
|
||||
"bar" : "0.1.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start" : "bar ./test"
|
||||
}
|
||||
<pre lang="json"><code>{
|
||||
"name" : "foo",
|
||||
"dependencies" : {
|
||||
"bar" : "0.1.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start" : "bar ./test"
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<p>then you could run <code>npm start</code> to execute the <code>bar</code> script, which is
|
||||
@@ -294,14 +294,14 @@ config by checking the <code>npm_config_root</code> environment variable.</p>
|
||||
<p>The package.json “config” keys are overwritten in the environment if
|
||||
there is a config param of <code><name>[@<version>]:<key></code>. For example,
|
||||
if the package.json has this:</p>
|
||||
<pre lang="json"><code>{
|
||||
"name" : "foo",
|
||||
"config" : {
|
||||
"port" : "8080"
|
||||
},
|
||||
"scripts" : {
|
||||
"start" : "node server.js"
|
||||
}
|
||||
<pre lang="json"><code>{
|
||||
"name" : "foo",
|
||||
"config" : {
|
||||
"port" : "8080"
|
||||
},
|
||||
"scripts" : {
|
||||
"start" : "node server.js"
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<p>and the server.js is this:</p>
|
||||
@@ -322,10 +322,10 @@ see this in the script:</p>
|
||||
</code></pre>
|
||||
<h3 id="examples">Examples</h3>
|
||||
<p>For example, if your package.json contains this:</p>
|
||||
<pre lang="json"><code>{
|
||||
"scripts" : {
|
||||
"install" : "scripts/install.js",
|
||||
"postinstall" : "scripts/postinstall.js",
|
||||
<pre lang="json"><code>{
|
||||
"scripts" : {
|
||||
"install" : "scripts/install.js",
|
||||
"postinstall" : "scripts/postinstall.js",
|
||||
"uninstall" : "scripts/uninstall.js"
|
||||
}
|
||||
}
|
||||
@@ -338,10 +338,10 @@ be wise in this case to look at the <code>npm_lifecycle_event</code> environment
|
||||
variable.</p>
|
||||
<p>If you want to run a make command, you can do so. This works just
|
||||
fine:</p>
|
||||
<pre lang="json"><code>{
|
||||
"scripts" : {
|
||||
"preinstall" : "./configure",
|
||||
"install" : "make && make install",
|
||||
<pre lang="json"><code>{
|
||||
"scripts" : {
|
||||
"preinstall" : "./configure",
|
||||
"install" : "make && make install",
|
||||
"test" : "make test"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+59
-26
@@ -6,12 +6,17 @@ const semver = require('semver')
|
||||
const pack = require('libnpmpack')
|
||||
const libpub = require('libnpmpublish').publish
|
||||
const runScript = require('@npmcli/run-script')
|
||||
const pacote = require('pacote')
|
||||
const npa = require('npm-package-arg')
|
||||
|
||||
const npm = require('./npm.js')
|
||||
const output = require('./utils/output.js')
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const { getContents, logTar } = require('./utils/tar.js')
|
||||
|
||||
// this is the only case in the CLI where we use the old full slow
|
||||
// 'read-package-json' module, because we want to pull in all the
|
||||
// defaults and metadata, like git sha's and default scripts and all that.
|
||||
const readJson = util.promisify(require('read-package-json'))
|
||||
|
||||
const completion = require('./utils/completion/none.js')
|
||||
@@ -46,47 +51,75 @@ const publish = async args => {
|
||||
return tarball
|
||||
}
|
||||
|
||||
// if it's a directory, read it from the file system
|
||||
// otherwise, get the full metadata from whatever it is
|
||||
const getManifest = (spec, opts) =>
|
||||
spec.type === 'directory' ? readJson(`${spec.fetchSpec}/package.json`)
|
||||
: pacote.manifest(spec, { ...opts, fullMetadata: true })
|
||||
|
||||
// for historical reasons, publishConfig in package.json can contain
|
||||
// ANY config keys that npm supports in .npmrc files and elsewhere.
|
||||
// We *may* want to revisit this at some point, and have a minimal set
|
||||
// that's a SemVer-major change that ought to get a RFC written on it.
|
||||
const { flatten } = require('./utils/flat-options.js')
|
||||
const publishConfigToOpts = publishConfig =>
|
||||
// create a new object that inherits from the config stack
|
||||
// then squash the css-case into camelCase opts, like we do
|
||||
flatten(Object.assign(Object.create(npm.config.list[0]), publishConfig))
|
||||
|
||||
const publish_ = async (arg, opts) => {
|
||||
const { unicode, dryRun, json } = opts
|
||||
let manifest = await readJson(`${arg}/package.json`)
|
||||
// you can publish name@version, ./foo.tgz, etc.
|
||||
// even though the default is the 'file:.' cwd.
|
||||
const spec = npa(arg)
|
||||
const manifest = await getManifest(spec, opts)
|
||||
|
||||
// prepublishOnly
|
||||
await runScript({
|
||||
event: 'prepublishOnly',
|
||||
path: arg,
|
||||
stdio: 'inherit',
|
||||
pkg: manifest,
|
||||
})
|
||||
if (manifest.publishConfig)
|
||||
Object.assign(opts, publishConfigToOpts(manifest.publishConfig))
|
||||
|
||||
const tarballData = await pack(arg)
|
||||
// only run scripts for directory type publishes
|
||||
if (spec.type === 'directory') {
|
||||
await runScript({
|
||||
event: 'prepublishOnly',
|
||||
path: spec.fetchSpec,
|
||||
stdio: 'inherit',
|
||||
pkg: manifest,
|
||||
})
|
||||
}
|
||||
|
||||
const tarballData = await pack(spec, opts)
|
||||
const pkgContents = await getContents(manifest, tarballData)
|
||||
|
||||
// note that logTar calls npmlog.notice(), so if we ARE in silent mode,
|
||||
// this will do nothing, but we still want it in the debuglog if it fails.
|
||||
if (!json)
|
||||
logTar(pkgContents, { log, unicode })
|
||||
|
||||
if (!dryRun) {
|
||||
// The purpose of re-reading the manifest is in case it changed,
|
||||
// so that we send the latest and greatest thing to the registry
|
||||
manifest = await readJson(`${arg}/package.json`)
|
||||
const { publishConfig } = manifest
|
||||
await otplease(opts, opts => libpub(arg, manifest, { ...opts, publishConfig }))
|
||||
// note that publishConfig might have changed as well!
|
||||
const manifest = await getManifest(spec, opts)
|
||||
if (manifest.publishConfig)
|
||||
Object.assign(opts, publishConfigToOpts(manifest.publishConfig))
|
||||
await otplease(opts, opts => libpub(manifest, tarballData, opts))
|
||||
}
|
||||
|
||||
// publish
|
||||
await runScript({
|
||||
event: 'publish',
|
||||
path: arg,
|
||||
stdio: 'inherit',
|
||||
pkg: manifest,
|
||||
})
|
||||
if (spec.type === 'directory') {
|
||||
await runScript({
|
||||
event: 'publish',
|
||||
path: spec.fetchSpec,
|
||||
stdio: 'inherit',
|
||||
pkg: manifest,
|
||||
})
|
||||
|
||||
// postpublish
|
||||
await runScript({
|
||||
event: 'postpublish',
|
||||
path: arg,
|
||||
stdio: 'inherit',
|
||||
pkg: manifest,
|
||||
})
|
||||
await runScript({
|
||||
event: 'postpublish',
|
||||
path: spec.fetchSpec,
|
||||
stdio: 'inherit',
|
||||
pkg: manifest,
|
||||
})
|
||||
}
|
||||
|
||||
return pkgContents
|
||||
}
|
||||
|
||||
Vendored
+168
-178
@@ -7,29 +7,176 @@ const npmSession = crypto.randomBytes(8).toString('hex')
|
||||
log.verbose('npm-session', npmSession)
|
||||
const { join } = require('path')
|
||||
|
||||
const buildOmitList = npm => {
|
||||
const include = npm.config.get('include') || []
|
||||
const omit = new Set((npm.config.get('omit') || [])
|
||||
const buildOmitList = obj => {
|
||||
const include = obj.include || []
|
||||
const omit = new Set((obj.omit || [])
|
||||
.filter(type => !include.includes(type)))
|
||||
const only = npm.config.get('only')
|
||||
const only = obj.only
|
||||
|
||||
if (/^prod(uction)?$/.test(only) || npm.config.get('production'))
|
||||
if (/^prod(uction)?$/.test(only) || obj.production)
|
||||
omit.add('dev')
|
||||
|
||||
if (/dev/.test(npm.config.get('also')))
|
||||
if (/dev/.test(obj.also))
|
||||
omit.delete('dev')
|
||||
|
||||
if (npm.config.get('dev'))
|
||||
if (obj.dev)
|
||||
omit.delete('dev')
|
||||
|
||||
if (npm.config.get('optional') === false)
|
||||
if (obj.optional === false)
|
||||
omit.add('optional')
|
||||
|
||||
npm.config.set('omit', [...omit])
|
||||
obj.omit = [...omit]
|
||||
return [...omit]
|
||||
}
|
||||
|
||||
// turn an object with npm-config style keys into an options object
|
||||
// with camelCase values. This doesn't account for the stuff that is
|
||||
// not pulled from the config keys, that's all handled only for the
|
||||
// main function which acts on the npm object itself. Used by the
|
||||
// flatOptions generator, and by the publishConfig handling logic.
|
||||
const flatten = obj => ({
|
||||
includeStaged: obj['include-staged'],
|
||||
preferDedupe: obj['prefer-dedupe'],
|
||||
ignoreScripts: obj['ignore-scripts'],
|
||||
nodeVersion: obj['node-version'],
|
||||
cache: join(obj.cache, '_cacache'),
|
||||
global: obj.global,
|
||||
|
||||
metricsRegistry: obj['metrics-registry'] || obj.registry,
|
||||
sendMetrics: obj['send-metrics'],
|
||||
registry: obj.registry,
|
||||
scope: obj.scope,
|
||||
access: obj.access,
|
||||
alwaysAuth: obj['always-auth'],
|
||||
audit: obj.audit,
|
||||
auditLevel: obj['audit-level'],
|
||||
authType: obj['auth-type'],
|
||||
ssoType: obj['sso-type'],
|
||||
ssoPollFrequency: obj['sso-poll-frequency'],
|
||||
before: obj.before,
|
||||
browser: obj.browser,
|
||||
ca: obj.ca,
|
||||
cafile: obj.cafile,
|
||||
cert: obj.cert,
|
||||
key: obj.key,
|
||||
|
||||
// token creation options
|
||||
cidr: obj.cidr,
|
||||
readOnly: obj['read-only'],
|
||||
|
||||
// npm version options
|
||||
preid: obj.preid,
|
||||
tagVersionPrefix: obj['tag-version-prefix'],
|
||||
allowSameVersion: obj['allow-same-version'],
|
||||
|
||||
// npm version git options
|
||||
message: obj.message,
|
||||
commitHooks: obj['commit-hooks'],
|
||||
gitTagVersion: obj['git-tag-version'],
|
||||
signGitCommit: obj['sign-git-commit'],
|
||||
signGitTag: obj['sign-git-tag'],
|
||||
|
||||
// only used for npm ls in v7, not update
|
||||
depth: obj.depth,
|
||||
all: obj.all,
|
||||
|
||||
// Output configs
|
||||
unicode: obj.unicode,
|
||||
json: obj.json,
|
||||
long: obj.long,
|
||||
parseable: obj.parseable,
|
||||
|
||||
// options for npm search
|
||||
search: {
|
||||
description: obj.description,
|
||||
exclude: obj.searchexclude,
|
||||
limit: obj.searchlimit || 20,
|
||||
opts: obj.searchopts,
|
||||
staleness: obj.searchstaleness,
|
||||
},
|
||||
|
||||
dryRun: obj['dry-run'],
|
||||
engineStrict: obj['engine-strict'],
|
||||
|
||||
retry: {
|
||||
retries: obj['fetch-retries'],
|
||||
factor: obj['fetch-retry-factor'],
|
||||
maxTimeout: obj['fetch-retry-maxtimeout'],
|
||||
minTimeout: obj['fetch-retry-mintimeout'],
|
||||
},
|
||||
|
||||
timeout: obj['fetch-timeout'],
|
||||
|
||||
force: obj.force,
|
||||
|
||||
formatPackageLock: obj['format-package-lock'],
|
||||
fund: obj.fund,
|
||||
|
||||
// binary locators
|
||||
git: obj.git,
|
||||
viewer: obj.viewer,
|
||||
editor: obj.editor,
|
||||
|
||||
// configs that affect how we build trees
|
||||
binLinks: obj['bin-links'],
|
||||
rebuildBundle: obj['rebuild-bundle'],
|
||||
// --no-shrinkwrap is the same as --no-package-lock
|
||||
packageLock: !(obj['package-lock'] === false ||
|
||||
obj.shrinkwrap === false),
|
||||
packageLockOnly: obj['package-lock-only'],
|
||||
globalStyle: obj['global-style'],
|
||||
legacyBundling: obj['legacy-bundling'],
|
||||
scriptShell: obj['script-shell'] || undefined,
|
||||
shell: obj.shell,
|
||||
omit: buildOmitList(obj),
|
||||
legacyPeerDeps: obj['legacy-peer-deps'],
|
||||
strictPeerDeps: obj['strict-peer-deps'],
|
||||
|
||||
// npx stuff
|
||||
call: obj.call,
|
||||
package: obj.package,
|
||||
|
||||
// used to build up the appropriate {add:{...}} options to Arborist.reify
|
||||
save: obj.save,
|
||||
saveBundle: obj['save-bundle'] && !obj['save-peer'],
|
||||
saveType: obj['save-optional'] && obj['save-peer']
|
||||
? 'peerOptional'
|
||||
: obj['save-optional'] ? 'optional'
|
||||
: obj['save-dev'] ? 'dev'
|
||||
: obj['save-peer'] ? 'peer'
|
||||
: obj['save-prod'] ? 'prod'
|
||||
: null,
|
||||
savePrefix: obj['save-exact'] ? ''
|
||||
: obj['save-prefix'],
|
||||
|
||||
// configs for npm-registry-fetch
|
||||
otp: obj.otp,
|
||||
offline: obj.offline,
|
||||
preferOffline: getPreferOffline(obj),
|
||||
preferOnline: getPreferOnline(obj),
|
||||
strictSSL: obj['strict-ssl'],
|
||||
defaultTag: obj.tag,
|
||||
userAgent: obj['user-agent'],
|
||||
|
||||
// yes, it's fine, just do it, jeez, stop asking
|
||||
yes: obj.yes,
|
||||
|
||||
...getScopesAndAuths(obj),
|
||||
|
||||
// npm fund exclusive option to select an item from a funding list
|
||||
which: obj.which,
|
||||
|
||||
// socks proxy can be configured in https-proxy or proxy field
|
||||
// note that the various (HTTPS_|HTTP_|]PROXY environs will be
|
||||
// respected if this is not set.
|
||||
proxy: obj['https-proxy'] || obj.proxy,
|
||||
noProxy: obj.noproxy,
|
||||
})
|
||||
|
||||
const flatOptions = npm => npm.flatOptions || Object.freeze({
|
||||
// flatten the config object
|
||||
...flatten(npm.config.list[0]),
|
||||
|
||||
// Note that many of these do not come from configs or cli flags
|
||||
// per se, though they may be implied or defined by them.
|
||||
log,
|
||||
@@ -39,14 +186,9 @@ const flatOptions = npm => npm.flatOptions || Object.freeze({
|
||||
umask: npm.modes.umask,
|
||||
hashAlgorithm: 'sha1', // XXX should this be sha512?
|
||||
color: !!npm.color,
|
||||
includeStaged: npm.config.get('include-staged'),
|
||||
|
||||
preferDedupe: npm.config.get('prefer-dedupe'),
|
||||
ignoreScripts: npm.config.get('ignore-scripts'),
|
||||
|
||||
projectScope: npm.projectScope,
|
||||
npmVersion: npm.version,
|
||||
nodeVersion: npm.config.get('node-version'),
|
||||
|
||||
// npm.command is not set until AFTER flatOptions are defined
|
||||
// so we need to make this a getter.
|
||||
get npmCommand () {
|
||||
@@ -54,194 +196,42 @@ const flatOptions = npm => npm.flatOptions || Object.freeze({
|
||||
},
|
||||
|
||||
tmp: npm.tmp,
|
||||
cache: join(npm.config.get('cache'), '_cacache'),
|
||||
prefix: npm.prefix,
|
||||
globalPrefix: npm.globalPrefix,
|
||||
localPrefix: npm.localPrefix,
|
||||
global: npm.config.get('global'),
|
||||
|
||||
metricsRegistry: npm.config.get('metrics-registry') ||
|
||||
npm.config.get('registry'),
|
||||
sendMetrics: npm.config.get('send-metrics'),
|
||||
registry: npm.config.get('registry'),
|
||||
scope: npm.config.get('scope'),
|
||||
access: npm.config.get('access'),
|
||||
alwaysAuth: npm.config.get('always-auth'),
|
||||
audit: npm.config.get('audit'),
|
||||
auditLevel: npm.config.get('audit-level'),
|
||||
authType: npm.config.get('auth-type'),
|
||||
ssoType: npm.config.get('sso-type'),
|
||||
ssoPollFrequency: npm.config.get('sso-poll-frequency'),
|
||||
before: npm.config.get('before'),
|
||||
browser: npm.config.get('browser'),
|
||||
ca: npm.config.get('ca'),
|
||||
cafile: npm.config.get('cafile'),
|
||||
cert: npm.config.get('cert'),
|
||||
key: npm.config.get('key'),
|
||||
|
||||
// XXX remove these when we don't use lockfile any more, once
|
||||
// arborist is handling the installation process
|
||||
cacheLockRetries: npm.config.get('cache-lock-retries'),
|
||||
cacheLockStale: npm.config.get('cache-lock-stale'),
|
||||
cacheLockWait: npm.config.get('cache-lock-wait'),
|
||||
lockFile: {
|
||||
retries: npm.config.get('cache-lock-retries'),
|
||||
stale: npm.config.get('cache-lock-stale'),
|
||||
wait: npm.config.get('cache-lock-wait'),
|
||||
},
|
||||
|
||||
// XXX remove these once no longer used
|
||||
get cacheMax () {
|
||||
return npm.config.get('cache-max')
|
||||
},
|
||||
get cacheMin () {
|
||||
return npm.config.get('cache-min')
|
||||
},
|
||||
|
||||
// token creation options
|
||||
cidr: npm.config.get('cidr'),
|
||||
readOnly: npm.config.get('read-only'),
|
||||
|
||||
// npm version options
|
||||
preid: npm.config.get('preid'),
|
||||
tagVersionPrefix: npm.config.get('tag-version-prefix'),
|
||||
allowSameVersion: npm.config.get('allow-same-version'),
|
||||
|
||||
// npm version git options
|
||||
message: npm.config.get('message'),
|
||||
commitHooks: npm.config.get('commit-hooks'),
|
||||
gitTagVersion: npm.config.get('git-tag-version'),
|
||||
signGitCommit: npm.config.get('sign-git-commit'),
|
||||
signGitTag: npm.config.get('sign-git-tag'),
|
||||
|
||||
// only used for npm ls in v7, not update
|
||||
depth: npm.config.get('depth'),
|
||||
all: npm.config.get('all'),
|
||||
|
||||
// Output configs
|
||||
unicode: npm.config.get('unicode'),
|
||||
json: npm.config.get('json'),
|
||||
long: npm.config.get('long'),
|
||||
parseable: npm.config.get('parseable'),
|
||||
|
||||
// options for npm search
|
||||
search: {
|
||||
description: npm.config.get('description'),
|
||||
exclude: npm.config.get('searchexclude'),
|
||||
limit: npm.config.get('searchlimit') || 20,
|
||||
opts: npm.config.get('searchopts'),
|
||||
staleness: npm.config.get('searchstaleness'),
|
||||
},
|
||||
|
||||
dryRun: npm.config.get('dry-run'),
|
||||
engineStrict: npm.config.get('engine-strict'),
|
||||
|
||||
retry: {
|
||||
retries: npm.config.get('fetch-retries'),
|
||||
factor: npm.config.get('fetch-retry-factor'),
|
||||
maxTimeout: npm.config.get('fetch-retry-maxtimeout'),
|
||||
minTimeout: npm.config.get('fetch-retry-mintimeout'),
|
||||
},
|
||||
|
||||
timeout: npm.config.get('fetch-timeout'),
|
||||
|
||||
force: npm.config.get('force'),
|
||||
|
||||
formatPackageLock: npm.config.get('format-package-lock'),
|
||||
fund: npm.config.get('fund'),
|
||||
|
||||
// binary locators
|
||||
git: npm.config.get('git'),
|
||||
npmBin: require.main.filename,
|
||||
npmBin: require.main && require.main.filename,
|
||||
nodeBin: process.env.NODE || process.execPath,
|
||||
viewer: npm.config.get('viewer'),
|
||||
editor: npm.config.get('editor'),
|
||||
|
||||
// configs that affect how we build trees
|
||||
binLinks: npm.config.get('bin-links'),
|
||||
rebuildBundle: npm.config.get('rebuild-bundle'),
|
||||
// --no-shrinkwrap is the same as --no-package-lock
|
||||
packageLock: !(npm.config.get('package-lock') === false ||
|
||||
npm.config.get('shrinkwrap') === false),
|
||||
packageLockOnly: npm.config.get('package-lock-only'),
|
||||
globalStyle: npm.config.get('global-style'),
|
||||
legacyBundling: npm.config.get('legacy-bundling'),
|
||||
scriptShell: npm.config.get('script-shell') || undefined,
|
||||
shell: npm.config.get('shell'),
|
||||
omit: buildOmitList(npm),
|
||||
legacyPeerDeps: npm.config.get('legacy-peer-deps'),
|
||||
strictPeerDeps: npm.config.get('strict-peer-deps'),
|
||||
|
||||
// npx stuff
|
||||
call: npm.config.get('call'),
|
||||
package: npm.config.get('package'),
|
||||
|
||||
// used to build up the appropriate {add:{...}} options to Arborist.reify
|
||||
save: npm.config.get('save'),
|
||||
saveBundle: npm.config.get('save-bundle') && !npm.config.get('save-peer'),
|
||||
saveType: npm.config.get('save-optional') && npm.config.get('save-peer')
|
||||
? 'peerOptional'
|
||||
: npm.config.get('save-optional') ? 'optional'
|
||||
: npm.config.get('save-dev') ? 'dev'
|
||||
: npm.config.get('save-peer') ? 'peer'
|
||||
: npm.config.get('save-prod') ? 'prod'
|
||||
: null,
|
||||
savePrefix: npm.config.get('save-exact') ? ''
|
||||
: npm.config.get('save-prefix'),
|
||||
|
||||
// configs for npm-registry-fetch
|
||||
otp: npm.config.get('otp'),
|
||||
offline: npm.config.get('offline'),
|
||||
preferOffline: getPreferOffline(npm),
|
||||
preferOnline: getPreferOnline(npm),
|
||||
strictSSL: npm.config.get('strict-ssl'),
|
||||
defaultTag: npm.config.get('tag'),
|
||||
get tag () {
|
||||
return npm.config.get('tag')
|
||||
},
|
||||
userAgent: npm.config.get('user-agent'),
|
||||
|
||||
// yes, it's fine, just do it, jeez, stop asking
|
||||
yes: npm.config.get('yes'),
|
||||
|
||||
...getScopesAndAuths(npm),
|
||||
|
||||
// npm fund exclusive option to select an item from a funding list
|
||||
which: npm.config.get('which'),
|
||||
|
||||
// socks proxy can be configured in https-proxy or proxy field
|
||||
// note that the various (HTTPS_|HTTP_|)PROXY environs will be
|
||||
// respected if this is not set.
|
||||
proxy: npm.config.get('https-proxy') || npm.config.get('proxy'),
|
||||
noProxy: npm.config.get('noproxy'),
|
||||
})
|
||||
|
||||
const getPreferOnline = npm => {
|
||||
const po = npm.config.get('prefer-online')
|
||||
const getPreferOnline = obj => {
|
||||
const po = obj['prefer-online']
|
||||
if (po !== undefined)
|
||||
return po
|
||||
|
||||
return npm.config.get('cache-max') <= 0
|
||||
return obj['cache-max'] <= 0
|
||||
}
|
||||
|
||||
const getPreferOffline = npm => {
|
||||
const po = npm.config.get('prefer-offline')
|
||||
const getPreferOffline = obj => {
|
||||
const po = obj['prefer-offline']
|
||||
if (po !== undefined)
|
||||
return po
|
||||
|
||||
return npm.config.get('cache-min') >= 9999
|
||||
return obj['cache-min'] >= 9999
|
||||
}
|
||||
|
||||
// pull out all the @scope:<key> and //host:key config fields
|
||||
// these are used by npm-registry-fetch for authing against registries
|
||||
const getScopesAndAuths = npm => {
|
||||
const getScopesAndAuths = obj => {
|
||||
const scopesAndAuths = {}
|
||||
// pull out all the @scope:... configs into a flat object.
|
||||
for (const key in npm.config.list[0]) {
|
||||
for (const key in obj) {
|
||||
if (/@.*:registry$/i.test(key) || /^\/\//.test(key))
|
||||
scopesAndAuths[key] = npm.config.get(key)
|
||||
scopesAndAuths[key] = obj[key]
|
||||
}
|
||||
return scopesAndAuths
|
||||
}
|
||||
|
||||
module.exports = flatOptions
|
||||
module.exports = Object.assign(flatOptions, { flatten })
|
||||
Vendored
+3
-3
@@ -28,9 +28,9 @@ This command allows you to run an arbitrary command from an npm package
|
||||
(either one installed locally, or fetched remotely), in a similar context
|
||||
as running it via \fBnpm run\fP\|\.
|
||||
.P
|
||||
Whatever packages are specified by the \fB\-\-package\fP or \fB\-p\fP option will be
|
||||
Whatever packages are specified by the \fB\-\-package\fP option will be
|
||||
provided in the \fBPATH\fP of the executed command, along with any locally
|
||||
installed package executables\. The \fB\-\-package\fP or \fB\-p\fP option may be
|
||||
installed package executables\. The \fB\-\-package\fP option may be
|
||||
specified multiple times, to execute the supplied command in an environment
|
||||
where all specified packages are available\.
|
||||
.P
|
||||
@@ -46,7 +46,7 @@ only be considered a match if they have the exact same name and version as
|
||||
the local dependency\.
|
||||
.P
|
||||
If no \fB\-c\fP or \fB\-\-call\fP option is provided, then the positional arguments
|
||||
are used to generate the command string\. If no \fB\-p\fP or \fB\-\-package\fP options
|
||||
are used to generate the command string\. If no \fB\-\-package\fP options
|
||||
are provided, then npm will attempt to determine the executable name from
|
||||
the package specifier provided as the first positional argument according
|
||||
to the following heuristic:
|
||||
|
||||
Vendored
+1
-1
@@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show:
|
||||
.P
|
||||
.RS 2
|
||||
.nf
|
||||
npm@7\.0\.7 /path/to/npm
|
||||
npm@7\.0\.8 /path/to/npm
|
||||
└─┬ init\-package\-json@0\.0\.4
|
||||
└── promzard@0\.1\.5
|
||||
.fi
|
||||
|
||||
Vendored
+1
-1
@@ -31,7 +31,7 @@ Even if a package version is unpublished, that specific name and
|
||||
version combination can never be reused\. In order to publish the
|
||||
package again, a new version number must be used\. If you unpublish the entire package, you may not publish any new versions of that package until 24 hours have passed\.
|
||||
.P
|
||||
To learn more about how unpublish is treated on the npm registry, see our <a href="https://www\.npmjs\.com/policies/unpublish" target="_blank" rel="noopener noreferrer"> unpublish policies</a>\|\.
|
||||
To learn more about how unpublish is treated on the npm registry, see our <a href="https://www\.npmjs\.com/policies/unpublish" target="_blank" rel="noopener noreferrer"> unpublish policies</a>\|\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@ npm <command> [args]
|
||||
.RE
|
||||
.SS Version
|
||||
.P
|
||||
7\.0\.7
|
||||
7\.0\.8
|
||||
.SS Description
|
||||
.P
|
||||
npm is the package manager for the Node JavaScript platform\. It puts
|
||||
|
||||
Vendored
+25
@@ -801,6 +801,31 @@ Assuming the host complies with semver \fIhttps://semver\.org/\fR, only changes
|
||||
the host package's major version will break your plugin\. Thus, if you've worked
|
||||
with every 1\.x version of the host package, use \fB"^1\.0"\fP or \fB"1\.x"\fP to express
|
||||
this\. If you depend on features introduced in 1\.5\.2, use \fB">= 1\.5\.2 < 2"\fP\|\.
|
||||
.SS peerDependenciesMeta
|
||||
.P
|
||||
When a user installs your package, npm will emit warnings if packages specified in \fBpeerDependencies\fP are not already installed\. The \fBpeerDependenciesMeta\fP field serves to provide npm more information on how your peer dependencies are to be used\. Specifically, it allows peer dependencies to be marked as optional\.
|
||||
.P
|
||||
For example:
|
||||
.P
|
||||
.RS 2
|
||||
.nf
|
||||
{
|
||||
"name": "tea\-latte",
|
||||
"version": "1\.3\.5",
|
||||
"peerDependencies": {
|
||||
"tea": "2\.x",
|
||||
"soy\-milk": "1\.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"soy\-milk": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
.fi
|
||||
.RE
|
||||
.P
|
||||
Marking a peer dependency as optional ensures npm will not emit a warning if the \fBsoy\-milk\fP package is not installed on the host\. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed\.
|
||||
.SS bundledDependencies
|
||||
.P
|
||||
This defines an array of package names that will be bundled when publishing
|
||||
|
||||
Vendored
+24
-24
@@ -194,14 +194,14 @@ executing the scripts\. So, if your package\.json has this:
|
||||
.P
|
||||
.RS 2
|
||||
.nf
|
||||
{
|
||||
"name" : "foo",
|
||||
"dependencies" : {
|
||||
"bar" : "0\.1\.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start" : "bar \./test"
|
||||
}
|
||||
{
|
||||
"name" : "foo",
|
||||
"dependencies" : {
|
||||
"bar" : "0\.1\.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start" : "bar \./test"
|
||||
}
|
||||
}
|
||||
.fi
|
||||
.RE
|
||||
@@ -230,14 +230,14 @@ if the package\.json has this:
|
||||
.P
|
||||
.RS 2
|
||||
.nf
|
||||
{
|
||||
"name" : "foo",
|
||||
"config" : {
|
||||
"port" : "8080"
|
||||
},
|
||||
"scripts" : {
|
||||
"start" : "node server\.js"
|
||||
}
|
||||
{
|
||||
"name" : "foo",
|
||||
"config" : {
|
||||
"port" : "8080"
|
||||
},
|
||||
"scripts" : {
|
||||
"start" : "node server\.js"
|
||||
}
|
||||
}
|
||||
.fi
|
||||
.RE
|
||||
@@ -279,10 +279,10 @@ For example, if your package\.json contains this:
|
||||
.P
|
||||
.RS 2
|
||||
.nf
|
||||
{
|
||||
"scripts" : {
|
||||
"install" : "scripts/install\.js",
|
||||
"postinstall" : "scripts/postinstall\.js",
|
||||
{
|
||||
"scripts" : {
|
||||
"install" : "scripts/install\.js",
|
||||
"postinstall" : "scripts/postinstall\.js",
|
||||
"uninstall" : "scripts/uninstall\.js"
|
||||
}
|
||||
}
|
||||
@@ -301,10 +301,10 @@ fine:
|
||||
.P
|
||||
.RS 2
|
||||
.nf
|
||||
{
|
||||
"scripts" : {
|
||||
"preinstall" : "\./configure",
|
||||
"install" : "make && make install",
|
||||
{
|
||||
"scripts" : {
|
||||
"preinstall" : "\./configure",
|
||||
"install" : "make && make install",
|
||||
"test" : "make test"
|
||||
}
|
||||
}
|
||||
|
||||
+29
-5
@@ -759,6 +759,11 @@ This is a one-time fix-up, please be patient...
|
||||
// be forced to agree on a version of z.
|
||||
const dep = vrDep && vrDep.satisfies(edge) ? vrDep
|
||||
: await this[_nodeFromEdge](edge, edge.peer ? virtualRoot : null)
|
||||
/* istanbul ignore next */
|
||||
debug(() => {
|
||||
if (!dep)
|
||||
throw new Error('no dep??')
|
||||
})
|
||||
tasks.push({edge, dep})
|
||||
}
|
||||
|
||||
@@ -1055,13 +1060,18 @@ This is a one-time fix-up, please be patient...
|
||||
// top nodes should still get peer deps from their fsParent if possible,
|
||||
// and only install locally if there's no other option, eg for a link
|
||||
// outside of the project root, or for a conflicted dep.
|
||||
const start = edge.peer && !node.isRoot
|
||||
? node.resolveParent || node
|
||||
const start = edge.peer && !node.isRoot ? node.resolveParent || node
|
||||
: node
|
||||
|
||||
let target
|
||||
let canPlace = null
|
||||
for (let check = start; check; check = check.resolveParent) {
|
||||
// if the current location has a peerDep on it, then we can't place here
|
||||
// this is pretty rare to hit, since we always prefer deduping peers.
|
||||
const checkEdge = check.edgesOut.get(edge.name)
|
||||
if (!check.isTop && checkEdge && checkEdge.peer)
|
||||
continue
|
||||
|
||||
const cp = this[_canPlaceDep](dep, check, edge, peerEntryEdge, peerPath)
|
||||
|
||||
// anything other than a conflict is fine to proceed with
|
||||
@@ -1210,9 +1220,15 @@ This is a one-time fix-up, please be patient...
|
||||
// otherwise they'd be gone and the peer set would change throughout
|
||||
// this loop.
|
||||
for (const peerEdge of newDep.edgesOut.values()) {
|
||||
if (!peerEdge.peer || peerEdge.valid)
|
||||
continue
|
||||
const peer = virtualRoot.children.get(peerEdge.name)
|
||||
|
||||
// Note: if the virtualRoot *doesn't* have the peer, then that means
|
||||
// it's an optional peer dep. If it's not being properly met (ie,
|
||||
// peerEdge.valid is false), that this is likely heading for an
|
||||
// ERESOLVE error, unless it can walk further up the tree.
|
||||
if (!peerEdge.peer || peerEdge.valid || !peer)
|
||||
continue
|
||||
|
||||
const peerPlaced = this[_placeDep](
|
||||
peer, newDep, peerEdge, peerEntryEdge || edge, peerPath)
|
||||
placed.push(...peerPlaced)
|
||||
@@ -1264,6 +1280,11 @@ This is a one-time fix-up, please be patient...
|
||||
// When we check peers, we pass along the peerEntryEdge to track the
|
||||
// original edge that caused us to load the family of peer dependencies.
|
||||
[_canPlaceDep] (dep, target, edge, peerEntryEdge = null, peerPath = []) {
|
||||
/* istanbul ignore next */
|
||||
debug(() => {
|
||||
if (!dep)
|
||||
throw new Error('no dep??')
|
||||
})
|
||||
const entryEdge = peerEntryEdge || edge
|
||||
const source = this[_peerSetSource].get(dep)
|
||||
const isSource = target === source
|
||||
@@ -1308,7 +1329,10 @@ This is a one-time fix-up, please be patient...
|
||||
return KEEP
|
||||
|
||||
// if we prefer deduping, then try replacing newer with older
|
||||
if (this[_preferDedupe] && !tryReplace && dep.canReplace(current)) {
|
||||
// we always prefer to dedupe peers, because they are trying
|
||||
// a bit harder to be singletons.
|
||||
const preferDedupe = this[_preferDedupe] || edge.peer
|
||||
if (preferDedupe && !tryReplace && dep.canReplace(current)) {
|
||||
const res = this[_canPlacePeers](dep, target, edge, REPLACE, peerEntryEdge, peerPath)
|
||||
/* istanbul ignore else - It's extremely rare that a replaceable
|
||||
* node would be a conflict, if the current one wasn't a conflict,
|
||||
|
||||
+8
-1
@@ -175,7 +175,7 @@ class Node {
|
||||
|
||||
// have to set the internal package ref before assigning the parent,
|
||||
// because this.package is read when adding to inventory
|
||||
this[_package] = pkg
|
||||
this[_package] = pkg && typeof pkg === 'object' ? pkg : {}
|
||||
|
||||
// only relevant for the root and top nodes
|
||||
this.meta = meta
|
||||
@@ -307,6 +307,13 @@ class Node {
|
||||
edge.detach()
|
||||
|
||||
this[_explanation] = null
|
||||
/* istanbul ignore next - should be impossible */
|
||||
if (!pkg || typeof pkg !== 'object') {
|
||||
debug(() => {
|
||||
throw new Error('setting Node.package to non-object')
|
||||
})
|
||||
pkg = {}
|
||||
}
|
||||
this[_package] = pkg
|
||||
this[_loadWorkspaces]()
|
||||
this[_loadDeps]()
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@npmcli/arborist",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.8",
|
||||
"description": "Manage node_modules trees",
|
||||
"dependencies": {
|
||||
"@npmcli/installed-package-contents": "^1.0.5",
|
||||
|
||||
+2
-1
@@ -92,7 +92,8 @@ const setEnvs = (config) => {
|
||||
if (cliConf['node-options'])
|
||||
env.NODE_OPTIONS = cliConf['node-options']
|
||||
|
||||
env.npm_execpath = require.main.filename
|
||||
if (require.main && require.main.filename)
|
||||
env.npm_execpath = require.main.filename
|
||||
env.npm_node_execpath = config.execPath
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -3,3 +3,4 @@
|
||||
## 0.0.0-pre.0
|
||||
|
||||
- Initial pre-release.
|
||||
|
||||
+1
@@ -80,3 +80,4 @@ A **Map** in which keys are **package names** and values are the **pathnames** f
|
||||
## LICENSE
|
||||
|
||||
[ISC](./LICENSE)
|
||||
|
||||
+1
@@ -10,3 +10,4 @@ module.exports = (mani, name) => {
|
||||
? mani.peerDependencies[name]
|
||||
: null
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
@node "%npm_config_node_gyp%" %*
|
||||
@node "%npm_config_node_gyp%" %*
|
||||
+2
-1
@@ -63,10 +63,11 @@
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'if' }}
|
||||
}
|
||||
}
|
||||
{{? $breakOnError }} else { {{?}}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
"$data": {
|
||||
"type": "string",
|
||||
"anyOf": [
|
||||
{ "format": "relative-json-pointer" },
|
||||
{ "format": "relative-json-pointer" },
|
||||
{ "format": "json-pointer" }
|
||||
]
|
||||
}
|
||||
|
||||
+2
-2
@@ -140,7 +140,7 @@ Override the built-in defaults for the duration of the process by passing an opt
|
||||
### byteSize(bytes, [options]) ⇒ <code>object</code> ⏏
|
||||
Returns an object with the spec `{ value: string, unit: string, long: string }`. The returned object defines a `toString` method meaning it can be used in any string context.
|
||||
|
||||
**Kind**: Exported function
|
||||
**Kind**: Exported function
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
@@ -156,7 +156,7 @@ Returns an object with the spec `{ value: string, unit: string, long: string }`.
|
||||
#### byteSize.defaultOptions(options)
|
||||
Set the default `byteSize` options for the duration of the process.
|
||||
|
||||
**Kind**: static method of [<code>byteSize</code>](#exp_module_byte-size--byteSize)
|
||||
**Kind**: static method of [<code>byteSize</code>](#exp_module_byte-size--byteSize)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
|
||||
+3
-3
@@ -442,7 +442,7 @@ the reader functions, but their default will be to read from memory.
|
||||
##### `opts.tmpPrefix`
|
||||
Default: null
|
||||
|
||||
Prefix to append on the temporary directory name inside the cache's tmp dir.
|
||||
Prefix to append on the temporary directory name inside the cache's tmp dir.
|
||||
|
||||
#### <a name="rm-all"></a> `> cacache.rm.all(cache) -> Promise`
|
||||
|
||||
@@ -542,7 +542,7 @@ cacache.tmp.mkdir(cache).then(dir => {
|
||||
|
||||
Creates a temporary directory with [`tmp.mkdir()`](#tmp-mkdir) and calls `cb`
|
||||
with it. The created temporary directory will be removed when the return value
|
||||
of `cb()` resolves, the tmp directory will be automatically deleted once that
|
||||
of `cb()` resolves, the tmp directory will be automatically deleted once that
|
||||
promise completes.
|
||||
|
||||
The same caveats apply when it comes to managing permissions for the tmp dir's
|
||||
@@ -565,7 +565,7 @@ cacache.tmp.withTmp(cache, dir => {
|
||||
##### `opts.tmpPrefix`
|
||||
Default: null
|
||||
|
||||
Prefix to append on the temporary directory name inside the cache's tmp dir.
|
||||
Prefix to append on the temporary directory name inside the cache's tmp dir.
|
||||
|
||||
#### <a name="integrity"></a> Subresource Integrity Digests
|
||||
|
||||
|
||||
+1
@@ -43,3 +43,4 @@ The maintainers of strip-ansi and thousands of other packages are working with T
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
+51
-49
@@ -1,49 +1,51 @@
|
||||
exports.replaceDollarWithPercentPair = replaceDollarWithPercentPair
|
||||
exports.convertToSetCommand = convertToSetCommand
|
||||
exports.convertToSetCommands = convertToSetCommands
|
||||
|
||||
function convertToSetCommand(key, value) {
|
||||
var line = ""
|
||||
key = key || ""
|
||||
key = key.trim()
|
||||
value = value || ""
|
||||
value = value.trim()
|
||||
if(key && value && value.length > 0) {
|
||||
line = "@SET " + key + "=" + replaceDollarWithPercentPair(value) + "\r\n"
|
||||
}
|
||||
return line
|
||||
}
|
||||
|
||||
function extractVariableValuePairs(declarations) {
|
||||
var pairs = {}
|
||||
declarations.map(function(declaration) {
|
||||
var split = declaration.split("=")
|
||||
pairs[split[0]]=split[1]
|
||||
})
|
||||
return pairs
|
||||
}
|
||||
|
||||
function convertToSetCommands(variableString) {
|
||||
var variableValuePairs = extractVariableValuePairs(variableString.split(" "))
|
||||
var variableDeclarationsAsBatch = ""
|
||||
Object.keys(variableValuePairs).forEach(function (key) {
|
||||
variableDeclarationsAsBatch += convertToSetCommand(key, variableValuePairs[key])
|
||||
})
|
||||
return variableDeclarationsAsBatch
|
||||
}
|
||||
|
||||
function replaceDollarWithPercentPair(value) {
|
||||
var dollarExpressions = /\$\{?([^\$@#\?\- \t{}:]+)\}?/g
|
||||
var result = ""
|
||||
var startIndex = 0
|
||||
do {
|
||||
var match = dollarExpressions.exec(value)
|
||||
if(match) {
|
||||
var betweenMatches = value.substring(startIndex, match.index) || ""
|
||||
result += betweenMatches + "%" + match[1] + "%"
|
||||
startIndex = dollarExpressions.lastIndex
|
||||
}
|
||||
} while (dollarExpressions.lastIndex > 0)
|
||||
result += value.substr(startIndex)
|
||||
return result
|
||||
}
|
||||
exports.replaceDollarWithPercentPair = replaceDollarWithPercentPair
|
||||
exports.convertToSetCommand = convertToSetCommand
|
||||
exports.convertToSetCommands = convertToSetCommands
|
||||
|
||||
function convertToSetCommand(key, value) {
|
||||
var line = ""
|
||||
key = key || ""
|
||||
key = key.trim()
|
||||
value = value || ""
|
||||
value = value.trim()
|
||||
if(key && value && value.length > 0) {
|
||||
line = "@SET " + key + "=" + replaceDollarWithPercentPair(value) + "\r\n"
|
||||
}
|
||||
return line
|
||||
}
|
||||
|
||||
function extractVariableValuePairs(declarations) {
|
||||
var pairs = {}
|
||||
declarations.map(function(declaration) {
|
||||
var split = declaration.split("=")
|
||||
pairs[split[0]]=split[1]
|
||||
})
|
||||
return pairs
|
||||
}
|
||||
|
||||
function convertToSetCommands(variableString) {
|
||||
var variableValuePairs = extractVariableValuePairs(variableString.split(" "))
|
||||
var variableDeclarationsAsBatch = ""
|
||||
Object.keys(variableValuePairs).forEach(function (key) {
|
||||
variableDeclarationsAsBatch += convertToSetCommand(key, variableValuePairs[key])
|
||||
})
|
||||
return variableDeclarationsAsBatch
|
||||
}
|
||||
|
||||
function replaceDollarWithPercentPair(value) {
|
||||
var dollarExpressions = /\$\{?([^\$@#\?\- \t{}:]+)\}?/g
|
||||
var result = ""
|
||||
var startIndex = 0
|
||||
do {
|
||||
var match = dollarExpressions.exec(value)
|
||||
if(match) {
|
||||
var betweenMatches = value.substring(startIndex, match.index) || ""
|
||||
result += betweenMatches + "%" + match[1] + "%"
|
||||
startIndex = dollarExpressions.lastIndex
|
||||
}
|
||||
} while (dollarExpressions.lastIndex > 0)
|
||||
result += value.substr(startIndex)
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -1,8 +1,8 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015 Dmitry Ivanov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015 Dmitry Ivanov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+11
-11
@@ -1,11 +1,11 @@
|
||||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||
|
||||
[](https://nodei.co/npm/color-name/)
|
||||
|
||||
|
||||
```js
|
||||
var colors = require('color-name');
|
||||
colors.red //[255,0,0]
|
||||
```
|
||||
|
||||
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
|
||||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||
|
||||
[](https://nodei.co/npm/color-name/)
|
||||
|
||||
|
||||
```js
|
||||
var colors = require('color-name');
|
||||
colors.red //[255,0,0]
|
||||
```
|
||||
|
||||
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
|
||||
+152
-152
@@ -1,152 +1,152 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
"aliceblue": [240, 248, 255],
|
||||
"antiquewhite": [250, 235, 215],
|
||||
"aqua": [0, 255, 255],
|
||||
"aquamarine": [127, 255, 212],
|
||||
"azure": [240, 255, 255],
|
||||
"beige": [245, 245, 220],
|
||||
"bisque": [255, 228, 196],
|
||||
"black": [0, 0, 0],
|
||||
"blanchedalmond": [255, 235, 205],
|
||||
"blue": [0, 0, 255],
|
||||
"blueviolet": [138, 43, 226],
|
||||
"brown": [165, 42, 42],
|
||||
"burlywood": [222, 184, 135],
|
||||
"cadetblue": [95, 158, 160],
|
||||
"chartreuse": [127, 255, 0],
|
||||
"chocolate": [210, 105, 30],
|
||||
"coral": [255, 127, 80],
|
||||
"cornflowerblue": [100, 149, 237],
|
||||
"cornsilk": [255, 248, 220],
|
||||
"crimson": [220, 20, 60],
|
||||
"cyan": [0, 255, 255],
|
||||
"darkblue": [0, 0, 139],
|
||||
"darkcyan": [0, 139, 139],
|
||||
"darkgoldenrod": [184, 134, 11],
|
||||
"darkgray": [169, 169, 169],
|
||||
"darkgreen": [0, 100, 0],
|
||||
"darkgrey": [169, 169, 169],
|
||||
"darkkhaki": [189, 183, 107],
|
||||
"darkmagenta": [139, 0, 139],
|
||||
"darkolivegreen": [85, 107, 47],
|
||||
"darkorange": [255, 140, 0],
|
||||
"darkorchid": [153, 50, 204],
|
||||
"darkred": [139, 0, 0],
|
||||
"darksalmon": [233, 150, 122],
|
||||
"darkseagreen": [143, 188, 143],
|
||||
"darkslateblue": [72, 61, 139],
|
||||
"darkslategray": [47, 79, 79],
|
||||
"darkslategrey": [47, 79, 79],
|
||||
"darkturquoise": [0, 206, 209],
|
||||
"darkviolet": [148, 0, 211],
|
||||
"deeppink": [255, 20, 147],
|
||||
"deepskyblue": [0, 191, 255],
|
||||
"dimgray": [105, 105, 105],
|
||||
"dimgrey": [105, 105, 105],
|
||||
"dodgerblue": [30, 144, 255],
|
||||
"firebrick": [178, 34, 34],
|
||||
"floralwhite": [255, 250, 240],
|
||||
"forestgreen": [34, 139, 34],
|
||||
"fuchsia": [255, 0, 255],
|
||||
"gainsboro": [220, 220, 220],
|
||||
"ghostwhite": [248, 248, 255],
|
||||
"gold": [255, 215, 0],
|
||||
"goldenrod": [218, 165, 32],
|
||||
"gray": [128, 128, 128],
|
||||
"green": [0, 128, 0],
|
||||
"greenyellow": [173, 255, 47],
|
||||
"grey": [128, 128, 128],
|
||||
"honeydew": [240, 255, 240],
|
||||
"hotpink": [255, 105, 180],
|
||||
"indianred": [205, 92, 92],
|
||||
"indigo": [75, 0, 130],
|
||||
"ivory": [255, 255, 240],
|
||||
"khaki": [240, 230, 140],
|
||||
"lavender": [230, 230, 250],
|
||||
"lavenderblush": [255, 240, 245],
|
||||
"lawngreen": [124, 252, 0],
|
||||
"lemonchiffon": [255, 250, 205],
|
||||
"lightblue": [173, 216, 230],
|
||||
"lightcoral": [240, 128, 128],
|
||||
"lightcyan": [224, 255, 255],
|
||||
"lightgoldenrodyellow": [250, 250, 210],
|
||||
"lightgray": [211, 211, 211],
|
||||
"lightgreen": [144, 238, 144],
|
||||
"lightgrey": [211, 211, 211],
|
||||
"lightpink": [255, 182, 193],
|
||||
"lightsalmon": [255, 160, 122],
|
||||
"lightseagreen": [32, 178, 170],
|
||||
"lightskyblue": [135, 206, 250],
|
||||
"lightslategray": [119, 136, 153],
|
||||
"lightslategrey": [119, 136, 153],
|
||||
"lightsteelblue": [176, 196, 222],
|
||||
"lightyellow": [255, 255, 224],
|
||||
"lime": [0, 255, 0],
|
||||
"limegreen": [50, 205, 50],
|
||||
"linen": [250, 240, 230],
|
||||
"magenta": [255, 0, 255],
|
||||
"maroon": [128, 0, 0],
|
||||
"mediumaquamarine": [102, 205, 170],
|
||||
"mediumblue": [0, 0, 205],
|
||||
"mediumorchid": [186, 85, 211],
|
||||
"mediumpurple": [147, 112, 219],
|
||||
"mediumseagreen": [60, 179, 113],
|
||||
"mediumslateblue": [123, 104, 238],
|
||||
"mediumspringgreen": [0, 250, 154],
|
||||
"mediumturquoise": [72, 209, 204],
|
||||
"mediumvioletred": [199, 21, 133],
|
||||
"midnightblue": [25, 25, 112],
|
||||
"mintcream": [245, 255, 250],
|
||||
"mistyrose": [255, 228, 225],
|
||||
"moccasin": [255, 228, 181],
|
||||
"navajowhite": [255, 222, 173],
|
||||
"navy": [0, 0, 128],
|
||||
"oldlace": [253, 245, 230],
|
||||
"olive": [128, 128, 0],
|
||||
"olivedrab": [107, 142, 35],
|
||||
"orange": [255, 165, 0],
|
||||
"orangered": [255, 69, 0],
|
||||
"orchid": [218, 112, 214],
|
||||
"palegoldenrod": [238, 232, 170],
|
||||
"palegreen": [152, 251, 152],
|
||||
"paleturquoise": [175, 238, 238],
|
||||
"palevioletred": [219, 112, 147],
|
||||
"papayawhip": [255, 239, 213],
|
||||
"peachpuff": [255, 218, 185],
|
||||
"peru": [205, 133, 63],
|
||||
"pink": [255, 192, 203],
|
||||
"plum": [221, 160, 221],
|
||||
"powderblue": [176, 224, 230],
|
||||
"purple": [128, 0, 128],
|
||||
"rebeccapurple": [102, 51, 153],
|
||||
"red": [255, 0, 0],
|
||||
"rosybrown": [188, 143, 143],
|
||||
"royalblue": [65, 105, 225],
|
||||
"saddlebrown": [139, 69, 19],
|
||||
"salmon": [250, 128, 114],
|
||||
"sandybrown": [244, 164, 96],
|
||||
"seagreen": [46, 139, 87],
|
||||
"seashell": [255, 245, 238],
|
||||
"sienna": [160, 82, 45],
|
||||
"silver": [192, 192, 192],
|
||||
"skyblue": [135, 206, 235],
|
||||
"slateblue": [106, 90, 205],
|
||||
"slategray": [112, 128, 144],
|
||||
"slategrey": [112, 128, 144],
|
||||
"snow": [255, 250, 250],
|
||||
"springgreen": [0, 255, 127],
|
||||
"steelblue": [70, 130, 180],
|
||||
"tan": [210, 180, 140],
|
||||
"teal": [0, 128, 128],
|
||||
"thistle": [216, 191, 216],
|
||||
"tomato": [255, 99, 71],
|
||||
"turquoise": [64, 224, 208],
|
||||
"violet": [238, 130, 238],
|
||||
"wheat": [245, 222, 179],
|
||||
"white": [255, 255, 255],
|
||||
"whitesmoke": [245, 245, 245],
|
||||
"yellow": [255, 255, 0],
|
||||
"yellowgreen": [154, 205, 50]
|
||||
};
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
"aliceblue": [240, 248, 255],
|
||||
"antiquewhite": [250, 235, 215],
|
||||
"aqua": [0, 255, 255],
|
||||
"aquamarine": [127, 255, 212],
|
||||
"azure": [240, 255, 255],
|
||||
"beige": [245, 245, 220],
|
||||
"bisque": [255, 228, 196],
|
||||
"black": [0, 0, 0],
|
||||
"blanchedalmond": [255, 235, 205],
|
||||
"blue": [0, 0, 255],
|
||||
"blueviolet": [138, 43, 226],
|
||||
"brown": [165, 42, 42],
|
||||
"burlywood": [222, 184, 135],
|
||||
"cadetblue": [95, 158, 160],
|
||||
"chartreuse": [127, 255, 0],
|
||||
"chocolate": [210, 105, 30],
|
||||
"coral": [255, 127, 80],
|
||||
"cornflowerblue": [100, 149, 237],
|
||||
"cornsilk": [255, 248, 220],
|
||||
"crimson": [220, 20, 60],
|
||||
"cyan": [0, 255, 255],
|
||||
"darkblue": [0, 0, 139],
|
||||
"darkcyan": [0, 139, 139],
|
||||
"darkgoldenrod": [184, 134, 11],
|
||||
"darkgray": [169, 169, 169],
|
||||
"darkgreen": [0, 100, 0],
|
||||
"darkgrey": [169, 169, 169],
|
||||
"darkkhaki": [189, 183, 107],
|
||||
"darkmagenta": [139, 0, 139],
|
||||
"darkolivegreen": [85, 107, 47],
|
||||
"darkorange": [255, 140, 0],
|
||||
"darkorchid": [153, 50, 204],
|
||||
"darkred": [139, 0, 0],
|
||||
"darksalmon": [233, 150, 122],
|
||||
"darkseagreen": [143, 188, 143],
|
||||
"darkslateblue": [72, 61, 139],
|
||||
"darkslategray": [47, 79, 79],
|
||||
"darkslategrey": [47, 79, 79],
|
||||
"darkturquoise": [0, 206, 209],
|
||||
"darkviolet": [148, 0, 211],
|
||||
"deeppink": [255, 20, 147],
|
||||
"deepskyblue": [0, 191, 255],
|
||||
"dimgray": [105, 105, 105],
|
||||
"dimgrey": [105, 105, 105],
|
||||
"dodgerblue": [30, 144, 255],
|
||||
"firebrick": [178, 34, 34],
|
||||
"floralwhite": [255, 250, 240],
|
||||
"forestgreen": [34, 139, 34],
|
||||
"fuchsia": [255, 0, 255],
|
||||
"gainsboro": [220, 220, 220],
|
||||
"ghostwhite": [248, 248, 255],
|
||||
"gold": [255, 215, 0],
|
||||
"goldenrod": [218, 165, 32],
|
||||
"gray": [128, 128, 128],
|
||||
"green": [0, 128, 0],
|
||||
"greenyellow": [173, 255, 47],
|
||||
"grey": [128, 128, 128],
|
||||
"honeydew": [240, 255, 240],
|
||||
"hotpink": [255, 105, 180],
|
||||
"indianred": [205, 92, 92],
|
||||
"indigo": [75, 0, 130],
|
||||
"ivory": [255, 255, 240],
|
||||
"khaki": [240, 230, 140],
|
||||
"lavender": [230, 230, 250],
|
||||
"lavenderblush": [255, 240, 245],
|
||||
"lawngreen": [124, 252, 0],
|
||||
"lemonchiffon": [255, 250, 205],
|
||||
"lightblue": [173, 216, 230],
|
||||
"lightcoral": [240, 128, 128],
|
||||
"lightcyan": [224, 255, 255],
|
||||
"lightgoldenrodyellow": [250, 250, 210],
|
||||
"lightgray": [211, 211, 211],
|
||||
"lightgreen": [144, 238, 144],
|
||||
"lightgrey": [211, 211, 211],
|
||||
"lightpink": [255, 182, 193],
|
||||
"lightsalmon": [255, 160, 122],
|
||||
"lightseagreen": [32, 178, 170],
|
||||
"lightskyblue": [135, 206, 250],
|
||||
"lightslategray": [119, 136, 153],
|
||||
"lightslategrey": [119, 136, 153],
|
||||
"lightsteelblue": [176, 196, 222],
|
||||
"lightyellow": [255, 255, 224],
|
||||
"lime": [0, 255, 0],
|
||||
"limegreen": [50, 205, 50],
|
||||
"linen": [250, 240, 230],
|
||||
"magenta": [255, 0, 255],
|
||||
"maroon": [128, 0, 0],
|
||||
"mediumaquamarine": [102, 205, 170],
|
||||
"mediumblue": [0, 0, 205],
|
||||
"mediumorchid": [186, 85, 211],
|
||||
"mediumpurple": [147, 112, 219],
|
||||
"mediumseagreen": [60, 179, 113],
|
||||
"mediumslateblue": [123, 104, 238],
|
||||
"mediumspringgreen": [0, 250, 154],
|
||||
"mediumturquoise": [72, 209, 204],
|
||||
"mediumvioletred": [199, 21, 133],
|
||||
"midnightblue": [25, 25, 112],
|
||||
"mintcream": [245, 255, 250],
|
||||
"mistyrose": [255, 228, 225],
|
||||
"moccasin": [255, 228, 181],
|
||||
"navajowhite": [255, 222, 173],
|
||||
"navy": [0, 0, 128],
|
||||
"oldlace": [253, 245, 230],
|
||||
"olive": [128, 128, 0],
|
||||
"olivedrab": [107, 142, 35],
|
||||
"orange": [255, 165, 0],
|
||||
"orangered": [255, 69, 0],
|
||||
"orchid": [218, 112, 214],
|
||||
"palegoldenrod": [238, 232, 170],
|
||||
"palegreen": [152, 251, 152],
|
||||
"paleturquoise": [175, 238, 238],
|
||||
"palevioletred": [219, 112, 147],
|
||||
"papayawhip": [255, 239, 213],
|
||||
"peachpuff": [255, 218, 185],
|
||||
"peru": [205, 133, 63],
|
||||
"pink": [255, 192, 203],
|
||||
"plum": [221, 160, 221],
|
||||
"powderblue": [176, 224, 230],
|
||||
"purple": [128, 0, 128],
|
||||
"rebeccapurple": [102, 51, 153],
|
||||
"red": [255, 0, 0],
|
||||
"rosybrown": [188, 143, 143],
|
||||
"royalblue": [65, 105, 225],
|
||||
"saddlebrown": [139, 69, 19],
|
||||
"salmon": [250, 128, 114],
|
||||
"sandybrown": [244, 164, 96],
|
||||
"seagreen": [46, 139, 87],
|
||||
"seashell": [255, 245, 238],
|
||||
"sienna": [160, 82, 45],
|
||||
"silver": [192, 192, 192],
|
||||
"skyblue": [135, 206, 235],
|
||||
"slateblue": [106, 90, 205],
|
||||
"slategray": [112, 128, 144],
|
||||
"slategrey": [112, 128, 144],
|
||||
"snow": [255, 250, 250],
|
||||
"springgreen": [0, 255, 127],
|
||||
"steelblue": [70, 130, 180],
|
||||
"tan": [210, 180, 140],
|
||||
"teal": [0, 128, 128],
|
||||
"thistle": [216, 191, 216],
|
||||
"tomato": [255, 99, 71],
|
||||
"turquoise": [64, 224, 208],
|
||||
"violet": [238, 130, 238],
|
||||
"wheat": [245, 222, 179],
|
||||
"white": [255, 255, 255],
|
||||
"whitesmoke": [245, 245, 245],
|
||||
"yellow": [255, 255, 0],
|
||||
"yellowgreen": [154, 205, 50]
|
||||
};
|
||||
+28
-28
@@ -1,28 +1,28 @@
|
||||
{
|
||||
"name": "color-name",
|
||||
"version": "1.1.4",
|
||||
"description": "A list of color names and its values",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:colorjs/color-name.git"
|
||||
},
|
||||
"keywords": [
|
||||
"color-name",
|
||||
"color",
|
||||
"color-keyword",
|
||||
"keyword"
|
||||
],
|
||||
"author": "DY <dfcreative@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/colorjs/color-name/issues"
|
||||
},
|
||||
"homepage": "https://github.com/colorjs/color-name"
|
||||
}
|
||||
{
|
||||
"name": "color-name",
|
||||
"version": "1.1.4",
|
||||
"description": "A list of color names and its values",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:colorjs/color-name.git"
|
||||
},
|
||||
"keywords": [
|
||||
"color-name",
|
||||
"color",
|
||||
"color-keyword",
|
||||
"keyword"
|
||||
],
|
||||
"author": "DY <dfcreative@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/colorjs/color-name/issues"
|
||||
},
|
||||
"homepage": "https://github.com/colorjs/color-name"
|
||||
}
|
||||
+6
-6
@@ -269,7 +269,7 @@ log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
## Extend
|
||||
You can simply extend debugger
|
||||
You can simply extend debugger
|
||||
```js
|
||||
const log = require('debug')('auth');
|
||||
|
||||
@@ -299,18 +299,18 @@ console.log(3, debug.enabled('test'));
|
||||
|
||||
```
|
||||
|
||||
print :
|
||||
print :
|
||||
```
|
||||
1 false
|
||||
2 true
|
||||
3 false
|
||||
```
|
||||
|
||||
Usage :
|
||||
`enable(namespaces)`
|
||||
Usage :
|
||||
`enable(namespaces)`
|
||||
`namespaces` can include modes separated by a colon and wildcards.
|
||||
|
||||
Note that calling `enable()` completely overrides previously set DEBUG variable :
|
||||
|
||||
Note that calling `enable()` completely overrides previously set DEBUG variable :
|
||||
|
||||
```
|
||||
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ const understoodStatuses = new Set([
|
||||
const errorStatusCodes = new Set([
|
||||
500,
|
||||
502,
|
||||
503,
|
||||
503,
|
||||
504,
|
||||
]);
|
||||
|
||||
|
||||
+5
-5
@@ -10,13 +10,13 @@
|
||||
|
||||
## 0.6.0 / 2020-06-08
|
||||
* Updated 'gb18030' encoding to :2005 edition (see https://github.com/whatwg/encoding/issues/22).
|
||||
* Removed `iconv.extendNodeEncodings()` mechanism. It was deprecated 5 years ago and didn't work
|
||||
* Removed `iconv.extendNodeEncodings()` mechanism. It was deprecated 5 years ago and didn't work
|
||||
in recent Node versions.
|
||||
* Reworked Streaming API behavior in browser environments to fix #204. Streaming API will be
|
||||
excluded by default in browser packs, saving ~100Kb bundle size, unless enabled explicitly using
|
||||
* Reworked Streaming API behavior in browser environments to fix #204. Streaming API will be
|
||||
excluded by default in browser packs, saving ~100Kb bundle size, unless enabled explicitly using
|
||||
`iconv.enableStreamingAPI(require('stream'))`.
|
||||
* Updates to development environment & tests:
|
||||
* Added ./test/webpack private package to test complex new use cases that need custom environment.
|
||||
* Added ./test/webpack private package to test complex new use cases that need custom environment.
|
||||
It's tested as a separate job in Travis CI.
|
||||
* Updated generation code for the new EUC-KR index file format from Encoding Standard.
|
||||
* Removed Buffer() constructor in tests (#197 by @gabrielschulhof).
|
||||
@@ -32,7 +32,7 @@
|
||||
## 0.5.1 / 2020-01-18
|
||||
|
||||
* Added cp720 encoding (#221, by @kr-deps)
|
||||
* (minor) Changed Changelog.md formatting to use h2.
|
||||
* (minor) Changed Changelog.md formatting to use h2.
|
||||
|
||||
|
||||
## 0.5.0 / 2019-06-26
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
* React Native is supported (need to install `stream` module to enable Streaming API).
|
||||
* License: MIT.
|
||||
|
||||
[](https://npmjs.org/package/iconv-lite/)
|
||||
[](https://npmjs.org/package/iconv-lite/)
|
||||
[](https://travis-ci.org/ashtuchkin/iconv-lite)
|
||||
[](https://npmjs.org/package/iconv-lite/)
|
||||
[](https://npmjs.org/package/iconv-lite/)
|
||||
@@ -103,7 +103,7 @@ smart about endianness in the following ways:
|
||||
|
||||
## UTF-32 Encodings
|
||||
|
||||
This library supports UTF-32LE, UTF-32BE and UTF-32 encodings. Like the UTF-16 encoding above, UTF-32 defaults to UTF-32LE, but uses BOM and 'spaces heuristics' to determine input endianness.
|
||||
This library supports UTF-32LE, UTF-32BE and UTF-32 encodings. Like the UTF-16 encoding above, UTF-32 defaults to UTF-32LE, but uses BOM and 'spaces heuristics' to determine input endianness.
|
||||
* The default of UTF-32LE can be overridden with the `defaultEncoding: 'utf-32be'` option. Strips BOM unless `stripBOM: false`.
|
||||
* Encoding: uses UTF-32LE and writes BOM by default. Use `addBOM: false` to override. (`defaultEncoding: 'utf-32be'` can also be used here to change encoding.)
|
||||
|
||||
|
||||
+4
-4
@@ -510,9 +510,9 @@ DBCSDecoder.prototype.write = function(buf) {
|
||||
if (i >= 3) {
|
||||
var ptr = (buf[i-3]-0x81)*12600 + (buf[i-2]-0x30)*1260 + (buf[i-1]-0x81)*10 + (curByte-0x30);
|
||||
} else {
|
||||
var ptr = (prevBytes[i-3+prevOffset]-0x81)*12600 +
|
||||
(((i-2 >= 0) ? buf[i-2] : prevBytes[i-2+prevOffset])-0x30)*1260 +
|
||||
(((i-1 >= 0) ? buf[i-1] : prevBytes[i-1+prevOffset])-0x81)*10 +
|
||||
var ptr = (prevBytes[i-3+prevOffset]-0x81)*12600 +
|
||||
(((i-2 >= 0) ? buf[i-2] : prevBytes[i-2+prevOffset])-0x30)*1260 +
|
||||
(((i-1 >= 0) ? buf[i-1] : prevBytes[i-1+prevOffset])-0x81)*10 +
|
||||
(curByte-0x30);
|
||||
}
|
||||
var idx = findIdx(this.gb18030.gbChars, ptr);
|
||||
@@ -535,7 +535,7 @@ DBCSDecoder.prototype.write = function(buf) {
|
||||
throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte);
|
||||
|
||||
// Write the character to buffer, handling higher planes using surrogate pair.
|
||||
if (uCode >= 0x10000) {
|
||||
if (uCode >= 0x10000) {
|
||||
uCode -= 0x10000;
|
||||
var uCodeLead = 0xD800 | (uCode >> 10);
|
||||
newBuf[j++] = uCodeLead & 0xFF;
|
||||
|
||||
+3
-3
@@ -118,7 +118,7 @@ Utf32Decoder.prototype.write = function(src) {
|
||||
if (overflow.length > 0) {
|
||||
for (; i < src.length && overflow.length < 4; i++)
|
||||
overflow.push(src[i]);
|
||||
|
||||
|
||||
if (overflow.length === 4) {
|
||||
// NOTE: codepoint is a signed int32 and can be negative.
|
||||
// NOTE: We copied this block from below to help V8 optimize it (it works with array, not buffer).
|
||||
@@ -157,7 +157,7 @@ function _writeCodepoint(dst, offset, codepoint, badChar) {
|
||||
if (codepoint < 0 || codepoint > 0x10FFFF) {
|
||||
// Not a valid Unicode codepoint
|
||||
codepoint = badChar;
|
||||
}
|
||||
}
|
||||
|
||||
// Ephemeral Planes: Write high surrogate.
|
||||
if (codepoint >= 0x10000) {
|
||||
@@ -229,7 +229,7 @@ function Utf32AutoDecoder(options, codec) {
|
||||
}
|
||||
|
||||
Utf32AutoDecoder.prototype.write = function(buf) {
|
||||
if (!this.decoder) {
|
||||
if (!this.decoder) {
|
||||
// Codec is not chosen yet. Accumulate initial bytes.
|
||||
this.initialBufs.push(buf);
|
||||
this.initialBufsLen += buf.length;
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
var Buffer = require("safer-buffer").Buffer;
|
||||
|
||||
// NOTE: Due to 'stream' module being pretty large (~100Kb, significant in browser environments),
|
||||
// NOTE: Due to 'stream' module being pretty large (~100Kb, significant in browser environments),
|
||||
// we opt to dependency-inject it instead of creating a hard dependency.
|
||||
module.exports = function(stream_module) {
|
||||
var Transform = stream_module.Transform;
|
||||
@@ -84,7 +84,7 @@ module.exports = function(stream_module) {
|
||||
IconvLiteDecoderStream.prototype._flush = function(done) {
|
||||
try {
|
||||
var res = this.conv.end();
|
||||
if (res && res.length) this.push(res, this.encoding);
|
||||
if (res && res.length) this.push(res, this.encoding);
|
||||
done();
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
JSON Schema is a repository for the JSON Schema specification, reference schemas and a CommonJS implementation of JSON Schema (not the only JavaScript implementation of JSON Schema, JSV is another excellent JavaScript validator).
|
||||
|
||||
Code is licensed under the AFL or BSD license as part of the Persevere
|
||||
project which is administered under the Dojo foundation,
|
||||
JSON Schema is a repository for the JSON Schema specification, reference schemas and a CommonJS implementation of JSON Schema (not the only JavaScript implementation of JSON Schema, JSV is another excellent JavaScript validator).
|
||||
|
||||
Code is licensed under the AFL or BSD license as part of the Persevere
|
||||
project which is administered under the Dojo foundation,
|
||||
and all contributions require a Dojo CLA.
|
||||
+67
-67
@@ -1,68 +1,68 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-00/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-00/hyper-schema#",
|
||||
|
||||
"properties" : {
|
||||
"links" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "http://json-schema.org/draft-00/links#"},
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"fragmentResolution" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"default" : "dot-delimited"
|
||||
},
|
||||
|
||||
"root" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"readonly" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"pathStart" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"mediaType" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "media-type"
|
||||
},
|
||||
|
||||
"alternate" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true
|
||||
}
|
||||
},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited",
|
||||
"extends" : {"$ref" : "http://json-schema.org/draft-00/schema#"}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-00/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-00/hyper-schema#",
|
||||
|
||||
"properties" : {
|
||||
"links" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "http://json-schema.org/draft-00/links#"},
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"fragmentResolution" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"default" : "dot-delimited"
|
||||
},
|
||||
|
||||
"root" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"readonly" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"pathStart" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"mediaType" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "media-type"
|
||||
},
|
||||
|
||||
"alternate" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true
|
||||
}
|
||||
},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited",
|
||||
"extends" : {"$ref" : "http://json-schema.org/draft-00/schema#"}
|
||||
}
|
||||
+25
-25
@@ -1,26 +1,26 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-00/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-00/json-ref#",
|
||||
|
||||
"items" : {"$ref" : "#"},
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited"
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-00/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-00/json-ref#",
|
||||
|
||||
"items" : {"$ref" : "#"},
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited"
|
||||
}
|
||||
+32
-32
@@ -1,33 +1,33 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-00/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-00/links#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"href" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"rel" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"method" : {
|
||||
"type" : "string",
|
||||
"default" : "GET",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enctype" : {
|
||||
"type" : "string",
|
||||
"requires" : "method",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-00/hyper-schema#"},
|
||||
"optional" : true
|
||||
}
|
||||
}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-00/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-00/links#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"href" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"rel" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"method" : {
|
||||
"type" : "string",
|
||||
"default" : "GET",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enctype" : {
|
||||
"type" : "string",
|
||||
"requires" : "method",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-00/hyper-schema#"},
|
||||
"optional" : true
|
||||
}
|
||||
}
|
||||
}
|
||||
+154
-154
@@ -1,155 +1,155 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-00/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-00/schema#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"type" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"optional" : true,
|
||||
"default" : "any"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"items" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"optional" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"additionalProperties" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"requires" : {
|
||||
"type" : ["string", {"$ref" : "#"}],
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"maximum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "minimum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"maximumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "maximum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"minItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"pattern" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "regex"
|
||||
},
|
||||
|
||||
"minLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enum" : {
|
||||
"type" : "array",
|
||||
"optional" : true,
|
||||
"minItems" : 1
|
||||
},
|
||||
|
||||
"title" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"description" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"format" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"contentEncoding" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"default" : {
|
||||
"type" : "any",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"maxDecimal" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"disallow" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {"type" : "string"},
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"extends" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
}
|
||||
},
|
||||
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-00/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-00/schema#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"type" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"optional" : true,
|
||||
"default" : "any"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"items" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"optional" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"additionalProperties" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"requires" : {
|
||||
"type" : ["string", {"$ref" : "#"}],
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"maximum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "minimum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"maximumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "maximum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"minItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"pattern" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "regex"
|
||||
},
|
||||
|
||||
"minLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enum" : {
|
||||
"type" : "array",
|
||||
"optional" : true,
|
||||
"minItems" : 1
|
||||
},
|
||||
|
||||
"title" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"description" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"format" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"contentEncoding" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"default" : {
|
||||
"type" : "any",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"maxDecimal" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"disallow" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {"type" : "string"},
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"extends" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
}
|
||||
},
|
||||
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
}
|
||||
+67
-67
@@ -1,68 +1,68 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-01/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-01/hyper-schema#",
|
||||
|
||||
"properties" : {
|
||||
"links" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "http://json-schema.org/draft-01/links#"},
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"fragmentResolution" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"default" : "dot-delimited"
|
||||
},
|
||||
|
||||
"root" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"readonly" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"pathStart" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"mediaType" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "media-type"
|
||||
},
|
||||
|
||||
"alternate" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true
|
||||
}
|
||||
},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited",
|
||||
"extends" : {"$ref" : "http://json-schema.org/draft-01/schema#"}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-01/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-01/hyper-schema#",
|
||||
|
||||
"properties" : {
|
||||
"links" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "http://json-schema.org/draft-01/links#"},
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"fragmentResolution" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"default" : "dot-delimited"
|
||||
},
|
||||
|
||||
"root" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"readonly" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"pathStart" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"mediaType" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "media-type"
|
||||
},
|
||||
|
||||
"alternate" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true
|
||||
}
|
||||
},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited",
|
||||
"extends" : {"$ref" : "http://json-schema.org/draft-01/schema#"}
|
||||
}
|
||||
+25
-25
@@ -1,26 +1,26 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-01/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-01/json-ref#",
|
||||
|
||||
"items" : {"$ref" : "#"},
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited"
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-01/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-01/json-ref#",
|
||||
|
||||
"items" : {"$ref" : "#"},
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited"
|
||||
}
|
||||
+32
-32
@@ -1,33 +1,33 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-01/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-01/links#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"href" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"rel" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"method" : {
|
||||
"type" : "string",
|
||||
"default" : "GET",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enctype" : {
|
||||
"type" : "string",
|
||||
"requires" : "method",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-01/hyper-schema#"},
|
||||
"optional" : true
|
||||
}
|
||||
}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-01/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-01/links#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"href" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"rel" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"method" : {
|
||||
"type" : "string",
|
||||
"default" : "GET",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enctype" : {
|
||||
"type" : "string",
|
||||
"requires" : "method",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-01/hyper-schema#"},
|
||||
"optional" : true
|
||||
}
|
||||
}
|
||||
}
|
||||
+154
-154
@@ -1,155 +1,155 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-01/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-01/schema#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"type" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"optional" : true,
|
||||
"default" : "any"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"items" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"optional" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"additionalProperties" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"requires" : {
|
||||
"type" : ["string", {"$ref" : "#"}],
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"maximum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "minimum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"maximumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "maximum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"minItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"pattern" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "regex"
|
||||
},
|
||||
|
||||
"minLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enum" : {
|
||||
"type" : "array",
|
||||
"optional" : true,
|
||||
"minItems" : 1
|
||||
},
|
||||
|
||||
"title" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"description" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"format" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"contentEncoding" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"default" : {
|
||||
"type" : "any",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"maxDecimal" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"disallow" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {"type" : "string"},
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"extends" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
}
|
||||
},
|
||||
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-01/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-01/schema#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"type" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"optional" : true,
|
||||
"default" : "any"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"items" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"optional" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"additionalProperties" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"requires" : {
|
||||
"type" : ["string", {"$ref" : "#"}],
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"maximum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "minimum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"maximumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "maximum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"minItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"pattern" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "regex"
|
||||
},
|
||||
|
||||
"minLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enum" : {
|
||||
"type" : "array",
|
||||
"optional" : true,
|
||||
"minItems" : 1
|
||||
},
|
||||
|
||||
"title" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"description" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"format" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"contentEncoding" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"default" : {
|
||||
"type" : "any",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"maxDecimal" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"disallow" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {"type" : "string"},
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"extends" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
}
|
||||
},
|
||||
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
}
|
||||
+67
-67
@@ -1,68 +1,68 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-02/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-02/hyper-schema#",
|
||||
|
||||
"properties" : {
|
||||
"links" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "http://json-schema.org/draft-02/links#"},
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"fragmentResolution" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"default" : "slash-delimited"
|
||||
},
|
||||
|
||||
"root" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"readonly" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"pathStart" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"mediaType" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "media-type"
|
||||
},
|
||||
|
||||
"alternate" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true
|
||||
}
|
||||
},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "slash-delimited",
|
||||
"extends" : {"$ref" : "http://json-schema.org/draft-02/schema#"}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-02/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-02/hyper-schema#",
|
||||
|
||||
"properties" : {
|
||||
"links" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "http://json-schema.org/draft-02/links#"},
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"fragmentResolution" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"default" : "slash-delimited"
|
||||
},
|
||||
|
||||
"root" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"readonly" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"pathStart" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"mediaType" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "media-type"
|
||||
},
|
||||
|
||||
"alternate" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true
|
||||
}
|
||||
},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "slash-delimited",
|
||||
"extends" : {"$ref" : "http://json-schema.org/draft-02/schema#"}
|
||||
}
|
||||
+25
-25
@@ -1,26 +1,26 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-02/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-02/json-ref#",
|
||||
|
||||
"items" : {"$ref" : "#"},
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited"
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-02/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-02/json-ref#",
|
||||
|
||||
"items" : {"$ref" : "#"},
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited"
|
||||
}
|
||||
+34
-34
@@ -1,35 +1,35 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-02/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-02/links#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"href" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"rel" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"targetSchema" : {"$ref" : "http://json-schema.org/draft-02/hyper-schema#"},
|
||||
|
||||
"method" : {
|
||||
"type" : "string",
|
||||
"default" : "GET",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enctype" : {
|
||||
"type" : "string",
|
||||
"requires" : "method",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-02/hyper-schema#"},
|
||||
"optional" : true
|
||||
}
|
||||
}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-02/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-02/links#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"href" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"rel" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"targetSchema" : {"$ref" : "http://json-schema.org/draft-02/hyper-schema#"},
|
||||
|
||||
"method" : {
|
||||
"type" : "string",
|
||||
"default" : "GET",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enctype" : {
|
||||
"type" : "string",
|
||||
"requires" : "method",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-02/hyper-schema#"},
|
||||
"optional" : true
|
||||
}
|
||||
}
|
||||
}
|
||||
+165
-165
@@ -1,166 +1,166 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-02/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-02/schema#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"type" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"optional" : true,
|
||||
"uniqueItems" : true,
|
||||
"default" : "any"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"items" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"optional" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"additionalProperties" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"requires" : {
|
||||
"type" : ["string", {"$ref" : "#"}],
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"maximum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "minimum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"maximumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "maximum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"minItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"uniqueItems" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"pattern" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "regex"
|
||||
},
|
||||
|
||||
"minLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enum" : {
|
||||
"type" : "array",
|
||||
"optional" : true,
|
||||
"minItems" : 1,
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"title" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"description" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"format" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"contentEncoding" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"default" : {
|
||||
"type" : "any",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"divisibleBy" : {
|
||||
"type" : "number",
|
||||
"minimum" : 0,
|
||||
"minimumCanEqual" : false,
|
||||
"optional" : true,
|
||||
"default" : 1
|
||||
},
|
||||
|
||||
"disallow" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {"type" : "string"},
|
||||
"optional" : true,
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"extends" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
}
|
||||
},
|
||||
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-02/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-02/schema#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"type" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"optional" : true,
|
||||
"uniqueItems" : true,
|
||||
"default" : "any"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"items" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"optional" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"additionalProperties" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"requires" : {
|
||||
"type" : ["string", {"$ref" : "#"}],
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"maximum" : {
|
||||
"type" : "number",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"minimumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "minimum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"maximumCanEqual" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"requires" : "maximum",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"minItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxItems" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"uniqueItems" : {
|
||||
"type" : "boolean",
|
||||
"optional" : true,
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"pattern" : {
|
||||
"type" : "string",
|
||||
"optional" : true,
|
||||
"format" : "regex"
|
||||
},
|
||||
|
||||
"minLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true,
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxLength" : {
|
||||
"type" : "integer",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"enum" : {
|
||||
"type" : "array",
|
||||
"optional" : true,
|
||||
"minItems" : 1,
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"title" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"description" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"format" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"contentEncoding" : {
|
||||
"type" : "string",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"default" : {
|
||||
"type" : "any",
|
||||
"optional" : true
|
||||
},
|
||||
|
||||
"divisibleBy" : {
|
||||
"type" : "number",
|
||||
"minimum" : 0,
|
||||
"minimumCanEqual" : false,
|
||||
"optional" : true,
|
||||
"default" : 1
|
||||
},
|
||||
|
||||
"disallow" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {"type" : "string"},
|
||||
"optional" : true,
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"extends" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
}
|
||||
},
|
||||
|
||||
"optional" : true,
|
||||
"default" : {}
|
||||
}
|
||||
+19
-19
@@ -1,20 +1,20 @@
|
||||
{
|
||||
"description" : "An Address following the convention of http://microformats.org/wiki/hcard",
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"post-office-box" : { "type" : "string" },
|
||||
"extended-address" : { "type" : "string" },
|
||||
"street-address" : { "type":"string" },
|
||||
"locality" : { "type" : "string", "required" : true },
|
||||
"region" : { "type" : "string", "required" : true },
|
||||
"postal-code" : { "type" : "string" },
|
||||
"country-name" : { "type" : "string", "required" : true }
|
||||
},
|
||||
"dependencies" : {
|
||||
"post-office-box" : "street-address",
|
||||
"extended-address" : "street-address",
|
||||
"street-address" : "region",
|
||||
"locality" : "region",
|
||||
"region" : "country-name"
|
||||
}
|
||||
{
|
||||
"description" : "An Address following the convention of http://microformats.org/wiki/hcard",
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"post-office-box" : { "type" : "string" },
|
||||
"extended-address" : { "type" : "string" },
|
||||
"street-address" : { "type":"string" },
|
||||
"locality" : { "type" : "string", "required" : true },
|
||||
"region" : { "type" : "string", "required" : true },
|
||||
"postal-code" : { "type" : "string" },
|
||||
"country-name" : { "type" : "string", "required" : true }
|
||||
},
|
||||
"dependencies" : {
|
||||
"post-office-box" : "street-address",
|
||||
"extended-address" : "street-address",
|
||||
"street-address" : "region",
|
||||
"locality" : "region",
|
||||
"region" : "country-name"
|
||||
}
|
||||
}
|
||||
+53
-49
@@ -1,49 +1,53 @@
|
||||
{
|
||||
"description" : "A representation of an event",
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"dtstart" : {
|
||||
"format" : "date-time",
|
||||
"type" : "string",
|
||||
"description" : "Event starting time",
|
||||
"required":true
|
||||
},
|
||||
"summary" : {
|
||||
"type":"string",
|
||||
"required":true
|
||||
},
|
||||
"location" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"url" : {
|
||||
"type" : "string",
|
||||
"format" : "url"
|
||||
},
|
||||
"dtend" : {
|
||||
"format" : "date-time",
|
||||
"type" : "string",
|
||||
"description" : "Event ending time"
|
||||
},
|
||||
"duration" : {
|
||||
"format" : "date",
|
||||
"type" : "string",
|
||||
"description" : "Event duration"
|
||||
},
|
||||
"rdate" : {
|
||||
"format" : "date-time",
|
||||
"type" : "string",
|
||||
"description" : "Recurrence date"
|
||||
},
|
||||
"rrule" : {
|
||||
"type" : "string",
|
||||
"description" : "Recurrence rule"
|
||||
},
|
||||
"category" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"description" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"geo" : { "$ref" : "http://json-schema.org/draft-03/geo" }
|
||||
}
|
||||
}
|
||||
{
|
||||
"description" : "A representation of an event",
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"dtstart" : {
|
||||
"format" : "date-time",
|
||||
"type" : "string",
|
||||
"description" : "Event starting time",
|
||||
"required":true
|
||||
},
|
||||
"summary" : {
|
||||
"type":"string",
|
||||
"required":true
|
||||
},
|
||||
"location" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"url" : {
|
||||
"type" : "string",
|
||||
"format" : "url"
|
||||
},
|
||||
"dtend" : {
|
||||
"format" : "date-time",
|
||||
"type" : "string",
|
||||
"description" : "Event ending time"
|
||||
},
|
||||
"duration" : {
|
||||
"format" : "date",
|
||||
"type" : "string",
|
||||
"description" : "Event duration"
|
||||
},
|
||||
"rdate" : {
|
||||
"format" : "date-time",
|
||||
"type" : "string",
|
||||
"description" : "Recurrence date"
|
||||
},
|
||||
"rrule" : {
|
||||
"type" : "string",
|
||||
"description" : "Recurrence rule"
|
||||
},
|
||||
"category" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"description" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"geo" : { "$ref" : "http://json-schema.org/draft-03/geo" }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+104
-104
@@ -1,105 +1,105 @@
|
||||
{
|
||||
"description":"A representation of a person, company, organization, or place",
|
||||
"type":"object",
|
||||
"properties":{
|
||||
"fn":{
|
||||
"description":"Formatted Name",
|
||||
"type":"string"
|
||||
},
|
||||
"familyName":{
|
||||
"type":"string",
|
||||
"required":true
|
||||
},
|
||||
"givenName":{
|
||||
"type":"string",
|
||||
"required":true
|
||||
},
|
||||
"additionalName":{
|
||||
"type":"array",
|
||||
"items":{
|
||||
"type":"string"
|
||||
}
|
||||
},
|
||||
"honorificPrefix":{
|
||||
"type":"array",
|
||||
"items":{
|
||||
"type":"string"
|
||||
}
|
||||
},
|
||||
"honorificSuffix":{
|
||||
"type":"array",
|
||||
"items":{
|
||||
"type":"string"
|
||||
}
|
||||
},
|
||||
"nickname":{
|
||||
"type":"string"
|
||||
},
|
||||
"url":{
|
||||
"type":"string",
|
||||
"format":"url"
|
||||
},
|
||||
"email":{
|
||||
"type":"object",
|
||||
"properties":{
|
||||
"type":{
|
||||
"type":"string"
|
||||
},
|
||||
"value":{
|
||||
"type":"string",
|
||||
"format":"email"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tel":{
|
||||
"type":"object",
|
||||
"properties":{
|
||||
"type":{
|
||||
"type":"string"
|
||||
},
|
||||
"value":{
|
||||
"type":"string",
|
||||
"format":"phone"
|
||||
}
|
||||
}
|
||||
},
|
||||
"adr":{"$ref" : "http://json-schema.org/address"},
|
||||
"geo":{"$ref" : "http://json-schema.org/geo"},
|
||||
"tz":{
|
||||
"type":"string"
|
||||
},
|
||||
"photo":{
|
||||
"format":"image",
|
||||
"type":"string"
|
||||
},
|
||||
"logo":{
|
||||
"format":"image",
|
||||
"type":"string"
|
||||
},
|
||||
"sound":{
|
||||
"format":"attachment",
|
||||
"type":"string"
|
||||
},
|
||||
"bday":{
|
||||
"type":"string",
|
||||
"format":"date"
|
||||
},
|
||||
"title":{
|
||||
"type":"string"
|
||||
},
|
||||
"role":{
|
||||
"type":"string"
|
||||
},
|
||||
"org":{
|
||||
"type":"object",
|
||||
"properties":{
|
||||
"organizationName":{
|
||||
"type":"string"
|
||||
},
|
||||
"organizationUnit":{
|
||||
"type":"string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"description":"A representation of a person, company, organization, or place",
|
||||
"type":"object",
|
||||
"properties":{
|
||||
"fn":{
|
||||
"description":"Formatted Name",
|
||||
"type":"string"
|
||||
},
|
||||
"familyName":{
|
||||
"type":"string",
|
||||
"required":true
|
||||
},
|
||||
"givenName":{
|
||||
"type":"string",
|
||||
"required":true
|
||||
},
|
||||
"additionalName":{
|
||||
"type":"array",
|
||||
"items":{
|
||||
"type":"string"
|
||||
}
|
||||
},
|
||||
"honorificPrefix":{
|
||||
"type":"array",
|
||||
"items":{
|
||||
"type":"string"
|
||||
}
|
||||
},
|
||||
"honorificSuffix":{
|
||||
"type":"array",
|
||||
"items":{
|
||||
"type":"string"
|
||||
}
|
||||
},
|
||||
"nickname":{
|
||||
"type":"string"
|
||||
},
|
||||
"url":{
|
||||
"type":"string",
|
||||
"format":"url"
|
||||
},
|
||||
"email":{
|
||||
"type":"object",
|
||||
"properties":{
|
||||
"type":{
|
||||
"type":"string"
|
||||
},
|
||||
"value":{
|
||||
"type":"string",
|
||||
"format":"email"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tel":{
|
||||
"type":"object",
|
||||
"properties":{
|
||||
"type":{
|
||||
"type":"string"
|
||||
},
|
||||
"value":{
|
||||
"type":"string",
|
||||
"format":"phone"
|
||||
}
|
||||
}
|
||||
},
|
||||
"adr":{"$ref" : "http://json-schema.org/address"},
|
||||
"geo":{"$ref" : "http://json-schema.org/geo"},
|
||||
"tz":{
|
||||
"type":"string"
|
||||
},
|
||||
"photo":{
|
||||
"format":"image",
|
||||
"type":"string"
|
||||
},
|
||||
"logo":{
|
||||
"format":"image",
|
||||
"type":"string"
|
||||
},
|
||||
"sound":{
|
||||
"format":"attachment",
|
||||
"type":"string"
|
||||
},
|
||||
"bday":{
|
||||
"type":"string",
|
||||
"format":"date"
|
||||
},
|
||||
"title":{
|
||||
"type":"string"
|
||||
},
|
||||
"role":{
|
||||
"type":"string"
|
||||
},
|
||||
"org":{
|
||||
"type":"object",
|
||||
"properties":{
|
||||
"organizationName":{
|
||||
"type":"string"
|
||||
},
|
||||
"organizationUnit":{
|
||||
"type":"string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"description" : "A geographical coordinate",
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"latitude" : { "type" : "number" },
|
||||
"longitude" : { "type" : "number" }
|
||||
}
|
||||
{
|
||||
"description" : "A geographical coordinate",
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"latitude" : { "type" : "number" },
|
||||
"longitude" : { "type" : "number" }
|
||||
}
|
||||
}
|
||||
+23
-23
@@ -1,23 +1,23 @@
|
||||
{
|
||||
"extends":"http://json-schema.org/hyper-schema",
|
||||
"description":"A schema for schema interface definitions that describe programmatic class structures using JSON schema syntax",
|
||||
"properties":{
|
||||
"methods":{
|
||||
"type":"object",
|
||||
"description":"This defines the set of methods available to the class instances",
|
||||
"additionalProperties":{
|
||||
"type":"object",
|
||||
"description":"The definition of the method",
|
||||
"properties":{
|
||||
"parameters":{
|
||||
"type":"array",
|
||||
"description":"The set of parameters that should be passed to the method when it is called",
|
||||
"items":{"$ref":"#"},
|
||||
"required": true
|
||||
},
|
||||
"returns":{"$ref":"#"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"extends":"http://json-schema.org/hyper-schema",
|
||||
"description":"A schema for schema interface definitions that describe programmatic class structures using JSON schema syntax",
|
||||
"properties":{
|
||||
"methods":{
|
||||
"type":"object",
|
||||
"description":"This defines the set of methods available to the class instances",
|
||||
"additionalProperties":{
|
||||
"type":"object",
|
||||
"description":"The definition of the method",
|
||||
"properties":{
|
||||
"parameters":{
|
||||
"type":"array",
|
||||
"description":"The set of parameters that should be passed to the method when it is called",
|
||||
"items":{"$ref":"#"},
|
||||
"required": true
|
||||
},
|
||||
"returns":{"$ref":"#"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+60
-60
@@ -1,60 +1,60 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-03/hyper-schema#",
|
||||
"extends" : {"$ref" : "http://json-schema.org/draft-03/schema#"},
|
||||
"id" : "http://json-schema.org/draft-03/hyper-schema#",
|
||||
|
||||
"properties" : {
|
||||
"links" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "http://json-schema.org/draft-03/links#"}
|
||||
},
|
||||
|
||||
"fragmentResolution" : {
|
||||
"type" : "string",
|
||||
"default" : "slash-delimited"
|
||||
},
|
||||
|
||||
"root" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"readonly" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"contentEncoding" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"pathStart" : {
|
||||
"type" : "string",
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"mediaType" : {
|
||||
"type" : "string",
|
||||
"format" : "media-type"
|
||||
}
|
||||
},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "slash-delimited"
|
||||
}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-03/hyper-schema#",
|
||||
"extends" : {"$ref" : "http://json-schema.org/draft-03/schema#"},
|
||||
"id" : "http://json-schema.org/draft-03/hyper-schema#",
|
||||
|
||||
"properties" : {
|
||||
"links" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "http://json-schema.org/draft-03/links#"}
|
||||
},
|
||||
|
||||
"fragmentResolution" : {
|
||||
"type" : "string",
|
||||
"default" : "slash-delimited"
|
||||
},
|
||||
|
||||
"root" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"readonly" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"contentEncoding" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"pathStart" : {
|
||||
"type" : "string",
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"mediaType" : {
|
||||
"type" : "string",
|
||||
"format" : "media-type"
|
||||
}
|
||||
},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "slash-delimited"
|
||||
}
|
||||
+25
-25
@@ -1,26 +1,26 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-03/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-03/json-ref#",
|
||||
|
||||
"additionalItems" : {"$ref" : "#"},
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited"
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-03/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-03/json-ref#",
|
||||
|
||||
"additionalItems" : {"$ref" : "#"},
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "dot-delimited"
|
||||
}
|
||||
+34
-34
@@ -1,35 +1,35 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-03/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-03/links#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"href" : {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"format" : "link-description-object-template"
|
||||
},
|
||||
|
||||
"rel" : {
|
||||
"type" : "string",
|
||||
"required" : true
|
||||
},
|
||||
|
||||
"targetSchema" : {"$ref" : "http://json-schema.org/draft-03/hyper-schema#"},
|
||||
|
||||
"method" : {
|
||||
"type" : "string",
|
||||
"default" : "GET"
|
||||
},
|
||||
|
||||
"enctype" : {
|
||||
"type" : "string",
|
||||
"requires" : "method"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-03/hyper-schema#"}
|
||||
}
|
||||
}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-03/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-03/links#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"href" : {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"format" : "link-description-object-template"
|
||||
},
|
||||
|
||||
"rel" : {
|
||||
"type" : "string",
|
||||
"required" : true
|
||||
},
|
||||
|
||||
"targetSchema" : {"$ref" : "http://json-schema.org/draft-03/hyper-schema#"},
|
||||
|
||||
"method" : {
|
||||
"type" : "string",
|
||||
"default" : "GET"
|
||||
},
|
||||
|
||||
"enctype" : {
|
||||
"type" : "string",
|
||||
"requires" : "method"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-03/hyper-schema#"}
|
||||
}
|
||||
}
|
||||
}
|
||||
+173
-173
@@ -1,174 +1,174 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-03/schema#",
|
||||
"id" : "http://json-schema.org/draft-03/schema#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"type" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"uniqueItems" : true,
|
||||
"default" : "any"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"patternProperties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"additionalProperties" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"items" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"additionalItems" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"required" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"dependencies" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {
|
||||
"type" : ["string", "array", {"$ref" : "#"}],
|
||||
"items" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"minimum" : {
|
||||
"type" : "number"
|
||||
},
|
||||
|
||||
"maximum" : {
|
||||
"type" : "number"
|
||||
},
|
||||
|
||||
"exclusiveMinimum" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"exclusiveMaximum" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"minItems" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxItems" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"uniqueItems" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"pattern" : {
|
||||
"type" : "string",
|
||||
"format" : "regex"
|
||||
},
|
||||
|
||||
"minLength" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxLength" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
|
||||
"enum" : {
|
||||
"type" : "array",
|
||||
"minItems" : 1,
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"default" : {
|
||||
"type" : "any"
|
||||
},
|
||||
|
||||
"title" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"description" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"format" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"divisibleBy" : {
|
||||
"type" : "number",
|
||||
"minimum" : 0,
|
||||
"exclusiveMinimum" : true,
|
||||
"default" : 1
|
||||
},
|
||||
|
||||
"disallow" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"extends" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"id" : {
|
||||
"type" : "string",
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"$ref" : {
|
||||
"type" : "string",
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"$schema" : {
|
||||
"type" : "string",
|
||||
"format" : "uri"
|
||||
}
|
||||
},
|
||||
|
||||
"dependencies" : {
|
||||
"exclusiveMinimum" : "minimum",
|
||||
"exclusiveMaximum" : "maximum"
|
||||
},
|
||||
|
||||
"default" : {}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-03/schema#",
|
||||
"id" : "http://json-schema.org/draft-03/schema#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"type" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"uniqueItems" : true,
|
||||
"default" : "any"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"patternProperties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"additionalProperties" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"items" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"additionalItems" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"required" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"dependencies" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {
|
||||
"type" : ["string", "array", {"$ref" : "#"}],
|
||||
"items" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"minimum" : {
|
||||
"type" : "number"
|
||||
},
|
||||
|
||||
"maximum" : {
|
||||
"type" : "number"
|
||||
},
|
||||
|
||||
"exclusiveMinimum" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"exclusiveMaximum" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"minItems" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxItems" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"uniqueItems" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"pattern" : {
|
||||
"type" : "string",
|
||||
"format" : "regex"
|
||||
},
|
||||
|
||||
"minLength" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxLength" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
|
||||
"enum" : {
|
||||
"type" : "array",
|
||||
"minItems" : 1,
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"default" : {
|
||||
"type" : "any"
|
||||
},
|
||||
|
||||
"title" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"description" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"format" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"divisibleBy" : {
|
||||
"type" : "number",
|
||||
"minimum" : 0,
|
||||
"exclusiveMinimum" : true,
|
||||
"default" : 1
|
||||
},
|
||||
|
||||
"disallow" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"extends" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"id" : {
|
||||
"type" : "string",
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"$ref" : {
|
||||
"type" : "string",
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"$schema" : {
|
||||
"type" : "string",
|
||||
"format" : "uri"
|
||||
}
|
||||
},
|
||||
|
||||
"dependencies" : {
|
||||
"exclusiveMinimum" : "minimum",
|
||||
"exclusiveMaximum" : "maximum"
|
||||
},
|
||||
|
||||
"default" : {}
|
||||
}
|
||||
+60
-60
@@ -1,60 +1,60 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-04/hyper-schema#",
|
||||
"extends" : {"$ref" : "http://json-schema.org/draft-04/schema#"},
|
||||
"id" : "http://json-schema.org/draft-04/hyper-schema#",
|
||||
|
||||
"properties" : {
|
||||
"links" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "http://json-schema.org/draft-04/links#"}
|
||||
},
|
||||
|
||||
"fragmentResolution" : {
|
||||
"type" : "string",
|
||||
"default" : "json-pointer"
|
||||
},
|
||||
|
||||
"root" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"readonly" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"contentEncoding" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"pathStart" : {
|
||||
"type" : "string",
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"mediaType" : {
|
||||
"type" : "string",
|
||||
"format" : "media-type"
|
||||
}
|
||||
},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "json-pointer"
|
||||
}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-04/hyper-schema#",
|
||||
"extends" : {"$ref" : "http://json-schema.org/draft-04/schema#"},
|
||||
"id" : "http://json-schema.org/draft-04/hyper-schema#",
|
||||
|
||||
"properties" : {
|
||||
"links" : {
|
||||
"type" : "array",
|
||||
"items" : {"$ref" : "http://json-schema.org/draft-04/links#"}
|
||||
},
|
||||
|
||||
"fragmentResolution" : {
|
||||
"type" : "string",
|
||||
"default" : "json-pointer"
|
||||
},
|
||||
|
||||
"root" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"readonly" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"contentEncoding" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"pathStart" : {
|
||||
"type" : "string",
|
||||
"format" : "uri"
|
||||
},
|
||||
|
||||
"mediaType" : {
|
||||
"type" : "string",
|
||||
"format" : "media-type"
|
||||
}
|
||||
},
|
||||
|
||||
"links" : [
|
||||
{
|
||||
"href" : "{id}",
|
||||
"rel" : "self"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$ref}",
|
||||
"rel" : "full"
|
||||
},
|
||||
|
||||
{
|
||||
"href" : "{$schema}",
|
||||
"rel" : "describedby"
|
||||
}
|
||||
],
|
||||
|
||||
"fragmentResolution" : "json-pointer"
|
||||
}
|
||||
+40
-40
@@ -1,41 +1,41 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-04/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-04/links#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"rel" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"href" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"template" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"targetSchema" : {"$ref" : "http://json-schema.org/draft-04/hyper-schema#"},
|
||||
|
||||
"method" : {
|
||||
"type" : "string",
|
||||
"default" : "GET"
|
||||
},
|
||||
|
||||
"enctype" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-04/hyper-schema#"}
|
||||
}
|
||||
},
|
||||
|
||||
"required" : ["rel", "href"],
|
||||
|
||||
"dependencies" : {
|
||||
"enctype" : "method"
|
||||
}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-04/hyper-schema#",
|
||||
"id" : "http://json-schema.org/draft-04/links#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"rel" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"href" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"template" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"targetSchema" : {"$ref" : "http://json-schema.org/draft-04/hyper-schema#"},
|
||||
|
||||
"method" : {
|
||||
"type" : "string",
|
||||
"default" : "GET"
|
||||
},
|
||||
|
||||
"enctype" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-04/hyper-schema#"}
|
||||
}
|
||||
},
|
||||
|
||||
"required" : ["rel", "href"],
|
||||
|
||||
"dependencies" : {
|
||||
"enctype" : "method"
|
||||
}
|
||||
}
|
||||
+188
-188
@@ -1,189 +1,189 @@
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-04/schema#",
|
||||
"id" : "http://json-schema.org/draft-04/schema#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"type" : {
|
||||
"type" : [
|
||||
{
|
||||
"id" : "#simple-type",
|
||||
"type" : "string",
|
||||
"enum" : ["object", "array", "string", "number", "boolean", "null", "any"]
|
||||
},
|
||||
"array"
|
||||
],
|
||||
"items" : {
|
||||
"type" : [
|
||||
{"$ref" : "#simple-type"},
|
||||
{"$ref" : "#"}
|
||||
]
|
||||
},
|
||||
"uniqueItems" : true,
|
||||
"default" : "any"
|
||||
},
|
||||
|
||||
"disallow" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"extends" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"enum" : {
|
||||
"type" : "array",
|
||||
"minItems" : 1,
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"minimum" : {
|
||||
"type" : "number"
|
||||
},
|
||||
|
||||
"maximum" : {
|
||||
"type" : "number"
|
||||
},
|
||||
|
||||
"exclusiveMinimum" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"exclusiveMaximum" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"divisibleBy" : {
|
||||
"type" : "number",
|
||||
"minimum" : 0,
|
||||
"exclusiveMinimum" : true,
|
||||
"default" : 1
|
||||
},
|
||||
|
||||
"minLength" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxLength" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
|
||||
"pattern" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"items" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"additionalItems" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"minItems" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxItems" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"uniqueItems" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"patternProperties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"additionalProperties" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"minProperties" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxProperties" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"required" : {
|
||||
"type" : "array",
|
||||
"items" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
|
||||
"dependencies" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {
|
||||
"type" : ["string", "array", {"$ref" : "#"}],
|
||||
"items" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"id" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"$ref" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"$schema" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"title" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"description" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"default" : {
|
||||
"type" : "any"
|
||||
}
|
||||
},
|
||||
|
||||
"dependencies" : {
|
||||
"exclusiveMinimum" : "minimum",
|
||||
"exclusiveMaximum" : "maximum"
|
||||
},
|
||||
|
||||
"default" : {}
|
||||
{
|
||||
"$schema" : "http://json-schema.org/draft-04/schema#",
|
||||
"id" : "http://json-schema.org/draft-04/schema#",
|
||||
"type" : "object",
|
||||
|
||||
"properties" : {
|
||||
"type" : {
|
||||
"type" : [
|
||||
{
|
||||
"id" : "#simple-type",
|
||||
"type" : "string",
|
||||
"enum" : ["object", "array", "string", "number", "boolean", "null", "any"]
|
||||
},
|
||||
"array"
|
||||
],
|
||||
"items" : {
|
||||
"type" : [
|
||||
{"$ref" : "#simple-type"},
|
||||
{"$ref" : "#"}
|
||||
]
|
||||
},
|
||||
"uniqueItems" : true,
|
||||
"default" : "any"
|
||||
},
|
||||
|
||||
"disallow" : {
|
||||
"type" : ["string", "array"],
|
||||
"items" : {
|
||||
"type" : ["string", {"$ref" : "#"}]
|
||||
},
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"extends" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"enum" : {
|
||||
"type" : "array",
|
||||
"minItems" : 1,
|
||||
"uniqueItems" : true
|
||||
},
|
||||
|
||||
"minimum" : {
|
||||
"type" : "number"
|
||||
},
|
||||
|
||||
"maximum" : {
|
||||
"type" : "number"
|
||||
},
|
||||
|
||||
"exclusiveMinimum" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"exclusiveMaximum" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"divisibleBy" : {
|
||||
"type" : "number",
|
||||
"minimum" : 0,
|
||||
"exclusiveMinimum" : true,
|
||||
"default" : 1
|
||||
},
|
||||
|
||||
"minLength" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxLength" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
|
||||
"pattern" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"items" : {
|
||||
"type" : [{"$ref" : "#"}, "array"],
|
||||
"items" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"additionalItems" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"minItems" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxItems" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"uniqueItems" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
|
||||
"properties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"patternProperties" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {"$ref" : "#"},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"additionalProperties" : {
|
||||
"type" : [{"$ref" : "#"}, "boolean"],
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"minProperties" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0,
|
||||
"default" : 0
|
||||
},
|
||||
|
||||
"maxProperties" : {
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
|
||||
"required" : {
|
||||
"type" : "array",
|
||||
"items" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
|
||||
"dependencies" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : {
|
||||
"type" : ["string", "array", {"$ref" : "#"}],
|
||||
"items" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"default" : {}
|
||||
},
|
||||
|
||||
"id" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"$ref" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"$schema" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"title" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"description" : {
|
||||
"type" : "string"
|
||||
},
|
||||
|
||||
"default" : {
|
||||
"type" : "any"
|
||||
}
|
||||
},
|
||||
|
||||
"dependencies" : {
|
||||
"exclusiveMinimum" : "minimum",
|
||||
"exclusiveMaximum" : "maximum"
|
||||
},
|
||||
|
||||
"default" : {}
|
||||
}
|
||||
+1120
-1120
File diff suppressed because it is too large.
Load diff
+1072
-1072
File diff suppressed because it is too large.
Load diff
+65
-65
@@ -1,66 +1,66 @@
|
||||
/**
|
||||
* JSON Schema link handler
|
||||
* Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
|
||||
* Licensed under the MIT (MIT-LICENSE.txt) license.
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define([], function () {
|
||||
return factory();
|
||||
});
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Browser globals
|
||||
root.jsonSchemaLinks = factory();
|
||||
}
|
||||
}(this, function () {// setup primitive classes to be JSON Schema types
|
||||
var exports = {};
|
||||
exports.cacheLinks = true;
|
||||
exports.getLink = function(relation, instance, schema){
|
||||
// gets the URI of the link for the given relation based on the instance and schema
|
||||
// for example:
|
||||
// getLink(
|
||||
// "brother",
|
||||
// {"brother_id":33},
|
||||
// {links:[{rel:"brother", href:"Brother/{brother_id}"}]}) ->
|
||||
// "Brother/33"
|
||||
var links = schema.__linkTemplates;
|
||||
if(!links){
|
||||
links = {};
|
||||
var schemaLinks = schema.links;
|
||||
if(schemaLinks && schemaLinks instanceof Array){
|
||||
schemaLinks.forEach(function(link){
|
||||
/* // TODO: allow for multiple same-name relations
|
||||
if(links[link.rel]){
|
||||
if(!(links[link.rel] instanceof Array)){
|
||||
links[link.rel] = [links[link.rel]];
|
||||
}
|
||||
}*/
|
||||
links[link.rel] = link.href;
|
||||
});
|
||||
}
|
||||
if(exports.cacheLinks){
|
||||
schema.__linkTemplates = links;
|
||||
}
|
||||
}
|
||||
var linkTemplate = links[relation];
|
||||
return linkTemplate && exports.substitute(linkTemplate, instance);
|
||||
};
|
||||
|
||||
exports.substitute = function(linkTemplate, instance){
|
||||
return linkTemplate.replace(/\{([^\}]*)\}/g, function(t, property){
|
||||
var value = instance[decodeURIComponent(property)];
|
||||
if(value instanceof Array){
|
||||
// the value is an array, it should produce a URI like /Table/(4,5,8) and store.get() should handle that as an array of values
|
||||
return '(' + value.join(',') + ')';
|
||||
}
|
||||
return value;
|
||||
});
|
||||
};
|
||||
return exports;
|
||||
/**
|
||||
* JSON Schema link handler
|
||||
* Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
|
||||
* Licensed under the MIT (MIT-LICENSE.txt) license.
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define([], function () {
|
||||
return factory();
|
||||
});
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Browser globals
|
||||
root.jsonSchemaLinks = factory();
|
||||
}
|
||||
}(this, function () {// setup primitive classes to be JSON Schema types
|
||||
var exports = {};
|
||||
exports.cacheLinks = true;
|
||||
exports.getLink = function(relation, instance, schema){
|
||||
// gets the URI of the link for the given relation based on the instance and schema
|
||||
// for example:
|
||||
// getLink(
|
||||
// "brother",
|
||||
// {"brother_id":33},
|
||||
// {links:[{rel:"brother", href:"Brother/{brother_id}"}]}) ->
|
||||
// "Brother/33"
|
||||
var links = schema.__linkTemplates;
|
||||
if(!links){
|
||||
links = {};
|
||||
var schemaLinks = schema.links;
|
||||
if(schemaLinks && schemaLinks instanceof Array){
|
||||
schemaLinks.forEach(function(link){
|
||||
/* // TODO: allow for multiple same-name relations
|
||||
if(links[link.rel]){
|
||||
if(!(links[link.rel] instanceof Array)){
|
||||
links[link.rel] = [links[link.rel]];
|
||||
}
|
||||
}*/
|
||||
links[link.rel] = link.href;
|
||||
});
|
||||
}
|
||||
if(exports.cacheLinks){
|
||||
schema.__linkTemplates = links;
|
||||
}
|
||||
}
|
||||
var linkTemplate = links[relation];
|
||||
return linkTemplate && exports.substitute(linkTemplate, instance);
|
||||
};
|
||||
|
||||
exports.substitute = function(linkTemplate, instance){
|
||||
return linkTemplate.replace(/\{([^\}]*)\}/g, function(t, property){
|
||||
var value = instance[decodeURIComponent(property)];
|
||||
if(value instanceof Array){
|
||||
// the value is an array, it should produce a URI like /Table/(4,5,8) and store.get() should handle that as an array of values
|
||||
return '(' + value.join(',') + ')';
|
||||
}
|
||||
return value;
|
||||
});
|
||||
};
|
||||
return exports;
|
||||
}));
|
||||
+273
-273
@@ -1,273 +1,273 @@
|
||||
/**
|
||||
* JSONSchema Validator - Validates JavaScript objects using JSON Schemas
|
||||
* (http://www.json.com/json-schema-proposal/)
|
||||
*
|
||||
* Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
|
||||
* Licensed under the MIT (MIT-LICENSE.txt) license.
|
||||
To use the validator call the validate function with an instance object and an optional schema object.
|
||||
If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
|
||||
that schema will be used to validate and the schema parameter is not necessary (if both exist,
|
||||
both validations will occur).
|
||||
The validate method will return an array of validation errors. If there are no errors, then an
|
||||
empty list will be returned. A validation error will have two properties:
|
||||
"property" which indicates which property had the error
|
||||
"message" which indicates what the error was
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define([], function () {
|
||||
return factory();
|
||||
});
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Browser globals
|
||||
root.jsonSchema = factory();
|
||||
}
|
||||
}(this, function () {// setup primitive classes to be JSON Schema types
|
||||
var exports = validate
|
||||
exports.Integer = {type:"integer"};
|
||||
var primitiveConstructors = {
|
||||
String: String,
|
||||
Boolean: Boolean,
|
||||
Number: Number,
|
||||
Object: Object,
|
||||
Array: Array,
|
||||
Date: Date
|
||||
}
|
||||
exports.validate = validate;
|
||||
function validate(/*Any*/instance,/*Object*/schema) {
|
||||
// Summary:
|
||||
// To use the validator call JSONSchema.validate with an instance object and an optional schema object.
|
||||
// If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
|
||||
// that schema will be used to validate and the schema parameter is not necessary (if both exist,
|
||||
// both validations will occur).
|
||||
// The validate method will return an object with two properties:
|
||||
// valid: A boolean indicating if the instance is valid by the schema
|
||||
// errors: An array of validation errors. If there are no errors, then an
|
||||
// empty list will be returned. A validation error will have two properties:
|
||||
// property: which indicates which property had the error
|
||||
// message: which indicates what the error was
|
||||
//
|
||||
return validate(instance, schema, {changing: false});//, coerce: false, existingOnly: false});
|
||||
};
|
||||
exports.checkPropertyChange = function(/*Any*/value,/*Object*/schema, /*String*/property) {
|
||||
// Summary:
|
||||
// The checkPropertyChange method will check to see if an value can legally be in property with the given schema
|
||||
// This is slightly different than the validate method in that it will fail if the schema is readonly and it will
|
||||
// not check for self-validation, it is assumed that the passed in value is already internally valid.
|
||||
// The checkPropertyChange method will return the same object type as validate, see JSONSchema.validate for
|
||||
// information.
|
||||
//
|
||||
return validate(value, schema, {changing: property || "property"});
|
||||
};
|
||||
var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*Object*/options) {
|
||||
|
||||
if (!options) options = {};
|
||||
var _changing = options.changing;
|
||||
|
||||
function getType(schema){
|
||||
return schema.type || (primitiveConstructors[schema.name] == schema && schema.name.toLowerCase());
|
||||
}
|
||||
var errors = [];
|
||||
// validate a value against a property definition
|
||||
function checkProp(value, schema, path,i){
|
||||
|
||||
var l;
|
||||
path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i;
|
||||
function addError(message){
|
||||
errors.push({property:path,message:message});
|
||||
}
|
||||
|
||||
if((typeof schema != 'object' || schema instanceof Array) && (path || typeof schema != 'function') && !(schema && getType(schema))){
|
||||
if(typeof schema == 'function'){
|
||||
if(!(value instanceof schema)){
|
||||
addError("is not an instance of the class/constructor " + schema.name);
|
||||
}
|
||||
}else if(schema){
|
||||
addError("Invalid schema/property definition " + schema);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if(_changing && schema.readonly){
|
||||
addError("is a readonly field, it can not be changed");
|
||||
}
|
||||
if(schema['extends']){ // if it extends another schema, it must pass that schema as well
|
||||
checkProp(value,schema['extends'],path,i);
|
||||
}
|
||||
// validate a value against a type definition
|
||||
function checkType(type,value){
|
||||
if(type){
|
||||
if(typeof type == 'string' && type != 'any' &&
|
||||
(type == 'null' ? value !== null : typeof value != type) &&
|
||||
!(value instanceof Array && type == 'array') &&
|
||||
!(value instanceof Date && type == 'date') &&
|
||||
!(type == 'integer' && value%1===0)){
|
||||
return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}];
|
||||
}
|
||||
if(type instanceof Array){
|
||||
var unionErrors=[];
|
||||
for(var j = 0; j < type.length; j++){ // a union type
|
||||
if(!(unionErrors=checkType(type[j],value)).length){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(unionErrors.length){
|
||||
return unionErrors;
|
||||
}
|
||||
}else if(typeof type == 'object'){
|
||||
var priorErrors = errors;
|
||||
errors = [];
|
||||
checkProp(value,type,path);
|
||||
var theseErrors = errors;
|
||||
errors = priorErrors;
|
||||
return theseErrors;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
if(value === undefined){
|
||||
if(schema.required){
|
||||
addError("is missing and it is required");
|
||||
}
|
||||
}else{
|
||||
errors = errors.concat(checkType(getType(schema),value));
|
||||
if(schema.disallow && !checkType(schema.disallow,value).length){
|
||||
addError(" disallowed value was matched");
|
||||
}
|
||||
if(value !== null){
|
||||
if(value instanceof Array){
|
||||
if(schema.items){
|
||||
var itemsIsArray = schema.items instanceof Array;
|
||||
var propDef = schema.items;
|
||||
for (i = 0, l = value.length; i < l; i += 1) {
|
||||
if (itemsIsArray)
|
||||
propDef = schema.items[i];
|
||||
if (options.coerce)
|
||||
value[i] = options.coerce(value[i], propDef);
|
||||
errors.concat(checkProp(value[i],propDef,path,i));
|
||||
}
|
||||
}
|
||||
if(schema.minItems && value.length < schema.minItems){
|
||||
addError("There must be a minimum of " + schema.minItems + " in the array");
|
||||
}
|
||||
if(schema.maxItems && value.length > schema.maxItems){
|
||||
addError("There must be a maximum of " + schema.maxItems + " in the array");
|
||||
}
|
||||
}else if(schema.properties || schema.additionalProperties){
|
||||
errors.concat(checkObj(value, schema.properties, path, schema.additionalProperties));
|
||||
}
|
||||
if(schema.pattern && typeof value == 'string' && !value.match(schema.pattern)){
|
||||
addError("does not match the regex pattern " + schema.pattern);
|
||||
}
|
||||
if(schema.maxLength && typeof value == 'string' && value.length > schema.maxLength){
|
||||
addError("may only be " + schema.maxLength + " characters long");
|
||||
}
|
||||
if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){
|
||||
addError("must be at least " + schema.minLength + " characters long");
|
||||
}
|
||||
if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum &&
|
||||
schema.minimum > value){
|
||||
addError("must have a minimum value of " + schema.minimum);
|
||||
}
|
||||
if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum &&
|
||||
schema.maximum < value){
|
||||
addError("must have a maximum value of " + schema.maximum);
|
||||
}
|
||||
if(schema['enum']){
|
||||
var enumer = schema['enum'];
|
||||
l = enumer.length;
|
||||
var found;
|
||||
for(var j = 0; j < l; j++){
|
||||
if(enumer[j]===value){
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found){
|
||||
addError("does not have a value in the enumeration " + enumer.join(", "));
|
||||
}
|
||||
}
|
||||
if(typeof schema.maxDecimal == 'number' &&
|
||||
(value.toString().match(new RegExp("\\.[0-9]{" + (schema.maxDecimal + 1) + ",}")))){
|
||||
addError("may only have " + schema.maxDecimal + " digits of decimal places");
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// validate an object against a schema
|
||||
function checkObj(instance,objTypeDef,path,additionalProp){
|
||||
|
||||
if(typeof objTypeDef =='object'){
|
||||
if(typeof instance != 'object' || instance instanceof Array){
|
||||
errors.push({property:path,message:"an object is required"});
|
||||
}
|
||||
|
||||
for(var i in objTypeDef){
|
||||
if(objTypeDef.hasOwnProperty(i)){
|
||||
var value = instance[i];
|
||||
// skip _not_ specified properties
|
||||
if (value === undefined && options.existingOnly) continue;
|
||||
var propDef = objTypeDef[i];
|
||||
// set default
|
||||
if(value === undefined && propDef["default"]){
|
||||
value = instance[i] = propDef["default"];
|
||||
}
|
||||
if(options.coerce && i in instance){
|
||||
value = instance[i] = options.coerce(value, propDef);
|
||||
}
|
||||
checkProp(value,propDef,path,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i in instance){
|
||||
if(instance.hasOwnProperty(i) && !(i.charAt(0) == '_' && i.charAt(1) == '_') && objTypeDef && !objTypeDef[i] && additionalProp===false){
|
||||
if (options.filter) {
|
||||
delete instance[i];
|
||||
continue;
|
||||
} else {
|
||||
errors.push({property:path,message:(typeof value) + "The property " + i +
|
||||
" is not defined in the schema and the schema does not allow additional properties"});
|
||||
}
|
||||
}
|
||||
var requires = objTypeDef && objTypeDef[i] && objTypeDef[i].requires;
|
||||
if(requires && !(requires in instance)){
|
||||
errors.push({property:path,message:"the presence of the property " + i + " requires that " + requires + " also be present"});
|
||||
}
|
||||
value = instance[i];
|
||||
if(additionalProp && (!(objTypeDef && typeof objTypeDef == 'object') || !(i in objTypeDef))){
|
||||
if(options.coerce){
|
||||
value = instance[i] = options.coerce(value, additionalProp);
|
||||
}
|
||||
checkProp(value,additionalProp,path,i);
|
||||
}
|
||||
if(!_changing && value && value.$schema){
|
||||
errors = errors.concat(checkProp(value,value.$schema,path,i));
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
if(schema){
|
||||
checkProp(instance,schema,'',_changing || '');
|
||||
}
|
||||
if(!_changing && instance && instance.$schema){
|
||||
checkProp(instance,instance.$schema,'','');
|
||||
}
|
||||
return {valid:!errors.length,errors:errors};
|
||||
};
|
||||
exports.mustBeValid = function(result){
|
||||
// summary:
|
||||
// This checks to ensure that the result is valid and will throw an appropriate error message if it is not
|
||||
// result: the result returned from checkPropertyChange or validate
|
||||
if(!result.valid){
|
||||
throw new TypeError(result.errors.map(function(error){return "for property " + error.property + ': ' + error.message;}).join(", \n"));
|
||||
}
|
||||
}
|
||||
|
||||
return exports;
|
||||
}));
|
||||
/**
|
||||
* JSONSchema Validator - Validates JavaScript objects using JSON Schemas
|
||||
* (http://www.json.com/json-schema-proposal/)
|
||||
*
|
||||
* Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
|
||||
* Licensed under the MIT (MIT-LICENSE.txt) license.
|
||||
To use the validator call the validate function with an instance object and an optional schema object.
|
||||
If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
|
||||
that schema will be used to validate and the schema parameter is not necessary (if both exist,
|
||||
both validations will occur).
|
||||
The validate method will return an array of validation errors. If there are no errors, then an
|
||||
empty list will be returned. A validation error will have two properties:
|
||||
"property" which indicates which property had the error
|
||||
"message" which indicates what the error was
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define([], function () {
|
||||
return factory();
|
||||
});
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Browser globals
|
||||
root.jsonSchema = factory();
|
||||
}
|
||||
}(this, function () {// setup primitive classes to be JSON Schema types
|
||||
var exports = validate
|
||||
exports.Integer = {type:"integer"};
|
||||
var primitiveConstructors = {
|
||||
String: String,
|
||||
Boolean: Boolean,
|
||||
Number: Number,
|
||||
Object: Object,
|
||||
Array: Array,
|
||||
Date: Date
|
||||
}
|
||||
exports.validate = validate;
|
||||
function validate(/*Any*/instance,/*Object*/schema) {
|
||||
// Summary:
|
||||
// To use the validator call JSONSchema.validate with an instance object and an optional schema object.
|
||||
// If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
|
||||
// that schema will be used to validate and the schema parameter is not necessary (if both exist,
|
||||
// both validations will occur).
|
||||
// The validate method will return an object with two properties:
|
||||
// valid: A boolean indicating if the instance is valid by the schema
|
||||
// errors: An array of validation errors. If there are no errors, then an
|
||||
// empty list will be returned. A validation error will have two properties:
|
||||
// property: which indicates which property had the error
|
||||
// message: which indicates what the error was
|
||||
//
|
||||
return validate(instance, schema, {changing: false});//, coerce: false, existingOnly: false});
|
||||
};
|
||||
exports.checkPropertyChange = function(/*Any*/value,/*Object*/schema, /*String*/property) {
|
||||
// Summary:
|
||||
// The checkPropertyChange method will check to see if an value can legally be in property with the given schema
|
||||
// This is slightly different than the validate method in that it will fail if the schema is readonly and it will
|
||||
// not check for self-validation, it is assumed that the passed in value is already internally valid.
|
||||
// The checkPropertyChange method will return the same object type as validate, see JSONSchema.validate for
|
||||
// information.
|
||||
//
|
||||
return validate(value, schema, {changing: property || "property"});
|
||||
};
|
||||
var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*Object*/options) {
|
||||
|
||||
if (!options) options = {};
|
||||
var _changing = options.changing;
|
||||
|
||||
function getType(schema){
|
||||
return schema.type || (primitiveConstructors[schema.name] == schema && schema.name.toLowerCase());
|
||||
}
|
||||
var errors = [];
|
||||
// validate a value against a property definition
|
||||
function checkProp(value, schema, path,i){
|
||||
|
||||
var l;
|
||||
path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i;
|
||||
function addError(message){
|
||||
errors.push({property:path,message:message});
|
||||
}
|
||||
|
||||
if((typeof schema != 'object' || schema instanceof Array) && (path || typeof schema != 'function') && !(schema && getType(schema))){
|
||||
if(typeof schema == 'function'){
|
||||
if(!(value instanceof schema)){
|
||||
addError("is not an instance of the class/constructor " + schema.name);
|
||||
}
|
||||
}else if(schema){
|
||||
addError("Invalid schema/property definition " + schema);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if(_changing && schema.readonly){
|
||||
addError("is a readonly field, it can not be changed");
|
||||
}
|
||||
if(schema['extends']){ // if it extends another schema, it must pass that schema as well
|
||||
checkProp(value,schema['extends'],path,i);
|
||||
}
|
||||
// validate a value against a type definition
|
||||
function checkType(type,value){
|
||||
if(type){
|
||||
if(typeof type == 'string' && type != 'any' &&
|
||||
(type == 'null' ? value !== null : typeof value != type) &&
|
||||
!(value instanceof Array && type == 'array') &&
|
||||
!(value instanceof Date && type == 'date') &&
|
||||
!(type == 'integer' && value%1===0)){
|
||||
return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}];
|
||||
}
|
||||
if(type instanceof Array){
|
||||
var unionErrors=[];
|
||||
for(var j = 0; j < type.length; j++){ // a union type
|
||||
if(!(unionErrors=checkType(type[j],value)).length){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(unionErrors.length){
|
||||
return unionErrors;
|
||||
}
|
||||
}else if(typeof type == 'object'){
|
||||
var priorErrors = errors;
|
||||
errors = [];
|
||||
checkProp(value,type,path);
|
||||
var theseErrors = errors;
|
||||
errors = priorErrors;
|
||||
return theseErrors;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
if(value === undefined){
|
||||
if(schema.required){
|
||||
addError("is missing and it is required");
|
||||
}
|
||||
}else{
|
||||
errors = errors.concat(checkType(getType(schema),value));
|
||||
if(schema.disallow && !checkType(schema.disallow,value).length){
|
||||
addError(" disallowed value was matched");
|
||||
}
|
||||
if(value !== null){
|
||||
if(value instanceof Array){
|
||||
if(schema.items){
|
||||
var itemsIsArray = schema.items instanceof Array;
|
||||
var propDef = schema.items;
|
||||
for (i = 0, l = value.length; i < l; i += 1) {
|
||||
if (itemsIsArray)
|
||||
propDef = schema.items[i];
|
||||
if (options.coerce)
|
||||
value[i] = options.coerce(value[i], propDef);
|
||||
errors.concat(checkProp(value[i],propDef,path,i));
|
||||
}
|
||||
}
|
||||
if(schema.minItems && value.length < schema.minItems){
|
||||
addError("There must be a minimum of " + schema.minItems + " in the array");
|
||||
}
|
||||
if(schema.maxItems && value.length > schema.maxItems){
|
||||
addError("There must be a maximum of " + schema.maxItems + " in the array");
|
||||
}
|
||||
}else if(schema.properties || schema.additionalProperties){
|
||||
errors.concat(checkObj(value, schema.properties, path, schema.additionalProperties));
|
||||
}
|
||||
if(schema.pattern && typeof value == 'string' && !value.match(schema.pattern)){
|
||||
addError("does not match the regex pattern " + schema.pattern);
|
||||
}
|
||||
if(schema.maxLength && typeof value == 'string' && value.length > schema.maxLength){
|
||||
addError("may only be " + schema.maxLength + " characters long");
|
||||
}
|
||||
if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){
|
||||
addError("must be at least " + schema.minLength + " characters long");
|
||||
}
|
||||
if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum &&
|
||||
schema.minimum > value){
|
||||
addError("must have a minimum value of " + schema.minimum);
|
||||
}
|
||||
if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum &&
|
||||
schema.maximum < value){
|
||||
addError("must have a maximum value of " + schema.maximum);
|
||||
}
|
||||
if(schema['enum']){
|
||||
var enumer = schema['enum'];
|
||||
l = enumer.length;
|
||||
var found;
|
||||
for(var j = 0; j < l; j++){
|
||||
if(enumer[j]===value){
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found){
|
||||
addError("does not have a value in the enumeration " + enumer.join(", "));
|
||||
}
|
||||
}
|
||||
if(typeof schema.maxDecimal == 'number' &&
|
||||
(value.toString().match(new RegExp("\\.[0-9]{" + (schema.maxDecimal + 1) + ",}")))){
|
||||
addError("may only have " + schema.maxDecimal + " digits of decimal places");
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// validate an object against a schema
|
||||
function checkObj(instance,objTypeDef,path,additionalProp){
|
||||
|
||||
if(typeof objTypeDef =='object'){
|
||||
if(typeof instance != 'object' || instance instanceof Array){
|
||||
errors.push({property:path,message:"an object is required"});
|
||||
}
|
||||
|
||||
for(var i in objTypeDef){
|
||||
if(objTypeDef.hasOwnProperty(i)){
|
||||
var value = instance[i];
|
||||
// skip _not_ specified properties
|
||||
if (value === undefined && options.existingOnly) continue;
|
||||
var propDef = objTypeDef[i];
|
||||
// set default
|
||||
if(value === undefined && propDef["default"]){
|
||||
value = instance[i] = propDef["default"];
|
||||
}
|
||||
if(options.coerce && i in instance){
|
||||
value = instance[i] = options.coerce(value, propDef);
|
||||
}
|
||||
checkProp(value,propDef,path,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i in instance){
|
||||
if(instance.hasOwnProperty(i) && !(i.charAt(0) == '_' && i.charAt(1) == '_') && objTypeDef && !objTypeDef[i] && additionalProp===false){
|
||||
if (options.filter) {
|
||||
delete instance[i];
|
||||
continue;
|
||||
} else {
|
||||
errors.push({property:path,message:(typeof value) + "The property " + i +
|
||||
" is not defined in the schema and the schema does not allow additional properties"});
|
||||
}
|
||||
}
|
||||
var requires = objTypeDef && objTypeDef[i] && objTypeDef[i].requires;
|
||||
if(requires && !(requires in instance)){
|
||||
errors.push({property:path,message:"the presence of the property " + i + " requires that " + requires + " also be present"});
|
||||
}
|
||||
value = instance[i];
|
||||
if(additionalProp && (!(objTypeDef && typeof objTypeDef == 'object') || !(i in objTypeDef))){
|
||||
if(options.coerce){
|
||||
value = instance[i] = options.coerce(value, additionalProp);
|
||||
}
|
||||
checkProp(value,additionalProp,path,i);
|
||||
}
|
||||
if(!_changing && value && value.$schema){
|
||||
errors = errors.concat(checkProp(value,value.$schema,path,i));
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
if(schema){
|
||||
checkProp(instance,schema,'',_changing || '');
|
||||
}
|
||||
if(!_changing && instance && instance.$schema){
|
||||
checkProp(instance,instance.$schema,'','');
|
||||
}
|
||||
return {valid:!errors.length,errors:errors};
|
||||
};
|
||||
exports.mustBeValid = function(result){
|
||||
// summary:
|
||||
// This checks to ensure that the result is valid and will throw an appropriate error message if it is not
|
||||
// result: the result returned from checkPropertyChange or validate
|
||||
if(!result.valid){
|
||||
throw new TypeError(result.errors.map(function(error){return "for property " + error.property + ': ' + error.message;}).join(", \n"));
|
||||
}
|
||||
}
|
||||
|
||||
return exports;
|
||||
}));
|
||||
+31
-30
@@ -1,30 +1,31 @@
|
||||
{
|
||||
"name": "json-schema",
|
||||
"version": "0.2.3",
|
||||
"author": "Kris Zyp",
|
||||
"description": "JSON Schema validation and specifications",
|
||||
"maintainers":[
|
||||
{"name": "Kris Zyp", "email": "kriszyp@gmail.com"}],
|
||||
"keywords": [
|
||||
"json",
|
||||
"schema"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "AFLv2.1",
|
||||
"url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L43"
|
||||
},
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L13"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type":"git",
|
||||
"url":"http://github.com/kriszyp/json-schema"
|
||||
},
|
||||
"directories": { "lib": "./lib" },
|
||||
"main": "./lib/validate.js",
|
||||
"devDependencies": { "vows": "*" },
|
||||
"scripts": { "test": "echo TESTS DISABLED vows --spec test/*.js" }
|
||||
}
|
||||
{
|
||||
"name": "json-schema",
|
||||
"version": "0.2.3",
|
||||
"author": "Kris Zyp",
|
||||
"description": "JSON Schema validation and specifications",
|
||||
"maintainers":[
|
||||
{"name": "Kris Zyp", "email": "kriszyp@gmail.com"}],
|
||||
"keywords": [
|
||||
"json",
|
||||
"schema"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "AFLv2.1",
|
||||
"url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L43"
|
||||
},
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L13"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type":"git",
|
||||
"url":"http://github.com/kriszyp/json-schema"
|
||||
},
|
||||
"directories": { "lib": "./lib" },
|
||||
"main": "./lib/validate.js",
|
||||
"devDependencies": { "vows": "*" },
|
||||
"scripts": { "test": "echo TESTS DISABLED vows --spec test/*.js" }
|
||||
}
|
||||
|
||||
+95
-95
@@ -1,95 +1,95 @@
|
||||
var assert = require('assert');
|
||||
var vows = require('vows');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
var validate = require('../lib/validate').validate;
|
||||
|
||||
|
||||
var revision = 'draft-03';
|
||||
var schemaRoot = path.join(__dirname, '..', revision);
|
||||
var schemaNames = ['schema', 'hyper-schema', 'links', 'json-ref' ];
|
||||
var schemas = {};
|
||||
|
||||
schemaNames.forEach(function(name) {
|
||||
var file = path.join(schemaRoot, name);
|
||||
schemas[name] = loadSchema(file);
|
||||
});
|
||||
|
||||
schemaNames.forEach(function(name) {
|
||||
var s, n = name+'-nsd', f = path.join(schemaRoot, name);
|
||||
schemas[n] = loadSchema(f);
|
||||
s = schemas[n];
|
||||
delete s['$schema'];
|
||||
});
|
||||
|
||||
function loadSchema(path) {
|
||||
var data = fs.readFileSync(path, 'utf-8');
|
||||
var schema = JSON.parse(data);
|
||||
return schema;
|
||||
}
|
||||
|
||||
function resultIsValid() {
|
||||
return function(result) {
|
||||
assert.isObject(result);
|
||||
//assert.isBoolean(result.valid);
|
||||
assert.equal(typeof(result.valid), 'boolean');
|
||||
assert.isArray(result.errors);
|
||||
for (var i = 0; i < result.errors.length; i++) {
|
||||
assert.notEqual(result.errors[i], null, 'errors['+i+'] is null');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function assertValidates(doc, schema) {
|
||||
var context = {};
|
||||
|
||||
context[': validate('+doc+', '+schema+')'] = {
|
||||
topic: validate(schemas[doc], schemas[schema]),
|
||||
'returns valid result': resultIsValid(),
|
||||
'with valid=true': function(result) { assert.equal(result.valid, true); },
|
||||
'and no errors': function(result) {
|
||||
// XXX work-around for bug in vows: [null] chokes it
|
||||
if (result.errors[0] == null) assert.fail('(errors contains null)');
|
||||
assert.length(result.errors, 0);
|
||||
}
|
||||
};
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
function assertSelfValidates(doc) {
|
||||
var context = {};
|
||||
|
||||
context[': validate('+doc+')'] = {
|
||||
topic: validate(schemas[doc]),
|
||||
'returns valid result': resultIsValid(),
|
||||
'with valid=true': function(result) { assert.equal(result.valid, true); },
|
||||
'and no errors': function(result) { assert.length(result.errors, 0); }
|
||||
};
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
var suite = vows.describe('JSON Schema').addBatch({
|
||||
'Core-NSD self-validates': assertSelfValidates('schema-nsd'),
|
||||
'Core-NSD/Core-NSD': assertValidates('schema-nsd', 'schema-nsd'),
|
||||
'Core-NSD/Core': assertValidates('schema-nsd', 'schema'),
|
||||
|
||||
'Core self-validates': assertSelfValidates('schema'),
|
||||
'Core/Core': assertValidates('schema', 'schema'),
|
||||
|
||||
'Hyper-NSD self-validates': assertSelfValidates('hyper-schema-nsd'),
|
||||
'Hyper self-validates': assertSelfValidates('hyper-schema'),
|
||||
'Hyper/Hyper': assertValidates('hyper-schema', 'hyper-schema'),
|
||||
'Hyper/Core': assertValidates('hyper-schema', 'schema'),
|
||||
|
||||
'Links-NSD self-validates': assertSelfValidates('links-nsd'),
|
||||
'Links self-validates': assertSelfValidates('links'),
|
||||
'Links/Hyper': assertValidates('links', 'hyper-schema'),
|
||||
'Links/Core': assertValidates('links', 'schema'),
|
||||
|
||||
'Json-Ref self-validates': assertSelfValidates('json-ref'),
|
||||
'Json-Ref/Hyper': assertValidates('json-ref', 'hyper-schema'),
|
||||
'Json-Ref/Core': assertValidates('json-ref', 'schema')
|
||||
}).export(module);
|
||||
var assert = require('assert');
|
||||
var vows = require('vows');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
var validate = require('../lib/validate').validate;
|
||||
|
||||
|
||||
var revision = 'draft-03';
|
||||
var schemaRoot = path.join(__dirname, '..', revision);
|
||||
var schemaNames = ['schema', 'hyper-schema', 'links', 'json-ref' ];
|
||||
var schemas = {};
|
||||
|
||||
schemaNames.forEach(function(name) {
|
||||
var file = path.join(schemaRoot, name);
|
||||
schemas[name] = loadSchema(file);
|
||||
});
|
||||
|
||||
schemaNames.forEach(function(name) {
|
||||
var s, n = name+'-nsd', f = path.join(schemaRoot, name);
|
||||
schemas[n] = loadSchema(f);
|
||||
s = schemas[n];
|
||||
delete s['$schema'];
|
||||
});
|
||||
|
||||
function loadSchema(path) {
|
||||
var data = fs.readFileSync(path, 'utf-8');
|
||||
var schema = JSON.parse(data);
|
||||
return schema;
|
||||
}
|
||||
|
||||
function resultIsValid() {
|
||||
return function(result) {
|
||||
assert.isObject(result);
|
||||
//assert.isBoolean(result.valid);
|
||||
assert.equal(typeof(result.valid), 'boolean');
|
||||
assert.isArray(result.errors);
|
||||
for (var i = 0; i < result.errors.length; i++) {
|
||||
assert.notEqual(result.errors[i], null, 'errors['+i+'] is null');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function assertValidates(doc, schema) {
|
||||
var context = {};
|
||||
|
||||
context[': validate('+doc+', '+schema+')'] = {
|
||||
topic: validate(schemas[doc], schemas[schema]),
|
||||
'returns valid result': resultIsValid(),
|
||||
'with valid=true': function(result) { assert.equal(result.valid, true); },
|
||||
'and no errors': function(result) {
|
||||
// XXX work-around for bug in vows: [null] chokes it
|
||||
if (result.errors[0] == null) assert.fail('(errors contains null)');
|
||||
assert.length(result.errors, 0);
|
||||
}
|
||||
};
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
function assertSelfValidates(doc) {
|
||||
var context = {};
|
||||
|
||||
context[': validate('+doc+')'] = {
|
||||
topic: validate(schemas[doc]),
|
||||
'returns valid result': resultIsValid(),
|
||||
'with valid=true': function(result) { assert.equal(result.valid, true); },
|
||||
'and no errors': function(result) { assert.length(result.errors, 0); }
|
||||
};
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
var suite = vows.describe('JSON Schema').addBatch({
|
||||
'Core-NSD self-validates': assertSelfValidates('schema-nsd'),
|
||||
'Core-NSD/Core-NSD': assertValidates('schema-nsd', 'schema-nsd'),
|
||||
'Core-NSD/Core': assertValidates('schema-nsd', 'schema'),
|
||||
|
||||
'Core self-validates': assertSelfValidates('schema'),
|
||||
'Core/Core': assertValidates('schema', 'schema'),
|
||||
|
||||
'Hyper-NSD self-validates': assertSelfValidates('hyper-schema-nsd'),
|
||||
'Hyper self-validates': assertSelfValidates('hyper-schema'),
|
||||
'Hyper/Hyper': assertValidates('hyper-schema', 'hyper-schema'),
|
||||
'Hyper/Core': assertValidates('hyper-schema', 'schema'),
|
||||
|
||||
'Links-NSD self-validates': assertSelfValidates('links-nsd'),
|
||||
'Links self-validates': assertSelfValidates('links'),
|
||||
'Links/Hyper': assertValidates('links', 'hyper-schema'),
|
||||
'Links/Core': assertValidates('links', 'schema'),
|
||||
|
||||
'Json-Ref self-validates': assertSelfValidates('json-ref'),
|
||||
'Json-Ref/Hyper': assertValidates('json-ref', 'hyper-schema'),
|
||||
'Json-Ref/Core': assertValidates('json-ref', 'schema')
|
||||
}).export(module);
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
## just-diff
|
||||
|
||||
Part of a [library](../../../../) of zero-dependency npm modules that do just do one thing.
|
||||
Part of a [library](../../../../) of zero-dependency npm modules that do just do one thing.
|
||||
Guilt-free utilities for every occasion.
|
||||
|
||||
[Try it now](http://anguscroll.com/just/just-diff)
|
||||
|
||||
Return an object representing the difference between two other objects
|
||||
Return an object representing the difference between two other objects
|
||||
Pass converter to format as http://jsonpatch.com
|
||||
|
||||
```js
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "libnpmaccess",
|
||||
"version": "4.0.0",
|
||||
"version": "4.0.1",
|
||||
"description": "programmatic library for `npm access` commands",
|
||||
"author": "Kat Marchán <kzm@sykosomatic.org>",
|
||||
"license": "ISC",
|
||||
@@ -26,7 +26,7 @@
|
||||
"aproba": "^2.0.0",
|
||||
"minipass": "^3.1.1",
|
||||
"npm-package-arg": "^8.0.0",
|
||||
"npm-registry-fetch": "^8.0.0"
|
||||
"npm-registry-fetch": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
|
||||
+1
@@ -3,3 +3,4 @@
|
||||
## 0.0.0-pre.0
|
||||
|
||||
- Initial pre-release.
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "libnpmhook",
|
||||
"version": "6.0.0",
|
||||
"version": "6.0.1",
|
||||
"description": "programmatic API for managing npm registry hooks",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
@@ -28,7 +28,7 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"aproba": "^2.0.0",
|
||||
"npm-registry-fetch": "^8.0.0"
|
||||
"npm-registry-fetch": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nock": "^9.6.1",
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "libnpmorg",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"description": "Programmatic api for `npm org` commands",
|
||||
"author": "Kat Marchán <kzm@sykosomatic.org>",
|
||||
"keywords": [
|
||||
@@ -40,7 +40,7 @@
|
||||
"homepage": "https://npmjs.com/package/libnpmorg",
|
||||
"dependencies": {
|
||||
"aproba": "^2.0.0",
|
||||
"npm-registry-fetch": "^8.0.0"
|
||||
"npm-registry-fetch": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
* [`cb2ecf2`](https://github.com/npm/libnpmpack/commit/cb2ecf2) feat: resolve to tarball data Buffer ([@claudiahdz](https://github.com/claudiahdz))
|
||||
|
||||
<a name="1.0.0"></a>
|
||||
<a name="1.0.0"></a>
|
||||
# 1.0.0 (2020-03-26)
|
||||
|
||||
### Features
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ const pack = require('libnpmpack')
|
||||
Packs a tarball from a local directory or from a registry or github spec and returns a Promise that resolves to the tarball data Buffer, with from, resolved, and integrity fields attached.
|
||||
|
||||
If no options are passed, the tarball file will be saved on the same directory from which `pack` was called in.
|
||||
|
||||
|
||||
`libnpmpack` uses [`pacote`](https://npm.im/pacote).
|
||||
Most options are passed through directly to that library, so please refer to
|
||||
[its own `opts`
|
||||
|
||||
+47
-40
@@ -1,13 +1,9 @@
|
||||
# libnpmpublish
|
||||
|
||||
[](https://npm.im/libnpmpublish)
|
||||
[](https://npm.im/libnpmpublish)
|
||||
[](https://github.com/npm/libnpmpublish/actions?query=workflow%3A%22Node+CI%22)
|
||||
[](https://coveralls.io/github/npm/libnpmpublish?branch=latest)
|
||||
|
||||
[`libnpmpublish`](https://github.com/npm/libnpmpublish) is a Node.js library for
|
||||
programmatically publishing and unpublishing npm packages. It takes care
|
||||
of packing tarballs from source code and putting it up on a nice registry for you.
|
||||
[`libnpmpublish`](https://github.com/npm/libnpmpublish) is a Node.js
|
||||
library for programmatically publishing and unpublishing npm packages. Give
|
||||
it a manifest as an object and a tarball as a Buffer, and it'll put them on
|
||||
the registry for you.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
@@ -22,7 +18,6 @@ of packing tarballs from source code and putting it up on a nice registry for yo
|
||||
|
||||
```js
|
||||
const { publish, unpublish } = require('libnpmpublish')
|
||||
|
||||
```
|
||||
|
||||
## Install
|
||||
@@ -33,39 +28,58 @@ const { publish, unpublish } = require('libnpmpublish')
|
||||
|
||||
#### <a name="opts"></a> `opts` for `libnpmpublish` commands
|
||||
|
||||
`libnpmpublish` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch).
|
||||
Most options are passed through directly to that library, so please refer to
|
||||
[its own `opts`
|
||||
documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options)
|
||||
for options that can be passed in.
|
||||
`libnpmpublish` uses
|
||||
[`npm-registry-fetch`](https://npm.im/npm-registry-fetch). Most options
|
||||
are passed through directly to that library, so please refer to [its own
|
||||
`opts` documentation](http://npm.im/npm-registry-fetch#fetch-options) for
|
||||
options that can be passed in.
|
||||
|
||||
A couple of options of note for those in a hurry:
|
||||
* `opts.defaultTag` - registers the published package with the given tag, defaults to `latest`.
|
||||
A couple of options of note:
|
||||
|
||||
* `opts.access` - tells the registry whether this package should be published as public or restricted. Only applies to scoped packages, which default to restricted.
|
||||
* `opts.defaultTag` - registers the published package with the given tag,
|
||||
defaults to `latest`.
|
||||
|
||||
* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs.
|
||||
* `opts.access` - tells the registry whether this package should be
|
||||
published as public or restricted. Only applies to scoped packages, which
|
||||
default to restricted.
|
||||
|
||||
#### <a name="publish"></a> `> libpub.publish(path, pkgJson, [opts]) -> Promise`
|
||||
* `opts.token` - can be passed in and will be used as the authentication
|
||||
token for the registry. For other ways to pass in auth details, see the
|
||||
n-r-f docs.
|
||||
|
||||
Packs a tarball located in `path` and publishes to the appropriate configured registry. `pkgJson` should be
|
||||
the parsed `package.json` for the package that is being published.
|
||||
#### <a name="publish"></a> `> libpub.publish(manifest, tarData, [opts]) -> Promise`
|
||||
|
||||
If `opts.npmVersion` is passed in, it will be used as the `_npmVersion` field in
|
||||
the outgoing packument. It's recommended you add your own user agent string in
|
||||
there!
|
||||
Sends the package represented by the `manifest` and `tarData` to the
|
||||
configured registry.
|
||||
|
||||
If `opts.algorithms` is passed in, it should be an array of hashing algorithms
|
||||
to generate `integrity` hashes for. The default is `['sha512']`, which means you
|
||||
end up with `dist.integrity = 'sha512-deadbeefbadc0ffee'`. Any algorithm
|
||||
supported by your current node version is allowed -- npm clients that do not
|
||||
support those algorithms will simply ignore the unsupported hashes.
|
||||
`manifest` should be the parsed `package.json` for the package being
|
||||
published (which can also be the manifest pulled from a packument, a git
|
||||
repo, tarball, etc.)
|
||||
|
||||
`tarData` is a `Buffer` of the tarball being published.
|
||||
|
||||
If `opts.npmVersion` is passed in, it will be used as the `_npmVersion`
|
||||
field in the outgoing packument. You may put your own user-agent string in
|
||||
there to identify your publishes.
|
||||
|
||||
If `opts.algorithms` is passed in, it should be an array of hashing
|
||||
algorithms to generate `integrity` hashes for. The default is `['sha512']`,
|
||||
which means you end up with `dist.integrity = 'sha512-deadbeefbadc0ffee'`.
|
||||
Any algorithm supported by your current node version is allowed -- npm
|
||||
clients that do not support those algorithms will simply ignore the
|
||||
unsupported hashes.
|
||||
|
||||
##### Example
|
||||
|
||||
```javascript
|
||||
```js
|
||||
// note that pacote.manifest() and pacote.tarball() can also take
|
||||
// any spec that npm can install. a folder shown here, since that's
|
||||
// far and away the most common use case.
|
||||
const path = '/a/path/to/your/source/code'
|
||||
await libpub.publish(path, {
|
||||
const pacote = require('pacote') // see: http://npm.im/pacote
|
||||
const manifest = await pacote.manifest(path)
|
||||
const tarData = await pacote.tarball(path)
|
||||
await libpub.publish(manifest, tarData, {
|
||||
npmVersion: 'my-pub-script@1.0.2',
|
||||
token: 'my-auth-token-here'
|
||||
}, opts)
|
||||
@@ -84,15 +98,8 @@ expected. `range` specs will fail silently in most cases.
|
||||
|
||||
##### Example
|
||||
|
||||
```javascript
|
||||
```js
|
||||
await libpub.unpublish('lodash', { token: 'i-am-the-worst'})
|
||||
//
|
||||
// `lodash` has now been unpublished, along with all its versions, and the world
|
||||
// devolves into utter chaos.
|
||||
//
|
||||
// That, or we all go home to our friends and/or family and have a nice time
|
||||
// doing nothing having to do with programming or JavaScript and realize our
|
||||
// lives are just so much happier now, and we just can't understand why we ever
|
||||
// got so into this JavaScript thing but damn did it pay well. I guess you'll
|
||||
// settle for gardening or something.
|
||||
// `lodash` has now been unpublished, along with all its versions
|
||||
```
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
publish: require('./publish.js'),
|
||||
unpublish: require('./unpublish.js')
|
||||
unpublish: require('./unpublish.js'),
|
||||
}
|
||||
+12
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "libnpmpublish",
|
||||
"version": "3.0.2",
|
||||
"version": "4.0.0",
|
||||
"description": "Programmatic API for the bits behind npm publish and unpublish",
|
||||
"author": "npm Inc. <support@npmjs.com>",
|
||||
"contributors": [
|
||||
@@ -13,10 +13,12 @@
|
||||
],
|
||||
"license": "ISC",
|
||||
"scripts": {
|
||||
"eslint": "eslint",
|
||||
"lint": "npm run eslint -- \"*.js\"",
|
||||
"lintfix": "npm run lint -- --fix",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags",
|
||||
"lint": "standard",
|
||||
"test": "tap",
|
||||
"posttest": "npm run lint"
|
||||
},
|
||||
@@ -24,6 +26,13 @@
|
||||
"check-coverage": true
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.11.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-standard": "^4.0.2",
|
||||
"libnpmpack": "^2.0.0",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"nock": "^12.0.2",
|
||||
"standard": "^14.3.1",
|
||||
"tap": "^14.10.6"
|
||||
@@ -35,11 +44,9 @@
|
||||
"bugs": "https://github.com/npm/libnpmpublish/issues",
|
||||
"homepage": "https://npmjs.com/package/libnpmpublish",
|
||||
"dependencies": {
|
||||
"libnpmpack": "^2.0.0",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"normalize-package-data": "^3.0.0",
|
||||
"npm-package-arg": "^8.1.0",
|
||||
"npm-registry-fetch": "^8.1.5",
|
||||
"npm-registry-fetch": "^9.0.0",
|
||||
"semver": "^7.1.3",
|
||||
"ssri": "^8.0.0"
|
||||
},
|
||||
|
||||
+28
-45
@@ -1,25 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
const { fixer } = require('normalize-package-data')
|
||||
const npmFetch = require('npm-registry-fetch')
|
||||
const cloneDeep = require('lodash.clonedeep')
|
||||
const npa = require('npm-package-arg')
|
||||
const pack = require('libnpmpack')
|
||||
const semver = require('semver')
|
||||
const { URL } = require('url')
|
||||
const util = require('util')
|
||||
const ssri = require('ssri')
|
||||
|
||||
const statAsync = util.promisify(require('fs').stat)
|
||||
|
||||
module.exports = publish
|
||||
async function publish (folder, manifest, opts) {
|
||||
const publish = async (manifest, tarballData, opts) => {
|
||||
if (manifest.private) {
|
||||
throw Object.assign(
|
||||
new Error(
|
||||
`This package has been marked as private\n
|
||||
Remove the 'private' field from the package.json to publish it.`
|
||||
),
|
||||
new Error(`This package has been marked as private
|
||||
Remove the 'private' field from the package.json to publish it.`),
|
||||
{ code: 'EPRIVATE' }
|
||||
)
|
||||
}
|
||||
@@ -32,16 +22,7 @@ async function publish (folder, manifest, opts) {
|
||||
access: spec.scope ? 'restricted' : 'public',
|
||||
algorithms: ['sha512'],
|
||||
...opts,
|
||||
spec
|
||||
}
|
||||
|
||||
const stat = await statAsync(folder)
|
||||
// checks if it's a dir
|
||||
if (!stat.isDirectory()) {
|
||||
throw Object.assign(
|
||||
new Error('not a directory'),
|
||||
{ code: 'ENOTDIR' }
|
||||
)
|
||||
spec,
|
||||
}
|
||||
|
||||
const reg = npmFetch.pickRegistry(spec, opts)
|
||||
@@ -56,7 +37,6 @@ async function publish (folder, manifest, opts) {
|
||||
)
|
||||
}
|
||||
|
||||
const tarballData = await pack(`file:${folder}`, { ...opts })
|
||||
const metadata = buildMetadata(reg, pubManifest, tarballData, opts)
|
||||
|
||||
try {
|
||||
@@ -64,36 +44,37 @@ async function publish (folder, manifest, opts) {
|
||||
...opts,
|
||||
method: 'PUT',
|
||||
body: metadata,
|
||||
ignoreBody: true
|
||||
ignoreBody: true,
|
||||
})
|
||||
} catch (err) {
|
||||
if (err.code !== 'E409') { throw err }
|
||||
if (err.code !== 'E409')
|
||||
throw err
|
||||
// if E409, we attempt exactly ONE retry, to protect us
|
||||
// against malicious activity like trying to publish
|
||||
// a bunch of new versions of a package at the same time
|
||||
// and/or spamming the registry
|
||||
const current = await npmFetch.json(spec.escapedName, {
|
||||
...opts,
|
||||
query: { write: true }
|
||||
query: { write: true },
|
||||
})
|
||||
const newMetadata = patchMetadata(current, metadata, opts)
|
||||
return npmFetch(spec.escapedName, {
|
||||
...opts,
|
||||
method: 'PUT',
|
||||
body: newMetadata,
|
||||
ignoreBody: true
|
||||
ignoreBody: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function patchManifest (_manifest, opts) {
|
||||
const patchManifest = (_manifest, opts) => {
|
||||
const { npmVersion } = opts
|
||||
const manifest = cloneDeep(_manifest)
|
||||
// we only update top-level fields, so a shallow clone is fine
|
||||
const manifest = { ..._manifest }
|
||||
|
||||
manifest._nodeVersion = process.versions.node
|
||||
if (npmVersion) {
|
||||
if (npmVersion)
|
||||
manifest._npmVersion = npmVersion
|
||||
}
|
||||
|
||||
fixer.fixNameField(manifest, { strict: true, allowLegacyCase: true })
|
||||
const version = semver.clean(manifest.version)
|
||||
@@ -107,7 +88,7 @@ function patchManifest (_manifest, opts) {
|
||||
return manifest
|
||||
}
|
||||
|
||||
function buildMetadata (registry, manifest, tarballData, opts) {
|
||||
const buildMetadata = (registry, manifest, tarballData, opts) => {
|
||||
const { access, defaultTag, algorithms } = opts
|
||||
const root = {
|
||||
_id: manifest.name,
|
||||
@@ -116,7 +97,6 @@ function buildMetadata (registry, manifest, tarballData, opts) {
|
||||
'dist-tags': {},
|
||||
versions: {},
|
||||
access,
|
||||
readme: manifest.readme || ''
|
||||
}
|
||||
|
||||
root.versions[manifest.version] = manifest
|
||||
@@ -126,7 +106,7 @@ function buildMetadata (registry, manifest, tarballData, opts) {
|
||||
const tarballName = `${manifest.name}-${manifest.version}.tgz`
|
||||
const tarballURI = `${manifest.name}/-/${tarballName}`
|
||||
const integrity = ssri.fromData(tarballData, {
|
||||
algorithms: [...new Set(['sha1'].concat(algorithms))]
|
||||
algorithms: [...new Set(['sha1'].concat(algorithms))],
|
||||
})
|
||||
|
||||
manifest._id = `${manifest.name}@${manifest.version}`
|
||||
@@ -146,18 +126,18 @@ function buildMetadata (registry, manifest, tarballData, opts) {
|
||||
root._attachments[tarballName] = {
|
||||
content_type: 'application/octet-stream',
|
||||
data: tarballData.toString('base64'),
|
||||
length: tarballData.length
|
||||
length: tarballData.length,
|
||||
}
|
||||
|
||||
return root
|
||||
}
|
||||
|
||||
function patchMetadata (current, newData) {
|
||||
const curVers = Object.keys(current.versions || {}).map(v => {
|
||||
return semver.clean(v, true)
|
||||
}).concat(Object.keys(current.time || {}).map(v => {
|
||||
if (semver.valid(v, true)) { return semver.clean(v, true) }
|
||||
})).filter(v => v)
|
||||
const patchMetadata = (current, newData) => {
|
||||
const curVers = Object.keys(current.versions || {})
|
||||
.map(v => semver.clean(v, true))
|
||||
.concat(Object.keys(current.time || {})
|
||||
.map(v => semver.valid(v, true) && semver.clean(v, true))
|
||||
.filter(v => v))
|
||||
|
||||
const newVersion = Object.keys(newData.versions)[0]
|
||||
|
||||
@@ -169,19 +149,19 @@ function patchMetadata (current, newData) {
|
||||
), {
|
||||
code: 'EPUBLISHCONFLICT',
|
||||
pkgid,
|
||||
version
|
||||
version,
|
||||
})
|
||||
}
|
||||
|
||||
current.versions = current.versions || {}
|
||||
current.versions[newVersion] = newData.versions[newVersion]
|
||||
for (var i in newData) {
|
||||
for (const i in newData) {
|
||||
switch (i) {
|
||||
// objects that copy over the new stuffs
|
||||
case 'dist-tags':
|
||||
case 'versions':
|
||||
case '_attachments':
|
||||
for (var j in newData[i]) {
|
||||
for (const j in newData[i]) {
|
||||
current[i] = current[i] || {}
|
||||
current[i][j] = newData[i][j]
|
||||
}
|
||||
@@ -190,8 +170,11 @@ function patchMetadata (current, newData) {
|
||||
// copy
|
||||
default:
|
||||
current[i] = newData[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return current
|
||||
}
|
||||
|
||||
module.exports = publish
|
||||
+13
-14
@@ -5,21 +5,20 @@ const npmFetch = require('npm-registry-fetch')
|
||||
const semver = require('semver')
|
||||
const { URL } = require('url')
|
||||
|
||||
module.exports = unpublish
|
||||
async function unpublish (spec, opts) {
|
||||
const unpublish = async (spec, opts) => {
|
||||
spec = npa(spec)
|
||||
// spec is used to pick the appropriate registry/auth combo.
|
||||
opts = {
|
||||
force: false,
|
||||
...opts,
|
||||
spec
|
||||
spec,
|
||||
}
|
||||
|
||||
try {
|
||||
const pkgUri = spec.escapedName
|
||||
const pkg = await npmFetch.json(pkgUri, {
|
||||
...opts,
|
||||
query: { write: true }
|
||||
query: { write: true },
|
||||
})
|
||||
|
||||
const version = spec.rawSpec
|
||||
@@ -32,9 +31,8 @@ async function unpublish (spec, opts) {
|
||||
|
||||
// if missing specific version,
|
||||
// assumed unpublished
|
||||
if (!versionData && !rawSpecs && !noVersions) {
|
||||
if (!versionData && !rawSpecs && !noVersions)
|
||||
return true
|
||||
}
|
||||
|
||||
// unpublish all versions of a package:
|
||||
// - no specs supplied "npm unpublish foo"
|
||||
@@ -45,7 +43,7 @@ async function unpublish (spec, opts) {
|
||||
await npmFetch(`${pkgUri}/-rev/${pkg._rev}`, {
|
||||
...opts,
|
||||
method: 'DELETE',
|
||||
ignoreBody: true
|
||||
ignoreBody: true,
|
||||
})
|
||||
return true
|
||||
} else {
|
||||
@@ -56,9 +54,8 @@ async function unpublish (spec, opts) {
|
||||
|
||||
// deleting dist tags associated to version
|
||||
Object.keys(pkg['dist-tags']).forEach(tag => {
|
||||
if (pkg['dist-tags'][tag] === version) {
|
||||
if (pkg['dist-tags'][tag] === version)
|
||||
delete pkg['dist-tags'][tag]
|
||||
}
|
||||
})
|
||||
|
||||
if (latestVer === version) {
|
||||
@@ -75,26 +72,28 @@ async function unpublish (spec, opts) {
|
||||
...opts,
|
||||
method: 'PUT',
|
||||
body: pkg,
|
||||
ignoreBody: true
|
||||
ignoreBody: true,
|
||||
})
|
||||
|
||||
// Remove the tarball itself
|
||||
const { _rev } = await npmFetch.json(pkgUri, {
|
||||
...opts,
|
||||
query: { write: true }
|
||||
query: { write: true },
|
||||
})
|
||||
const tarballUrl = new URL(dist.tarball).pathname.substr(1)
|
||||
await npmFetch(`${tarballUrl}/-rev/${_rev}`, {
|
||||
...opts,
|
||||
method: 'DELETE',
|
||||
ignoreBody: true
|
||||
ignoreBody: true,
|
||||
})
|
||||
return true
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code !== 'E404') {
|
||||
if (err.code !== 'E404')
|
||||
throw err
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = unpublish
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "libnpmsearch",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.1",
|
||||
"description": "Programmatic API for searching in npm and compatible registries.",
|
||||
"author": "Kat Marchán <kzm@sykosomatic.org>",
|
||||
"files": [
|
||||
@@ -37,7 +37,7 @@
|
||||
"bugs": "https://github.com/npm/libnpmsearch/issues",
|
||||
"homepage": "https://npmjs.com/package/libnpmsearch",
|
||||
"dependencies": {
|
||||
"npm-registry-fetch": "^8.0.0"
|
||||
"npm-registry-fetch": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
|
||||
Loaded 100 of 147 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user