@marcoappio/marco-config 2.0.473 → 2.0.475

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":"getThreads.d.ts","sourceRoot":"","sources":["../../../src/zero/queries/getThreads.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAOlE,KAAK,cAAc,GAAG;IACpB,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,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IMIT = 1000;
6
6
  const 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 getThreads = syncedQueryWithContext('getThreads', 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('recipients').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 getThreads = syncedQueryWithContext('getThreads', 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', x => x.related('recipients').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('recipients').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', x => x.whereExists('threadByLabel', y => y.where('labelId', additionalLabelId)));
93
61
  }
94
- return query.limit(limit);
62
+ return query;
95
63
  });
@@ -973,6 +973,7 @@ export declare const z: import("@rocicorp/zero").SchemaQuery<{
973
973
  export { getAccounts } from './getAccounts';
974
974
  export { getContacts } from './getContacts';
975
975
  export { getDrafts } from './getDrafts';
976
+ export { getThread } from './getThread';
976
977
  export { getThreadList } from './getThreadList';
977
978
  export { getThreads } from './getThreads';
978
979
  export { getUser } from './getUser';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/zero/queries/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAwB,CAAA;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}
@@ -4,6 +4,7 @@ export const z = createBuilder(schema);
4
4
  export { getAccounts } from './getAccounts';
5
5
  export { getContacts } from './getContacts';
6
6
  export { getDrafts } from './getDrafts';
7
+ export { getThread } from './getThread';
7
8
  export { getThreadList } from './getThreadList';
8
9
  export { getThreads } from './getThreads';
9
10
  export { getUser } from './getUser';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcoappio/marco-config",
3
- "version": "2.0.473",
3
+ "version": "2.0.475",
4
4
  "author": "team@marcoapp.io",
5
5
  "main": "dist/index.js",
6
6
  "repository": "git@github.com:marcoappio/marco-config.git",