@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,109 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/parameter.ts
|
|
3
|
+
const ParameterType = z.enum([
|
|
4
|
+
"number",
|
|
5
|
+
"text",
|
|
6
|
+
"date",
|
|
7
|
+
"boolean",
|
|
8
|
+
"date/single",
|
|
9
|
+
"id",
|
|
10
|
+
"category",
|
|
11
|
+
"location/city",
|
|
12
|
+
"location/state",
|
|
13
|
+
"location/zip_code",
|
|
14
|
+
"location/country",
|
|
15
|
+
"date/range",
|
|
16
|
+
"date/month-year",
|
|
17
|
+
"date/quarter-year",
|
|
18
|
+
"date/relative",
|
|
19
|
+
"date/all-options",
|
|
20
|
+
"temporal-unit",
|
|
21
|
+
"number/!=",
|
|
22
|
+
"number/<=",
|
|
23
|
+
"number/=",
|
|
24
|
+
"number/>=",
|
|
25
|
+
"number/between",
|
|
26
|
+
"string/!=",
|
|
27
|
+
"string/=",
|
|
28
|
+
"string/contains",
|
|
29
|
+
"string/does-not-contain",
|
|
30
|
+
"string/ends-with",
|
|
31
|
+
"string/starts-with",
|
|
32
|
+
"boolean/="
|
|
33
|
+
]);
|
|
34
|
+
const TemporalUnit = z.enum([
|
|
35
|
+
"millisecond",
|
|
36
|
+
"second",
|
|
37
|
+
"minute",
|
|
38
|
+
"hour",
|
|
39
|
+
"day",
|
|
40
|
+
"week",
|
|
41
|
+
"month",
|
|
42
|
+
"quarter",
|
|
43
|
+
"year",
|
|
44
|
+
"second-of-minute",
|
|
45
|
+
"minute-of-hour",
|
|
46
|
+
"hour-of-day",
|
|
47
|
+
"day-of-week",
|
|
48
|
+
"day-of-month",
|
|
49
|
+
"day-of-year",
|
|
50
|
+
"week-of-year",
|
|
51
|
+
"month-of-year",
|
|
52
|
+
"quarter-of-year",
|
|
53
|
+
"year-of-era",
|
|
54
|
+
"default"
|
|
55
|
+
]);
|
|
56
|
+
const ValuesSourceType = z.enum(["static-list", "card"]);
|
|
57
|
+
const ValuesQueryType = z.enum([
|
|
58
|
+
"list",
|
|
59
|
+
"search",
|
|
60
|
+
"none"
|
|
61
|
+
]);
|
|
62
|
+
const ParameterTemplateTagRef = z.tuple([z.literal("template-tag"), z.union([z.string(), z.object({ id: z.string() }).loose()])]);
|
|
63
|
+
const FieldRefLike = z.tuple([z.string()]).rest(z.unknown());
|
|
64
|
+
const DimensionTarget = z.tuple([z.literal("dimension"), z.union([ParameterTemplateTagRef, FieldRefLike])]).rest(z.unknown());
|
|
65
|
+
const VariableTarget = z.tuple([z.literal("variable"), z.union([ParameterTemplateTagRef, FieldRefLike])]);
|
|
66
|
+
const ParameterTextTagTarget = z.tuple([z.literal("text-tag"), z.string()]);
|
|
67
|
+
const ParameterTarget = z.union([
|
|
68
|
+
DimensionTarget,
|
|
69
|
+
VariableTarget,
|
|
70
|
+
ParameterTextTagTarget,
|
|
71
|
+
z.number().int(),
|
|
72
|
+
FieldRefLike
|
|
73
|
+
]);
|
|
74
|
+
const ValuesSourceConfig = z.object({
|
|
75
|
+
values: z.array(z.unknown()).optional(),
|
|
76
|
+
card_id: z.number().int().optional(),
|
|
77
|
+
value_field: FieldRefLike.optional(),
|
|
78
|
+
label_field: FieldRefLike.optional()
|
|
79
|
+
}).loose();
|
|
80
|
+
const Parameter = z.object({
|
|
81
|
+
id: z.string(),
|
|
82
|
+
type: ParameterType,
|
|
83
|
+
name: z.string().optional(),
|
|
84
|
+
slug: z.string().optional(),
|
|
85
|
+
sectionId: z.string().optional(),
|
|
86
|
+
default: z.unknown().optional(),
|
|
87
|
+
required: z.boolean().nullable().optional(),
|
|
88
|
+
filteringParameters: z.array(z.string()).nullable().optional(),
|
|
89
|
+
target: ParameterTarget.optional(),
|
|
90
|
+
temporal_units: z.array(TemporalUnit).nullable().optional(),
|
|
91
|
+
values_query_type: ValuesQueryType.nullable().optional(),
|
|
92
|
+
values_source_type: ValuesSourceType.nullable().optional(),
|
|
93
|
+
values_source_config: ValuesSourceConfig.nullable().optional()
|
|
94
|
+
}).loose();
|
|
95
|
+
const ParameterMapping = z.object({
|
|
96
|
+
parameter_id: z.string(),
|
|
97
|
+
target: ParameterTarget,
|
|
98
|
+
card_id: z.number().int().nullable().optional()
|
|
99
|
+
}).loose();
|
|
100
|
+
const ParameterValues = z.object({
|
|
101
|
+
values: z.array(z.array(z.unknown())),
|
|
102
|
+
has_more_values: z.boolean()
|
|
103
|
+
}).loose();
|
|
104
|
+
const ParameterValuesCompact = ParameterValues.pick({
|
|
105
|
+
values: true,
|
|
106
|
+
has_more_values: true
|
|
107
|
+
}).strip();
|
|
108
|
+
//#endregion
|
|
109
|
+
export { Parameter, ParameterMapping, ParameterTarget, ParameterTemplateTagRef, ParameterTextTagTarget, ParameterType, ParameterValues, ParameterValuesCompact, TemporalUnit, ValuesQueryType, ValuesSourceConfig, ValuesSourceType };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as PermissionsGraph, i as DownloadPermission, n as DataModelPermission, o as ViewDataPermission, r as DatabasePermissions, s as YesNoPermission, t as CreateQueriesPermission } from "../permission-BnCQw5Kp.js";
|
|
2
|
+
export { CreateQueriesPermission, DataModelPermission, DatabasePermissions, DownloadPermission, PermissionsGraph, ViewDataPermission, YesNoPermission };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/permission.ts
|
|
3
|
+
const ViewDataPermission = z.enum([
|
|
4
|
+
"unrestricted",
|
|
5
|
+
"legacy-no-self-service",
|
|
6
|
+
"blocked",
|
|
7
|
+
"sandboxed",
|
|
8
|
+
"impersonated"
|
|
9
|
+
]);
|
|
10
|
+
const CreateQueriesPermission = z.enum([
|
|
11
|
+
"query-builder-and-native",
|
|
12
|
+
"query-builder",
|
|
13
|
+
"no"
|
|
14
|
+
]);
|
|
15
|
+
const DownloadPermission = z.enum(["full", "limited"]);
|
|
16
|
+
const DataModelPermission = z.literal("all");
|
|
17
|
+
const YesNoPermission = z.enum(["yes", "no"]);
|
|
18
|
+
function granular(value) {
|
|
19
|
+
const perTable = z.record(z.string(), value);
|
|
20
|
+
const perSchema = z.record(z.string(), z.union([value, perTable]));
|
|
21
|
+
return z.union([value, perSchema]);
|
|
22
|
+
}
|
|
23
|
+
const DatabasePermissions = z.object({
|
|
24
|
+
"view-data": granular(ViewDataPermission).optional(),
|
|
25
|
+
"create-queries": granular(CreateQueriesPermission).optional(),
|
|
26
|
+
download: z.object({ schemas: granular(DownloadPermission) }).loose().optional(),
|
|
27
|
+
"data-model": z.object({ schemas: granular(DataModelPermission) }).loose().optional(),
|
|
28
|
+
details: YesNoPermission.optional(),
|
|
29
|
+
transforms: YesNoPermission.optional()
|
|
30
|
+
}).loose();
|
|
31
|
+
const PermissionsGraph = z.object({
|
|
32
|
+
revision: z.number().int().nonnegative(),
|
|
33
|
+
groups: z.record(z.string(), z.record(z.string(), DatabasePermissions))
|
|
34
|
+
}).loose();
|
|
35
|
+
//#endregion
|
|
36
|
+
export { CreateQueriesPermission, DataModelPermission, DatabasePermissions, DownloadPermission, PermissionsGraph, ViewDataPermission, YesNoPermission };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as PulseChannelCompact, c as PulseCompact, d as PulseRecipientCompact, f as PulseScheduleDay, h as PulseUpdateInput, i as PulseChannel, l as PulseCreateInput, m as PulseScheduleType, n as PulseCard, o as PulseChannelDetails, p as PulseScheduleFrame, r as PulseCardCompact, s as PulseChannelType, t as Pulse, u as PulseRecipient } from "../pulse-CMc1Rwdj.js";
|
|
2
|
+
export { Pulse, PulseCard, PulseCardCompact, PulseChannel, PulseChannelCompact, PulseChannelDetails, PulseChannelType, PulseCompact, PulseCreateInput, PulseRecipient, PulseRecipientCompact, PulseScheduleDay, PulseScheduleFrame, PulseScheduleType, PulseUpdateInput };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Parameter } from "./parameter.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/domain/pulse.ts
|
|
4
|
+
const PulseChannelType = z.enum([
|
|
5
|
+
"email",
|
|
6
|
+
"slack",
|
|
7
|
+
"http"
|
|
8
|
+
]);
|
|
9
|
+
const PulseScheduleType = z.enum([
|
|
10
|
+
"hourly",
|
|
11
|
+
"daily",
|
|
12
|
+
"weekly",
|
|
13
|
+
"monthly"
|
|
14
|
+
]);
|
|
15
|
+
const PulseScheduleDay = z.enum([
|
|
16
|
+
"mon",
|
|
17
|
+
"tue",
|
|
18
|
+
"wed",
|
|
19
|
+
"thu",
|
|
20
|
+
"fri",
|
|
21
|
+
"sat",
|
|
22
|
+
"sun"
|
|
23
|
+
]);
|
|
24
|
+
const PulseScheduleFrame = z.enum([
|
|
25
|
+
"first",
|
|
26
|
+
"mid",
|
|
27
|
+
"last"
|
|
28
|
+
]);
|
|
29
|
+
const PulseChannelDetails = z.object({ channel: z.string().optional() }).loose();
|
|
30
|
+
const PulseRecipient = z.object({
|
|
31
|
+
id: z.number().int().nullable().optional(),
|
|
32
|
+
email: z.string()
|
|
33
|
+
}).loose();
|
|
34
|
+
const PulseRecipientCompact = PulseRecipient.pick({
|
|
35
|
+
id: true,
|
|
36
|
+
email: true
|
|
37
|
+
}).strip();
|
|
38
|
+
const PulseChannel = z.object({
|
|
39
|
+
id: z.number().int().optional(),
|
|
40
|
+
channel_type: PulseChannelType,
|
|
41
|
+
channel_id: z.number().int().nullable().optional(),
|
|
42
|
+
enabled: z.boolean(),
|
|
43
|
+
schedule_type: PulseScheduleType,
|
|
44
|
+
schedule_hour: z.number().int().nullable(),
|
|
45
|
+
schedule_day: PulseScheduleDay.nullable(),
|
|
46
|
+
schedule_frame: PulseScheduleFrame.nullable(),
|
|
47
|
+
details: PulseChannelDetails.optional(),
|
|
48
|
+
recipients: z.array(PulseRecipient)
|
|
49
|
+
}).loose();
|
|
50
|
+
const PulseChannelCompact = PulseChannel.pick({
|
|
51
|
+
channel_type: true,
|
|
52
|
+
enabled: true,
|
|
53
|
+
schedule_type: true,
|
|
54
|
+
schedule_hour: true,
|
|
55
|
+
schedule_day: true,
|
|
56
|
+
schedule_frame: true,
|
|
57
|
+
details: true
|
|
58
|
+
}).strip().extend({ recipients: z.array(PulseRecipientCompact) });
|
|
59
|
+
const PulseCard = z.object({
|
|
60
|
+
id: z.number().int(),
|
|
61
|
+
name: z.string(),
|
|
62
|
+
dashboard_card_id: z.number().int().nullable(),
|
|
63
|
+
include_csv: z.boolean(),
|
|
64
|
+
include_xls: z.boolean()
|
|
65
|
+
}).loose();
|
|
66
|
+
const PulseCardCompact = PulseCard.pick({
|
|
67
|
+
id: true,
|
|
68
|
+
name: true,
|
|
69
|
+
dashboard_card_id: true,
|
|
70
|
+
include_csv: true,
|
|
71
|
+
include_xls: true
|
|
72
|
+
}).strip();
|
|
73
|
+
const Pulse = z.object({
|
|
74
|
+
id: z.number().int(),
|
|
75
|
+
name: z.string().nullable(),
|
|
76
|
+
creator_id: z.number().int(),
|
|
77
|
+
dashboard_id: z.number().int().nullable(),
|
|
78
|
+
collection_id: z.number().int().nullable(),
|
|
79
|
+
archived: z.boolean(),
|
|
80
|
+
skip_if_empty: z.boolean(),
|
|
81
|
+
parameters: z.array(Parameter),
|
|
82
|
+
cards: z.array(PulseCard),
|
|
83
|
+
channels: z.array(PulseChannel)
|
|
84
|
+
}).loose();
|
|
85
|
+
const PulseCompact = Pulse.pick({
|
|
86
|
+
id: true,
|
|
87
|
+
name: true,
|
|
88
|
+
dashboard_id: true,
|
|
89
|
+
collection_id: true,
|
|
90
|
+
archived: true,
|
|
91
|
+
skip_if_empty: true
|
|
92
|
+
}).strip().extend({
|
|
93
|
+
cards: z.array(PulseCardCompact),
|
|
94
|
+
channels: z.array(PulseChannelCompact)
|
|
95
|
+
});
|
|
96
|
+
const PulseRecipientInput = z.union([z.object({ id: z.number().int().positive() }).loose(), z.object({ email: z.string().min(1) }).loose()]);
|
|
97
|
+
const PulseCardInput = z.object({
|
|
98
|
+
id: z.number().int().positive(),
|
|
99
|
+
include_csv: z.boolean(),
|
|
100
|
+
include_xls: z.boolean(),
|
|
101
|
+
dashboard_card_id: z.number().int().positive().nullable().optional(),
|
|
102
|
+
format_rows: z.boolean().optional(),
|
|
103
|
+
pivot_results: z.boolean().optional()
|
|
104
|
+
}).loose();
|
|
105
|
+
const PulseChannelInput = z.object({
|
|
106
|
+
channel_type: PulseChannelType,
|
|
107
|
+
enabled: z.boolean().default(true),
|
|
108
|
+
schedule_type: PulseScheduleType,
|
|
109
|
+
schedule_hour: z.number().int().min(0).max(23).nullable().optional(),
|
|
110
|
+
schedule_day: PulseScheduleDay.nullable().optional(),
|
|
111
|
+
schedule_frame: PulseScheduleFrame.nullable().optional(),
|
|
112
|
+
channel_id: z.number().int().positive().nullable().optional(),
|
|
113
|
+
details: PulseChannelDetails.optional(),
|
|
114
|
+
recipients: z.array(PulseRecipientInput).optional()
|
|
115
|
+
}).loose();
|
|
116
|
+
const PulseCreateInput = z.object({
|
|
117
|
+
name: z.string().min(1),
|
|
118
|
+
dashboard_id: z.number().int().positive(),
|
|
119
|
+
cards: z.array(PulseCardInput).min(1),
|
|
120
|
+
channels: z.array(PulseChannelInput).min(1),
|
|
121
|
+
skip_if_empty: z.boolean().optional(),
|
|
122
|
+
parameters: z.array(Parameter).optional()
|
|
123
|
+
}).loose();
|
|
124
|
+
const PulseUpdateInput = z.object({
|
|
125
|
+
name: z.string().min(1).optional(),
|
|
126
|
+
cards: z.array(PulseCardInput).min(1).optional(),
|
|
127
|
+
channels: z.array(PulseChannelInput).min(1).optional(),
|
|
128
|
+
skip_if_empty: z.boolean().optional(),
|
|
129
|
+
archived: z.boolean().optional(),
|
|
130
|
+
parameters: z.array(Parameter).optional()
|
|
131
|
+
}).loose();
|
|
132
|
+
//#endregion
|
|
133
|
+
export { Pulse, PulseCard, PulseCardCompact, PulseChannel, PulseChannelCompact, PulseChannelDetails, PulseChannelType, PulseCompact, PulseCreateInput, PulseRecipient, PulseRecipientCompact, PulseScheduleDay, PulseScheduleFrame, PulseScheduleType, PulseUpdateInput };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/query.ts
|
|
3
|
+
const DatasetQuery = z.object({}).loose().refine((value) => "lib/type" in value || "type" in value, { message: "dataset_query must include \"lib/type\" (MBQL 5) or \"type\" (legacy MBQL/native); empty `{}` is rejected" }).describe("MBQL 5, legacy MBQL, or native query");
|
|
4
|
+
const ExportFormat = z.enum([
|
|
5
|
+
"csv",
|
|
6
|
+
"json",
|
|
7
|
+
"xlsx"
|
|
8
|
+
]);
|
|
9
|
+
const PivotExportFormat = ExportFormat.exclude(["json"]);
|
|
10
|
+
const VisualizationSettings = z.record(z.string(), z.unknown());
|
|
11
|
+
const SortDirection = z.enum(["asc", "desc"]);
|
|
12
|
+
//#endregion
|
|
13
|
+
export { DatasetQuery, ExportFormat, PivotExportFormat, SortDirection, VisualizationSettings };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ReplacementEntityType, c as ReplacementRun, d as ReplacementRunStatus, f as ReplacementSourceInput, i as ReplacementColumnMapping, l as ReplacementRunCompact, n as ReplacementColumn, o as ReplacementError, p as ReplacementSourceType, r as ReplacementColumnError, s as ReplacementModelWithTransformInput, t as ReplacementCheck, u as ReplacementRunStarted } from "../replacement-CyvtbxGg.js";
|
|
2
|
+
export { ReplacementCheck, ReplacementColumn, ReplacementColumnError, ReplacementColumnMapping, ReplacementEntityType, ReplacementError, ReplacementModelWithTransformInput, ReplacementRun, ReplacementRunCompact, ReplacementRunStarted, ReplacementRunStatus, ReplacementSourceInput, ReplacementSourceType };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { FieldBaseType, FieldSemanticType } from "./field.js";
|
|
2
|
+
import { TransformTarget } from "./transform.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/domain/replacement.ts
|
|
5
|
+
const ReplacementSourceType = z.enum(["card", "table"]);
|
|
6
|
+
const ReplacementEntityType = z.enum([...ReplacementSourceType.options, "transform"]);
|
|
7
|
+
const ReplacementRunStatus = z.enum([
|
|
8
|
+
"pending",
|
|
9
|
+
"started",
|
|
10
|
+
"succeeded",
|
|
11
|
+
"failed",
|
|
12
|
+
"canceled",
|
|
13
|
+
"timeout"
|
|
14
|
+
]);
|
|
15
|
+
const ReplacementRun = z.object({
|
|
16
|
+
id: z.number().int(),
|
|
17
|
+
status: ReplacementRunStatus,
|
|
18
|
+
is_active: z.literal(true).nullable(),
|
|
19
|
+
source_entity_type: ReplacementEntityType,
|
|
20
|
+
source_entity_id: z.number().int(),
|
|
21
|
+
target_entity_type: ReplacementEntityType,
|
|
22
|
+
target_entity_id: z.number().int(),
|
|
23
|
+
progress: z.number().min(0).max(1).nullable(),
|
|
24
|
+
message: z.string().nullable(),
|
|
25
|
+
user_id: z.number().int().nullable(),
|
|
26
|
+
start_time: z.string(),
|
|
27
|
+
end_time: z.string().nullable()
|
|
28
|
+
}).loose();
|
|
29
|
+
const ReplacementRunCompact = ReplacementRun.pick({
|
|
30
|
+
id: true,
|
|
31
|
+
status: true,
|
|
32
|
+
source_entity_type: true,
|
|
33
|
+
source_entity_id: true,
|
|
34
|
+
target_entity_type: true,
|
|
35
|
+
target_entity_id: true,
|
|
36
|
+
progress: true,
|
|
37
|
+
message: true,
|
|
38
|
+
start_time: true,
|
|
39
|
+
end_time: true
|
|
40
|
+
}).strip();
|
|
41
|
+
const ReplacementColumn = z.object({
|
|
42
|
+
id: z.number().int().nullable(),
|
|
43
|
+
name: z.string(),
|
|
44
|
+
display_name: z.string(),
|
|
45
|
+
base_type: FieldBaseType.nullable(),
|
|
46
|
+
effective_type: FieldBaseType.nullable(),
|
|
47
|
+
semantic_type: FieldSemanticType.nullable()
|
|
48
|
+
});
|
|
49
|
+
const ReplacementColumnError = z.enum([
|
|
50
|
+
"column-type-mismatch",
|
|
51
|
+
"missing-primary-key",
|
|
52
|
+
"missing-foreign-key",
|
|
53
|
+
"foreign-key-mismatch"
|
|
54
|
+
]);
|
|
55
|
+
const ReplacementColumnMatched = z.object({
|
|
56
|
+
source: ReplacementColumn,
|
|
57
|
+
target: ReplacementColumn,
|
|
58
|
+
errors: z.array(ReplacementColumnError).optional()
|
|
59
|
+
}).strict();
|
|
60
|
+
const ReplacementColumnMissingOnTarget = z.object({ source: ReplacementColumn }).strict();
|
|
61
|
+
const ReplacementColumnMissingOnSource = z.object({ target: ReplacementColumn }).strict();
|
|
62
|
+
const ReplacementColumnMapping = z.union([
|
|
63
|
+
ReplacementColumnMatched,
|
|
64
|
+
ReplacementColumnMissingOnTarget,
|
|
65
|
+
ReplacementColumnMissingOnSource
|
|
66
|
+
]);
|
|
67
|
+
const ReplacementError = z.enum([
|
|
68
|
+
"cycle-detected",
|
|
69
|
+
"database-mismatch",
|
|
70
|
+
"incompatible-implicit-joins",
|
|
71
|
+
"affects-gtap-policies"
|
|
72
|
+
]);
|
|
73
|
+
const ReplacementCheck = z.object({
|
|
74
|
+
success: z.boolean(),
|
|
75
|
+
errors: z.array(ReplacementError).optional(),
|
|
76
|
+
column_mappings: z.array(ReplacementColumnMapping).optional()
|
|
77
|
+
});
|
|
78
|
+
const ReplacementSourceInput = z.object({
|
|
79
|
+
source_entity_id: z.number().int().positive(),
|
|
80
|
+
source_entity_type: ReplacementSourceType,
|
|
81
|
+
target_entity_id: z.number().int().positive(),
|
|
82
|
+
target_entity_type: ReplacementSourceType
|
|
83
|
+
}).strict();
|
|
84
|
+
const ReplacementModelWithTransformInput = z.object({
|
|
85
|
+
card_id: z.number().int().positive(),
|
|
86
|
+
transform_name: z.string(),
|
|
87
|
+
transform_target: TransformTarget,
|
|
88
|
+
target_collection_id: z.number().int().positive().nullable().optional(),
|
|
89
|
+
transform_tag_ids: z.array(z.number().int().positive()).nullable().optional()
|
|
90
|
+
}).strict();
|
|
91
|
+
const ReplacementRunStarted = z.object({ run_id: z.number().int().positive() });
|
|
92
|
+
//#endregion
|
|
93
|
+
export { ReplacementCheck, ReplacementColumn, ReplacementColumnError, ReplacementColumnMapping, ReplacementEntityType, ReplacementError, ReplacementModelWithTransformInput, ReplacementRun, ReplacementRunCompact, ReplacementRunStarted, ReplacementRunStatus, ReplacementSourceInput, ReplacementSourceType };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/revision.ts
|
|
3
|
+
const RevisionEntity = z.enum([
|
|
4
|
+
"card",
|
|
5
|
+
"dashboard",
|
|
6
|
+
"document",
|
|
7
|
+
"measure",
|
|
8
|
+
"segment",
|
|
9
|
+
"transform",
|
|
10
|
+
"transform-test"
|
|
11
|
+
]);
|
|
12
|
+
const RevisionUser = z.object({
|
|
13
|
+
id: z.number().int(),
|
|
14
|
+
first_name: z.string().nullable(),
|
|
15
|
+
last_name: z.string().nullable(),
|
|
16
|
+
common_name: z.string()
|
|
17
|
+
}).loose();
|
|
18
|
+
const Revision = z.object({
|
|
19
|
+
id: z.number().int(),
|
|
20
|
+
timestamp: z.string(),
|
|
21
|
+
is_creation: z.boolean(),
|
|
22
|
+
is_reversion: z.boolean(),
|
|
23
|
+
most_recent: z.boolean(),
|
|
24
|
+
diff: z.object({}).loose().nullable(),
|
|
25
|
+
description: z.string(),
|
|
26
|
+
has_multiple_changes: z.boolean(),
|
|
27
|
+
user: RevisionUser
|
|
28
|
+
}).loose();
|
|
29
|
+
const RevisionCompact = Revision.pick({
|
|
30
|
+
id: true,
|
|
31
|
+
timestamp: true,
|
|
32
|
+
is_creation: true,
|
|
33
|
+
is_reversion: true,
|
|
34
|
+
description: true,
|
|
35
|
+
user: true
|
|
36
|
+
}).strip();
|
|
37
|
+
const RevisionRow = z.object({
|
|
38
|
+
id: z.number().int(),
|
|
39
|
+
model: z.string(),
|
|
40
|
+
model_id: z.number().int(),
|
|
41
|
+
user_id: z.number().int(),
|
|
42
|
+
object: z.object({}).loose(),
|
|
43
|
+
timestamp: z.string(),
|
|
44
|
+
is_creation: z.boolean(),
|
|
45
|
+
is_reversion: z.boolean(),
|
|
46
|
+
most_recent: z.boolean()
|
|
47
|
+
}).loose();
|
|
48
|
+
const RevisionRevertInput = z.object({
|
|
49
|
+
entity: RevisionEntity,
|
|
50
|
+
id: z.number().int().positive(),
|
|
51
|
+
revision_id: z.number().int().positive()
|
|
52
|
+
}).strict();
|
|
53
|
+
const RevisionReverted = z.object({
|
|
54
|
+
outcome: z.literal("reverted"),
|
|
55
|
+
revision: Revision
|
|
56
|
+
});
|
|
57
|
+
const RevisionUnchanged = z.object({
|
|
58
|
+
outcome: z.literal("unchanged"),
|
|
59
|
+
revision: RevisionRow
|
|
60
|
+
});
|
|
61
|
+
const RevisionRevert = z.discriminatedUnion("outcome", [RevisionReverted, RevisionUnchanged]);
|
|
62
|
+
//#endregion
|
|
63
|
+
export { Revision, RevisionCompact, RevisionEntity, RevisionRevert, RevisionRevertInput, RevisionRow };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ModerationStatus } from "./moderation-review.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/domain/search.ts
|
|
4
|
+
const SEARCH_MODELS = [
|
|
5
|
+
"card",
|
|
6
|
+
"dataset",
|
|
7
|
+
"metric",
|
|
8
|
+
"dashboard",
|
|
9
|
+
"collection",
|
|
10
|
+
"database",
|
|
11
|
+
"table",
|
|
12
|
+
"segment",
|
|
13
|
+
"measure",
|
|
14
|
+
"document",
|
|
15
|
+
"exploration",
|
|
16
|
+
"action",
|
|
17
|
+
"transform",
|
|
18
|
+
"indexed-entity"
|
|
19
|
+
];
|
|
20
|
+
const SearchModel = z.enum(SEARCH_MODELS);
|
|
21
|
+
const SearchResultCollection = z.object({
|
|
22
|
+
id: z.union([
|
|
23
|
+
z.number().int(),
|
|
24
|
+
z.string(),
|
|
25
|
+
z.null()
|
|
26
|
+
]),
|
|
27
|
+
name: z.string().nullable(),
|
|
28
|
+
authority_level: z.string().nullable(),
|
|
29
|
+
type: z.string().nullable()
|
|
30
|
+
}).loose();
|
|
31
|
+
const SearchResultDashboard = z.object({
|
|
32
|
+
id: z.number().int(),
|
|
33
|
+
name: z.string()
|
|
34
|
+
}).loose();
|
|
35
|
+
const SearchResult = z.object({
|
|
36
|
+
id: z.union([z.number().int(), z.string()]),
|
|
37
|
+
name: z.string(),
|
|
38
|
+
model: SearchModel,
|
|
39
|
+
description: z.string().nullable().optional(),
|
|
40
|
+
archived: z.boolean().nullable(),
|
|
41
|
+
collection: SearchResultCollection.nullable(),
|
|
42
|
+
result_metadata: z.array(z.unknown()).nullable().optional(),
|
|
43
|
+
database_id: z.number().int().nullable().optional(),
|
|
44
|
+
database_name: z.string().nullable().optional(),
|
|
45
|
+
table_schema: z.string().nullable().optional(),
|
|
46
|
+
table_name: z.string().nullable().optional(),
|
|
47
|
+
moderated_status: ModerationStatus.nullable().optional(),
|
|
48
|
+
dashboard: SearchResultDashboard.nullable().optional()
|
|
49
|
+
}).loose();
|
|
50
|
+
const SearchResultCompact = SearchResult.pick({
|
|
51
|
+
id: true,
|
|
52
|
+
name: true,
|
|
53
|
+
model: true,
|
|
54
|
+
description: true,
|
|
55
|
+
database_name: true,
|
|
56
|
+
table_schema: true,
|
|
57
|
+
table_name: true
|
|
58
|
+
}).strip().extend({ dashboard: SearchResultDashboard.pick({
|
|
59
|
+
id: true,
|
|
60
|
+
name: true
|
|
61
|
+
}).strip().nullable().optional() });
|
|
62
|
+
//#endregion
|
|
63
|
+
export { SEARCH_MODELS, SearchModel, SearchResult, SearchResultCompact };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/segment.ts
|
|
3
|
+
const Segment = z.object({
|
|
4
|
+
id: z.number().int(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
description: z.string().nullable(),
|
|
7
|
+
archived: z.boolean(),
|
|
8
|
+
table_id: z.number().int(),
|
|
9
|
+
definition: z.unknown(),
|
|
10
|
+
creator_id: z.number().int(),
|
|
11
|
+
entity_id: z.string().nullable(),
|
|
12
|
+
show_in_getting_started: z.boolean().nullable(),
|
|
13
|
+
caveats: z.string().nullable(),
|
|
14
|
+
points_of_interest: z.string().nullable(),
|
|
15
|
+
definition_description: z.string().nullable().optional(),
|
|
16
|
+
created_at: z.string(),
|
|
17
|
+
updated_at: z.string()
|
|
18
|
+
}).loose();
|
|
19
|
+
const SegmentCompact = Segment.pick({
|
|
20
|
+
id: true,
|
|
21
|
+
name: true,
|
|
22
|
+
description: true,
|
|
23
|
+
archived: true,
|
|
24
|
+
table_id: true
|
|
25
|
+
}).strip();
|
|
26
|
+
const SegmentDefinition = z.record(z.string(), z.unknown()).describe("MBQL query holding the filter");
|
|
27
|
+
const SegmentCreateInput = z.object({
|
|
28
|
+
name: z.string().min(1),
|
|
29
|
+
table_id: z.number().int().positive(),
|
|
30
|
+
definition: SegmentDefinition,
|
|
31
|
+
description: z.string().nullable().optional()
|
|
32
|
+
}).loose();
|
|
33
|
+
const SegmentUpdateInput = z.object({
|
|
34
|
+
name: z.string().min(1).nullable().optional(),
|
|
35
|
+
definition: SegmentDefinition.nullable().optional(),
|
|
36
|
+
revision_message: z.string().min(1),
|
|
37
|
+
archived: z.boolean().nullable().optional(),
|
|
38
|
+
description: z.string().nullable().optional(),
|
|
39
|
+
caveats: z.string().nullable().optional(),
|
|
40
|
+
points_of_interest: z.string().nullable().optional(),
|
|
41
|
+
show_in_getting_started: z.boolean().nullable().optional()
|
|
42
|
+
}).loose();
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Segment, SegmentCompact, SegmentCreateInput, SegmentUpdateInput };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/session-properties.ts
|
|
3
|
+
const ServerVersion = z.object({
|
|
4
|
+
tag: z.string(),
|
|
5
|
+
date: z.string().optional(),
|
|
6
|
+
hash: z.string().optional()
|
|
7
|
+
}).loose();
|
|
8
|
+
const TokenFeatures = z.record(z.string(), z.boolean());
|
|
9
|
+
const SessionProperties = z.object({
|
|
10
|
+
version: ServerVersion,
|
|
11
|
+
"token-features": TokenFeatures.optional()
|
|
12
|
+
}).loose();
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SessionProperties, TokenFeatures };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/setting.ts
|
|
3
|
+
const Setting = z.object({
|
|
4
|
+
key: z.string(),
|
|
5
|
+
value: z.unknown(),
|
|
6
|
+
is_env_setting: z.boolean(),
|
|
7
|
+
env_name: z.string(),
|
|
8
|
+
description: z.string(),
|
|
9
|
+
default: z.unknown()
|
|
10
|
+
}).loose();
|
|
11
|
+
const SettingCompact = Setting.pick({
|
|
12
|
+
key: true,
|
|
13
|
+
value: true,
|
|
14
|
+
is_env_setting: true,
|
|
15
|
+
env_name: true
|
|
16
|
+
}).strip();
|
|
17
|
+
const SettingValue = z.object({
|
|
18
|
+
key: z.string(),
|
|
19
|
+
value: z.unknown()
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Setting, SettingCompact, SettingValue };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/setup.ts
|
|
3
|
+
const SetupUserInput = z.object({
|
|
4
|
+
first_name: z.string().min(1).nullable().optional(),
|
|
5
|
+
last_name: z.string().min(1).nullable().optional(),
|
|
6
|
+
email: z.email(),
|
|
7
|
+
password: z.string().min(1).describe("must satisfy the server's password complexity requirements")
|
|
8
|
+
}).loose();
|
|
9
|
+
const SetupPrefsInput = z.object({
|
|
10
|
+
site_name: z.string().min(1),
|
|
11
|
+
site_locale: z.string().min(1).nullable().optional()
|
|
12
|
+
}).loose();
|
|
13
|
+
const SetupInput = z.object({
|
|
14
|
+
token: z.string().min(1),
|
|
15
|
+
user: SetupUserInput,
|
|
16
|
+
prefs: SetupPrefsInput
|
|
17
|
+
}).loose();
|
|
18
|
+
const SetupResult = z.object({ id: z.string() }).loose();
|
|
19
|
+
const SetupResultCompact = SetupResult.pick({ id: true }).strip();
|
|
20
|
+
//#endregion
|
|
21
|
+
export { SetupInput, SetupResult, SetupResultCompact };
|