@types/simpl-schema 1.12.2 → 1.12.4

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,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: Tue, 19 Apr 2022 18:31:28 GMT
11
+ * Last updated: Mon, 25 Sep 2023 13:39:06 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
@@ -9,7 +9,7 @@
9
9
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
10
10
  // Minimum TypeScript Version: 4.1
11
11
 
12
- import { check } from 'meteor/check';
12
+ import { check } from "meteor/check";
13
13
 
14
14
  export interface ValidationContext extends SimpleSchemaValidationContextStatic {
15
15
  addValidationErrors(errors: any): void;
@@ -84,13 +84,13 @@ export interface AutoValueContext {
84
84
  field: (fieldName: string) => FieldInfo;
85
85
  isModifier: boolean;
86
86
  isUpsert: boolean;
87
- isSet: FieldInfo['isSet'];
87
+ isSet: FieldInfo["isSet"];
88
88
  key: string;
89
- operator: FieldInfo['operator'];
89
+ operator: FieldInfo["operator"];
90
90
  parentField: () => FieldInfo;
91
91
  siblingField: (fieldName: string) => FieldInfo;
92
92
  unset: () => void;
93
- value?: FieldInfo['value'] | undefined;
93
+ value?: FieldInfo["value"] | undefined;
94
94
  }
95
95
 
96
96
  type Validator = (this: CustomValidationContext) => undefined | string | SimpleSchemaValidationError;
@@ -136,108 +136,121 @@ interface CleanOption {
136
136
  }
137
137
 
138
138
  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;
139
+ check?: typeof check | undefined;
140
+ clean?: CleanOption | undefined;
141
+ defaultLabel?: string | undefined;
142
+ humanizeAutoLabels?: boolean | undefined;
143
+ requiredByDefault?: boolean | undefined;
144
+ tracker?: any;
145
145
  }
146
146
 
147
147
  interface SimpleSchemaValidationError {
148
- type: string;
149
- [key: string]: number | string;
148
+ type: string;
149
+ [key: string]: number | string;
150
150
  }
151
151
 
152
152
  type IntegerSchema = "SimpleSchema.Integer";
153
153
 
154
154
  export type SimpleSchemaDefinition = {
155
155
  [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[];
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[];
171
171
 
172
172
  type SimpleSchemaCreateFunc = (options: { label: string; regExp: string }) => string;
173
173
 
174
174
  interface SimpleSchemaMessageType {
175
- [key: string]: string | SimpleSchemaCreateFunc;
175
+ [key: string]: string | SimpleSchemaCreateFunc;
176
176
  }
177
177
 
178
178
  type SimpleSchemaMessagesDict = Record<string, SimpleSchemaMessageType>;
179
179
 
180
180
  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
- schema(): SchemaDefinition[];
192
- getDefinition(key: string, propList?: any, functionContext?: any): any;
193
- get(key: string, prop: string): any;
194
- keyIsInBlackBox(key: string): boolean;
195
- labels(labels: { [key: string]: string }): void;
196
- label(key: any): any;
197
- static Integer: IntegerSchema;
198
- messages(messages: any): any;
199
- messageForError(type: any, key: any, def: any, value: any): string;
200
- allowsKey(key: any): string;
201
- newContext(): ValidationContext;
202
- objectKeys(keyPrefix?: any): any[];
203
- validate(obj: any, options?: ValidationOption): void;
204
- static validate(obj: any, schema: SimpleSchema, options?: ValidationOption): void;
205
- validator(options?: ValidatorOption): (obj: any) => boolean;
206
- extend(otherSchema: SimpleSchema | SimpleSchemaDefinition): SimpleSchema;
207
- static extendOptions(options: ReadonlyArray<string>): void;
208
- static RegEx: {
209
- Email: RegExp;
210
- EmailWithTLD: RegExp;
211
- Domain: RegExp;
212
- WeakDomain: RegExp;
213
- IP: RegExp;
214
- IPv4: RegExp;
215
- IPv6: RegExp;
216
- Url: RegExp;
217
- Id: RegExp;
218
- ZipCode: RegExp;
219
- Phone: RegExp;
220
- };
221
- static ErrorTypes: {
222
- REQUIRED: string;
223
- MIN_STRING: string;
224
- MAX_STRING: string;
225
- MIN_NUMBER: string;
226
- MAX_NUMBER: string;
227
- MIN_NUMBER_EXCLUSIVE: string;
228
- MAX_NUMBER_EXCLUSIVE: string;
229
- MIN_DATE: string;
230
- MAX_DATE: string;
231
- BAD_DATE: string;
232
- MIN_COUNT: string;
233
- MAX_COUNT: string;
234
- MUST_BE_INTEGER: string;
235
- VALUE_NOT_ALLOWED: string;
236
- EXPECTED_TYPE: string;
237
- FAILED_REGULAR_EXPRESSION: string;
238
- KEY_NOT_IN_SCHEMA: string;
239
- };
240
- static setDefaultMessages(messages: {messages: SimpleSchemaMessagesDict}): void;
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(
189
+ ...types: Array<
190
+ (
191
+ | RegExp
192
+ | SchemaDefinition
193
+ | BooleanConstructor
194
+ | StringConstructor
195
+ | NumberConstructor
196
+ | DateConstructor
197
+ | ArrayConstructor
198
+ | IntegerSchema
199
+ )
200
+ >
201
+ ): SimpleSchema;
202
+ clean(doc: any, options?: CleanOption): any;
203
+ schema(key?: string): SchemaDefinition;
204
+ getDefinition(key: string, propList?: any, functionContext?: any): any;
205
+ get(key: string, prop: string): any;
206
+ keyIsInBlackBox(key: string): boolean;
207
+ labels(labels: { [key: string]: string }): void;
208
+ label(key: any): any;
209
+ static Integer: IntegerSchema;
210
+ messages(messages: any): any;
211
+ messageForError(type: any, key: any, def: any, value: any): string;
212
+ allowsKey(key: any): string;
213
+ newContext(): ValidationContext;
214
+ objectKeys(keyPrefix?: any): any[];
215
+ validate(obj: any, options?: ValidationOption): void;
216
+ static validate(obj: any, schema: SimpleSchema, options?: ValidationOption): void;
217
+ validator(options?: ValidatorOption): (obj: any) => boolean;
218
+ extend(otherSchema: SimpleSchema | SimpleSchemaDefinition): SimpleSchema;
219
+ static extendOptions(options: ReadonlyArray<string>): void;
220
+ static RegEx: {
221
+ Email: RegExp;
222
+ EmailWithTLD: RegExp;
223
+ Domain: RegExp;
224
+ WeakDomain: RegExp;
225
+ IP: RegExp;
226
+ IPv4: RegExp;
227
+ IPv6: RegExp;
228
+ Url: RegExp;
229
+ Id: RegExp;
230
+ ZipCode: RegExp;
231
+ Phone: RegExp;
232
+ };
233
+ static ErrorTypes: {
234
+ REQUIRED: string;
235
+ MIN_STRING: string;
236
+ MAX_STRING: string;
237
+ MIN_NUMBER: string;
238
+ MAX_NUMBER: string;
239
+ MIN_NUMBER_EXCLUSIVE: string;
240
+ MAX_NUMBER_EXCLUSIVE: string;
241
+ MIN_DATE: string;
242
+ MAX_DATE: string;
243
+ BAD_DATE: string;
244
+ MIN_COUNT: string;
245
+ MAX_COUNT: string;
246
+ MUST_BE_INTEGER: string;
247
+ VALUE_NOT_ALLOWED: string;
248
+ EXPECTED_TYPE: string;
249
+ FAILED_REGULAR_EXPRESSION: string;
250
+ KEY_NOT_IN_SCHEMA: string;
251
+ };
252
+ static setDefaultMessages(messages: { messages: SimpleSchemaMessagesDict }): void;
253
+ getObjectSchema(key: string): typeof SimpleSchema | undefined;
241
254
  }
242
255
 
243
256
  interface ValidationOption {
@@ -248,7 +261,9 @@ interface ValidationOption {
248
261
  keys?: string[] | undefined;
249
262
  }
250
263
 
251
- type ValidatorOption = ({clean: true} & ValidationOption & CleanOption) | ({clean?: false | undefined} & ValidationOption);
264
+ type ValidatorOption =
265
+ | ({ clean: true } & ValidationOption & CleanOption)
266
+ | ({ clean?: false | undefined } & ValidationOption);
252
267
 
253
268
  interface SimpleSchemaValidationContextStatic {
254
269
  validate(obj: any, options?: ValidationOption): boolean;
@@ -258,7 +273,7 @@ interface SimpleSchemaValidationContextStatic {
258
273
  }
259
274
 
260
275
  interface MongoObjectStatic {
261
- forEachNode(func: () => void, options?: {endPointsOnly: boolean}): void;
276
+ forEachNode(func: () => void, options?: { endPointsOnly: boolean }): void;
262
277
  getValueForPosition(position: string): any;
263
278
  setValueForPosition(position: string, value: any): void;
264
279
  removeValueForPosition(position: string): void;
@@ -277,7 +292,7 @@ interface MongoObjectStatic {
277
292
  setValueForKey(key: string, val: any): void;
278
293
  setValueForGenericKey(key: string, val: any): void;
279
294
  getObject(): any;
280
- getFlatObject(options?: {keepArrays?: boolean | undefined}): any;
295
+ getFlatObject(options?: { keepArrays?: boolean | undefined }): any;
281
296
  affectsKey(key: string): any;
282
297
  affectsGenericKey(key: string): any;
283
298
  affectsGenericKeyImplicit(key: string): any;
@@ -287,7 +302,7 @@ export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic;
287
302
  export const MongoObject: MongoObjectStatic;
288
303
 
289
304
  export interface MongoObject {
290
- expandKey(val: any, key: string, obj: any): void;
305
+ expandKey(val: any, key: string, obj: any): void;
291
306
  }
292
307
 
293
308
  export default SimpleSchema;
simpl-schema/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/simpl-schema",
3
- "version": "1.12.2",
3
+ "version": "1.12.4",
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",
@@ -47,6 +47,6 @@
47
47
  "dependencies": {
48
48
  "@types/meteor": "*"
49
49
  },
50
- "typesPublisherContentHash": "619137cd56bf558c5b9381718f2105fa3e9baafd8880a4096ef7d4c3405444f7",
51
- "typeScriptVersion": "4.1"
50
+ "typesPublisherContentHash": "839cac028b7781a3ae74db1cb8c3e2fa2cc23eb9fc17ed9db8d0cb6dcdfe5527",
51
+ "typeScriptVersion": "4.5"
52
52
  }