@types/simpl-schema 1.12.3 → 1.12.5

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/LICENSE CHANGED
File without changes
simpl-schema/README.md CHANGED
@@ -8,9 +8,8 @@ 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: Tue, 13 Sep 2022 01:37:42 GMT
11
+ * Last updated: Wed, 18 Oct 2023 11:45:06 GMT
12
12
  * Dependencies: [@types/meteor](https://npmjs.com/package/@types/meteor)
13
- * Global values: none
14
13
 
15
14
  # Credits
16
15
  These definitions were written by [Andreas Richter](https://github.com/arichter83), [Qkramer](https://github.com/Qkramer), [Deskoh](https://github.com/deskoh), [Nicusor Chiciuc](https://github.com/nicu-chiciuc), [Rafa Horo](https://github.com/rafahoro), and [Stepan Yurtsiv](https://github.com/yurtsiv).
simpl-schema/index.d.ts CHANGED
@@ -1,15 +1,4 @@
1
- // Type definitions for simpl-schema 1.12
2
- // Project: https://github.com/aldeed/simpl-schema
3
- // Definitions by: Andreas Richter <https://github.com/arichter83>
4
- // Qkramer <https://github.com/Qkramer>
5
- // Deskoh <https://github.com/deskoh>
6
- // Nicusor Chiciuc <https://github.com/nicu-chiciuc>
7
- // Rafa Horo <https://github.com/rafahoro>
8
- // Stepan Yurtsiv <https://github.com/yurtsiv>
9
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
10
- // Minimum TypeScript Version: 4.1
11
-
12
- import { check } from 'meteor/check';
1
+ import { check } from "meteor/check";
13
2
 
14
3
  export interface ValidationContext extends SimpleSchemaValidationContextStatic {
15
4
  addValidationErrors(errors: any): void;
@@ -84,13 +73,13 @@ export interface AutoValueContext {
84
73
  field: (fieldName: string) => FieldInfo;
85
74
  isModifier: boolean;
86
75
  isUpsert: boolean;
87
- isSet: FieldInfo['isSet'];
76
+ isSet: FieldInfo["isSet"];
88
77
  key: string;
89
- operator: FieldInfo['operator'];
78
+ operator: FieldInfo["operator"];
90
79
  parentField: () => FieldInfo;
91
80
  siblingField: (fieldName: string) => FieldInfo;
92
81
  unset: () => void;
93
- value?: FieldInfo['value'] | undefined;
82
+ value?: FieldInfo["value"] | undefined;
94
83
  }
95
84
 
96
85
  type Validator = (this: CustomValidationContext) => undefined | string | SimpleSchemaValidationError;
@@ -136,108 +125,121 @@ interface CleanOption {
136
125
  }
137
126
 
138
127
  interface SimpleSchemaOptions {
139
- check?: typeof check | undefined;
140
- clean?: CleanOption | undefined;
141
- defaultLabel?: string | undefined;
142
- humanizeAutoLabels?: boolean | undefined;
143
- requiredByDefault?: boolean | undefined;
144
- tracker?: any;
128
+ check?: typeof check | undefined;
129
+ clean?: CleanOption | undefined;
130
+ defaultLabel?: string | undefined;
131
+ humanizeAutoLabels?: boolean | undefined;
132
+ requiredByDefault?: boolean | undefined;
133
+ tracker?: any;
145
134
  }
146
135
 
147
136
  interface SimpleSchemaValidationError {
148
- type: string;
149
- [key: string]: number | string;
137
+ type: string;
138
+ [key: string]: number | string;
150
139
  }
151
140
 
152
141
  type IntegerSchema = "SimpleSchema.Integer";
153
142
 
154
143
  export type SimpleSchemaDefinition = {
155
144
  [key: string]:
156
- | SchemaDefinition
157
- | BooleanConstructor
158
- | StringConstructor
159
- | NumberConstructor
160
- | DateConstructor
161
- | ArrayConstructor
162
- | IntegerSchema
163
- | [StringConstructor]
164
- | [NumberConstructor]
165
- | [IntegerSchema]
166
- | [SimpleSchema]
167
- | string
168
- | RegExp
169
- | SimpleSchema;
170
- } | any[];
145
+ | SchemaDefinition
146
+ | BooleanConstructor
147
+ | StringConstructor
148
+ | NumberConstructor
149
+ | DateConstructor
150
+ | ArrayConstructor
151
+ | IntegerSchema
152
+ | [StringConstructor]
153
+ | [NumberConstructor]
154
+ | [IntegerSchema]
155
+ | [SimpleSchema]
156
+ | string
157
+ | RegExp
158
+ | SimpleSchema;
159
+ } | any[];
171
160
 
172
161
  type SimpleSchemaCreateFunc = (options: { label: string; regExp: string }) => string;
173
162
 
174
163
  interface SimpleSchemaMessageType {
175
- [key: string]: string | SimpleSchemaCreateFunc;
164
+ [key: string]: string | SimpleSchemaCreateFunc;
176
165
  }
177
166
 
178
167
  type SimpleSchemaMessagesDict = Record<string, SimpleSchemaMessageType>;
179
168
 
180
169
  export class SimpleSchema {
181
- constructor(schema: SimpleSchemaDefinition, options?: SimpleSchemaOptions);
182
- namedContext(name?: string): SimpleSchemaValidationContextStatic;
183
- static isSimpleSchema(obj: any): boolean;
184
- static addValidator(validator: Validator): void;
185
- addValidator(validator: Validator): void;
186
- pick(...fields: string[]): SimpleSchema;
187
- omit(...fields: string[]): SimpleSchema;
188
- static oneOf(...types: Array<(RegExp | SchemaDefinition | BooleanConstructor | StringConstructor | NumberConstructor | DateConstructor | ArrayConstructor | IntegerSchema)>): SimpleSchema;
189
- clean(doc: any, options?: CleanOption): any;
190
- schema(key?: string): SchemaDefinition;
191
- getDefinition(key: string, propList?: any, functionContext?: any): any;
192
- get(key: string, prop: string): any;
193
- keyIsInBlackBox(key: string): boolean;
194
- labels(labels: { [key: string]: string }): void;
195
- label(key: any): any;
196
- static Integer: IntegerSchema;
197
- messages(messages: any): any;
198
- messageForError(type: any, key: any, def: any, value: any): string;
199
- allowsKey(key: any): string;
200
- newContext(): ValidationContext;
201
- objectKeys(keyPrefix?: any): any[];
202
- validate(obj: any, options?: ValidationOption): void;
203
- static validate(obj: any, schema: SimpleSchema, options?: ValidationOption): void;
204
- validator(options?: ValidatorOption): (obj: any) => boolean;
205
- extend(otherSchema: SimpleSchema | SimpleSchemaDefinition): SimpleSchema;
206
- static extendOptions(options: ReadonlyArray<string>): void;
207
- static RegEx: {
208
- Email: RegExp;
209
- EmailWithTLD: RegExp;
210
- Domain: RegExp;
211
- WeakDomain: RegExp;
212
- IP: RegExp;
213
- IPv4: RegExp;
214
- IPv6: RegExp;
215
- Url: RegExp;
216
- Id: RegExp;
217
- ZipCode: RegExp;
218
- Phone: RegExp;
219
- };
220
- static ErrorTypes: {
221
- REQUIRED: string;
222
- MIN_STRING: string;
223
- MAX_STRING: string;
224
- MIN_NUMBER: string;
225
- MAX_NUMBER: string;
226
- MIN_NUMBER_EXCLUSIVE: string;
227
- MAX_NUMBER_EXCLUSIVE: string;
228
- MIN_DATE: string;
229
- MAX_DATE: string;
230
- BAD_DATE: string;
231
- MIN_COUNT: string;
232
- MAX_COUNT: string;
233
- MUST_BE_INTEGER: string;
234
- VALUE_NOT_ALLOWED: string;
235
- EXPECTED_TYPE: string;
236
- FAILED_REGULAR_EXPRESSION: string;
237
- KEY_NOT_IN_SCHEMA: string;
238
- };
239
- static setDefaultMessages(messages: {messages: SimpleSchemaMessagesDict}): void;
240
- getObjectSchema(key: string): typeof SimpleSchema | undefined;
170
+ constructor(schema: SimpleSchemaDefinition, options?: SimpleSchemaOptions);
171
+ namedContext(name?: string): SimpleSchemaValidationContextStatic;
172
+ static isSimpleSchema(obj: any): boolean;
173
+ static addValidator(validator: Validator): void;
174
+ addValidator(validator: Validator): void;
175
+ pick(...fields: string[]): SimpleSchema;
176
+ omit(...fields: string[]): SimpleSchema;
177
+ static oneOf(
178
+ ...types: Array<
179
+ (
180
+ | RegExp
181
+ | SchemaDefinition
182
+ | BooleanConstructor
183
+ | StringConstructor
184
+ | NumberConstructor
185
+ | DateConstructor
186
+ | ArrayConstructor
187
+ | IntegerSchema
188
+ )
189
+ >
190
+ ): SimpleSchema;
191
+ clean(doc: any, options?: CleanOption): any;
192
+ schema(key?: string): SchemaDefinition;
193
+ getDefinition(key: string, propList?: any, functionContext?: any): any;
194
+ get(key: string, prop: string): any;
195
+ keyIsInBlackBox(key: string): boolean;
196
+ labels(labels: { [key: string]: string }): void;
197
+ label(key: any): any;
198
+ static Integer: IntegerSchema;
199
+ messages(messages: any): any;
200
+ messageForError(type: any, key: any, def: any, value: any): string;
201
+ allowsKey(key: any): string;
202
+ newContext(): ValidationContext;
203
+ objectKeys(keyPrefix?: any): any[];
204
+ validate(obj: any, options?: ValidationOption): void;
205
+ static validate(obj: any, schema: SimpleSchema, options?: ValidationOption): void;
206
+ validator(options?: ValidatorOption): (obj: any) => boolean;
207
+ extend(otherSchema: SimpleSchema | SimpleSchemaDefinition): SimpleSchema;
208
+ static extendOptions(options: ReadonlyArray<string>): void;
209
+ static RegEx: {
210
+ Email: RegExp;
211
+ EmailWithTLD: RegExp;
212
+ Domain: RegExp;
213
+ WeakDomain: RegExp;
214
+ IP: RegExp;
215
+ IPv4: RegExp;
216
+ IPv6: RegExp;
217
+ Url: RegExp;
218
+ Id: RegExp;
219
+ ZipCode: RegExp;
220
+ Phone: RegExp;
221
+ };
222
+ static ErrorTypes: {
223
+ REQUIRED: string;
224
+ MIN_STRING: string;
225
+ MAX_STRING: string;
226
+ MIN_NUMBER: string;
227
+ MAX_NUMBER: string;
228
+ MIN_NUMBER_EXCLUSIVE: string;
229
+ MAX_NUMBER_EXCLUSIVE: string;
230
+ MIN_DATE: string;
231
+ MAX_DATE: string;
232
+ BAD_DATE: string;
233
+ MIN_COUNT: string;
234
+ MAX_COUNT: string;
235
+ MUST_BE_INTEGER: string;
236
+ VALUE_NOT_ALLOWED: string;
237
+ EXPECTED_TYPE: string;
238
+ FAILED_REGULAR_EXPRESSION: string;
239
+ KEY_NOT_IN_SCHEMA: string;
240
+ };
241
+ static setDefaultMessages(messages: { messages: SimpleSchemaMessagesDict }): void;
242
+ getObjectSchema(key: string): typeof SimpleSchema | undefined;
241
243
  }
242
244
 
243
245
  interface ValidationOption {
@@ -248,7 +250,9 @@ interface ValidationOption {
248
250
  keys?: string[] | undefined;
249
251
  }
250
252
 
251
- type ValidatorOption = ({clean: true} & ValidationOption & CleanOption) | ({clean?: false | undefined} & ValidationOption);
253
+ type ValidatorOption =
254
+ | ({ clean: true } & ValidationOption & CleanOption)
255
+ | ({ clean?: false | undefined } & ValidationOption);
252
256
 
253
257
  interface SimpleSchemaValidationContextStatic {
254
258
  validate(obj: any, options?: ValidationOption): boolean;
@@ -258,7 +262,7 @@ interface SimpleSchemaValidationContextStatic {
258
262
  }
259
263
 
260
264
  interface MongoObjectStatic {
261
- forEachNode(func: () => void, options?: {endPointsOnly: boolean}): void;
265
+ forEachNode(func: () => void, options?: { endPointsOnly: boolean }): void;
262
266
  getValueForPosition(position: string): any;
263
267
  setValueForPosition(position: string, value: any): void;
264
268
  removeValueForPosition(position: string): void;
@@ -277,7 +281,7 @@ interface MongoObjectStatic {
277
281
  setValueForKey(key: string, val: any): void;
278
282
  setValueForGenericKey(key: string, val: any): void;
279
283
  getObject(): any;
280
- getFlatObject(options?: {keepArrays?: boolean | undefined}): any;
284
+ getFlatObject(options?: { keepArrays?: boolean | undefined }): any;
281
285
  affectsKey(key: string): any;
282
286
  affectsGenericKey(key: string): any;
283
287
  affectsGenericKeyImplicit(key: string): any;
@@ -287,7 +291,7 @@ export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic;
287
291
  export const MongoObject: MongoObjectStatic;
288
292
 
289
293
  export interface MongoObject {
290
- expandKey(val: any, key: string, obj: any): void;
294
+ expandKey(val: any, key: string, obj: any): void;
291
295
  }
292
296
 
293
297
  export default SimpleSchema;
simpl-schema/package.json CHANGED
@@ -1,39 +1,39 @@
1
1
  {
2
2
  "name": "@types/simpl-schema",
3
- "version": "1.12.3",
3
+ "version": "1.12.5",
4
4
  "description": "TypeScript definitions for simpl-schema",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/simpl-schema",
6
6
  "license": "MIT",
7
7
  "contributors": [
8
8
  {
9
9
  "name": "Andreas Richter",
10
- "url": "https://github.com/arichter83",
11
- "githubUsername": "arichter83"
10
+ "githubUsername": "arichter83",
11
+ "url": "https://github.com/arichter83"
12
12
  },
13
13
  {
14
14
  "name": "Qkramer",
15
- "url": "https://github.com/Qkramer",
16
- "githubUsername": "Qkramer"
15
+ "githubUsername": "Qkramer",
16
+ "url": "https://github.com/Qkramer"
17
17
  },
18
18
  {
19
19
  "name": "Deskoh",
20
- "url": "https://github.com/deskoh",
21
- "githubUsername": "deskoh"
20
+ "githubUsername": "deskoh",
21
+ "url": "https://github.com/deskoh"
22
22
  },
23
23
  {
24
24
  "name": "Nicusor Chiciuc",
25
- "url": "https://github.com/nicu-chiciuc",
26
- "githubUsername": "nicu-chiciuc"
25
+ "githubUsername": "nicu-chiciuc",
26
+ "url": "https://github.com/nicu-chiciuc"
27
27
  },
28
28
  {
29
29
  "name": "Rafa Horo",
30
- "url": "https://github.com/rafahoro",
31
- "githubUsername": "rafahoro"
30
+ "githubUsername": "rafahoro",
31
+ "url": "https://github.com/rafahoro"
32
32
  },
33
33
  {
34
34
  "name": "Stepan Yurtsiv",
35
- "url": "https://github.com/yurtsiv",
36
- "githubUsername": "yurtsiv"
35
+ "githubUsername": "yurtsiv",
36
+ "url": "https://github.com/yurtsiv"
37
37
  }
38
38
  ],
39
39
  "main": "",
@@ -47,6 +47,6 @@
47
47
  "dependencies": {
48
48
  "@types/meteor": "*"
49
49
  },
50
- "typesPublisherContentHash": "37e600a22b8b91cd4ee4fd48a811b3b6d806ae8e708a476b8eac85e1e9eeb86c",
51
- "typeScriptVersion": "4.1"
50
+ "typesPublisherContentHash": "86ac15a1deafd317d16cc640ea94d922667578b353d1b65c4fc4c9b0ba15a6ae",
51
+ "typeScriptVersion": "4.5"
52
52
  }