@jsb188/mday 1.1.11 → 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 +58 -23
- package/src/constants/agentMemory.ts +14 -45
- package/src/constants/agentNote.ts +212 -0
- package/src/constants/aiChat.ts +5 -0
- package/src/constants/billing.ts +126 -0
- package/src/constants/campaign.ts +156 -47
- package/src/constants/contact.ts +72 -0
- package/src/constants/csvExport.ts +133 -0
- package/src/constants/dataTable.ts +12 -38
- package/src/constants/dataTableFieldTypes.generated.ts +3 -7
- package/src/constants/docAccess.ts +3 -2
- package/src/constants/dt.ts +234 -0
- package/src/constants/email.ts +114 -12
- package/src/constants/fieldDoc.ts +74 -4
- package/src/constants/graphqlReactivity.ts +108 -25
- package/src/constants/log.ts +9 -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 +1834 -730
- package/src/constants/organization.ts +13 -14
- package/src/constants/qrCode.ts +30 -0
- package/src/constants/sheet.ts +65 -101
- package/src/constants/sms.ts +18 -0
- package/src/constants/storage.ts +33 -9
- package/src/constants/usage.ts +3 -0
- package/src/constants/workflowSteps.ts +60 -0
- package/src/schemas/editLogEntry.ts +106 -283
- package/src/schemas/inboundContact.ts +5 -5
- package/src/types/agentMemory.d.ts +38 -14
- package/src/types/agentNote.d.ts +443 -0
- package/src/types/billing.d.ts +537 -0
- package/src/types/campaign.d.ts +1043 -193
- 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 +102 -309
- package/src/types/definitionElement.d.ts +35 -0
- package/src/types/dt.d.ts +257 -0
- package/src/types/email.d.ts +144 -55
- package/src/types/emailReplyReport.d.ts +76 -0
- package/src/types/fieldDoc.d.ts +579 -150
- package/src/types/fieldDocContract.d.ts +90 -0
- package/src/types/inboundContact.d.ts +8 -0
- package/src/types/log.d.ts +94 -3
- package/src/types/logDisplay.types.ts +85 -0
- package/src/types/organization.d.ts +8 -3
- package/src/types/qrCode.d.ts +96 -0
- package/src/types/richText.d.ts +81 -0
- package/src/types/sheet.d.ts +180 -463
- package/src/types/sms.d.ts +38 -0
- package/src/types/storage.d.ts +266 -27
- package/src/types/workflow.d.ts +196 -66
- package/src/utils/agentMemory.ts +15 -0
- package/src/utils/agentNote.ts +850 -0
- package/src/utils/aiChat.ts +31 -14
- package/src/utils/aiChatWork.ts +64 -0
- package/src/utils/billing.ts +37 -0
- package/src/utils/campaign.ts +642 -209
- 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 +18 -556
- package/src/utils/dataTableFieldTypeRegistry.ts +1 -0
- package/src/utils/dataTableRelativeDate.ts +447 -0
- package/src/utils/definitionElement.ts +84 -0
- package/src/utils/email.ts +208 -1
- package/src/utils/emailReplyReport.test.ts +187 -0
- package/src/utils/emailReplyReport.ts +143 -0
- package/src/utils/fieldDoc.ts +81 -37
- 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 +232 -141
- package/src/utils/logDisplay.helpers.ts +177 -0
- package/src/utils/logDisplay.ts +87 -0
- package/src/utils/logStoreRead.ts +9 -13
- package/src/utils/logTaxonomy.helpers.ts +17 -0
- package/src/utils/logTaxonomyDisplay.ts +80 -124
- package/src/utils/noteDoc.ts +66 -284
- package/src/utils/organization.ts +117 -283
- 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 +123 -4834
- package/src/utils/sheetAxisMove.ts +77 -291
- package/src/utils/sheetBootstrap.ts +771 -1138
- package/src/utils/sheetCellLiteral.ts +101 -0
- package/src/utils/sheetCommand.ts +23 -88
- package/src/utils/sheetDesign.ts +705 -0
- package/src/utils/sheetExport.ts +17 -69
- 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 +388 -403
- package/src/utils/sheetFormulaEvaluator.ts +589 -444
- 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 +140 -18
- package/src/utils/sheetNumberFormat.ts +68 -267
- package/src/utils/sheetPreview.ts +68 -0
- package/src/utils/sheetSequence.ts +13 -43
- package/src/utils/sheetSnapshot.ts +176 -429
- package/src/utils/sheetStructureEdit.ts +537 -907
- package/src/utils/sheetStructureReferences.ts +389 -0
- package/src/utils/storage.ts +49 -3
- package/src/utils/time.ts +12 -0
- package/src/utils/workflow.ts +199 -73
- 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 +2 -1
- package/tests/dataTableRelativeDate.test.ts +412 -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 +37 -192
- package/tests/richTextHTML.test.ts +185 -0
- package/tests/sheetAxisMove.test.ts +49 -40
- 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 +93 -200
- 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 +4 -23
- package/tests/sheetSnapshot.test.ts +134 -0
- package/tests/sheetStructureEdit.test.ts +492 -37
- 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/src/constants/agentDoc.ts +0 -12
- package/src/constants/logActivityGroupColors.generated.ts +0 -19
- package/src/constants/schedule.ts +0 -220
- package/src/constants/scheduleRuleTemplateSeed.ts +0 -138
- package/src/constants/scheduleRuleTemplates.generated.ts +0 -145
- package/src/constants/sheetRegionSources.generated.ts +0 -578
- package/src/schemas/fieldDocsQuery.ts +0 -12
- package/src/schemas/organization.ts +0 -68
- package/src/types/agentDoc.d.ts +0 -64
- package/src/types/noteDoc.d.ts +0 -86
- package/src/types/schedule.d.ts +0 -391
- package/src/utils/agentDoc.ts +0 -109
- package/src/utils/campaignFormEditor.ts +0 -871
- package/src/utils/dataTableRealtimeAuthority.ts +0 -209
- package/src/utils/dataTableRealtimeSelection.ts +0 -134
- package/src/utils/dataTableRowDocument.ts +0 -508
- package/src/utils/dataTableSource.ts +0 -230
- package/src/utils/schedule.ts +0 -799
- package/src/utils/scheduleEvaluation.ts +0 -1994
- package/src/utils/scheduleICS.ts +0 -246
- package/src/utils/scheduleRuleTemplates.ts +0 -188
- package/src/utils/sheetRegion.ts +0 -374
- package/src/utils/sheetRegionFilter.ts +0 -1259
- package/src/utils/sheetRegionSourceRegistry.ts +0 -594
- package/tests/schedule.test.ts +0 -693
- package/tests/scheduleEvaluation.test.ts +0 -1970
- package/tests/scheduleICS.test.ts +0 -208
- package/tests/scheduleRuleTemplates.test.ts +0 -176
- package/tests/scheduleSweepInvariants.test.ts +0 -428
- package/tests/sheetRegionFilter.test.ts +0 -1135
package/src/types/noteDoc.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
NOTE_BLOCK_TYPES,
|
|
3
|
-
NOTE_INLINE_TYPES,
|
|
4
|
-
NOTE_MARK_TYPES,
|
|
5
|
-
} from '../constants/noteDoc.ts';
|
|
6
|
-
|
|
7
|
-
export type NoteBlockType = (typeof NOTE_BLOCK_TYPES)[number];
|
|
8
|
-
export type NoteInlineType = (typeof NOTE_INLINE_TYPES)[number];
|
|
9
|
-
export type NoteMarkType = (typeof NOTE_MARK_TYPES)[number];
|
|
10
|
-
|
|
11
|
-
// Heading depth; sanitizeNoteDoc clamps anything else into this range
|
|
12
|
-
export type NoteHeadingLevel = 1 | 2 | 3;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Attrs carried by one "image" void block. storageId is the string form of
|
|
16
|
-
* the storage row id and is the notes_storage_rels source-of-truth key:
|
|
17
|
-
* image blocks whose storageId has no surviving rel row are filtered out of
|
|
18
|
-
* the document on read. fileUri locates the GCS object for rendering.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
export interface NoteImageAttrs {
|
|
22
|
-
storageId: string;
|
|
23
|
-
fileUri: string;
|
|
24
|
-
alt?: string;
|
|
25
|
-
width?: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* One inline mark on a text run. color/highlight marks carry a palette
|
|
30
|
-
* token from NOTE_COLOR_TOKENS; link marks carry an http(s)/mailto href;
|
|
31
|
-
* every other mark type carries no attrs.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
export interface NoteMark {
|
|
35
|
-
type: NoteMarkType;
|
|
36
|
-
attrs?: {
|
|
37
|
-
token?: string;
|
|
38
|
-
href?: string;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* One inline node inside a text-bearing block: a styled text run, or a
|
|
44
|
-
* hard line break (which carries neither text nor marks).
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
export interface NoteInlineNode {
|
|
48
|
-
type: NoteInlineType;
|
|
49
|
-
text?: string;
|
|
50
|
-
marks?: NoteMark[];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Attrs a block node may carry: "level" on headings, image attrs on image
|
|
55
|
-
* blocks. Every other block type carries no attrs.
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
export interface NoteBlockAttrs extends Partial<NoteImageAttrs> {
|
|
59
|
-
level?: NoteHeadingLevel;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* One block-level node. Containers (bulletList, orderedList, listItem,
|
|
64
|
-
* blockquote) hold block children; paragraph/heading hold inline children;
|
|
65
|
-
* divider/image hold none. _key and _uploading are client-editor-only
|
|
66
|
-
* fields, always stripped by sanitizeNoteDoc before persistence.
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
export interface NoteBlockNode {
|
|
70
|
-
type: NoteBlockType;
|
|
71
|
-
attrs?: NoteBlockAttrs;
|
|
72
|
-
content?: Array<NoteBlockNode | NoteInlineNode>;
|
|
73
|
-
_key?: string;
|
|
74
|
-
_uploading?: boolean;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* The root note document stored in notes.content (JSONB). Always non-empty
|
|
79
|
-
* after sanitizing: at least one (possibly empty) paragraph.
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
export interface NoteDoc {
|
|
83
|
-
type: 'doc';
|
|
84
|
-
version: number;
|
|
85
|
-
content: NoteBlockNode[];
|
|
86
|
-
}
|
package/src/types/schedule.d.ts
DELETED
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
SCHEDULE_ACTOR_TYPE_ENUMS,
|
|
3
|
-
SCHEDULE_ASSIGNMENT_STATUS_ENUMS,
|
|
4
|
-
SCHEDULE_CALENDAR_KIND_ENUMS,
|
|
5
|
-
SCHEDULE_DEMAND_SOURCE_ENUMS,
|
|
6
|
-
SCHEDULE_EVALUATION_STATUS_ENUMS,
|
|
7
|
-
SCHEDULE_FEED_SCOPE_ENUMS,
|
|
8
|
-
SCHEDULE_NOTIFICATION_CHANNEL_ENUMS,
|
|
9
|
-
SCHEDULE_NOTIFICATION_EVENT_KIND_ENUMS,
|
|
10
|
-
SCHEDULE_OCCURRENCE_KIND_ENUMS,
|
|
11
|
-
SCHEDULE_OCCURRENCE_STATUS_ENUMS,
|
|
12
|
-
SCHEDULE_RECURRENCE_FREQ_ENUMS,
|
|
13
|
-
SCHEDULE_REQUEST_KIND_ENUMS,
|
|
14
|
-
SCHEDULE_REQUEST_STATUS_ENUMS,
|
|
15
|
-
SCHEDULE_RULE_KIND_ENUMS,
|
|
16
|
-
SCHEDULE_RULE_SEVERITY_ENUMS,
|
|
17
|
-
} from '../constants/schedule.ts';
|
|
18
|
-
import type { DocAccessBaseObj } from './docAccess.d.ts';
|
|
19
|
-
|
|
20
|
-
export type ScheduleCalendarKindEnum =
|
|
21
|
-
(typeof SCHEDULE_CALENDAR_KIND_ENUMS)[number];
|
|
22
|
-
export type ScheduleOccurrenceKindEnum =
|
|
23
|
-
(typeof SCHEDULE_OCCURRENCE_KIND_ENUMS)[number];
|
|
24
|
-
export type ScheduleOccurrenceStatusEnum =
|
|
25
|
-
(typeof SCHEDULE_OCCURRENCE_STATUS_ENUMS)[number];
|
|
26
|
-
export type ScheduleActorTypeEnum = (typeof SCHEDULE_ACTOR_TYPE_ENUMS)[number];
|
|
27
|
-
export type ScheduleAssignmentStatusEnum =
|
|
28
|
-
(typeof SCHEDULE_ASSIGNMENT_STATUS_ENUMS)[number];
|
|
29
|
-
export type ScheduleDemandSourceEnum =
|
|
30
|
-
(typeof SCHEDULE_DEMAND_SOURCE_ENUMS)[number];
|
|
31
|
-
export type ScheduleRuleKindEnum = (typeof SCHEDULE_RULE_KIND_ENUMS)[number];
|
|
32
|
-
export type ScheduleRuleSeverityEnum =
|
|
33
|
-
(typeof SCHEDULE_RULE_SEVERITY_ENUMS)[number];
|
|
34
|
-
export type ScheduleEvaluationStatusEnum =
|
|
35
|
-
(typeof SCHEDULE_EVALUATION_STATUS_ENUMS)[number];
|
|
36
|
-
export type ScheduleRequestKindEnum =
|
|
37
|
-
(typeof SCHEDULE_REQUEST_KIND_ENUMS)[number];
|
|
38
|
-
export type ScheduleRequestStatusEnum =
|
|
39
|
-
(typeof SCHEDULE_REQUEST_STATUS_ENUMS)[number];
|
|
40
|
-
export type ScheduleFeedScopeEnum = (typeof SCHEDULE_FEED_SCOPE_ENUMS)[number];
|
|
41
|
-
export type ScheduleNotificationEventKindEnum =
|
|
42
|
-
(typeof SCHEDULE_NOTIFICATION_EVENT_KIND_ENUMS)[number];
|
|
43
|
-
export type ScheduleNotificationChannelEnum =
|
|
44
|
-
(typeof SCHEDULE_NOTIFICATION_CHANNEL_ENUMS)[number];
|
|
45
|
-
export type ScheduleRecurrenceFreqEnum =
|
|
46
|
-
(typeof SCHEDULE_RECURRENCE_FREQ_ENUMS)[number];
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Every *Data interface below models a database row, so ids are the shapes
|
|
50
|
-
* Postgres hands back. Client-facing ids are serialized GenericID strings and
|
|
51
|
-
* live on the GraphQL types instead, never on these.
|
|
52
|
-
*/
|
|
53
|
-
export type ScheduleId = number | bigint;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* One recurrence rule, stored as schedule_series."recurrence" JSONB.
|
|
57
|
-
*
|
|
58
|
-
* - byWeekday uses the JavaScript convention (0 = Sunday ... 6 = Saturday)
|
|
59
|
-
* and applies to WEEKLY rules
|
|
60
|
-
* - byMonthDay applies to MONTHLY and YEARLY rules; -1 means the last day of
|
|
61
|
-
* the month
|
|
62
|
-
* - byMonth (1 = January ... 12 = December) applies to YEARLY rules
|
|
63
|
-
* - count and until both bound the series; whichever is reached first wins
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
export interface ScheduleRecurrenceObj {
|
|
67
|
-
freq: ScheduleRecurrenceFreqEnum;
|
|
68
|
-
interval?: number | null;
|
|
69
|
-
byWeekday?: number[] | null;
|
|
70
|
-
byMonthDay?: number[] | null;
|
|
71
|
-
byMonth?: number[] | null;
|
|
72
|
-
count?: number | null;
|
|
73
|
-
until?: string | null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* One slot requirement, both as a schedule_slots row and as an entry of
|
|
78
|
-
* schedule_series."slotTemplate". "predicate" narrows who may fill the slot;
|
|
79
|
-
* an empty predicate means anyone.
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
export interface ScheduleSlotPredicateObj {
|
|
83
|
-
roles?: string[] | null;
|
|
84
|
-
qualifications?: string[] | null;
|
|
85
|
-
tags?: string[] | null;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface ScheduleSlotTemplateObj {
|
|
89
|
-
key: string;
|
|
90
|
-
label?: string | null;
|
|
91
|
-
requiredCount: number;
|
|
92
|
-
predicate?: ScheduleSlotPredicateObj | null;
|
|
93
|
-
ordinal?: number | null;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface ScheduleSlotData extends ScheduleSlotTemplateObj {
|
|
97
|
-
id: ScheduleId;
|
|
98
|
-
occurrenceId: ScheduleId;
|
|
99
|
-
ordinal: number;
|
|
100
|
-
createdAt?: Date | string;
|
|
101
|
-
updatedAt?: Date | string;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* A calendar: the unit of sharing, of ICS subscription, and of constraint
|
|
106
|
-
* evaluation. "access" is the base policy only; per-grantee overrides live in
|
|
107
|
-
* access_grants rows with entityType 'SCHEDULE_CALENDAR'.
|
|
108
|
-
*/
|
|
109
|
-
|
|
110
|
-
export interface ScheduleCalendarData {
|
|
111
|
-
__table?: string;
|
|
112
|
-
id: ScheduleId;
|
|
113
|
-
organizationId: ScheduleId;
|
|
114
|
-
kind: ScheduleCalendarKindEnum;
|
|
115
|
-
name: string;
|
|
116
|
-
description?: string | null;
|
|
117
|
-
timeZone: string;
|
|
118
|
-
siteId?: ScheduleId | null;
|
|
119
|
-
access?: DocAccessBaseObj | null;
|
|
120
|
-
color?: string | null;
|
|
121
|
-
settings?: Record<string, unknown> | null;
|
|
122
|
-
ordinal: number;
|
|
123
|
-
createdByAccountId?: ScheduleId | null;
|
|
124
|
-
deletedAt?: Date | string | null;
|
|
125
|
-
createdAt?: Date | string;
|
|
126
|
-
updatedAt?: Date | string;
|
|
127
|
-
// Attached by fetch paths that resolve the viewer's permission
|
|
128
|
-
viewerPermission?: string | null;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* What an occurrence occupies: a room, a position, a vehicle, a booth.
|
|
133
|
-
*/
|
|
134
|
-
|
|
135
|
-
export interface ScheduleResourceData {
|
|
136
|
-
__table?: string;
|
|
137
|
-
id: ScheduleId;
|
|
138
|
-
organizationId: ScheduleId;
|
|
139
|
-
siteId?: ScheduleId | null;
|
|
140
|
-
kind: string;
|
|
141
|
-
key: string;
|
|
142
|
-
name: string;
|
|
143
|
-
capacity?: number | null;
|
|
144
|
-
config?: Record<string, unknown> | null;
|
|
145
|
-
ordinal: number;
|
|
146
|
-
retiredAt?: Date | string | null;
|
|
147
|
-
createdAt?: Date | string;
|
|
148
|
-
updatedAt?: Date | string;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* A recurrence rule. Never read by calendar queries — the horizon job
|
|
153
|
-
* materializes concrete occurrences from it.
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
export interface ScheduleSeriesData {
|
|
157
|
-
__table?: string;
|
|
158
|
-
id: ScheduleId;
|
|
159
|
-
organizationId: ScheduleId;
|
|
160
|
-
calendarId: ScheduleId;
|
|
161
|
-
resourceId?: ScheduleId | null;
|
|
162
|
-
siteId?: ScheduleId | null;
|
|
163
|
-
kind: ScheduleOccurrenceKindEnum;
|
|
164
|
-
title: string;
|
|
165
|
-
note?: string | null;
|
|
166
|
-
location?: string | null;
|
|
167
|
-
recurrence: ScheduleRecurrenceObj;
|
|
168
|
-
timeZone: string;
|
|
169
|
-
startsAt: Date | string;
|
|
170
|
-
endsAt?: Date | string | null;
|
|
171
|
-
durationMinutes: number;
|
|
172
|
-
allDay: boolean;
|
|
173
|
-
slotTemplate: ScheduleSlotTemplateObj[];
|
|
174
|
-
materializedThrough?: Date | string | null;
|
|
175
|
-
active: boolean;
|
|
176
|
-
createdByAccountId?: ScheduleId | null;
|
|
177
|
-
deletedAt?: Date | string | null;
|
|
178
|
-
createdAt?: Date | string;
|
|
179
|
-
updatedAt?: Date | string;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* One concrete scheduled thing. Series-generated rows carry
|
|
184
|
-
* ("seriesId", "recurrenceKey"); "detached" marks a row the user has taken
|
|
185
|
-
* ownership of, which regeneration never overwrites or deletes.
|
|
186
|
-
*/
|
|
187
|
-
|
|
188
|
-
export interface ScheduleOccurrenceData {
|
|
189
|
-
__table?: string;
|
|
190
|
-
id: ScheduleId;
|
|
191
|
-
organizationId: ScheduleId;
|
|
192
|
-
calendarId: ScheduleId;
|
|
193
|
-
seriesId?: ScheduleId | null;
|
|
194
|
-
recurrenceKey?: Date | string | null;
|
|
195
|
-
resourceId?: ScheduleId | null;
|
|
196
|
-
siteId?: ScheduleId | null;
|
|
197
|
-
kind: ScheduleOccurrenceKindEnum;
|
|
198
|
-
title: string;
|
|
199
|
-
note?: string | null;
|
|
200
|
-
location?: string | null;
|
|
201
|
-
startAt: Date | string;
|
|
202
|
-
endAt: Date | string;
|
|
203
|
-
timeZone: string;
|
|
204
|
-
allDay: boolean;
|
|
205
|
-
status: ScheduleOccurrenceStatusEnum;
|
|
206
|
-
detached: boolean;
|
|
207
|
-
version: number | bigint;
|
|
208
|
-
createdByAccountId?: ScheduleId | null;
|
|
209
|
-
publishedAt?: Date | string | null;
|
|
210
|
-
canceledAt?: Date | string | null;
|
|
211
|
-
deletedAt?: Date | string | null;
|
|
212
|
-
createdAt?: Date | string;
|
|
213
|
-
updatedAt?: Date | string;
|
|
214
|
-
// Attached by fetch paths that hydrate relations
|
|
215
|
-
slots?: ScheduleSlotData[];
|
|
216
|
-
assignments?: ScheduleAssignmentData[];
|
|
217
|
-
resource?: ScheduleResourceData | null;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* One participation record. Exactly one actor id is set and it matches
|
|
222
|
-
* "actorType". "startAt"/"endAt" are null unless the assignment covers only
|
|
223
|
-
* part of its occurrence.
|
|
224
|
-
*/
|
|
225
|
-
|
|
226
|
-
export interface ScheduleAssignmentData {
|
|
227
|
-
__table?: string;
|
|
228
|
-
id: ScheduleId;
|
|
229
|
-
organizationId: ScheduleId;
|
|
230
|
-
occurrenceId: ScheduleId;
|
|
231
|
-
slotId?: ScheduleId | null;
|
|
232
|
-
actorType: ScheduleActorTypeEnum;
|
|
233
|
-
actorAccountId?: ScheduleId | null;
|
|
234
|
-
actorOrganizationId?: ScheduleId | null;
|
|
235
|
-
actorContactId?: ScheduleId | null;
|
|
236
|
-
status: ScheduleAssignmentStatusEnum;
|
|
237
|
-
startAt?: Date | string | null;
|
|
238
|
-
endAt?: Date | string | null;
|
|
239
|
-
assignedByAccountId?: ScheduleId | null;
|
|
240
|
-
releasedAt?: Date | string | null;
|
|
241
|
-
createdAt?: Date | string;
|
|
242
|
-
updatedAt?: Date | string;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* An aggregate quantity over an interval that drives derived staffing
|
|
247
|
-
* requirements. Never identifies a person.
|
|
248
|
-
*/
|
|
249
|
-
|
|
250
|
-
export interface ScheduleDemandData {
|
|
251
|
-
__table?: string;
|
|
252
|
-
id: ScheduleId;
|
|
253
|
-
organizationId: ScheduleId;
|
|
254
|
-
resourceId?: ScheduleId | null;
|
|
255
|
-
category: string;
|
|
256
|
-
startAt: Date | string;
|
|
257
|
-
endAt: Date | string;
|
|
258
|
-
quantity: number;
|
|
259
|
-
source: ScheduleDemandSourceEnum;
|
|
260
|
-
createdByAccountId?: ScheduleId | null;
|
|
261
|
-
createdAt?: Date | string;
|
|
262
|
-
updatedAt?: Date | string;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* One constraint rule. Resolution precedence is most-specific-wins:
|
|
267
|
-
* resource > calendar > organization > operation default.
|
|
268
|
-
*/
|
|
269
|
-
|
|
270
|
-
export interface ScheduleRuleData {
|
|
271
|
-
__table?: string;
|
|
272
|
-
id: ScheduleId;
|
|
273
|
-
operationTypeId?: ScheduleId | null;
|
|
274
|
-
organizationId?: ScheduleId | null;
|
|
275
|
-
calendarId?: ScheduleId | null;
|
|
276
|
-
resourceId?: ScheduleId | null;
|
|
277
|
-
kind: ScheduleRuleKindEnum;
|
|
278
|
-
label?: string | null;
|
|
279
|
-
// Which rule template this was built from, if any; a hand-written rule has
|
|
280
|
-
// none and renders with the generic message for its kind
|
|
281
|
-
templateKey?: string | null;
|
|
282
|
-
config: Record<string, unknown>;
|
|
283
|
-
severity: ScheduleRuleSeverityEnum;
|
|
284
|
-
effectiveFrom?: Date | string | null;
|
|
285
|
-
effectiveTo?: Date | string | null;
|
|
286
|
-
ordinal: number;
|
|
287
|
-
version: number | bigint;
|
|
288
|
-
retiredAt?: Date | string | null;
|
|
289
|
-
createdAt?: Date | string;
|
|
290
|
-
updatedAt?: Date | string;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* One rule template: the wording and defaults an organization sees behind a
|
|
295
|
-
* rule kind. Resolution is organization -> operation type -> platform default,
|
|
296
|
-
* so a vertical can be given its own language without a schema change.
|
|
297
|
-
*/
|
|
298
|
-
|
|
299
|
-
export interface ScheduleRuleTemplateObj {
|
|
300
|
-
kind: string;
|
|
301
|
-
key: string;
|
|
302
|
-
label: string;
|
|
303
|
-
description: string | null;
|
|
304
|
-
// "{token}" placeholders filled from a violation's detail object
|
|
305
|
-
messageTemplate: string;
|
|
306
|
-
defaultConfig: Record<string, unknown> | null;
|
|
307
|
-
defaultSeverity: string;
|
|
308
|
-
ordinal: number;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
export interface ScheduleRuleTemplateData extends ScheduleRuleTemplateObj {
|
|
312
|
-
__table?: string;
|
|
313
|
-
id: ScheduleId;
|
|
314
|
-
operationTypeId?: ScheduleId | null;
|
|
315
|
-
organizationId?: ScheduleId | null;
|
|
316
|
-
retiredAt?: Date | string | null;
|
|
317
|
-
createdAt?: Date | string;
|
|
318
|
-
updatedAt?: Date | string;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
export interface ScheduleEvaluationData {
|
|
322
|
-
__table?: string;
|
|
323
|
-
id: ScheduleId;
|
|
324
|
-
organizationId: ScheduleId;
|
|
325
|
-
calendarId: ScheduleId;
|
|
326
|
-
windowStart: Date | string;
|
|
327
|
-
windowEnd: Date | string;
|
|
328
|
-
inputHash?: string | null;
|
|
329
|
-
status: ScheduleEvaluationStatusEnum;
|
|
330
|
-
segmentCount: number;
|
|
331
|
-
violationCount: number;
|
|
332
|
-
errorMessage?: string | null;
|
|
333
|
-
startedAt: Date | string;
|
|
334
|
-
finishedAt?: Date | string | null;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
export interface ScheduleViolationData {
|
|
338
|
-
__table?: string;
|
|
339
|
-
id: ScheduleId;
|
|
340
|
-
organizationId: ScheduleId;
|
|
341
|
-
calendarId: ScheduleId;
|
|
342
|
-
evaluationId: ScheduleId;
|
|
343
|
-
ruleId?: ScheduleId | null;
|
|
344
|
-
kind: ScheduleRuleKindEnum;
|
|
345
|
-
severity: ScheduleRuleSeverityEnum;
|
|
346
|
-
resourceId?: ScheduleId | null;
|
|
347
|
-
occurrenceId?: ScheduleId | null;
|
|
348
|
-
actorAccountId?: ScheduleId | null;
|
|
349
|
-
segmentStart: Date | string;
|
|
350
|
-
segmentEnd: Date | string;
|
|
351
|
-
detail: Record<string, unknown>;
|
|
352
|
-
acknowledgedByAccountId?: ScheduleId | null;
|
|
353
|
-
acknowledgedAt?: Date | string | null;
|
|
354
|
-
createdAt?: Date | string;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
export interface ScheduleRequestData {
|
|
358
|
-
__table?: string;
|
|
359
|
-
id: ScheduleId;
|
|
360
|
-
organizationId: ScheduleId;
|
|
361
|
-
calendarId: ScheduleId;
|
|
362
|
-
kind: ScheduleRequestKindEnum;
|
|
363
|
-
status: ScheduleRequestStatusEnum;
|
|
364
|
-
requesterAccountId: ScheduleId;
|
|
365
|
-
sourceAssignmentId?: ScheduleId | null;
|
|
366
|
-
targetAssignmentId?: ScheduleId | null;
|
|
367
|
-
targetOccurrenceId?: ScheduleId | null;
|
|
368
|
-
claimedByAccountId?: ScheduleId | null;
|
|
369
|
-
startAt?: Date | string | null;
|
|
370
|
-
endAt?: Date | string | null;
|
|
371
|
-
reason?: string | null;
|
|
372
|
-
autoApproved: boolean;
|
|
373
|
-
decidedByAccountId?: ScheduleId | null;
|
|
374
|
-
decidedAt?: Date | string | null;
|
|
375
|
-
decisionNote?: string | null;
|
|
376
|
-
expiresAt?: Date | string | null;
|
|
377
|
-
createdAt?: Date | string;
|
|
378
|
-
updatedAt?: Date | string;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* One expanded instance produced by the recurrence expander, before it is
|
|
383
|
-
* written as an occurrence row. "recurrenceKey" is the instant the rule
|
|
384
|
-
* produced and never changes, even when the instance is later moved.
|
|
385
|
-
*/
|
|
386
|
-
|
|
387
|
-
export interface ScheduleExpandedInstance {
|
|
388
|
-
recurrenceKey: Date;
|
|
389
|
-
startAt: Date;
|
|
390
|
-
endAt: Date;
|
|
391
|
-
}
|
package/src/utils/agentDoc.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { AGENT_DOC_SURFACE_ENUMS } from '../constants/agentDoc.ts';
|
|
2
|
-
import type {
|
|
3
|
-
AgentDocSettingsObj,
|
|
4
|
-
AgentDocSurfaceEnum,
|
|
5
|
-
} from '../types/agentDoc.d.ts';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Check whether one value is a valid agent doc surface.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export function isValidAgentDocSurface(
|
|
12
|
-
value: unknown,
|
|
13
|
-
): value is AgentDocSurfaceEnum {
|
|
14
|
-
return AGENT_DOC_SURFACE_ENUMS.includes(value as AgentDocSurfaceEnum);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Sanitize one agent doc settings object into the closed vocabulary stored
|
|
19
|
-
* in the agent_docs "settings" JSONB. Unknown keys are dropped, booleans are
|
|
20
|
-
* coerced strictly (only literal true is kept, so absent and false collapse
|
|
21
|
-
* to the same default), surfaces are validated and deduplicated, and
|
|
22
|
-
* "reviewBy" must be a parseable date string.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
export function sanitizeAgentDocSettings(
|
|
26
|
-
settings?: Partial<AgentDocSettingsObj> | null,
|
|
27
|
-
): AgentDocSettingsObj {
|
|
28
|
-
const sanitized: AgentDocSettingsObj = {};
|
|
29
|
-
|
|
30
|
-
if (settings?.aiCannotEdit === true) {
|
|
31
|
-
sanitized.aiCannotEdit = true;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (settings?.aiCannotRead === true) {
|
|
35
|
-
sanitized.aiCannotRead = true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (settings?.pinned === true) {
|
|
39
|
-
sanitized.pinned = true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (Array.isArray(settings?.hiddenSurfaces)) {
|
|
43
|
-
const surfaces = [
|
|
44
|
-
...new Set(settings.hiddenSurfaces.filter(isValidAgentDocSurface)),
|
|
45
|
-
];
|
|
46
|
-
if (surfaces.length) {
|
|
47
|
-
sanitized.hiddenSurfaces = surfaces;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
typeof settings?.reviewBy === 'string' &&
|
|
53
|
-
settings.reviewBy &&
|
|
54
|
-
!isNaN(Date.parse(settings.reviewBy))
|
|
55
|
-
) {
|
|
56
|
-
sanitized.reviewBy = settings.reviewBy;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return sanitized;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Check whether agents on one surface may read one agent doc.
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
export function isAgentDocReadableBySurface(
|
|
67
|
-
settings: AgentDocSettingsObj | null | undefined,
|
|
68
|
-
surface: AgentDocSurfaceEnum,
|
|
69
|
-
): boolean {
|
|
70
|
-
if (settings?.aiCannotRead) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
return !settings?.hiddenSurfaces?.includes(surface);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Check whether agents on one surface may modify one agent doc. An
|
|
78
|
-
* unreadable document is never writable.
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
export function isAgentDocWritableByAgent(
|
|
82
|
-
settings: AgentDocSettingsObj | null | undefined,
|
|
83
|
-
surface: AgentDocSurfaceEnum,
|
|
84
|
-
): boolean {
|
|
85
|
-
if (settings?.aiCannotEdit) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
return isAgentDocReadableBySurface(settings, surface);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Check whether one agent doc is past its review date. Stale documents stay
|
|
93
|
-
* readable; agent tools annotate them so the model verifies with a human
|
|
94
|
-
* instead of silently trusting outdated rules.
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
export function isAgentDocStale(
|
|
98
|
-
settings: AgentDocSettingsObj | null | undefined,
|
|
99
|
-
now: Date | number = Date.now(),
|
|
100
|
-
): boolean {
|
|
101
|
-
if (!settings?.reviewBy) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
const reviewBy = Date.parse(settings.reviewBy);
|
|
105
|
-
return (
|
|
106
|
-
!isNaN(reviewBy) &&
|
|
107
|
-
reviewBy < (typeof now === 'number' ? now : now.getTime())
|
|
108
|
-
);
|
|
109
|
-
}
|