surreal-zod 0.0.0-alpha.13 → 0.0.0-alpha.14
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.
- package/lib/data-types.d.ts +4 -0
- package/lib/data-types.js +6 -0
- package/lib/zod/schema.d.ts +146 -147
- package/lib/zod/schema.js +116 -9
- package/package.json +1 -1
- package/src/zod/schema.ts +597 -990
package/src/zod/schema.ts
CHANGED
|
@@ -344,7 +344,7 @@ type UnwrapField<T> =
|
|
|
344
344
|
: T;
|
|
345
345
|
|
|
346
346
|
export interface ZodSurrealField<
|
|
347
|
-
T extends ZodSurrealType = ZodSurrealType,
|
|
347
|
+
T extends _core_.$ZodSurrealType = _core_.$ZodSurrealType,
|
|
348
348
|
O = core.output<T>,
|
|
349
349
|
I = core.input<T>,
|
|
350
350
|
DBO = _core_.dboutput<T>,
|
|
@@ -355,6 +355,7 @@ export interface ZodSurrealField<
|
|
|
355
355
|
I,
|
|
356
356
|
DBO,
|
|
357
357
|
DBI,
|
|
358
|
+
| ""
|
|
358
359
|
| "$default"
|
|
359
360
|
| "$prefault"
|
|
360
361
|
| "$defaultAlways"
|
|
@@ -370,10 +371,17 @@ export interface ZodSurrealField<
|
|
|
370
371
|
: {
|
|
371
372
|
dboptout?: "optional" | undefined;
|
|
372
373
|
})
|
|
373
|
-
: ZodSurrealFieldInternals<O, I, DBO, DBI> &
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
374
|
+
: ZodSurrealFieldInternals<O, I, DBO, DBI> &
|
|
375
|
+
(T["_zod"] extends { optin?: any }
|
|
376
|
+
? {
|
|
377
|
+
dboptin?: T["_zod"]["optin"];
|
|
378
|
+
}
|
|
379
|
+
: { dboptin: T["_zod"]["optin"] }) &
|
|
380
|
+
(T["_zod"] extends { optout?: any }
|
|
381
|
+
? {
|
|
382
|
+
dboptout?: T["_zod"]["optout"];
|
|
383
|
+
}
|
|
384
|
+
: { dboptout: T["_zod"]["optout"] })
|
|
377
385
|
>,
|
|
378
386
|
ZodSurrealFieldMethods<Options> {
|
|
379
387
|
// parsing/encoding/decoding
|
|
@@ -5218,7 +5226,12 @@ export function preprocess<A, U extends _core_.$SomeSurrealType, B = unknown>(
|
|
|
5218
5226
|
//////////////////////////////////////////////////
|
|
5219
5227
|
//////////////////////////////////////////////////
|
|
5220
5228
|
|
|
5221
|
-
export type ZodSurrealRecordIdValue = ZodSurrealType<
|
|
5229
|
+
export type ZodSurrealRecordIdValue = _core_.$ZodSurrealType<
|
|
5230
|
+
RecordIdValue | undefined,
|
|
5231
|
+
unknown,
|
|
5232
|
+
RecordIdValue,
|
|
5233
|
+
unknown
|
|
5234
|
+
>;
|
|
5222
5235
|
|
|
5223
5236
|
export type inferRecordIdValue<Id extends ZodSurrealRecordIdValue> =
|
|
5224
5237
|
Id extends {
|
|
@@ -5257,10 +5270,10 @@ export interface ZodSurrealRecordIdInternals<
|
|
|
5257
5270
|
Extras extends ZodSurrealRecordIdExtras = {},
|
|
5258
5271
|
> extends ZodSurrealTypeInternals<
|
|
5259
5272
|
// O
|
|
5260
|
-
| RecordId<Table, core.output<Id>>
|
|
5273
|
+
| RecordId<Table, Exclude<core.output<Id>, undefined>>
|
|
5261
5274
|
| (Extras extends { output: infer Output } ? Output : never),
|
|
5262
5275
|
// I
|
|
5263
|
-
| RecordId<Table, core.output<Id>>
|
|
5276
|
+
| RecordId<Table, Exclude<core.output<Id>, undefined>>
|
|
5264
5277
|
| StringRecordId
|
|
5265
5278
|
| (Extras extends { input: infer Input } ? Input : never),
|
|
5266
5279
|
// DBO
|
|
@@ -5274,984 +5287,460 @@ export interface ZodSurrealRecordIdInternals<
|
|
|
5274
5287
|
def: ZodSurrealRecordIdDef<Table, Id>;
|
|
5275
5288
|
}
|
|
5276
5289
|
|
|
5277
|
-
type
|
|
5290
|
+
type AnyTableRecordIdTrait<
|
|
5278
5291
|
Tb extends string,
|
|
5279
5292
|
Id extends ZodSurrealRecordIdValue,
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
>
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
table: NoInfer<OverrideTb>,
|
|
5370
|
-
id: NoInfer<OverrideId>,
|
|
5371
|
-
params?: ParseDbContext,
|
|
5372
|
-
): Promise<RecordId<OverrideTb, OverrideId>>;
|
|
5373
|
-
safeFromParts<
|
|
5374
|
-
OverrideTb extends string = Tb,
|
|
5375
|
-
OverrideId extends RecordIdValue = core.output<Id>,
|
|
5376
|
-
>(
|
|
5377
|
-
table: NoInfer<OverrideTb>,
|
|
5378
|
-
id: NoInfer<OverrideId>,
|
|
5379
|
-
params?: ParseDbContext,
|
|
5380
|
-
): classic.ZodSafeParseResult<RecordId<OverrideTb, OverrideId>>;
|
|
5381
|
-
safeFromPartsAsync<
|
|
5382
|
-
OverrideTb extends string = Tb,
|
|
5383
|
-
OverrideId extends RecordIdValue = core.output<Id>,
|
|
5384
|
-
>(
|
|
5385
|
-
table: NoInfer<OverrideTb>,
|
|
5386
|
-
id: NoInfer<OverrideId>,
|
|
5387
|
-
params?: ParseDbContext,
|
|
5388
|
-
): Promise<
|
|
5389
|
-
classic.ZodSafeParseResult<RecordId<OverrideTb, OverrideId>>
|
|
5390
|
-
>;
|
|
5293
|
+
> = {
|
|
5294
|
+
parse<Ctx extends ParseDbContext>(
|
|
5295
|
+
data: unknown,
|
|
5296
|
+
params?: Ctx,
|
|
5297
|
+
): RecordId<
|
|
5298
|
+
Tb,
|
|
5299
|
+
Ctx extends { db: any }
|
|
5300
|
+
? _core_.dboutput<Id>
|
|
5301
|
+
: Exclude<core.output<Id>, undefined>
|
|
5302
|
+
>;
|
|
5303
|
+
parseAsync<Ctx extends ParseDbContext>(
|
|
5304
|
+
data: unknown,
|
|
5305
|
+
params?: Ctx,
|
|
5306
|
+
): Promise<
|
|
5307
|
+
RecordId<
|
|
5308
|
+
Tb,
|
|
5309
|
+
Ctx extends { db: any }
|
|
5310
|
+
? _core_.dboutput<Id>
|
|
5311
|
+
: Exclude<core.output<Id>, undefined>
|
|
5312
|
+
>
|
|
5313
|
+
>;
|
|
5314
|
+
safeParse<Ctx extends ParseDbContext>(
|
|
5315
|
+
data: unknown,
|
|
5316
|
+
params?: Ctx,
|
|
5317
|
+
): classic.ZodSafeParseResult<
|
|
5318
|
+
RecordId<
|
|
5319
|
+
Tb,
|
|
5320
|
+
Ctx extends { db: any }
|
|
5321
|
+
? _core_.dboutput<Id>
|
|
5322
|
+
: Exclude<core.output<Id>, undefined>
|
|
5323
|
+
>
|
|
5324
|
+
>;
|
|
5325
|
+
safeParseAsync<Ctx extends ParseDbContext>(
|
|
5326
|
+
data: unknown,
|
|
5327
|
+
params?: Ctx,
|
|
5328
|
+
): Promise<
|
|
5329
|
+
classic.ZodSafeParseResult<
|
|
5330
|
+
RecordId<
|
|
5331
|
+
Tb,
|
|
5332
|
+
Ctx extends { db: any }
|
|
5333
|
+
? _core_.dboutput<Id>
|
|
5334
|
+
: Exclude<core.output<Id>, undefined>
|
|
5335
|
+
>
|
|
5336
|
+
>
|
|
5337
|
+
>;
|
|
5338
|
+
decode<Ctx extends ParseDbContext>(
|
|
5339
|
+
id: RecordId<Tb, Exclude<core.output<Id>, undefined>> | StringRecordId,
|
|
5340
|
+
params?: Ctx,
|
|
5341
|
+
): RecordId<
|
|
5342
|
+
Tb,
|
|
5343
|
+
Ctx extends { db: any }
|
|
5344
|
+
? _core_.dboutput<Id>
|
|
5345
|
+
: Exclude<core.output<Id>, undefined>
|
|
5346
|
+
>;
|
|
5347
|
+
decodeAsync<Ctx extends ParseDbContext>(
|
|
5348
|
+
id: RecordId<Tb, Exclude<core.output<Id>, undefined>> | StringRecordId,
|
|
5349
|
+
params?: Ctx,
|
|
5350
|
+
): Promise<
|
|
5351
|
+
RecordId<
|
|
5352
|
+
Tb,
|
|
5353
|
+
Ctx extends { db: any }
|
|
5354
|
+
? _core_.dboutput<Id>
|
|
5355
|
+
: Exclude<core.output<Id>, undefined>
|
|
5356
|
+
>
|
|
5357
|
+
>;
|
|
5358
|
+
safeDecode<Ctx extends ParseDbContext>(
|
|
5359
|
+
id: RecordId<Tb, Exclude<core.output<Id>, undefined>> | StringRecordId,
|
|
5360
|
+
params?: Ctx,
|
|
5361
|
+
): classic.ZodSafeParseResult<
|
|
5362
|
+
RecordId<
|
|
5363
|
+
Tb,
|
|
5364
|
+
Ctx extends { db: any }
|
|
5365
|
+
? _core_.dboutput<Id>
|
|
5366
|
+
: Exclude<core.output<Id>, undefined>
|
|
5367
|
+
>
|
|
5368
|
+
>;
|
|
5369
|
+
safeDecodeAsync<Ctx extends ParseDbContext>(
|
|
5370
|
+
id: RecordId<Tb, Exclude<core.output<Id>, undefined>> | StringRecordId,
|
|
5371
|
+
params?: Ctx,
|
|
5372
|
+
): Promise<
|
|
5373
|
+
classic.ZodSafeParseResult<
|
|
5374
|
+
RecordId<
|
|
5375
|
+
Tb,
|
|
5376
|
+
Ctx extends { db: any }
|
|
5377
|
+
? _core_.dboutput<Id>
|
|
5378
|
+
: Exclude<core.output<Id>, undefined>
|
|
5379
|
+
>
|
|
5380
|
+
>
|
|
5381
|
+
>;
|
|
5391
5382
|
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
Tb,
|
|
5402
|
-
core.output<Id>
|
|
5403
|
-
>,
|
|
5404
|
-
>(data: unknown, params?: ParseDbContext): Promise<Override>;
|
|
5405
|
-
safeParse<
|
|
5406
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5407
|
-
Tb,
|
|
5408
|
-
core.output<Id>
|
|
5409
|
-
>,
|
|
5410
|
-
>(
|
|
5411
|
-
data: unknown,
|
|
5412
|
-
params?: ParseDbContext,
|
|
5413
|
-
): classic.ZodSafeParseResult<Override>;
|
|
5414
|
-
safeParseAsync<
|
|
5415
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5416
|
-
Tb,
|
|
5417
|
-
core.output<Id>
|
|
5418
|
-
>,
|
|
5419
|
-
>(
|
|
5420
|
-
data: unknown,
|
|
5421
|
-
params?: ParseDbContext,
|
|
5422
|
-
): Promise<classic.ZodSafeParseResult<Override>>;
|
|
5423
|
-
decode<
|
|
5424
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5425
|
-
Tb,
|
|
5426
|
-
core.output<Id>
|
|
5427
|
-
>,
|
|
5428
|
-
>(
|
|
5429
|
-
id: NoInfer<Override> | StringRecordId,
|
|
5430
|
-
params?: ParseDbContext,
|
|
5431
|
-
): Override;
|
|
5432
|
-
decodeAsync<
|
|
5433
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5434
|
-
Tb,
|
|
5435
|
-
core.output<Id>
|
|
5436
|
-
>,
|
|
5437
|
-
>(
|
|
5438
|
-
id: NoInfer<Override> | StringRecordId,
|
|
5439
|
-
params?: ParseDbContext,
|
|
5440
|
-
): Promise<Override>;
|
|
5441
|
-
safeDecode<
|
|
5442
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5443
|
-
Tb,
|
|
5444
|
-
core.output<Id>
|
|
5445
|
-
>,
|
|
5446
|
-
>(
|
|
5447
|
-
id: NoInfer<Override> | StringRecordId,
|
|
5448
|
-
params?: ParseDbContext,
|
|
5449
|
-
): classic.ZodSafeParseResult<Override>;
|
|
5450
|
-
safeDecodeAsync<
|
|
5451
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5452
|
-
Tb,
|
|
5453
|
-
core.output<Id>
|
|
5454
|
-
>,
|
|
5455
|
-
>(
|
|
5456
|
-
id: NoInfer<Override> | StringRecordId,
|
|
5457
|
-
params?: ParseDbContext,
|
|
5458
|
-
): Promise<classic.ZodSafeParseResult<Override>>;
|
|
5459
|
-
|
|
5460
|
-
// From Parts - Single Parameter
|
|
5461
|
-
fromParts<
|
|
5462
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5383
|
+
fromParts<Ctx extends ParseDbContext>(
|
|
5384
|
+
table: Tb,
|
|
5385
|
+
id: Ctx extends { db: any }
|
|
5386
|
+
? core.output<Id>
|
|
5387
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5388
|
+
params?: Ctx,
|
|
5389
|
+
): undefined extends core.output<Id>
|
|
5390
|
+
?
|
|
5391
|
+
| RecordId<
|
|
5463
5392
|
Tb,
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5393
|
+
// @ts-expect-error: output intersected above
|
|
5394
|
+
Ctx extends { db: any }
|
|
5395
|
+
? _core_.dboutput<Id>
|
|
5396
|
+
: Exclude<core.output<Id>, undefined>
|
|
5397
|
+
>
|
|
5398
|
+
| undefined
|
|
5399
|
+
: RecordId<
|
|
5400
|
+
Tb,
|
|
5401
|
+
Ctx extends { db: any }
|
|
5402
|
+
? _core_.dboutput<Id>
|
|
5403
|
+
: Exclude<core.output<Id>, undefined>
|
|
5404
|
+
>;
|
|
5405
|
+
fromPartsAsync<Ctx extends ParseDbContext>(
|
|
5406
|
+
table: Tb,
|
|
5407
|
+
id: Ctx extends { db: any }
|
|
5408
|
+
? core.output<Id>
|
|
5409
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5410
|
+
params?: Ctx,
|
|
5411
|
+
): undefined extends core.output<Id>
|
|
5412
|
+
? Promise<
|
|
5413
|
+
| RecordId<
|
|
5473
5414
|
Tb,
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5415
|
+
// @ts-expect-error: output intersected above
|
|
5416
|
+
Ctx extends { db: any }
|
|
5417
|
+
? _core_.dboutput<Id>
|
|
5418
|
+
: Exclude<core.output<Id>, undefined>
|
|
5419
|
+
>
|
|
5420
|
+
| undefined
|
|
5421
|
+
>
|
|
5422
|
+
: Promise<
|
|
5423
|
+
RecordId<
|
|
5424
|
+
Tb,
|
|
5425
|
+
Ctx extends { db: any }
|
|
5426
|
+
? _core_.dboutput<Id>
|
|
5427
|
+
: Exclude<core.output<Id>, undefined>
|
|
5428
|
+
>
|
|
5429
|
+
>;
|
|
5430
|
+
safeFromParts<Ctx extends ParseDbContext>(
|
|
5431
|
+
table: Tb,
|
|
5432
|
+
id: Ctx extends { db: any }
|
|
5433
|
+
? core.output<Id>
|
|
5434
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5435
|
+
params?: Ctx,
|
|
5436
|
+
): undefined extends core.output<Id>
|
|
5437
|
+
? classic.ZodSafeParseResult<
|
|
5438
|
+
| RecordId<
|
|
5483
5439
|
Tb,
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5440
|
+
// @ts-expect-error: output intersected above
|
|
5441
|
+
Ctx extends { db: any }
|
|
5442
|
+
? _core_.dboutput<Id>
|
|
5443
|
+
: Exclude<core.output<Id>, undefined>
|
|
5444
|
+
>
|
|
5445
|
+
| undefined
|
|
5446
|
+
>
|
|
5447
|
+
: classic.ZodSafeParseResult<
|
|
5448
|
+
RecordId<
|
|
5449
|
+
Tb,
|
|
5450
|
+
Ctx extends { db: any }
|
|
5451
|
+
? _core_.dboutput<Id>
|
|
5452
|
+
: Exclude<core.output<Id>, undefined>
|
|
5453
|
+
>
|
|
5454
|
+
>;
|
|
5455
|
+
safeFromPartsAsync<Ctx extends ParseDbContext>(
|
|
5456
|
+
table: Tb,
|
|
5457
|
+
id: Ctx extends { db: any }
|
|
5458
|
+
? core.output<Id>
|
|
5459
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5460
|
+
params?: Ctx,
|
|
5461
|
+
): undefined extends core.output<Id>
|
|
5462
|
+
? Promise<
|
|
5463
|
+
classic.ZodSafeParseResult<
|
|
5464
|
+
| RecordId<
|
|
5465
|
+
Tb,
|
|
5466
|
+
// @ts-expect-error: output intersected above
|
|
5467
|
+
Ctx extends { db: any }
|
|
5468
|
+
? _core_.dboutput<Id>
|
|
5469
|
+
: Exclude<core.output<Id>, undefined>
|
|
5470
|
+
>
|
|
5471
|
+
| undefined
|
|
5472
|
+
>
|
|
5473
|
+
>
|
|
5474
|
+
: Promise<
|
|
5475
|
+
classic.ZodSafeParseResult<
|
|
5476
|
+
RecordId<
|
|
5493
5477
|
Tb,
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
}
|
|
5502
|
-
: // Any Table + Typed Value:
|
|
5503
|
-
{
|
|
5504
|
-
// Clone - Split Parameters
|
|
5505
|
-
parse<OverrideTb extends string = Tb>(
|
|
5506
|
-
data: unknown,
|
|
5507
|
-
params?: ParseDbContext,
|
|
5508
|
-
): RecordId<OverrideTb, core.output<Id>>;
|
|
5509
|
-
parseAsync<OverrideTb extends string = Tb>(
|
|
5510
|
-
data: unknown,
|
|
5511
|
-
params?: ParseDbContext,
|
|
5512
|
-
): Promise<RecordId<OverrideTb, core.output<Id>>>;
|
|
5513
|
-
safeParse<OverrideTb extends string = Tb>(
|
|
5514
|
-
data: unknown,
|
|
5515
|
-
params?: ParseDbContext,
|
|
5516
|
-
): classic.ZodSafeParseResult<RecordId<OverrideTb, core.output<Id>>>;
|
|
5517
|
-
safeParseAsync<OverrideTb extends string = Tb>(
|
|
5518
|
-
data: unknown,
|
|
5519
|
-
params?: ParseDbContext,
|
|
5520
|
-
): Promise<
|
|
5521
|
-
classic.ZodSafeParseResult<RecordId<OverrideTb, core.output<Id>>>
|
|
5522
|
-
>;
|
|
5523
|
-
decode<OverrideTb extends string = Tb>(
|
|
5524
|
-
data: RecordId<NoInfer<OverrideTb>, core.output<Id>> | StringRecordId,
|
|
5525
|
-
params?: ParseDbContext,
|
|
5526
|
-
): RecordId<OverrideTb, core.output<Id>>;
|
|
5527
|
-
decodeAsync<OverrideTb extends string = Tb>(
|
|
5528
|
-
data: RecordId<NoInfer<OverrideTb>, core.output<Id>> | StringRecordId,
|
|
5529
|
-
params?: ParseDbContext,
|
|
5530
|
-
): Promise<RecordId<OverrideTb, core.output<Id>>>;
|
|
5531
|
-
safeDecode<OverrideTb extends string = Tb>(
|
|
5532
|
-
data: RecordId<NoInfer<OverrideTb>, core.output<Id>> | StringRecordId,
|
|
5533
|
-
params?: ParseDbContext,
|
|
5534
|
-
): classic.ZodSafeParseResult<RecordId<OverrideTb, core.output<Id>>>;
|
|
5535
|
-
safeDecodeAsync<OverrideTb extends string = Tb>(
|
|
5536
|
-
data: RecordId<NoInfer<OverrideTb>, core.output<Id>> | StringRecordId,
|
|
5537
|
-
params?: ParseDbContext,
|
|
5538
|
-
): Promise<
|
|
5539
|
-
classic.ZodSafeParseResult<RecordId<OverrideTb, core.output<Id>>>
|
|
5540
|
-
>;
|
|
5478
|
+
Ctx extends { db: any }
|
|
5479
|
+
? _core_.dboutput<Id>
|
|
5480
|
+
: Exclude<core.output<Id>, undefined>
|
|
5481
|
+
>
|
|
5482
|
+
>
|
|
5483
|
+
>;
|
|
5484
|
+
};
|
|
5541
5485
|
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5486
|
+
type SpecificTableRecordIdTrait<
|
|
5487
|
+
Tb extends string,
|
|
5488
|
+
Id extends ZodSurrealRecordIdValue,
|
|
5489
|
+
> = {
|
|
5490
|
+
parse<Ctx extends ParseDbContext>(
|
|
5491
|
+
data: unknown,
|
|
5492
|
+
params?: Ctx,
|
|
5493
|
+
): RecordId<
|
|
5494
|
+
Tb,
|
|
5495
|
+
Ctx extends { db: any }
|
|
5496
|
+
? _core_.dboutput<Id>
|
|
5497
|
+
: Exclude<core.output<Id>, undefined>
|
|
5498
|
+
>;
|
|
5499
|
+
parseAsync<Ctx extends ParseDbContext>(
|
|
5500
|
+
data: unknown,
|
|
5501
|
+
params?: Ctx,
|
|
5502
|
+
): Promise<
|
|
5503
|
+
RecordId<
|
|
5504
|
+
Tb,
|
|
5505
|
+
Ctx extends { db: any }
|
|
5506
|
+
? _core_.dboutput<Id>
|
|
5507
|
+
: Exclude<core.output<Id>, undefined>
|
|
5508
|
+
>
|
|
5509
|
+
>;
|
|
5510
|
+
safeParse<Ctx extends ParseDbContext>(
|
|
5511
|
+
data: unknown,
|
|
5512
|
+
params?: Ctx,
|
|
5513
|
+
): classic.ZodSafeParseResult<
|
|
5514
|
+
RecordId<
|
|
5515
|
+
Tb,
|
|
5516
|
+
Ctx extends { db: any }
|
|
5517
|
+
? _core_.dboutput<Id>
|
|
5518
|
+
: Exclude<core.output<Id>, undefined>
|
|
5519
|
+
>
|
|
5520
|
+
>;
|
|
5521
|
+
safeParseAsync<Ctx extends ParseDbContext>(
|
|
5522
|
+
data: unknown,
|
|
5523
|
+
params?: Ctx,
|
|
5524
|
+
): Promise<
|
|
5525
|
+
classic.ZodSafeParseResult<
|
|
5526
|
+
RecordId<
|
|
5527
|
+
Tb,
|
|
5528
|
+
Ctx extends { db: any }
|
|
5529
|
+
? _core_.dboutput<Id>
|
|
5530
|
+
: Exclude<core.output<Id>, undefined>
|
|
5531
|
+
>
|
|
5532
|
+
>
|
|
5533
|
+
>;
|
|
5534
|
+
decode<Ctx extends ParseDbContext>(
|
|
5535
|
+
data: core.output<Id> | StringRecordId,
|
|
5536
|
+
params?: Ctx,
|
|
5537
|
+
): RecordId<
|
|
5538
|
+
Tb,
|
|
5539
|
+
Ctx extends { db: any }
|
|
5540
|
+
? _core_.dboutput<Id>
|
|
5541
|
+
: Exclude<core.output<Id>, undefined>
|
|
5542
|
+
>;
|
|
5543
|
+
decodeAsync<Ctx extends ParseDbContext>(
|
|
5544
|
+
data: core.output<Id> | StringRecordId,
|
|
5545
|
+
params?: Ctx,
|
|
5546
|
+
): Promise<
|
|
5547
|
+
RecordId<
|
|
5548
|
+
Tb,
|
|
5549
|
+
Ctx extends { db: any }
|
|
5550
|
+
? _core_.dboutput<Id>
|
|
5551
|
+
: Exclude<core.output<Id>, undefined>
|
|
5552
|
+
>
|
|
5553
|
+
>;
|
|
5554
|
+
safeDecode<Ctx extends ParseDbContext>(
|
|
5555
|
+
data: core.output<Id> | StringRecordId,
|
|
5556
|
+
params?: Ctx,
|
|
5557
|
+
): classic.ZodSafeParseResult<
|
|
5558
|
+
RecordId<
|
|
5559
|
+
Tb,
|
|
5560
|
+
Ctx extends { db: any }
|
|
5561
|
+
? _core_.dboutput<Id>
|
|
5562
|
+
: Exclude<core.output<Id>, undefined>
|
|
5563
|
+
>
|
|
5564
|
+
>;
|
|
5565
|
+
safeDecodeAsync<Ctx extends ParseDbContext>(
|
|
5566
|
+
data: core.output<Id> | StringRecordId,
|
|
5567
|
+
params?: Ctx,
|
|
5568
|
+
): Promise<
|
|
5569
|
+
classic.ZodSafeParseResult<
|
|
5570
|
+
RecordId<
|
|
5571
|
+
Tb,
|
|
5572
|
+
Ctx extends { db: any }
|
|
5573
|
+
? _core_.dboutput<Id>
|
|
5574
|
+
: Exclude<core.output<Id>, undefined>
|
|
5575
|
+
>
|
|
5576
|
+
>
|
|
5577
|
+
>;
|
|
5565
5578
|
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
): RecordId<Override["table"]["name"], core.output<Id>>;
|
|
5576
|
-
parseAsync<
|
|
5577
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5578
|
-
Tb,
|
|
5579
|
-
core.output<Id>
|
|
5580
|
-
>,
|
|
5581
|
-
>(
|
|
5582
|
-
data: unknown,
|
|
5583
|
-
params?: ParseDbContext,
|
|
5584
|
-
): Promise<RecordId<Override["table"]["name"], core.output<Id>>>;
|
|
5585
|
-
safeParse<
|
|
5586
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5587
|
-
Tb,
|
|
5588
|
-
core.output<Id>
|
|
5589
|
-
>,
|
|
5590
|
-
>(
|
|
5591
|
-
data: unknown,
|
|
5592
|
-
params?: ParseDbContext,
|
|
5593
|
-
): classic.ZodSafeParseResult<
|
|
5594
|
-
RecordId<Override["table"]["name"], core.output<Id>>
|
|
5595
|
-
>;
|
|
5596
|
-
safeParseAsync<
|
|
5597
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5579
|
+
fromParts<Ctx extends ParseDbContext>(
|
|
5580
|
+
table: Tb,
|
|
5581
|
+
id: Ctx extends { db: any }
|
|
5582
|
+
? core.output<Id>
|
|
5583
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5584
|
+
params?: Ctx,
|
|
5585
|
+
): undefined extends core.output<Id>
|
|
5586
|
+
?
|
|
5587
|
+
| RecordId<
|
|
5598
5588
|
Tb,
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
params?: ParseDbContext,
|
|
5604
|
-
): Promise<
|
|
5605
|
-
classic.ZodSafeParseResult<
|
|
5606
|
-
RecordId<Override["table"]["name"], core.output<Id>>
|
|
5589
|
+
// @ts-expect-error: output intersected above
|
|
5590
|
+
Ctx extends { db: any }
|
|
5591
|
+
? _core_.dboutput<Id>
|
|
5592
|
+
: Exclude<core.output<Id>, undefined>
|
|
5607
5593
|
>
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
>,
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
>,
|
|
5625
|
-
>(
|
|
5626
|
-
data:
|
|
5627
|
-
| RecordId<Override["table"]["name"], core.output<Id>>
|
|
5628
|
-
| StringRecordId,
|
|
5629
|
-
params?: ParseDbContext,
|
|
5630
|
-
): Promise<RecordId<Override["table"]["name"], core.output<Id>>>;
|
|
5631
|
-
safeDecode<
|
|
5632
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5633
|
-
Tb,
|
|
5634
|
-
core.output<Id>
|
|
5635
|
-
>,
|
|
5636
|
-
>(
|
|
5637
|
-
data:
|
|
5638
|
-
| RecordId<Override["table"]["name"], core.output<Id>>
|
|
5639
|
-
| StringRecordId,
|
|
5640
|
-
params?: ParseDbContext,
|
|
5641
|
-
): classic.ZodSafeParseResult<
|
|
5642
|
-
RecordId<Override["table"]["name"], core.output<Id>>
|
|
5643
|
-
>;
|
|
5644
|
-
safeDecodeAsync<
|
|
5645
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5594
|
+
| undefined
|
|
5595
|
+
: RecordId<
|
|
5596
|
+
Tb,
|
|
5597
|
+
Ctx extends { db: any }
|
|
5598
|
+
? _core_.dboutput<Id>
|
|
5599
|
+
: Exclude<core.output<Id>, undefined>
|
|
5600
|
+
>;
|
|
5601
|
+
fromPartsAsync<Ctx extends ParseDbContext>(
|
|
5602
|
+
table: Tb,
|
|
5603
|
+
id: Ctx extends { db: any }
|
|
5604
|
+
? core.output<Id>
|
|
5605
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5606
|
+
params?: Ctx,
|
|
5607
|
+
): undefined extends core.output<Id>
|
|
5608
|
+
? Promise<
|
|
5609
|
+
| RecordId<
|
|
5646
5610
|
Tb,
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
| RecordId<Override["table"]["name"], core.output<Id>>
|
|
5652
|
-
| StringRecordId,
|
|
5653
|
-
params?: ParseDbContext,
|
|
5654
|
-
): Promise<
|
|
5655
|
-
classic.ZodSafeParseResult<
|
|
5656
|
-
RecordId<Override["table"]["name"], core.output<Id>>
|
|
5611
|
+
// @ts-expect-error: output intersected above
|
|
5612
|
+
Ctx extends { db: any }
|
|
5613
|
+
? _core_.dboutput<Id>
|
|
5614
|
+
: Exclude<core.output<Id>, undefined>
|
|
5657
5615
|
>
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
>
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
table: NoInfer<Override["table"]["name"]>,
|
|
5678
|
-
id: NoInfer<core.output<Id>>,
|
|
5679
|
-
params?: ParseDbContext,
|
|
5680
|
-
): Promise<RecordId<Override["table"]["name"], core.output<Id>>>;
|
|
5681
|
-
safeFromParts<
|
|
5682
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5683
|
-
Tb,
|
|
5684
|
-
core.output<Id>
|
|
5685
|
-
>,
|
|
5686
|
-
>(
|
|
5687
|
-
table: NoInfer<Override["table"]["name"]>,
|
|
5688
|
-
id: NoInfer<core.output<Id>>,
|
|
5689
|
-
params?: ParseDbContext,
|
|
5690
|
-
): classic.ZodSafeParseResult<
|
|
5691
|
-
RecordId<Override["table"]["name"], core.output<Id>>
|
|
5692
|
-
>;
|
|
5693
|
-
safeFromPartsAsync<
|
|
5694
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5616
|
+
| undefined
|
|
5617
|
+
>
|
|
5618
|
+
: Promise<
|
|
5619
|
+
RecordId<
|
|
5620
|
+
Tb,
|
|
5621
|
+
Ctx extends { db: any }
|
|
5622
|
+
? _core_.dboutput<Id>
|
|
5623
|
+
: Exclude<core.output<Id>, undefined>
|
|
5624
|
+
>
|
|
5625
|
+
>;
|
|
5626
|
+
safeFromParts<Ctx extends ParseDbContext>(
|
|
5627
|
+
table: Tb,
|
|
5628
|
+
id: Ctx extends { db: any }
|
|
5629
|
+
? core.output<Id>
|
|
5630
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5631
|
+
params?: Ctx,
|
|
5632
|
+
): undefined extends core.output<Id>
|
|
5633
|
+
? classic.ZodSafeParseResult<
|
|
5634
|
+
| RecordId<
|
|
5695
5635
|
Tb,
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
id: NoInfer<core.output<Id>>,
|
|
5701
|
-
params?: ParseDbContext,
|
|
5702
|
-
): Promise<
|
|
5703
|
-
classic.ZodSafeParseResult<
|
|
5704
|
-
RecordId<Override["table"]["name"], core.output<Id>>
|
|
5636
|
+
// @ts-expect-error: output intersected above
|
|
5637
|
+
Ctx extends { db: any }
|
|
5638
|
+
? _core_.dboutput<Id>
|
|
5639
|
+
: Exclude<core.output<Id>, undefined>
|
|
5705
5640
|
>
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
safeParseAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5727
|
-
data: unknown,
|
|
5728
|
-
params?: ParseDbContext,
|
|
5729
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>>;
|
|
5730
|
-
decode<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5731
|
-
data: RecordId<Tb, NoInfer<OverrideId>> | StringRecordId,
|
|
5732
|
-
params?: ParseDbContext,
|
|
5733
|
-
): RecordId<Tb, OverrideId>;
|
|
5734
|
-
decodeAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5735
|
-
data: RecordId<Tb, NoInfer<OverrideId>> | StringRecordId,
|
|
5736
|
-
params?: ParseDbContext,
|
|
5737
|
-
): Promise<RecordId<Tb, OverrideId>>;
|
|
5738
|
-
safeDecode<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5739
|
-
data: RecordId<Tb, NoInfer<OverrideId>> | StringRecordId,
|
|
5740
|
-
params?: ParseDbContext,
|
|
5741
|
-
): classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>;
|
|
5742
|
-
safeDecodeAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5743
|
-
data: RecordId<Tb, NoInfer<OverrideId>> | StringRecordId,
|
|
5744
|
-
params?: ParseDbContext,
|
|
5745
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>>;
|
|
5746
|
-
|
|
5747
|
-
// From Parts - Split Parameters
|
|
5748
|
-
fromParts<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5749
|
-
table: NoInfer<Tb>,
|
|
5750
|
-
id: NoInfer<OverrideId>,
|
|
5751
|
-
params?: ParseDbContext,
|
|
5752
|
-
): RecordId<Tb, OverrideId>;
|
|
5753
|
-
fromPartsAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5754
|
-
table: NoInfer<Tb>,
|
|
5755
|
-
id: NoInfer<OverrideId>,
|
|
5756
|
-
params?: ParseDbContext,
|
|
5757
|
-
): Promise<RecordId<Tb, OverrideId>>;
|
|
5758
|
-
safeFromParts<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5759
|
-
table: NoInfer<Tb>,
|
|
5760
|
-
id: NoInfer<OverrideId>,
|
|
5761
|
-
params?: ParseDbContext,
|
|
5762
|
-
): classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>;
|
|
5763
|
-
safeFromPartsAsync<
|
|
5764
|
-
OverrideId extends RecordIdValue = core.output<Id>,
|
|
5765
|
-
>(
|
|
5766
|
-
table: NoInfer<Tb>,
|
|
5767
|
-
id: NoInfer<OverrideId>,
|
|
5768
|
-
params?: ParseDbContext,
|
|
5769
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>>;
|
|
5770
|
-
|
|
5771
|
-
// From Id - Split Parameters
|
|
5772
|
-
fromId<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5773
|
-
id: NoInfer<OverrideId>,
|
|
5774
|
-
params?: ParseDbContext,
|
|
5775
|
-
): RecordId<Tb, OverrideId>;
|
|
5776
|
-
fromIdAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5777
|
-
id: NoInfer<OverrideId>,
|
|
5778
|
-
params?: ParseDbContext,
|
|
5779
|
-
): Promise<RecordId<Tb, OverrideId>>;
|
|
5780
|
-
safeFromId<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5781
|
-
id: NoInfer<OverrideId>,
|
|
5782
|
-
params?: ParseDbContext,
|
|
5783
|
-
): classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>;
|
|
5784
|
-
safeFromIdAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
5785
|
-
id: NoInfer<OverrideId>,
|
|
5786
|
-
params?: ParseDbContext,
|
|
5787
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>>;
|
|
5788
|
-
|
|
5789
|
-
// Clone - Single Parameter
|
|
5790
|
-
parse<
|
|
5791
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5792
|
-
Tb,
|
|
5793
|
-
core.output<Id>
|
|
5794
|
-
>,
|
|
5795
|
-
>(
|
|
5796
|
-
data: unknown,
|
|
5797
|
-
params?: ParseDbContext,
|
|
5798
|
-
): RecordId<Tb, Override["id"]>;
|
|
5799
|
-
parseAsync<
|
|
5800
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5801
|
-
Tb,
|
|
5802
|
-
core.output<Id>
|
|
5803
|
-
>,
|
|
5804
|
-
>(
|
|
5805
|
-
data: unknown,
|
|
5806
|
-
params?: ParseDbContext,
|
|
5807
|
-
): Promise<RecordId<Tb, Override["id"]>>;
|
|
5808
|
-
safeParse<
|
|
5809
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5810
|
-
Tb,
|
|
5811
|
-
core.output<Id>
|
|
5812
|
-
>,
|
|
5813
|
-
>(
|
|
5814
|
-
data: unknown,
|
|
5815
|
-
params?: ParseDbContext,
|
|
5816
|
-
): classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>;
|
|
5817
|
-
safeParseAsync<
|
|
5818
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5819
|
-
Tb,
|
|
5820
|
-
core.output<Id>
|
|
5821
|
-
>,
|
|
5822
|
-
>(
|
|
5823
|
-
data: unknown,
|
|
5824
|
-
params?: ParseDbContext,
|
|
5825
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>>;
|
|
5826
|
-
decode<
|
|
5827
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5828
|
-
Tb,
|
|
5829
|
-
core.output<Id>
|
|
5830
|
-
>,
|
|
5831
|
-
>(
|
|
5832
|
-
data: RecordId<Tb, Override["id"]> | StringRecordId,
|
|
5833
|
-
params?: ParseDbContext,
|
|
5834
|
-
): RecordId<Tb, Override["id"]>;
|
|
5835
|
-
decodeAsync<
|
|
5836
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5837
|
-
Tb,
|
|
5838
|
-
core.output<Id>
|
|
5839
|
-
>,
|
|
5840
|
-
>(
|
|
5841
|
-
data: RecordId<Tb, Override["id"]> | StringRecordId,
|
|
5842
|
-
params?: ParseDbContext,
|
|
5843
|
-
): Promise<RecordId<Tb, Override["id"]>>;
|
|
5844
|
-
safeDecode<
|
|
5845
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5846
|
-
Tb,
|
|
5847
|
-
core.output<Id>
|
|
5848
|
-
>,
|
|
5849
|
-
>(
|
|
5850
|
-
data: RecordId<Tb, Override["id"]> | StringRecordId,
|
|
5851
|
-
params?: ParseDbContext,
|
|
5852
|
-
): classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>;
|
|
5853
|
-
safeDecodeAsync<
|
|
5854
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5855
|
-
Tb,
|
|
5856
|
-
core.output<Id>
|
|
5857
|
-
>,
|
|
5858
|
-
>(
|
|
5859
|
-
data: RecordId<Tb, Override["id"]> | StringRecordId,
|
|
5860
|
-
params?: ParseDbContext,
|
|
5861
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>>;
|
|
5862
|
-
|
|
5863
|
-
// From Parts - Single Parameter
|
|
5864
|
-
fromParts<
|
|
5865
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5866
|
-
Tb,
|
|
5867
|
-
core.output<Id>
|
|
5868
|
-
>,
|
|
5869
|
-
>(
|
|
5870
|
-
table: NoInfer<Tb>,
|
|
5871
|
-
id: NoInfer<Override["id"]>,
|
|
5872
|
-
params?: ParseDbContext,
|
|
5873
|
-
): RecordId<Tb, Override["id"]>;
|
|
5874
|
-
fromPartsAsync<
|
|
5875
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5876
|
-
Tb,
|
|
5877
|
-
core.output<Id>
|
|
5878
|
-
>,
|
|
5879
|
-
>(
|
|
5880
|
-
table: NoInfer<Tb>,
|
|
5881
|
-
id: NoInfer<Override["id"]>,
|
|
5882
|
-
params?: ParseDbContext,
|
|
5883
|
-
): Promise<RecordId<Tb, Override["id"]>>;
|
|
5884
|
-
safeFromParts<
|
|
5885
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5886
|
-
Tb,
|
|
5887
|
-
core.output<Id>
|
|
5888
|
-
>,
|
|
5889
|
-
>(
|
|
5890
|
-
table: NoInfer<Tb>,
|
|
5891
|
-
id: NoInfer<Override["id"]>,
|
|
5892
|
-
params?: ParseDbContext,
|
|
5893
|
-
): classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>;
|
|
5894
|
-
safeFromPartsAsync<
|
|
5895
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5896
|
-
Tb,
|
|
5897
|
-
core.output<Id>
|
|
5898
|
-
>,
|
|
5899
|
-
>(
|
|
5900
|
-
table: NoInfer<Tb>,
|
|
5901
|
-
id: NoInfer<Override["id"]>,
|
|
5902
|
-
params?: ParseDbContext,
|
|
5903
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>>;
|
|
5904
|
-
|
|
5905
|
-
// From Id - Single Parameter
|
|
5906
|
-
fromId<
|
|
5907
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5908
|
-
Tb,
|
|
5909
|
-
core.output<Id>
|
|
5910
|
-
>,
|
|
5911
|
-
>(
|
|
5912
|
-
id: NoInfer<Override["id"]>,
|
|
5913
|
-
params?: ParseDbContext,
|
|
5914
|
-
): RecordId<Tb, Override["id"]>;
|
|
5915
|
-
fromIdAsync<
|
|
5916
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5917
|
-
Tb,
|
|
5918
|
-
core.output<Id>
|
|
5919
|
-
>,
|
|
5920
|
-
>(
|
|
5921
|
-
id: NoInfer<Override["id"]>,
|
|
5922
|
-
params?: ParseDbContext,
|
|
5923
|
-
): Promise<RecordId<Tb, Override["id"]>>;
|
|
5924
|
-
safeFromId<
|
|
5925
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5926
|
-
Tb,
|
|
5927
|
-
core.output<Id>
|
|
5928
|
-
>,
|
|
5929
|
-
>(
|
|
5930
|
-
id: NoInfer<Override["id"]>,
|
|
5931
|
-
params?: ParseDbContext,
|
|
5932
|
-
): classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>;
|
|
5933
|
-
safeFromIdAsync<
|
|
5934
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5935
|
-
Tb,
|
|
5936
|
-
core.output<Id>
|
|
5937
|
-
>,
|
|
5938
|
-
>(
|
|
5939
|
-
id: NoInfer<Override["id"]>,
|
|
5940
|
-
params?: ParseDbContext,
|
|
5941
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>>;
|
|
5942
|
-
}
|
|
5943
|
-
: // Specific Table + Typed Value
|
|
5944
|
-
{
|
|
5945
|
-
// Clone - Non Overridable
|
|
5946
|
-
parse(
|
|
5947
|
-
data: unknown,
|
|
5948
|
-
params?: ParseDbContext,
|
|
5949
|
-
): RecordId<Tb, core.output<Id>>;
|
|
5950
|
-
parseAsync(
|
|
5951
|
-
data: unknown,
|
|
5952
|
-
params?: ParseDbContext,
|
|
5953
|
-
): Promise<RecordId<Tb, core.output<Id>>>;
|
|
5954
|
-
safeParse(
|
|
5955
|
-
data: unknown,
|
|
5956
|
-
params?: ParseDbContext,
|
|
5957
|
-
): classic.ZodSafeParseResult<RecordId<Tb, core.output<Id>>>;
|
|
5958
|
-
safeParseAsync(
|
|
5959
|
-
data: unknown,
|
|
5960
|
-
params?: ParseDbContext,
|
|
5961
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, core.output<Id>>>>;
|
|
5962
|
-
decode(
|
|
5963
|
-
data: RecordId<Tb, core.output<Id>> | StringRecordId,
|
|
5964
|
-
params?: ParseDbContext,
|
|
5965
|
-
): RecordId<Tb, core.output<Id>>;
|
|
5966
|
-
decodeAsync(
|
|
5967
|
-
data: RecordId<Tb, core.output<Id>> | StringRecordId,
|
|
5968
|
-
params?: ParseDbContext,
|
|
5969
|
-
): Promise<RecordId<Tb, core.output<Id>>>;
|
|
5970
|
-
safeDecode(
|
|
5971
|
-
data: RecordId<Tb, core.output<Id>> | StringRecordId,
|
|
5972
|
-
params?: ParseDbContext,
|
|
5973
|
-
): classic.ZodSafeParseResult<RecordId<Tb, core.output<Id>>>;
|
|
5974
|
-
safeDecodeAsync(
|
|
5975
|
-
data: RecordId<Tb, core.output<Id>> | StringRecordId,
|
|
5976
|
-
params?: ParseDbContext,
|
|
5977
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, core.output<Id>>>>;
|
|
5978
|
-
|
|
5979
|
-
// From Parts - Non Overridable
|
|
5980
|
-
fromParts(
|
|
5981
|
-
table: NoInfer<Tb>,
|
|
5982
|
-
id: NoInfer<core.output<Id>>,
|
|
5983
|
-
params?: ParseDbContext,
|
|
5984
|
-
): RecordId<Tb, core.output<Id>>;
|
|
5985
|
-
fromPartsAsync(
|
|
5986
|
-
table: NoInfer<Tb>,
|
|
5987
|
-
id: NoInfer<core.output<Id>>,
|
|
5988
|
-
params?: ParseDbContext,
|
|
5989
|
-
): Promise<RecordId<Tb, core.output<Id>>>;
|
|
5990
|
-
safeFromParts(
|
|
5991
|
-
table: NoInfer<Tb>,
|
|
5992
|
-
id: NoInfer<core.output<Id>>,
|
|
5993
|
-
params?: ParseDbContext,
|
|
5994
|
-
): classic.ZodSafeParseResult<RecordId<Tb, core.output<Id>>>;
|
|
5995
|
-
safeFromPartsAsync(
|
|
5996
|
-
table: NoInfer<Tb>,
|
|
5997
|
-
id: NoInfer<core.output<Id>>,
|
|
5998
|
-
params?: ParseDbContext,
|
|
5999
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, core.output<Id>>>>;
|
|
6000
|
-
|
|
6001
|
-
// From Id - Non Overridable
|
|
6002
|
-
fromId(
|
|
6003
|
-
id: NoInfer<core.output<Id>>,
|
|
6004
|
-
params?: ParseDbContext,
|
|
6005
|
-
): RecordId<Tb, core.output<Id>>;
|
|
6006
|
-
fromIdAsync(
|
|
6007
|
-
id: NoInfer<core.output<Id>>,
|
|
6008
|
-
params?: ParseDbContext,
|
|
6009
|
-
): Promise<RecordId<Tb, core.output<Id>>>;
|
|
6010
|
-
safeFromId(
|
|
6011
|
-
id: NoInfer<core.output<Id>>,
|
|
6012
|
-
params?: ParseDbContext,
|
|
6013
|
-
): classic.ZodSafeParseResult<RecordId<Tb, core.output<Id>>>;
|
|
6014
|
-
safeFromIdAsync(
|
|
6015
|
-
id: NoInfer<core.output<Id>>,
|
|
6016
|
-
params?: ParseDbContext,
|
|
6017
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, core.output<Id>>>>;
|
|
6018
|
-
}
|
|
6019
|
-
: // Multiple Tables:
|
|
6020
|
-
ZodSurrealRecordIdValue extends Id
|
|
6021
|
-
? // Multiple Tables + Any Value:
|
|
6022
|
-
{
|
|
6023
|
-
// Clone - Split Parameters
|
|
6024
|
-
parse<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6025
|
-
data: unknown,
|
|
6026
|
-
params?: ParseDbContext,
|
|
6027
|
-
): RecordId<Tb, OverrideId>;
|
|
6028
|
-
parseAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6029
|
-
data: unknown,
|
|
6030
|
-
params?: ParseDbContext,
|
|
6031
|
-
): Promise<RecordId<Tb, OverrideId>>;
|
|
6032
|
-
safeParse<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6033
|
-
data: unknown,
|
|
6034
|
-
params?: ParseDbContext,
|
|
6035
|
-
): classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>;
|
|
6036
|
-
safeParseAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6037
|
-
data: unknown,
|
|
6038
|
-
params?: ParseDbContext,
|
|
6039
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>>;
|
|
6040
|
-
decode<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6041
|
-
data: RecordId<Tb, NoInfer<OverrideId>> | StringRecordId,
|
|
6042
|
-
params?: ParseDbContext,
|
|
6043
|
-
): RecordId<Tb, OverrideId>;
|
|
6044
|
-
decodeAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6045
|
-
data: RecordId<Tb, NoInfer<OverrideId>> | StringRecordId,
|
|
6046
|
-
params?: ParseDbContext,
|
|
6047
|
-
): Promise<RecordId<Tb, OverrideId>>;
|
|
6048
|
-
safeDecode<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6049
|
-
data: RecordId<Tb, NoInfer<OverrideId>> | StringRecordId,
|
|
6050
|
-
params?: ParseDbContext,
|
|
6051
|
-
): classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>;
|
|
6052
|
-
safeDecodeAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6053
|
-
data: RecordId<Tb, NoInfer<OverrideId>> | StringRecordId,
|
|
6054
|
-
params?: ParseDbContext,
|
|
6055
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>>;
|
|
6056
|
-
|
|
6057
|
-
// From Parts - Split Parameters
|
|
6058
|
-
fromParts<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6059
|
-
table: NoInfer<Tb>,
|
|
6060
|
-
id: NoInfer<OverrideId>,
|
|
6061
|
-
params?: ParseDbContext,
|
|
6062
|
-
): RecordId<Tb, OverrideId>;
|
|
6063
|
-
fromPartsAsync<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6064
|
-
table: NoInfer<Tb>,
|
|
6065
|
-
id: NoInfer<OverrideId>,
|
|
6066
|
-
params?: ParseDbContext,
|
|
6067
|
-
): Promise<RecordId<Tb, OverrideId>>;
|
|
6068
|
-
safeFromParts<OverrideId extends RecordIdValue = core.output<Id>>(
|
|
6069
|
-
table: NoInfer<Tb>,
|
|
6070
|
-
id: NoInfer<OverrideId>,
|
|
6071
|
-
params?: ParseDbContext,
|
|
6072
|
-
): classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>;
|
|
6073
|
-
safeFromPartsAsync<
|
|
6074
|
-
OverrideId extends RecordIdValue = core.output<Id>,
|
|
6075
|
-
>(
|
|
6076
|
-
table: NoInfer<Tb>,
|
|
6077
|
-
id: NoInfer<OverrideId>,
|
|
6078
|
-
params?: ParseDbContext,
|
|
6079
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, OverrideId>>>;
|
|
6080
|
-
|
|
6081
|
-
// Clone - Single Parameter
|
|
6082
|
-
parse<
|
|
6083
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6084
|
-
Tb,
|
|
6085
|
-
core.output<Id>
|
|
6086
|
-
>,
|
|
6087
|
-
>(
|
|
6088
|
-
data: unknown,
|
|
6089
|
-
params?: ParseDbContext,
|
|
6090
|
-
): RecordId<Tb, Override["id"]>;
|
|
6091
|
-
parseAsync<
|
|
6092
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6093
|
-
Tb,
|
|
6094
|
-
core.output<Id>
|
|
6095
|
-
>,
|
|
6096
|
-
>(
|
|
6097
|
-
data: unknown,
|
|
6098
|
-
params?: ParseDbContext,
|
|
6099
|
-
): Promise<RecordId<Tb, Override["id"]>>;
|
|
6100
|
-
safeParse<
|
|
6101
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6102
|
-
Tb,
|
|
6103
|
-
core.output<Id>
|
|
6104
|
-
>,
|
|
6105
|
-
>(
|
|
6106
|
-
data: unknown,
|
|
6107
|
-
params?: ParseDbContext,
|
|
6108
|
-
): classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>;
|
|
6109
|
-
safeParseAsync<
|
|
6110
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6111
|
-
Tb,
|
|
6112
|
-
core.output<Id>
|
|
6113
|
-
>,
|
|
6114
|
-
>(
|
|
6115
|
-
data: unknown,
|
|
6116
|
-
params?: ParseDbContext,
|
|
6117
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>>;
|
|
6118
|
-
decode<
|
|
6119
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6120
|
-
Tb,
|
|
6121
|
-
core.output<Id>
|
|
6122
|
-
>,
|
|
6123
|
-
>(
|
|
6124
|
-
data: RecordId<Tb, Override["id"]> | StringRecordId,
|
|
6125
|
-
params?: ParseDbContext,
|
|
6126
|
-
): RecordId<Tb, Override["id"]>;
|
|
6127
|
-
decodeAsync<
|
|
6128
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6129
|
-
Tb,
|
|
6130
|
-
core.output<Id>
|
|
6131
|
-
>,
|
|
6132
|
-
>(
|
|
6133
|
-
data: RecordId<Tb, Override["id"]> | StringRecordId,
|
|
6134
|
-
params?: ParseDbContext,
|
|
6135
|
-
): Promise<RecordId<Tb, Override["id"]>>;
|
|
6136
|
-
safeDecode<
|
|
6137
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6138
|
-
Tb,
|
|
6139
|
-
core.output<Id>
|
|
6140
|
-
>,
|
|
6141
|
-
>(
|
|
6142
|
-
data: RecordId<Tb, Override["id"]> | StringRecordId,
|
|
6143
|
-
params?: ParseDbContext,
|
|
6144
|
-
): classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>;
|
|
6145
|
-
safeDecodeAsync<
|
|
6146
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6147
|
-
Tb,
|
|
6148
|
-
core.output<Id>
|
|
6149
|
-
>,
|
|
6150
|
-
>(
|
|
6151
|
-
data: RecordId<Tb, Override["id"]> | StringRecordId,
|
|
6152
|
-
params?: ParseDbContext,
|
|
6153
|
-
): Promise<classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>>;
|
|
6154
|
-
|
|
6155
|
-
// From Parts - Single Parameter
|
|
6156
|
-
fromParts<
|
|
6157
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6158
|
-
Tb,
|
|
6159
|
-
core.output<Id>
|
|
6160
|
-
>,
|
|
6161
|
-
>(
|
|
6162
|
-
table: NoInfer<Tb>,
|
|
6163
|
-
id: NoInfer<Override["id"]>,
|
|
6164
|
-
params?: ParseDbContext,
|
|
6165
|
-
): RecordId<Tb, Override["id"]>;
|
|
6166
|
-
fromPartsAsync<
|
|
6167
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6168
|
-
Tb,
|
|
6169
|
-
core.output<Id>
|
|
6170
|
-
>,
|
|
6171
|
-
>(
|
|
6172
|
-
table: NoInfer<Tb>,
|
|
6173
|
-
id: NoInfer<Override["id"]>,
|
|
6174
|
-
params?: ParseDbContext,
|
|
6175
|
-
): Promise<RecordId<Tb, Override["id"]>>;
|
|
6176
|
-
safeFromParts<
|
|
6177
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
6178
|
-
Tb,
|
|
6179
|
-
core.output<Id>
|
|
6180
|
-
>,
|
|
6181
|
-
>(
|
|
6182
|
-
table: NoInfer<Tb>,
|
|
6183
|
-
id: NoInfer<Override["id"]>,
|
|
6184
|
-
params?: ParseDbContext,
|
|
6185
|
-
): classic.ZodSafeParseResult<RecordId<Tb, Override["id"]>>;
|
|
6186
|
-
safeFromPartsAsync<
|
|
6187
|
-
Override extends RecordId<string, RecordIdValue> = RecordId<
|
|
5641
|
+
| undefined
|
|
5642
|
+
>
|
|
5643
|
+
: classic.ZodSafeParseResult<
|
|
5644
|
+
RecordId<
|
|
5645
|
+
Tb,
|
|
5646
|
+
Ctx extends { db: any }
|
|
5647
|
+
? _core_.dboutput<Id>
|
|
5648
|
+
: Exclude<core.output<Id>, undefined>
|
|
5649
|
+
>
|
|
5650
|
+
>;
|
|
5651
|
+
safeFromPartsAsync<Ctx extends ParseDbContext>(
|
|
5652
|
+
table: Tb,
|
|
5653
|
+
id: Ctx extends { db: any }
|
|
5654
|
+
? core.output<Id>
|
|
5655
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5656
|
+
params?: Ctx,
|
|
5657
|
+
): undefined extends core.output<Id>
|
|
5658
|
+
? Promise<
|
|
5659
|
+
classic.ZodSafeParseResult<
|
|
5660
|
+
| RecordId<
|
|
6188
5661
|
Tb,
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
}
|
|
5662
|
+
// @ts-expect-error: output intersected above
|
|
5663
|
+
Ctx extends { db: any }
|
|
5664
|
+
? _core_.dboutput<Id>
|
|
5665
|
+
: Exclude<core.output<Id>, undefined>
|
|
5666
|
+
>
|
|
5667
|
+
| undefined
|
|
5668
|
+
>
|
|
5669
|
+
>
|
|
5670
|
+
: Promise<
|
|
5671
|
+
classic.ZodSafeParseResult<
|
|
5672
|
+
RecordId<
|
|
5673
|
+
Tb,
|
|
5674
|
+
Ctx extends { db: any }
|
|
5675
|
+
? _core_.dboutput<Id>
|
|
5676
|
+
: Exclude<core.output<Id>, undefined>
|
|
5677
|
+
>
|
|
5678
|
+
>
|
|
5679
|
+
>;
|
|
5680
|
+
|
|
5681
|
+
fromId<Ctx extends ParseDbContext>(
|
|
5682
|
+
id: Ctx extends { db: any }
|
|
5683
|
+
? core.output<Id>
|
|
5684
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5685
|
+
params?: Ctx,
|
|
5686
|
+
): RecordId<
|
|
5687
|
+
Tb,
|
|
5688
|
+
Ctx extends { db: any }
|
|
5689
|
+
? _core_.dboutput<Id>
|
|
5690
|
+
: Exclude<core.output<Id>, undefined>
|
|
5691
|
+
>;
|
|
5692
|
+
fromIdAsync<Ctx extends ParseDbContext>(
|
|
5693
|
+
id: Ctx extends { db: any }
|
|
5694
|
+
? core.output<Id>
|
|
5695
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5696
|
+
params?: Ctx,
|
|
5697
|
+
): Promise<
|
|
5698
|
+
RecordId<
|
|
5699
|
+
Tb,
|
|
5700
|
+
Ctx extends { db: any }
|
|
5701
|
+
? _core_.dboutput<Id>
|
|
5702
|
+
: Exclude<core.output<Id>, undefined>
|
|
5703
|
+
>
|
|
5704
|
+
>;
|
|
5705
|
+
safeFromId<Ctx extends ParseDbContext>(
|
|
5706
|
+
id: Ctx extends { db: any }
|
|
5707
|
+
? core.output<Id>
|
|
5708
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5709
|
+
params?: Ctx,
|
|
5710
|
+
): classic.ZodSafeParseResult<
|
|
5711
|
+
RecordId<
|
|
5712
|
+
Tb,
|
|
5713
|
+
Ctx extends { db: any }
|
|
5714
|
+
? _core_.dboutput<Id>
|
|
5715
|
+
: Exclude<core.output<Id>, undefined>
|
|
5716
|
+
>
|
|
5717
|
+
>;
|
|
5718
|
+
safeFromIdAsync<Ctx extends ParseDbContext>(
|
|
5719
|
+
id: Ctx extends { db: any }
|
|
5720
|
+
? core.output<Id>
|
|
5721
|
+
: Exclude<core.output<Id>, undefined>,
|
|
5722
|
+
params?: Ctx,
|
|
5723
|
+
): Promise<
|
|
5724
|
+
classic.ZodSafeParseResult<
|
|
5725
|
+
RecordId<
|
|
5726
|
+
Tb,
|
|
5727
|
+
Ctx extends { db: any }
|
|
5728
|
+
? _core_.dboutput<Id>
|
|
5729
|
+
: Exclude<core.output<Id>, undefined>
|
|
5730
|
+
>
|
|
5731
|
+
>
|
|
5732
|
+
>;
|
|
5733
|
+
};
|
|
5734
|
+
|
|
5735
|
+
type ZodSurrealRecordIdTrait<
|
|
5736
|
+
Tb extends string,
|
|
5737
|
+
Id extends ZodSurrealRecordIdValue,
|
|
5738
|
+
Extras extends ZodSurrealRecordIdExtras = {},
|
|
5739
|
+
> = string extends Tb
|
|
5740
|
+
? AnyTableRecordIdTrait<Tb, Id>
|
|
5741
|
+
: UnionToTuple<Tb> extends { length: 1 }
|
|
5742
|
+
? SpecificTableRecordIdTrait<Tb, Id>
|
|
5743
|
+
: AnyTableRecordIdTrait<Tb, Id>;
|
|
6255
5744
|
|
|
6256
5745
|
export type ZodSurrealdRecordId<
|
|
6257
5746
|
Table extends string = string,
|
|
@@ -6265,7 +5754,8 @@ export type ZodSurrealdRecordId<
|
|
|
6265
5754
|
| "nullish"
|
|
6266
5755
|
| "nonoptional"
|
|
6267
5756
|
> &
|
|
6268
|
-
ZodSurrealRecordIdTrait<Table, Id, Extras> &
|
|
5757
|
+
ZodSurrealRecordIdTrait<Table, Id, Extras> &
|
|
5758
|
+
ZodSurrealFieldMethods & {
|
|
6269
5759
|
anytable(): ZodSurrealdRecordId<string, Id, Extras>;
|
|
6270
5760
|
|
|
6271
5761
|
table<const NewTable extends string | string[]>(
|
|
@@ -6506,60 +5996,177 @@ export const ZodSurrealdRecordId: core.$constructor<ZodSurrealdRecordId> =
|
|
|
6506
5996
|
inst.value = inst.type;
|
|
6507
5997
|
|
|
6508
5998
|
// ------- Parsing/Encoding/Decoding -------
|
|
6509
|
-
|
|
6510
|
-
_inst.fromParts = (
|
|
5999
|
+
inst.fromParts = (
|
|
6511
6000
|
table: string,
|
|
6512
6001
|
id: RecordIdValue,
|
|
6513
|
-
params?:
|
|
6514
|
-
) =>
|
|
6002
|
+
params?: ParseDbContext,
|
|
6003
|
+
) => {
|
|
6004
|
+
const inner = def.innerType as core.$ZodType;
|
|
6005
|
+
if (id === undefined) {
|
|
6006
|
+
const res = core.safeDecode(inner, id, params);
|
|
6007
|
+
if (res.error) {
|
|
6008
|
+
for (const issue of res.error.issues) {
|
|
6009
|
+
issue.path.unshift("id");
|
|
6010
|
+
}
|
|
6011
|
+
throw res.error;
|
|
6012
|
+
}
|
|
6013
|
+
id = res.data as RecordIdValue;
|
|
6014
|
+
if (id === undefined) {
|
|
6015
|
+
return undefined;
|
|
6016
|
+
}
|
|
6017
|
+
}
|
|
6018
|
+
return inst.decode(new RecordId(table, id), params);
|
|
6019
|
+
};
|
|
6515
6020
|
|
|
6516
|
-
|
|
6021
|
+
inst.fromPartsAsync = async (
|
|
6517
6022
|
table: string,
|
|
6518
6023
|
id: RecordIdValue,
|
|
6519
6024
|
params?: core.ParseContext<core.$ZodIssue>,
|
|
6520
|
-
) =>
|
|
6025
|
+
) => {
|
|
6026
|
+
const inner = def.innerType as core.$ZodType;
|
|
6027
|
+
if (id === undefined) {
|
|
6028
|
+
const res = await core.safeDecodeAsync(inner, id, params);
|
|
6029
|
+
if (res.error) {
|
|
6030
|
+
for (const issue of res.error.issues) {
|
|
6031
|
+
issue.path.unshift("id");
|
|
6032
|
+
}
|
|
6033
|
+
throw res.error;
|
|
6034
|
+
}
|
|
6035
|
+
id = res.data as RecordIdValue;
|
|
6036
|
+
}
|
|
6521
6037
|
|
|
6522
|
-
|
|
6038
|
+
return inst.decodeAsync(new RecordId(table, id), params);
|
|
6039
|
+
};
|
|
6040
|
+
|
|
6041
|
+
inst.safeFromParts = (
|
|
6523
6042
|
table: string,
|
|
6524
6043
|
id: RecordIdValue,
|
|
6525
6044
|
params?: core.ParseContext<core.$ZodIssue>,
|
|
6526
|
-
) =>
|
|
6045
|
+
) => {
|
|
6046
|
+
const inner = def.innerType as core.$ZodType;
|
|
6047
|
+
if (id === undefined) {
|
|
6048
|
+
const res = core.safeDecode(inner, id, params);
|
|
6049
|
+
if (res.error) {
|
|
6050
|
+
for (const issue of res.error.issues) {
|
|
6051
|
+
issue.path.unshift("id");
|
|
6052
|
+
}
|
|
6053
|
+
throw res.error;
|
|
6054
|
+
}
|
|
6055
|
+
id = res.data as RecordIdValue;
|
|
6056
|
+
}
|
|
6527
6057
|
|
|
6528
|
-
|
|
6058
|
+
return inst.safeDecode(new RecordId(table, id), params);
|
|
6059
|
+
};
|
|
6060
|
+
|
|
6061
|
+
inst.safeFromPartsAsync = async (
|
|
6529
6062
|
table: string,
|
|
6530
6063
|
id: RecordIdValue,
|
|
6531
6064
|
params?: core.ParseContext<core.$ZodIssue>,
|
|
6532
|
-
) =>
|
|
6065
|
+
) => {
|
|
6066
|
+
const inner = def.innerType as core.$ZodType;
|
|
6067
|
+
if (id === undefined) {
|
|
6068
|
+
const res = await core.safeDecodeAsync(inner, id, params);
|
|
6069
|
+
if (res.error) {
|
|
6070
|
+
for (const issue of res.error.issues) {
|
|
6071
|
+
issue.path.unshift("id");
|
|
6072
|
+
}
|
|
6073
|
+
throw res.error;
|
|
6074
|
+
}
|
|
6075
|
+
id = res.data as RecordIdValue;
|
|
6076
|
+
}
|
|
6077
|
+
|
|
6078
|
+
return inst.safeDecodeAsync(new RecordId(table, id), params);
|
|
6079
|
+
};
|
|
6533
6080
|
|
|
6534
6081
|
if (normalized.table?.length === 1) {
|
|
6082
|
+
const _inst = inst as any;
|
|
6535
6083
|
_inst.fromId = (
|
|
6536
6084
|
id: RecordIdValue,
|
|
6537
6085
|
params?: core.ParseContext<core.$ZodIssue>,
|
|
6538
|
-
) =>
|
|
6086
|
+
) => {
|
|
6087
|
+
const inner = def.innerType as core.$ZodType;
|
|
6088
|
+
if (id === undefined) {
|
|
6089
|
+
const res = core.safeDecode(inner, id, params);
|
|
6090
|
+
if (res.error) {
|
|
6091
|
+
for (const issue of res.error.issues) {
|
|
6092
|
+
issue.path.unshift("id");
|
|
6093
|
+
}
|
|
6094
|
+
throw res.error;
|
|
6095
|
+
}
|
|
6096
|
+
id = res.data as RecordIdValue;
|
|
6097
|
+
}
|
|
6098
|
+
|
|
6099
|
+
return _inst.decode(
|
|
6100
|
+
new RecordId(normalized.table?.[0] ?? "", id),
|
|
6101
|
+
params,
|
|
6102
|
+
);
|
|
6103
|
+
};
|
|
6539
6104
|
|
|
6540
|
-
_inst.fromIdAsync = (
|
|
6105
|
+
_inst.fromIdAsync = async (
|
|
6541
6106
|
id: RecordIdValue,
|
|
6542
6107
|
params?: core.ParseContext<core.$ZodIssue>,
|
|
6543
|
-
) =>
|
|
6544
|
-
|
|
6108
|
+
) => {
|
|
6109
|
+
const inner = def.innerType as core.$ZodType;
|
|
6110
|
+
if (id === undefined) {
|
|
6111
|
+
const res = await core.safeDecodeAsync(inner, id, params);
|
|
6112
|
+
if (res.error) {
|
|
6113
|
+
for (const issue of res.error.issues) {
|
|
6114
|
+
issue.path.unshift("id");
|
|
6115
|
+
}
|
|
6116
|
+
throw res.error;
|
|
6117
|
+
}
|
|
6118
|
+
id = res.data as RecordIdValue;
|
|
6119
|
+
}
|
|
6120
|
+
|
|
6121
|
+
return _inst.decodeAsync(
|
|
6545
6122
|
new RecordId(normalized.table?.[0] ?? "", id),
|
|
6546
6123
|
params,
|
|
6547
6124
|
);
|
|
6125
|
+
};
|
|
6548
6126
|
|
|
6549
6127
|
_inst.safeFromId = (
|
|
6550
6128
|
id: RecordIdValue,
|
|
6551
6129
|
params?: core.ParseContext<core.$ZodIssue>,
|
|
6552
|
-
) =>
|
|
6553
|
-
|
|
6130
|
+
) => {
|
|
6131
|
+
const inner = def.innerType as core.$ZodType;
|
|
6132
|
+
if (id === undefined) {
|
|
6133
|
+
const res = core.safeDecode(inner, id, params);
|
|
6134
|
+
if (res.error) {
|
|
6135
|
+
for (const issue of res.error.issues) {
|
|
6136
|
+
issue.path.unshift("id");
|
|
6137
|
+
}
|
|
6138
|
+
throw res.error;
|
|
6139
|
+
}
|
|
6140
|
+
id = res.data as RecordIdValue;
|
|
6141
|
+
}
|
|
6142
|
+
|
|
6143
|
+
return _inst.safeDecode(
|
|
6144
|
+
new RecordId(normalized.table?.[0] ?? "", id),
|
|
6145
|
+
params,
|
|
6146
|
+
);
|
|
6147
|
+
};
|
|
6554
6148
|
|
|
6555
|
-
_inst.safeFromIdAsync = (
|
|
6149
|
+
_inst.safeFromIdAsync = async (
|
|
6556
6150
|
id: RecordIdValue,
|
|
6557
6151
|
params?: core.ParseContext<core.$ZodIssue>,
|
|
6558
|
-
) =>
|
|
6559
|
-
|
|
6152
|
+
) => {
|
|
6153
|
+
const inner = def.innerType as core.$ZodType;
|
|
6154
|
+
if (id === undefined) {
|
|
6155
|
+
const res = await core.safeDecodeAsync(inner, id, params);
|
|
6156
|
+
if (res.error) {
|
|
6157
|
+
for (const issue of res.error.issues) {
|
|
6158
|
+
issue.path.unshift("id");
|
|
6159
|
+
}
|
|
6160
|
+
throw res.error;
|
|
6161
|
+
}
|
|
6162
|
+
id = res.data as RecordIdValue;
|
|
6163
|
+
}
|
|
6164
|
+
|
|
6165
|
+
return _inst.safeDecodeAsync(
|
|
6560
6166
|
new RecordId(normalized.table?.[0] ?? "", id),
|
|
6561
6167
|
params,
|
|
6562
6168
|
);
|
|
6169
|
+
};
|
|
6563
6170
|
}
|
|
6564
6171
|
|
|
6565
6172
|
inst._zod.parse = (payload, ctx) => {
|