@aloma.io/integration-sdk 3.8.52 → 3.8.54
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/MULTI_RESOURCE_GUIDE.md +217 -0
- package/README.md +55 -2
- package/build/cli.mjs +162 -11
- package/build/openapi-to-connector.d.mts +23 -0
- package/build/openapi-to-connector.mjs +274 -26
- package/examples/api-without-servers.json +32 -0
- package/examples/companies-resource-class.mts +310 -0
- package/examples/companies-resource.mts +310 -0
- package/examples/complete-example.sh +116 -0
- package/examples/create-hubspot-connector.sh +33 -0
- package/examples/hubspot-companies.json +1889 -0
- package/examples/hubspot-contacts.json +1919 -0
- package/examples/hubspot-controller-individual-params.mts +323 -0
- package/examples/hubspot-controller-with-implementation.mts +315 -0
- package/examples/hubspot-controller.mts +192 -0
- package/examples/hubspot-lists.json +5525 -0
- package/examples/main-controller-with-resources.mts +35 -0
- package/examples/stripe.json +182829 -0
- package/examples/utility-click.json +8992 -0
- package/package.json +1 -1
- package/src/cli.mts +195 -11
- package/src/openapi-to-connector.mts +313 -32
@@ -0,0 +1,116 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Complete Example: Generate a Multi-Resource HubSpot Connector
|
4
|
+
# This script demonstrates how to create a connector with multiple resources
|
5
|
+
|
6
|
+
set -e # Exit on error
|
7
|
+
|
8
|
+
echo "🚀 Generating Multi-Resource HubSpot Connector"
|
9
|
+
echo "=============================================="
|
10
|
+
echo ""
|
11
|
+
|
12
|
+
# Step 1: Generate the main project with Companies resource
|
13
|
+
echo "📦 Step 1: Creating project with Companies resource..."
|
14
|
+
npx @aloma.io/integration-sdk@latest from-openapi "HubSpot" \
|
15
|
+
--connector-id "hubspot-connector" \
|
16
|
+
--spec hubspot-companies.json \
|
17
|
+
--out src/resources/companies.mts \
|
18
|
+
--resource CompaniesResource \
|
19
|
+
--no-build
|
20
|
+
|
21
|
+
cd HubSpot
|
22
|
+
|
23
|
+
echo ""
|
24
|
+
echo "✅ Project created with CompaniesResource"
|
25
|
+
echo ""
|
26
|
+
|
27
|
+
# Step 2: Generate additional resources (if you have the specs)
|
28
|
+
# Uncomment these when you have the OpenAPI specs
|
29
|
+
|
30
|
+
# echo "📦 Step 2: Adding Deals resource..."
|
31
|
+
# node <<EOF
|
32
|
+
# import {OpenAPIToConnector} from '@aloma.io/integration-sdk';
|
33
|
+
# import fs from 'fs';
|
34
|
+
#
|
35
|
+
# const specContent = fs.readFileSync('../hubspot-deals.json', 'utf-8');
|
36
|
+
# const spec = OpenAPIToConnector.parseSpec(specContent);
|
37
|
+
# const generator = new OpenAPIToConnector(spec, 'HubSpot Deals');
|
38
|
+
# const code = generator.generateResourceClass('DealsResource');
|
39
|
+
# fs.writeFileSync('src/resources/deals.mts', code);
|
40
|
+
# console.log('✅ Generated DealsResource');
|
41
|
+
# EOF
|
42
|
+
|
43
|
+
# echo ""
|
44
|
+
# echo "📦 Step 3: Adding Contacts resource..."
|
45
|
+
# node <<EOF
|
46
|
+
# import {OpenAPIToConnector} from '@aloma.io/integration-sdk';
|
47
|
+
# import fs from 'fs';
|
48
|
+
#
|
49
|
+
# const specContent = fs.readFileSync('../hubspot-contacts.json', 'utf-8');
|
50
|
+
# const spec = OpenAPIToConnector.parseSpec(specContent);
|
51
|
+
# const generator = new OpenAPIToConnector(spec, 'HubSpot Contacts');
|
52
|
+
# const code = generator.generateResourceClass('ContactsResource');
|
53
|
+
# fs.writeFileSync('src/resources/contacts.mts', code);
|
54
|
+
# console.log('✅ Generated ContactsResource');
|
55
|
+
# EOF
|
56
|
+
|
57
|
+
# Step 3: Create the main controller
|
58
|
+
echo "📝 Step 3: Creating main controller..."
|
59
|
+
|
60
|
+
cat > src/controller/index.mts << 'EOF'
|
61
|
+
import {AbstractController} from '@aloma.io/integration-sdk';
|
62
|
+
import CompaniesResource from '../resources/companies.mts';
|
63
|
+
// import DealsResource from '../resources/deals.mts';
|
64
|
+
// import ContactsResource from '../resources/contacts.mts';
|
65
|
+
|
66
|
+
export default class Controller extends AbstractController {
|
67
|
+
companies: CompaniesResource;
|
68
|
+
// deals: DealsResource;
|
69
|
+
// contacts: ContactsResource;
|
70
|
+
|
71
|
+
constructor(fetcher: any) {
|
72
|
+
super(fetcher);
|
73
|
+
|
74
|
+
// Each resource extends AbstractController and has access to this.api
|
75
|
+
this.companies = new CompaniesResource(fetcher);
|
76
|
+
// this.deals = new DealsResource(fetcher);
|
77
|
+
// this.contacts = new ContactsResource(fetcher);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
EOF
|
81
|
+
|
82
|
+
echo "✅ Main controller created"
|
83
|
+
echo ""
|
84
|
+
|
85
|
+
# Step 4: Install dependencies and build
|
86
|
+
echo "📦 Step 4: Installing dependencies..."
|
87
|
+
yarn --ignore-engines
|
88
|
+
|
89
|
+
echo ""
|
90
|
+
echo "🔨 Step 5: Building project..."
|
91
|
+
yarn build
|
92
|
+
|
93
|
+
echo ""
|
94
|
+
echo "✅ Success! Your multi-resource connector is ready!"
|
95
|
+
echo ""
|
96
|
+
echo "📁 Project structure:"
|
97
|
+
echo " HubSpot/"
|
98
|
+
echo " ├── src/"
|
99
|
+
echo " │ ├── controller/"
|
100
|
+
echo " │ │ └── index.mts # Main controller"
|
101
|
+
echo " │ └── resources/"
|
102
|
+
echo " │ └── companies.mts # CompaniesResource"
|
103
|
+
echo " │ # └── deals.mts # (when added)"
|
104
|
+
echo " │ # └── contacts.mts # (when added)"
|
105
|
+
echo ""
|
106
|
+
echo "💡 Usage:"
|
107
|
+
echo " await controller.companies.create({ name: 'Acme Corp' });"
|
108
|
+
echo " await controller.companies.getPage(10);"
|
109
|
+
echo " await controller.companies.getById('12345');"
|
110
|
+
echo ""
|
111
|
+
echo "📝 Next steps:"
|
112
|
+
echo " 1. Add more resources (deals, contacts, etc.)"
|
113
|
+
echo " 2. Edit .env and insert the registration token"
|
114
|
+
echo " 3. Run: yarn start"
|
115
|
+
echo ""
|
116
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Create HubSpot v2 Multi-Resource Connector
|
4
|
+
# This script demonstrates how to create a multi-resource connector with multiple OpenAPI specifications
|
5
|
+
|
6
|
+
echo "🚀 Creating HubSpot v2 Multi-Resource Connector..."
|
7
|
+
|
8
|
+
# Create the multi-resource connector with all 3 resources
|
9
|
+
npx @aloma.io/integration-sdk@latest create-multi-resource "HubSpot-v2" \
|
10
|
+
--connector-id "hubspot-123" \
|
11
|
+
--resources "CompaniesResource:examples/hubspot-companies.json,ContactsResource:examples/hubspot-contacts.json,ListsResource:examples/hubspot-lists.json" \
|
12
|
+
--base-url "https://api.hubapi.com" \
|
13
|
+
--no-build
|
14
|
+
|
15
|
+
echo "✅ HubSpot v2 connector created successfully!"
|
16
|
+
echo ""
|
17
|
+
echo "📁 Generated structure:"
|
18
|
+
echo "├── src/controller/index.mts (main controller)"
|
19
|
+
echo "├── src/resources/companies.mts (CompaniesResource)"
|
20
|
+
echo "├── src/resources/contacts.mts (ContactsResource)"
|
21
|
+
echo "└── src/resources/lists.mts (ListsResource)"
|
22
|
+
echo ""
|
23
|
+
echo "🔧 Next steps:"
|
24
|
+
echo "1.) cd HubSpot-v2"
|
25
|
+
echo "2.) yarn --ignore-engines"
|
26
|
+
echo "3.) yarn build"
|
27
|
+
echo "4.) Add to workspace and configure .env"
|
28
|
+
echo "5.) yarn start"
|
29
|
+
echo ""
|
30
|
+
echo "💡 Usage examples:"
|
31
|
+
echo "await controller.companies.create({ body: { properties: { name: 'Acme Corp' } } });"
|
32
|
+
echo "await controller.contacts.getPage({ limit: 10 });"
|
33
|
+
echo "await controller.lists.getAll({ limit: 50 });"
|