@eventcatalog/core 2.20.1 → 2.20.3

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,3 +1,4 @@
1
+ import type { CollectionTypes } from '@types';
1
2
  import { getCollection } from 'astro:content';
2
3
  import type { CollectionEntry } from 'astro:content';
3
4
  import path from 'path';
@@ -12,15 +13,10 @@ export const getUsers = async (): Promise<User[]> => {
12
13
 
13
14
  // What do they own?
14
15
  const domains = await getCollection('domains');
15
-
16
- // What do they own?
17
16
  const services = await getCollection('services');
18
-
19
- // What do they own?
20
17
  const events = await getCollection('events');
21
-
22
- // What do they own?
23
18
  const commands = await getCollection('commands');
19
+ const queries = await getCollection('queries');
24
20
 
25
21
  const teams = await getCollection('teams', (team) => {
26
22
  return team.data.hidden !== true;
@@ -35,19 +31,18 @@ export const getUsers = async (): Promise<User[]> => {
35
31
  return domain.data.owners?.find((owner) => owner.id === user.data.id);
36
32
  });
37
33
 
38
- const isOwnedByUserOrAssociatedTeam = () => {
39
- const associatedTeamsSlug: string[] = associatedTeams.map((team) => team.id);
40
-
41
- return ({ data }: { data: { owners?: Array<{ slug: string }> } }) => {
42
- return data.owners?.some((owner) => owner.slug === user.data.id || associatedTeamsSlug.includes(owner.slug));
43
- };
34
+ const isOwnedByUserOrAssociatedTeam = (item: CollectionEntry<CollectionTypes>) => {
35
+ const associatedTeamsSlug: string[] = associatedTeams.map((team) => team.slug);
36
+ return item.data.owners?.some((owner) => owner.id === user.data.id || associatedTeamsSlug.includes(owner.id));
44
37
  };
45
38
 
46
- const ownedServices = services.filter(() => isOwnedByUserOrAssociatedTeam());
39
+ const ownedServices = services.filter(isOwnedByUserOrAssociatedTeam);
40
+
41
+ const ownedEvents = events.filter(isOwnedByUserOrAssociatedTeam);
47
42
 
48
- const ownedEvents = events.filter(() => isOwnedByUserOrAssociatedTeam());
43
+ const ownedCommands = commands.filter(isOwnedByUserOrAssociatedTeam);
49
44
 
50
- const ownedCommands = commands.filter(() => isOwnedByUserOrAssociatedTeam());
45
+ const ownedQueries = queries.filter(isOwnedByUserOrAssociatedTeam);
51
46
 
52
47
  return {
53
48
  ...user,
@@ -57,6 +52,7 @@ export const getUsers = async (): Promise<User[]> => {
57
52
  ownedServices,
58
53
  ownedEvents,
59
54
  ownedCommands,
55
+ ownedQueries,
60
56
  associatedTeams,
61
57
  },
62
58
  catalog: {
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/event-catalog/eventcatalog.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "2.20.1",
9
+ "version": "2.20.3",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },