@malloy-publisher/app 0.0.205 → 0.0.207

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/api-doc.yaml CHANGED
@@ -38,13 +38,16 @@ tags:
38
38
  - name: publisher
39
39
  description: Publisher status and health check operations
40
40
  - name: environments
41
- description: Environment lifecycle management including creation, configuration,
41
+ description:
42
+ Environment lifecycle management including creation, configuration,
42
43
  and deletion of data modeling environments
43
44
  - name: connections
44
- description: Database connection management for secure data source configuration
45
+ description:
46
+ Database connection management for secure data source configuration
45
47
  and access
46
48
  - name: packages
47
- description: Package management for Malloy data models, including versioning and
49
+ description:
50
+ Package management for Malloy data models, including versioning and
48
51
  distribution
49
52
  - name: models
50
53
  description: Malloy model access and compilation operations
@@ -58,8 +61,6 @@ tags:
58
61
  description: Real-time file watching for development workflows
59
62
  - name: materializations
60
63
  description: Package-level materializations for persisting Malloy sources
61
- - name: manifests
62
- description: Build manifest management for tracking materialized source tables
63
64
 
64
65
  paths:
65
66
  /status:
@@ -620,55 +621,7 @@ paths:
620
621
  "503":
621
622
  $ref: "#/components/responses/ServiceUnavailable"
622
623
 
623
- # TODO: Remove this endpoint.
624
624
  /environments/{environmentName}/connections/{connectionName}/sqlSource:
625
- get:
626
- tags:
627
- - connections
628
- operationId: get-sqlsource
629
- deprecated: true
630
- summary: Get SQL source (deprecated)
631
- description: |
632
- **DEPRECATED**: This endpoint is deprecated and may be removed in future versions.
633
- Use the POST version instead for better security and functionality.
634
-
635
- Creates a Malloy source from a SQL statement using the specified connection.
636
- The SQL statement is executed to generate a source definition that can be used in Malloy models.
637
- parameters:
638
- - name: environmentName
639
- in: path
640
- description: Name of the environment
641
- required: true
642
- schema:
643
- $ref: "#/components/schemas/IdentifierPattern"
644
- - name: connectionName
645
- in: path
646
- description: Name of the connection
647
- required: true
648
- schema:
649
- $ref: "#/components/schemas/IdentifierPattern"
650
- - name: sqlStatement
651
- in: query
652
- description: SQL statement
653
- required: false
654
- schema:
655
- type: string
656
- responses:
657
- "200":
658
- description: SQL source information
659
- content:
660
- application/json:
661
- schema:
662
- $ref: "#/components/schemas/SqlSource"
663
- "401":
664
- $ref: "#/components/responses/Unauthorized"
665
- "404":
666
- $ref: "#/components/responses/NotFound"
667
- "500":
668
- $ref: "#/components/responses/InternalServerError"
669
- "503":
670
- $ref: "#/components/responses/ServiceUnavailable"
671
-
672
625
  post:
673
626
  tags:
674
627
  - connections
@@ -745,13 +698,6 @@ paths:
745
698
  required: true
746
699
  schema:
747
700
  $ref: "#/components/schemas/IdentifierPattern"
748
- - name: options
749
- in: query
750
- description: Options (deprecated; pass in body instead)
751
- deprecated: true
752
- required: false
753
- schema:
754
- type: string
755
701
  requestBody:
756
702
  description: SQL statement to execute
757
703
  required: true
@@ -833,55 +779,6 @@ paths:
833
779
  "503":
834
780
  $ref: "#/components/responses/ServiceUnavailable"
835
781
 
836
- # TODO: Remove this endpoint.
837
- /environments/{environmentName}/connections/{connectionName}/temporaryTable:
838
- get:
839
- tags:
840
- - connections
841
- operationId: get-temporarytable
842
- deprecated: true
843
- summary: Create temporary table (deprecated)
844
- description: |
845
- **DEPRECATED**: This endpoint is deprecated and may be removed in future versions.
846
- Use the POST version instead for better security and functionality.
847
-
848
- Creates a temporary table from a SQL statement using the specified connection.
849
- Temporary tables are useful for storing intermediate results during complex queries.
850
- parameters:
851
- - name: environmentName
852
- in: path
853
- description: Name of the environment
854
- required: true
855
- schema:
856
- $ref: "#/components/schemas/IdentifierPattern"
857
- - name: connectionName
858
- in: path
859
- description: Name of the connection
860
- required: true
861
- schema:
862
- $ref: "#/components/schemas/IdentifierPattern"
863
- - name: sqlStatement
864
- in: query
865
- description: SQL statement
866
- required: false
867
- schema:
868
- type: string
869
- responses:
870
- "200":
871
- description: Temporary table information
872
- content:
873
- application/json:
874
- schema:
875
- $ref: "#/components/schemas/TemporaryTable"
876
- "401":
877
- $ref: "#/components/responses/Unauthorized"
878
- "404":
879
- $ref: "#/components/responses/NotFound"
880
- "500":
881
- $ref: "#/components/responses/InternalServerError"
882
- "503":
883
- $ref: "#/components/responses/ServiceUnavailable"
884
-
885
782
  # NOTE: The GET …/connections/{connectionName}/queryData endpoint
886
783
  # was removed alongside the operational-guards changes. Use the
887
784
  # POST …/sqlQuery endpoint above instead — it accepts the SQL in
@@ -1066,60 +963,7 @@ paths:
1066
963
  "503":
1067
964
  $ref: "#/components/responses/ServiceUnavailable"
1068
965
 
1069
- # TODO: Remove the GET (deprecated) form once clients migrate.
1070
966
  /environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlSource:
1071
- get:
1072
- tags:
1073
- - connections
1074
- operationId: get-sqlsource-in-package
1075
- deprecated: true
1076
- summary: Get SQL source (per-package, deprecated)
1077
- description: |
1078
- **DEPRECATED**: Use the POST version instead.
1079
-
1080
- Creates a Malloy source from a SQL statement using the specified
1081
- connection, resolved in the context of the named package.
1082
- parameters:
1083
- - name: environmentName
1084
- in: path
1085
- description: Name of the environment
1086
- required: true
1087
- schema:
1088
- $ref: "#/components/schemas/IdentifierPattern"
1089
- - name: packageName
1090
- in: path
1091
- description: Name of the package whose connection context to use
1092
- required: true
1093
- schema:
1094
- $ref: "#/components/schemas/IdentifierPattern"
1095
- - name: connectionName
1096
- in: path
1097
- description: Name of the connection
1098
- required: true
1099
- schema:
1100
- $ref: "#/components/schemas/IdentifierPattern"
1101
- - name: sqlStatement
1102
- in: query
1103
- description: SQL statement
1104
- required: false
1105
- schema:
1106
- type: string
1107
- responses:
1108
- "200":
1109
- description: SQL source information
1110
- content:
1111
- application/json:
1112
- schema:
1113
- $ref: "#/components/schemas/SqlSource"
1114
- "401":
1115
- $ref: "#/components/responses/Unauthorized"
1116
- "404":
1117
- $ref: "#/components/responses/NotFound"
1118
- "500":
1119
- $ref: "#/components/responses/InternalServerError"
1120
- "503":
1121
- $ref: "#/components/responses/ServiceUnavailable"
1122
-
1123
967
  post:
1124
968
  tags:
1125
969
  - connections
@@ -1204,13 +1048,6 @@ paths:
1204
1048
  required: true
1205
1049
  schema:
1206
1050
  $ref: "#/components/schemas/IdentifierPattern"
1207
- - name: options
1208
- in: query
1209
- description: Options (deprecated; pass in body instead)
1210
- deprecated: true
1211
- required: false
1212
- schema:
1213
- type: string
1214
1051
  requestBody:
1215
1052
  description: SQL statement to execute
1216
1053
  required: true
@@ -1298,60 +1135,6 @@ paths:
1298
1135
  "503":
1299
1136
  $ref: "#/components/responses/ServiceUnavailable"
1300
1137
 
1301
- # TODO: Remove this endpoint.
1302
- /environments/{environmentName}/packages/{packageName}/connections/{connectionName}/temporaryTable:
1303
- get:
1304
- tags:
1305
- - connections
1306
- operationId: get-temporarytable-in-package
1307
- deprecated: true
1308
- summary: Create temporary table (per-package, deprecated)
1309
- description: |
1310
- **DEPRECATED**: Use the POST version instead.
1311
-
1312
- Creates a temporary table from a SQL statement using the specified
1313
- connection, resolved in the context of the named package.
1314
- parameters:
1315
- - name: environmentName
1316
- in: path
1317
- description: Name of the environment
1318
- required: true
1319
- schema:
1320
- $ref: "#/components/schemas/IdentifierPattern"
1321
- - name: packageName
1322
- in: path
1323
- description: Name of the package whose connection context to use
1324
- required: true
1325
- schema:
1326
- $ref: "#/components/schemas/IdentifierPattern"
1327
- - name: connectionName
1328
- in: path
1329
- description: Name of the connection
1330
- required: true
1331
- schema:
1332
- $ref: "#/components/schemas/IdentifierPattern"
1333
- - name: sqlStatement
1334
- in: query
1335
- description: SQL statement
1336
- required: false
1337
- schema:
1338
- type: string
1339
- responses:
1340
- "200":
1341
- description: Temporary table information
1342
- content:
1343
- application/json:
1344
- schema:
1345
- $ref: "#/components/schemas/TemporaryTable"
1346
- "401":
1347
- $ref: "#/components/responses/Unauthorized"
1348
- "404":
1349
- $ref: "#/components/responses/NotFound"
1350
- "500":
1351
- $ref: "#/components/responses/InternalServerError"
1352
- "503":
1353
- $ref: "#/components/responses/ServiceUnavailable"
1354
-
1355
1138
  # NOTE: The GET …/packages/{packageName}/connections/{connectionName}/queryData
1356
1139
  # endpoint was removed alongside the operational-guards changes.
1357
1140
  # Use the matching POST …/sqlQuery endpoint instead.
@@ -1406,16 +1189,6 @@ paths:
1406
1189
  required: true
1407
1190
  schema:
1408
1191
  $ref: "#/components/schemas/IdentifierPattern"
1409
- - name: autoLoadManifest
1410
- in: query
1411
- description: |
1412
- When true, automatically loads any existing build manifest
1413
- for the package so materialized table references resolve immediately.
1414
- Defaults to false.
1415
- required: false
1416
- schema:
1417
- type: boolean
1418
- default: false
1419
1192
  requestBody:
1420
1193
  required: true
1421
1194
  content:
@@ -1429,6 +1202,8 @@ paths:
1429
1202
  application/json:
1430
1203
  schema:
1431
1204
  $ref: "#/components/schemas/Package"
1205
+ "400":
1206
+ $ref: "#/components/responses/BadRequest"
1432
1207
  "401":
1433
1208
  $ref: "#/components/responses/Unauthorized"
1434
1209
  "500":
@@ -1526,6 +1301,8 @@ paths:
1526
1301
  application/json:
1527
1302
  schema:
1528
1303
  $ref: "#/components/schemas/Package"
1304
+ "400":
1305
+ $ref: "#/components/responses/BadRequest"
1529
1306
  "401":
1530
1307
  $ref: "#/components/responses/Unauthorized"
1531
1308
  "404":
@@ -1765,7 +1542,8 @@ paths:
1765
1542
  type: string
1766
1543
  - name: path
1767
1544
  in: path
1768
- description: Path to the model within the package (used to resolve relative
1545
+ description:
1546
+ Path to the model within the package (used to resolve relative
1769
1547
  imports)
1770
1548
  required: true
1771
1549
  schema:
@@ -2251,10 +2029,13 @@ paths:
2251
2029
  tags:
2252
2030
  - materializations
2253
2031
  operationId: create-materialization
2254
- summary: Create a materialization
2032
+ summary: Create a materialization (Round 1)
2255
2033
  description: |
2256
- Creates a new materialization in PENDING state for all persist sources across all
2257
- models in the package. Use POST .../materializations/{materializationId}?action=start to begin execution.
2034
+ Starts Round 1 of the two-round build protocol: asynchronously compiles the package,
2035
+ computes a build plan (per-source buildId, output columns, dependency/column lineage,
2036
+ connection capability), and pauses at BUILD_PLAN_READY without writing any tables.
2037
+ The control plane then issues Round 2 via
2038
+ POST .../materializations/{materializationId}?action=build with build instructions.
2258
2039
  parameters:
2259
2040
  - $ref: "#/components/parameters/environmentName"
2260
2041
  - $ref: "#/components/parameters/packageName"
@@ -2283,7 +2064,8 @@ paths:
2283
2064
  - materializations
2284
2065
  operationId: list-materializations
2285
2066
  summary: List materializations for a package
2286
- description: Returns the materialization history for the package, ordered by
2067
+ description:
2068
+ Returns the materialization history for the package, ordered by
2287
2069
  most recent first.
2288
2070
  parameters:
2289
2071
  - $ref: "#/components/parameters/environmentName"
@@ -2341,8 +2123,11 @@ paths:
2341
2123
  description: |
2342
2124
  Performs an action on a materialization. The action is specified via
2343
2125
  the `action` query parameter:
2344
- * `start` - Transitions a PENDING materialization to RUNNING and begins execution in the background. Returns 202.
2345
- * `stop` - Cancels a PENDING or RUNNING materialization. Returns 200.
2126
+ * `build` - Round 2. Provide BuildInstructions (CP-assigned table id, physical
2127
+ table name, and realization per source). Builds only the instructed sources into
2128
+ the exact names provided and assembles the manifest. Valid only when the
2129
+ materialization is at BUILD_PLAN_READY. Returns 202.
2130
+ * `stop` - Cancels a PENDING, BUILD_PLAN_READY, or building materialization. Returns 200.
2346
2131
  parameters:
2347
2132
  - $ref: "#/components/parameters/environmentName"
2348
2133
  - $ref: "#/components/parameters/packageName"
@@ -2353,9 +2138,15 @@ paths:
2353
2138
  schema:
2354
2139
  type: string
2355
2140
  enum:
2356
- - start
2141
+ - build
2357
2142
  - stop
2358
2143
  description: Action to perform on the materialization
2144
+ requestBody:
2145
+ required: false
2146
+ content:
2147
+ application/json:
2148
+ schema:
2149
+ $ref: "#/components/schemas/BuildInstructions"
2359
2150
  responses:
2360
2151
  "200":
2361
2152
  description: Materialization cancelled (action=stop)
@@ -2364,7 +2155,7 @@ paths:
2364
2155
  schema:
2365
2156
  $ref: "#/components/schemas/Materialization"
2366
2157
  "202":
2367
- description: Materialization started (action=start)
2158
+ description: Round 2 build accepted (action=build)
2368
2159
  content:
2369
2160
  application/json:
2370
2161
  schema:
@@ -2384,86 +2175,43 @@ paths:
2384
2175
  - materializations
2385
2176
  operationId: delete-materialization
2386
2177
  summary: Delete a materialization
2387
- description: Deletes a terminal (SUCCESS, FAILED, or CANCELLED) materialization
2388
- record.
2178
+ description: |
2179
+ Deletes a terminal (MANIFEST_FILE_READY, FAILED, or CANCELLED)
2180
+ materialization record. By default this removes the publisher's record
2181
+ only; the control plane owns table GC. Set dropTables=true to also drop
2182
+ the physical tables this run produced (from the materialization's
2183
+ manifest) as a best-effort cleanup.
2389
2184
  parameters:
2390
2185
  - $ref: "#/components/parameters/environmentName"
2391
2186
  - $ref: "#/components/parameters/packageName"
2392
2187
  - $ref: "#/components/parameters/materializationId"
2188
+ - name: dropTables
2189
+ in: query
2190
+ required: false
2191
+ description: |
2192
+ When true, also drop the physical tables recorded in the
2193
+ materialization's manifest before deleting the record. Defaults to
2194
+ false (record-only delete; the control plane owns table GC).
2195
+ schema:
2196
+ type: boolean
2197
+ default: false
2393
2198
  responses:
2394
2199
  "204":
2395
2200
  description: Materialization deleted
2396
2201
  "404":
2397
2202
  $ref: "#/components/responses/NotFound"
2398
2203
  "409":
2399
- description: Materialization cannot be deleted (PENDING or RUNNING)
2204
+ description: Materialization cannot be deleted while it is active
2400
2205
  content:
2401
2206
  application/json:
2402
2207
  schema:
2403
2208
  $ref: "#/components/schemas/Error"
2404
2209
 
2405
- /environments/{environmentName}/packages/{packageName}/manifest:
2406
- get:
2407
- tags:
2408
- - manifests
2409
- operationId: get-manifest
2410
- summary: Get the build manifest for a package
2411
- description: |
2412
- Returns the current build manifest containing buildId-to-tableName mappings
2413
- for all materialized sources in the package.
2414
- parameters:
2415
- - $ref: "#/components/parameters/environmentName"
2416
- - $ref: "#/components/parameters/packageName"
2417
- responses:
2418
- "200":
2419
- description: Build manifest
2420
- content:
2421
- application/json:
2422
- schema:
2423
- $ref: "#/components/schemas/BuildManifest"
2424
- "404":
2425
- $ref: "#/components/responses/NotFound"
2426
- post:
2427
- tags:
2428
- - manifests
2429
- operationId: manifest-action
2430
- summary: Perform an action on the package manifest
2431
- description: |
2432
- Performs an action on the package manifest. The action is specified via
2433
- the `action` query parameter:
2434
- * `reload` - Reads the build manifest from the shared store (DuckLake
2435
- in orchestrated mode, local DuckDB in standalone mode) and recompiles
2436
- every model in the package so subsequent queries resolve persisted
2437
- sources to their materialized tables. Intended for orchestrated
2438
- workers that did not themselves run the build; the endpoint does
2439
- not write anything *into* storage.
2440
- parameters:
2441
- - $ref: "#/components/parameters/environmentName"
2442
- - $ref: "#/components/parameters/packageName"
2443
- - name: action
2444
- in: query
2445
- required: true
2446
- schema:
2447
- type: string
2448
- enum:
2449
- - reload
2450
- description: Action to perform on the manifest
2451
- responses:
2452
- "200":
2453
- description: Manifest loaded
2454
- content:
2455
- application/json:
2456
- schema:
2457
- $ref: "#/components/schemas/BuildManifest"
2458
- "400":
2459
- $ref: "#/components/responses/BadRequest"
2460
- "404":
2461
- $ref: "#/components/responses/NotFound"
2462
-
2463
2210
  components:
2464
2211
  responses:
2465
2212
  BadRequest:
2466
- description: The request was malformed or cannot be performed given the current
2213
+ description:
2214
+ The request was malformed or cannot be performed given the current
2467
2215
  state of the system
2468
2216
  content:
2469
2217
  application/json:
@@ -2586,8 +2334,9 @@ components:
2586
2334
  description: Whether the server is fully initialized and ready to serve requests
2587
2335
  operationalState:
2588
2336
  type: string
2589
- enum: [ "initializing", "serving", "draining", "throttled" ]
2590
- description: Status of the server; initializing when the server is loading
2337
+ enum: ["initializing", "serving", "draining", "throttled"]
2338
+ description:
2339
+ Status of the server; initializing when the server is loading
2591
2340
  environments, packages and connections, serving when the server is
2592
2341
  initialized and ready to serve requests, draining when the
2593
2342
  server is going to shut down, and throttled when the server has hit
@@ -2598,12 +2347,14 @@ components:
2598
2347
  Only reported when the memory governor is enabled.
2599
2348
  frozenConfig:
2600
2349
  type: boolean
2601
- description: Whether the server configuration is frozen (read-only mode). When
2350
+ description:
2351
+ Whether the server configuration is frozen (read-only mode). When
2602
2352
  true, all mutation operations are disabled.
2603
2353
 
2604
2354
  Environment:
2605
2355
  type: object
2606
- description: Represents a Malloy environment containing packages, connections,
2356
+ description:
2357
+ Represents a Malloy environment containing packages, connections,
2607
2358
  and other resources
2608
2359
  properties:
2609
2360
  resource:
@@ -2617,7 +2368,8 @@ components:
2617
2368
  description: Environment README content
2618
2369
  location:
2619
2370
  type: string
2620
- description: Environment location, can be an absolute path or URI (e.g. github,
2371
+ description:
2372
+ Environment location, can be an absolute path or URI (e.g. github,
2621
2373
  s3, gcs, etc.)
2622
2374
  connections:
2623
2375
  type: array
@@ -2629,19 +2381,6 @@ components:
2629
2381
  description: List of Malloy packages in this environment
2630
2382
  items:
2631
2383
  $ref: "#/components/schemas/Package"
2632
- materializationStorage:
2633
- type: object
2634
- nullable: true
2635
- description: Optional DuckLake-backed storage for materialization manifests
2636
- (orchestrated mode). When set, manifests are stored in a shared
2637
- DuckLake catalog instead of the local DuckDB database.
2638
- properties:
2639
- catalogUrl:
2640
- type: string
2641
- description: PostgreSQL connection URL for the DuckLake catalog metadata store
2642
- dataPath:
2643
- type: string
2644
- description: Cloud storage path (s3:// or gs://) for DuckLake data files
2645
2384
 
2646
2385
  Package:
2647
2386
  type: object
@@ -2659,8 +2398,90 @@ components:
2659
2398
  description: Package description
2660
2399
  location:
2661
2400
  type: string
2662
- description: Package location, can be an absolute path or URI (e.g. github, s3,
2401
+ description:
2402
+ Package location, can be an absolute path or URI (e.g. github, s3,
2663
2403
  gcs, etc.)
2404
+ explores:
2405
+ type: array
2406
+ items:
2407
+ type: string
2408
+ description: >-
2409
+ Optional opt-in for curated discovery. When present, only these
2410
+ model file paths (relative to the package root) are listed via
2411
+ `listModels()`, and within-file discovery is filtered to each
2412
+ model's `export {}` closure. When absent or empty, every model is
2413
+ listed with its full source set (backward-compatible). Every other
2414
+ .malloy file still compiles for import/join resolution but is
2415
+ hidden from listings once `explores` is declared. Notebooks are
2416
+ always listed regardless of this field.
2417
+ exploresWarnings:
2418
+ type: array
2419
+ readOnly: true
2420
+ items:
2421
+ type: string
2422
+ description: >-
2423
+ Actionable messages for declared explores that do not resolve to
2424
+ a real model in this package (e.g. a misspelled path, or a notebook
2425
+ listed as an explore). Server-computed and read-only: it is
2426
+ ignored on create/update requests and only ever returned in
2427
+ responses. Present only when there are such problems. Loading is
2428
+ fail-safe — the unresolved entry simply lists nothing rather than
2429
+ exposing everything — so this is the signal that a package is
2430
+ misconfigured; publishing such a package is rejected.
2431
+ queryableSources:
2432
+ type: string
2433
+ enum:
2434
+ - declared
2435
+ - all
2436
+ description: >-
2437
+ Controls whether the discovery surface is also a query boundary.
2438
+ `"declared"` (the default) makes queryable == discoverable: when
2439
+ `explores` is declared, only `explores` model files — and within
2440
+ them only the `export {}` closure — are valid top-level query
2441
+ targets; every other source still compiles, imports, joins, and
2442
+ extends but is not directly queryable (denied with 404). `"all"`
2443
+ decouples them: `explores`/`export {}` gate discovery only and every
2444
+ compiled source stays directly queryable. When `explores` is absent
2445
+ there is no curated surface, so both modes are equivalent
2446
+ (everything queryable). Invalid values fall back to `"declared"`.
2447
+ Identity-based access is a separate concern — see `#(authorize)`.
2448
+ manifestLocation:
2449
+ type: ["string", "null"]
2450
+ description: |
2451
+ URI (gs:// or s3://) of the control-plane-computed manifest for this package.
2452
+ On (re)load the worker reads it and binds persist references
2453
+ (buildId -> physicalTableName). Null = serve live.
2454
+ manifestBindingStatus:
2455
+ type: string
2456
+ readOnly: true
2457
+ enum:
2458
+ - unbound
2459
+ - bound
2460
+ - live_fallback
2461
+ description: >-
2462
+ Server-computed, read-only: whether the control-plane build manifest
2463
+ is currently bound to this package's served models. `unbound` = no
2464
+ manifest configured, so the package serves live. `bound` = a manifest
2465
+ was fetched and applied, so persist sources route to their
2466
+ materialized physical tables. `live_fallback` = a `manifestLocation`
2467
+ is configured but the fetch/bind failed or timed out, so the package
2468
+ is serving live despite intending to be materialized-routed. Lets the
2469
+ control plane confirm a worker actually bound a distributed manifest
2470
+ rather than inferring it from logs.
2471
+ manifestEntryCount:
2472
+ type: integer
2473
+ readOnly: true
2474
+ description: >-
2475
+ Server-computed, read-only: number of buildId -> physical-table
2476
+ entries currently bound (0 when unbound or on live fallback).
2477
+ boundManifestUri:
2478
+ type: ["string", "null"]
2479
+ readOnly: true
2480
+ description: >-
2481
+ Server-computed, read-only: the manifest URI actually bound to the
2482
+ served models. Usually equals `manifestLocation`, but can differ
2483
+ after an in-memory auto-load following a materialization build (no
2484
+ URI), in which case it is null. Null whenever the package is unbound.
2664
2485
 
2665
2486
  Model:
2666
2487
  type: object
@@ -2702,7 +2523,8 @@ components:
2702
2523
  properties:
2703
2524
  resource:
2704
2525
  type: string
2705
- description: Canonical URL to the served page. Root-relative and does NOT
2526
+ description:
2527
+ Canonical URL to the served page. Root-relative and does NOT
2706
2528
  carry the /api/v0 prefix, because pages are static assets served off
2707
2529
  the server root rather than API resources.
2708
2530
  packageName:
@@ -2713,7 +2535,8 @@ components:
2713
2535
  description: Relative path to the HTML file within its package directory
2714
2536
  title:
2715
2537
  type: string
2716
- description: Title extracted from the file's <title> tag, or the path if
2538
+ description:
2539
+ Title extracted from the file's <title> tag, or the path if
2717
2540
  not present
2718
2541
 
2719
2542
  RawNotebook:
@@ -2769,7 +2592,8 @@ components:
2769
2592
  description: JSON string containing model metadata and structure information
2770
2593
  sourceInfos:
2771
2594
  type: array
2772
- description: Array of JSON strings containing source information for each data
2595
+ description:
2596
+ Array of JSON strings containing source information for each data
2773
2597
  source
2774
2598
  items:
2775
2599
  type: string
@@ -2785,7 +2609,8 @@ components:
2785
2609
  $ref: "#/components/schemas/Source"
2786
2610
  givens:
2787
2611
  type: array
2788
- description: Givens (runtime parameters) declared on this model via the
2612
+ description:
2613
+ Givens (runtime parameters) declared on this model via the
2789
2614
  `given:` keyword
2790
2615
  items:
2791
2616
  $ref: "#/components/schemas/Given"
@@ -2851,12 +2676,14 @@ components:
2851
2676
  description: Whether a value must be provided
2852
2677
  dimensionType:
2853
2678
  type: string
2854
- description: Malloy data type of the dimension (e.g. string, number, boolean,
2679
+ description:
2680
+ Malloy data type of the dimension (e.g. string, number, boolean,
2855
2681
  date, timestamp)
2856
2682
 
2857
2683
  Given:
2858
2684
  type: object
2859
- description: A given (runtime parameter) declared on a Malloy model via the
2685
+ description:
2686
+ A given (runtime parameter) declared on a Malloy model via the
2860
2687
  `given:` keyword. Surfaced on `CompiledModel.givens` and `Source.givens`
2861
2688
  so callers can introspect what runtime values a model accepts.
2862
2689
  properties:
@@ -2912,7 +2739,8 @@ components:
2912
2739
  $ref: "#/components/schemas/Filter"
2913
2740
  givens:
2914
2741
  type: array
2915
- description: Model-level givens (runtime parameters) available to queries
2742
+ description:
2743
+ Model-level givens (runtime parameters) available to queries
2916
2744
  on this source. Identical to `CompiledModel.givens`; repeated here
2917
2745
  for SDK ergonomics so consumers iterating sources can render inputs
2918
2746
  without a second lookup.
@@ -2938,23 +2766,27 @@ components:
2938
2766
  properties:
2939
2767
  query:
2940
2768
  type: string
2941
- description: Query string to execute on the model. If the query parameter is
2769
+ description:
2770
+ Query string to execute on the model. If the query parameter is
2942
2771
  set, the queryName parameter must be empty.
2943
2772
  sourceName:
2944
2773
  type: string
2945
- description: Name of the source in the model to use for queryName, search, and
2774
+ description:
2775
+ Name of the source in the model to use for queryName, search, and
2946
2776
  topValue requests.
2947
2777
  queryName:
2948
2778
  type: string
2949
- description: Name of a query to execute on a source in the model. Requires the
2779
+ description:
2780
+ Name of a query to execute on a source in the model. Requires the
2950
2781
  sourceName parameter is set. If the queryName parameter is set, the
2951
2782
  query parameter must be empty.
2952
2783
  compactJson:
2953
2784
  type: boolean
2954
2785
  default: false
2955
- description: "If true, returns a simple JSON array of row objects in the form
2956
- {\"columnName\": value}. If false (default), returns the full Malloy
2957
- result with type metadata for rendering."
2786
+ description:
2787
+ 'If true, returns a simple JSON array of row objects in the form
2788
+ {"columnName": value}. If false (default), returns the full Malloy
2789
+ result with type metadata for rendering.'
2958
2790
  versionId:
2959
2791
  type: string
2960
2792
  description: Version ID
@@ -2988,20 +2820,22 @@ components:
2988
2820
  properties:
2989
2821
  type:
2990
2822
  type: string
2991
- enum: [ "markdown", "code" ]
2823
+ enum: ["markdown", "code"]
2992
2824
  description: Type of notebook cell
2993
2825
  text:
2994
2826
  type: string
2995
2827
  description: Text contents of the notebook cell (either markdown or Malloy code)
2996
2828
  newSources:
2997
2829
  type: array
2998
- description: Array of JSON strings containing SourceInfo objects made available
2830
+ description:
2831
+ Array of JSON strings containing SourceInfo objects made available
2999
2832
  in this cell
3000
2833
  items:
3001
2834
  type: string
3002
2835
  queryInfo:
3003
2836
  type: string
3004
- description: JSON string containing QueryInfo object for the query in this cell
2837
+ description:
2838
+ JSON string containing QueryInfo object for the query in this cell
3005
2839
  (if the cell contains a query)
3006
2840
 
3007
2841
  NotebookCellResult:
@@ -3010,7 +2844,7 @@ components:
3010
2844
  properties:
3011
2845
  type:
3012
2846
  type: string
3013
- enum: [ "markdown", "code" ]
2847
+ enum: ["markdown", "code"]
3014
2848
  description: Type of notebook cell
3015
2849
  text:
3016
2850
  type: string
@@ -3020,7 +2854,8 @@ components:
3020
2854
  description: JSON string containing the execution result for this cell
3021
2855
  newSources:
3022
2856
  type: array
3023
- description: Array of JSON strings containing SourceInfo objects made available
2857
+ description:
2858
+ Array of JSON strings containing SourceInfo objects made available
3024
2859
  in this cell
3025
2860
  items:
3026
2861
  type: string
@@ -3031,14 +2866,16 @@ components:
3031
2866
  properties:
3032
2867
  result:
3033
2868
  type: string
3034
- description: JSON string containing the query results, metadata, and execution
2869
+ description:
2870
+ JSON string containing the query results, metadata, and execution
3035
2871
  information
3036
2872
  resource:
3037
2873
  type: string
3038
2874
  description: Resource path to the query result
3039
2875
  renderLogs:
3040
2876
  type: array
3041
- description: Render tag validation messages (errors, warnings) detected during
2877
+ description:
2878
+ Render tag validation messages (errors, warnings) detected during
3042
2879
  query preparation
3043
2880
  items:
3044
2881
  $ref: "#/components/schemas/LogMessage"
@@ -3071,7 +2908,7 @@ components:
3071
2908
  severity:
3072
2909
  type: string
3073
2910
  description: Severity level of the log message
3074
- enum: [ "debug", "info", "warn", "error" ]
2911
+ enum: ["debug", "info", "warn", "error"]
3075
2912
  message:
3076
2913
  type: string
3077
2914
  description: Human-readable log message
@@ -3091,7 +2928,7 @@ components:
3091
2928
  type:
3092
2929
  type: string
3093
2930
  description: Type of embedded database
3094
- enum: [ "embedded", "materialized" ]
2931
+ enum: ["embedded", "materialized"]
3095
2932
 
3096
2933
  Schema:
3097
2934
  description: A schema name in a Connection.
@@ -3194,7 +3031,8 @@ components:
3194
3031
  description: PostgreSQL password for authentication
3195
3032
  connectionString:
3196
3033
  type: string
3197
- description: Complete PostgreSQL connection string (alternative to individual
3034
+ description:
3035
+ Complete PostgreSQL connection string (alternative to individual
3198
3036
  parameters)
3199
3037
 
3200
3038
  MysqlConnection:
@@ -3264,7 +3102,7 @@ components:
3264
3102
  properties:
3265
3103
  authType:
3266
3104
  type: string
3267
- enum: [ service_principal, sas_token ]
3105
+ enum: [service_principal, sas_token]
3268
3106
  description: Authentication method for Azure Storage
3269
3107
  sasUrl:
3270
3108
  type: string
@@ -3305,7 +3143,8 @@ components:
3305
3143
  properties:
3306
3144
  bucketUrl:
3307
3145
  type: string
3308
- description: URL of the storage bucket (e.g. s3://my-bucket/path or
3146
+ description:
3147
+ URL of the storage bucket (e.g. s3://my-bucket/path or
3309
3148
  gs://my-bucket/path)
3310
3149
  s3Connection:
3311
3150
  $ref: "#/components/schemas/S3Connection"
@@ -3478,7 +3317,7 @@ components:
3478
3317
  type:
3479
3318
  type: string
3480
3319
  description: Type of database connection
3481
- enum: [ bigquery, snowflake, postgres, gcs, s3, azure ]
3320
+ enum: [bigquery, snowflake, postgres, gcs, s3, azure]
3482
3321
  attributes:
3483
3322
  $ref: "#/components/schemas/ConnectionAttributes"
3484
3323
  bigqueryConnection:
@@ -3519,24 +3358,6 @@ components:
3519
3358
  items:
3520
3359
  $ref: "#/components/schemas/Column"
3521
3360
 
3522
- # TODO: Remove this. Replaced by Table
3523
- TableSource:
3524
- type: object
3525
- deprecated: true
3526
- properties:
3527
- resource:
3528
- type: string
3529
- description: Resource path to the table source.
3530
- # Pass source as an opaque JSON string that is malloyVersion dependent.
3531
- # TODO: Remove this once we update the Malloy Publisher connection.
3532
- source:
3533
- type: string
3534
- columns:
3535
- description: Table fields
3536
- type: array
3537
- items:
3538
- $ref: "#/components/schemas/Column"
3539
-
3540
3361
  TemporaryTable:
3541
3362
  type: object
3542
3363
  properties:
@@ -3609,7 +3430,8 @@ components:
3609
3430
  description: Name of the environment being watched for file changes
3610
3431
  watchingPath:
3611
3432
  type: string
3612
- description: The file system path being monitored for changes, null if not
3433
+ description:
3434
+ The file system path being monitored for changes, null if not
3613
3435
  watching
3614
3436
  required:
3615
3437
  - enabled
@@ -3633,7 +3455,7 @@ components:
3633
3455
  status:
3634
3456
  type: string
3635
3457
  description: Connection test result status
3636
- enum: [ "ok", "failed" ]
3458
+ enum: ["ok", "failed"]
3637
3459
  errorMessage:
3638
3460
  type: string
3639
3461
  description: Error message if the connection test failed, null if successful
@@ -3648,7 +3470,8 @@ components:
3648
3470
  includeSql:
3649
3471
  type: boolean
3650
3472
  default: false
3651
- description: If true, returns the generated SQL alongside compilation results
3473
+ description:
3474
+ If true, returns the generated SQL alongside compilation results
3652
3475
  (only available when compilation succeeds and the source contains a
3653
3476
  runnable query).
3654
3477
  givens:
@@ -3662,9 +3485,10 @@ components:
3662
3485
  properties:
3663
3486
  status:
3664
3487
  type: string
3665
- description: Overall compilation status — "error" if any problems have error
3488
+ description:
3489
+ Overall compilation status — "error" if any problems have error
3666
3490
  severity
3667
- enum: [ "success", "error" ]
3491
+ enum: ["success", "error"]
3668
3492
  problems:
3669
3493
  type: array
3670
3494
  description: List of compilation problems (errors and warnings)
@@ -3672,7 +3496,8 @@ components:
3672
3496
  $ref: "#/components/schemas/CompileProblem"
3673
3497
  sql:
3674
3498
  type: string
3675
- description: Generated SQL for the compiled query. Only present when includeSql
3499
+ description:
3500
+ Generated SQL for the compiled query. Only present when includeSql
3676
3501
  is true and compilation succeeds with a runnable query.
3677
3502
 
3678
3503
  CompileProblem:
@@ -3685,7 +3510,7 @@ components:
3685
3510
  severity:
3686
3511
  type: string
3687
3512
  description: Severity level of the problem
3688
- enum: [ "error", "warn", "debug" ]
3513
+ enum: ["error", "warn", "debug"]
3689
3514
  code:
3690
3515
  type: string
3691
3516
  description: Machine-readable error code
@@ -3702,22 +3527,46 @@ components:
3702
3527
 
3703
3528
  CreateMaterializationRequest:
3704
3529
  type: object
3705
- description: Options for creating a materialization
3530
+ description:
3531
+ Options for starting a materialization. Auto-run by default; opt into the
3532
+ two-round control-plane-driven flow with pauseBetweenPhases.
3706
3533
  properties:
3707
- forceRefresh:
3534
+ pauseBetweenPhases:
3708
3535
  type: boolean
3709
3536
  default: false
3710
- description: If true, forces rebuild of all sources even if their BuildID is
3711
- unchanged
3712
- autoLoadManifest:
3537
+ description:
3538
+ When false (default) the publisher runs all phases in one pass —
3539
+ self-assigns table names (the "#@ persist name=" value, else the
3540
+ source name), builds with realization=COPY, assembles the manifest,
3541
+ and auto-loads it into the package models. When true it pauses at
3542
+ BUILD_PLAN_READY for the control plane to send Round 2 build
3543
+ instructions.
3544
+ forceRefresh:
3713
3545
  type: boolean
3714
3546
  default: false
3715
- description: If true, automatically reloads the manifest into the Malloy Runtime
3716
- after a successful materialization
3547
+ description: Build a new table even when a source's buildId is unchanged.
3548
+ sourceNames:
3549
+ type: array
3550
+ items:
3551
+ type: string
3552
+ description:
3553
+ Restrict the plan/build to these persist source names. Omit = all
3554
+ persist sources.
3555
+
3556
+ MaterializationStatus:
3557
+ type: string
3558
+ description: Phase-aware status of a two-round materialization run.
3559
+ enum:
3560
+ - PENDING
3561
+ - BUILD_PLAN_READY
3562
+ - MANIFEST_ROWS_READY
3563
+ - MANIFEST_FILE_READY
3564
+ - FAILED
3565
+ - CANCELLED
3717
3566
 
3718
3567
  Materialization:
3719
3568
  type: object
3720
- description: A record of a package materialization
3569
+ description: A record of one two-round materialization run for a package.
3721
3570
  properties:
3722
3571
  id:
3723
3572
  type: string
@@ -3725,21 +3574,36 @@ components:
3725
3574
  type: string
3726
3575
  packageName:
3727
3576
  type: string
3577
+ pauseBetweenPhases:
3578
+ type: boolean
3579
+ description:
3580
+ Echoes the create-time flag. False (default) = auto-run all phases;
3581
+ true = pause at BUILD_PLAN_READY for control-plane-driven Round 2.
3728
3582
  status:
3729
- type: string
3730
- enum: [ "PENDING", "RUNNING", "SUCCESS", "FAILED", "CANCELLED" ]
3583
+ $ref: "#/components/schemas/MaterializationStatus"
3584
+ buildPlan:
3585
+ oneOf:
3586
+ - $ref: "#/components/schemas/BuildPlan"
3587
+ - type: "null"
3588
+ description: Round 1 output. Null until status >= BUILD_PLAN_READY.
3589
+ manifest:
3590
+ oneOf:
3591
+ - $ref: "#/components/schemas/BuildManifest"
3592
+ - type: "null"
3593
+ description: Round 2 output. Null until status = MANIFEST_FILE_READY.
3731
3594
  startedAt:
3732
- type: [ "string", "null" ]
3595
+ type: ["string", "null"]
3733
3596
  format: date-time
3734
3597
  completedAt:
3735
- type: [ "string", "null" ]
3598
+ type: ["string", "null"]
3736
3599
  format: date-time
3737
3600
  error:
3738
- type: [ "string", "null" ]
3601
+ type: ["string", "null"]
3739
3602
  description: Error message if the materialization failed
3740
3603
  metadata:
3741
- type: [ "object", "null" ]
3742
- description: Materialization metadata including build options, source counts,
3604
+ type: ["object", "null"]
3605
+ description:
3606
+ Materialization metadata including build options, source counts,
3743
3607
  and durations
3744
3608
  createdAt:
3745
3609
  type: string
@@ -3748,26 +3612,161 @@ components:
3748
3612
  type: string
3749
3613
  format: date-time
3750
3614
 
3615
+ BuildPlan:
3616
+ type: object
3617
+ description: |
3618
+ Round 1 output. Mirrors Malloy's native build plan plus the minimal
3619
+ per-source detail the control plane needs in v0 to assign
3620
+ identity/naming/realization. Lineage, policy, and connection
3621
+ capability are intentionally omitted until they carry real data.
3622
+ required: [graphs, sources]
3623
+ properties:
3624
+ graphs:
3625
+ type: array
3626
+ description: Dependency-ordered build graphs, one per connection.
3627
+ items:
3628
+ $ref: "#/components/schemas/BuildGraph"
3629
+ sources:
3630
+ type: object
3631
+ description: Map of sourceID ("sourceName@modelURL") to per-source plan.
3632
+ additionalProperties:
3633
+ $ref: "#/components/schemas/PersistSourcePlan"
3634
+
3635
+ BuildGraph:
3636
+ type: object
3637
+ required: [connectionName, nodes]
3638
+ properties:
3639
+ connectionName:
3640
+ type: string
3641
+ nodes:
3642
+ type: array
3643
+ description:
3644
+ Leveled build nodes; each inner array is one parallelizable level,
3645
+ levels run in order.
3646
+ items:
3647
+ type: array
3648
+ items:
3649
+ $ref: "#/components/schemas/BuildNode"
3650
+
3651
+ BuildNode:
3652
+ type: object
3653
+ required: [sourceID]
3654
+ properties:
3655
+ sourceID:
3656
+ type: string
3657
+ description: "sourceName@modelURL"
3658
+ dependsOn:
3659
+ type: array
3660
+ description: Upstream sourceIDs in this graph.
3661
+ items:
3662
+ type: string
3663
+
3664
+ PersistSourcePlan:
3665
+ type: object
3666
+ required: [name, sourceID, connectionName, buildId, sql, columns]
3667
+ properties:
3668
+ name:
3669
+ type: string
3670
+ sourceID:
3671
+ type: string
3672
+ connectionName:
3673
+ type: string
3674
+ dialect:
3675
+ type: string
3676
+ buildId:
3677
+ type: string
3678
+ description: hash(connectionDigest + canonical logical SQL).
3679
+ sql:
3680
+ type: string
3681
+ description:
3682
+ The source's build SQL (with the build manifest applied for upstream
3683
+ rewrites).
3684
+ columns:
3685
+ type: array
3686
+ description: Output schema of the source.
3687
+ items:
3688
+ $ref: "#/components/schemas/Column"
3689
+
3690
+ Realization:
3691
+ type: string
3692
+ enum: [SNAPSHOT, COPY]
3693
+ description: SNAPSHOT = warehouse clone/snapshot; COPY = CREATE TABLE AS SELECT.
3694
+
3695
+ BuildInstructions:
3696
+ type: object
3697
+ description: Round 2 input. Per-source instructions assigned by the control plane.
3698
+ required: [sources]
3699
+ properties:
3700
+ sources:
3701
+ type: array
3702
+ items:
3703
+ $ref: "#/components/schemas/BuildInstruction"
3704
+
3705
+ BuildInstruction:
3706
+ type: object
3707
+ required: [buildId, materializedTableId, physicalTableName, realization]
3708
+ properties:
3709
+ buildId:
3710
+ type: string
3711
+ description: Identifies which planned source this instruction is for
3712
+ (matches PersistSourcePlan.buildId).
3713
+ sourceID:
3714
+ type: string
3715
+ description:
3716
+ Optional convenience echo of "sourceName@modelURL"; buildId is
3717
+ authoritative.
3718
+ materializedTableId:
3719
+ type: string
3720
+ description:
3721
+ CP-assigned surrogate id for the materialized table about to be
3722
+ produced.
3723
+ physicalTableName:
3724
+ type: string
3725
+ description:
3726
+ Fully-qualified, dialect-quoted table name to create. The publisher
3727
+ writes here verbatim.
3728
+ realization:
3729
+ $ref: "#/components/schemas/Realization"
3730
+
3751
3731
  BuildManifest:
3752
3732
  type: object
3753
- description: Manifest mapping BuildIDs to materialized table names
3733
+ description:
3734
+ Round 2 output. Maps each buildId a build produced to its physical table.
3735
+ Returned inline; the control plane persists it.
3754
3736
  properties:
3737
+ builtAt:
3738
+ type: string
3739
+ format: date-time
3755
3740
  entries:
3756
3741
  type: object
3757
3742
  additionalProperties:
3758
3743
  $ref: "#/components/schemas/ManifestEntry"
3759
- description: Map of BuildID to manifest entry
3744
+ description: Map of buildId to manifest entry.
3760
3745
  strict:
3761
3746
  type: boolean
3762
- description: Whether the manifest is in strict mode
3747
+ description: Whether unresolved references should error.
3763
3748
 
3764
3749
  ManifestEntry:
3765
3750
  type: object
3766
- description: A single entry in the build manifest
3751
+ description: A single entry in the build manifest.
3752
+ required: [buildId, physicalTableName]
3767
3753
  properties:
3768
- tableName:
3754
+ buildId:
3755
+ type: string
3756
+ sourceName:
3757
+ type: string
3758
+ materializedTableId:
3759
+ type: string
3760
+ description: Echoes the CP-assigned id from the BuildInstruction.
3761
+ physicalTableName:
3769
3762
  type: string
3770
- description: Name of the materialized table
3763
+ description: Name of the materialized table.
3764
+ connectionName:
3765
+ type: string
3766
+ realization:
3767
+ $ref: "#/components/schemas/Realization"
3768
+ rowCount:
3769
+ type: ["integer", "null"]
3771
3770
 
3772
3771
  parameters:
3773
3772
  environmentName: