@bpmnkit/connector-gen 0.0.5 → 0.0.7

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
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <img src="https://raw.githubusercontent.com/bpmnkit/monorepo/main/doc/logos/logo-2-gateway.svg" width="72" height="72" alt="BPMN Kit logo">
2
+ <a href="https://bpmnkit.com"><img src="https://bpmnkit.com/favicon.svg" width="72" height="72" alt="BPMN Kit logo"></a>
3
3
  <h1>@bpmnkit/connector-gen</h1>
4
4
  <p>Generate Camunda REST connector element templates from OpenAPI/Swagger specs</p>
5
5
 
@@ -90,3 +90,7 @@ interface GenerateOptions {
90
90
  ## License
91
91
 
92
92
  [MIT](https://github.com/bpmnkit/monorepo/blob/main/LICENSE) © BPMN Kit — made by [u11g](https://u11g.com)
93
+
94
+ <div align="center">
95
+ <a href="https://bpmnkit.com"><img src="https://bpmnkit.com/favicon.svg" width="32" height="32" alt="BPMN Kit"></a>
96
+ </div>
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Browser-safe entry point for `@bpmnkit/connector-gen`.
3
+ *
4
+ * Identical to the main entry except `writeTemplates` is excluded — that
5
+ * function depends on `node:fs/promises` and `node:path` which are not
6
+ * available in browser environments. Use this entry point when bundling for
7
+ * the browser (e.g. with Vite or webpack).
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ export { buildTemplate, buildTemplates } from "./build-template.js";
12
+ export { CATALOG, getCatalogEntry } from "./catalog.js";
13
+ export type { CatalogEntry } from "./catalog.js";
14
+ export { detectDefaultAuth, getBaseUrl, getOperations, getServers, isRef, parseOpenApi, resolve, resolveRef, } from "./parse-openapi.js";
15
+ export type { DetectedAuth } from "./parse-openapi.js";
16
+ export type { ApiResponse, AuthHint, Binding, Components, ConnectorGroup, ConnectorTemplate, Constraints, GeneratorOptions, HttpMethod, MediaType, OpenApiDoc, OpenApiInfo, OpenApiServer, Operation, OperationWithMeta, OAuthFlows, Parameter, PathItem, PropertyDef, Ref, RequestBody, Schema, SecurityRequirement, WriteOptions, } from "./types.js";
17
+ export { CONNECTOR_SCHEMA } from "./types.js";
18
+ import type { CatalogEntry } from "./catalog.js";
19
+ import type { ConnectorTemplate, GeneratorOptions } from "./types.js";
20
+ export interface GenerateOptions extends GeneratorOptions {
21
+ filter?: GeneratorOptions["filter"];
22
+ }
23
+ /**
24
+ * Parse an OpenAPI spec (string or object) and generate connector templates.
25
+ */
26
+ export declare function generate(specText: string, opts: GeneratorOptions): ConnectorTemplate[];
27
+ /**
28
+ * Download an OpenAPI spec from a URL and generate connector templates.
29
+ */
30
+ export declare function generateFromUrl(url: string, opts: GeneratorOptions): Promise<{
31
+ templates: ConnectorTemplate[];
32
+ }>;
33
+ /**
34
+ * Generate connector templates from a catalog entry by ID.
35
+ */
36
+ export declare function generateFromCatalog(id: string, overrides?: Partial<GenerateOptions>): Promise<{
37
+ templates: ConnectorTemplate[];
38
+ entry: CatalogEntry;
39
+ }>;
40
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Browser-safe entry point for `@bpmnkit/connector-gen`.
3
+ *
4
+ * Identical to the main entry except `writeTemplates` is excluded — that
5
+ * function depends on `node:fs/promises` and `node:path` which are not
6
+ * available in browser environments. Use this entry point when bundling for
7
+ * the browser (e.g. with Vite or webpack).
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ export { buildTemplate, buildTemplates } from "./build-template.js";
12
+ export { CATALOG, getCatalogEntry } from "./catalog.js";
13
+ export { detectDefaultAuth, getBaseUrl, getOperations, getServers, isRef, parseOpenApi, resolve, resolveRef, } from "./parse-openapi.js";
14
+ export { CONNECTOR_SCHEMA } from "./types.js";
15
+ import { buildTemplates } from "./build-template.js";
16
+ import { CATALOG, getCatalogEntry } from "./catalog.js";
17
+ import { detectDefaultAuth, getOperations, parseOpenApi } from "./parse-openapi.js";
18
+ /**
19
+ * Parse an OpenAPI spec (string or object) and generate connector templates.
20
+ */
21
+ export function generate(specText, opts) {
22
+ const doc = parseOpenApi(specText);
23
+ const defaultAuth = opts.defaultAuthType ?? detectDefaultAuth(doc);
24
+ const ops = getOperations(doc, opts.filter);
25
+ return buildTemplates(ops, { ...opts, defaultAuthType: defaultAuth });
26
+ }
27
+ /**
28
+ * Download an OpenAPI spec from a URL and generate connector templates.
29
+ */
30
+ export async function generateFromUrl(url, opts) {
31
+ const res = await fetch(url);
32
+ if (!res.ok)
33
+ throw new Error(`Failed to fetch spec from ${url}: ${res.status} ${res.statusText}`);
34
+ const text = await res.text();
35
+ const templates = generate(text, opts);
36
+ return { templates };
37
+ }
38
+ /**
39
+ * Generate connector templates from a catalog entry by ID.
40
+ */
41
+ export async function generateFromCatalog(id, overrides = {}) {
42
+ const entry = getCatalogEntry(id);
43
+ if (!entry) {
44
+ const ids = CATALOG.map((e) => e.id).join(", ");
45
+ throw new Error(`Unknown catalog entry "${id}". Available: ${ids}`);
46
+ }
47
+ const opts = {
48
+ idPrefix: overrides.idPrefix ?? entry.idPrefix,
49
+ defaultAuthType: overrides.defaultAuthType ?? entry.defaultAuth,
50
+ ...overrides,
51
+ };
52
+ const { templates } = await generateFromUrl(entry.url, opts);
53
+ return { templates, entry };
54
+ }
55
+ //# sourceMappingURL=browser.js.map
package/dist/catalog.js CHANGED
@@ -159,6 +159,86 @@ export const CATALOG = [
159
159
  idPrefix: "com.vercel",
160
160
  defaultAuth: "bearer",
161
161
  },
162
+ {
163
+ id: "anthropic",
164
+ name: "Anthropic API",
165
+ description: "Access Claude models for text generation, vision, and tool use via the Anthropic API",
166
+ url: "https://raw.githubusercontent.com/anthropics/anthropic-openapi/main/openapi.yaml",
167
+ idPrefix: "com.anthropic",
168
+ defaultAuth: "apiKey",
169
+ },
170
+ {
171
+ id: "shopify",
172
+ name: "Shopify Admin API",
173
+ description: "Manage Shopify store products, orders, customers, inventory, and fulfillments",
174
+ url: "https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/shopify.dev/admin/2023-04/openapi.yaml",
175
+ idPrefix: "dev.shopify",
176
+ defaultAuth: "bearer",
177
+ },
178
+ {
179
+ id: "datadog",
180
+ name: "Datadog API",
181
+ description: "Submit metrics, manage monitors, dashboards, logs, and alerts in Datadog",
182
+ url: "https://raw.githubusercontent.com/DataDog/datadog-api-client-python/master/openapi.yaml",
183
+ idPrefix: "com.datadoghq",
184
+ defaultAuth: "apiKey",
185
+ },
186
+ {
187
+ id: "sentry",
188
+ name: "Sentry API",
189
+ description: "Manage Sentry projects, issues, events, releases, and team members",
190
+ url: "https://raw.githubusercontent.com/getsentry/sentry-api-schema/main/openapi-derefed.json",
191
+ idPrefix: "io.sentry",
192
+ defaultAuth: "bearer",
193
+ },
194
+ {
195
+ id: "intercom",
196
+ name: "Intercom API",
197
+ description: "Manage contacts, conversations, messages, and support workflows in Intercom",
198
+ url: "https://raw.githubusercontent.com/intercom/Intercom-OpenAPI/main/descriptions/2.10/api.intercom.io.yaml",
199
+ idPrefix: "io.intercom",
200
+ defaultAuth: "bearer",
201
+ },
202
+ {
203
+ id: "contentful",
204
+ name: "Contentful Management API",
205
+ description: "Create and manage content types, entries, assets, and spaces in Contentful CMS",
206
+ url: "https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/contentful.com/management.2/openapi.yaml",
207
+ idPrefix: "com.contentful",
208
+ defaultAuth: "bearer",
209
+ },
210
+ {
211
+ id: "airtable",
212
+ name: "Airtable API",
213
+ description: "Read and write records, tables, fields, and views in Airtable bases",
214
+ url: "https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/airtable.com/0.1.0/openapi.yaml",
215
+ idPrefix: "com.airtable",
216
+ defaultAuth: "bearer",
217
+ },
218
+ {
219
+ id: "twitch",
220
+ name: "Twitch Helix API",
221
+ description: "Manage Twitch streams, channels, clips, users, subscriptions, and EventSub webhooks",
222
+ url: "https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/twitch.tv/helix/latest/openapi.yaml",
223
+ idPrefix: "tv.twitch",
224
+ defaultAuth: "oauth-client-credentials-flow",
225
+ },
226
+ {
227
+ id: "klaviyo",
228
+ name: "Klaviyo API",
229
+ description: "Manage email/SMS campaigns, lists, profiles, flows, and events in Klaviyo",
230
+ url: "https://raw.githubusercontent.com/klaviyo/klaviyo-api-node/main/openapi/openapi.yaml",
231
+ idPrefix: "com.klaviyo",
232
+ defaultAuth: "apiKey",
233
+ },
234
+ {
235
+ id: "brex",
236
+ name: "Brex API",
237
+ description: "Manage Brex business accounts, cards, transactions, and expense reimbursements",
238
+ url: "https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/brex.com/payments/0.1/openapi.yaml",
239
+ idPrefix: "com.brex",
240
+ defaultAuth: "oauth-client-credentials-flow",
241
+ },
162
242
  ];
163
243
  export function getCatalogEntry(id) {
164
244
  return CATALOG.find((e) => e.id === id);
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@bpmnkit/connector-gen",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./dist/index.js",
9
9
  "types": "./dist/index.d.ts"
10
+ },
11
+ "./browser": {
12
+ "import": "./dist/browser.js",
13
+ "types": "./dist/browser.d.ts"
10
14
  }
11
15
  },
12
16
  "main": "./dist/index.js",