@514labs/moose-lib 0.6.459 → 0.6.460
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 +5 -4
- package/dist/browserCompatible.d.ts +5 -4
- package/dist/browserCompatible.js +8 -5
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +4 -1
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/dmv2/index.d.mts +3 -2
- package/dist/dmv2/index.d.ts +3 -2
- package/dist/dmv2/index.js +7 -4
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +4 -1
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/index-Cs6mRtl7.d.ts +1305 -0
- package/dist/index-DBs6nRQN.d.mts +1305 -0
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +28 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -23
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +67 -56
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +70 -59
- package/dist/moose-runner.mjs.map +1 -1
- package/dist/testing/index.d.mts +99 -0
- package/dist/testing/index.d.ts +99 -0
- package/dist/testing/index.js +328 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/index.mjs +295 -0
- package/dist/testing/index.mjs.map +1 -0
- package/dist/view-CNYx8kUh.d.mts +1327 -0
- package/dist/view-CNYx8kUh.d.ts +1327 -0
- package/package.json +7 -2
- package/dist/index-BkvEUvtm.d.mts +0 -2627
- package/dist/index-BkvEUvtm.d.ts +0 -2627
package/dist/moose-runner.js
CHANGED
|
@@ -553,7 +553,7 @@ var init_secrets = __esm({
|
|
|
553
553
|
}
|
|
554
554
|
});
|
|
555
555
|
|
|
556
|
-
// src/consumption-apis/
|
|
556
|
+
// src/consumption-apis/query-client.ts
|
|
557
557
|
function formatElapsedTime(ms) {
|
|
558
558
|
if (ms < 1e3) {
|
|
559
559
|
return `${Math.round(ms)} ms`;
|
|
@@ -566,6 +566,68 @@ function formatElapsedTime(ms) {
|
|
|
566
566
|
const remainingSeconds = seconds % 60;
|
|
567
567
|
return `${minutes} minutes and ${remainingSeconds.toFixed(2)} seconds`;
|
|
568
568
|
}
|
|
569
|
+
var import_node_crypto3, import_perf_hooks, QueryClient;
|
|
570
|
+
var init_query_client = __esm({
|
|
571
|
+
"src/consumption-apis/query-client.ts"() {
|
|
572
|
+
"use strict";
|
|
573
|
+
import_node_crypto3 = require("crypto");
|
|
574
|
+
import_perf_hooks = require("perf_hooks");
|
|
575
|
+
init_sqlHelpers();
|
|
576
|
+
QueryClient = class {
|
|
577
|
+
client;
|
|
578
|
+
query_id_prefix;
|
|
579
|
+
rowPolicyOptions;
|
|
580
|
+
constructor(client, query_id_prefix, rowPolicyOptions) {
|
|
581
|
+
this.client = client;
|
|
582
|
+
this.query_id_prefix = query_id_prefix;
|
|
583
|
+
this.rowPolicyOptions = rowPolicyOptions;
|
|
584
|
+
}
|
|
585
|
+
async execute(sql3) {
|
|
586
|
+
const [query, query_params] = toQuery(sql3);
|
|
587
|
+
console.log(`[QueryClient] | Query: ${toQueryPreview(sql3)}`);
|
|
588
|
+
const start = import_perf_hooks.performance.now();
|
|
589
|
+
const result = await this.client.query({
|
|
590
|
+
query,
|
|
591
|
+
query_params,
|
|
592
|
+
format: "JSONEachRow",
|
|
593
|
+
query_id: this.query_id_prefix + (0, import_node_crypto3.randomUUID)(),
|
|
594
|
+
// Note: wait_end_of_query deliberately NOT set here as this is used for SELECT queries
|
|
595
|
+
// where response buffering would harm streaming performance and concurrency
|
|
596
|
+
clickhouse_settings: {
|
|
597
|
+
asterisk_include_materialized_columns: 1,
|
|
598
|
+
asterisk_include_alias_columns: 1,
|
|
599
|
+
...this.rowPolicyOptions?.clickhouse_settings
|
|
600
|
+
},
|
|
601
|
+
...this.rowPolicyOptions && {
|
|
602
|
+
role: this.rowPolicyOptions.role
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
const elapsedMs = import_perf_hooks.performance.now() - start;
|
|
606
|
+
console.log(
|
|
607
|
+
`[QueryClient] | Query completed: ${formatElapsedTime(elapsedMs)}`
|
|
608
|
+
);
|
|
609
|
+
return result;
|
|
610
|
+
}
|
|
611
|
+
async command(sql3) {
|
|
612
|
+
const [query, query_params] = toQuery(sql3);
|
|
613
|
+
console.log(`[QueryClient] | Command: ${toQueryPreview(sql3)}`);
|
|
614
|
+
const start = import_perf_hooks.performance.now();
|
|
615
|
+
const result = await this.client.command({
|
|
616
|
+
query,
|
|
617
|
+
query_params,
|
|
618
|
+
query_id: this.query_id_prefix + (0, import_node_crypto3.randomUUID)()
|
|
619
|
+
});
|
|
620
|
+
const elapsedMs = import_perf_hooks.performance.now() - start;
|
|
621
|
+
console.log(
|
|
622
|
+
`[QueryClient] | Command completed: ${formatElapsedTime(elapsedMs)}`
|
|
623
|
+
);
|
|
624
|
+
return result;
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
// src/consumption-apis/helpers.ts
|
|
569
631
|
function buildRowPolicyOptionsFromClaims(config, claims) {
|
|
570
632
|
const clickhouse_settings = /* @__PURE__ */ Object.create(null);
|
|
571
633
|
for (const [settingName, claimName] of Object.entries(config)) {
|
|
@@ -612,16 +674,16 @@ async function getTemporalClient(temporalUrl, namespace, clientCert, clientKey,
|
|
|
612
674
|
return void 0;
|
|
613
675
|
}
|
|
614
676
|
}
|
|
615
|
-
var import_client2,
|
|
677
|
+
var import_client2, import_node_crypto4, fs, MooseClient, MOOSE_RLS_ROLE, MOOSE_RLS_USER, MOOSE_RLS_SETTING_PREFIX, WorkflowClient;
|
|
616
678
|
var init_helpers = __esm({
|
|
617
679
|
"src/consumption-apis/helpers.ts"() {
|
|
618
680
|
"use strict";
|
|
619
681
|
import_client2 = require("@temporalio/client");
|
|
620
|
-
|
|
621
|
-
import_perf_hooks = require("perf_hooks");
|
|
682
|
+
import_node_crypto4 = require("crypto");
|
|
622
683
|
fs = __toESM(require("fs"));
|
|
623
684
|
init_internal();
|
|
624
685
|
init_sqlHelpers();
|
|
686
|
+
init_query_client();
|
|
625
687
|
MooseClient = class {
|
|
626
688
|
query;
|
|
627
689
|
workflow;
|
|
@@ -633,57 +695,6 @@ var init_helpers = __esm({
|
|
|
633
695
|
MOOSE_RLS_ROLE = "moose_rls_role";
|
|
634
696
|
MOOSE_RLS_USER = "moose_rls_user";
|
|
635
697
|
MOOSE_RLS_SETTING_PREFIX = "SQL_moose_rls_";
|
|
636
|
-
QueryClient = class {
|
|
637
|
-
client;
|
|
638
|
-
query_id_prefix;
|
|
639
|
-
rowPolicyOptions;
|
|
640
|
-
constructor(client, query_id_prefix, rowPolicyOptions) {
|
|
641
|
-
this.client = client;
|
|
642
|
-
this.query_id_prefix = query_id_prefix;
|
|
643
|
-
this.rowPolicyOptions = rowPolicyOptions;
|
|
644
|
-
}
|
|
645
|
-
async execute(sql3) {
|
|
646
|
-
const [query, query_params] = toQuery(sql3);
|
|
647
|
-
console.log(`[QueryClient] | Query: ${toQueryPreview(sql3)}`);
|
|
648
|
-
const start = import_perf_hooks.performance.now();
|
|
649
|
-
const result = await this.client.query({
|
|
650
|
-
query,
|
|
651
|
-
query_params,
|
|
652
|
-
format: "JSONEachRow",
|
|
653
|
-
query_id: this.query_id_prefix + (0, import_node_crypto3.randomUUID)(),
|
|
654
|
-
// Note: wait_end_of_query deliberately NOT set here as this is used for SELECT queries
|
|
655
|
-
// where response buffering would harm streaming performance and concurrency
|
|
656
|
-
clickhouse_settings: {
|
|
657
|
-
asterisk_include_materialized_columns: 1,
|
|
658
|
-
asterisk_include_alias_columns: 1,
|
|
659
|
-
...this.rowPolicyOptions?.clickhouse_settings
|
|
660
|
-
},
|
|
661
|
-
...this.rowPolicyOptions && {
|
|
662
|
-
role: this.rowPolicyOptions.role
|
|
663
|
-
}
|
|
664
|
-
});
|
|
665
|
-
const elapsedMs = import_perf_hooks.performance.now() - start;
|
|
666
|
-
console.log(
|
|
667
|
-
`[QueryClient] | Query completed: ${formatElapsedTime(elapsedMs)}`
|
|
668
|
-
);
|
|
669
|
-
return result;
|
|
670
|
-
}
|
|
671
|
-
async command(sql3) {
|
|
672
|
-
const [query, query_params] = toQuery(sql3);
|
|
673
|
-
console.log(`[QueryClient] | Command: ${toQueryPreview(sql3)}`);
|
|
674
|
-
const start = import_perf_hooks.performance.now();
|
|
675
|
-
const result = await this.client.command({
|
|
676
|
-
query,
|
|
677
|
-
query_params,
|
|
678
|
-
query_id: this.query_id_prefix + (0, import_node_crypto3.randomUUID)()
|
|
679
|
-
});
|
|
680
|
-
const elapsedMs = import_perf_hooks.performance.now() - start;
|
|
681
|
-
console.log(
|
|
682
|
-
`[QueryClient] | Command completed: ${formatElapsedTime(elapsedMs)}`
|
|
683
|
-
);
|
|
684
|
-
return result;
|
|
685
|
-
}
|
|
686
|
-
};
|
|
687
698
|
WorkflowClient = class {
|
|
688
699
|
client;
|
|
689
700
|
constructor(temporalClient) {
|
|
@@ -766,7 +777,7 @@ var init_helpers = __esm({
|
|
|
766
777
|
processInputData(name, input_data) {
|
|
767
778
|
let workflowId = name;
|
|
768
779
|
if (input_data) {
|
|
769
|
-
const hash = (0,
|
|
780
|
+
const hash = (0, import_node_crypto4.createHash)("sha256").update(JSON.stringify(input_data)).digest("hex").slice(0, 16);
|
|
770
781
|
workflowId = `${name}-${hash}`;
|
|
771
782
|
}
|
|
772
783
|
return [input_data, workflowId];
|