@qp-mongosh/types 0.0.0-dev.3 → 0.0.0-dev.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/.eslintignore CHANGED
@@ -1,2 +1,2 @@
1
- node_modules
2
- lib
1
+ node_modules
2
+ lib
package/.eslintrc.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('../../config/eslintrc.base');
1
+ module.exports = require('../../config/eslintrc.base');
package/AUTHORS CHANGED
@@ -1,6 +1,6 @@
1
- Anna Henningsen <anna@addaleax.net>
2
- Maurizio Casimirri <maurizio.cas@gmail.com>
3
- github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
4
- Michael Rose <michael_rose@gmx.de>
5
- Alena Khineika <alena.khineika@gmail.com>
6
- Sergey Petushkov <petushkov.sergey@gmail.com>
1
+ Anna Henningsen <anna@addaleax.net>
2
+ Maurizio Casimirri <maurizio.cas@gmail.com>
3
+ github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
4
+ Michael Rose <michael_rose@gmx.de>
5
+ Alena Khineika <alena.khineika@gmail.com>
6
+ Sergey Petushkov <petushkov.sergey@gmail.com>
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # `@qp-mongosh/types`
2
-
3
- > TODO: description
4
-
5
- ## Usage
6
-
7
- ```
8
- const types = require('@qp-mongosh/types');
9
-
10
- // TODO: DEMONSTRATE API
11
- ```
1
+ # `@qp-mongosh/types`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const types = require('@qp-mongosh/types');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
package/package.json CHANGED
@@ -1,38 +1,38 @@
1
- {
2
- "name": "@qp-mongosh/types",
3
- "version": "0.0.0-dev.3",
4
- "description": "Types for mongosh internals",
5
- "author": "Anna Henningsen <anna.henningsen@mongodb.com>",
6
- "homepage": "https://github.com/mongodb-js/mongosh/tree/main/packages/types#readme",
7
- "license": "Apache-2.0",
8
- "main": "lib/index.js",
9
- "types": "lib/index.d.ts",
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "engines": {
14
- "node": ">=12.4.0"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/mongodb-js/mongosh.git"
19
- },
20
- "scripts": {
21
- "check": "npm run lint",
22
- "compile-ts": "tsc -p tsconfig.json",
23
- "lint": "eslint --report-unused-disable-directives \"./{src,test}/**/*.{js,ts,tsx}\"",
24
- "prepublish": "npm run compile-ts",
25
- "test": "mocha --timeout 15000 -r ts-node/register \"./src/*.spec.ts\"",
26
- "test-ci": "node ../../scripts/run-if-package-requested.js npm test"
27
- },
28
- "bugs": {
29
- "url": "https://github.com/mongodb-js/mongosh/issues"
30
- },
31
- "mongosh": {
32
- "unitTestsOnly": true
33
- },
34
- "dependencies": {
35
- "@mongodb-js/devtools-connect": "^1.2.4",
36
- "qp-mongodb": "0.0.0-dev.3"
37
- }
38
- }
1
+ {
2
+ "name": "@qp-mongosh/types",
3
+ "version": "0.0.0-dev.8",
4
+ "description": "Types for mongosh internals",
5
+ "author": "Anna Henningsen <anna.henningsen@mongodb.com>",
6
+ "homepage": "https://github.com/mongodb-js/mongosh/tree/main/packages/types#readme",
7
+ "license": "Apache-2.0",
8
+ "main": "lib/index.js",
9
+ "types": "lib/index.d.ts",
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "engines": {
14
+ "node": ">=12.4.0"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/mongodb-js/mongosh.git"
19
+ },
20
+ "scripts": {
21
+ "check": "npm run lint",
22
+ "compile-ts": "tsc -p tsconfig.json",
23
+ "lint": "eslint --report-unused-disable-directives \"./{src,test}/**/*.{js,ts,tsx}\"",
24
+ "prepublish": "npm run compile-ts",
25
+ "test": "mocha --timeout 15000 -r ts-node/register \"./src/*.spec.ts\"",
26
+ "test-ci": "node ../../scripts/run-if-package-requested.js npm test"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/mongodb-js/mongosh/issues"
30
+ },
31
+ "mongosh": {
32
+ "unitTestsOnly": true
33
+ },
34
+ "dependencies": {
35
+ "@mongodb-js/devtools-connect": "^1.2.4",
36
+ "qp-mongodb": "0.0.0-dev.8"
37
+ }
38
+ }
package/src/index.spec.ts CHANGED
@@ -1,69 +1,69 @@
1
- import { CliUserConfig, CliUserConfigValidator } from './';
2
- import { expect } from 'chai';
3
-
4
- describe('config validation', () => {
5
- it('validates config option values', async() => {
6
- const { validate } = CliUserConfigValidator as any;
7
- expect(await validate('userId', 'foo')).to.equal(null);
8
- expect(await validate('telemetryAnonymousId', 'foo')).to.equal(null);
9
- expect(await validate('disableGreetingMessage', 'foo')).to.equal(null);
10
- expect(await validate('inspectDepth', 'foo')).to.equal('inspectDepth must be a positive integer');
11
- expect(await validate('inspectDepth', -1)).to.equal('inspectDepth must be a positive integer');
12
- expect(await validate('inspectDepth', 0)).to.equal(null);
13
- expect(await validate('inspectDepth', 1)).to.equal(null);
14
- expect(await validate('inspectDepth', Infinity)).to.equal(null);
15
- expect(await validate('historyLength', 'foo')).to.equal('historyLength must be a positive integer');
16
- expect(await validate('historyLength', -1)).to.equal('historyLength must be a positive integer');
17
- expect(await validate('historyLength', 0)).to.equal(null);
18
- expect(await validate('historyLength', 1)).to.equal(null);
19
- expect(await validate('historyLength', Infinity)).to.equal(null);
20
- expect(await validate('showStackTraces', 'foo')).to.equal('showStackTraces must be a boolean');
21
- expect(await validate('showStackTraces', -1)).to.equal('showStackTraces must be a boolean');
22
- expect(await validate('showStackTraces', false)).to.equal(null);
23
- expect(await validate('showStackTraces', true)).to.equal(null);
24
- expect(await validate('redactHistory', 'foo')).to.equal("redactHistory must be one of 'keep', 'remove', or 'remove-redact'");
25
- expect(await validate('redactHistory', -1)).to.equal("redactHistory must be one of 'keep', 'remove', or 'remove-redact'");
26
- expect(await validate('redactHistory', false)).to.equal("redactHistory must be one of 'keep', 'remove', or 'remove-redact'");
27
- expect(await validate('redactHistory', 'keep')).to.equal(null);
28
- expect(await validate('redactHistory', 'remove')).to.equal(null);
29
- expect(await validate('redactHistory', 'remove-redact')).to.equal(null);
30
- expect(await validate('displayBatchSize', 'foo')).to.equal('displayBatchSize must be a positive integer');
31
- expect(await validate('displayBatchSize', -1)).to.equal('displayBatchSize must be a positive integer');
32
- expect(await validate('displayBatchSize', 0)).to.equal('displayBatchSize must be a positive integer');
33
- expect(await validate('displayBatchSize', 1)).to.equal(null);
34
- expect(await validate('displayBatchSize', Infinity)).to.equal(null);
35
- expect(await validate('maxTimeMS', 'foo')).to.equal('maxTimeMS must be null or a positive integer');
36
- expect(await validate('maxTimeMS', -1)).to.equal('maxTimeMS must be null or a positive integer');
37
- expect(await validate('maxTimeMS', 0)).to.equal('maxTimeMS must be null or a positive integer');
38
- expect(await validate('maxTimeMS', 1)).to.equal(null);
39
- expect(await validate('maxTimeMS', null)).to.equal(null);
40
- expect(await validate('enableTelemetry', 'foo')).to.equal('enableTelemetry must be a boolean');
41
- expect(await validate('enableTelemetry', -1)).to.equal('enableTelemetry must be a boolean');
42
- expect(await validate('enableTelemetry', false)).to.equal(null);
43
- expect(await validate('enableTelemetry', true)).to.equal(null);
44
- expect(await validate('inspectCompact', 'foo')).to.equal('inspectCompact must be a boolean or a positive integer');
45
- expect(await validate('inspectCompact', -1)).to.equal('inspectCompact must be a boolean or a positive integer');
46
- expect(await validate('inspectCompact', false)).to.equal(null);
47
- expect(await validate('inspectCompact', true)).to.equal(null);
48
- expect(await validate('inspectCompact', 32)).to.equal(null);
49
- expect(await validate('snippetIndexSourceURLs', 'https://example.com/')).to.equal(null);
50
- expect(await validate('snippetIndexSourceURLs', 'foo')).to.equal('snippetIndexSourceURLs must be a ;-separated list of valid URLs');
51
- expect(await validate('snippetIndexSourceURLs', 'https://xyz/;foo')).to.equal('snippetIndexSourceURLs must be a ;-separated list of valid URLs');
52
- expect(await validate('snippetIndexSourceURLs', ';')).to.equal(null);
53
- expect(await validate('snippetIndexSourceURLs', 0)).to.equal('snippetIndexSourceURLs must be a ;-separated list of valid URLs');
54
- expect(await validate('snippetRegistryURL', ';')).to.equal('snippetRegistryURL must be a valid URL');
55
- expect(await validate('snippetRegistryURL', 'https://registry.npmjs.org')).to.equal(null);
56
- expect(await validate('snippetRegistryURL', 0)).to.equal('snippetRegistryURL must be a valid URL');
57
- expect(await validate('snippetAutoload', 'foo')).to.equal('snippetAutoload must be a boolean');
58
- expect(await validate('snippetAutoload', -1)).to.equal('snippetAutoload must be a boolean');
59
- expect(await validate('snippetAutoload', false)).to.equal(null);
60
- expect(await validate('snippetAutoload', true)).to.equal(null);
61
- });
62
-
63
- it('allows default CliUserConfig values', async() => {
64
- const userConfig = new CliUserConfig();
65
- for (const key of Object.keys(userConfig) as (keyof CliUserConfig)[]) {
66
- expect(await CliUserConfigValidator.validate(key, userConfig[key])).to.equal(null);
67
- }
68
- });
69
- });
1
+ import { CliUserConfig, CliUserConfigValidator } from './';
2
+ import { expect } from 'chai';
3
+
4
+ describe('config validation', () => {
5
+ it('validates config option values', async() => {
6
+ const { validate } = CliUserConfigValidator as any;
7
+ expect(await validate('userId', 'foo')).to.equal(null);
8
+ expect(await validate('telemetryAnonymousId', 'foo')).to.equal(null);
9
+ expect(await validate('disableGreetingMessage', 'foo')).to.equal(null);
10
+ expect(await validate('inspectDepth', 'foo')).to.equal('inspectDepth must be a positive integer');
11
+ expect(await validate('inspectDepth', -1)).to.equal('inspectDepth must be a positive integer');
12
+ expect(await validate('inspectDepth', 0)).to.equal(null);
13
+ expect(await validate('inspectDepth', 1)).to.equal(null);
14
+ expect(await validate('inspectDepth', Infinity)).to.equal(null);
15
+ expect(await validate('historyLength', 'foo')).to.equal('historyLength must be a positive integer');
16
+ expect(await validate('historyLength', -1)).to.equal('historyLength must be a positive integer');
17
+ expect(await validate('historyLength', 0)).to.equal(null);
18
+ expect(await validate('historyLength', 1)).to.equal(null);
19
+ expect(await validate('historyLength', Infinity)).to.equal(null);
20
+ expect(await validate('showStackTraces', 'foo')).to.equal('showStackTraces must be a boolean');
21
+ expect(await validate('showStackTraces', -1)).to.equal('showStackTraces must be a boolean');
22
+ expect(await validate('showStackTraces', false)).to.equal(null);
23
+ expect(await validate('showStackTraces', true)).to.equal(null);
24
+ expect(await validate('redactHistory', 'foo')).to.equal("redactHistory must be one of 'keep', 'remove', or 'remove-redact'");
25
+ expect(await validate('redactHistory', -1)).to.equal("redactHistory must be one of 'keep', 'remove', or 'remove-redact'");
26
+ expect(await validate('redactHistory', false)).to.equal("redactHistory must be one of 'keep', 'remove', or 'remove-redact'");
27
+ expect(await validate('redactHistory', 'keep')).to.equal(null);
28
+ expect(await validate('redactHistory', 'remove')).to.equal(null);
29
+ expect(await validate('redactHistory', 'remove-redact')).to.equal(null);
30
+ expect(await validate('displayBatchSize', 'foo')).to.equal('displayBatchSize must be a positive integer');
31
+ expect(await validate('displayBatchSize', -1)).to.equal('displayBatchSize must be a positive integer');
32
+ expect(await validate('displayBatchSize', 0)).to.equal('displayBatchSize must be a positive integer');
33
+ expect(await validate('displayBatchSize', 1)).to.equal(null);
34
+ expect(await validate('displayBatchSize', Infinity)).to.equal(null);
35
+ expect(await validate('maxTimeMS', 'foo')).to.equal('maxTimeMS must be null or a positive integer');
36
+ expect(await validate('maxTimeMS', -1)).to.equal('maxTimeMS must be null or a positive integer');
37
+ expect(await validate('maxTimeMS', 0)).to.equal('maxTimeMS must be null or a positive integer');
38
+ expect(await validate('maxTimeMS', 1)).to.equal(null);
39
+ expect(await validate('maxTimeMS', null)).to.equal(null);
40
+ expect(await validate('enableTelemetry', 'foo')).to.equal('enableTelemetry must be a boolean');
41
+ expect(await validate('enableTelemetry', -1)).to.equal('enableTelemetry must be a boolean');
42
+ expect(await validate('enableTelemetry', false)).to.equal(null);
43
+ expect(await validate('enableTelemetry', true)).to.equal(null);
44
+ expect(await validate('inspectCompact', 'foo')).to.equal('inspectCompact must be a boolean or a positive integer');
45
+ expect(await validate('inspectCompact', -1)).to.equal('inspectCompact must be a boolean or a positive integer');
46
+ expect(await validate('inspectCompact', false)).to.equal(null);
47
+ expect(await validate('inspectCompact', true)).to.equal(null);
48
+ expect(await validate('inspectCompact', 32)).to.equal(null);
49
+ expect(await validate('snippetIndexSourceURLs', 'https://example.com/')).to.equal(null);
50
+ expect(await validate('snippetIndexSourceURLs', 'foo')).to.equal('snippetIndexSourceURLs must be a ;-separated list of valid URLs');
51
+ expect(await validate('snippetIndexSourceURLs', 'https://xyz/;foo')).to.equal('snippetIndexSourceURLs must be a ;-separated list of valid URLs');
52
+ expect(await validate('snippetIndexSourceURLs', ';')).to.equal(null);
53
+ expect(await validate('snippetIndexSourceURLs', 0)).to.equal('snippetIndexSourceURLs must be a ;-separated list of valid URLs');
54
+ expect(await validate('snippetRegistryURL', ';')).to.equal('snippetRegistryURL must be a valid URL');
55
+ expect(await validate('snippetRegistryURL', 'https://registry.npmjs.org')).to.equal(null);
56
+ expect(await validate('snippetRegistryURL', 0)).to.equal('snippetRegistryURL must be a valid URL');
57
+ expect(await validate('snippetAutoload', 'foo')).to.equal('snippetAutoload must be a boolean');
58
+ expect(await validate('snippetAutoload', -1)).to.equal('snippetAutoload must be a boolean');
59
+ expect(await validate('snippetAutoload', false)).to.equal(null);
60
+ expect(await validate('snippetAutoload', true)).to.equal(null);
61
+ });
62
+
63
+ it('allows default CliUserConfig values', async() => {
64
+ const userConfig = new CliUserConfig();
65
+ for (const key of Object.keys(userConfig) as (keyof CliUserConfig)[]) {
66
+ expect(await CliUserConfigValidator.validate(key, userConfig[key])).to.equal(null);
67
+ }
68
+ });
69
+ });