@malloy-publisher/server 0.10.2 → 0.10.4

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 +21 -10
  2. package/dist/app/assets/{EnvironmentPage-qOdFSQL1.js → EnvironmentPage-B9Q9ZYYM.js} +1 -1
  3. package/dist/app/assets/{HomePage-qPrsLgkV.js → HomePage-CVbXvH7c.js} +1 -1
  4. package/dist/app/assets/{MainPage-BfS_-PBR.js → MainPage-D1Fj4Wy1.js} +1 -1
  5. package/dist/app/assets/{ModelPage-Rgt_50mg.js → ModelPage-DmYocpWT.js} +2 -2
  6. package/dist/app/assets/{PackagePage-D6bXCeY6.js → PackagePage-4TwX_ajC.js} +1 -1
  7. package/dist/app/assets/RenderedResult-B_sW7neX.es-CFeRQyYD.js +179 -0
  8. package/dist/app/assets/{RouteError-D3qvottt.js → RouteError-BYb6Nj48.js} +1 -1
  9. package/dist/app/assets/ThemeEditorPage-CYe_2MfI.js +1 -0
  10. package/dist/app/assets/{ToggleButtonGroup-DnK5WHKM.js → ToggleButtonGroup-b325mGmL.js} +1 -1
  11. package/dist/app/assets/documentRoutes-D_C8snHV.js +1 -0
  12. package/dist/app/assets/{editPageMounted-po3c6RP3.js → editPageMounted-1X99LP7v.js} +2 -2
  13. package/dist/app/assets/{index-CNbuoYFM.js → index-3fArIYYK.js} +1 -1
  14. package/dist/app/assets/index-CGKV9Dxi.js +483 -0
  15. package/dist/app/assets/{index-4-yQ2uF2.js → index-DEj7hnfZ.js} +1 -1
  16. package/dist/app/assets/{index-a9NQPL4B.js → index-DWhQwvJR.js} +1 -1
  17. package/dist/app/assets/{index.es-C2AyMc9a.js → index.es-CMsNTB-h.js} +21 -21
  18. package/dist/app/index.html +1 -1
  19. package/dist/instrumentation.mjs +1 -1
  20. package/dist/package_load_worker.mjs +81 -48
  21. package/dist/server.mjs +382 -127
  22. package/package.json +1 -1
  23. package/dist/app/assets/RenderedResult-BCJC0ZVj.es-ThIM8SXj.js +0 -171
  24. package/dist/app/assets/ThemeEditorPage-UAf70V3Q.js +0 -1
  25. package/dist/app/assets/documentRoutes-CnLoYf4D.js +0 -1
  26. package/dist/app/assets/index-iyvwQg3j.js +0 -481
@@ -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-iyvwQg3j.js"></script>
19
+ <script type="module" crossorigin src="/assets/index-CGKV9Dxi.js"></script>
20
20
  <link rel="stylesheet" crossorigin href="/assets/index-DUqldpo0.css">
21
21
  </head>
22
22
  <body>
@@ -164831,7 +164831,7 @@ var init_telemetry = __esm(() => {
164831
164831
  });
164832
164832
 
164833
164833
  // package.json
164834
- var version = "0.10.2";
164834
+ var version = "0.10.4";
164835
164835
  var init_package = () => {};
164836
164836
 
164837
164837
  // src/version.ts
@@ -22216,7 +22216,7 @@ async function compileSynthesizedPreaggregation(args) {
22216
22216
  const { runtime, importBaseURL } = await args.getRuntime(new Map([[synthesizedURL.href, text]]));
22217
22217
  const materializer = runtime.loadModel(synthesizedURL, { importBaseURL });
22218
22218
  const model = await materializer.getModel();
22219
- return { plans, model, materializer, text };
22219
+ return { plans, model, materializer, runtime, text };
22220
22220
  }
22221
22221
  async function tryCompileSynthesizedPreaggregation(args) {
22222
22222
  try {
@@ -23215,27 +23215,47 @@ function composeDeclaredQueryMetadata(layers) {
23215
23215
  const resolved = Object.assign({}, ...ordered);
23216
23216
  return Object.keys(resolved).length > 0 ? resolved : null;
23217
23217
  }
23218
- function flattenDependsOn(node) {
23219
- return node.dependsOn.map((d) => d.sourceID);
23220
- }
23221
- function* iterGraphSources(graph, sources) {
23222
- const seen = new Set;
23223
- function* visit(node) {
23224
- if (seen.has(node.sourceID))
23225
- return;
23226
- for (const dep of node.dependsOn) {
23227
- yield* visit(dep);
23218
+ function sourceBuildOf(build, unbuildable) {
23219
+ const order = [];
23220
+ const dependsOn = {};
23221
+ for (const target of build.targets) {
23222
+ const reads = target.dependsOn.flatMap((t) => t.sources.map((s) => s.sourceID));
23223
+ for (const source of target.sources) {
23224
+ order.push(source.sourceID);
23225
+ dependsOn[source.sourceID] = reads;
23228
23226
  }
23229
- seen.add(node.sourceID);
23230
- const source = sources[node.sourceID];
23227
+ }
23228
+ for (const { source } of unbuildable) {
23229
+ if (source.connectionName !== build.connectionName)
23230
+ continue;
23231
+ order.push(source.sourceID);
23232
+ dependsOn[source.sourceID] = [];
23233
+ }
23234
+ return { connectionName: build.connectionName, order, dependsOn };
23235
+ }
23236
+ function sourceBuildsOf(targets) {
23237
+ const builds = targets.connections.map((c) => sourceBuildOf(c, targets.unbuildable));
23238
+ const planned = new Set(builds.map((b) => b.connectionName));
23239
+ for (const { source } of targets.unbuildable) {
23240
+ if (planned.has(source.connectionName))
23241
+ continue;
23242
+ planned.add(source.connectionName);
23243
+ builds.push(sourceBuildOf({ connectionName: source.connectionName, targets: [] }, targets.unbuildable));
23244
+ }
23245
+ return builds;
23246
+ }
23247
+ function plannedSources(targets) {
23248
+ return [
23249
+ ...targets.connections.flatMap((c) => c.targets.flatMap((t) => t.sources)),
23250
+ ...targets.unbuildable.map((u) => u.source)
23251
+ ];
23252
+ }
23253
+ function* sourcesInBuildOrder(build, sources) {
23254
+ for (const sourceID of build.order) {
23255
+ const source = sources[sourceID];
23231
23256
  if (source)
23232
23257
  yield source;
23233
23258
  }
23234
- for (const level of graph.nodes) {
23235
- for (const node of level) {
23236
- yield* visit(node);
23237
- }
23238
- }
23239
23259
  }
23240
23260
  function computeSourceEntityId(source, connectionDigests) {
23241
23261
  return source.makeBuildId(connectionDigests[source.connectionName], addressPartitionLayout(source, source.getSQL()));
@@ -23324,7 +23344,7 @@ async function classifyPersistSourceGate(persistSource, modelDef, materializer,
23324
23344
  }
23325
23345
  function emptyBuildPlanParts() {
23326
23346
  return {
23327
- graphs: [],
23347
+ builds: [],
23328
23348
  sources: {},
23329
23349
  sourceModelPaths: {},
23330
23350
  droppedPersistSources: [],
@@ -23333,7 +23353,7 @@ function emptyBuildPlanParts() {
23333
23353
  };
23334
23354
  }
23335
23355
  function mergeBuildPlanParts(into, from) {
23336
- into.graphs.push(...from.graphs);
23356
+ into.builds.push(...from.builds);
23337
23357
  Object.assign(into.sources, from.sources);
23338
23358
  Object.assign(into.sourceModelPaths, from.sourceModelPaths);
23339
23359
  into.droppedPersistSources.push(...from.droppedPersistSources);
@@ -23341,7 +23361,14 @@ function mergeBuildPlanParts(into, from) {
23341
23361
  Object.assign(into.sourceGateOutcomes, from.sourceGateOutcomes);
23342
23362
  }
23343
23363
  async function collectModelBuildPlan(parts, args) {
23344
- const { modelPath, packagePath, materializer, malloyModel, getRuntime } = args;
23364
+ const {
23365
+ modelPath,
23366
+ packagePath,
23367
+ materializer,
23368
+ malloyModel,
23369
+ runtime,
23370
+ getRuntime
23371
+ } = args;
23345
23372
  const synthesized = args.synthesized !== undefined ? args.synthesized : await tryCompileSynthesizedPreaggregation({
23346
23373
  packagePath,
23347
23374
  modelPath,
@@ -23349,14 +23376,14 @@ async function collectModelBuildPlan(parts, args) {
23349
23376
  contents: malloyModel._modelDef?.contents ?? {}
23350
23377
  });
23351
23378
  if (synthesized) {
23352
- const rollupPlan = synthesized.model.getBuildPlan();
23353
- const rollupNames = new Set(synthesized.plans.map((p) => p.rollupSourceName));
23354
- parts.graphs.push(...rollupPlan.graphs);
23379
+ const rollupTargets = await synthesized.runtime.getBuildTargets(synthesized.model);
23380
+ parts.builds.push(...sourceBuildsOf(rollupTargets));
23355
23381
  const planByName = new Map(synthesized.plans.map((p) => [p.rollupSourceName, p]));
23356
23382
  let rollupClassificationCtx;
23357
- for (const [sourceID, source] of Object.entries(rollupPlan.sources)) {
23358
- if (!rollupNames.has(source.name))
23383
+ for (const source of plannedSources(rollupTargets)) {
23384
+ if (!planByName.has(source.name))
23359
23385
  continue;
23386
+ const sourceID = source.sourceID;
23360
23387
  parts.sources[sourceID] = source;
23361
23388
  parts.sourceModelPaths[sourceID] = modelPath;
23362
23389
  const rollup = planByName.get(source.name);
@@ -23375,23 +23402,25 @@ async function collectModelBuildPlan(parts, args) {
23375
23402
  const modelTag = malloyModel.modelAnnotations.parseAsTag("!").tag;
23376
23403
  if (!modelTag.has("experimental", "persistence"))
23377
23404
  return;
23378
- const buildPlan = malloyModel.getBuildPlan();
23379
- for (const msg of buildPlan.tagParseLog) {
23405
+ const targets = await runtime.getBuildTargets(malloyModel);
23406
+ for (const msg of targets.tagParseLog) {
23380
23407
  logger.warn("Persist annotation issue", {
23381
23408
  modelPath,
23382
23409
  message: msg.message,
23383
23410
  severity: msg.severity
23384
23411
  });
23385
23412
  }
23386
- const recognizedNames = new Set(Object.values(buildPlan.sources).map((s) => s.name));
23413
+ const planned = plannedSources(targets);
23414
+ const recognizedNames = new Set(planned.map((s) => s.name));
23387
23415
  for (const name of detectDroppedPersistSources(malloyModel, recognizedNames)) {
23388
23416
  parts.droppedPersistSources.push({ name, modelPath });
23389
23417
  }
23390
- if (buildPlan.graphs.length === 0)
23418
+ if (planned.length === 0)
23391
23419
  return;
23392
- parts.graphs.push(...buildPlan.graphs);
23420
+ parts.builds.push(...sourceBuildsOf(targets));
23393
23421
  let classificationCtx;
23394
- for (const [sourceID, source] of Object.entries(buildPlan.sources)) {
23422
+ for (const source of planned) {
23423
+ const sourceID = source.sourceID;
23395
23424
  parts.sources[sourceID] = source;
23396
23425
  parts.sourceModelPaths[sourceID] = modelPath;
23397
23426
  if (!classificationCtx) {
@@ -23404,28 +23433,30 @@ async function collectModelBuildPlan(parts, args) {
23404
23433
  parts.sourceGateOutcomes[sourceID] = await classifyPersistSourceGate(source, classificationCtx.modelDef, materializer, classificationCtx.deps, modelPath);
23405
23434
  }
23406
23435
  }
23407
- async function resolveConnectionDigests(connections, graphs, onSkipped) {
23436
+ async function resolveConnectionDigests(connections, builds, onSkipped) {
23408
23437
  const connectionDigests = {};
23409
- for (const graph of graphs) {
23410
- const conn = connections.get(graph.connectionName);
23438
+ for (const build of builds) {
23439
+ const conn = connections.get(build.connectionName);
23411
23440
  if (!conn) {
23412
- onSkipped(graph.connectionName);
23441
+ onSkipped(build.connectionName);
23413
23442
  continue;
23414
23443
  }
23415
- if (!connectionDigests[graph.connectionName]) {
23416
- connectionDigests[graph.connectionName] = await conn.getDigest();
23444
+ if (!connectionDigests[build.connectionName]) {
23445
+ connectionDigests[build.connectionName] = await conn.getDigest();
23417
23446
  }
23418
23447
  }
23419
23448
  return connectionDigests;
23420
23449
  }
23421
- function deriveBuildPlan(graphs, sources, connectionDigests, sourceNames, sourceModelPaths, packageMaterialization, options) {
23450
+ function deriveBuildPlan(builds, sources, connectionDigests, sourceNames, sourceModelPaths, packageMaterialization, options) {
23422
23451
  const include = sourceNames ? new Set(sourceNames) : null;
23423
- const wireGraphs = graphs.map((graph) => ({
23424
- connectionName: graph.connectionName,
23425
- nodes: graph.nodes.map((level) => level.map((node) => ({
23426
- sourceID: node.sourceID,
23427
- dependsOn: flattenDependsOn(node)
23428
- })))
23452
+ const wireGraphs = builds.map((build) => ({
23453
+ connectionName: build.connectionName,
23454
+ nodes: [
23455
+ build.order.map((sourceID) => ({
23456
+ sourceID,
23457
+ dependsOn: build.dependsOn[sourceID] ?? []
23458
+ }))
23459
+ ]
23429
23460
  }));
23430
23461
  const wireSources = {};
23431
23462
  const refusedSources = {};
@@ -23514,7 +23545,7 @@ function deriveBuildPlan(graphs, sources, connectionDigests, sourceNames, source
23514
23545
  function deriveBuildPlanOutcome(compiled, materializationConfig) {
23515
23546
  const droppedPersistSources = compiled.droppedPersistSources ?? [];
23516
23547
  const incrementalDeclarations = collectIncrementalDeclarations(compiled.sources);
23517
- const plan = compiled.graphs.length === 0 ? null : deriveBuildPlan(compiled.graphs, compiled.sources, compiled.connectionDigests, undefined, compiled.sourceModelPaths, materializationConfig, {
23548
+ const plan = compiled.builds.length === 0 ? null : deriveBuildPlan(compiled.builds, compiled.sources, compiled.connectionDigests, undefined, compiled.sourceModelPaths, materializationConfig, {
23518
23549
  preaggregatePlans: compiled.preaggregatePlans,
23519
23550
  sourceGateOutcomes: compiled.sourceGateOutcomes
23520
23551
  });
@@ -24474,6 +24505,7 @@ async function compileMalloyModel(job, malloyConfig, modelPath, load) {
24474
24505
  modelPath,
24475
24506
  materializer: mm,
24476
24507
  model: compiled,
24508
+ runtime,
24477
24509
  importBaseURL,
24478
24510
  queries,
24479
24511
  sources
@@ -24559,6 +24591,7 @@ async function prepareForMainThread(job, malloyConfig, load, model) {
24559
24591
  packagePath: job.packagePath,
24560
24592
  materializer,
24561
24593
  malloyModel: model.model,
24594
+ runtime: model.runtime,
24562
24595
  getRuntime: companionRuntime,
24563
24596
  synthesized: companion
24564
24597
  });
@@ -24798,8 +24831,8 @@ async function finishWorkerBuildPlan(malloyConfig, modelPaths, load, materializa
24798
24831
  }
24799
24832
  const connections = await resolvePackageConnections({
24800
24833
  getMalloyConnection: (name) => malloyConfig.connections.lookupConnection(name)
24801
- }, parts.graphs.map((g) => g.connectionName));
24802
- const connectionDigests = await resolveConnectionDigests(connections, parts.graphs, (name) => digestSkipped.push(name));
24834
+ }, parts.builds.map((b) => b.connectionName));
24835
+ const connectionDigests = await resolveConnectionDigests(connections, parts.builds, (name) => digestSkipped.push(name));
24803
24836
  const outcome = deriveBuildPlanOutcome({ ...parts, connectionDigests }, materializationConfig);
24804
24837
  return {
24805
24838
  ok: true,