@naturalcycles/nodejs-lib 15.72.2 → 15.73.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.
|
@@ -50,6 +50,13 @@ export declare const j: {
|
|
|
50
50
|
buffer(): JsonSchemaBufferBuilder;
|
|
51
51
|
enum<const T extends readonly (string | number | boolean | null)[] | StringEnum | NumberEnum>(input: T, opt?: JsonBuilderRuleOpt): JsonSchemaEnumBuilder<T extends readonly (infer U)[] ? U : T extends StringEnum ? T[keyof T] : T extends NumberEnum ? T[keyof T] : never>;
|
|
52
52
|
oneOf<B extends readonly JsonSchemaAnyBuilder<any, any, boolean>[], IN = BuilderInUnion<B>, OUT = BuilderOutUnion<B>>(items: [...B]): JsonSchemaAnyBuilder<IN, OUT, false>;
|
|
53
|
+
/**
|
|
54
|
+
* Value must match at least one of the provided schemas.
|
|
55
|
+
*
|
|
56
|
+
* Use `anyOf` when schemas may overlap (e.g., AccountId | PartnerId with same format).
|
|
57
|
+
* Use `oneOf` when schemas are mutually exclusive.
|
|
58
|
+
*/
|
|
59
|
+
anyOf<B extends readonly JsonSchemaAnyBuilder<any, any, boolean>[], IN = BuilderInUnion<B>, OUT = BuilderOutUnion<B>>(items: [...B]): JsonSchemaAnyBuilder<IN, OUT, false>;
|
|
53
60
|
and(): {
|
|
54
61
|
silentBob: () => never;
|
|
55
62
|
};
|
|
@@ -112,6 +112,18 @@ export const j = {
|
|
|
112
112
|
oneOf: schemas,
|
|
113
113
|
});
|
|
114
114
|
},
|
|
115
|
+
/**
|
|
116
|
+
* Value must match at least one of the provided schemas.
|
|
117
|
+
*
|
|
118
|
+
* Use `anyOf` when schemas may overlap (e.g., AccountId | PartnerId with same format).
|
|
119
|
+
* Use `oneOf` when schemas are mutually exclusive.
|
|
120
|
+
*/
|
|
121
|
+
anyOf(items) {
|
|
122
|
+
const schemas = items.map(b => b.build());
|
|
123
|
+
return new JsonSchemaAnyBuilder({
|
|
124
|
+
anyOf: schemas,
|
|
125
|
+
});
|
|
126
|
+
},
|
|
115
127
|
and() {
|
|
116
128
|
return {
|
|
117
129
|
silentBob: () => {
|
package/package.json
CHANGED
|
@@ -190,6 +190,23 @@ export const j = {
|
|
|
190
190
|
})
|
|
191
191
|
},
|
|
192
192
|
|
|
193
|
+
/**
|
|
194
|
+
* Value must match at least one of the provided schemas.
|
|
195
|
+
*
|
|
196
|
+
* Use `anyOf` when schemas may overlap (e.g., AccountId | PartnerId with same format).
|
|
197
|
+
* Use `oneOf` when schemas are mutually exclusive.
|
|
198
|
+
*/
|
|
199
|
+
anyOf<
|
|
200
|
+
B extends readonly JsonSchemaAnyBuilder<any, any, boolean>[],
|
|
201
|
+
IN = BuilderInUnion<B>,
|
|
202
|
+
OUT = BuilderOutUnion<B>,
|
|
203
|
+
>(items: [...B]): JsonSchemaAnyBuilder<IN, OUT, false> {
|
|
204
|
+
const schemas = items.map(b => b.build())
|
|
205
|
+
return new JsonSchemaAnyBuilder<IN, OUT, false>({
|
|
206
|
+
anyOf: schemas,
|
|
207
|
+
})
|
|
208
|
+
},
|
|
209
|
+
|
|
193
210
|
and() {
|
|
194
211
|
return {
|
|
195
212
|
silentBob: () => {
|