@types/simpl-schema 1.10.4 → 1.12.1

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.
simpl-schema/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for simpl-schema (https://github.com/alde
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/simpl-schema.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 29 Mar 2021 21:41:46 GMT
11
+ * Last updated: Tue, 22 Feb 2022 17:31:39 GMT
12
12
  * Dependencies: [@types/meteor](https://npmjs.com/package/@types/meteor)
13
13
  * Global values: none
14
14
 
simpl-schema/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for simpl-schema 1.10
1
+ // Type definitions for simpl-schema 1.12
2
2
  // Project: https://github.com/aldeed/simpl-schema
3
3
  // Definitions by: Andreas Richter <https://github.com/arichter83>
4
4
  // Qkramer <https://github.com/Qkramer>
@@ -7,7 +7,7 @@
7
7
  // Rafa Horo <https://github.com/rafahoro>
8
8
  // Stepan Yurtsiv <https://github.com/yurtsiv>
9
9
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
10
- // Minimum TypeScript Version: 3.7
10
+ // Minimum TypeScript Version: 4.1
11
11
 
12
12
  import { check } from 'meteor/check';
13
13
 
@@ -46,7 +46,7 @@ interface CustomValidationContext {
46
46
  value: any;
47
47
 
48
48
  /** The Mongo operator for which we're doing validation. Might be null. */
49
- operator?: string | null;
49
+ operator?: string | null | undefined;
50
50
 
51
51
  /** The current validation context */
52
52
  validationContext: ValidationContext;
@@ -90,53 +90,56 @@ export interface AutoValueContext {
90
90
  parentField: () => FieldInfo;
91
91
  siblingField: (fieldName: string) => FieldInfo;
92
92
  unset: () => void;
93
- value?: FieldInfo['value'];
93
+ value?: FieldInfo['value'] | undefined;
94
94
  }
95
95
 
96
96
  type Validator = (this: CustomValidationContext) => undefined | string | SimpleSchemaValidationError;
97
97
 
98
98
  export interface SchemaDefinition {
99
99
  type: any;
100
- label?: string | (() => string);
101
- optional?: boolean | (() => boolean);
102
- min?: number | boolean | Date | (() => number | boolean | Date);
103
- max?: number | boolean | Date | (() => number | boolean | Date);
104
- minCount?: number | (() => number);
105
- maxCount?: number | (() => number);
106
- allowedValues?: any[] | (() => any[]);
107
- decimal?: boolean;
108
- exclusiveMax?: boolean;
109
- exclusiveMin?: boolean;
110
- regEx?: RegExp | RegExp[];
100
+ label?: string | (() => string) | undefined;
101
+ optional?: boolean | (() => boolean) | undefined;
102
+ min?: number | boolean | Date | (() => number | boolean | Date) | undefined;
103
+ max?: number | boolean | Date | (() => number | boolean | Date) | undefined;
104
+ minCount?: number | (() => number) | undefined;
105
+ maxCount?: number | (() => number) | undefined;
106
+ allowedValues?: any[] | (() => any[]) | undefined;
107
+ decimal?: boolean | undefined;
108
+ exclusiveMax?: boolean | undefined;
109
+ exclusiveMin?: boolean | undefined;
110
+ regEx?: RegExp | RegExp[] | undefined;
111
111
  /**
112
112
  * For custom validation function. If you use an arrow function the context
113
113
  * for "this" will not be available. Use "custom: function() { return
114
114
  * something(this.value); }" instead.
115
115
  */
116
- custom?: Validator;
117
- blackbox?: boolean;
118
- autoValue?: (this: AutoValueContext) => any;
116
+ custom?: Validator | undefined;
117
+ blackbox?: boolean | undefined;
118
+ autoValue?: ((this: AutoValueContext) => any) | undefined;
119
119
  defaultValue?: any;
120
- trim?: boolean;
120
+ trim?: boolean | undefined;
121
121
  }
122
122
 
123
123
  interface CleanOption {
124
- filter?: boolean;
125
- autoConvert?: boolean;
126
- removeEmptyStrings?: boolean;
127
- trimStrings?: boolean;
128
- getAutoValues?: boolean;
129
- isModifier?: boolean;
130
- extendAutoValueContext?: boolean;
131
- removeNullsFromArrays?: boolean;
124
+ filter?: boolean | undefined;
125
+ autoConvert?: boolean | undefined;
126
+ removeEmptyStrings?: boolean | undefined;
127
+ trimStrings?: boolean | undefined;
128
+ getAutoValues?: boolean | undefined;
129
+ isModifier?: boolean | undefined;
130
+ extendAutoValueContext?: boolean | undefined;
131
+ removeNullsFromArrays?: boolean | undefined;
132
+ mutate?: boolean | undefined;
133
+ isUpsert?: boolean | undefined;
134
+ mongoObject?: boolean | undefined;
132
135
  }
133
136
 
134
137
  interface SimpleSchemaOptions {
135
- check?: typeof check;
136
- clean?: CleanOption;
137
- defaultLabel?: string;
138
- humanizeAutoLabels?: boolean;
139
- requiredByDefault?: boolean;
138
+ check?: typeof check | undefined;
139
+ clean?: CleanOption | undefined;
140
+ defaultLabel?: string | undefined;
141
+ humanizeAutoLabels?: boolean | undefined;
142
+ requiredByDefault?: boolean | undefined;
140
143
  tracker?: any;
141
144
  }
142
145
 
@@ -198,7 +201,7 @@ export class SimpleSchema {
198
201
  objectKeys(keyPrefix?: any): any[];
199
202
  validate(obj: any, options?: ValidationOption): void;
200
203
  static validate(obj: any, schema: SimpleSchema, options?: ValidationOption): void;
201
- validator(options?: ValidationOption): (obj: any) => boolean;
204
+ validator(options?: ValidatorOption): (obj: any) => boolean;
202
205
  extend(otherSchema: SimpleSchema | SimpleSchemaDefinition): SimpleSchema;
203
206
  static extendOptions(options: ReadonlyArray<string>): void;
204
207
  static RegEx: {
@@ -237,35 +240,20 @@ export class SimpleSchema {
237
240
  }
238
241
 
239
242
  interface ValidationOption {
240
- modifier?: boolean;
241
- upsert?: boolean;
242
- clean?: boolean;
243
- filter?: boolean;
244
- upsertextendedCustomContext?: boolean;
245
- keys?: string[];
243
+ modifier?: boolean | undefined;
244
+ upsert?: boolean | undefined;
245
+ extendedCustomContext?: Record<string, any> | undefined;
246
+ ignore?: string[];
247
+ keys?: string[] | undefined;
246
248
  }
247
249
 
248
- interface SimpleSchemaValidationContextStaticKeys {
249
- name: string;
250
- type: string;
251
- value?: any;
252
- }
253
-
254
- interface SimpleSchemaError {
255
- name: string;
256
- type: string;
257
- }
250
+ type ValidatorOption = ({clean: true} & ValidationOption & CleanOption) | ({clean?: false | undefined} & ValidationOption);
258
251
 
259
252
  interface SimpleSchemaValidationContextStatic {
260
253
  validate(obj: any, options?: ValidationOption): boolean;
261
- validateOne(doc: any, keyName: string, options?: ValidationOption): boolean;
262
- resetValidation(): void;
263
254
  isValid(): boolean;
264
- invalidKeys(): SimpleSchemaValidationContextStaticKeys[];
265
- addInvalidKeys(errors: ReadonlyArray<SimpleSchemaError>): void;
266
255
  keyIsInvalid(name: any): boolean;
267
256
  keyErrorMessage(name: any): string;
268
- getErrorObject(): any;
269
257
  }
270
258
 
271
259
  interface MongoObjectStatic {
@@ -288,7 +276,7 @@ interface MongoObjectStatic {
288
276
  setValueForKey(key: string, val: any): void;
289
277
  setValueForGenericKey(key: string, val: any): void;
290
278
  getObject(): any;
291
- getFlatObject(options?: {keepArrays?: boolean}): any;
279
+ getFlatObject(options?: {keepArrays?: boolean | undefined}): any;
292
280
  affectsKey(key: string): any;
293
281
  affectsGenericKey(key: string): any;
294
282
  affectsGenericKeyImplicit(key: string): any;
simpl-schema/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@types/simpl-schema",
3
- "version": "1.10.4",
3
+ "version": "1.12.1",
4
4
  "description": "TypeScript definitions for simpl-schema",
5
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/simpl-schema",
5
6
  "license": "MIT",
6
7
  "contributors": [
7
8
  {
@@ -46,6 +47,6 @@
46
47
  "dependencies": {
47
48
  "@types/meteor": "*"
48
49
  },
49
- "typesPublisherContentHash": "e199aa2bec77d1760782f4d04ab332c0636e0f9af1203c312826756fed661398",
50
- "typeScriptVersion": "3.7"
50
+ "typesPublisherContentHash": "269b3ccf1d97ff6ed525001a0584fcf822fbc6afe9e54203c9c81615893c3685",
51
+ "typeScriptVersion": "4.1"
51
52
  }