@malloydata/render 0.0.396 → 0.0.398

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.
@@ -6,9 +6,6 @@ import {DuckDBConnection} from '@malloydata/db-duckdb';
6
6
  import type {Model, URLReader} from '@malloydata/malloy';
7
7
  import {SingleConnectionRuntime} from '@malloydata/malloy';
8
8
 
9
- const STORY_MODEL_PREFIX = /##\(story\)\s/;
10
- const STORY_PREFIX = /#\(story\)\s/;
11
-
12
9
  async function createConnection() {
13
10
  // TODO: figure out how to get duckdb.table to load based on taht path, rather than from workingDirectory. so that malloy story files can be anywhere
14
11
  const workingDirectory = path.join(__dirname, '../src/stories');
@@ -57,22 +54,23 @@ function getModelStories(materializedModel: Model, fileName: string) {
57
54
  const models = materializedModel.explores;
58
55
  const modelStories: ModelIndexInput[] = [];
59
56
 
60
- const isLegacy = materializedModel.tagParse().tag.has('renderer_legacy');
57
+ const isLegacy = materializedModel.annotations
58
+ .parseAsTag()
59
+ .tag.has('renderer_legacy');
61
60
  const componentName =
62
- materializedModel
63
- .tagParse({prefix: STORY_MODEL_PREFIX})
64
- .tag.text('component') ?? fileNameToComponentName(fileName);
61
+ materializedModel.annotations.parseAsTag('story').tag.text('component') ??
62
+ fileNameToComponentName(fileName);
65
63
 
66
64
  models.forEach(model => {
67
65
  model.allFields
68
- .filter(f => f.isQueryField() && f.getTaglines(STORY_PREFIX).length > 0)
66
+ .filter(f => f.isQueryField() && f.annotations.texts('story').length > 0)
69
67
  .forEach(query => {
70
68
  modelStories.push({
71
69
  type: 'story',
72
70
  importPath: fileName,
73
71
  title: `Malloy ${isLegacy ? 'Legacy' : 'Next'}/${componentName}`,
74
72
  exportName: query.name,
75
- name: query.tagParse({prefix: STORY_PREFIX}).tag.text('story'),
73
+ name: query.annotations.parseAsTag('story').tag.text('story'),
76
74
  sourceName: model.name,
77
75
  queryName: query.name,
78
76
  });