@eventcatalog/connectors 0.1.0 → 0.2.1

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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Connectors for syncing external systems into EventCatalog.
4
4
 
5
+ ## GitHub
6
+
5
7
  ```js
6
8
  // eventcatalog.config.js
7
9
  import { githubDirectory } from "@eventcatalog/connectors";
@@ -20,6 +22,63 @@ export default {
20
22
  };
21
23
  ```
22
24
 
25
+ ## Microsoft Entra ID
26
+
27
+ Sync selected Microsoft Entra ID groups into EventCatalog teams, and sync their
28
+ direct user members into EventCatalog users.
29
+
30
+ ```js
31
+ // eventcatalog.config.js
32
+ import { microsoftEntraDirectory } from "@eventcatalog/connectors";
33
+
34
+ export default {
35
+ directory: {
36
+ sources: [
37
+ microsoftEntraDirectory({
38
+ tenantId: process.env.AZURE_TENANT_ID,
39
+ clientId: process.env.AZURE_CLIENT_ID,
40
+ clientSecret: process.env.AZURE_CLIENT_SECRET,
41
+ groups: [
42
+ {
43
+ id: "00000000-0000-0000-0000-000000000000",
44
+ alias: "platform",
45
+ },
46
+ {
47
+ displayName: "Architecture Guild",
48
+ },
49
+ ],
50
+ }),
51
+ ],
52
+ },
53
+ };
54
+ ```
55
+
56
+ The connector uses Microsoft Graph with the OAuth client credentials flow.
57
+ Create an app registration in Microsoft Entra ID, add read-only Microsoft Graph
58
+ application permissions for reading groups, users, and group members, grant
59
+ admin consent, then create a client secret for the build environment.
60
+
61
+ Groups can be configured by stable `id` or exact `displayName`. Group IDs are
62
+ recommended. If a `displayName` lookup finds no groups or multiple groups, the
63
+ connector fails and asks you to use the group ID.
64
+
65
+ Selected groups become EventCatalog teams. Team IDs use `alias` when provided,
66
+ otherwise they are slugified from the Entra group display name. Only direct user
67
+ members are synced. Disabled users are excluded by default; set
68
+ `includeDisabledUsers: true` to include them.
69
+
70
+ ```js
71
+ microsoftEntraDirectory({
72
+ tenantId: process.env.AZURE_TENANT_ID,
73
+ clientId: process.env.AZURE_CLIENT_ID,
74
+ clientSecret: process.env.AZURE_CLIENT_SECRET,
75
+ groups: [{ id: "00000000-0000-0000-0000-000000000000" }],
76
+ includeDisabledUsers: true,
77
+ graphBaseUrl: "https://graph.microsoft.com/v1.0",
78
+ tokenUrl: "https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token",
79
+ });
80
+ ```
81
+
23
82
  External directory sources require EventCatalog Scale when loaded by EventCatalog.
24
83
 
25
84
  Custom directory sources can use the same contract:
package/dist/index.d.mts CHANGED
@@ -22,7 +22,7 @@ type DirectoryEntrySource = {
22
22
  type DirectoryUser = {
23
23
  id: string;
24
24
  name: string;
25
- avatarUrl: string;
25
+ avatarUrl?: string;
26
26
  role?: string;
27
27
  email?: string;
28
28
  markdown?: string;
@@ -65,6 +65,57 @@ type DirectorySource = {
65
65
  * Defines a custom directory source with type inference for connector authors.
66
66
  */
67
67
  declare const defineDirectorySource: <TSource extends DirectorySource>(source: TSource) => TSource;
68
+ /**
69
+ * Describes where a synced schema came from.
70
+ */
71
+ type SchemaEntrySource = {
72
+ /** Provider identifier, for example `git`, `github`, `confluent`, or `eventbridge`. */
73
+ provider: string;
74
+ /** Optional provider-specific identifier for the external schema. */
75
+ id?: string;
76
+ /** Optional URL back to the schema source. */
77
+ url?: string;
78
+ /** Optional version/ref/branch for versioned sources. */
79
+ ref?: string;
80
+ /** Optional branch for git-backed schema sources. */
81
+ branch?: string;
82
+ /** Optional path inside the source. */
83
+ path?: string;
84
+ [key: string]: unknown;
85
+ };
86
+ /**
87
+ * Schema returned by an external schema source.
88
+ */
89
+ type SchemaEntry = {
90
+ id: string;
91
+ name?: string;
92
+ format?: string;
93
+ content: string;
94
+ source: SchemaEntrySource;
95
+ };
96
+ type SchemaResolveContext = {
97
+ /** Absolute path to the message file that referenced the schema. */
98
+ messageFilePath?: string;
99
+ };
100
+ /**
101
+ * Loads schemas from an external source.
102
+ *
103
+ * EventCatalog calls schema sources during content sync to resolve schema
104
+ * references from messages into generated schema collection entries.
105
+ */
106
+ type SchemaSource = {
107
+ type: "schemas";
108
+ /** Stable source identifier used in schema refs, for example `contracts`. */
109
+ name: string;
110
+ /** Returns true when this source can resolve the given schema ref. */
111
+ canResolve: (ref: string) => boolean;
112
+ /** Resolves a schema ref into schema content and source metadata. */
113
+ resolve: (ref: string, context?: SchemaResolveContext) => Promise<SchemaEntry | undefined>;
114
+ };
115
+ /**
116
+ * Defines a custom schema source with type inference for connector authors.
117
+ */
118
+ declare const defineSchemaSource: <TSource extends SchemaSource>(source: TSource) => TSource;
68
119
 
69
120
  type GitHubDirectoryOptions = {
70
121
  org: string;
@@ -75,4 +126,40 @@ type GitHubDirectoryOptions = {
75
126
  };
76
127
  declare const githubDirectory: (options: GitHubDirectoryOptions) => DirectorySource;
77
128
 
78
- export { type DirectoryEntrySource, type DirectorySource, type DirectoryTeam, type DirectoryUser, defineDirectorySource, githubDirectory };
129
+ type MicrosoftEntraGroupInput = string | {
130
+ id: string;
131
+ alias?: string;
132
+ } | {
133
+ displayName: string;
134
+ alias?: string;
135
+ };
136
+ type MicrosoftEntraDirectoryOptions = {
137
+ tenantId: string;
138
+ clientId: string;
139
+ clientSecret: string;
140
+ groups: MicrosoftEntraGroupInput[];
141
+ users?: boolean;
142
+ includeDisabledUsers?: boolean;
143
+ graphBaseUrl?: string;
144
+ tokenUrl?: string;
145
+ };
146
+ declare const microsoftEntraDirectory: (options: MicrosoftEntraDirectoryOptions) => DirectorySource;
147
+
148
+ type GitSchemaSourceOptions = {
149
+ /**
150
+ * Stable source name used in schema refs, for example:
151
+ * `git://contracts/events/OrderPlaced.schema.json`.
152
+ */
153
+ name: string;
154
+ /** Git repository URL. Supports any URL your local git can clone. */
155
+ url: string;
156
+ /** Branch to clone. */
157
+ branch?: string;
158
+ /** Optional directory inside the repository that contains schemas. */
159
+ directory?: string;
160
+ /** Optional HTTPS token. SSH auth is handled by the local git environment. */
161
+ token?: string;
162
+ };
163
+ declare const gitSchemaSource: (options: GitSchemaSourceOptions) => SchemaSource;
164
+
165
+ export { type DirectoryEntrySource, type DirectorySource, type DirectoryTeam, type DirectoryUser, type SchemaEntry, type SchemaEntrySource, type SchemaResolveContext, type SchemaSource, defineDirectorySource, defineSchemaSource, gitSchemaSource, githubDirectory, microsoftEntraDirectory };
package/dist/index.d.ts CHANGED
@@ -22,7 +22,7 @@ type DirectoryEntrySource = {
22
22
  type DirectoryUser = {
23
23
  id: string;
24
24
  name: string;
25
- avatarUrl: string;
25
+ avatarUrl?: string;
26
26
  role?: string;
27
27
  email?: string;
28
28
  markdown?: string;
@@ -65,6 +65,57 @@ type DirectorySource = {
65
65
  * Defines a custom directory source with type inference for connector authors.
66
66
  */
67
67
  declare const defineDirectorySource: <TSource extends DirectorySource>(source: TSource) => TSource;
68
+ /**
69
+ * Describes where a synced schema came from.
70
+ */
71
+ type SchemaEntrySource = {
72
+ /** Provider identifier, for example `git`, `github`, `confluent`, or `eventbridge`. */
73
+ provider: string;
74
+ /** Optional provider-specific identifier for the external schema. */
75
+ id?: string;
76
+ /** Optional URL back to the schema source. */
77
+ url?: string;
78
+ /** Optional version/ref/branch for versioned sources. */
79
+ ref?: string;
80
+ /** Optional branch for git-backed schema sources. */
81
+ branch?: string;
82
+ /** Optional path inside the source. */
83
+ path?: string;
84
+ [key: string]: unknown;
85
+ };
86
+ /**
87
+ * Schema returned by an external schema source.
88
+ */
89
+ type SchemaEntry = {
90
+ id: string;
91
+ name?: string;
92
+ format?: string;
93
+ content: string;
94
+ source: SchemaEntrySource;
95
+ };
96
+ type SchemaResolveContext = {
97
+ /** Absolute path to the message file that referenced the schema. */
98
+ messageFilePath?: string;
99
+ };
100
+ /**
101
+ * Loads schemas from an external source.
102
+ *
103
+ * EventCatalog calls schema sources during content sync to resolve schema
104
+ * references from messages into generated schema collection entries.
105
+ */
106
+ type SchemaSource = {
107
+ type: "schemas";
108
+ /** Stable source identifier used in schema refs, for example `contracts`. */
109
+ name: string;
110
+ /** Returns true when this source can resolve the given schema ref. */
111
+ canResolve: (ref: string) => boolean;
112
+ /** Resolves a schema ref into schema content and source metadata. */
113
+ resolve: (ref: string, context?: SchemaResolveContext) => Promise<SchemaEntry | undefined>;
114
+ };
115
+ /**
116
+ * Defines a custom schema source with type inference for connector authors.
117
+ */
118
+ declare const defineSchemaSource: <TSource extends SchemaSource>(source: TSource) => TSource;
68
119
 
69
120
  type GitHubDirectoryOptions = {
70
121
  org: string;
@@ -75,4 +126,40 @@ type GitHubDirectoryOptions = {
75
126
  };
76
127
  declare const githubDirectory: (options: GitHubDirectoryOptions) => DirectorySource;
77
128
 
78
- export { type DirectoryEntrySource, type DirectorySource, type DirectoryTeam, type DirectoryUser, defineDirectorySource, githubDirectory };
129
+ type MicrosoftEntraGroupInput = string | {
130
+ id: string;
131
+ alias?: string;
132
+ } | {
133
+ displayName: string;
134
+ alias?: string;
135
+ };
136
+ type MicrosoftEntraDirectoryOptions = {
137
+ tenantId: string;
138
+ clientId: string;
139
+ clientSecret: string;
140
+ groups: MicrosoftEntraGroupInput[];
141
+ users?: boolean;
142
+ includeDisabledUsers?: boolean;
143
+ graphBaseUrl?: string;
144
+ tokenUrl?: string;
145
+ };
146
+ declare const microsoftEntraDirectory: (options: MicrosoftEntraDirectoryOptions) => DirectorySource;
147
+
148
+ type GitSchemaSourceOptions = {
149
+ /**
150
+ * Stable source name used in schema refs, for example:
151
+ * `git://contracts/events/OrderPlaced.schema.json`.
152
+ */
153
+ name: string;
154
+ /** Git repository URL. Supports any URL your local git can clone. */
155
+ url: string;
156
+ /** Branch to clone. */
157
+ branch?: string;
158
+ /** Optional directory inside the repository that contains schemas. */
159
+ directory?: string;
160
+ /** Optional HTTPS token. SSH auth is handled by the local git environment. */
161
+ token?: string;
162
+ };
163
+ declare const gitSchemaSource: (options: GitSchemaSourceOptions) => SchemaSource;
164
+
165
+ export { type DirectoryEntrySource, type DirectorySource, type DirectoryTeam, type DirectoryUser, type SchemaEntry, type SchemaEntrySource, type SchemaResolveContext, type SchemaSource, defineDirectorySource, defineSchemaSource, gitSchemaSource, githubDirectory, microsoftEntraDirectory };