@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
package/dist/dmv2/index.mjs
CHANGED
|
@@ -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() {
|
|
@@ -791,6 +799,93 @@ import { createClient as createClient2 } from "redis";
|
|
|
791
799
|
// src/consumption-apis/standalone.ts
|
|
792
800
|
init_commons();
|
|
793
801
|
|
|
802
|
+
// src/dmv2/registry.ts
|
|
803
|
+
function getTables() {
|
|
804
|
+
return getMooseInternal().tables;
|
|
805
|
+
}
|
|
806
|
+
function getTable(name) {
|
|
807
|
+
return getMooseInternal().tables.get(name);
|
|
808
|
+
}
|
|
809
|
+
function getStreams() {
|
|
810
|
+
return getMooseInternal().streams;
|
|
811
|
+
}
|
|
812
|
+
function getStream(name) {
|
|
813
|
+
return getMooseInternal().streams.get(name);
|
|
814
|
+
}
|
|
815
|
+
function getIngestApis() {
|
|
816
|
+
return getMooseInternal().ingestApis;
|
|
817
|
+
}
|
|
818
|
+
function getIngestApi(name) {
|
|
819
|
+
return getMooseInternal().ingestApis.get(name);
|
|
820
|
+
}
|
|
821
|
+
function getApis() {
|
|
822
|
+
return getMooseInternal().apis;
|
|
823
|
+
}
|
|
824
|
+
function getApi(nameOrPath) {
|
|
825
|
+
const registry = getMooseInternal();
|
|
826
|
+
const directMatch = registry.apis.get(nameOrPath);
|
|
827
|
+
if (directMatch) {
|
|
828
|
+
return directMatch;
|
|
829
|
+
}
|
|
830
|
+
const versionedApis = /* @__PURE__ */ new Map();
|
|
831
|
+
const pathMap = /* @__PURE__ */ new Map();
|
|
832
|
+
registry.apis.forEach((api, key) => {
|
|
833
|
+
const baseName = api.name;
|
|
834
|
+
if (!versionedApis.has(baseName)) {
|
|
835
|
+
versionedApis.set(baseName, []);
|
|
836
|
+
}
|
|
837
|
+
versionedApis.get(baseName).push(api);
|
|
838
|
+
if (api.config.path) {
|
|
839
|
+
pathMap.set(api.config.path, api);
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
const candidates = versionedApis.get(nameOrPath);
|
|
843
|
+
if (candidates && candidates.length === 1) {
|
|
844
|
+
return candidates[0];
|
|
845
|
+
}
|
|
846
|
+
return pathMap.get(nameOrPath);
|
|
847
|
+
}
|
|
848
|
+
function getSqlResources() {
|
|
849
|
+
return getMooseInternal().sqlResources;
|
|
850
|
+
}
|
|
851
|
+
function getSqlResource(name) {
|
|
852
|
+
return getMooseInternal().sqlResources.get(name);
|
|
853
|
+
}
|
|
854
|
+
function getWorkflows() {
|
|
855
|
+
return getMooseInternal().workflows;
|
|
856
|
+
}
|
|
857
|
+
function getWorkflow(name) {
|
|
858
|
+
return getMooseInternal().workflows.get(name);
|
|
859
|
+
}
|
|
860
|
+
function getWebApps() {
|
|
861
|
+
return getMooseInternal().webApps;
|
|
862
|
+
}
|
|
863
|
+
function getWebApp(name) {
|
|
864
|
+
return getMooseInternal().webApps.get(name);
|
|
865
|
+
}
|
|
866
|
+
function getMaterializedViews() {
|
|
867
|
+
return getMooseInternal().materializedViews;
|
|
868
|
+
}
|
|
869
|
+
function getMaterializedView(name) {
|
|
870
|
+
return getMooseInternal().materializedViews.get(name);
|
|
871
|
+
}
|
|
872
|
+
function getViews() {
|
|
873
|
+
return getMooseInternal().views;
|
|
874
|
+
}
|
|
875
|
+
function getView(name) {
|
|
876
|
+
return getMooseInternal().views.get(name);
|
|
877
|
+
}
|
|
878
|
+
function getSelectRowPolicies() {
|
|
879
|
+
return getMooseInternal().selectRowPolicies;
|
|
880
|
+
}
|
|
881
|
+
function getSelectRowPolicy(name) {
|
|
882
|
+
return getMooseInternal().selectRowPolicies.get(name);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// src/consumption-apis/standalone.ts
|
|
886
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
887
|
+
var requestContextStorage = new AsyncLocalStorage();
|
|
888
|
+
|
|
794
889
|
// src/utilities/dataParser.ts
|
|
795
890
|
import { parse } from "csv-parse";
|
|
796
891
|
var CSV_DELIMITERS = {
|
|
@@ -982,7 +1077,8 @@ function createRegistryFrom(existing) {
|
|
|
982
1077
|
workflows: toTrackingMap(existing?.workflows),
|
|
983
1078
|
webApps: toTrackingMap(existing?.webApps),
|
|
984
1079
|
materializedViews: toTrackingMap(existing?.materializedViews),
|
|
985
|
-
views: toTrackingMap(existing?.views)
|
|
1080
|
+
views: toTrackingMap(existing?.views),
|
|
1081
|
+
selectRowPolicies: toTrackingMap(existing?.selectRowPolicies)
|
|
986
1082
|
};
|
|
987
1083
|
}
|
|
988
1084
|
var moose_internal = {
|
|
@@ -1018,7 +1114,11 @@ var moose_internal = {
|
|
|
1018
1114
|
void 0,
|
|
1019
1115
|
markRegistryMutated
|
|
1020
1116
|
),
|
|
1021
|
-
views: new MutationTrackingMap(void 0, markRegistryMutated)
|
|
1117
|
+
views: new MutationTrackingMap(void 0, markRegistryMutated),
|
|
1118
|
+
selectRowPolicies: new MutationTrackingMap(
|
|
1119
|
+
void 0,
|
|
1120
|
+
markRegistryMutated
|
|
1121
|
+
)
|
|
1022
1122
|
};
|
|
1023
1123
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
1024
1124
|
var initializeMooseInternalRegistry = () => {
|
|
@@ -1205,10 +1305,7 @@ var OlapTable = class extends TypedBase {
|
|
|
1205
1305
|
}
|
|
1206
1306
|
tables.set(registryKey, this);
|
|
1207
1307
|
}
|
|
1208
|
-
/**
|
|
1209
|
-
* Generates the versioned table name following Moose's naming convention
|
|
1210
|
-
* Format: {tableName}_{version_with_dots_replaced_by_underscores}
|
|
1211
|
-
*/
|
|
1308
|
+
/** @internal Returns the versioned ClickHouse table name (e.g., "events_1_0_0") */
|
|
1212
1309
|
generateTableName() {
|
|
1213
1310
|
if (this._cachedTableName) {
|
|
1214
1311
|
return this._cachedTableName;
|
|
@@ -2917,6 +3014,47 @@ var View = class {
|
|
|
2917
3014
|
}
|
|
2918
3015
|
};
|
|
2919
3016
|
|
|
3017
|
+
// src/dmv2/sdk/selectRowPolicy.ts
|
|
3018
|
+
var SelectRowPolicy = class {
|
|
3019
|
+
/** @internal */
|
|
3020
|
+
kind = "SelectRowPolicy";
|
|
3021
|
+
/** The name of the row policy */
|
|
3022
|
+
name;
|
|
3023
|
+
/** The policy configuration */
|
|
3024
|
+
config;
|
|
3025
|
+
constructor(name, config) {
|
|
3026
|
+
if (!name.trim()) {
|
|
3027
|
+
throw new Error("SelectRowPolicy name must not be empty");
|
|
3028
|
+
}
|
|
3029
|
+
if (!config.tables.length) {
|
|
3030
|
+
throw new Error(`SelectRowPolicy '${name}': tables must not be empty`);
|
|
3031
|
+
}
|
|
3032
|
+
if (!config.column.trim()) {
|
|
3033
|
+
throw new Error(`SelectRowPolicy '${name}': column must not be empty`);
|
|
3034
|
+
}
|
|
3035
|
+
if (!config.claim.trim()) {
|
|
3036
|
+
throw new Error(`SelectRowPolicy '${name}': claim must not be empty`);
|
|
3037
|
+
}
|
|
3038
|
+
this.name = name;
|
|
3039
|
+
this.config = Object.freeze({
|
|
3040
|
+
...config,
|
|
3041
|
+
tables: Object.freeze([...config.tables])
|
|
3042
|
+
});
|
|
3043
|
+
const selectRowPolicies = getMooseInternal().selectRowPolicies;
|
|
3044
|
+
if (!isClientOnlyMode() && selectRowPolicies.has(this.name)) {
|
|
3045
|
+
throw new Error(`SelectRowPolicy with name ${this.name} already exists`);
|
|
3046
|
+
}
|
|
3047
|
+
selectRowPolicies.set(this.name, this);
|
|
3048
|
+
}
|
|
3049
|
+
/** Resolved table references for serialization */
|
|
3050
|
+
get tableRefs() {
|
|
3051
|
+
return this.config.tables.map((t) => ({
|
|
3052
|
+
name: t.generateTableName(),
|
|
3053
|
+
...t.config.database ? { database: t.config.database } : {}
|
|
3054
|
+
}));
|
|
3055
|
+
}
|
|
3056
|
+
};
|
|
3057
|
+
|
|
2920
3058
|
// src/dmv2/sdk/lifeCycle.ts
|
|
2921
3059
|
var LifeCycle = /* @__PURE__ */ ((LifeCycle2) => {
|
|
2922
3060
|
LifeCycle2["FULLY_MANAGED"] = "FULLY_MANAGED";
|
|
@@ -3051,83 +3189,6 @@ Examples:
|
|
|
3051
3189
|
return this._rawApp;
|
|
3052
3190
|
}
|
|
3053
3191
|
};
|
|
3054
|
-
|
|
3055
|
-
// src/dmv2/registry.ts
|
|
3056
|
-
function getTables() {
|
|
3057
|
-
return getMooseInternal().tables;
|
|
3058
|
-
}
|
|
3059
|
-
function getTable(name) {
|
|
3060
|
-
return getMooseInternal().tables.get(name);
|
|
3061
|
-
}
|
|
3062
|
-
function getStreams() {
|
|
3063
|
-
return getMooseInternal().streams;
|
|
3064
|
-
}
|
|
3065
|
-
function getStream(name) {
|
|
3066
|
-
return getMooseInternal().streams.get(name);
|
|
3067
|
-
}
|
|
3068
|
-
function getIngestApis() {
|
|
3069
|
-
return getMooseInternal().ingestApis;
|
|
3070
|
-
}
|
|
3071
|
-
function getIngestApi(name) {
|
|
3072
|
-
return getMooseInternal().ingestApis.get(name);
|
|
3073
|
-
}
|
|
3074
|
-
function getApis() {
|
|
3075
|
-
return getMooseInternal().apis;
|
|
3076
|
-
}
|
|
3077
|
-
function getApi(nameOrPath) {
|
|
3078
|
-
const registry = getMooseInternal();
|
|
3079
|
-
const directMatch = registry.apis.get(nameOrPath);
|
|
3080
|
-
if (directMatch) {
|
|
3081
|
-
return directMatch;
|
|
3082
|
-
}
|
|
3083
|
-
const versionedApis = /* @__PURE__ */ new Map();
|
|
3084
|
-
const pathMap = /* @__PURE__ */ new Map();
|
|
3085
|
-
registry.apis.forEach((api, key) => {
|
|
3086
|
-
const baseName = api.name;
|
|
3087
|
-
if (!versionedApis.has(baseName)) {
|
|
3088
|
-
versionedApis.set(baseName, []);
|
|
3089
|
-
}
|
|
3090
|
-
versionedApis.get(baseName).push(api);
|
|
3091
|
-
if (api.config.path) {
|
|
3092
|
-
pathMap.set(api.config.path, api);
|
|
3093
|
-
}
|
|
3094
|
-
});
|
|
3095
|
-
const candidates = versionedApis.get(nameOrPath);
|
|
3096
|
-
if (candidates && candidates.length === 1) {
|
|
3097
|
-
return candidates[0];
|
|
3098
|
-
}
|
|
3099
|
-
return pathMap.get(nameOrPath);
|
|
3100
|
-
}
|
|
3101
|
-
function getSqlResources() {
|
|
3102
|
-
return getMooseInternal().sqlResources;
|
|
3103
|
-
}
|
|
3104
|
-
function getSqlResource(name) {
|
|
3105
|
-
return getMooseInternal().sqlResources.get(name);
|
|
3106
|
-
}
|
|
3107
|
-
function getWorkflows() {
|
|
3108
|
-
return getMooseInternal().workflows;
|
|
3109
|
-
}
|
|
3110
|
-
function getWorkflow(name) {
|
|
3111
|
-
return getMooseInternal().workflows.get(name);
|
|
3112
|
-
}
|
|
3113
|
-
function getWebApps() {
|
|
3114
|
-
return getMooseInternal().webApps;
|
|
3115
|
-
}
|
|
3116
|
-
function getWebApp(name) {
|
|
3117
|
-
return getMooseInternal().webApps.get(name);
|
|
3118
|
-
}
|
|
3119
|
-
function getMaterializedViews() {
|
|
3120
|
-
return getMooseInternal().materializedViews;
|
|
3121
|
-
}
|
|
3122
|
-
function getMaterializedView(name) {
|
|
3123
|
-
return getMooseInternal().materializedViews.get(name);
|
|
3124
|
-
}
|
|
3125
|
-
function getViews() {
|
|
3126
|
-
return getMooseInternal().views;
|
|
3127
|
-
}
|
|
3128
|
-
function getView(name) {
|
|
3129
|
-
return getMooseInternal().views.get(name);
|
|
3130
|
-
}
|
|
3131
3192
|
export {
|
|
3132
3193
|
Api,
|
|
3133
3194
|
ClickHouseEngines,
|
|
@@ -3139,6 +3200,7 @@ export {
|
|
|
3139
3200
|
LifeCycle,
|
|
3140
3201
|
MaterializedView,
|
|
3141
3202
|
OlapTable,
|
|
3203
|
+
SelectRowPolicy,
|
|
3142
3204
|
SqlResource,
|
|
3143
3205
|
Stream,
|
|
3144
3206
|
Task,
|
|
@@ -3151,6 +3213,8 @@ export {
|
|
|
3151
3213
|
getIngestApis,
|
|
3152
3214
|
getMaterializedView,
|
|
3153
3215
|
getMaterializedViews,
|
|
3216
|
+
getSelectRowPolicies,
|
|
3217
|
+
getSelectRowPolicy,
|
|
3154
3218
|
getSqlResource,
|
|
3155
3219
|
getSqlResources,
|
|
3156
3220
|
getStream,
|