@marcoappio/marco-config 2.0.471 → 2.0.473

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 +1 @@
1
- {"version":3,"file":"getThreadList.d.ts","sourceRoot":"","sources":["../../../src/zero/queries/getThreadList.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAOlE,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,EAAE,CAAC,EAAE,MAAM,CAAA;QACX,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;QACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;QACvB,IAAI,CAAC,EAAE,OAAO,CAAA;KACf,CAAA;CACF,CAAA;AAoBD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGzB,CAAA"}
@@ -20,6 +20,48 @@ const parseArgs = (args) => {
20
20
  return [v.parse(schema, args[0])];
21
21
  };
22
22
  export const getThreadList = syncedQueryWithContext('getThreadList', parseArgs, ({ userId }, { search, limit, where }) => {
23
+ if (where?.labelIds && where.labelIds.length > 0) {
24
+ const [primaryLabelId, ...additionalLabelIds] = where.labelIds;
25
+ let query = z.threadByLabel
26
+ .where('labelId', primaryLabelId)
27
+ .orderBy('latestMessageDate', 'desc')
28
+ .limit(limit)
29
+ .related('thread', t => {
30
+ let threadQuery = t
31
+ .where('userId', userId)
32
+ .related('messages', m => m.related('attachments').orderBy('envelopeDate', 'asc'));
33
+ if (where?.id) {
34
+ threadQuery = threadQuery.where('id', where.id);
35
+ }
36
+ if (typeof where?.flagged === 'boolean') {
37
+ threadQuery = threadQuery.where('flagged', where.flagged);
38
+ }
39
+ if (typeof where?.seen === 'boolean') {
40
+ threadQuery = threadQuery.where('seen', where.seen);
41
+ }
42
+ if (where?.messageIds && where.messageIds.length > 0) {
43
+ for (const messageId of where.messageIds) {
44
+ threadQuery = threadQuery.whereExists('messages', x => x.where('id', messageId));
45
+ }
46
+ }
47
+ if (where?.participants && where.participants.length > 0) {
48
+ for (const participant of where.participants) {
49
+ threadQuery = threadQuery.whereExists('messages', x => x.whereExists('recipients', y => y.where('emailAddress', participant)));
50
+ }
51
+ }
52
+ if (search) {
53
+ const tokens = threadsUtils.processSearchTerm(search);
54
+ if (tokens.length > 0) {
55
+ threadQuery = threadQuery.where(({ and, cmp }) => and(...tokens.map(x => cmp('words', 'ILIKE', `%${x}%`))));
56
+ }
57
+ }
58
+ return threadQuery;
59
+ });
60
+ for (const additionalLabelId of additionalLabelIds) {
61
+ query = query.whereExists('thread', t => t.whereExists('threadByLabel', tbl => tbl.where('labelId', additionalLabelId)));
62
+ }
63
+ return query;
64
+ }
23
65
  let query = z.thread
24
66
  .where('userId', userId)
25
67
  .related('messages', x => x.related('attachments').orderBy('envelopeDate', 'asc'))
@@ -33,11 +75,6 @@ export const getThreadList = syncedQueryWithContext('getThreadList', parseArgs,
33
75
  if (typeof where?.seen === 'boolean') {
34
76
  query = query.where('seen', where.seen);
35
77
  }
36
- if (where?.labelIds && where.labelIds.length > 0) {
37
- for (const labelId of where.labelIds) {
38
- query = query.where('labelIdList', 'LIKE', `% ${labelId} %`);
39
- }
40
- }
41
78
  if (where?.messageIds && where.messageIds.length > 0) {
42
79
  for (const messageId of where.messageIds) {
43
80
  query = query.whereExists('messages', x => x.where('id', messageId));