@jsb188/mday 1.1.10 → 1.1.12
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 +140 -54
- package/src/constants/agentMemory.ts +123 -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 +21 -21
- 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 +125 -7
- package/src/constants/fieldDoc.ts +104 -0
- package/src/constants/graphqlReactivity.ts +196 -0
- package/src/constants/integration.ts +8 -9
- package/src/constants/log.ts +14 -408
- 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 +2207 -0
- package/src/constants/noteDoc.ts +77 -0
- package/src/constants/organization.ts +18 -21
- package/src/constants/pageRoute.ts +23 -0
- package/src/constants/qrCode.ts +30 -0
- package/src/constants/sheet.ts +126 -14
- package/src/constants/sms.ts +18 -0
- package/src/constants/square.ts +6 -6
- package/src/constants/storage.ts +80 -7
- package/src/constants/usage.ts +82 -0
- package/src/constants/workflowSteps.ts +60 -0
- package/src/schemas/editLogEntry.ts +836 -780
- package/src/schemas/inboundContact.ts +60 -55
- package/src/schemas/logsQuery.ts +55 -49
- package/src/types/account.d.ts +4 -1
- package/src/types/agentMemory.d.ts +98 -0
- package/src/types/agentNote.d.ts +443 -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 +115 -403
- 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 +184 -24
- 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 +10 -1
- package/src/types/log.d.ts +254 -295
- package/src/types/logDisplay.types.ts +85 -0
- package/src/types/organization.d.ts +91 -43
- 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 +678 -129
- package/src/types/sms.d.ts +38 -0
- package/src/types/storage.d.ts +449 -129
- package/src/types/usage.d.ts +106 -0
- package/src/types/workflow.d.ts +315 -54
- 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 +1174 -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 +95 -618
- 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 +317 -51
- 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 +276 -192
- 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 +337 -84
- 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 +199 -107
- 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 +22 -12
- package/src/utils/storage.ts +198 -0
- package/src/utils/table-route.ts +127 -11
- package/src/utils/time.ts +12 -0
- package/src/utils/workflow.ts +334 -40
- 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 +10 -10
- package/vitest.config.ts +8 -0
- package/src/constants/log-activityTexts.ts +0 -235
- package/src/constants/product.ts +0 -42
- package/src/constants/report.ts +0 -44
- package/src/schemas/organization.ts +0 -65
- package/src/schemas/productsQuery.ts +0 -53
- package/src/schemas/reportsQuery.ts +0 -20
- package/src/types/product.d.ts +0 -84
- package/src/types/report.d.ts +0 -290
- package/src/utils/product-calEvent.ts +0 -455
- package/src/utils/report.ts +0 -158
package/src/types/dataTable.d.ts
CHANGED
|
@@ -1,18 +1,56 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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[];
|
|
16
54
|
|
|
17
55
|
export interface DataTableDesignCellOptionObj {
|
|
18
56
|
label: string;
|
|
@@ -20,428 +58,102 @@ export interface DataTableDesignCellOptionObj {
|
|
|
20
58
|
color?: string | null;
|
|
21
59
|
}
|
|
22
60
|
|
|
61
|
+
/* One typed column a value is coerced into (dataset conversion and select-option matching). */
|
|
23
62
|
export interface DataTableDesignCellObj {
|
|
24
63
|
key: string;
|
|
25
64
|
label: string;
|
|
26
|
-
humanLabel?: string | null;
|
|
27
|
-
iconName?: string | null;
|
|
28
65
|
fieldType: DataTableFieldTypeEnum;
|
|
29
|
-
humanFieldType: DataTableFieldTypeEnum;
|
|
30
|
-
format?: string | null;
|
|
31
|
-
instructions?: string | null;
|
|
32
|
-
source?: {
|
|
33
|
-
path: string;
|
|
34
|
-
table: string;
|
|
35
|
-
} | null;
|
|
36
66
|
options?: DataTableDesignCellOptionObj[];
|
|
37
|
-
openLink?: boolean;
|
|
38
|
-
humansOnly?: boolean;
|
|
39
|
-
humansCannotEdit?: boolean; // If true, humans cannot edit this cell
|
|
40
|
-
hidden?: boolean; // If true, this cell is hidden from the default dataTable grid
|
|
41
|
-
indexed?: boolean;
|
|
42
|
-
width?: number | null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface DataTableDesignViewColumnSourceObj {
|
|
46
|
-
type: 'MASTER_CELL' | 'FORMULA' | 'STATIC' | 'DIMENSION' | 'CUSTOM' | 'RELATED_RECORD' | 'COMPUTED';
|
|
47
|
-
cellKey?: string | null;
|
|
48
|
-
formulaKey?: string | null;
|
|
49
|
-
dimensionKey?: string | null;
|
|
50
|
-
table?: string | null;
|
|
51
|
-
path?: string | null;
|
|
52
|
-
sourceCellKey?: string | null;
|
|
53
|
-
sourceCellKeys?: string[];
|
|
54
|
-
operation?: 'SUM' | null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface DataTableDesignViewDimensionObj {
|
|
58
|
-
key: string;
|
|
59
|
-
label?: string | null;
|
|
60
|
-
source?: DataTableDesignViewColumnSourceObj | null;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface DataTableDesignViewGeneratorDateSeriesObj {
|
|
64
|
-
key: string;
|
|
65
|
-
label?: string | null;
|
|
66
|
-
sourceCellKey?: string | null;
|
|
67
|
-
grain: 'DAY' | 'WEEK';
|
|
68
|
-
weekStart?: 'MONDAY';
|
|
69
|
-
range: {
|
|
70
|
-
type: 'CURRENT_MONTH' | 'FIXED';
|
|
71
|
-
start?: string;
|
|
72
|
-
end?: string;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface DataTableDesignViewGeneratorDimensionObj {
|
|
77
|
-
key: string;
|
|
78
|
-
label?: string | null;
|
|
79
|
-
source:
|
|
80
|
-
| {
|
|
81
|
-
type: 'MASTER_CELL_OPTIONS';
|
|
82
|
-
cellKey: string;
|
|
83
|
-
}
|
|
84
|
-
| {
|
|
85
|
-
type: 'STATIC_VALUES';
|
|
86
|
-
values: Array<{
|
|
87
|
-
value: string;
|
|
88
|
-
label?: string | null;
|
|
89
|
-
}>;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface DataTableDesignViewGeneratorMeasureObj {
|
|
94
|
-
key: string;
|
|
95
|
-
label?: string | null;
|
|
96
|
-
operation: 'COUNT' | 'SUM';
|
|
97
|
-
sourceCellKey?: string | null;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export interface DataTableDesignViewGeneratorObj {
|
|
101
|
-
keyPrefix: string;
|
|
102
|
-
dateSeries?: DataTableDesignViewGeneratorDateSeriesObj;
|
|
103
|
-
dimensions?: DataTableDesignViewGeneratorDimensionObj[];
|
|
104
|
-
measures?: DataTableDesignViewGeneratorMeasureObj[];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface DataTableDesignViewRowModelObj {
|
|
108
|
-
type: 'MASTER_ROWS' | 'GROUPED_ROWS';
|
|
109
|
-
dimensions?: DataTableDesignViewDimensionObj[];
|
|
110
|
-
generator?: DataTableDesignViewGeneratorObj | null;
|
|
111
67
|
}
|
|
112
68
|
|
|
113
|
-
|
|
69
|
+
/* One column of a read-only data table, as the shared dataTableFragment selects it. */
|
|
70
|
+
export interface DataTableColumnGQL {
|
|
114
71
|
key: string;
|
|
115
72
|
label: string;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
options?: DataTableDesignCellOptionObj[];
|
|
122
|
-
openLink?: boolean;
|
|
123
|
-
humansCannotEdit?: boolean;
|
|
124
|
-
width?: number | null;
|
|
73
|
+
type: string;
|
|
74
|
+
origin: DtColumnOriginEnum;
|
|
75
|
+
unit?: string | null;
|
|
76
|
+
currency?: string | null;
|
|
77
|
+
retired: boolean;
|
|
125
78
|
}
|
|
126
79
|
|
|
127
|
-
|
|
128
|
-
|
|
80
|
+
/* One projection gap of a SOURCE table: source data the table cannot show. */
|
|
81
|
+
export interface DataTableCoverageWarningGQL {
|
|
82
|
+
code: DtCoverageWarningCodeEnum;
|
|
129
83
|
columnKey: string;
|
|
130
|
-
|
|
131
|
-
value?: any;
|
|
132
|
-
enabled?: boolean;
|
|
84
|
+
message: string;
|
|
133
85
|
}
|
|
134
86
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
direction: 'ASC' | 'DESC';
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface DataTableDesignViewGroupObj {
|
|
141
|
-
columnKey: string;
|
|
142
|
-
direction?: 'ASC' | 'DESC';
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export interface DataTableDesignViewObj {
|
|
87
|
+
/* The AI note that owns a table. */
|
|
88
|
+
export interface DataTableOwnerNoteGQL {
|
|
146
89
|
id: string;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
iconName?: string | null;
|
|
150
|
-
color?: string | null;
|
|
151
|
-
description?: string | null;
|
|
152
|
-
rowModel?: DataTableDesignViewRowModelObj | null;
|
|
153
|
-
columns: DataTableDesignViewColumnObj[];
|
|
154
|
-
columnsOrder?: string[];
|
|
155
|
-
filters?: DataTableDesignViewFilterObj[];
|
|
156
|
-
sorts?: DataTableDesignViewSortObj[];
|
|
157
|
-
groups?: DataTableDesignViewGroupObj[];
|
|
158
|
-
stickyTop?: number | null;
|
|
159
|
-
stickyLeft?: number | null;
|
|
160
|
-
humansCannotEdit?: boolean | null;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export interface DataTableDesignObj {
|
|
164
|
-
cells: DataTableDesignCellObj[];
|
|
165
|
-
cellsOrder?: string[];
|
|
166
|
-
views?: DataTableDesignViewObj[];
|
|
167
|
-
viewsOrder?: string[];
|
|
168
|
-
defaultViewId?: string | null;
|
|
169
|
-
instructions?: string;
|
|
170
|
-
humansCannotEdit?: boolean; // If true, humans cannot edit any cells in this dataTable
|
|
171
|
-
stickyTop?: number;
|
|
172
|
-
stickyLeft?: number;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export interface DataTableData {
|
|
176
|
-
__table: 'data_tables';
|
|
177
|
-
|
|
178
|
-
id: number | bigint;
|
|
179
|
-
organizationId: number | bigint;
|
|
180
|
-
name: string;
|
|
181
|
-
title: string;
|
|
182
|
-
description?: string | null;
|
|
183
|
-
design: DataTableDesignObj;
|
|
184
|
-
active: boolean;
|
|
185
|
-
createdAt: Date;
|
|
186
|
-
updatedAt: Date;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export interface DataTableRowData {
|
|
190
|
-
__table: 'data_table_rows';
|
|
191
|
-
|
|
192
|
-
id: number | bigint;
|
|
193
|
-
organizationId: number | bigint;
|
|
194
|
-
dataTableId: number | bigint;
|
|
195
|
-
identifier?: string | null;
|
|
196
|
-
viewId?: string | null;
|
|
197
|
-
viewRowKey?: string | null;
|
|
198
|
-
position: number;
|
|
199
|
-
metadata: Record<string, any>;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export interface DataTableRecordData {
|
|
203
|
-
__table: 'data_table_records';
|
|
204
|
-
|
|
205
|
-
id: number | bigint;
|
|
206
|
-
dataTableId: number | bigint;
|
|
207
|
-
dataTableRowId: number | bigint;
|
|
208
|
-
cellKey: string;
|
|
209
|
-
iconName?: string | null;
|
|
210
|
-
value?: DataTableRecordValue;
|
|
211
|
-
textValue?: string | null;
|
|
212
|
-
numberValue?: number | null;
|
|
213
|
-
booleanValue?: boolean | null;
|
|
214
|
-
dateValue?: Date | string | null;
|
|
215
|
-
datetimeValue?: Date | string | null;
|
|
216
|
-
relatedTable?: string | null;
|
|
217
|
-
relatedId?: number | bigint | null;
|
|
218
|
-
referenceDataTableId?: number | bigint | null;
|
|
219
|
-
referenceDataTableRowId?: number | bigint | null;
|
|
220
|
-
referenceCellKey?: string | null;
|
|
221
|
-
createdAt: Date;
|
|
222
|
-
updatedAt: Date;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export interface DataTableCellReferenceGQL {
|
|
226
|
-
dataTableId?: string | null;
|
|
227
|
-
dataTableRowId?: string | null;
|
|
228
|
-
cellKey?: string | null;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export interface DataTableDesignCellOptionGQL {
|
|
232
|
-
label: string;
|
|
233
|
-
value: string;
|
|
234
|
-
color?: string | null;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export interface DataTableDesignCellSourceGQL {
|
|
238
|
-
path: string;
|
|
239
|
-
table: string;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export interface DataTableDesignCellGQL {
|
|
243
|
-
key: string;
|
|
244
|
-
label: string;
|
|
245
|
-
humanLabel?: string | null;
|
|
246
|
-
iconName?: string | null;
|
|
247
|
-
fieldType: DataTableFieldTypeGQL;
|
|
248
|
-
humanFieldType: DataTableFieldTypeGQL;
|
|
249
|
-
format?: string | null;
|
|
250
|
-
instructions?: string | null;
|
|
251
|
-
source?: DataTableDesignCellSourceGQL | null;
|
|
252
|
-
options?: DataTableDesignCellOptionGQL[];
|
|
253
|
-
openLink?: boolean | null;
|
|
254
|
-
humansOnly?: boolean | null;
|
|
255
|
-
humansCannotEdit?: boolean | null;
|
|
256
|
-
hidden?: boolean | null;
|
|
257
|
-
indexed?: boolean | null;
|
|
258
|
-
width?: number | null;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export interface DataTableDesignViewColumnSourceGQL {
|
|
262
|
-
type: 'MASTER_CELL' | 'FORMULA' | 'STATIC' | 'DIMENSION' | 'CUSTOM' | 'RELATED_RECORD' | 'COMPUTED';
|
|
263
|
-
cellKey?: string | null;
|
|
264
|
-
formulaKey?: string | null;
|
|
265
|
-
dimensionKey?: string | null;
|
|
266
|
-
table?: string | null;
|
|
267
|
-
path?: string | null;
|
|
268
|
-
sourceCellKey?: string | null;
|
|
269
|
-
sourceCellKeys?: string[];
|
|
270
|
-
operation?: 'SUM' | null;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export interface DataTableDesignViewDimensionGQL {
|
|
274
|
-
key: string;
|
|
275
|
-
label?: string | null;
|
|
276
|
-
source?: DataTableDesignViewColumnSourceGQL | null;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export interface DataTableDesignViewGeneratorDateSeriesGQL {
|
|
280
|
-
key: string;
|
|
281
|
-
label?: string | null;
|
|
282
|
-
sourceCellKey?: string | null;
|
|
283
|
-
grain: 'DAY' | 'WEEK';
|
|
284
|
-
weekStart?: 'MONDAY' | null;
|
|
285
|
-
range: {
|
|
286
|
-
type: 'CURRENT_MONTH' | 'FIXED';
|
|
287
|
-
start?: string | null;
|
|
288
|
-
end?: string | null;
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export interface DataTableDesignViewGeneratorDimensionGQL {
|
|
293
|
-
key: string;
|
|
294
|
-
label?: string | null;
|
|
295
|
-
source:
|
|
296
|
-
| {
|
|
297
|
-
type: 'MASTER_CELL_OPTIONS';
|
|
298
|
-
cellKey: string;
|
|
299
|
-
}
|
|
300
|
-
| {
|
|
301
|
-
type: 'STATIC_VALUES';
|
|
302
|
-
values: Array<{
|
|
303
|
-
value: string;
|
|
304
|
-
label?: string | null;
|
|
305
|
-
}>;
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
export interface DataTableDesignViewGeneratorMeasureGQL {
|
|
310
|
-
key: string;
|
|
311
|
-
label?: string | null;
|
|
312
|
-
operation: 'COUNT' | 'SUM';
|
|
313
|
-
sourceCellKey?: string | null;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
export interface DataTableDesignViewGeneratorGQL {
|
|
317
|
-
keyPrefix: string;
|
|
318
|
-
dateSeries?: DataTableDesignViewGeneratorDateSeriesGQL | null;
|
|
319
|
-
dimensions?: DataTableDesignViewGeneratorDimensionGQL[];
|
|
320
|
-
measures?: DataTableDesignViewGeneratorMeasureGQL[];
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
export interface DataTableDesignViewRowModelGQL {
|
|
324
|
-
type: 'MASTER_ROWS' | 'GROUPED_ROWS';
|
|
325
|
-
dimensions?: DataTableDesignViewDimensionGQL[];
|
|
326
|
-
generator?: DataTableDesignViewGeneratorGQL | null;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export interface DataTableDesignViewColumnGQL {
|
|
330
|
-
key: string;
|
|
331
|
-
label: string;
|
|
332
|
-
humanLabel?: string | null;
|
|
333
|
-
iconName?: string | null;
|
|
334
|
-
fieldType?: DataTableFieldTypeGQL | null;
|
|
335
|
-
humanFieldType: DataTableFieldTypeGQL;
|
|
336
|
-
source?: DataTableDesignViewColumnSourceGQL | null;
|
|
337
|
-
options?: DataTableDesignCellOptionGQL[];
|
|
338
|
-
openLink?: boolean | null;
|
|
339
|
-
humansCannotEdit?: boolean | null;
|
|
340
|
-
width?: number | null;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
export interface DataTableDesignViewFilterGQL {
|
|
344
|
-
id: string;
|
|
345
|
-
columnKey: string;
|
|
346
|
-
operator: string;
|
|
347
|
-
value?: string | null;
|
|
348
|
-
enabled?: boolean | null;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
export interface DataTableDesignViewSortGQL {
|
|
352
|
-
columnKey: string;
|
|
353
|
-
direction: 'ASC' | 'DESC';
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
export interface DataTableDesignViewGroupGQL {
|
|
357
|
-
columnKey: string;
|
|
358
|
-
direction?: 'ASC' | 'DESC' | null;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
export interface DataTableDesignViewGQL {
|
|
362
|
-
id: string;
|
|
363
|
-
name: string;
|
|
364
|
-
layout: 'GRID';
|
|
365
|
-
iconName?: string | null;
|
|
366
|
-
color?: string | null;
|
|
367
|
-
description?: string | null;
|
|
368
|
-
rowModel?: DataTableDesignViewRowModelGQL | null;
|
|
369
|
-
columns: DataTableDesignViewColumnGQL[];
|
|
370
|
-
columnsOrder: string[];
|
|
371
|
-
filters: DataTableDesignViewFilterGQL[];
|
|
372
|
-
sorts: DataTableDesignViewSortGQL[];
|
|
373
|
-
groups: DataTableDesignViewGroupGQL[];
|
|
374
|
-
stickyTop?: number | null;
|
|
375
|
-
stickyLeft?: number | null;
|
|
376
|
-
humansCannotEdit?: boolean | null;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
export interface DataTableDesignGQL {
|
|
380
|
-
id: string;
|
|
381
|
-
cells: DataTableDesignCellGQL[];
|
|
382
|
-
cellsOrder: string[];
|
|
383
|
-
views?: DataTableDesignViewGQL[];
|
|
384
|
-
viewsOrder?: string[];
|
|
385
|
-
defaultViewId?: string | null;
|
|
386
|
-
instructions?: string | null;
|
|
387
|
-
humansCannotEdit?: boolean | null;
|
|
388
|
-
stickyTop?: number | null;
|
|
389
|
-
stickyLeft?: number | null;
|
|
90
|
+
headline: string | null;
|
|
91
|
+
emoji: string;
|
|
390
92
|
}
|
|
391
93
|
|
|
94
|
+
/* One read-only data table (GraphQL DataTable; dataTableFragment). */
|
|
392
95
|
export interface DataTableGQL {
|
|
393
96
|
__deleted?: boolean;
|
|
394
97
|
|
|
395
98
|
id: string;
|
|
99
|
+
cursor?: string | null;
|
|
396
100
|
organizationId: string;
|
|
397
101
|
|
|
398
|
-
|
|
102
|
+
kind: DtTableKindEnum;
|
|
103
|
+
source?: DtSourceEnum | null;
|
|
399
104
|
title: string;
|
|
400
105
|
description?: string | null;
|
|
401
|
-
|
|
402
|
-
|
|
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;
|
|
403
121
|
|
|
404
122
|
createdAt: string;
|
|
405
123
|
updatedAt: string;
|
|
406
124
|
}
|
|
407
125
|
|
|
126
|
+
/* One live row (GraphQL DataTableRow; dataTableRowFragment). "cells" maps column keys to values. */
|
|
408
127
|
export interface DataTableRowGQL {
|
|
409
|
-
__deleted?: boolean;
|
|
410
|
-
|
|
411
128
|
id: string;
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
metadata: string;
|
|
421
|
-
cells?: DataTableCellGQL[];
|
|
422
|
-
updatedAt?: string | null;
|
|
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;
|
|
423
137
|
}
|
|
424
138
|
|
|
425
|
-
|
|
426
|
-
|
|
139
|
+
/* One keyset page of live rows (GraphQL DataTableRowPage). */
|
|
140
|
+
export interface DataTableRowPageGQL {
|
|
141
|
+
items: DataTableRowGQL[];
|
|
142
|
+
nextCursor?: string | null;
|
|
143
|
+
revision: string;
|
|
144
|
+
}
|
|
427
145
|
|
|
146
|
+
/* One recorded change batch of a table (GraphQL DataTableRun; dataTableRunFragment). */
|
|
147
|
+
export interface DataTableRunGQL {
|
|
428
148
|
id: string;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
datetimeValue?: string | null;
|
|
440
|
-
relatedTable?: string | null;
|
|
441
|
-
relatedId?: string | null;
|
|
442
|
-
reference?: DataTableCellReferenceGQL | null;
|
|
443
|
-
referenceStatus?: DataTableCellReferenceStatus | null;
|
|
444
|
-
|
|
445
|
-
createdAt: string;
|
|
446
|
-
updatedAt: 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;
|
|
447
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
|
+
}
|