promptgraph-mcp 2.4.7 → 2.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -6
- package/ann.js +23 -51
- package/api.js +200 -0
- package/config.js +7 -0
- package/db.js +20 -0
- package/embedder.js +10 -0
- package/github-import.js +102 -22
- package/indexer.js +45 -11
- package/marketplace.js +47 -5
- package/package.json +9 -3
- package/search.js +84 -20
- package/src/filter/hard-filter.js +2 -0
- package/src/filter/train.js +3 -1
- package/src/store/flat-store.js +61 -0
- package/src/store/hnsw-store.js +187 -0
- package/src/store/index.js +19 -0
- package/src/store/vector-store.js +9 -0
- package/validator.js +7 -1
- package/registry/training/bad/accepts-HISTORY.md +0 -250
- package/registry/training/bad/argparse-CHANGELOG.md +0 -185
- package/registry/training/bad/balanced-match-LICENSE.md +0 -23
- package/registry/training/bad/better-sqlite3-README.md +0 -99
- package/registry/training/bad/bindings-LICENSE.md +0 -22
- package/registry/training/bad/bl-LICENSE.md +0 -13
- package/registry/training/bad/body-parser-README.md +0 -494
- package/registry/training/bad/bytes-HISTORY.md +0 -97
- package/registry/training/bad/camelcase-README.md +0 -135
- package/registry/training/bad/chai-README.md +0 -162
- package/registry/training/bad/cli-progress-LICENSE.md +0 -24
- package/registry/training/bad/content-type-HISTORY.md +0 -29
- package/registry/training/bad/cookie-SECURITY.md +0 -25
- package/registry/training/bad/cookie-signature-HISTORY.md +0 -70
- package/registry/training/bad/cors-README.md +0 -277
- package/registry/training/bad/cross-spawn-README.md +0 -89
- package/registry/training/bad/deep-extend-CHANGELOG.md +0 -46
- package/registry/training/bad/depd-HISTORY.md +0 -103
- package/registry/training/bad/esprima-README.md +0 -46
- package/registry/training/bad/etag-HISTORY.md +0 -83
- package/registry/training/bad/expect-type-SECURITY.md +0 -14
- package/registry/training/bad/finalhandler-HISTORY.md +0 -239
- package/registry/training/bad/fresh-HISTORY.md +0 -80
- package/registry/training/bad/glob-LICENSE.md +0 -63
- package/registry/training/bad/hono-README.md +0 -85
- package/registry/training/bad/http-errors-HISTORY.md +0 -186
- package/registry/training/bad/jose-LICENSE.md +0 -21
- package/registry/training/bad/jose-README.md +0 -153
- package/registry/training/bad/js-yaml-README.md +0 -299
- package/registry/training/bad/json-schema-typed-LICENSE.md +0 -57
- package/registry/training/bad/json-stringify-safe-CHANGELOG.md +0 -14
- package/registry/training/bad/lru-cache-LICENSE.md +0 -55
- package/registry/training/bad/media-typer-HISTORY.md +0 -50
- package/registry/training/bad/minimatch-LICENSE.md +0 -55
- package/registry/training/bad/minimist-CHANGELOG.md +0 -298
- package/registry/training/bad/minimist-README.md +0 -121
- package/registry/training/bad/ms-LICENSE.md +0 -21
- package/registry/training/bad/negotiator-HISTORY.md +0 -114
- package/registry/training/bad/on-finished-HISTORY.md +0 -98
- package/registry/training/bad/pkce-challenge-CHANGELOG.md +0 -114
- package/registry/training/bad/postcss-README.md +0 -28
- package/registry/training/bad/prebuild-install-CHANGELOG.md +0 -131
- package/registry/training/bad/proxy-addr-HISTORY.md +0 -161
- package/registry/training/bad/qs-CHANGELOG.md +0 -822
- package/registry/training/bad/rc-README.md +0 -227
- package/registry/training/bad/readable-stream-CONTRIBUTING.md +0 -38
- package/registry/training/bad/router-HISTORY.md +0 -228
- package/registry/training/bad/semver-README.md +0 -680
- package/registry/training/bad/send-README.md +0 -317
- package/registry/training/bad/serve-static-README.md +0 -253
- package/registry/training/bad/statuses-HISTORY.md +0 -87
- package/registry/training/bad/type-is-HISTORY.md +0 -292
- package/registry/training/bad/vary-HISTORY.md +0 -39
- package/registry/training/bad/vite-LICENSE.md +0 -2230
- package/registry/training/bad/which-CHANGELOG.md +0 -166
- package/registry/training/bad/zod-README.md +0 -191
- package/registry/training/good/skills-store-autopilot.md +0 -85
- package/registry/training/good/skills-store-bot-builder.md +0 -70
- package/registry/training/good/skills-store-chain.md +0 -136
- package/registry/training/good/skills-store-evolve.md +0 -100
- package/registry/training/good/skills-store-game.md +0 -27
- package/registry/training/good/skills-store-hunt.md +0 -102
- package/registry/training/good/skills-store-intel.md +0 -56
- package/registry/training/good/skills-store-memory-gc.md +0 -58
- package/registry/training/good/skills-store-pcsort.md +0 -207
- package/registry/training/good/skills-store-pickup.md +0 -60
- package/registry/training/good/skills-store-recon.md +0 -141
- package/registry/training/good/skills-store-remember.md +0 -64
- package/registry/training/good/skills-store-report.md +0 -117
- package/registry/training/good/skills-store-router.md +0 -225
- package/registry/training/good/skills-store-search.md +0 -168
- package/registry/training/good/skills-store-surface.md +0 -53
- package/registry/training/good/skills-store-token-scan.md +0 -141
- package/registry/training/good/skills-store-triage.md +0 -97
- package/registry/training/good/skills-store-unity.md +0 -733
- package/registry/training/good/skills-store-validate.md +0 -135
- package/registry/training/good/skills-store-web3-audit.md +0 -217
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# jose
|
|
2
|
-
|
|
3
|
-
`jose` is a JavaScript module for JSON Object Signing and Encryption, providing support for JSON Web Tokens (JWT), JSON Web Signature (JWS), JSON Web Encryption (JWE), JSON Web Key (JWK), JSON Web Key Set (JWKS), and more. The module is designed to work across various Web-interoperable runtimes including Node.js, browsers, Cloudflare Workers, Deno, Bun, and others.
|
|
4
|
-
|
|
5
|
-
## Sponsor
|
|
6
|
-
|
|
7
|
-
<picture>
|
|
8
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_dark.png">
|
|
9
|
-
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_light.png">
|
|
10
|
-
<img height="65" align="left" alt="Auth0 by Okta" src="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_light.png">
|
|
11
|
-
</picture>
|
|
12
|
-
|
|
13
|
-
If you want to quickly add JWT authentication to JavaScript apps, feel free to check out Auth0's JavaScript SDK and free plan. [Create an Auth0 account; it's free!][sponsor-auth0]<br><br>
|
|
14
|
-
|
|
15
|
-
## [💗 Help the project](https://github.com/sponsors/panva)
|
|
16
|
-
|
|
17
|
-
Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by [becoming a sponsor](https://github.com/sponsors/panva).
|
|
18
|
-
|
|
19
|
-
## Dependencies: 0
|
|
20
|
-
|
|
21
|
-
`jose` has no dependencies and it exports tree-shakeable ESM[^cjs].
|
|
22
|
-
|
|
23
|
-
## Documentation
|
|
24
|
-
|
|
25
|
-
`jose` is distributed via [npmjs.com](https://www.npmjs.com/package/jose), [jsr.io](https://jsr.io/@panva/jose), [jsdelivr.com](https://www.jsdelivr.com/package/npm/jose), and [github.com](https://github.com/panva/jose).
|
|
26
|
-
|
|
27
|
-
**`example`** ESM import[^cjs]
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
import * as jose from 'jose'
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### JSON Web Tokens (JWT)
|
|
34
|
-
|
|
35
|
-
The `jose` module supports JSON Web Tokens (JWT) and provides functionality for signing and verifying tokens, as well as their JWT Claims Set validation.
|
|
36
|
-
|
|
37
|
-
- [JWT Claims Set Validation & Signature Verification](docs/jwt/verify/functions/jwtVerify.md) using the `jwtVerify` function
|
|
38
|
-
- [Using a remote JSON Web Key Set (JWKS)](docs/jwks/remote/functions/createRemoteJWKSet.md)
|
|
39
|
-
- [Using a local JSON Web Key Set (JWKS)](docs/jwks/local/functions/createLocalJWKSet.md)
|
|
40
|
-
- [Signing](docs/jwt/sign/classes/SignJWT.md) using the `SignJWT` class
|
|
41
|
-
- Utility functions
|
|
42
|
-
- [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
|
|
43
|
-
- [Decoding JWT Claims Set](docs/util/decode_jwt/functions/decodeJwt.md) prior to its validation
|
|
44
|
-
|
|
45
|
-
### Encrypted JSON Web Tokens
|
|
46
|
-
|
|
47
|
-
The `jose` module supports encrypted JSON Web Tokens and provides functionality for encrypting and decrypting tokens, as well as their JWT Claims Set validation.
|
|
48
|
-
|
|
49
|
-
- [Decryption & JWT Claims Set Validation](docs/jwt/decrypt/functions/jwtDecrypt.md) using the `jwtDecrypt` function
|
|
50
|
-
- [Encryption](docs/jwt/encrypt/classes/EncryptJWT.md) using the `EncryptJWT` class
|
|
51
|
-
- Utility functions
|
|
52
|
-
- [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
|
|
53
|
-
|
|
54
|
-
### Key Utilities
|
|
55
|
-
|
|
56
|
-
The `jose` module supports importing, exporting, and generating keys and secrets in various formats, including PEM formats like SPKI, X.509 certificate, and PKCS #8, as well as JSON Web Key (JWK).
|
|
57
|
-
|
|
58
|
-
- Key Import Functions
|
|
59
|
-
- [JWK Import](docs/key/import/functions/importJWK.md)
|
|
60
|
-
- [Public Key Import (SPKI)](docs/key/import/functions/importSPKI.md)
|
|
61
|
-
- [Public Key Import (X.509 Certificate)](docs/key/import/functions/importX509.md)
|
|
62
|
-
- [Private Key Import (PKCS #8)](docs/key/import/functions/importPKCS8.md)
|
|
63
|
-
- Key and Secret Generation Functions
|
|
64
|
-
- [Asymmetric Key Pair Generation](docs/key/generate_key_pair/functions/generateKeyPair.md)
|
|
65
|
-
- [Symmetric Secret Generation](docs/key/generate_secret/functions/generateSecret.md)
|
|
66
|
-
- Key Export Functions
|
|
67
|
-
- [JWK Export](docs/key/export/functions/exportJWK.md)
|
|
68
|
-
- [Private Key Export](docs/key/export/functions/exportPKCS8.md)
|
|
69
|
-
- [Public Key Export](docs/key/export/functions/exportSPKI.md)
|
|
70
|
-
|
|
71
|
-
### JSON Web Signature (JWS)
|
|
72
|
-
|
|
73
|
-
The `jose` module supports signing and verification of JWS messages with arbitrary payloads in Compact, Flattened JSON, and General JSON serialization syntaxes.
|
|
74
|
-
|
|
75
|
-
- Signing - [Compact](docs/jws/compact/sign/classes/CompactSign.md), [Flattened JSON](docs/jws/flattened/sign/classes/FlattenedSign.md), [General JSON](docs/jws/general/sign/classes/GeneralSign.md)
|
|
76
|
-
- Verification - [Compact](docs/jws/compact/verify/functions/compactVerify.md), [Flattened JSON](docs/jws/flattened/verify/functions/flattenedVerify.md), [General JSON](docs/jws/general/verify/functions/generalVerify.md)
|
|
77
|
-
- [Using a remote JSON Web Key Set (JWKS)](docs/jwks/remote/functions/createRemoteJWKSet.md)
|
|
78
|
-
- [Using a local JSON Web Key Set (JWKS)](docs/jwks/local/functions/createLocalJWKSet.md)
|
|
79
|
-
- Utility functions
|
|
80
|
-
- [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
|
|
81
|
-
|
|
82
|
-
### JSON Web Encryption (JWE)
|
|
83
|
-
|
|
84
|
-
The `jose` module supports encryption and decryption of JWE messages with arbitrary plaintext in Compact, Flattened JSON, and General JSON serialization syntaxes.
|
|
85
|
-
|
|
86
|
-
- Encryption - [Compact](docs/jwe/compact/encrypt/classes/CompactEncrypt.md), [Flattened JSON](docs/jwe/flattened/encrypt/classes/FlattenedEncrypt.md), [General JSON](docs/jwe/general/encrypt/classes/GeneralEncrypt.md)
|
|
87
|
-
- Decryption - [Compact](docs/jwe/compact/decrypt/functions/compactDecrypt.md), [Flattened JSON](docs/jwe/flattened/decrypt/functions/flattenedDecrypt.md), [General JSON](docs/jwe/general/decrypt/functions/generalDecrypt.md)
|
|
88
|
-
- Utility functions
|
|
89
|
-
- [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
|
|
90
|
-
|
|
91
|
-
### Other
|
|
92
|
-
|
|
93
|
-
The following are additional features and utilities provided by the `jose` module:
|
|
94
|
-
|
|
95
|
-
- [Calculating JWK Thumbprint](docs/jwk/thumbprint/functions/calculateJwkThumbprint.md)
|
|
96
|
-
- [Calculating JWK Thumbprint URI](docs/jwk/thumbprint/functions/calculateJwkThumbprintUri.md)
|
|
97
|
-
- [Verification using a JWK Embedded in a JWS Header](docs/jwk/embedded/functions/EmbeddedJWK.md)
|
|
98
|
-
- [Unsecured JWT](docs/jwt/unsecured/classes/UnsecuredJWT.md)
|
|
99
|
-
- [JOSE Errors](docs/util/errors/README.md)
|
|
100
|
-
|
|
101
|
-
## Supported Runtimes
|
|
102
|
-
|
|
103
|
-
The `jose` module is compatible with JavaScript runtimes that support the utilized Web API globals and standard built-in objects or are Node.js.
|
|
104
|
-
|
|
105
|
-
The following runtimes are supported _(this is not an exhaustive list)_:
|
|
106
|
-
|
|
107
|
-
- [Bun](https://github.com/panva/jose/issues/471)
|
|
108
|
-
- [Browsers](https://github.com/panva/jose/issues/263)
|
|
109
|
-
- [Cloudflare Workers](https://github.com/panva/jose/issues/265)
|
|
110
|
-
- [Deno](https://github.com/panva/jose/issues/266)
|
|
111
|
-
- [Electron](https://github.com/panva/jose/issues/264)
|
|
112
|
-
- [Node.js](https://github.com/panva/jose/issues/262)
|
|
113
|
-
|
|
114
|
-
Please note that certain algorithms may not be available depending on the runtime used. You can find a list of available algorithms for each runtime in the specific issue links provided above.
|
|
115
|
-
|
|
116
|
-
## Supported Versions
|
|
117
|
-
|
|
118
|
-
| Version | Security Fixes 🔑 | Other Bug Fixes 🐞 | New Features ⭐ | Runtime and Module type |
|
|
119
|
-
| ----------------------------------------------- | ----------------- | ------------------ | --------------- | ------------------------------- |
|
|
120
|
-
| [v6.x](https://github.com/panva/jose/tree/v6.x) | [Security Policy] | ✅ | ✅ | Universal[^universal] ESM[^cjs] |
|
|
121
|
-
| [v5.x](https://github.com/panva/jose/tree/v5.x) | [Security Policy] | ❌ | ❌ | Universal[^universal] CJS + ESM |
|
|
122
|
-
| [v4.x](https://github.com/panva/jose/tree/v4.x) | [Security Policy] | ❌ | ❌ | Universal[^universal] CJS + ESM |
|
|
123
|
-
| [v2.x](https://github.com/panva/jose/tree/v2.x) | [Security Policy] | ❌ | ❌ | Node.js CJS |
|
|
124
|
-
|
|
125
|
-
## Specifications
|
|
126
|
-
|
|
127
|
-
<details>
|
|
128
|
-
<summary>Details</summary>
|
|
129
|
-
|
|
130
|
-
- JSON Web Signature (JWS) - [RFC7515](https://www.rfc-editor.org/rfc/rfc7515)
|
|
131
|
-
- JSON Web Encryption (JWE) - [RFC7516](https://www.rfc-editor.org/rfc/rfc7516)
|
|
132
|
-
- JSON Web Key (JWK) - [RFC7517](https://www.rfc-editor.org/rfc/rfc7517)
|
|
133
|
-
- JSON Web Algorithms (JWA) - [RFC7518](https://www.rfc-editor.org/rfc/rfc7518)
|
|
134
|
-
- JSON Web Token (JWT) - [RFC7519](https://www.rfc-editor.org/rfc/rfc7519)
|
|
135
|
-
- JSON Web Key Thumbprint - [RFC7638](https://www.rfc-editor.org/rfc/rfc7638)
|
|
136
|
-
- JSON Web Key Thumbprint URI - [RFC9278](https://www.rfc-editor.org/rfc/rfc9278)
|
|
137
|
-
- JWS Unencoded Payload Option - [RFC7797](https://www.rfc-editor.org/rfc/rfc7797)
|
|
138
|
-
- CFRG Elliptic Curve ECDH and Signatures - [RFC8037](https://www.rfc-editor.org/rfc/rfc8037)
|
|
139
|
-
- Fully-Specified Algorithms for JOSE - [RFC9864](https://www.rfc-editor.org/rfc/rfc9864.html)
|
|
140
|
-
- ML-DSA for JOSE - [draft-ietf-cose-dilithium-10](https://www.ietf.org/archive/id/draft-ietf-cose-dilithium-10.html)
|
|
141
|
-
|
|
142
|
-
The algorithm implementations in `jose` have been tested using test vectors from their respective specifications as well as [RFC7520](https://www.rfc-editor.org/rfc/rfc7520).
|
|
143
|
-
|
|
144
|
-
</details>
|
|
145
|
-
|
|
146
|
-
[sponsor-auth0]: https://a0.to/signup/panva
|
|
147
|
-
[WebCryptoAPI]: https://w3c.github.io/webcrypto/
|
|
148
|
-
[Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
|
149
|
-
[Security Policy]: https://github.com/panva/jose/security/policy
|
|
150
|
-
|
|
151
|
-
[^cjs]: CJS style `let jose = require('jose')` is possible in Node.js versions where the `require(esm)` feature is enabled by default (^20.19.0 || ^22.12.0 || >= 23.0.0).
|
|
152
|
-
|
|
153
|
-
[^universal]: Assumes runtime support of [WebCryptoAPI][] and [Fetch API][]
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
JS-YAML - YAML 1.2 parser / writer for JavaScript
|
|
2
|
-
=================================================
|
|
3
|
-
|
|
4
|
-
[](https://travis-ci.org/nodeca/js-yaml)
|
|
5
|
-
[](https://www.npmjs.org/package/js-yaml)
|
|
6
|
-
|
|
7
|
-
__[Online Demo](http://nodeca.github.com/js-yaml/)__
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
This is an implementation of [YAML](http://yaml.org/), a human-friendly data
|
|
11
|
-
serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was
|
|
12
|
-
completely rewritten from scratch. Now it's very fast, and supports 1.2 spec.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Installation
|
|
16
|
-
------------
|
|
17
|
-
|
|
18
|
-
### YAML module for node.js
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
npm install js-yaml
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### CLI executable
|
|
26
|
-
|
|
27
|
-
If you want to inspect your YAML files from CLI, install js-yaml globally:
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
npm install -g js-yaml
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
#### Usage
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
usage: js-yaml [-h] [-v] [-c] [-t] file
|
|
37
|
-
|
|
38
|
-
Positional arguments:
|
|
39
|
-
file File with YAML document(s)
|
|
40
|
-
|
|
41
|
-
Optional arguments:
|
|
42
|
-
-h, --help Show this help message and exit.
|
|
43
|
-
-v, --version Show program's version number and exit.
|
|
44
|
-
-c, --compact Display errors in compact mode
|
|
45
|
-
-t, --trace Show stack trace on error
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### Bundled YAML library for browsers
|
|
50
|
-
|
|
51
|
-
``` html
|
|
52
|
-
<!-- esprima required only for !!js/function -->
|
|
53
|
-
<script src="esprima.js"></script>
|
|
54
|
-
<script src="js-yaml.min.js"></script>
|
|
55
|
-
<script type="text/javascript">
|
|
56
|
-
var doc = jsyaml.load('greeting: hello\nname: world');
|
|
57
|
-
</script>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Browser support was done mostly for the online demo. If you find any errors - feel
|
|
61
|
-
free to send pull requests with fixes. Also note, that IE and other old browsers
|
|
62
|
-
needs [es5-shims](https://github.com/kriskowal/es5-shim) to operate.
|
|
63
|
-
|
|
64
|
-
Notes:
|
|
65
|
-
|
|
66
|
-
1. We have no resources to support browserified version. Don't expect it to be
|
|
67
|
-
well tested. Don't expect fast fixes if something goes wrong there.
|
|
68
|
-
2. `!!js/function` in browser bundle will not work by default. If you really need
|
|
69
|
-
it - load `esprima` parser first (via amd or directly).
|
|
70
|
-
3. `!!bin` in browser will return `Array`, because browsers do not support
|
|
71
|
-
node.js `Buffer` and adding Buffer shims is completely useless on practice.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
API
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
Here we cover the most 'useful' methods. If you need advanced details (creating
|
|
78
|
-
your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and
|
|
79
|
-
[examples](https://github.com/nodeca/js-yaml/tree/master/examples) for more
|
|
80
|
-
info.
|
|
81
|
-
|
|
82
|
-
``` javascript
|
|
83
|
-
const yaml = require('js-yaml');
|
|
84
|
-
const fs = require('fs');
|
|
85
|
-
|
|
86
|
-
// Get document, or throw exception on error
|
|
87
|
-
try {
|
|
88
|
-
const doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
|
|
89
|
-
console.log(doc);
|
|
90
|
-
} catch (e) {
|
|
91
|
-
console.log(e);
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### safeLoad (string [ , options ])
|
|
97
|
-
|
|
98
|
-
**Recommended loading way.** Parses `string` as single YAML document. Returns either a
|
|
99
|
-
plain object, a string or `undefined`, or throws `YAMLException` on error. By default, does
|
|
100
|
-
not support regexps, functions and undefined. This method is safe for untrusted data.
|
|
101
|
-
|
|
102
|
-
options:
|
|
103
|
-
|
|
104
|
-
- `filename` _(default: null)_ - string to be used as a file path in
|
|
105
|
-
error/warning messages.
|
|
106
|
-
- `onWarning` _(default: null)_ - function to call on warning messages.
|
|
107
|
-
Loader will call this function with an instance of `YAMLException` for each warning.
|
|
108
|
-
- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use.
|
|
109
|
-
- `FAILSAFE_SCHEMA` - only strings, arrays and plain objects:
|
|
110
|
-
http://www.yaml.org/spec/1.2/spec.html#id2802346
|
|
111
|
-
- `JSON_SCHEMA` - all JSON-supported types:
|
|
112
|
-
http://www.yaml.org/spec/1.2/spec.html#id2803231
|
|
113
|
-
- `CORE_SCHEMA` - same as `JSON_SCHEMA`:
|
|
114
|
-
http://www.yaml.org/spec/1.2/spec.html#id2804923
|
|
115
|
-
- `DEFAULT_SAFE_SCHEMA` - all supported YAML types, without unsafe ones
|
|
116
|
-
(`!!js/undefined`, `!!js/regexp` and `!!js/function`):
|
|
117
|
-
http://yaml.org/type/
|
|
118
|
-
- `DEFAULT_FULL_SCHEMA` - all supported YAML types.
|
|
119
|
-
- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.
|
|
120
|
-
|
|
121
|
-
NOTE: This function **does not** understand multi-document sources, it throws
|
|
122
|
-
exception on those.
|
|
123
|
-
|
|
124
|
-
NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions.
|
|
125
|
-
So, the JSON schema is not as strictly defined in the YAML specification.
|
|
126
|
-
It allows numbers in any notation, use `Null` and `NULL` as `null`, etc.
|
|
127
|
-
The core schema also has no such restrictions. It allows binary notation for integers.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
### load (string [ , options ])
|
|
131
|
-
|
|
132
|
-
**Use with care with untrusted sources**. The same as `safeLoad()` but uses
|
|
133
|
-
`DEFAULT_FULL_SCHEMA` by default - adds some JavaScript-specific types:
|
|
134
|
-
`!!js/function`, `!!js/regexp` and `!!js/undefined`. For untrusted sources, you
|
|
135
|
-
must additionally validate object structure to avoid injections:
|
|
136
|
-
|
|
137
|
-
``` javascript
|
|
138
|
-
const untrusted_code = '"toString": !<tag:yaml.org,2002:js/function> "function (){very_evil_thing();}"';
|
|
139
|
-
|
|
140
|
-
// I'm just converting that string, what could possibly go wrong?
|
|
141
|
-
require('js-yaml').load(untrusted_code) + ''
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
### safeLoadAll (string [, iterator] [, options ])
|
|
146
|
-
|
|
147
|
-
Same as `safeLoad()`, but understands multi-document sources. Applies
|
|
148
|
-
`iterator` to each document if specified, or returns array of documents.
|
|
149
|
-
|
|
150
|
-
``` javascript
|
|
151
|
-
const yaml = require('js-yaml');
|
|
152
|
-
|
|
153
|
-
yaml.safeLoadAll(data, function (doc) {
|
|
154
|
-
console.log(doc);
|
|
155
|
-
});
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
### loadAll (string [, iterator] [ , options ])
|
|
160
|
-
|
|
161
|
-
Same as `safeLoadAll()` but uses `DEFAULT_FULL_SCHEMA` by default.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
### safeDump (object [ , options ])
|
|
165
|
-
|
|
166
|
-
Serializes `object` as a YAML document. Uses `DEFAULT_SAFE_SCHEMA`, so it will
|
|
167
|
-
throw an exception if you try to dump regexps or functions. However, you can
|
|
168
|
-
disable exceptions by setting the `skipInvalid` option to `true`.
|
|
169
|
-
|
|
170
|
-
options:
|
|
171
|
-
|
|
172
|
-
- `indent` _(default: 2)_ - indentation width to use (in spaces).
|
|
173
|
-
- `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements
|
|
174
|
-
- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function
|
|
175
|
-
in the safe schema) and skip pairs and single values with such types.
|
|
176
|
-
- `flowLevel` (default: -1) - specifies level of nesting, when to switch from
|
|
177
|
-
block to flow style for collections. -1 means block style everwhere
|
|
178
|
-
- `styles` - "tag" => "style" map. Each tag may have own set of styles.
|
|
179
|
-
- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ specifies a schema to use.
|
|
180
|
-
- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a
|
|
181
|
-
function, use the function to sort the keys.
|
|
182
|
-
- `lineWidth` _(default: `80`)_ - set max line width.
|
|
183
|
-
- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references
|
|
184
|
-
- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older
|
|
185
|
-
yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
|
|
186
|
-
- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded.
|
|
187
|
-
|
|
188
|
-
The following table show availlable styles (e.g. "canonical",
|
|
189
|
-
"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml
|
|
190
|
-
output is shown on the right side after `=>` (default setting) or `->`:
|
|
191
|
-
|
|
192
|
-
``` none
|
|
193
|
-
!!null
|
|
194
|
-
"canonical" -> "~"
|
|
195
|
-
"lowercase" => "null"
|
|
196
|
-
"uppercase" -> "NULL"
|
|
197
|
-
"camelcase" -> "Null"
|
|
198
|
-
|
|
199
|
-
!!int
|
|
200
|
-
"binary" -> "0b1", "0b101010", "0b1110001111010"
|
|
201
|
-
"octal" -> "01", "052", "016172"
|
|
202
|
-
"decimal" => "1", "42", "7290"
|
|
203
|
-
"hexadecimal" -> "0x1", "0x2A", "0x1C7A"
|
|
204
|
-
|
|
205
|
-
!!bool
|
|
206
|
-
"lowercase" => "true", "false"
|
|
207
|
-
"uppercase" -> "TRUE", "FALSE"
|
|
208
|
-
"camelcase" -> "True", "False"
|
|
209
|
-
|
|
210
|
-
!!float
|
|
211
|
-
"lowercase" => ".nan", '.inf'
|
|
212
|
-
"uppercase" -> ".NAN", '.INF'
|
|
213
|
-
"camelcase" -> ".NaN", '.Inf'
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
Example:
|
|
217
|
-
|
|
218
|
-
``` javascript
|
|
219
|
-
safeDump (object, {
|
|
220
|
-
'styles': {
|
|
221
|
-
'!!null': 'canonical' // dump null as ~
|
|
222
|
-
},
|
|
223
|
-
'sortKeys': true // sort object keys
|
|
224
|
-
});
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### dump (object [ , options ])
|
|
228
|
-
|
|
229
|
-
Same as `safeDump()` but without limits (uses `DEFAULT_FULL_SCHEMA` by default).
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
Supported YAML types
|
|
233
|
-
--------------------
|
|
234
|
-
|
|
235
|
-
The list of standard YAML tags and corresponding JavaScipt types. See also
|
|
236
|
-
[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and
|
|
237
|
-
[YAML types repository](http://yaml.org/type/).
|
|
238
|
-
|
|
239
|
-
```
|
|
240
|
-
!!null '' # null
|
|
241
|
-
!!bool 'yes' # bool
|
|
242
|
-
!!int '3...' # number
|
|
243
|
-
!!float '3.14...' # number
|
|
244
|
-
!!binary '...base64...' # buffer
|
|
245
|
-
!!timestamp 'YYYY-...' # date
|
|
246
|
-
!!omap [ ... ] # array of key-value pairs
|
|
247
|
-
!!pairs [ ... ] # array or array pairs
|
|
248
|
-
!!set { ... } # array of objects with given keys and null values
|
|
249
|
-
!!str '...' # string
|
|
250
|
-
!!seq [ ... ] # array
|
|
251
|
-
!!map { ... } # object
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
**JavaScript-specific tags**
|
|
255
|
-
|
|
256
|
-
```
|
|
257
|
-
!!js/regexp /pattern/gim # RegExp
|
|
258
|
-
!!js/undefined '' # Undefined
|
|
259
|
-
!!js/function 'function () {...}' # Function
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
Caveats
|
|
263
|
-
-------
|
|
264
|
-
|
|
265
|
-
Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects
|
|
266
|
-
or arrays as keys, and stringifies (by calling `toString()` method) them at the
|
|
267
|
-
moment of adding them.
|
|
268
|
-
|
|
269
|
-
``` yaml
|
|
270
|
-
---
|
|
271
|
-
? [ foo, bar ]
|
|
272
|
-
: - baz
|
|
273
|
-
? { foo: bar }
|
|
274
|
-
: - baz
|
|
275
|
-
- baz
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
``` javascript
|
|
279
|
-
{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] }
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
Also, reading of properties on implicit block mapping keys is not supported yet.
|
|
283
|
-
So, the following YAML document cannot be loaded.
|
|
284
|
-
|
|
285
|
-
``` yaml
|
|
286
|
-
&anchor foo:
|
|
287
|
-
foo: bar
|
|
288
|
-
*anchor: duplicate key
|
|
289
|
-
baz: bat
|
|
290
|
-
*anchor: duplicate key
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
js-yaml for enterprise
|
|
295
|
-
----------------------
|
|
296
|
-
|
|
297
|
-
Available as part of the Tidelift Subscription
|
|
298
|
-
|
|
299
|
-
The maintainers of js-yaml and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-js-yaml?utm_source=npm-js-yaml&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
BSD 2-Clause License
|
|
2
|
-
|
|
3
|
-
Original source code is copyright (c) 2019-2025 Remy Rylan
|
|
4
|
-
<https://github.com/RemyRylan>
|
|
5
|
-
|
|
6
|
-
All JSON Schema documentation and descriptions are copyright (c):
|
|
7
|
-
|
|
8
|
-
2009 [draft-0] IETF Trust <https://www.ietf.org/>, Kris Zyp <kris@sitepen.com>,
|
|
9
|
-
and SitePen (USA) <https://www.sitepen.com/>.
|
|
10
|
-
|
|
11
|
-
2009 [draft-1] IETF Trust <https://www.ietf.org/>, Kris Zyp <kris@sitepen.com>,
|
|
12
|
-
and SitePen (USA) <https://www.sitepen.com/>.
|
|
13
|
-
|
|
14
|
-
2010 [draft-2] IETF Trust <https://www.ietf.org/>, Kris Zyp <kris@sitepen.com>,
|
|
15
|
-
and SitePen (USA) <https://www.sitepen.com/>.
|
|
16
|
-
|
|
17
|
-
2010 [draft-3] IETF Trust <https://www.ietf.org/>, Kris Zyp <kris@sitepen.com>,
|
|
18
|
-
Gary Court <gary.court@gmail.com>, and SitePen (USA) <https://www.sitepen.com/>.
|
|
19
|
-
|
|
20
|
-
2013 [draft-4] IETF Trust <https://www.ietf.org/>), Francis Galiegue
|
|
21
|
-
<fgaliegue@gmail.com>, Kris Zyp <kris@sitepen.com>, Gary Court
|
|
22
|
-
<gary.court@gmail.com>, and SitePen (USA) <https://www.sitepen.com/>.
|
|
23
|
-
|
|
24
|
-
2018 [draft-7] IETF Trust <https://www.ietf.org/>, Austin Wright <aaa@bzfx.net>,
|
|
25
|
-
Henry Andrews <henry@cloudflare.com>, Geraint Luff <luffgd@gmail.com>, and
|
|
26
|
-
Cloudflare, Inc. <https://www.cloudflare.com/>.
|
|
27
|
-
|
|
28
|
-
2019 [draft-2019-09] IETF Trust <https://www.ietf.org/>, Austin Wright
|
|
29
|
-
<aaa@bzfx.net>, Henry Andrews <andrews_henry@yahoo.com>, Ben Hutton
|
|
30
|
-
<bh7@sanger.ac.uk>, and Greg Dennis <gregsdennis@yahoo.com>.
|
|
31
|
-
|
|
32
|
-
2020 [draft-2020-12] IETF Trust <https://www.ietf.org/>, Austin Wright
|
|
33
|
-
<aaa@bzfx.net>, Henry Andrews <andrews_henry@yahoo.com>, Ben Hutton
|
|
34
|
-
<ben@jsonschema.dev>, and Greg Dennis <gregsdennis@yahoo.com>.
|
|
35
|
-
|
|
36
|
-
All rights reserved.
|
|
37
|
-
|
|
38
|
-
Redistribution and use in source and binary forms, with or without modification,
|
|
39
|
-
are permitted provided that the following conditions are met:
|
|
40
|
-
|
|
41
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
42
|
-
list of conditions and the following disclaimer.
|
|
43
|
-
|
|
44
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
45
|
-
this list of conditions and the following disclaimer in the documentation
|
|
46
|
-
and/or other materials provided with the distribution.
|
|
47
|
-
|
|
48
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
49
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
50
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
51
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
52
|
-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
53
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
54
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
55
|
-
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
56
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
57
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
## Unreleased
|
|
2
|
-
- Fixes stringify to only take ancestors into account when checking
|
|
3
|
-
circularity.
|
|
4
|
-
It previously assumed every visited object was circular which led to [false
|
|
5
|
-
positives][issue9].
|
|
6
|
-
Uses the tiny serializer I wrote for [Must.js][must] a year and a half ago.
|
|
7
|
-
- Fixes calling the `replacer` function in the proper context (`thisArg`).
|
|
8
|
-
- Fixes calling the `cycleReplacer` function in the proper context (`thisArg`).
|
|
9
|
-
- Speeds serializing by a factor of
|
|
10
|
-
Big-O(h-my-god-it-linearly-searched-every-object) it had ever seen. Searching
|
|
11
|
-
only the ancestors for a circular references speeds up things considerably.
|
|
12
|
-
|
|
13
|
-
[must]: https://github.com/moll/js-must
|
|
14
|
-
[issue9]: https://github.com/isaacs/json-stringify-safe/issues/9
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Blue Oak Model License
|
|
2
|
-
|
|
3
|
-
Version 1.0.0
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
This license gives everyone as much permission to work with
|
|
8
|
-
this software as possible, while protecting contributors
|
|
9
|
-
from liability.
|
|
10
|
-
|
|
11
|
-
## Acceptance
|
|
12
|
-
|
|
13
|
-
In order to receive this license, you must agree to its
|
|
14
|
-
rules. The rules of this license are both obligations
|
|
15
|
-
under that agreement and conditions to your license.
|
|
16
|
-
You must not do anything with this software that triggers
|
|
17
|
-
a rule that you cannot or will not follow.
|
|
18
|
-
|
|
19
|
-
## Copyright
|
|
20
|
-
|
|
21
|
-
Each contributor licenses you to do everything with this
|
|
22
|
-
software that would otherwise infringe that contributor's
|
|
23
|
-
copyright in it.
|
|
24
|
-
|
|
25
|
-
## Notices
|
|
26
|
-
|
|
27
|
-
You must ensure that everyone who gets a copy of
|
|
28
|
-
any part of this software from you, with or without
|
|
29
|
-
changes, also gets the text of this license or a link to
|
|
30
|
-
<https://blueoakcouncil.org/license/1.0.0>.
|
|
31
|
-
|
|
32
|
-
## Excuse
|
|
33
|
-
|
|
34
|
-
If anyone notifies you in writing that you have not
|
|
35
|
-
complied with [Notices](#notices), you can keep your
|
|
36
|
-
license by taking all practical steps to comply within 30
|
|
37
|
-
days after the notice. If you do not do so, your license
|
|
38
|
-
ends immediately.
|
|
39
|
-
|
|
40
|
-
## Patent
|
|
41
|
-
|
|
42
|
-
Each contributor licenses you to do everything with this
|
|
43
|
-
software that would otherwise infringe any patent claims
|
|
44
|
-
they can license or become able to license.
|
|
45
|
-
|
|
46
|
-
## Reliability
|
|
47
|
-
|
|
48
|
-
No contributor can revoke this license.
|
|
49
|
-
|
|
50
|
-
## No Liability
|
|
51
|
-
|
|
52
|
-
***As far as the law allows, this software comes as is,
|
|
53
|
-
without any warranty or condition, and no contributor
|
|
54
|
-
will be liable to anyone for any damages related to this
|
|
55
|
-
software or this license, under any kind of legal claim.***
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
1.1.0 / 2019-04-24
|
|
2
|
-
==================
|
|
3
|
-
|
|
4
|
-
* Add `test(string)` function
|
|
5
|
-
|
|
6
|
-
1.0.2 / 2019-04-19
|
|
7
|
-
==================
|
|
8
|
-
|
|
9
|
-
* Fix JSDoc comment for `parse` function
|
|
10
|
-
|
|
11
|
-
1.0.1 / 2018-10-20
|
|
12
|
-
==================
|
|
13
|
-
|
|
14
|
-
* Remove left over `parameters` property from class
|
|
15
|
-
|
|
16
|
-
1.0.0 / 2018-10-20
|
|
17
|
-
==================
|
|
18
|
-
|
|
19
|
-
This major release brings the module back to it's RFC 6838 roots. If you want
|
|
20
|
-
a module to parse the `Content-Type` or similar HTTP headers, use the
|
|
21
|
-
`content-type` module instead.
|
|
22
|
-
|
|
23
|
-
* Drop support for Node.js below 0.8
|
|
24
|
-
* Remove parameter handling, which is outside RFC 6838 scope
|
|
25
|
-
* Remove `parse(req)` and `parse(res)` signatures
|
|
26
|
-
* perf: enable strict mode
|
|
27
|
-
* perf: use a class for object creation
|
|
28
|
-
|
|
29
|
-
0.3.0 / 2014-09-07
|
|
30
|
-
==================
|
|
31
|
-
|
|
32
|
-
* Support Node.js 0.6
|
|
33
|
-
* Throw error when parameter format invalid on parse
|
|
34
|
-
|
|
35
|
-
0.2.0 / 2014-06-18
|
|
36
|
-
==================
|
|
37
|
-
|
|
38
|
-
* Add `typer.format()` to format media types
|
|
39
|
-
|
|
40
|
-
0.1.0 / 2014-06-17
|
|
41
|
-
==================
|
|
42
|
-
|
|
43
|
-
* Accept `req` as argument to `parse`
|
|
44
|
-
* Accept `res` as argument to `parse`
|
|
45
|
-
* Parse media type with extra LWS between type and first parameter
|
|
46
|
-
|
|
47
|
-
0.0.0 / 2014-06-13
|
|
48
|
-
==================
|
|
49
|
-
|
|
50
|
-
* Initial implementation
|