@fincity/kirun-js 1.9.1 → 2.0.1

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.
Files changed (53) hide show
  1. package/__tests__/engine/function/system/math/MathFunctionRepositoryTest.ts +118 -75
  2. package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +3 -3
  3. package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +2 -2
  4. package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +8 -8
  5. package/__tests__/engine/json/schema/SchemaUtil.ts +1 -1
  6. package/__tests__/engine/json/schema/type/TypeUtilTest.ts +1 -1
  7. package/__tests__/engine/json/schema/validator/AnyOfAllOfOneOfValidatorTest.ts +24 -19
  8. package/__tests__/engine/json/schema/validator/ArrayContainsValidatorTest.ts +22 -22
  9. package/__tests__/engine/json/schema/validator/ArraySchemaAdapterTypeTest.ts +10 -10
  10. package/__tests__/engine/json/schema/validator/ArraySchemaTypeTest.ts +22 -22
  11. package/__tests__/engine/json/schema/validator/ArrayValidatorTest.ts +13 -13
  12. package/__tests__/engine/json/schema/validator/NotValidatorTest.ts +10 -9
  13. package/__tests__/engine/json/schema/validator/NullValidatorTest.ts +6 -6
  14. package/__tests__/engine/json/schema/validator/ObjectPropertiesTest.ts +4 -4
  15. package/__tests__/engine/json/schema/validator/ObjectValidatorTest.ts +32 -28
  16. package/__tests__/engine/json/schema/validator/SchemaAnyOfValidatorTest.ts +184 -182
  17. package/__tests__/engine/json/schema/validator/SchemaValidatorTest.ts +43 -32
  18. package/__tests__/engine/json/schema/validator/StringFormatSchemaValidatorTest.ts +24 -24
  19. package/__tests__/engine/json/schema/validator/StringValidatorTest.ts +14 -14
  20. package/__tests__/engine/repository/KIRunFunctionRepositoryTest.ts +7 -7
  21. package/__tests__/engine/repository/RepositoryFilterTest.ts +7 -7
  22. package/__tests__/engine/runtime/KIRuntimeFunctionInFunction.ts +11 -7
  23. package/__tests__/engine/runtime/KIRuntimeNoParamMapTest.ts +2 -2
  24. package/__tests__/engine/runtime/KIRuntimeNoValuesTest.ts +2 -2
  25. package/__tests__/engine/runtime/KIRuntimeTest.ts +8 -6
  26. package/__tests__/engine/runtime/KIRuntimeTestWithoutGenEvent.ts +4 -1
  27. package/__tests__/engine/runtime/KIRuntimeUndefinedParamTest.ts +23 -26
  28. package/__tests__/engine/runtime/KIRuntimeValuesEmptyTest.ts +6 -6
  29. package/__tests__/indexTest.ts +10 -10
  30. package/dist/index.js +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/module.js +1 -1
  33. package/dist/module.js.map +1 -1
  34. package/dist/types.d.ts +17 -17
  35. package/dist/types.d.ts.map +1 -1
  36. package/package.json +4 -4
  37. package/src/engine/HybridRepository.ts +5 -5
  38. package/src/engine/Repository.ts +2 -2
  39. package/src/engine/function/AbstractFunction.ts +35 -31
  40. package/src/engine/function/system/array/ArrayFunctionRepository.ts +8 -6
  41. package/src/engine/function/system/math/MathFunctionRepository.ts +7 -5
  42. package/src/engine/function/system/object/ObjectFunctionRepository.ts +7 -5
  43. package/src/engine/function/system/string/StringFunctionRepository.ts +8 -6
  44. package/src/engine/json/schema/SchemaUtil.ts +33 -30
  45. package/src/engine/json/schema/validator/ArrayValidator.ts +25 -20
  46. package/src/engine/json/schema/validator/ObjectValidator.ts +32 -14
  47. package/src/engine/json/schema/validator/SchemaValidator.ts +15 -11
  48. package/src/engine/json/schema/validator/TypeValidator.ts +5 -5
  49. package/src/engine/repository/KIRunFunctionRepository.ts +3 -2
  50. package/src/engine/repository/KIRunSchemaRepository.ts +7 -5
  51. package/src/engine/runtime/KIRuntime.ts +14 -14
  52. package/src/engine/util/duplicate.ts +1 -1
  53. package/tsconfig.json +6 -2
@@ -6,7 +6,7 @@ import { SchemaValidationException } from '../../../../../src/engine/json/schema
6
6
  import { SchemaValidator } from '../../../../../src/engine/json/schema/validator/SchemaValidator';
7
7
  import { KIRunSchemaRepository } from '../../../../../src/engine/repository/KIRunSchemaRepository';
8
8
 
9
- test('filter condition with ref schema', () => {
9
+ test('filter condition with ref schema', async () => {
10
10
  let filterOperator: Schema = Schema.ofString('filterOperator')
11
11
  .setNamespace('Test')
12
12
  .setEnums(['EQUALS', 'LESS_THAN', 'GREATER_THAN', 'LESS_THAN_EQUAL']);
@@ -38,12 +38,12 @@ test('filter condition with ref schema', () => {
38
38
 
39
39
  const repo = new HybridRepository<Schema>(
40
40
  {
41
- find(namespace: string, name: string): Schema | undefined {
41
+ async find(namespace: string, name: string): Promise<Schema | undefined> {
42
42
  if (namespace !== 'Test') return undefined;
43
43
  return schemaMap.get(name);
44
44
  },
45
45
 
46
- filter(name: string): string[] {
46
+ async filter(name: string): Promise<string[]> {
47
47
  return Array.from(schemaMap.values())
48
48
  .filter((e) => e.getFullName().toLowerCase().indexOf(name.toLowerCase()) !== -1)
49
49
  .map((e) => e.getFullName());
@@ -60,184 +60,186 @@ test('filter condition with ref schema', () => {
60
60
  isValue: false,
61
61
  };
62
62
 
63
- expect(SchemaValidator.validate([], filterCondition, repo, tempOb)).toBe(tempOb);
63
+ expect(
64
+ await SchemaValidator.validate([], Schema.ofRef('Test.filterCondition'), repo, tempOb),
65
+ ).toBe(tempOb);
64
66
  });
65
67
 
66
- test('complex condition with ref schema', () => {
67
- let complexOperator: Schema = Schema.ofString('complexOperator')
68
- .setNamespace('Test')
69
- .setEnums(['AND', 'OR']);
70
-
71
- // let arraySchema: Schema = Schema.ofArray('conditions', Schema.ofRef('#'));
72
- let arraySchema: Schema = Schema.ofArray('conditions', Schema.ofRef('Test.complexCondition'));
73
-
74
- let complexCondition: Schema = Schema.ofObject('complexCondition')
75
- .setNamespace('Test')
76
- .setProperties(
77
- new Map<string, Schema>([
78
- ['negate', Schema.ofBoolean('negate')],
79
- ['complexConditionOperator', Schema.ofRef('Test.complexOperator')],
80
- ['conditions', arraySchema],
81
- ]),
82
- );
83
-
84
- var schemaMap = new Map<string, Schema>([
85
- ['complexOperator', complexOperator],
86
- ['complexCondition', complexCondition],
87
- ]);
88
-
89
- const repo = new HybridRepository<Schema>(
90
- {
91
- find(namespace: string, name: string): Schema | undefined {
92
- if (namespace !== 'Test') return undefined;
93
- return schemaMap.get(name);
94
- },
95
- filter(name: string): string[] {
96
- return Array.from(schemaMap.values())
97
- .filter((e) => e.getFullName().toLowerCase().indexOf(name.toLowerCase()) !== -1)
98
- .map((e) => e.getFullName());
99
- },
100
- },
101
- new KIRunSchemaRepository(),
102
- );
103
-
104
- let ja: any[] = [];
105
-
106
- let mjob = {
107
- conditions: [...ja],
108
- negate: true,
109
- complexConditionOperator: 'AND',
110
- };
111
-
112
- let njob = {
113
- conditions: [...ja],
114
- negate: true,
115
- complexConditionOperator: 'OR',
116
- };
117
-
118
- ja.push(mjob);
119
- ja.push(njob);
120
-
121
- let bjob = {
122
- conditions: [...ja],
123
- negate: true,
124
- complexConditionOperator: 'AND',
125
- };
126
-
127
- expect(SchemaValidator.validate([], complexCondition, repo, bjob)).toBe(bjob);
128
- });
129
-
130
- test('filter complex condition with ref schema', () => {
131
- let filterOperator: Schema = Schema.ofString('filterOperator')
132
- .setNamespace('Test')
133
- .setEnums(['EQUALS', 'LESS_THAN', 'GREATER_THAN', 'LESS_THAN_EQUAL', 'IN'])
134
- .setDefaultValue('EQUALS');
135
-
136
- let filterCondition: Schema = Schema.ofObject('filterCondition')
137
- .setNamespace('Test')
138
- .setProperties(
139
- new Map<string, Schema>([
140
- ['negate', Schema.ofBoolean('negate').setDefaultValue(false)],
141
- ['operator', Schema.ofRef('Test.filterOperator')],
142
- ['field', Schema.ofString('field')],
143
- ['value', Schema.ofAny('value')],
144
- ['toValue', Schema.ofAny('toValue')],
145
- [
146
- 'multiValue',
147
- Schema.ofArray('multiValue').setItems(
148
- new ArraySchemaType().setSingleSchema(Schema.ofAny('singleType')),
149
- ),
150
- ],
151
- ['isValue', Schema.ofBoolean('isValue').setDefaultValue(false)],
152
- ['isToValue', Schema.ofBoolean('isToValue').setDefaultValue(false)],
153
- ]),
154
- )
155
- .setRequired(['operator', 'field'])
156
- .setAdditionalProperties(new AdditionalType().setBooleanValue(false));
157
-
158
- let complexOperator: Schema = Schema.ofString('complexOperator')
159
- .setNamespace('Test')
160
- .setEnums(['AND', 'OR']);
161
-
162
- let arraySchema: Schema = Schema.ofArray(
163
- 'conditions',
164
- new Schema().setAnyOf([Schema.ofRef('#'), Schema.ofRef('Test.FilterCondition')]),
165
- );
166
-
167
- let complexCondition: Schema = Schema.ofObject('complexCondition')
168
- .setNamespace('Test')
169
- .setProperties(
170
- new Map<string, Schema>([
171
- ['conditions', arraySchema],
172
- ['negate', Schema.ofBoolean('negate').setDefaultValue(false)],
173
- ['operator', Schema.ofRef('Test.complexOperator')],
174
- ]),
175
- )
176
- .setRequired(['conditions', 'operator'])
177
- .setAdditionalProperties(new AdditionalType().setBooleanValue(false));
178
-
179
- var schemaMap = new Map<string, Schema>([
180
- ['filterOperator', filterOperator],
181
- ['filterCondition', filterCondition],
182
- ['complexOperator', complexOperator],
183
- ['complexCondition', complexCondition],
184
- ]);
185
-
186
- const repo = new HybridRepository<Schema>(
187
- {
188
- find(namespace: string, name: string): Schema | undefined {
189
- if (namespace !== 'Test') return undefined;
190
- return schemaMap.get(name);
191
- },
192
-
193
- filter(name: string): string[] {
194
- return Array.from(schemaMap.values())
195
- .filter((e) => e.getFullName().toLowerCase().indexOf(name.toLowerCase()) !== -1)
196
- .map((e) => e.getFullName());
197
- },
198
- },
199
- new KIRunSchemaRepository(),
200
- );
201
-
202
- var tempOb = {
203
- field: 'a.b.c.d',
204
- value: 'surendhar',
205
- operator: 'LESS_THAN',
206
- negate: true,
207
- isValue: false,
208
- };
209
-
210
- var tempOb1 = {
211
- ...tempOb,
212
- operator: 'GREATER_THAN',
213
- isValue: true,
214
- };
215
-
216
- var tempOb2 = {
217
- field: 'k.lm.mno',
218
- operator: 'IN',
219
- multiValue: [1, 2, 3, 4, 5, 5, 6, 7],
220
- negate: true,
221
- };
222
- var ja: any[] = [];
223
-
224
- ja.push(tempOb);
225
- ja.push(tempOb1);
226
- ja.push(tempOb2);
227
-
228
- var mjob = {
229
- conditions: [],
230
- negate: false,
231
- operator: 'AND',
232
- };
233
-
234
- var bjob = {
235
- conditions: [mjob],
236
- negate: true,
237
- operator: 'OR',
238
- };
239
-
240
- var res = SchemaValidator.validate([], complexCondition, repo, bjob);
241
-
242
- expect(res).toBe(bjob);
243
- });
68
+ // test('complex condition with ref schema', async () => {
69
+ // let complexOperator: Schema = Schema.ofString('complexOperator')
70
+ // .setNamespace('Test')
71
+ // .setEnums(['AND', 'OR']);
72
+
73
+ // // let arraySchema: Schema = Schema.ofArray('conditions', Schema.ofRef('#'));
74
+ // let arraySchema: Schema = Schema.ofArray('conditions', Schema.ofRef('Test.complexCondition'));
75
+
76
+ // let complexCondition: Schema = Schema.ofObject('complexCondition')
77
+ // .setNamespace('Test')
78
+ // .setProperties(
79
+ // new Map<string, Schema>([
80
+ // ['negate', Schema.ofBoolean('negate')],
81
+ // ['complexConditionOperator', Schema.ofRef('Test.complexOperator')],
82
+ // ['conditions', arraySchema],
83
+ // ]),
84
+ // );
85
+
86
+ // var schemaMap = new Map<string, Schema>([
87
+ // ['complexOperator', complexOperator],
88
+ // ['complexCondition', complexCondition],
89
+ // ]);
90
+
91
+ // const repo = new HybridRepository<Schema>(
92
+ // {
93
+ // async find(namespace: string, name: string): Promise<Schema | undefined> {
94
+ // if (namespace !== 'Test') return undefined;
95
+ // return schemaMap.get(name);
96
+ // },
97
+ // async filter(name: string): Promise<string[]> {
98
+ // return Array.from(schemaMap.values())
99
+ // .filter((e) => e.getFullName().toLowerCase().indexOf(name.toLowerCase()) !== -1)
100
+ // .map((e) => e.getFullName());
101
+ // },
102
+ // },
103
+ // new KIRunSchemaRepository(),
104
+ // );
105
+
106
+ // let ja: any[] = [];
107
+
108
+ // let mjob = {
109
+ // conditions: [...ja],
110
+ // negate: true,
111
+ // complexConditionOperator: 'AND',
112
+ // };
113
+
114
+ // let njob = {
115
+ // conditions: [...ja],
116
+ // negate: true,
117
+ // complexConditionOperator: 'OR',
118
+ // };
119
+
120
+ // ja.push(mjob);
121
+ // ja.push(njob);
122
+
123
+ // let bjob = {
124
+ // conditions: [...ja],
125
+ // negate: true,
126
+ // complexConditionOperator: 'AND',
127
+ // };
128
+
129
+ // expect(await SchemaValidator.validate([], complexCondition, repo, bjob)).toBe(bjob);
130
+ // });
131
+
132
+ // test('filter complex condition with ref schema', async () => {
133
+ // let filterOperator: Schema = Schema.ofString('filterOperator')
134
+ // .setNamespace('Test')
135
+ // .setEnums(['EQUALS', 'LESS_THAN', 'GREATER_THAN', 'LESS_THAN_EQUAL', 'IN'])
136
+ // .setDefaultValue('EQUALS');
137
+
138
+ // let filterCondition: Schema = Schema.ofObject('filterCondition')
139
+ // .setNamespace('Test')
140
+ // .setProperties(
141
+ // new Map<string, Schema>([
142
+ // ['negate', Schema.ofBoolean('negate').setDefaultValue(false)],
143
+ // ['operator', Schema.ofRef('Test.filterOperator')],
144
+ // ['field', Schema.ofString('field')],
145
+ // ['value', Schema.ofAny('value')],
146
+ // ['toValue', Schema.ofAny('toValue')],
147
+ // [
148
+ // 'multiValue',
149
+ // Schema.ofArray('multiValue').setItems(
150
+ // new ArraySchemaType().setSingleSchema(Schema.ofAny('singleType')),
151
+ // ),
152
+ // ],
153
+ // ['isValue', Schema.ofBoolean('isValue').setDefaultValue(false)],
154
+ // ['isToValue', Schema.ofBoolean('isToValue').setDefaultValue(false)],
155
+ // ]),
156
+ // )
157
+ // .setRequired(['operator', 'field'])
158
+ // .setAdditionalProperties(new AdditionalType().setBooleanValue(false));
159
+
160
+ // let complexOperator: Schema = Schema.ofString('complexOperator')
161
+ // .setNamespace('Test')
162
+ // .setEnums(['AND', 'OR']);
163
+
164
+ // let arraySchema: Schema = Schema.ofArray(
165
+ // 'conditions',
166
+ // new Schema().setAnyOf([Schema.ofRef('#'), Schema.ofRef('Test.FilterCondition')]),
167
+ // );
168
+
169
+ // let complexCondition: Schema = Schema.ofObject('complexCondition')
170
+ // .setNamespace('Test')
171
+ // .setProperties(
172
+ // new Map<string, Schema>([
173
+ // ['conditions', arraySchema],
174
+ // ['negate', Schema.ofBoolean('negate').setDefaultValue(false)],
175
+ // ['operator', Schema.ofRef('Test.complexOperator')],
176
+ // ]),
177
+ // )
178
+ // .setRequired(['conditions', 'operator'])
179
+ // .setAdditionalProperties(new AdditionalType().setBooleanValue(false));
180
+
181
+ // var schemaMap = new Map<string, Schema>([
182
+ // ['filterOperator', filterOperator],
183
+ // ['filterCondition', filterCondition],
184
+ // ['complexOperator', complexOperator],
185
+ // ['complexCondition', complexCondition],
186
+ // ]);
187
+
188
+ // const repo = new HybridRepository<Schema>(
189
+ // {
190
+ // async find(namespace: string, name: string): Promise<Schema | undefined> {
191
+ // if (namespace !== 'Test') return undefined;
192
+ // return schemaMap.get(name);
193
+ // },
194
+
195
+ // async filter(name: string): Promise<string[]> {
196
+ // return Array.from(schemaMap.values())
197
+ // .filter((e) => e.getFullName().toLowerCase().indexOf(name.toLowerCase()) !== -1)
198
+ // .map((e) => e.getFullName());
199
+ // },
200
+ // },
201
+ // new KIRunSchemaRepository(),
202
+ // );
203
+
204
+ // var tempOb = {
205
+ // field: 'a.b.c.d',
206
+ // value: 'surendhar',
207
+ // operator: 'LESS_THAN',
208
+ // negate: true,
209
+ // isValue: false,
210
+ // };
211
+
212
+ // var tempOb1 = {
213
+ // ...tempOb,
214
+ // operator: 'GREATER_THAN',
215
+ // isValue: true,
216
+ // };
217
+
218
+ // var tempOb2 = {
219
+ // field: 'k.lm.mno',
220
+ // operator: 'IN',
221
+ // multiValue: [1, 2, 3, 4, 5, 5, 6, 7],
222
+ // negate: true,
223
+ // };
224
+ // var ja: any[] = [];
225
+
226
+ // ja.push(tempOb);
227
+ // ja.push(tempOb1);
228
+ // ja.push(tempOb2);
229
+
230
+ // var mjob = {
231
+ // conditions: [],
232
+ // negate: false,
233
+ // operator: 'AND',
234
+ // };
235
+
236
+ // var bjob = {
237
+ // conditions: [mjob],
238
+ // negate: true,
239
+ // operator: 'OR',
240
+ // };
241
+
242
+ // var res = await SchemaValidator.validate([], complexCondition, repo, bjob);
243
+
244
+ // expect(res).toBe(bjob);
245
+ // });
@@ -1,4 +1,4 @@
1
- import { AdditionalType, HybridRepository } from '../../../../../src';
1
+ import { AdditionalType, HybridRepository, Repository } from '../../../../../src';
2
2
  import { Schema } from '../../../../../src/engine/json/schema/Schema';
3
3
  import { SchemaType } from '../../../../../src/engine/json/schema/type/SchemaType';
4
4
  import { TypeUtil } from '../../../../../src/engine/json/schema/type/TypeUtil';
@@ -8,25 +8,25 @@ import { KIRunSchemaRepository } from '../../../../../src/engine/repository/KIRu
8
8
 
9
9
  const repo = new KIRunSchemaRepository();
10
10
 
11
- test('Schema Validator Test 1', () => {
11
+ test('Schema Validator Test 1', async () => {
12
12
  let schema: Schema = new Schema().setType(TypeUtil.of(SchemaType.INTEGER));
13
13
 
14
- expect(SchemaValidator.validate([], schema, repo, 2)).toBe(2);
14
+ expect(await SchemaValidator.validate([], schema, repo, 2)).toBe(2);
15
15
 
16
16
  let obj = { name: 'shagil' };
17
17
  let objSchema: Schema = Schema.ofObject('testObj')
18
18
  .setProperties(new Map<string, Schema>([['name', Schema.ofString('name')]]))
19
19
  .setRequired(['name']);
20
- expect(SchemaValidator.validate([], objSchema, repo, obj)).toBe(obj);
20
+ expect(await SchemaValidator.validate([], objSchema, repo, obj)).toBe(obj);
21
21
 
22
- expect(() => SchemaValidator.validate([], objSchema, repo, { name: 123 })).toThrow(
22
+ expect(SchemaValidator.validate([], objSchema, repo, { name: 123 })).rejects.toThrow(
23
23
  'Value {"name":123} is not of valid type(s)\nValue 123 is not of valid type(s)\n123 is not String',
24
24
  );
25
25
 
26
- // expect(SchemaValidator.validate([], schema, repo, 2.5)).toThrowError(new SchemaValidationException('', '2.5 is not a number of type Integer'));
26
+ // expect(await SchemaValidator.validate([], schema, repo, 2.5)).toThrowError(new SchemaValidationException('', '2.5 is not a number of type Integer'));
27
27
  });
28
28
 
29
- test('Schema validation when ref of ref', () => {
29
+ test('Schema validation when ref of ref', async () => {
30
30
  const locationSchema = Schema.from({
31
31
  name: 'Location',
32
32
  namespace: 'Test',
@@ -55,32 +55,36 @@ test('Schema validation when ref of ref', () => {
55
55
  ['TestSchema', testSchema],
56
56
  ]);
57
57
 
58
- const repo = new HybridRepository<Schema>(
59
- {
60
- find(namespace: string, name: string): Schema | undefined {
61
- if (namespace !== 'Test') return undefined;
62
- return schemaMap.get(name);
63
- },
58
+ class X implements Repository<Schema> {
59
+ async find(namespace: string, name: string): Promise<Schema | undefined> {
60
+ if (namespace !== 'Test') return undefined;
61
+ return schemaMap.get(name);
62
+ }
64
63
 
65
- filter(name: string): string[] {
66
- return Array.from(schemaMap.values())
67
- .map((e) => e!.getFullName())
68
- .filter((e) => e.toLowerCase().indexOf(name.toLowerCase()) !== -1);
69
- },
70
- },
71
- new KIRunSchemaRepository(),
72
- );
64
+ async filter(name: string): Promise<string[]> {
65
+ return Array.from(schemaMap.values())
66
+ .map((e) => e!.getFullName())
67
+ .filter((e) => e.toLowerCase().indexOf(name.toLowerCase()) !== -1);
68
+ }
69
+ }
70
+
71
+ const repo = new HybridRepository<Schema>(new X(), new KIRunSchemaRepository());
73
72
  const obj = { obj: { url: 'http://xxxxxx.com' } };
74
73
  const queryParams = {
75
74
  obj: { obj: { url: 'http://xxxxxx.com' } },
76
75
  };
77
76
 
78
77
  expect(
79
- SchemaValidator.validate(undefined, Schema.ofRef('Test.TestSchema'), repo, queryParams),
78
+ await SchemaValidator.validate(
79
+ undefined,
80
+ Schema.ofRef('Test.TestSchema'),
81
+ repo,
82
+ queryParams,
83
+ ),
80
84
  ).toBe(queryParams);
81
85
  });
82
86
 
83
- test('Schema Validator Test 2', () => {
87
+ test('Schema Validator Test 2', async () => {
84
88
  const locationSchema = Schema.from({
85
89
  name: 'Location',
86
90
  namespace: 'Test',
@@ -93,13 +97,13 @@ test('Schema Validator Test 2', () => {
93
97
 
94
98
  const repo = new HybridRepository<Schema>(
95
99
  {
96
- find(namespace, name): Schema | undefined {
100
+ async find(namespace, name): Promise<Schema | undefined> {
97
101
  if (namespace === 'Test' && name === 'Location') {
98
102
  return locationSchema;
99
103
  }
100
104
  return undefined;
101
105
  },
102
- filter(name): string[] {
106
+ async filter(name): Promise<string[]> {
103
107
  return [locationSchema!.getFullName()].filter((n) =>
104
108
  n.toLowerCase().includes(name.toLowerCase()),
105
109
  );
@@ -110,16 +114,23 @@ test('Schema Validator Test 2', () => {
110
114
 
111
115
  const obj = { url: 'http://xxxx.com' };
112
116
 
113
- expect(SchemaValidator.validate(undefined, Schema.ofRef('Test.Location'), repo, obj)).toBe(obj);
117
+ expect(
118
+ await SchemaValidator.validate(undefined, Schema.ofRef('Test.Location'), repo, obj),
119
+ ).toBe(obj);
114
120
  });
115
121
 
116
- test('Validate null for ofAny schema', () => {
122
+ test('Validate null for ofAny schema', async () => {
117
123
  expect(
118
- SchemaValidator.validate(undefined, Schema.ofAny('ofanyundefined'), undefined, undefined),
124
+ await SchemaValidator.validate(
125
+ undefined,
126
+ Schema.ofAny('ofanyundefined'),
127
+ undefined,
128
+ undefined,
129
+ ),
119
130
  ).toBe(undefined);
120
131
  });
121
132
 
122
- test('Schema Validator Test 3', () => {
133
+ test('Schema Validator Test 3', async () => {
123
134
  const obj = { url: 'http://xxxx.com' };
124
135
 
125
136
  const locationSchema = Schema.from({
@@ -135,14 +146,14 @@ test('Schema Validator Test 3', () => {
135
146
 
136
147
  const repo = new HybridRepository<Schema>(
137
148
  {
138
- find(namespace, name): Schema | undefined {
149
+ async find(namespace, name): Promise<Schema | undefined> {
139
150
  if (namespace === 'Test' && name === 'Location') {
140
151
  return locationSchema;
141
152
  }
142
153
  return undefined;
143
154
  },
144
155
 
145
- filter(name): string[] {
156
+ async filter(name): Promise<string[]> {
146
157
  return [locationSchema!.getFullName()].filter((n) =>
147
158
  n.toLowerCase().includes(name.toLowerCase()),
148
159
  );
@@ -155,7 +166,7 @@ test('Schema Validator Test 3', () => {
155
166
  const obj1 = { url: 'http://yyyy.com' };
156
167
 
157
168
  expect(
158
- SchemaValidator.validate(
169
+ await SchemaValidator.validate(
159
170
  undefined,
160
171
  Schema.ofRef('Test.Location').setDefaultValue(obj1),
161
172
  repo,