@marcoappio/marco-config 2.0.473 → 2.0.474

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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DEFAULT_LIMIT = 50;
7
7
  const parseArgs = (args) => {
8
8
  const schema = v.object({
9
+ labelIds: v.pipe(v.array(v.string()), v.minLength(1)),
9
10
  limit: v.optional(v.pipe(v.number(), v.minValue(0), v.maxValue(MAX_LIMIT)), DEFAULT_LIMIT),
10
11
  search: v.optional(v.string()),
11
12
  where: v.optional(v.object({
12
13
  flagged: v.optional(v.boolean()),
13
14
  id: v.optional(v.string()),
14
- labelIds: v.optional(v.array(v.string())),
15
15
  messageIds: v.optional(v.array(v.string())),
16
16
  participants: v.optional(v.array(v.string())),
17
17
  seen: v.optional(v.boolean()),
@@ -19,77 +19,45 @@ const parseArgs = (args) => {
19
19
  });
20
20
  return [v.parse(schema, args[0])];
21
21
  };
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)));
22
+ export const getThreadList = syncedQueryWithContext('getThreadList', parseArgs, ({ userId }, { labelIds, search, limit, where }) => {
23
+ const [primaryLabelId, ...additionalLabelIds] = labelIds;
24
+ let query = z.threadByLabel
25
+ .where('labelId', primaryLabelId)
26
+ .orderBy('latestMessageDate', 'desc')
27
+ .limit(limit)
28
+ .related('thread', t => {
29
+ let threadQuery = t
30
+ .where('userId', userId)
31
+ .related('messages', m => m.related('attachments').orderBy('envelopeDate', 'asc'));
32
+ if (where?.id) {
33
+ threadQuery = threadQuery.where('id', where.id);
62
34
  }
63
- return query;
64
- }
65
- let query = z.thread
66
- .where('userId', userId)
67
- .related('messages', x => x.related('attachments').orderBy('envelopeDate', 'asc'))
68
- .orderBy('latestMessageDate', 'desc');
69
- if (where?.id) {
70
- query = query.where('id', where.id);
71
- }
72
- if (typeof where?.flagged === 'boolean') {
73
- query = query.where('flagged', where.flagged);
74
- }
75
- if (typeof where?.seen === 'boolean') {
76
- query = query.where('seen', where.seen);
77
- }
78
- if (where?.messageIds && where.messageIds.length > 0) {
79
- for (const messageId of where.messageIds) {
80
- query = query.whereExists('messages', x => x.where('id', messageId));
35
+ if (typeof where?.flagged === 'boolean') {
36
+ threadQuery = threadQuery.where('flagged', where.flagged);
81
37
  }
82
- }
83
- if (where?.participants && where.participants.length > 0) {
84
- for (const participant of where.participants) {
85
- query = query.whereExists('messages', x => x.whereExists('recipients', y => y.where('emailAddress', participant)));
38
+ if (typeof where?.seen === 'boolean') {
39
+ threadQuery = threadQuery.where('seen', where.seen);
86
40
  }
87
- }
88
- if (search) {
89
- const tokens = threadsUtils.processSearchTerm(search);
90
- if (tokens.length > 0) {
91
- query = query.where(({ and, cmp }) => and(...tokens.map(x => cmp('words', 'ILIKE', `%${x}%`))));
41
+ if (where?.messageIds && where.messageIds.length > 0) {
42
+ for (const messageId of where.messageIds) {
43
+ threadQuery = threadQuery.whereExists('messages', x => x.where('id', messageId));
44
+ }
92
45
  }
46
+ if (where?.participants && where.participants.length > 0) {
47
+ for (const participant of where.participants) {
48
+ threadQuery = threadQuery.whereExists('messages', x => x.whereExists('recipients', y => y.where('emailAddress', participant)));
49
+ }
50
+ }
51
+ if (search) {
52
+ const tokens = threadsUtils.processSearchTerm(search);
53
+ if (tokens.length > 0) {
54
+ threadQuery = threadQuery.where(({ and, cmp }) => and(...tokens.map(x => cmp('words', 'ILIKE', `%${x}%`))));
55
+ }
56
+ }
57
+ return threadQuery;
58
+ });
59
+ for (const additionalLabelId of additionalLabelIds) {
60
+ query = query.whereExists('thread', t => t.whereExists('threadByLabel', tbl => tbl.where('labelId', additionalLabelId)));
93
61
  }
94
- return query.limit(limit);
62
+ return query;
95
63
  });