@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.
- package/CHANGELOG.md +25 -0
- package/README.md +10 -6
- package/dist/api-key-DJeN1-7G.d.ts +46 -0
- package/dist/auth/credential.d.ts +1 -1
- package/dist/auth/oauth-login.d.ts +1 -1
- package/dist/auth/oauth-login.js +1 -1
- package/dist/auth/oauth-session.d.ts +1 -1
- package/dist/{card-BZx4NSr-.d.ts → card-CbV6hLYH.d.ts} +4 -4
- package/dist/{card-B6merEUN.d.ts → card-CrSywvOt.d.ts} +18 -18
- package/dist/{client-DNRvXFRm.d.ts → client-cBi6_RQs.d.ts} +289 -185
- package/dist/client.d.ts +1 -1
- package/dist/client.js +4 -0
- package/dist/{collection-Bib61WiV.d.ts → collection-Bmtisr3r.d.ts} +47 -47
- package/dist/{collection-CqtGPi4W.d.ts → collection-Q9FNMiRh.d.ts} +18 -4
- package/dist/{credential-6aOEGqMH.d.ts → credential-B6fKSvqp.d.ts} +1 -1
- package/dist/{dashboard-XTe46250.d.ts → dashboard-CknUcTp8.d.ts} +3 -3
- package/dist/{dashboard-z9i1VUZC.d.ts → dashboard-DBdEehA9.d.ts} +33 -25
- package/dist/{data-action-rS27f2Ji.d.ts → data-action-CqqZ0JYg.d.ts} +6 -4
- package/dist/data-app-MoMS9VUr.d.ts +76 -0
- package/dist/{database-DqTespfa.d.ts → database-Bs5WQOOZ.d.ts} +3 -3
- package/dist/{database-BLUMlywE.d.ts → database-CYNLJ8AZ.d.ts} +18 -18
- package/dist/{dataset-C6lX1-cr.d.ts → dataset-cg8ZZrOP.d.ts} +85 -85
- package/dist/{dataset-Cj3XuKLe.d.ts → dataset-dzWljE_C.d.ts} +3 -3
- package/dist/{dependency-fN5_7a22.d.ts → dependency-CL-YG9KH.d.ts} +26 -26
- package/dist/{dependency-D8Qs5Xdx.d.ts → dependency-VqvLTDAU.d.ts} +248 -196
- package/dist/{document-oZNDbDfx.d.ts → document-tLd6pYWe.d.ts} +2 -2
- package/dist/domain/api-key.d.ts +2 -0
- package/dist/domain/api-key.js +31 -0
- package/dist/domain/card.d.ts +1 -1
- package/dist/domain/collection.d.ts +1 -1
- package/dist/domain/dashboard.d.ts +2 -2
- package/dist/domain/dashboard.js +21 -4
- package/dist/domain/data-action.d.ts +2 -2
- package/dist/domain/data-action.js +8 -2
- package/dist/domain/data-app.d.ts +2 -0
- package/dist/domain/data-app.js +52 -0
- package/dist/domain/database.d.ts +1 -1
- package/dist/domain/dataset.d.ts +1 -1
- package/dist/domain/dependency.d.ts +1 -1
- package/dist/domain/dependency.js +6 -3
- package/dist/domain/document.d.ts +1 -1
- package/dist/domain/eid-translation.d.ts +1 -1
- package/dist/domain/field.d.ts +2 -2
- package/dist/domain/field.js +8 -2
- package/dist/domain/git-sync.d.ts +1 -1
- package/dist/domain/library.d.ts +2 -2
- package/dist/domain/library.js +8 -2
- package/dist/domain/measure.d.ts +1 -1
- package/dist/domain/measure.js +3 -1
- package/dist/domain/metric.d.ts +1 -1
- package/dist/domain/moderation-review.d.ts +1 -1
- package/dist/domain/notification.d.ts +2 -2
- package/dist/domain/notification.js +6 -1
- package/dist/domain/parameter.d.ts +1 -1
- package/dist/domain/pulse.d.ts +2 -2
- package/dist/domain/pulse.js +10 -3
- package/dist/domain/replacement.d.ts +1 -1
- package/dist/domain/revision.d.ts +2 -2
- package/dist/domain/revision.js +29 -2
- package/dist/domain/search.d.ts +1 -1
- package/dist/domain/segment.d.ts +1 -1
- package/dist/domain/segment.js +3 -1
- package/dist/domain/setup.d.ts +1 -1
- package/dist/domain/setup.js +1 -1
- package/dist/domain/snippet.d.ts +1 -1
- package/dist/domain/table.d.ts +2 -2
- package/dist/domain/table.js +35 -4
- package/dist/domain/timeline.d.ts +1 -1
- package/dist/domain/transform-dag-run.d.ts +1 -1
- package/dist/domain/transform-inspector.d.ts +1 -1
- package/dist/domain/transform-job.d.ts +2 -2
- package/dist/domain/transform-job.js +8 -2
- package/dist/domain/transform-python.d.ts +2 -2
- package/dist/domain/transform-python.js +15 -3
- package/dist/domain/transform-tag.d.ts +1 -1
- package/dist/domain/transform-test.d.ts +1 -1
- package/dist/domain/transform.d.ts +2 -2
- package/dist/domain/transform.js +76 -7
- package/dist/domain/user.d.ts +1 -1
- package/dist/domain/user.js +1 -1
- package/dist/{eid-translation-nuhr8St2.d.ts → eid-translation-aQSffx0o.d.ts} +40 -40
- package/dist/{erd-BujD227Y.d.ts → erd-DCgdEC2S.d.ts} +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/{features-CnFkUCj2.d.ts → features-SMSfJhB6.d.ts} +36 -2
- package/dist/{field-Bqn10Fq_.d.ts → field-ozrfbvUd.d.ts} +2 -2
- package/dist/{field-BCRO19mk.d.ts → field-tqQPtVuR.d.ts} +9 -7
- package/dist/{git-sync-gAMKsZgN.d.ts → git-sync-5lFWX1ds.d.ts} +3 -3
- package/dist/{git-sync-DNXrNVCW.d.ts → git-sync-QL9Nu6gP.d.ts} +10 -10
- package/dist/{glossary-CqFlzW33.d.ts → glossary-DwS7QVrl.d.ts} +1 -1
- package/dist/http/errors.d.ts +1 -1
- package/dist/http/oauth.d.ts +1 -1
- package/dist/http/oauth.js +47 -36
- package/dist/http/transport.d.ts +1 -1
- package/dist/index.d.ts +48 -46
- package/dist/index.js +8 -6
- package/dist/input-gate-registry-Dai7SfXb.js +14 -0
- package/dist/input-gates-DwKoTJVQ.d.ts +28 -0
- package/dist/{json-CZvjc3--.d.ts → json-DwGOvRtS.d.ts} +1 -1
- package/dist/json-pointer.d.ts +2 -1
- package/dist/json-pointer.js +4 -1
- package/dist/json.d.ts +1 -1
- package/dist/{library-Cx9h_RkU.d.ts → library-B9pEq7qP.d.ts} +8 -6
- package/dist/{measure-CuMqPbQX.d.ts → measure-CInoXeyH.d.ts} +1 -1
- package/dist/{measure-KuXdjZYJ.d.ts → measure-CgH14YQZ.d.ts} +1 -1
- package/dist/{metric-yvehaVCS.d.ts → metric-CYOmbcM5.d.ts} +10 -10
- package/dist/{moderation-review-B4RUTZ6_.d.ts → moderation-review-CWUQ3_HL.d.ts} +4 -4
- package/dist/{notification-BT2TDAd_.d.ts → notification-BY2JEjKp.d.ts} +68 -4
- package/dist/{notification-BiegPoSD.d.ts → notification-D-Hp82Pn.d.ts} +3 -3
- package/dist/{oauth-C4ordeoJ.d.ts → oauth-CVoZpuq8.d.ts} +4 -2
- package/dist/{oauth-login-D734Jvbq.js → oauth-login--tDagiZu.js} +29 -11
- package/dist/{oauth-login-CJsT_3EE.d.ts → oauth-login-SZ4Csai8.d.ts} +3 -2
- package/dist/{oauth-session-BlIlcd8Q.d.ts → oauth-session-COLH4puN.d.ts} +1 -1
- package/dist/{paginate-DZWvWvbm.d.ts → paginate-CaJ5usdp.d.ts} +1 -1
- package/dist/paginate.d.ts +1 -1
- package/dist/{parameter-ak-J-IOj.d.ts → parameter-BYo7uR-J.d.ts} +2 -2
- package/dist/{pulse-dylocLd9.d.ts → pulse-BTpSNxhT.d.ts} +2 -2
- package/dist/{pulse-CMc1Rwdj.d.ts → pulse-BUlfrJZH.d.ts} +23 -21
- package/dist/{replacement-CyvtbxGg.d.ts → replacement-BQian4vA.d.ts} +23 -23
- package/dist/{replacement-S9U3gApY.d.ts → replacement-Dbtvvrmz.d.ts} +11 -11
- package/dist/{requirement-check-CIA5IHC1.d.ts → requirement-check-CHHEHXcj.d.ts} +2 -2
- package/dist/{requirements-C0txASN8.d.ts → requirements-Dx_ZVzl7.d.ts} +11 -1
- package/dist/resources/api-key.d.ts +11 -0
- package/dist/resources/api-key.js +35 -0
- package/dist/resources/card.d.ts +1 -1
- package/dist/resources/collection.d.ts +1 -1
- package/dist/resources/collection.js +35 -6
- package/dist/resources/content-translation.d.ts +1 -1
- package/dist/resources/content-translation.js +1 -1
- package/dist/resources/dashboard.d.ts +1 -1
- package/dist/resources/dashboard.js +8 -5
- package/dist/resources/data-action.d.ts +3 -48
- package/dist/resources/data-action.js +9 -9
- package/dist/resources/data-app.d.ts +112 -0
- package/dist/resources/data-app.js +75 -0
- package/dist/resources/database.d.ts +1 -1
- package/dist/resources/dataset.d.ts +1 -1
- package/dist/resources/dependency.d.ts +1 -1
- package/dist/resources/dependency.js +13 -7
- package/dist/resources/document.d.ts +3 -10
- package/dist/resources/eid-translation.d.ts +2 -2
- package/dist/resources/erd.d.ts +1 -1
- package/dist/resources/field.d.ts +1 -1
- package/dist/resources/field.js +3 -2
- package/dist/resources/git-sync.d.ts +1 -1
- package/dist/resources/git-sync.js +1 -1
- package/dist/resources/glossary.d.ts +1 -1
- package/dist/resources/library.d.ts +4 -4
- package/dist/resources/library.js +2 -2
- package/dist/resources/measure.d.ts +1 -1
- package/dist/resources/metric.d.ts +1 -1
- package/dist/resources/moderation-review.d.ts +1 -1
- package/dist/resources/notification.d.ts +1 -1
- package/dist/resources/notification.js +2 -2
- package/dist/resources/optional-parsed.d.ts +1 -1
- package/dist/resources/permission.d.ts +1 -1
- package/dist/resources/pivot-export.d.ts +1 -1
- package/dist/resources/pulse.d.ts +1 -1
- package/dist/resources/pulse.js +3 -2
- package/dist/resources/replacement.d.ts +1 -1
- package/dist/resources/revision.d.ts +3 -3
- package/dist/resources/revision.js +5 -10
- package/dist/resources/search.d.ts +1 -1
- package/dist/resources/search.js +23 -2
- package/dist/resources/segment.d.ts +1 -1
- package/dist/resources/setting.d.ts +1 -1
- package/dist/resources/setup.d.ts +2 -2
- package/dist/resources/snippet.d.ts +1 -1
- package/dist/resources/table.d.ts +1 -1
- package/dist/resources/table.js +9 -10
- package/dist/resources/timeline-event.d.ts +2 -2
- package/dist/resources/timeline.d.ts +1 -1
- package/dist/resources/transform-dag-run.d.ts +2 -2
- package/dist/resources/transform-inspector.d.ts +4 -4
- package/dist/resources/transform-job.d.ts +1 -1
- package/dist/resources/transform-python.d.ts +11 -4
- package/dist/resources/transform-python.js +3 -2
- package/dist/resources/transform-tag.d.ts +1 -1
- package/dist/resources/transform-test.d.ts +1 -1
- package/dist/resources/transform.d.ts +1 -1
- package/dist/resources/transform.js +13 -3
- package/dist/resources/upload.d.ts +1 -1
- package/dist/resources/user.d.ts +2 -2
- package/dist/{revision-CQBPhohA.d.ts → revision-DNEw6S93.d.ts} +7 -5
- package/dist/{search-BxJipLN6.d.ts → search-BQWkdVg1.d.ts} +2 -2
- package/dist/{search-NZR6iRBs.d.ts → search-tK5lmRb8.d.ts} +23 -23
- package/dist/{segment-pj3wklGe.d.ts → segment-CbAgVO-5.d.ts} +1 -1
- package/dist/{segment-D2i34X9l.d.ts → segment-jyhBtOAZ.d.ts} +2 -2
- package/dist/{setup-Ez_U7GmM.d.ts → setup-JqcJ2unJ.d.ts} +1 -1
- package/dist/signal.d.ts +3 -2
- package/dist/signal.js +9 -4
- package/dist/{snippet-hEV429Pv.d.ts → snippet-C_Ilx7tR.d.ts} +2 -2
- package/dist/{snippet-RnnWa4TL.d.ts → snippet-DsgohpTV.d.ts} +2 -2
- package/dist/{table-B_lfuaHc.d.ts → table-B1pQSpTA.d.ts} +14 -14
- package/dist/{table-B3-UaPHa.d.ts → table-BAl8aPZZ.d.ts} +49 -44
- package/dist/{timeline-C2IEcRlP.d.ts → timeline-BdLvwRnl.d.ts} +2 -2
- package/dist/{timeline-folD3mQ_.d.ts → timeline-BfX1lMob.d.ts} +24 -24
- package/dist/{transform-CXOT5kFe.d.ts → transform-Ds74yPiY.d.ts} +48 -34
- package/dist/{transform-CDurgE1D.d.ts → transform-DwnIcpqV.d.ts} +153 -37
- package/dist/{transform-dag-run-BgZwv1yx.d.ts → transform-dag-run-BSrdrjaK.d.ts} +4 -4
- package/dist/{transform-inspector-BUYBt6--.d.ts → transform-inspector-BMaRqcRM.d.ts} +8 -8
- package/dist/{transform-job-29P6BULe.d.ts → transform-job-C85GxBHj.d.ts} +9 -9
- package/dist/{transform-job-CTJImaOd.d.ts → transform-job-Dfp9Ox0l.d.ts} +7 -5
- package/dist/{transform-python-DdDnW6yK.d.ts → transform-python-DtL3xxMj.d.ts} +49 -4
- package/dist/{transform-tag-DVUIZTEM.d.ts → transform-tag-C6j5EUkX.d.ts} +1 -1
- package/dist/{transform-test-A-CJYT6B.d.ts → transform-test-C3hiZ4AV.d.ts} +2 -2
- package/dist/{transform-test-BwuyrHpT.d.ts → transform-test-DROPvrkI.d.ts} +2 -2
- package/dist/{transport-E0ZaPNWJ.d.ts → transport-CS11mEqI.d.ts} +20 -6
- package/dist/{upload-B7PG3ePk.d.ts → upload-Bx1D7eNy.d.ts} +1 -1
- package/dist/{user-2r0OBoO6.d.ts → user-Sqqv7rqh.d.ts} +2 -2
- package/dist/version/capability-error.d.ts +1 -1
- package/dist/version/features.d.ts +2 -2
- package/dist/version/features.js +30 -2
- package/dist/version/input-gates.d.ts +2 -0
- package/dist/version/input-gates.js +13 -0
- package/dist/version/probe.d.ts +1 -1
- package/dist/version/profile.d.ts +1 -1
- package/dist/version/requirement-check.d.ts +1 -1
- package/dist/version/requirements.d.ts +1 -1
- package/dist/version/requirements.js +10 -0
- package/package.json +3 -2
package/dist/resources/search.js
CHANGED
|
@@ -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,
|
|
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-
|
|
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-
|
|
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-
|
|
2
|
-
import { n as SetupResult, t as SetupInput } from "../setup-
|
|
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-
|
|
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-
|
|
1
|
+
import { n as tableResource, t as TableListParams } from "../table-B1pQSpTA.js";
|
|
2
2
|
export { TableListParams, tableResource };
|
package/dist/resources/table.js
CHANGED
|
@@ -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
|
|
32
|
-
feature:
|
|
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 (
|
|
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
|
|
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
|
|
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-
|
|
2
|
-
import { i as TimelineEvent, o as TimelineEventCreateInput, s as TimelineEventUpdateInput } from "../timeline-
|
|
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-
|
|
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-
|
|
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: "
|
|
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-
|
|
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" | "
|
|
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?: "
|
|
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" | "
|
|
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-
|
|
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-
|
|
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
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
|
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
|
|
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-
|
|
1
|
+
import { n as uploadResource, t as UploadCsvParams } from "../upload-Bx1D7eNy.js";
|
|
2
2
|
export { UploadCsvParams, uploadResource };
|
package/dist/resources/user.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as RequestOptions, h as Transport } from "../transport-
|
|
2
|
-
import { t as CurrentUser } from "../user-
|
|
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 {
|
|
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-
|
|
2
|
-
import { n as SearchModel, r as SearchResult } from "./search-
|
|
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-
|
|
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-
|
|
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.
|
|
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-
|
|
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
|
|
20
|
-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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;
|