@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,147 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/git-sync.ts
|
|
3
|
+
const SyncTaskStatus = z.enum([
|
|
4
|
+
"running",
|
|
5
|
+
"successful",
|
|
6
|
+
"errored",
|
|
7
|
+
"cancelled",
|
|
8
|
+
"timed-out",
|
|
9
|
+
"conflict"
|
|
10
|
+
]);
|
|
11
|
+
const SyncTaskType = z.enum(["import", "export"]);
|
|
12
|
+
/**
|
|
13
|
+
* The direction an instance syncs in: `read-only` follows the remote branch and refuses local edits
|
|
14
|
+
* to synced content; `read-write` also exports its own changes.
|
|
15
|
+
*/
|
|
16
|
+
const SyncType = z.enum(["read-only", "read-write"]);
|
|
17
|
+
/**
|
|
18
|
+
* Whether a remote is configured, the direction the instance syncs in, and the branch it tracks,
|
|
19
|
+
* `null` when none is set. The sync type is a `SyncType` when an admin sets it; a server that reads
|
|
20
|
+
* `MB_REMOTE_SYNC_TYPE` (60 and later) does not check that value, so it is the string the server
|
|
21
|
+
* holds.
|
|
22
|
+
*/
|
|
23
|
+
const RemoteSyncState = z.object({
|
|
24
|
+
configured: z.boolean(),
|
|
25
|
+
sync_type: z.string(),
|
|
26
|
+
branch: z.string().nullable()
|
|
27
|
+
});
|
|
28
|
+
const TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
29
|
+
"successful",
|
|
30
|
+
"errored",
|
|
31
|
+
"cancelled",
|
|
32
|
+
"timed-out",
|
|
33
|
+
"conflict"
|
|
34
|
+
]);
|
|
35
|
+
const FAILED_STATUSES = /* @__PURE__ */ new Set([
|
|
36
|
+
"errored",
|
|
37
|
+
"timed-out",
|
|
38
|
+
"conflict"
|
|
39
|
+
]);
|
|
40
|
+
/** Whether the server will report any further progress for a task in this status. */
|
|
41
|
+
function isSyncTaskTerminal(status) {
|
|
42
|
+
return TERMINAL_STATUSES.has(status);
|
|
43
|
+
}
|
|
44
|
+
/** Whether a terminal status means the sync did not carry out what it was asked to. */
|
|
45
|
+
function isSyncTaskFailed(status) {
|
|
46
|
+
return FAILED_STATUSES.has(status);
|
|
47
|
+
}
|
|
48
|
+
const SyncTask = z.object({
|
|
49
|
+
id: z.number().int().positive(),
|
|
50
|
+
sync_task_type: SyncTaskType,
|
|
51
|
+
status: SyncTaskStatus,
|
|
52
|
+
progress: z.number().min(0).max(1).nullable(),
|
|
53
|
+
started_at: z.string(),
|
|
54
|
+
ended_at: z.string().nullable().optional(),
|
|
55
|
+
last_progress_report_at: z.string().nullable().optional(),
|
|
56
|
+
version: z.string().nullable().optional(),
|
|
57
|
+
initiated_by: z.number().int().positive().nullable().optional(),
|
|
58
|
+
cancelled: z.boolean().nullable().optional(),
|
|
59
|
+
error_message: z.string().nullable().optional(),
|
|
60
|
+
conflicts: z.array(z.string()).nullable().optional()
|
|
61
|
+
}).loose();
|
|
62
|
+
const SyncTaskCompact = SyncTask.pick({
|
|
63
|
+
id: true,
|
|
64
|
+
sync_task_type: true,
|
|
65
|
+
status: true,
|
|
66
|
+
progress: true,
|
|
67
|
+
version: true,
|
|
68
|
+
error_message: true,
|
|
69
|
+
conflicts: true
|
|
70
|
+
}).strip();
|
|
71
|
+
const SyncDirtyItem = z.object({
|
|
72
|
+
id: z.number().int(),
|
|
73
|
+
name: z.string().nullable(),
|
|
74
|
+
model: z.string(),
|
|
75
|
+
sync_status: z.string(),
|
|
76
|
+
collection_id: z.number().int().positive().nullable().optional(),
|
|
77
|
+
description: z.string().nullable().optional(),
|
|
78
|
+
display: z.string().nullable().optional(),
|
|
79
|
+
query_type: z.string().nullable().optional(),
|
|
80
|
+
table_id: z.number().int().positive().nullable().optional(),
|
|
81
|
+
table_name: z.string().nullable().optional()
|
|
82
|
+
}).loose();
|
|
83
|
+
const SyncDirtyItemCompact = SyncDirtyItem.pick({
|
|
84
|
+
id: true,
|
|
85
|
+
name: true,
|
|
86
|
+
model: true,
|
|
87
|
+
sync_status: true,
|
|
88
|
+
collection_id: true
|
|
89
|
+
}).strip();
|
|
90
|
+
const SyncRemoteChanges = z.object({
|
|
91
|
+
has_changes: z.boolean(),
|
|
92
|
+
remote_version: z.string().nullable(),
|
|
93
|
+
local_version: z.string().nullable(),
|
|
94
|
+
cached: z.boolean()
|
|
95
|
+
});
|
|
96
|
+
const SyncMergeSummary = z.object({
|
|
97
|
+
added: z.number().int(),
|
|
98
|
+
updated: z.number().int(),
|
|
99
|
+
removed: z.number().int()
|
|
100
|
+
});
|
|
101
|
+
const SyncForcePushCasualties = z.object({
|
|
102
|
+
deleted: z.array(z.string()),
|
|
103
|
+
overwritten: z.array(z.string())
|
|
104
|
+
});
|
|
105
|
+
const SyncExportPreflight = z.object({
|
|
106
|
+
has_changes: z.boolean(),
|
|
107
|
+
clean: z.boolean(),
|
|
108
|
+
conflicts: z.array(z.string()),
|
|
109
|
+
summary: SyncMergeSummary,
|
|
110
|
+
force_push_casualties: SyncForcePushCasualties,
|
|
111
|
+
reason: z.literal("history-rewritten").nullable()
|
|
112
|
+
}).loose();
|
|
113
|
+
const SyncExportPreflightCompact = SyncExportPreflight.pick({
|
|
114
|
+
has_changes: true,
|
|
115
|
+
clean: true,
|
|
116
|
+
conflicts: true,
|
|
117
|
+
summary: true,
|
|
118
|
+
force_push_casualties: true,
|
|
119
|
+
reason: true
|
|
120
|
+
}).strip();
|
|
121
|
+
const SyncBranchCreated = z.object({
|
|
122
|
+
status: z.literal("success"),
|
|
123
|
+
message: z.string()
|
|
124
|
+
});
|
|
125
|
+
const SyncSettingsUpdateResult = z.object({
|
|
126
|
+
success: z.boolean(),
|
|
127
|
+
task_id: z.number().int().positive().optional()
|
|
128
|
+
});
|
|
129
|
+
const SyncImportResult = z.object({
|
|
130
|
+
message: z.string().nullable(),
|
|
131
|
+
task_id: z.number().int().positive().nullable(),
|
|
132
|
+
final: SyncTask.nullable().optional()
|
|
133
|
+
});
|
|
134
|
+
const SyncExportResult = z.object({
|
|
135
|
+
message: z.string(),
|
|
136
|
+
task_id: z.number().int().positive(),
|
|
137
|
+
branch: z.string().nullable(),
|
|
138
|
+
final: SyncTask.nullable().optional()
|
|
139
|
+
});
|
|
140
|
+
const SyncStashResult = z.object({
|
|
141
|
+
status: z.literal("success"),
|
|
142
|
+
message: z.string(),
|
|
143
|
+
task_id: z.number().int().positive(),
|
|
144
|
+
final: SyncTask.nullable().optional()
|
|
145
|
+
});
|
|
146
|
+
//#endregion
|
|
147
|
+
export { RemoteSyncState, SyncBranchCreated, SyncDirtyItem, SyncDirtyItemCompact, SyncExportPreflight, SyncExportPreflightCompact, SyncExportResult, SyncForcePushCasualties, SyncImportResult, SyncMergeSummary, SyncRemoteChanges, SyncSettingsUpdateResult, SyncStashResult, SyncTask, SyncTaskCompact, SyncTaskStatus, SyncTaskType, SyncType, isSyncTaskFailed, isSyncTaskTerminal };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NonBlankText } from "./text.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/domain/glossary.ts
|
|
4
|
+
const GlossaryCreator = z.object({
|
|
5
|
+
id: z.number().int(),
|
|
6
|
+
email: z.string(),
|
|
7
|
+
first_name: z.string().nullable(),
|
|
8
|
+
last_name: z.string().nullable()
|
|
9
|
+
}).loose();
|
|
10
|
+
const Glossary = z.object({
|
|
11
|
+
id: z.number().int(),
|
|
12
|
+
term: z.string(),
|
|
13
|
+
definition: z.string(),
|
|
14
|
+
creator_id: z.number().int(),
|
|
15
|
+
creator: GlossaryCreator,
|
|
16
|
+
created_at: z.string(),
|
|
17
|
+
updated_at: z.string()
|
|
18
|
+
}).loose();
|
|
19
|
+
const GlossaryCompact = Glossary.pick({
|
|
20
|
+
id: true,
|
|
21
|
+
term: true,
|
|
22
|
+
definition: true
|
|
23
|
+
}).strip();
|
|
24
|
+
const GlossaryCreateInput = z.object({
|
|
25
|
+
term: NonBlankText,
|
|
26
|
+
definition: NonBlankText
|
|
27
|
+
}).strict();
|
|
28
|
+
const GlossaryUpdateInput = GlossaryCreateInput;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Glossary, GlossaryCompact, GlossaryCreateInput, GlossaryUpdateInput };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as LibraryListing, c as libraryWireSchema, i as LibraryCompact, l as toLibrary, n as LibraryChild, o as LibraryPublishTablesInput, r as LibraryCollectionInfo, s as LibraryWire, t as Library } from "../library-Cx9h_RkU.js";
|
|
2
|
+
export { Library, LibraryChild, LibraryCollectionInfo, LibraryCompact, LibraryListing, LibraryPublishTablesInput, LibraryWire, libraryWireSchema, toLibrary };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { TableSelectors } from "./table.js";
|
|
2
|
+
import { Collection, CollectionId, CollectionType } from "./collection.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/domain/library.ts
|
|
5
|
+
const LibraryChildWireV59 = z.object({
|
|
6
|
+
id: CollectionId,
|
|
7
|
+
name: z.string(),
|
|
8
|
+
description: z.string().nullable()
|
|
9
|
+
});
|
|
10
|
+
const LibraryChildWireV62 = LibraryChildWireV59.extend({ type: CollectionType.nullable() });
|
|
11
|
+
const LibraryChild = LibraryChildWireV62.extend({ is_remote_synced: z.boolean().nullable() });
|
|
12
|
+
const Library = Collection.extend({ effective_children: z.array(LibraryChild) }).loose();
|
|
13
|
+
const LibraryCompact = Library.pick({
|
|
14
|
+
id: true,
|
|
15
|
+
name: true,
|
|
16
|
+
type: true,
|
|
17
|
+
effective_children: true
|
|
18
|
+
}).strip();
|
|
19
|
+
const LibraryCollectionInfo = Collection.pick({
|
|
20
|
+
id: true,
|
|
21
|
+
type: true,
|
|
22
|
+
is_remote_synced: true
|
|
23
|
+
}).strip();
|
|
24
|
+
const LibraryPublishTablesInput = TableSelectors.extend({ collection_id: z.number().int().positive() }).strict();
|
|
25
|
+
const LibraryWireV59 = Collection.extend({ effective_children: z.array(LibraryChildWireV59) }).loose();
|
|
26
|
+
const LibraryWireV62 = Collection.extend({ effective_children: z.array(LibraryChildWireV62) }).loose();
|
|
27
|
+
const AbsentLibrary = z.object({ data: z.null() });
|
|
28
|
+
/**
|
|
29
|
+
* The shape `GET /api/ee/library/` answers on a server with `features`: the Library as sent,
|
|
30
|
+
* awaiting `toLibrary`, or `null` on an instance that has none.
|
|
31
|
+
*/
|
|
32
|
+
function libraryWireSchema(features) {
|
|
33
|
+
return presentOrAbsent(features.libraryChildrenCarryType ? LibraryWireV62.transform((root) => ({
|
|
34
|
+
childrenCarryType: true,
|
|
35
|
+
root
|
|
36
|
+
})) : LibraryWireV59.transform((root) => ({
|
|
37
|
+
childrenCarryType: false,
|
|
38
|
+
root
|
|
39
|
+
})));
|
|
40
|
+
}
|
|
41
|
+
function presentOrAbsent(present) {
|
|
42
|
+
return z.unknown().transform((value, ctx) => {
|
|
43
|
+
if (AbsentLibrary.safeParse(value).success) return null;
|
|
44
|
+
const parsed = present.safeParse(value);
|
|
45
|
+
if (parsed.success) return parsed.data;
|
|
46
|
+
for (const issue of parsed.error.issues) ctx.addIssue({ ...issue });
|
|
47
|
+
return z.NEVER;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** `wire` read as `Library`, with what its children's projection omitted taken from `listing`. */
|
|
51
|
+
function toLibrary(wire, listing) {
|
|
52
|
+
if (wire.childrenCarryType) {
|
|
53
|
+
const effective_children = wire.root.effective_children.map((child) => ({
|
|
54
|
+
...child,
|
|
55
|
+
is_remote_synced: listedSyncFlag(child.id, listing)
|
|
56
|
+
}));
|
|
57
|
+
return {
|
|
58
|
+
...wire.root,
|
|
59
|
+
effective_children
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const effective_children = wire.root.effective_children.map((child) => ({
|
|
63
|
+
...child,
|
|
64
|
+
type: listedType(child.id, listing),
|
|
65
|
+
is_remote_synced: listedSyncFlag(child.id, listing)
|
|
66
|
+
}));
|
|
67
|
+
return {
|
|
68
|
+
...wire.root,
|
|
69
|
+
effective_children
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function listed(id, listing) {
|
|
73
|
+
if (typeof id !== "number") return null;
|
|
74
|
+
return listing.get(id) ?? null;
|
|
75
|
+
}
|
|
76
|
+
function listedType(id, listing) {
|
|
77
|
+
return listed(id, listing)?.type ?? null;
|
|
78
|
+
}
|
|
79
|
+
function listedSyncFlag(id, listing) {
|
|
80
|
+
return listed(id, listing)?.is_remote_synced ?? null;
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { Library, LibraryChild, LibraryCollectionInfo, LibraryCompact, LibraryPublishTablesInput, libraryWireSchema, toLibrary };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/measure.ts
|
|
3
|
+
const Measure = 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
|
+
dimensions: z.array(z.unknown()).nullish(),
|
|
13
|
+
dimension_mappings: z.array(z.unknown()).nullish(),
|
|
14
|
+
definition_description: z.string().nullable().optional(),
|
|
15
|
+
result_column_name: z.string().nullable().optional(),
|
|
16
|
+
created_at: z.string(),
|
|
17
|
+
updated_at: z.string()
|
|
18
|
+
}).loose();
|
|
19
|
+
const MeasureCompact = Measure.pick({
|
|
20
|
+
id: true,
|
|
21
|
+
name: true,
|
|
22
|
+
description: true,
|
|
23
|
+
archived: true,
|
|
24
|
+
table_id: true
|
|
25
|
+
}).strip();
|
|
26
|
+
const MeasureDefinition = z.record(z.string(), z.unknown()).describe("MBQL query holding exactly one aggregation");
|
|
27
|
+
const MeasureCreateInput = z.object({
|
|
28
|
+
name: z.string().min(1),
|
|
29
|
+
table_id: z.number().int().positive(),
|
|
30
|
+
definition: MeasureDefinition,
|
|
31
|
+
description: z.string().nullable().optional()
|
|
32
|
+
}).loose();
|
|
33
|
+
const MeasureUpdateInput = z.object({
|
|
34
|
+
name: z.string().min(1).nullable().optional(),
|
|
35
|
+
definition: MeasureDefinition.nullable().optional(),
|
|
36
|
+
revision_message: z.string().min(1),
|
|
37
|
+
archived: z.boolean().nullable().optional(),
|
|
38
|
+
description: z.string().nullable().optional()
|
|
39
|
+
}).loose();
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Measure, MeasureCompact, MeasureCreateInput, MeasureUpdateInput };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as MetricProjection, S as MetricMathOperator, _ as MetricInstanceFilter, a as MetricBreakoutValues, b as MetricMappingTarget, c as MetricDimensionCompact, d as MetricDimensionRef, f as MetricDimensionRefOptions, g as MetricFilterClause, h as MetricFilterArgument, i as MetricBreakoutColumn, l as MetricDimensionGroup, m as MetricDimensionStatus, n as MetricAddableGroup, o as MetricDefinition, p as MetricDimensionSource, r as MetricBinning, s as MetricDimension, t as MetricAddableDimension, u as MetricDimensionListing, v as MetricLeafRef, x as MetricMathExpression, y as MetricLeafType } from "../metric-yvehaVCS.js";
|
|
2
|
+
export { MetricAddableDimension, MetricAddableGroup, MetricBinning, MetricBreakoutColumn, MetricBreakoutValues, MetricDefinition, MetricDimension, MetricDimensionCompact, MetricDimensionGroup, MetricDimensionListing, MetricDimensionRef, MetricDimensionRefOptions, MetricDimensionSource, MetricDimensionStatus, MetricFilterArgument, MetricFilterClause, MetricInstanceFilter, MetricLeafRef, MetricLeafType, MetricMappingTarget, MetricMathExpression, MetricMathOperator, MetricProjection };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { FieldBaseType, FieldSemanticType } from "./field.js";
|
|
2
|
+
import { TemporalUnit } from "./parameter.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/domain/metric.ts
|
|
5
|
+
const ClauseOptions = z.object({}).loose();
|
|
6
|
+
const MetricLeafType = z.enum(["metric", "measure"]);
|
|
7
|
+
const MetricLeafRef = z.tuple([
|
|
8
|
+
MetricLeafType,
|
|
9
|
+
z.object({ "lib/uuid": z.string().min(1) }).strict(),
|
|
10
|
+
z.number().int().positive()
|
|
11
|
+
]);
|
|
12
|
+
const MetricMathOperator = z.enum([
|
|
13
|
+
"+",
|
|
14
|
+
"-",
|
|
15
|
+
"*",
|
|
16
|
+
"/"
|
|
17
|
+
]);
|
|
18
|
+
const MetricMathExpression = z.lazy(() => z.union([
|
|
19
|
+
MetricLeafRef,
|
|
20
|
+
z.number(),
|
|
21
|
+
z.tuple([
|
|
22
|
+
MetricMathOperator,
|
|
23
|
+
ClauseOptions,
|
|
24
|
+
MetricMathExpression,
|
|
25
|
+
MetricMathExpression
|
|
26
|
+
]).rest(MetricMathExpression)
|
|
27
|
+
]));
|
|
28
|
+
const MetricBinning = z.discriminatedUnion("strategy", [
|
|
29
|
+
z.object({ strategy: z.literal("default") }).strict(),
|
|
30
|
+
z.object({
|
|
31
|
+
strategy: z.literal("bin-width"),
|
|
32
|
+
"bin-width": z.number().positive()
|
|
33
|
+
}).strict(),
|
|
34
|
+
z.object({
|
|
35
|
+
strategy: z.literal("num-bins"),
|
|
36
|
+
"num-bins": z.number().int().positive()
|
|
37
|
+
}).strict()
|
|
38
|
+
]);
|
|
39
|
+
const MetricDimensionRefOptions = z.object({
|
|
40
|
+
"lib/uuid": z.string().min(1).optional(),
|
|
41
|
+
"display-name": z.string().min(1).nullable().optional(),
|
|
42
|
+
"effective-type": FieldBaseType.nullable().optional(),
|
|
43
|
+
"semantic-type": FieldSemanticType.nullable().optional(),
|
|
44
|
+
"temporal-unit": TemporalUnit.nullable().optional(),
|
|
45
|
+
binning: MetricBinning.nullable().optional()
|
|
46
|
+
}).strict();
|
|
47
|
+
const MetricDimensionRef = z.tuple([
|
|
48
|
+
z.literal("dimension"),
|
|
49
|
+
MetricDimensionRefOptions,
|
|
50
|
+
z.string().min(1)
|
|
51
|
+
]);
|
|
52
|
+
const MetricFilterArgument = z.lazy(() => z.union([
|
|
53
|
+
MetricDimensionRef,
|
|
54
|
+
MetricFilterClause,
|
|
55
|
+
z.string(),
|
|
56
|
+
z.number(),
|
|
57
|
+
z.boolean(),
|
|
58
|
+
z.null()
|
|
59
|
+
]));
|
|
60
|
+
const MetricFilterClause = z.lazy(() => z.tuple([z.string().min(1), ClauseOptions]).rest(MetricFilterArgument));
|
|
61
|
+
const MetricInstanceFilter = z.object({
|
|
62
|
+
"lib/uuid": z.string().min(1),
|
|
63
|
+
filter: MetricFilterClause
|
|
64
|
+
}).strict();
|
|
65
|
+
const MetricProjection = z.object({
|
|
66
|
+
type: MetricLeafType,
|
|
67
|
+
id: z.number().int().positive(),
|
|
68
|
+
"lib/uuid": z.string().min(1),
|
|
69
|
+
projection: z.array(MetricDimensionRef)
|
|
70
|
+
}).strict();
|
|
71
|
+
const MetricDefinition = z.object({
|
|
72
|
+
expression: MetricMathExpression,
|
|
73
|
+
filters: z.array(MetricInstanceFilter).nullable().optional(),
|
|
74
|
+
projections: z.array(MetricProjection).nullable().optional()
|
|
75
|
+
}).strict();
|
|
76
|
+
const MetricBreakoutColumn = z.object({
|
|
77
|
+
name: z.string().optional(),
|
|
78
|
+
display_name: z.string().optional(),
|
|
79
|
+
base_type: FieldBaseType.optional(),
|
|
80
|
+
effective_type: FieldBaseType.optional(),
|
|
81
|
+
semantic_type: FieldSemanticType.nullable().optional()
|
|
82
|
+
}).loose();
|
|
83
|
+
const MetricBreakoutValues = z.object({
|
|
84
|
+
values: z.array(z.unknown()),
|
|
85
|
+
col: MetricBreakoutColumn
|
|
86
|
+
}).loose();
|
|
87
|
+
const MetricDimensionStatus = z.enum(["status/active", "status/orphaned"]);
|
|
88
|
+
const MetricDimensionSource = z.object({
|
|
89
|
+
type: z.literal("field"),
|
|
90
|
+
"field-id": z.number().int().nullable()
|
|
91
|
+
}).loose();
|
|
92
|
+
const MetricDimensionGroup = z.object({
|
|
93
|
+
id: z.string(),
|
|
94
|
+
type: z.enum(["main", "connection"]),
|
|
95
|
+
display_name: z.string()
|
|
96
|
+
}).loose();
|
|
97
|
+
const MetricDimension = z.object({
|
|
98
|
+
id: z.string(),
|
|
99
|
+
name: z.string().nullable(),
|
|
100
|
+
display_name: z.string().nullable(),
|
|
101
|
+
description: z.string().nullable().optional(),
|
|
102
|
+
effective_type: FieldBaseType.nullable(),
|
|
103
|
+
semantic_type: FieldSemanticType.nullable(),
|
|
104
|
+
has_field_values: z.enum([
|
|
105
|
+
"list",
|
|
106
|
+
"search",
|
|
107
|
+
"none"
|
|
108
|
+
]).optional(),
|
|
109
|
+
status: MetricDimensionStatus.optional(),
|
|
110
|
+
status_message: z.string().optional(),
|
|
111
|
+
sources: z.array(MetricDimensionSource).optional(),
|
|
112
|
+
group: MetricDimensionGroup.optional(),
|
|
113
|
+
dimension_interestingness: z.number().optional(),
|
|
114
|
+
default_temporal_unit: TemporalUnit.optional(),
|
|
115
|
+
default: z.boolean().nullable().optional()
|
|
116
|
+
}).loose();
|
|
117
|
+
const MetricDimensionCompact = MetricDimension.pick({
|
|
118
|
+
id: true,
|
|
119
|
+
name: true,
|
|
120
|
+
display_name: true,
|
|
121
|
+
description: true,
|
|
122
|
+
effective_type: true,
|
|
123
|
+
semantic_type: true,
|
|
124
|
+
status: true,
|
|
125
|
+
group: true,
|
|
126
|
+
default: true
|
|
127
|
+
}).strip();
|
|
128
|
+
const MetricMappingTarget = z.tuple([z.string(), ClauseOptions]).rest(z.unknown());
|
|
129
|
+
const MetricAddableDimension = MetricDimension.extend({ mapping_target: MetricMappingTarget });
|
|
130
|
+
const MetricAddableGroup = z.object({
|
|
131
|
+
group: MetricDimensionGroup.nullable(),
|
|
132
|
+
dimensions: z.array(MetricAddableDimension)
|
|
133
|
+
}).loose();
|
|
134
|
+
const MetricDimensionListing = z.object({
|
|
135
|
+
added: z.array(MetricDimension),
|
|
136
|
+
addable: z.array(MetricAddableGroup)
|
|
137
|
+
}).loose();
|
|
138
|
+
//#endregion
|
|
139
|
+
export { MetricAddableDimension, MetricAddableGroup, MetricBinning, MetricBreakoutColumn, MetricBreakoutValues, MetricDefinition, MetricDimension, MetricDimensionCompact, MetricDimensionGroup, MetricDimensionListing, MetricDimensionRef, MetricDimensionRefOptions, MetricDimensionSource, MetricDimensionStatus, MetricFilterClause, MetricInstanceFilter, MetricLeafRef, MetricLeafType, MetricMappingTarget, MetricMathExpression, MetricMathOperator, MetricProjection };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ModerationStatus, i as ModerationReviewCreateInput, n as ModerationReview, r as ModerationReviewCompact, t as ModeratedItemType } from "../moderation-review-B4RUTZ6_.js";
|
|
2
|
+
export { ModeratedItemType, ModerationReview, ModerationReviewCompact, ModerationReviewCreateInput, ModerationStatus };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/moderation-review.ts
|
|
3
|
+
const ModeratedItemType = z.enum(["card", "dashboard"]);
|
|
4
|
+
const ModerationStatus = z.enum(["verified"]);
|
|
5
|
+
const ModerationReview = z.object({
|
|
6
|
+
id: z.number().int(),
|
|
7
|
+
moderated_item_id: z.number().int(),
|
|
8
|
+
moderated_item_type: ModeratedItemType,
|
|
9
|
+
moderator_id: z.number().int(),
|
|
10
|
+
status: ModerationStatus.nullable(),
|
|
11
|
+
text: z.string().nullable(),
|
|
12
|
+
most_recent: z.boolean(),
|
|
13
|
+
created_at: z.string(),
|
|
14
|
+
updated_at: z.string()
|
|
15
|
+
}).loose();
|
|
16
|
+
const ModerationReviewCompact = ModerationReview.pick({
|
|
17
|
+
id: true,
|
|
18
|
+
moderated_item_id: true,
|
|
19
|
+
moderated_item_type: true,
|
|
20
|
+
status: true,
|
|
21
|
+
text: true,
|
|
22
|
+
most_recent: true
|
|
23
|
+
}).strip();
|
|
24
|
+
const ModerationReviewCreateInput = z.object({
|
|
25
|
+
moderated_item_id: z.number().int().positive(),
|
|
26
|
+
moderated_item_type: ModeratedItemType,
|
|
27
|
+
status: ModerationStatus.nullable().optional(),
|
|
28
|
+
text: z.string().nullable().optional()
|
|
29
|
+
}).strict();
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ModeratedItemType, ModerationReview, ModerationReviewCompact, ModerationReviewCreateInput, ModerationStatus };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as NotificationSubscription, a as NotificationCardPayloadPatch, b as NotificationUpdateInput, c as NotificationCreateInput, d as NotificationPayloadType, f as NotificationRecipient, g as NotificationSendCondition, h as NotificationRecipientType, i as NotificationCardPayloadCompact, l as NotificationHandler, m as NotificationRecipientDetails, n as Notification, o as NotificationChannelType, p as NotificationRecipientCompact, r as NotificationCardPayload, s as NotificationCompact, t as CARD_PAYLOAD_TYPE, u as NotificationHandlerCompact, v as NotificationSubscriptionCompact, y as NotificationSubscriptionType } from "../notification-BT2TDAd_.js";
|
|
2
|
+
export { CARD_PAYLOAD_TYPE, Notification, NotificationCardPayload, NotificationCardPayloadCompact, NotificationCardPayloadPatch, NotificationChannelType, NotificationCompact, NotificationCreateInput, NotificationHandler, NotificationHandlerCompact, NotificationPayloadType, NotificationRecipient, NotificationRecipientCompact, NotificationRecipientDetails, NotificationRecipientType, NotificationSendCondition, NotificationSubscription, NotificationSubscriptionCompact, NotificationSubscriptionType, NotificationUpdateInput };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { CronUiDisplayType } from "./cron.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/domain/notification.ts
|
|
4
|
+
const NotificationPayloadType = z.enum([
|
|
5
|
+
"notification/card",
|
|
6
|
+
"notification/dashboard",
|
|
7
|
+
"notification/system-event",
|
|
8
|
+
"notification/testing"
|
|
9
|
+
]);
|
|
10
|
+
const CARD_PAYLOAD_TYPE = "notification/card";
|
|
11
|
+
const NotificationSendCondition = z.enum([
|
|
12
|
+
"has_result",
|
|
13
|
+
"goal_above",
|
|
14
|
+
"goal_below"
|
|
15
|
+
]);
|
|
16
|
+
const NotificationChannelType = z.enum([
|
|
17
|
+
"channel/email",
|
|
18
|
+
"channel/slack",
|
|
19
|
+
"channel/http"
|
|
20
|
+
]);
|
|
21
|
+
const NotificationRecipientType = z.enum([
|
|
22
|
+
"notification-recipient/user",
|
|
23
|
+
"notification-recipient/group",
|
|
24
|
+
"notification-recipient/raw-value",
|
|
25
|
+
"notification-recipient/template"
|
|
26
|
+
]);
|
|
27
|
+
const NotificationSubscriptionType = z.enum(["notification-subscription/cron", "notification-subscription/system-event"]);
|
|
28
|
+
const NotificationRecipientDetails = z.object({
|
|
29
|
+
value: z.string().optional(),
|
|
30
|
+
channel_id: z.string().nullable().optional()
|
|
31
|
+
}).loose();
|
|
32
|
+
const NotificationRecipientDetailsCompact = NotificationRecipientDetails.pick({
|
|
33
|
+
value: true,
|
|
34
|
+
channel_id: true
|
|
35
|
+
}).strip();
|
|
36
|
+
const NotificationRecipient = z.object({
|
|
37
|
+
id: z.number().int().optional(),
|
|
38
|
+
type: NotificationRecipientType,
|
|
39
|
+
user_id: z.number().int().nullable().optional(),
|
|
40
|
+
permissions_group_id: z.number().int().nullable().optional(),
|
|
41
|
+
details: NotificationRecipientDetails.nullable().optional()
|
|
42
|
+
}).loose();
|
|
43
|
+
const NotificationRecipientCompact = NotificationRecipient.pick({
|
|
44
|
+
type: true,
|
|
45
|
+
user_id: true,
|
|
46
|
+
permissions_group_id: true
|
|
47
|
+
}).strip().extend({ details: NotificationRecipientDetailsCompact.nullable().optional() });
|
|
48
|
+
const NotificationHandler = z.object({
|
|
49
|
+
id: z.number().int().optional(),
|
|
50
|
+
channel_type: NotificationChannelType,
|
|
51
|
+
channel_id: z.number().int().nullable().optional(),
|
|
52
|
+
template_id: z.number().int().nullable().optional(),
|
|
53
|
+
active: z.boolean().optional(),
|
|
54
|
+
recipients: z.array(NotificationRecipient).optional()
|
|
55
|
+
}).loose();
|
|
56
|
+
const NotificationHandlerCompact = NotificationHandler.pick({
|
|
57
|
+
channel_type: true,
|
|
58
|
+
channel_id: true
|
|
59
|
+
}).strip().extend({ recipients: z.array(NotificationRecipientCompact).optional() });
|
|
60
|
+
const NotificationSubscription = z.object({
|
|
61
|
+
id: z.number().int().optional(),
|
|
62
|
+
type: NotificationSubscriptionType,
|
|
63
|
+
cron_schedule: z.string().nullable().optional(),
|
|
64
|
+
event_name: z.string().nullable().optional(),
|
|
65
|
+
ui_display_type: CronUiDisplayType.nullable().optional()
|
|
66
|
+
}).loose();
|
|
67
|
+
const NotificationSubscriptionCompact = NotificationSubscription.pick({
|
|
68
|
+
type: true,
|
|
69
|
+
cron_schedule: true
|
|
70
|
+
}).strip();
|
|
71
|
+
const NotificationCardPayload = z.object({
|
|
72
|
+
id: z.number().int().optional(),
|
|
73
|
+
card_id: z.number().int(),
|
|
74
|
+
send_condition: NotificationSendCondition,
|
|
75
|
+
send_once: z.boolean()
|
|
76
|
+
}).loose();
|
|
77
|
+
const NotificationCardPayloadCompact = NotificationCardPayload.pick({
|
|
78
|
+
card_id: true,
|
|
79
|
+
send_condition: true,
|
|
80
|
+
send_once: true
|
|
81
|
+
}).strip();
|
|
82
|
+
const Notification = z.object({
|
|
83
|
+
id: z.number().int(),
|
|
84
|
+
payload_type: NotificationPayloadType,
|
|
85
|
+
payload_id: z.number().int().nullable(),
|
|
86
|
+
payload: NotificationCardPayload.nullable(),
|
|
87
|
+
active: z.boolean(),
|
|
88
|
+
creator_id: z.number().int().nullable(),
|
|
89
|
+
subscriptions: z.array(NotificationSubscription),
|
|
90
|
+
handlers: z.array(NotificationHandler)
|
|
91
|
+
}).loose();
|
|
92
|
+
const NotificationCompact = Notification.pick({
|
|
93
|
+
id: true,
|
|
94
|
+
payload_type: true,
|
|
95
|
+
active: true,
|
|
96
|
+
creator_id: true
|
|
97
|
+
}).strip().extend({
|
|
98
|
+
payload: NotificationCardPayloadCompact.nullable(),
|
|
99
|
+
subscriptions: z.array(NotificationSubscriptionCompact),
|
|
100
|
+
handlers: z.array(NotificationHandlerCompact)
|
|
101
|
+
});
|
|
102
|
+
const NotificationRecipientInput = z.object({
|
|
103
|
+
type: NotificationRecipientType,
|
|
104
|
+
user_id: z.number().int().positive().optional(),
|
|
105
|
+
permissions_group_id: z.number().int().positive().optional(),
|
|
106
|
+
details: NotificationRecipientDetails.optional()
|
|
107
|
+
}).loose();
|
|
108
|
+
const NotificationHandlerInput = z.object({
|
|
109
|
+
channel_type: NotificationChannelType,
|
|
110
|
+
channel_id: z.number().int().positive().nullable().optional(),
|
|
111
|
+
active: z.boolean().optional(),
|
|
112
|
+
recipients: z.array(NotificationRecipientInput).optional()
|
|
113
|
+
}).loose();
|
|
114
|
+
const NotificationSubscriptionInput = z.object({
|
|
115
|
+
type: NotificationSubscriptionType.default("notification-subscription/cron"),
|
|
116
|
+
cron_schedule: z.string().min(1)
|
|
117
|
+
}).loose();
|
|
118
|
+
const NotificationCardPayloadInput = z.object({
|
|
119
|
+
card_id: z.number().int().positive(),
|
|
120
|
+
send_condition: NotificationSendCondition.optional(),
|
|
121
|
+
send_once: z.boolean().optional()
|
|
122
|
+
}).loose();
|
|
123
|
+
const NotificationCreateInput = z.object({
|
|
124
|
+
payload_type: NotificationPayloadType.default(CARD_PAYLOAD_TYPE),
|
|
125
|
+
payload: NotificationCardPayloadInput,
|
|
126
|
+
subscriptions: z.array(NotificationSubscriptionInput).min(1),
|
|
127
|
+
handlers: z.array(NotificationHandlerInput).min(1),
|
|
128
|
+
active: z.boolean().optional()
|
|
129
|
+
}).loose();
|
|
130
|
+
const NotificationCardPayloadPatch = NotificationCardPayloadInput.partial();
|
|
131
|
+
const NotificationUpdateInput = z.object({
|
|
132
|
+
payload: NotificationCardPayloadPatch.optional(),
|
|
133
|
+
subscriptions: z.array(NotificationSubscriptionInput).min(1).optional(),
|
|
134
|
+
handlers: z.array(NotificationHandlerInput).min(1).optional(),
|
|
135
|
+
active: z.boolean().optional()
|
|
136
|
+
}).loose();
|
|
137
|
+
//#endregion
|
|
138
|
+
export { CARD_PAYLOAD_TYPE, Notification, NotificationCardPayload, NotificationCardPayloadCompact, NotificationCardPayloadPatch, NotificationChannelType, NotificationCompact, NotificationCreateInput, NotificationHandler, NotificationHandlerCompact, NotificationPayloadType, NotificationRecipient, NotificationRecipientCompact, NotificationRecipientDetails, NotificationRecipientType, NotificationSendCondition, NotificationSubscription, NotificationSubscriptionCompact, NotificationSubscriptionType, NotificationUpdateInput };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ParameterTextTagTarget, c as ParameterValuesCompact, d as ValuesSourceConfig, f as ValuesSourceType, i as ParameterTemplateTagRef, l as TemporalUnit, n as ParameterMapping, o as ParameterType, r as ParameterTarget, s as ParameterValues, t as Parameter, u as ValuesQueryType } from "../parameter-ak-J-IOj.js";
|
|
2
|
+
export { Parameter, ParameterMapping, ParameterTarget, ParameterTemplateTagRef, ParameterTextTagTarget, ParameterType, ParameterValues, ParameterValuesCompact, TemporalUnit, ValuesQueryType, ValuesSourceConfig, ValuesSourceType };
|