@514labs/moose-lib 0.6.457 → 0.6.458

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.
@@ -1,4 +1,4 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, aq as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, a5 as ClickHouseMaterialized, a2 as ClickHouseNamedTuple, U as ClickHousePrecision, a4 as ClickHouseTTL, j as ConsumptionApi, ar as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, at as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ap as Insertable, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, au as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, aw as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, az as Sql, l as SqlResource, ax as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, av as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aE as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aD as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aF as mapToClickHouseType, as as quoteIdentifier, ay as sql, aB as toQuery, aC as toQueryPreview, aA as toStaticQuery } from './index-FbIy0gSU.mjs';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, au as ApiUtil, aa as ClickHouseAlias, a0 as ClickHouseByteSize, ac as ClickHouseCodec, $ as ClickHouseDecimal, a7 as ClickHouseDefault, C as ClickHouseEngines, a1 as ClickHouseFixedStringSize, a2 as ClickHouseFloat, a3 as ClickHouseInt, a4 as ClickHouseJson, a9 as ClickHouseMaterialized, a6 as ClickHouseNamedTuple, _ as ClickHousePrecision, a8 as ClickHouseTTL, j as ConsumptionApi, av as ConsumptionUtil, ad as DateTime, ae as DateTime64, ag as DateTime64String, af as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, as as Decimal, o as ETLPipeline, p as ETLPipelineConfig, E as EgressConfig, ah as FixedString, ai as Float32, aj as Float64, F as FrameworkApp, ax as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, at as Insertable, al as Int16, am as Int32, an as Int64, ak as Int8, L as LifeCycle, a5 as LowCardinality, M as MaterializedView, ay as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, aA as RawValue, b as S3QueueTableSettings, m as SelectRowPolicy, n as SelectRowPolicyConfig, S as SimpleAggregated, aD as Sql, l as SqlResource, aB as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, ap as UInt16, aq as UInt32, ar as UInt64, ao as UInt8, az as Value, V as View, q as WebApp, r as WebAppConfig, s as WebAppHandler, ab as WithDefault, W as Workflow, aI as createClickhouseParameter, B as getApi, z as getApis, y as getIngestApi, x as getIngestApis, U as getMaterializedView, X as getMaterializedViews, Y as getSelectRowPolicies, Z as getSelectRowPolicy, H as getSqlResource, G as getSqlResources, w as getStream, v as getStreams, u as getTable, t as getTables, aH as getValueFromParameter, Q as getView, R as getViews, P as getWebApp, N as getWebApps, K as getWorkflow, J as getWorkflows, aJ as mapToClickHouseType, aw as quoteIdentifier, aC as sql, aF as toQuery, aG as toQueryPreview, aE as toStaticQuery } from './index-BkvEUvtm.mjs';
2
2
  import 'typia';
3
3
  import 'typia/lib/tags';
4
4
  import 'node:stream';
@@ -1,4 +1,4 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, aq as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, a5 as ClickHouseMaterialized, a2 as ClickHouseNamedTuple, U as ClickHousePrecision, a4 as ClickHouseTTL, j as ConsumptionApi, ar as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, at as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ap as Insertable, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, au as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, aw as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, az as Sql, l as SqlResource, ax as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, av as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aE as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aD as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aF as mapToClickHouseType, as as quoteIdentifier, ay as sql, aB as toQuery, aC as toQueryPreview, aA as toStaticQuery } from './index-FbIy0gSU.js';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, au as ApiUtil, aa as ClickHouseAlias, a0 as ClickHouseByteSize, ac as ClickHouseCodec, $ as ClickHouseDecimal, a7 as ClickHouseDefault, C as ClickHouseEngines, a1 as ClickHouseFixedStringSize, a2 as ClickHouseFloat, a3 as ClickHouseInt, a4 as ClickHouseJson, a9 as ClickHouseMaterialized, a6 as ClickHouseNamedTuple, _ as ClickHousePrecision, a8 as ClickHouseTTL, j as ConsumptionApi, av as ConsumptionUtil, ad as DateTime, ae as DateTime64, ag as DateTime64String, af as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, as as Decimal, o as ETLPipeline, p as ETLPipelineConfig, E as EgressConfig, ah as FixedString, ai as Float32, aj as Float64, F as FrameworkApp, ax as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, at as Insertable, al as Int16, am as Int32, an as Int64, ak as Int8, L as LifeCycle, a5 as LowCardinality, M as MaterializedView, ay as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, aA as RawValue, b as S3QueueTableSettings, m as SelectRowPolicy, n as SelectRowPolicyConfig, S as SimpleAggregated, aD as Sql, l as SqlResource, aB as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, ap as UInt16, aq as UInt32, ar as UInt64, ao as UInt8, az as Value, V as View, q as WebApp, r as WebAppConfig, s as WebAppHandler, ab as WithDefault, W as Workflow, aI as createClickhouseParameter, B as getApi, z as getApis, y as getIngestApi, x as getIngestApis, U as getMaterializedView, X as getMaterializedViews, Y as getSelectRowPolicies, Z as getSelectRowPolicy, H as getSqlResource, G as getSqlResources, w as getStream, v as getStreams, u as getTable, t as getTables, aH as getValueFromParameter, Q as getView, R as getViews, P as getWebApp, N as getWebApps, K as getWorkflow, J as getWorkflows, aJ as mapToClickHouseType, aw as quoteIdentifier, aC as sql, aF as toQuery, aG as toQueryPreview, aE as toStaticQuery } from './index-BkvEUvtm.js';
2
2
  import 'typia';
3
3
  import 'typia/lib/tags';
4
4
  import 'node:stream';
@@ -395,13 +395,17 @@ var init_runtime = __esm({
395
395
  const envUseSSL = this._parseBool(
396
396
  this._env("MOOSE_CLICKHOUSE_CONFIG__USE_SSL")
397
397
  );
398
+ const envRlsUser = this._env("MOOSE_CLICKHOUSE_CONFIG__RLS_USER");
399
+ const envRlsPassword = this._env("MOOSE_CLICKHOUSE_CONFIG__RLS_PASSWORD");
398
400
  return {
399
401
  host: envHost ?? projectConfig.clickhouse_config.host,
400
402
  port: envPort ?? projectConfig.clickhouse_config.host_port.toString(),
401
403
  username: envUser ?? projectConfig.clickhouse_config.user,
402
404
  password: envPassword ?? projectConfig.clickhouse_config.password,
403
405
  database: envDb ?? projectConfig.clickhouse_config.db_name,
404
- useSSL: envUseSSL !== void 0 ? envUseSSL : projectConfig.clickhouse_config.use_ssl || false
406
+ useSSL: envUseSSL !== void 0 ? envUseSSL : projectConfig.clickhouse_config.use_ssl || false,
407
+ rlsUser: envRlsUser ?? projectConfig.clickhouse_config.rls_user ?? void 0,
408
+ rlsPassword: envRlsPassword ?? projectConfig.clickhouse_config.rls_password ?? void 0
405
409
  };
406
410
  }
407
411
  async getStandaloneClickhouseConfig(overrides) {
@@ -416,6 +420,8 @@ var init_runtime = __esm({
416
420
  const envUseSSL = this._parseBool(
417
421
  this._env("MOOSE_CLICKHOUSE_CONFIG__USE_SSL")
418
422
  );
423
+ const envRlsUser = this._env("MOOSE_CLICKHOUSE_CONFIG__RLS_USER");
424
+ const envRlsPassword = this._env("MOOSE_CLICKHOUSE_CONFIG__RLS_PASSWORD");
419
425
  let projectConfig;
420
426
  try {
421
427
  projectConfig = await readProjectConfig();
@@ -436,7 +442,9 @@ var init_runtime = __esm({
436
442
  username: overrides?.username ?? envUser ?? projectConfig?.clickhouse_config.user ?? defaults.username,
437
443
  password: overrides?.password ?? envPassword ?? projectConfig?.clickhouse_config.password ?? defaults.password,
438
444
  database: overrides?.database ?? envDb ?? projectConfig?.clickhouse_config.db_name ?? defaults.database,
439
- useSSL: overrides?.useSSL ?? envUseSSL ?? projectConfig?.clickhouse_config.use_ssl ?? defaults.useSSL
445
+ useSSL: overrides?.useSSL ?? envUseSSL ?? projectConfig?.clickhouse_config.use_ssl ?? defaults.useSSL,
446
+ rlsUser: envRlsUser ?? projectConfig?.clickhouse_config.rls_user ?? void 0,
447
+ rlsPassword: envRlsPassword ?? projectConfig?.clickhouse_config.rls_password ?? void 0
440
448
  };
441
449
  }
442
450
  async getKafkaConfig() {
@@ -485,6 +493,7 @@ __export(browserCompatible_exports, {
485
493
  LifeCycle: () => LifeCycle,
486
494
  MaterializedView: () => MaterializedView,
487
495
  OlapTable: () => OlapTable2,
496
+ SelectRowPolicy: () => SelectRowPolicy,
488
497
  Sql: () => Sql,
489
498
  SqlResource: () => SqlResource,
490
499
  Stream: () => Stream,
@@ -499,6 +508,8 @@ __export(browserCompatible_exports, {
499
508
  getIngestApis: () => getIngestApis,
500
509
  getMaterializedView: () => getMaterializedView,
501
510
  getMaterializedViews: () => getMaterializedViews,
511
+ getSelectRowPolicies: () => getSelectRowPolicies,
512
+ getSelectRowPolicy: () => getSelectRowPolicy,
502
513
  getSqlResource: () => getSqlResource,
503
514
  getSqlResources: () => getSqlResources,
504
515
  getStream: () => getStream,
@@ -882,6 +893,93 @@ var import_redis = require("redis");
882
893
  // src/consumption-apis/standalone.ts
883
894
  init_commons();
884
895
 
896
+ // src/dmv2/registry.ts
897
+ function getTables() {
898
+ return getMooseInternal().tables;
899
+ }
900
+ function getTable(name) {
901
+ return getMooseInternal().tables.get(name);
902
+ }
903
+ function getStreams() {
904
+ return getMooseInternal().streams;
905
+ }
906
+ function getStream(name) {
907
+ return getMooseInternal().streams.get(name);
908
+ }
909
+ function getIngestApis() {
910
+ return getMooseInternal().ingestApis;
911
+ }
912
+ function getIngestApi(name) {
913
+ return getMooseInternal().ingestApis.get(name);
914
+ }
915
+ function getApis() {
916
+ return getMooseInternal().apis;
917
+ }
918
+ function getApi(nameOrPath) {
919
+ const registry = getMooseInternal();
920
+ const directMatch = registry.apis.get(nameOrPath);
921
+ if (directMatch) {
922
+ return directMatch;
923
+ }
924
+ const versionedApis = /* @__PURE__ */ new Map();
925
+ const pathMap = /* @__PURE__ */ new Map();
926
+ registry.apis.forEach((api, key) => {
927
+ const baseName = api.name;
928
+ if (!versionedApis.has(baseName)) {
929
+ versionedApis.set(baseName, []);
930
+ }
931
+ versionedApis.get(baseName).push(api);
932
+ if (api.config.path) {
933
+ pathMap.set(api.config.path, api);
934
+ }
935
+ });
936
+ const candidates = versionedApis.get(nameOrPath);
937
+ if (candidates && candidates.length === 1) {
938
+ return candidates[0];
939
+ }
940
+ return pathMap.get(nameOrPath);
941
+ }
942
+ function getSqlResources() {
943
+ return getMooseInternal().sqlResources;
944
+ }
945
+ function getSqlResource(name) {
946
+ return getMooseInternal().sqlResources.get(name);
947
+ }
948
+ function getWorkflows2() {
949
+ return getMooseInternal().workflows;
950
+ }
951
+ function getWorkflow(name) {
952
+ return getMooseInternal().workflows.get(name);
953
+ }
954
+ function getWebApps() {
955
+ return getMooseInternal().webApps;
956
+ }
957
+ function getWebApp(name) {
958
+ return getMooseInternal().webApps.get(name);
959
+ }
960
+ function getMaterializedViews() {
961
+ return getMooseInternal().materializedViews;
962
+ }
963
+ function getMaterializedView(name) {
964
+ return getMooseInternal().materializedViews.get(name);
965
+ }
966
+ function getViews() {
967
+ return getMooseInternal().views;
968
+ }
969
+ function getView(name) {
970
+ return getMooseInternal().views.get(name);
971
+ }
972
+ function getSelectRowPolicies() {
973
+ return getMooseInternal().selectRowPolicies;
974
+ }
975
+ function getSelectRowPolicy(name) {
976
+ return getMooseInternal().selectRowPolicies.get(name);
977
+ }
978
+
979
+ // src/consumption-apis/standalone.ts
980
+ var import_node_async_hooks = require("async_hooks");
981
+ var requestContextStorage = new import_node_async_hooks.AsyncLocalStorage();
982
+
885
983
  // src/utilities/dataParser.ts
886
984
  var import_csv_parse = require("csv-parse");
887
985
  var CSV_DELIMITERS = {
@@ -1073,7 +1171,8 @@ function createRegistryFrom(existing) {
1073
1171
  workflows: toTrackingMap(existing?.workflows),
1074
1172
  webApps: toTrackingMap(existing?.webApps),
1075
1173
  materializedViews: toTrackingMap(existing?.materializedViews),
1076
- views: toTrackingMap(existing?.views)
1174
+ views: toTrackingMap(existing?.views),
1175
+ selectRowPolicies: toTrackingMap(existing?.selectRowPolicies)
1077
1176
  };
1078
1177
  }
1079
1178
  var moose_internal = {
@@ -1109,7 +1208,11 @@ var moose_internal = {
1109
1208
  void 0,
1110
1209
  markRegistryMutated
1111
1210
  ),
1112
- views: new MutationTrackingMap(void 0, markRegistryMutated)
1211
+ views: new MutationTrackingMap(void 0, markRegistryMutated),
1212
+ selectRowPolicies: new MutationTrackingMap(
1213
+ void 0,
1214
+ markRegistryMutated
1215
+ )
1113
1216
  };
1114
1217
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
1115
1218
  var initializeMooseInternalRegistry = () => {
@@ -1296,10 +1399,7 @@ var OlapTable2 = class extends TypedBase {
1296
1399
  }
1297
1400
  tables.set(registryKey, this);
1298
1401
  }
1299
- /**
1300
- * Generates the versioned table name following Moose's naming convention
1301
- * Format: {tableName}_{version_with_dots_replaced_by_underscores}
1302
- */
1402
+ /** @internal Returns the versioned ClickHouse table name (e.g., "events_1_0_0") */
1303
1403
  generateTableName() {
1304
1404
  if (this._cachedTableName) {
1305
1405
  return this._cachedTableName;
@@ -3008,6 +3108,47 @@ var View = class {
3008
3108
  }
3009
3109
  };
3010
3110
 
3111
+ // src/dmv2/sdk/selectRowPolicy.ts
3112
+ var SelectRowPolicy = class {
3113
+ /** @internal */
3114
+ kind = "SelectRowPolicy";
3115
+ /** The name of the row policy */
3116
+ name;
3117
+ /** The policy configuration */
3118
+ config;
3119
+ constructor(name, config) {
3120
+ if (!name.trim()) {
3121
+ throw new Error("SelectRowPolicy name must not be empty");
3122
+ }
3123
+ if (!config.tables.length) {
3124
+ throw new Error(`SelectRowPolicy '${name}': tables must not be empty`);
3125
+ }
3126
+ if (!config.column.trim()) {
3127
+ throw new Error(`SelectRowPolicy '${name}': column must not be empty`);
3128
+ }
3129
+ if (!config.claim.trim()) {
3130
+ throw new Error(`SelectRowPolicy '${name}': claim must not be empty`);
3131
+ }
3132
+ this.name = name;
3133
+ this.config = Object.freeze({
3134
+ ...config,
3135
+ tables: Object.freeze([...config.tables])
3136
+ });
3137
+ const selectRowPolicies = getMooseInternal().selectRowPolicies;
3138
+ if (!isClientOnlyMode() && selectRowPolicies.has(this.name)) {
3139
+ throw new Error(`SelectRowPolicy with name ${this.name} already exists`);
3140
+ }
3141
+ selectRowPolicies.set(this.name, this);
3142
+ }
3143
+ /** Resolved table references for serialization */
3144
+ get tableRefs() {
3145
+ return this.config.tables.map((t) => ({
3146
+ name: t.generateTableName(),
3147
+ ...t.config.database ? { database: t.config.database } : {}
3148
+ }));
3149
+ }
3150
+ };
3151
+
3011
3152
  // src/dmv2/sdk/lifeCycle.ts
3012
3153
  var LifeCycle = /* @__PURE__ */ ((LifeCycle2) => {
3013
3154
  LifeCycle2["FULLY_MANAGED"] = "FULLY_MANAGED";
@@ -3142,83 +3283,6 @@ Examples:
3142
3283
  return this._rawApp;
3143
3284
  }
3144
3285
  };
3145
-
3146
- // src/dmv2/registry.ts
3147
- function getTables() {
3148
- return getMooseInternal().tables;
3149
- }
3150
- function getTable(name) {
3151
- return getMooseInternal().tables.get(name);
3152
- }
3153
- function getStreams() {
3154
- return getMooseInternal().streams;
3155
- }
3156
- function getStream(name) {
3157
- return getMooseInternal().streams.get(name);
3158
- }
3159
- function getIngestApis() {
3160
- return getMooseInternal().ingestApis;
3161
- }
3162
- function getIngestApi(name) {
3163
- return getMooseInternal().ingestApis.get(name);
3164
- }
3165
- function getApis() {
3166
- return getMooseInternal().apis;
3167
- }
3168
- function getApi(nameOrPath) {
3169
- const registry = getMooseInternal();
3170
- const directMatch = registry.apis.get(nameOrPath);
3171
- if (directMatch) {
3172
- return directMatch;
3173
- }
3174
- const versionedApis = /* @__PURE__ */ new Map();
3175
- const pathMap = /* @__PURE__ */ new Map();
3176
- registry.apis.forEach((api, key) => {
3177
- const baseName = api.name;
3178
- if (!versionedApis.has(baseName)) {
3179
- versionedApis.set(baseName, []);
3180
- }
3181
- versionedApis.get(baseName).push(api);
3182
- if (api.config.path) {
3183
- pathMap.set(api.config.path, api);
3184
- }
3185
- });
3186
- const candidates = versionedApis.get(nameOrPath);
3187
- if (candidates && candidates.length === 1) {
3188
- return candidates[0];
3189
- }
3190
- return pathMap.get(nameOrPath);
3191
- }
3192
- function getSqlResources() {
3193
- return getMooseInternal().sqlResources;
3194
- }
3195
- function getSqlResource(name) {
3196
- return getMooseInternal().sqlResources.get(name);
3197
- }
3198
- function getWorkflows2() {
3199
- return getMooseInternal().workflows;
3200
- }
3201
- function getWorkflow(name) {
3202
- return getMooseInternal().workflows.get(name);
3203
- }
3204
- function getWebApps() {
3205
- return getMooseInternal().webApps;
3206
- }
3207
- function getWebApp(name) {
3208
- return getMooseInternal().webApps.get(name);
3209
- }
3210
- function getMaterializedViews() {
3211
- return getMooseInternal().materializedViews;
3212
- }
3213
- function getMaterializedView(name) {
3214
- return getMooseInternal().materializedViews.get(name);
3215
- }
3216
- function getViews() {
3217
- return getMooseInternal().views;
3218
- }
3219
- function getView(name) {
3220
- return getMooseInternal().views.get(name);
3221
- }
3222
3286
  // Annotate the CommonJS export names for ESM import in node:
3223
3287
  0 && (module.exports = {
3224
3288
  Api,
@@ -3231,6 +3295,7 @@ function getView(name) {
3231
3295
  LifeCycle,
3232
3296
  MaterializedView,
3233
3297
  OlapTable,
3298
+ SelectRowPolicy,
3234
3299
  Sql,
3235
3300
  SqlResource,
3236
3301
  Stream,
@@ -3245,6 +3310,8 @@ function getView(name) {
3245
3310
  getIngestApis,
3246
3311
  getMaterializedView,
3247
3312
  getMaterializedViews,
3313
+ getSelectRowPolicies,
3314
+ getSelectRowPolicy,
3248
3315
  getSqlResource,
3249
3316
  getSqlResources,
3250
3317
  getStream,