@antcde/connect-ts 0.4.35-rc.2 → 0.4.35
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/build/AntConnect.d.ts +15 -2
- package/build/AntConnect.d.ts.map +1 -1
- package/build/AntConnect.js +14 -2
- package/build/index.d.ts +29 -29
- package/build/index.d.ts.map +1 -1
- package/build/index.js +7 -7
- package/build/service-runtime.d.ts +1 -1
- package/build/service-runtime.d.ts.map +1 -1
- package/build/service-runtime.js +1 -1
- package/build/service-types.d.ts +7 -7
- package/build/service-types.d.ts.map +1 -1
- package/build/services/AppService/factory/assignments.d.ts +4 -4
- package/build/services/AppService/factory/assignments.d.ts.map +1 -1
- package/build/services/AppService/factory/assignments.js +4 -8
- package/build/services/AppService/types/appScopes.d.ts +14 -14
- package/build/services/AppService/types/appScopes.d.ts.map +1 -1
- package/build/services/AppService/types/bulkAssignments.d.ts +4 -2
- package/build/services/AppService/types/bulkAssignments.d.ts.map +1 -1
- package/build/services/AppService/types/resourceReleases.d.ts +1 -1
- package/build/services/AppService/types/seats.d.ts +1 -14
- package/build/services/AppService/types/seats.d.ts.map +1 -1
- package/build/services/AppService/types/sellableResources.d.ts +1 -1
- package/build/services/AppService/types/subscriptions.d.ts +0 -4
- package/build/services/AppService/types/subscriptions.d.ts.map +1 -1
- package/build/services/SecretSharing.types.d.ts +1 -1
- package/build/services/TaskRelation.types.d.ts +1 -1
- package/build/services/TaskService.types.d.ts +1 -1
- package/build/services/TaskService.types.d.ts.map +1 -1
- package/build/services/Webhook/ConfigService.d.ts +50 -2
- package/build/services/Webhook/ConfigService.d.ts.map +1 -1
- package/build/services/Webhook/ConfigService.js +5 -2
- package/build/services/Webhook/EventService.d.ts +145 -2
- package/build/services/Webhook/EventService.d.ts.map +1 -1
- package/build/services/Webhook/EventService.js +6 -2
- package/build/services/Webhook/TriggerCaller.types.d.ts +17 -2
- package/build/services/Webhook/TriggerCaller.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerCaller.types.js +1 -2
- package/build/services/Webhook/TriggerDataset.types.d.ts +167 -2
- package/build/services/Webhook/TriggerDataset.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerDataset.types.js +51 -2
- package/build/services/Webhook/TriggerDatasetColumns.d.ts +73 -2
- package/build/services/Webhook/TriggerDatasetColumns.d.ts.map +1 -1
- package/build/services/Webhook/TriggerDatasetColumns.js +118 -2
- package/build/services/Webhook/TriggerDatasetCsv.types.d.ts +6 -2
- package/build/services/Webhook/TriggerDatasetCsv.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerDatasetCsv.types.js +1 -2
- package/build/services/Webhook/TriggerDatasetResponses.types.d.ts +175 -2
- package/build/services/Webhook/TriggerDatasetResponses.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerDatasetResponses.types.js +99 -2
- package/build/services/Webhook/TriggerDatasetSourceService.d.ts +181 -2
- package/build/services/Webhook/TriggerDatasetSourceService.d.ts.map +1 -1
- package/build/services/Webhook/TriggerDatasetSourceService.js +23 -2
- package/build/services/Webhook/TriggerDispatch.types.d.ts +88 -2
- package/build/services/Webhook/TriggerDispatch.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerDispatch.types.js +24 -2
- package/build/services/Webhook/TriggerDispatchUrl.d.ts +8 -2
- package/build/services/Webhook/TriggerDispatchUrl.d.ts.map +1 -1
- package/build/services/Webhook/TriggerDispatchUrl.js +27 -2
- package/build/services/Webhook/TriggerDivergence.d.ts +29 -2
- package/build/services/Webhook/TriggerDivergence.d.ts.map +1 -1
- package/build/services/Webhook/TriggerDivergence.js +25 -2
- package/build/services/Webhook/TriggerFailedRuns.types.d.ts +32 -2
- package/build/services/Webhook/TriggerFailedRuns.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerFailedRuns.types.js +1 -2
- package/build/services/Webhook/TriggerHistoryService.d.ts +200 -2
- package/build/services/Webhook/TriggerHistoryService.d.ts.map +1 -1
- package/build/services/Webhook/TriggerHistoryService.js +13 -2
- package/build/services/Webhook/TriggerLastRun.types.d.ts +79 -2
- package/build/services/Webhook/TriggerLastRun.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerLastRun.types.js +1 -2
- package/build/services/Webhook/TriggerOwner.d.ts +4 -2
- package/build/services/Webhook/TriggerOwner.d.ts.map +1 -1
- package/build/services/Webhook/TriggerOwner.js +6 -2
- package/build/services/Webhook/TriggerRefresh.types.d.ts +14 -2
- package/build/services/Webhook/TriggerRefresh.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerRefresh.types.js +1 -2
- package/build/services/Webhook/TriggerRefusalDetail.types.d.ts +62 -2
- package/build/services/Webhook/TriggerRefusalDetail.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerRefusalDetail.types.js +12 -2
- package/build/services/Webhook/TriggerRequest.types.d.ts +57 -2
- package/build/services/Webhook/TriggerRequest.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerRequest.types.js +1 -2
- package/build/services/Webhook/TriggerSearch.types.d.ts +38 -2
- package/build/services/Webhook/TriggerSearch.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerSearch.types.js +1 -2
- package/build/services/Webhook/TriggerSecretService.d.ts +87 -2
- package/build/services/Webhook/TriggerSecretService.d.ts.map +1 -1
- package/build/services/Webhook/TriggerSecretService.js +9 -2
- package/build/services/Webhook/TriggerService.d.ts +190 -2
- package/build/services/Webhook/TriggerService.d.ts.map +1 -1
- package/build/services/Webhook/TriggerService.js +14 -2
- package/build/services/Webhook/TriggerStats.types.d.ts +45 -2
- package/build/services/Webhook/TriggerStats.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerStats.types.js +1 -2
- package/build/services/Webhook/TriggerTimeline.types.d.ts +41 -2
- package/build/services/Webhook/TriggerTimeline.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerTimeline.types.js +1 -2
- package/build/services/Webhook/TriggerVersion.types.d.ts +108 -2
- package/build/services/Webhook/TriggerVersion.types.d.ts.map +1 -1
- package/build/services/Webhook/TriggerVersion.types.js +1 -2
- package/build/services/Webhook/TriggerVersionService.d.ts +53 -2
- package/build/services/Webhook/TriggerVersionService.d.ts.map +1 -1
- package/build/services/Webhook/TriggerVersionService.js +20 -2
- package/package.json +1 -1
- package/build/services/Trigger/ConfigService.d.ts +0 -51
- package/build/services/Trigger/ConfigService.d.ts.map +0 -1
- package/build/services/Trigger/ConfigService.js +0 -5
- package/build/services/Trigger/EventService.d.ts +0 -146
- package/build/services/Trigger/EventService.d.ts.map +0 -1
- package/build/services/Trigger/EventService.js +0 -6
- package/build/services/Trigger/TriggerCaller.types.d.ts +0 -18
- package/build/services/Trigger/TriggerCaller.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerCaller.types.js +0 -1
- package/build/services/Trigger/TriggerDataset.types.d.ts +0 -168
- package/build/services/Trigger/TriggerDataset.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerDataset.types.js +0 -51
- package/build/services/Trigger/TriggerDatasetColumns.d.ts +0 -74
- package/build/services/Trigger/TriggerDatasetColumns.d.ts.map +0 -1
- package/build/services/Trigger/TriggerDatasetColumns.js +0 -118
- package/build/services/Trigger/TriggerDatasetCsv.types.d.ts +0 -7
- package/build/services/Trigger/TriggerDatasetCsv.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerDatasetCsv.types.js +0 -1
- package/build/services/Trigger/TriggerDatasetResponses.types.d.ts +0 -176
- package/build/services/Trigger/TriggerDatasetResponses.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerDatasetResponses.types.js +0 -99
- package/build/services/Trigger/TriggerDatasetSourceService.d.ts +0 -182
- package/build/services/Trigger/TriggerDatasetSourceService.d.ts.map +0 -1
- package/build/services/Trigger/TriggerDatasetSourceService.js +0 -23
- package/build/services/Trigger/TriggerDispatch.types.d.ts +0 -89
- package/build/services/Trigger/TriggerDispatch.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerDispatch.types.js +0 -24
- package/build/services/Trigger/TriggerDispatchUrl.d.ts +0 -9
- package/build/services/Trigger/TriggerDispatchUrl.d.ts.map +0 -1
- package/build/services/Trigger/TriggerDispatchUrl.js +0 -27
- package/build/services/Trigger/TriggerDivergence.d.ts +0 -30
- package/build/services/Trigger/TriggerDivergence.d.ts.map +0 -1
- package/build/services/Trigger/TriggerDivergence.js +0 -25
- package/build/services/Trigger/TriggerFailedRuns.types.d.ts +0 -33
- package/build/services/Trigger/TriggerFailedRuns.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerFailedRuns.types.js +0 -1
- package/build/services/Trigger/TriggerHistoryService.d.ts +0 -201
- package/build/services/Trigger/TriggerHistoryService.d.ts.map +0 -1
- package/build/services/Trigger/TriggerHistoryService.js +0 -13
- package/build/services/Trigger/TriggerLastRun.types.d.ts +0 -80
- package/build/services/Trigger/TriggerLastRun.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerLastRun.types.js +0 -1
- package/build/services/Trigger/TriggerOwner.d.ts +0 -5
- package/build/services/Trigger/TriggerOwner.d.ts.map +0 -1
- package/build/services/Trigger/TriggerOwner.js +0 -6
- package/build/services/Trigger/TriggerRefresh.types.d.ts +0 -15
- package/build/services/Trigger/TriggerRefresh.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerRefresh.types.js +0 -1
- package/build/services/Trigger/TriggerRefusalDetail.types.d.ts +0 -63
- package/build/services/Trigger/TriggerRefusalDetail.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerRefusalDetail.types.js +0 -12
- package/build/services/Trigger/TriggerRequest.types.d.ts +0 -58
- package/build/services/Trigger/TriggerRequest.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerRequest.types.js +0 -1
- package/build/services/Trigger/TriggerSearch.types.d.ts +0 -39
- package/build/services/Trigger/TriggerSearch.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerSearch.types.js +0 -1
- package/build/services/Trigger/TriggerSecretService.d.ts +0 -88
- package/build/services/Trigger/TriggerSecretService.d.ts.map +0 -1
- package/build/services/Trigger/TriggerSecretService.js +0 -9
- package/build/services/Trigger/TriggerService.d.ts +0 -191
- package/build/services/Trigger/TriggerService.d.ts.map +0 -1
- package/build/services/Trigger/TriggerService.js +0 -14
- package/build/services/Trigger/TriggerServices.d.ts +0 -33
- package/build/services/Trigger/TriggerServices.d.ts.map +0 -1
- package/build/services/Trigger/TriggerServices.js +0 -32
- package/build/services/Trigger/TriggerStats.types.d.ts +0 -46
- package/build/services/Trigger/TriggerStats.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerStats.types.js +0 -1
- package/build/services/Trigger/TriggerTimeline.types.d.ts +0 -42
- package/build/services/Trigger/TriggerTimeline.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerTimeline.types.js +0 -1
- package/build/services/Trigger/TriggerVersion.types.d.ts +0 -109
- package/build/services/Trigger/TriggerVersion.types.d.ts.map +0 -1
- package/build/services/Trigger/TriggerVersion.types.js +0 -1
- package/build/services/Trigger/TriggerVersionService.d.ts +0 -54
- package/build/services/Trigger/TriggerVersionService.d.ts.map +0 -1
- package/build/services/Trigger/TriggerVersionService.js +0 -20
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import type { DatasetCsvOptions } from './TriggerDatasetCsv.types';
|
|
2
|
-
export type { DatasetCsvOptions };
|
|
3
|
-
/**
|
|
4
|
-
* The three trigger actions that RETURN data (AAD-967).
|
|
5
|
-
*
|
|
6
|
-
* These are not new endpoints. They are `payload` shapes for an ordinary trigger,
|
|
7
|
-
* dispatched through the ordinary dispatch URL. What is new is the split below.
|
|
8
|
-
*
|
|
9
|
-
* Response and refusal shapes live in `TriggerDatasetResponses.types.ts`.
|
|
10
|
-
*
|
|
11
|
-
* ## Frozen publisher config vs caller parameters — the load-bearing distinction
|
|
12
|
-
*
|
|
13
|
-
* Everything in a `*Payload` type is **frozen publisher configuration**, stored on
|
|
14
|
-
* the trigger and read from there at dispatch. The dispatcher merges a caller's
|
|
15
|
-
* request body ABOVE the stored config, so an action reading its source from the
|
|
16
|
-
* request body would let a caller repoint it — these actions deliberately do not.
|
|
17
|
-
*
|
|
18
|
-
* A caller can therefore change **nothing structural**: not the table, not the
|
|
19
|
-
* file, not the script, not the column selection. The only dataset field a caller
|
|
20
|
-
* controls is `limit`, and only downward — see {@link DatasetCallerParams}.
|
|
21
|
-
*
|
|
22
|
-
* A UI that blurs this will mislead a publisher about what they are selling. Show
|
|
23
|
-
* the payload fields as "fixed for every caller" and `limit` as "the caller may
|
|
24
|
-
* ask for fewer".
|
|
25
|
-
*/
|
|
26
|
-
/** `Event.code` values for the three dataset actions. */
|
|
27
|
-
export type DatasetActionCode = 'ReturnTableDataEvent' | 'ReturnFileDataEvent' | 'TransformWithScriptEvent';
|
|
28
|
-
/** Column types a dataset may publish. Anything else is refused at dispatch. */
|
|
29
|
-
export type DatasetColumnType = 'boolean' | 'integer' | 'float' | 'textfield' | 'link' | 'email' | 'text' | 'dropdown' | 'sbscode' | 'date';
|
|
30
|
-
/**
|
|
31
|
-
* One selected column of a linked TABLE.
|
|
32
|
-
*
|
|
33
|
-
* Selected by `column_id` rather than by name, so renaming a column in the table
|
|
34
|
-
* does not silently change what a released version returns.
|
|
35
|
-
*/
|
|
36
|
-
export interface DatasetTableColumn {
|
|
37
|
-
column_id: string;
|
|
38
|
-
/** Buyer-facing key. Defaults to the column's own name. */
|
|
39
|
-
key?: string | null;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* One declared column of an uploaded FILE.
|
|
43
|
-
*
|
|
44
|
-
* A file declares no types of its own, so the publisher supplies them — which is
|
|
45
|
-
* what keeps the emitted schema declared rather than guessed. `source_key` is the
|
|
46
|
-
* header as it appears in this file; `key` is the buyer's contract. Only one of
|
|
47
|
-
* those is allowed to be a breaking change.
|
|
48
|
-
*/
|
|
49
|
-
export interface DatasetFileColumn {
|
|
50
|
-
source_key: string;
|
|
51
|
-
/** Always send it: omitted, the RAW header is returned. `^[\w-]+$`, not `id`, unique. */
|
|
52
|
-
key?: string | null;
|
|
53
|
-
type: DatasetColumnType;
|
|
54
|
-
label?: string | null;
|
|
55
|
-
}
|
|
56
|
-
/** Either kind of declared column, for a source that could be either. */
|
|
57
|
-
export type DatasetColumn = DatasetTableColumn | DatasetFileColumn;
|
|
58
|
-
/** `ReturnTableDataEvent` — rows from a linked dynamic table. */
|
|
59
|
-
export interface ReturnTableDataPayload {
|
|
60
|
-
table_id: string;
|
|
61
|
-
/** Required and non-empty. An empty list is REFUSED, never read as "all". */
|
|
62
|
-
columns: DatasetTableColumn[];
|
|
63
|
-
/** The publisher's row cap for one dispatch. Omit to use the platform default. */
|
|
64
|
-
limit?: number;
|
|
65
|
-
}
|
|
66
|
-
/** How `ReturnFileDataEvent` answers. */
|
|
67
|
-
export type DatasetFileMode = 'records' | 'raw';
|
|
68
|
-
/** Formats a file source can be parsed as. `.jsonl` is read as `ndjson`. */
|
|
69
|
-
export type DatasetFileFormat = 'csv' | 'json' | 'ndjson';
|
|
70
|
-
/**
|
|
71
|
-
* `ReturnFileDataEvent` — an uploaded DMS file, as rows or as a download link.
|
|
72
|
-
*
|
|
73
|
-
* **There is no upload endpoint for this.** The publisher uploads through the
|
|
74
|
-
* existing DMS endpoints and this points at the resulting file, which is also why
|
|
75
|
-
* deleting that file is blocked while a released version reads it.
|
|
76
|
-
*/
|
|
77
|
-
export interface ReturnFileDataPayload {
|
|
78
|
-
dms_file_id: string;
|
|
79
|
-
/** Defaults to `records`. An unrecognised value is refused, not defaulted. */
|
|
80
|
-
mode?: DatasetFileMode;
|
|
81
|
-
/** Defaults to the file's own extension. */
|
|
82
|
-
format?: DatasetFileFormat;
|
|
83
|
-
/**
|
|
84
|
-
* Required for `records`. **Ignored entirely by `raw`**, which hands over the
|
|
85
|
-
* whole file — so the column guarantee does not apply in raw mode.
|
|
86
|
-
*
|
|
87
|
-
* Optional here rather than required-under-`records`, because the two modes are
|
|
88
|
-
* not modelled as a discriminated union — so the compiler will NOT stop you
|
|
89
|
-
* submitting a `records` payload with no columns. Validate it in the form; the
|
|
90
|
-
* backend answers `invalid_payload_config`.
|
|
91
|
-
*/
|
|
92
|
-
columns?: DatasetFileColumn[];
|
|
93
|
-
/** CSV only. Omit for detection — see {@link DatasetCsvOptions}. */
|
|
94
|
-
csv?: DatasetCsvOptions;
|
|
95
|
-
limit?: number;
|
|
96
|
-
}
|
|
97
|
-
/** Whether the script's own value is returned, or the full run envelope. */
|
|
98
|
-
export type TransformResponseMode = 'result' | 'envelope';
|
|
99
|
-
/**
|
|
100
|
-
* `TransformWithScriptEvent` — a script shapes the response.
|
|
101
|
-
*
|
|
102
|
-
* ⚠️ **This action is a WRITE**, despite reading data and returning it, because it
|
|
103
|
-
* runs user-authored code under a freshly minted OAuth token. It therefore cannot
|
|
104
|
-
* be used on a `read_only` trigger. Check `Trigger.access_mode` and say so up
|
|
105
|
-
* front rather than letting the dispatch fail.
|
|
106
|
-
*
|
|
107
|
-
* Always synchronous — there is no async option, because an async run returns a
|
|
108
|
-
* task id and a permanently null result.
|
|
109
|
-
*/
|
|
110
|
-
export interface TransformWithScriptPayload {
|
|
111
|
-
script_id: string;
|
|
112
|
-
/** Defaults to `result`. Frozen here rather than derived from `debug_mode`. */
|
|
113
|
-
response_mode?: TransformResponseMode;
|
|
114
|
-
/**
|
|
115
|
-
* An optional declared source, using the same shape as the actions above. Omit
|
|
116
|
-
* both to hand the script only the caller's parameters.
|
|
117
|
-
*
|
|
118
|
-
* Nothing here expresses that `table_id` and `dms_file_id` are mutually
|
|
119
|
-
* exclusive — setting both is invalid and the backend refuses it. Enforce it in
|
|
120
|
-
* the form.
|
|
121
|
-
*/
|
|
122
|
-
table_id?: string;
|
|
123
|
-
dms_file_id?: string;
|
|
124
|
-
/**
|
|
125
|
-
* An ARRAY OF EITHER column kind, matching whichever source is set — not a
|
|
126
|
-
* union of two arrays, so it can be pushed into and bound to a row editor.
|
|
127
|
-
*/
|
|
128
|
-
columns?: DatasetColumn[];
|
|
129
|
-
/** For a CSV `dms_file_id` source. */
|
|
130
|
-
csv?: DatasetCsvOptions;
|
|
131
|
-
limit?: number;
|
|
132
|
-
/** Clamped by the engine to its configured maximum. */
|
|
133
|
-
timeout_s?: number;
|
|
134
|
-
python_version?: string;
|
|
135
|
-
}
|
|
136
|
-
export type DatasetActionPayload = ReturnTableDataPayload | ReturnFileDataPayload | TransformWithScriptPayload;
|
|
137
|
-
/** The payload type belonging to a given dataset action code. */
|
|
138
|
-
export type DatasetPayloadFor<C extends DatasetActionCode> = C extends 'ReturnTableDataEvent' ? ReturnTableDataPayload : C extends 'ReturnFileDataEvent' ? ReturnFileDataPayload : C extends 'TransformWithScriptEvent' ? TransformWithScriptPayload : never;
|
|
139
|
-
/**
|
|
140
|
-
* What a CALLER may send. Nothing here can widen what the publisher declared.
|
|
141
|
-
*
|
|
142
|
-
* `limit` is clamped to the publisher's declared limit and then to the platform
|
|
143
|
-
* ceiling, so asking for more returns the publisher's number rather than an error.
|
|
144
|
-
* A `TransformWithScriptEvent` additionally forwards the whole request body to the
|
|
145
|
-
* script as `INPUT.params`, minus `limit`.
|
|
146
|
-
*/
|
|
147
|
-
export interface DatasetCallerParams {
|
|
148
|
-
limit?: number;
|
|
149
|
-
/** Page start (records only): follow `DatasetRows.next_offset`, up to the row ceiling. */
|
|
150
|
-
offset?: number;
|
|
151
|
-
[param: string]: unknown;
|
|
152
|
-
}
|
|
153
|
-
/** Narrow an event code to one of the three dataset actions. */
|
|
154
|
-
export declare function isDatasetAction(code: string | null | undefined): code is DatasetActionCode;
|
|
155
|
-
/**
|
|
156
|
-
* Whether a dataset action can run on a trigger with `read_only` set.
|
|
157
|
-
*
|
|
158
|
-
* Only the script transform cannot: it executes user code with real credentials,
|
|
159
|
-
* so it is classified as a write however read-shaped it looks.
|
|
160
|
-
*/
|
|
161
|
-
export declare function isReadOnlyCompatible(code: DatasetActionCode): boolean;
|
|
162
|
-
/** Narrow an unknown payload to `TransformWithScriptEvent`'s config. */
|
|
163
|
-
export declare function isTransformWithScriptPayload(payload: unknown): payload is TransformWithScriptPayload;
|
|
164
|
-
/** Narrow an unknown payload to `ReturnTableDataEvent`'s config. */
|
|
165
|
-
export declare function isReturnTableDataPayload(payload: unknown): payload is ReturnTableDataPayload;
|
|
166
|
-
/** Narrow an unknown payload to `ReturnFileDataEvent`'s config. */
|
|
167
|
-
export declare function isReturnFileDataPayload(payload: unknown): payload is ReturnFileDataPayload;
|
|
168
|
-
//# sourceMappingURL=TriggerDataset.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerDataset.types.d.ts","sourceRoot":"","sources":["../../../src/services/Trigger/TriggerDataset.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,YAAY,EAAE,iBAAiB,EAAE,CAAA;AAEjC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,yDAAyD;AACzD,MAAM,MAAM,iBAAiB,GACvB,sBAAsB,GACtB,qBAAqB,GACrB,0BAA0B,CAAA;AAEhC,gFAAgF;AAChF,MAAM,MAAM,iBAAiB,GACvB,SAAS,GACT,SAAS,GACT,OAAO,GACP,WAAW,GACX,MAAM,GACN,OAAO,GACP,MAAM,GACN,UAAU,GACV,SAAS,GACT,MAAM,CAAA;AAEZ;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,yFAAyF;IACzF,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,iBAAiB,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,yEAAyE;AACzE,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,iBAAiB,CAAA;AAElE,iEAAiE;AACjE,MAAM,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BAAqB,GACrB,0BAA0B,CAAA;AAEhC,iEAAiE;AACjE,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,iBAAiB,IACrD,CAAC,SAAS,sBAAsB,GAAG,sBAAsB,GACvD,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,GACrD,CAAC,SAAS,0BAA0B,GAAG,0BAA0B,GAC/D,KAAK,CAAA;AAEf;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;CACzB;AAED,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,iBAAiB,CAI1F;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAErE;AAmBD,wEAAwE;AACxE,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,0BAA0B,CAGpG;AAED,oEAAoE;AACpE,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,sBAAsB,CAM5F;AAED,mEAAmE;AACnE,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,qBAAqB,CAK1F"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/** Narrow an event code to one of the three dataset actions. */
|
|
2
|
-
export function isDatasetAction(code) {
|
|
3
|
-
return code === 'ReturnTableDataEvent'
|
|
4
|
-
|| code === 'ReturnFileDataEvent'
|
|
5
|
-
|| code === 'TransformWithScriptEvent';
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Whether a dataset action can run on a trigger with `read_only` set.
|
|
9
|
-
*
|
|
10
|
-
* Only the script transform cannot: it executes user code with real credentials,
|
|
11
|
-
* so it is classified as a write however read-shaped it looks.
|
|
12
|
-
*/
|
|
13
|
-
export function isReadOnlyCompatible(code) {
|
|
14
|
-
return code !== 'TransformWithScriptEvent';
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* The payload guards below exist because `TriggerVersion.payload` is `unknown` and
|
|
18
|
-
* {@link DatasetActionPayload} carries no discriminant — so reading a released
|
|
19
|
-
* version's frozen config would otherwise need an `as` cast, which this repo
|
|
20
|
-
* forbids.
|
|
21
|
-
*
|
|
22
|
-
* `Event.code` remains the authority on which action a trigger is; these narrow
|
|
23
|
-
* the payload once you know that. Order matters: `script_id` is the only key
|
|
24
|
-
* unique to one shape, because `TransformWithScriptPayload` may also carry
|
|
25
|
-
* `table_id` or `dms_file_id`.
|
|
26
|
-
*/
|
|
27
|
-
function asRecord(payload) {
|
|
28
|
-
return (typeof payload === 'object' && payload !== null)
|
|
29
|
-
? payload
|
|
30
|
-
: null;
|
|
31
|
-
}
|
|
32
|
-
/** Narrow an unknown payload to `TransformWithScriptEvent`'s config. */
|
|
33
|
-
export function isTransformWithScriptPayload(payload) {
|
|
34
|
-
const body = asRecord(payload);
|
|
35
|
-
return body !== null && typeof body.script_id === 'string';
|
|
36
|
-
}
|
|
37
|
-
/** Narrow an unknown payload to `ReturnTableDataEvent`'s config. */
|
|
38
|
-
export function isReturnTableDataPayload(payload) {
|
|
39
|
-
const body = asRecord(payload);
|
|
40
|
-
return body !== null
|
|
41
|
-
&& typeof body.script_id !== 'string'
|
|
42
|
-
&& typeof body.table_id === 'string'
|
|
43
|
-
&& Array.isArray(body.columns);
|
|
44
|
-
}
|
|
45
|
-
/** Narrow an unknown payload to `ReturnFileDataEvent`'s config. */
|
|
46
|
-
export function isReturnFileDataPayload(payload) {
|
|
47
|
-
const body = asRecord(payload);
|
|
48
|
-
return body !== null
|
|
49
|
-
&& typeof body.script_id !== 'string'
|
|
50
|
-
&& typeof body.dms_file_id === 'string';
|
|
51
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { DatasetColumnType } from './TriggerDataset.types';
|
|
2
|
-
/**
|
|
3
|
-
* The rules for declaring a dataset column's published key and type.
|
|
4
|
-
*
|
|
5
|
-
* These live next to the types they narrow rather than in a UI package on
|
|
6
|
-
* purpose: they are interpretations of the AAD-967 contract, and the exhaustive
|
|
7
|
-
* records below are what make a new backend column type or refusal reason fail
|
|
8
|
-
* the BUILD instead of falling silently through a default. A UI library would
|
|
9
|
-
* put that guarantee in the wrong place, and every consumer would need its own
|
|
10
|
-
* copy of the same eleven strings.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Every publishable column type, as a runtime lookup.
|
|
14
|
-
*
|
|
15
|
-
* Annotated rather than inferred so the compiler rejects a missing key and a
|
|
16
|
-
* stray one alike — adding a member to {@link DatasetColumnType} without adding
|
|
17
|
-
* it here fails to build.
|
|
18
|
-
*/
|
|
19
|
-
export declare const DATASET_COLUMN_TYPES: Record<DatasetColumnType, true>;
|
|
20
|
-
/** What a FILE column may declare: the platform-table types (textfield, dropdown, sbscode) mean nothing in a file. */
|
|
21
|
-
export declare const DATASET_FILE_COLUMN_TYPES: readonly DatasetColumnType[];
|
|
22
|
-
/**
|
|
23
|
-
* Is this a column type a dataset may publish?
|
|
24
|
-
*
|
|
25
|
-
* ⚠️ `hasOwnProperty.call`, AND NEITHER OF THE TWO OBVIOUS ALTERNATIVES. `in`
|
|
26
|
-
* answers true for every inherited key, so `isDatasetColumnType('toString')` used
|
|
27
|
-
* to report a publishable column type. `Object.hasOwn` is the rule's preferred
|
|
28
|
-
* form and this package's TS lib predates it — swapping it in compiles under
|
|
29
|
-
* `tsc -p` and then fails the Python schema generator, which builds its own
|
|
30
|
-
* program from these files. Hence the disable rather than the autofix.
|
|
31
|
-
*/
|
|
32
|
-
export declare function isDatasetColumnType(type: string): type is DatasetColumnType;
|
|
33
|
-
/**
|
|
34
|
-
* Keys a publisher may not claim.
|
|
35
|
-
*
|
|
36
|
-
* `id` is reserved because every dataset row leads with it — the record id for a
|
|
37
|
-
* table, the 1-based line number for a file. A publisher who maps their own
|
|
38
|
-
* column to `id` would silently shadow it.
|
|
39
|
-
*/
|
|
40
|
-
export declare const RESERVED_DATASET_KEYS: readonly string[];
|
|
41
|
-
/** Case-insensitive: `ID` collides with the reserved `id` just as surely. */
|
|
42
|
-
export declare function isReservedDatasetKey(key: string): boolean;
|
|
43
|
-
/** Letters, digits, underscore and hyphen. Anything else is not a usable key. */
|
|
44
|
-
export declare function isValidDatasetKey(key: string): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* A reasonable published key for a source column or file header.
|
|
47
|
-
*
|
|
48
|
-
* Only a starting point — the publisher owns the final name, because it is the
|
|
49
|
-
* buyer's contract.
|
|
50
|
-
*/
|
|
51
|
-
export declare function defaultDatasetKeyFor(name: string): string;
|
|
52
|
-
/** Why a published key is unusable. `null` means it is fine. */
|
|
53
|
-
export type DatasetKeyError = 'required' | 'reserved' | 'invalid' | 'duplicate';
|
|
54
|
-
/**
|
|
55
|
-
* Validate one published key.
|
|
56
|
-
*
|
|
57
|
-
* ⚠️ **The order of these checks is the message a user sees**, and it is not
|
|
58
|
-
* arbitrary. A blank key is `required`, never `invalid` — telling someone their
|
|
59
|
-
* empty field contains illegal characters sends them looking for a character
|
|
60
|
-
* that is not there. Reserved beats invalid for the same reason: `id` is a
|
|
61
|
-
* perfectly well-formed key, so "invalid" would be a lie about why it was
|
|
62
|
-
* refused. Duplicate is last because it is the only one that depends on the
|
|
63
|
-
* other rows rather than on this key alone.
|
|
64
|
-
*/
|
|
65
|
-
export declare function datasetKeyError(key: string, duplicates: ReadonlySet<string>): DatasetKeyError | null;
|
|
66
|
-
/**
|
|
67
|
-
* Which of these keys appear more than once.
|
|
68
|
-
*
|
|
69
|
-
* Blank keys are excluded: several unfilled rows are not a name collision, and
|
|
70
|
-
* flagging them as duplicates would report the same problem twice under the
|
|
71
|
-
* wrong name.
|
|
72
|
-
*/
|
|
73
|
-
export declare function duplicateDatasetKeys(keys: readonly string[]): Set<string>;
|
|
74
|
-
//# sourceMappingURL=TriggerDatasetColumns.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerDatasetColumns.d.ts","sourceRoot":"","sources":["../../../src/services/Trigger/TriggerDatasetColumns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,iBAAiB,EAAE,IAAI,CAWhE,CAAA;AAED,sHAAsH;AACtH,eAAO,MAAM,yBAAyB,EAAE,SAAS,iBAAiB,EAAqE,CAAA;AAEvI;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,iBAAiB,CAG3E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAAW,CAAA;AAE9D,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED,gEAAgE;AAChE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAA;AAE/E;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,eAAe,GAAG,IAAI,CAWpG;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAazE"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The rules for declaring a dataset column's published key and type.
|
|
3
|
-
*
|
|
4
|
-
* These live next to the types they narrow rather than in a UI package on
|
|
5
|
-
* purpose: they are interpretations of the AAD-967 contract, and the exhaustive
|
|
6
|
-
* records below are what make a new backend column type or refusal reason fail
|
|
7
|
-
* the BUILD instead of falling silently through a default. A UI library would
|
|
8
|
-
* put that guarantee in the wrong place, and every consumer would need its own
|
|
9
|
-
* copy of the same eleven strings.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Every publishable column type, as a runtime lookup.
|
|
13
|
-
*
|
|
14
|
-
* Annotated rather than inferred so the compiler rejects a missing key and a
|
|
15
|
-
* stray one alike — adding a member to {@link DatasetColumnType} without adding
|
|
16
|
-
* it here fails to build.
|
|
17
|
-
*/
|
|
18
|
-
export const DATASET_COLUMN_TYPES = {
|
|
19
|
-
boolean: true,
|
|
20
|
-
integer: true,
|
|
21
|
-
float: true,
|
|
22
|
-
textfield: true,
|
|
23
|
-
link: true,
|
|
24
|
-
email: true,
|
|
25
|
-
text: true,
|
|
26
|
-
dropdown: true,
|
|
27
|
-
sbscode: true,
|
|
28
|
-
date: true,
|
|
29
|
-
};
|
|
30
|
-
/** What a FILE column may declare: the platform-table types (textfield, dropdown, sbscode) mean nothing in a file. */
|
|
31
|
-
export const DATASET_FILE_COLUMN_TYPES = ['text', 'integer', 'float', 'boolean', 'date', 'email', 'link'];
|
|
32
|
-
/**
|
|
33
|
-
* Is this a column type a dataset may publish?
|
|
34
|
-
*
|
|
35
|
-
* ⚠️ `hasOwnProperty.call`, AND NEITHER OF THE TWO OBVIOUS ALTERNATIVES. `in`
|
|
36
|
-
* answers true for every inherited key, so `isDatasetColumnType('toString')` used
|
|
37
|
-
* to report a publishable column type. `Object.hasOwn` is the rule's preferred
|
|
38
|
-
* form and this package's TS lib predates it — swapping it in compiles under
|
|
39
|
-
* `tsc -p` and then fails the Python schema generator, which builds its own
|
|
40
|
-
* program from these files. Hence the disable rather than the autofix.
|
|
41
|
-
*/
|
|
42
|
-
export function isDatasetColumnType(type) {
|
|
43
|
-
// eslint-disable-next-line e18e/prefer-object-has-own -- Object.hasOwn is not in this package's TS lib; see above
|
|
44
|
-
return Object.prototype.hasOwnProperty.call(DATASET_COLUMN_TYPES, type);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Keys a publisher may not claim.
|
|
48
|
-
*
|
|
49
|
-
* `id` is reserved because every dataset row leads with it — the record id for a
|
|
50
|
-
* table, the 1-based line number for a file. A publisher who maps their own
|
|
51
|
-
* column to `id` would silently shadow it.
|
|
52
|
-
*/
|
|
53
|
-
export const RESERVED_DATASET_KEYS = ['id'];
|
|
54
|
-
/** Case-insensitive: `ID` collides with the reserved `id` just as surely. */
|
|
55
|
-
export function isReservedDatasetKey(key) {
|
|
56
|
-
return RESERVED_DATASET_KEYS.includes(key.trim().toLowerCase());
|
|
57
|
-
}
|
|
58
|
-
/** Letters, digits, underscore and hyphen. Anything else is not a usable key. */
|
|
59
|
-
export function isValidDatasetKey(key) {
|
|
60
|
-
return /^[\w-]+$/.test(key);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* A reasonable published key for a source column or file header.
|
|
64
|
-
*
|
|
65
|
-
* Only a starting point — the publisher owns the final name, because it is the
|
|
66
|
-
* buyer's contract.
|
|
67
|
-
*/
|
|
68
|
-
export function defaultDatasetKeyFor(name) {
|
|
69
|
-
return name
|
|
70
|
-
.trim()
|
|
71
|
-
.toLowerCase()
|
|
72
|
-
.replace(/[^a-z0-9]+/g, '_')
|
|
73
|
-
.replace(/^_+|_+$/g, '');
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Validate one published key.
|
|
77
|
-
*
|
|
78
|
-
* ⚠️ **The order of these checks is the message a user sees**, and it is not
|
|
79
|
-
* arbitrary. A blank key is `required`, never `invalid` — telling someone their
|
|
80
|
-
* empty field contains illegal characters sends them looking for a character
|
|
81
|
-
* that is not there. Reserved beats invalid for the same reason: `id` is a
|
|
82
|
-
* perfectly well-formed key, so "invalid" would be a lie about why it was
|
|
83
|
-
* refused. Duplicate is last because it is the only one that depends on the
|
|
84
|
-
* other rows rather than on this key alone.
|
|
85
|
-
*/
|
|
86
|
-
export function datasetKeyError(key, duplicates) {
|
|
87
|
-
const trimmed = key.trim();
|
|
88
|
-
if (!trimmed)
|
|
89
|
-
return 'required';
|
|
90
|
-
if (isReservedDatasetKey(trimmed))
|
|
91
|
-
return 'reserved';
|
|
92
|
-
if (!isValidDatasetKey(trimmed))
|
|
93
|
-
return 'invalid';
|
|
94
|
-
if (duplicates.has(trimmed))
|
|
95
|
-
return 'duplicate';
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Which of these keys appear more than once.
|
|
100
|
-
*
|
|
101
|
-
* Blank keys are excluded: several unfilled rows are not a name collision, and
|
|
102
|
-
* flagging them as duplicates would report the same problem twice under the
|
|
103
|
-
* wrong name.
|
|
104
|
-
*/
|
|
105
|
-
export function duplicateDatasetKeys(keys) {
|
|
106
|
-
const seen = new Set();
|
|
107
|
-
const dupes = new Set();
|
|
108
|
-
for (const raw of keys) {
|
|
109
|
-
const key = raw.trim();
|
|
110
|
-
if (!key)
|
|
111
|
-
continue;
|
|
112
|
-
if (seen.has(key))
|
|
113
|
-
dupes.add(key);
|
|
114
|
-
else
|
|
115
|
-
seen.add(key);
|
|
116
|
-
}
|
|
117
|
-
return dupes;
|
|
118
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerDatasetCsv.types.d.ts","sourceRoot":"","sources":["../../../src/services/Trigger/TriggerDatasetCsv.types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;IAC3C,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,CAAA;IAC5C,iBAAiB,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,GAAG,CAAA;CACvC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What a dataset action ANSWERS with (AAD-967) — successful shapes and refusals.
|
|
3
|
-
*
|
|
4
|
-
* Split from `TriggerDataset.types.ts`, which carries the frozen publisher config
|
|
5
|
-
* a caller cannot repoint. This file is the wire side: what comes back, and how a
|
|
6
|
-
* refusal is told apart from an empty result.
|
|
7
|
-
*/
|
|
8
|
-
/** Rows returned by a dataset action. */
|
|
9
|
-
export interface DatasetRows {
|
|
10
|
-
/** Buyer-facing keys, in the publisher's declared order. */
|
|
11
|
-
keys: string[];
|
|
12
|
-
/** Led by `id` (record id, or 1-based file line); values in their declared JSON type. */
|
|
13
|
-
rows: Array<Record<string, unknown>>;
|
|
14
|
-
/** How many rows are in THIS response, not how many exist. */
|
|
15
|
-
row_count: number;
|
|
16
|
-
/**
|
|
17
|
-
* There was more data than `limit` allowed.
|
|
18
|
-
*
|
|
19
|
-
* Too much data is never an error for these actions — you get the rows up to
|
|
20
|
-
* the limit plus this flag. Say so in the UI; a silently short answer that looks
|
|
21
|
-
* complete is the failure this flag exists to prevent.
|
|
22
|
-
*/
|
|
23
|
-
truncated: boolean;
|
|
24
|
-
/** The limit actually applied, after clamping. */
|
|
25
|
-
limit: number;
|
|
26
|
-
/** Where this page started. */
|
|
27
|
-
offset: number;
|
|
28
|
-
/** Send as `offset` for the next page; null when there is none or the row ceiling is reached. */
|
|
29
|
-
next_offset: number | null;
|
|
30
|
-
}
|
|
31
|
-
/** `ReturnFileDataEvent` in `raw` mode. */
|
|
32
|
-
export interface DatasetRawFile {
|
|
33
|
-
/** No DMS id, no storage token, no project or licence id — by design. */
|
|
34
|
-
file: {
|
|
35
|
-
name: string;
|
|
36
|
-
extension: string;
|
|
37
|
-
mime: string;
|
|
38
|
-
size: number | string;
|
|
39
|
-
};
|
|
40
|
-
/** Short-lived and signed. Carries no credential, so its lifetime IS the grant. */
|
|
41
|
-
download_url: string;
|
|
42
|
-
expires_in_seconds: number;
|
|
43
|
-
}
|
|
44
|
-
/** `TransformWithScriptEvent` with `response_mode: 'envelope'`. */
|
|
45
|
-
export interface TransformRunEnvelope {
|
|
46
|
-
task_id: string;
|
|
47
|
-
status: string;
|
|
48
|
-
exit_code: number | null;
|
|
49
|
-
/** Whatever the script emitted via its `__ANT_RESULT__:` sentinel. */
|
|
50
|
-
result: unknown;
|
|
51
|
-
stdout_tail: string;
|
|
52
|
-
meta: Record<string, unknown>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* ⚠️ **Every dataset dispatch is wrapped**, even though all three actions run
|
|
56
|
-
* synchronously and inline.
|
|
57
|
-
*
|
|
58
|
-
* The dispatcher decides the envelope from whether the payload carries an `async`
|
|
59
|
-
* key, and only the older `RunScriptEvent` sets one — so these actions are
|
|
60
|
-
* reported through the async-shaped envelope regardless. Read `response`, not the
|
|
61
|
-
* top level. Not worth changing: it would move the response shape of every
|
|
62
|
-
* existing action.
|
|
63
|
-
*/
|
|
64
|
-
export interface DatasetDispatchEnvelope<T> {
|
|
65
|
-
response: T | null;
|
|
66
|
-
error: string | null;
|
|
67
|
-
}
|
|
68
|
-
/** Why a dataset action refused to serve. */
|
|
69
|
-
export type DatasetRefusalReason = 'invalid_payload_config' | 'byte_limit_exceeded' | 'source_table_missing' | 'upload_source_missing' | 'unsupported_upload_format' | 'malformed_upload' | 'row_shape_mismatch' | 'value_type_mismatch'
|
|
70
|
-
/** A declared column names a header the file does not have. */
|
|
71
|
-
| 'unknown_source_column' | 'unpublishable_column_type'
|
|
72
|
-
/**
|
|
73
|
-
* An OPERATOR fault: the deployment's ceilings are unusable. Must NOT be shown
|
|
74
|
-
* to a publisher as "your dataset is too big" — that sends them hunting through
|
|
75
|
-
* their own data for a problem in the environment.
|
|
76
|
-
*
|
|
77
|
-
* The string still says `snapshot` deliberately: it is persisted in existing
|
|
78
|
-
* rows, and changing it would break reading them.
|
|
79
|
-
*/
|
|
80
|
-
| 'snapshot_limits_misconfigured' | 'internal_error';
|
|
81
|
-
/**
|
|
82
|
-
* Every refusal reason, as a runtime lookup.
|
|
83
|
-
*
|
|
84
|
-
* Annotated `Record<DatasetRefusalReason, true>` rather than inferred, so the
|
|
85
|
-
* compiler rejects both a missing key and a stray one: adding a member to
|
|
86
|
-
* {@link DatasetRefusalReason} without adding it here fails to build. That is the
|
|
87
|
-
* point — a reason nobody mapped must not fail silently.
|
|
88
|
-
*/
|
|
89
|
-
export declare const DATASET_REFUSAL_REASONS: Record<DatasetRefusalReason, true>;
|
|
90
|
-
/**
|
|
91
|
-
* A release refused because the file does not serve as declared (422 from
|
|
92
|
-
* `releaseTriggerVersion`). Unlike a dispatch refusal, `message` is the DETAILED
|
|
93
|
-
* one — only the publisher releases — and names the row and column to fix.
|
|
94
|
-
*/
|
|
95
|
-
export interface DatasetReleaseRefusal {
|
|
96
|
-
dataset_refused: true;
|
|
97
|
-
reason: DatasetRefusalReason;
|
|
98
|
-
message: string;
|
|
99
|
-
context: Record<string, unknown>;
|
|
100
|
-
status_code: 422;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* A dataset action refused to serve.
|
|
104
|
-
*
|
|
105
|
-
* ⚠️ Arrives as a NON-2xx response, so it surfaces as a rejected request — read it
|
|
106
|
-
* off the error body, not the resolved value. It sits inside the dispatch
|
|
107
|
-
* envelope: `error.response.data.response`.
|
|
108
|
-
*
|
|
109
|
-
* **Branch on `reason`, never on the HTTP status.** There are only two statuses —
|
|
110
|
-
* 422 for anything the publisher or the data is responsible for, 5xx for
|
|
111
|
-
* `snapshot_limits_misconfigured` and `internal_error` — so the status cannot tell
|
|
112
|
-
* you what to say.
|
|
113
|
-
*
|
|
114
|
-
* `message` is a caller-safe sentence. The detailed one, which names columns and
|
|
115
|
-
* table ids, is deliberately withheld and only reaches the execution history the
|
|
116
|
-
* publisher can read. Do not expect it here.
|
|
117
|
-
*
|
|
118
|
-
* ⚠️ **Never render this as an empty result.** "This file is gone" and "this
|
|
119
|
-
* dataset has no rows" look identical to a user and call for opposite actions.
|
|
120
|
-
*/
|
|
121
|
-
export interface DatasetRefusedResult {
|
|
122
|
-
dataset_refused: true;
|
|
123
|
-
reason: DatasetRefusalReason;
|
|
124
|
-
message: string;
|
|
125
|
-
/** Informational — branch on `reason`. */
|
|
126
|
-
status_code: number;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Type guard: is this a refused dataset dispatch?
|
|
130
|
-
*
|
|
131
|
-
* Accepts either the dispatch envelope or the inner body, so it can be pointed
|
|
132
|
-
* straight at `error.response?.data` without unwrapping first.
|
|
133
|
-
*
|
|
134
|
-
* ⚠️ **This is a deliberately loose narrow, and the looseness is load-bearing.**
|
|
135
|
-
* It accepts any string `reason` rather than only the eleven known ones, so that a
|
|
136
|
-
* reason a newer backend adds is still recognised AS a refusal instead of falling
|
|
137
|
-
* through to "empty result" — which is the one failure mode this whole contract
|
|
138
|
-
* exists to prevent.
|
|
139
|
-
*
|
|
140
|
-
* The cost is that the narrowed type is optimistic: `reason` may be a string
|
|
141
|
-
* outside {@link DatasetRefusalReason}, and `message` may be absent. So:
|
|
142
|
-
*
|
|
143
|
-
* - Give every `switch (reason)` a `default:` arm, and map unknown reasons to a
|
|
144
|
-
* generic sentence rather than letting them fall into a specific one.
|
|
145
|
-
* - Do NOT trust {@link isOperatorFault} alone to classify an unrecognised
|
|
146
|
-
* reason — it answers `false`, which reads as "the publisher's fault". Check
|
|
147
|
-
* membership with {@link DATASET_REFUSAL_REASONS} first when the distinction
|
|
148
|
-
* drives what you tell someone.
|
|
149
|
-
*/
|
|
150
|
-
export declare function isDatasetRefused(result: unknown): result is DatasetRefusedResult;
|
|
151
|
-
/**
|
|
152
|
-
* Narrow a stored or received response to {@link DatasetRows}.
|
|
153
|
-
*
|
|
154
|
-
* ⚠️ **DELIBERATELY DOES NOT REQUIRE `rows` TO BE INTACT.** A run recorded in the
|
|
155
|
-
* execution history has `stored_response_truncated: true` for essentially every
|
|
156
|
-
* dataset action — the stored copy of `rows` is elided to save database space, and
|
|
157
|
-
* arrives with a `"... (2 more items truncated)"` string sitting in the array. The
|
|
158
|
-
* caller still received everything.
|
|
159
|
-
*
|
|
160
|
-
* `row_count` is a SCALAR recorded beside the array and is never elided, so it
|
|
161
|
-
* stays true across that shrinking. Reading `rows.length` instead would report a
|
|
162
|
-
* five-row answer as two — which is why this guard checks the count and not the
|
|
163
|
-
* array, and why any caller should read `row_count` rather than measuring `rows`.
|
|
164
|
-
*/
|
|
165
|
-
export declare function isDatasetRows(response: unknown): response is DatasetRows;
|
|
166
|
-
/** Is this a reason this build of the SDK knows about? */
|
|
167
|
-
export declare function isKnownRefusalReason(reason: string): reason is DatasetRefusalReason;
|
|
168
|
-
/**
|
|
169
|
-
* Is this reason the operator's fault rather than the publisher's?
|
|
170
|
-
*
|
|
171
|
-
* ⚠️ Answers `false` for an unrecognised reason, which reads as "the publisher's
|
|
172
|
-
* fault". Guard with {@link isKnownRefusalReason} when that distinction is what
|
|
173
|
-
* you are about to tell someone.
|
|
174
|
-
*/
|
|
175
|
-
export declare function isOperatorFault(reason: DatasetRefusalReason): boolean;
|
|
176
|
-
//# sourceMappingURL=TriggerDatasetResponses.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerDatasetResponses.types.d.ts","sourceRoot":"","sources":["../../../src/services/Trigger/TriggerDatasetResponses.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,yCAAyC;AACzC,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,yFAAyF;IACzF,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA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