@mongosh/shell-api 3.16.1 → 3.16.2

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.
@@ -19,7 +19,6 @@ import { EJSONOptions } from 'bson';
19
19
  import { EventEmitter } from 'events';
20
20
  import type { IncomingMessage } from 'http';
21
21
  import { Int32 } from 'bson';
22
- import type { JSONSchema } from 'mongodb-schema';
23
22
  import { Long } from 'bson';
24
23
  import { MaxKey } from 'bson';
25
24
  import { MinKey } from 'bson';
@@ -6427,6 +6426,214 @@ declare interface InterruptWatcher {
6427
6426
 
6428
6427
  /** @public */
6429
6428
  declare type IsAny<Type, ResultIfAny, ResultIfNotAny> = true extends false & Type ? ResultIfAny : ResultIfNotAny;
6429
+ declare type JSONSchema = Partial<JSONSchema4> & MongoDBJSONSchema;
6430
+
6431
+ /**
6432
+ * JSON Schema V4
6433
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04
6434
+ */
6435
+ declare interface JSONSchema4 {
6436
+ id?: string | undefined;
6437
+ $ref?: string | undefined;
6438
+ $schema?: JSONSchema4Version | undefined;
6439
+
6440
+ /**
6441
+ * This attribute is a string that provides a short description of the
6442
+ * instance property.
6443
+ *
6444
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
6445
+ */
6446
+ title?: string | undefined;
6447
+
6448
+ /**
6449
+ * This attribute is a string that provides a full description of the of
6450
+ * purpose the instance property.
6451
+ *
6452
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
6453
+ */
6454
+ description?: string | undefined;
6455
+ default?: JSONSchema4Type | undefined;
6456
+ multipleOf?: number | undefined;
6457
+ maximum?: number | undefined;
6458
+ exclusiveMaximum?: boolean | undefined;
6459
+ minimum?: number | undefined;
6460
+ exclusiveMinimum?: boolean | undefined;
6461
+ maxLength?: number | undefined;
6462
+ minLength?: number | undefined;
6463
+ pattern?: string | undefined;
6464
+
6465
+ /**
6466
+ * May only be defined when "items" is defined, and is a tuple of JSONSchemas.
6467
+ *
6468
+ * This provides a definition for additional items in an array instance
6469
+ * when tuple definitions of the items is provided. This can be false
6470
+ * to indicate additional items in the array are not allowed, or it can
6471
+ * be a schema that defines the schema of the additional items.
6472
+ *
6473
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
6474
+ */
6475
+ additionalItems?: boolean | JSONSchema4 | undefined;
6476
+
6477
+ /**
6478
+ * This attribute defines the allowed items in an instance array, and
6479
+ * MUST be a schema or an array of schemas. The default value is an
6480
+ * empty schema which allows any value for items in the instance array.
6481
+ *
6482
+ * When this attribute value is a schema and the instance value is an
6483
+ * array, then all the items in the array MUST be valid according to the
6484
+ * schema.
6485
+ *
6486
+ * When this attribute value is an array of schemas and the instance
6487
+ * value is an array, each position in the instance array MUST conform
6488
+ * to the schema in the corresponding position for this array. This
6489
+ * called tuple typing. When tuple typing is used, additional items are
6490
+ * allowed, disallowed, or constrained by the "additionalItems"
6491
+ * (Section 5.6) attribute using the same rules as
6492
+ * "additionalProperties" (Section 5.4) for objects.
6493
+ *
6494
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
6495
+ */
6496
+ items?: JSONSchema4 | JSONSchema4[] | undefined;
6497
+ maxItems?: number | undefined;
6498
+ minItems?: number | undefined;
6499
+ uniqueItems?: boolean | undefined;
6500
+ maxProperties?: number | undefined;
6501
+ minProperties?: number | undefined;
6502
+
6503
+ /**
6504
+ * This attribute indicates if the instance must have a value, and not
6505
+ * be undefined. This is false by default, making the instance
6506
+ * optional.
6507
+ *
6508
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
6509
+ */
6510
+ required?: boolean | string[] | undefined;
6511
+
6512
+ /**
6513
+ * This attribute defines a schema for all properties that are not
6514
+ * explicitly defined in an object type definition. If specified, the
6515
+ * value MUST be a schema or a boolean. If false is provided, no
6516
+ * additional properties are allowed beyond the properties defined in
6517
+ * the schema. The default value is an empty schema which allows any
6518
+ * value for additional properties.
6519
+ *
6520
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
6521
+ */
6522
+ additionalProperties?: boolean | JSONSchema4 | undefined;
6523
+ definitions?: {
6524
+ [k: string]: JSONSchema4;
6525
+ } | undefined;
6526
+
6527
+ /**
6528
+ * This attribute is an object with property definitions that define the
6529
+ * valid values of instance object property values. When the instance
6530
+ * value is an object, the property values of the instance object MUST
6531
+ * conform to the property definitions in this object. In this object,
6532
+ * each property definition's value MUST be a schema, and the property's
6533
+ * name MUST be the name of the instance property that it defines. The
6534
+ * instance property value MUST be valid according to the schema from
6535
+ * the property definition. Properties are considered unordered, the
6536
+ * order of the instance properties MAY be in any order.
6537
+ *
6538
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
6539
+ */
6540
+ properties?: {
6541
+ [k: string]: JSONSchema4;
6542
+ } | undefined;
6543
+
6544
+ /**
6545
+ * This attribute is an object that defines the schema for a set of
6546
+ * property names of an object instance. The name of each property of
6547
+ * this attribute's object is a regular expression pattern in the ECMA
6548
+ * 262/Perl 5 format, while the value is a schema. If the pattern
6549
+ * matches the name of a property on the instance object, the value of
6550
+ * the instance's property MUST be valid against the pattern name's
6551
+ * schema value.
6552
+ *
6553
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
6554
+ */
6555
+ patternProperties?: {
6556
+ [k: string]: JSONSchema4;
6557
+ } | undefined;
6558
+ dependencies?: {
6559
+ [k: string]: JSONSchema4 | string[];
6560
+ } | undefined;
6561
+
6562
+ /**
6563
+ * This provides an enumeration of all possible values that are valid
6564
+ * for the instance property. This MUST be an array, and each item in
6565
+ * the array represents a possible value for the instance value. If
6566
+ * this attribute is defined, the instance value MUST be one of the
6567
+ * values in the array in order for the schema to be valid.
6568
+ *
6569
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
6570
+ */
6571
+ enum?: JSONSchema4Type[] | undefined;
6572
+
6573
+ /**
6574
+ * A single type, or a union of simple types
6575
+ */
6576
+ type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
6577
+ allOf?: JSONSchema4[] | undefined;
6578
+ anyOf?: JSONSchema4[] | undefined;
6579
+ oneOf?: JSONSchema4[] | undefined;
6580
+ not?: JSONSchema4 | undefined;
6581
+
6582
+ /**
6583
+ * The value of this property MUST be another schema which will provide
6584
+ * a base schema which the current schema will inherit from. The
6585
+ * inheritance rules are such that any instance that is valid according
6586
+ * to the current schema MUST be valid according to the referenced
6587
+ * schema. This MAY also be an array, in which case, the instance MUST
6588
+ * be valid for all the schemas in the array. A schema that extends
6589
+ * another schema MAY define additional attributes, constrain existing
6590
+ * attributes, or add other constraints.
6591
+ *
6592
+ * Conceptually, the behavior of extends can be seen as validating an
6593
+ * instance against all constraints in the extending schema as well as
6594
+ * the extended schema(s).
6595
+ *
6596
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
6597
+ */
6598
+ extends?: string | string[] | undefined;
6599
+
6600
+ /**
6601
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6
6602
+ */
6603
+ [k: string]: any;
6604
+ format?: string | undefined;
6605
+ }
6606
+ declare interface JSONSchema4Array extends Array<JSONSchema4Type> {}
6607
+ declare interface JSONSchema4Object {
6608
+ [key: string]: JSONSchema4Type;
6609
+ }
6610
+
6611
+ /**
6612
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
6613
+ */
6614
+ declare type JSONSchema4Type = string //
6615
+ | number | boolean | JSONSchema4Object | JSONSchema4Array | null;
6616
+
6617
+ /**
6618
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
6619
+ */
6620
+ declare type JSONSchema4TypeName = "string" //
6621
+ | "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
6622
+
6623
+ /**
6624
+ * Meta schema
6625
+ *
6626
+ * Recommended values:
6627
+ * - 'http://json-schema.org/schema#'
6628
+ * - 'http://json-schema.org/hyper-schema#'
6629
+ * - 'http://json-schema.org/draft-04/schema#'
6630
+ * - 'http://json-schema.org/draft-04/hyper-schema#'
6631
+ * - 'http://json-schema.org/draft-03/schema#'
6632
+ * - 'http://json-schema.org/draft-03/hyper-schema#'
6633
+ *
6634
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
6635
+ */
6636
+ declare type JSONSchema4Version = string;
6430
6637
 
6431
6638
  /** @public */
6432
6639
  declare type KeysOfAType<TSchema, Type> = { [key in keyof TSchema]: NonNullable<TSchema[key]> extends Type ? key : never }[keyof TSchema];
@@ -7268,6 +7475,12 @@ declare class MongoDBCollectionNamespace extends MongoDBNamespace {
7268
7475
  constructor(db: string, collection: string);
7269
7476
  static fromString(namespace?: string): MongoDBCollectionNamespace;
7270
7477
  }
7478
+ declare type MongoDBJSONSchema = Pick<StandardJSONSchema, 'title' | 'required' | 'description'> & {
7479
+ bsonType?: string | string[];
7480
+ properties?: Record<string, MongoDBJSONSchema>;
7481
+ items?: MongoDBJSONSchema | MongoDBJSONSchema[];
7482
+ anyOf?: MongoDBJSONSchema[];
7483
+ };
7271
7484
 
7272
7485
  /**
7273
7486
  * @public
@@ -9554,6 +9767,7 @@ declare type Sort = string | Exclude<SortDirection, {
9554
9767
  declare type SortDirection = 1 | -1 | 'asc' | 'desc' | 'ascending' | 'descending' | {
9555
9768
  $meta: string;
9556
9769
  };
9770
+ declare type StandardJSONSchema = JSONSchema4;
9557
9771
  declare interface StartLoadingCliScriptsEvent {
9558
9772
  usesShellOption: boolean;
9559
9773
  }
package/lib/api-raw.d.ts CHANGED
@@ -19,7 +19,6 @@ import { EJSONOptions } from 'bson';
19
19
  import { EventEmitter } from 'events';
20
20
  import type { IncomingMessage } from 'http';
21
21
  import { Int32 } from 'bson';
22
- import type { JSONSchema } from 'mongodb-schema';
23
22
  import { Long } from 'bson';
24
23
  import { MaxKey } from 'bson';
25
24
  import { MinKey } from 'bson';
@@ -5858,6 +5857,234 @@ declare interface InterruptWatcher {
5858
5857
  /** @public */
5859
5858
  declare type IsAny<Type, ResultIfAny, ResultIfNotAny> = true extends false & Type ? ResultIfAny : ResultIfNotAny;
5860
5859
 
5860
+ declare type JSONSchema = Partial<JSONSchema4> & MongoDBJSONSchema;
5861
+
5862
+ /**
5863
+ * JSON Schema V4
5864
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04
5865
+ */
5866
+ declare interface JSONSchema4 {
5867
+ id?: string | undefined;
5868
+ $ref?: string | undefined;
5869
+ $schema?: JSONSchema4Version | undefined;
5870
+
5871
+ /**
5872
+ * This attribute is a string that provides a short description of the
5873
+ * instance property.
5874
+ *
5875
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
5876
+ */
5877
+ title?: string | undefined;
5878
+
5879
+ /**
5880
+ * This attribute is a string that provides a full description of the of
5881
+ * purpose the instance property.
5882
+ *
5883
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
5884
+ */
5885
+ description?: string | undefined;
5886
+
5887
+ default?: JSONSchema4Type | undefined;
5888
+ multipleOf?: number | undefined;
5889
+ maximum?: number | undefined;
5890
+ exclusiveMaximum?: boolean | undefined;
5891
+ minimum?: number | undefined;
5892
+ exclusiveMinimum?: boolean | undefined;
5893
+ maxLength?: number | undefined;
5894
+ minLength?: number | undefined;
5895
+ pattern?: string | undefined;
5896
+
5897
+ /**
5898
+ * May only be defined when "items" is defined, and is a tuple of JSONSchemas.
5899
+ *
5900
+ * This provides a definition for additional items in an array instance
5901
+ * when tuple definitions of the items is provided. This can be false
5902
+ * to indicate additional items in the array are not allowed, or it can
5903
+ * be a schema that defines the schema of the additional items.
5904
+ *
5905
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
5906
+ */
5907
+ additionalItems?: boolean | JSONSchema4 | undefined;
5908
+
5909
+ /**
5910
+ * This attribute defines the allowed items in an instance array, and
5911
+ * MUST be a schema or an array of schemas. The default value is an
5912
+ * empty schema which allows any value for items in the instance array.
5913
+ *
5914
+ * When this attribute value is a schema and the instance value is an
5915
+ * array, then all the items in the array MUST be valid according to the
5916
+ * schema.
5917
+ *
5918
+ * When this attribute value is an array of schemas and the instance
5919
+ * value is an array, each position in the instance array MUST conform
5920
+ * to the schema in the corresponding position for this array. This
5921
+ * called tuple typing. When tuple typing is used, additional items are
5922
+ * allowed, disallowed, or constrained by the "additionalItems"
5923
+ * (Section 5.6) attribute using the same rules as
5924
+ * "additionalProperties" (Section 5.4) for objects.
5925
+ *
5926
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
5927
+ */
5928
+ items?: JSONSchema4 | JSONSchema4[] | undefined;
5929
+
5930
+ maxItems?: number | undefined;
5931
+ minItems?: number | undefined;
5932
+ uniqueItems?: boolean | undefined;
5933
+ maxProperties?: number | undefined;
5934
+ minProperties?: number | undefined;
5935
+
5936
+ /**
5937
+ * This attribute indicates if the instance must have a value, and not
5938
+ * be undefined. This is false by default, making the instance
5939
+ * optional.
5940
+ *
5941
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
5942
+ */
5943
+ required?: boolean | string[] | undefined;
5944
+
5945
+ /**
5946
+ * This attribute defines a schema for all properties that are not
5947
+ * explicitly defined in an object type definition. If specified, the
5948
+ * value MUST be a schema or a boolean. If false is provided, no
5949
+ * additional properties are allowed beyond the properties defined in
5950
+ * the schema. The default value is an empty schema which allows any
5951
+ * value for additional properties.
5952
+ *
5953
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
5954
+ */
5955
+ additionalProperties?: boolean | JSONSchema4 | undefined;
5956
+
5957
+ definitions?: {
5958
+ [k: string]: JSONSchema4;
5959
+ } | undefined;
5960
+
5961
+ /**
5962
+ * This attribute is an object with property definitions that define the
5963
+ * valid values of instance object property values. When the instance
5964
+ * value is an object, the property values of the instance object MUST
5965
+ * conform to the property definitions in this object. In this object,
5966
+ * each property definition's value MUST be a schema, and the property's
5967
+ * name MUST be the name of the instance property that it defines. The
5968
+ * instance property value MUST be valid according to the schema from
5969
+ * the property definition. Properties are considered unordered, the
5970
+ * order of the instance properties MAY be in any order.
5971
+ *
5972
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
5973
+ */
5974
+ properties?: {
5975
+ [k: string]: JSONSchema4;
5976
+ } | undefined;
5977
+
5978
+ /**
5979
+ * This attribute is an object that defines the schema for a set of
5980
+ * property names of an object instance. The name of each property of
5981
+ * this attribute's object is a regular expression pattern in the ECMA
5982
+ * 262/Perl 5 format, while the value is a schema. If the pattern
5983
+ * matches the name of a property on the instance object, the value of
5984
+ * the instance's property MUST be valid against the pattern name's
5985
+ * schema value.
5986
+ *
5987
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
5988
+ */
5989
+ patternProperties?: {
5990
+ [k: string]: JSONSchema4;
5991
+ } | undefined;
5992
+ dependencies?: {
5993
+ [k: string]: JSONSchema4 | string[];
5994
+ } | undefined;
5995
+
5996
+ /**
5997
+ * This provides an enumeration of all possible values that are valid
5998
+ * for the instance property. This MUST be an array, and each item in
5999
+ * the array represents a possible value for the instance value. If
6000
+ * this attribute is defined, the instance value MUST be one of the
6001
+ * values in the array in order for the schema to be valid.
6002
+ *
6003
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
6004
+ */
6005
+ enum?: JSONSchema4Type[] | undefined;
6006
+
6007
+ /**
6008
+ * A single type, or a union of simple types
6009
+ */
6010
+ type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
6011
+
6012
+ allOf?: JSONSchema4[] | undefined;
6013
+ anyOf?: JSONSchema4[] | undefined;
6014
+ oneOf?: JSONSchema4[] | undefined;
6015
+ not?: JSONSchema4 | undefined;
6016
+
6017
+ /**
6018
+ * The value of this property MUST be another schema which will provide
6019
+ * a base schema which the current schema will inherit from. The
6020
+ * inheritance rules are such that any instance that is valid according
6021
+ * to the current schema MUST be valid according to the referenced
6022
+ * schema. This MAY also be an array, in which case, the instance MUST
6023
+ * be valid for all the schemas in the array. A schema that extends
6024
+ * another schema MAY define additional attributes, constrain existing
6025
+ * attributes, or add other constraints.
6026
+ *
6027
+ * Conceptually, the behavior of extends can be seen as validating an
6028
+ * instance against all constraints in the extending schema as well as
6029
+ * the extended schema(s).
6030
+ *
6031
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
6032
+ */
6033
+ extends?: string | string[] | undefined;
6034
+
6035
+ /**
6036
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6
6037
+ */
6038
+ [k: string]: any;
6039
+
6040
+ format?: string | undefined;
6041
+ }
6042
+
6043
+ declare interface JSONSchema4Array extends Array<JSONSchema4Type> {}
6044
+
6045
+ declare interface JSONSchema4Object {
6046
+ [key: string]: JSONSchema4Type;
6047
+ }
6048
+
6049
+ /**
6050
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
6051
+ */
6052
+ declare type JSONSchema4Type =
6053
+ | string //
6054
+ | number
6055
+ | boolean
6056
+ | JSONSchema4Object
6057
+ | JSONSchema4Array
6058
+ | null;
6059
+
6060
+ /**
6061
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
6062
+ */
6063
+ declare type JSONSchema4TypeName =
6064
+ | "string" //
6065
+ | "number"
6066
+ | "integer"
6067
+ | "boolean"
6068
+ | "object"
6069
+ | "array"
6070
+ | "null"
6071
+ | "any";
6072
+
6073
+ /**
6074
+ * Meta schema
6075
+ *
6076
+ * Recommended values:
6077
+ * - 'http://json-schema.org/schema#'
6078
+ * - 'http://json-schema.org/hyper-schema#'
6079
+ * - 'http://json-schema.org/draft-04/schema#'
6080
+ * - 'http://json-schema.org/draft-04/hyper-schema#'
6081
+ * - 'http://json-schema.org/draft-03/schema#'
6082
+ * - 'http://json-schema.org/draft-03/hyper-schema#'
6083
+ *
6084
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
6085
+ */
6086
+ declare type JSONSchema4Version = string;
6087
+
5861
6088
  /** @public */
5862
6089
  declare type KeysOfAType<TSchema, Type> = {
5863
6090
  [key in keyof TSchema]: NonNullable<TSchema[key]> extends Type ? key : never;
@@ -6589,6 +6816,13 @@ declare class MongoDBCollectionNamespace extends MongoDBNamespace {
6589
6816
  static fromString(namespace?: string): MongoDBCollectionNamespace;
6590
6817
  }
6591
6818
 
6819
+ declare type MongoDBJSONSchema = Pick<StandardJSONSchema, 'title' | 'required' | 'description'> & {
6820
+ bsonType?: string | string[];
6821
+ properties?: Record<string, MongoDBJSONSchema>;
6822
+ items?: MongoDBJSONSchema | MongoDBJSONSchema[];
6823
+ anyOf?: MongoDBJSONSchema[];
6824
+ };
6825
+
6592
6826
  /**
6593
6827
  * @public
6594
6828
  *
@@ -8621,6 +8855,8 @@ declare type SortDirection = 1 | -1 | 'asc' | 'desc' | 'ascending' | 'descending
8621
8855
  $meta: string;
8622
8856
  };
8623
8857
 
8858
+ declare type StandardJSONSchema = JSONSchema4;
8859
+
8624
8860
  declare interface StartLoadingCliScriptsEvent {
8625
8861
  usesShellOption: boolean;
8626
8862
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongosh/shell-api",
3
- "version": "3.16.1",
3
+ "version": "3.16.2",
4
4
  "description": "MongoDB Shell API Classes Package",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -75,5 +75,5 @@
75
75
  "prettier": "^2.8.8",
76
76
  "semver": "^7.5.3"
77
77
  },
78
- "gitHead": "d660036ab705b977d72e95f8daddbe587fa4466a"
78
+ "gitHead": "d37041bae3d76c22a9a683c7231e51f5108cefd3"
79
79
  }