@nxtedition/types 23.0.43 → 23.0.45
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/dist/records/utils.d.ts +5 -1
- package/dist/records/utils.tds.js +2 -0
- package/dist/records/validate/assert-guard.js +8 -5
- package/dist/records/validate/assert.js +8 -5
- package/dist/records/validate/is.js +6 -3
- package/dist/records/validate/schemas.js +8 -8
- package/dist/records/validate/stringify.js +6 -3
- package/dist/records/validate/utils.d.ts +2 -0
- package/dist/records/validate/utils.js +3 -0
- package/dist/records/validate/validate-equals.js +11 -5
- package/dist/records/validate/validate.js +11 -5
- package/package.json +1 -1
package/dist/records/utils.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { EmptyObject, SingleKeyObject } from 'type-fest';
|
|
1
2
|
import type { DomainRecords, DomainRows, ExactRecords } from './index.ts';
|
|
2
|
-
export type RecordNameToType<T extends string> = T extends keyof ExactRecords ? ExactRecords[T] : T extends `:${string}` ? DomainRows : T extends `${string}:${infer Domain}?${string}` ? `:${Domain}?` extends keyof DomainRecords ? DomainRecords[`:${Domain}?`] : unknown : T extends `${string}:${infer Pattern}` ? `:${Pattern}` extends keyof DomainRecords ? DomainRecords[`:${Pattern}`] : unknown : unknown;
|
|
3
|
+
export type RecordNameToType<T extends string> = T extends keyof ExactRecords ? GettablePossibleEmpty<ExactRecords[T]> : T extends `:${string}` ? GettablePossibleEmpty<DomainRows> : T extends `${string}:${infer Domain}?${string}` ? `:${Domain}?` extends keyof DomainRecords ? GettablePossibleEmpty<DomainRecords[`:${Domain}?`]> : unknown : T extends `${string}:${infer Pattern}` ? `:${Pattern}` extends keyof DomainRecords ? GettablePossibleEmpty<DomainRecords[`:${Pattern}`]> : unknown : unknown;
|
|
3
4
|
declare const providedRecordSymbol: unique symbol;
|
|
4
5
|
export type ProvidedRecord<T> = T & {
|
|
5
6
|
[providedRecordSymbol]: never;
|
|
6
7
|
};
|
|
8
|
+
export type GettablePossibleEmpty<Data> = keyof Data extends never ? EmptyObject : Partial<Data> extends Data ? Data : SingleKeyObject<Data> extends never ? Data | EmptyObject : {
|
|
9
|
+
[K in keyof Data]+?: Data[K];
|
|
10
|
+
};
|
|
7
11
|
export {};
|
|
@@ -5,3 +5,5 @@ expectType(getType(":user"));
|
|
|
5
5
|
expectType(getType("id:user.receivedNotifications?"));
|
|
6
6
|
expectType(getType("id:user.receivedNotifications?limit=2"));
|
|
7
7
|
expectType(getType("{}:search?"));
|
|
8
|
+
expectType(getType("id:general.title"));
|
|
9
|
+
expectType(getType("id:file.replicate"));
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as __typia_transform__assertGuard from "typia/lib/internal/_assertGuard.js";
|
|
2
2
|
import * as __typia_transform__accessExpressionAsString from "typia/lib/internal/_accessExpressionAsString.js";
|
|
3
3
|
import * as __typia_transform__isTypeUint64 from "typia/lib/internal/_isTypeUint64.js";
|
|
4
|
-
import { parseRecordName } from "./utils.js";
|
|
4
|
+
import { isEmptyRecord, parseRecordName } from "./utils.js";
|
|
5
5
|
import typia from 'typia';
|
|
6
6
|
export function assertGuardRecord(name, input) {
|
|
7
|
+
if (isEmptyRecord(input)) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
7
10
|
const parsed = parseRecordName(name);
|
|
8
11
|
if (parsed.type === "domain-rows") {
|
|
9
12
|
(() => { const _io0 = input => Array.isArray(input.rows) && input.rows.every(elem => "string" === typeof elem); const _ao0 = (input, _path, _exceptionable = true) => (Array.isArray(input.rows) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
@@ -12205,7 +12208,7 @@ function _assertGuardDomainRecord(domain, input) {
|
|
|
12205
12208
|
}; })()(input);
|
|
12206
12209
|
}
|
|
12207
12210
|
case ":script?": {
|
|
12208
|
-
return (() => { const _io0 = input => "object" === typeof input.value && null !== input.value && _io1(input.value); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
12211
|
+
return (() => { const _io0 = input => "object" === typeof input.value && null !== input.value && _io1(input.value); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle); const _io3 = input => Object.keys(input).every(key => {
|
|
12209
12212
|
const value = input[key];
|
|
12210
12213
|
if (undefined === value)
|
|
12211
12214
|
return true;
|
|
@@ -12275,7 +12278,7 @@ function _assertGuardDomainRecord(domain, input) {
|
|
|
12275
12278
|
path: _path + ".direction",
|
|
12276
12279
|
expected: "(\"ltr\" | \"rtl\" | null)",
|
|
12277
12280
|
value: input.direction
|
|
12278
|
-
}, _errorFactory)) && ("" === input.format || "center" === input.format || "
|
|
12281
|
+
}, _errorFactory)) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
12279
12282
|
method: "typia.assertGuard",
|
|
12280
12283
|
path: _path + ".format",
|
|
12281
12284
|
expected: "(\"\" | \"center\" | \"end\" | \"justify\" | \"left\" | \"right\" | \"start\")",
|
|
@@ -12424,7 +12427,7 @@ function _assertGuardDomainRecord(domain, input) {
|
|
|
12424
12427
|
}; })()(input);
|
|
12425
12428
|
}
|
|
12426
12429
|
case ":script.revision?": {
|
|
12427
|
-
return (() => { const _io0 = input => "string" === typeof input.$parent && "string" === typeof input.scriptId && "string" === typeof input.userId && ("object" === typeof input.value && null !== input.value && _io1(input.value)); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
12430
|
+
return (() => { const _io0 = input => "string" === typeof input.$parent && "string" === typeof input.scriptId && "string" === typeof input.userId && ("object" === typeof input.value && null !== input.value && _io1(input.value)); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle); const _io3 = input => Object.keys(input).every(key => {
|
|
12428
12431
|
const value = input[key];
|
|
12429
12432
|
if (undefined === value)
|
|
12430
12433
|
return true;
|
|
@@ -12509,7 +12512,7 @@ function _assertGuardDomainRecord(domain, input) {
|
|
|
12509
12512
|
path: _path + ".direction",
|
|
12510
12513
|
expected: "(\"ltr\" | \"rtl\" | null)",
|
|
12511
12514
|
value: input.direction
|
|
12512
|
-
}, _errorFactory)) && ("" === input.format || "center" === input.format || "
|
|
12515
|
+
}, _errorFactory)) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
12513
12516
|
method: "typia.assertGuard",
|
|
12514
12517
|
path: _path + ".format",
|
|
12515
12518
|
expected: "(\"\" | \"center\" | \"end\" | \"justify\" | \"left\" | \"right\" | \"start\")",
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as __typia_transform__assertGuard from "typia/lib/internal/_assertGuard.js";
|
|
2
2
|
import * as __typia_transform__accessExpressionAsString from "typia/lib/internal/_accessExpressionAsString.js";
|
|
3
3
|
import * as __typia_transform__isTypeUint64 from "typia/lib/internal/_isTypeUint64.js";
|
|
4
|
-
import { parseRecordName } from "./utils.js";
|
|
4
|
+
import { isEmptyRecord, parseRecordName } from "./utils.js";
|
|
5
5
|
import typia from 'typia';
|
|
6
6
|
export function assertRecord(name, input) {
|
|
7
|
+
if (isEmptyRecord(input)) {
|
|
8
|
+
return input;
|
|
9
|
+
}
|
|
7
10
|
const parsed = parseRecordName(name);
|
|
8
11
|
if (parsed.type === "domain-rows") {
|
|
9
12
|
return (() => { const _io0 = input => Array.isArray(input.rows) && input.rows.every(elem => "string" === typeof elem); const _ao0 = (input, _path, _exceptionable = true) => (Array.isArray(input.rows) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
@@ -12313,7 +12316,7 @@ function _assertDomainRecord(domain, input) {
|
|
|
12313
12316
|
}; })()(input);
|
|
12314
12317
|
}
|
|
12315
12318
|
case ":script?": {
|
|
12316
|
-
return (() => { const _io0 = input => "object" === typeof input.value && null !== input.value && _io1(input.value); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
12319
|
+
return (() => { const _io0 = input => "object" === typeof input.value && null !== input.value && _io1(input.value); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle); const _io3 = input => Object.keys(input).every(key => {
|
|
12317
12320
|
const value = input[key];
|
|
12318
12321
|
if (undefined === value)
|
|
12319
12322
|
return true;
|
|
@@ -12383,7 +12386,7 @@ function _assertDomainRecord(domain, input) {
|
|
|
12383
12386
|
path: _path + ".direction",
|
|
12384
12387
|
expected: "(\"ltr\" | \"rtl\" | null)",
|
|
12385
12388
|
value: input.direction
|
|
12386
|
-
}, _errorFactory)) && ("" === input.format || "center" === input.format || "
|
|
12389
|
+
}, _errorFactory)) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
12387
12390
|
method: "typia.assert",
|
|
12388
12391
|
path: _path + ".format",
|
|
12389
12392
|
expected: "(\"\" | \"center\" | \"end\" | \"justify\" | \"left\" | \"right\" | \"start\")",
|
|
@@ -12535,7 +12538,7 @@ function _assertDomainRecord(domain, input) {
|
|
|
12535
12538
|
}; })()(input);
|
|
12536
12539
|
}
|
|
12537
12540
|
case ":script.revision?": {
|
|
12538
|
-
return (() => { const _io0 = input => "string" === typeof input.$parent && "string" === typeof input.scriptId && "string" === typeof input.userId && ("object" === typeof input.value && null !== input.value && _io1(input.value)); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
12541
|
+
return (() => { const _io0 = input => "string" === typeof input.$parent && "string" === typeof input.scriptId && "string" === typeof input.userId && ("object" === typeof input.value && null !== input.value && _io1(input.value)); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle); const _io3 = input => Object.keys(input).every(key => {
|
|
12539
12542
|
const value = input[key];
|
|
12540
12543
|
if (undefined === value)
|
|
12541
12544
|
return true;
|
|
@@ -12620,7 +12623,7 @@ function _assertDomainRecord(domain, input) {
|
|
|
12620
12623
|
path: _path + ".direction",
|
|
12621
12624
|
expected: "(\"ltr\" | \"rtl\" | null)",
|
|
12622
12625
|
value: input.direction
|
|
12623
|
-
}, _errorFactory)) && ("" === input.format || "center" === input.format || "
|
|
12626
|
+
}, _errorFactory)) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
12624
12627
|
method: "typia.assert",
|
|
12625
12628
|
path: _path + ".format",
|
|
12626
12629
|
expected: "(\"\" | \"center\" | \"end\" | \"justify\" | \"left\" | \"right\" | \"start\")",
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as __typia_transform__isTypeUint64 from "typia/lib/internal/_isTypeUint64.js";
|
|
2
|
-
import { parseRecordName } from "./utils.js";
|
|
2
|
+
import { isEmptyRecord, parseRecordName } from "./utils.js";
|
|
3
3
|
import typia from 'typia';
|
|
4
4
|
export function isRecord(name, input) {
|
|
5
|
+
if (isEmptyRecord(input)) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
5
8
|
const parsed = parseRecordName(name);
|
|
6
9
|
if (parsed.type === "domain-rows") {
|
|
7
10
|
return (() => { const _io0 = input => Array.isArray(input.rows) && input.rows.every(elem => "string" === typeof elem); return input => "object" === typeof input && null !== input && _io0(input); })()(input);
|
|
@@ -820,7 +823,7 @@ function _isDomainRecord(domain, input) {
|
|
|
820
823
|
return (() => { const _io0 = input => "string" === typeof input.value; return input => "object" === typeof input && null !== input && _io0(input); })()(input);
|
|
821
824
|
}
|
|
822
825
|
case ":script?": {
|
|
823
|
-
return (() => { const _io0 = input => "object" === typeof input.value && null !== input.value && _io1(input.value); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
826
|
+
return (() => { const _io0 = input => "object" === typeof input.value && null !== input.value && _io1(input.value); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle); const _io3 = input => Object.keys(input).every(key => {
|
|
824
827
|
const value = input[key];
|
|
825
828
|
if (undefined === value)
|
|
826
829
|
return true;
|
|
@@ -834,7 +837,7 @@ function _isDomainRecord(domain, input) {
|
|
|
834
837
|
return (() => { const _io0 = input => "string" === typeof input.$parent && "string" === typeof input.scriptId && "string" === typeof input.userId && "string" === typeof input.value; return input => "object" === typeof input && null !== input && _io0(input); })()(input);
|
|
835
838
|
}
|
|
836
839
|
case ":script.revision?": {
|
|
837
|
-
return (() => { const _io0 = input => "string" === typeof input.$parent && "string" === typeof input.scriptId && "string" === typeof input.userId && ("object" === typeof input.value && null !== input.value && _io1(input.value)); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
840
|
+
return (() => { const _io0 = input => "string" === typeof input.$parent && "string" === typeof input.scriptId && "string" === typeof input.userId && ("object" === typeof input.value && null !== input.value && _io1(input.value)); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle); const _io3 = input => Object.keys(input).every(key => {
|
|
838
841
|
const value = input[key];
|
|
839
842
|
if (undefined === value)
|
|
840
843
|
return true;
|
|
@@ -10086,16 +10086,16 @@ function _schemasDomainRecord(domain) {
|
|
|
10086
10086
|
"const": "center"
|
|
10087
10087
|
},
|
|
10088
10088
|
{
|
|
10089
|
-
"const": "
|
|
10089
|
+
"const": "start"
|
|
10090
10090
|
},
|
|
10091
10091
|
{
|
|
10092
|
-
"const": "
|
|
10092
|
+
"const": "end"
|
|
10093
10093
|
},
|
|
10094
10094
|
{
|
|
10095
|
-
"const": "
|
|
10095
|
+
"const": "left"
|
|
10096
10096
|
},
|
|
10097
10097
|
{
|
|
10098
|
-
"const": "
|
|
10098
|
+
"const": "right"
|
|
10099
10099
|
},
|
|
10100
10100
|
{
|
|
10101
10101
|
"const": "justify"
|
|
@@ -10322,16 +10322,16 @@ function _schemasDomainRecord(domain) {
|
|
|
10322
10322
|
"const": "center"
|
|
10323
10323
|
},
|
|
10324
10324
|
{
|
|
10325
|
-
"const": "
|
|
10325
|
+
"const": "start"
|
|
10326
10326
|
},
|
|
10327
10327
|
{
|
|
10328
|
-
"const": "
|
|
10328
|
+
"const": "end"
|
|
10329
10329
|
},
|
|
10330
10330
|
{
|
|
10331
|
-
"const": "
|
|
10331
|
+
"const": "left"
|
|
10332
10332
|
},
|
|
10333
10333
|
{
|
|
10334
|
-
"const": "
|
|
10334
|
+
"const": "right"
|
|
10335
10335
|
},
|
|
10336
10336
|
{
|
|
10337
10337
|
"const": "justify"
|
|
@@ -2,9 +2,12 @@ import * as __typia_transform__jsonStringifyString from "typia/lib/internal/_jso
|
|
|
2
2
|
import * as __typia_transform__throwTypeGuardError from "typia/lib/internal/_throwTypeGuardError.js";
|
|
3
3
|
import * as __typia_transform__jsonStringifyTail from "typia/lib/internal/_jsonStringifyTail.js";
|
|
4
4
|
import * as __typia_transform__isTypeUint64 from "typia/lib/internal/_isTypeUint64.js";
|
|
5
|
-
import { parseRecordName } from "./utils.js";
|
|
5
|
+
import { isEmptyRecord, parseRecordName } from "./utils.js";
|
|
6
6
|
import typia from 'typia';
|
|
7
7
|
export function stringifyRecord(name, input) {
|
|
8
|
+
if (isEmptyRecord(input)) {
|
|
9
|
+
return "{}";
|
|
10
|
+
}
|
|
8
11
|
const parsed = parseRecordName(name);
|
|
9
12
|
if (parsed.type === "domain-rows") {
|
|
10
13
|
return (() => { const _so0 = input => `{"rows":${`[${input.rows.map(elem => __typia_transform__jsonStringifyString._jsonStringifyString(elem)).join(",")}]`}}`; return input => _so0(input); })()(input);
|
|
@@ -1634,7 +1637,7 @@ function _stringifyDomainRecord(domain, input) {
|
|
|
1634
1637
|
}
|
|
1635
1638
|
case ":script?": {
|
|
1636
1639
|
return (() => { const _so0 = input => `{"value":${_so1(input.value)}}`; const _so1 = input => `{"root":${_so2(input.root)}}`; const _so2 = input => `{${undefined === input.$ ? "" : `"$":${undefined !== input.$ ? _so3(input.$) : undefined},`}${undefined === input.textFormat ? "" : `"textFormat":${undefined !== input.textFormat ? input.textFormat : undefined},`}${undefined === input.textStyle ? "" : `"textStyle":${undefined !== input.textStyle ? __typia_transform__jsonStringifyString._jsonStringifyString(input.textStyle) : undefined},`}"type":${__typia_transform__jsonStringifyString._jsonStringifyString(input.type)},"version":${input.version},"children":${`[${input.children.map(elem => _so4(elem)).join(",")}]`},"direction":${null !== input.direction ? "\"" + input.direction + "\"" : "null"},"format":${"\"" + input.format + "\""},"indent":${input.indent}}`; const _so3 = input => `{${Object.entries(input).map(([key, value]) => { if (undefined === value)
|
|
1637
|
-
return ""; return `${JSON.stringify(key)}:${undefined !== value ? JSON.stringify(value) : undefined}`; }).filter(str => "" !== str).join(",")}}`; const _so4 = input => `{${undefined === input.$ ? "" : `"$":${undefined !== input.$ ? _so3(input.$) : undefined},`}"type":${__typia_transform__jsonStringifyString._jsonStringifyString(input.type)},"version":${input.version}}`; const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
1640
|
+
return ""; return `${JSON.stringify(key)}:${undefined !== value ? JSON.stringify(value) : undefined}`; }).filter(str => "" !== str).join(",")}}`; const _so4 = input => `{${undefined === input.$ ? "" : `"$":${undefined !== input.$ ? _so3(input.$) : undefined},`}"type":${__typia_transform__jsonStringifyString._jsonStringifyString(input.type)},"version":${input.version}}`; const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle); const _io3 = input => Object.keys(input).every(key => {
|
|
1638
1641
|
const value = input[key];
|
|
1639
1642
|
if (undefined === value)
|
|
1640
1643
|
return true;
|
|
@@ -1649,7 +1652,7 @@ function _stringifyDomainRecord(domain, input) {
|
|
|
1649
1652
|
}
|
|
1650
1653
|
case ":script.revision?": {
|
|
1651
1654
|
return (() => { const _so0 = input => `{"$parent":${__typia_transform__jsonStringifyString._jsonStringifyString(input.$parent)},"scriptId":${__typia_transform__jsonStringifyString._jsonStringifyString(input.scriptId)},"userId":${__typia_transform__jsonStringifyString._jsonStringifyString(input.userId)},"value":${_so1(input.value)}}`; const _so1 = input => `{"root":${_so2(input.root)}}`; const _so2 = input => `{${undefined === input.$ ? "" : `"$":${undefined !== input.$ ? _so3(input.$) : undefined},`}${undefined === input.textFormat ? "" : `"textFormat":${undefined !== input.textFormat ? input.textFormat : undefined},`}${undefined === input.textStyle ? "" : `"textStyle":${undefined !== input.textStyle ? __typia_transform__jsonStringifyString._jsonStringifyString(input.textStyle) : undefined},`}"type":${__typia_transform__jsonStringifyString._jsonStringifyString(input.type)},"version":${input.version},"children":${`[${input.children.map(elem => _so4(elem)).join(",")}]`},"direction":${null !== input.direction ? "\"" + input.direction + "\"" : "null"},"format":${"\"" + input.format + "\""},"indent":${input.indent}}`; const _so3 = input => `{${Object.entries(input).map(([key, value]) => { if (undefined === value)
|
|
1652
|
-
return ""; return `${JSON.stringify(key)}:${undefined !== value ? JSON.stringify(value) : undefined}`; }).filter(str => "" !== str).join(",")}}`; const _so4 = input => `{${undefined === input.$ ? "" : `"$":${undefined !== input.$ ? _so3(input.$) : undefined},`}"type":${__typia_transform__jsonStringifyString._jsonStringifyString(input.type)},"version":${input.version}}`; const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
1655
|
+
return ""; return `${JSON.stringify(key)}:${undefined !== value ? JSON.stringify(value) : undefined}`; }).filter(str => "" !== str).join(",")}}`; const _so4 = input => `{${undefined === input.$ ? "" : `"$":${undefined !== input.$ ? _so3(input.$) : undefined},`}"type":${__typia_transform__jsonStringifyString._jsonStringifyString(input.type)},"version":${input.version}}`; const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle); const _io3 = input => Object.keys(input).every(key => {
|
|
1653
1656
|
const value = input[key];
|
|
1654
1657
|
if (undefined === value)
|
|
1655
1658
|
return true;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EmptyObject } from 'type-fest';
|
|
1
2
|
import type { ExactRecords, DomainRecords } from '../index.ts';
|
|
2
3
|
export type ParsedRecordName = ExactRecordName | DomainRecord | DomainRowsRecord;
|
|
3
4
|
export interface ExactRecordName {
|
|
@@ -12,4 +13,5 @@ export interface DomainRecord {
|
|
|
12
13
|
export interface DomainRowsRecord {
|
|
13
14
|
type: "domain-rows";
|
|
14
15
|
}
|
|
16
|
+
export declare function isEmptyRecord<NonEmpty>(data: NonEmpty | EmptyObject): data is EmptyObject;
|
|
15
17
|
export declare function parseRecordName(name: string): ParsedRecordName;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
const _exactRecordNames = new Set(["asset.assignees", "asset.clone", "asset.deadlines", "asset.duration", "asset.embedding", "asset.icon", "asset.locations", "asset.media", "asset.tags", "asset.title", "asset.types", "storage.locations?", "storage.zones?", "nxt.status?", "media.subtitles", "media.subtitles?", "media.transcribe?", "media.fonts?", "media.consolidate", "asset-daemon", "asset-daemon:user-notify.state", "deepstream-replicator.stats?"]);
|
|
2
|
+
export function isEmptyRecord(data) {
|
|
3
|
+
return typeof data === "object" && data !== null && Object.keys(data).length === 0;
|
|
4
|
+
}
|
|
2
5
|
export function parseRecordName(name) {
|
|
3
6
|
if (_exactRecordNames.has(stripParams(name))) {
|
|
4
7
|
return {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import * as __typia_transform__accessExpressionAsString from "typia/lib/internal/_accessExpressionAsString.js";
|
|
2
2
|
import * as __typia_transform__validateReport from "typia/lib/internal/_validateReport.js";
|
|
3
3
|
import * as __typia_transform__isTypeUint64 from "typia/lib/internal/_isTypeUint64.js";
|
|
4
|
-
import { parseRecordName } from "./utils.js";
|
|
4
|
+
import { isEmptyRecord, parseRecordName } from "./utils.js";
|
|
5
5
|
import typia from 'typia';
|
|
6
6
|
export function validateEqualsRecord(name, input) {
|
|
7
|
+
if (isEmptyRecord(input)) {
|
|
8
|
+
return {
|
|
9
|
+
success: true,
|
|
10
|
+
data: input,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
7
13
|
const parsed = parseRecordName(name);
|
|
8
14
|
if (parsed.type === "domain-rows") {
|
|
9
15
|
return (() => { const _io0 = (input, _exceptionable = true) => Array.isArray(input.rows) && input.rows.every((elem, _index1) => "string" === typeof elem) && (1 === Object.keys(input).length || Object.keys(input).every(key => {
|
|
@@ -18289,7 +18295,7 @@ function _validateEqualsDomainRecord(domain, input) {
|
|
|
18289
18295
|
if (undefined === value)
|
|
18290
18296
|
return true;
|
|
18291
18297
|
return false;
|
|
18292
|
-
})); const _io2 = (input, _exceptionable = true) => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$, true && _exceptionable)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every((elem, _index1) => "object" === typeof elem && null !== elem && _io4(elem, true && _exceptionable))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
18298
|
+
})); const _io2 = (input, _exceptionable = true) => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$, true && _exceptionable)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every((elem, _index1) => "object" === typeof elem && null !== elem && _io4(elem, true && _exceptionable))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle) && (6 === Object.keys(input).length || Object.keys(input).every(key => {
|
|
18293
18299
|
if (["type", "$", "version", "children", "direction", "format", "indent", "textFormat", "textStyle"].some(prop => key === prop))
|
|
18294
18300
|
return true;
|
|
18295
18301
|
const value = input[key];
|
|
@@ -18392,7 +18398,7 @@ function _validateEqualsDomainRecord(domain, input) {
|
|
|
18392
18398
|
path: _path + ".direction",
|
|
18393
18399
|
expected: "(\"ltr\" | \"rtl\" | null)",
|
|
18394
18400
|
value: input.direction
|
|
18395
|
-
}), "" === input.format || "center" === input.format || "
|
|
18401
|
+
}), "" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format || _report(_exceptionable, {
|
|
18396
18402
|
path: _path + ".format",
|
|
18397
18403
|
expected: "(\"\" | \"center\" | \"end\" | \"justify\" | \"left\" | \"right\" | \"start\")",
|
|
18398
18404
|
value: input.format
|
|
@@ -18674,7 +18680,7 @@ function _validateEqualsDomainRecord(domain, input) {
|
|
|
18674
18680
|
if (undefined === value)
|
|
18675
18681
|
return true;
|
|
18676
18682
|
return false;
|
|
18677
|
-
})); const _io2 = (input, _exceptionable = true) => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$, true && _exceptionable)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every((elem, _index1) => "object" === typeof elem && null !== elem && _io4(elem, true && _exceptionable))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
18683
|
+
})); const _io2 = (input, _exceptionable = true) => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$, true && _exceptionable)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every((elem, _index1) => "object" === typeof elem && null !== elem && _io4(elem, true && _exceptionable))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle) && (6 === Object.keys(input).length || Object.keys(input).every(key => {
|
|
18678
18684
|
if (["type", "$", "version", "children", "direction", "format", "indent", "textFormat", "textStyle"].some(prop => key === prop))
|
|
18679
18685
|
return true;
|
|
18680
18686
|
const value = input[key];
|
|
@@ -18789,7 +18795,7 @@ function _validateEqualsDomainRecord(domain, input) {
|
|
|
18789
18795
|
path: _path + ".direction",
|
|
18790
18796
|
expected: "(\"ltr\" | \"rtl\" | null)",
|
|
18791
18797
|
value: input.direction
|
|
18792
|
-
}), "" === input.format || "center" === input.format || "
|
|
18798
|
+
}), "" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format || _report(_exceptionable, {
|
|
18793
18799
|
path: _path + ".format",
|
|
18794
18800
|
expected: "(\"\" | \"center\" | \"end\" | \"justify\" | \"left\" | \"right\" | \"start\")",
|
|
18795
18801
|
value: input.format
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import * as __typia_transform__validateReport from "typia/lib/internal/_validateReport.js";
|
|
2
2
|
import * as __typia_transform__accessExpressionAsString from "typia/lib/internal/_accessExpressionAsString.js";
|
|
3
3
|
import * as __typia_transform__isTypeUint64 from "typia/lib/internal/_isTypeUint64.js";
|
|
4
|
-
import { parseRecordName } from "./utils.js";
|
|
4
|
+
import { parseRecordName, isEmptyRecord } from "./utils.js";
|
|
5
5
|
import typia from 'typia';
|
|
6
6
|
export function validateRecord(name, input) {
|
|
7
|
+
if (isEmptyRecord(input)) {
|
|
8
|
+
return {
|
|
9
|
+
success: true,
|
|
10
|
+
data: input,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
7
13
|
const parsed = parseRecordName(name);
|
|
8
14
|
if (parsed.type === "domain-rows") {
|
|
9
15
|
return (() => { const _io0 = input => Array.isArray(input.rows) && input.rows.every(elem => "string" === typeof elem); const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.rows) || _report(_exceptionable, {
|
|
@@ -11638,7 +11644,7 @@ function _validateDomainRecord(domain, input) {
|
|
|
11638
11644
|
}; })()(input);
|
|
11639
11645
|
}
|
|
11640
11646
|
case ":script?": {
|
|
11641
|
-
return (() => { const _io0 = input => "object" === typeof input.value && null !== input.value && _io1(input.value); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
11647
|
+
return (() => { const _io0 = input => "object" === typeof input.value && null !== input.value && _io1(input.value); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle); const _io3 = input => Object.keys(input).every(key => {
|
|
11642
11648
|
const value = input[key];
|
|
11643
11649
|
if (undefined === value)
|
|
11644
11650
|
return true;
|
|
@@ -11695,7 +11701,7 @@ function _validateDomainRecord(domain, input) {
|
|
|
11695
11701
|
path: _path + ".direction",
|
|
11696
11702
|
expected: "(\"ltr\" | \"rtl\" | null)",
|
|
11697
11703
|
value: input.direction
|
|
11698
|
-
}), "" === input.format || "center" === input.format || "
|
|
11704
|
+
}), "" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format || _report(_exceptionable, {
|
|
11699
11705
|
path: _path + ".format",
|
|
11700
11706
|
expected: "(\"\" | \"center\" | \"end\" | \"justify\" | \"left\" | \"right\" | \"start\")",
|
|
11701
11707
|
value: input.format
|
|
@@ -11862,7 +11868,7 @@ function _validateDomainRecord(domain, input) {
|
|
|
11862
11868
|
}; })()(input);
|
|
11863
11869
|
}
|
|
11864
11870
|
case ":script.revision?": {
|
|
11865
|
-
return (() => { const _io0 = input => "string" === typeof input.$parent && "string" === typeof input.scriptId && "string" === typeof input.userId && ("object" === typeof input.value && null !== input.value && _io1(input.value)); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "
|
|
11871
|
+
return (() => { const _io0 = input => "string" === typeof input.$parent && "string" === typeof input.scriptId && "string" === typeof input.userId && ("object" === typeof input.value && null !== input.value && _io1(input.value)); const _io1 = input => "object" === typeof input.root && null !== input.root && _io2(input.root); const _io2 = input => "string" === typeof input.type && (undefined === input.$ || "object" === typeof input.$ && null !== input.$ && false === Array.isArray(input.$) && _io3(input.$)) && "number" === typeof input.version && (Array.isArray(input.children) && input.children.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.direction || "ltr" === input.direction || "rtl" === input.direction) && ("" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format) && "number" === typeof input.indent && (undefined === input.textFormat || "number" === typeof input.textFormat) && (undefined === input.textStyle || "string" === typeof input.textStyle); const _io3 = input => Object.keys(input).every(key => {
|
|
11866
11872
|
const value = input[key];
|
|
11867
11873
|
if (undefined === value)
|
|
11868
11874
|
return true;
|
|
@@ -11931,7 +11937,7 @@ function _validateDomainRecord(domain, input) {
|
|
|
11931
11937
|
path: _path + ".direction",
|
|
11932
11938
|
expected: "(\"ltr\" | \"rtl\" | null)",
|
|
11933
11939
|
value: input.direction
|
|
11934
|
-
}), "" === input.format || "center" === input.format || "
|
|
11940
|
+
}), "" === input.format || "center" === input.format || "start" === input.format || "end" === input.format || "left" === input.format || "right" === input.format || "justify" === input.format || _report(_exceptionable, {
|
|
11935
11941
|
path: _path + ".format",
|
|
11936
11942
|
expected: "(\"\" | \"center\" | \"end\" | \"justify\" | \"left\" | \"right\" | \"start\")",
|
|
11937
11943
|
value: input.format
|