@bayoudhi/moose-lib-serverless 0.7.12 → 0.7.13
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.ts +5 -4
- package/dist/compilerPlugin.js +115 -9
- package/dist/index-Cs6mRtl7.d.ts +1305 -0
- package/dist/index.d.mts +771 -17
- package/dist/index.d.ts +771 -17
- package/dist/index.js +5523 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5572 -195
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +10364 -4240
- package/dist/moose-tspc.js +7 -56
- package/dist/view-CNYx8kUh.d.ts +1327 -0
- package/package.json +2 -2
- package/dist/index-DdE-_e4q.d.ts +0 -2412
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { A as Aggregated,
|
|
1
|
+
export { A as Aggregated, f as Api, g as ApiConfig, R as ApiUtil, C as ConsumptionApi, U as ConsumptionUtil, c as DeadLetter, D as DeadLetterModel, d as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, e as IngestConfig, h as IngestPipeline, M as MaterializedView, j as SelectRowPolicy, k as SelectRowPolicyConfig, S as SimpleAggregated, i as SqlResource, a as Stream, b as StreamConfig, T as Task, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, N as getMaterializedView, O as getMaterializedViews, P as getSelectRowPolicies, Q as getSelectRowPolicy, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, K as getView, L as getViews, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from './index-Cs6mRtl7';
|
|
2
|
+
export { n as ClickHouseAlias, d as ClickHouseByteSize, o as ClickHouseCodec, c as ClickHouseDecimal, k as ClickHouseDefault, C as ClickHouseEngines, e as ClickHouseFixedStringSize, f as ClickHouseFloat, g as ClickHouseInt, h as ClickHouseJson, m as ClickHouseMaterialized, j as ClickHouseNamedTuple, b as ClickHousePrecision, l as ClickHouseTTL, D as DateTime, p as DateTime64, r as DateTime64String, q as DateTimeString, A as Decimal, F as FixedString, s as Float32, t as Float64, G as IdentifierBrandedString, B as Insertable, u as Int16, v as Int32, w as Int64, I as Int8, L as LifeCycle, i as LowCardinality, N as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, R as RawValue, S as S3QueueTableSettings, M as Sql, J as SqlTemplateTag, x as UInt16, y as UInt32, z as UInt64, U as UInt8, H as Value, V as View, W as WithDefault, Y as createClickhouseParameter, X as getValueFromParameter, Z as mapToClickHouseType, E as quoteIdentifier, K as sql, Q as toQuery, T as toQueryPreview, P as toStaticQuery } from './view-CNYx8kUh';
|
|
2
3
|
import 'typia';
|
|
3
|
-
import 'typia/lib/tags';
|
|
4
|
-
import 'node:stream';
|
|
5
|
-
import '@clickhouse/client';
|
|
6
4
|
import 'jose';
|
|
7
5
|
import 'http';
|
|
6
|
+
import '@clickhouse/client';
|
|
7
|
+
import 'typia/lib/tags';
|
|
8
|
+
import 'node:stream';
|
|
8
9
|
|
|
9
10
|
type Key<T extends string | number | Date> = T;
|
|
10
11
|
type JWT<T extends object> = T;
|
package/dist/compilerPlugin.js
CHANGED
|
@@ -439,6 +439,18 @@ var handleMaterialized = (t, checker) => {
|
|
|
439
439
|
}
|
|
440
440
|
return materializedType.value;
|
|
441
441
|
};
|
|
442
|
+
var handleAlias = (t, checker) => {
|
|
443
|
+
const aliasType = getTaggedType(t, checker, "_clickhouse_alias");
|
|
444
|
+
if (aliasType === null) {
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
if (!aliasType.isStringLiteral()) {
|
|
448
|
+
throw new UnsupportedFeature(
|
|
449
|
+
'ClickHouseAlias must use a string literal, e.g. ClickHouseAlias<"toDate(timestamp)">'
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
return aliasType.value;
|
|
453
|
+
};
|
|
442
454
|
var handleTtl = (t, checker) => {
|
|
443
455
|
const ttlType = getTaggedType(t, checker, "_clickhouse_ttl");
|
|
444
456
|
if (ttlType === null) {
|
|
@@ -931,9 +943,18 @@ var toColumns = (t, checker, options) => {
|
|
|
931
943
|
);
|
|
932
944
|
const defaultValue = defaultExpression ?? handleDefault(type, checker);
|
|
933
945
|
const materializedValue = handleMaterialized(type, checker);
|
|
934
|
-
|
|
946
|
+
const aliasValue = handleAlias(type, checker);
|
|
947
|
+
const setCount = [defaultValue, materializedValue, aliasValue].filter(
|
|
948
|
+
(v) => v != null
|
|
949
|
+
).length;
|
|
950
|
+
if (setCount > 1) {
|
|
951
|
+
throw new UnsupportedFeature(
|
|
952
|
+
`Column '${prop.name}' can only have one of ClickHouseDefault, ClickHouseMaterialized, or ClickHouseAlias.`
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
if (aliasValue != null && isKey) {
|
|
935
956
|
throw new UnsupportedFeature(
|
|
936
|
-
`Column '${prop.name}' cannot
|
|
957
|
+
`Column '${prop.name}' cannot be a primary key when using ClickHouseAlias.`
|
|
937
958
|
);
|
|
938
959
|
}
|
|
939
960
|
const docComment = prop.getDocumentationComment(checker);
|
|
@@ -946,6 +967,7 @@ var toColumns = (t, checker, options) => {
|
|
|
946
967
|
unique: false,
|
|
947
968
|
default: defaultValue,
|
|
948
969
|
materialized: materializedValue,
|
|
970
|
+
alias: aliasValue,
|
|
949
971
|
ttl: handleTtl(type, checker),
|
|
950
972
|
codec: handleCodec(type, checker),
|
|
951
973
|
annotations,
|
|
@@ -1026,6 +1048,50 @@ var generateAssertFunction = (ctx, type, typeName) => {
|
|
|
1026
1048
|
config: { equals: false, guard: false }
|
|
1027
1049
|
});
|
|
1028
1050
|
};
|
|
1051
|
+
var getPropertyName = (prop) => prop.key.constants?.[0]?.values?.[0]?.value;
|
|
1052
|
+
var patchMetadataForInsert = (metadata, computedColumns, defaultColumns) => {
|
|
1053
|
+
for (const obj of metadata.objects) {
|
|
1054
|
+
const keep = [];
|
|
1055
|
+
for (const prop of obj.type.properties) {
|
|
1056
|
+
const name = getPropertyName(prop);
|
|
1057
|
+
if (name !== void 0 && computedColumns.has(name)) continue;
|
|
1058
|
+
if (name !== void 0 && defaultColumns.has(name)) {
|
|
1059
|
+
prop.value.optional = true;
|
|
1060
|
+
prop.value.required = false;
|
|
1061
|
+
}
|
|
1062
|
+
keep.push(prop);
|
|
1063
|
+
}
|
|
1064
|
+
obj.type.properties.length = 0;
|
|
1065
|
+
obj.type.properties.push(...keep);
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
var withInsertableMetadata = (columns, fn) => {
|
|
1069
|
+
const original = import_MetadataFactory.MetadataFactory.analyze;
|
|
1070
|
+
import_MetadataFactory.MetadataFactory.analyze = (props) => {
|
|
1071
|
+
const result = original(props);
|
|
1072
|
+
if (result.success) {
|
|
1073
|
+
patchMetadataForInsert(result.data, columns.computed, columns.defaults);
|
|
1074
|
+
}
|
|
1075
|
+
return result;
|
|
1076
|
+
};
|
|
1077
|
+
try {
|
|
1078
|
+
return fn();
|
|
1079
|
+
} finally {
|
|
1080
|
+
import_MetadataFactory.MetadataFactory.analyze = original;
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
var generateInsertValidateFunction = (ctx, type, columns, typeName) => withInsertableMetadata(
|
|
1084
|
+
columns,
|
|
1085
|
+
() => generateValidateFunction(ctx, type, typeName)
|
|
1086
|
+
);
|
|
1087
|
+
var generateInsertIsFunction = (ctx, type, columns, typeName) => withInsertableMetadata(
|
|
1088
|
+
columns,
|
|
1089
|
+
() => generateIsFunction(ctx, type, typeName)
|
|
1090
|
+
);
|
|
1091
|
+
var generateInsertAssertFunction = (ctx, type, columns, typeName) => withInsertableMetadata(
|
|
1092
|
+
columns,
|
|
1093
|
+
() => generateAssertFunction(ctx, type, typeName)
|
|
1094
|
+
);
|
|
1029
1095
|
var generateHttpAssertQueryFunction = (ctx, type, typeName) => {
|
|
1030
1096
|
const typiaCtx = toTypiaContext(ctx);
|
|
1031
1097
|
return import_HttpAssertQueryProgrammer.HttpAssertQueryProgrammer.write({
|
|
@@ -1227,18 +1293,16 @@ var transformNewMooseResource = (node, checker, ctx) => {
|
|
|
1227
1293
|
}
|
|
1228
1294
|
const typiaCtx = ctx.typiaContext;
|
|
1229
1295
|
let internalArguments;
|
|
1296
|
+
let columns;
|
|
1230
1297
|
if (typeName === "DeadLetterQueue") {
|
|
1231
1298
|
internalArguments = [generateAssertFunction(typiaCtx, typeAtLocation)];
|
|
1232
1299
|
} else {
|
|
1300
|
+
columns = toColumns(typeAtLocation, checker, {
|
|
1301
|
+
allowIndexSignatures
|
|
1302
|
+
});
|
|
1233
1303
|
internalArguments = [
|
|
1234
1304
|
generateJsonSchemas(typiaCtx, typeAtLocation),
|
|
1235
|
-
parseAsAny(
|
|
1236
|
-
JSON.stringify(
|
|
1237
|
-
toColumns(typeAtLocation, checker, {
|
|
1238
|
-
allowIndexSignatures
|
|
1239
|
-
})
|
|
1240
|
-
)
|
|
1241
|
-
)
|
|
1305
|
+
parseAsAny(JSON.stringify(columns))
|
|
1242
1306
|
];
|
|
1243
1307
|
}
|
|
1244
1308
|
const resourceName = checker.getSymbolAtLocation(node.expression).name;
|
|
@@ -1270,6 +1334,48 @@ var transformNewMooseResource = (node, checker, ctx) => {
|
|
|
1270
1334
|
true
|
|
1271
1335
|
);
|
|
1272
1336
|
updatedArgs = [...updatedArgs, validatorsObject];
|
|
1337
|
+
if (resourceName === "OlapTable" && columns) {
|
|
1338
|
+
const insertColumnSets = {
|
|
1339
|
+
computed: new Set(
|
|
1340
|
+
columns.filter((c) => c.alias != null || c.materialized != null).map((c) => c.name)
|
|
1341
|
+
),
|
|
1342
|
+
defaults: new Set(
|
|
1343
|
+
columns.filter((c) => c.default != null).map((c) => c.name)
|
|
1344
|
+
)
|
|
1345
|
+
};
|
|
1346
|
+
const insertValidatorsObject = import_typescript5.factory.createObjectLiteralExpression(
|
|
1347
|
+
[
|
|
1348
|
+
import_typescript5.factory.createPropertyAssignment(
|
|
1349
|
+
import_typescript5.factory.createIdentifier("validate"),
|
|
1350
|
+
wrapValidateFunction(
|
|
1351
|
+
generateInsertValidateFunction(
|
|
1352
|
+
typiaCtx,
|
|
1353
|
+
typeAtLocation,
|
|
1354
|
+
insertColumnSets
|
|
1355
|
+
)
|
|
1356
|
+
)
|
|
1357
|
+
),
|
|
1358
|
+
import_typescript5.factory.createPropertyAssignment(
|
|
1359
|
+
import_typescript5.factory.createIdentifier("assert"),
|
|
1360
|
+
generateInsertAssertFunction(
|
|
1361
|
+
typiaCtx,
|
|
1362
|
+
typeAtLocation,
|
|
1363
|
+
insertColumnSets
|
|
1364
|
+
)
|
|
1365
|
+
),
|
|
1366
|
+
import_typescript5.factory.createPropertyAssignment(
|
|
1367
|
+
import_typescript5.factory.createIdentifier("is"),
|
|
1368
|
+
generateInsertIsFunction(
|
|
1369
|
+
typiaCtx,
|
|
1370
|
+
typeAtLocation,
|
|
1371
|
+
insertColumnSets
|
|
1372
|
+
)
|
|
1373
|
+
)
|
|
1374
|
+
],
|
|
1375
|
+
true
|
|
1376
|
+
);
|
|
1377
|
+
updatedArgs = [...updatedArgs, insertValidatorsObject];
|
|
1378
|
+
}
|
|
1273
1379
|
if (resourceName === "IngestPipeline") {
|
|
1274
1380
|
updatedArgs = [
|
|
1275
1381
|
...updatedArgs,
|