@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 +0 -0
- simpl-schema/README.md +1 -2
- simpl-schema/index.d.ts +107 -103
- simpl-schema/package.json +15 -15
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:
|
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
|
-
|
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[
|
76
|
+
isSet: FieldInfo["isSet"];
|
88
77
|
key: string;
|
89
|
-
operator: FieldInfo[
|
78
|
+
operator: FieldInfo["operator"];
|
90
79
|
parentField: () => FieldInfo;
|
91
80
|
siblingField: (fieldName: string) => FieldInfo;
|
92
81
|
unset: () => void;
|
93
|
-
value?: FieldInfo[
|
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
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
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
|
-
|
149
|
-
|
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
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
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
|
-
|
164
|
+
[key: string]: string | SimpleSchemaCreateFunc;
|
176
165
|
}
|
177
166
|
|
178
167
|
type SimpleSchemaMessagesDict = Record<string, SimpleSchemaMessageType>;
|
179
168
|
|
180
169
|
export class SimpleSchema {
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
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 =
|
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
|
-
|
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
|
+
"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
|
-
"
|
11
|
-
"
|
10
|
+
"githubUsername": "arichter83",
|
11
|
+
"url": "https://github.com/arichter83"
|
12
12
|
},
|
13
13
|
{
|
14
14
|
"name": "Qkramer",
|
15
|
-
"
|
16
|
-
"
|
15
|
+
"githubUsername": "Qkramer",
|
16
|
+
"url": "https://github.com/Qkramer"
|
17
17
|
},
|
18
18
|
{
|
19
19
|
"name": "Deskoh",
|
20
|
-
"
|
21
|
-
"
|
20
|
+
"githubUsername": "deskoh",
|
21
|
+
"url": "https://github.com/deskoh"
|
22
22
|
},
|
23
23
|
{
|
24
24
|
"name": "Nicusor Chiciuc",
|
25
|
-
"
|
26
|
-
"
|
25
|
+
"githubUsername": "nicu-chiciuc",
|
26
|
+
"url": "https://github.com/nicu-chiciuc"
|
27
27
|
},
|
28
28
|
{
|
29
29
|
"name": "Rafa Horo",
|
30
|
-
"
|
31
|
-
"
|
30
|
+
"githubUsername": "rafahoro",
|
31
|
+
"url": "https://github.com/rafahoro"
|
32
32
|
},
|
33
33
|
{
|
34
34
|
"name": "Stepan Yurtsiv",
|
35
|
-
"
|
36
|
-
"
|
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": "
|
51
|
-
"typeScriptVersion": "4.
|
50
|
+
"typesPublisherContentHash": "86ac15a1deafd317d16cc640ea94d922667578b353d1b65c4fc4c9b0ba15a6ae",
|
51
|
+
"typeScriptVersion": "4.5"
|
52
52
|
}
|