@jsb188/mday 1.1.2
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/package.json +142 -0
- package/src/constants/agentMemory.ts +166 -0
- package/src/constants/agentNote.ts +212 -0
- package/src/constants/aiChat.ts +10 -0
- package/src/constants/billing.ts +126 -0
- package/src/constants/campaign.ts +236 -0
- package/src/constants/contact.ts +72 -0
- package/src/constants/csvExport.ts +133 -0
- package/src/constants/dataTable.ts +22 -0
- package/src/constants/dataTableFieldTypes.generated.ts +59 -0
- package/src/constants/docAccess.ts +33 -0
- package/src/constants/dt.ts +234 -0
- package/src/constants/email.ts +146 -0
- package/src/constants/fieldDoc.ts +104 -0
- package/src/constants/graphqlReactivity.ts +196 -0
- package/src/constants/inboundContact.ts +8 -0
- package/src/constants/integration.ts +13 -0
- package/src/constants/log.ts +21 -0
- package/src/constants/logDisplay/README.md +88 -0
- package/src/constants/logDisplay/defaults.ts +39 -0
- package/src/constants/logDisplay/index.ts +27 -0
- package/src/constants/logDisplay/operations/arable.ts +16 -0
- package/src/constants/logDisplay/operations/farmersMarket.ts +10 -0
- package/src/constants/logDisplay/operations/foodManufacturing.ts +13 -0
- package/src/constants/logDisplay/shared/accounting.ts +13 -0
- package/src/constants/logDisplay/shared/interactions.ts +13 -0
- package/src/constants/logDisplay/shared/rackTemperatures.ts +42 -0
- package/src/constants/logTaxonomy.generated.ts +2199 -0
- package/src/constants/noteDoc.ts +77 -0
- package/src/constants/organization.ts +60 -0
- package/src/constants/pageRoute.ts +23 -0
- package/src/constants/qrCode.ts +30 -0
- package/src/constants/sheet.ts +132 -0
- package/src/constants/sms.ts +18 -0
- package/src/constants/square.ts +16 -0
- package/src/constants/storage.ts +85 -0
- package/src/constants/usage.ts +82 -0
- package/src/constants/workflowSteps.ts +60 -0
- package/src/schemas/editLogEntry.ts +879 -0
- package/src/schemas/inboundContact.ts +77 -0
- package/src/schemas/logsQuery.ts +93 -0
- package/src/types/account.d.ts +81 -0
- package/src/types/agentMemory.d.ts +100 -0
- package/src/types/agentNote.d.ts +441 -0
- package/src/types/billing.d.ts +537 -0
- package/src/types/campaign.d.ts +1533 -0
- package/src/types/contact.d.ts +15 -0
- package/src/types/csvExport.d.ts +213 -0
- package/src/types/dataAnalysis.d.ts +44 -0
- package/src/types/dataTable.d.ts +159 -0
- package/src/types/definitionElement.d.ts +35 -0
- package/src/types/docAccess.d.ts +96 -0
- package/src/types/dt.d.ts +257 -0
- package/src/types/email.d.ts +231 -0
- package/src/types/emailReplyReport.d.ts +76 -0
- package/src/types/fieldDoc.d.ts +702 -0
- package/src/types/fieldDocContract.d.ts +90 -0
- package/src/types/inboundContact.d.ts +65 -0
- package/src/types/integration.d.ts +42 -0
- package/src/types/log.d.ts +338 -0
- package/src/types/logDisplay.types.ts +85 -0
- package/src/types/organization.d.ts +350 -0
- package/src/types/pageRoute.d.ts +48 -0
- package/src/types/qrCode.d.ts +96 -0
- package/src/types/richText.d.ts +81 -0
- package/src/types/sheet.d.ts +847 -0
- package/src/types/sms.d.ts +38 -0
- package/src/types/storage.d.ts +481 -0
- package/src/types/usage.d.ts +106 -0
- package/src/types/workflow.d.ts +435 -0
- package/src/utils/agentMemory.ts +15 -0
- package/src/utils/agentNote.ts +850 -0
- package/src/utils/aiChat.ts +43 -0
- package/src/utils/aiChatWork.ts +64 -0
- package/src/utils/billing.ts +37 -0
- package/src/utils/campaign.ts +1173 -0
- package/src/utils/campaignAI.ts +72 -0
- package/src/utils/campaignAccess.ts +239 -0
- package/src/utils/campaignEmail.ts +601 -0
- package/src/utils/campaignEmailCompiler.ts +372 -0
- package/src/utils/campaignEmailImages.ts +60 -0
- package/src/utils/campaignEmailStyles.ts +544 -0
- package/src/utils/campaignLifecycle.ts +104 -0
- package/src/utils/campaignPreview.ts +285 -0
- package/src/utils/contact.ts +50 -0
- package/src/utils/csvExport.ts +19 -0
- package/src/utils/dataTable.ts +311 -0
- package/src/utils/dataTableFieldTypeRegistry.ts +106 -0
- package/src/utils/dataTableRelativeDate.ts +447 -0
- package/src/utils/definitionElement.ts +84 -0
- package/src/utils/docAccess.ts +383 -0
- package/src/utils/documentName.ts +53 -0
- package/src/utils/email.ts +379 -0
- package/src/utils/emailReplyReport.test.ts +187 -0
- package/src/utils/emailReplyReport.ts +143 -0
- package/src/utils/fieldDoc.ts +157 -0
- package/src/utils/fieldDocAnswers.ts +128 -0
- package/src/utils/fieldDocDefaults.ts +36 -0
- package/src/utils/fieldDocProgram.ts +36 -0
- package/src/utils/fieldDocSummary.ts +30 -0
- package/src/utils/log.ts +357 -0
- package/src/utils/logDisplay.helpers.ts +177 -0
- package/src/utils/logDisplay.ts +87 -0
- package/src/utils/logRegistryValue.ts +90 -0
- package/src/utils/logStoreRead.ts +262 -0
- package/src/utils/logTaxonomy.helpers.ts +17 -0
- package/src/utils/logTaxonomy.ts +76 -0
- package/src/utils/logTaxonomyDisplay.ts +395 -0
- package/src/utils/noteDoc.ts +609 -0
- package/src/utils/organization.ts +669 -0
- package/src/utils/pageRoute.ts +71 -0
- package/src/utils/qrCode.helpers.ts +189 -0
- package/src/utils/qrCode.test.ts +519 -0
- package/src/utils/qrCode.ts +273 -0
- package/src/utils/richTextHTML.ts +385 -0
- package/src/utils/sheet.ts +262 -0
- package/src/utils/sheetAxisMove.ts +616 -0
- package/src/utils/sheetBootstrap.ts +1402 -0
- package/src/utils/sheetCellLiteral.ts +101 -0
- package/src/utils/sheetCommand.ts +358 -0
- package/src/utils/sheetDesign.ts +705 -0
- package/src/utils/sheetExport.ts +186 -0
- package/src/utils/sheetFeatureReference.ts +183 -0
- package/src/utils/sheetFormulaArgs.ts +168 -0
- package/src/utils/sheetFormulaCompile.ts +475 -0
- package/src/utils/sheetFormulaConditionalAggregate.ts +254 -0
- package/src/utils/sheetFormulaCriteria.ts +656 -0
- package/src/utils/sheetFormulaDate.ts +444 -0
- package/src/utils/sheetFormulaEvaluation.ts +899 -0
- package/src/utils/sheetFormulaEvaluator.ts +997 -0
- package/src/utils/sheetFormulaFunctionHandlers.ts +403 -0
- package/src/utils/sheetFormulaLogical.ts +116 -0
- package/src/utils/sheetFormulaLookup.ts +488 -0
- package/src/utils/sheetFormulaMath.ts +48 -0
- package/src/utils/sheetFormulaParser.ts +729 -0
- package/src/utils/sheetFormulaRange.ts +330 -0
- package/src/utils/sheetFormulaReference.ts +703 -0
- package/src/utils/sheetFormulaReferenceAggregates.ts +313 -0
- package/src/utils/sheetFormulaReferenceDates.ts +237 -0
- package/src/utils/sheetFormulaReferenceLogical.ts +330 -0
- package/src/utils/sheetFormulaReferenceLookup.ts +341 -0
- package/src/utils/sheetFormulaReferenceMath.ts +95 -0
- package/src/utils/sheetFormulaReferenceRewrite.ts +220 -0
- package/src/utils/sheetFormulaReferenceText.ts +462 -0
- package/src/utils/sheetFormulaSyntax.ts +1027 -0
- package/src/utils/sheetFormulaText.ts +430 -0
- package/src/utils/sheetJournal.ts +200 -0
- package/src/utils/sheetNumberFormat.ts +1012 -0
- package/src/utils/sheetPreview.ts +68 -0
- package/src/utils/sheetSequence.ts +118 -0
- package/src/utils/sheetSnapshot.ts +739 -0
- package/src/utils/sheetStructureEdit.ts +914 -0
- package/src/utils/sheetStructureReferences.ts +389 -0
- package/src/utils/square.ts +32 -0
- package/src/utils/storage.ts +198 -0
- package/src/utils/table-route.ts +262 -0
- package/src/utils/time.ts +12 -0
- package/src/utils/workflow.ts +506 -0
- package/src/utils/workflowLogFingerprint.ts +302 -0
- package/src/utils/workflowLogRevisionSnapshot.ts +424 -0
- package/src/utils/workflowProgress.ts +280 -0
- package/src/utils/workflowTriggers.ts +61 -0
- package/tests/agentNote.test.ts +395 -0
- package/tests/campaignAI.test.ts +119 -0
- package/tests/campaignAccess.test.ts +239 -0
- package/tests/campaignEmail.test.ts +441 -0
- package/tests/campaignLifecycle.test.ts +134 -0
- package/tests/campaignPublication.test.ts +309 -0
- package/tests/dataTableFieldTypeRegistry.test.ts +111 -0
- package/tests/dataTableRelativeDate.test.ts +412 -0
- package/tests/docAccess.test.ts +525 -0
- package/tests/editLogEntry.test.ts +112 -0
- package/tests/email.test.ts +39 -0
- package/tests/fieldDocProgram.test.ts +114 -0
- package/tests/logDisplay.fixtures.ts +67 -0
- package/tests/logDisplay.test.ts +227 -0
- package/tests/noteDoc.test.ts +514 -0
- package/tests/richTextHTML.test.ts +185 -0
- package/tests/sheetAxisMove.test.ts +352 -0
- package/tests/sheetBootstrap.test.ts +1967 -0
- package/tests/sheetFeatureReference.test.ts +22 -0
- package/tests/sheetFormulaCriteria.test.ts +269 -0
- package/tests/sheetFormulaEvaluator.test.ts +468 -0
- package/tests/sheetFormulaFunctions.test.ts +538 -0
- package/tests/sheetFormulaLanguage.test.ts +361 -0
- package/tests/sheetFormulaParity.fixtures.ts +872 -0
- package/tests/sheetFormulaParity.test.ts +188 -0
- package/tests/sheetFormulaRange.test.ts +167 -0
- package/tests/sheetFormulaReference.test.ts +78 -0
- package/tests/sheetFormulaReferenceRewrite.test.ts +117 -0
- package/tests/sheetFormulaTextDate.test.ts +512 -0
- package/tests/sheetSequence.test.ts +22 -0
- package/tests/sheetSnapshot.test.ts +134 -0
- package/tests/sheetStructureEdit.test.ts +537 -0
- package/tests/sheetStructureReferences.test.ts +589 -0
- package/tests/workflowLifecycleStatus.test.ts +60 -0
- package/tests/workflowLogFingerprint.test.ts +203 -0
- package/tests/workflowLogRevisionSnapshot.test.ts +96 -0
- package/tests/workflowProgress.test.ts +180 -0
- package/tests/workflowTriggers.test.ts +29 -0
- package/tsconfig.json +12 -0
- package/vitest.config.ts +8 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CONTACT_INDUSTRIES } from '../constants/contact.ts';
|
|
2
|
+
|
|
3
|
+
export type ContactIndustryEnum = (typeof CONTACT_INDUSTRIES)[number];
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Normalized values of one public contact form submission.
|
|
7
|
+
*/
|
|
8
|
+
export interface ContactRequestValues {
|
|
9
|
+
email: string;
|
|
10
|
+
firstName: string;
|
|
11
|
+
lastName: string;
|
|
12
|
+
jobTitle: string;
|
|
13
|
+
companyName: string;
|
|
14
|
+
industry: ContactIndustryEnum;
|
|
15
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CSV_EXPORT_ARTIFACT_COMPRESSION_ENUMS,
|
|
3
|
+
CSV_EXPORT_ARTIFACT_KIND_ENUMS,
|
|
4
|
+
CSV_EXPORT_BATCH_FILE_STATUS_ENUMS,
|
|
5
|
+
CSV_EXPORT_BATCH_STATUS_ENUMS,
|
|
6
|
+
CSV_EXPORT_DATA_COMPLETENESS_ENUMS,
|
|
7
|
+
CSV_EXPORT_DELIVERY_CHANNEL_ENUMS,
|
|
8
|
+
CSV_EXPORT_DELIVERY_MODE_ENUMS,
|
|
9
|
+
CSV_EXPORT_DELIVERY_STATUS_ENUMS,
|
|
10
|
+
CSV_EXPORT_DELIVERY_SUMMARY_STATUS_ENUMS,
|
|
11
|
+
CSV_EXPORT_EXECUTION_MODE_ENUMS,
|
|
12
|
+
CSV_EXPORT_GENERATION_STAGE_ENUMS,
|
|
13
|
+
CSV_EXPORT_PROGRESS_EVENT_STATUS_ENUMS,
|
|
14
|
+
CSV_EXPORT_REQUESTED_DELIVERY_CHANNEL_ENUMS,
|
|
15
|
+
CSV_EXPORT_STEP_KIND_ENUMS,
|
|
16
|
+
CSV_EXPORT_STEP_STATUS_ENUMS,
|
|
17
|
+
} from '../constants/csvExport.ts';
|
|
18
|
+
import type { SMSProviderEnum } from './sms.d.ts';
|
|
19
|
+
|
|
20
|
+
export type CSVExportBatchStatus = (typeof CSV_EXPORT_BATCH_STATUS_ENUMS)[number];
|
|
21
|
+
export type CSVExportGenerationStage = (typeof CSV_EXPORT_GENERATION_STAGE_ENUMS)[number];
|
|
22
|
+
export type CSVExportExecutionMode = (typeof CSV_EXPORT_EXECUTION_MODE_ENUMS)[number];
|
|
23
|
+
export type CSVExportDeliveryMode = (typeof CSV_EXPORT_DELIVERY_MODE_ENUMS)[number];
|
|
24
|
+
export type CSVExportBatchFileStatus = (typeof CSV_EXPORT_BATCH_FILE_STATUS_ENUMS)[number];
|
|
25
|
+
export type CSVExportStepKind = (typeof CSV_EXPORT_STEP_KIND_ENUMS)[number];
|
|
26
|
+
export type CSVExportStepStatus = (typeof CSV_EXPORT_STEP_STATUS_ENUMS)[number];
|
|
27
|
+
export type CSVExportDataCompleteness = (typeof CSV_EXPORT_DATA_COMPLETENESS_ENUMS)[number];
|
|
28
|
+
export type CSVExportArtifactKind = (typeof CSV_EXPORT_ARTIFACT_KIND_ENUMS)[number];
|
|
29
|
+
export type CSVExportArtifactCompression = (typeof CSV_EXPORT_ARTIFACT_COMPRESSION_ENUMS)[number];
|
|
30
|
+
export type CSVExportDeliveryChannel = (typeof CSV_EXPORT_DELIVERY_CHANNEL_ENUMS)[number];
|
|
31
|
+
export type CSVExportRequestedDeliveryChannel = (typeof CSV_EXPORT_REQUESTED_DELIVERY_CHANNEL_ENUMS)[number];
|
|
32
|
+
export type CSVExportDeliveryStatus = (typeof CSV_EXPORT_DELIVERY_STATUS_ENUMS)[number];
|
|
33
|
+
export type CSVExportDeliverySummaryStatus = (typeof CSV_EXPORT_DELIVERY_SUMMARY_STATUS_ENUMS)[number];
|
|
34
|
+
export type CSVExportProgressEventStatus = (typeof CSV_EXPORT_PROGRESS_EVENT_STATUS_ENUMS)[number];
|
|
35
|
+
|
|
36
|
+
export interface CSVExportPlanAttemptData {
|
|
37
|
+
callIndex?: number; // Durable batch-wide reservation; absent on legacy attempts
|
|
38
|
+
status?: 'STARTED' | 'COMPLETED' | 'FAILED';
|
|
39
|
+
fingerprint?: string; // Candidate behavior identity for repeated deterministic repair detection
|
|
40
|
+
revision: number;
|
|
41
|
+
attempt: number;
|
|
42
|
+
kind:
|
|
43
|
+
| 'DEFINE_REQUIREMENTS'
|
|
44
|
+
| 'REVIEW_REQUIREMENTS'
|
|
45
|
+
| 'PREPARE_SOURCE'
|
|
46
|
+
| 'COMPOSE_ANSWER'
|
|
47
|
+
| 'PLAN'
|
|
48
|
+
| 'REPAIR'
|
|
49
|
+
| 'VERIFY_REPAIR'
|
|
50
|
+
| 'EXTRACT_TEXT'
|
|
51
|
+
| 'REVIEW_TEXT'
|
|
52
|
+
| 'REVIEW_PLAN';
|
|
53
|
+
model: string | null;
|
|
54
|
+
requestedModel?: string | null; // Stable routing identity even when the provider returns a version alias
|
|
55
|
+
responseId: string | null;
|
|
56
|
+
usage: { input: number; output: number } | null;
|
|
57
|
+
durationMs: number;
|
|
58
|
+
candidate: string | null; // raw model output, truncated to 64 KB
|
|
59
|
+
errors: string[];
|
|
60
|
+
createdAt: string; // ISO Date string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface CSVExportBatchData {
|
|
64
|
+
__table?: 'csv_export_batches';
|
|
65
|
+
id: number | bigint;
|
|
66
|
+
batchKey: string;
|
|
67
|
+
organizationId: number | bigint;
|
|
68
|
+
accountId: number | bigint | null;
|
|
69
|
+
aiChatId: number | bigint | null;
|
|
70
|
+
requestSource: 'SMS' | 'WEB';
|
|
71
|
+
smsProvider: SMSProviderEnum | null;
|
|
72
|
+
requestSchemaVersion: number;
|
|
73
|
+
request: Record<string, unknown>;
|
|
74
|
+
validatedPlan: Record<string, unknown> | null;
|
|
75
|
+
planVersion: number | null;
|
|
76
|
+
planHash: string | null;
|
|
77
|
+
originRequestKey: string | null; // idempotency key of the originating chat tool call
|
|
78
|
+
planRevision: number; // 0 = not planned; each verify-driven re-plan bumps it
|
|
79
|
+
planAttempts: CSVExportPlanAttemptData[]; // Every call within the bounded durable planner budget
|
|
80
|
+
plannerCallCount?: number;
|
|
81
|
+
plannerInputTokens?: number | bigint; // Known reported usage; failed requests can have unknown usage
|
|
82
|
+
plannerOutputTokens?: number | bigint;
|
|
83
|
+
plannerDeadlineAt?: Date | null; // Fixed on the first reserved call, never extended by retries
|
|
84
|
+
executionMode: CSVExportExecutionMode;
|
|
85
|
+
deliveryMode: CSVExportDeliveryMode;
|
|
86
|
+
status: CSVExportBatchStatus;
|
|
87
|
+
stage: CSVExportGenerationStage;
|
|
88
|
+
stageVersion: number | bigint;
|
|
89
|
+
snapshotAt: Date | null;
|
|
90
|
+
currentStepKey: string | null;
|
|
91
|
+
errorCode: string | null;
|
|
92
|
+
errorMessage: string | null;
|
|
93
|
+
startedAt: Date | null;
|
|
94
|
+
terminalAt: Date | null;
|
|
95
|
+
createdAt: Date;
|
|
96
|
+
updatedAt: Date;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface CSVExportBatchFileData {
|
|
100
|
+
__table?: 'csv_export_batch_files';
|
|
101
|
+
id: number | bigint;
|
|
102
|
+
batchId: number | bigint;
|
|
103
|
+
storageGeneratedCode: string | null;
|
|
104
|
+
outputKind?: 'CSV' | 'ANSWER';
|
|
105
|
+
result?: import('./dataAnalysis.d.ts').DataAnalysisResultReference | null;
|
|
106
|
+
fileKey: string;
|
|
107
|
+
requestOrder: number;
|
|
108
|
+
spec: Record<string, unknown>;
|
|
109
|
+
status: CSVExportBatchFileStatus;
|
|
110
|
+
currentStepKey: string | null;
|
|
111
|
+
rowCount: number | bigint | null;
|
|
112
|
+
columnCount: number | null;
|
|
113
|
+
byteCount: number | bigint | null;
|
|
114
|
+
completeness: CSVExportDataCompleteness;
|
|
115
|
+
errorCode: string | null;
|
|
116
|
+
errorMessage: string | null;
|
|
117
|
+
completedAt: Date | null;
|
|
118
|
+
createdAt: Date;
|
|
119
|
+
updatedAt: Date;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface CSVExportStepData {
|
|
123
|
+
__table?: 'csv_export_steps';
|
|
124
|
+
id: number | bigint;
|
|
125
|
+
batchId: number | bigint;
|
|
126
|
+
batchFileId: number | bigint | null;
|
|
127
|
+
stepKey: string;
|
|
128
|
+
ordinal: number;
|
|
129
|
+
kind: CSVExportStepKind;
|
|
130
|
+
planRevision: number; // 0 for server-owned read steps, r >= 1 for plan revision r
|
|
131
|
+
dependencies: string[];
|
|
132
|
+
definition: Record<string, unknown>;
|
|
133
|
+
inputHash: string | null;
|
|
134
|
+
outputHash: string | null;
|
|
135
|
+
status: CSVExportStepStatus;
|
|
136
|
+
attempts: number;
|
|
137
|
+
rowCount: number | bigint | null;
|
|
138
|
+
columnCount: number | null;
|
|
139
|
+
byteCount: number | bigint | null;
|
|
140
|
+
completeness: CSVExportDataCompleteness;
|
|
141
|
+
errorCode: string | null;
|
|
142
|
+
errorMessage: string | null;
|
|
143
|
+
startedAt: Date | null;
|
|
144
|
+
completedAt: Date | null;
|
|
145
|
+
createdAt: Date;
|
|
146
|
+
updatedAt: Date;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface CSVExportStepArtifactData {
|
|
150
|
+
__table?: 'csv_export_step_artifacts';
|
|
151
|
+
id: number | bigint;
|
|
152
|
+
batchId: number | bigint;
|
|
153
|
+
stepId: number | bigint;
|
|
154
|
+
batchFileId: number | bigint | null;
|
|
155
|
+
kind: CSVExportArtifactKind;
|
|
156
|
+
objectUri: string;
|
|
157
|
+
objectGeneration: string;
|
|
158
|
+
contentHash: string;
|
|
159
|
+
contentType: string;
|
|
160
|
+
compression: CSVExportArtifactCompression;
|
|
161
|
+
sizeBytes: number | bigint;
|
|
162
|
+
rowCount: number | bigint | null;
|
|
163
|
+
columnCount: number | null;
|
|
164
|
+
metadata: Record<string, unknown>;
|
|
165
|
+
expiresAt: Date | null;
|
|
166
|
+
createdAt: Date;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface CSVExportDeliveryData {
|
|
170
|
+
__table?: 'csv_export_deliveries';
|
|
171
|
+
id: number | bigint;
|
|
172
|
+
batchId: number | bigint;
|
|
173
|
+
channel: CSVExportDeliveryChannel;
|
|
174
|
+
recipientKey: string;
|
|
175
|
+
recipientAccountId: number | bigint | null;
|
|
176
|
+
recipientSnapshot: Record<string, unknown>;
|
|
177
|
+
smsProvider: SMSProviderEnum | null;
|
|
178
|
+
status: CSVExportDeliveryStatus;
|
|
179
|
+
attempts: number;
|
|
180
|
+
maxAttempts: number;
|
|
181
|
+
availableAt: Date;
|
|
182
|
+
lockedAt: Date | null;
|
|
183
|
+
lockedBy: string | null;
|
|
184
|
+
idempotencyKey: string;
|
|
185
|
+
providerMessageId: string | null;
|
|
186
|
+
lastError: string | null;
|
|
187
|
+
sentAt: Date | null;
|
|
188
|
+
deliveredAt: Date | null;
|
|
189
|
+
failedAt: Date | null;
|
|
190
|
+
createdAt: Date;
|
|
191
|
+
updatedAt: Date;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface CSVExportProgressEventData {
|
|
195
|
+
__table?: 'csv_export_progress_events';
|
|
196
|
+
id: number | bigint;
|
|
197
|
+
batchId: number | bigint;
|
|
198
|
+
organizationId: number | bigint;
|
|
199
|
+
eventVersion: number | bigint;
|
|
200
|
+
stage: CSVExportGenerationStage;
|
|
201
|
+
batchStatus: CSVExportBatchStatus;
|
|
202
|
+
payload: Record<string, unknown>;
|
|
203
|
+
dedupKey: string;
|
|
204
|
+
status: CSVExportProgressEventStatus;
|
|
205
|
+
attempts: number;
|
|
206
|
+
maxAttempts: number;
|
|
207
|
+
availableAt: Date;
|
|
208
|
+
lockedAt: Date | null;
|
|
209
|
+
lockedBy: string | null;
|
|
210
|
+
processedAt: Date | null;
|
|
211
|
+
lastError: string | null;
|
|
212
|
+
createdAt: Date;
|
|
213
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CSVExportDeliveryChoice, CSVExportFileSpecV2, CSVExportSourceSpec } from './storage.d.ts';
|
|
2
|
+
|
|
3
|
+
export interface DataAnalysisRequest {
|
|
4
|
+
schemaVersion: 3;
|
|
5
|
+
task: string;
|
|
6
|
+
sources: CSVExportSourceSpec[];
|
|
7
|
+
outputs: Array<
|
|
8
|
+
| { id: string; kind: 'ANSWER'; title: string; instructions: string; sourceIds: string[] }
|
|
9
|
+
| { id: string; kind: 'CSV'; sourceIds: string[]; file: Omit<CSVExportFileSpecV2, 'sources'> }
|
|
10
|
+
>;
|
|
11
|
+
delivery?: CSVExportDeliveryChoice;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface DataAnalysisResult {
|
|
15
|
+
version: 1;
|
|
16
|
+
title: string;
|
|
17
|
+
summary?: string;
|
|
18
|
+
sections: Array<{
|
|
19
|
+
title: string;
|
|
20
|
+
role: 'DETAIL' | 'SUMMARY';
|
|
21
|
+
columns: string[];
|
|
22
|
+
rows: string[][];
|
|
23
|
+
}>;
|
|
24
|
+
completeness: 'COMPLETE' | 'INTENTIONALLY_LIMITED';
|
|
25
|
+
sourceRowCount: number;
|
|
26
|
+
sourceAuthorizations: NonNullable<import('./storage.d.ts').CSVExportGeneratedPayload['sourceAuthorizations']>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface DataAnalysisResultReference {
|
|
30
|
+
version: 2;
|
|
31
|
+
artifactId: string;
|
|
32
|
+
contentHash: string;
|
|
33
|
+
expiresAt: string;
|
|
34
|
+
title: string;
|
|
35
|
+
summary?: string;
|
|
36
|
+
sections: Array<{ title: string; role: 'DETAIL' | 'SUMMARY'; columns: string[]; rowCount: number }>;
|
|
37
|
+
completeness: DataAnalysisResult['completeness'];
|
|
38
|
+
sourceRowCount: number;
|
|
39
|
+
sourceAuthorizations: DataAnalysisResult['sourceAuthorizations'];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type LoadedDataAnalysisFile = Omit<import('./csvExport.d.ts').CSVExportBatchFileData, 'result'> & {
|
|
43
|
+
result?: DataAnalysisResult | null;
|
|
44
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DtCellScalar,
|
|
3
|
+
DtColumnOriginEnum,
|
|
4
|
+
DtCoverageWarningCodeEnum,
|
|
5
|
+
DtRunCauseEnum,
|
|
6
|
+
DtSourceEnum,
|
|
7
|
+
DtSyncStateEnum,
|
|
8
|
+
DtTableKindEnum,
|
|
9
|
+
} from './dt.d.ts';
|
|
10
|
+
import type {
|
|
11
|
+
DATA_TABLE_FIELD_TYPE_ENUMS,
|
|
12
|
+
DATA_TABLE_RELATIVE_DATE_BOUNDARY_ENUMS,
|
|
13
|
+
DATA_TABLE_RELATIVE_DATE_OPERATOR_ENUMS,
|
|
14
|
+
DATA_TABLE_RELATIVE_DATE_UNIT_ENUMS,
|
|
15
|
+
} from '../constants/dataTable.ts';
|
|
16
|
+
|
|
17
|
+
export type DataTableFieldTypeEnum = (typeof DATA_TABLE_FIELD_TYPE_ENUMS)[number];
|
|
18
|
+
|
|
19
|
+
export type DataTableRelativeDateUnitEnum = (typeof DATA_TABLE_RELATIVE_DATE_UNIT_ENUMS)[number];
|
|
20
|
+
|
|
21
|
+
export type DataTableRelativeDateBoundaryEnum = (typeof DATA_TABLE_RELATIVE_DATE_BOUNDARY_ENUMS)[number];
|
|
22
|
+
|
|
23
|
+
export type DataTableRelativeDateOperatorEnum = (typeof DATA_TABLE_RELATIVE_DATE_OPERATOR_ENUMS)[number];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A relative date: the START or END of the unit period that contains the
|
|
27
|
+
* organization-local today, shifted by offset units (ISO weeks start Monday).
|
|
28
|
+
*/
|
|
29
|
+
export interface DataTableRelativeDateObj {
|
|
30
|
+
unit: DataTableRelativeDateUnitEnum;
|
|
31
|
+
offset: number;
|
|
32
|
+
boundary: DataTableRelativeDateBoundaryEnum;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The organization time zone and its local date that one query resolves
|
|
37
|
+
* every relative date against.
|
|
38
|
+
*/
|
|
39
|
+
export interface DataTableRelativeDateContextObj {
|
|
40
|
+
timeZone: string;
|
|
41
|
+
today: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* One resolved relative date: the boundary day (YYYY-MM-DD) for date columns
|
|
46
|
+
* and the boundary instant (ISO with the zone offset) for datetime columns.
|
|
47
|
+
*/
|
|
48
|
+
export interface DataTableRelativeDateResolvedObj {
|
|
49
|
+
date: string;
|
|
50
|
+
instant: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type DataTableRecordValue = string | number | boolean | null | Record<string, any> | any[];
|
|
54
|
+
|
|
55
|
+
export interface DataTableDesignCellOptionObj {
|
|
56
|
+
label: string;
|
|
57
|
+
value: string;
|
|
58
|
+
color?: string | null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* One typed column a value is coerced into (dataset conversion and select-option matching). */
|
|
62
|
+
export interface DataTableDesignCellObj {
|
|
63
|
+
key: string;
|
|
64
|
+
label: string;
|
|
65
|
+
fieldType: DataTableFieldTypeEnum;
|
|
66
|
+
options?: DataTableDesignCellOptionObj[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* One column of a read-only data table, as the shared dataTableFragment selects it. */
|
|
70
|
+
export interface DataTableColumnGQL {
|
|
71
|
+
key: string;
|
|
72
|
+
label: string;
|
|
73
|
+
type: string;
|
|
74
|
+
origin: DtColumnOriginEnum;
|
|
75
|
+
unit?: string | null;
|
|
76
|
+
currency?: string | null;
|
|
77
|
+
retired: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* One projection gap of a SOURCE table: source data the table cannot show. */
|
|
81
|
+
export interface DataTableCoverageWarningGQL {
|
|
82
|
+
code: DtCoverageWarningCodeEnum;
|
|
83
|
+
columnKey: string;
|
|
84
|
+
message: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* The AI note that owns a table. */
|
|
88
|
+
export interface DataTableOwnerNoteGQL {
|
|
89
|
+
id: string;
|
|
90
|
+
headline: string | null;
|
|
91
|
+
emoji: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* One read-only data table (GraphQL DataTable; dataTableFragment). */
|
|
95
|
+
export interface DataTableGQL {
|
|
96
|
+
__deleted?: boolean;
|
|
97
|
+
|
|
98
|
+
id: string;
|
|
99
|
+
cursor?: string | null;
|
|
100
|
+
organizationId: string;
|
|
101
|
+
|
|
102
|
+
kind: DtTableKindEnum;
|
|
103
|
+
source?: DtSourceEnum | null;
|
|
104
|
+
title: string;
|
|
105
|
+
description?: string | null;
|
|
106
|
+
rowCount: number;
|
|
107
|
+
/* Table revision serialized as BigInt text. */
|
|
108
|
+
revision: string;
|
|
109
|
+
syncState: DtSyncStateEnum;
|
|
110
|
+
syncError?: string | null;
|
|
111
|
+
/* Last committed batch of any kind (sync, AI column, agent write): "data as of". */
|
|
112
|
+
syncedAt?: string | null;
|
|
113
|
+
derivePausedAt?: string | null;
|
|
114
|
+
derivePauseReason?: string | null;
|
|
115
|
+
canManage: boolean;
|
|
116
|
+
archivedAt?: string | null;
|
|
117
|
+
|
|
118
|
+
columns: DataTableColumnGQL[];
|
|
119
|
+
coverageWarnings: DataTableCoverageWarningGQL[];
|
|
120
|
+
ownerNote?: DataTableOwnerNoteGQL | null;
|
|
121
|
+
|
|
122
|
+
createdAt: string;
|
|
123
|
+
updatedAt: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* One live row (GraphQL DataTableRow; dataTableRowFragment). "cells" maps column keys to values. */
|
|
127
|
+
export interface DataTableRowGQL {
|
|
128
|
+
id: string;
|
|
129
|
+
key: string;
|
|
130
|
+
cells: Record<string, DtCellScalar>;
|
|
131
|
+
sourceReadableId?: string | null;
|
|
132
|
+
derivePending: boolean;
|
|
133
|
+
deriveError?: string | null;
|
|
134
|
+
changedAt: string;
|
|
135
|
+
// Keyset cursor after this row; the client attaches it to the last row of a page
|
|
136
|
+
cursor?: string | null;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* One keyset page of live rows (GraphQL DataTableRowPage). */
|
|
140
|
+
export interface DataTableRowPageGQL {
|
|
141
|
+
items: DataTableRowGQL[];
|
|
142
|
+
nextCursor?: string | null;
|
|
143
|
+
revision: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* One recorded change batch of a table (GraphQL DataTableRun; dataTableRunFragment). */
|
|
147
|
+
export interface DataTableRunGQL {
|
|
148
|
+
id: string;
|
|
149
|
+
cause: DtRunCauseEnum;
|
|
150
|
+
added: number;
|
|
151
|
+
changed: number;
|
|
152
|
+
removed: number;
|
|
153
|
+
derived: number;
|
|
154
|
+
llmCalls: number;
|
|
155
|
+
reason?: string | null;
|
|
156
|
+
error?: string | null;
|
|
157
|
+
startedAt: string;
|
|
158
|
+
finishedAt?: string | null;
|
|
159
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { StorageData } from './storage.d.ts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Definition elements; the row shape shared by field_doc_elements and
|
|
5
|
+
* campaign_template_elements. Both store one definition as flat element rows:
|
|
6
|
+
* SECTION elements are the top-level containers ("parentId" IS NULL) and every
|
|
7
|
+
* other element is a child of exactly one section. Each domain keeps its own
|
|
8
|
+
* kinds, option shape, settings flags and extra columns.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export interface DefinitionElementBaseData<KindEnum extends string, OptionObj, SettingsObj, StorageRelObj> {
|
|
12
|
+
id: number | bigint;
|
|
13
|
+
parentId?: number | bigint | null; // NULL for SECTION elements
|
|
14
|
+
kind: KindEnum;
|
|
15
|
+
key: string; // Answers reference this key; unique per definition
|
|
16
|
+
order: number;
|
|
17
|
+
label?: string | null;
|
|
18
|
+
description?: string | null;
|
|
19
|
+
options?: OptionObj[] | null;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
settings?: SettingsObj | null;
|
|
22
|
+
storageRels?: StorageRelObj[]; // Element images
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// One ordered element image; each domain adds its table name and element foreign key
|
|
26
|
+
export interface DefinitionElementStorageRelBaseData {
|
|
27
|
+
storageId: number | bigint;
|
|
28
|
+
order: number;
|
|
29
|
+
file: StorageData;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// One hydrated top-level section with its ordered child elements
|
|
33
|
+
export type DefinitionSectionWithElementsObj<ElementObj> = ElementObj & {
|
|
34
|
+
elements: ElementObj[];
|
|
35
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DOC_ACCESS_ENTITY_TYPE_ENUMS,
|
|
3
|
+
DOC_ACCESS_GRANTEE_TYPE_ENUMS,
|
|
4
|
+
DOC_ACCESS_SCOPE_ENUMS,
|
|
5
|
+
DOC_GRANT_PERMISSION_ENUMS,
|
|
6
|
+
DOC_PERMISSION_ENUMS,
|
|
7
|
+
} from '../constants/docAccess.ts';
|
|
8
|
+
|
|
9
|
+
export type DocPermissionEnum = (typeof DOC_PERMISSION_ENUMS)[number];
|
|
10
|
+
export type DocGrantPermissionEnum =
|
|
11
|
+
(typeof DOC_GRANT_PERMISSION_ENUMS)[number];
|
|
12
|
+
export type DocAccessGranteeTypeEnum =
|
|
13
|
+
(typeof DOC_ACCESS_GRANTEE_TYPE_ENUMS)[number];
|
|
14
|
+
export type DocAccessEntityTypeEnum =
|
|
15
|
+
(typeof DOC_ACCESS_ENTITY_TYPE_ENUMS)[number];
|
|
16
|
+
export type DocAccessScopeEnum = (typeof DOC_ACCESS_SCOPE_ENUMS)[number];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Base access policy stored on the document row itself (jsonb "access"):
|
|
20
|
+
* - team: what every owner-org member gets ("NONE" restricts the document
|
|
21
|
+
* to grant holders and owner-org members with the document edit ACL)
|
|
22
|
+
* - public: what everyone with the link gets
|
|
23
|
+
* - network: what every member of the owner org's network (child)
|
|
24
|
+
* organizations gets
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export interface DocAccessBaseObj {
|
|
28
|
+
team: DocPermissionEnum;
|
|
29
|
+
public: DocPermissionEnum;
|
|
30
|
+
network: DocPermissionEnum;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* One access grant for one account or one organization. A grant overrides
|
|
35
|
+
* the base policy for its grantee (ACCOUNT grants override the team rule,
|
|
36
|
+
* ORGANIZATION grants override the network rule), so it can raise or lower
|
|
37
|
+
* access, including an explicit "NONE" block. Grants are stored relationally
|
|
38
|
+
* in access_grants; ids are serialized GenericIDs on the client and parsed
|
|
39
|
+
* numeric ids in server storage.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
export interface DocAccessGrantObj {
|
|
43
|
+
granteeType: DocAccessGranteeTypeEnum;
|
|
44
|
+
granteeId: string | number | bigint;
|
|
45
|
+
permission: DocGrantPermissionEnum;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Full access settings for one document: the base policy plus the grants
|
|
50
|
+
* list. Fetch paths that skip the grants table leave "grants" undefined.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
export interface DocAccessObj extends DocAccessBaseObj {
|
|
54
|
+
grants?: DocAccessGrantObj[] | null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Viewer facts needed to evaluate one document's access settings.
|
|
59
|
+
* - isOwnerOrgMember: viewer passes the owner org's "general_read" ACL
|
|
60
|
+
* - isAdminOrOwner: viewer's role in the owner org is ADMIN or OWNER
|
|
61
|
+
* (admins and owners always keep full view and edit access)
|
|
62
|
+
* - hasWriteACL: viewer passes the owner org's "general_write" ACL; the
|
|
63
|
+
* team policy only grants EDIT to members who can write org data
|
|
64
|
+
* (read-only members cap at VIEW unless an explicit grant raises them)
|
|
65
|
+
* - isNetworkOrgMember: viewer belongs to one of the owner org's network
|
|
66
|
+
* (child) organizations
|
|
67
|
+
* - viewerOrganizationIds: every organization the viewer belongs to
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
export interface DocAccessViewerCtx {
|
|
71
|
+
accountId?: string | number | bigint | null;
|
|
72
|
+
isOwnerOrgMember?: boolean | null;
|
|
73
|
+
isAdminOrOwner?: boolean | null;
|
|
74
|
+
hasWriteACL?: boolean | null;
|
|
75
|
+
isNetworkOrgMember?: boolean | null;
|
|
76
|
+
viewerOrganizationIds?: Array<string | number | bigint> | null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* One access_grants database row.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
export interface DocAccessGrantData {
|
|
84
|
+
__table: 'access_grants';
|
|
85
|
+
|
|
86
|
+
id: number | bigint;
|
|
87
|
+
organizationId: number | bigint;
|
|
88
|
+
entityType: DocAccessEntityTypeEnum;
|
|
89
|
+
entityId: number | bigint;
|
|
90
|
+
granteeType: DocAccessGranteeTypeEnum;
|
|
91
|
+
granteeAccountId?: number | bigint | null;
|
|
92
|
+
granteeOrganizationId?: number | bigint | null;
|
|
93
|
+
permission: DocGrantPermissionEnum;
|
|
94
|
+
createdAt: Date;
|
|
95
|
+
updatedAt: Date;
|
|
96
|
+
}
|