@514labs/moose-lib 0.6.433 → 0.6.434
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/browserCompatible.d.mts +1 -1
- package/dist/browserCompatible.d.ts +1 -1
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/compilerPlugin.js +24 -2
- package/dist/compilerPlugin.js.map +1 -1
- package/dist/compilerPlugin.mjs +24 -2
- package/dist/compilerPlugin.mjs.map +1 -1
- package/dist/dataModels/toDataModels.js +24 -2
- package/dist/dataModels/toDataModels.js.map +1 -1
- package/dist/dataModels/toDataModels.mjs +24 -2
- package/dist/dataModels/toDataModels.mjs.map +1 -1
- package/dist/dmv2/index.d.mts +1 -1
- package/dist/dmv2/index.d.ts +1 -1
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-Cxd3zrUS.d.mts → index-DaI1orpy.d.mts} +27 -1
- package/dist/{index-Cxd3zrUS.d.ts → index-DaI1orpy.d.ts} +27 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/compilerPlugin.js
CHANGED
|
@@ -401,6 +401,18 @@ var handleMaterialized = (t, checker) => {
|
|
|
401
401
|
}
|
|
402
402
|
return materializedType.value;
|
|
403
403
|
};
|
|
404
|
+
var handleAlias = (t, checker) => {
|
|
405
|
+
const aliasType = getTaggedType(t, checker, "_clickhouse_alias");
|
|
406
|
+
if (aliasType === null) {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
if (!aliasType.isStringLiteral()) {
|
|
410
|
+
throw new UnsupportedFeature(
|
|
411
|
+
'ClickHouseAlias must use a string literal, e.g. ClickHouseAlias<"toDate(timestamp)">'
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
return aliasType.value;
|
|
415
|
+
};
|
|
404
416
|
var handleTtl = (t, checker) => {
|
|
405
417
|
const ttlType = getTaggedType(t, checker, "_clickhouse_ttl");
|
|
406
418
|
if (ttlType === null) {
|
|
@@ -893,9 +905,18 @@ var toColumns = (t, checker, options) => {
|
|
|
893
905
|
);
|
|
894
906
|
const defaultValue = defaultExpression ?? handleDefault(type, checker);
|
|
895
907
|
const materializedValue = handleMaterialized(type, checker);
|
|
896
|
-
|
|
908
|
+
const aliasValue = handleAlias(type, checker);
|
|
909
|
+
const setCount = [defaultValue, materializedValue, aliasValue].filter(
|
|
910
|
+
(v) => v != null
|
|
911
|
+
).length;
|
|
912
|
+
if (setCount > 1) {
|
|
913
|
+
throw new UnsupportedFeature(
|
|
914
|
+
`Column '${prop.name}' can only have one of ClickHouseDefault, ClickHouseMaterialized, or ClickHouseAlias.`
|
|
915
|
+
);
|
|
916
|
+
}
|
|
917
|
+
if (aliasValue != null && isKey) {
|
|
897
918
|
throw new UnsupportedFeature(
|
|
898
|
-
`Column '${prop.name}' cannot
|
|
919
|
+
`Column '${prop.name}' cannot be a primary key when using ClickHouseAlias.`
|
|
899
920
|
);
|
|
900
921
|
}
|
|
901
922
|
const docComment = prop.getDocumentationComment(checker);
|
|
@@ -908,6 +929,7 @@ var toColumns = (t, checker, options) => {
|
|
|
908
929
|
unique: false,
|
|
909
930
|
default: defaultValue,
|
|
910
931
|
materialized: materializedValue,
|
|
932
|
+
alias: aliasValue,
|
|
911
933
|
ttl: handleTtl(type, checker),
|
|
912
934
|
codec: handleCodec(type, checker),
|
|
913
935
|
annotations,
|