@naturalcycles/nodejs-lib 15.97.0 → 15.97.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.
|
@@ -361,17 +361,17 @@ interface JObjectOpts {
|
|
|
361
361
|
patternProperties?: StringMap<JsonSchema<any>>;
|
|
362
362
|
keySchema?: JsonSchema;
|
|
363
363
|
}
|
|
364
|
-
export declare class JObjectInfer<PROPS extends Record<string,
|
|
365
|
-
[K in keyof PROPS as PROPS[K] extends
|
|
364
|
+
export declare class JObjectInfer<PROPS extends Record<string, JSchema<any, any>>, Opt extends boolean = false> extends JBuilder<Expand<{
|
|
365
|
+
[K in keyof PROPS as PROPS[K] extends JSchema<any, infer IsOpt> ? IsOpt extends true ? never : K : never]: PROPS[K] extends JSchema<infer OUT, any> ? OUT : never;
|
|
366
366
|
} & {
|
|
367
|
-
[K in keyof PROPS as PROPS[K] extends
|
|
367
|
+
[K in keyof PROPS as PROPS[K] extends JSchema<any, infer IsOpt> ? IsOpt extends true ? K : never : never]?: PROPS[K] extends JSchema<infer OUT, any> ? OUT : never;
|
|
368
368
|
}>, Opt> {
|
|
369
369
|
constructor(props?: PROPS);
|
|
370
370
|
/**
|
|
371
371
|
* When set, the validation will not strip away properties that are not specified explicitly in the schema.
|
|
372
372
|
*/
|
|
373
373
|
allowAdditionalProperties(): this;
|
|
374
|
-
extend<NEW_PROPS extends Record<string,
|
|
374
|
+
extend<NEW_PROPS extends Record<string, JSchema<any, any>>>(props: NEW_PROPS): JObjectInfer<{
|
|
375
375
|
[K in keyof PROPS | keyof NEW_PROPS]: K extends keyof NEW_PROPS ? NEW_PROPS[K] : K extends keyof PROPS ? PROPS[K] : never;
|
|
376
376
|
}, Opt>;
|
|
377
377
|
/**
|
|
@@ -408,7 +408,7 @@ declare function object(props: AnyObject): never;
|
|
|
408
408
|
declare function object<OUT extends AnyObject>(props: {
|
|
409
409
|
[K in keyof Required<OUT>]-?: JSchema<OUT[K], any>;
|
|
410
410
|
}): JObject<OUT, false>;
|
|
411
|
-
declare function objectInfer<P extends Record<string,
|
|
411
|
+
declare function objectInfer<P extends Record<string, JSchema<any, any>>>(props: P): JObjectInfer<P, false>;
|
|
412
412
|
declare function objectDbEntity(props: AnyObject): never;
|
|
413
413
|
declare function objectDbEntity<OUT extends BaseDBEntity, EXTRA_KEYS extends Exclude<keyof OUT, keyof BaseDBEntity> = Exclude<keyof OUT, keyof BaseDBEntity>>(props: {
|
|
414
414
|
[K in EXTRA_KEYS]-?: BuilderFor<OUT[K]>;
|
package/package.json
CHANGED
|
@@ -1144,22 +1144,22 @@ interface JObjectOpts {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
|
|
1146
1146
|
export class JObjectInfer<
|
|
1147
|
-
PROPS extends Record<string,
|
|
1147
|
+
PROPS extends Record<string, JSchema<any, any>>,
|
|
1148
1148
|
Opt extends boolean = false,
|
|
1149
1149
|
> extends JBuilder<
|
|
1150
1150
|
Expand<
|
|
1151
1151
|
{
|
|
1152
|
-
[K in keyof PROPS as PROPS[K] extends
|
|
1152
|
+
[K in keyof PROPS as PROPS[K] extends JSchema<any, infer IsOpt>
|
|
1153
1153
|
? IsOpt extends true
|
|
1154
1154
|
? never
|
|
1155
1155
|
: K
|
|
1156
|
-
: never]: PROPS[K] extends
|
|
1156
|
+
: never]: PROPS[K] extends JSchema<infer OUT, any> ? OUT : never
|
|
1157
1157
|
} & {
|
|
1158
|
-
[K in keyof PROPS as PROPS[K] extends
|
|
1158
|
+
[K in keyof PROPS as PROPS[K] extends JSchema<any, infer IsOpt>
|
|
1159
1159
|
? IsOpt extends true
|
|
1160
1160
|
? K
|
|
1161
1161
|
: never
|
|
1162
|
-
: never]?: PROPS[K] extends
|
|
1162
|
+
: never]?: PROPS[K] extends JSchema<infer OUT, any> ? OUT : never
|
|
1163
1163
|
}
|
|
1164
1164
|
>,
|
|
1165
1165
|
Opt
|
|
@@ -1183,7 +1183,7 @@ export class JObjectInfer<
|
|
|
1183
1183
|
return this.cloneAndUpdateSchema({ additionalProperties: true })
|
|
1184
1184
|
}
|
|
1185
1185
|
|
|
1186
|
-
extend<NEW_PROPS extends Record<string,
|
|
1186
|
+
extend<NEW_PROPS extends Record<string, JSchema<any, any>>>(
|
|
1187
1187
|
props: NEW_PROPS,
|
|
1188
1188
|
): JObjectInfer<
|
|
1189
1189
|
{
|
|
@@ -1326,7 +1326,7 @@ function object<OUT extends AnyObject>(props: {
|
|
|
1326
1326
|
return new JObject<OUT, false>(props)
|
|
1327
1327
|
}
|
|
1328
1328
|
|
|
1329
|
-
function objectInfer<P extends Record<string,
|
|
1329
|
+
function objectInfer<P extends Record<string, JSchema<any, any>>>(
|
|
1330
1330
|
props: P,
|
|
1331
1331
|
): JObjectInfer<P, false> {
|
|
1332
1332
|
return new JObjectInfer<P, false>(props)
|