@types/simpl-schema 1.12.8 → 1.13.0

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
@@ -1,15 +1,3 @@
1
- # Installation
2
- > `npm install --save @types/simpl-schema`
3
-
4
- # Summary
5
- This package contains type definitions for simpl-schema (https://github.com/aldeed/simpl-schema).
6
-
7
- # Details
8
- Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/simpl-schema.
9
-
10
- ### Additional Details
11
- * Last updated: Fri, 10 May 2024 20:35:45 GMT
12
- * Dependencies: [@types/meteor](https://npmjs.com/package/@types/meteor)
13
-
14
- # Credits
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).
1
+ This is a stub types definition for @types/simpl-schema (https://github.com/longshotlabs/simpl-schema).
2
+
3
+ simpl-schema provides its own type definitions, so you don't need @types/simpl-schema installed!
simpl-schema/package.json CHANGED
@@ -1,52 +1,12 @@
1
1
  {
2
2
  "name": "@types/simpl-schema",
3
- "version": "1.12.8",
4
- "description": "TypeScript definitions for simpl-schema",
5
- "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/simpl-schema",
6
- "license": "MIT",
7
- "contributors": [
8
- {
9
- "name": "Andreas Richter",
10
- "githubUsername": "arichter83",
11
- "url": "https://github.com/arichter83"
12
- },
13
- {
14
- "name": "Qkramer",
15
- "githubUsername": "Qkramer",
16
- "url": "https://github.com/Qkramer"
17
- },
18
- {
19
- "name": "Deskoh",
20
- "githubUsername": "deskoh",
21
- "url": "https://github.com/deskoh"
22
- },
23
- {
24
- "name": "Nicusor Chiciuc",
25
- "githubUsername": "nicu-chiciuc",
26
- "url": "https://github.com/nicu-chiciuc"
27
- },
28
- {
29
- "name": "Rafa Horo",
30
- "githubUsername": "rafahoro",
31
- "url": "https://github.com/rafahoro"
32
- },
33
- {
34
- "name": "Stepan Yurtsiv",
35
- "githubUsername": "yurtsiv",
36
- "url": "https://github.com/yurtsiv"
37
- }
38
- ],
3
+ "version": "1.13.0",
4
+ "description": "Stub TypeScript definitions entry for simpl-schema, which provides its own types definitions",
39
5
  "main": "",
40
- "types": "index.d.ts",
41
- "repository": {
42
- "type": "git",
43
- "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
44
- "directory": "types/simpl-schema"
45
- },
46
6
  "scripts": {},
7
+ "license": "MIT",
47
8
  "dependencies": {
48
- "@types/meteor": "*"
9
+ "simpl-schema": "*"
49
10
  },
50
- "typesPublisherContentHash": "def7710e199f371afe3a990e61843c9ec4bdeeaa0b643490aa7226ae9b81b032",
51
- "typeScriptVersion": "4.7"
11
+ "deprecated": "This is a stub types definition. simpl-schema provides its own type definitions, so you do not need this installed."
52
12
  }
simpl-schema/index.d.ts DELETED
@@ -1,297 +0,0 @@
1
- import { check } from "meteor/check";
2
-
3
- export interface ValidationContext extends SimpleSchemaValidationContextStatic {
4
- addValidationErrors(errors: any): void;
5
- clean(...args: any[]): any;
6
- getErrorForKey(key: any, ...args: any[]): any;
7
- reset(): void;
8
- setValidationErrors(errors: any): void;
9
- validationErrors(): any;
10
- }
11
-
12
- interface CustomValidationContext {
13
- /** The name of the schema key (e.g., "addresses.0.street") */
14
- key: string;
15
-
16
- /** The generic name of the schema key (e.g., "addresses.$.street") */
17
- genericKey: string;
18
-
19
- /** True if we're traversing an object that's in an array */
20
- isInArrayItemObject: boolean;
21
-
22
- /** True if we're traversing an object that's somewhere within another object */
23
- isInSubObject: boolean;
24
-
25
- /** True if this is running on a MongoDB modifier object */
26
- isModifier: boolean;
27
-
28
- /** The schema definition object. */
29
- definition: SchemaDefinition;
30
-
31
- /** Does the object being validated have this key set? */
32
- isSet: boolean;
33
-
34
- /** Value to validate */
35
- value: any;
36
-
37
- /** The Mongo operator for which we're doing validation. Might be null. */
38
- operator?: string | null | undefined;
39
-
40
- /** The current validation context */
41
- validationContext: ValidationContext;
42
-
43
- /**
44
- * Use this method to get information about other fields. Pass a field name
45
- * (non-generic schema key) as the only argument. The return object will
46
- * have isSet, value, and operator properties for that field.
47
- */
48
- field(name: string): FieldInfo;
49
- /**
50
- * Use this method to get information about other fields that have the same
51
- * parent object. Works the same way as field(). This is helpful when you use
52
- * sub-schemas or when you're dealing with arrays of objects.
53
- */
54
- siblingField(name: string): FieldInfo;
55
-
56
- /**
57
- * Call this to add validation errors for any key. In general, you should use
58
- * this to add errors for other keys. To add an error for the current key,
59
- * return the error type string. If you do use this to add an error for the
60
- * current key, return false from your custom validation function.
61
- */
62
- addValidationErrors(errors: readonly SimpleSchemaValidationError[]): any;
63
- }
64
-
65
- interface FieldInfo {
66
- isSet: boolean;
67
- value?: any;
68
- operator: string | null;
69
- }
70
-
71
- export interface AutoValueContext {
72
- closestSubschemaFieldName: string | null;
73
- field: (fieldName: string) => FieldInfo;
74
- isModifier: boolean;
75
- isUpsert: boolean;
76
- isSet: FieldInfo["isSet"];
77
- key: string;
78
- operator: FieldInfo["operator"];
79
- parentField: () => FieldInfo;
80
- siblingField: (fieldName: string) => FieldInfo;
81
- unset: () => void;
82
- value?: FieldInfo["value"] | undefined;
83
- }
84
-
85
- type Validator = (this: CustomValidationContext) => undefined | string | SimpleSchemaValidationError;
86
-
87
- export interface SchemaDefinition {
88
- type: any;
89
- label?: string | (() => string) | undefined;
90
- optional?: boolean | (() => boolean) | undefined;
91
- required?: boolean | (() => boolean) | undefined;
92
- min?: number | boolean | Date | (() => number | boolean | Date) | undefined;
93
- max?: number | boolean | Date | (() => number | boolean | Date) | undefined;
94
- minCount?: number | (() => number) | undefined;
95
- maxCount?: number | (() => number) | undefined;
96
- allowedValues?: any[] | (() => any[]) | undefined;
97
- decimal?: boolean | undefined;
98
- exclusiveMax?: boolean | undefined;
99
- exclusiveMin?: boolean | undefined;
100
- regEx?: RegExp | RegExp[] | undefined;
101
- /**
102
- * For custom validation function. If you use an arrow function the context
103
- * for "this" will not be available. Use "custom: function() { return
104
- * something(this.value); }" instead.
105
- */
106
- custom?: Validator | undefined;
107
- blackbox?: boolean | undefined;
108
- autoValue?: ((this: AutoValueContext) => any) | undefined;
109
- defaultValue?: any;
110
- trim?: boolean | undefined;
111
- }
112
-
113
- interface CleanOption {
114
- filter?: boolean | undefined;
115
- autoConvert?: boolean | undefined;
116
- removeEmptyStrings?: boolean | undefined;
117
- trimStrings?: boolean | undefined;
118
- getAutoValues?: boolean | undefined;
119
- isModifier?: boolean | undefined;
120
- extendAutoValueContext?: boolean | undefined;
121
- removeNullsFromArrays?: boolean | undefined;
122
- mutate?: boolean | undefined;
123
- isUpsert?: boolean | undefined;
124
- mongoObject?: boolean | undefined;
125
- }
126
-
127
- interface SimpleSchemaOptions {
128
- check?: typeof check | undefined;
129
- clean?: CleanOption | undefined;
130
- defaultLabel?: string | undefined;
131
- humanizeAutoLabels?: boolean | undefined;
132
- requiredByDefault?: boolean | undefined;
133
- tracker?: any;
134
- }
135
-
136
- interface SimpleSchemaValidationError {
137
- type: string;
138
- [key: string]: number | string;
139
- }
140
-
141
- type IntegerSchema = "SimpleSchema.Integer";
142
-
143
- export type SimpleSchemaDefinition = {
144
- [key: string]:
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[];
160
-
161
- type SimpleSchemaCreateFunc = (options: { label: string; regExp: string }) => string;
162
-
163
- interface SimpleSchemaMessageType {
164
- [key: string]: string | SimpleSchemaCreateFunc;
165
- }
166
-
167
- type SimpleSchemaMessagesDict = Record<string, SimpleSchemaMessageType>;
168
-
169
- export class SimpleSchema {
170
- constructor(schema: SimpleSchemaDefinition | SimpleSchema, 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: readonly 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;
243
- }
244
-
245
- interface ValidationOption {
246
- modifier?: boolean | undefined;
247
- upsert?: boolean | undefined;
248
- extendedCustomContext?: Record<string, any> | undefined;
249
- ignore?: string[];
250
- keys?: string[] | undefined;
251
- }
252
-
253
- type ValidatorOption =
254
- | ({ clean: true } & ValidationOption & CleanOption)
255
- | ({ clean?: false | undefined } & ValidationOption);
256
-
257
- interface SimpleSchemaValidationContextStatic {
258
- validate(obj: any, options?: ValidationOption): boolean;
259
- isValid(): boolean;
260
- keyIsInvalid(name: any): boolean;
261
- keyErrorMessage(name: any): string;
262
- }
263
-
264
- interface MongoObjectStatic {
265
- forEachNode(func: () => void, options?: { endPointsOnly: boolean }): void;
266
- getValueForPosition(position: string): any;
267
- setValueForPosition(position: string, value: any): void;
268
- removeValueForPosition(position: string): void;
269
- getKeyForPosition(position: string): any;
270
- getGenericKeyForPosition(position: string): any;
271
- getInfoForKey(key: string): any;
272
- getPositionForKey(key: string): string;
273
- getPositionsForGenericKey(key: string): string[];
274
- getValueForKey(key: string): any;
275
- addKey(key: string, val: any, op: string): any;
276
- removeGenericKeys(keys: readonly string[]): void;
277
- removeGenericKey(key: string): void;
278
- removeKey(key: string): void;
279
- removeKeys(keys: readonly string[]): void;
280
- filterGenericKeys(test: () => boolean): void;
281
- setValueForKey(key: string, val: any): void;
282
- setValueForGenericKey(key: string, val: any): void;
283
- getObject(): any;
284
- getFlatObject(options?: { keepArrays?: boolean | undefined }): any;
285
- affectsKey(key: string): any;
286
- affectsGenericKey(key: string): any;
287
- affectsGenericKeyImplicit(key: string): any;
288
- }
289
-
290
- export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic;
291
- export const MongoObject: MongoObjectStatic;
292
-
293
- export interface MongoObject {
294
- expandKey(val: any, key: string, obj: any): void;
295
- }
296
-
297
- export default SimpleSchema;