@qp-mongosh/service-provider-core 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.
Files changed (71) hide show
  1. package/.eslintignore +2 -2
  2. package/.eslintrc.js +1 -1
  3. package/AUTHORS +11 -11
  4. package/LICENSE +200 -200
  5. package/package.json +54 -54
  6. package/src/admin.ts +119 -119
  7. package/src/all-fle-types.ts +17 -17
  8. package/src/all-transport-types.ts +80 -80
  9. package/src/cli-options.ts +49 -49
  10. package/src/closable.ts +14 -14
  11. package/src/connect-info.spec.ts +192 -192
  12. package/src/connect-info.ts +57 -57
  13. package/src/index.ts +62 -62
  14. package/src/platform.ts +6 -6
  15. package/src/printable-bson.spec.ts +75 -75
  16. package/src/printable-bson.ts +103 -103
  17. package/src/readable.ts +242 -242
  18. package/src/service-provider.ts +23 -23
  19. package/src/shell-auth-options.ts +7 -7
  20. package/src/textencoder-polyfill.spec.ts +11 -11
  21. package/src/textencoder-polyfill.ts +30 -30
  22. package/src/uri-generator.spec.ts +481 -481
  23. package/src/uri-generator.ts +265 -265
  24. package/src/writable.ts +367 -367
  25. package/tsconfig.json +12 -12
  26. package/tsconfig.lint.json +8 -8
  27. package/lib/admin.d.ts +0 -28
  28. package/lib/admin.js +0 -3
  29. package/lib/admin.js.map +0 -1
  30. package/lib/all-fle-types.d.ts +0 -2
  31. package/lib/all-fle-types.js +0 -3
  32. package/lib/all-fle-types.js.map +0 -1
  33. package/lib/all-transport-types.d.ts +0 -1
  34. package/lib/all-transport-types.js +0 -3
  35. package/lib/all-transport-types.js.map +0 -1
  36. package/lib/cli-options.d.ts +0 -43
  37. package/lib/cli-options.js +0 -3
  38. package/lib/cli-options.js.map +0 -1
  39. package/lib/closable.d.ts +0 -4
  40. package/lib/closable.js +0 -3
  41. package/lib/closable.js.map +0 -1
  42. package/lib/connect-info.d.ts +0 -19
  43. package/lib/connect-info.js +0 -35
  44. package/lib/connect-info.js.map +0 -1
  45. package/lib/index.d.ts +0 -31
  46. package/lib/index.js +0 -56
  47. package/lib/index.js.map +0 -1
  48. package/lib/platform.d.ts +0 -6
  49. package/lib/platform.js +0 -11
  50. package/lib/platform.js.map +0 -1
  51. package/lib/printable-bson.d.ts +0 -3
  52. package/lib/printable-bson.js +0 -82
  53. package/lib/printable-bson.js.map +0 -1
  54. package/lib/readable.d.ts +0 -18
  55. package/lib/readable.js +0 -3
  56. package/lib/readable.js.map +0 -1
  57. package/lib/service-provider.d.ts +0 -11
  58. package/lib/service-provider.js +0 -19
  59. package/lib/service-provider.js.map +0 -1
  60. package/lib/shell-auth-options.d.ts +0 -7
  61. package/lib/shell-auth-options.js +0 -3
  62. package/lib/shell-auth-options.js.map +0 -1
  63. package/lib/textencoder-polyfill.d.ts +0 -2
  64. package/lib/textencoder-polyfill.js +0 -22
  65. package/lib/textencoder-polyfill.js.map +0 -1
  66. package/lib/uri-generator.d.ts +0 -8
  67. package/lib/uri-generator.js +0 -176
  68. package/lib/uri-generator.js.map +0 -1
  69. package/lib/writable.d.ts +0 -22
  70. package/lib/writable.js +0 -3
  71. package/lib/writable.js.map +0 -1
package/src/admin.ts CHANGED
@@ -1,119 +1,119 @@
1
- import ShellAuthOptions from './shell-auth-options';
2
- import type {
3
- MongoClientOptions,
4
- ReadConcern,
5
- ReadPreference,
6
- WriteConcern,
7
- Document,
8
- CreateCollectionOptions,
9
- ClientSession,
10
- DbOptions,
11
- ClientSessionOptions,
12
- ListDatabasesOptions,
13
- AutoEncryptionOptions
14
- } from './all-transport-types';
15
- import type { bson as BSON } from './index';
16
- import { ReplPlatform } from './platform';
17
- import { FLE } from './all-fle-types';
18
-
19
-
20
- export default interface Admin {
21
- /**
22
- * What platform (Compass/CLI/Browser)
23
- */
24
- platform: ReplPlatform;
25
-
26
- /**
27
- * The initial database
28
- */
29
- initialDb: string;
30
-
31
- /**
32
- * The BSON package
33
- */
34
- bsonLibrary: typeof BSON;
35
-
36
- /**
37
- * list databases.
38
- *
39
- * @param {String} database - The database name.
40
- *
41
- * @returns {Promise} The promise of command Documents.
42
- */
43
- listDatabases(database: string, options?: ListDatabasesOptions): Promise<Document>;
44
-
45
- /**
46
- * create a new service provider with a new connection.
47
- *
48
- * @param uri
49
- * @param options
50
- */
51
- getNewConnection(uri: string, options: MongoClientOptions): Promise<any>; // returns the ServiceProvider instance
52
-
53
- /**
54
- * Return the URI for the current connection, if this ServiceProvider is connected.
55
- */
56
- getURI(): string | undefined;
57
-
58
- /**
59
- * Return connection info
60
- */
61
- getConnectionInfo(): Promise<Document>;
62
-
63
- /**
64
- * Authenticate
65
- */
66
- authenticate(authDoc: ShellAuthOptions): Promise<{ ok: number }>;
67
-
68
- /**
69
- * createCollection
70
- */
71
- createCollection(
72
- dbName: string,
73
- collName: string,
74
- options: CreateCollectionOptions,
75
- dbOptions?: DbOptions): Promise<{ ok: number }>;
76
-
77
- /**
78
- * Return read preference for connection.
79
- */
80
- getReadPreference(): ReadPreference;
81
-
82
- /**
83
- * Return read concern for connection.
84
- */
85
- getReadConcern(): ReadConcern | undefined;
86
-
87
- /**
88
- * Return write concern for connection.
89
- */
90
- getWriteConcern(): WriteConcern | undefined;
91
-
92
- /**
93
- * Reset the connection to have the option specified.
94
- *
95
- * @param options
96
- */
97
- resetConnectionOptions(options: MongoClientOptions): Promise<void>;
98
-
99
- /**
100
- * Start a session.
101
- * @param options
102
- */
103
- startSession(options: ClientSessionOptions): ClientSession;
104
-
105
- /**
106
- * Return the raw client for use in keyVaultClient.
107
- */
108
- getRawClient(): any;
109
-
110
- /**
111
- * The FLE implementation for access to the client-side encryption API.
112
- */
113
- fle?: FLE | undefined;
114
-
115
- /**
116
- * The FLE options passed to the client, if any.
117
- */
118
- getFleOptions?: () => AutoEncryptionOptions | undefined;
119
- }
1
+ import ShellAuthOptions from './shell-auth-options';
2
+ import type {
3
+ MongoClientOptions,
4
+ ReadConcern,
5
+ ReadPreference,
6
+ WriteConcern,
7
+ Document,
8
+ CreateCollectionOptions,
9
+ ClientSession,
10
+ DbOptions,
11
+ ClientSessionOptions,
12
+ ListDatabasesOptions,
13
+ AutoEncryptionOptions
14
+ } from './all-transport-types';
15
+ import type { bson as BSON } from './index';
16
+ import { ReplPlatform } from './platform';
17
+ import { FLE } from './all-fle-types';
18
+
19
+
20
+ export default interface Admin {
21
+ /**
22
+ * What platform (Compass/CLI/Browser)
23
+ */
24
+ platform: ReplPlatform;
25
+
26
+ /**
27
+ * The initial database
28
+ */
29
+ initialDb: string;
30
+
31
+ /**
32
+ * The BSON package
33
+ */
34
+ bsonLibrary: typeof BSON;
35
+
36
+ /**
37
+ * list databases.
38
+ *
39
+ * @param {String} database - The database name.
40
+ *
41
+ * @returns {Promise} The promise of command Documents.
42
+ */
43
+ listDatabases(database: string, options?: ListDatabasesOptions): Promise<Document>;
44
+
45
+ /**
46
+ * create a new service provider with a new connection.
47
+ *
48
+ * @param uri
49
+ * @param options
50
+ */
51
+ getNewConnection(uri: string, options: MongoClientOptions): Promise<any>; // returns the ServiceProvider instance
52
+
53
+ /**
54
+ * Return the URI for the current connection, if this ServiceProvider is connected.
55
+ */
56
+ getURI(): string | undefined;
57
+
58
+ /**
59
+ * Return connection info
60
+ */
61
+ getConnectionInfo(): Promise<Document>;
62
+
63
+ /**
64
+ * Authenticate
65
+ */
66
+ authenticate(authDoc: ShellAuthOptions): Promise<{ ok: number }>;
67
+
68
+ /**
69
+ * createCollection
70
+ */
71
+ createCollection(
72
+ dbName: string,
73
+ collName: string,
74
+ options: CreateCollectionOptions,
75
+ dbOptions?: DbOptions): Promise<{ ok: number }>;
76
+
77
+ /**
78
+ * Return read preference for connection.
79
+ */
80
+ getReadPreference(): ReadPreference;
81
+
82
+ /**
83
+ * Return read concern for connection.
84
+ */
85
+ getReadConcern(): ReadConcern | undefined;
86
+
87
+ /**
88
+ * Return write concern for connection.
89
+ */
90
+ getWriteConcern(): WriteConcern | undefined;
91
+
92
+ /**
93
+ * Reset the connection to have the option specified.
94
+ *
95
+ * @param options
96
+ */
97
+ resetConnectionOptions(options: MongoClientOptions): Promise<void>;
98
+
99
+ /**
100
+ * Start a session.
101
+ * @param options
102
+ */
103
+ startSession(options: ClientSessionOptions): ClientSession;
104
+
105
+ /**
106
+ * Return the raw client for use in keyVaultClient.
107
+ */
108
+ getRawClient(): any;
109
+
110
+ /**
111
+ * The FLE implementation for access to the client-side encryption API.
112
+ */
113
+ fle?: FLE | undefined;
114
+
115
+ /**
116
+ * The FLE options passed to the client, if any.
117
+ */
118
+ getFleOptions?: () => AutoEncryptionOptions | undefined;
119
+ }
@@ -1,17 +1,17 @@
1
- export type {
2
- AWSEncryptionKeyOptions,
3
- AzureEncryptionKeyOptions,
4
- GCPEncryptionKeyOptions,
5
- ClientEncryption,
6
- ClientEncryptionCreateDataKeyCallback,
7
- ClientEncryptionCreateDataKeyProviderOptions,
8
- ClientEncryptionDataKeyProvider,
9
- ClientEncryptionDecryptCallback,
10
- ClientEncryptionEncryptCallback,
11
- ClientEncryptionEncryptOptions,
12
- ClientEncryptionOptions,
13
- ClientEncryptionTlsOptions,
14
- KMSProviders
15
- } from 'mongodb-client-encryption';
16
-
17
- export type FLE = typeof import('mongodb-client-encryption');
1
+ export type {
2
+ AWSEncryptionKeyOptions,
3
+ AzureEncryptionKeyOptions,
4
+ GCPEncryptionKeyOptions,
5
+ ClientEncryption,
6
+ ClientEncryptionCreateDataKeyCallback,
7
+ ClientEncryptionCreateDataKeyProviderOptions,
8
+ ClientEncryptionDataKeyProvider,
9
+ ClientEncryptionDecryptCallback,
10
+ ClientEncryptionEncryptCallback,
11
+ ClientEncryptionEncryptOptions,
12
+ ClientEncryptionOptions,
13
+ ClientEncryptionTlsOptions,
14
+ KMSProviders
15
+ } from 'mongodb-client-encryption';
16
+
17
+ export type FLE = typeof import('mongodb-client-encryption');
@@ -1,80 +1,80 @@
1
- export type {
2
- AggregateOptions,
3
- AggregationCursor,
4
- AnyBulkWriteOperation,
5
- Batch,
6
- BulkResult,
7
- BulkWriteOptions,
8
- BulkWriteResult,
9
- ChangeStream,
10
- ChangeStreamOptions,
11
- ClientSession,
12
- CloseOptions,
13
- CollationOptions,
14
- CollStatsOptions,
15
- Collection,
16
- CommandOperationOptions,
17
- CountDocumentsOptions,
18
- CountOptions,
19
- CreateCollectionOptions,
20
- CreateIndexesOptions,
21
- ClientSessionOptions,
22
- ClusterTime,
23
- FindCursor,
24
- CursorFlag,
25
- Db,
26
- DbOptions,
27
- DeleteOptions,
28
- DeleteResult,
29
- DistinctOptions,
30
- Document,
31
- DropCollectionOptions,
32
- DropDatabaseOptions,
33
- EstimatedDocumentCountOptions,
34
- ExplainOptions,
35
- ExplainVerbosityLike,
36
- FindOneAndDeleteOptions,
37
- FindOneAndUpdateOptions,
38
- FindOneAndReplaceOptions,
39
- FindOperators,
40
- FindOptions,
41
- HedgeOptions,
42
- IndexDescription,
43
- InsertManyResult,
44
- InsertOneOptions,
45
- InsertOneResult,
46
- ListCollectionsOptions,
47
- ListDatabasesOptions,
48
- ListIndexesOptions,
49
- MapReduceOptions,
50
- MongoClientOptions,
51
- OrderedBulkOperation,
52
- ReadConcern,
53
- ReadConcernLike,
54
- ReadConcernLevel,
55
- ReadPreference,
56
- ReadPreferenceLike,
57
- ReadPreferenceFromOptions,
58
- ReadPreferenceMode,
59
- RenameOptions,
60
- ReplaceOptions,
61
- ResumeToken,
62
- RunCommandOptions,
63
- ServerSessionId,
64
- TagSet,
65
- TransactionOptions,
66
- UpdateOptions,
67
- UpdateResult,
68
- UnorderedBulkOperation,
69
- WriteConcern,
70
- ObjectId as ObjectIdType,
71
- Timestamp as TimestampType,
72
- Binary as BinaryType,
73
- TopologyDescription,
74
- TopologyType,
75
- ServerType,
76
- AutoEncryptionOptions,
77
- ServerApi,
78
- ServerApiVersion,
79
- MongoClient // mostly for testing
80
- } from 'qp-mongodb';
1
+ export type {
2
+ AggregateOptions,
3
+ AggregationCursor,
4
+ AnyBulkWriteOperation,
5
+ Batch,
6
+ BulkResult,
7
+ BulkWriteOptions,
8
+ BulkWriteResult,
9
+ ChangeStream,
10
+ ChangeStreamOptions,
11
+ ClientSession,
12
+ CloseOptions,
13
+ CollationOptions,
14
+ CollStatsOptions,
15
+ Collection,
16
+ CommandOperationOptions,
17
+ CountDocumentsOptions,
18
+ CountOptions,
19
+ CreateCollectionOptions,
20
+ CreateIndexesOptions,
21
+ ClientSessionOptions,
22
+ ClusterTime,
23
+ FindCursor,
24
+ CursorFlag,
25
+ Db,
26
+ DbOptions,
27
+ DeleteOptions,
28
+ DeleteResult,
29
+ DistinctOptions,
30
+ Document,
31
+ DropCollectionOptions,
32
+ DropDatabaseOptions,
33
+ EstimatedDocumentCountOptions,
34
+ ExplainOptions,
35
+ ExplainVerbosityLike,
36
+ FindOneAndDeleteOptions,
37
+ FindOneAndUpdateOptions,
38
+ FindOneAndReplaceOptions,
39
+ FindOperators,
40
+ FindOptions,
41
+ HedgeOptions,
42
+ IndexDescription,
43
+ InsertManyResult,
44
+ InsertOneOptions,
45
+ InsertOneResult,
46
+ ListCollectionsOptions,
47
+ ListDatabasesOptions,
48
+ ListIndexesOptions,
49
+ MapReduceOptions,
50
+ MongoClientOptions,
51
+ OrderedBulkOperation,
52
+ ReadConcern,
53
+ ReadConcernLike,
54
+ ReadConcernLevel,
55
+ ReadPreference,
56
+ ReadPreferenceLike,
57
+ ReadPreferenceFromOptions,
58
+ ReadPreferenceMode,
59
+ RenameOptions,
60
+ ReplaceOptions,
61
+ ResumeToken,
62
+ RunCommandOptions,
63
+ ServerSessionId,
64
+ TagSet,
65
+ TransactionOptions,
66
+ UpdateOptions,
67
+ UpdateResult,
68
+ UnorderedBulkOperation,
69
+ WriteConcern,
70
+ ObjectId as ObjectIdType,
71
+ Timestamp as TimestampType,
72
+ Binary as BinaryType,
73
+ TopologyDescription,
74
+ TopologyType,
75
+ ServerType,
76
+ AutoEncryptionOptions,
77
+ ServerApi,
78
+ ServerApiVersion,
79
+ MongoClient // mostly for testing
80
+ } from 'qp-mongodb';
@@ -1,49 +1,49 @@
1
- /**
2
- * Valid options that can be parsed from the command line.
3
- */
4
- export default interface CliOptions {
5
- // Positional arguments:
6
- connectionSpecifier?: string;
7
- fileNames?: string[];
8
-
9
- // Non-positional arguments:
10
- apiDeprecationErrors?: boolean;
11
- apiStrict?: boolean;
12
- apiVersion?: string;
13
- authenticationDatabase?: string;
14
- authenticationMechanism?: string;
15
- awsAccessKeyId?: string;
16
- awsIamSessionToken?: string;
17
- awsSecretAccessKey?: string;
18
- awsSessionToken?: string;
19
- db?: string;
20
- eval?: string;
21
- gssapiServiceName?: string;
22
- sspiHostnameCanonicalization?: string;
23
- sspiRealmOverride?: string;
24
- help?: boolean;
25
- host?: string;
26
- ipv6?: boolean;
27
- keyVaultNamespace?: string;
28
- kmsURL?: string;
29
- nodb?: boolean;
30
- norc?: boolean;
31
- password?: string;
32
- port?: string;
33
- quiet?: boolean;
34
- retryWrites?: boolean;
35
- shell?: boolean;
36
- tls?: boolean;
37
- tlsAllowInvalidCertificates?: boolean;
38
- tlsAllowInvalidHostnames?: boolean;
39
- tlsCAFile?: string;
40
- tlsCertificateKeyFile?: string;
41
- tlsCertificateKeyFilePassword?: string;
42
- tlsCertificateSelector?: string;
43
- tlsCRLFile?: string;
44
- tlsDisabledProtocols?: boolean;
45
- tlsFIPSMode?: boolean;
46
- username?: string;
47
- verbose?: boolean;
48
- version?: boolean;
49
- }
1
+ /**
2
+ * Valid options that can be parsed from the command line.
3
+ */
4
+ export default interface CliOptions {
5
+ // Positional arguments:
6
+ connectionSpecifier?: string;
7
+ fileNames?: string[];
8
+
9
+ // Non-positional arguments:
10
+ apiDeprecationErrors?: boolean;
11
+ apiStrict?: boolean;
12
+ apiVersion?: string;
13
+ authenticationDatabase?: string;
14
+ authenticationMechanism?: string;
15
+ awsAccessKeyId?: string;
16
+ awsIamSessionToken?: string;
17
+ awsSecretAccessKey?: string;
18
+ awsSessionToken?: string;
19
+ db?: string;
20
+ eval?: string;
21
+ gssapiServiceName?: string;
22
+ sspiHostnameCanonicalization?: string;
23
+ sspiRealmOverride?: string;
24
+ help?: boolean;
25
+ host?: string;
26
+ ipv6?: boolean;
27
+ keyVaultNamespace?: string;
28
+ kmsURL?: string;
29
+ nodb?: boolean;
30
+ norc?: boolean;
31
+ password?: string;
32
+ port?: string;
33
+ quiet?: boolean;
34
+ retryWrites?: boolean;
35
+ shell?: boolean;
36
+ tls?: boolean;
37
+ tlsAllowInvalidCertificates?: boolean;
38
+ tlsAllowInvalidHostnames?: boolean;
39
+ tlsCAFile?: string;
40
+ tlsCertificateKeyFile?: string;
41
+ tlsCertificateKeyFilePassword?: string;
42
+ tlsCertificateSelector?: string;
43
+ tlsCRLFile?: string;
44
+ tlsDisabledProtocols?: boolean;
45
+ tlsFIPSMode?: boolean;
46
+ username?: string;
47
+ verbose?: boolean;
48
+ version?: boolean;
49
+ }
package/src/closable.ts CHANGED
@@ -1,14 +1,14 @@
1
- export default interface Closable {
2
- /**
3
- * Close the connection.
4
- *
5
- * @param {boolean} force - Whether to force close.
6
- */
7
- close(force: boolean): Promise<void>;
8
-
9
- /**
10
- * Suspends the connection, i.e. temporarily force-closes it
11
- * and returns a function that will re-open the connection.
12
- */
13
- suspend(): Promise<() => Promise<void>>;
14
- }
1
+ export default interface Closable {
2
+ /**
3
+ * Close the connection.
4
+ *
5
+ * @param {boolean} force - Whether to force close.
6
+ */
7
+ close(force: boolean): Promise<void>;
8
+
9
+ /**
10
+ * Suspends the connection, i.e. temporarily force-closes it
11
+ * and returns a function that will re-open the connection.
12
+ */
13
+ suspend(): Promise<() => Promise<void>>;
14
+ }