@metabase/client 0.0.0-stage → 0.1.0
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 +7 -0
- package/LICENSE +661 -0
- package/README.md +488 -2
- package/dist/auth/credential.d.ts +2 -0
- package/dist/auth/credential.js +61 -0
- package/dist/auth/oauth-login.d.ts +2 -0
- package/dist/auth/oauth-login.js +2 -0
- package/dist/auth/oauth-session.d.ts +2 -0
- package/dist/auth/oauth-session.js +31 -0
- package/dist/card-B6merEUN.d.ts +1392 -0
- package/dist/card-BZx4NSr-.d.ts +33 -0
- package/dist/client-DNRvXFRm.d.ts +3276 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +95 -0
- package/dist/collection-Bib61WiV.d.ts +294 -0
- package/dist/collection-CqtGPi4W.d.ts +39 -0
- package/dist/content-translation-zfUkE_OG.d.ts +8 -0
- package/dist/credential-6aOEGqMH.d.ts +30 -0
- package/dist/cron-DThzerR6.d.ts +9 -0
- package/dist/csv-upload--K35QedP.d.ts +8 -0
- package/dist/dashboard-XTe46250.d.ts +38 -0
- package/dist/dashboard-z9i1VUZC.d.ts +970 -0
- package/dist/data-action-rS27f2Ji.d.ts +95 -0
- package/dist/database-BLUMlywE.d.ts +997 -0
- package/dist/database-DqTespfa.d.ts +27 -0
- package/dist/dataset-C6lX1-cr.d.ts +4144 -0
- package/dist/dataset-Cj3XuKLe.d.ts +23 -0
- package/dist/dependency-D8Qs5Xdx.d.ts +827 -0
- package/dist/dependency-fN5_7a22.d.ts +299 -0
- package/dist/document-oZNDbDfx.d.ts +115 -0
- package/dist/domain/card.d.ts +2 -0
- package/dist/domain/card.js +140 -0
- package/dist/domain/collection.d.ts +2 -0
- package/dist/domain/collection.js +137 -0
- package/dist/domain/content-translation.d.ts +2 -0
- package/dist/domain/content-translation.js +5 -0
- package/dist/domain/cron.d.ts +2 -0
- package/dist/domain/cron.js +5 -0
- package/dist/domain/dashboard.d.ts +2 -0
- package/dist/domain/dashboard.js +194 -0
- package/dist/domain/data-action.d.ts +2 -0
- package/dist/domain/data-action.js +85 -0
- package/dist/domain/database.d.ts +2 -0
- package/dist/domain/database.js +56 -0
- package/dist/domain/dataset.d.ts +2 -0
- package/dist/domain/dataset.js +56 -0
- package/dist/domain/dependency.d.ts +2 -0
- package/dist/domain/dependency.js +165 -0
- package/dist/domain/document.d.ts +2 -0
- package/dist/domain/document.js +94 -0
- package/dist/domain/eid-translation.d.ts +2 -0
- package/dist/domain/eid-translation.js +36 -0
- package/dist/domain/embedding.d.ts +2 -0
- package/dist/domain/embedding.js +9 -0
- package/dist/domain/erd.d.ts +2 -0
- package/dist/domain/erd.js +45 -0
- package/dist/domain/field.d.ts +2 -0
- package/dist/domain/field.js +268 -0
- package/dist/domain/git-sync.d.ts +2 -0
- package/dist/domain/git-sync.js +147 -0
- package/dist/domain/glossary.d.ts +2 -0
- package/dist/domain/glossary.js +30 -0
- package/dist/domain/library.d.ts +2 -0
- package/dist/domain/library.js +83 -0
- package/dist/domain/measure.d.ts +2 -0
- package/dist/domain/measure.js +41 -0
- package/dist/domain/metric.d.ts +2 -0
- package/dist/domain/metric.js +139 -0
- package/dist/domain/moderation-review.d.ts +2 -0
- package/dist/domain/moderation-review.js +31 -0
- package/dist/domain/notification.d.ts +2 -0
- package/dist/domain/notification.js +138 -0
- package/dist/domain/parameter.d.ts +2 -0
- package/dist/domain/parameter.js +109 -0
- package/dist/domain/permission.d.ts +2 -0
- package/dist/domain/permission.js +36 -0
- package/dist/domain/pulse.d.ts +2 -0
- package/dist/domain/pulse.js +133 -0
- package/dist/domain/query.d.ts +2 -0
- package/dist/domain/query.js +13 -0
- package/dist/domain/replacement.d.ts +2 -0
- package/dist/domain/replacement.js +93 -0
- package/dist/domain/revision.d.ts +2 -0
- package/dist/domain/revision.js +63 -0
- package/dist/domain/search.d.ts +2 -0
- package/dist/domain/search.js +63 -0
- package/dist/domain/segment.d.ts +2 -0
- package/dist/domain/segment.js +44 -0
- package/dist/domain/session-properties.d.ts +2 -0
- package/dist/domain/session-properties.js +14 -0
- package/dist/domain/setting.d.ts +2 -0
- package/dist/domain/setting.js +22 -0
- package/dist/domain/setup.d.ts +2 -0
- package/dist/domain/setup.js +21 -0
- package/dist/domain/snippet.d.ts +2 -0
- package/dist/domain/snippet.js +38 -0
- package/dist/domain/table.d.ts +2 -0
- package/dist/domain/table.js +156 -0
- package/dist/domain/text.d.ts +5 -0
- package/dist/domain/text.js +6 -0
- package/dist/domain/timeline.d.ts +2 -0
- package/dist/domain/timeline.js +97 -0
- package/dist/domain/transform-dag-run.d.ts +2 -0
- package/dist/domain/transform-dag-run.js +19 -0
- package/dist/domain/transform-inspector.d.ts +2 -0
- package/dist/domain/transform-inspector.js +142 -0
- package/dist/domain/transform-job.d.ts +2 -0
- package/dist/domain/transform-job.js +109 -0
- package/dist/domain/transform-python.d.ts +2 -0
- package/dist/domain/transform-python.js +39 -0
- package/dist/domain/transform-tag.d.ts +2 -0
- package/dist/domain/transform-tag.js +17 -0
- package/dist/domain/transform-test.d.ts +2 -0
- package/dist/domain/transform-test.js +176 -0
- package/dist/domain/transform.d.ts +2 -0
- package/dist/domain/transform.js +235 -0
- package/dist/domain/upload.d.ts +2 -0
- package/dist/domain/upload.js +13 -0
- package/dist/domain/user.d.ts +2 -0
- package/dist/domain/user.js +16 -0
- package/dist/eid-translation-nuhr8St2.d.ts +143 -0
- package/dist/embedding-Cz3RUJYf.d.ts +10 -0
- package/dist/erd-BdeFEeSy.d.ts +842 -0
- package/dist/erd-BujD227Y.d.ts +51 -0
- package/dist/errors-DdMlaXqq.js +330 -0
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +189 -0
- package/dist/features-CnFkUCj2.d.ts +261 -0
- package/dist/field-BCRO19mk.d.ts +2547 -0
- package/dist/field-Bqn10Fq_.d.ts +50 -0
- package/dist/git-sync-DNXrNVCW.d.ts +258 -0
- package/dist/git-sync-gAMKsZgN.d.ts +205 -0
- package/dist/glossary-CHK3elPj.d.ts +35 -0
- package/dist/glossary-CqFlzW33.d.ts +15 -0
- package/dist/http/errors.d.ts +2 -0
- package/dist/http/errors.js +2 -0
- package/dist/http/oauth.d.ts +2 -0
- package/dist/http/oauth.js +201 -0
- package/dist/http/retry.d.ts +19 -0
- package/dist/http/retry.js +33 -0
- package/dist/http/transport.d.ts +2 -0
- package/dist/http/transport.js +2 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +62 -0
- package/dist/json-CZvjc3--.d.ts +19 -0
- package/dist/json-pointer.d.ts +4 -0
- package/dist/json-pointer.js +7 -0
- package/dist/json.d.ts +2 -0
- package/dist/json.js +44 -0
- package/dist/known-range-DTOBgTEC.d.ts +7 -0
- package/dist/library-Cx9h_RkU.d.ts +228 -0
- package/dist/list-BT_bBm9Z.d.ts +7 -0
- package/dist/list.d.ts +2 -0
- package/dist/list.js +1 -0
- package/dist/measure-CuMqPbQX.d.ts +108 -0
- package/dist/measure-KuXdjZYJ.d.ts +44 -0
- package/dist/metric-yvehaVCS.d.ts +2655 -0
- package/dist/moderation-review-B4RUTZ6_.d.ts +56 -0
- package/dist/network-error-5g4U1iul.js +62 -0
- package/dist/notification-BT2TDAd_.d.ts +379 -0
- package/dist/notification-BiegPoSD.d.ts +22 -0
- package/dist/oauth-C4ordeoJ.d.ts +59 -0
- package/dist/oauth-login-CJsT_3EE.d.ts +19 -0
- package/dist/oauth-login-D734Jvbq.js +179 -0
- package/dist/oauth-session-BlIlcd8Q.d.ts +6 -0
- package/dist/paginate-DZWvWvbm.d.ts +24 -0
- package/dist/paginate.d.ts +2 -0
- package/dist/paginate.js +49 -0
- package/dist/parameter-ak-J-IOj.d.ts +190 -0
- package/dist/permission-BnCQw5Kp.d.ts +149 -0
- package/dist/poll-CIwnee7h.d.ts +15 -0
- package/dist/poll.d.ts +2 -0
- package/dist/poll.js +47 -0
- package/dist/predicates.d.ts +10 -0
- package/dist/predicates.js +18 -0
- package/dist/pulse-CMc1Rwdj.d.ts +596 -0
- package/dist/pulse-dylocLd9.d.ts +18 -0
- package/dist/query-Xsin530u.d.ts +23 -0
- package/dist/refusal-B9aeHMc9.js +130 -0
- package/dist/replacement-CyvtbxGg.d.ts +2467 -0
- package/dist/replacement-S9U3gApY.d.ts +128 -0
- package/dist/requirement-check-CIA5IHC1.d.ts +17 -0
- package/dist/requirements-C0txASN8.d.ts +217 -0
- package/dist/resources/card.d.ts +2 -0
- package/dist/resources/card.js +103 -0
- package/dist/resources/collection.d.ts +2 -0
- package/dist/resources/collection.js +110 -0
- package/dist/resources/content-translation.d.ts +11 -0
- package/dist/resources/content-translation.js +27 -0
- package/dist/resources/csv-upload.d.ts +2 -0
- package/dist/resources/csv-upload.js +9 -0
- package/dist/resources/dashboard.d.ts +2 -0
- package/dist/resources/dashboard.js +218 -0
- package/dist/resources/data-action.d.ts +105 -0
- package/dist/resources/data-action.js +79 -0
- package/dist/resources/database.d.ts +2 -0
- package/dist/resources/database.js +103 -0
- package/dist/resources/dataset.d.ts +2 -0
- package/dist/resources/dataset.js +81 -0
- package/dist/resources/dependency.d.ts +2 -0
- package/dist/resources/dependency.js +150 -0
- package/dist/resources/document.d.ts +55 -0
- package/dist/resources/document.js +60 -0
- package/dist/resources/eid-translation.d.ts +8 -0
- package/dist/resources/eid-translation.js +19 -0
- package/dist/resources/erd.d.ts +2 -0
- package/dist/resources/erd.js +26 -0
- package/dist/resources/field.d.ts +2 -0
- package/dist/resources/field.js +98 -0
- package/dist/resources/git-sync.d.ts +2 -0
- package/dist/resources/git-sync.js +362 -0
- package/dist/resources/glossary.d.ts +2 -0
- package/dist/resources/glossary.js +51 -0
- package/dist/resources/library.d.ts +85 -0
- package/dist/resources/library.js +90 -0
- package/dist/resources/measure.d.ts +2 -0
- package/dist/resources/measure.js +57 -0
- package/dist/resources/metric.d.ts +2 -0
- package/dist/resources/metric.js +50 -0
- package/dist/resources/moderation-review.d.ts +23 -0
- package/dist/resources/moderation-review.js +24 -0
- package/dist/resources/notification.d.ts +2 -0
- package/dist/resources/notification.js +93 -0
- package/dist/resources/optional-parsed.d.ts +7 -0
- package/dist/resources/optional-parsed.js +14 -0
- package/dist/resources/permission.d.ts +10 -0
- package/dist/resources/permission.js +31 -0
- package/dist/resources/pivot-export.d.ts +10 -0
- package/dist/resources/pivot-export.js +16 -0
- package/dist/resources/pulse.d.ts +2 -0
- package/dist/resources/pulse.js +75 -0
- package/dist/resources/replacement.d.ts +2 -0
- package/dist/resources/replacement.js +82 -0
- package/dist/resources/request-body.d.ts +9 -0
- package/dist/resources/request-body.js +13 -0
- package/dist/resources/revision.d.ts +70 -0
- package/dist/resources/revision.js +51 -0
- package/dist/resources/search.d.ts +2 -0
- package/dist/resources/search.js +57 -0
- package/dist/resources/segment.d.ts +2 -0
- package/dist/resources/segment.js +55 -0
- package/dist/resources/setting.d.ts +11 -0
- package/dist/resources/setting.js +43 -0
- package/dist/resources/setup.d.ts +8 -0
- package/dist/resources/setup.js +18 -0
- package/dist/resources/snippet.d.ts +2 -0
- package/dist/resources/snippet.js +52 -0
- package/dist/resources/table.d.ts +2 -0
- package/dist/resources/table.js +275 -0
- package/dist/resources/timeline-event.d.ts +12 -0
- package/dist/resources/timeline-event.js +51 -0
- package/dist/resources/timeline.d.ts +2 -0
- package/dist/resources/timeline.js +82 -0
- package/dist/resources/transform-dag-run.d.ts +22 -0
- package/dist/resources/transform-dag-run.js +32 -0
- package/dist/resources/transform-inspector.d.ts +214 -0
- package/dist/resources/transform-inspector.js +47 -0
- package/dist/resources/transform-job.d.ts +2 -0
- package/dist/resources/transform-job.js +90 -0
- package/dist/resources/transform-python.d.ts +52 -0
- package/dist/resources/transform-python.js +56 -0
- package/dist/resources/transform-tag.d.ts +35 -0
- package/dist/resources/transform-tag.js +47 -0
- package/dist/resources/transform-test.d.ts +2 -0
- package/dist/resources/transform-test.js +75 -0
- package/dist/resources/transform.d.ts +2 -0
- package/dist/resources/transform.js +217 -0
- package/dist/resources/upload.d.ts +2 -0
- package/dist/resources/upload.js +48 -0
- package/dist/resources/user.d.ts +8 -0
- package/dist/resources/user.js +11 -0
- package/dist/revision-CQBPhohA.d.ts +104 -0
- package/dist/search-BxJipLN6.d.ts +26 -0
- package/dist/search-NZR6iRBs.d.ts +92 -0
- package/dist/segment-D2i34X9l.d.ts +16 -0
- package/dist/segment-pj3wklGe.d.ts +47 -0
- package/dist/session-properties-COtlxAcK.d.ts +15 -0
- package/dist/setting-DXuQGXGF.d.ts +25 -0
- package/dist/setup-Ez_U7GmM.d.ts +26 -0
- package/dist/signal.d.ts +8 -0
- package/dist/signal.js +25 -0
- package/dist/snippet-RnnWa4TL.d.ts +16 -0
- package/dist/snippet-hEV429Pv.d.ts +41 -0
- package/dist/table-B3-UaPHa.d.ts +3229 -0
- package/dist/table-B_lfuaHc.d.ts +176 -0
- package/dist/tag-qzjGGci8.d.ts +48 -0
- package/dist/timeline-C2IEcRlP.d.ts +21 -0
- package/dist/timeline-folD3mQ_.d.ts +218 -0
- package/dist/transform-CDurgE1D.d.ts +443 -0
- package/dist/transform-CXOT5kFe.d.ts +638 -0
- package/dist/transform-dag-run-BgZwv1yx.d.ts +49 -0
- package/dist/transform-inspector-BUYBt6--.d.ts +374 -0
- package/dist/transform-job-29P6BULe.d.ts +237 -0
- package/dist/transform-job-CTJImaOd.d.ts +96 -0
- package/dist/transform-python-DdDnW6yK.d.ts +56 -0
- package/dist/transform-tag-DVUIZTEM.d.ts +25 -0
- package/dist/transform-test-A-CJYT6B.d.ts +412 -0
- package/dist/transform-test-BwuyrHpT.d.ts +346 -0
- package/dist/transport-E0ZaPNWJ.d.ts +462 -0
- package/dist/transport-HP7cyo9N.js +397 -0
- package/dist/upload-B7PG3ePk.d.ts +12 -0
- package/dist/upload-UPfZFdbH.d.ts +22 -0
- package/dist/url-CI0pxHOc.d.ts +7 -0
- package/dist/url.d.ts +2 -0
- package/dist/url.js +34 -0
- package/dist/user-2r0OBoO6.d.ts +18 -0
- package/dist/version/capability-error.d.ts +2 -0
- package/dist/version/capability-error.js +42 -0
- package/dist/version/features.d.ts +2 -0
- package/dist/version/features.js +143 -0
- package/dist/version/known-range.d.ts +2 -0
- package/dist/version/known-range.js +7 -0
- package/dist/version/probe.d.ts +2 -0
- package/dist/version/probe.js +30 -0
- package/dist/version/profile.d.ts +2 -0
- package/dist/version/profile.js +64 -0
- package/dist/version/requirement-check.d.ts +2 -0
- package/dist/version/requirement-check.js +62 -0
- package/dist/version/requirements.d.ts +2 -0
- package/dist/version/requirements.js +219 -0
- package/dist/version/tag.d.ts +2 -0
- package/dist/version/tag.js +52 -0
- package/package.json +65 -4
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { paginatePages } from "../paginate.js";
|
|
2
|
+
import { t as explainer } from "../refusal-B9aeHMc9.js";
|
|
3
|
+
import { BreakingSource, DependencyEntity, DependencyGraph, DependencyNode } from "../domain/dependency.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/resources/dependency.ts
|
|
6
|
+
const DependencyNodeApiList = z.array(DependencyNode);
|
|
7
|
+
const DependencyEntityApiList = z.array(DependencyEntity);
|
|
8
|
+
function graphTypeFeatures(type) {
|
|
9
|
+
return type === "measure" ? [{
|
|
10
|
+
feature: "measureDependencyGraph",
|
|
11
|
+
fields: ["type"]
|
|
12
|
+
}] : [];
|
|
13
|
+
}
|
|
14
|
+
function dependencyResource(transport) {
|
|
15
|
+
const { explain, explainWalk } = explainer(transport, "dependency");
|
|
16
|
+
/**
|
|
17
|
+
* The upstream dependency graph of one entity. `nodes` holds the starting entity plus every
|
|
18
|
+
* entity it depends on, directly or transitively; each edge runs from the dependent to what it
|
|
19
|
+
* depends on. A measure starts a graph only on a server with `measureDependencyGraph`.
|
|
20
|
+
*/
|
|
21
|
+
async function graph(type, id, options = {}) {
|
|
22
|
+
return transport.requestParsed(DependencyGraph, "/api/ee/dependencies/graph", {
|
|
23
|
+
...options,
|
|
24
|
+
query: {
|
|
25
|
+
type,
|
|
26
|
+
id
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The entities that depend directly on one entity. `dependent-types` and `dependent-card-types`
|
|
32
|
+
* narrow which kinds are listed, `broken` keeps only those whose query the entity has broken,
|
|
33
|
+
* `query` matches against names and locations, `include-personal-collections` admits content in
|
|
34
|
+
* personal collections, and `sort-column` / `sort-direction` order the result.
|
|
35
|
+
*/
|
|
36
|
+
async function dependents(type, id, params = {}, options = {}) {
|
|
37
|
+
return {
|
|
38
|
+
data: await transport.requestParsed(DependencyNodeApiList, "/api/ee/dependencies/graph/dependents", {
|
|
39
|
+
...options,
|
|
40
|
+
query: {
|
|
41
|
+
type,
|
|
42
|
+
id,
|
|
43
|
+
"dependent-types": params["dependent-types"],
|
|
44
|
+
"dependent-card-types": params["dependent-card-types"],
|
|
45
|
+
broken: params.broken,
|
|
46
|
+
query: params.query,
|
|
47
|
+
"include-personal-collections": params["include-personal-collections"],
|
|
48
|
+
"sort-column": params["sort-column"],
|
|
49
|
+
"sort-direction": params["sort-direction"]
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
total: null
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The dependents of one entity whose queries it has broken, as bare entities without a
|
|
57
|
+
* dependents count. `dependent-types` and `dependent-card-types` narrow which kinds are listed,
|
|
58
|
+
* `include-personal-collections` admits content in personal collections, and `sort-column` /
|
|
59
|
+
* `sort-direction` order the result.
|
|
60
|
+
*/
|
|
61
|
+
async function broken(type, id, params = {}, options = {}) {
|
|
62
|
+
return {
|
|
63
|
+
data: await transport.requestParsed(DependencyEntityApiList, "/api/ee/dependencies/graph/broken", {
|
|
64
|
+
...options,
|
|
65
|
+
query: {
|
|
66
|
+
type,
|
|
67
|
+
id,
|
|
68
|
+
"dependent-types": params["dependent-types"],
|
|
69
|
+
"dependent-card-types": params["dependent-card-types"],
|
|
70
|
+
"include-personal-collections": params["include-personal-collections"],
|
|
71
|
+
"sort-column": params["sort-column"],
|
|
72
|
+
"sort-direction": params["sort-direction"]
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
total: null
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Walk the entities that no readable, unarchived dependent depends on, one page at a time: an
|
|
80
|
+
* entity used only by archived content, or by content the caller cannot read, is listed. `types`
|
|
81
|
+
* and `card-types` narrow which kinds are listed, `query` matches against names and locations,
|
|
82
|
+
* `include-personal-collections` admits content in personal collections, and `sort-column` /
|
|
83
|
+
* `sort-direction` order the result. A `query` leaves sandboxes out, since they have no name or
|
|
84
|
+
* location to match, so sandboxes alone with a `query` answer one empty page without a request.
|
|
85
|
+
* This endpoint pages on the server, so the caller consumes pages and decides how far to pull.
|
|
86
|
+
*/
|
|
87
|
+
async function* unreferencedPages(params = {}, options = {}) {
|
|
88
|
+
if (queryLeavesNoKind(params)) {
|
|
89
|
+
yield {
|
|
90
|
+
items: [],
|
|
91
|
+
total: 0
|
|
92
|
+
};
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
yield* paginatePages(transport, "/api/ee/dependencies/graph/unreferenced", DependencyNode, {
|
|
96
|
+
query: itemListQuery(params),
|
|
97
|
+
...options.offset !== void 0 && { offset: options.offset },
|
|
98
|
+
...options.max !== void 0 && { max: options.max },
|
|
99
|
+
...options.pageSize !== void 0 && { pageSize: options.pageSize },
|
|
100
|
+
...options.signal !== void 0 && { signal: options.signal }
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Walk the entities whose dependents carry analysis errors, one page at a time, each with the
|
|
105
|
+
* `dependents_errors` rows found downstream of it. The server lists cards and tables unless
|
|
106
|
+
* `types` says otherwise; `card-types`, `query`, `include-personal-collections`, `sort-column`
|
|
107
|
+
* and `sort-direction` read as on `unreferencedPages`. This endpoint pages on the server, so the
|
|
108
|
+
* caller consumes pages and decides how far to pull.
|
|
109
|
+
*/
|
|
110
|
+
async function* breakingPages(params = {}, options = {}) {
|
|
111
|
+
if (queryLeavesNoKind(params)) {
|
|
112
|
+
yield {
|
|
113
|
+
items: [],
|
|
114
|
+
total: 0
|
|
115
|
+
};
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
yield* paginatePages(transport, "/api/ee/dependencies/graph/breaking", BreakingSource, {
|
|
119
|
+
query: itemListQuery(params),
|
|
120
|
+
...options.offset !== void 0 && { offset: options.offset },
|
|
121
|
+
...options.max !== void 0 && { max: options.max },
|
|
122
|
+
...options.pageSize !== void 0 && { pageSize: options.pageSize },
|
|
123
|
+
...options.signal !== void 0 && { signal: options.signal }
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
graph: explain("graph", graph, graphTypeFeatures),
|
|
128
|
+
dependents: explain("dependents", dependents),
|
|
129
|
+
broken: explain("broken", broken),
|
|
130
|
+
unreferencedPages: explainWalk("unreferencedPages", unreferencedPages),
|
|
131
|
+
breakingPages: explainWalk("breakingPages", breakingPages)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function queryLeavesNoKind(params) {
|
|
135
|
+
const { query, types } = params;
|
|
136
|
+
if (query === void 0 || types === void 0 || types.length === 0) return false;
|
|
137
|
+
return types.every((type) => type === "sandbox");
|
|
138
|
+
}
|
|
139
|
+
function itemListQuery(params) {
|
|
140
|
+
return {
|
|
141
|
+
types: params.types === void 0 ? void 0 : [...new Set(params.types)],
|
|
142
|
+
"card-types": params["card-types"],
|
|
143
|
+
query: params.query,
|
|
144
|
+
"include-personal-collections": params["include-personal-collections"],
|
|
145
|
+
"sort-column": params["sort-column"],
|
|
146
|
+
"sort-direction": params["sort-direction"]
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
export { dependencyResource };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { f as RequestOptions, h as Transport } from "../transport-E0ZaPNWJ.js";
|
|
2
|
+
import { t as ListResult } from "../list-BT_bBm9Z.js";
|
|
3
|
+
import { a as DocumentUpdateInput, i as DocumentCreateInput, t as Document } from "../document-oZNDbDfx.js";
|
|
4
|
+
//#region src/resources/document.d.ts
|
|
5
|
+
declare function documentResource(transport: Transport): {
|
|
6
|
+
list: (options?: RequestOptions) => Promise<ListResult<Document>>;
|
|
7
|
+
get: (id: number, options?: RequestOptions) => Promise<Document>;
|
|
8
|
+
create: (params: DocumentCreateInput, options?: RequestOptions) => Promise<Document>;
|
|
9
|
+
update: (id: number, params: DocumentUpdateInput, options?: RequestOptions) => Promise<Document>;
|
|
10
|
+
archive: (id: number, options?: RequestOptions) => Promise<Document>;
|
|
11
|
+
copy: (id: number, params?: {
|
|
12
|
+
name?: string | null | undefined;
|
|
13
|
+
collection_id?: number | null | undefined;
|
|
14
|
+
collection_position?: number | null | undefined;
|
|
15
|
+
} | undefined, options?: RequestOptions | undefined) => Promise<{
|
|
16
|
+
[x: string]: unknown;
|
|
17
|
+
id: number;
|
|
18
|
+
name: string;
|
|
19
|
+
document: {
|
|
20
|
+
[x: string]: unknown;
|
|
21
|
+
type: string;
|
|
22
|
+
text?: string | undefined;
|
|
23
|
+
attrs?: Record<string, unknown> | undefined;
|
|
24
|
+
marks?: Record<string, unknown>[] | undefined;
|
|
25
|
+
content?: {
|
|
26
|
+
[x: string]: unknown;
|
|
27
|
+
type: string;
|
|
28
|
+
text?: string | undefined;
|
|
29
|
+
attrs?: Record<string, unknown> | undefined;
|
|
30
|
+
marks?: Record<string, unknown>[] | undefined;
|
|
31
|
+
content?: /*elided*/ any[] | undefined;
|
|
32
|
+
}[] | undefined;
|
|
33
|
+
} | null;
|
|
34
|
+
entity_id: string | null;
|
|
35
|
+
collection_id: number | null;
|
|
36
|
+
creator_id: number;
|
|
37
|
+
archived: boolean;
|
|
38
|
+
created_at: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
collection_position?: number | null | undefined;
|
|
41
|
+
creator?: {
|
|
42
|
+
[x: string]: unknown;
|
|
43
|
+
id: number;
|
|
44
|
+
email: string;
|
|
45
|
+
first_name: string | null;
|
|
46
|
+
last_name: string | null;
|
|
47
|
+
} | null | undefined;
|
|
48
|
+
can_write?: boolean | undefined;
|
|
49
|
+
can_delete?: boolean | undefined;
|
|
50
|
+
can_restore?: boolean | undefined;
|
|
51
|
+
is_remote_synced?: boolean | undefined;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { documentResource };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as explainer } from "../refusal-B9aeHMc9.js";
|
|
2
|
+
import { Document } from "../domain/document.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/resources/document.ts
|
|
5
|
+
const DocumentApiList = z.object({ items: z.array(Document) }).loose();
|
|
6
|
+
function documentResource(transport) {
|
|
7
|
+
const { explain } = explainer(transport, "document");
|
|
8
|
+
/** Get existing documents. */
|
|
9
|
+
async function list(options = {}) {
|
|
10
|
+
return {
|
|
11
|
+
data: (await transport.requestParsed(DocumentApiList, "/api/document", { ...options })).items,
|
|
12
|
+
total: null
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Return an existing document by id. */
|
|
16
|
+
async function get(id, options = {}) {
|
|
17
|
+
return transport.requestParsed(Document, `/api/document/${id}`, { ...options });
|
|
18
|
+
}
|
|
19
|
+
/** Create a new document. */
|
|
20
|
+
async function create(params, options = {}) {
|
|
21
|
+
return transport.requestParsed(Document, "/api/document", {
|
|
22
|
+
...options,
|
|
23
|
+
method: "POST",
|
|
24
|
+
body: params
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** Update an existing document by id. */
|
|
28
|
+
async function update(id, params, options = {}) {
|
|
29
|
+
return transport.requestParsed(Document, `/api/document/${id}`, {
|
|
30
|
+
...options,
|
|
31
|
+
method: "PUT",
|
|
32
|
+
body: params
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** Archive (soft-delete) a document by id. Metabase models this as an update, not its own endpoint. */
|
|
36
|
+
async function archive(id, options = {}) {
|
|
37
|
+
return update(id, { archived: true }, options);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Copy a document into `collection_id` (root when absent), duplicating the cards saved inside
|
|
41
|
+
* it. An archived source is not found.
|
|
42
|
+
*/
|
|
43
|
+
async function copy(id, params = {}, options = {}) {
|
|
44
|
+
return transport.requestParsed(Document, `/api/document/${id}/copy`, {
|
|
45
|
+
...options,
|
|
46
|
+
method: "POST",
|
|
47
|
+
body: params
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
list,
|
|
52
|
+
get,
|
|
53
|
+
create,
|
|
54
|
+
update,
|
|
55
|
+
archive,
|
|
56
|
+
copy: explain("copy", copy)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { documentResource };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { f as RequestOptions, h as Transport } from "../transport-E0ZaPNWJ.js";
|
|
2
|
+
import { a as EidTranslateResult, i as EidTranslateInput } from "../eid-translation-nuhr8St2.js";
|
|
3
|
+
//#region src/resources/eid-translation.d.ts
|
|
4
|
+
declare function eidTranslationResource(transport: Transport): {
|
|
5
|
+
translate: (params: EidTranslateInput, options?: RequestOptions) => Promise<EidTranslateResult>;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { eidTranslationResource };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EidTranslateResult } from "../domain/eid-translation.js";
|
|
2
|
+
//#region src/resources/eid-translation.ts
|
|
3
|
+
function eidTranslationResource(transport) {
|
|
4
|
+
/**
|
|
5
|
+
* Translate entity ids to the numeric ids of the rows they name. The request groups the entity
|
|
6
|
+
* ids by model; the response is keyed by entity id, each entry carrying its model and — when the
|
|
7
|
+
* lookup succeeded — the numeric id.
|
|
8
|
+
*/
|
|
9
|
+
async function translate(params, options = {}) {
|
|
10
|
+
return transport.requestParsed(EidTranslateResult, "/api/eid-translation/translate", {
|
|
11
|
+
...options,
|
|
12
|
+
method: "POST",
|
|
13
|
+
body: params
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return { translate };
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { eidTranslationResource };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { t as explainer } from "../refusal-B9aeHMc9.js";
|
|
2
|
+
import { Erd } from "../domain/erd.js";
|
|
3
|
+
//#region src/resources/erd.ts
|
|
4
|
+
const ERD_PATH = "/api/ee/erd";
|
|
5
|
+
function erdResource(transport) {
|
|
6
|
+
const { explain } = explainer(transport, "erd");
|
|
7
|
+
/**
|
|
8
|
+
* Get the entity relationship diagram of a database: the readable tables as nodes, each with its
|
|
9
|
+
* fields, and the foreign keys between them as edges. `table-ids` makes those tables the focal
|
|
10
|
+
* points and draws their neighbours; `schema` keeps one schema, the empty string the tables with
|
|
11
|
+
* none.
|
|
12
|
+
*/
|
|
13
|
+
async function get(params, options = {}) {
|
|
14
|
+
return transport.requestParsed(Erd, ERD_PATH, {
|
|
15
|
+
...options,
|
|
16
|
+
query: {
|
|
17
|
+
"database-id": params["database-id"],
|
|
18
|
+
"table-ids": params["table-ids"],
|
|
19
|
+
schema: params.schema
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return { get: explain("get", get) };
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { erdResource };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as FieldSetDataSensitivityParams, i as FieldSearchParams, n as FieldSearchBounded, o as fieldResource, r as FieldSearchByValue, t as FieldRemappingParams } from "../field-Bqn10Fq_.js";
|
|
2
|
+
export { FieldRemappingParams, FieldSearchBounded, FieldSearchByValue, FieldSearchParams, FieldSetDataSensitivityParams, fieldResource };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { FieldSearchMatches, FieldValues, FieldWithDataSensitivity, fieldDetailSchema, fieldRemappedValueSchema } from "../domain/field.js";
|
|
2
|
+
import { t as explainer } from "../refusal-B9aeHMc9.js";
|
|
3
|
+
import { fetchOptionalParsed } from "./optional-parsed.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/resources/field.ts
|
|
6
|
+
const FieldApiSummary = z.tuple([z.tuple([z.literal("count"), z.number().int()]), z.tuple([z.literal("distincts"), z.number().int()])]);
|
|
7
|
+
function fieldResource(transport) {
|
|
8
|
+
const { refuse } = explainer(transport, "field");
|
|
9
|
+
/**
|
|
10
|
+
* Get one field by id. A server that labels data sensitivity answers `data_sensitivity`, `null`
|
|
11
|
+
* for an unlabelled field; any other answers the field without the key (`hasDataSensitivity`).
|
|
12
|
+
*/
|
|
13
|
+
async function get(id, options = {}) {
|
|
14
|
+
const { features } = await transport.server(options);
|
|
15
|
+
return transport.requestParsed(fieldDetailSchema(features), `/api/field/${id}`, { ...options });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Update a field by id, patching only the fields the body carries. A `data_sensitivity` label is
|
|
19
|
+
* a person's call the server's classifier never overwrites, and `null` withdraws it so the
|
|
20
|
+
* classifier's own applies again; a server without the column would drop the key silently, so
|
|
21
|
+
* the label is refused there before the wire. Answers the field the way `get` does.
|
|
22
|
+
*/
|
|
23
|
+
async function update(id, params, options = {}) {
|
|
24
|
+
await transport.requireFeatures(params.data_sensitivity === void 0 ? [] : ["fieldDataSensitivity"], options);
|
|
25
|
+
const { features } = await transport.server(options);
|
|
26
|
+
return transport.requestParsed(fieldDetailSchema(features), `/api/field/${id}`, {
|
|
27
|
+
...options,
|
|
28
|
+
method: "PUT",
|
|
29
|
+
body: params
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Label a field's data sensitivity by hand. A person's label is never overwritten by the server's
|
|
34
|
+
* classifier; `null` withdraws it, so whatever label the classifier wrote shows again. A server
|
|
35
|
+
* without the column drops the key silently, so the label is refused there before the wire.
|
|
36
|
+
* Answers the field with the label it now carries.
|
|
37
|
+
*/
|
|
38
|
+
async function setDataSensitivity(id, params, options = {}) {
|
|
39
|
+
return transport.requestParsed(FieldWithDataSensitivity, `/api/field/${id}`, {
|
|
40
|
+
...options,
|
|
41
|
+
method: "PUT",
|
|
42
|
+
body: params
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Search the values of `searchId` that contain `value`, case-insensitively, answering the
|
|
47
|
+
* matching values of `id` paired with them, ordered by value, at most `limit` of them. An FK on
|
|
48
|
+
* either side is followed to the PK it points at, and a field that resolves to the same field as
|
|
49
|
+
* `searchId` answers each value alone. Without `value`, the first `limit` values. A field with
|
|
50
|
+
* custom display values answers every mapped value with its display value instead, matching
|
|
51
|
+
* `value` against the display value, ignoring both `searchId` and `limit`.
|
|
52
|
+
*/
|
|
53
|
+
async function search(id, searchId, params, options = {}) {
|
|
54
|
+
return transport.requestParsed(FieldSearchMatches, `/api/field/${id}/search/${searchId}`, {
|
|
55
|
+
...options,
|
|
56
|
+
query: {
|
|
57
|
+
value: params.value,
|
|
58
|
+
limit: params.limit
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The value of `remappedId` on the one row where `id` equals `value`, as `[value, remapped]`,
|
|
64
|
+
* or `null` when no row matches. For a numeric field the server reads the leading number of
|
|
65
|
+
* `value` and ignores any text after it, refusing only a `value` that has none.
|
|
66
|
+
*/
|
|
67
|
+
async function remapping(id, remappedId, params, options = {}) {
|
|
68
|
+
const { features } = await transport.server(options);
|
|
69
|
+
return fetchOptionalParsed(transport, `/api/field/${id}/remapping/${remappedId}`, fieldRemappedValueSchema(features, id === remappedId), {
|
|
70
|
+
...options,
|
|
71
|
+
query: { value: params.value }
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** Get the row count and the distinct-value count for a field. */
|
|
75
|
+
async function summary(id, options = {}) {
|
|
76
|
+
const [[, count], [, distincts]] = await transport.requestParsed(FieldApiSummary, `/api/field/${id}/summary`, { ...options });
|
|
77
|
+
return {
|
|
78
|
+
field_id: id,
|
|
79
|
+
count,
|
|
80
|
+
distincts
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** Get the cached distinct values Metabase holds for a field. */
|
|
84
|
+
async function values(id, options = {}) {
|
|
85
|
+
return transport.requestParsed(FieldValues, `/api/field/${id}/values`, { ...options });
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
get,
|
|
89
|
+
update,
|
|
90
|
+
setDataSensitivity: refuse("setDataSensitivity", setDataSensitivity),
|
|
91
|
+
search,
|
|
92
|
+
remapping,
|
|
93
|
+
summary,
|
|
94
|
+
values
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { fieldResource };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as SyncRemoteChangesParams, c as SyncWaitParams, i as SyncImportParams, l as gitSyncResource, n as SyncExportParams, o as SyncScopeCollection, r as SyncExportPreflightParams, s as SyncStashParams, t as SyncCreateBranchParams } from "../git-sync-gAMKsZgN.js";
|
|
2
|
+
export { SyncCreateBranchParams, SyncExportParams, SyncExportPreflightParams, SyncImportParams, SyncRemoteChangesParams, SyncScopeCollection, SyncStashParams, SyncWaitParams, gitSyncResource };
|