@valbuild/server 0.79.4 → 0.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -921,12 +921,13 @@ import { Internal } from "@valbuild/core";
|
|
921
921
|
|
922
922
|
globalThis.valModule = {
|
923
923
|
path: valModule?.default && Internal.getValPath(valModule?.default),
|
924
|
-
schema: !!globalThis['__VAL_OPTIONS__'].schema ? valModule?.default && Internal.getSchema(valModule?.default)?.
|
924
|
+
schema: !!globalThis['__VAL_OPTIONS__'].schema ? valModule?.default && Internal.getSchema(valModule?.default)?.["executeSerialize"]() : undefined,
|
925
925
|
source: !!globalThis['__VAL_OPTIONS__'].source ? valModule?.default && Internal.getSource(valModule?.default) : undefined,
|
926
|
-
validation: !!globalThis['__VAL_OPTIONS__'].validate ? valModule?.default && Internal.
|
927
|
-
valModule?.default
|
928
|
-
|
929
|
-
|
926
|
+
validation: !!globalThis['__VAL_OPTIONS__'].validate ? valModule?.default && (Internal.validate ? Internal.validate(valModule.default, Internal.getValPath(valModule?.default) || "/",
|
927
|
+
Internal.getSource(valModule?.default)) : Internal.getSchema(valModule?.default)?.validate(
|
928
|
+
Internal.getValPath(valModule?.default) || "/",
|
929
|
+
Internal.getSource(valModule?.default)
|
930
|
+
)) : undefined,
|
930
931
|
defaultExport: !!valModule?.default,
|
931
932
|
};
|
932
933
|
`;
|
@@ -1395,7 +1396,7 @@ class Service {
|
|
1395
1396
|
const sourcePath = resolved.path ? [moduleFilePath, resolved.path].join(".") : moduleFilePath;
|
1396
1397
|
return {
|
1397
1398
|
path: sourcePath,
|
1398
|
-
schema: resolved.schema instanceof core.Schema ? resolved.schema
|
1399
|
+
schema: resolved.schema instanceof core.Schema ? resolved.schema["executeSerialize"]() : resolved.schema,
|
1399
1400
|
source: resolved.source,
|
1400
1401
|
errors: valModule.errors && valModule.errors.validation ? {
|
1401
1402
|
validation: valModule.errors.validation || undefined,
|
@@ -1609,7 +1610,7 @@ class ValOps {
|
|
1609
1610
|
addModuleError(`schema in path '${path}' is not an instance of Schema`, moduleIdx, path);
|
1610
1611
|
return;
|
1611
1612
|
}
|
1612
|
-
if (typeof schema
|
1613
|
+
if (typeof schema["executeSerialize"] !== "function") {
|
1613
1614
|
addModuleError(`schema.serialize in path '${path}' is not a function`, moduleIdx, path);
|
1614
1615
|
return;
|
1615
1616
|
}
|
@@ -1620,7 +1621,7 @@ class ValOps {
|
|
1620
1621
|
}
|
1621
1622
|
let serializedSchema;
|
1622
1623
|
try {
|
1623
|
-
serializedSchema = schema
|
1624
|
+
serializedSchema = schema["executeSerialize"]();
|
1624
1625
|
} catch (e) {
|
1625
1626
|
const message = e instanceof Error ? e.message : JSON.stringify(e);
|
1626
1627
|
addModuleError(`Could not serialize module: '${path}'. Error: ${message}`, moduleIdx, path);
|
@@ -1827,7 +1828,7 @@ class ValOps {
|
|
1827
1828
|
var _schemas$moduleFilePa;
|
1828
1829
|
const [moduleFilePath] = core.Internal.splitModuleFilePathAndModulePath(sourcePath);
|
1829
1830
|
const keyOfModuleSource = sources[moduleFilePath];
|
1830
|
-
const keyOfModuleSchema = (_schemas$moduleFilePa = schemas[moduleFilePath]) === null || _schemas$moduleFilePa === void 0 ? void 0 : _schemas$moduleFilePa
|
1831
|
+
const keyOfModuleSchema = (_schemas$moduleFilePa = schemas[moduleFilePath]) === null || _schemas$moduleFilePa === void 0 ? void 0 : _schemas$moduleFilePa["executeSerialize"]();
|
1831
1832
|
if (keyOfModuleSchema && keyOfModuleSchema.type !== "record") {
|
1832
1833
|
return {
|
1833
1834
|
error: true,
|
@@ -1875,7 +1876,7 @@ class ValOps {
|
|
1875
1876
|
};
|
1876
1877
|
continue;
|
1877
1878
|
}
|
1878
|
-
const res = schema
|
1879
|
+
const res = schema["executeValidate"](path, source);
|
1879
1880
|
if (res === false) {
|
1880
1881
|
continue;
|
1881
1882
|
}
|
@@ -5551,7 +5552,7 @@ const ValServer = (valModules, options, callbacks) => {
|
|
5551
5552
|
try {
|
5552
5553
|
for (const [moduleFilePathS, schema] of Object.entries(schemas)) {
|
5553
5554
|
const moduleFilePath = moduleFilePathS;
|
5554
|
-
serializedSchemas[moduleFilePath] = schema
|
5555
|
+
serializedSchemas[moduleFilePath] = schema["executeSerialize"]();
|
5555
5556
|
}
|
5556
5557
|
} catch (e) {
|
5557
5558
|
console.error("Val: Failed to serialize schemas", e);
|
@@ -6266,7 +6267,7 @@ function guessMimeTypeFromPath(filePath) {
|
|
6266
6267
|
function getIsRemoteRequired(schemas) {
|
6267
6268
|
for (const moduleFilePathS in schemas) {
|
6268
6269
|
const moduleFilePath = moduleFilePathS;
|
6269
|
-
const schema = schemas[moduleFilePath]
|
6270
|
+
const schema = schemas[moduleFilePath]["executeSerialize"]();
|
6270
6271
|
const isRemoteRequired = hasRemoteFileSchema(schema);
|
6271
6272
|
if (isRemoteRequired) {
|
6272
6273
|
return true;
|
@@ -921,12 +921,13 @@ import { Internal } from "@valbuild/core";
|
|
921
921
|
|
922
922
|
globalThis.valModule = {
|
923
923
|
path: valModule?.default && Internal.getValPath(valModule?.default),
|
924
|
-
schema: !!globalThis['__VAL_OPTIONS__'].schema ? valModule?.default && Internal.getSchema(valModule?.default)?.
|
924
|
+
schema: !!globalThis['__VAL_OPTIONS__'].schema ? valModule?.default && Internal.getSchema(valModule?.default)?.["executeSerialize"]() : undefined,
|
925
925
|
source: !!globalThis['__VAL_OPTIONS__'].source ? valModule?.default && Internal.getSource(valModule?.default) : undefined,
|
926
|
-
validation: !!globalThis['__VAL_OPTIONS__'].validate ? valModule?.default && Internal.
|
927
|
-
valModule?.default
|
928
|
-
|
929
|
-
|
926
|
+
validation: !!globalThis['__VAL_OPTIONS__'].validate ? valModule?.default && (Internal.validate ? Internal.validate(valModule.default, Internal.getValPath(valModule?.default) || "/",
|
927
|
+
Internal.getSource(valModule?.default)) : Internal.getSchema(valModule?.default)?.validate(
|
928
|
+
Internal.getValPath(valModule?.default) || "/",
|
929
|
+
Internal.getSource(valModule?.default)
|
930
|
+
)) : undefined,
|
930
931
|
defaultExport: !!valModule?.default,
|
931
932
|
};
|
932
933
|
`;
|
@@ -1395,7 +1396,7 @@ class Service {
|
|
1395
1396
|
const sourcePath = resolved.path ? [moduleFilePath, resolved.path].join(".") : moduleFilePath;
|
1396
1397
|
return {
|
1397
1398
|
path: sourcePath,
|
1398
|
-
schema: resolved.schema instanceof core.Schema ? resolved.schema
|
1399
|
+
schema: resolved.schema instanceof core.Schema ? resolved.schema["executeSerialize"]() : resolved.schema,
|
1399
1400
|
source: resolved.source,
|
1400
1401
|
errors: valModule.errors && valModule.errors.validation ? {
|
1401
1402
|
validation: valModule.errors.validation || undefined,
|
@@ -1609,7 +1610,7 @@ class ValOps {
|
|
1609
1610
|
addModuleError(`schema in path '${path}' is not an instance of Schema`, moduleIdx, path);
|
1610
1611
|
return;
|
1611
1612
|
}
|
1612
|
-
if (typeof schema
|
1613
|
+
if (typeof schema["executeSerialize"] !== "function") {
|
1613
1614
|
addModuleError(`schema.serialize in path '${path}' is not a function`, moduleIdx, path);
|
1614
1615
|
return;
|
1615
1616
|
}
|
@@ -1620,7 +1621,7 @@ class ValOps {
|
|
1620
1621
|
}
|
1621
1622
|
let serializedSchema;
|
1622
1623
|
try {
|
1623
|
-
serializedSchema = schema
|
1624
|
+
serializedSchema = schema["executeSerialize"]();
|
1624
1625
|
} catch (e) {
|
1625
1626
|
const message = e instanceof Error ? e.message : JSON.stringify(e);
|
1626
1627
|
addModuleError(`Could not serialize module: '${path}'. Error: ${message}`, moduleIdx, path);
|
@@ -1827,7 +1828,7 @@ class ValOps {
|
|
1827
1828
|
var _schemas$moduleFilePa;
|
1828
1829
|
const [moduleFilePath] = core.Internal.splitModuleFilePathAndModulePath(sourcePath);
|
1829
1830
|
const keyOfModuleSource = sources[moduleFilePath];
|
1830
|
-
const keyOfModuleSchema = (_schemas$moduleFilePa = schemas[moduleFilePath]) === null || _schemas$moduleFilePa === void 0 ? void 0 : _schemas$moduleFilePa
|
1831
|
+
const keyOfModuleSchema = (_schemas$moduleFilePa = schemas[moduleFilePath]) === null || _schemas$moduleFilePa === void 0 ? void 0 : _schemas$moduleFilePa["executeSerialize"]();
|
1831
1832
|
if (keyOfModuleSchema && keyOfModuleSchema.type !== "record") {
|
1832
1833
|
return {
|
1833
1834
|
error: true,
|
@@ -1875,7 +1876,7 @@ class ValOps {
|
|
1875
1876
|
};
|
1876
1877
|
continue;
|
1877
1878
|
}
|
1878
|
-
const res = schema
|
1879
|
+
const res = schema["executeValidate"](path, source);
|
1879
1880
|
if (res === false) {
|
1880
1881
|
continue;
|
1881
1882
|
}
|
@@ -5551,7 +5552,7 @@ const ValServer = (valModules, options, callbacks) => {
|
|
5551
5552
|
try {
|
5552
5553
|
for (const [moduleFilePathS, schema] of Object.entries(schemas)) {
|
5553
5554
|
const moduleFilePath = moduleFilePathS;
|
5554
|
-
serializedSchemas[moduleFilePath] = schema
|
5555
|
+
serializedSchemas[moduleFilePath] = schema["executeSerialize"]();
|
5555
5556
|
}
|
5556
5557
|
} catch (e) {
|
5557
5558
|
console.error("Val: Failed to serialize schemas", e);
|
@@ -6266,7 +6267,7 @@ function guessMimeTypeFromPath(filePath) {
|
|
6266
6267
|
function getIsRemoteRequired(schemas) {
|
6267
6268
|
for (const moduleFilePathS in schemas) {
|
6268
6269
|
const moduleFilePath = moduleFilePathS;
|
6269
|
-
const schema = schemas[moduleFilePath]
|
6270
|
+
const schema = schemas[moduleFilePath]["executeSerialize"]();
|
6270
6271
|
const isRemoteRequired = hasRemoteFileSchema(schema);
|
6271
6272
|
if (isRemoteRequired) {
|
6272
6273
|
return true;
|
@@ -890,12 +890,13 @@ import { Internal } from "@valbuild/core";
|
|
890
890
|
|
891
891
|
globalThis.valModule = {
|
892
892
|
path: valModule?.default && Internal.getValPath(valModule?.default),
|
893
|
-
schema: !!globalThis['__VAL_OPTIONS__'].schema ? valModule?.default && Internal.getSchema(valModule?.default)?.
|
893
|
+
schema: !!globalThis['__VAL_OPTIONS__'].schema ? valModule?.default && Internal.getSchema(valModule?.default)?.["executeSerialize"]() : undefined,
|
894
894
|
source: !!globalThis['__VAL_OPTIONS__'].source ? valModule?.default && Internal.getSource(valModule?.default) : undefined,
|
895
|
-
validation: !!globalThis['__VAL_OPTIONS__'].validate ? valModule?.default && Internal.
|
896
|
-
valModule?.default
|
897
|
-
|
898
|
-
|
895
|
+
validation: !!globalThis['__VAL_OPTIONS__'].validate ? valModule?.default && (Internal.validate ? Internal.validate(valModule.default, Internal.getValPath(valModule?.default) || "/",
|
896
|
+
Internal.getSource(valModule?.default)) : Internal.getSchema(valModule?.default)?.validate(
|
897
|
+
Internal.getValPath(valModule?.default) || "/",
|
898
|
+
Internal.getSource(valModule?.default)
|
899
|
+
)) : undefined,
|
899
900
|
defaultExport: !!valModule?.default,
|
900
901
|
};
|
901
902
|
`;
|
@@ -1364,7 +1365,7 @@ class Service {
|
|
1364
1365
|
const sourcePath = resolved.path ? [moduleFilePath, resolved.path].join(".") : moduleFilePath;
|
1365
1366
|
return {
|
1366
1367
|
path: sourcePath,
|
1367
|
-
schema: resolved.schema instanceof Schema ? resolved.schema
|
1368
|
+
schema: resolved.schema instanceof Schema ? resolved.schema["executeSerialize"]() : resolved.schema,
|
1368
1369
|
source: resolved.source,
|
1369
1370
|
errors: valModule.errors && valModule.errors.validation ? {
|
1370
1371
|
validation: valModule.errors.validation || undefined,
|
@@ -1578,7 +1579,7 @@ class ValOps {
|
|
1578
1579
|
addModuleError(`schema in path '${path}' is not an instance of Schema`, moduleIdx, path);
|
1579
1580
|
return;
|
1580
1581
|
}
|
1581
|
-
if (typeof schema
|
1582
|
+
if (typeof schema["executeSerialize"] !== "function") {
|
1582
1583
|
addModuleError(`schema.serialize in path '${path}' is not a function`, moduleIdx, path);
|
1583
1584
|
return;
|
1584
1585
|
}
|
@@ -1589,7 +1590,7 @@ class ValOps {
|
|
1589
1590
|
}
|
1590
1591
|
let serializedSchema;
|
1591
1592
|
try {
|
1592
|
-
serializedSchema = schema
|
1593
|
+
serializedSchema = schema["executeSerialize"]();
|
1593
1594
|
} catch (e) {
|
1594
1595
|
const message = e instanceof Error ? e.message : JSON.stringify(e);
|
1595
1596
|
addModuleError(`Could not serialize module: '${path}'. Error: ${message}`, moduleIdx, path);
|
@@ -1796,7 +1797,7 @@ class ValOps {
|
|
1796
1797
|
var _schemas$moduleFilePa;
|
1797
1798
|
const [moduleFilePath] = Internal.splitModuleFilePathAndModulePath(sourcePath);
|
1798
1799
|
const keyOfModuleSource = sources[moduleFilePath];
|
1799
|
-
const keyOfModuleSchema = (_schemas$moduleFilePa = schemas[moduleFilePath]) === null || _schemas$moduleFilePa === void 0 ? void 0 : _schemas$moduleFilePa
|
1800
|
+
const keyOfModuleSchema = (_schemas$moduleFilePa = schemas[moduleFilePath]) === null || _schemas$moduleFilePa === void 0 ? void 0 : _schemas$moduleFilePa["executeSerialize"]();
|
1800
1801
|
if (keyOfModuleSchema && keyOfModuleSchema.type !== "record") {
|
1801
1802
|
return {
|
1802
1803
|
error: true,
|
@@ -1844,7 +1845,7 @@ class ValOps {
|
|
1844
1845
|
};
|
1845
1846
|
continue;
|
1846
1847
|
}
|
1847
|
-
const res = schema
|
1848
|
+
const res = schema["executeValidate"](path, source);
|
1848
1849
|
if (res === false) {
|
1849
1850
|
continue;
|
1850
1851
|
}
|
@@ -5520,7 +5521,7 @@ const ValServer = (valModules, options, callbacks) => {
|
|
5520
5521
|
try {
|
5521
5522
|
for (const [moduleFilePathS, schema] of Object.entries(schemas)) {
|
5522
5523
|
const moduleFilePath = moduleFilePathS;
|
5523
|
-
serializedSchemas[moduleFilePath] = schema
|
5524
|
+
serializedSchemas[moduleFilePath] = schema["executeSerialize"]();
|
5524
5525
|
}
|
5525
5526
|
} catch (e) {
|
5526
5527
|
console.error("Val: Failed to serialize schemas", e);
|
@@ -6235,7 +6236,7 @@ function guessMimeTypeFromPath(filePath) {
|
|
6235
6236
|
function getIsRemoteRequired(schemas) {
|
6236
6237
|
for (const moduleFilePathS in schemas) {
|
6237
6238
|
const moduleFilePath = moduleFilePathS;
|
6238
|
-
const schema = schemas[moduleFilePath]
|
6239
|
+
const schema = schemas[moduleFilePath]["executeSerialize"]();
|
6239
6240
|
const isRemoteRequired = hasRemoteFileSchema(schema);
|
6240
6241
|
if (isRemoteRequired) {
|
6241
6242
|
return true;
|
package/package.json
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
"./package.json": "./package.json"
|
13
13
|
},
|
14
14
|
"types": "dist/valbuild-server.cjs.d.ts",
|
15
|
-
"version": "0.
|
15
|
+
"version": "0.80.0",
|
16
16
|
"scripts": {
|
17
17
|
"typecheck": "tsc --noEmit",
|
18
18
|
"test": "jest",
|
@@ -23,9 +23,9 @@
|
|
23
23
|
"@types/jest": "^29.2.5"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@valbuild/core": "~0.
|
27
|
-
"@valbuild/shared": "~0.
|
28
|
-
"@valbuild/ui": "~0.
|
26
|
+
"@valbuild/core": "~0.80.0",
|
27
|
+
"@valbuild/shared": "~0.80.0",
|
28
|
+
"@valbuild/ui": "~0.80.0",
|
29
29
|
"chokidar": "^4.0.1",
|
30
30
|
"image-size": "^1.0.2",
|
31
31
|
"minimatch": "^3.0.4",
|