@malloy-publisher/server 0.9.11 → 0.9.12

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 (24) hide show
  1. package/dist/app/api-doc.yaml +73 -4
  2. package/dist/app/assets/EnvironmentPage-BFcCRfvE.js +1 -0
  3. package/dist/app/assets/HomePage-C0LnSonK.js +1 -0
  4. package/dist/app/assets/{MainPage-BpE_5WuW.js → MainPage-D3EM60u0.js} +1 -1
  5. package/dist/app/assets/{ModelPage-ftyDI1tw.js → ModelPage-B1wvZV7r.js} +2 -2
  6. package/dist/app/assets/{PackagePage-QGnFwlHu.js → PackagePage-QZ59dwip.js} +1 -1
  7. package/dist/app/assets/{RenderedResult-Cmx8sX8d.es-du-Qe1x0.js → RenderedResult-CDiXJAh9.es-C9BYYEfH.js} +1 -1
  8. package/dist/app/assets/{RouteError-zM4SSZaU.js → RouteError-v8LP_Q9x.js} +1 -1
  9. package/dist/app/assets/{ThemeEditorPage-DhZJXGJm.js → ThemeEditorPage-B5l2nzAq.js} +1 -1
  10. package/dist/app/assets/{ToggleButtonGroup-TKxhg0Mg.js → ToggleButtonGroup-C6Lespxy.js} +1 -1
  11. package/dist/app/assets/{documentRoutes-D4TbSIi5.js → documentRoutes-xv0fP4cS.js} +1 -1
  12. package/dist/app/assets/{editPageMounted-0kzl2sgg.js → editPageMounted-COiBq84S.js} +2 -2
  13. package/dist/app/assets/{index-gQEuz0Cg.js → index-5On9Gkpl.js} +87 -87
  14. package/dist/app/assets/{index-Bzi4YH8Y.js → index-BG7MWz9o.js} +1 -1
  15. package/dist/app/assets/{index-B-qJVEXn.js → index-Dynd6zeI.js} +1 -1
  16. package/dist/app/assets/{index-CS4mmuDD.js → index-mIetEOsB.js} +1 -1
  17. package/dist/app/assets/{index.es-B3P9tIm3.js → index.es-FZZk_rEa.js} +1 -1
  18. package/dist/app/index.html +1 -1
  19. package/dist/package_load_worker.mjs +105 -8
  20. package/dist/server.mjs +242 -23
  21. package/dist/sshcrypto-cqb52edz.node +0 -0
  22. package/package.json +2 -1
  23. package/dist/app/assets/EnvironmentPage-tIGzymgb.js +0 -1
  24. package/dist/app/assets/HomePage-7QkNvQ_3.js +0 -1
@@ -13053,15 +13053,36 @@ function filesystemAccessFailure(error) {
13053
13053
  function isMysqlConfigFault(code) {
13054
13054
  return typeof code === "string" && (MYSQL_CONFIG_CODES.has(code) || code.startsWith("HANDSHAKE_"));
13055
13055
  }
13056
- function isConnectionFailure(error) {
13057
- let current = error;
13056
+ function isSqlserverConnectTimeout(error, code) {
13057
+ return code === "ETIMEOUT" && error.name === "ConnectionError";
13058
+ }
13059
+ function wrappedError(error) {
13060
+ if (error.cause instanceof Error)
13061
+ return error.cause;
13062
+ return error.originalError;
13063
+ }
13064
+ function causeChainHasTlsVerificationFailure(error) {
13065
+ let current = wrappedError(error);
13058
13066
  for (let depth = 0;depth < 8 && current instanceof Error; depth++) {
13067
+ const { code } = current;
13068
+ if (typeof code === "string" && TLS_VERIFICATION_CODES.has(code)) {
13069
+ return true;
13070
+ }
13071
+ current = wrappedError(current);
13072
+ }
13073
+ return false;
13074
+ }
13075
+ function isConnectionFailure(error) {
13076
+ for (const current of causeChain(error)) {
13059
13077
  const { code, fatal } = current;
13060
13078
  if (typeof code === "string") {
13061
13079
  if (NODE_CONNECTION_CODES.has(code))
13062
13080
  return true;
13063
13081
  if (POSTGRES_CONNECTION_SQLSTATE.test(code))
13064
13082
  return true;
13083
+ if (SQLSERVER_CONNECTION_CODES.has(code) || isSqlserverConnectTimeout(current, code)) {
13084
+ return !causeChainHasTlsVerificationFailure(current);
13085
+ }
13065
13086
  }
13066
13087
  if (fatal === true && !isMysqlConfigFault(code))
13067
13088
  return true;
@@ -13069,13 +13090,18 @@ function isConnectionFailure(error) {
13069
13090
  if (CODELESS_CONNECTION_MESSAGES.some((re) => re.test(message))) {
13070
13091
  return true;
13071
13092
  }
13072
- current = current.cause;
13073
13093
  }
13074
13094
  return false;
13075
13095
  }
13076
- function isCredentialRejection(error) {
13096
+ function* causeChain(error) {
13077
13097
  let current = error;
13078
13098
  for (let depth = 0;depth < 8 && current instanceof Error; depth++) {
13099
+ yield current;
13100
+ current = wrappedError(current);
13101
+ }
13102
+ }
13103
+ function isCredentialRejection(error) {
13104
+ for (const current of causeChain(error)) {
13079
13105
  const { code } = current;
13080
13106
  if (typeof code === "string" || typeof code === "number") {
13081
13107
  const value = String(code);
@@ -13083,12 +13109,13 @@ function isCredentialRejection(error) {
13083
13109
  return true;
13084
13110
  if (MYSQL_AUTH_CODES.has(value))
13085
13111
  return true;
13112
+ if (SQLSERVER_AUTH_CODES.has(value))
13113
+ return true;
13086
13114
  if (SNOWFLAKE_AUTH_CODES.has(value))
13087
13115
  return true;
13088
13116
  }
13089
13117
  if (current.name === "BigQueryAuthenticationError")
13090
13118
  return true;
13091
- current = current.cause;
13092
13119
  }
13093
13120
  return false;
13094
13121
  }
@@ -13103,6 +13130,19 @@ function databaseAccessFailure(error) {
13103
13130
  return new ConnectionFailedError(message);
13104
13131
  return;
13105
13132
  }
13133
+ function statementRejection(error) {
13134
+ for (const current of causeChain(error)) {
13135
+ const { code, severity } = current;
13136
+ if (severity === "FATAL" || severity === "PANIC")
13137
+ return;
13138
+ if (typeof code !== "string" || !POSTGRES_STATEMENT_SQLSTATES.has(code)) {
13139
+ continue;
13140
+ }
13141
+ const message = current.message;
13142
+ return code === POSTGRES_UNDEFINED_TABLE && POSTGRES_RELATION_MISSING.test(message) ? new TableNotFoundError(message) : new InvalidArgumentError(message);
13143
+ }
13144
+ return;
13145
+ }
13106
13146
  function describeFilesystemAccessFailure(errno) {
13107
13147
  const code = errno.code ?? "";
13108
13148
  const target = errno.path ? ` '${errno.path}'` : "";
@@ -13242,7 +13282,7 @@ function toQueryTextProblem(problem) {
13242
13282
  ...problem.at ? { at: { range: problem.at.range } } : {}
13243
13283
  };
13244
13284
  }
13245
- var GENERIC_INTERNAL_MESSAGE = "Internal server error.", GENERIC_UPSTREAM_MESSAGE = "Upstream connection error.", GENERIC_UNREACHABLE_MESSAGE = "The database connection is down: the database could not be reached, so the query did not run.", GENERIC_AUTH_MESSAGE = "The database rejected the connection's credentials. Check the connection's user, password, key or token.", MAX_LOGGED_DETAIL_CHARS = 2000, FILESYSTEM_ACCESS_DESCRIPTIONS, NODE_CONNECTION_CODES, POSTGRES_CONNECTION_SQLSTATE, CODELESS_CONNECTION_MESSAGES, MYSQL_CONFIG_CODES, POSTGRES_AUTH_SQLSTATE, MYSQL_AUTH_CODES, SNOWFLAKE_AUTH_CODES, NotImplementedError, BadRequestError, InvalidArgumentError, CompileRefusedError, InvalidModelPathError, RenderTagRefusedError, UnparseableTextError, EnvironmentNotFoundError, PackageNotFoundError, ModelNotFoundError, DashboardNotFoundError, SkillNotFoundError, AgentNotFoundError, ConflictError, ConnectionNotFoundError, TableNotFoundError, ConnectionError, ConnectionFailedError, UnconfiguredConnectionError, ConnectionPoolExhaustedError, DestinationNotFoundError, ConnectionAuthError, UnsupportedCatalogFormatError, ModelCompilationError, PackageManifestError, MaterializationEligibilityError, ChainedUpstreamMissingError, ChainedShapeNotCarriedError, PublisherConfigError, ServerConfigurationError, FrozenConfigError, AccessDeniedError, QueryCompileError, NotQueryableError, OffSurfaceError, MaterializationNotFoundError, MaterializationConflictError, WriteConflictError, WriteRolledBackError, WriteRollbackFailedError, WriteVerifyError, InvalidStateTransitionError, ServiceUnavailableError, PackageAdmissionRefusedError, PayloadTooLargeError, ResponseUnserializableError, QueryTimeoutError;
13285
+ var GENERIC_INTERNAL_MESSAGE = "Internal server error.", GENERIC_UPSTREAM_MESSAGE = "Upstream connection error.", GENERIC_UNREACHABLE_MESSAGE = "The database connection is down: the database could not be reached, so the query did not run.", GENERIC_AUTH_MESSAGE = "The database rejected the connection's credentials. Check the connection's user, password, key or token.", MAX_LOGGED_DETAIL_CHARS = 2000, FILESYSTEM_ACCESS_DESCRIPTIONS, NODE_CONNECTION_CODES, POSTGRES_CONNECTION_SQLSTATE, CODELESS_CONNECTION_MESSAGES, MYSQL_CONFIG_CODES, SQLSERVER_CONNECTION_CODES, TLS_VERIFICATION_CODES, POSTGRES_AUTH_SQLSTATE, MYSQL_AUTH_CODES, SQLSERVER_AUTH_CODES, SNOWFLAKE_AUTH_CODES, POSTGRES_STATEMENT_SQLSTATES, POSTGRES_UNDEFINED_TABLE = "42P01", POSTGRES_RELATION_MISSING, NotImplementedError, BadRequestError, InvalidArgumentError, CompileRefusedError, InvalidModelPathError, RenderTagRefusedError, UnparseableTextError, EnvironmentNotFoundError, PackageNotFoundError, ModelNotFoundError, DashboardNotFoundError, SkillNotFoundError, AgentNotFoundError, ConflictError, ConnectionNotFoundError, TableNotFoundError, ConnectionError, ConnectionFailedError, UnconfiguredConnectionError, ConnectionPoolExhaustedError, DestinationNotFoundError, ConnectionAuthError, UnsupportedCatalogFormatError, ModelCompilationError, PackageManifestError, MaterializationEligibilityError, ChainedUpstreamMissingError, ChainedShapeNotCarriedError, PublisherConfigError, ServerConfigurationError, FrozenConfigError, AccessDeniedError, QueryCompileError, NotQueryableError, OffSurfaceError, MaterializationNotFoundError, MaterializationConflictError, WriteConflictError, WriteRolledBackError, WriteRollbackFailedError, WriteVerifyError, InvalidStateTransitionError, ServiceUnavailableError, PackageAdmissionRefusedError, PayloadTooLargeError, ResponseUnserializableError, QueryTimeoutError;
13246
13286
  var init_errors = __esm(() => {
13247
13287
  init_constants();
13248
13288
  init_logger();
@@ -13268,7 +13308,8 @@ var init_errors = __esm(() => {
13268
13308
  /^(Error: )?Connection lost: The server closed the connection\.$/,
13269
13309
  new RegExp(`^(Error: )?(connect|read|write|getaddrinfo) (${[
13270
13310
  ...NODE_CONNECTION_CODES
13271
- ].join("|")})\\b`)
13311
+ ].join("|")})\\b`),
13312
+ /^Failed to connect to \S+( \(redirected from \S+\))?( in \d+ms| - (?!.*certificate).+)$/i
13272
13313
  ];
13273
13314
  MYSQL_CONFIG_CODES = new Set([
13274
13315
  "ER_ACCESS_DENIED_ERROR",
@@ -13277,9 +13318,46 @@ var init_errors = __esm(() => {
13277
13318
  "AUTH_SWITCH_PLUGIN_ERROR",
13278
13319
  "MYSQL_CLEAR_PASSWORD_NOT_ENABLED"
13279
13320
  ]);
13321
+ SQLSERVER_CONNECTION_CODES = new Set(["ESOCKET", "EINSTLOOKUP"]);
13322
+ TLS_VERIFICATION_CODES = new Set([
13323
+ "CERT_HAS_EXPIRED",
13324
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
13325
+ "ERR_TLS_CERT_ALTNAME_INVALID",
13326
+ "SELF_SIGNED_CERT_IN_CHAIN",
13327
+ "UNABLE_TO_GET_ISSUER_CERT",
13328
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
13329
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE"
13330
+ ]);
13280
13331
  POSTGRES_AUTH_SQLSTATE = /^28[0-9A-Z]{3}$/;
13281
13332
  MYSQL_AUTH_CODES = new Set(["ER_ACCESS_DENIED_ERROR"]);
13333
+ SQLSERVER_AUTH_CODES = new Set(["ELOGIN"]);
13282
13334
  SNOWFLAKE_AUTH_CODES = new Set(["390100", "390144", "390195", "390318"]);
13335
+ POSTGRES_STATEMENT_SQLSTATES = new Set([
13336
+ "42601",
13337
+ "42703",
13338
+ "42P01",
13339
+ "42883",
13340
+ "42704",
13341
+ "42P02",
13342
+ "42702",
13343
+ "42725",
13344
+ "42P09",
13345
+ "42P10",
13346
+ "42804",
13347
+ "42846",
13348
+ "42803",
13349
+ "42P20",
13350
+ "42P18",
13351
+ "42P19",
13352
+ "42712",
13353
+ "42701",
13354
+ "42602",
13355
+ "42622",
13356
+ "42809",
13357
+ "42P21",
13358
+ "42P22"
13359
+ ]);
13360
+ POSTGRES_RELATION_MISSING = /^relation ".*" does not exist$/;
13283
13361
  NotImplementedError = class NotImplementedError extends Error {
13284
13362
  constructor(message) {
13285
13363
  super(message);
@@ -23908,6 +23986,15 @@ class RpcWaitAccountant {
23908
23986
  }
23909
23987
  }
23910
23988
 
23989
+ // src/service/experimental_dialects.ts
23990
+ import { getDialect } from "@malloydata/malloy";
23991
+ var BUNDLED_EXPERIMENTAL_DIALECTS = ["sqlserver"];
23992
+ function acceptBundledExperimentalDialects() {
23993
+ for (const name of BUNDLED_EXPERIMENTAL_DIALECTS) {
23994
+ getDialect(name).acceptExperimental();
23995
+ }
23996
+ }
23997
+
23911
23998
  // src/materialization_metrics.ts
23912
23999
  var resetHooks = [];
23913
24000
  function lazyCounter(name, description) {
@@ -23943,7 +24030,7 @@ var storageServeRoutingCounter = lazyCounter("publisher_storage_serve_routing_to
23943
24030
  var storageTableRetainedCounter = lazyCounter("publisher_storage_tables_retained_total", "Tables a FAILED run left in a storage= destination and deliberately did not " + "reclaim, because the source is refreshed incrementally and the name may be " + "the one it serves from. Label: destination. Not all of these are orphans — " + "a rebuild at a fresh generational name is, a seed on the live serving name " + "is not, and the manifest entry cannot separate them — so read this as an " + "upper bound on what is accumulating rather than a leak count. It is the " + "only accounting there is until reclaiming a destination exists, which is " + "why it is a counter and not just a log line: the question is a rate, not " + "whether it ever happened.");
23944
24031
  var storageBuildFailureCounter = lazyCounter("publisher_storage_build_failures_total", "storage= build failures (federation/passthrough/attach/CTAS), distinct from " + "in-warehouse build failures. Labels: destination (connection name), " + "reason ('build_failed'|'billed_read_not_captured'). The second is the " + "expensive one: the warehouse read ran and was charged, and the rows could " + "not be captured — so a re-drive pays for it again. Worth alerting on " + "separately from a failure that costs only a retry.");
23945
24032
  var attributionSkippedCounter = lazyCounter("publisher_storage_build_attribution_skipped_total", "storage= builds whose warehouse read went out UNATTRIBUTED while tagging was " + "on. Label: reason ('job_listing_unavailable'|'tag_failed'|" + "'read_row_not_found'|'read_row_ambiguous'|'cost_query_failed'). " + "The read still ran and the " + "build still succeeded — what was lost is the label in the customer's own " + "query history, and the cost on this side. Without this an operator who " + "turns tagging on and sees nothing has a single log line to go on.");
23946
- var eligibilityRefusedCounter = lazyCounter("publisher_materialization_eligibility_refused_total", "materialization-eligibility refusals, both tiers. Label: reason " + "('free_parameter'|'given_in_persisted_query'|'dynamic_projection'|" + "'dynamic_join'|'dynamic_joined_where'|'partition_without_storage'|" + "'partition_column_unknown'|'partition_column_not_public'|" + "'merge_key_scope_unresolved'|'preaggregate_over_dynamic_source'|" + "'authorize'|'partition'|'not_duckdb_portable'|" + "'public_surface_unknown'). 'given' is retained on the enum for records " + "that carry it and is no longer produced: where a given sits decides the " + "outcome, so one reason covering every placement cannot be raised.");
24033
+ var eligibilityRefusedCounter = lazyCounter("publisher_materialization_eligibility_refused_total", "materialization-eligibility refusals, both tiers. Label: reason " + "('free_parameter'|'given_in_persisted_query'|'dynamic_projection'|" + "'dynamic_join'|'dynamic_joined_where'|'partition_without_storage'|" + "'partition_column_unknown'|'partition_column_not_public'|" + "'merge_key_scope_unresolved'|'preaggregate_over_dynamic_source'|" + "'authorize'|'partition'|'not_duckdb_portable'|" + "'public_surface_unknown'|'read_only_dialect'). 'given' is retained on the enum for records " + "that carry it and is no longer produced: where a given sits decides the " + "outcome, so one reason covering every placement cannot be raised.");
23947
24034
  var serveShapeTierDropCounter = lazyCounter("publisher_storage_serve_shape_tier_drop_total", "storage serve-shape compile escalations: a refinement tier failed to " + "compile and the riskiest category was dropped, or one or more lifted " + "entry points failed to compile and were dropped alone. Label: tier (the " + "failed tier index, 0=full; 'lifts' for dropped lifts).");
23948
24035
  var serveShapeTypeFallbackCounter = lazyCounter("publisher_storage_serve_shape_type_fallback_total", "Captured DuckDB column types mapped to json in the serve shape (type " + "fidelity loss). Label: kind ('array'|'unrecognized').");
23949
24036
  var chainedStorageBuildCounter = lazyCounter("publisher_storage_chained_build_total", "Chained storage= source builds (a source reading a storage-materialized " + "upstream). Label: outcome ('parent_reuse'|'inline_fallback'|" + "'strict_shape_fallback'|'strict_refused'|'infra_failure'). The " + "parent_reuse share is the headline signal for how far the " + "stack-on-the-parent path gets us vs recompute-from-raw.");
@@ -25132,7 +25219,16 @@ function assertMergeKeyScopeResolvable(persistSource, terms, annotationFields, w
25132
25219
  message: `${what} cannot be materialized: it declares 'merge_key=' and is ` + `scoped by a term this pass cannot express as a predicate over the ` + `stored table's own columns (${unscopable.map((term) => `'${term.code}'`).join(", ")}). An incremental refresh matches rows by the merge ` + `key, and the stored table holds every caller's rows, so the match ` + `must also carry the scoping columns or it would update rows ` + `belonging to other callers. Scope this source with a term over its ` + `own columns, or drop 'merge_key=' to refresh by watermark range.`
25133
25220
  });
25134
25221
  }
25222
+ var READ_ONLY_DIALECTS = new Set(["sqlserver"]);
25135
25223
  function assertColocatedPersistNotAuthorizeGated(persistSource, sourceName = persistSource.name, origin = "persist", gateOutcome, annotationFields = {}) {
25224
+ if (!annotationFields.storage && READ_ONLY_DIALECTS.has(persistSource.dialectName)) {
25225
+ recordEligibilityRefused("read_only_dialect");
25226
+ const what2 = origin === "preaggregate" ? `Pre-aggregation rollup '${sourceName}'` : `Source '${sourceName}'`;
25227
+ throw new MaterializationEligibilityError({
25228
+ reason: "read_only_dialect",
25229
+ message: `${what2} cannot be materialized (colocated '#@ persist'): its ` + `connection '${persistSource.connectionName}' is on the ` + `'${persistSource.dialectName}' dialect, whose connection is ` + `read-only and creates no tables, so there is nowhere in the ` + `source warehouse to write the result. The source serves live. ` + `Remove the annotation, or persist a source on a connection that ` + `can write.`
25230
+ });
25231
+ }
25136
25232
  const partition = resolvePartitionColumns(persistSource, annotationFields);
25137
25233
  if (!partition.ok) {
25138
25234
  recordEligibilityRefused(partition.reason);
@@ -25867,6 +25963,7 @@ function collectColocatedSourceEligibility(compiled) {
25867
25963
  if (!parentPort) {
25868
25964
  throw new Error("package_load_worker.ts must be loaded inside a worker_threads Worker");
25869
25965
  }
25966
+ acceptBundledExperimentalDialects();
25870
25967
  var port = parentPort;
25871
25968
  var nextRpcId = 0;
25872
25969
  var pendingRpc = new Map;