@marcoappio/marco-config 4.0.16 → 4.0.17

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.
@@ -1,191 +1,170 @@
1
1
  import * as v from 'valibot';
2
2
  /* oxlint-disable eslint/sort-keys */
3
- import { appwriteColumnDefinitions, appwriteIds, appwriteRelationship, appwriteRelationshipIdSchema, canonicalTimestampSchema, defineAppwriteTable, draftStates, draftTypes, identifierSchema, mailboxAddressSchema, messageLocationCoordinateCheck, nonNegativeIntegerSchema, positiveIntegerSchema, isoTimestampSchema, } from './shared';
3
+ import { appwriteColumnDefinitions, appwriteRelationship, appwriteRelationshipIdSchema, canonicalTimestampSchema, defineAppwriteTableGroup, draftStates, draftTypes, identifierSchema, mailboxAddressSchema, messageLocationCoordinateCheck, nonNegativeIntegerSchema, positiveIntegerSchema, isoTimestampSchema, } from './shared';
4
4
  const { bigint, boolean, dateTime, enumValue, identifier, integer, longText, string: stringColumn, stringArray, text } = appwriteColumnDefinitions;
5
- export const threadAliasesTable = defineAppwriteTable({
6
- fields: {
7
- aliasAssignmentKey: identifier(identifierSchema),
8
- latestMessageAt: dateTime(isoTimestampSchema),
9
- threadAssignmentKey: identifier(identifierSchema),
10
- alias: appwriteRelationship(appwriteRelationshipIdSchema, 'aliases'),
11
- thread: appwriteRelationship(appwriteRelationshipIdSchema, 'threads'),
5
+ export const mailboxTableInputs = defineAppwriteTableGroup({
6
+ contacts: {
7
+ fields: {
8
+ normalisedAddress: stringColumn(mailboxAddressSchema, true, 320),
9
+ displayName: stringColumn(v.nullable(identifierSchema), false),
10
+ lastContactedAt: dateTime(v.nullable(isoTimestampSchema), false),
11
+ messageCount: integer(nonNegativeIntegerSchema),
12
+ profileAssignmentKey: identifier(identifierSchema),
13
+ searchText: text(v.string()),
14
+ profile: appwriteRelationship(appwriteRelationshipIdSchema, 'profiles'),
15
+ },
16
+ indexes: [
17
+ { attributes: ['profileAssignmentKey', 'lastContactedAt'], name: 'assignment_profile_last_contacted', type: 'key' },
18
+ { attributes: ['profileAssignmentKey', 'normalisedAddress'], name: 'assignment_profile_address_unique', type: 'unique' },
19
+ { attributes: ['searchText'], name: 'search', type: 'fulltext' },
20
+ ],
21
+ name: 'Contacts',
12
22
  },
13
- id: appwriteIds.tables.threadAliases,
14
- indexes: [
15
- { attributes: ['threadAssignmentKey', 'aliasAssignmentKey'], name: 'assignment_thread_alias_unique', type: 'unique' },
16
- { attributes: ['aliasAssignmentKey', 'latestMessageAt'], name: 'assignment_alias_latest', type: 'key' },
17
- ],
18
- key: 'threadAliases',
19
- name: 'Thread aliases',
20
- });
21
- export const messageLocationsTable = defineAppwriteTable({
22
- dataCheck: messageLocationCoordinateCheck,
23
- fields: {
24
- accountAssignmentKey: identifier(identifierSchema),
25
- flagged: boolean(v.boolean()),
26
- labelAssignmentKey: identifier(identifierSchema),
27
- messageAt: dateTime(isoTimestampSchema),
28
- seen: boolean(v.boolean()),
29
- threadAssignmentKey: identifier(identifierSchema),
30
- uid: bigint(v.nullable(positiveIntegerSchema), false),
31
- uidValidity: bigint(v.nullable(positiveIntegerSchema), false),
32
- account: appwriteRelationship(appwriteRelationshipIdSchema, 'accounts'),
33
- label: appwriteRelationship(appwriteRelationshipIdSchema, 'labels'),
34
- message: appwriteRelationship(appwriteRelationshipIdSchema, 'messages'),
35
- thread: appwriteRelationship(appwriteRelationshipIdSchema, 'threads'),
23
+ drafts: {
24
+ fields: {
25
+ accountAssignmentKey: identifier(identifierSchema),
26
+ type: enumValue(v.picklist(draftTypes), draftTypes),
27
+ envelope: text(v.string()),
28
+ html: longText(v.string()),
29
+ attachmentMetadata: text(v.string()),
30
+ contentHash: stringColumn(identifierSchema),
31
+ scheduledAt: dateTime(v.nullable(canonicalTimestampSchema), false),
32
+ status: enumValue(v.picklist(draftStates), draftStates),
33
+ revision: integer(nonNegativeIntegerSchema),
34
+ sequence: integer(nonNegativeIntegerSchema),
35
+ executionLeaseId: stringColumn(v.nullable(identifierSchema), false),
36
+ executionLeaseExpiresAt: dateTime(v.nullable(canonicalTimestampSchema), false),
37
+ errorCode: stringColumn(v.nullable(identifierSchema), false),
38
+ account: appwriteRelationship(appwriteRelationshipIdSchema, 'accounts'),
39
+ fromAlias: appwriteRelationship(v.nullable(appwriteRelationshipIdSchema), 'aliases', 'manyToOne', 'setNull'),
40
+ referencedMessage: appwriteRelationship(v.nullable(appwriteRelationshipIdSchema), 'messages', 'manyToOne', 'setNull'),
41
+ },
42
+ indexes: [
43
+ { attributes: ['accountAssignmentKey'], name: 'assignment_account', type: 'key' },
44
+ { attributes: ['accountAssignmentKey', 'status'], name: 'assignment_account_status', type: 'key' },
45
+ { attributes: ['scheduledAt'], name: 'scheduled', type: 'key' },
46
+ ],
47
+ name: 'Drafts',
36
48
  },
37
- id: appwriteIds.tables.messageLocations,
38
- indexes: [
39
- { attributes: ['accountAssignmentKey', 'labelAssignmentKey', 'uidValidity', 'uid'], name: 'assignment_account_label_uid', type: 'key' },
40
- { attributes: ['accountAssignmentKey', 'threadAssignmentKey'], name: 'assignment_account_thread', type: 'key' },
41
- { attributes: ['threadAssignmentKey', 'labelAssignmentKey', 'messageAt'], name: 'assignment_thread_label_latest', type: 'key' },
42
- ],
43
- key: 'messageLocations',
44
- name: 'Message locations',
45
- });
46
- export const contactsTable = defineAppwriteTable({
47
- fields: {
48
- normalisedAddress: stringColumn(mailboxAddressSchema, true, 320),
49
- displayName: stringColumn(v.nullable(identifierSchema), false),
50
- lastContactedAt: dateTime(v.nullable(isoTimestampSchema), false),
51
- messageCount: integer(nonNegativeIntegerSchema),
52
- profileAssignmentKey: identifier(identifierSchema),
53
- searchText: text(v.string()),
54
- profile: appwriteRelationship(appwriteRelationshipIdSchema, 'profiles'),
49
+ messageLocations: {
50
+ dataCheck: messageLocationCoordinateCheck,
51
+ fields: {
52
+ accountAssignmentKey: identifier(identifierSchema),
53
+ flagged: boolean(v.boolean()),
54
+ labelAssignmentKey: identifier(identifierSchema),
55
+ messageAt: dateTime(isoTimestampSchema),
56
+ seen: boolean(v.boolean()),
57
+ threadAssignmentKey: identifier(identifierSchema),
58
+ uid: bigint(v.nullable(positiveIntegerSchema), false),
59
+ uidValidity: bigint(v.nullable(positiveIntegerSchema), false),
60
+ account: appwriteRelationship(appwriteRelationshipIdSchema, 'accounts'),
61
+ label: appwriteRelationship(appwriteRelationshipIdSchema, 'labels'),
62
+ message: appwriteRelationship(appwriteRelationshipIdSchema, 'messages'),
63
+ thread: appwriteRelationship(appwriteRelationshipIdSchema, 'threads'),
64
+ },
65
+ indexes: [
66
+ { attributes: ['accountAssignmentKey', 'labelAssignmentKey', 'uidValidity', 'uid'], name: 'assignment_account_label_uid', type: 'key' },
67
+ { attributes: ['accountAssignmentKey', 'threadAssignmentKey'], name: 'assignment_account_thread', type: 'key' },
68
+ { attributes: ['threadAssignmentKey', 'labelAssignmentKey', 'messageAt'], name: 'assignment_thread_label_latest', type: 'key' },
69
+ ],
70
+ name: 'Message locations',
55
71
  },
56
- id: appwriteIds.tables.contacts,
57
- indexes: [
58
- { attributes: ['profileAssignmentKey', 'lastContactedAt'], name: 'assignment_profile_last_contacted', type: 'key' },
59
- { attributes: ['profileAssignmentKey', 'normalisedAddress'], name: 'assignment_profile_address_unique', type: 'unique' },
60
- { attributes: ['searchText'], name: 'search', type: 'fulltext' },
61
- ],
62
- key: 'contacts',
63
- name: 'Contacts',
64
- });
65
- export const draftsTable = defineAppwriteTable({
66
- fields: {
67
- accountAssignmentKey: identifier(identifierSchema),
68
- type: enumValue(v.picklist(draftTypes), draftTypes),
69
- envelope: text(v.string()),
70
- html: longText(v.string()),
71
- attachmentMetadata: text(v.string()),
72
- contentHash: stringColumn(identifierSchema),
73
- scheduledAt: dateTime(v.nullable(canonicalTimestampSchema), false),
74
- status: enumValue(v.picklist(draftStates), draftStates),
75
- revision: integer(nonNegativeIntegerSchema),
76
- sequence: integer(nonNegativeIntegerSchema),
77
- executionLeaseId: stringColumn(v.nullable(identifierSchema), false),
78
- executionLeaseExpiresAt: dateTime(v.nullable(canonicalTimestampSchema), false),
79
- errorCode: stringColumn(v.nullable(identifierSchema), false),
80
- account: appwriteRelationship(appwriteRelationshipIdSchema, 'accounts'),
81
- fromAlias: appwriteRelationship(v.nullable(appwriteRelationshipIdSchema), 'aliases', 'manyToOne', 'setNull'),
82
- referencedMessage: appwriteRelationship(v.nullable(appwriteRelationshipIdSchema), 'messages', 'manyToOne', 'setNull'),
72
+ messages: {
73
+ fields: {
74
+ accountAssignmentKey: identifier(identifierSchema),
75
+ providerId: stringColumn(identifierSchema),
76
+ rfcMessageId: stringColumn(v.nullable(identifierSchema), false),
77
+ sender: text(v.nullable(v.string()), false),
78
+ senderName: text(v.nullable(v.string()), false),
79
+ recipients: text(v.nullable(v.string()), false),
80
+ sentAt: dateTime(isoTimestampSchema),
81
+ receivedAt: dateTime(v.nullable(isoTimestampSchema), false),
82
+ preview: text(v.nullable(v.string()), false),
83
+ attachmentMetadata: longText(v.string()),
84
+ htmlFileId: stringColumn(v.nullable(identifierSchema), false),
85
+ rawFileId: stringColumn(v.nullable(identifierSchema), false),
86
+ size: integer(nonNegativeIntegerSchema),
87
+ subject: text(v.nullable(v.string()), false),
88
+ revision: integer(nonNegativeIntegerSchema),
89
+ threadAssignmentKey: identifier(identifierSchema),
90
+ account: appwriteRelationship(appwriteRelationshipIdSchema, 'accounts'),
91
+ thread: appwriteRelationship(appwriteRelationshipIdSchema, 'threads'),
92
+ },
93
+ indexes: [
94
+ { attributes: ['threadAssignmentKey', 'sentAt'], name: 'assignment_thread_sent', type: 'key' },
95
+ { attributes: ['accountAssignmentKey', 'providerId'], name: 'assignment_account_provider_unique', type: 'unique' },
96
+ { attributes: ['accountAssignmentKey', 'rfcMessageId'], name: 'assignment_account_rfc_message', type: 'key' },
97
+ ],
98
+ name: 'Messages',
83
99
  },
84
- id: appwriteIds.tables.drafts,
85
- indexes: [
86
- { attributes: ['accountAssignmentKey'], name: 'assignment_account', type: 'key' },
87
- { attributes: ['accountAssignmentKey', 'status'], name: 'assignment_account_status', type: 'key' },
88
- { attributes: ['scheduledAt'], name: 'scheduled', type: 'key' },
89
- ],
90
- key: 'drafts',
91
- name: 'Drafts',
92
- });
93
- export const threadsTable = defineAppwriteTable({
94
- fields: {
95
- accountAssignmentKey: identifier(identifierSchema),
96
- providerId: stringColumn(identifierSchema),
97
- subject: text(v.nullable(v.string()), false),
98
- firstMessageAt: dateTime(v.nullable(isoTimestampSchema), false),
99
- senderEmail: stringColumn(v.nullable(mailboxAddressSchema), false, 320),
100
- senderName: stringColumn(v.nullable(identifierSchema), false),
101
- preview: text(v.nullable(v.string()), false),
102
- participants: text(v.nullable(v.string()), false),
103
- labelIds: stringArray(v.array(identifierSchema), true, 36),
104
- latestMessageAt: dateTime(isoTimestampSchema),
105
- latestMessageId: identifier(identifierSchema),
106
- messageCount: integer(nonNegativeIntegerSchema),
107
- hasAttachments: boolean(v.boolean()),
108
- unseenLocationCount: integer(nonNegativeIntegerSchema),
109
- flaggedLocationCount: integer(nonNegativeIntegerSchema),
110
- seen: boolean(v.boolean()),
111
- flagged: boolean(v.boolean()),
112
- archived: boolean(v.boolean()),
113
- spam: boolean(v.boolean()),
114
- trashed: boolean(v.boolean()),
115
- snoozedUntil: dateTime(v.nullable(canonicalTimestampSchema), false),
116
- revision: integer(nonNegativeIntegerSchema),
117
- searchText: text(v.nullable(v.string()), false),
118
- account: appwriteRelationship(appwriteRelationshipIdSchema, 'accounts'),
100
+ threadAliases: {
101
+ fields: {
102
+ aliasAssignmentKey: identifier(identifierSchema),
103
+ latestMessageAt: dateTime(isoTimestampSchema),
104
+ threadAssignmentKey: identifier(identifierSchema),
105
+ alias: appwriteRelationship(appwriteRelationshipIdSchema, 'aliases'),
106
+ thread: appwriteRelationship(appwriteRelationshipIdSchema, 'threads'),
107
+ },
108
+ indexes: [
109
+ { attributes: ['threadAssignmentKey', 'aliasAssignmentKey'], name: 'assignment_thread_alias_unique', type: 'unique' },
110
+ { attributes: ['aliasAssignmentKey', 'latestMessageAt'], name: 'assignment_alias_latest', type: 'key' },
111
+ ],
112
+ name: 'Thread aliases',
119
113
  },
120
- id: appwriteIds.tables.threads,
121
- indexes: [
122
- { attributes: ['accountAssignmentKey', 'providerId'], name: 'assignment_account_provider_unique', type: 'unique' },
123
- { attributes: ['accountAssignmentKey', 'latestMessageAt'], name: 'assignment_account_latest', type: 'key' },
124
- { attributes: ['accountAssignmentKey', 'seen', 'latestMessageAt'], name: 'assignment_account_seen_latest', type: 'key' },
125
- { attributes: ['accountAssignmentKey', 'flagged', 'latestMessageAt'], name: 'assignment_account_flagged_latest', type: 'key' },
126
- { attributes: ['accountAssignmentKey', 'snoozedUntil', 'latestMessageAt'], name: 'assignment_account_snoozed_latest', type: 'key' },
127
- { attributes: ['snoozedUntil'], name: 'snoozed_due', type: 'key' },
128
- { attributes: ['accountAssignmentKey', 'archived', 'latestMessageAt'], name: 'assignment_account_archived_latest', type: 'key' },
129
- { attributes: ['accountAssignmentKey', 'spam', 'latestMessageAt'], name: 'assignment_account_spam_latest', type: 'key' },
130
- { attributes: ['accountAssignmentKey', 'trashed', 'latestMessageAt'], name: 'assignment_account_trashed_latest', type: 'key' },
131
- { attributes: ['searchText'], name: 'search', type: 'fulltext' },
132
- ],
133
- key: 'threads',
134
- name: 'Threads',
135
- });
136
- export const threadLabelsTable = defineAppwriteTable({
137
- fields: {
138
- labelAssignmentKey: identifier(identifierSchema),
139
- latestMessageAt: dateTime(isoTimestampSchema),
140
- locationCount: integer(nonNegativeIntegerSchema),
141
- threadAssignmentKey: identifier(identifierSchema),
142
- label: appwriteRelationship(appwriteRelationshipIdSchema, 'labels'),
143
- thread: appwriteRelationship(appwriteRelationshipIdSchema, 'threads'),
114
+ threadLabels: {
115
+ fields: {
116
+ labelAssignmentKey: identifier(identifierSchema),
117
+ latestMessageAt: dateTime(isoTimestampSchema),
118
+ locationCount: integer(nonNegativeIntegerSchema),
119
+ threadAssignmentKey: identifier(identifierSchema),
120
+ label: appwriteRelationship(appwriteRelationshipIdSchema, 'labels'),
121
+ thread: appwriteRelationship(appwriteRelationshipIdSchema, 'threads'),
122
+ },
123
+ indexes: [
124
+ { attributes: ['threadAssignmentKey', 'labelAssignmentKey'], name: 'assignment_thread_label_unique', type: 'unique' },
125
+ { attributes: ['labelAssignmentKey', 'latestMessageAt'], name: 'assignment_label_latest', type: 'key' },
126
+ ],
127
+ name: 'Thread labels',
144
128
  },
145
- id: appwriteIds.tables.threadLabels,
146
- indexes: [
147
- { attributes: ['threadAssignmentKey', 'labelAssignmentKey'], name: 'assignment_thread_label_unique', type: 'unique' },
148
- { attributes: ['labelAssignmentKey', 'latestMessageAt'], name: 'assignment_label_latest', type: 'key' },
149
- ],
150
- key: 'threadLabels',
151
- name: 'Thread labels',
152
- });
153
- export const messagesTable = defineAppwriteTable({
154
- fields: {
155
- accountAssignmentKey: identifier(identifierSchema),
156
- providerId: stringColumn(identifierSchema),
157
- rfcMessageId: stringColumn(v.nullable(identifierSchema), false),
158
- sender: text(v.nullable(v.string()), false),
159
- senderName: text(v.nullable(v.string()), false),
160
- recipients: text(v.nullable(v.string()), false),
161
- sentAt: dateTime(isoTimestampSchema),
162
- receivedAt: dateTime(v.nullable(isoTimestampSchema), false),
163
- preview: text(v.nullable(v.string()), false),
164
- attachmentMetadata: longText(v.string()),
165
- htmlFileId: stringColumn(v.nullable(identifierSchema), false),
166
- rawFileId: stringColumn(v.nullable(identifierSchema), false),
167
- size: integer(nonNegativeIntegerSchema),
168
- subject: text(v.nullable(v.string()), false),
169
- revision: integer(nonNegativeIntegerSchema),
170
- threadAssignmentKey: identifier(identifierSchema),
171
- account: appwriteRelationship(appwriteRelationshipIdSchema, 'accounts'),
172
- thread: appwriteRelationship(appwriteRelationshipIdSchema, 'threads'),
129
+ threads: {
130
+ fields: {
131
+ accountAssignmentKey: identifier(identifierSchema),
132
+ providerId: stringColumn(identifierSchema),
133
+ subject: text(v.nullable(v.string()), false),
134
+ firstMessageAt: dateTime(v.nullable(isoTimestampSchema), false),
135
+ senderEmail: stringColumn(v.nullable(mailboxAddressSchema), false, 320),
136
+ senderName: stringColumn(v.nullable(identifierSchema), false),
137
+ preview: text(v.nullable(v.string()), false),
138
+ participants: text(v.nullable(v.string()), false),
139
+ labelIds: stringArray(v.array(identifierSchema), true, 36),
140
+ latestMessageAt: dateTime(isoTimestampSchema),
141
+ latestMessageId: identifier(identifierSchema),
142
+ messageCount: integer(nonNegativeIntegerSchema),
143
+ hasAttachments: boolean(v.boolean()),
144
+ unseenLocationCount: integer(nonNegativeIntegerSchema),
145
+ flaggedLocationCount: integer(nonNegativeIntegerSchema),
146
+ seen: boolean(v.boolean()),
147
+ flagged: boolean(v.boolean()),
148
+ archived: boolean(v.boolean()),
149
+ spam: boolean(v.boolean()),
150
+ trashed: boolean(v.boolean()),
151
+ snoozedUntil: dateTime(v.nullable(canonicalTimestampSchema), false),
152
+ revision: integer(nonNegativeIntegerSchema),
153
+ searchText: text(v.nullable(v.string()), false),
154
+ account: appwriteRelationship(appwriteRelationshipIdSchema, 'accounts'),
155
+ },
156
+ indexes: [
157
+ { attributes: ['accountAssignmentKey', 'providerId'], name: 'assignment_account_provider_unique', type: 'unique' },
158
+ { attributes: ['accountAssignmentKey', 'latestMessageAt'], name: 'assignment_account_latest', type: 'key' },
159
+ { attributes: ['accountAssignmentKey', 'seen', 'latestMessageAt'], name: 'assignment_account_seen_latest', type: 'key' },
160
+ { attributes: ['accountAssignmentKey', 'flagged', 'latestMessageAt'], name: 'assignment_account_flagged_latest', type: 'key' },
161
+ { attributes: ['accountAssignmentKey', 'snoozedUntil', 'latestMessageAt'], name: 'assignment_account_snoozed_latest', type: 'key' },
162
+ { attributes: ['snoozedUntil'], name: 'snoozed_due', type: 'key' },
163
+ { attributes: ['accountAssignmentKey', 'archived', 'latestMessageAt'], name: 'assignment_account_archived_latest', type: 'key' },
164
+ { attributes: ['accountAssignmentKey', 'spam', 'latestMessageAt'], name: 'assignment_account_spam_latest', type: 'key' },
165
+ { attributes: ['accountAssignmentKey', 'trashed', 'latestMessageAt'], name: 'assignment_account_trashed_latest', type: 'key' },
166
+ { attributes: ['searchText'], name: 'search', type: 'fulltext' },
167
+ ],
168
+ name: 'Threads',
173
169
  },
174
- id: appwriteIds.tables.messages,
175
- indexes: [
176
- { attributes: ['threadAssignmentKey', 'sentAt'], name: 'assignment_thread_sent', type: 'key' },
177
- { attributes: ['accountAssignmentKey', 'providerId'], name: 'assignment_account_provider_unique', type: 'unique' },
178
- { attributes: ['accountAssignmentKey', 'rfcMessageId'], name: 'assignment_account_rfc_message', type: 'key' },
179
- ],
180
- key: 'messages',
181
- name: 'Messages',
182
170
  });
183
- export const mailboxTableInputs = {
184
- contacts: contactsTable,
185
- drafts: draftsTable,
186
- messageLocations: messageLocationsTable,
187
- messages: messagesTable,
188
- threadAliases: threadAliasesTable,
189
- threadLabels: threadLabelsTable,
190
- threads: threadsTable,
191
- };