@malloy-publisher/server 0.10.1 → 0.10.2

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.
Files changed (22) hide show
  1. package/dist/app/api-doc.yaml +7 -2
  2. package/dist/app/assets/{EnvironmentPage-BU9PTvlW.js → EnvironmentPage-qOdFSQL1.js} +1 -1
  3. package/dist/app/assets/{HomePage-Cf8DI47T.js → HomePage-qPrsLgkV.js} +1 -1
  4. package/dist/app/assets/{MainPage-BlwWg0iB.js → MainPage-BfS_-PBR.js} +1 -1
  5. package/dist/app/assets/{ModelPage-DA0bb3CE.js → ModelPage-Rgt_50mg.js} +2 -2
  6. package/dist/app/assets/{PackagePage-BMsYUtRD.js → PackagePage-D6bXCeY6.js} +1 -1
  7. package/dist/app/assets/{RenderedResult-vf6tu8tf.es-CSqnbEun.js → RenderedResult-BCJC0ZVj.es-ThIM8SXj.js} +1 -1
  8. package/dist/app/assets/{RouteError-DxCqVKbo.js → RouteError-D3qvottt.js} +1 -1
  9. package/dist/app/assets/{ThemeEditorPage-380DQSoR.js → ThemeEditorPage-UAf70V3Q.js} +1 -1
  10. package/dist/app/assets/{ToggleButtonGroup-DgxU1gMN.js → ToggleButtonGroup-DnK5WHKM.js} +1 -1
  11. package/dist/app/assets/{documentRoutes-Bqj5f6iK.js → documentRoutes-CnLoYf4D.js} +1 -1
  12. package/dist/app/assets/{editPageMounted-CT7ODDUS.js → editPageMounted-po3c6RP3.js} +2 -2
  13. package/dist/app/assets/{index-Cji4XUjs.js → index-4-yQ2uF2.js} +1 -1
  14. package/dist/app/assets/{index-D8RY5NbL.js → index-CNbuoYFM.js} +1 -1
  15. package/dist/app/assets/{index-BiBw5Wni.js → index-a9NQPL4B.js} +1 -1
  16. package/dist/app/assets/{index-DYqHxLwV.js → index-iyvwQg3j.js} +4 -4
  17. package/dist/app/assets/{index.es-B10IQDf8.js → index.es-C2AyMc9a.js} +1 -1
  18. package/dist/app/index.html +1 -1
  19. package/dist/instrumentation.mjs +1 -1
  20. package/dist/server.mjs +78 -46
  21. package/package.json +1 -1
  22. package/dist/sshcrypto-cqb52edz.node +0 -0
package/dist/server.mjs CHANGED
@@ -164832,7 +164832,7 @@ var init_telemetry = __esm(() => {
164832
164832
  });
164833
164833
 
164834
164834
  // package.json
164835
- var version = "0.10.1";
164835
+ var version = "0.10.2";
164836
164836
  var init_package = () => {};
164837
164837
 
164838
164838
  // src/version.ts
@@ -263961,6 +263961,45 @@ var init_introspection_sql = __esm(() => {
263961
263961
  });
263962
263962
 
263963
263963
  // src/service/gcs_s3_utils.ts
263964
+ function parseS3Endpoint(endpoint) {
263965
+ const scheme = /^([a-z][a-z0-9+.-]*):\/\//i.exec(endpoint);
263966
+ const protocol = scheme?.[1].toLowerCase();
263967
+ if (protocol !== undefined && protocol !== "http" && protocol !== "https") {
263968
+ throw new Error(`S3 endpoint scheme must be http:// or https://, got ${protocol}://`);
263969
+ }
263970
+ if (/\s/.test(endpoint)) {
263971
+ throw new Error("S3 endpoint must not contain whitespace");
263972
+ }
263973
+ if (/[?#]/.test(endpoint)) {
263974
+ throw new Error("S3 endpoint must not contain a query string or fragment");
263975
+ }
263976
+ let end = endpoint.length;
263977
+ while (end > 0 && endpoint[end - 1] === "/")
263978
+ end--;
263979
+ const hostAndPath = endpoint.slice(scheme ? scheme[0].length : 0, end);
263980
+ if (!hostAndPath) {
263981
+ throw new Error("S3 endpoint must include a host");
263982
+ }
263983
+ if (hostAndPath.startsWith("/")) {
263984
+ throw new Error("S3 endpoint must include a host before any path");
263985
+ }
263986
+ if (hostAndPath.split("/", 1)[0].includes("@")) {
263987
+ throw new Error("S3 endpoint must not contain userinfo");
263988
+ }
263989
+ const useSsl = protocol !== "http";
263990
+ return {
263991
+ hostAndPath,
263992
+ useSsl,
263993
+ url: `${useSsl ? "https" : "http"}://${hostAndPath}`
263994
+ };
263995
+ }
263996
+ function checkS3Endpoint(endpoint, provider) {
263997
+ const parsed = parseS3Endpoint(endpoint);
263998
+ if (!parsed.useSsl && provider === "credential_chain") {
263999
+ throw new Error("S3 endpoint must use https:// with provider credential_chain: its requests carry the host's credentials");
264000
+ }
264001
+ return parsed;
264002
+ }
263964
264003
  function gcsConnectionToCredentials(gcsConnection) {
263965
264004
  return {
263966
264005
  type: "gcs",
@@ -264025,6 +264064,13 @@ function resolveCloudStorageCredentials(attachedDb, origin2 = "connection") {
264025
264064
  }
264026
264065
  const s3 = attachedDb.s3Connection;
264027
264066
  validateS3ProviderShape(s3, attachedDb.name, origin2);
264067
+ if (typeof s3.endpoint === "string" && s3.endpoint !== "") {
264068
+ try {
264069
+ checkS3Endpoint(s3.endpoint, s3.provider);
264070
+ } catch (error) {
264071
+ throw new Error(`${error.message} (${attachedDb.name})`);
264072
+ }
264073
+ }
264028
264074
  if (s3.provider !== "credential_chain" && (!s3.accessKeyId || !s3.secretAccessKey)) {
264029
264075
  throw new Error(`S3 accessKeyId and secretAccessKey are required for: ${attachedDb.name}`);
264030
264076
  }
@@ -264043,7 +264089,7 @@ function createCloudStorageClient(credentials) {
264043
264089
  const isGCS = credentials.type === "gcs";
264044
264090
  const useHostCredentials = !isGCS && credentials.provider === "credential_chain";
264045
264091
  const client = new import_client_s3.S3Client({
264046
- endpoint: isGCS ? "https://storage.googleapis.com" : credentials.endpoint,
264092
+ endpoint: isGCS ? "https://storage.googleapis.com" : credentials.endpoint ? checkS3Endpoint(credentials.endpoint, credentials.provider).url : undefined,
264047
264093
  region: isGCS ? "auto" : credentials.region || "us-east-1",
264048
264094
  ...useHostCredentials ? {} : {
264049
264095
  credentials: {
@@ -268914,11 +268960,6 @@ var require_utils93 = __commonJS((exports, module) => {
268914
268960
  };
268915
268961
  });
268916
268962
 
268917
- // ../../node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node
268918
- var require_sshcrypto = __commonJS((exports, module) => {
268919
- module.exports = __require("./sshcrypto-cqb52edz.node");
268920
- });
268921
-
268922
268963
  // ../../node_modules/ssh2/lib/protocol/crypto/poly1305.js
268923
268964
  var require_poly1305 = __commonJS((exports, module) => {
268924
268965
  var __dirname = "/home/runner/work/publisher/publisher/node_modules/ssh2/lib/protocol/crypto", __filename = "/home/runner/work/publisher/publisher/node_modules/ssh2/lib/protocol/crypto/poly1305.js";
@@ -269405,7 +269446,7 @@ var require_crypto = __commonJS((exports, module) => {
269405
269446
  var ChaChaPolyDecipher;
269406
269447
  var GenericDecipher;
269407
269448
  try {
269408
- binding = require_sshcrypto();
269449
+ binding = (()=>{throw new Error("Cannot require module "+"./crypto/build/Release/sshcrypto.node");})();
269409
269450
  ({
269410
269451
  AESGCMCipher,
269411
269452
  ChaChaPolyCipher,
@@ -295454,57 +295495,40 @@ function buildCloudStorageSecretSQL(secretName, credentials) {
295454
295495
  if (!credentials.region) {
295455
295496
  logger.warn("S3 connection has no region; defaulting to us-east-1. A bucket in " + "another region will not be found.", { secretName });
295456
295497
  }
295498
+ let clauses;
295457
295499
  if (credentials.provider === "credential_chain") {
295458
295500
  const chain = escapeSQL(credentials.chain?.trim() || DEFAULT_S3_CREDENTIAL_CHAIN);
295459
- const clauses = [
295501
+ clauses = [
295460
295502
  "TYPE s3",
295461
295503
  "PROVIDER credential_chain",
295462
295504
  `CHAIN '${chain}'`,
295463
295505
  "REFRESH 'auto'",
295464
295506
  `REGION '${region}'`
295465
295507
  ];
295466
- if (credentials.endpoint) {
295467
- clauses.push(`ENDPOINT '${escapeSQL(credentials.endpoint)}'`, "URL_STYLE 'path'");
295508
+ } else {
295509
+ clauses = [
295510
+ "TYPE s3",
295511
+ `KEY_ID '${escapedKeyId}'`,
295512
+ `SECRET '${escapedSecret}'`,
295513
+ `REGION '${region}'`
295514
+ ];
295515
+ }
295516
+ if (credentials.endpoint) {
295517
+ const { hostAndPath, useSsl } = checkS3Endpoint(credentials.endpoint, credentials.provider);
295518
+ clauses.push(`ENDPOINT '${escapeSQL(hostAndPath)}'`, "URL_STYLE 'path'");
295519
+ if (!useSsl) {
295520
+ clauses.push("USE_SSL false");
295468
295521
  }
295469
- createSecretCommand = `
295522
+ }
295523
+ if (credentials.provider !== "credential_chain" && credentials.sessionToken) {
295524
+ clauses.push(`SESSION_TOKEN '${escapeSQL(credentials.sessionToken)}'`);
295525
+ }
295526
+ createSecretCommand = `
295470
295527
  CREATE OR REPLACE SECRET ${secretName} (
295471
295528
  ${clauses.join(`,
295472
295529
  `)}
295473
295530
  );
295474
295531
  `;
295475
- } else if (credentials.endpoint) {
295476
- const escapedEndpoint = escapeSQL(credentials.endpoint);
295477
- createSecretCommand = `
295478
- CREATE OR REPLACE SECRET ${secretName} (
295479
- TYPE s3,
295480
- KEY_ID '${escapedKeyId}',
295481
- SECRET '${escapedSecret}',
295482
- REGION '${region}',
295483
- ENDPOINT '${escapedEndpoint}',
295484
- URL_STYLE 'path'
295485
- );
295486
- `;
295487
- } else if (credentials.sessionToken) {
295488
- const escapedToken = escapeSQL(credentials.sessionToken);
295489
- createSecretCommand = `
295490
- CREATE OR REPLACE SECRET ${secretName} (
295491
- TYPE s3,
295492
- KEY_ID '${escapedKeyId}',
295493
- SECRET '${escapedSecret}',
295494
- REGION '${region}',
295495
- SESSION_TOKEN '${escapedToken}'
295496
- );
295497
- `;
295498
- } else {
295499
- createSecretCommand = `
295500
- CREATE OR REPLACE SECRET ${secretName} (
295501
- TYPE s3,
295502
- KEY_ID '${escapedKeyId}',
295503
- SECRET '${escapedSecret}',
295504
- REGION '${region}'
295505
- );
295506
- `;
295507
- }
295508
295532
  }
295509
295533
  return createSecretCommand;
295510
295534
  }
@@ -305734,7 +305758,7 @@ class ConnectionController {
305734
305758
  const connection = this.getApiConnectionForLookup(environment, connectionName);
305735
305759
  if (connection.type === "ducklake") {
305736
305760
  if (tablePath.split(".").length === 1) {
305737
- tablePath = `${connectionName}.${schemaName}.${tablePath}`;
305761
+ tablePath = schemaName === tablePath ? `${connectionName}.${tablePath}` : `${connectionName}.${schemaName}.${tablePath}`;
305738
305762
  } else if (tablePath.split(".").length === 2 && !tablePath.startsWith(connectionName)) {
305739
305763
  tablePath = `${connectionName}.${tablePath}`;
305740
305764
  }
@@ -376935,6 +376959,13 @@ function catalogAdminConfigFromEnv(env) {
376935
376959
  if (!keyId || !secret) {
376936
376960
  throw new Error("PUBLISHER_ADMIN_STORAGE_PROVIDER=s3 needs PUBLISHER_ADMIN_STORAGE_KEY_ID and PUBLISHER_ADMIN_STORAGE_SECRET.");
376937
376961
  }
376962
+ if (env.PUBLISHER_ADMIN_STORAGE_ENDPOINT) {
376963
+ try {
376964
+ parseS3Endpoint(env.PUBLISHER_ADMIN_STORAGE_ENDPOINT);
376965
+ } catch (error) {
376966
+ throw new Error(`PUBLISHER_ADMIN_STORAGE_ENDPOINT: ${error.message}`);
376967
+ }
376968
+ }
376938
376969
  storage = {
376939
376970
  s3Connection: {
376940
376971
  provider: "config",
@@ -377457,6 +377488,7 @@ var init_catalog_admin = __esm(() => {
377457
377488
  init_logger();
377458
377489
  init_connection();
377459
377490
  init_materialization_build_session();
377491
+ init_gcs_s3_utils();
377460
377492
  init_pg_helpers();
377461
377493
  init_quoting();
377462
377494
  init_statement_usage();
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "snowflake"
20
20
  ],
21
21
  "homepage": "https://docs.malloydata.dev/documentation/user_guides/publishing/mcp_agents",
22
- "version": "0.10.1",
22
+ "version": "0.10.2",
23
23
  "main": "dist/server.mjs",
24
24
  "bin": {
25
25
  "malloy-publisher": "dist/server.mjs"
Binary file