@rjromeoent/ein-supabase 0.1.13 → 0.2.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/README.md +31 -1
- package/dist/document-intake.d.ts +450 -0
- package/dist/document-intake.js +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ This package is the canonical home for:
|
|
|
9
9
|
- Registered app slugs and the `x-ein-app` header helper.
|
|
10
10
|
- Shared org-role helpers for `core.app_organization_memberships`.
|
|
11
11
|
- Typed schema-client helpers.
|
|
12
|
+
- Document-intake Edge Function names and request/response DTOs.
|
|
12
13
|
|
|
13
14
|
Regenerate database types from the Event Intelligence Network repo root:
|
|
14
15
|
|
|
@@ -87,7 +88,7 @@ Then app repos should depend on the released version:
|
|
|
87
88
|
```json
|
|
88
89
|
{
|
|
89
90
|
"dependencies": {
|
|
90
|
-
"@rjromeoent/ein-supabase": "^0.
|
|
91
|
+
"@rjromeoent/ein-supabase": "^0.2.0"
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
```
|
|
@@ -226,6 +227,35 @@ different JSON parsing behavior.
|
|
|
226
227
|
These helpers should stay small and dependency-free. App-specific parsers should
|
|
227
228
|
compose them locally.
|
|
228
229
|
|
|
230
|
+
#### Document Intake API Contracts
|
|
231
|
+
|
|
232
|
+
Examples:
|
|
233
|
+
|
|
234
|
+
- `DOCUMENT_INTAKE_EDGE_FUNCTIONS`
|
|
235
|
+
- `DocumentIntakeCreateBatchRequest`
|
|
236
|
+
- `DocumentIntakeGetBatchResponse`
|
|
237
|
+
- `DocumentFindingAction`
|
|
238
|
+
- `DocumentFindingStatus`
|
|
239
|
+
- `DocumentReconciliationOperationDto`
|
|
240
|
+
- `AiModelInvocationSummaryDto`
|
|
241
|
+
- `AvailabilityReviewRowDto`
|
|
242
|
+
- `AvailabilityBatchDetailsDto`
|
|
243
|
+
|
|
244
|
+
Why:
|
|
245
|
+
|
|
246
|
+
The document-intake review UI and the EIN Edge Functions need to agree on
|
|
247
|
+
endpoint names, request bodies, response DTOs, finding actions, reconciliation
|
|
248
|
+
operations, and AI invocation summaries. These contracts are app-facing even
|
|
249
|
+
before all `document_intake` tables are available in generated database types.
|
|
250
|
+
|
|
251
|
+
Keep UI-only state local to the app. Examples that should not move here:
|
|
252
|
+
|
|
253
|
+
- upload progress state;
|
|
254
|
+
- review mode or active tab;
|
|
255
|
+
- row edit drafts;
|
|
256
|
+
- matrix/table view models;
|
|
257
|
+
- sidebar and filter state.
|
|
258
|
+
|
|
229
259
|
#### Cross-App Backend Contracts
|
|
230
260
|
|
|
231
261
|
Examples:
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import type { JsonRecord } from "./json.js";
|
|
2
|
+
export declare const DOCUMENT_INTAKE_EDGE_FUNCTIONS: {
|
|
3
|
+
readonly createBatch: "document-intake-create-batch";
|
|
4
|
+
readonly registerFiles: "document-intake-register-files";
|
|
5
|
+
readonly processFile: "document-intake-process-file";
|
|
6
|
+
readonly processFileWorker: "document-intake-process-file-worker";
|
|
7
|
+
readonly processingReaper: "document-intake-processing-reaper";
|
|
8
|
+
readonly getBatch: "document-intake-get-batch";
|
|
9
|
+
readonly listBatches: "document-intake-list-batches";
|
|
10
|
+
readonly updateRecord: "document-intake-update-record";
|
|
11
|
+
readonly updateFinding: "document-intake-update-finding";
|
|
12
|
+
readonly submitBatch: "document-intake-submit-batch";
|
|
13
|
+
};
|
|
14
|
+
export type DocumentIntakeEndpointKey = keyof typeof DOCUMENT_INTAKE_EDGE_FUNCTIONS;
|
|
15
|
+
export type DocumentIntakeEdgeFunctionName = (typeof DOCUMENT_INTAKE_EDGE_FUNCTIONS)[DocumentIntakeEndpointKey];
|
|
16
|
+
export type DocumentIntakeDomainKey = "availability" | string;
|
|
17
|
+
export type DocumentIntakeBatchStatus = "draft" | "uploading" | "uploaded" | "processing" | "extracting" | "ready_for_review" | "submitting" | "submitted" | "normalizing" | "completed" | "completed_with_exceptions" | "failed" | "canceled";
|
|
18
|
+
export type DocumentIntakeFileStatus = "pending_upload" | "uploaded" | "queued" | "processing" | "extracting" | "parsed" | "ready_for_review" | "failed" | "ignored" | "canceled";
|
|
19
|
+
export type DocumentIntakeProcessingStatus = "queued" | "running" | "succeeded" | "failed" | "canceled";
|
|
20
|
+
export type DocumentIntakeReviewStatus = "needs_review" | "accepted" | "rejected" | "submitted";
|
|
21
|
+
export type DocumentFindingSeverity = "info" | "warning" | "error";
|
|
22
|
+
export type DocumentFindingSource = "parser" | "validator" | "ai" | "reconciliation" | "system";
|
|
23
|
+
export type DocumentFindingScope = "batch" | "file" | "chunk" | "record" | "record_group" | "entity" | "evidence";
|
|
24
|
+
export type DocumentFindingAction = "resolve" | "dismiss" | "reopen" | "request_ai_verification" | "apply_reconciliation_operation" | "edit_record" | "map_entity" | "create_entity";
|
|
25
|
+
export type DocumentFindingStatus = "open" | "resolved" | "dismissed" | "superseded";
|
|
26
|
+
export type DocumentFindingStatusUpdate = Extract<DocumentFindingStatus, "open" | "resolved" | "dismissed">;
|
|
27
|
+
export type DocumentFindingActionStatus = "applied" | "queued" | "rejected" | "failed";
|
|
28
|
+
export type DocumentReconciliationOperationKind = "merge" | "split" | "flag" | "drop_exact_duplicate" | "normalize" | "link_entity" | "supersede";
|
|
29
|
+
export type DocumentReconciliationDecision = "automatic" | "requires_human_approval" | "ai_suggested";
|
|
30
|
+
export type DocumentReconciliationOperationStatus = "applied" | "proposed" | "skipped";
|
|
31
|
+
export type AvailabilityDocumentFamily = "standard_availability_workbook" | "caa_matrix_workbook" | "caa_route_calendar_pdf" | "uta_buyer_copy_route_pdf" | "uta_casino_pdf" | "wasserman_route_pdf" | "wme_mtr_workbook" | "wme_route_book_pdf" | "generic_availability_document" | string;
|
|
32
|
+
export type AvailabilityStorageBucket = "availability-uploads";
|
|
33
|
+
export interface DocumentIntakeErrorResponse {
|
|
34
|
+
error: string;
|
|
35
|
+
details?: unknown;
|
|
36
|
+
}
|
|
37
|
+
export interface DocumentIntakeBatchDto<TDefaultContext extends JsonRecord = JsonRecord, TMetadata extends JsonRecord = JsonRecord> {
|
|
38
|
+
id: string;
|
|
39
|
+
organization_id: string;
|
|
40
|
+
created_by_profile_id?: string | null;
|
|
41
|
+
domain_key?: DocumentIntakeDomainKey;
|
|
42
|
+
source_system?: string;
|
|
43
|
+
intake_channel?: string;
|
|
44
|
+
source_label?: string | null;
|
|
45
|
+
status: DocumentIntakeBatchStatus | string;
|
|
46
|
+
default_context?: TDefaultContext | null;
|
|
47
|
+
metadata?: TMetadata | null;
|
|
48
|
+
file_count?: number;
|
|
49
|
+
total_candidate_count?: number;
|
|
50
|
+
accepted_candidate_count?: number;
|
|
51
|
+
rejected_candidate_count?: number;
|
|
52
|
+
needs_review_candidate_count?: number;
|
|
53
|
+
submitted_candidate_count?: number;
|
|
54
|
+
open_finding_count?: number;
|
|
55
|
+
blocking_finding_count?: number;
|
|
56
|
+
error_code?: string | null;
|
|
57
|
+
error_message?: string | null;
|
|
58
|
+
created_at?: string;
|
|
59
|
+
updated_at?: string;
|
|
60
|
+
submitted_at?: string | null;
|
|
61
|
+
completed_at?: string | null;
|
|
62
|
+
}
|
|
63
|
+
export type DocumentIntakeBatchSummaryDto = DocumentIntakeBatchDto;
|
|
64
|
+
export interface DocumentIntakeFileDto<TMetadata extends JsonRecord = JsonRecord> {
|
|
65
|
+
id: string;
|
|
66
|
+
batch_id: string;
|
|
67
|
+
organization_id: string;
|
|
68
|
+
domain_key?: DocumentIntakeDomainKey;
|
|
69
|
+
storage_bucket?: string;
|
|
70
|
+
storage_path?: string;
|
|
71
|
+
original_file_name: string;
|
|
72
|
+
content_type?: string | null;
|
|
73
|
+
file_size_bytes?: number | null;
|
|
74
|
+
checksum_sha256?: string | null;
|
|
75
|
+
file_fingerprint_sha256?: string | null;
|
|
76
|
+
status: DocumentIntakeFileStatus | string;
|
|
77
|
+
document_family?: string | null;
|
|
78
|
+
layout_variant?: string | null;
|
|
79
|
+
route?: string | null;
|
|
80
|
+
strategy_key?: string | null;
|
|
81
|
+
matched_strategy_id?: string | null;
|
|
82
|
+
processor_key?: string | null;
|
|
83
|
+
processor_version?: string | null;
|
|
84
|
+
classification_source?: string | null;
|
|
85
|
+
classification_confidence?: number | null;
|
|
86
|
+
metadata?: TMetadata | null;
|
|
87
|
+
error_code?: string | null;
|
|
88
|
+
error_message: string | null;
|
|
89
|
+
created_at?: string;
|
|
90
|
+
updated_at?: string;
|
|
91
|
+
uploaded_at?: string | null;
|
|
92
|
+
completed_at?: string | null;
|
|
93
|
+
}
|
|
94
|
+
export interface AiModelInvocationSummaryDto<TMetadata extends JsonRecord = JsonRecord> {
|
|
95
|
+
id: string;
|
|
96
|
+
organization_id?: string | null;
|
|
97
|
+
domain: string;
|
|
98
|
+
feature_key: string;
|
|
99
|
+
context_prompt_id?: string | null;
|
|
100
|
+
prompt_revision_id?: string | null;
|
|
101
|
+
model_provider: string;
|
|
102
|
+
model_name: string;
|
|
103
|
+
input_token_count: number | null;
|
|
104
|
+
output_token_count: number | null;
|
|
105
|
+
input_cost_estimate: number | string | null;
|
|
106
|
+
output_cost_estimate: number | string | null;
|
|
107
|
+
total_cost_estimate: number | string | null;
|
|
108
|
+
cost_currency: string | null;
|
|
109
|
+
cost_estimate_source: string | null;
|
|
110
|
+
status: string;
|
|
111
|
+
started_at: string | null;
|
|
112
|
+
completed_at: string | null;
|
|
113
|
+
latency_ms: number | null;
|
|
114
|
+
error_message: string | null;
|
|
115
|
+
metadata?: TMetadata | null;
|
|
116
|
+
}
|
|
117
|
+
export interface DocumentIntakeReviewFileDto<TMetadata extends JsonRecord = JsonRecord> extends DocumentIntakeFileDto<TMetadata> {
|
|
118
|
+
extraction_method: string | null;
|
|
119
|
+
parser_version: string | null;
|
|
120
|
+
ai_model_invocation?: AiModelInvocationSummaryDto | null;
|
|
121
|
+
}
|
|
122
|
+
export interface DocumentIntakeProcessingJobDto<TMetadata extends JsonRecord = JsonRecord> {
|
|
123
|
+
id: string;
|
|
124
|
+
file_id: string;
|
|
125
|
+
batch_id?: string;
|
|
126
|
+
job_kind?: string | null;
|
|
127
|
+
route?: string | null;
|
|
128
|
+
strategy_key?: string | null;
|
|
129
|
+
processor_key?: string | null;
|
|
130
|
+
processor_version?: string | null;
|
|
131
|
+
status: DocumentIntakeProcessingStatus | string;
|
|
132
|
+
extraction_method: string | null;
|
|
133
|
+
parser_version: string | null;
|
|
134
|
+
model_invocation_id: string | null;
|
|
135
|
+
error_code: string | null;
|
|
136
|
+
error_message: string | null;
|
|
137
|
+
input_summary?: JsonRecord | null;
|
|
138
|
+
output_summary?: JsonRecord | null;
|
|
139
|
+
metadata?: TMetadata | null;
|
|
140
|
+
started_at: string | null;
|
|
141
|
+
completed_at: string | null;
|
|
142
|
+
created_at: string;
|
|
143
|
+
updated_at: string;
|
|
144
|
+
ai_model_invocation?: AiModelInvocationSummaryDto | null;
|
|
145
|
+
}
|
|
146
|
+
export interface DocumentIntakeProcessingChunkDto<TMetadata extends JsonRecord = JsonRecord> {
|
|
147
|
+
id: string;
|
|
148
|
+
processing_job_id: string;
|
|
149
|
+
batch_id?: string;
|
|
150
|
+
file_id: string;
|
|
151
|
+
chunk_index: number;
|
|
152
|
+
chunk_key: string;
|
|
153
|
+
chunk_type: string;
|
|
154
|
+
status: DocumentIntakeProcessingStatus | string;
|
|
155
|
+
attempt_count: number | null;
|
|
156
|
+
expected_candidate_count?: number | null;
|
|
157
|
+
actual_candidate_count?: number | null;
|
|
158
|
+
expected_row_count?: number | null;
|
|
159
|
+
actual_row_count?: number | null;
|
|
160
|
+
model_invocation_id?: string | null;
|
|
161
|
+
input_summary?: JsonRecord | null;
|
|
162
|
+
output_summary?: JsonRecord | null;
|
|
163
|
+
metadata?: TMetadata | null;
|
|
164
|
+
error_message: string | null;
|
|
165
|
+
queued_at?: string | null;
|
|
166
|
+
started_at?: string | null;
|
|
167
|
+
completed_at?: string | null;
|
|
168
|
+
created_at: string;
|
|
169
|
+
updated_at: string;
|
|
170
|
+
ai_model_invocation?: AiModelInvocationSummaryDto | null;
|
|
171
|
+
}
|
|
172
|
+
export interface DocumentTargetRefDto<TMetadata extends JsonRecord = JsonRecord> extends JsonRecord {
|
|
173
|
+
schema: string;
|
|
174
|
+
table: string;
|
|
175
|
+
id: string;
|
|
176
|
+
role?: string | null;
|
|
177
|
+
label?: string | null;
|
|
178
|
+
metadata?: TMetadata;
|
|
179
|
+
}
|
|
180
|
+
export interface DocumentFindingDto<TMetadata extends JsonRecord = JsonRecord> {
|
|
181
|
+
id: string;
|
|
182
|
+
organization_id: string | null;
|
|
183
|
+
domain_key: DocumentIntakeDomainKey;
|
|
184
|
+
feature_key: string | null;
|
|
185
|
+
source_label: string | null;
|
|
186
|
+
document_family: string | null;
|
|
187
|
+
layout_variant: string | null;
|
|
188
|
+
batch_id: string | null;
|
|
189
|
+
file_id: string | null;
|
|
190
|
+
processing_job_id: string | null;
|
|
191
|
+
processing_chunk_id: string | null;
|
|
192
|
+
candidate_record_id: string | null;
|
|
193
|
+
candidate_key: string | null;
|
|
194
|
+
candidate_index: number | null;
|
|
195
|
+
severity: DocumentFindingSeverity | string;
|
|
196
|
+
source: DocumentFindingSource | string;
|
|
197
|
+
scope: DocumentFindingScope | string;
|
|
198
|
+
finding_type: string;
|
|
199
|
+
message: string;
|
|
200
|
+
source_evidence: string | null;
|
|
201
|
+
recommendation: string | null;
|
|
202
|
+
allowed_actions: DocumentFindingAction[];
|
|
203
|
+
blocks_submit: boolean;
|
|
204
|
+
ai_verifiable: boolean;
|
|
205
|
+
evidence_refs?: JsonRecord[];
|
|
206
|
+
affected_record_refs?: JsonRecord[];
|
|
207
|
+
status: DocumentFindingStatus | string;
|
|
208
|
+
model_invocation_id: string | null;
|
|
209
|
+
context_prompt_id: string | null;
|
|
210
|
+
metadata?: TMetadata | null;
|
|
211
|
+
created_at: string;
|
|
212
|
+
updated_at: string;
|
|
213
|
+
resolved_at: string | null;
|
|
214
|
+
resolved_by_profile_id: string | null;
|
|
215
|
+
ai_model_invocation?: AiModelInvocationSummaryDto | null;
|
|
216
|
+
}
|
|
217
|
+
export interface DocumentFindingUpdateOptions<TMetadata extends JsonRecord = JsonRecord> {
|
|
218
|
+
action?: DocumentFindingAction;
|
|
219
|
+
metadata?: TMetadata;
|
|
220
|
+
}
|
|
221
|
+
export interface DocumentFindingActionEventDto<TMetadata extends JsonRecord = JsonRecord> {
|
|
222
|
+
id: string;
|
|
223
|
+
organization_id: string | null;
|
|
224
|
+
domain_key: DocumentIntakeDomainKey;
|
|
225
|
+
batch_id: string | null;
|
|
226
|
+
finding_id: string;
|
|
227
|
+
action: DocumentFindingAction | string;
|
|
228
|
+
action_status: DocumentFindingActionStatus | string;
|
|
229
|
+
previous_status: DocumentFindingStatus | string | null;
|
|
230
|
+
next_status: DocumentFindingStatus | string | null;
|
|
231
|
+
reviewer_profile_id: string | null;
|
|
232
|
+
model_invocation_id: string | null;
|
|
233
|
+
reconciliation_operation_id: string | null;
|
|
234
|
+
metadata?: TMetadata | null;
|
|
235
|
+
created_at: string;
|
|
236
|
+
ai_model_invocation?: AiModelInvocationSummaryDto | null;
|
|
237
|
+
}
|
|
238
|
+
export interface DocumentReconciliationOperationDto<TMetadata extends JsonRecord = JsonRecord> {
|
|
239
|
+
version: "document_reconciliation_operation_v1" | string;
|
|
240
|
+
operation_key: string;
|
|
241
|
+
operation_kind: DocumentReconciliationOperationKind | string;
|
|
242
|
+
decision: DocumentReconciliationDecision | string;
|
|
243
|
+
status: DocumentReconciliationOperationStatus | string;
|
|
244
|
+
group_key: string | null;
|
|
245
|
+
message: string;
|
|
246
|
+
input_record_refs: JsonRecord[];
|
|
247
|
+
output_record_refs: JsonRecord[];
|
|
248
|
+
evidence_refs: JsonRecord[];
|
|
249
|
+
metadata?: TMetadata | null;
|
|
250
|
+
batch_id?: string | null;
|
|
251
|
+
file_id?: string | null;
|
|
252
|
+
processing_job_id?: string | null;
|
|
253
|
+
source_record_type?: "file" | "job" | string;
|
|
254
|
+
source_record_id?: string | null;
|
|
255
|
+
linked_finding_ids?: string[];
|
|
256
|
+
}
|
|
257
|
+
export interface DocumentIntakeReviewPageDto {
|
|
258
|
+
offset: number;
|
|
259
|
+
limit: number | null;
|
|
260
|
+
count: number;
|
|
261
|
+
total: number | null;
|
|
262
|
+
fileId: string | null;
|
|
263
|
+
hasMore: boolean;
|
|
264
|
+
}
|
|
265
|
+
export interface AvailabilityReviewRowDto<TEvidenceRef extends JsonRecord = JsonRecord> {
|
|
266
|
+
id: string;
|
|
267
|
+
file_id?: string | null;
|
|
268
|
+
source_row_number: number | null;
|
|
269
|
+
source_record_key?: string | null;
|
|
270
|
+
artist_name: string | null;
|
|
271
|
+
agency_id: string | null;
|
|
272
|
+
agency_name: string | null;
|
|
273
|
+
availability_date: string | null;
|
|
274
|
+
availability_start_date: string | null;
|
|
275
|
+
availability_end_date: string | null;
|
|
276
|
+
status: string | null;
|
|
277
|
+
market_city: string | null;
|
|
278
|
+
market_state: string | null;
|
|
279
|
+
market_name: string | null;
|
|
280
|
+
venue_name: string | null;
|
|
281
|
+
venue_capacity: number | null;
|
|
282
|
+
quote_low: number | null;
|
|
283
|
+
quote_high: number | null;
|
|
284
|
+
currency: string | null;
|
|
285
|
+
confidence: number | null;
|
|
286
|
+
review_status: DocumentIntakeReviewStatus | string;
|
|
287
|
+
review_reason: string | null;
|
|
288
|
+
normalized_window_id?: string | null;
|
|
289
|
+
submitted_source_record_id?: string | null;
|
|
290
|
+
raw_source_excerpt?: string | null;
|
|
291
|
+
evidence_refs?: TEvidenceRef[];
|
|
292
|
+
}
|
|
293
|
+
export interface DocumentIntakeBatchDetailsDto<TRow = JsonRecord> {
|
|
294
|
+
batch: DocumentIntakeBatchDto;
|
|
295
|
+
files: DocumentIntakeReviewFileDto[];
|
|
296
|
+
jobs?: DocumentIntakeProcessingJobDto[];
|
|
297
|
+
chunks?: DocumentIntakeProcessingChunkDto[];
|
|
298
|
+
document_findings?: DocumentFindingDto[];
|
|
299
|
+
document_finding_action_events?: DocumentFindingActionEventDto[];
|
|
300
|
+
document_reconciliation_operations?: DocumentReconciliationOperationDto[];
|
|
301
|
+
model_invocations?: AiModelInvocationSummaryDto[];
|
|
302
|
+
rowPage?: DocumentIntakeReviewPageDto;
|
|
303
|
+
rows: TRow[];
|
|
304
|
+
}
|
|
305
|
+
export type AvailabilityBatchDetailsDto = DocumentIntakeBatchDetailsDto<AvailabilityReviewRowDto>;
|
|
306
|
+
export interface DocumentIntakeCreateBatchRequest<TMetadata extends JsonRecord = JsonRecord> {
|
|
307
|
+
domainKey: DocumentIntakeDomainKey;
|
|
308
|
+
organizationId?: string;
|
|
309
|
+
sourceLabel?: string | null;
|
|
310
|
+
defaultAgencyId?: string | null;
|
|
311
|
+
defaultAgency?: string | null;
|
|
312
|
+
defaultYear?: number | null;
|
|
313
|
+
parseTypeHint?: string | null;
|
|
314
|
+
documentFamilyHint?: AvailabilityDocumentFamily | string | null;
|
|
315
|
+
layoutHint?: string | null;
|
|
316
|
+
layoutVariantHint?: string | null;
|
|
317
|
+
processorKeyHint?: string | null;
|
|
318
|
+
processorVersionHint?: string | null;
|
|
319
|
+
timezone?: string | null;
|
|
320
|
+
metadata?: TMetadata | null;
|
|
321
|
+
}
|
|
322
|
+
export interface DocumentIntakeCreateBatchResponse {
|
|
323
|
+
batch: DocumentIntakeBatchDto;
|
|
324
|
+
}
|
|
325
|
+
export interface DocumentIntakeUploadedFileRegistration {
|
|
326
|
+
id: string;
|
|
327
|
+
storageBucket: AvailabilityStorageBucket | string;
|
|
328
|
+
storagePath: string;
|
|
329
|
+
originalFileName: string;
|
|
330
|
+
contentType: string | null;
|
|
331
|
+
fileSizeBytes: number;
|
|
332
|
+
checksumSha256?: string | null;
|
|
333
|
+
lastModified: number | null;
|
|
334
|
+
}
|
|
335
|
+
export interface DocumentIntakeRegisteredFileDto {
|
|
336
|
+
id: string;
|
|
337
|
+
batch_id: string;
|
|
338
|
+
organization_id: string;
|
|
339
|
+
original_file_name: string;
|
|
340
|
+
[key: string]: unknown;
|
|
341
|
+
}
|
|
342
|
+
export interface DocumentIntakeRegisterFilesRequest {
|
|
343
|
+
domainKey: DocumentIntakeDomainKey;
|
|
344
|
+
batchId: string;
|
|
345
|
+
files: DocumentIntakeUploadedFileRegistration[];
|
|
346
|
+
}
|
|
347
|
+
export interface DocumentIntakeRegisterFilesResponse {
|
|
348
|
+
files: DocumentIntakeRegisteredFileDto[];
|
|
349
|
+
processingTriggered: number;
|
|
350
|
+
processingFunction: DocumentIntakeEdgeFunctionName | string;
|
|
351
|
+
processingDomainKey: DocumentIntakeDomainKey;
|
|
352
|
+
processingResults: Array<{
|
|
353
|
+
fileId: string;
|
|
354
|
+
queued: boolean;
|
|
355
|
+
}>;
|
|
356
|
+
}
|
|
357
|
+
export interface DocumentIntakeGetBatchRequest {
|
|
358
|
+
domainKey: DocumentIntakeDomainKey;
|
|
359
|
+
batchId: string;
|
|
360
|
+
includeRows?: boolean;
|
|
361
|
+
rowOffset?: number;
|
|
362
|
+
rowLimit?: number | null;
|
|
363
|
+
rowFileId?: string | null;
|
|
364
|
+
}
|
|
365
|
+
export type DocumentIntakeGetBatchResponse<TRow = JsonRecord> = DocumentIntakeBatchDetailsDto<TRow>;
|
|
366
|
+
export interface DocumentIntakeListBatchesRequest {
|
|
367
|
+
domainKey: DocumentIntakeDomainKey;
|
|
368
|
+
limit?: number;
|
|
369
|
+
excludeSmoke?: boolean;
|
|
370
|
+
}
|
|
371
|
+
export interface DocumentIntakeListBatchesResponse {
|
|
372
|
+
batches: DocumentIntakeBatchSummaryDto[];
|
|
373
|
+
}
|
|
374
|
+
export interface DocumentIntakeUpdateRecordRequest<TValues extends JsonRecord = JsonRecord> {
|
|
375
|
+
domainKey: DocumentIntakeDomainKey;
|
|
376
|
+
rowId: string;
|
|
377
|
+
values?: TValues;
|
|
378
|
+
reviewStatus?: DocumentIntakeReviewStatus;
|
|
379
|
+
}
|
|
380
|
+
export interface DocumentIntakeUpdateRecordResponse<TRow extends JsonRecord = JsonRecord> {
|
|
381
|
+
row?: TRow;
|
|
382
|
+
record?: TRow;
|
|
383
|
+
error?: string;
|
|
384
|
+
}
|
|
385
|
+
export interface DocumentIntakeUpdateFindingRequest<TMetadata extends JsonRecord = JsonRecord> {
|
|
386
|
+
domainKey: DocumentIntakeDomainKey;
|
|
387
|
+
findingId: string;
|
|
388
|
+
status?: DocumentFindingStatusUpdate;
|
|
389
|
+
action?: DocumentFindingAction;
|
|
390
|
+
metadata?: TMetadata;
|
|
391
|
+
}
|
|
392
|
+
export interface DocumentIntakeUpdateFindingResponse {
|
|
393
|
+
finding: DocumentFindingDto;
|
|
394
|
+
finding_action_event: DocumentFindingActionEventDto;
|
|
395
|
+
}
|
|
396
|
+
export interface DocumentIntakeProcessFileRequest {
|
|
397
|
+
domainKey?: DocumentIntakeDomainKey;
|
|
398
|
+
fileId: string;
|
|
399
|
+
}
|
|
400
|
+
export interface DocumentIntakeProcessFileResponse {
|
|
401
|
+
fileId: string;
|
|
402
|
+
parsedRows: number;
|
|
403
|
+
processingJobId?: string;
|
|
404
|
+
queuedRows?: number;
|
|
405
|
+
totalChunks?: number;
|
|
406
|
+
expectedRowCount?: number;
|
|
407
|
+
pageCount?: number;
|
|
408
|
+
asyncWorkerFunction?: DocumentIntakeEdgeFunctionName | string;
|
|
409
|
+
documentProcessorFallbackUsed?: boolean;
|
|
410
|
+
counts?: JsonRecord;
|
|
411
|
+
error?: string;
|
|
412
|
+
[key: string]: unknown;
|
|
413
|
+
}
|
|
414
|
+
export interface DocumentIntakeProcessFileWorkerRequest {
|
|
415
|
+
domainKey?: DocumentIntakeDomainKey;
|
|
416
|
+
jobId: string;
|
|
417
|
+
}
|
|
418
|
+
export interface DocumentIntakeProcessFileWorkerResponse {
|
|
419
|
+
jobId: string;
|
|
420
|
+
status?: string;
|
|
421
|
+
skipped?: boolean;
|
|
422
|
+
completed?: boolean;
|
|
423
|
+
chunkId?: string;
|
|
424
|
+
chunkIndex?: number;
|
|
425
|
+
parsedRows?: number;
|
|
426
|
+
insertedRows?: number;
|
|
427
|
+
queuedRowChunks?: number;
|
|
428
|
+
hasMore?: boolean;
|
|
429
|
+
counts?: JsonRecord;
|
|
430
|
+
error?: string;
|
|
431
|
+
[key: string]: unknown;
|
|
432
|
+
}
|
|
433
|
+
export interface DocumentIntakeSubmitBatchRequest {
|
|
434
|
+
domainKey: DocumentIntakeDomainKey;
|
|
435
|
+
batchId: string;
|
|
436
|
+
normalize?: boolean;
|
|
437
|
+
}
|
|
438
|
+
export interface DocumentIntakeSubmitBatchResponse {
|
|
439
|
+
batchId: string;
|
|
440
|
+
submittedRows: number;
|
|
441
|
+
publishedRows: number;
|
|
442
|
+
normalizedWindowCount: number;
|
|
443
|
+
publishSourceSystem: "document_intake" | string;
|
|
444
|
+
sourceArtistCount: number;
|
|
445
|
+
sourceRecordCount: number;
|
|
446
|
+
normalized: boolean;
|
|
447
|
+
normalizationRequested: boolean;
|
|
448
|
+
normalizationError: string | null;
|
|
449
|
+
pipelineResults: unknown[];
|
|
450
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const DOCUMENT_INTAKE_EDGE_FUNCTIONS = {
|
|
2
|
+
createBatch: "document-intake-create-batch",
|
|
3
|
+
registerFiles: "document-intake-register-files",
|
|
4
|
+
processFile: "document-intake-process-file",
|
|
5
|
+
processFileWorker: "document-intake-process-file-worker",
|
|
6
|
+
processingReaper: "document-intake-processing-reaper",
|
|
7
|
+
getBatch: "document-intake-get-batch",
|
|
8
|
+
listBatches: "document-intake-list-batches",
|
|
9
|
+
updateRecord: "document-intake-update-record",
|
|
10
|
+
updateFinding: "document-intake-update-finding",
|
|
11
|
+
submitBatch: "document-intake-submit-batch",
|
|
12
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rjromeoent/ein-supabase",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared Supabase types, app context, and contract helpers for EIN-connected apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"types": "./dist/db-enums.d.ts",
|
|
25
25
|
"import": "./dist/db-enums.js"
|
|
26
26
|
},
|
|
27
|
+
"./document-intake": {
|
|
28
|
+
"types": "./dist/document-intake.d.ts",
|
|
29
|
+
"import": "./dist/document-intake.js"
|
|
30
|
+
},
|
|
27
31
|
"./generated/database.types": {
|
|
28
32
|
"types": "./dist/generated/database.types.d.ts",
|
|
29
33
|
"import": "./dist/generated/database.types.js"
|