@ultracart/bq-skill 0.1.2

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 (303) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +952 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +42 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/alarm.d.ts +3 -0
  8. package/dist/commands/alarm.d.ts.map +1 -0
  9. package/dist/commands/alarm.js +146 -0
  10. package/dist/commands/alarm.js.map +1 -0
  11. package/dist/commands/config.d.ts +3 -0
  12. package/dist/commands/config.d.ts.map +1 -0
  13. package/dist/commands/config.js +749 -0
  14. package/dist/commands/config.js.map +1 -0
  15. package/dist/commands/deck.d.ts +3 -0
  16. package/dist/commands/deck.d.ts.map +1 -0
  17. package/dist/commands/deck.js +567 -0
  18. package/dist/commands/deck.js.map +1 -0
  19. package/dist/commands/dry-run.d.ts +3 -0
  20. package/dist/commands/dry-run.d.ts.map +1 -0
  21. package/dist/commands/dry-run.js +105 -0
  22. package/dist/commands/dry-run.js.map +1 -0
  23. package/dist/commands/history.d.ts +3 -0
  24. package/dist/commands/history.d.ts.map +1 -0
  25. package/dist/commands/history.js +127 -0
  26. package/dist/commands/history.js.map +1 -0
  27. package/dist/commands/init.d.ts +3 -0
  28. package/dist/commands/init.d.ts.map +1 -0
  29. package/dist/commands/init.js +302 -0
  30. package/dist/commands/init.js.map +1 -0
  31. package/dist/commands/install-skill.d.ts +3 -0
  32. package/dist/commands/install-skill.d.ts.map +1 -0
  33. package/dist/commands/install-skill.js +132 -0
  34. package/dist/commands/install-skill.js.map +1 -0
  35. package/dist/commands/list.d.ts +3 -0
  36. package/dist/commands/list.d.ts.map +1 -0
  37. package/dist/commands/list.js +89 -0
  38. package/dist/commands/list.js.map +1 -0
  39. package/dist/commands/query.d.ts +3 -0
  40. package/dist/commands/query.d.ts.map +1 -0
  41. package/dist/commands/query.js +152 -0
  42. package/dist/commands/query.js.map +1 -0
  43. package/dist/commands/render.d.ts +3 -0
  44. package/dist/commands/render.d.ts.map +1 -0
  45. package/dist/commands/render.js +107 -0
  46. package/dist/commands/render.js.map +1 -0
  47. package/dist/commands/run-all.d.ts +3 -0
  48. package/dist/commands/run-all.d.ts.map +1 -0
  49. package/dist/commands/run-all.js +285 -0
  50. package/dist/commands/run-all.js.map +1 -0
  51. package/dist/commands/run.d.ts +3 -0
  52. package/dist/commands/run.d.ts.map +1 -0
  53. package/dist/commands/run.js +321 -0
  54. package/dist/commands/run.js.map +1 -0
  55. package/dist/commands/schema.d.ts +3 -0
  56. package/dist/commands/schema.d.ts.map +1 -0
  57. package/dist/commands/schema.js +271 -0
  58. package/dist/commands/schema.js.map +1 -0
  59. package/dist/commands/validate.d.ts +3 -0
  60. package/dist/commands/validate.d.ts.map +1 -0
  61. package/dist/commands/validate.js +109 -0
  62. package/dist/commands/validate.js.map +1 -0
  63. package/dist/lib/alarm-notify.d.ts +16 -0
  64. package/dist/lib/alarm-notify.d.ts.map +1 -0
  65. package/dist/lib/alarm-notify.js +312 -0
  66. package/dist/lib/alarm-notify.js.map +1 -0
  67. package/dist/lib/alarm-state.d.ts +26 -0
  68. package/dist/lib/alarm-state.d.ts.map +1 -0
  69. package/dist/lib/alarm-state.js +118 -0
  70. package/dist/lib/alarm-state.js.map +1 -0
  71. package/dist/lib/alarm.d.ts +28 -0
  72. package/dist/lib/alarm.d.ts.map +1 -0
  73. package/dist/lib/alarm.js +215 -0
  74. package/dist/lib/alarm.js.map +1 -0
  75. package/dist/lib/analysis.d.ts +16 -0
  76. package/dist/lib/analysis.d.ts.map +1 -0
  77. package/dist/lib/analysis.js +134 -0
  78. package/dist/lib/analysis.js.map +1 -0
  79. package/dist/lib/bigquery.d.ts +55 -0
  80. package/dist/lib/bigquery.d.ts.map +1 -0
  81. package/dist/lib/bigquery.js +321 -0
  82. package/dist/lib/bigquery.js.map +1 -0
  83. package/dist/lib/config-writer.d.ts +3 -0
  84. package/dist/lib/config-writer.d.ts.map +1 -0
  85. package/dist/lib/config-writer.js +60 -0
  86. package/dist/lib/config-writer.js.map +1 -0
  87. package/dist/lib/config.d.ts +63 -0
  88. package/dist/lib/config.d.ts.map +1 -0
  89. package/dist/lib/config.js +151 -0
  90. package/dist/lib/config.js.map +1 -0
  91. package/dist/lib/dashboard.d.ts +3 -0
  92. package/dist/lib/dashboard.d.ts.map +1 -0
  93. package/dist/lib/dashboard.js +468 -0
  94. package/dist/lib/dashboard.js.map +1 -0
  95. package/dist/lib/deck.d.ts +58 -0
  96. package/dist/lib/deck.d.ts.map +1 -0
  97. package/dist/lib/deck.js +232 -0
  98. package/dist/lib/deck.js.map +1 -0
  99. package/dist/lib/deliver-email.d.ts +14 -0
  100. package/dist/lib/deliver-email.d.ts.map +1 -0
  101. package/dist/lib/deliver-email.js +360 -0
  102. package/dist/lib/deliver-email.js.map +1 -0
  103. package/dist/lib/deliver-slack.d.ts +6 -0
  104. package/dist/lib/deliver-slack.d.ts.map +1 -0
  105. package/dist/lib/deliver-slack.js +73 -0
  106. package/dist/lib/deliver-slack.js.map +1 -0
  107. package/dist/lib/deliver.d.ts +10 -0
  108. package/dist/lib/deliver.d.ts.map +1 -0
  109. package/dist/lib/deliver.js +95 -0
  110. package/dist/lib/deliver.js.map +1 -0
  111. package/dist/lib/llm/anthropic.d.ts +7 -0
  112. package/dist/lib/llm/anthropic.d.ts.map +1 -0
  113. package/dist/lib/llm/anthropic.js +69 -0
  114. package/dist/lib/llm/anthropic.js.map +1 -0
  115. package/dist/lib/llm/bedrock.d.ts +7 -0
  116. package/dist/lib/llm/bedrock.d.ts.map +1 -0
  117. package/dist/lib/llm/bedrock.js +67 -0
  118. package/dist/lib/llm/bedrock.js.map +1 -0
  119. package/dist/lib/llm/gemini.d.ts +7 -0
  120. package/dist/lib/llm/gemini.d.ts.map +1 -0
  121. package/dist/lib/llm/gemini.js +67 -0
  122. package/dist/lib/llm/gemini.js.map +1 -0
  123. package/dist/lib/llm/index.d.ts +5 -0
  124. package/dist/lib/llm/index.d.ts.map +1 -0
  125. package/dist/lib/llm/index.js +61 -0
  126. package/dist/lib/llm/index.js.map +1 -0
  127. package/dist/lib/llm/models.d.ts +5 -0
  128. package/dist/lib/llm/models.d.ts.map +1 -0
  129. package/dist/lib/llm/models.js +33 -0
  130. package/dist/lib/llm/models.js.map +1 -0
  131. package/dist/lib/llm/openai.d.ts +8 -0
  132. package/dist/lib/llm/openai.d.ts.map +1 -0
  133. package/dist/lib/llm/openai.js +48 -0
  134. package/dist/lib/llm/openai.js.map +1 -0
  135. package/dist/lib/llm/provider.d.ts +28 -0
  136. package/dist/lib/llm/provider.d.ts.map +1 -0
  137. package/dist/lib/llm/provider.js +3 -0
  138. package/dist/lib/llm/provider.js.map +1 -0
  139. package/dist/lib/manifest.d.ts +95 -0
  140. package/dist/lib/manifest.d.ts.map +1 -0
  141. package/dist/lib/manifest.js +105 -0
  142. package/dist/lib/manifest.js.map +1 -0
  143. package/dist/lib/params.d.ts +27 -0
  144. package/dist/lib/params.d.ts.map +1 -0
  145. package/dist/lib/params.js +192 -0
  146. package/dist/lib/params.js.map +1 -0
  147. package/dist/lib/pdf.d.ts +8 -0
  148. package/dist/lib/pdf.d.ts.map +1 -0
  149. package/dist/lib/pdf.js +86 -0
  150. package/dist/lib/pdf.js.map +1 -0
  151. package/dist/lib/renderer.d.ts +17 -0
  152. package/dist/lib/renderer.d.ts.map +1 -0
  153. package/dist/lib/renderer.js +166 -0
  154. package/dist/lib/renderer.js.map +1 -0
  155. package/dist/lib/schema-filter.d.ts +3 -0
  156. package/dist/lib/schema-filter.d.ts.map +1 -0
  157. package/dist/lib/schema-filter.js +49 -0
  158. package/dist/lib/schema-filter.js.map +1 -0
  159. package/dist/lib/template.d.ts +4 -0
  160. package/dist/lib/template.d.ts.map +1 -0
  161. package/dist/lib/template.js +37 -0
  162. package/dist/lib/template.js.map +1 -0
  163. package/dist/lib/validator.d.ts +8 -0
  164. package/dist/lib/validator.d.ts.map +1 -0
  165. package/dist/lib/validator.js +88 -0
  166. package/dist/lib/validator.js.map +1 -0
  167. package/package.json +59 -0
  168. package/schemas/deck.schema.json +122 -0
  169. package/schemas/report-manifest.schema.json +309 -0
  170. package/schemas/tables/README.md +45 -0
  171. package/schemas/tables/ultracart_dw/uc_affiliate_clicks.json +186 -0
  172. package/schemas/tables/ultracart_dw/uc_affiliate_commission_groups.json +317 -0
  173. package/schemas/tables/ultracart_dw/uc_affiliate_ledgers.json +404 -0
  174. package/schemas/tables/ultracart_dw/uc_affiliate_network_pixel_postback_logs.json +166 -0
  175. package/schemas/tables/ultracart_dw/uc_affiliate_network_pixels.json +106 -0
  176. package/schemas/tables/ultracart_dw/uc_affiliate_payments.json +204 -0
  177. package/schemas/tables/ultracart_dw/uc_affiliate_postback_logs.json +90 -0
  178. package/schemas/tables/ultracart_dw/uc_affiliates.json +425 -0
  179. package/schemas/tables/ultracart_dw/uc_auto_orders.json +13848 -0
  180. package/schemas/tables/ultracart_dw/uc_cart_abandons.json +3971 -0
  181. package/schemas/tables/ultracart_dw/uc_conversation_pbx_calls.json +374 -0
  182. package/schemas/tables/ultracart_dw/uc_conversations.json +374 -0
  183. package/schemas/tables/ultracart_dw/uc_coupons.json +1893 -0
  184. package/schemas/tables/ultracart_dw/uc_customers.json +11886 -0
  185. package/schemas/tables/ultracart_dw/uc_fraud_rules.json +239 -0
  186. package/schemas/tables/ultracart_dw/uc_gift_certificates.json +135 -0
  187. package/schemas/tables/ultracart_dw/uc_item_inventory_history.json +79 -0
  188. package/schemas/tables/ultracart_dw/uc_items.json +4437 -0
  189. package/schemas/tables/ultracart_dw/uc_orders.json +6629 -0
  190. package/schemas/tables/ultracart_dw/uc_rotating_transaction_gateway_history.json +271 -0
  191. package/schemas/tables/ultracart_dw/uc_rotating_transaction_gateways.json +416 -0
  192. package/schemas/tables/ultracart_dw/uc_shipping_methods.json +1372 -0
  193. package/schemas/tables/ultracart_dw/uc_storefront_customers.json +261 -0
  194. package/schemas/tables/ultracart_dw/uc_storefront_experiments.json +386 -0
  195. package/schemas/tables/ultracart_dw/uc_storefront_pages.json +513 -0
  196. package/schemas/tables/ultracart_dw/uc_storefront_upsell_offer_events.json +338 -0
  197. package/schemas/tables/ultracart_dw/uc_storefront_upsell_offers.json +431 -0
  198. package/schemas/tables/ultracart_dw/uc_storefront_upsell_paths.json +163 -0
  199. package/schemas/tables/ultracart_dw/uc_storefronts.json +62 -0
  200. package/schemas/tables/ultracart_dw/uc_surveys.json +238 -0
  201. package/schemas/tables/ultracart_dw/uc_workflow_tasks.json +377 -0
  202. package/schemas/tables/ultracart_dw/uc_zoho_desk_tickets.json +1184 -0
  203. package/schemas/tables/ultracart_dw_high/uc_affiliate_clicks.json +186 -0
  204. package/schemas/tables/ultracart_dw_high/uc_affiliate_commission_groups.json +317 -0
  205. package/schemas/tables/ultracart_dw_high/uc_affiliate_ledgers.json +404 -0
  206. package/schemas/tables/ultracart_dw_high/uc_affiliate_network_pixel_postback_logs.json +166 -0
  207. package/schemas/tables/ultracart_dw_high/uc_affiliate_network_pixels.json +106 -0
  208. package/schemas/tables/ultracart_dw_high/uc_affiliate_payments.json +204 -0
  209. package/schemas/tables/ultracart_dw_high/uc_affiliate_postback_logs.json +90 -0
  210. package/schemas/tables/ultracart_dw_high/uc_affiliates.json +425 -0
  211. package/schemas/tables/ultracart_dw_high/uc_auto_orders.json +14332 -0
  212. package/schemas/tables/ultracart_dw_high/uc_cart_abandons.json +4245 -0
  213. package/schemas/tables/ultracart_dw_high/uc_conversation_pbx_calls.json +415 -0
  214. package/schemas/tables/ultracart_dw_high/uc_conversations.json +415 -0
  215. package/schemas/tables/ultracart_dw_high/uc_coupons.json +1893 -0
  216. package/schemas/tables/ultracart_dw_high/uc_customers.json +12250 -0
  217. package/schemas/tables/ultracart_dw_high/uc_fraud_rules.json +239 -0
  218. package/schemas/tables/ultracart_dw_high/uc_gift_certificates.json +135 -0
  219. package/schemas/tables/ultracart_dw_high/uc_item_inventory_history.json +79 -0
  220. package/schemas/tables/ultracart_dw_high/uc_items.json +4437 -0
  221. package/schemas/tables/ultracart_dw_high/uc_orders.json +6871 -0
  222. package/schemas/tables/ultracart_dw_high/uc_rotating_transaction_gateway_history.json +271 -0
  223. package/schemas/tables/ultracart_dw_high/uc_rotating_transaction_gateways.json +416 -0
  224. package/schemas/tables/ultracart_dw_high/uc_shipping_methods.json +1372 -0
  225. package/schemas/tables/ultracart_dw_high/uc_storefront_customers.json +261 -0
  226. package/schemas/tables/ultracart_dw_high/uc_storefront_experiments.json +386 -0
  227. package/schemas/tables/ultracart_dw_high/uc_storefront_pages.json +513 -0
  228. package/schemas/tables/ultracart_dw_high/uc_storefront_upsell_offer_events.json +338 -0
  229. package/schemas/tables/ultracart_dw_high/uc_storefront_upsell_offers.json +431 -0
  230. package/schemas/tables/ultracart_dw_high/uc_storefront_upsell_paths.json +163 -0
  231. package/schemas/tables/ultracart_dw_high/uc_storefronts.json +62 -0
  232. package/schemas/tables/ultracart_dw_high/uc_surveys.json +269 -0
  233. package/schemas/tables/ultracart_dw_high/uc_workflow_tasks.json +377 -0
  234. package/schemas/tables/ultracart_dw_high/uc_zoho_desk_tickets.json +1330 -0
  235. package/schemas/tables/ultracart_dw_low/uc_affiliate_clicks.json +186 -0
  236. package/schemas/tables/ultracart_dw_low/uc_affiliate_commission_groups.json +317 -0
  237. package/schemas/tables/ultracart_dw_low/uc_affiliate_ledgers.json +404 -0
  238. package/schemas/tables/ultracart_dw_low/uc_affiliate_network_pixel_postback_logs.json +166 -0
  239. package/schemas/tables/ultracart_dw_low/uc_affiliate_network_pixels.json +106 -0
  240. package/schemas/tables/ultracart_dw_low/uc_affiliate_payments.json +204 -0
  241. package/schemas/tables/ultracart_dw_low/uc_affiliate_postback_logs.json +90 -0
  242. package/schemas/tables/ultracart_dw_low/uc_affiliates.json +425 -0
  243. package/schemas/tables/ultracart_dw_low/uc_auto_orders.json +13868 -0
  244. package/schemas/tables/ultracart_dw_low/uc_cart_abandons.json +3971 -0
  245. package/schemas/tables/ultracart_dw_low/uc_conversation_pbx_calls.json +374 -0
  246. package/schemas/tables/ultracart_dw_low/uc_conversations.json +374 -0
  247. package/schemas/tables/ultracart_dw_low/uc_coupons.json +1893 -0
  248. package/schemas/tables/ultracart_dw_low/uc_customers.json +11900 -0
  249. package/schemas/tables/ultracart_dw_low/uc_fraud_rules.json +239 -0
  250. package/schemas/tables/ultracart_dw_low/uc_gift_certificates.json +135 -0
  251. package/schemas/tables/ultracart_dw_low/uc_item_inventory_history.json +79 -0
  252. package/schemas/tables/ultracart_dw_low/uc_items.json +4437 -0
  253. package/schemas/tables/ultracart_dw_low/uc_orders.json +6639 -0
  254. package/schemas/tables/ultracart_dw_low/uc_rotating_transaction_gateway_history.json +271 -0
  255. package/schemas/tables/ultracart_dw_low/uc_rotating_transaction_gateways.json +416 -0
  256. package/schemas/tables/ultracart_dw_low/uc_shipping_methods.json +1372 -0
  257. package/schemas/tables/ultracart_dw_low/uc_storefront_customers.json +261 -0
  258. package/schemas/tables/ultracart_dw_low/uc_storefront_experiments.json +386 -0
  259. package/schemas/tables/ultracart_dw_low/uc_storefront_pages.json +513 -0
  260. package/schemas/tables/ultracart_dw_low/uc_storefront_upsell_offer_events.json +338 -0
  261. package/schemas/tables/ultracart_dw_low/uc_storefront_upsell_offers.json +431 -0
  262. package/schemas/tables/ultracart_dw_low/uc_storefront_upsell_paths.json +163 -0
  263. package/schemas/tables/ultracart_dw_low/uc_storefronts.json +62 -0
  264. package/schemas/tables/ultracart_dw_low/uc_surveys.json +238 -0
  265. package/schemas/tables/ultracart_dw_low/uc_workflow_tasks.json +377 -0
  266. package/schemas/tables/ultracart_dw_low/uc_zoho_desk_tickets.json +1184 -0
  267. package/schemas/tables/ultracart_dw_medium/uc_affiliate_clicks.json +186 -0
  268. package/schemas/tables/ultracart_dw_medium/uc_affiliate_commission_groups.json +317 -0
  269. package/schemas/tables/ultracart_dw_medium/uc_affiliate_ledgers.json +404 -0
  270. package/schemas/tables/ultracart_dw_medium/uc_affiliate_network_pixel_postback_logs.json +166 -0
  271. package/schemas/tables/ultracart_dw_medium/uc_affiliate_network_pixels.json +106 -0
  272. package/schemas/tables/ultracart_dw_medium/uc_affiliate_payments.json +204 -0
  273. package/schemas/tables/ultracart_dw_medium/uc_affiliate_postback_logs.json +90 -0
  274. package/schemas/tables/ultracart_dw_medium/uc_affiliates.json +425 -0
  275. package/schemas/tables/ultracart_dw_medium/uc_auto_orders.json +14320 -0
  276. package/schemas/tables/ultracart_dw_medium/uc_cart_abandons.json +4245 -0
  277. package/schemas/tables/ultracart_dw_medium/uc_conversation_pbx_calls.json +415 -0
  278. package/schemas/tables/ultracart_dw_medium/uc_conversations.json +415 -0
  279. package/schemas/tables/ultracart_dw_medium/uc_coupons.json +1893 -0
  280. package/schemas/tables/ultracart_dw_medium/uc_customers.json +12250 -0
  281. package/schemas/tables/ultracart_dw_medium/uc_fraud_rules.json +239 -0
  282. package/schemas/tables/ultracart_dw_medium/uc_gift_certificates.json +135 -0
  283. package/schemas/tables/ultracart_dw_medium/uc_item_inventory_history.json +79 -0
  284. package/schemas/tables/ultracart_dw_medium/uc_items.json +4437 -0
  285. package/schemas/tables/ultracart_dw_medium/uc_orders.json +6865 -0
  286. package/schemas/tables/ultracart_dw_medium/uc_rotating_transaction_gateway_history.json +271 -0
  287. package/schemas/tables/ultracart_dw_medium/uc_rotating_transaction_gateways.json +416 -0
  288. package/schemas/tables/ultracart_dw_medium/uc_shipping_methods.json +1372 -0
  289. package/schemas/tables/ultracart_dw_medium/uc_storefront_customers.json +261 -0
  290. package/schemas/tables/ultracart_dw_medium/uc_storefront_experiments.json +386 -0
  291. package/schemas/tables/ultracart_dw_medium/uc_storefront_pages.json +513 -0
  292. package/schemas/tables/ultracart_dw_medium/uc_storefront_upsell_offer_events.json +338 -0
  293. package/schemas/tables/ultracart_dw_medium/uc_storefront_upsell_offers.json +431 -0
  294. package/schemas/tables/ultracart_dw_medium/uc_storefront_upsell_paths.json +163 -0
  295. package/schemas/tables/ultracart_dw_medium/uc_storefronts.json +62 -0
  296. package/schemas/tables/ultracart_dw_medium/uc_surveys.json +269 -0
  297. package/schemas/tables/ultracart_dw_medium/uc_workflow_tasks.json +377 -0
  298. package/schemas/tables/ultracart_dw_medium/uc_zoho_desk_tickets.json +1330 -0
  299. package/schemas/tables/ultracart_dw_streaming/uc_analytics_session_streaming.json +2444 -0
  300. package/schemas/tables/ultracart_dw_streaming/uc_screen_recording_streaming.json +509 -0
  301. package/schemas/ultracart-bq-config.schema.json +140 -0
  302. package/skill/skill.md +1228 -0
  303. package/templates/render.html +73 -0
@@ -0,0 +1,309 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://ultracart.com/schemas/report-manifest.schema.json",
4
+ "title": "UltraCart BigQuery Report Manifest",
5
+ "description": "A replayable report definition that captures the full report pipeline: question, parameters, SQL, chart config, and run history.",
6
+ "type": "object",
7
+ "required": ["name", "description", "created", "last_run", "prompt", "config", "sql_file", "chart"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "name": {
11
+ "type": "string",
12
+ "description": "Human-readable report name",
13
+ "minLength": 1,
14
+ "maxLength": 100
15
+ },
16
+ "description": {
17
+ "type": "string",
18
+ "description": "Brief description of what the report shows",
19
+ "maxLength": 500
20
+ },
21
+ "created": {
22
+ "type": "string",
23
+ "format": "date",
24
+ "description": "ISO 8601 date when the report was first created"
25
+ },
26
+ "last_run": {
27
+ "type": "string",
28
+ "format": "date",
29
+ "description": "ISO 8601 date when the report was last executed"
30
+ },
31
+ "prompt": {
32
+ "type": "string",
33
+ "description": "The original natural language question that created this report"
34
+ },
35
+ "refinements": {
36
+ "type": "array",
37
+ "description": "Ordered list of refinement instructions applied after initial creation",
38
+ "items": {
39
+ "type": "string"
40
+ }
41
+ },
42
+
43
+ "parameters": {
44
+ "type": "array",
45
+ "description": "Parameter definitions required to run this report",
46
+ "items": {
47
+ "$ref": "#/$defs/parameter"
48
+ }
49
+ },
50
+
51
+ "run_history": {
52
+ "type": "array",
53
+ "description": "Log of past executions with resolved parameter values",
54
+ "items": {
55
+ "$ref": "#/$defs/run_history_entry"
56
+ }
57
+ },
58
+
59
+ "config": {
60
+ "type": "object",
61
+ "description": "BigQuery configuration snapshot from when the report was created",
62
+ "required": ["merchant_id", "project_id", "taxonomy_level", "dataset", "tables_used"],
63
+ "additionalProperties": false,
64
+ "properties": {
65
+ "merchant_id": {
66
+ "type": "string"
67
+ },
68
+ "project_id": {
69
+ "type": "string"
70
+ },
71
+ "taxonomy_level": {
72
+ "type": "string",
73
+ "enum": ["standard", "low", "medium", "high"]
74
+ },
75
+ "dataset": {
76
+ "type": "string"
77
+ },
78
+ "tables_used": {
79
+ "type": "array",
80
+ "items": { "type": "string" },
81
+ "minItems": 1
82
+ }
83
+ }
84
+ },
85
+
86
+ "sql_file": {
87
+ "type": "string",
88
+ "description": "Relative path to the SQL template file with {{parameter}} placeholders",
89
+ "pattern": "\\.sql$"
90
+ },
91
+
92
+ "chart": {
93
+ "type": "object",
94
+ "description": "Visualization configuration",
95
+ "required": ["type", "echarts_file", "output_format", "width", "height"],
96
+ "additionalProperties": false,
97
+ "properties": {
98
+ "type": {
99
+ "type": "string",
100
+ "enum": ["bar", "line", "area", "stacked-bar", "stacked-area", "pie", "donut", "scatter", "heatmap", "treemap", "funnel", "gauge", "radar", "candlestick", "boxplot"],
101
+ "description": "The ECharts visualization type"
102
+ },
103
+ "echarts_file": {
104
+ "type": "string",
105
+ "description": "Relative path to the battle-hardened ECharts JavaScript file",
106
+ "pattern": "\\.js$"
107
+ },
108
+ "output_format": {
109
+ "type": "string",
110
+ "enum": ["png", "pdf", "both"]
111
+ },
112
+ "width": {
113
+ "type": "integer",
114
+ "minimum": 400,
115
+ "maximum": 3840
116
+ },
117
+ "height": {
118
+ "type": "integer",
119
+ "minimum": 300,
120
+ "maximum": 2160
121
+ }
122
+ }
123
+ },
124
+
125
+ "analysis": {
126
+ "type": "object",
127
+ "description": "Executive analysis settings",
128
+ "additionalProperties": false,
129
+ "properties": {
130
+ "include": {
131
+ "type": "boolean",
132
+ "description": "Whether to generate an executive analysis on each run",
133
+ "default": true
134
+ },
135
+ "prompt_file": {
136
+ "type": "string",
137
+ "description": "Relative path to the analysis system prompt template (generated at design time, used at replay time by a separate LLM call to produce fresh analysis)",
138
+ "pattern": "\\.md$",
139
+ "default": "analysis_prompt.md"
140
+ },
141
+ "output_file": {
142
+ "type": "string",
143
+ "description": "Relative path for the analysis markdown file",
144
+ "pattern": "\\.md$",
145
+ "default": "report.md"
146
+ }
147
+ }
148
+ },
149
+
150
+ "delivery": {
151
+ "type": "object",
152
+ "description": "Report delivery configuration for Slack and/or email",
153
+ "properties": {
154
+ "slack": {
155
+ "type": "object",
156
+ "properties": {
157
+ "channels": {
158
+ "type": "array",
159
+ "items": {
160
+ "type": "string"
161
+ },
162
+ "minItems": 1,
163
+ "description": "Slack channel IDs (e.g., C0123456789)"
164
+ }
165
+ },
166
+ "required": ["channels"],
167
+ "additionalProperties": false
168
+ },
169
+ "email": {
170
+ "type": "object",
171
+ "properties": {
172
+ "to": {
173
+ "type": "array",
174
+ "items": { "type": "string", "format": "email" },
175
+ "minItems": 1,
176
+ "description": "Recipient email addresses"
177
+ },
178
+ "subject": {
179
+ "type": "string",
180
+ "description": "Email subject line"
181
+ },
182
+ "provider": {
183
+ "type": "string",
184
+ "enum": ["sendgrid", "ses", "postmark", "mailgun", "resend"],
185
+ "description": "Email delivery provider"
186
+ }
187
+ },
188
+ "required": ["to", "subject", "provider"],
189
+ "additionalProperties": false
190
+ }
191
+ },
192
+ "additionalProperties": false
193
+ }
194
+ },
195
+
196
+ "$defs": {
197
+ "parameter": {
198
+ "type": "object",
199
+ "description": "A single report parameter definition",
200
+ "required": ["name", "type", "label", "description", "required"],
201
+ "additionalProperties": false,
202
+ "properties": {
203
+ "name": {
204
+ "type": "string",
205
+ "description": "Parameter identifier used in SQL placeholders (e.g., {{name}})",
206
+ "pattern": "^[a-z][a-z0-9_]*$"
207
+ },
208
+ "type": {
209
+ "type": "string",
210
+ "enum": ["date", "string", "number", "boolean", "enum"],
211
+ "description": "The parameter data type. Determines validation rules and prompt behavior."
212
+ },
213
+ "label": {
214
+ "type": "string",
215
+ "description": "Human-readable label shown when prompting the user",
216
+ "maxLength": 50
217
+ },
218
+ "description": {
219
+ "type": "string",
220
+ "description": "Help text explaining what this parameter controls",
221
+ "maxLength": 200
222
+ },
223
+ "required": {
224
+ "type": "boolean",
225
+ "description": "If true, the parameter must be resolved before the report can run"
226
+ },
227
+ "default": {
228
+ "description": "Default value. For date types, supports relative expressions: 'today', '-Nd' (N days ago), '-Nw' (N weeks ago), '-Nm' (N months ago), 'start_of_month', 'start_of_quarter', 'start_of_year'",
229
+ "oneOf": [
230
+ { "type": "string" },
231
+ { "type": "number" },
232
+ { "type": "boolean" }
233
+ ]
234
+ },
235
+ "options": {
236
+ "type": "array",
237
+ "description": "Valid values for enum-type parameters. Ignored for other types.",
238
+ "items": { "type": "string" },
239
+ "minItems": 2
240
+ },
241
+ "validation": {
242
+ "type": "object",
243
+ "description": "Optional validation constraints beyond type checking",
244
+ "properties": {
245
+ "min": {
246
+ "type": "number",
247
+ "description": "Minimum value for number-type parameters"
248
+ },
249
+ "max": {
250
+ "type": "number",
251
+ "description": "Maximum value for number-type parameters"
252
+ },
253
+ "pattern": {
254
+ "type": "string",
255
+ "description": "Regex pattern for string-type parameters"
256
+ },
257
+ "min_date": {
258
+ "type": "string",
259
+ "description": "Earliest allowed date (ISO 8601 or relative expression)"
260
+ },
261
+ "max_date": {
262
+ "type": "string",
263
+ "description": "Latest allowed date (ISO 8601 or relative expression)"
264
+ }
265
+ },
266
+ "additionalProperties": false
267
+ }
268
+ }
269
+ },
270
+
271
+ "run_history_entry": {
272
+ "type": "object",
273
+ "description": "A record of a single report execution",
274
+ "required": ["run_date", "parameters"],
275
+ "additionalProperties": false,
276
+ "properties": {
277
+ "run_date": {
278
+ "type": "string",
279
+ "format": "date",
280
+ "description": "The date this run was executed"
281
+ },
282
+ "parameters": {
283
+ "type": "object",
284
+ "description": "The resolved parameter values used for this run. Keys are parameter names, values are the resolved (not relative) values.",
285
+ "additionalProperties": true
286
+ },
287
+ "status": {
288
+ "type": "string",
289
+ "enum": ["success", "error"],
290
+ "description": "Whether the run completed successfully"
291
+ },
292
+ "error_message": {
293
+ "type": "string",
294
+ "description": "Error details if status is 'error'"
295
+ },
296
+ "rows_returned": {
297
+ "type": "integer",
298
+ "description": "Number of rows returned by the query",
299
+ "minimum": 0
300
+ },
301
+ "bytes_processed": {
302
+ "type": "integer",
303
+ "description": "Bytes processed by BigQuery (for cost tracking)",
304
+ "minimum": 0
305
+ }
306
+ }
307
+ }
308
+ }
309
+ }
@@ -0,0 +1,45 @@
1
+ # Enhanced Table Schemas
2
+
3
+ This directory contains enhanced BigQuery table schemas with human-readable descriptions and `allowed_values` arrays generated from UltraCart's REST objects.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ tables/
9
+ ├── ultracart_dw/ # Standard taxonomy dataset (no PII columns)
10
+ ├── ultracart_dw_low/ # Low taxonomy dataset
11
+ ├── ultracart_dw_medium/ # Medium taxonomy dataset (includes PII columns)
12
+ ├── ultracart_dw_high/ # High taxonomy dataset (full access)
13
+ └── ultracart_dw_streaming/ # Streaming dataset (analytics, screen recordings)
14
+ ```
15
+
16
+ Each subdirectory corresponds to a BigQuery dataset and taxonomy level. The schema files are organized by dataset so taxonomy-level restrictions are respected — a standard-taxonomy user never sees PII columns.
17
+
18
+ ## File Format
19
+
20
+ Each file is a JSON array matching the BigQuery schema structure with additional fields:
21
+
22
+ ```json
23
+ [
24
+ {
25
+ "name": "column_name",
26
+ "type": "STRING",
27
+ "mode": "NULLABLE",
28
+ "description": "Human-readable description of what this column contains",
29
+ "allowed_values": ["value1", "value2", "value3"],
30
+ "mandatory": true
31
+ }
32
+ ]
33
+ ```
34
+
35
+ - `description` — Helps the LLM understand the column's business meaning
36
+ - `allowed_values` — Constrains the LLM to valid values when writing SQL filters
37
+ - `mandatory` — If true, this column is always included in schema filtering
38
+
39
+ ## Resolution Priority
40
+
41
+ When the CLI needs a table schema:
42
+ 1. Check for an enhanced schema file here (`tables/{dataset}/{table}.json`)
43
+ 2. Fall back to live BigQuery metadata if no enhanced schema exists
44
+
45
+ Use `uc-bq schema --tables=TABLE --live` to bypass enhanced schemas and fetch directly from BigQuery.
@@ -0,0 +1,186 @@
1
+ [
2
+ {
3
+ "mode": "NULLABLE",
4
+ "name": "partition_date",
5
+ "type": "DATE"
6
+ },
7
+ {
8
+ "mode": "NULLABLE",
9
+ "name": "affiliate_click_oid",
10
+ "description": "Unique object identifier for this click",
11
+ "type": "INTEGER"
12
+ },
13
+ {
14
+ "mode": "NULLABLE",
15
+ "name": "affiliate_oid",
16
+ "description": "Affiliate object ID associated with this click",
17
+ "type": "INTEGER"
18
+ },
19
+ {
20
+ "mode": "NULLABLE",
21
+ "name": "click_dts",
22
+ "description": "Date/time that the click was made",
23
+ "type": "DATETIME"
24
+ },
25
+ {
26
+ "mode": "NULLABLE",
27
+ "name": "ip_address",
28
+ "description": "IP address that generated the click",
29
+ "type": "STRING"
30
+ },
31
+ {
32
+ "mode": "NULLABLE",
33
+ "name": "referrer",
34
+ "description": "URL that referred the click (Browser Header Referer)",
35
+ "type": "STRING"
36
+ },
37
+ {
38
+ "mode": "NULLABLE",
39
+ "name": "sub_id",
40
+ "description": "Sub ID value passed on the click",
41
+ "type": "STRING"
42
+ },
43
+ {
44
+ "mode": "NULLABLE",
45
+ "name": "affiliate_link_oid",
46
+ "description": "Unique object identifier for for the link that this click is associated with",
47
+ "type": "INTEGER"
48
+ },
49
+ {
50
+ "name": "link",
51
+ "description": "Link object associated with this click",
52
+ "type": "RECORD",
53
+ "fields": [
54
+ {
55
+ "mode": "NULLABLE",
56
+ "name": "affiliate_link_oid",
57
+ "description": "Unique object identifier associated with this link",
58
+ "type": "INTEGER"
59
+ },
60
+ {
61
+ "mode": "NULLABLE",
62
+ "name": "affiliate_oid",
63
+ "description": "Affiliate object ID associated with this link",
64
+ "type": "INTEGER"
65
+ },
66
+ {
67
+ "mode": "NULLABLE",
68
+ "name": "creative_oid",
69
+ "description": "Creative (image or text) associated with this link",
70
+ "type": "INTEGER"
71
+ },
72
+ {
73
+ "mode": "NULLABLE",
74
+ "name": "custom_html",
75
+ "description": "Custom HTML associated with this link",
76
+ "type": "STRING"
77
+ },
78
+ {
79
+ "allowed_values": [
80
+ "Pending",
81
+ "Approved",
82
+ "Rejected"
83
+ ],
84
+ "mode": "NULLABLE",
85
+ "name": "custom_html_approval_status",
86
+ "description": "Approved status of the custom html",
87
+ "type": "STRING"
88
+ },
89
+ {
90
+ "mode": "NULLABLE",
91
+ "name": "invisible_link_url_prefix",
92
+ "description": "Invisible link URL prefix",
93
+ "type": "STRING"
94
+ },
95
+ {
96
+ "allowed_values": [
97
+ "Pending",
98
+ "Approved",
99
+ "Rejected"
100
+ ],
101
+ "mode": "NULLABLE",
102
+ "name": "invisible_link_approval_status",
103
+ "description": "Invisible link approval status",
104
+ "type": "STRING"
105
+ },
106
+ {
107
+ "mode": "NULLABLE",
108
+ "name": "deleted",
109
+ "description": "True if the link has been deleted",
110
+ "type": "BOOLEAN"
111
+ },
112
+ {
113
+ "mode": "NULLABLE",
114
+ "name": "name",
115
+ "description": "Name of the link",
116
+ "type": "STRING"
117
+ },
118
+ {
119
+ "allowed_values": [
120
+ "image",
121
+ "text",
122
+ "invisible",
123
+ "direct"
124
+ ],
125
+ "mode": "NULLABLE",
126
+ "name": "type",
127
+ "description": "Type of link",
128
+ "type": "STRING"
129
+ },
130
+ {
131
+ "mode": "NULLABLE",
132
+ "name": "custom_landing_url",
133
+ "description": "Custom landing page URL if configured",
134
+ "type": "STRING"
135
+ },
136
+ {
137
+ "mode": "NULLABLE",
138
+ "name": "code",
139
+ "description": "Code associated with the link",
140
+ "type": "STRING"
141
+ },
142
+ {
143
+ "mode": "NULLABLE",
144
+ "name": "affiliate_program_item_oid",
145
+ "description": "The affiliate program item this managed link is associated with",
146
+ "type": "INTEGER"
147
+ },
148
+ {
149
+ "mode": "NULLABLE",
150
+ "name": "affiliate_managed_link_oid",
151
+ "description": "Managed link OID that this link object was generated from",
152
+ "type": "INTEGER"
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ "mode": "NULLABLE",
158
+ "name": "referrer_query_string",
159
+ "description": "Query string that was on the referrer URL.",
160
+ "type": "STRING"
161
+ },
162
+ {
163
+ "mode": "NULLABLE",
164
+ "name": "landing_page",
165
+ "description": "URL of the landing page the customer was sent to.",
166
+ "type": "STRING"
167
+ },
168
+ {
169
+ "mode": "NULLABLE",
170
+ "name": "landing_page_query_string",
171
+ "description": "Query string on the landing page URL the customer was sent to.",
172
+ "type": "STRING"
173
+ },
174
+ {
175
+ "mode": "NULLABLE",
176
+ "name": "ucacid",
177
+ "description": "UC Analytics Identifier",
178
+ "type": "STRING"
179
+ },
180
+ {
181
+ "mode": "NULLABLE",
182
+ "name": "screen_recording_uuid",
183
+ "description": "Screen recording UUID",
184
+ "type": "STRING"
185
+ }
186
+ ]