@malloy-publisher/server 0.9.14 → 0.9.16

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 (26) hide show
  1. package/dist/app/api-doc.yaml +33 -10
  2. package/dist/app/assets/{EnvironmentPage-C0Y7JsgF.js → EnvironmentPage-BfcAd2yi.js} +1 -1
  3. package/dist/app/assets/{HomePage-B3LsCOlr.js → HomePage-Ci_5k81i.js} +1 -1
  4. package/dist/app/assets/{MainPage-BCDlscxh.js → MainPage-D3QeyfA0.js} +1 -1
  5. package/dist/app/assets/{ModelPage-DGXivK0m.js → ModelPage-Bpeml30i.js} +2 -2
  6. package/dist/app/assets/PackagePage-C9Ptmg2y.js +1 -0
  7. package/dist/app/assets/RenderedResult-DxmHGZNQ.es-D0Ona1d0.js +171 -0
  8. package/dist/app/assets/{RouteError-1Eclkzb_.js → RouteError-C8LT19mj.js} +1 -1
  9. package/dist/app/assets/{ThemeEditorPage-loRmpKoQ.js → ThemeEditorPage-CynRJmSm.js} +1 -1
  10. package/dist/app/assets/{ToggleButtonGroup-CnciHZDP.js → ToggleButtonGroup-ChqidtS2.js} +1 -1
  11. package/dist/app/assets/{documentRoutes-e6eAjpuN.js → documentRoutes-DZ-IkgZk.js} +1 -1
  12. package/dist/app/assets/{editPageMounted-BiGObPJ4.js → editPageMounted-BaIkidNI.js} +2 -2
  13. package/dist/app/assets/{index-Bp7WJqoi.js → index-CIAQd_g-.js} +1 -1
  14. package/dist/app/assets/{index-1Jwtzdx_.js → index-CtRRADnY.js} +1 -1
  15. package/dist/app/assets/{index-Dnzp7ChL.js → index-Cu8EElmh.js} +1 -1
  16. package/dist/app/assets/index-Dzz5PLbw.js +481 -0
  17. package/dist/app/assets/index.es-DvW5H23D.js +144 -0
  18. package/dist/app/index.html +1 -1
  19. package/dist/instrumentation.mjs +42 -1
  20. package/dist/package_load_worker.mjs +230 -127
  21. package/dist/server.mjs +90093 -90403
  22. package/package.json +7 -5
  23. package/dist/app/assets/PackagePage-BBvnnh9f.js +0 -1
  24. package/dist/app/assets/RenderedResult-DnBtf-cI.es-Bs8KIO86.js +0 -153
  25. package/dist/app/assets/index-B_gOHtqJ.js +0 -481
  26. package/dist/app/assets/index.es-396NBJA3.js +0 -143
@@ -16,7 +16,7 @@ SPDX-License-Identifier: MIT
16
16
  href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
17
17
  />
18
18
  <title>Malloy Publisher</title>
19
- <script type="module" crossorigin src="/assets/index-B_gOHtqJ.js"></script>
19
+ <script type="module" crossorigin src="/assets/index-Dzz5PLbw.js"></script>
20
20
  <link rel="stylesheet" crossorigin href="/assets/index-DUqldpo0.css">
21
21
  </head>
22
22
  <body>
@@ -167012,6 +167012,47 @@ var REQUEST_DURATION_BUCKETS_MS = [
167012
167012
  1e4,
167013
167013
  60000
167014
167014
  ];
167015
+ var instrumentResets = [];
167016
+ function lazyInstrument(create) {
167017
+ let instrument = null;
167018
+ instrumentResets.push(() => instrument = null);
167019
+ return () => instrument ??= create();
167020
+ }
167021
+ function lazyCounter(name, description, unit) {
167022
+ return lazyInstrument(() => publisherMeter().createCounter(name, {
167023
+ description,
167024
+ ...unit ? { unit } : {}
167025
+ }));
167026
+ }
167027
+ function lazyHistogram(name, description, { unit = "ms", buckets } = {}) {
167028
+ return lazyInstrument(() => publisherMeter().createHistogram(name, {
167029
+ description,
167030
+ ...unit ? { unit } : {},
167031
+ ...buckets ? { advice: { explicitBucketBoundaries: buckets } } : {}
167032
+ }));
167033
+ }
167034
+ var tracer = () => import_api.trace.getTracer(METER_NAME);
167035
+ async function withSpan(name, attributes, fn, spanTracer = tracer()) {
167036
+ return spanTracer.startActiveSpan(name, { attributes }, async (span) => {
167037
+ try {
167038
+ return await fn(span);
167039
+ } catch (error) {
167040
+ span.recordException(error);
167041
+ span.setStatus({
167042
+ code: import_api.SpanStatusCode.ERROR,
167043
+ message: error instanceof Error ? error.message : String(error)
167044
+ });
167045
+ throw error;
167046
+ } finally {
167047
+ span.end();
167048
+ }
167049
+ });
167050
+ }
167051
+ // package.json
167052
+ var version = "0.9.16";
167053
+
167054
+ // src/version.ts
167055
+ var SERVER_VERSION = version;
167015
167056
 
167016
167057
  // src/instrumentation.ts
167017
167058
  var prometheusExporter = null;
@@ -167045,7 +167086,7 @@ function instrument() {
167045
167086
  sdk = new import_sdk_node.NodeSDK({
167046
167087
  resource: import_resources.resourceFromAttributes({
167047
167088
  [import_semantic_conventions.ATTR_SERVICE_NAME]: "publisher",
167048
- [import_semantic_conventions.ATTR_SERVICE_VERSION]: "1.0.0"
167089
+ [import_semantic_conventions.ATTR_SERVICE_VERSION]: SERVER_VERSION
167049
167090
  }),
167050
167091
  autoDetectResources: true,
167051
167092
  metricReader: prometheusExporter,
@@ -12074,8 +12074,8 @@ var require_exception_handler = __commonJS((exports, module) => {
12074
12074
  };
12075
12075
  }
12076
12076
  getTrace(err) {
12077
- const trace = err ? stackTrace.parse(err) : stackTrace.get();
12078
- return trace.map((site) => {
12077
+ const trace2 = err ? stackTrace.parse(err) : stackTrace.get();
12078
+ return trace2.map((site) => {
12079
12079
  return {
12080
12080
  column: site.getColumnNumber(),
12081
12081
  file: site.getFileName(),
@@ -12241,8 +12241,8 @@ var require_rejection_handler = __commonJS((exports, module) => {
12241
12241
  };
12242
12242
  }
12243
12243
  getTrace(err) {
12244
- const trace = err ? stackTrace.parse(err) : stackTrace.get();
12245
- return trace.map((site) => {
12244
+ const trace2 = err ? stackTrace.parse(err) : stackTrace.get();
12245
+ return trace2.map((site) => {
12246
12246
  return {
12247
12247
  column: site.getColumnNumber(),
12248
12248
  file: site.getFileName(),
@@ -13024,32 +13024,7 @@ var init_logger = __esm(() => {
13024
13024
  SENSITIVE_KEYS = new Set(SENSITIVE_KEY_NAMES.map((name) => name.toLowerCase()));
13025
13025
  });
13026
13026
 
13027
- // src/errors.ts
13028
- import { MalloyError } from "@malloydata/malloy";
13029
- function logInternalFailure(summary, error, level = "error") {
13030
- const strip = (value) => value.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, " ");
13031
- const message = error.message ?? "";
13032
- const stack = error.stack ?? "";
13033
- const framesOnly = stack.startsWith(`${error.name}: ${message}`) ? stack.slice(`${error.name}: ${message}`.length).replace(/^\r?\n/, "") : stack;
13034
- logger[level](summary, {
13035
- error: {
13036
- name: error.name,
13037
- message: strip(message).slice(0, MAX_LOGGED_DETAIL_CHARS),
13038
- stack: strip(framesOnly).slice(0, MAX_LOGGED_DETAIL_CHARS)
13039
- }
13040
- });
13041
- }
13042
- function filesystemAccessFailure(error) {
13043
- let current = error;
13044
- for (let depth = 0;depth < 8 && current instanceof Error; depth++) {
13045
- const errno = current;
13046
- if (typeof errno.code === "string" && errno.code in FILESYSTEM_ACCESS_DESCRIPTIONS && typeof errno.syscall === "string") {
13047
- return errno;
13048
- }
13049
- current = errno.cause;
13050
- }
13051
- return;
13052
- }
13027
+ // src/driver_errors.ts
13053
13028
  function isMysqlConfigFault(code) {
13054
13029
  return typeof code === "string" && (MYSQL_CONFIG_CODES.has(code) || code.startsWith("HANDSHAKE_"));
13055
13030
  }
@@ -13119,6 +13094,165 @@ function isCredentialRejection(error) {
13119
13094
  }
13120
13095
  return false;
13121
13096
  }
13097
+ var 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;
13098
+ var init_driver_errors = __esm(() => {
13099
+ NODE_CONNECTION_CODES = new Set([
13100
+ "ECONNREFUSED",
13101
+ "ECONNRESET",
13102
+ "ECONNABORTED",
13103
+ "EPIPE",
13104
+ "ETIMEDOUT",
13105
+ "EAI_AGAIN",
13106
+ "EHOSTUNREACH",
13107
+ "ENETUNREACH"
13108
+ ]);
13109
+ POSTGRES_CONNECTION_SQLSTATE = /^(08[0-9A-Z]{3}|57P0[123])$/;
13110
+ CODELESS_CONNECTION_MESSAGES = [
13111
+ /^Connection terminated unexpectedly$/,
13112
+ /^(Error: )?Can't add new command when connection is in closed state$/,
13113
+ /^(Error: )?Connection lost: The server closed the connection\.$/,
13114
+ new RegExp(`^(Error: )?(connect|read|write|getaddrinfo) (${[
13115
+ ...NODE_CONNECTION_CODES
13116
+ ].join("|")})\\b`),
13117
+ /^Failed to connect to \S+( \(redirected from \S+\))?( in \d+ms| - (?!.*certificate).+)$/i
13118
+ ];
13119
+ MYSQL_CONFIG_CODES = new Set([
13120
+ "ER_ACCESS_DENIED_ERROR",
13121
+ "ER_BAD_DB_ERROR",
13122
+ "ER_NOT_SUPPORTED_AUTH_MODE",
13123
+ "AUTH_SWITCH_PLUGIN_ERROR",
13124
+ "MYSQL_CLEAR_PASSWORD_NOT_ENABLED"
13125
+ ]);
13126
+ SQLSERVER_CONNECTION_CODES = new Set(["ESOCKET", "EINSTLOOKUP"]);
13127
+ TLS_VERIFICATION_CODES = new Set([
13128
+ "CERT_HAS_EXPIRED",
13129
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
13130
+ "ERR_TLS_CERT_ALTNAME_INVALID",
13131
+ "SELF_SIGNED_CERT_IN_CHAIN",
13132
+ "UNABLE_TO_GET_ISSUER_CERT",
13133
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
13134
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE"
13135
+ ]);
13136
+ POSTGRES_AUTH_SQLSTATE = /^28[0-9A-Z]{3}$/;
13137
+ MYSQL_AUTH_CODES = new Set(["ER_ACCESS_DENIED_ERROR"]);
13138
+ SQLSERVER_AUTH_CODES = new Set(["ELOGIN"]);
13139
+ SNOWFLAKE_AUTH_CODES = new Set(["390100", "390144", "390195", "390318"]);
13140
+ });
13141
+
13142
+ // src/pg_helpers.ts
13143
+ function redactPgSecrets(s) {
13144
+ return redactUserinfoPasswords(redactUserinfoPasswords(s, ANY_SCHEME_LAST_AT), PG_SCHEME_FIRST_AT).replace(/password=('(?:\\.|[^'\\])*'|"[^"]*"|\S+)/gi, "password=***");
13145
+ }
13146
+ function runEnd(run, s, from) {
13147
+ run.lastIndex = from;
13148
+ run.exec(s);
13149
+ return run.lastIndex;
13150
+ }
13151
+ function redactUserinfoPasswords(s, pass) {
13152
+ let out = "";
13153
+ let copied = 0;
13154
+ let stop = -1;
13155
+ let sep = s.indexOf("://");
13156
+ while (sep !== -1) {
13157
+ const userEnd = runEnd(USERNAME_RUN, s, sep + 3);
13158
+ let at = -1;
13159
+ if (s[userEnd] === ":" && pass.hasScheme(s, sep, copied)) {
13160
+ const from = userEnd + 1;
13161
+ if (stop < from)
13162
+ stop = runEnd(pass.passwordRun, s, from);
13163
+ at = pass.passwordEnd(s, from, stop);
13164
+ }
13165
+ if (at === -1) {
13166
+ sep = s.indexOf("://", sep + 1);
13167
+ continue;
13168
+ }
13169
+ out += s.slice(copied, userEnd + 1) + "***@";
13170
+ copied = at + 1;
13171
+ sep = s.indexOf("://", copied);
13172
+ }
13173
+ return out + s.slice(copied);
13174
+ }
13175
+ function redactConnectionSecretShapes(s) {
13176
+ return redactPgSecrets(s.replace(PEM_TERMINATED_PATTERN, "***").replace(PEM_UNTERMINATED_PATTERN, "***").replace(SECRET_QUOTED_PATTERN, "$1***").replace(SECRET_BARE_PATTERN, "$1***"));
13177
+ }
13178
+ var USERNAME_RUN, SCHEME_CHAR, SCHEME_LETTER, PG_SCHEMES, ANY_SCHEME_LAST_AT, PG_SCHEME_FIRST_AT, SECRET_FIELD_NAMES, NAME_ALTERNATION, SECRET_QUOTED_PATTERN, SECRET_BARE_PATTERN, PEM_TERMINATED_PATTERN, PEM_UNTERMINATED_PATTERN;
13179
+ var init_pg_helpers = __esm(() => {
13180
+ USERNAME_RUN = /[^:/?#\s]*/y;
13181
+ SCHEME_CHAR = /[a-z0-9+.-]/i;
13182
+ SCHEME_LETTER = /[a-z]/i;
13183
+ PG_SCHEMES = ["postgres", "postgresql"];
13184
+ ANY_SCHEME_LAST_AT = {
13185
+ hasScheme(s, sep, floor) {
13186
+ for (let i = sep - 1;i >= floor && SCHEME_CHAR.test(s[i]); i--) {
13187
+ if (SCHEME_LETTER.test(s[i]))
13188
+ return true;
13189
+ }
13190
+ return false;
13191
+ },
13192
+ passwordRun: /[^/\s]*/y,
13193
+ passwordEnd(s, from, stop) {
13194
+ const at = s.slice(from, stop).lastIndexOf("@");
13195
+ return at > 0 ? from + at : -1;
13196
+ }
13197
+ };
13198
+ PG_SCHEME_FIRST_AT = {
13199
+ hasScheme(s, sep, floor) {
13200
+ return PG_SCHEMES.some((scheme) => sep - scheme.length >= floor && s.slice(sep - scheme.length, sep).toLowerCase() === scheme);
13201
+ },
13202
+ passwordRun: /[^@\s]*/y,
13203
+ passwordEnd(s, from, stop) {
13204
+ return stop > from && s[stop] === "@" ? stop : -1;
13205
+ }
13206
+ };
13207
+ SECRET_FIELD_NAMES = [
13208
+ "password",
13209
+ "privateKey",
13210
+ "privateKeyPass",
13211
+ "serviceAccountKeyJson",
13212
+ "accessToken",
13213
+ "oauthClientSecret",
13214
+ "clientSecret",
13215
+ "secretAccessKey",
13216
+ "sessionToken",
13217
+ "peakaKey",
13218
+ "sasUrl",
13219
+ "connectionString",
13220
+ "token",
13221
+ "secret"
13222
+ ];
13223
+ NAME_ALTERNATION = SECRET_FIELD_NAMES.map((n) => n.replace(/([A-Z])/g, "[_-]?$1")).join("|");
13224
+ SECRET_QUOTED_PATTERN = new RegExp(String.raw`(["']?(?:${NAME_ALTERNATION})["']?\s*[:=]\s*)(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')`, "gi");
13225
+ SECRET_BARE_PATTERN = new RegExp(String.raw`(["']?(?:${NAME_ALTERNATION})["']?\s*=\s*)(?:[^,;\s}"']+)`, "gi");
13226
+ PEM_TERMINATED_PATTERN = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----(?:(?!-----BEGIN )[\s\S])*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g;
13227
+ PEM_UNTERMINATED_PATTERN = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*$/;
13228
+ });
13229
+
13230
+ // src/errors.ts
13231
+ import { MalloyError } from "@malloydata/malloy";
13232
+ function logInternalFailure(summary, error, level = "error") {
13233
+ const strip = (value) => value.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, " ");
13234
+ const message = error.message ?? "";
13235
+ const stack = error.stack ?? "";
13236
+ const framesOnly = stack.startsWith(`${error.name}: ${message}`) ? stack.slice(`${error.name}: ${message}`.length).replace(/^\r?\n/, "") : stack;
13237
+ logger[level](summary, {
13238
+ error: {
13239
+ name: error.name,
13240
+ message: redactPgSecrets(strip(message)).slice(0, MAX_LOGGED_DETAIL_CHARS),
13241
+ stack: redactPgSecrets(strip(framesOnly)).slice(0, MAX_LOGGED_DETAIL_CHARS)
13242
+ }
13243
+ });
13244
+ }
13245
+ function filesystemAccessFailure(error) {
13246
+ let current = error;
13247
+ for (let depth = 0;depth < 8 && current instanceof Error; depth++) {
13248
+ const errno = current;
13249
+ if (typeof errno.code === "string" && errno.code in FILESYSTEM_ACCESS_DESCRIPTIONS && typeof errno.syscall === "string") {
13250
+ return errno;
13251
+ }
13252
+ current = errno.cause;
13253
+ }
13254
+ return;
13255
+ }
13122
13256
  function databaseAccessFailure(error) {
13123
13257
  if (error instanceof ConnectionAuthError || error instanceof ConnectionFailedError || error instanceof UnconfiguredConnectionError) {
13124
13258
  return error;
@@ -13217,6 +13351,8 @@ function internalErrorToHttpError(error, { log = true, onLogged } = {}) {
13217
13351
  return httpError(404, error.message);
13218
13352
  } else if (error instanceof StorageDestinationNotFoundError) {
13219
13353
  return httpError(404, error.message);
13354
+ } else if (error instanceof StorageCatalogNotFoundError) {
13355
+ return httpError(404, error.message);
13220
13356
  } else if (error instanceof DestinationNotFoundError) {
13221
13357
  return httpError(422, error.message);
13222
13358
  } else if (error instanceof ConnectionAuthError) {
@@ -13284,56 +13420,17 @@ function toQueryTextProblem(problem) {
13284
13420
  ...problem.at ? { at: { range: problem.at.range } } : {}
13285
13421
  };
13286
13422
  }
13287
- 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, StorageDestinationNotFoundError, 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;
13423
+ 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, 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, StorageDestinationNotFoundError, StorageCatalogNotFoundError, 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;
13288
13424
  var init_errors = __esm(() => {
13289
13425
  init_constants();
13290
13426
  init_logger();
13427
+ init_driver_errors();
13428
+ init_pg_helpers();
13291
13429
  FILESYSTEM_ACCESS_DESCRIPTIONS = {
13292
13430
  EACCES: "permission denied",
13293
13431
  EPERM: "operation not permitted",
13294
13432
  EROFS: "read-only file system"
13295
13433
  };
13296
- NODE_CONNECTION_CODES = new Set([
13297
- "ECONNREFUSED",
13298
- "ECONNRESET",
13299
- "ECONNABORTED",
13300
- "EPIPE",
13301
- "ETIMEDOUT",
13302
- "EAI_AGAIN",
13303
- "EHOSTUNREACH",
13304
- "ENETUNREACH"
13305
- ]);
13306
- POSTGRES_CONNECTION_SQLSTATE = /^(08[0-9A-Z]{3}|57P0[123])$/;
13307
- CODELESS_CONNECTION_MESSAGES = [
13308
- /^Connection terminated unexpectedly$/,
13309
- /^(Error: )?Can't add new command when connection is in closed state$/,
13310
- /^(Error: )?Connection lost: The server closed the connection\.$/,
13311
- new RegExp(`^(Error: )?(connect|read|write|getaddrinfo) (${[
13312
- ...NODE_CONNECTION_CODES
13313
- ].join("|")})\\b`),
13314
- /^Failed to connect to \S+( \(redirected from \S+\))?( in \d+ms| - (?!.*certificate).+)$/i
13315
- ];
13316
- MYSQL_CONFIG_CODES = new Set([
13317
- "ER_ACCESS_DENIED_ERROR",
13318
- "ER_BAD_DB_ERROR",
13319
- "ER_NOT_SUPPORTED_AUTH_MODE",
13320
- "AUTH_SWITCH_PLUGIN_ERROR",
13321
- "MYSQL_CLEAR_PASSWORD_NOT_ENABLED"
13322
- ]);
13323
- SQLSERVER_CONNECTION_CODES = new Set(["ESOCKET", "EINSTLOOKUP"]);
13324
- TLS_VERIFICATION_CODES = new Set([
13325
- "CERT_HAS_EXPIRED",
13326
- "DEPTH_ZERO_SELF_SIGNED_CERT",
13327
- "ERR_TLS_CERT_ALTNAME_INVALID",
13328
- "SELF_SIGNED_CERT_IN_CHAIN",
13329
- "UNABLE_TO_GET_ISSUER_CERT",
13330
- "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
13331
- "UNABLE_TO_VERIFY_LEAF_SIGNATURE"
13332
- ]);
13333
- POSTGRES_AUTH_SQLSTATE = /^28[0-9A-Z]{3}$/;
13334
- MYSQL_AUTH_CODES = new Set(["ER_ACCESS_DENIED_ERROR"]);
13335
- SQLSERVER_AUTH_CODES = new Set(["ELOGIN"]);
13336
- SNOWFLAKE_AUTH_CODES = new Set(["390100", "390144", "390195", "390318"]);
13337
13434
  POSTGRES_STATEMENT_SQLSTATES = new Set([
13338
13435
  "42601",
13339
13436
  "42703",
@@ -13463,6 +13560,11 @@ var init_errors = __esm(() => {
13463
13560
  super(message);
13464
13561
  }
13465
13562
  };
13563
+ StorageCatalogNotFoundError = class StorageCatalogNotFoundError extends Error {
13564
+ constructor(message) {
13565
+ super(message);
13566
+ }
13567
+ };
13466
13568
  ConnectionAuthError = class ConnectionAuthError extends Error {
13467
13569
  constructor(message) {
13468
13570
  super(message);
@@ -20352,16 +20454,49 @@ var REQUEST_DURATION_BUCKETS_MS = [
20352
20454
  1e4,
20353
20455
  60000
20354
20456
  ];
20457
+ var instrumentResets = [];
20458
+ function lazyInstrument(create) {
20459
+ let instrument = null;
20460
+ instrumentResets.push(() => instrument = null);
20461
+ return () => instrument ??= create();
20462
+ }
20463
+ function lazyCounter(name, description, unit) {
20464
+ return lazyInstrument(() => publisherMeter().createCounter(name, {
20465
+ description,
20466
+ ...unit ? { unit } : {}
20467
+ }));
20468
+ }
20469
+ function lazyHistogram(name, description, { unit = "ms", buckets } = {}) {
20470
+ return lazyInstrument(() => publisherMeter().createHistogram(name, {
20471
+ description,
20472
+ ...unit ? { unit } : {},
20473
+ ...buckets ? { advice: { explicitBucketBoundaries: buckets } } : {}
20474
+ }));
20475
+ }
20476
+ var tracer = () => import_api.trace.getTracer(METER_NAME);
20477
+ async function withSpan(name, attributes, fn, spanTracer = tracer()) {
20478
+ return spanTracer.startActiveSpan(name, { attributes }, async (span) => {
20479
+ try {
20480
+ return await fn(span);
20481
+ } catch (error) {
20482
+ span.recordException(error);
20483
+ span.setStatus({
20484
+ code: import_api.SpanStatusCode.ERROR,
20485
+ message: error instanceof Error ? error.message : String(error)
20486
+ });
20487
+ throw error;
20488
+ } finally {
20489
+ span.end();
20490
+ }
20491
+ });
20492
+ }
20355
20493
 
20356
20494
  // src/deprecated_usage_metrics.ts
20357
- var counter = null;
20495
+ var counter = lazyCounter("publisher_deprecated_usage_total", "Uses of a deprecated feature: a request to a legacy route or carrying a legacy parameter, or a package load or reload that uses one. Labels: feature.");
20358
20496
  function recordDeprecatedUsage(feature, count = 1) {
20359
20497
  if (count <= 0)
20360
20498
  return;
20361
- counter ??= publisherMeter().createCounter("publisher_deprecated_usage_total", {
20362
- description: "Uses of a deprecated feature: a request to a legacy route or carrying a legacy parameter, or a package load or reload that uses one. Labels: feature."
20363
- });
20364
- counter.add(count, { feature });
20499
+ counter().add(count, { feature });
20365
20500
  }
20366
20501
 
20367
20502
  // src/service/deprecated/manifest_keys.ts
@@ -21826,50 +21961,32 @@ ${rewrites}
21826
21961
  }
21827
21962
 
21828
21963
  // src/authorize_metrics.ts
21829
- var guardRejectionCounter = null;
21830
- var bypassCounter = null;
21831
- var rowLevelDecisionCounter = null;
21832
- var rowLevelRejectionCounter = null;
21833
- var admitAllCounter = null;
21834
- var lockDecisionCounter = null;
21964
+ var guardRejectionCounter = lazyCounter("publisher_authorize_guard_rejected_total", "Requests rejected with 400 for declaring an `#(authorize)` annotation in caller-submitted Malloy text. Labels: field ('query'|'source_name'|'query_name'|'compile_source'), match ('lexed' when Malloy's lexer placed a tag outside prose, 'whole_text' when the text could not be lexed cleanly or is a name, 'no_lexer' when Malloy's parser failed to load so every prose-bearing text refuses).");
21965
+ var bypassCounter = lazyCounter("publisher_authorize_bypass_total", "Gate evaluations skipped because the request carried an authorize bypass (private data-management path). Label: entry_point ('source'|'runnable'). Any nonzero value on a path that should not use the bypass is a finding — see the paired `authorize bypass` audit log line for org/package/model/source.");
21966
+ var rowLevelDecisionCounter = lazyCounter("publisher_authorize_row_level_total", "How a row-level `#(access_filter)` gate resolved a request. Labels: decision ('denied_by_gate'|'empty_after_filter'), site ('entry_point'|'caller_join'). 'denied_by_gate' is the fail-closed refusal when the gate could not be applied; 'empty_after_filter' is a successful response with zero rows after the filter matched none, which is NOT an error. site says whether the gate was the query's own run target or a source the caller's text joined.");
21967
+ var rowLevelRejectionCounter = lazyCounter("publisher_authorize_row_level_rejected_total", "Row-level `#(access_filter)` gates that were refused, warned about, or could not be resolved. Label: cause (" + ROW_LEVEL_GATE_REJECTION_CAUSES.map((c) => `'${c}'`).join("|") + "). Only 'legacy_string_gate' fails the whole model load. 'entry_point_unexpressible', 'source_line_gate_no_given_reference' and 'source_line_gate_negated_membership' warn at load and leave the model servable. 'unreachable_given', 'given_usage_unresolvable' and 'unclassifiable_condition' are request-time only — that entry point denies every request. Alert on any nonzero value since the last publish; the request-time causes also make this a rate signal, so see the doc above before writing an alert.");
21968
+ var admitAllCounter = lazyCounter("publisher_authorize_admit_all_total", "Sources declaring their OWN unconditional admit-all gate (`#(authorize) true`), counted once each at package load. Label: route (" + CANONICAL_AUTHORIZE_ROUTES.map((r) => `'${r}'`).join("|") + "). Not an error — `true` is the only spelling for an extension that deliberately re-opens a gated base — but it is the one declaration that turns a gate off, so a jump since the last publish is worth a look.");
21969
+ var lockDecisionCounter = lazyCounter("publisher_authorize_lock_total", "How a `#(authorize)` lock resolved a request. Labels: decision ('admitted'|'denied_by_lock'|'denied_unresolvable'), site ('entry_point'|'caller_join'). Both denials are a 403; 'denied_by_lock' is the gate refusing a caller it does not admit (routine), 'denied_unresolvable' is the fail-closed refusal when the gate could not be decided at all. site says whether the lock was on the query's own run target or on a source the caller's text joined.");
21835
21970
  function recordAuthorizeGuardRejection(field) {
21836
- guardRejectionCounter ??= publisherMeter().createCounter("publisher_authorize_guard_rejected_total", {
21837
- description: "Requests rejected with 400 for declaring an `#(authorize)` annotation in caller-submitted Malloy text. Labels: field ('query'|'source_name'|'query_name'|'compile_source'), match ('lexed' when Malloy's lexer placed a tag outside prose, 'whole_text' when the text could not be lexed cleanly or is a name, 'no_lexer' when Malloy's parser failed to load so every prose-bearing text refuses)."
21838
- });
21839
- guardRejectionCounter.add(1, {
21971
+ guardRejectionCounter().add(1, {
21840
21972
  field,
21841
21973
  match: lastCallerGuardRefusalKind()
21842
21974
  });
21843
21975
  }
21844
21976
  function recordAuthorizeBypass(entryPoint) {
21845
- bypassCounter ??= publisherMeter().createCounter("publisher_authorize_bypass_total", {
21846
- description: "Gate evaluations skipped because the request carried an authorize bypass (private data-management path). Label: entry_point ('source'|'runnable'). Any nonzero value on a path that should not use the bypass is a finding — see the paired `authorize bypass` audit log line for org/package/model/source."
21847
- });
21848
- bypassCounter.add(1, { entry_point: entryPoint });
21977
+ bypassCounter().add(1, { entry_point: entryPoint });
21849
21978
  }
21850
21979
  function recordRowLevelGateDecision(decision, site = "entry_point") {
21851
- rowLevelDecisionCounter ??= publisherMeter().createCounter("publisher_authorize_row_level_total", {
21852
- description: "How a row-level `#(access_filter)` gate resolved a request. Labels: decision ('denied_by_gate'|'empty_after_filter'), site ('entry_point'|'caller_join'). 'denied_by_gate' is the fail-closed refusal when the gate could not be applied; 'empty_after_filter' is a successful response with zero rows after the filter matched none, which is NOT an error. site says whether the gate was the query's own run target or a source the caller's text joined."
21853
- });
21854
- rowLevelDecisionCounter.add(1, { decision, site });
21980
+ rowLevelDecisionCounter().add(1, { decision, site });
21855
21981
  }
21856
21982
  function recordRowLevelGateRejected(cause) {
21857
- rowLevelRejectionCounter ??= publisherMeter().createCounter("publisher_authorize_row_level_rejected_total", {
21858
- description: "Row-level `#(access_filter)` gates that were refused, warned about, or could not be resolved. Label: cause (" + ROW_LEVEL_GATE_REJECTION_CAUSES.map((c) => `'${c}'`).join("|") + "). Only 'legacy_string_gate' fails the whole model load. 'entry_point_unexpressible', 'source_line_gate_no_given_reference' and 'source_line_gate_negated_membership' warn at load and leave the model servable. 'unreachable_given', 'given_usage_unresolvable' and 'unclassifiable_condition' are request-time only — that entry point denies every request. Alert on any nonzero value since the last publish; the request-time causes also make this a rate signal, so see the doc above before writing an alert."
21859
- });
21860
- rowLevelRejectionCounter.add(1, { cause });
21983
+ rowLevelRejectionCounter().add(1, { cause });
21861
21984
  }
21862
21985
  function recordAuthorizeAdmitAllGate(route) {
21863
- admitAllCounter ??= publisherMeter().createCounter("publisher_authorize_admit_all_total", {
21864
- description: "Sources declaring their OWN unconditional admit-all gate (`#(authorize) true`), counted once each at package load. Label: route (" + CANONICAL_AUTHORIZE_ROUTES.map((r) => `'${r}'`).join("|") + "). Not an error — `true` is the only spelling for an extension that deliberately re-opens a gated base — but it is the one declaration that turns a gate off, so a jump since the last publish is worth a look."
21865
- });
21866
- admitAllCounter.add(1, { route });
21986
+ admitAllCounter().add(1, { route });
21867
21987
  }
21868
21988
  function recordLockDecision(decision, site = "entry_point") {
21869
- lockDecisionCounter ??= publisherMeter().createCounter("publisher_authorize_lock_total", {
21870
- description: "How a `#(authorize)` lock resolved a request. Labels: decision ('admitted'|'denied_by_lock'|'denied_unresolvable'), site ('entry_point'|'caller_join'). Both denials are a 403; 'denied_by_lock' is the gate refusing a caller it does not admit (routine), 'denied_unresolvable' is the fail-closed refusal when the gate could not be decided at all. site says whether the lock was on the query's own run target or on a source the caller's text joined."
21871
- });
21872
- lockDecisionCounter.add(1, { decision, site });
21989
+ lockDecisionCounter().add(1, { decision, site });
21873
21990
  }
21874
21991
 
21875
21992
  // src/data_styles.ts
@@ -24003,25 +24120,11 @@ function acceptBundledExperimentalDialects() {
24003
24120
  }
24004
24121
 
24005
24122
  // src/materialization_metrics.ts
24006
- var resetHooks = [];
24007
- function lazyCounter(name, description) {
24008
- let instrument = null;
24009
- resetHooks.push(() => instrument = null);
24010
- return () => instrument ??= publisherMeter().createCounter(name, { description });
24011
- }
24012
- function lazyHistogram(name, description, unit) {
24013
- let instrument = null;
24014
- resetHooks.push(() => instrument = null);
24015
- return () => instrument ??= publisherMeter().createHistogram(name, {
24016
- description,
24017
- unit
24018
- });
24019
- }
24020
24123
  var runCounter = lazyCounter("publisher_materialization_runs_total", "Materialization builds completed. Labels: mode ('auto'|'orchestrated'), outcome ('success'|'partial'|'failed'|'cancelled').");
24021
- var runDuration = lazyHistogram("publisher_materialization_run_duration_ms", "Wall-clock duration of a materialization build. Label: mode ('auto'|'orchestrated').", "ms");
24124
+ var runDuration = lazyHistogram("publisher_materialization_run_duration_ms", "Wall-clock duration of a materialization build. Label: mode ('auto'|'orchestrated').");
24022
24125
  var sourcesCounter = lazyCounter("publisher_materialization_sources_total", "Persist sources processed by a materialization run. Labels: outcome ('built'|'reused'|'failed'|'refused'), mode ('auto'|'orchestrated').");
24023
24126
  var incrementalStepCounter = lazyCounter("publisher_materialization_incremental_step_total", 'Refreshes of a source declared refresh="incremental". Labels: step ' + "('delta'|'seed'|'skip'), and for seed/skip a bounded reason code " + "(IncrementalStepReasonCode). A 'seed' is a full rebuild the delta path " + "declined, so a rising seed rate means the feature is not engaging — and " + "the reason label says why without a log dive.");
24024
- var buildPlanComputeDuration = lazyHistogram("publisher_materialization_build_plan_compute_duration_ms", "Wall-clock duration of compiling a package's build plan (Package.buildPlan).", "ms");
24127
+ var buildPlanComputeDuration = lazyHistogram("publisher_materialization_build_plan_compute_duration_ms", "Wall-clock duration of compiling a package's build plan (Package.buildPlan).");
24025
24128
  var buildPlanComputeFailedCounter = lazyCounter("publisher_materialization_build_plan_compute_failed_total", "Package loads whose build plan failed to compute. The ROOT-CAUSE signal for " + "colocated_bind_dropped{reason='build_plan_unavailable'}, which fires only " + "per dropped entry per load -- a package that loads once and is never " + "reloaded ticks that counter once and then sits with its colocated tier " + "off and a flat total, indistinguishable from healthy.");
24026
24129
  var autoLoadCounter = lazyCounter("publisher_materialization_auto_load_total", "Auto-run manifest auto-load attempts. Label: outcome ('success'|'failure').");
24027
24130
  var connectionDigestSkipCounter = lazyCounter("publisher_materialization_connection_digest_skipped_total", "Connection digests skipped during build-plan compile because the connection did not resolve.");
@@ -24030,7 +24133,7 @@ var manifestBindDegradedCounter = lazyCounter("publisher_materialization_manifes
24030
24133
  var duplicateTargetSkipCounter = lazyCounter("publisher_materialization_duplicate_target_skipped_total", "Sources skipped because the physical table they name was already built in " + "this run. Ordinary for a package that extends a persisted source; a " + "rising count against a package with no extension means the plan is " + "enumerating one table under more names than expected.");
24031
24134
  var sharedAddressInstructionCounter = lazyCounter("publisher_materialization_shared_address_instructions_total", "Content addresses that arrived with more than one instruction naming a " + "DIFFERENT physical table. The host minted a table per source where " + "several sources share one artifact. With a sourceID on each instruction " + "every table is built and only one is recorded, so the rest are orphaned; " + "without one the last instruction wins and the earlier names are never " + "built. Wasteful, not wrong — the table's CONTENT is the same either way.");
24032
24135
  var tableCollisionCounter = lazyCounter("publisher_materialization_table_collision_total", "Two definitions with DIFFERENT content addresses materializing into ONE " + "physical table. Each build overwrites the other's rows while both " + "addresses resolve to the table at serve time, so a query is answered " + "from another source's data. A wrong answer, not wasted work — page on " + "this one. Refused instead of counted-and-continued when " + "PERSIST_COLLISION_ENFORCE is set, so a non-zero rate here is also the " + "measure of what flipping that flag would start refusing.");
24033
- var sourceBuildDuration = lazyHistogram("publisher_materialization_source_build_duration_ms", "Wall-clock duration of building a single persist source.", "ms");
24136
+ var sourceBuildDuration = lazyHistogram("publisher_materialization_source_build_duration_ms", "Wall-clock duration of building a single persist source.");
24034
24137
  var dropTablesCounter = lazyCounter("publisher_materialization_drop_tables_total", "Physical tables dropped on delete. Label: outcome ('success'|'failure').");
24035
24138
  var scheduledFireCounter = lazyCounter("publisher_materialization_scheduled_fires_total", "Standalone-scheduler attempts to fire a package's materialization.schedule. " + "Label: outcome ('fired'|'conflict'|'error').");
24036
24139
  var storageServeRoutingCounter = lazyCounter("publisher_storage_serve_routing_total", "storage= serve routing decisions. Label: outcome ('storage'|'live_fallback'|" + "'runtime_live_fallback'|'blocked_by_row_level_gate'). Covers the storage= " + "tier only; a colocated #@ persist hit is in neither the numerator nor the " + "denominator. NOTE 'live_fallback' here means the transform was INELIGIBLE, " + "which QueryResult.servedFrom reports as null - that field's " + "'live_fallback' is this counter's 'runtime_live_fallback'.");
@@ -25295,7 +25398,7 @@ function unboundParameterNames(persistSource) {
25295
25398
  }
25296
25399
  return unbound;
25297
25400
  }
25298
- var MAX_GIVEN_WALK_DEPTH = 200;
25401
+ var MAX_AUTHORIZE_WALK_DEPTH = 200;
25299
25402
  function referencesAuthorize(persistSource) {
25300
25403
  try {
25301
25404
  return walkForAuthorize(persistSource._sourceDef, new WeakSet, 0);
@@ -25311,7 +25414,7 @@ function isAuthorizeAnnotation(text) {
25311
25414
  }
25312
25415
  }
25313
25416
  function walkForAuthorize(node, seen, depth) {
25314
- if (depth > MAX_GIVEN_WALK_DEPTH) {
25417
+ if (depth > MAX_AUTHORIZE_WALK_DEPTH) {
25315
25418
  throw new Error("authorize-usage walk exceeded max depth");
25316
25419
  }
25317
25420
  if (node === null || typeof node !== "object")
@@ -25359,7 +25462,7 @@ function isAuthorizeAttributedToEntryPoint(persistSource) {
25359
25462
  }
25360
25463
  }
25361
25464
  function walkForAuthorizeNotes(node, seen, depth, found, crossJoins) {
25362
- if (depth > MAX_GIVEN_WALK_DEPTH) {
25465
+ if (depth > MAX_AUTHORIZE_WALK_DEPTH) {
25363
25466
  throw new Error("authorize-usage walk exceeded max depth");
25364
25467
  }
25365
25468
  if (node === null || typeof node !== "object")