@metabase/client 0.0.0-stage → 0.1.1
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 +28 -0
- package/LICENSE +661 -0
- package/README.md +490 -2
- package/dist/api-key-DJeN1-7G.d.ts +46 -0
- 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-BxBzr5Uj.d.ts +1392 -0
- package/dist/card-DN0sLkCG.d.ts +33 -0
- package/dist/client-DdXLlH1B.d.ts +3380 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +99 -0
- package/dist/collection-DGnTvD6R.d.ts +294 -0
- package/dist/collection-fFahL-ub.d.ts +53 -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-CM7RmNeE.d.ts +38 -0
- package/dist/dashboard-DtLXVgtf.d.ts +978 -0
- package/dist/data-action-CkXVrOUH.d.ts +97 -0
- package/dist/data-app-CqP5_fpB.d.ts +76 -0
- package/dist/database-B0JNZjDN.d.ts +27 -0
- package/dist/database-BxqDmfcj.d.ts +997 -0
- package/dist/dataset-BBNGPVec.d.ts +4144 -0
- package/dist/dataset-BUirJ1rO.d.ts +23 -0
- package/dist/dependency-CzpXmeu7.d.ts +299 -0
- package/dist/dependency-arB8Cr2H.d.ts +879 -0
- package/dist/document-tLd6pYWe.d.ts +115 -0
- package/dist/domain/api-key.d.ts +2 -0
- package/dist/domain/api-key.js +31 -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 +211 -0
- package/dist/domain/data-action.d.ts +2 -0
- package/dist/domain/data-action.js +91 -0
- package/dist/domain/data-app.d.ts +2 -0
- package/dist/domain/data-app.js +52 -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 +168 -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 +274 -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 +89 -0
- package/dist/domain/measure.d.ts +2 -0
- package/dist/domain/measure.js +43 -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 +143 -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 +140 -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 +90 -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 +46 -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 +187 -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 +115 -0
- package/dist/domain/transform-python.d.ts +2 -0
- package/dist/domain/transform-python.js +51 -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 +304 -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-CH6NPWd-.d.ts +143 -0
- package/dist/embedding-oU3gqfgX.d.ts +10 -0
- package/dist/erd-BdeFEeSy.d.ts +842 -0
- package/dist/erd-CbV7xvAc.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-SMSfJhB6.d.ts +295 -0
- package/dist/field-D1Pfk-0S.d.ts +50 -0
- package/dist/field-p9Rme2zB.d.ts +2549 -0
- package/dist/git-sync-BTf1aYHr.d.ts +205 -0
- package/dist/git-sync-C99SVdJ9.d.ts +258 -0
- package/dist/glossary-CHK3elPj.d.ts +35 -0
- package/dist/glossary-DFvnz-E5.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 +62 -0
- package/dist/index.js +64 -0
- package/dist/input-gate-registry-Dai7SfXb.js +14 -0
- package/dist/input-gates-DwKoTJVQ.d.ts +28 -0
- package/dist/json-BksZpXDC.d.ts +19 -0
- package/dist/json-pointer.d.ts +5 -0
- package/dist/json-pointer.js +10 -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-B9pEq7qP.d.ts +230 -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-CgH14YQZ.d.ts +44 -0
- package/dist/measure-lPz8qnwz.d.ts +108 -0
- package/dist/metric-DcYloqOQ.d.ts +2655 -0
- package/dist/moderation-review-B4RUTZ6_.d.ts +56 -0
- package/dist/network-error-5g4U1iul.js +62 -0
- package/dist/notification-Cp5GJErS.d.ts +22 -0
- package/dist/notification-D1MThyKE.d.ts +443 -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-COuL0Gzl.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-0LG3K6qO.d.ts +598 -0
- package/dist/pulse-BzKmz3Yn.d.ts +18 -0
- package/dist/query-Xsin530u.d.ts +23 -0
- package/dist/refusal-B9aeHMc9.js +130 -0
- package/dist/replacement-BGyggp-G.d.ts +2467 -0
- package/dist/replacement-CVebCuNp.d.ts +128 -0
- package/dist/requirement-check-glU7wqhQ.d.ts +17 -0
- package/dist/requirements-Dx_ZVzl7.d.ts +227 -0
- package/dist/resources/api-key.d.ts +11 -0
- package/dist/resources/api-key.js +35 -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 +134 -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 +221 -0
- package/dist/resources/data-action.d.ts +60 -0
- package/dist/resources/data-action.js +79 -0
- package/dist/resources/data-app.d.ts +112 -0
- package/dist/resources/data-app.js +75 -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 +156 -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 +99 -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 +76 -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 +46 -0
- package/dist/resources/search.d.ts +2 -0
- package/dist/resources/search.js +78 -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 +274 -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 +59 -0
- package/dist/resources/transform-python.js +57 -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 +227 -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-Dyl-8p7d.d.ts +106 -0
- package/dist/search-Cm5IxKss.d.ts +92 -0
- package/dist/search-Cten2h0I.d.ts +26 -0
- package/dist/segment-CbAgVO-5.d.ts +47 -0
- package/dist/segment-DQLX6r1E.d.ts +16 -0
- package/dist/session-properties-COtlxAcK.d.ts +15 -0
- package/dist/setting-DXuQGXGF.d.ts +25 -0
- package/dist/setup-JqcJ2unJ.d.ts +26 -0
- package/dist/signal.d.ts +8 -0
- package/dist/signal.js +25 -0
- package/dist/snippet-C_Ilx7tR.d.ts +41 -0
- package/dist/snippet-Djn0rL21.d.ts +16 -0
- package/dist/table-CDZbLNow.d.ts +176 -0
- package/dist/table-Od6uvDVW.d.ts +3234 -0
- package/dist/tag-qzjGGci8.d.ts +48 -0
- package/dist/timeline-BK45hy-h.d.ts +218 -0
- package/dist/timeline-BTs6fuRp.d.ts +21 -0
- package/dist/transform-C5thnJwW.d.ts +559 -0
- package/dist/transform-WASQAXeA.d.ts +652 -0
- package/dist/transform-dag-run-BgZwv1yx.d.ts +49 -0
- package/dist/transform-inspector-CMCh8WKV.d.ts +374 -0
- package/dist/transform-job-D8jTQtdX.d.ts +98 -0
- package/dist/transform-job-DmTwKxhc.d.ts +237 -0
- package/dist/transform-python-DtL3xxMj.d.ts +101 -0
- package/dist/transform-tag-C6j5EUkX.d.ts +25 -0
- package/dist/transform-test-CR_i54IV.d.ts +412 -0
- package/dist/transform-test-CeMzDpUC.d.ts +346 -0
- package/dist/transport-BsXqRujn.d.ts +476 -0
- package/dist/transport-HP7cyo9N.js +397 -0
- package/dist/upload-B5YjVkSW.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-Sqqv7rqh.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 +171 -0
- package/dist/version/input-gates.d.ts +2 -0
- package/dist/version/input-gates.js +13 -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 +229 -0
- package/dist/version/tag.d.ts +2 -0
- package/dist/version/tag.js +52 -0
- package/package.json +66 -4
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/moderation-review.d.ts
|
|
3
|
+
declare const ModeratedItemType: z.ZodEnum<{
|
|
4
|
+
card: "card";
|
|
5
|
+
dashboard: "dashboard";
|
|
6
|
+
}>;
|
|
7
|
+
type ModeratedItemType = z.infer<typeof ModeratedItemType>;
|
|
8
|
+
declare const ModerationStatus: z.ZodEnum<{
|
|
9
|
+
verified: "verified";
|
|
10
|
+
}>;
|
|
11
|
+
type ModerationStatus = z.infer<typeof ModerationStatus>;
|
|
12
|
+
declare const ModerationReview: z.ZodObject<{
|
|
13
|
+
id: z.ZodNumber;
|
|
14
|
+
moderated_item_id: z.ZodNumber;
|
|
15
|
+
moderated_item_type: z.ZodEnum<{
|
|
16
|
+
card: "card";
|
|
17
|
+
dashboard: "dashboard";
|
|
18
|
+
}>;
|
|
19
|
+
moderator_id: z.ZodNumber;
|
|
20
|
+
status: z.ZodNullable<z.ZodEnum<{
|
|
21
|
+
verified: "verified";
|
|
22
|
+
}>>;
|
|
23
|
+
text: z.ZodNullable<z.ZodString>;
|
|
24
|
+
most_recent: z.ZodBoolean;
|
|
25
|
+
created_at: z.ZodString;
|
|
26
|
+
updated_at: z.ZodString;
|
|
27
|
+
}, z.core.$loose>;
|
|
28
|
+
type ModerationReview = z.infer<typeof ModerationReview>;
|
|
29
|
+
declare const ModerationReviewCompact: z.ZodObject<{
|
|
30
|
+
id: z.ZodNumber;
|
|
31
|
+
text: z.ZodNullable<z.ZodString>;
|
|
32
|
+
status: z.ZodNullable<z.ZodEnum<{
|
|
33
|
+
verified: "verified";
|
|
34
|
+
}>>;
|
|
35
|
+
moderated_item_type: z.ZodEnum<{
|
|
36
|
+
card: "card";
|
|
37
|
+
dashboard: "dashboard";
|
|
38
|
+
}>;
|
|
39
|
+
moderated_item_id: z.ZodNumber;
|
|
40
|
+
most_recent: z.ZodBoolean;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
type ModerationReviewCompact = z.infer<typeof ModerationReviewCompact>;
|
|
43
|
+
declare const ModerationReviewCreateInput: z.ZodObject<{
|
|
44
|
+
moderated_item_id: z.ZodNumber;
|
|
45
|
+
moderated_item_type: z.ZodEnum<{
|
|
46
|
+
card: "card";
|
|
47
|
+
dashboard: "dashboard";
|
|
48
|
+
}>;
|
|
49
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
50
|
+
verified: "verified";
|
|
51
|
+
}>>>;
|
|
52
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
type ModerationReviewCreateInput = z.infer<typeof ModerationReviewCreateInput>;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { ModerationStatus as a, ModerationReviewCreateInput as i, ModerationReview as n, ModerationReviewCompact as r, ModeratedItemType as t };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { NetworkError, errorMessage } from "./errors.js";
|
|
2
|
+
//#region src/http/network-error.ts
|
|
3
|
+
const NETWORK_HINTS = {
|
|
4
|
+
ECONNREFUSED: (t) => `Connection refused by ${t.host} — is Metabase running and is the port correct?`,
|
|
5
|
+
ENOTFOUND: (t) => `Host not found: ${t.hostname} — check the URL.`,
|
|
6
|
+
EAI_AGAIN: (t) => `Could not resolve ${t.hostname} — check your network connection and the URL.`,
|
|
7
|
+
ECONNRESET: (t) => `Connection to ${t.host} was reset — the server may have closed it, or http/https may be mismatched.`,
|
|
8
|
+
UND_ERR_SOCKET: (t) => `Connection to ${t.host} was closed by the other side — a pooled connection or a proxy may have dropped it.`,
|
|
9
|
+
EPIPE: (t) => `Connection to ${t.host} closed while the request was still being written — the server or a proxy dropped it.`,
|
|
10
|
+
ETIMEDOUT: (t) => `Connection to ${t.host} timed out — check the host, port, and your network.`
|
|
11
|
+
};
|
|
12
|
+
const CONNECTION_CLOSED_CODES = /* @__PURE__ */ new Set([
|
|
13
|
+
"ECONNRESET",
|
|
14
|
+
"UND_ERR_SOCKET",
|
|
15
|
+
"EPIPE"
|
|
16
|
+
]);
|
|
17
|
+
const TLS_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
18
|
+
"EPROTO",
|
|
19
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
20
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
21
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
22
|
+
"CERT_HAS_EXPIRED",
|
|
23
|
+
"ERR_TLS_CERT_ALTNAME_INVALID"
|
|
24
|
+
]);
|
|
25
|
+
function buildNetworkError(error, method, url) {
|
|
26
|
+
const fallback = errorMessage(error);
|
|
27
|
+
const code = failureCode(error);
|
|
28
|
+
return new NetworkError(networkMessage(code, networkTarget(url), fallback), {
|
|
29
|
+
method,
|
|
30
|
+
url,
|
|
31
|
+
cause: code ?? fallback
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function isConnectionClosed(error) {
|
|
35
|
+
const code = failureCode(error);
|
|
36
|
+
return code !== null && CONNECTION_CLOSED_CODES.has(code);
|
|
37
|
+
}
|
|
38
|
+
function networkMessage(code, target, fallback) {
|
|
39
|
+
if (code === null) return `Could not reach Metabase: ${fallback}`;
|
|
40
|
+
if (TLS_ERROR_CODES.has(code)) return `Could not reach Metabase: TLS error contacting ${target.host} (${code}) — the certificate could not be verified, or https:// was used against a plain-HTTP server. For a certificate the OS does not trust either, set NODE_EXTRA_CA_CERTS to its CA bundle.`;
|
|
41
|
+
const hint = NETWORK_HINTS[code];
|
|
42
|
+
if (hint === void 0) return `Could not reach Metabase: ${fallback} (${code})`;
|
|
43
|
+
return `Could not reach Metabase: ${hint(target)}`;
|
|
44
|
+
}
|
|
45
|
+
function failureCode(error) {
|
|
46
|
+
const own = errorCode(error);
|
|
47
|
+
if (own !== null) return own;
|
|
48
|
+
return errorCode(error instanceof Error ? error.cause : void 0);
|
|
49
|
+
}
|
|
50
|
+
function errorCode(value) {
|
|
51
|
+
if (value instanceof Error && "code" in value && typeof value.code === "string") return value.code;
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function networkTarget(url) {
|
|
55
|
+
const parsed = new URL(url);
|
|
56
|
+
return {
|
|
57
|
+
host: parsed.host,
|
|
58
|
+
hostname: parsed.hostname
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { isConnectionClosed as n, buildNetworkError as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { f as RequestOptions, h as Transport } from "./transport-BsXqRujn.js";
|
|
2
|
+
import { t as ListResult } from "./list-BT_bBm9Z.js";
|
|
3
|
+
import { l as NotificationCreateInput, r as Notification, t as AnyNotification, x as NotificationUpdateInput } from "./notification-D1MThyKE.js";
|
|
4
|
+
//#region src/resources/notification.d.ts
|
|
5
|
+
interface NotificationListParams {
|
|
6
|
+
card_id?: number | undefined;
|
|
7
|
+
creator_id?: number | undefined;
|
|
8
|
+
recipient_id?: number | undefined;
|
|
9
|
+
include_inactive?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
declare function assertCardAlert(notification: AnyNotification): Notification;
|
|
12
|
+
declare function mergeAlertUpdate(current: Notification, patch: NotificationUpdateInput): Notification;
|
|
13
|
+
declare function notificationResource(transport: Transport): {
|
|
14
|
+
list: (params?: NotificationListParams, options?: RequestOptions) => Promise<ListResult<Notification>>;
|
|
15
|
+
get: (id: number, options?: RequestOptions) => Promise<Notification>;
|
|
16
|
+
create: (params: NotificationCreateInput, options?: RequestOptions) => Promise<Notification>;
|
|
17
|
+
update: (id: number, params: NotificationUpdateInput, options?: RequestOptions) => Promise<Notification>;
|
|
18
|
+
archive: (id: number, options?: RequestOptions) => Promise<Notification>;
|
|
19
|
+
send: (id: number, options?: RequestOptions) => Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { notificationResource as i, assertCardAlert as n, mergeAlertUpdate as r, NotificationListParams as t };
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/notification.d.ts
|
|
3
|
+
declare const NotificationPayloadType: z.ZodEnum<{
|
|
4
|
+
"notification/card": "notification/card";
|
|
5
|
+
"notification/dashboard": "notification/dashboard";
|
|
6
|
+
"notification/system-event": "notification/system-event";
|
|
7
|
+
"notification/testing": "notification/testing";
|
|
8
|
+
}>;
|
|
9
|
+
type NotificationPayloadType = z.infer<typeof NotificationPayloadType>;
|
|
10
|
+
declare const CARD_PAYLOAD_TYPE = "notification/card";
|
|
11
|
+
declare const NotificationSendCondition: z.ZodEnum<{
|
|
12
|
+
has_result: "has_result";
|
|
13
|
+
goal_above: "goal_above";
|
|
14
|
+
goal_below: "goal_below";
|
|
15
|
+
}>;
|
|
16
|
+
type NotificationSendCondition = z.infer<typeof NotificationSendCondition>;
|
|
17
|
+
declare const NotificationChannelType: z.ZodEnum<{
|
|
18
|
+
"channel/email": "channel/email";
|
|
19
|
+
"channel/slack": "channel/slack";
|
|
20
|
+
"channel/http": "channel/http";
|
|
21
|
+
}>;
|
|
22
|
+
type NotificationChannelType = z.infer<typeof NotificationChannelType>;
|
|
23
|
+
declare const NotificationRecipientType: z.ZodEnum<{
|
|
24
|
+
"notification-recipient/user": "notification-recipient/user";
|
|
25
|
+
"notification-recipient/group": "notification-recipient/group";
|
|
26
|
+
"notification-recipient/raw-value": "notification-recipient/raw-value";
|
|
27
|
+
"notification-recipient/template": "notification-recipient/template";
|
|
28
|
+
}>;
|
|
29
|
+
type NotificationRecipientType = z.infer<typeof NotificationRecipientType>;
|
|
30
|
+
declare const NotificationSubscriptionType: z.ZodEnum<{
|
|
31
|
+
"notification-subscription/cron": "notification-subscription/cron";
|
|
32
|
+
"notification-subscription/system-event": "notification-subscription/system-event";
|
|
33
|
+
}>;
|
|
34
|
+
type NotificationSubscriptionType = z.infer<typeof NotificationSubscriptionType>;
|
|
35
|
+
declare const NotificationRecipientDetails: z.ZodObject<{
|
|
36
|
+
value: z.ZodOptional<z.ZodString>;
|
|
37
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
38
|
+
}, z.core.$loose>;
|
|
39
|
+
type NotificationRecipientDetails = z.infer<typeof NotificationRecipientDetails>;
|
|
40
|
+
declare const NotificationRecipient: z.ZodObject<{
|
|
41
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
type: z.ZodEnum<{
|
|
43
|
+
"notification-recipient/user": "notification-recipient/user";
|
|
44
|
+
"notification-recipient/group": "notification-recipient/group";
|
|
45
|
+
"notification-recipient/raw-value": "notification-recipient/raw-value";
|
|
46
|
+
"notification-recipient/template": "notification-recipient/template";
|
|
47
|
+
}>;
|
|
48
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
49
|
+
permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
50
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
51
|
+
value: z.ZodOptional<z.ZodString>;
|
|
52
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
}, z.core.$loose>>>;
|
|
54
|
+
}, z.core.$loose>;
|
|
55
|
+
type NotificationRecipient = z.infer<typeof NotificationRecipient>;
|
|
56
|
+
declare const NotificationRecipientCompact: z.ZodObject<{
|
|
57
|
+
type: z.ZodEnum<{
|
|
58
|
+
"notification-recipient/user": "notification-recipient/user";
|
|
59
|
+
"notification-recipient/group": "notification-recipient/group";
|
|
60
|
+
"notification-recipient/raw-value": "notification-recipient/raw-value";
|
|
61
|
+
"notification-recipient/template": "notification-recipient/template";
|
|
62
|
+
}>;
|
|
63
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
64
|
+
permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
65
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
66
|
+
value: z.ZodOptional<z.ZodString>;
|
|
67
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
68
|
+
}, z.core.$strip>>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
type NotificationRecipientCompact = z.infer<typeof NotificationRecipientCompact>;
|
|
71
|
+
declare const NotificationHandler: z.ZodObject<{
|
|
72
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
channel_type: z.ZodEnum<{
|
|
74
|
+
"channel/email": "channel/email";
|
|
75
|
+
"channel/slack": "channel/slack";
|
|
76
|
+
"channel/http": "channel/http";
|
|
77
|
+
}>;
|
|
78
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
79
|
+
template_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
80
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
82
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
type: z.ZodEnum<{
|
|
84
|
+
"notification-recipient/user": "notification-recipient/user";
|
|
85
|
+
"notification-recipient/group": "notification-recipient/group";
|
|
86
|
+
"notification-recipient/raw-value": "notification-recipient/raw-value";
|
|
87
|
+
"notification-recipient/template": "notification-recipient/template";
|
|
88
|
+
}>;
|
|
89
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
90
|
+
permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
91
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
92
|
+
value: z.ZodOptional<z.ZodString>;
|
|
93
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
|
+
}, z.core.$loose>>>;
|
|
95
|
+
}, z.core.$loose>>>;
|
|
96
|
+
}, z.core.$loose>;
|
|
97
|
+
type NotificationHandler = z.infer<typeof NotificationHandler>;
|
|
98
|
+
declare const NotificationHandlerCompact: z.ZodObject<{
|
|
99
|
+
channel_type: z.ZodEnum<{
|
|
100
|
+
"channel/email": "channel/email";
|
|
101
|
+
"channel/slack": "channel/slack";
|
|
102
|
+
"channel/http": "channel/http";
|
|
103
|
+
}>;
|
|
104
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
105
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
106
|
+
type: z.ZodEnum<{
|
|
107
|
+
"notification-recipient/user": "notification-recipient/user";
|
|
108
|
+
"notification-recipient/group": "notification-recipient/group";
|
|
109
|
+
"notification-recipient/raw-value": "notification-recipient/raw-value";
|
|
110
|
+
"notification-recipient/template": "notification-recipient/template";
|
|
111
|
+
}>;
|
|
112
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
113
|
+
permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
114
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
115
|
+
value: z.ZodOptional<z.ZodString>;
|
|
116
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
117
|
+
}, z.core.$strip>>>;
|
|
118
|
+
}, z.core.$strip>>>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
type NotificationHandlerCompact = z.infer<typeof NotificationHandlerCompact>;
|
|
121
|
+
declare const NotificationSubscription: z.ZodObject<{
|
|
122
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
type: z.ZodEnum<{
|
|
124
|
+
"notification-subscription/cron": "notification-subscription/cron";
|
|
125
|
+
"notification-subscription/system-event": "notification-subscription/system-event";
|
|
126
|
+
}>;
|
|
127
|
+
cron_schedule: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
128
|
+
event_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
129
|
+
ui_display_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
130
|
+
"cron/raw": "cron/raw";
|
|
131
|
+
"cron/builder": "cron/builder";
|
|
132
|
+
}>>>;
|
|
133
|
+
}, z.core.$loose>;
|
|
134
|
+
type NotificationSubscription = z.infer<typeof NotificationSubscription>;
|
|
135
|
+
declare const NotificationSubscriptionCompact: z.ZodObject<{
|
|
136
|
+
type: z.ZodEnum<{
|
|
137
|
+
"notification-subscription/cron": "notification-subscription/cron";
|
|
138
|
+
"notification-subscription/system-event": "notification-subscription/system-event";
|
|
139
|
+
}>;
|
|
140
|
+
cron_schedule: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
|
+
}, z.core.$strip>;
|
|
142
|
+
type NotificationSubscriptionCompact = z.infer<typeof NotificationSubscriptionCompact>;
|
|
143
|
+
declare const NotificationCardPayload: z.ZodObject<{
|
|
144
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
card_id: z.ZodNumber;
|
|
146
|
+
send_condition: z.ZodEnum<{
|
|
147
|
+
has_result: "has_result";
|
|
148
|
+
goal_above: "goal_above";
|
|
149
|
+
goal_below: "goal_below";
|
|
150
|
+
}>;
|
|
151
|
+
send_once: z.ZodBoolean;
|
|
152
|
+
}, z.core.$loose>;
|
|
153
|
+
type NotificationCardPayload = z.infer<typeof NotificationCardPayload>;
|
|
154
|
+
declare const NotificationCardPayloadCompact: z.ZodObject<{
|
|
155
|
+
card_id: z.ZodNumber;
|
|
156
|
+
send_condition: z.ZodEnum<{
|
|
157
|
+
has_result: "has_result";
|
|
158
|
+
goal_above: "goal_above";
|
|
159
|
+
goal_below: "goal_below";
|
|
160
|
+
}>;
|
|
161
|
+
send_once: z.ZodBoolean;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
type NotificationCardPayloadCompact = z.infer<typeof NotificationCardPayloadCompact>;
|
|
164
|
+
declare const Notification: z.ZodObject<{
|
|
165
|
+
id: z.ZodNumber;
|
|
166
|
+
payload_type: z.ZodEnum<{
|
|
167
|
+
"notification/card": "notification/card";
|
|
168
|
+
"notification/dashboard": "notification/dashboard";
|
|
169
|
+
"notification/system-event": "notification/system-event";
|
|
170
|
+
"notification/testing": "notification/testing";
|
|
171
|
+
}>;
|
|
172
|
+
payload_id: z.ZodNullable<z.ZodNumber>;
|
|
173
|
+
payload: z.ZodNullable<z.ZodObject<{
|
|
174
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
175
|
+
card_id: z.ZodNumber;
|
|
176
|
+
send_condition: z.ZodEnum<{
|
|
177
|
+
has_result: "has_result";
|
|
178
|
+
goal_above: "goal_above";
|
|
179
|
+
goal_below: "goal_below";
|
|
180
|
+
}>;
|
|
181
|
+
send_once: z.ZodBoolean;
|
|
182
|
+
}, z.core.$loose>>;
|
|
183
|
+
active: z.ZodBoolean;
|
|
184
|
+
creator_id: z.ZodNullable<z.ZodNumber>;
|
|
185
|
+
subscriptions: z.ZodArray<z.ZodObject<{
|
|
186
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
type: z.ZodEnum<{
|
|
188
|
+
"notification-subscription/cron": "notification-subscription/cron";
|
|
189
|
+
"notification-subscription/system-event": "notification-subscription/system-event";
|
|
190
|
+
}>;
|
|
191
|
+
cron_schedule: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
192
|
+
event_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
193
|
+
ui_display_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
194
|
+
"cron/raw": "cron/raw";
|
|
195
|
+
"cron/builder": "cron/builder";
|
|
196
|
+
}>>>;
|
|
197
|
+
}, z.core.$loose>>;
|
|
198
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
199
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
200
|
+
channel_type: z.ZodEnum<{
|
|
201
|
+
"channel/email": "channel/email";
|
|
202
|
+
"channel/slack": "channel/slack";
|
|
203
|
+
"channel/http": "channel/http";
|
|
204
|
+
}>;
|
|
205
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
206
|
+
template_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
207
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
208
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
209
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
210
|
+
type: z.ZodEnum<{
|
|
211
|
+
"notification-recipient/user": "notification-recipient/user";
|
|
212
|
+
"notification-recipient/group": "notification-recipient/group";
|
|
213
|
+
"notification-recipient/raw-value": "notification-recipient/raw-value";
|
|
214
|
+
"notification-recipient/template": "notification-recipient/template";
|
|
215
|
+
}>;
|
|
216
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
217
|
+
permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
218
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
219
|
+
value: z.ZodOptional<z.ZodString>;
|
|
220
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
}, z.core.$loose>>>;
|
|
222
|
+
}, z.core.$loose>>>;
|
|
223
|
+
}, z.core.$loose>>;
|
|
224
|
+
}, z.core.$loose>;
|
|
225
|
+
type Notification = z.infer<typeof Notification>;
|
|
226
|
+
declare const AnyNotification: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
227
|
+
id: z.ZodNumber;
|
|
228
|
+
payload_id: z.ZodNullable<z.ZodNumber>;
|
|
229
|
+
payload: z.ZodNullable<z.ZodObject<{
|
|
230
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
card_id: z.ZodNumber;
|
|
232
|
+
send_condition: z.ZodEnum<{
|
|
233
|
+
has_result: "has_result";
|
|
234
|
+
goal_above: "goal_above";
|
|
235
|
+
goal_below: "goal_below";
|
|
236
|
+
}>;
|
|
237
|
+
send_once: z.ZodBoolean;
|
|
238
|
+
}, z.core.$loose>>;
|
|
239
|
+
active: z.ZodBoolean;
|
|
240
|
+
creator_id: z.ZodNullable<z.ZodNumber>;
|
|
241
|
+
subscriptions: z.ZodArray<z.ZodObject<{
|
|
242
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
243
|
+
type: z.ZodEnum<{
|
|
244
|
+
"notification-subscription/cron": "notification-subscription/cron";
|
|
245
|
+
"notification-subscription/system-event": "notification-subscription/system-event";
|
|
246
|
+
}>;
|
|
247
|
+
cron_schedule: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
248
|
+
event_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
249
|
+
ui_display_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
250
|
+
"cron/raw": "cron/raw";
|
|
251
|
+
"cron/builder": "cron/builder";
|
|
252
|
+
}>>>;
|
|
253
|
+
}, z.core.$loose>>;
|
|
254
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
255
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
256
|
+
channel_type: z.ZodEnum<{
|
|
257
|
+
"channel/email": "channel/email";
|
|
258
|
+
"channel/slack": "channel/slack";
|
|
259
|
+
"channel/http": "channel/http";
|
|
260
|
+
}>;
|
|
261
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
262
|
+
template_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
263
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
264
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
265
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
266
|
+
type: z.ZodEnum<{
|
|
267
|
+
"notification-recipient/user": "notification-recipient/user";
|
|
268
|
+
"notification-recipient/group": "notification-recipient/group";
|
|
269
|
+
"notification-recipient/raw-value": "notification-recipient/raw-value";
|
|
270
|
+
"notification-recipient/template": "notification-recipient/template";
|
|
271
|
+
}>;
|
|
272
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
273
|
+
permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
274
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
275
|
+
value: z.ZodOptional<z.ZodString>;
|
|
276
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
277
|
+
}, z.core.$loose>>>;
|
|
278
|
+
}, z.core.$loose>>>;
|
|
279
|
+
}, z.core.$loose>>;
|
|
280
|
+
payload_type: z.ZodLiteral<"notification/card">;
|
|
281
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
282
|
+
id: z.ZodNumber;
|
|
283
|
+
payload_type: z.ZodEnum<{
|
|
284
|
+
"notification/dashboard": "notification/dashboard";
|
|
285
|
+
"notification/system-event": "notification/system-event";
|
|
286
|
+
"notification/testing": "notification/testing";
|
|
287
|
+
}>;
|
|
288
|
+
}, z.core.$loose>], "payload_type">;
|
|
289
|
+
type AnyNotification = z.infer<typeof AnyNotification>;
|
|
290
|
+
declare const NotificationCompact: z.ZodObject<{
|
|
291
|
+
id: z.ZodNumber;
|
|
292
|
+
creator_id: z.ZodNullable<z.ZodNumber>;
|
|
293
|
+
active: z.ZodBoolean;
|
|
294
|
+
payload_type: z.ZodEnum<{
|
|
295
|
+
"notification/card": "notification/card";
|
|
296
|
+
"notification/dashboard": "notification/dashboard";
|
|
297
|
+
"notification/system-event": "notification/system-event";
|
|
298
|
+
"notification/testing": "notification/testing";
|
|
299
|
+
}>;
|
|
300
|
+
payload: z.ZodNullable<z.ZodObject<{
|
|
301
|
+
card_id: z.ZodNumber;
|
|
302
|
+
send_condition: z.ZodEnum<{
|
|
303
|
+
has_result: "has_result";
|
|
304
|
+
goal_above: "goal_above";
|
|
305
|
+
goal_below: "goal_below";
|
|
306
|
+
}>;
|
|
307
|
+
send_once: z.ZodBoolean;
|
|
308
|
+
}, z.core.$strip>>;
|
|
309
|
+
subscriptions: z.ZodArray<z.ZodObject<{
|
|
310
|
+
type: z.ZodEnum<{
|
|
311
|
+
"notification-subscription/cron": "notification-subscription/cron";
|
|
312
|
+
"notification-subscription/system-event": "notification-subscription/system-event";
|
|
313
|
+
}>;
|
|
314
|
+
cron_schedule: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
315
|
+
}, z.core.$strip>>;
|
|
316
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
317
|
+
channel_type: z.ZodEnum<{
|
|
318
|
+
"channel/email": "channel/email";
|
|
319
|
+
"channel/slack": "channel/slack";
|
|
320
|
+
"channel/http": "channel/http";
|
|
321
|
+
}>;
|
|
322
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
323
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
324
|
+
type: z.ZodEnum<{
|
|
325
|
+
"notification-recipient/user": "notification-recipient/user";
|
|
326
|
+
"notification-recipient/group": "notification-recipient/group";
|
|
327
|
+
"notification-recipient/raw-value": "notification-recipient/raw-value";
|
|
328
|
+
"notification-recipient/template": "notification-recipient/template";
|
|
329
|
+
}>;
|
|
330
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
331
|
+
permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
332
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
333
|
+
value: z.ZodOptional<z.ZodString>;
|
|
334
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
335
|
+
}, z.core.$strip>>>;
|
|
336
|
+
}, z.core.$strip>>>;
|
|
337
|
+
}, z.core.$strip>>;
|
|
338
|
+
}, z.core.$strip>;
|
|
339
|
+
type NotificationCompact = z.infer<typeof NotificationCompact>;
|
|
340
|
+
declare const NotificationCreateInput: z.ZodObject<{
|
|
341
|
+
payload_type: z.ZodDefault<z.ZodEnum<{
|
|
342
|
+
"notification/card": "notification/card";
|
|
343
|
+
"notification/dashboard": "notification/dashboard";
|
|
344
|
+
"notification/system-event": "notification/system-event";
|
|
345
|
+
"notification/testing": "notification/testing";
|
|
346
|
+
}>>;
|
|
347
|
+
payload: z.ZodObject<{
|
|
348
|
+
card_id: z.ZodNumber;
|
|
349
|
+
send_condition: z.ZodOptional<z.ZodEnum<{
|
|
350
|
+
has_result: "has_result";
|
|
351
|
+
goal_above: "goal_above";
|
|
352
|
+
goal_below: "goal_below";
|
|
353
|
+
}>>;
|
|
354
|
+
send_once: z.ZodOptional<z.ZodBoolean>;
|
|
355
|
+
}, z.core.$loose>;
|
|
356
|
+
subscriptions: z.ZodArray<z.ZodObject<{
|
|
357
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
358
|
+
"notification-subscription/cron": "notification-subscription/cron";
|
|
359
|
+
"notification-subscription/system-event": "notification-subscription/system-event";
|
|
360
|
+
}>>;
|
|
361
|
+
cron_schedule: z.ZodString;
|
|
362
|
+
}, z.core.$loose>>;
|
|
363
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
364
|
+
channel_type: z.ZodEnum<{
|
|
365
|
+
"channel/email": "channel/email";
|
|
366
|
+
"channel/slack": "channel/slack";
|
|
367
|
+
"channel/http": "channel/http";
|
|
368
|
+
}>;
|
|
369
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
370
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
371
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
372
|
+
type: z.ZodEnum<{
|
|
373
|
+
"notification-recipient/user": "notification-recipient/user";
|
|
374
|
+
"notification-recipient/group": "notification-recipient/group";
|
|
375
|
+
"notification-recipient/raw-value": "notification-recipient/raw-value";
|
|
376
|
+
"notification-recipient/template": "notification-recipient/template";
|
|
377
|
+
}>;
|
|
378
|
+
user_id: z.ZodOptional<z.ZodNumber>;
|
|
379
|
+
permissions_group_id: z.ZodOptional<z.ZodNumber>;
|
|
380
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
381
|
+
value: z.ZodOptional<z.ZodString>;
|
|
382
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
383
|
+
}, z.core.$loose>>;
|
|
384
|
+
}, z.core.$loose>>>;
|
|
385
|
+
}, z.core.$loose>>;
|
|
386
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
387
|
+
}, z.core.$loose>;
|
|
388
|
+
type NotificationCreateInput = z.infer<typeof NotificationCreateInput>;
|
|
389
|
+
declare const NotificationCardPayloadPatch: z.ZodObject<{
|
|
390
|
+
card_id: z.ZodOptional<z.ZodNumber>;
|
|
391
|
+
send_condition: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
|
|
392
|
+
has_result: "has_result";
|
|
393
|
+
goal_above: "goal_above";
|
|
394
|
+
goal_below: "goal_below";
|
|
395
|
+
}>>>;
|
|
396
|
+
send_once: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
397
|
+
}, z.core.$loose>;
|
|
398
|
+
type NotificationCardPayloadPatch = z.infer<typeof NotificationCardPayloadPatch>;
|
|
399
|
+
declare const NotificationUpdateInput: z.ZodObject<{
|
|
400
|
+
payload: z.ZodOptional<z.ZodObject<{
|
|
401
|
+
card_id: z.ZodOptional<z.ZodNumber>;
|
|
402
|
+
send_condition: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
|
|
403
|
+
has_result: "has_result";
|
|
404
|
+
goal_above: "goal_above";
|
|
405
|
+
goal_below: "goal_below";
|
|
406
|
+
}>>>;
|
|
407
|
+
send_once: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
408
|
+
}, z.core.$loose>>;
|
|
409
|
+
subscriptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
410
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
411
|
+
"notification-subscription/cron": "notification-subscription/cron";
|
|
412
|
+
"notification-subscription/system-event": "notification-subscription/system-event";
|
|
413
|
+
}>>;
|
|
414
|
+
cron_schedule: z.ZodString;
|
|
415
|
+
}, z.core.$loose>>>;
|
|
416
|
+
handlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
417
|
+
channel_type: z.ZodEnum<{
|
|
418
|
+
"channel/email": "channel/email";
|
|
419
|
+
"channel/slack": "channel/slack";
|
|
420
|
+
"channel/http": "channel/http";
|
|
421
|
+
}>;
|
|
422
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
423
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
424
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
425
|
+
type: z.ZodEnum<{
|
|
426
|
+
"notification-recipient/user": "notification-recipient/user";
|
|
427
|
+
"notification-recipient/group": "notification-recipient/group";
|
|
428
|
+
"notification-recipient/raw-value": "notification-recipient/raw-value";
|
|
429
|
+
"notification-recipient/template": "notification-recipient/template";
|
|
430
|
+
}>;
|
|
431
|
+
user_id: z.ZodOptional<z.ZodNumber>;
|
|
432
|
+
permissions_group_id: z.ZodOptional<z.ZodNumber>;
|
|
433
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
434
|
+
value: z.ZodOptional<z.ZodString>;
|
|
435
|
+
channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
436
|
+
}, z.core.$loose>>;
|
|
437
|
+
}, z.core.$loose>>>;
|
|
438
|
+
}, z.core.$loose>>>;
|
|
439
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
440
|
+
}, z.core.$loose>;
|
|
441
|
+
type NotificationUpdateInput = z.infer<typeof NotificationUpdateInput>;
|
|
442
|
+
//#endregion
|
|
443
|
+
export { NotificationSendCondition as _, NotificationCardPayloadCompact as a, NotificationSubscriptionType as b, NotificationCompact as c, NotificationHandlerCompact as d, NotificationPayloadType as f, NotificationRecipientType as g, NotificationRecipientDetails as h, NotificationCardPayload as i, NotificationCreateInput as l, NotificationRecipientCompact as m, CARD_PAYLOAD_TYPE as n, NotificationCardPayloadPatch as o, NotificationRecipient as p, Notification as r, NotificationChannelType as s, AnyNotification as t, NotificationHandler as u, NotificationSubscription as v, NotificationUpdateInput as x, NotificationSubscriptionCompact as y };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/http/oauth.d.ts
|
|
3
|
+
declare const OAUTH_SCOPE = "mb:full";
|
|
4
|
+
declare const OAuthServerMetadata: z.ZodObject<{
|
|
5
|
+
issuer: z.ZodString;
|
|
6
|
+
authorization_endpoint: z.ZodString;
|
|
7
|
+
token_endpoint: z.ZodString;
|
|
8
|
+
registration_endpoint: z.ZodOptional<z.ZodString>;
|
|
9
|
+
revocation_endpoint: z.ZodOptional<z.ZodString>;
|
|
10
|
+
scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
11
|
+
}, z.core.$loose>;
|
|
12
|
+
type OAuthServerMetadata = z.infer<typeof OAuthServerMetadata>;
|
|
13
|
+
declare const RegisteredClient: z.ZodObject<{
|
|
14
|
+
client_id: z.ZodString;
|
|
15
|
+
}, z.core.$loose>;
|
|
16
|
+
type RegisteredClient = z.infer<typeof RegisteredClient>;
|
|
17
|
+
declare const OAuthTokens: z.ZodObject<{
|
|
18
|
+
access_token: z.ZodString;
|
|
19
|
+
token_type: z.ZodString;
|
|
20
|
+
expires_in: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
refresh_token: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$loose>;
|
|
23
|
+
type OAuthTokens = z.infer<typeof OAuthTokens>;
|
|
24
|
+
interface ClientRegistration {
|
|
25
|
+
registrationEndpoint: string;
|
|
26
|
+
redirectUri: string;
|
|
27
|
+
clientName: string;
|
|
28
|
+
userAgent: string;
|
|
29
|
+
}
|
|
30
|
+
interface CodeExchange {
|
|
31
|
+
tokenEndpoint: string;
|
|
32
|
+
code: string;
|
|
33
|
+
redirectUri: string;
|
|
34
|
+
clientId: string;
|
|
35
|
+
codeVerifier: string;
|
|
36
|
+
userAgent: string;
|
|
37
|
+
}
|
|
38
|
+
interface TokenRefresh {
|
|
39
|
+
tokenEndpoint: string;
|
|
40
|
+
refreshToken: string;
|
|
41
|
+
clientId: string;
|
|
42
|
+
userAgent: string;
|
|
43
|
+
}
|
|
44
|
+
interface TokenRevocation {
|
|
45
|
+
revocationEndpoint: string;
|
|
46
|
+
token: string;
|
|
47
|
+
clientId: string;
|
|
48
|
+
userAgent: string;
|
|
49
|
+
}
|
|
50
|
+
declare const OAUTH_UNSUPPORTED_MESSAGE = "this Metabase does not support OAuth login (requires Metabase v63 or newer)";
|
|
51
|
+
declare function tryDiscoverMetadata(baseUrl: string, userAgent: string): Promise<OAuthServerMetadata | null>;
|
|
52
|
+
declare function discoverLoginMetadata(baseUrl: string, userAgent: string): Promise<OAuthServerMetadata>;
|
|
53
|
+
declare function discoverMetadata(baseUrl: string, userAgent: string): Promise<OAuthServerMetadata>;
|
|
54
|
+
declare function registerClient(input: ClientRegistration): Promise<RegisteredClient>;
|
|
55
|
+
declare function exchangeCode(input: CodeExchange): Promise<OAuthTokens>;
|
|
56
|
+
declare function refreshTokens(input: TokenRefresh): Promise<OAuthTokens>;
|
|
57
|
+
declare function revokeToken(input: TokenRevocation): Promise<void>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { OAuthServerMetadata as a, TokenRefresh as c, discoverMetadata as d, exchangeCode as f, tryDiscoverMetadata as g, revokeToken as h, OAUTH_UNSUPPORTED_MESSAGE as i, TokenRevocation as l, registerClient as m, CodeExchange as n, OAuthTokens as o, refreshTokens as p, OAUTH_SCOPE as r, RegisteredClient as s, ClientRegistration as t, discoverLoginMetadata as u };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { a as OAuthServerMetadata } from "./oauth-C4ordeoJ.js";
|
|
2
|
+
import { c as OAuthCredential } from "./credential-6aOEGqMH.js";
|
|
3
|
+
//#region src/auth/oauth-login.d.ts
|
|
4
|
+
interface OAuthLoginInput {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
userAgent: string;
|
|
7
|
+
clientName: string;
|
|
8
|
+
metadata?: OAuthServerMetadata;
|
|
9
|
+
clientId?: string;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
}
|
|
12
|
+
interface OAuthLoginDeps {
|
|
13
|
+
openBrowser: (url: string) => Promise<boolean>;
|
|
14
|
+
onAuthorizeUrl: (url: string, opened: boolean) => void;
|
|
15
|
+
now: () => number;
|
|
16
|
+
}
|
|
17
|
+
declare function oauthLogin(input: OAuthLoginInput, deps: OAuthLoginDeps): Promise<OAuthCredential>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { OAuthLoginInput as n, oauthLogin as r, OAuthLoginDeps as t };
|