@malloydata/malloy 0.0.25-dev230307204042 → 0.0.25
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.
- package/dist/malloy.d.ts +8 -0
- package/dist/malloy.js +29 -0
- package/package.json +1 -1
package/dist/malloy.d.ts
CHANGED
|
@@ -789,6 +789,14 @@ export declare class ModelMaterializer extends FluentState<Model> {
|
|
|
789
789
|
* or loading further related objects.
|
|
790
790
|
*/
|
|
791
791
|
loadQuery(query: QueryString | QueryURL): QueryMaterializer;
|
|
792
|
+
/**
|
|
793
|
+
* Extend a Malloy model by URL or contents.
|
|
794
|
+
*
|
|
795
|
+
* @param source The model URL or contents to load and (eventually) compile.
|
|
796
|
+
* @return A `ModelMaterializer` capable of materializing the requested model,
|
|
797
|
+
* or loading further related objects.
|
|
798
|
+
*/
|
|
799
|
+
extendModel(query: QueryString | QueryURL): ModelMaterializer;
|
|
792
800
|
search(sourceName: string, searchTerm: string, limit?: number, searchField?: string | undefined): Promise<SearchIndexResult[] | undefined>;
|
|
793
801
|
searchValueMap(sourceName: string, limit?: number): Promise<SearchValueMapResult[] | undefined>;
|
|
794
802
|
/**
|
package/dist/malloy.js
CHANGED
|
@@ -1607,6 +1607,35 @@ class ModelMaterializer extends FluentState {
|
|
|
1607
1607
|
return queryModel.preparedQuery;
|
|
1608
1608
|
});
|
|
1609
1609
|
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Extend a Malloy model by URL or contents.
|
|
1612
|
+
*
|
|
1613
|
+
* @param source The model URL or contents to load and (eventually) compile.
|
|
1614
|
+
* @return A `ModelMaterializer` capable of materializing the requested model,
|
|
1615
|
+
* or loading further related objects.
|
|
1616
|
+
*/
|
|
1617
|
+
extendModel(query) {
|
|
1618
|
+
return new ModelMaterializer(this.runtime, async () => {
|
|
1619
|
+
const urlReader = this.runtime.urlReader;
|
|
1620
|
+
const connections = this.runtime.connections;
|
|
1621
|
+
const parse = query instanceof URL
|
|
1622
|
+
? await Malloy.parse({
|
|
1623
|
+
url: query,
|
|
1624
|
+
urlReader,
|
|
1625
|
+
})
|
|
1626
|
+
: Malloy.parse({
|
|
1627
|
+
source: query,
|
|
1628
|
+
});
|
|
1629
|
+
const model = await this.getModel();
|
|
1630
|
+
const queryModel = await Malloy.compile({
|
|
1631
|
+
urlReader,
|
|
1632
|
+
connections,
|
|
1633
|
+
parse,
|
|
1634
|
+
model,
|
|
1635
|
+
});
|
|
1636
|
+
return queryModel;
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1610
1639
|
async search(sourceName, searchTerm, limit = 1000, searchField = undefined) {
|
|
1611
1640
|
const model = await this.materialize();
|
|
1612
1641
|
const queryModel = new model_1.QueryModel(model._modelDef);
|