@metabase/client 0.1.0 → 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 (220) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +10 -6
  3. package/dist/api-key-DJeN1-7G.d.ts +46 -0
  4. package/dist/auth/credential.d.ts +1 -1
  5. package/dist/auth/oauth-login.d.ts +1 -1
  6. package/dist/auth/oauth-login.js +1 -1
  7. package/dist/auth/oauth-session.d.ts +1 -1
  8. package/dist/{card-BZx4NSr-.d.ts → card-CbV6hLYH.d.ts} +4 -4
  9. package/dist/{card-B6merEUN.d.ts → card-CrSywvOt.d.ts} +18 -18
  10. package/dist/{client-DNRvXFRm.d.ts → client-cBi6_RQs.d.ts} +289 -185
  11. package/dist/client.d.ts +1 -1
  12. package/dist/client.js +4 -0
  13. package/dist/{collection-Bib61WiV.d.ts → collection-Bmtisr3r.d.ts} +47 -47
  14. package/dist/{collection-CqtGPi4W.d.ts → collection-Q9FNMiRh.d.ts} +18 -4
  15. package/dist/{credential-6aOEGqMH.d.ts → credential-B6fKSvqp.d.ts} +1 -1
  16. package/dist/{dashboard-XTe46250.d.ts → dashboard-CknUcTp8.d.ts} +3 -3
  17. package/dist/{dashboard-z9i1VUZC.d.ts → dashboard-DBdEehA9.d.ts} +33 -25
  18. package/dist/{data-action-rS27f2Ji.d.ts → data-action-CqqZ0JYg.d.ts} +6 -4
  19. package/dist/data-app-MoMS9VUr.d.ts +76 -0
  20. package/dist/{database-DqTespfa.d.ts → database-Bs5WQOOZ.d.ts} +3 -3
  21. package/dist/{database-BLUMlywE.d.ts → database-CYNLJ8AZ.d.ts} +18 -18
  22. package/dist/{dataset-C6lX1-cr.d.ts → dataset-cg8ZZrOP.d.ts} +85 -85
  23. package/dist/{dataset-Cj3XuKLe.d.ts → dataset-dzWljE_C.d.ts} +3 -3
  24. package/dist/{dependency-fN5_7a22.d.ts → dependency-CL-YG9KH.d.ts} +26 -26
  25. package/dist/{dependency-D8Qs5Xdx.d.ts → dependency-VqvLTDAU.d.ts} +248 -196
  26. package/dist/{document-oZNDbDfx.d.ts → document-tLd6pYWe.d.ts} +2 -2
  27. package/dist/domain/api-key.d.ts +2 -0
  28. package/dist/domain/api-key.js +31 -0
  29. package/dist/domain/card.d.ts +1 -1
  30. package/dist/domain/collection.d.ts +1 -1
  31. package/dist/domain/dashboard.d.ts +2 -2
  32. package/dist/domain/dashboard.js +21 -4
  33. package/dist/domain/data-action.d.ts +2 -2
  34. package/dist/domain/data-action.js +8 -2
  35. package/dist/domain/data-app.d.ts +2 -0
  36. package/dist/domain/data-app.js +52 -0
  37. package/dist/domain/database.d.ts +1 -1
  38. package/dist/domain/dataset.d.ts +1 -1
  39. package/dist/domain/dependency.d.ts +1 -1
  40. package/dist/domain/dependency.js +6 -3
  41. package/dist/domain/document.d.ts +1 -1
  42. package/dist/domain/eid-translation.d.ts +1 -1
  43. package/dist/domain/field.d.ts +2 -2
  44. package/dist/domain/field.js +8 -2
  45. package/dist/domain/git-sync.d.ts +1 -1
  46. package/dist/domain/library.d.ts +2 -2
  47. package/dist/domain/library.js +8 -2
  48. package/dist/domain/measure.d.ts +1 -1
  49. package/dist/domain/measure.js +3 -1
  50. package/dist/domain/metric.d.ts +1 -1
  51. package/dist/domain/moderation-review.d.ts +1 -1
  52. package/dist/domain/notification.d.ts +2 -2
  53. package/dist/domain/notification.js +6 -1
  54. package/dist/domain/parameter.d.ts +1 -1
  55. package/dist/domain/pulse.d.ts +2 -2
  56. package/dist/domain/pulse.js +10 -3
  57. package/dist/domain/replacement.d.ts +1 -1
  58. package/dist/domain/revision.d.ts +2 -2
  59. package/dist/domain/revision.js +29 -2
  60. package/dist/domain/search.d.ts +1 -1
  61. package/dist/domain/segment.d.ts +1 -1
  62. package/dist/domain/segment.js +3 -1
  63. package/dist/domain/setup.d.ts +1 -1
  64. package/dist/domain/setup.js +1 -1
  65. package/dist/domain/snippet.d.ts +1 -1
  66. package/dist/domain/table.d.ts +2 -2
  67. package/dist/domain/table.js +35 -4
  68. package/dist/domain/timeline.d.ts +1 -1
  69. package/dist/domain/transform-dag-run.d.ts +1 -1
  70. package/dist/domain/transform-inspector.d.ts +1 -1
  71. package/dist/domain/transform-job.d.ts +2 -2
  72. package/dist/domain/transform-job.js +8 -2
  73. package/dist/domain/transform-python.d.ts +2 -2
  74. package/dist/domain/transform-python.js +15 -3
  75. package/dist/domain/transform-tag.d.ts +1 -1
  76. package/dist/domain/transform-test.d.ts +1 -1
  77. package/dist/domain/transform.d.ts +2 -2
  78. package/dist/domain/transform.js +76 -7
  79. package/dist/domain/user.d.ts +1 -1
  80. package/dist/domain/user.js +1 -1
  81. package/dist/{eid-translation-nuhr8St2.d.ts → eid-translation-aQSffx0o.d.ts} +40 -40
  82. package/dist/{erd-BujD227Y.d.ts → erd-DCgdEC2S.d.ts} +1 -1
  83. package/dist/errors.d.ts +1 -1
  84. package/dist/{features-CnFkUCj2.d.ts → features-SMSfJhB6.d.ts} +36 -2
  85. package/dist/{field-Bqn10Fq_.d.ts → field-ozrfbvUd.d.ts} +2 -2
  86. package/dist/{field-BCRO19mk.d.ts → field-tqQPtVuR.d.ts} +9 -7
  87. package/dist/{git-sync-gAMKsZgN.d.ts → git-sync-5lFWX1ds.d.ts} +3 -3
  88. package/dist/{git-sync-DNXrNVCW.d.ts → git-sync-QL9Nu6gP.d.ts} +10 -10
  89. package/dist/{glossary-CqFlzW33.d.ts → glossary-DwS7QVrl.d.ts} +1 -1
  90. package/dist/http/errors.d.ts +1 -1
  91. package/dist/http/oauth.d.ts +1 -1
  92. package/dist/http/oauth.js +47 -36
  93. package/dist/http/transport.d.ts +1 -1
  94. package/dist/index.d.ts +48 -46
  95. package/dist/index.js +8 -6
  96. package/dist/input-gate-registry-Dai7SfXb.js +14 -0
  97. package/dist/input-gates-DwKoTJVQ.d.ts +28 -0
  98. package/dist/{json-CZvjc3--.d.ts → json-DwGOvRtS.d.ts} +1 -1
  99. package/dist/json-pointer.d.ts +2 -1
  100. package/dist/json-pointer.js +4 -1
  101. package/dist/json.d.ts +1 -1
  102. package/dist/{library-Cx9h_RkU.d.ts → library-B9pEq7qP.d.ts} +8 -6
  103. package/dist/{measure-CuMqPbQX.d.ts → measure-CInoXeyH.d.ts} +1 -1
  104. package/dist/{measure-KuXdjZYJ.d.ts → measure-CgH14YQZ.d.ts} +1 -1
  105. package/dist/{metric-yvehaVCS.d.ts → metric-CYOmbcM5.d.ts} +10 -10
  106. package/dist/{moderation-review-B4RUTZ6_.d.ts → moderation-review-CWUQ3_HL.d.ts} +4 -4
  107. package/dist/{notification-BT2TDAd_.d.ts → notification-BY2JEjKp.d.ts} +68 -4
  108. package/dist/{notification-BiegPoSD.d.ts → notification-D-Hp82Pn.d.ts} +3 -3
  109. package/dist/{oauth-C4ordeoJ.d.ts → oauth-CVoZpuq8.d.ts} +4 -2
  110. package/dist/{oauth-login-D734Jvbq.js → oauth-login--tDagiZu.js} +29 -11
  111. package/dist/{oauth-login-CJsT_3EE.d.ts → oauth-login-SZ4Csai8.d.ts} +3 -2
  112. package/dist/{oauth-session-BlIlcd8Q.d.ts → oauth-session-COLH4puN.d.ts} +1 -1
  113. package/dist/{paginate-DZWvWvbm.d.ts → paginate-CaJ5usdp.d.ts} +1 -1
  114. package/dist/paginate.d.ts +1 -1
  115. package/dist/{parameter-ak-J-IOj.d.ts → parameter-BYo7uR-J.d.ts} +2 -2
  116. package/dist/{pulse-dylocLd9.d.ts → pulse-BTpSNxhT.d.ts} +2 -2
  117. package/dist/{pulse-CMc1Rwdj.d.ts → pulse-BUlfrJZH.d.ts} +23 -21
  118. package/dist/{replacement-CyvtbxGg.d.ts → replacement-BQian4vA.d.ts} +23 -23
  119. package/dist/{replacement-S9U3gApY.d.ts → replacement-Dbtvvrmz.d.ts} +11 -11
  120. package/dist/{requirement-check-CIA5IHC1.d.ts → requirement-check-CHHEHXcj.d.ts} +2 -2
  121. package/dist/{requirements-C0txASN8.d.ts → requirements-Dx_ZVzl7.d.ts} +11 -1
  122. package/dist/resources/api-key.d.ts +11 -0
  123. package/dist/resources/api-key.js +35 -0
  124. package/dist/resources/card.d.ts +1 -1
  125. package/dist/resources/collection.d.ts +1 -1
  126. package/dist/resources/collection.js +35 -6
  127. package/dist/resources/content-translation.d.ts +1 -1
  128. package/dist/resources/content-translation.js +1 -1
  129. package/dist/resources/dashboard.d.ts +1 -1
  130. package/dist/resources/dashboard.js +8 -5
  131. package/dist/resources/data-action.d.ts +3 -48
  132. package/dist/resources/data-action.js +9 -9
  133. package/dist/resources/data-app.d.ts +112 -0
  134. package/dist/resources/data-app.js +75 -0
  135. package/dist/resources/database.d.ts +1 -1
  136. package/dist/resources/dataset.d.ts +1 -1
  137. package/dist/resources/dependency.d.ts +1 -1
  138. package/dist/resources/dependency.js +13 -7
  139. package/dist/resources/document.d.ts +3 -10
  140. package/dist/resources/eid-translation.d.ts +2 -2
  141. package/dist/resources/erd.d.ts +1 -1
  142. package/dist/resources/field.d.ts +1 -1
  143. package/dist/resources/field.js +3 -2
  144. package/dist/resources/git-sync.d.ts +1 -1
  145. package/dist/resources/git-sync.js +1 -1
  146. package/dist/resources/glossary.d.ts +1 -1
  147. package/dist/resources/library.d.ts +4 -4
  148. package/dist/resources/library.js +2 -2
  149. package/dist/resources/measure.d.ts +1 -1
  150. package/dist/resources/metric.d.ts +1 -1
  151. package/dist/resources/moderation-review.d.ts +1 -1
  152. package/dist/resources/notification.d.ts +1 -1
  153. package/dist/resources/notification.js +2 -2
  154. package/dist/resources/optional-parsed.d.ts +1 -1
  155. package/dist/resources/permission.d.ts +1 -1
  156. package/dist/resources/pivot-export.d.ts +1 -1
  157. package/dist/resources/pulse.d.ts +1 -1
  158. package/dist/resources/pulse.js +3 -2
  159. package/dist/resources/replacement.d.ts +1 -1
  160. package/dist/resources/revision.d.ts +3 -3
  161. package/dist/resources/revision.js +5 -10
  162. package/dist/resources/search.d.ts +1 -1
  163. package/dist/resources/search.js +23 -2
  164. package/dist/resources/segment.d.ts +1 -1
  165. package/dist/resources/setting.d.ts +1 -1
  166. package/dist/resources/setup.d.ts +2 -2
  167. package/dist/resources/snippet.d.ts +1 -1
  168. package/dist/resources/table.d.ts +1 -1
  169. package/dist/resources/table.js +9 -10
  170. package/dist/resources/timeline-event.d.ts +2 -2
  171. package/dist/resources/timeline.d.ts +1 -1
  172. package/dist/resources/transform-dag-run.d.ts +2 -2
  173. package/dist/resources/transform-inspector.d.ts +4 -4
  174. package/dist/resources/transform-job.d.ts +1 -1
  175. package/dist/resources/transform-python.d.ts +11 -4
  176. package/dist/resources/transform-python.js +3 -2
  177. package/dist/resources/transform-tag.d.ts +1 -1
  178. package/dist/resources/transform-test.d.ts +1 -1
  179. package/dist/resources/transform.d.ts +1 -1
  180. package/dist/resources/transform.js +13 -3
  181. package/dist/resources/upload.d.ts +1 -1
  182. package/dist/resources/user.d.ts +2 -2
  183. package/dist/{revision-CQBPhohA.d.ts → revision-DNEw6S93.d.ts} +7 -5
  184. package/dist/{search-BxJipLN6.d.ts → search-BQWkdVg1.d.ts} +2 -2
  185. package/dist/{search-NZR6iRBs.d.ts → search-tK5lmRb8.d.ts} +23 -23
  186. package/dist/{segment-pj3wklGe.d.ts → segment-CbAgVO-5.d.ts} +1 -1
  187. package/dist/{segment-D2i34X9l.d.ts → segment-jyhBtOAZ.d.ts} +2 -2
  188. package/dist/{setup-Ez_U7GmM.d.ts → setup-JqcJ2unJ.d.ts} +1 -1
  189. package/dist/signal.d.ts +3 -2
  190. package/dist/signal.js +9 -4
  191. package/dist/{snippet-hEV429Pv.d.ts → snippet-C_Ilx7tR.d.ts} +2 -2
  192. package/dist/{snippet-RnnWa4TL.d.ts → snippet-DsgohpTV.d.ts} +2 -2
  193. package/dist/{table-B_lfuaHc.d.ts → table-B1pQSpTA.d.ts} +14 -14
  194. package/dist/{table-B3-UaPHa.d.ts → table-BAl8aPZZ.d.ts} +49 -44
  195. package/dist/{timeline-C2IEcRlP.d.ts → timeline-BdLvwRnl.d.ts} +2 -2
  196. package/dist/{timeline-folD3mQ_.d.ts → timeline-BfX1lMob.d.ts} +24 -24
  197. package/dist/{transform-CXOT5kFe.d.ts → transform-Ds74yPiY.d.ts} +48 -34
  198. package/dist/{transform-CDurgE1D.d.ts → transform-DwnIcpqV.d.ts} +153 -37
  199. package/dist/{transform-dag-run-BgZwv1yx.d.ts → transform-dag-run-BSrdrjaK.d.ts} +4 -4
  200. package/dist/{transform-inspector-BUYBt6--.d.ts → transform-inspector-BMaRqcRM.d.ts} +8 -8
  201. package/dist/{transform-job-29P6BULe.d.ts → transform-job-C85GxBHj.d.ts} +9 -9
  202. package/dist/{transform-job-CTJImaOd.d.ts → transform-job-Dfp9Ox0l.d.ts} +7 -5
  203. package/dist/{transform-python-DdDnW6yK.d.ts → transform-python-DtL3xxMj.d.ts} +49 -4
  204. package/dist/{transform-tag-DVUIZTEM.d.ts → transform-tag-C6j5EUkX.d.ts} +1 -1
  205. package/dist/{transform-test-A-CJYT6B.d.ts → transform-test-C3hiZ4AV.d.ts} +2 -2
  206. package/dist/{transform-test-BwuyrHpT.d.ts → transform-test-DROPvrkI.d.ts} +2 -2
  207. package/dist/{transport-E0ZaPNWJ.d.ts → transport-CS11mEqI.d.ts} +20 -6
  208. package/dist/{upload-B7PG3ePk.d.ts → upload-Bx1D7eNy.d.ts} +1 -1
  209. package/dist/{user-2r0OBoO6.d.ts → user-Sqqv7rqh.d.ts} +2 -2
  210. package/dist/version/capability-error.d.ts +1 -1
  211. package/dist/version/features.d.ts +2 -2
  212. package/dist/version/features.js +30 -2
  213. package/dist/version/input-gates.d.ts +2 -0
  214. package/dist/version/input-gates.js +13 -0
  215. package/dist/version/probe.d.ts +1 -1
  216. package/dist/version/profile.d.ts +1 -1
  217. package/dist/version/requirement-check.d.ts +1 -1
  218. package/dist/version/requirements.d.ts +1 -1
  219. package/dist/version/requirements.js +10 -0
  220. package/package.json +3 -2
@@ -12,6 +12,25 @@ function verifiedFeatures(params = {}) {
12
12
  fields: ["verified"]
13
13
  }] : [];
14
14
  }
15
+ const MODELS_FIELDS = ["models"];
16
+ const SEARCH_MODEL_FEATURES = {
17
+ measure: "measures",
18
+ transform: "transforms",
19
+ exploration: "explorations"
20
+ };
21
+ function modelFeatures(params) {
22
+ if (params.models === void 0) return [];
23
+ return params.models.flatMap((model) => {
24
+ const feature = SEARCH_MODEL_FEATURES[model];
25
+ return feature === void 0 ? [] : [{
26
+ feature,
27
+ fields: MODELS_FIELDS
28
+ }];
29
+ });
30
+ }
31
+ function queryFeatures(params = {}) {
32
+ return [...verifiedFeatures(params), ...modelFeatures(params)];
33
+ }
15
34
  function searchResource(transport) {
16
35
  const { explain } = explainer(transport, "search");
17
36
  /**
@@ -25,7 +44,9 @@ function searchResource(transport) {
25
44
  * default), and `limit`/`offset` are the window the server applies before ranking hydration.
26
45
  * `verified` needs the `content_verification` premium feature, and is refused before the wire
27
46
  * without it: a server granting neither it nor `official_collections` refuses the filter, and one
28
- * granting `official_collections` alone takes it without applying it.
47
+ * granting `official_collections` alone takes it without applying it. `models` takes `measure`
48
+ * only with `measures`, `transform` with `transforms` or on a Metabase 58 enterprise build, and
49
+ * `exploration` only with `explorations`.
29
50
  */
30
51
  async function query(params = {}, options = {}) {
31
52
  await transport.requireFeatures(verifiedFeatures(params).map((requirement) => requirement.feature), options);
@@ -51,7 +72,7 @@ function searchResource(transport) {
51
72
  total: response.total
52
73
  };
53
74
  }
54
- return { query: explain("query", query, verifiedFeatures) };
75
+ return { query: explain("query", query, queryFeatures) };
55
76
  }
56
77
  //#endregion
57
78
  export { searchResource };
@@ -1,2 +1,2 @@
1
- import { n as segmentResource, t as SegmentArchiveParams } from "../segment-D2i34X9l.js";
1
+ import { n as segmentResource, t as SegmentArchiveParams } from "../segment-jyhBtOAZ.js";
2
2
  export { SegmentArchiveParams, segmentResource };
@@ -1,4 +1,4 @@
1
- import { f as RequestOptions, h as Transport } from "../transport-E0ZaPNWJ.js";
1
+ import { f as RequestOptions, h as Transport } from "../transport-CS11mEqI.js";
2
2
  import { t as ListResult } from "../list-BT_bBm9Z.js";
3
3
  import { t as Setting } from "../setting-DXuQGXGF.js";
4
4
  //#region src/resources/setting.d.ts
@@ -1,5 +1,5 @@
1
- import { f as RequestOptions, h as Transport } from "../transport-E0ZaPNWJ.js";
2
- import { n as SetupResult, t as SetupInput } from "../setup-Ez_U7GmM.js";
1
+ import { f as RequestOptions, h as Transport } from "../transport-CS11mEqI.js";
2
+ import { n as SetupResult, t as SetupInput } from "../setup-JqcJ2unJ.js";
3
3
  //#region src/resources/setup.d.ts
4
4
  declare function setupResource(transport: Transport): {
5
5
  create: (params: SetupInput, options?: RequestOptions) => Promise<SetupResult>;
@@ -1,2 +1,2 @@
1
- import { n as snippetResource, t as SnippetListParams } from "../snippet-RnnWa4TL.js";
1
+ import { n as snippetResource, t as SnippetListParams } from "../snippet-DsgohpTV.js";
2
2
  export { SnippetListParams, snippetResource };
@@ -1,2 +1,2 @@
1
- import { n as tableResource, t as TableListParams } from "../table-B_lfuaHc.js";
1
+ import { n as tableResource, t as TableListParams } from "../table-B1pQSpTA.js";
2
2
  export { TableListParams, tableResource };
@@ -1,11 +1,12 @@
1
1
  import { PartialWriteError } from "../errors.js";
2
2
  import { CapabilityError } from "../version/capability-error.js";
3
3
  import { supersedingFeature } from "../version/requirement-check.js";
4
- import { Table, TableDataLayerTier, TableForeignKey, TableQueryMetadata, TableSelectors } from "../domain/table.js";
4
+ import { DATA_AUTHORITY_WITHDRAWAL_GATE, DATA_LAYER_MEDALLION_GATE, DATA_LAYER_TIER_GATE, Table, TableDataLayerTier, TableForeignKey, TableQueryMetadata, TableSelectors } from "../domain/table.js";
5
5
  import { t as explainer } from "../refusal-B9aeHMc9.js";
6
6
  import { buildCsvFormData } from "./csv-upload.js";
7
- import { fetchOptionalParsed } from "./optional-parsed.js";
8
7
  import { parseRequestBody } from "./request-body.js";
8
+ import { gateTriggered } from "../version/input-gates.js";
9
+ import { fetchOptionalParsed } from "./optional-parsed.js";
9
10
  import { z } from "zod";
10
11
  //#region src/resources/table.ts
11
12
  const TableApiList = z.array(Table);
@@ -28,14 +29,11 @@ function listParamFeatures(params) {
28
29
  return LIST_PARAM_FEATURES.filter(([param]) => params[param] === true).map(([, feature]) => feature);
29
30
  }
30
31
  function dataLayerFeatures(value, field) {
31
- return isTierName(value) ? [{
32
- feature: "tableDataLayerTiers",
32
+ return gateTriggered(DATA_LAYER_TIER_GATE, value) ? [{
33
+ feature: DATA_LAYER_TIER_GATE.feature,
33
34
  fields: [field]
34
35
  }] : [];
35
36
  }
36
- function isTierName(value) {
37
- return value !== null && value !== void 0 && TableDataLayerTier.safeParse(value).success;
38
- }
39
37
  const UPLOAD_UPDATE_PATHS = {
40
38
  append: "append-csv",
41
39
  replace: "replace-csv"
@@ -89,10 +87,11 @@ function tableResource(transport) {
89
87
  return updated;
90
88
  }
91
89
  async function refuseRewrittenDataLayer(value, options) {
92
- if (value === null || value === void 0 || isTierName(value)) return;
90
+ if (!gateTriggered(DATA_LAYER_MEDALLION_GATE, value)) return;
93
91
  const profile = await transport.preflightServer(options);
94
92
  if (profile === null) return;
95
- const failure = supersedingFeature("tableDataLayerTiers", profile, `data_layer "${value}" is a medallion name; this server names a table's layer ${TableDataLayerTier.options.join(", ")} and would map it onto one of those without a word`);
93
+ const detail = `data_layer "${value}" is a medallion name; this server names a table's layer ${TableDataLayerTier.options.join(", ")} and would map it onto one of those without a word`;
94
+ const failure = supersedingFeature(DATA_LAYER_MEDALLION_GATE.feature, profile, detail);
96
95
  if (failure !== null) transport.refuseBeforeSending(new CapabilityError(failure));
97
96
  }
98
97
  /** Get a table by id with its fields hydrated — the metadata the query builder runs on. */
@@ -168,7 +167,7 @@ function tableResource(transport) {
168
167
  };
169
168
  }
170
169
  async function requireDataAuthorityNull(value, options) {
171
- if (value === null) await transport.requireFeatures(["tableUserValueWithdrawal"], options);
170
+ if (gateTriggered(DATA_AUTHORITY_WITHDRAWAL_GATE, value)) await transport.requireFeatures([DATA_AUTHORITY_WITHDRAWAL_GATE.feature], options);
172
171
  }
173
172
  async function postSelection(path, selectors, options) {
174
173
  const body = parseRequestBody(TableSelectors, selectors, "table selectors");
@@ -1,5 +1,5 @@
1
- import { f as RequestOptions, h as Transport } from "../transport-E0ZaPNWJ.js";
2
- import { i as TimelineEvent, o as TimelineEventCreateInput, s as TimelineEventUpdateInput } from "../timeline-folD3mQ_.js";
1
+ import { f as RequestOptions, h as Transport } from "../transport-CS11mEqI.js";
2
+ import { i as TimelineEvent, o as TimelineEventCreateInput, s as TimelineEventUpdateInput } from "../timeline-BfX1lMob.js";
3
3
  //#region src/resources/timeline-event.d.ts
4
4
  declare function timelineEventResource(transport: Transport): {
5
5
  get: (id: number, options?: RequestOptions) => Promise<TimelineEvent>;
@@ -1,2 +1,2 @@
1
- import { n as TimelineListParams, r as timelineResource, t as TimelineEventsParams } from "../timeline-C2IEcRlP.js";
1
+ import { n as TimelineListParams, r as timelineResource, t as TimelineEventsParams } from "../timeline-BdLvwRnl.js";
2
2
  export { TimelineEventsParams, TimelineListParams, timelineResource };
@@ -1,4 +1,4 @@
1
- import { f as RequestOptions, h as Transport } from "../transport-E0ZaPNWJ.js";
1
+ import { f as RequestOptions, h as Transport } from "../transport-CS11mEqI.js";
2
2
  import { t as ListResult } from "../list-BT_bBm9Z.js";
3
3
  //#region src/resources/transform-dag-run.d.ts
4
4
  declare function transformDagRunResource(transport: Transport): {
@@ -7,7 +7,7 @@ declare function transformDagRunResource(transport: Transport): {
7
7
  id: number;
8
8
  transform_id: number | null;
9
9
  run_method: "manual" | "cron";
10
- status: "timeout" | "failed" | "started" | "succeeded" | "canceled" | "canceling";
10
+ status: "started" | "succeeded" | "failed" | "canceled" | "timeout" | "canceling";
11
11
  is_active: boolean | null;
12
12
  start_time: string;
13
13
  message: string | null;
@@ -1,4 +1,4 @@
1
- import { f as RequestOptions, h as Transport } from "../transport-E0ZaPNWJ.js";
1
+ import { f as RequestOptions, h as Transport } from "../transport-CS11mEqI.js";
2
2
  //#region src/resources/transform-inspector.d.ts
3
3
  declare function transformInspectorResource(transport: Transport): {
4
4
  discover: (id: number, options?: RequestOptions | undefined) => Promise<{
@@ -95,7 +95,7 @@ declare function transformInspectorResource(transport: Transport): {
95
95
  [x: string]: unknown;
96
96
  id: string;
97
97
  title: string;
98
- display: "table" | "hidden" | "progress" | "bar" | "row" | "line" | "area" | "pie" | "scalar" | "gauge";
98
+ display: "table" | "hidden" | "row" | "progress" | "bar" | "line" | "area" | "pie" | "scalar" | "gauge";
99
99
  dataset_query: {
100
100
  [x: string]: unknown;
101
101
  };
@@ -108,7 +108,7 @@ declare function transformInspectorResource(transport: Transport): {
108
108
  dedup_key?: unknown[] | undefined;
109
109
  depends_on_cards?: string[] | undefined;
110
110
  group_id?: string | undefined;
111
- group_role?: "output" | "input" | undefined;
111
+ group_role?: "input" | "output" | undefined;
112
112
  group_order?: number | undefined;
113
113
  card_type?: string | undefined;
114
114
  } | undefined;
@@ -149,7 +149,7 @@ declare function transformInspectorResource(transport: Transport): {
149
149
  [x: string]: unknown;
150
150
  name: string;
151
151
  };
152
- severity: "error" | "info" | "warning";
152
+ severity: "error" | "warning" | "info";
153
153
  message: string;
154
154
  metadata?: {
155
155
  [x: string]: unknown;
@@ -1,2 +1,2 @@
1
- import { n as transformJobResource, t as TransformJobRunParams } from "../transform-job-29P6BULe.js";
1
+ import { n as transformJobResource, t as TransformJobRunParams } from "../transform-job-C85GxBHj.js";
2
2
  export { TransformJobRunParams, transformJobResource };
@@ -1,4 +1,4 @@
1
- import { f as RequestOptions, h as Transport } from "../transport-E0ZaPNWJ.js";
1
+ import { f as RequestOptions, h as Transport } from "../transport-CS11mEqI.js";
2
2
  //#region src/resources/transform-python.d.ts
3
3
  declare function transformPythonResource(transport: Transport): {
4
4
  getLibrary: (path: string, options?: RequestOptions | undefined) => Promise<{
@@ -19,14 +19,21 @@ declare function transformPythonResource(transport: Transport): {
19
19
  }>;
20
20
  testRun: (params: {
21
21
  code: string;
22
- source_tables: {
22
+ source_tables: ({
23
23
  [x: string]: unknown;
24
24
  alias: string;
25
25
  database_id: number;
26
- schema: string | null;
26
+ schema?: string | null | undefined;
27
27
  table?: string | undefined;
28
28
  table_id?: number | null | undefined;
29
- }[];
29
+ } | {
30
+ [x: string]: unknown;
31
+ alias: string;
32
+ table_id: number;
33
+ database_id?: null | undefined;
34
+ schema?: null | undefined;
35
+ table?: null | undefined;
36
+ })[];
30
37
  output_row_limit?: number | undefined;
31
38
  per_input_row_limit?: number | undefined;
32
39
  }, options?: RequestOptions | undefined) => Promise<{
@@ -1,5 +1,5 @@
1
1
  import { t as explainer } from "../refusal-B9aeHMc9.js";
2
- import { PythonLibrary, PythonTestRunError, PythonTestRunOutput } from "../domain/transform-python.js";
2
+ import { PythonLibrary, PythonTestRunError, PythonTestRunOutput, pythonTestRunBody } from "../domain/transform-python.js";
3
3
  import { z } from "zod";
4
4
  //#region src/resources/transform-python.ts
5
5
  const PythonApiTestRun = z.union([z.object({
@@ -40,10 +40,11 @@ function transformPythonResource(transport) {
40
40
  * sizes are capped at 100 rows.
41
41
  */
42
42
  async function testRun(params, options = {}) {
43
+ const { features } = await transport.server(options);
43
44
  return transport.requestParsed(PythonApiTestRun, "/api/ee/transforms-python/test-run", {
44
45
  ...options,
45
46
  method: "POST",
46
- body: params
47
+ body: pythonTestRunBody(params, features)
47
48
  });
48
49
  }
49
50
  return {
@@ -1,4 +1,4 @@
1
- import { f as RequestOptions, h as Transport } from "../transport-E0ZaPNWJ.js";
1
+ import { f as RequestOptions, h as Transport } from "../transport-CS11mEqI.js";
2
2
  import { t as ListResult } from "../list-BT_bBm9Z.js";
3
3
  //#region src/resources/transform-tag.d.ts
4
4
  declare function transformTagResource(transport: Transport): {
@@ -1,2 +1,2 @@
1
- import { n as transformTestResource, t as TransformTestListParams } from "../transform-test-A-CJYT6B.js";
1
+ import { n as transformTestResource, t as TransformTestListParams } from "../transform-test-C3hiZ4AV.js";
2
2
  export { TransformTestListParams, transformTestResource };
@@ -1,2 +1,2 @@
1
- import { a as TransformRunSummaryPageParams, i as TransformRunParams, n as TransformRunPageOptions, o as transformResource, r as TransformRunPageParams, t as TransformDagParams } from "../transform-CXOT5kFe.js";
1
+ import { a as TransformRunSummaryPageParams, i as TransformRunParams, n as TransformRunPageOptions, o as transformResource, r as TransformRunPageParams, t as TransformDagParams } from "../transform-Ds74yPiY.js";
2
2
  export { TransformDagParams, TransformRunPageOptions, TransformRunPageParams, TransformRunParams, TransformRunSummaryPageParams, transformResource };
@@ -2,7 +2,7 @@ import { TimeoutError } from "../errors.js";
2
2
  import { paginatePages } from "../paginate.js";
3
3
  import { t as explainer } from "../refusal-B9aeHMc9.js";
4
4
  import { pollUntil } from "../poll.js";
5
- import { TransformDagRunResult, TransformDagTransform, TransformRun, TransformRunSummary, isTransformRunFailed, isTransformRunTerminal, transformDetailSchema, transformRowSchema } from "../domain/transform.js";
5
+ import { TransformDagRunResult, TransformDagTransform, TransformRun, TransformRunSummary, isTransformRunFailed, isTransformRunTerminal, transformDetailSchema, transformRowSchema, transformSourceBody } from "../domain/transform.js";
6
6
  import { z } from "zod";
7
7
  //#region src/resources/transform.ts
8
8
  function transformListSchema(features) {
@@ -35,20 +35,30 @@ function transformResource(transport) {
35
35
  const { features } = await transport.server(options);
36
36
  return transport.requestParsed(transformDetailSchema(features), `/api/transform/${id}`, { ...options });
37
37
  }
38
+ async function writeBody(params, options) {
39
+ if (params.source === void 0) return params;
40
+ const { features } = await transport.server(options);
41
+ return {
42
+ ...params,
43
+ source: transformSourceBody(params.source, features)
44
+ };
45
+ }
38
46
  /** Create a transform — a query plus the warehouse table it writes — from a full body. */
39
47
  async function create(params, options = {}) {
48
+ const body = await writeBody(params, options);
40
49
  return requestTransform("/api/transform", {
41
50
  ...options,
42
51
  method: "POST",
43
- body: params
52
+ body
44
53
  });
45
54
  }
46
55
  /** Update a transform by id, patching only the fields the body carries. */
47
56
  async function update(id, params, options = {}) {
57
+ const body = await writeBody(params, options);
48
58
  return requestTransform(`/api/transform/${id}`, {
49
59
  ...options,
50
60
  method: "PUT",
51
- body: params
61
+ body
52
62
  });
53
63
  }
54
64
  /** Delete a transform by id, leaving any table it already materialized in place. */
@@ -1,2 +1,2 @@
1
- import { n as uploadResource, t as UploadCsvParams } from "../upload-B7PG3ePk.js";
1
+ import { n as uploadResource, t as UploadCsvParams } from "../upload-Bx1D7eNy.js";
2
2
  export { UploadCsvParams, uploadResource };
@@ -1,5 +1,5 @@
1
- import { f as RequestOptions, h as Transport } from "../transport-E0ZaPNWJ.js";
2
- import { t as CurrentUser } from "../user-2r0OBoO6.js";
1
+ import { f as RequestOptions, h as Transport } from "../transport-CS11mEqI.js";
2
+ import { t as CurrentUser } from "../user-Sqqv7rqh.js";
3
3
  //#region src/resources/user.d.ts
4
4
  declare function userResource(transport: Transport): {
5
5
  current: (options?: RequestOptions) => Promise<CurrentUser>;
@@ -1,12 +1,13 @@
1
+ import { r as InputGate } from "./input-gates-DwKoTJVQ.js";
1
2
  import { z } from "zod";
2
3
  //#region src/domain/revision.d.ts
3
4
  declare const RevisionEntity: z.ZodEnum<{
5
+ transform: "transform";
4
6
  card: "card";
5
7
  dashboard: "dashboard";
6
8
  document: "document";
7
9
  measure: "measure";
8
10
  segment: "segment";
9
- transform: "transform";
10
11
  "transform-test": "transform-test";
11
12
  }>;
12
13
  type RevisionEntity = z.infer<typeof RevisionEntity>;
@@ -28,14 +29,14 @@ declare const Revision: z.ZodObject<{
28
29
  }, z.core.$loose>;
29
30
  type Revision = z.infer<typeof Revision>;
30
31
  declare const RevisionCompact: z.ZodObject<{
32
+ id: z.ZodNumber;
33
+ description: z.ZodString;
31
34
  user: z.ZodObject<{
32
35
  id: z.ZodNumber;
33
36
  first_name: z.ZodNullable<z.ZodString>;
34
37
  last_name: z.ZodNullable<z.ZodString>;
35
38
  common_name: z.ZodString;
36
39
  }, z.core.$loose>;
37
- id: z.ZodNumber;
38
- description: z.ZodString;
39
40
  timestamp: z.ZodString;
40
41
  is_creation: z.ZodBoolean;
41
42
  is_reversion: z.ZodBoolean;
@@ -53,14 +54,15 @@ declare const RevisionRow: z.ZodObject<{
53
54
  most_recent: z.ZodBoolean;
54
55
  }, z.core.$loose>;
55
56
  type RevisionRow = z.infer<typeof RevisionRow>;
57
+ declare const REVISION_ENTITY_GATES: readonly InputGate[];
56
58
  declare const RevisionRevertInput: z.ZodObject<{
57
59
  entity: z.ZodEnum<{
60
+ transform: "transform";
58
61
  card: "card";
59
62
  dashboard: "dashboard";
60
63
  document: "document";
61
64
  measure: "measure";
62
65
  segment: "segment";
63
- transform: "transform";
64
66
  "transform-test": "transform-test";
65
67
  }>;
66
68
  id: z.ZodNumber;
@@ -101,4 +103,4 @@ declare const RevisionRevert: z.ZodDiscriminatedUnion<[z.ZodObject<{
101
103
  }, z.core.$strip>], "outcome">;
102
104
  type RevisionRevert = z.infer<typeof RevisionRevert>;
103
105
  //#endregion
104
- export { RevisionRevertInput as a, RevisionRevert as i, RevisionCompact as n, RevisionRow as o, RevisionEntity as r, Revision as t };
106
+ export { RevisionRevert as a, RevisionEntity as i, Revision as n, RevisionRevertInput as o, RevisionCompact as r, RevisionRow as s, REVISION_ENTITY_GATES as t };
@@ -1,5 +1,5 @@
1
- import { f as RequestOptions, h as Transport } from "./transport-E0ZaPNWJ.js";
2
- import { n as SearchModel, r as SearchResult } from "./search-NZR6iRBs.js";
1
+ import { f as RequestOptions, h as Transport } from "./transport-CS11mEqI.js";
2
+ import { n as SearchModel, r as SearchResult } from "./search-tK5lmRb8.js";
3
3
  //#region src/resources/search.d.ts
4
4
  interface SearchPage {
5
5
  data: SearchResult[];
@@ -2,40 +2,40 @@ import { z } from "zod";
2
2
  //#region src/domain/search.d.ts
3
3
  declare const SEARCH_MODELS: readonly ["card", "dataset", "metric", "dashboard", "collection", "database", "table", "segment", "measure", "document", "exploration", "action", "transform", "indexed-entity"];
4
4
  declare const SearchModel: z.ZodEnum<{
5
+ transform: "transform";
6
+ metric: "metric";
7
+ database: "database";
8
+ table: "table";
5
9
  card: "card";
6
- collection: "collection";
7
10
  dashboard: "dashboard";
8
- database: "database";
9
11
  dataset: "dataset";
12
+ collection: "collection";
10
13
  document: "document";
11
- metric: "metric";
12
- measure: "measure";
13
- segment: "segment";
14
- table: "table";
15
- transform: "transform";
16
14
  exploration: "exploration";
15
+ measure: "measure";
17
16
  "indexed-entity": "indexed-entity";
18
17
  action: "action";
18
+ segment: "segment";
19
19
  }>;
20
20
  type SearchModel = z.infer<typeof SearchModel>;
21
21
  declare const SearchResult: z.ZodObject<{
22
22
  id: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
23
23
  name: z.ZodString;
24
24
  model: z.ZodEnum<{
25
+ transform: "transform";
26
+ metric: "metric";
27
+ database: "database";
28
+ table: "table";
25
29
  card: "card";
26
- collection: "collection";
27
30
  dashboard: "dashboard";
28
- database: "database";
29
31
  dataset: "dataset";
32
+ collection: "collection";
30
33
  document: "document";
31
- metric: "metric";
32
- measure: "measure";
33
- segment: "segment";
34
- table: "table";
35
- transform: "transform";
36
34
  exploration: "exploration";
35
+ measure: "measure";
37
36
  "indexed-entity": "indexed-entity";
38
37
  action: "action";
38
+ segment: "segment";
39
39
  }>;
40
40
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
41
  archived: z.ZodNullable<z.ZodBoolean>;
@@ -60,31 +60,31 @@ declare const SearchResult: z.ZodObject<{
60
60
  }, z.core.$loose>;
61
61
  type SearchResult = z.infer<typeof SearchResult>;
62
62
  declare const SearchResultCompact: z.ZodObject<{
63
- name: z.ZodString;
64
63
  id: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
64
+ name: z.ZodString;
65
65
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
66
  model: z.ZodEnum<{
67
+ transform: "transform";
68
+ metric: "metric";
69
+ database: "database";
70
+ table: "table";
67
71
  card: "card";
68
- collection: "collection";
69
72
  dashboard: "dashboard";
70
- database: "database";
71
73
  dataset: "dataset";
74
+ collection: "collection";
72
75
  document: "document";
73
- metric: "metric";
74
- measure: "measure";
75
- segment: "segment";
76
- table: "table";
77
- transform: "transform";
78
76
  exploration: "exploration";
77
+ measure: "measure";
79
78
  "indexed-entity": "indexed-entity";
80
79
  action: "action";
80
+ segment: "segment";
81
81
  }>;
82
82
  table_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
83
  database_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
84
  table_schema: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
85
  dashboard: z.ZodOptional<z.ZodNullable<z.ZodObject<{
86
- name: z.ZodString;
87
86
  id: z.ZodNumber;
87
+ name: z.ZodString;
88
88
  }, z.core.$strip>>>;
89
89
  }, z.core.$strip>;
90
90
  type SearchResultCompact = z.infer<typeof SearchResultCompact>;
@@ -18,8 +18,8 @@ declare const Segment: z.ZodObject<{
18
18
  }, z.core.$loose>;
19
19
  type Segment = z.infer<typeof Segment>;
20
20
  declare const SegmentCompact: z.ZodObject<{
21
- name: z.ZodString;
22
21
  id: z.ZodNumber;
22
+ name: z.ZodString;
23
23
  description: z.ZodNullable<z.ZodString>;
24
24
  archived: z.ZodBoolean;
25
25
  table_id: z.ZodNumber;
@@ -1,6 +1,6 @@
1
- import { f as RequestOptions, h as Transport } from "./transport-E0ZaPNWJ.js";
1
+ import { f as RequestOptions, h as Transport } from "./transport-CS11mEqI.js";
2
2
  import { t as ListResult } from "./list-BT_bBm9Z.js";
3
- import { i as SegmentUpdateInput, r as SegmentCreateInput, t as Segment } from "./segment-pj3wklGe.js";
3
+ import { i as SegmentUpdateInput, r as SegmentCreateInput, t as Segment } from "./segment-CbAgVO-5.js";
4
4
  //#region src/resources/segment.d.ts
5
5
  interface SegmentArchiveParams {
6
6
  revision_message: string;
@@ -5,7 +5,7 @@ declare const SetupInput: z.ZodObject<{
5
5
  user: z.ZodObject<{
6
6
  first_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
7
  last_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
- email: z.ZodEmail;
8
+ email: z.ZodString;
9
9
  password: z.ZodString;
10
10
  }, z.core.$loose>;
11
11
  prefs: z.ZodObject<{
package/dist/signal.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { X as MetabaseError } from "./transport-E0ZaPNWJ.js";
1
+ import { X as MetabaseError } from "./transport-CS11mEqI.js";
2
2
  //#region src/signal.d.ts
3
3
  declare function combineAborts(...signals: Array<AbortSignal | undefined>): AbortSignal;
4
4
  declare function throwIfAborted(...signals: Array<AbortSignal | undefined>): void;
5
5
  declare function abortReason(signal: AbortSignal): MetabaseError;
6
6
  declare function untilAborted<T>(promise: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
7
+ declare function whenAborted(signal: AbortSignal | undefined, onAbort: (reason: MetabaseError) => void): () => void;
7
8
  //#endregion
8
- export { abortReason, combineAborts, throwIfAborted, untilAborted };
9
+ export { abortReason, combineAborts, throwIfAborted, untilAborted, whenAborted };
package/dist/signal.js CHANGED
@@ -16,10 +16,15 @@ function untilAborted(promise, signal) {
16
16
  if (signal === void 0) return promise;
17
17
  throwIfAborted(signal);
18
18
  return new Promise((resolve, reject) => {
19
- const onAbort = () => reject(abortReason(signal));
20
- signal.addEventListener("abort", onAbort, { once: true });
21
- promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
19
+ const stopWatching = whenAborted(signal, reject);
20
+ promise.then(resolve, reject).finally(stopWatching);
22
21
  });
23
22
  }
23
+ function whenAborted(signal, onAbort) {
24
+ if (signal === void 0) return () => void 0;
25
+ const listener = () => onAbort(abortReason(signal));
26
+ signal.addEventListener("abort", listener, { once: true });
27
+ return () => signal.removeEventListener("abort", listener);
28
+ }
24
29
  //#endregion
25
- export { abortReason, combineAborts, throwIfAborted, untilAborted };
30
+ export { abortReason, combineAborts, throwIfAborted, untilAborted, whenAborted };
@@ -15,11 +15,11 @@ declare const Snippet: z.ZodObject<{
15
15
  }, z.core.$loose>;
16
16
  type Snippet = z.infer<typeof Snippet>;
17
17
  declare const SnippetCompact: z.ZodObject<{
18
- name: z.ZodString;
19
18
  id: z.ZodNumber;
20
- collection_id: z.ZodNullable<z.ZodNumber>;
19
+ name: z.ZodString;
21
20
  description: z.ZodNullable<z.ZodString>;
22
21
  archived: z.ZodBoolean;
22
+ collection_id: z.ZodNullable<z.ZodNumber>;
23
23
  }, z.core.$strip>;
24
24
  type SnippetCompact = z.infer<typeof SnippetCompact>;
25
25
  declare const SnippetCreateInput: z.ZodObject<{
@@ -1,6 +1,6 @@
1
- import { f as RequestOptions, h as Transport } from "./transport-E0ZaPNWJ.js";
1
+ import { f as RequestOptions, h as Transport } from "./transport-CS11mEqI.js";
2
2
  import { t as ListResult } from "./list-BT_bBm9Z.js";
3
- import { i as SnippetUpdateInput, r as SnippetCreateInput, t as Snippet } from "./snippet-hEV429Pv.js";
3
+ import { i as SnippetUpdateInput, r as SnippetCreateInput, t as Snippet } from "./snippet-C_Ilx7tR.js";
4
4
  //#region src/resources/snippet.d.ts
5
5
  interface SnippetListParams {
6
6
  archived?: boolean | undefined;