@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,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/snippet.ts
|
|
3
|
+
const Snippet = z.object({
|
|
4
|
+
id: z.number().int(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
description: z.string().nullable(),
|
|
7
|
+
content: z.string(),
|
|
8
|
+
archived: z.boolean(),
|
|
9
|
+
collection_id: z.number().int().nullable(),
|
|
10
|
+
creator_id: z.number().int(),
|
|
11
|
+
entity_id: z.string().nullable(),
|
|
12
|
+
template_tags: z.record(z.string(), z.unknown()).nullable(),
|
|
13
|
+
created_at: z.string(),
|
|
14
|
+
updated_at: z.string()
|
|
15
|
+
}).loose();
|
|
16
|
+
const SnippetCompact = Snippet.pick({
|
|
17
|
+
id: true,
|
|
18
|
+
name: true,
|
|
19
|
+
description: true,
|
|
20
|
+
archived: true,
|
|
21
|
+
collection_id: true
|
|
22
|
+
}).strip();
|
|
23
|
+
const snippetName = z.string().regex(/^(?!\s)[^}]*$/, "snippet names cannot include '}' or start with spaces");
|
|
24
|
+
const SnippetCreateInput = z.object({
|
|
25
|
+
name: snippetName,
|
|
26
|
+
content: z.string(),
|
|
27
|
+
description: z.string().nullable().optional(),
|
|
28
|
+
collection_id: z.number().int().positive().nullable().optional()
|
|
29
|
+
}).loose();
|
|
30
|
+
const SnippetUpdateInput = z.object({
|
|
31
|
+
name: snippetName.nullable().optional(),
|
|
32
|
+
content: z.string().nullable().optional(),
|
|
33
|
+
description: z.string().nullable().optional(),
|
|
34
|
+
archived: z.boolean().nullable().optional(),
|
|
35
|
+
collection_id: z.number().int().positive().nullable().optional()
|
|
36
|
+
}).loose();
|
|
37
|
+
//#endregion
|
|
38
|
+
export { Snippet, SnippetCompact, SnippetCreateInput, SnippetUpdateInput };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { S as TableVisibilityType, _ as TableSchemaId, a as TableCompact, b as TableSelectors, c as TableDataLayerTier, d as TableFieldValuesResult, f as TableForeignKey, g as TableQueryMetadataCompact, h as TableQueryMetadata, i as TableBulkEditResult, l as TableDataSource, m as TableGetInclude, n as TableBulkEditFields, o as TableDataLayer, p as TableForeignKeyCompact, r as TableBulkEditInput, s as TableDataLayerMedallion, t as Table, u as TableDatabase, v as TableSchemaSyncResult, x as TableUpdateInput, y as TableSelectionResult } from "../table-B3-UaPHa.js";
|
|
2
|
+
export { Table, TableBulkEditFields, TableBulkEditInput, TableBulkEditResult, TableCompact, TableDataLayer, TableDataLayerMedallion, TableDataLayerTier, TableDataSource, TableDatabase, TableFieldValuesResult, TableForeignKey, TableForeignKeyCompact, TableGetInclude, TableQueryMetadata, TableQueryMetadataCompact, TableSchemaId, TableSchemaSyncResult, TableSelectionResult, TableSelectors, TableUpdateInput, TableVisibilityType };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Field, FieldCompact, FieldWithTarget } from "./field.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/domain/table.ts
|
|
4
|
+
const TableEntityType = z.enum([
|
|
5
|
+
"entity/GenericTable",
|
|
6
|
+
"entity/UserTable",
|
|
7
|
+
"entity/CompanyTable",
|
|
8
|
+
"entity/TransactionTable",
|
|
9
|
+
"entity/ProductTable",
|
|
10
|
+
"entity/SubscriptionTable",
|
|
11
|
+
"entity/EventTable"
|
|
12
|
+
]);
|
|
13
|
+
const TableVisibilityType = z.enum([
|
|
14
|
+
"hidden",
|
|
15
|
+
"technical",
|
|
16
|
+
"cruft"
|
|
17
|
+
]);
|
|
18
|
+
const TableFieldOrder = z.enum([
|
|
19
|
+
"alphabetical",
|
|
20
|
+
"custom",
|
|
21
|
+
"database",
|
|
22
|
+
"smart"
|
|
23
|
+
]);
|
|
24
|
+
const TableDataAuthority = z.enum([
|
|
25
|
+
"unconfigured",
|
|
26
|
+
"authoritative",
|
|
27
|
+
"computed",
|
|
28
|
+
"ingested"
|
|
29
|
+
]);
|
|
30
|
+
const TableDataLayerTier = z.enum([
|
|
31
|
+
"final",
|
|
32
|
+
"internal",
|
|
33
|
+
"hidden"
|
|
34
|
+
]);
|
|
35
|
+
const TableDataLayerMedallion = z.enum([
|
|
36
|
+
"gold",
|
|
37
|
+
"silver",
|
|
38
|
+
"bronze",
|
|
39
|
+
"copper"
|
|
40
|
+
]);
|
|
41
|
+
const TableDataLayer = z.enum([...TableDataLayerTier.options, ...TableDataLayerMedallion.options]);
|
|
42
|
+
const Table = z.object({
|
|
43
|
+
id: z.number().int(),
|
|
44
|
+
name: z.string(),
|
|
45
|
+
display_name: z.string(),
|
|
46
|
+
description: z.string().nullable(),
|
|
47
|
+
caveats: z.string().nullable(),
|
|
48
|
+
db_id: z.number().int(),
|
|
49
|
+
schema: z.string().nullable(),
|
|
50
|
+
entity_type: TableEntityType.nullable(),
|
|
51
|
+
visibility_type: TableVisibilityType.nullable().optional(),
|
|
52
|
+
data_layer: TableDataLayer.nullable(),
|
|
53
|
+
estimated_row_count: z.number().int().nullable(),
|
|
54
|
+
active: z.boolean(),
|
|
55
|
+
is_published: z.boolean().optional(),
|
|
56
|
+
collection_id: z.number().int().nullable().optional(),
|
|
57
|
+
fields: z.array(Field).optional()
|
|
58
|
+
}).loose();
|
|
59
|
+
const TableDatabase = z.object({
|
|
60
|
+
id: z.number().int(),
|
|
61
|
+
name: z.string(),
|
|
62
|
+
engine: z.string(),
|
|
63
|
+
features: z.array(z.string()).optional()
|
|
64
|
+
}).loose();
|
|
65
|
+
const TableQueryMetadata = Table.extend({
|
|
66
|
+
fields: z.array(FieldWithTarget),
|
|
67
|
+
db: TableDatabase
|
|
68
|
+
});
|
|
69
|
+
const TableGetInclude = z.enum(["fields"]);
|
|
70
|
+
const TableCompact = Table.pick({
|
|
71
|
+
id: true,
|
|
72
|
+
name: true,
|
|
73
|
+
display_name: true,
|
|
74
|
+
description: true,
|
|
75
|
+
db_id: true,
|
|
76
|
+
schema: true,
|
|
77
|
+
entity_type: true,
|
|
78
|
+
visibility_type: true,
|
|
79
|
+
active: true,
|
|
80
|
+
is_published: true
|
|
81
|
+
}).strip().extend({ fields: z.array(FieldCompact).optional() });
|
|
82
|
+
const TableQueryMetadataCompact = TableCompact.extend({ fields: z.array(FieldCompact) });
|
|
83
|
+
const TableDataSource = z.enum([
|
|
84
|
+
"unknown",
|
|
85
|
+
"ingested",
|
|
86
|
+
"metabase-transform",
|
|
87
|
+
"transform",
|
|
88
|
+
"source-data",
|
|
89
|
+
"upload"
|
|
90
|
+
]);
|
|
91
|
+
const TableUpdateInput = z.object({
|
|
92
|
+
display_name: z.string().min(1).optional(),
|
|
93
|
+
entity_type: TableEntityType.optional(),
|
|
94
|
+
visibility_type: TableVisibilityType.nullable().optional(),
|
|
95
|
+
description: z.string().nullable().optional(),
|
|
96
|
+
caveats: z.string().nullable().optional(),
|
|
97
|
+
points_of_interest: z.string().nullable().optional(),
|
|
98
|
+
show_in_getting_started: z.boolean().optional(),
|
|
99
|
+
field_order: TableFieldOrder.optional(),
|
|
100
|
+
data_authority: TableDataAuthority.nullable().optional(),
|
|
101
|
+
data_source: TableDataSource.nullable().optional(),
|
|
102
|
+
data_layer: TableDataLayer.nullable().optional(),
|
|
103
|
+
owner_email: z.string().nullable().optional(),
|
|
104
|
+
owner_user_id: z.number().int().nullable().optional(),
|
|
105
|
+
collection_id: z.number().int().positive().optional()
|
|
106
|
+
}).loose();
|
|
107
|
+
const TableSchemaId = z.string().regex(/^[1-9]\d{0,17}:[^:]*$/, { error: "expected a schema id \"<db-id>:<schema>\" with a positive database id" });
|
|
108
|
+
const TableSelectors = z.object({
|
|
109
|
+
database_ids: z.array(z.number().int().positive()).optional(),
|
|
110
|
+
schema_ids: z.array(TableSchemaId).optional(),
|
|
111
|
+
table_ids: z.array(z.number().int().positive()).optional()
|
|
112
|
+
}).strict();
|
|
113
|
+
const TableBulkEditFields = z.object({
|
|
114
|
+
data_authority: TableDataAuthority.nullable().optional(),
|
|
115
|
+
data_source: TableDataSource.nullable().optional(),
|
|
116
|
+
data_layer: TableDataLayerTier.nullable().optional(),
|
|
117
|
+
entity_type: TableEntityType.nullable().optional(),
|
|
118
|
+
owner_email: z.string().nullable().optional(),
|
|
119
|
+
owner_user_id: z.number().int().positive().nullable().optional()
|
|
120
|
+
});
|
|
121
|
+
const TableBulkEditInput = TableSelectors.extend(TableBulkEditFields.shape).strict();
|
|
122
|
+
const TableSchemaSyncResult = z.object({
|
|
123
|
+
id: z.number().int(),
|
|
124
|
+
status: z.literal("ok")
|
|
125
|
+
});
|
|
126
|
+
const TableFieldValuesResult = z.object({
|
|
127
|
+
id: z.number().int(),
|
|
128
|
+
status: z.literal("success")
|
|
129
|
+
});
|
|
130
|
+
const TableSelectionResult = TableSelectors.extend({ accepted: z.literal(true) }).strict();
|
|
131
|
+
const TableBulkEditResult = TableBulkEditInput.extend({ accepted: z.literal(true) }).strict();
|
|
132
|
+
const TableForeignKeyEnd = Field.extend({ table: Table });
|
|
133
|
+
const TableForeignKey = z.object({
|
|
134
|
+
relationship: z.literal("Mt1"),
|
|
135
|
+
origin_id: z.number().int(),
|
|
136
|
+
origin: TableForeignKeyEnd,
|
|
137
|
+
destination_id: z.number().int(),
|
|
138
|
+
destination: TableForeignKeyEnd
|
|
139
|
+
}).loose();
|
|
140
|
+
const TableForeignKeyOriginCompact = FieldCompact.extend({ table: Table.pick({
|
|
141
|
+
id: true,
|
|
142
|
+
name: true,
|
|
143
|
+
display_name: true,
|
|
144
|
+
schema: true,
|
|
145
|
+
db_id: true
|
|
146
|
+
}).strip() });
|
|
147
|
+
const TableForeignKeyCompact = TableForeignKey.pick({
|
|
148
|
+
relationship: true,
|
|
149
|
+
origin_id: true,
|
|
150
|
+
destination_id: true
|
|
151
|
+
}).strip().extend({
|
|
152
|
+
origin: TableForeignKeyOriginCompact,
|
|
153
|
+
destination: FieldCompact
|
|
154
|
+
});
|
|
155
|
+
//#endregion
|
|
156
|
+
export { Table, TableBulkEditFields, TableBulkEditInput, TableBulkEditResult, TableCompact, TableDataLayer, TableDataLayerMedallion, TableDataLayerTier, TableDataSource, TableDatabase, TableFieldValuesResult, TableForeignKey, TableForeignKeyCompact, TableGetInclude, TableQueryMetadata, TableQueryMetadataCompact, TableSchemaId, TableSchemaSyncResult, TableSelectionResult, TableSelectors, TableUpdateInput, TableVisibilityType };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as TimelineEventCompact, c as TimelineIcon, i as TimelineEvent, l as TimelineUpdateInput, n as TimelineCompact, o as TimelineEventCreateInput, r as TimelineCreateInput, s as TimelineEventUpdateInput, t as Timeline } from "../timeline-folD3mQ_.js";
|
|
2
|
+
export { Timeline, TimelineCompact, TimelineCreateInput, TimelineEvent, TimelineEventCompact, TimelineEventCreateInput, TimelineEventUpdateInput, TimelineIcon, TimelineUpdateInput };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/timeline.ts
|
|
3
|
+
const TimelineIcon = z.enum([
|
|
4
|
+
"star",
|
|
5
|
+
"cake",
|
|
6
|
+
"mail",
|
|
7
|
+
"mail_at",
|
|
8
|
+
"warning",
|
|
9
|
+
"bell",
|
|
10
|
+
"cloud",
|
|
11
|
+
"info",
|
|
12
|
+
"note",
|
|
13
|
+
"event"
|
|
14
|
+
]);
|
|
15
|
+
const TimelineEvent = z.object({
|
|
16
|
+
id: z.number().int(),
|
|
17
|
+
name: z.string(),
|
|
18
|
+
description: z.string().nullable(),
|
|
19
|
+
timestamp: z.string(),
|
|
20
|
+
timezone: z.string(),
|
|
21
|
+
time_matters: z.boolean(),
|
|
22
|
+
icon: TimelineIcon,
|
|
23
|
+
timeline_id: z.number().int(),
|
|
24
|
+
archived: z.boolean(),
|
|
25
|
+
creator_id: z.number().int(),
|
|
26
|
+
created_at: z.string(),
|
|
27
|
+
updated_at: z.string()
|
|
28
|
+
}).loose();
|
|
29
|
+
const TimelineEventCompact = TimelineEvent.pick({
|
|
30
|
+
id: true,
|
|
31
|
+
name: true,
|
|
32
|
+
description: true,
|
|
33
|
+
timestamp: true,
|
|
34
|
+
icon: true,
|
|
35
|
+
timeline_id: true,
|
|
36
|
+
archived: true
|
|
37
|
+
}).strip();
|
|
38
|
+
const Timeline = z.object({
|
|
39
|
+
id: z.number().int(),
|
|
40
|
+
name: z.string(),
|
|
41
|
+
description: z.string().nullable(),
|
|
42
|
+
icon: TimelineIcon,
|
|
43
|
+
collection_id: z.number().int().nullable(),
|
|
44
|
+
archived: z.boolean(),
|
|
45
|
+
default: z.boolean(),
|
|
46
|
+
creator_id: z.number().int(),
|
|
47
|
+
entity_id: z.string(),
|
|
48
|
+
created_at: z.string(),
|
|
49
|
+
updated_at: z.string(),
|
|
50
|
+
events: z.array(TimelineEvent).optional()
|
|
51
|
+
}).loose();
|
|
52
|
+
const TimelineCompact = Timeline.pick({
|
|
53
|
+
id: true,
|
|
54
|
+
name: true,
|
|
55
|
+
description: true,
|
|
56
|
+
icon: true,
|
|
57
|
+
collection_id: true,
|
|
58
|
+
default: true,
|
|
59
|
+
archived: true
|
|
60
|
+
}).strip();
|
|
61
|
+
const TimelineCreateInput = z.object({
|
|
62
|
+
name: z.string().min(1),
|
|
63
|
+
description: z.string().nullable().optional(),
|
|
64
|
+
icon: TimelineIcon.nullable().optional(),
|
|
65
|
+
collection_id: z.number().int().positive().nullable().optional(),
|
|
66
|
+
default: z.boolean().nullable().optional()
|
|
67
|
+
}).loose();
|
|
68
|
+
const TimelineUpdateInput = z.object({
|
|
69
|
+
name: z.string().min(1).nullable().optional(),
|
|
70
|
+
description: z.string().nullable().optional(),
|
|
71
|
+
icon: TimelineIcon.nullable().optional(),
|
|
72
|
+
collection_id: z.number().int().positive().nullable().optional(),
|
|
73
|
+
default: z.boolean().nullable().optional(),
|
|
74
|
+
archived: z.boolean().nullable().optional()
|
|
75
|
+
}).loose();
|
|
76
|
+
const TimelineEventCreateInput = z.object({
|
|
77
|
+
name: z.string().min(1),
|
|
78
|
+
timestamp: z.string().min(1),
|
|
79
|
+
timezone: z.string().min(1),
|
|
80
|
+
time_matters: z.boolean(),
|
|
81
|
+
timeline_id: z.number().int().positive(),
|
|
82
|
+
description: z.string().nullable().optional(),
|
|
83
|
+
icon: TimelineIcon.nullable().optional(),
|
|
84
|
+
archived: z.boolean().nullable().optional()
|
|
85
|
+
}).loose();
|
|
86
|
+
const TimelineEventUpdateInput = z.object({
|
|
87
|
+
name: z.string().min(1).nullable().optional(),
|
|
88
|
+
description: z.string().nullable().optional(),
|
|
89
|
+
timestamp: z.string().min(1).nullable().optional(),
|
|
90
|
+
timezone: z.string().min(1).nullable().optional(),
|
|
91
|
+
time_matters: z.boolean().nullable().optional(),
|
|
92
|
+
icon: TimelineIcon.nullable().optional(),
|
|
93
|
+
timeline_id: z.number().int().positive().nullable().optional(),
|
|
94
|
+
archived: z.boolean().nullable().optional()
|
|
95
|
+
}).loose();
|
|
96
|
+
//#endregion
|
|
97
|
+
export { Timeline, TimelineCompact, TimelineCreateInput, TimelineEvent, TimelineEventCompact, TimelineEventCreateInput, TimelineEventUpdateInput, TimelineIcon, TimelineUpdateInput };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TransformRun } from "./transform.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/domain/transform-dag-run.ts
|
|
4
|
+
const TransformMemberRun = TransformRun.extend({
|
|
5
|
+
job_run_id: z.number().int().nullable(),
|
|
6
|
+
dag_run_id: z.number().int().nullable()
|
|
7
|
+
});
|
|
8
|
+
const TransformMemberRunCompact = TransformMemberRun.pick({
|
|
9
|
+
id: true,
|
|
10
|
+
transform_id: true,
|
|
11
|
+
dag_run_id: true,
|
|
12
|
+
status: true,
|
|
13
|
+
run_method: true,
|
|
14
|
+
start_time: true,
|
|
15
|
+
end_time: true,
|
|
16
|
+
message: true
|
|
17
|
+
}).strip();
|
|
18
|
+
//#endregion
|
|
19
|
+
export { TransformMemberRun, TransformMemberRunCompact };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as LensCardDisplay, c as LensDrillTrigger, d as LensSection, f as TransformInspection, h as TransformLensQueryInput, i as LensCard, l as LensMetadata, m as TransformLens, n as InspectorTable, o as LensCardMetadata, p as TransformInspectionStatus, r as LensAlertTrigger, s as LensComplexityLevel, t as InspectorField, u as LensParams } from "../transform-inspector-BUYBt6--.js";
|
|
2
|
+
export { InspectorField, InspectorTable, LensAlertTrigger, LensCard, LensCardDisplay, LensCardMetadata, LensComplexityLevel, LensDrillTrigger, LensMetadata, LensParams, LensSection, TransformInspection, TransformInspectionStatus, TransformLens, TransformLensQueryInput };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { DatasetQuery } from "./query.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/domain/transform-inspector.ts
|
|
4
|
+
const InspectorFieldStats = z.object({
|
|
5
|
+
distinct_count: z.number().int().optional(),
|
|
6
|
+
nil_percent: z.number().optional(),
|
|
7
|
+
min: z.number().optional(),
|
|
8
|
+
max: z.number().optional(),
|
|
9
|
+
avg: z.number().optional(),
|
|
10
|
+
q1: z.number().optional(),
|
|
11
|
+
q3: z.number().optional(),
|
|
12
|
+
earliest: z.string().optional(),
|
|
13
|
+
latest: z.string().optional()
|
|
14
|
+
}).loose();
|
|
15
|
+
const InspectorField = z.object({
|
|
16
|
+
id: z.number().int(),
|
|
17
|
+
name: z.string(),
|
|
18
|
+
display_name: z.string().nullable().optional(),
|
|
19
|
+
base_type: z.string(),
|
|
20
|
+
semantic_type: z.string().nullable().optional(),
|
|
21
|
+
stats: InspectorFieldStats.nullable().optional()
|
|
22
|
+
}).loose();
|
|
23
|
+
const InspectorTable = z.object({
|
|
24
|
+
table_id: z.number().int(),
|
|
25
|
+
table_name: z.string(),
|
|
26
|
+
schema: z.string().nullable().optional(),
|
|
27
|
+
db_id: z.number().int(),
|
|
28
|
+
column_count: z.number().int(),
|
|
29
|
+
fields: z.array(InspectorField)
|
|
30
|
+
}).loose();
|
|
31
|
+
const LensComplexityLevel = z.enum([
|
|
32
|
+
"fast",
|
|
33
|
+
"slow",
|
|
34
|
+
"very-slow"
|
|
35
|
+
]);
|
|
36
|
+
const LensComplexity = z.object({
|
|
37
|
+
level: LensComplexityLevel,
|
|
38
|
+
score: z.number().int().optional()
|
|
39
|
+
}).loose();
|
|
40
|
+
const LensMetadata = z.object({
|
|
41
|
+
id: z.string(),
|
|
42
|
+
display_name: z.string(),
|
|
43
|
+
description: z.string().nullable().optional(),
|
|
44
|
+
complexity: LensComplexity.optional()
|
|
45
|
+
}).loose();
|
|
46
|
+
const TransformInspectionStatus = z.enum(["not-run", "ready"]);
|
|
47
|
+
const TransformInspection = z.object({
|
|
48
|
+
name: z.string(),
|
|
49
|
+
description: z.string().nullable().optional(),
|
|
50
|
+
status: TransformInspectionStatus,
|
|
51
|
+
sources: z.array(InspectorTable),
|
|
52
|
+
target: InspectorTable.nullable().optional(),
|
|
53
|
+
visited_fields: z.object({ all: z.array(z.number().int()).optional() }).loose().nullable().optional(),
|
|
54
|
+
available_lenses: z.array(LensMetadata)
|
|
55
|
+
}).loose();
|
|
56
|
+
const LensCardDisplay = z.enum([
|
|
57
|
+
"bar",
|
|
58
|
+
"row",
|
|
59
|
+
"line",
|
|
60
|
+
"area",
|
|
61
|
+
"pie",
|
|
62
|
+
"scalar",
|
|
63
|
+
"gauge",
|
|
64
|
+
"progress",
|
|
65
|
+
"table",
|
|
66
|
+
"hidden"
|
|
67
|
+
]);
|
|
68
|
+
const LensJoinMetadata = z.object({
|
|
69
|
+
join_step: z.number().int().optional(),
|
|
70
|
+
join_alias: z.string().optional(),
|
|
71
|
+
join_strategy: z.string().optional()
|
|
72
|
+
}).loose();
|
|
73
|
+
const LensCardMetadata = LensJoinMetadata.extend({
|
|
74
|
+
dedup_key: z.array(z.unknown()).optional(),
|
|
75
|
+
depends_on_cards: z.array(z.string()).optional(),
|
|
76
|
+
group_id: z.string().optional(),
|
|
77
|
+
group_role: z.enum(["input", "output"]).optional(),
|
|
78
|
+
group_order: z.number().int().optional(),
|
|
79
|
+
card_type: z.string().optional()
|
|
80
|
+
});
|
|
81
|
+
const LensCard = z.object({
|
|
82
|
+
id: z.string(),
|
|
83
|
+
section_id: z.string().nullable().optional(),
|
|
84
|
+
title: z.string(),
|
|
85
|
+
display: LensCardDisplay,
|
|
86
|
+
dataset_query: DatasetQuery,
|
|
87
|
+
metadata: LensCardMetadata.optional()
|
|
88
|
+
}).loose();
|
|
89
|
+
const LensSection = z.object({
|
|
90
|
+
id: z.string(),
|
|
91
|
+
title: z.string(),
|
|
92
|
+
description: z.string().nullable().optional(),
|
|
93
|
+
layout: z.enum(["flat", "comparison"]).optional()
|
|
94
|
+
}).loose();
|
|
95
|
+
const LensHighlight = z.object({
|
|
96
|
+
label: z.string(),
|
|
97
|
+
value: z.unknown().optional(),
|
|
98
|
+
card_id: z.string().optional()
|
|
99
|
+
}).loose();
|
|
100
|
+
const LensSummary = z.object({
|
|
101
|
+
text: z.string().nullable().optional(),
|
|
102
|
+
highlights: z.array(LensHighlight).optional(),
|
|
103
|
+
alerts: z.array(z.object({}).loose()).optional()
|
|
104
|
+
}).loose();
|
|
105
|
+
const LensTriggerCondition = z.object({ name: z.string() }).loose();
|
|
106
|
+
const LensAlertTrigger = z.object({
|
|
107
|
+
id: z.string(),
|
|
108
|
+
condition: LensTriggerCondition,
|
|
109
|
+
severity: z.enum([
|
|
110
|
+
"info",
|
|
111
|
+
"warning",
|
|
112
|
+
"error"
|
|
113
|
+
]),
|
|
114
|
+
message: z.string(),
|
|
115
|
+
metadata: LensJoinMetadata.optional()
|
|
116
|
+
}).loose();
|
|
117
|
+
/** The parameters a drill lens takes; `join_step` scopes a join lens to one join. */
|
|
118
|
+
const LensParams = z.object({ join_step: z.number().int().optional() });
|
|
119
|
+
const LensDrillTrigger = z.object({
|
|
120
|
+
lens_id: z.string(),
|
|
121
|
+
condition: LensTriggerCondition,
|
|
122
|
+
params: LensParams.loose().optional(),
|
|
123
|
+
reason: z.string().optional(),
|
|
124
|
+
metadata: LensJoinMetadata.optional()
|
|
125
|
+
}).loose();
|
|
126
|
+
const TransformLens = z.object({
|
|
127
|
+
id: z.string(),
|
|
128
|
+
display_name: z.string(),
|
|
129
|
+
complexity: LensComplexity.optional(),
|
|
130
|
+
summary: LensSummary.optional(),
|
|
131
|
+
sections: z.array(LensSection),
|
|
132
|
+
cards: z.array(LensCard),
|
|
133
|
+
drill_lenses: z.array(LensMetadata).optional(),
|
|
134
|
+
alert_triggers: z.array(LensAlertTrigger).optional(),
|
|
135
|
+
drill_lens_triggers: z.array(LensDrillTrigger).optional()
|
|
136
|
+
}).loose();
|
|
137
|
+
const TransformLensQueryInput = z.object({
|
|
138
|
+
query: DatasetQuery,
|
|
139
|
+
lens_params: LensParams.nullable().optional()
|
|
140
|
+
}).strict();
|
|
141
|
+
//#endregion
|
|
142
|
+
export { InspectorField, InspectorTable, LensAlertTrigger, LensCard, LensCardDisplay, LensCardMetadata, LensComplexityLevel, LensDrillTrigger, LensMetadata, LensParams, LensSection, TransformInspection, TransformInspectionStatus, TransformLens, TransformLensQueryInput };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as TransformJobRunResult, c as transformJobSchema, i as TransformJobCreateInput, n as TransformJobActiveResult, o as TransformJobUpdateInput, r as TransformJobCompact, s as transformJobRunResultSchema, t as TransformJob } from "../transform-job-CTJImaOd.js";
|
|
2
|
+
export { TransformJob, TransformJobActiveResult, TransformJobCompact, TransformJobCreateInput, TransformJobRunResult, TransformJobUpdateInput, transformJobRunResultSchema, transformJobSchema };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { CronUiDisplayType } from "./cron.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/domain/transform-job.ts
|
|
4
|
+
const JobRunStatus = z.enum([
|
|
5
|
+
"started",
|
|
6
|
+
"succeeded",
|
|
7
|
+
"failed",
|
|
8
|
+
"timeout",
|
|
9
|
+
"canceled"
|
|
10
|
+
]);
|
|
11
|
+
const JobRunMethod = z.enum(["manual", "cron"]);
|
|
12
|
+
const JobLastRun = z.object({
|
|
13
|
+
id: z.number().int(),
|
|
14
|
+
job_id: z.number().int(),
|
|
15
|
+
run_method: JobRunMethod,
|
|
16
|
+
status: JobRunStatus,
|
|
17
|
+
start_time: z.string(),
|
|
18
|
+
end_time: z.string().nullable().optional(),
|
|
19
|
+
message: z.string().nullable(),
|
|
20
|
+
created_at: z.string(),
|
|
21
|
+
updated_at: z.string()
|
|
22
|
+
}).loose();
|
|
23
|
+
const JobNextRun = z.object({ start_time: z.string() }).loose();
|
|
24
|
+
const TransformJobBase = z.object({
|
|
25
|
+
id: z.number().int(),
|
|
26
|
+
name: z.string(),
|
|
27
|
+
description: z.string().nullable(),
|
|
28
|
+
schedule: z.string(),
|
|
29
|
+
ui_display_type: CronUiDisplayType,
|
|
30
|
+
entity_id: z.string().nullable(),
|
|
31
|
+
created_at: z.string(),
|
|
32
|
+
updated_at: z.string(),
|
|
33
|
+
built_in_type: z.string().nullable().optional(),
|
|
34
|
+
tag_ids: z.array(z.number().int()).optional(),
|
|
35
|
+
last_run: JobLastRun.nullable().optional(),
|
|
36
|
+
next_run: JobNextRun.nullable().optional()
|
|
37
|
+
}).loose();
|
|
38
|
+
const TransformJob = TransformJobBase.extend({ active: z.boolean().nullable() });
|
|
39
|
+
function alwaysActive(wire) {
|
|
40
|
+
return {
|
|
41
|
+
...wire,
|
|
42
|
+
active: null
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** The shape every transform-job endpoint answers on a server with `features`, read as `TransformJob`. */
|
|
46
|
+
function transformJobSchema(features) {
|
|
47
|
+
return features.transformJobActivation ? TransformJob : TransformJobBase.transform(alwaysActive);
|
|
48
|
+
}
|
|
49
|
+
const TransformJobCompact = TransformJob.pick({
|
|
50
|
+
id: true,
|
|
51
|
+
name: true,
|
|
52
|
+
description: true,
|
|
53
|
+
schedule: true,
|
|
54
|
+
ui_display_type: true,
|
|
55
|
+
active: true,
|
|
56
|
+
built_in_type: true
|
|
57
|
+
}).strip();
|
|
58
|
+
const TransformJobCreateInput = z.object({
|
|
59
|
+
name: z.string().min(1),
|
|
60
|
+
description: z.string().min(1).nullable().optional(),
|
|
61
|
+
schedule: z.string().min(1),
|
|
62
|
+
ui_display_type: CronUiDisplayType.optional(),
|
|
63
|
+
tag_ids: z.array(z.number().int().positive()).optional()
|
|
64
|
+
}).loose();
|
|
65
|
+
const TransformJobUpdateInput = z.object({
|
|
66
|
+
name: z.string().min(1).optional(),
|
|
67
|
+
description: z.string().min(1).nullable().optional(),
|
|
68
|
+
schedule: z.string().min(1).optional(),
|
|
69
|
+
ui_display_type: CronUiDisplayType.optional(),
|
|
70
|
+
active: z.boolean().optional(),
|
|
71
|
+
tag_ids: z.array(z.number().int().positive()).optional()
|
|
72
|
+
}).loose();
|
|
73
|
+
const TransformJobRunResult = z.object({
|
|
74
|
+
message: z.string(),
|
|
75
|
+
started: z.boolean().nullable(),
|
|
76
|
+
run_id: z.number().int().positive().nullable()
|
|
77
|
+
});
|
|
78
|
+
const TransformJobRunWireV59 = z.object({
|
|
79
|
+
message: z.string(),
|
|
80
|
+
job_run_id: z.string()
|
|
81
|
+
});
|
|
82
|
+
const TransformJobRunWireV64 = z.object({
|
|
83
|
+
message: z.string(),
|
|
84
|
+
job_run_id: z.number().int().positive().nullable()
|
|
85
|
+
});
|
|
86
|
+
function fromStubRunId(wire) {
|
|
87
|
+
return {
|
|
88
|
+
message: wire.message,
|
|
89
|
+
started: null,
|
|
90
|
+
run_id: null
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function fromNumericRunId(wire) {
|
|
94
|
+
return {
|
|
95
|
+
message: wire.message,
|
|
96
|
+
started: wire.job_run_id !== null,
|
|
97
|
+
run_id: wire.job_run_id
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/** The shape `POST /api/transform-job/{id}/run` answers on a server with `features`, read as `TransformJobRunResult`. */
|
|
101
|
+
function transformJobRunResultSchema(features) {
|
|
102
|
+
return features.transformJobRunIdIsNumeric ? TransformJobRunWireV64.transform(fromNumericRunId) : TransformJobRunWireV59.transform(fromStubRunId);
|
|
103
|
+
}
|
|
104
|
+
const TransformJobActiveResult = z.object({
|
|
105
|
+
updated: z.number().int(),
|
|
106
|
+
failed: z.number().int()
|
|
107
|
+
});
|
|
108
|
+
//#endregion
|
|
109
|
+
export { TransformJob, TransformJobActiveResult, TransformJobCompact, TransformJobCreateInput, TransformJobRunResult, TransformJobUpdateInput, transformJobRunResultSchema, transformJobSchema };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as PythonTestRunOutput, i as PythonTestRunInput, n as PythonLibraryUpdateInput, o as PythonTestRunResult, r as PythonTestRunError, t as PythonLibrary } from "../transform-python-DdDnW6yK.js";
|
|
2
|
+
export { PythonLibrary, PythonLibraryUpdateInput, PythonTestRunError, PythonTestRunInput, PythonTestRunOutput, PythonTestRunResult };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TransformSourceTableEntry } from "./transform.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/domain/transform-python.ts
|
|
4
|
+
const PythonLibrary = z.object({
|
|
5
|
+
path: z.string(),
|
|
6
|
+
source: z.string().nullable(),
|
|
7
|
+
created_at: z.string(),
|
|
8
|
+
updated_at: z.string()
|
|
9
|
+
}).loose();
|
|
10
|
+
const PythonLibraryUpdateInput = z.object({ source: z.string() }).strict();
|
|
11
|
+
const TEST_RUN_ROW_LIMIT = {
|
|
12
|
+
min: 2,
|
|
13
|
+
max: 100
|
|
14
|
+
};
|
|
15
|
+
const TestRunRowLimit = z.number().int().min(TEST_RUN_ROW_LIMIT.min).max(TEST_RUN_ROW_LIMIT.max);
|
|
16
|
+
const PythonTestRunInput = z.object({
|
|
17
|
+
code: z.string(),
|
|
18
|
+
source_tables: z.array(TransformSourceTableEntry).min(1),
|
|
19
|
+
output_row_limit: TestRunRowLimit.optional(),
|
|
20
|
+
per_input_row_limit: TestRunRowLimit.optional()
|
|
21
|
+
}).strict();
|
|
22
|
+
const PythonTestRunOutput = z.object({
|
|
23
|
+
cols: z.array(z.object({ name: z.string() }).loose()),
|
|
24
|
+
rows: z.array(z.unknown())
|
|
25
|
+
});
|
|
26
|
+
const PythonTestRunError = z.object({ message: z.string() }).loose();
|
|
27
|
+
const PythonTestRunSucceeded = z.object({
|
|
28
|
+
outcome: z.literal("succeeded"),
|
|
29
|
+
logs: z.string(),
|
|
30
|
+
output: PythonTestRunOutput
|
|
31
|
+
});
|
|
32
|
+
const PythonTestRunFailed = z.object({
|
|
33
|
+
outcome: z.literal("failed"),
|
|
34
|
+
logs: z.string(),
|
|
35
|
+
error: PythonTestRunError
|
|
36
|
+
});
|
|
37
|
+
const PythonTestRunResult = z.discriminatedUnion("outcome", [PythonTestRunSucceeded, PythonTestRunFailed]);
|
|
38
|
+
//#endregion
|
|
39
|
+
export { PythonLibrary, PythonLibraryUpdateInput, PythonTestRunError, PythonTestRunInput, PythonTestRunOutput, PythonTestRunResult };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/domain/transform-tag.ts
|
|
3
|
+
const TransformTag = z.object({
|
|
4
|
+
id: z.number().int(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
entity_id: z.string().nullable(),
|
|
7
|
+
built_in_type: z.string().nullable()
|
|
8
|
+
}).loose();
|
|
9
|
+
const TransformTagCompact = TransformTag.pick({
|
|
10
|
+
id: true,
|
|
11
|
+
name: true,
|
|
12
|
+
built_in_type: true
|
|
13
|
+
}).strip();
|
|
14
|
+
const TransformTagCreateInput = z.object({ name: z.string().min(1) }).loose();
|
|
15
|
+
const TransformTagUpdateInput = TransformTagCreateInput;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { TransformTag, TransformTagCompact, TransformTagCreateInput, TransformTagUpdateInput };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as TransformTestExpectation, c as TransformTestRefusalCode, d as TransformTestRunResult, f as TransformTestTable, i as TransformTestCreateInput, l as TransformTestResultColumn, m as isTransformTestRefusalCode, n as TransformTestColumn, o as TransformTestExpectationResult, p as TransformTestUpdateInput, r as TransformTestCompact, s as TransformTestInput, t as TransformTest, u as TransformTestRow } from "../transform-test-BwuyrHpT.js";
|
|
2
|
+
export { TransformTest, TransformTestColumn, TransformTestCompact, TransformTestCreateInput, TransformTestExpectation, TransformTestExpectationResult, TransformTestInput, TransformTestRefusalCode, TransformTestResultColumn, TransformTestRow, TransformTestRunResult, TransformTestTable, TransformTestUpdateInput, isTransformTestRefusalCode };
|