@malloydata/malloyyo 0.2.65 → 0.2.66

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 (2) hide show
  1. package/dist/index.js +9 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { dirname, join } from "node:path";
11
11
  import { fileURLToPath } from "node:url";
12
12
 
13
13
  // package.json
14
- var version = "0.2.65";
14
+ var version = "0.2.66";
15
15
 
16
16
  // src/update-check.ts
17
17
  var UPDATE_CHECK_ARGV = "__update-check";
@@ -2183,22 +2183,23 @@ function describeSourceTool(host) {
2183
2183
  const modelRef = r.model_ref;
2184
2184
  try {
2185
2185
  return await host.withModel(modelRef, async (m) => {
2186
+ const ref = m.ref ?? modelRef;
2186
2187
  const compiled = await compile(m.runtime, m.entry, { readSource: m.readSource });
2187
2188
  if (!compiled.ok || !compiled.model) {
2188
- return { ok: false, model_ref: modelRef, source, problems: compiled.problems };
2189
+ return { ok: false, model_ref: ref, source, problems: compiled.problems };
2189
2190
  }
2190
2191
  const built = buildSourceDescribe(compiled.model, source);
2191
2192
  if (!built) {
2192
2193
  const available = Object.keys(compiled.model.sources);
2193
2194
  return {
2194
2195
  ok: false,
2195
- model_ref: modelRef,
2196
+ model_ref: ref,
2196
2197
  source,
2197
2198
  problems: [
2198
2199
  ...compiled.problems,
2199
2200
  codeProblem(
2200
2201
  "source-not-found",
2201
- `No source named '${source}' in '${modelRef}'. Sources: ${available.join(", ") || "(none)"}.`
2202
+ `No source named '${source}' in '${ref}'. Sources: ${available.join(", ") || "(none)"}.`
2202
2203
  )
2203
2204
  ]
2204
2205
  };
@@ -2206,7 +2207,7 @@ function describeSourceTool(host) {
2206
2207
  const malloy_text = sourceAsMalloy(compiled.model.sources[source]);
2207
2208
  const base = {
2208
2209
  ok: true,
2209
- model_ref: modelRef,
2210
+ model_ref: ref,
2210
2211
  source,
2211
2212
  guidance: prompts.explore.guidance,
2212
2213
  described_source: built.described_source,
@@ -2281,15 +2282,16 @@ function exploreQueryTool(host, opts) {
2281
2282
  }
2282
2283
  try {
2283
2284
  return await host.withModel(modelRef, async (m) => {
2285
+ const ref = m.ref ?? modelRef;
2284
2286
  const res = await executeQuery(
2285
2287
  m,
2286
2288
  args,
2287
2289
  queryFieldFix(modelRef, source, argString(args, "malloy")),
2288
2290
  opts.result
2289
2291
  );
2290
- if (!execute) return { ...res, model_ref: modelRef };
2292
+ if (!execute) return { ...res, model_ref: ref };
2291
2293
  const { sql, ...rest } = res;
2292
- const out = { ...rest, model_ref: modelRef };
2294
+ const out = { ...rest, model_ref: ref };
2293
2295
  if (sql !== void 0) out[HOST_ONLY] = { sql };
2294
2296
  return out;
2295
2297
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloyyo",
3
- "version": "0.2.65",
3
+ "version": "0.2.66",
4
4
  "description": "Publish Malloy models to a Malloyyo instance",
5
5
  "license": "MIT",
6
6
  "repository": {