@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,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note document ("noteDoc") constants, shared by the Deno server sanitizer
|
|
3
|
+
* and the web note editor. A note's content is one ProseMirror-shaped JSON
|
|
4
|
+
* tree restricted to the closed node/mark vocabulary declared here; anything
|
|
5
|
+
* outside this vocabulary is removed by sanitizeNoteDoc on every write.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { COLORS } from '@jsb188/app/constants/app.ts';
|
|
9
|
+
|
|
10
|
+
// Stamped on every sanitized document; bump only with a migration path
|
|
11
|
+
export const NOTE_DOC_VERSION = 1;
|
|
12
|
+
|
|
13
|
+
// Every block-level node type a note document may contain
|
|
14
|
+
export const NOTE_BLOCK_TYPES = [
|
|
15
|
+
'paragraph',
|
|
16
|
+
'heading',
|
|
17
|
+
'bulletList',
|
|
18
|
+
'orderedList',
|
|
19
|
+
'listItem',
|
|
20
|
+
'blockquote',
|
|
21
|
+
'divider',
|
|
22
|
+
'image',
|
|
23
|
+
] as const;
|
|
24
|
+
|
|
25
|
+
// Every inline node type a text-bearing block may contain
|
|
26
|
+
export const NOTE_INLINE_TYPES = ['text', 'hardBreak'] as const;
|
|
27
|
+
|
|
28
|
+
// Every inline mark type a text run may carry
|
|
29
|
+
export const NOTE_MARK_TYPES = [
|
|
30
|
+
'bold',
|
|
31
|
+
'italic',
|
|
32
|
+
'underline',
|
|
33
|
+
'strike',
|
|
34
|
+
'code',
|
|
35
|
+
'color',
|
|
36
|
+
'highlight',
|
|
37
|
+
'link',
|
|
38
|
+
] as const;
|
|
39
|
+
|
|
40
|
+
// Block types that contain other blocks; every other block type is either
|
|
41
|
+
// an inline-content leaf (paragraph, heading) or a void leaf (divider, image)
|
|
42
|
+
export const NOTE_CONTAINER_BLOCK_TYPES = [
|
|
43
|
+
'bulletList',
|
|
44
|
+
'orderedList',
|
|
45
|
+
'listItem',
|
|
46
|
+
'blockquote',
|
|
47
|
+
] as const;
|
|
48
|
+
|
|
49
|
+
// Which block types each container allows as direct children; the sanitizer
|
|
50
|
+
// unwraps/converts/wraps anything else (it never keeps illegal nesting)
|
|
51
|
+
export const NOTE_NESTING_RULES: Record<string, readonly string[]> = {
|
|
52
|
+
doc: [
|
|
53
|
+
'paragraph',
|
|
54
|
+
'heading',
|
|
55
|
+
'bulletList',
|
|
56
|
+
'orderedList',
|
|
57
|
+
'blockquote',
|
|
58
|
+
'divider',
|
|
59
|
+
'image',
|
|
60
|
+
],
|
|
61
|
+
bulletList: ['listItem'],
|
|
62
|
+
orderedList: ['listItem'],
|
|
63
|
+
listItem: ['paragraph', 'bulletList', 'orderedList'],
|
|
64
|
+
blockquote: ['paragraph'],
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Valid tokens for color/highlight marks: the shared 21-color app palette
|
|
68
|
+
export const NOTE_COLOR_TOKENS: readonly string[] = COLORS;
|
|
69
|
+
|
|
70
|
+
// Sanitizer caps against oversized/hostile documents; the sanitizer
|
|
71
|
+
// truncates the tail once a cap is reached
|
|
72
|
+
export const NOTE_MAX_DEPTH = 6;
|
|
73
|
+
export const NOTE_MAX_BLOCKS = 2000;
|
|
74
|
+
export const NOTE_MAX_TEXT_CHARS = 200000;
|
|
75
|
+
|
|
76
|
+
// link mark hrefs must match this (kills javascript:/data:/etc URLs)
|
|
77
|
+
export const NOTE_LINK_HREF_REGEX = /^(https?:|mailto:)/i;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Organization constants
|
|
2
|
+
// IMPORTANT NOTE: Array order must *never* change, indexes are used to create PDF URLs
|
|
3
|
+
|
|
4
|
+
export const OPERATION_ENUMS = [
|
|
5
|
+
// Farms
|
|
6
|
+
'ARABLE',
|
|
7
|
+
|
|
8
|
+
// Umbrella orgs
|
|
9
|
+
'FARMERS_MARKET',
|
|
10
|
+
'GROWER_NETWORK',
|
|
11
|
+
|
|
12
|
+
// External orgs
|
|
13
|
+
'RESTAURANT',
|
|
14
|
+
'VENDOR',
|
|
15
|
+
'WHOLESALE_FOOD',
|
|
16
|
+
'UNKNOWN',
|
|
17
|
+
|
|
18
|
+
// Project-scheduled operations (appended; see note above)
|
|
19
|
+
'CONSTRUCTION',
|
|
20
|
+
'UTILITIES',
|
|
21
|
+
'CHILDCARE',
|
|
22
|
+
|
|
23
|
+
// Registry-logged operations (appended; see note above)
|
|
24
|
+
'CONSTRUCTION_INSPECTION_AGENCY',
|
|
25
|
+
'EMERGENCY_MEDICAL_SERVICES_AGENCY',
|
|
26
|
+
'FOOD_MANUFACTURING',
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export const PARENT_ORG_OPERATIONS = ['FARMERS_MARKET', 'GROWER_NETWORK'];
|
|
30
|
+
|
|
31
|
+
export const AUDITOR_ORG_OPERATIONS = ['GROWER_NETWORK'];
|
|
32
|
+
|
|
33
|
+
// Membership roles
|
|
34
|
+
// Order of roles matter (for visualization)
|
|
35
|
+
// second item is default value
|
|
36
|
+
|
|
37
|
+
export const ROLE_ENUMS = ['GUEST', 'MEMBER', 'MANAGER', 'ADMIN', 'OWNER'];
|
|
38
|
+
|
|
39
|
+
// Role categories (used for reminders)
|
|
40
|
+
|
|
41
|
+
export const ROLE_CATEGORY_ENUMS = ['EMPLOYEES_ONLY', 'MANAGERS_ONLY'];
|
|
42
|
+
|
|
43
|
+
// Org departments
|
|
44
|
+
|
|
45
|
+
export const ORG_CONTACTS = ['PRIMARY_CONTACT', 'ACCOUNTS_RECEIVABLE', 'SALES', 'CUSTOMER_SERVICE', 'SHIPPING_RECEIVING', 'OTHER'];
|
|
46
|
+
|
|
47
|
+
// Compliance
|
|
48
|
+
|
|
49
|
+
export const COMPLIANCE_DOCUMENT_TYPE_MAP = {
|
|
50
|
+
'Organic Certificate': 'ORGANIC',
|
|
51
|
+
'Insurance Policy/Insurance Certificate': 'INSURANCE',
|
|
52
|
+
"Producer's Certificate": 'PRODUCERS_CERTIFICATE',
|
|
53
|
+
'Milk Handler License': 'MILK_HANDLER_LICENSE',
|
|
54
|
+
'Egg Handler License': 'EGG_HANDLER_LICENSE',
|
|
55
|
+
'Nursery License': 'NURSERY_LICENSE',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const COMPLIANCE_DOCUMENT_TYPE_ENUMS = Object.values(COMPLIANCE_DOCUMENT_TYPE_MAP);
|
|
59
|
+
|
|
60
|
+
export const COMPLIANCE_DOCUMENT_TYPE_LABELS = Object.keys(COMPLIANCE_DOCUMENT_TYPE_MAP);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Custom organization page route constants
|
|
2
|
+
|
|
3
|
+
// Queries that a custom page route can use as its data source
|
|
4
|
+
export const PAGE_ROUTE_QUERY_ENUMS = ['LOG_ENTRIES', 'CHILD_ORGANIZATIONS'];
|
|
5
|
+
|
|
6
|
+
// Slugs that can never be used for custom page routes (single-character slugs are always rejected)
|
|
7
|
+
export const PAGE_ROUTE_RESERVED_SLUGS = [
|
|
8
|
+
'workspaces',
|
|
9
|
+
'workspace',
|
|
10
|
+
'grids',
|
|
11
|
+
'grid',
|
|
12
|
+
'tables',
|
|
13
|
+
'table',
|
|
14
|
+
'workflows',
|
|
15
|
+
'workflow',
|
|
16
|
+
'billing',
|
|
17
|
+
'inbox',
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export const PAGE_ROUTE_SLUG_MIN_LENGTH = 2;
|
|
21
|
+
export const PAGE_ROUTE_SLUG_MAX_LENGTH = 40;
|
|
22
|
+
export const PAGE_ROUTE_MAX_COLUMNS = 30;
|
|
23
|
+
export const PAGE_ROUTE_ICON_NAME_MAX_LENGTH = 80;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const QR_CODE_LIMITS = {
|
|
2
|
+
maxTextBytes: 2_000,
|
|
3
|
+
nameLength: 120,
|
|
4
|
+
publicIdBytes: 16,
|
|
5
|
+
maxFields: 50,
|
|
6
|
+
fieldKeyLength: 80,
|
|
7
|
+
fieldDescriptionLength: 120,
|
|
8
|
+
fieldValueLength: 255,
|
|
9
|
+
displayNameLength: 120,
|
|
10
|
+
referenceIdLength: 40,
|
|
11
|
+
// Bounds for external scanned JSON envelopes, not editable QR field values.
|
|
12
|
+
maxJSONDepth: 16,
|
|
13
|
+
maxJSONNodes: 2_000,
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export const QR_CODE_PAYLOAD_VERSION = 3 as const;
|
|
17
|
+
|
|
18
|
+
export const QR_CODE_REFERENCE_TYPES = ['ORGANIZATION_SITE', 'CHILD_ORGANIZATION'] as const;
|
|
19
|
+
|
|
20
|
+
export const QR_CODE_REFERENCE_ID_PREFIXES = {
|
|
21
|
+
ORGANIZATION_SITE: 'site',
|
|
22
|
+
CHILD_ORGANIZATION: 'org',
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
export const QR_CODE_APP_FIELD_REFERENCE_TYPES = {
|
|
26
|
+
siteLocation: 'ORGANIZATION_SITE',
|
|
27
|
+
childOrg: 'CHILD_ORGANIZATION',
|
|
28
|
+
} as const;
|
|
29
|
+
|
|
30
|
+
export const QR_CODE_RENDER_OPTIONS = { errorCorrectionLevel: 'M', margin: 4 } as const;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export const SHEET_CELL_TEXT_WRAP_ENUMS = ['OVERFLOW', 'WRAP', 'CLIP'] as const;
|
|
2
|
+
|
|
3
|
+
export const SHEET_CELL_TEXT_ALIGN_ENUMS = ['LEFT', 'CENTER', 'RIGHT'] as const;
|
|
4
|
+
|
|
5
|
+
export const SHEET_CELL_VERTICAL_ALIGN_ENUMS = ['TOP', 'MIDDLE', 'BOTTOM'] as const;
|
|
6
|
+
|
|
7
|
+
export const SHEET_STRUCTURE_OPERATION_ENUMS = ['INSERT_ROW_ABOVE', 'INSERT_COLUMN_LEFT', 'DELETE_ROW', 'DELETE_COLUMN'] as const;
|
|
8
|
+
|
|
9
|
+
export const SHEET_CELL_VALUE_TYPE_ENUMS = ['CELL_INT', 'CELL_FLOAT', 'CELL_DATE', 'CELL_BOOLEAN', 'CELL_TEXT'] as const;
|
|
10
|
+
|
|
11
|
+
export const SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS = [
|
|
12
|
+
'AUTOMATIC',
|
|
13
|
+
'TEXT',
|
|
14
|
+
'NUMBER',
|
|
15
|
+
'PERCENT',
|
|
16
|
+
'SCIENTIFIC',
|
|
17
|
+
'ACCOUNTING',
|
|
18
|
+
'FINANCIAL',
|
|
19
|
+
'CURRENCY',
|
|
20
|
+
'CURRENCY_ROUNDED',
|
|
21
|
+
'DATE',
|
|
22
|
+
'TIME',
|
|
23
|
+
'DATE_TIME',
|
|
24
|
+
'DURATION',
|
|
25
|
+
'CUSTOM',
|
|
26
|
+
] as const;
|
|
27
|
+
|
|
28
|
+
// Canonical Google-Sheets-style pattern per preset number format type; null
|
|
29
|
+
// types render raw (AUTOMATIC) or require an explicit saved pattern (CUSTOM).
|
|
30
|
+
// The "$" literal is substituted with the locale currency symbol at resolve time.
|
|
31
|
+
export const SHEET_NUMBER_FORMAT_PRESET_PATTERNS: Record<(typeof SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS)[number], string | null> = {
|
|
32
|
+
AUTOMATIC: null,
|
|
33
|
+
TEXT: '@',
|
|
34
|
+
NUMBER: '#,##0.00',
|
|
35
|
+
PERCENT: '0.00%',
|
|
36
|
+
SCIENTIFIC: '0.00E+00',
|
|
37
|
+
ACCOUNTING: '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',
|
|
38
|
+
FINANCIAL: '#,##0.00;(#,##0.00)',
|
|
39
|
+
CURRENCY: '"$"#,##0.00',
|
|
40
|
+
CURRENCY_ROUNDED: '"$"#,##0',
|
|
41
|
+
DATE: 'm/d/yyyy',
|
|
42
|
+
TIME: 'h:mm:ss AM/PM',
|
|
43
|
+
DATE_TIME: 'm/d/yyyy h:mm:ss',
|
|
44
|
+
DURATION: '[h]:mm:ss',
|
|
45
|
+
CUSTOM: null,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const GRID_ITEM_SORT_ENUMS = ['UPDATED_AT_DESC', 'TITLE_ASC'] as const;
|
|
49
|
+
|
|
50
|
+
export const SHEET_EXPORT_FORMAT_ENUMS = ['CSV', 'TSV', 'XLSX', 'PDF'] as const;
|
|
51
|
+
|
|
52
|
+
// Journaled sheet_tab_changes row kinds, in the order of the table's CHECK
|
|
53
|
+
// constraint. CELLS rows carry cell images, COMPUTED rows carry
|
|
54
|
+
// derived write-backs (computed fields only); every other kind is a
|
|
55
|
+
// presentation/structure row applied by its own payload shape.
|
|
56
|
+
export const SHEET_TAB_CHANGE_KIND_ENUMS = ['CELLS', 'COMPUTED', 'STRUCTURE', 'DESIGN'] as const;
|
|
57
|
+
|
|
58
|
+
export const GRID_ITEM_LIST_LIMIT = 1000;
|
|
59
|
+
export const SHEET_MAX_ROW_COUNT = 500;
|
|
60
|
+
// Largest column count a sheet can reach today: the server import parser caps
|
|
61
|
+
// imported worksheets at 256 columns (sheetOps-import-parse.ts maxColumns must
|
|
62
|
+
// stay in sync with this)
|
|
63
|
+
export const SHEET_MAX_COLUMN_COUNT = 256;
|
|
64
|
+
|
|
65
|
+
export const SHEET_DEFAULT_ROW_COUNT = SHEET_MAX_ROW_COUNT;
|
|
66
|
+
export const SHEET_DEFAULT_COLUMN_COUNT = 26;
|
|
67
|
+
// Viewport clamps must cover the full sheet caps: the client fetches the whole
|
|
68
|
+
// sheet in one sheetView query and never refetches while scrolling, so any
|
|
69
|
+
// clamp below the sheet caps renders the overflow rows/columns permanently
|
|
70
|
+
// blank (rows 401-500 were blank when this was 400)
|
|
71
|
+
export const SHEET_VIEWPORT_MAX_ROWS = SHEET_MAX_ROW_COUNT;
|
|
72
|
+
export const SHEET_VIEWPORT_MAX_COLUMNS = SHEET_MAX_COLUMN_COUNT;
|
|
73
|
+
export const SHEET_DEFAULT_COLUMN_WIDTH = 160;
|
|
74
|
+
|
|
75
|
+
// Maximum UTF-16 length stored or relayed for one editable Sheet cell value.
|
|
76
|
+
export const SHEET_CELL_TEXT_MAX_CHARS = 10_000;
|
|
77
|
+
|
|
78
|
+
// Maximum UTF-16 length stored or relayed for one Sheet cell note.
|
|
79
|
+
export const SHEET_CELL_NOTE_MAX_CHARS = 2_000;
|
|
80
|
+
|
|
81
|
+
// Hard cap for one complete Sheet realtime event encoded as UTF-8 JSON.
|
|
82
|
+
export const SHEET_REALTIME_RELAY_MAX_BYTES = 64 * 1024;
|
|
83
|
+
|
|
84
|
+
// One durable command read set stays bounded identically across browser,
|
|
85
|
+
// IndexedDB, GraphQL, REST beacon, and server transaction validation.
|
|
86
|
+
export const SHEET_COMMAND_PRECONDITION_MAX_SHEET_CELLS = 10_000;
|
|
87
|
+
|
|
88
|
+
// Version 5 accepts ordinary spreadsheet references and builtins. Stored ASTs
|
|
89
|
+
// from older versions must be recompiled from their authored formula text.
|
|
90
|
+
export const SHEET_FORMULA_LANGUAGE_VERSION = 5;
|
|
91
|
+
export const SHEET_FORMULA_MIN_STORED_AST_VERSION = 5;
|
|
92
|
+
|
|
93
|
+
// Builtins that also accept the legacy '@name(...)' spelling. Newer builtins
|
|
94
|
+
// never do, so '@index(...)', '@text(...)' and similar are unknown functions
|
|
95
|
+
export const SHEET_FORMULA_AT_PREFIX_BUILTIN_FUNCTION_NAMES = [
|
|
96
|
+
'ABS',
|
|
97
|
+
'AVERAGE',
|
|
98
|
+
'CEILING',
|
|
99
|
+
'COUNT',
|
|
100
|
+
'COUNTA',
|
|
101
|
+
'DATE',
|
|
102
|
+
'DAY',
|
|
103
|
+
'FLOOR',
|
|
104
|
+
'IF',
|
|
105
|
+
'IFERROR',
|
|
106
|
+
'IFNA',
|
|
107
|
+
'INCLUDES',
|
|
108
|
+
'MAX',
|
|
109
|
+
'MIN',
|
|
110
|
+
'MOD',
|
|
111
|
+
'MONTH',
|
|
112
|
+
'NOW',
|
|
113
|
+
'POWER',
|
|
114
|
+
'ROUND',
|
|
115
|
+
'ROUNDDOWN',
|
|
116
|
+
'ROUNDUP',
|
|
117
|
+
'REGEXMATCH',
|
|
118
|
+
'SUM',
|
|
119
|
+
'TODAY',
|
|
120
|
+
'YEAR',
|
|
121
|
+
] as const;
|
|
122
|
+
|
|
123
|
+
// Display tokens for formula error codes (Excel/Sheets spelling). Codes that
|
|
124
|
+
// are not listed display the generic '#ERROR!' token.
|
|
125
|
+
export const SHEET_FORMULA_ERROR_DISPLAY_BY_CODE: Readonly<Record<string, string>> = {
|
|
126
|
+
DIVIDE_BY_ZERO: '#DIV/0!',
|
|
127
|
+
INVALID_NUMBER: '#NUM!',
|
|
128
|
+
INVALID_REFERENCE: '#REF!',
|
|
129
|
+
INVALID_VALUE: '#VALUE!',
|
|
130
|
+
NOT_FOUND: '#N/A',
|
|
131
|
+
};
|
|
132
|
+
export const SHEET_FORMULA_ERROR_FALLBACK_DISPLAY = '#ERROR!';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported outbound SMS providers.
|
|
3
|
+
*/
|
|
4
|
+
export const SMS_PROVIDER_ENUMS = ['TWILIO', 'TELNYX'] as const;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Durable outbound SMS lifecycle statuses.
|
|
8
|
+
*/
|
|
9
|
+
export const SMS_OUTBOUND_STATUS_ENUMS = [
|
|
10
|
+
'QUEUED',
|
|
11
|
+
'PROCESSING',
|
|
12
|
+
'SENT',
|
|
13
|
+
'DELIVERED',
|
|
14
|
+
'FAILED',
|
|
15
|
+
'DELIVERY_UNKNOWN',
|
|
16
|
+
'BOUNCED',
|
|
17
|
+
'BLOCKED',
|
|
18
|
+
] as const;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IntegrationConnectionStatusEnum } from './integration.ts';
|
|
2
|
+
import { INTEGRATION_CONNECTION_STATUSES } from './integration.ts';
|
|
3
|
+
|
|
4
|
+
export const SQUARE_OAUTH_SCOPES = [
|
|
5
|
+
'MERCHANT_PROFILE_READ',
|
|
6
|
+
'PAYMENTS_READ',
|
|
7
|
+
'ORDERS_READ',
|
|
8
|
+
'ORDERS_WRITE',
|
|
9
|
+
'PAYMENTS_WRITE',
|
|
10
|
+
] as const;
|
|
11
|
+
|
|
12
|
+
export type SquareOAuthScope = (typeof SQUARE_OAUTH_SCOPES)[number];
|
|
13
|
+
|
|
14
|
+
export const SQUARE_CONNECTION_STATUSES = INTEGRATION_CONNECTION_STATUSES;
|
|
15
|
+
|
|
16
|
+
export type SquareConnectionStatusEnum = IntegrationConnectionStatusEnum;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// The storage_intents DB enum keeps retired labels; code never writes them.
|
|
2
|
+
export const STORAGE_INTENT_ENUMS = [
|
|
3
|
+
'CAMPAIGN_HEADER_IMAGE',
|
|
4
|
+
'CAMPAIGN_ELEMENT_IMAGE',
|
|
5
|
+
'CREATE_COMPLIANCE_DOCUMENT',
|
|
6
|
+
'IMPORT_SHEET_FILE',
|
|
7
|
+
'EXPORT_SHEET_FILE',
|
|
8
|
+
'AI_CHAT_FILE',
|
|
9
|
+
'CAMPAIGN_GENERATION_FILE',
|
|
10
|
+
'CAMPAIGN_TEMPLATE_PREVIEW',
|
|
11
|
+
'AI_GENERATED_FILE',
|
|
12
|
+
'LOG_FILE',
|
|
13
|
+
'UNUSED',
|
|
14
|
+
'STATIC',
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
// Public form header images are resized by the asset route before display.
|
|
18
|
+
export const CAMPAIGN_HEADER_IMAGE_CONTENT_TYPES = ['image/jpeg', 'image/png', 'image/webp'] as const;
|
|
19
|
+
|
|
20
|
+
export const CAMPAIGN_HEADER_IMAGE_MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
21
|
+
|
|
22
|
+
// Email/form content images may retain animation and use any browser image MIME.
|
|
23
|
+
export const CAMPAIGN_ELEMENT_IMAGE_MAX_FILE_SIZE = 20 * 1024 * 1024;
|
|
24
|
+
|
|
25
|
+
// How long AI-generated files (CSV exports) stay downloadable before the
|
|
26
|
+
// daily cron reaps the GCS object; storage_generated rows stay as history
|
|
27
|
+
export const GENERATED_FILE_RETENTION_DAYS = 180;
|
|
28
|
+
|
|
29
|
+
// Who may list/download a generated file inside its organization: everyone
|
|
30
|
+
// with generated-files access, or only the account that requested it
|
|
31
|
+
export const GENERATED_FILE_VISIBILITY_ENUMS = ['ORGANIZATION', 'REQUESTER'] as const;
|
|
32
|
+
|
|
33
|
+
// How many times one minted download link (web or SMS) may be redeemed
|
|
34
|
+
// before it stops serving bytes; expiry ends a link regardless of uses
|
|
35
|
+
export const GENERATED_FILE_DOWNLOAD_MAX_USES = 3;
|
|
36
|
+
|
|
37
|
+
// Maximum number of files that can be attached to a single AI chat message
|
|
38
|
+
export const MAX_AI_CHAT_ATTACHMENTS = 5;
|
|
39
|
+
|
|
40
|
+
// Maximum number of source files accepted by one public-form generation
|
|
41
|
+
export const MAX_PUBLIC_FORM_GENERATION_FILES = 10;
|
|
42
|
+
|
|
43
|
+
// File extensions the AI chat composer accepts. Images/documents become model files;
|
|
44
|
+
// audio/video use the shared media decoder before entering model context.
|
|
45
|
+
export const AI_CHAT_FILE_EXTENSIONS = [
|
|
46
|
+
// Images (input_image)
|
|
47
|
+
'gif',
|
|
48
|
+
'jpeg',
|
|
49
|
+
'jpg',
|
|
50
|
+
'png',
|
|
51
|
+
'webp',
|
|
52
|
+
// Documents (input_file)
|
|
53
|
+
'csv',
|
|
54
|
+
'doc',
|
|
55
|
+
'docx',
|
|
56
|
+
'md',
|
|
57
|
+
'pdf',
|
|
58
|
+
'tsv',
|
|
59
|
+
'txt',
|
|
60
|
+
'xls',
|
|
61
|
+
'xlsx',
|
|
62
|
+
// Audio recordings and videos (decoded into transcript and timestamped frames)
|
|
63
|
+
'aac',
|
|
64
|
+
'amr',
|
|
65
|
+
'flac',
|
|
66
|
+
'm4a',
|
|
67
|
+
'mp3',
|
|
68
|
+
'ogg',
|
|
69
|
+
'opus',
|
|
70
|
+
'wav',
|
|
71
|
+
'3gp',
|
|
72
|
+
'3gpp',
|
|
73
|
+
'm4v',
|
|
74
|
+
'mkv',
|
|
75
|
+
'mov',
|
|
76
|
+
'mp4',
|
|
77
|
+
'webm',
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
export const FILE_STATUS_ENUMS = [
|
|
81
|
+
'PENDING', // default value
|
|
82
|
+
'PROCESSING',
|
|
83
|
+
'COMPLETED',
|
|
84
|
+
'FAILED',
|
|
85
|
+
] as const;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Version written into every durable usage-tracking envelope and ledger row.
|
|
3
|
+
*/
|
|
4
|
+
export const USAGE_SCHEMA_VERSION = 1 as const;
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Raw quantities measured at provider boundaries. Prices and allowances are
|
|
8
|
+
* intentionally not represented in this measurement contract.
|
|
9
|
+
*/
|
|
10
|
+
export const USAGE_METERS = [
|
|
11
|
+
'SMS_OUTBOUND_MESSAGES',
|
|
12
|
+
'EMAIL_OUTBOUND_MESSAGES',
|
|
13
|
+
'AI_INPUT_TOKENS',
|
|
14
|
+
'AI_OUTPUT_TOKENS',
|
|
15
|
+
'AI_AUDIO_SECONDS',
|
|
16
|
+
'AI_MODERATION_REQUESTS',
|
|
17
|
+
] as const;
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* Product paths that can cause organization-attributed provider usage.
|
|
21
|
+
*/
|
|
22
|
+
export const USAGE_ORIGINS = [
|
|
23
|
+
'AI_CHAT',
|
|
24
|
+
'CHAT_SUMMARY',
|
|
25
|
+
'WORKFLOW',
|
|
26
|
+
'REMINDER',
|
|
27
|
+
'EMAIL_ASSISTANT',
|
|
28
|
+
'SMS_ASSISTANT',
|
|
29
|
+
'TRANSLATION',
|
|
30
|
+
'LOG_EMBEDDING',
|
|
31
|
+
'VOICE_TRANSCRIPTION',
|
|
32
|
+
'CSV_EXPORT',
|
|
33
|
+
'CAMPAIGN',
|
|
34
|
+
'FIELD_DOC',
|
|
35
|
+
'FORM_SUBMISSION',
|
|
36
|
+
'USER_ACTION',
|
|
37
|
+
'SCHEDULE',
|
|
38
|
+
'AGENT_NOTE',
|
|
39
|
+
] as const;
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* Explicit reasons why a provider call is not organization-billable usage.
|
|
43
|
+
*/
|
|
44
|
+
export const USAGE_EXCLUSION_REASONS = [
|
|
45
|
+
'AUTHENTICATION',
|
|
46
|
+
'DEVELOPMENT',
|
|
47
|
+
'PLATFORM_OPERATION',
|
|
48
|
+
] as const;
|
|
49
|
+
|
|
50
|
+
/*
|
|
51
|
+
* Provider boundaries supported by the first usage-tracking schema version.
|
|
52
|
+
*/
|
|
53
|
+
export const USAGE_PROVIDERS = [
|
|
54
|
+
'OPENAI',
|
|
55
|
+
'POSTMARK',
|
|
56
|
+
'TWILIO',
|
|
57
|
+
'TELNYX',
|
|
58
|
+
] as const;
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* Provider operation categories retained for usage reporting and rating.
|
|
62
|
+
*/
|
|
63
|
+
export const USAGE_OPERATIONS = [
|
|
64
|
+
'RESPONSE',
|
|
65
|
+
'EMBEDDING',
|
|
66
|
+
'TRANSCRIPTION',
|
|
67
|
+
'MODERATION',
|
|
68
|
+
'SMS_SEND',
|
|
69
|
+
'EMAIL_SEND',
|
|
70
|
+
] as const;
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
* Stable source identity categories used with sourceId for idempotency.
|
|
74
|
+
*/
|
|
75
|
+
export const USAGE_SOURCE_TYPES = [
|
|
76
|
+
'OPENAI_RESPONSE',
|
|
77
|
+
'OPENAI_EMBEDDING',
|
|
78
|
+
'OPENAI_TRANSCRIPTION',
|
|
79
|
+
'OPENAI_MODERATION',
|
|
80
|
+
'OUTBOUND_SMS',
|
|
81
|
+
'OUTBOUND_EMAIL',
|
|
82
|
+
] as const;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* Shared authoring limits for human-readable workflow descriptions. */
|
|
2
|
+
export const WORKFLOW_STEP_TEXT_MAX_LENGTH = 120;
|
|
3
|
+
export const WORKFLOW_STEP_ACTION_WORDS = [
|
|
4
|
+
'Add',
|
|
5
|
+
'Ask',
|
|
6
|
+
'Assign',
|
|
7
|
+
'Calculate',
|
|
8
|
+
'Check',
|
|
9
|
+
'Choose',
|
|
10
|
+
'Collect',
|
|
11
|
+
'Compare',
|
|
12
|
+
'Complete',
|
|
13
|
+
'Confirm',
|
|
14
|
+
'Contact',
|
|
15
|
+
'Copy',
|
|
16
|
+
'Create',
|
|
17
|
+
'Delete',
|
|
18
|
+
'Determine',
|
|
19
|
+
'Email',
|
|
20
|
+
'Evaluate',
|
|
21
|
+
'Fill',
|
|
22
|
+
'Find',
|
|
23
|
+
'Finish',
|
|
24
|
+
'Flag',
|
|
25
|
+
'Generate',
|
|
26
|
+
'Identify',
|
|
27
|
+
'Keep',
|
|
28
|
+
'Link',
|
|
29
|
+
'List',
|
|
30
|
+
'Mark',
|
|
31
|
+
'Match',
|
|
32
|
+
'Notify',
|
|
33
|
+
'Prepare',
|
|
34
|
+
'Read',
|
|
35
|
+
'Record',
|
|
36
|
+
'Remind',
|
|
37
|
+
'Remove',
|
|
38
|
+
'Report',
|
|
39
|
+
'Request',
|
|
40
|
+
'Resolve',
|
|
41
|
+
'Resend',
|
|
42
|
+
'Review',
|
|
43
|
+
'Save',
|
|
44
|
+
'Schedule',
|
|
45
|
+
'Select',
|
|
46
|
+
'Send',
|
|
47
|
+
'Set',
|
|
48
|
+
'Skip',
|
|
49
|
+
'Sort',
|
|
50
|
+
'Stop',
|
|
51
|
+
'Summarize',
|
|
52
|
+
'Track',
|
|
53
|
+
'Treat',
|
|
54
|
+
'Update',
|
|
55
|
+
'Use',
|
|
56
|
+
'Validate',
|
|
57
|
+
'Verify',
|
|
58
|
+
'Wait',
|
|
59
|
+
] as const;
|
|
60
|
+
export const WORKFLOW_STEP_TEXT_PATTERN = `^(?:${WORKFLOW_STEP_ACTION_WORDS.join('|')})\\b`;
|