@jsb188/graphql 1.1.5 → 1.1.6

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/cache/config.ts CHANGED
@@ -22,15 +22,23 @@ export const RULES = {
22
22
  aiChats: true,
23
23
  aiChatMessages: true,
24
24
  alerts: true,
25
- cardsForUser: true,
26
25
  chat: true,
27
26
  chatsList: true,
28
- editChat: true,
29
- friend: true,
27
+ childOrganizations: true,
28
+ eventsList: true,
29
+ eventAttendanceList: true,
30
+ parentOrganization: true,
30
31
  logEntries: true,
32
+ logEvidences: true,
31
33
  myChats: true,
34
+ myOrganizations: true,
32
35
  organizationRelationship: true,
36
+ organizationWorkflows: true,
33
37
  platformProducts: true,
38
+ productAttendanceList: true,
39
+ productsList: true,
40
+ reports: true,
41
+ availableReports: true,
34
42
  searchUsers: true,
35
43
  updateNote: true,
36
44
  userIdToChatId: true,
@@ -47,5 +55,4 @@ export const PARTIALS_MAP = {
47
55
  // Partial fragments are supported if you map them to its original fragment name
48
56
  chatPartial: 'chatFragment',
49
57
  chatStatusPartial: 'chatFragment',
50
- userPartial: 'userFragment',
51
58
  } as Record<string, string>;
package/cache/index.ts CHANGED
@@ -1,14 +1,11 @@
1
+ import { makeVariablesKey } from '@jsb188/app/utils/logic';
1
2
  import { cloneArrayLike, mapArrayLikeObjects } from '@jsb188/app/utils/object';
2
3
  import type { UpdateObserversFn } from '../types.d';
3
4
  import { PARTIALS_MAP, RULES } from './config';
4
5
 
5
- const DO_LOG = [
6
- false, // [0] Log name
7
- false, // [1] Log data
8
- ];
9
-
10
6
  const QUERIES = new Map();
11
7
  const FRAGMENTS = new Map();
8
+ const RESET_TIME = new Map();
12
9
 
13
10
  /**
14
11
  * JS Map will sometimes convert nested Array into Array-like Object
@@ -62,35 +59,6 @@ export function mergeNestedObjects(obj1: any, obj2: any) {
62
59
  return newObj;
63
60
  }
64
61
 
65
- /**
66
- * Get a single string to represent all variables for a query
67
- * NOTE: This isn't perfect because variables could have extra or unnnecessary keys/values
68
- * The correct way to do this would be to compare it against the query {variableDefinitions}
69
- * But this will work as long as each variables object is used consistently to match the used query.
70
- *
71
- * NOTE: Same logic is used in SSE [publish.ts]
72
- */
73
-
74
- export function makeVariablesKey(variables?: any) {
75
- if (variables) {
76
- const key = Object.keys(variables).sort().reduce((acc, key) => {
77
- const value = variables[key];
78
- if (value || value === 0 || value === false) {
79
- return `${acc}$${key}:${typeof value === 'object' ? JSON.stringify(value) : value}`;
80
- }
81
- return acc;
82
- }, '');
83
-
84
- // NOTE: I can't think of a query where capitalization matters;
85
- // So I'm doing lowerCase() here.
86
- // Also, I don't think there's any query where null/undefined matters;
87
- // So I'm omitting all of those.
88
-
89
- return key.toLowerCase();
90
- }
91
- return 'none';
92
- }
93
-
94
62
  /**
95
63
  * Make Object for fragment, omitting what you don't need
96
64
  */
@@ -152,7 +120,9 @@ export function loadQuery(queryKey: string, referencesOnly?: boolean) {
152
120
 
153
121
  return mappedCache;
154
122
  } else if (references) {
155
- const singleCacheData = appendFragmentToCache(references);
123
+ // console.log('references single:', references);
124
+ const singleCacheData = appendFragmentToCache(references, true);
125
+ // console.log('singleCacheData >>>>:', singleCacheData);
156
126
  return singleCacheData;
157
127
  }
158
128
  }
@@ -167,7 +137,6 @@ export function loadFragment(id: string) {
167
137
  const fragment = enforceArrayType(FRAGMENTS.get(id));
168
138
  if (!fragment) {
169
139
  return null;
170
-
171
140
  }
172
141
 
173
142
  const spreads = FRAGMENTS.get(`${id}.spreads`);
@@ -175,11 +144,67 @@ export function loadFragment(id: string) {
175
144
  return fragment;
176
145
  }
177
146
 
147
+ // const isTest = id.startsWith('$logEntryFragment:9479647167133727') && false;
148
+ // if (isTest) {
149
+ // ..
150
+ // }
151
+
178
152
  let fragmentWithSpreads = { ...fragment };
179
153
  for (const key in spreads) {
154
+
180
155
  if (Object.prototype.hasOwnProperty.call(spreads, key)) {
181
- const spreadId = spreads[key];
182
- const spreadData = enforceArrayType(FRAGMENTS.get(spreadId));
156
+ const spreadValue = spreads[key];
157
+
158
+ // if (isTest) {
159
+ // console.log('SPREAD:', key, '->', spreadValue);
160
+ // }
161
+
162
+ let spreadData;
163
+ if (typeof spreadValue === 'string') {
164
+ spreadData = enforceArrayType(FRAGMENTS.get(spreadValue));
165
+ } else if (Array.isArray(spreadValue)) {
166
+ spreadData = spreadValue.reduce((acc, value) => {
167
+ if (typeof value === 'string') {
168
+ const fragmentData = enforceArrayType(FRAGMENTS.get(value));
169
+
170
+ // if (isTest && key === 'details') {
171
+ // console.log('1:', value, fragmentData);
172
+ // }
173
+
174
+ return {
175
+ ...acc,
176
+ ...fragmentData,
177
+ };
178
+ } else if (Array.isArray(value)) {
179
+ const [namespace, innerValue] = value;
180
+ // console.log('2:', namespace, value);
181
+
182
+ return {
183
+ ...acc,
184
+ [namespace]: innerValue,
185
+ };
186
+ }
187
+
188
+ return acc;
189
+ }, {});
190
+ } else if (spreadValue?.__list === true) {
191
+ spreadData = spreadValue.data.map((val: any) => {
192
+
193
+ // NOTE: I haven't fully finished this work,
194
+ // but it should work for most cases.
195
+
196
+ if (typeof val === 'string') {
197
+ return loadFragment(val);
198
+ } else if (Array.isArray(val) && typeof val[0] === 'string' && val[0].startsWith('$')) {
199
+ return loadFragment(val[0]);
200
+ }
201
+
202
+ // Unfinished work
203
+ console.warn('Unfinished GraphQL cache scenario!: ', val)
204
+ return null;
205
+ }).filter(Boolean);
206
+ }
207
+
183
208
  if (spreadData) {
184
209
  fragmentWithSpreads[key] = spreadData;
185
210
  }
@@ -194,6 +219,7 @@ export function loadFragment(id: string) {
194
219
  */
195
220
 
196
221
  function mapSelections(data: any, innerSelections: any[], updatedKeys: string[] = []) {
222
+
197
223
  return innerSelections.map((inner) => {
198
224
 
199
225
  let fragmentKey;
@@ -203,15 +229,32 @@ function mapSelections(data: any, innerSelections: any[], updatedKeys: string[]
203
229
  const frgMap = PARTIALS_MAP[frgName];
204
230
  fragmentKey = `$${frgMap || frgName}:${data.id || 'none'}`;
205
231
 
206
- if (DO_LOG[0]) {
207
- console.log('SETTING (1): ', fragmentKey);
208
- }
209
- if (DO_LOG[1]) {
210
- console.log('SETTING (1): ', extractFragment(data, innerSelections));
232
+ } else if (inner.kind === 'Field' && inner.selectionSet && inner.selectionSet.selections?.length) {
233
+
234
+ // These are nested fragments, they need to be cached as a fragment
235
+
236
+ const innerData = data?.[inner.name.value];
237
+ const innerSelections = inner.selectionSet.selections?.filter((sel: any) => sel.kind === 'FragmentSpread');
238
+
239
+ if (innerData && Array.isArray(innerSelections)) {
240
+ if (Array.isArray(innerData)) {
241
+ for (const item of innerData) {
242
+ mapSelections(item, inner.selectionSet.selections, updatedKeys);
243
+ }
244
+ } else {
245
+ mapSelections(innerData, inner.selectionSet.selections, updatedKeys);
246
+ }
211
247
  }
248
+
212
249
  } else if (inner.kind === 'InlineFragment') {
213
250
  // This is Union, etc
214
251
  const frgNamesJoined = inner.selectionSet.selections.map((sel: any) => PARTIALS_MAP[sel.name.value] || sel.name.value).join('.');
252
+
253
+ if (frgNamesJoined.toLowerCase().indexOf(data.__typename.toLowerCase()) < 0) {
254
+ // This is untested, but should be fine
255
+ return null;
256
+ }
257
+
215
258
  fragmentKey = `$${frgNamesJoined}:${data.id || 'none'}`;
216
259
  }
217
260
 
@@ -220,6 +263,12 @@ function mapSelections(data: any, innerSelections: any[], updatedKeys: string[]
220
263
  // Because partials might have data that's not in the main fragment
221
264
  const currentData = loadFragment(fragmentKey);
222
265
 
266
+ // if (fragmentKey.startsWith('$accountFragment:')) {
267
+ // console.log('>>>>', fragmentKey);
268
+ // console.log(data);
269
+ // console.log(extractFragment(data, innerSelections));
270
+ // }
271
+
223
272
  FRAGMENTS.set(fragmentKey, mergeNestedObjects(currentData, extractFragment(data, innerSelections)));
224
273
  updatedKeys.push(fragmentKey);
225
274
 
@@ -235,7 +284,7 @@ function mapSelections(data: any, innerSelections: any[], updatedKeys: string[]
235
284
  // name: inner.name.value,
236
285
  // value: data[key]?.[inner.name.value]
237
286
  // };
238
- });
287
+ }).filter(Boolean);
239
288
  }
240
289
 
241
290
  /**
@@ -253,10 +302,6 @@ function makeCacheObject(data: any, selections: any[], variables?: any, cacheMap
253
302
  continue;
254
303
  }
255
304
 
256
- // if (DO_LOG[2]) {
257
- // console.log(sel);
258
- // }
259
-
260
305
  switch (sel.kind) {
261
306
  case 'Field':
262
307
  {
@@ -286,13 +331,6 @@ function makeCacheObject(data: any, selections: any[], variables?: any, cacheMap
286
331
  const fragmentKey = `$${frgMap || frgName}:${data.id || 'none'}`;
287
332
 
288
333
  if (RULES[frgName] !== false) {
289
- if (DO_LOG[0]) {
290
- console.log('SETTING (2): ', fragmentKey);
291
- }
292
- if (DO_LOG[1]) {
293
- console.log('SETTING (2): ', extractFragment(data, selections));
294
- }
295
-
296
334
  // if (testMode) {
297
335
  // console.log('Array.isArray(data)');
298
336
  // console.log(Array.isArray(data));
@@ -304,6 +342,7 @@ function makeCacheObject(data: any, selections: any[], variables?: any, cacheMap
304
342
  // Because partials might have data that's not in the main fragment
305
343
  const currentData = loadFragment(fragmentKey);
306
344
 
345
+ // console.log('>>>>', fragmentKey);
307
346
  FRAGMENTS.set(fragmentKey, mergeNestedObjects(currentData, extractFragment(data, selections)));
308
347
  updatedKeys.push(fragmentKey);
309
348
  }
@@ -332,21 +371,41 @@ function makeCacheObject(data: any, selections: any[], variables?: any, cacheMap
332
371
  if (cacheObj.__flat?.data?.[0]) {
333
372
  const spreadsFragmentKey = `${cacheObj.__flat.data[0]}.spreads`;
334
373
 
335
- let spreads: Record<string, string> | undefined;
374
+ let spreads: Record<string, any> | undefined;
336
375
  for (const cKey in cacheObj) {
337
376
  if (
338
377
  cKey !== '__flat' &&
339
- Object.prototype.hasOwnProperty.call(cacheObj, cKey) &&
340
- typeof cacheObj[cKey]?.data?.[0] === 'string'
378
+ Object.prototype.hasOwnProperty.call(cacheObj, cKey)
341
379
  ) {
342
380
  if (!spreads) {
343
381
  spreads = {};
344
382
  }
345
- spreads[cKey] = cacheObj[cKey].data[0];
383
+
384
+ // Spreads here
385
+
386
+ if (cacheObj[cKey]?.data?.length === 1 && typeof cacheObj[cKey]?.data?.[0] === 'string') {
387
+ // Single spread with single fragment
388
+ spreads[cKey] = cacheObj[cKey].data[0];
389
+ } else if (cacheObj[cKey].__list === true) {
390
+ // List of spreads
391
+ spreads[cKey] = {
392
+ __list: true,
393
+ data: cacheObj[cKey].data
394
+ };
395
+ } else if (Array.isArray(cacheObj[cKey]?.data)) {
396
+ // Spread with more spreads inside
397
+ spreads[cKey] = cacheObj[cKey].data;
398
+ }
346
399
  }
347
400
  }
348
401
 
349
402
  if (spreads) {
403
+ // if (spreadsFragmentKey.startsWith('$emailFragment:')) {
404
+ // console.log('>>>>', spreadsFragmentKey);
405
+ // console.log(data);
406
+ // console.log(spreads);
407
+ // }
408
+
350
409
  FRAGMENTS.set(spreadsFragmentKey, spreads);
351
410
  }
352
411
  }
@@ -410,6 +469,7 @@ function saveQueryToMemory(
410
469
  if (saveQueryToCache) {
411
470
  const customCacheData = cacheMap(data, cacheData, selections, variables);
412
471
  // console.log('1--->', queryId);
472
+ // console.log('UPDATING (1):', typeof customCacheData === 'undefined' ? null : customCacheData);
413
473
  QUERIES.set(queryId, typeof customCacheData === 'undefined' ? null : customCacheData);
414
474
 
415
475
  if (updateObservers) {
@@ -422,6 +482,7 @@ function saveQueryToMemory(
422
482
  if (saveQueryToCache) {
423
483
  // console.log('2--->', queryId);
424
484
  // console.log('2--->', cacheData);
485
+ // console.log('UPDATING (2):', cacheData);
425
486
  QUERIES.set(queryId, cacheData);
426
487
  }
427
488
 
@@ -486,58 +547,72 @@ export function setDataToCache(
486
547
 
487
548
  export function appendFragmentToCache(cacheData: any, testMode?: boolean) {
488
549
  let newObj = cloneArrayLike(cacheData);
550
+ let flatObj: any;
489
551
 
490
552
  // if (testMode) {
491
553
  // console.log('appendFragmentToCache:', newObj);
492
554
  // }
493
555
 
494
556
  for (const key in newObj) {
557
+
558
+ // if (testMode) {
559
+ // console.log('******* key:', key);
560
+ // console.log('******* ??:', newObj[key]);
561
+ // }
562
+
495
563
  if (newObj[key] && typeof newObj[key] === 'object') {
496
564
  const isFlat = key === '__flat';
497
565
  const isCache = newObj[key].__cache && newObj[key].data;
498
566
 
499
567
  if (isCache) {
500
-
501
568
  let cachedObj = {};
502
569
  let cacheIsValid = true;
503
570
 
504
571
  if (newObj[key].__list) {
505
-
506
572
  cachedObj = newObj[key].data.map((di: any[]) => {
507
573
 
508
574
  let item = {};
509
575
  di.forEach((d) => {
576
+ let mapCacheId;
510
577
  if (Array.isArray(d)) {
511
- item[d[0]] = d[1];
512
- } else if (typeof d === 'string') {
513
- const frgIndex = d.indexOf(':');
514
- const frgName = d.substring(1, frgIndex);
515
- const frgMap = PARTIALS_MAP[frgName];
516
-
517
- let fragmentKey;
518
- if (frgMap) {
519
- fragmentKey = `$${frgMap}:${d.substring(frgIndex + 1)}`;
578
+ if (d.length === 1 && d?.[0]?.startsWith('$')) {
579
+ mapCacheId = d[0];
520
580
  } else {
521
- fragmentKey = d;
581
+ item[d[0]] = d[1];
582
+ return;
522
583
  }
584
+ } else if (typeof d === 'string') {
585
+ mapCacheId = d;
586
+ }
523
587
 
524
- const cachedFragment = loadFragment(fragmentKey);
525
- if (DO_LOG[0]) {
526
- console.log('LOAD (1): ', d);
527
- }
528
- if (DO_LOG[1]) {
529
- console.log('LOAD (1): ', cachedFragment);
530
- }
588
+ // if (Array.isArray(d)) {
589
+ // item[d[0]] = d[1];
590
+ // return;
591
+ // } else if (typeof d === 'string') {
592
+ // mapCacheId = d;
593
+ // }
531
594
 
532
- if (cachedFragment) {
533
- item = {
534
- ...item,
535
- ...cachedFragment,
536
- };
537
- } else {
538
- // Cache was invalidated
539
- cacheIsValid = false;
540
- }
595
+ const frgIndex = mapCacheId.indexOf(':');
596
+ const frgName = mapCacheId.substring(1, frgIndex);
597
+ const frgMap = PARTIALS_MAP[frgName];
598
+
599
+ let fragmentKey;
600
+ if (frgMap) {
601
+ fragmentKey = `$${frgMap}:${mapCacheId.substring(frgIndex + 1)}`;
602
+ } else {
603
+ fragmentKey = mapCacheId;
604
+ }
605
+
606
+ const cachedFragment = loadFragment(fragmentKey);
607
+
608
+ if (cachedFragment) {
609
+ item = {
610
+ ...item,
611
+ ...cachedFragment,
612
+ };
613
+ } else {
614
+ // Cache was invalidated
615
+ cacheIsValid = false;
541
616
  }
542
617
  });
543
618
 
@@ -568,19 +643,23 @@ export function appendFragmentToCache(cacheData: any, testMode?: boolean) {
568
643
  }
569
644
 
570
645
  const cachedFragment = loadFragment(fragmentKey);
571
- if (DO_LOG[0]) {
572
- console.log('LOAD (2): ', d);
573
- }
574
- if (DO_LOG[1]) {
575
- console.log('LOAD (2): ', cachedFragment);
576
- }
577
646
 
578
647
  if (cachedFragment) {
579
648
  if (isFlat) {
580
- newObj = {
581
- ...newObj,
582
- ...cachedFragment,
583
- };
649
+ // if (testMode) {
650
+ // console.log('///////');
651
+ // console.log('///////');
652
+ // console.log('newObj before:', newObj);
653
+ // console.log('fragmentKey:', fragmentKey);
654
+ // console.log('cachedFragment:', cachedFragment);
655
+ // }
656
+
657
+ // newObj = {
658
+ // ...newObj,
659
+ // ...cachedFragment,
660
+ // };
661
+
662
+ flatObj = cachedFragment,
584
663
  delete newObj.__flat;
585
664
  } else {
586
665
  cachedObj = {
@@ -624,6 +703,17 @@ export function appendFragmentToCache(cacheData: any, testMode?: boolean) {
624
703
  }
625
704
  }
626
705
 
706
+ // Merge flat data
707
+
708
+ if (flatObj) {
709
+ for (const key in flatObj) {
710
+ // console.log('FLAT:', key, flatObj[key], newObj[key]);
711
+ if (newObj[key] === undefined) {
712
+ newObj[key] = flatObj[key];
713
+ }
714
+ }
715
+ }
716
+
627
717
  return newObj;
628
718
  }
629
719
 
@@ -820,8 +910,36 @@ export function clearGraphQLClientCache() {
820
910
  FRAGMENTS.clear();
821
911
  }
822
912
 
913
+ /**
914
+ * Check if query was reset (used on mount to check if a new fetch is needed)
915
+ */
916
+
917
+ export function getQueryRefreshTime(queryName: string, variablesKey: string) {
918
+ // if (RESET_TIME.get(`#${queryName}:`) || RESET_TIME.get(`#${queryName}:${variablesKey}`)) {
919
+ // console.log(`#${queryName}:${variablesKey}`);
920
+ // console.log('1 >>>>>>>', RESET_TIME.get(`#${queryName}:`));
921
+ // console.log('2 >>>>>>>', RESET_TIME.get(`#${queryName}:${variablesKey}`));
922
+ // }
923
+
924
+ return (
925
+ RESET_TIME.get(`#${queryName}:`) ||
926
+ RESET_TIME.get(`#${queryName}:${variablesKey}`)
927
+ );
928
+ }
929
+
930
+ /**
931
+ * Clear the reset status of a query
932
+ */
933
+
934
+ export function clearQueryResetStatus(queryName: string, variablesKey: string) {
935
+ RESET_TIME.delete(`#${queryName}:`);
936
+ RESET_TIME.delete(`#${queryName}:${variablesKey}`);
937
+ }
938
+
823
939
  /**
824
940
  * Clear query cache
941
+ * NOTE: If "queryId" is a name of query postfixed by ":" like this => "#queryName:"
942
+ * it will reset all queries everywhere for the same GraphQL query.
825
943
  */
826
944
 
827
945
  export function resetQuery(queryId: string, forceRefetch?: boolean, updateObservers?: UpdateObserversFn) {
@@ -830,10 +948,31 @@ export function resetQuery(queryId: string, forceRefetch?: boolean, updateObserv
830
948
  // }
831
949
 
832
950
  if (updateObservers) {
833
- updateObservers({
834
- queryId,
835
- forceRefetch,
836
- });
951
+ if (queryId.startsWith('^')) {
952
+ // Reset using regex
953
+ const regex = new RegExp(queryId);
954
+
955
+ // Loop for each of QUERIES map keys
956
+ for (const key of QUERIES.keys()) {
957
+ if (regex.test(key)) {
958
+ RESET_TIME.set(key, Date.now());
959
+ console.dev('✅ RESET ->', key);
960
+ updateObservers({
961
+ queryId: key,
962
+ forceRefetch,
963
+ });
964
+ }
965
+ }
966
+ } else {
967
+ // Reset specific query
968
+ RESET_TIME.set(queryId, Date.now());
969
+ console.dev('✅ RESET ->', queryId);
970
+ updateObservers({
971
+ queryId,
972
+ forceRefetch,
973
+ });
974
+ }
975
+ // console.log('SETTING ->', queryId, RESET_TIME.get(queryId));
837
976
  }
838
977
  }
839
978
 
@@ -847,6 +986,7 @@ export function updateFragment(
847
986
  replaceId?: string | null,
848
987
  doNotTriggerObserver?: boolean,
849
988
  updateObservers?: UpdateObserversFn,
989
+ otherUpdatedFragmentKeys?: string[],
850
990
  ) {
851
991
  const cache = loadFragment(updateFragmentKey);
852
992
 
@@ -859,7 +999,6 @@ export function updateFragment(
859
999
  }
860
1000
 
861
1001
  const updatedObj = { ...cache, ...updateObj };
862
-
863
1002
  FRAGMENTS.set(updateFragmentKey, updatedObj);
864
1003
 
865
1004
  if (replaceId && replaceId !== updateFragmentKey) {
@@ -867,8 +1006,13 @@ export function updateFragment(
867
1006
  }
868
1007
 
869
1008
  if (!doNotTriggerObserver && updateObservers) {
1009
+ let observingFragmentIds = [updateFragmentKey];
1010
+ if (Array.isArray(otherUpdatedFragmentKeys)) {
1011
+ observingFragmentIds = observingFragmentIds.concat(otherUpdatedFragmentKeys);
1012
+ }
1013
+
870
1014
  updateObservers({
871
- fragmentIds: [updateFragmentKey],
1015
+ fragmentIds: observingFragmentIds,
872
1016
  });
873
1017
 
874
1018
  // FRAGMENT_OBSERVER.value = {
@@ -901,6 +1045,8 @@ export function updateQuery(
901
1045
  }
902
1046
 
903
1047
  const updatedObj = Array.isArray(updateObj) ? updateObj : { ...cache, ...updateObj };
1048
+
1049
+ // console.log('UPDATING (3):', updateObj);
904
1050
  QUERIES.set(queryId, updatedObj);
905
1051
 
906
1052
  if (!doNotTriggerObserver && updateObservers) {
@@ -0,0 +1,16 @@
1
+
2
+ export const actionTaskFragment = `fragment actionTaskFragment on ActionTask {
3
+ id
4
+ logId
5
+
6
+ title
7
+ message
8
+ instruction
9
+
10
+ scheduledAt
11
+ delay
12
+ completed
13
+
14
+ createdAt
15
+ updatedAt
16
+ }`;
@@ -4,12 +4,13 @@ export const logEntryFragment = `fragment logEntryFragment on LogEntry {
4
4
  accountId
5
5
  organizationId
6
6
  cursor
7
+ status
7
8
  date
8
9
  createdAt
9
10
  updatedAt
10
11
  }`;
11
12
 
12
- export const logEntryArableFragment = `fragment logEntryArableFragment on LogEntryArable {
13
+ export const logArableFragment = `fragment logArableFragment on LogArable {
13
14
  __typename
14
15
 
15
16
  id
@@ -17,9 +18,78 @@ export const logEntryArableFragment = `fragment logEntryArableFragment on LogEnt
17
18
  activity
18
19
  concentration
19
20
  concentrationUnit
20
- crop
21
+
22
+ item
21
23
  quantity
22
24
  unit
25
+ location
26
+ fieldLocation
27
+
28
+ otherParty
29
+ referenceNumber
30
+ values {
31
+ label
32
+ value
33
+ quantity
34
+ }
35
+ tax
36
+
37
+ summary
38
+ notes
39
+ }`;
40
+
41
+ export const logFarmersMarketFragment = `fragment logFarmersMarketFragment on LogFarmersMarket {
42
+ __typename
43
+
44
+ id
45
+ type
46
+ activity
47
+
48
+ childOrgId
49
+ item
50
+
51
+ otherParty
52
+ referenceNumber
53
+ values {
54
+ label
55
+ value
56
+ quantity
57
+ }
58
+ tax
59
+ voided
60
+
61
+ summary
62
+ notes
63
+ }`;
64
+
65
+ export const logLivestockFragment = `fragment logLivestockFragment on LogLivestock {
66
+ __typename
67
+
68
+ id
69
+ type
70
+ activity
71
+
72
+ livestock
73
+ livestockIdentifiers
74
+ livestockGroup
75
+ damIdentifier
76
+
77
+ otherParty
78
+ referenceNumber
79
+ values {
80
+ label
81
+ value
82
+ quantity
83
+ }
84
+ tax
85
+
86
+ item
87
+ quantity
88
+ unit
23
89
  price
90
+ location
91
+ fieldLocation
92
+
93
+ summary
24
94
  notes
25
95
  }`;