@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.
- package/dist/browserCompatible.d.mts +1 -1
- package/dist/browserCompatible.d.ts +1 -1
- package/dist/browserCompatible.js +152 -85
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +149 -85
- package/dist/browserCompatible.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 +152 -85
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +149 -85
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-FbIy0gSU.d.mts → index-BkvEUvtm.d.mts} +107 -7
- package/dist/{index-FbIy0gSU.d.ts → index-BkvEUvtm.d.ts} +107 -7
- package/dist/index.d.mts +17 -15
- package/dist/index.d.ts +17 -15
- package/dist/index.js +223 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +216 -42
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +337 -98
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +339 -100
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -384,13 +384,17 @@ var init_runtime = __esm({
|
|
|
384
384
|
const envUseSSL = this._parseBool(
|
|
385
385
|
this._env("MOOSE_CLICKHOUSE_CONFIG__USE_SSL")
|
|
386
386
|
);
|
|
387
|
+
const envRlsUser = this._env("MOOSE_CLICKHOUSE_CONFIG__RLS_USER");
|
|
388
|
+
const envRlsPassword = this._env("MOOSE_CLICKHOUSE_CONFIG__RLS_PASSWORD");
|
|
387
389
|
return {
|
|
388
390
|
host: envHost ?? projectConfig.clickhouse_config.host,
|
|
389
391
|
port: envPort ?? projectConfig.clickhouse_config.host_port.toString(),
|
|
390
392
|
username: envUser ?? projectConfig.clickhouse_config.user,
|
|
391
393
|
password: envPassword ?? projectConfig.clickhouse_config.password,
|
|
392
394
|
database: envDb ?? projectConfig.clickhouse_config.db_name,
|
|
393
|
-
useSSL: envUseSSL !== void 0 ? envUseSSL : projectConfig.clickhouse_config.use_ssl || false
|
|
395
|
+
useSSL: envUseSSL !== void 0 ? envUseSSL : projectConfig.clickhouse_config.use_ssl || false,
|
|
396
|
+
rlsUser: envRlsUser ?? projectConfig.clickhouse_config.rls_user ?? void 0,
|
|
397
|
+
rlsPassword: envRlsPassword ?? projectConfig.clickhouse_config.rls_password ?? void 0
|
|
394
398
|
};
|
|
395
399
|
}
|
|
396
400
|
async getStandaloneClickhouseConfig(overrides) {
|
|
@@ -405,6 +409,8 @@ var init_runtime = __esm({
|
|
|
405
409
|
const envUseSSL = this._parseBool(
|
|
406
410
|
this._env("MOOSE_CLICKHOUSE_CONFIG__USE_SSL")
|
|
407
411
|
);
|
|
412
|
+
const envRlsUser = this._env("MOOSE_CLICKHOUSE_CONFIG__RLS_USER");
|
|
413
|
+
const envRlsPassword = this._env("MOOSE_CLICKHOUSE_CONFIG__RLS_PASSWORD");
|
|
408
414
|
let projectConfig;
|
|
409
415
|
try {
|
|
410
416
|
projectConfig = await readProjectConfig();
|
|
@@ -425,7 +431,9 @@ var init_runtime = __esm({
|
|
|
425
431
|
username: overrides?.username ?? envUser ?? projectConfig?.clickhouse_config.user ?? defaults.username,
|
|
426
432
|
password: overrides?.password ?? envPassword ?? projectConfig?.clickhouse_config.password ?? defaults.password,
|
|
427
433
|
database: overrides?.database ?? envDb ?? projectConfig?.clickhouse_config.db_name ?? defaults.database,
|
|
428
|
-
useSSL: overrides?.useSSL ?? envUseSSL ?? projectConfig?.clickhouse_config.use_ssl ?? defaults.useSSL
|
|
434
|
+
useSSL: overrides?.useSSL ?? envUseSSL ?? projectConfig?.clickhouse_config.use_ssl ?? defaults.useSSL,
|
|
435
|
+
rlsUser: envRlsUser ?? projectConfig?.clickhouse_config.rls_user ?? void 0,
|
|
436
|
+
rlsPassword: envRlsPassword ?? projectConfig?.clickhouse_config.rls_password ?? void 0
|
|
429
437
|
};
|
|
430
438
|
}
|
|
431
439
|
async getKafkaConfig() {
|
|
@@ -825,6 +833,93 @@ import { createClient as createClient2 } from "redis";
|
|
|
825
833
|
// src/consumption-apis/standalone.ts
|
|
826
834
|
init_commons();
|
|
827
835
|
|
|
836
|
+
// src/dmv2/registry.ts
|
|
837
|
+
function getTables() {
|
|
838
|
+
return getMooseInternal().tables;
|
|
839
|
+
}
|
|
840
|
+
function getTable(name) {
|
|
841
|
+
return getMooseInternal().tables.get(name);
|
|
842
|
+
}
|
|
843
|
+
function getStreams() {
|
|
844
|
+
return getMooseInternal().streams;
|
|
845
|
+
}
|
|
846
|
+
function getStream(name) {
|
|
847
|
+
return getMooseInternal().streams.get(name);
|
|
848
|
+
}
|
|
849
|
+
function getIngestApis() {
|
|
850
|
+
return getMooseInternal().ingestApis;
|
|
851
|
+
}
|
|
852
|
+
function getIngestApi(name) {
|
|
853
|
+
return getMooseInternal().ingestApis.get(name);
|
|
854
|
+
}
|
|
855
|
+
function getApis() {
|
|
856
|
+
return getMooseInternal().apis;
|
|
857
|
+
}
|
|
858
|
+
function getApi(nameOrPath) {
|
|
859
|
+
const registry = getMooseInternal();
|
|
860
|
+
const directMatch = registry.apis.get(nameOrPath);
|
|
861
|
+
if (directMatch) {
|
|
862
|
+
return directMatch;
|
|
863
|
+
}
|
|
864
|
+
const versionedApis = /* @__PURE__ */ new Map();
|
|
865
|
+
const pathMap = /* @__PURE__ */ new Map();
|
|
866
|
+
registry.apis.forEach((api, key) => {
|
|
867
|
+
const baseName = api.name;
|
|
868
|
+
if (!versionedApis.has(baseName)) {
|
|
869
|
+
versionedApis.set(baseName, []);
|
|
870
|
+
}
|
|
871
|
+
versionedApis.get(baseName).push(api);
|
|
872
|
+
if (api.config.path) {
|
|
873
|
+
pathMap.set(api.config.path, api);
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
const candidates = versionedApis.get(nameOrPath);
|
|
877
|
+
if (candidates && candidates.length === 1) {
|
|
878
|
+
return candidates[0];
|
|
879
|
+
}
|
|
880
|
+
return pathMap.get(nameOrPath);
|
|
881
|
+
}
|
|
882
|
+
function getSqlResources() {
|
|
883
|
+
return getMooseInternal().sqlResources;
|
|
884
|
+
}
|
|
885
|
+
function getSqlResource(name) {
|
|
886
|
+
return getMooseInternal().sqlResources.get(name);
|
|
887
|
+
}
|
|
888
|
+
function getWorkflows2() {
|
|
889
|
+
return getMooseInternal().workflows;
|
|
890
|
+
}
|
|
891
|
+
function getWorkflow(name) {
|
|
892
|
+
return getMooseInternal().workflows.get(name);
|
|
893
|
+
}
|
|
894
|
+
function getWebApps() {
|
|
895
|
+
return getMooseInternal().webApps;
|
|
896
|
+
}
|
|
897
|
+
function getWebApp(name) {
|
|
898
|
+
return getMooseInternal().webApps.get(name);
|
|
899
|
+
}
|
|
900
|
+
function getMaterializedViews() {
|
|
901
|
+
return getMooseInternal().materializedViews;
|
|
902
|
+
}
|
|
903
|
+
function getMaterializedView(name) {
|
|
904
|
+
return getMooseInternal().materializedViews.get(name);
|
|
905
|
+
}
|
|
906
|
+
function getViews() {
|
|
907
|
+
return getMooseInternal().views;
|
|
908
|
+
}
|
|
909
|
+
function getView(name) {
|
|
910
|
+
return getMooseInternal().views.get(name);
|
|
911
|
+
}
|
|
912
|
+
function getSelectRowPolicies() {
|
|
913
|
+
return getMooseInternal().selectRowPolicies;
|
|
914
|
+
}
|
|
915
|
+
function getSelectRowPolicy(name) {
|
|
916
|
+
return getMooseInternal().selectRowPolicies.get(name);
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// src/consumption-apis/standalone.ts
|
|
920
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
921
|
+
var requestContextStorage = new AsyncLocalStorage();
|
|
922
|
+
|
|
828
923
|
// src/utilities/dataParser.ts
|
|
829
924
|
import { parse } from "csv-parse";
|
|
830
925
|
var CSV_DELIMITERS = {
|
|
@@ -1016,7 +1111,8 @@ function createRegistryFrom(existing) {
|
|
|
1016
1111
|
workflows: toTrackingMap(existing?.workflows),
|
|
1017
1112
|
webApps: toTrackingMap(existing?.webApps),
|
|
1018
1113
|
materializedViews: toTrackingMap(existing?.materializedViews),
|
|
1019
|
-
views: toTrackingMap(existing?.views)
|
|
1114
|
+
views: toTrackingMap(existing?.views),
|
|
1115
|
+
selectRowPolicies: toTrackingMap(existing?.selectRowPolicies)
|
|
1020
1116
|
};
|
|
1021
1117
|
}
|
|
1022
1118
|
var moose_internal = {
|
|
@@ -1052,7 +1148,11 @@ var moose_internal = {
|
|
|
1052
1148
|
void 0,
|
|
1053
1149
|
markRegistryMutated
|
|
1054
1150
|
),
|
|
1055
|
-
views: new MutationTrackingMap(void 0, markRegistryMutated)
|
|
1151
|
+
views: new MutationTrackingMap(void 0, markRegistryMutated),
|
|
1152
|
+
selectRowPolicies: new MutationTrackingMap(
|
|
1153
|
+
void 0,
|
|
1154
|
+
markRegistryMutated
|
|
1155
|
+
)
|
|
1056
1156
|
};
|
|
1057
1157
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
1058
1158
|
var initializeMooseInternalRegistry = () => {
|
|
@@ -1239,10 +1339,7 @@ var OlapTable2 = class extends TypedBase {
|
|
|
1239
1339
|
}
|
|
1240
1340
|
tables.set(registryKey, this);
|
|
1241
1341
|
}
|
|
1242
|
-
/**
|
|
1243
|
-
* Generates the versioned table name following Moose's naming convention
|
|
1244
|
-
* Format: {tableName}_{version_with_dots_replaced_by_underscores}
|
|
1245
|
-
*/
|
|
1342
|
+
/** @internal Returns the versioned ClickHouse table name (e.g., "events_1_0_0") */
|
|
1246
1343
|
generateTableName() {
|
|
1247
1344
|
if (this._cachedTableName) {
|
|
1248
1345
|
return this._cachedTableName;
|
|
@@ -2951,6 +3048,47 @@ var View = class {
|
|
|
2951
3048
|
}
|
|
2952
3049
|
};
|
|
2953
3050
|
|
|
3051
|
+
// src/dmv2/sdk/selectRowPolicy.ts
|
|
3052
|
+
var SelectRowPolicy = class {
|
|
3053
|
+
/** @internal */
|
|
3054
|
+
kind = "SelectRowPolicy";
|
|
3055
|
+
/** The name of the row policy */
|
|
3056
|
+
name;
|
|
3057
|
+
/** The policy configuration */
|
|
3058
|
+
config;
|
|
3059
|
+
constructor(name, config) {
|
|
3060
|
+
if (!name.trim()) {
|
|
3061
|
+
throw new Error("SelectRowPolicy name must not be empty");
|
|
3062
|
+
}
|
|
3063
|
+
if (!config.tables.length) {
|
|
3064
|
+
throw new Error(`SelectRowPolicy '${name}': tables must not be empty`);
|
|
3065
|
+
}
|
|
3066
|
+
if (!config.column.trim()) {
|
|
3067
|
+
throw new Error(`SelectRowPolicy '${name}': column must not be empty`);
|
|
3068
|
+
}
|
|
3069
|
+
if (!config.claim.trim()) {
|
|
3070
|
+
throw new Error(`SelectRowPolicy '${name}': claim must not be empty`);
|
|
3071
|
+
}
|
|
3072
|
+
this.name = name;
|
|
3073
|
+
this.config = Object.freeze({
|
|
3074
|
+
...config,
|
|
3075
|
+
tables: Object.freeze([...config.tables])
|
|
3076
|
+
});
|
|
3077
|
+
const selectRowPolicies = getMooseInternal().selectRowPolicies;
|
|
3078
|
+
if (!isClientOnlyMode() && selectRowPolicies.has(this.name)) {
|
|
3079
|
+
throw new Error(`SelectRowPolicy with name ${this.name} already exists`);
|
|
3080
|
+
}
|
|
3081
|
+
selectRowPolicies.set(this.name, this);
|
|
3082
|
+
}
|
|
3083
|
+
/** Resolved table references for serialization */
|
|
3084
|
+
get tableRefs() {
|
|
3085
|
+
return this.config.tables.map((t) => ({
|
|
3086
|
+
name: t.generateTableName(),
|
|
3087
|
+
...t.config.database ? { database: t.config.database } : {}
|
|
3088
|
+
}));
|
|
3089
|
+
}
|
|
3090
|
+
};
|
|
3091
|
+
|
|
2954
3092
|
// src/dmv2/sdk/lifeCycle.ts
|
|
2955
3093
|
var LifeCycle = /* @__PURE__ */ ((LifeCycle2) => {
|
|
2956
3094
|
LifeCycle2["FULLY_MANAGED"] = "FULLY_MANAGED";
|
|
@@ -3085,83 +3223,6 @@ Examples:
|
|
|
3085
3223
|
return this._rawApp;
|
|
3086
3224
|
}
|
|
3087
3225
|
};
|
|
3088
|
-
|
|
3089
|
-
// src/dmv2/registry.ts
|
|
3090
|
-
function getTables() {
|
|
3091
|
-
return getMooseInternal().tables;
|
|
3092
|
-
}
|
|
3093
|
-
function getTable(name) {
|
|
3094
|
-
return getMooseInternal().tables.get(name);
|
|
3095
|
-
}
|
|
3096
|
-
function getStreams() {
|
|
3097
|
-
return getMooseInternal().streams;
|
|
3098
|
-
}
|
|
3099
|
-
function getStream(name) {
|
|
3100
|
-
return getMooseInternal().streams.get(name);
|
|
3101
|
-
}
|
|
3102
|
-
function getIngestApis() {
|
|
3103
|
-
return getMooseInternal().ingestApis;
|
|
3104
|
-
}
|
|
3105
|
-
function getIngestApi(name) {
|
|
3106
|
-
return getMooseInternal().ingestApis.get(name);
|
|
3107
|
-
}
|
|
3108
|
-
function getApis() {
|
|
3109
|
-
return getMooseInternal().apis;
|
|
3110
|
-
}
|
|
3111
|
-
function getApi(nameOrPath) {
|
|
3112
|
-
const registry = getMooseInternal();
|
|
3113
|
-
const directMatch = registry.apis.get(nameOrPath);
|
|
3114
|
-
if (directMatch) {
|
|
3115
|
-
return directMatch;
|
|
3116
|
-
}
|
|
3117
|
-
const versionedApis = /* @__PURE__ */ new Map();
|
|
3118
|
-
const pathMap = /* @__PURE__ */ new Map();
|
|
3119
|
-
registry.apis.forEach((api, key) => {
|
|
3120
|
-
const baseName = api.name;
|
|
3121
|
-
if (!versionedApis.has(baseName)) {
|
|
3122
|
-
versionedApis.set(baseName, []);
|
|
3123
|
-
}
|
|
3124
|
-
versionedApis.get(baseName).push(api);
|
|
3125
|
-
if (api.config.path) {
|
|
3126
|
-
pathMap.set(api.config.path, api);
|
|
3127
|
-
}
|
|
3128
|
-
});
|
|
3129
|
-
const candidates = versionedApis.get(nameOrPath);
|
|
3130
|
-
if (candidates && candidates.length === 1) {
|
|
3131
|
-
return candidates[0];
|
|
3132
|
-
}
|
|
3133
|
-
return pathMap.get(nameOrPath);
|
|
3134
|
-
}
|
|
3135
|
-
function getSqlResources() {
|
|
3136
|
-
return getMooseInternal().sqlResources;
|
|
3137
|
-
}
|
|
3138
|
-
function getSqlResource(name) {
|
|
3139
|
-
return getMooseInternal().sqlResources.get(name);
|
|
3140
|
-
}
|
|
3141
|
-
function getWorkflows2() {
|
|
3142
|
-
return getMooseInternal().workflows;
|
|
3143
|
-
}
|
|
3144
|
-
function getWorkflow(name) {
|
|
3145
|
-
return getMooseInternal().workflows.get(name);
|
|
3146
|
-
}
|
|
3147
|
-
function getWebApps() {
|
|
3148
|
-
return getMooseInternal().webApps;
|
|
3149
|
-
}
|
|
3150
|
-
function getWebApp(name) {
|
|
3151
|
-
return getMooseInternal().webApps.get(name);
|
|
3152
|
-
}
|
|
3153
|
-
function getMaterializedViews() {
|
|
3154
|
-
return getMooseInternal().materializedViews;
|
|
3155
|
-
}
|
|
3156
|
-
function getMaterializedView(name) {
|
|
3157
|
-
return getMooseInternal().materializedViews.get(name);
|
|
3158
|
-
}
|
|
3159
|
-
function getViews() {
|
|
3160
|
-
return getMooseInternal().views;
|
|
3161
|
-
}
|
|
3162
|
-
function getView(name) {
|
|
3163
|
-
return getMooseInternal().views.get(name);
|
|
3164
|
-
}
|
|
3165
3226
|
export {
|
|
3166
3227
|
Api,
|
|
3167
3228
|
ClickHouseEngines,
|
|
@@ -3173,6 +3234,7 @@ export {
|
|
|
3173
3234
|
LifeCycle,
|
|
3174
3235
|
MaterializedView,
|
|
3175
3236
|
OlapTable2 as OlapTable,
|
|
3237
|
+
SelectRowPolicy,
|
|
3176
3238
|
Sql,
|
|
3177
3239
|
SqlResource,
|
|
3178
3240
|
Stream,
|
|
@@ -3187,6 +3249,8 @@ export {
|
|
|
3187
3249
|
getIngestApis,
|
|
3188
3250
|
getMaterializedView,
|
|
3189
3251
|
getMaterializedViews,
|
|
3252
|
+
getSelectRowPolicies,
|
|
3253
|
+
getSelectRowPolicy,
|
|
3190
3254
|
getSqlResource,
|
|
3191
3255
|
getSqlResources,
|
|
3192
3256
|
getStream,
|