mongodb-atlas-api-client 4.10.0 → 4.13.0
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/.github/copilot-instructions.md +239 -0
- package/eslint.config.js +188 -234
- package/package.json +7 -7
- package/test/helper.test.js +1 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# MongoDB Atlas API Client - Copilot Instructions
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
This is a MongoDB Atlas API client library for Node.js that provides a programmatic interface to the MongoDB Atlas REST API. The library uses HTTP Digest Authentication and wraps the urllib HTTP client library.
|
|
6
|
+
|
|
7
|
+
## Architecture and Code Organization
|
|
8
|
+
|
|
9
|
+
### Module Structure
|
|
10
|
+
- Each API resource (User, Cluster, Project, Organization, etc.) is implemented as a separate class in `src/`
|
|
11
|
+
- Each class follows a consistent pattern:
|
|
12
|
+
- Constructor receives: `client`, `baseUrl`, and optionally `projectId`
|
|
13
|
+
- Methods return promises
|
|
14
|
+
- All API methods accept an optional `options` parameter
|
|
15
|
+
- The main entry point (`src/index.js`) exports a factory function that creates instances of all API resource classes
|
|
16
|
+
- TypeScript definitions (`.d.ts` files) are provided alongside each JavaScript file
|
|
17
|
+
|
|
18
|
+
### Key Components
|
|
19
|
+
- `httpClient.js`: HTTP client wrapper that handles digest authentication
|
|
20
|
+
- `helper.js`: Utility functions for query string generation
|
|
21
|
+
- `index.js`: Main entry point that instantiates and exports all API resource clients
|
|
22
|
+
|
|
23
|
+
## Code Patterns and Conventions
|
|
24
|
+
|
|
25
|
+
### API Method Pattern
|
|
26
|
+
```javascript
|
|
27
|
+
async methodName(param1, param2, options = {}) {
|
|
28
|
+
const queryString = getQueryStringFromOptions(options);
|
|
29
|
+
const httpOptions = options.httpOptions;
|
|
30
|
+
const response = await this.client_.fetch(`${this.baseUrl_}/path/${param1}?${queryString}`, {
|
|
31
|
+
"method": "METHOD",
|
|
32
|
+
"data": body,
|
|
33
|
+
...httpOptions
|
|
34
|
+
});
|
|
35
|
+
return response;
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Class Pattern
|
|
40
|
+
- Private properties use trailing underscore: `this.client_`, `this.baseUrl_`, `this.projectId_`
|
|
41
|
+
- All methods are async and return promises
|
|
42
|
+
- Methods should handle `options` parameter for query strings and HTTP options
|
|
43
|
+
- The `httpOptions` parameter is extracted from options and passed separately (not included in query string)
|
|
44
|
+
|
|
45
|
+
### Naming Conventions
|
|
46
|
+
- Use camelCase for variables and function names
|
|
47
|
+
- Use PascalCase for class names
|
|
48
|
+
- Use descriptive names (e.g., `getAll`, `getById`, `delete`, `create`, `update`)
|
|
49
|
+
- Private instance variables end with underscore: `this.client_`, `this.baseUrl_`
|
|
50
|
+
|
|
51
|
+
## Testing Requirements
|
|
52
|
+
|
|
53
|
+
### Test Framework
|
|
54
|
+
- Uses `@hapi/lab` for test execution
|
|
55
|
+
- Uses `@hapi/code` for assertions
|
|
56
|
+
- Uses `sinon` for stubbing/mocking when needed
|
|
57
|
+
- Uses `urllib`'s MockAgent for HTTP mocking
|
|
58
|
+
- **100% code coverage is required** - all tests must pass with full coverage
|
|
59
|
+
|
|
60
|
+
### Test Structure Pattern
|
|
61
|
+
```javascript
|
|
62
|
+
const {describe, it, afterEach, before, beforeEach} = exports.lab = require("@hapi/lab").script();
|
|
63
|
+
const {expect} = require('@hapi/code');
|
|
64
|
+
const getClient = require('../src/index.js');
|
|
65
|
+
const {MockAgent, setGlobalDispatcher} = require('urllib');
|
|
66
|
+
|
|
67
|
+
const baseUrl = "http://localhost:7001";
|
|
68
|
+
const projectId = "dummyProjectId";
|
|
69
|
+
|
|
70
|
+
const client = getClient({
|
|
71
|
+
"publicKey": "dummyPublicKey",
|
|
72
|
+
"privateKey": "dummyPrivateKey",
|
|
73
|
+
"baseUrl": baseUrl,
|
|
74
|
+
"projectId": projectId
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe("Mongo Atlas Api Client - ResourceName", () => {
|
|
78
|
+
let mockAgent;
|
|
79
|
+
let mockPool;
|
|
80
|
+
|
|
81
|
+
before(() => {
|
|
82
|
+
mockAgent = new MockAgent();
|
|
83
|
+
setGlobalDispatcher(mockAgent);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
beforeEach(() => {
|
|
87
|
+
mockPool = mockAgent.get(baseUrl);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
afterEach(() => {
|
|
91
|
+
mockAgent.assertNoPendingInterceptors();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe("When method is called", () => {
|
|
95
|
+
it("should return expected result", async () => {
|
|
96
|
+
mockPool.intercept({
|
|
97
|
+
"path": `/expected/path`,
|
|
98
|
+
"method": "get"
|
|
99
|
+
}).reply(200, {"response": "data"});
|
|
100
|
+
|
|
101
|
+
const result = await client.resource.method();
|
|
102
|
+
expect(result).to.equal({"response": "data"});
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Test Guidelines
|
|
109
|
+
- Test file names match source files: `user.js` → `user.test.js`
|
|
110
|
+
- Each resource should have tests for:
|
|
111
|
+
- Verification that methods are exported from index
|
|
112
|
+
- Each public method with various parameter combinations
|
|
113
|
+
- Query string handling
|
|
114
|
+
- HTTP options handling
|
|
115
|
+
- Use MockAgent to intercept HTTP requests
|
|
116
|
+
- Always call `mockAgent.assertNoPendingInterceptors()` in afterEach
|
|
117
|
+
|
|
118
|
+
## Linting and Code Style
|
|
119
|
+
|
|
120
|
+
### ESLint Configuration
|
|
121
|
+
- Uses ESLint 9 with `@eslint/js` recommended config
|
|
122
|
+
- ES2015+ (latest) JavaScript syntax
|
|
123
|
+
- CommonJS module system (not ES modules)
|
|
124
|
+
- Strict rules including:
|
|
125
|
+
- No console logs (`no-console: error`)
|
|
126
|
+
- No var declarations (`no-var: error`)
|
|
127
|
+
- Prefer const (`prefer-const: error`)
|
|
128
|
+
- Prefer template literals (`prefer-template: error`)
|
|
129
|
+
- Complexity limit of 9 (`complexity: [warn, 9]`)
|
|
130
|
+
- One variable declaration per statement (`one-var: [warn, never]`)
|
|
131
|
+
- Variable name length: 2-70 characters (with exceptions for i, j, k, n, Q, _)
|
|
132
|
+
|
|
133
|
+
### Code Style Guidelines
|
|
134
|
+
- Use double quotes for strings (no enforcement, but check existing code)
|
|
135
|
+
- Use semicolons at end of statements (no enforcement, but check existing code)
|
|
136
|
+
- No trailing commas in arrays/objects (`comma-dangle: [error, never]`)
|
|
137
|
+
- Use arrow functions for callbacks where appropriate
|
|
138
|
+
- Prefer object method shorthand
|
|
139
|
+
|
|
140
|
+
## Build and Development Commands
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Install dependencies
|
|
144
|
+
npm install
|
|
145
|
+
|
|
146
|
+
# Run tests (includes linting and depcheck)
|
|
147
|
+
npm test
|
|
148
|
+
|
|
149
|
+
# Run linting only
|
|
150
|
+
npm run lint
|
|
151
|
+
|
|
152
|
+
# Run dependency check
|
|
153
|
+
npm run depcheck
|
|
154
|
+
|
|
155
|
+
# Version bumping and publishing
|
|
156
|
+
npm run patch # Bump patch version
|
|
157
|
+
npm run minor # Bump minor version
|
|
158
|
+
npm run major # Bump major version
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Pre-test Steps
|
|
162
|
+
The `pretest` script automatically runs:
|
|
163
|
+
1. Dependency check with `depcheck`
|
|
164
|
+
2. ESLint on all source and test files
|
|
165
|
+
|
|
166
|
+
## TypeScript Definitions
|
|
167
|
+
|
|
168
|
+
- All source files should have corresponding `.d.ts` TypeScript definition files
|
|
169
|
+
- Type definitions should match the JavaScript implementation
|
|
170
|
+
- Export types for all public classes and their methods
|
|
171
|
+
- Method signatures should include parameter types and return types
|
|
172
|
+
|
|
173
|
+
## Dependencies
|
|
174
|
+
|
|
175
|
+
### Production
|
|
176
|
+
- `urllib`: HTTP client library (version 4.x)
|
|
177
|
+
|
|
178
|
+
### Development
|
|
179
|
+
- `@hapi/lab`: Test runner
|
|
180
|
+
- `@hapi/code`: Assertion library
|
|
181
|
+
- `eslint`: Linting
|
|
182
|
+
- `depcheck`: Dependency checker
|
|
183
|
+
- `sinon`: Test stubbing/mocking
|
|
184
|
+
|
|
185
|
+
## MongoDB Atlas API Specifics
|
|
186
|
+
|
|
187
|
+
### Authentication
|
|
188
|
+
- Uses HTTP Digest Authentication
|
|
189
|
+
- Requires public key (username) and private key (password)
|
|
190
|
+
- Authentication is handled by HttpClient class
|
|
191
|
+
|
|
192
|
+
### Common Parameters
|
|
193
|
+
- `baseUrl`: MongoDB Atlas API base URL (e.g., `https://cloud.mongodb.com/api/atlas/v1.0`)
|
|
194
|
+
- `projectId`: MongoDB Atlas project/group ID
|
|
195
|
+
- `options`: Object that can contain:
|
|
196
|
+
- Query parameters (e.g., `envelope`, `itemsPerPage`, `pretty`)
|
|
197
|
+
- `httpOptions`: Additional options passed to urllib (e.g., `timeout`)
|
|
198
|
+
|
|
199
|
+
### URL Structure
|
|
200
|
+
- Groups and projects are synonymous in MongoDB Atlas API
|
|
201
|
+
- URLs typically follow pattern: `/groups/{projectId}/resource/{identifier}`
|
|
202
|
+
|
|
203
|
+
## Best Practices for Contributing
|
|
204
|
+
|
|
205
|
+
1. **Minimal Changes**: Make the smallest possible changes to accomplish the goal
|
|
206
|
+
2. **Test Coverage**: Maintain 100% test coverage - add tests for all new code
|
|
207
|
+
3. **Consistency**: Follow existing patterns in the codebase
|
|
208
|
+
4. **No Breaking Changes**: Don't modify existing public APIs unless necessary
|
|
209
|
+
5. **Documentation**: Update README.md if adding new features
|
|
210
|
+
6. **Type Safety**: Update corresponding `.d.ts` files when modifying JavaScript
|
|
211
|
+
7. **Error Handling**: Follow existing error handling patterns (let errors propagate)
|
|
212
|
+
8. **Async/Await**: Use async/await for all asynchronous operations (not callbacks or raw promises)
|
|
213
|
+
|
|
214
|
+
## Common Tasks
|
|
215
|
+
|
|
216
|
+
### Adding a New API Resource
|
|
217
|
+
|
|
218
|
+
1. Create `src/resourceName.js` with class following the established pattern
|
|
219
|
+
2. Create `src/resourceName.d.ts` with TypeScript definitions
|
|
220
|
+
3. Add resource to `src/index.js` initialization and exports
|
|
221
|
+
4. Create `test/resourceName.test.js` with comprehensive tests
|
|
222
|
+
5. Ensure 100% coverage and all tests pass
|
|
223
|
+
6. Update README.md if the resource is a significant new feature
|
|
224
|
+
|
|
225
|
+
### Adding a Method to Existing Resource
|
|
226
|
+
|
|
227
|
+
1. Add method to the class in `src/`
|
|
228
|
+
2. Update corresponding `.d.ts` file
|
|
229
|
+
3. Add comprehensive tests in `test/` file
|
|
230
|
+
4. Ensure 100% coverage maintained
|
|
231
|
+
5. Run linter and fix any issues
|
|
232
|
+
|
|
233
|
+
## Important Notes
|
|
234
|
+
|
|
235
|
+
- This library is production code used by many users - stability is critical
|
|
236
|
+
- All changes must pass existing tests without modification
|
|
237
|
+
- HTTP interactions are mocked in tests using urllib's MockAgent
|
|
238
|
+
- The library uses MongoDB Atlas API v1.0
|
|
239
|
+
- Digest authentication is required for all API calls
|
package/eslint.config.js
CHANGED
|
@@ -1,251 +1,205 @@
|
|
|
1
1
|
// eslint.config.js
|
|
2
2
|
const pluginJs = require("@eslint/js");
|
|
3
3
|
|
|
4
|
-
module.
|
|
4
|
+
module.exports = [
|
|
5
5
|
pluginJs.configs.recommended,
|
|
6
6
|
{
|
|
7
|
-
|
|
7
|
+
languageOptions: {
|
|
8
|
+
ecmaVersion: "latest",
|
|
9
|
+
sourceType: "commonjs",
|
|
10
|
+
globals: {
|
|
11
|
+
process: "readonly",
|
|
12
|
+
__dirname: "readonly",
|
|
13
|
+
__filename: "readonly",
|
|
14
|
+
require: "readonly",
|
|
15
|
+
module: "readonly",
|
|
16
|
+
exports: "writable",
|
|
17
|
+
console: "readonly",
|
|
18
|
+
Buffer: "readonly",
|
|
19
|
+
URLSearchParams: "readonly"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
8
23
|
// Possible Errors
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"no-
|
|
14
|
-
"no-
|
|
15
|
-
"no-
|
|
16
|
-
"no-
|
|
17
|
-
"no-
|
|
18
|
-
"no-
|
|
19
|
-
"no-
|
|
20
|
-
"no-
|
|
21
|
-
"no-
|
|
22
|
-
"no-
|
|
23
|
-
"no-
|
|
24
|
-
"no-
|
|
25
|
-
"no-
|
|
26
|
-
"no-
|
|
27
|
-
"no-extra-
|
|
28
|
-
"no-
|
|
29
|
-
"no-
|
|
30
|
-
"no-
|
|
31
|
-
"no-
|
|
32
|
-
"no-
|
|
33
|
-
"no-
|
|
34
|
-
"no-
|
|
35
|
-
"no-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"no-
|
|
39
|
-
"use-isnan": 2, // - disallow comparisons with the value NaN (recommended)
|
|
40
|
-
"valid-typeof": 2, // - Ensure that the results of typeof are compared against a valid string (recommended)
|
|
41
|
-
"no-unexpected-multiline": 2, // - Avoid code that looks like two expressions but is actually one
|
|
24
|
+
"comma-dangle": ["error", "never"],
|
|
25
|
+
"getter-return": "error",
|
|
26
|
+
"no-async-promise-executor": "error",
|
|
27
|
+
"no-await-in-loop": "error",
|
|
28
|
+
"no-compare-neg-zero": "error",
|
|
29
|
+
"no-cond-assign": "error",
|
|
30
|
+
"no-console": "error",
|
|
31
|
+
"no-constant-condition": "error",
|
|
32
|
+
"no-control-regex": "error",
|
|
33
|
+
"no-debugger": "error",
|
|
34
|
+
"no-dupe-args": "error",
|
|
35
|
+
"no-dupe-keys": "error",
|
|
36
|
+
"no-duplicate-case": "error",
|
|
37
|
+
"no-empty-character-class": "error",
|
|
38
|
+
"no-empty": "error",
|
|
39
|
+
"no-ex-assign": "error",
|
|
40
|
+
"no-extra-boolean-cast": "error",
|
|
41
|
+
"no-extra-parens": "off",
|
|
42
|
+
"no-extra-semi": "error",
|
|
43
|
+
"no-func-assign": "error",
|
|
44
|
+
"no-inner-declarations": ["error", "functions"],
|
|
45
|
+
"no-invalid-regexp": "error",
|
|
46
|
+
"no-irregular-whitespace": "error",
|
|
47
|
+
"no-obj-calls": "error",
|
|
48
|
+
"no-regex-spaces": "error",
|
|
49
|
+
"no-sparse-arrays": "off",
|
|
50
|
+
"no-unreachable": "error",
|
|
51
|
+
"use-isnan": "error",
|
|
52
|
+
"valid-typeof": "error",
|
|
53
|
+
"no-unexpected-multiline": "error",
|
|
42
54
|
|
|
43
55
|
// Best Practices
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"no-
|
|
57
|
-
"no-
|
|
58
|
-
"no-
|
|
59
|
-
"no-
|
|
60
|
-
"no-
|
|
61
|
-
"no-
|
|
62
|
-
"no-
|
|
63
|
-
"no-
|
|
64
|
-
"no-
|
|
65
|
-
"no-
|
|
66
|
-
"no-
|
|
67
|
-
"no-
|
|
68
|
-
"no-
|
|
69
|
-
"no-
|
|
70
|
-
"no-
|
|
71
|
-
"no-
|
|
72
|
-
"no-
|
|
73
|
-
"no-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"no-
|
|
80
|
-
"no-
|
|
81
|
-
"no-
|
|
82
|
-
"no-
|
|
83
|
-
"no-
|
|
84
|
-
"no-
|
|
85
|
-
"no-
|
|
86
|
-
"no-
|
|
87
|
-
"no-
|
|
88
|
-
"no-
|
|
89
|
-
"no-
|
|
90
|
-
"no-
|
|
91
|
-
"no-
|
|
92
|
-
"no-
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"no-unused-expressions": 0, // - disallow usage of expressions in statement position
|
|
98
|
-
"no-useless-call": 2, // - disallow unnecessary .call() and .apply()
|
|
99
|
-
"no-void": 2, // - disallow use of the void operator
|
|
100
|
-
"no-warning-comments": 0, // - disallow usage of configurable warning terms in comments - e.g. TODO or FIXME
|
|
101
|
-
"no-with": 2, // - disallow use of the with statement
|
|
102
|
-
"radix": 2, // - require use of the second argument for parseInt()
|
|
103
|
-
"vars-on-top": 2, // - require declaration of all vars at the top of their containing scope
|
|
104
|
-
"wrap-iife": 2, // - require immediate function invocation to be wrapped in parentheses
|
|
105
|
-
"yoda": 2, // - require or disallow Yoda conditions
|
|
106
|
-
|
|
107
|
-
// Strict Mode
|
|
108
|
-
// These rules relate to using strict mode.
|
|
109
|
-
|
|
110
|
-
"strict": [2, "global"], // - controls location of Use Strict Directives
|
|
56
|
+
"accessor-pairs": "error",
|
|
57
|
+
"block-scoped-var": "off",
|
|
58
|
+
"complexity": ["warn", 9],
|
|
59
|
+
"consistent-return": "warn",
|
|
60
|
+
"curly": ["error", "all"],
|
|
61
|
+
"default-case": "off",
|
|
62
|
+
"dot-notation": "error",
|
|
63
|
+
"dot-location": ["error", "property"],
|
|
64
|
+
"eqeqeq": "error",
|
|
65
|
+
"guard-for-in": "error",
|
|
66
|
+
"no-alert": "error",
|
|
67
|
+
"no-caller": "error",
|
|
68
|
+
"no-div-regex": "error",
|
|
69
|
+
"no-else-return": "error",
|
|
70
|
+
"no-eq-null": "error",
|
|
71
|
+
"no-eval": "error",
|
|
72
|
+
"no-extend-native": "error",
|
|
73
|
+
"no-extra-bind": "error",
|
|
74
|
+
"no-fallthrough": "error",
|
|
75
|
+
"no-floating-decimal": "error",
|
|
76
|
+
"no-implicit-coercion": "error",
|
|
77
|
+
"no-implied-eval": "error",
|
|
78
|
+
"no-invalid-this": "error",
|
|
79
|
+
"no-iterator": "error",
|
|
80
|
+
"no-labels": "error",
|
|
81
|
+
"no-lone-blocks": "error",
|
|
82
|
+
"no-loop-func": "error",
|
|
83
|
+
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],
|
|
84
|
+
"no-multi-str": "error",
|
|
85
|
+
"no-new-func": "error",
|
|
86
|
+
"no-new-wrappers": "error",
|
|
87
|
+
"no-new": "error",
|
|
88
|
+
"no-octal-escape": "error",
|
|
89
|
+
"no-octal": "error",
|
|
90
|
+
"no-param-reassign": "error",
|
|
91
|
+
"no-proto": "error",
|
|
92
|
+
"no-redeclare": "error",
|
|
93
|
+
"no-return-assign": "error",
|
|
94
|
+
"no-return-await": "error",
|
|
95
|
+
"no-script-url": "error",
|
|
96
|
+
"no-self-assign": "error",
|
|
97
|
+
"no-self-compare": "error",
|
|
98
|
+
"no-sequences": "error",
|
|
99
|
+
"no-throw-literal": "error",
|
|
100
|
+
"no-unused-expressions": "off",
|
|
101
|
+
"no-useless-call": "error",
|
|
102
|
+
"no-void": "error",
|
|
103
|
+
"no-warning-comments": "off",
|
|
104
|
+
"no-with": "error",
|
|
105
|
+
"radix": "error",
|
|
106
|
+
"vars-on-top": "error",
|
|
107
|
+
"wrap-iife": "error",
|
|
108
|
+
"yoda": "error",
|
|
111
109
|
|
|
112
110
|
// Variables
|
|
113
|
-
|
|
111
|
+
"init-declarations": "off",
|
|
112
|
+
"no-delete-var": "error",
|
|
113
|
+
"no-label-var": "error",
|
|
114
|
+
"no-shadow-restricted-names": "error",
|
|
115
|
+
"no-shadow": "error",
|
|
116
|
+
"no-undef-init": "error",
|
|
117
|
+
"no-undef": "error",
|
|
118
|
+
"no-undefined": "off",
|
|
119
|
+
"no-unused-vars": "error",
|
|
120
|
+
"no-use-before-define": "error",
|
|
114
121
|
|
|
115
|
-
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"no-
|
|
120
|
-
"no-
|
|
121
|
-
"no-
|
|
122
|
-
"no-
|
|
123
|
-
"no-
|
|
124
|
-
"no-
|
|
125
|
-
"no-
|
|
122
|
+
// Node.js (using stylistic rules where available in ESLint 9)
|
|
123
|
+
"callback-return": "off", // Removed in ESLint 9
|
|
124
|
+
"global-require": "off", // Removed in ESLint 9
|
|
125
|
+
"handle-callback-err": "off", // Removed in ESLint 9
|
|
126
|
+
"no-mixed-requires": "off", // Removed in ESLint 9
|
|
127
|
+
"no-new-require": "off", // Removed in ESLint 9
|
|
128
|
+
"no-path-concat": "off", // Removed in ESLint 9
|
|
129
|
+
"no-process-env": "off", // Removed in ESLint 9
|
|
130
|
+
"no-process-exit": "off", // Removed in ESLint 9
|
|
131
|
+
"no-restricted-modules": "off",
|
|
132
|
+
"no-sync": "off", // Removed in ESLint 9
|
|
133
|
+
"no-buffer-constructor": "error",
|
|
126
134
|
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"max-statements-per-line": [
|
|
181
|
-
2,
|
|
182
|
-
{
|
|
183
|
-
"max": 1
|
|
184
|
-
}
|
|
185
|
-
], // - enforce a maximum number of statements per line
|
|
186
|
-
"new-cap": 0, // - require a capital letter for constructors
|
|
187
|
-
"new-parens": 2, // - disallow the omission of parentheses when invoking a constructor with no arguments
|
|
188
|
-
"newline-after-var": 0, // - require or disallow an empty newline after variable declarations
|
|
189
|
-
"no-array-constructor": 2, // - disallow use of the Array constructor
|
|
190
|
-
"no-continue": 2, // - disallow use of the continue statement
|
|
191
|
-
"no-inline-comments": 0, // - disallow comments inline after code
|
|
192
|
-
"no-lonely-if": 2, // - disallow if as the only statement in an else block
|
|
193
|
-
"no-mixed-spaces-and-tabs": 2, // - disallow mixed spaces and tabs for indentation (recommended)
|
|
194
|
-
"no-multiple-empty-lines": [
|
|
195
|
-
2,
|
|
196
|
-
{
|
|
197
|
-
"max": 2,
|
|
198
|
-
"maxEOF": 1,
|
|
199
|
-
"maxBOF": 0
|
|
200
|
-
}
|
|
201
|
-
], // - disallow multiple empty lines
|
|
202
|
-
"no-nested-ternary": 2, // - disallow nested ternary expressions
|
|
203
|
-
"no-new-object": 2, // - disallow the use of the Object constructor
|
|
204
|
-
"no-spaced-func": 2, // - disallow space between function identifier and application
|
|
205
|
-
"no-ternary": 0, // - disallow the use of ternary operators
|
|
206
|
-
"no-trailing-spaces": 2, // - disallow trailing whitespace at the end of lines
|
|
207
|
-
"no-underscore-dangle": 0, // - disallow dangling underscores in identifiers
|
|
208
|
-
"no-unneeded-ternary": 2, // - disallow the use of Boolean literals in conditional expressions
|
|
209
|
-
"object-curly-spacing": 2, // - require or disallow padding inside curly braces
|
|
210
|
-
"one-var": [1, "never"], // - require or disallow one variable declaration per function
|
|
211
|
-
"operator-assignment": [2, "always"], // - require assignment operator shorthand where possible or prohibit it entirely
|
|
212
|
-
"operator-linebreak": 2, // - enforce operators to be placed before or after line breaks
|
|
213
|
-
"padded-blocks": 0, // - enforce padding within blocks
|
|
214
|
-
"quote-props": 2, // - require quotes around object literal property names
|
|
215
|
-
"quotes": [2, "double"], // - specify whether backticks, double or single quotes should be used
|
|
216
|
-
"semi-spacing": 2, // - enforce spacing before and after semicolons
|
|
217
|
-
"semi": 2, // - require or disallow use of semicolons instead of ASI
|
|
218
|
-
"sort-vars": 0, // - sort variables within the same declaration block
|
|
219
|
-
"keyword-spacing": 2, // - require a space after certain keywords
|
|
220
|
-
"space-before-blocks": 2, // - require or disallow a space before blocks
|
|
221
|
-
"space-before-function-paren": [2,
|
|
222
|
-
{
|
|
223
|
-
"anonymous": "always",
|
|
224
|
-
"named": "never"
|
|
225
|
-
}
|
|
226
|
-
], // - require or disallow a space before function opening parenthesis
|
|
227
|
-
"space-in-parens": 2, // - require or disallow spaces inside parentheses
|
|
228
|
-
"space-infix-ops": 2, // - require spaces around operators
|
|
229
|
-
"space-unary-ops": 2, // - require or disallow spaces before/after unary operators
|
|
230
|
-
"spaced-comment": 2, // - require or disallow a space immediately following the // or /* in a comment
|
|
231
|
-
"wrap-regex": 2, // - require regex literals to be wrapped in parentheses
|
|
135
|
+
// Stylistic Issues (many moved to @stylistic/eslint-plugin in ESLint 9)
|
|
136
|
+
"array-bracket-spacing": "off",
|
|
137
|
+
"brace-style": "off",
|
|
138
|
+
"camelcase": "error",
|
|
139
|
+
"comma-spacing": "off",
|
|
140
|
+
"comma-style": "off",
|
|
141
|
+
"computed-property-spacing": "off",
|
|
142
|
+
"consistent-this": "off",
|
|
143
|
+
"eol-last": "off",
|
|
144
|
+
"func-names": "off",
|
|
145
|
+
"func-style": "off",
|
|
146
|
+
"id-length": ["error", { "min": 2, "max": 70, "exceptions": ["i", "j", "k", "n", "Q", "_"] }],
|
|
147
|
+
"id-match": "off",
|
|
148
|
+
"indent": "off",
|
|
149
|
+
"key-spacing": "off",
|
|
150
|
+
"lines-around-comment": "off",
|
|
151
|
+
"linebreak-style": "off",
|
|
152
|
+
"max-nested-callbacks": ["error", 6],
|
|
153
|
+
"max-statements-per-line": "off",
|
|
154
|
+
"new-cap": "off",
|
|
155
|
+
"new-parens": "off",
|
|
156
|
+
"newline-after-var": "off",
|
|
157
|
+
"no-array-constructor": "error",
|
|
158
|
+
"no-continue": "error",
|
|
159
|
+
"no-inline-comments": "off",
|
|
160
|
+
"no-lonely-if": "error",
|
|
161
|
+
"no-mixed-spaces-and-tabs": "error",
|
|
162
|
+
"no-multiple-empty-lines": "off",
|
|
163
|
+
"no-nested-ternary": "error",
|
|
164
|
+
"no-new-object": "error",
|
|
165
|
+
"no-spaced-func": "off",
|
|
166
|
+
"no-ternary": "off",
|
|
167
|
+
"no-trailing-spaces": "off",
|
|
168
|
+
"no-underscore-dangle": "off",
|
|
169
|
+
"no-unneeded-ternary": "error",
|
|
170
|
+
"object-curly-spacing": "off",
|
|
171
|
+
"one-var": ["warn", "never"],
|
|
172
|
+
"operator-assignment": ["error", "always"],
|
|
173
|
+
"operator-linebreak": "off",
|
|
174
|
+
"padded-blocks": "off",
|
|
175
|
+
"quote-props": "off",
|
|
176
|
+
"quotes": "off",
|
|
177
|
+
"semi-spacing": "off",
|
|
178
|
+
"semi": "off",
|
|
179
|
+
"sort-vars": "off",
|
|
180
|
+
"keyword-spacing": "off",
|
|
181
|
+
"space-before-blocks": "off",
|
|
182
|
+
"space-before-function-paren": "off",
|
|
183
|
+
"space-in-parens": "off",
|
|
184
|
+
"space-infix-ops": "off",
|
|
185
|
+
"space-unary-ops": "off",
|
|
186
|
+
"spaced-comment": "off",
|
|
187
|
+
"wrap-regex": "off",
|
|
232
188
|
|
|
233
189
|
// ECMAScript 6
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
"
|
|
237
|
-
"
|
|
238
|
-
"
|
|
239
|
-
"
|
|
240
|
-
"no-
|
|
241
|
-
"no-
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"prefer-
|
|
247
|
-
"require-yield": 2, // - disallow generator functions that do not have yield
|
|
248
|
-
"prefer-template": 2
|
|
190
|
+
"arrow-parens": "off",
|
|
191
|
+
"arrow-spacing": "off",
|
|
192
|
+
"constructor-super": "error",
|
|
193
|
+
"generator-star-spacing": "off",
|
|
194
|
+
"no-class-assign": "error",
|
|
195
|
+
"no-const-assign": "error",
|
|
196
|
+
"no-this-before-super": "error",
|
|
197
|
+
"no-var": "error",
|
|
198
|
+
"object-shorthand": ["error", "methods"],
|
|
199
|
+
"prefer-const": "error",
|
|
200
|
+
"prefer-spread": "error",
|
|
201
|
+
"require-yield": "error",
|
|
202
|
+
"prefer-template": "error"
|
|
249
203
|
}
|
|
250
204
|
}
|
|
251
205
|
];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongodb-atlas-api-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "A mongodb atlas api client for nodejs.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"pretest": "npm run depcheck && eslint --cache \"src/**/*.js\" \"test/**/*.js\"",
|
|
8
8
|
"depcheck": "depcheck",
|
|
9
|
-
"test": "./node_modules/@hapi/lab/bin/lab -I '@@any-promise/REGISTRATION,Symbol(undici.globalDispatcher.1)' ./test/ -v -S --assert @hapi/code --threshold 100 -p 1 -o test-results/result.json -r json -r console -o stdout",
|
|
9
|
+
"test": "./node_modules/@hapi/lab/bin/lab -I '@@any-promise/REGISTRATION,Symbol(undici.globalDispatcher.1),File' ./test/ -v -S --assert @hapi/code --threshold 100 -p 1 -o test-results/result.json -r json -r console -o stdout",
|
|
10
10
|
"lint": "./node_modules/.bin/eslint ./src --fix",
|
|
11
11
|
"premajor": "npm run test",
|
|
12
12
|
"major": "npm version major -m \"published to npm as v%s\" && git push --follow-tags && npm publish",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/montumodi/mongodb-atlas-api-client#readme",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@eslint/js": "^9.
|
|
39
|
+
"@eslint/js": "^9.38.0",
|
|
40
40
|
"@hapi/code": "^9.0.3",
|
|
41
|
-
"@hapi/lab": "^25.3.
|
|
41
|
+
"@hapi/lab": "^25.3.2",
|
|
42
42
|
"depcheck": "^1.4.7",
|
|
43
|
-
"eslint": "^9.
|
|
44
|
-
"sinon": "^
|
|
43
|
+
"eslint": "^9.38.0",
|
|
44
|
+
"sinon": "^21.0.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"urllib": "^4.2
|
|
47
|
+
"urllib": "^4.8.2"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/test/helper.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {describe, it} = exports.lab = require("@hapi/lab").script();
|
|
2
2
|
const {expect} = require('@hapi/code');
|
|
3
|
-
const {getQueryStringFromOptions}
|
|
3
|
+
const {getQueryStringFromOptions} = require('../src/helper.js');
|
|
4
4
|
|
|
5
5
|
describe("Helper Methods", () => {
|
|
6
6
|
|