@types/simpl-schema 1.12.9 → 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: Sat, 02 Nov 2024 18:36:07 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,53 +1,12 @@
1
1
  {
2
2
  "name": "@types/simpl-schema",
3
- "version": "1.12.9",
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
- "peerDependencies": {},
51
- "typesPublisherContentHash": "9ffcbc7ac41653cbce310413e40fda8a07a55119c66163a90e14f7dd073293a0",
52
- "typeScriptVersion": "4.8"
11
+ "deprecated": "This is a stub types definition. simpl-schema provides its own type definitions, so you do not need this installed."
53
12
  }
simpl-schema/index.d.ts DELETED
@@ -1,290 +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: SchemaDefinitionType;
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
- interface Class {
142
- new(...args: any[]): any;
143
- }
144
-
145
- type IntegerSchemaType = "SimpleSchema.Integer";
146
- type AnySchemaType = "___Any___";
147
-
148
- export type SchemaDefinitionType =
149
- | SchemaDefinition
150
- | ObjectConstructor
151
- | BooleanConstructor
152
- | StringConstructor
153
- | NumberConstructor
154
- | DateConstructor
155
- | ArrayConstructor
156
- | IntegerSchemaType
157
- | FunctionConstructor
158
- | RegExp
159
- | SimpleSchema
160
- | Class;
161
-
162
- export type SimpleSchemaDefinition = {
163
- [key: string]: SchemaDefinitionType | SchemaDefinitionType[];
164
- } | any[];
165
-
166
- type SimpleSchemaCreateFunc = (options: { label: string; regExp: string }) => string;
167
-
168
- interface SimpleSchemaMessageType {
169
- [key: string]: string | SimpleSchemaCreateFunc;
170
- }
171
-
172
- type SimpleSchemaMessagesDict = Record<string, SimpleSchemaMessageType>;
173
-
174
- export class SimpleSchema {
175
- constructor(schema: SimpleSchemaDefinition | SimpleSchema, options?: SimpleSchemaOptions);
176
- namedContext(name?: string): SimpleSchemaValidationContextStatic;
177
- static isSimpleSchema(obj: any): boolean;
178
- static addValidator(validator: Validator): void;
179
- addValidator(validator: Validator): void;
180
- pick(...fields: string[]): SimpleSchema;
181
- omit(...fields: string[]): SimpleSchema;
182
- static oneOf(...types: SchemaDefinitionType[]): SimpleSchema;
183
- clean(doc: any, options?: CleanOption): any;
184
- schema(key?: string): SchemaDefinition;
185
- getDefinition(key: string, propList?: any, functionContext?: any): any;
186
- get(key: string, prop: string): any;
187
- keyIsInBlackBox(key: string): boolean;
188
- labels(labels: { [key: string]: string }): void;
189
- label(key: any): any;
190
- messages(messages: any): any;
191
- messageForError(type: any, key: any, def: any, value: any): string;
192
- allowsKey(key: any): string;
193
- newContext(): ValidationContext;
194
- objectKeys(keyPrefix?: any): any[];
195
- validate(obj: any, options?: ValidationOption): void;
196
- static validate(obj: any, schema: SimpleSchema, options?: ValidationOption): void;
197
- validator(options?: ValidatorOption): (obj: any) => boolean;
198
- extend(otherSchema: SimpleSchema | SimpleSchemaDefinition): SimpleSchema;
199
- static extendOptions(options: readonly string[]): void;
200
- static Integer: IntegerSchemaType;
201
- static Any: AnySchemaType;
202
- static RegEx: {
203
- Email: RegExp;
204
- EmailWithTLD: RegExp;
205
- Domain: RegExp;
206
- WeakDomain: RegExp;
207
- IP: RegExp;
208
- IPv4: RegExp;
209
- IPv6: RegExp;
210
- Url: RegExp;
211
- Id: RegExp;
212
- ZipCode: RegExp;
213
- Phone: RegExp;
214
- };
215
- static ErrorTypes: {
216
- REQUIRED: string;
217
- MIN_STRING: string;
218
- MAX_STRING: string;
219
- MIN_NUMBER: string;
220
- MAX_NUMBER: string;
221
- MIN_NUMBER_EXCLUSIVE: string;
222
- MAX_NUMBER_EXCLUSIVE: string;
223
- MIN_DATE: string;
224
- MAX_DATE: string;
225
- BAD_DATE: string;
226
- MIN_COUNT: string;
227
- MAX_COUNT: string;
228
- MUST_BE_INTEGER: string;
229
- VALUE_NOT_ALLOWED: string;
230
- EXPECTED_TYPE: string;
231
- FAILED_REGULAR_EXPRESSION: string;
232
- KEY_NOT_IN_SCHEMA: string;
233
- };
234
- static setDefaultMessages(messages: { messages: SimpleSchemaMessagesDict }): void;
235
- getObjectSchema(key: string): typeof SimpleSchema | undefined;
236
- }
237
-
238
- interface ValidationOption {
239
- modifier?: boolean | undefined;
240
- upsert?: boolean | undefined;
241
- extendedCustomContext?: Record<string, any> | undefined;
242
- ignore?: string[];
243
- keys?: string[] | undefined;
244
- }
245
-
246
- type ValidatorOption =
247
- | ({ clean: true } & ValidationOption & CleanOption)
248
- | ({ clean?: false | undefined } & ValidationOption);
249
-
250
- interface SimpleSchemaValidationContextStatic {
251
- validate(obj: any, options?: ValidationOption): boolean;
252
- isValid(): boolean;
253
- keyIsInvalid(name: any): boolean;
254
- keyErrorMessage(name: any): string;
255
- }
256
-
257
- interface MongoObjectStatic {
258
- forEachNode(func: () => void, options?: { endPointsOnly: boolean }): void;
259
- getValueForPosition(position: string): any;
260
- setValueForPosition(position: string, value: any): void;
261
- removeValueForPosition(position: string): void;
262
- getKeyForPosition(position: string): any;
263
- getGenericKeyForPosition(position: string): any;
264
- getInfoForKey(key: string): any;
265
- getPositionForKey(key: string): string;
266
- getPositionsForGenericKey(key: string): string[];
267
- getValueForKey(key: string): any;
268
- addKey(key: string, val: any, op: string): any;
269
- removeGenericKeys(keys: readonly string[]): void;
270
- removeGenericKey(key: string): void;
271
- removeKey(key: string): void;
272
- removeKeys(keys: readonly string[]): void;
273
- filterGenericKeys(test: () => boolean): void;
274
- setValueForKey(key: string, val: any): void;
275
- setValueForGenericKey(key: string, val: any): void;
276
- getObject(): any;
277
- getFlatObject(options?: { keepArrays?: boolean | undefined }): any;
278
- affectsKey(key: string): any;
279
- affectsGenericKey(key: string): any;
280
- affectsGenericKeyImplicit(key: string): any;
281
- }
282
-
283
- export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic;
284
- export const MongoObject: MongoObjectStatic;
285
-
286
- export interface MongoObject {
287
- expandKey(val: any, key: string, obj: any): void;
288
- }
289
-
290
- export default SimpleSchema;