@aloma.io/integration-sdk 3.8.53 → 3.8.55
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/build/openapi-to-connector.d.mts +4 -0
- package/build/openapi-to-connector.mjs +131 -18
- package/package.json +1 -1
- package/src/openapi-to-connector.mts +159 -20
- package/examples/api-without-servers.json +0 -32
- package/examples/companies-resource-class.mts +0 -310
- package/examples/companies-resource.mts +0 -310
- package/examples/complete-example.sh +0 -116
- package/examples/create-hubspot-connector.sh +0 -33
- package/examples/generate-connector.sh +0 -35
- package/examples/generated-controller.mts +0 -81
- package/examples/hubspot-companies.json +0 -1889
- package/examples/hubspot-contacts.json +0 -1919
- package/examples/hubspot-controller-individual-params.mts +0 -323
- package/examples/hubspot-controller-with-implementation.mts +0 -315
- package/examples/hubspot-controller.mts +0 -192
- package/examples/hubspot-lists.json +0 -5525
- package/examples/main-controller-with-resources.mts +0 -35
- package/examples/stripe.json +0 -182829
- package/examples/utility-click.json +0 -8992
@@ -1,116 +0,0 @@
|
|
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
|
-
|
@@ -1,33 +0,0 @@
|
|
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 });"
|
@@ -1,35 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# Example script to generate a connector from OpenAPI specification
|
4
|
-
# Usage: ./generate-connector.sh <connector-name> <openapi-file> [output-file]
|
5
|
-
|
6
|
-
set -e
|
7
|
-
|
8
|
-
CONNECTOR_NAME=${1:-"My API Connector"}
|
9
|
-
OPENAPI_FILE=${2:-"./sample-api.yaml"}
|
10
|
-
OUTPUT_FILE=${3:-"./generated-controller.mts"}
|
11
|
-
|
12
|
-
echo "🚀 Generating connector: $CONNECTOR_NAME"
|
13
|
-
echo "📄 OpenAPI spec: $OPENAPI_FILE"
|
14
|
-
echo "📝 Output file: $OUTPUT_FILE"
|
15
|
-
echo ""
|
16
|
-
|
17
|
-
# Check if OpenAPI file exists
|
18
|
-
if [ ! -f "$OPENAPI_FILE" ]; then
|
19
|
-
echo "❌ Error: OpenAPI file '$OPENAPI_FILE' not found"
|
20
|
-
exit 1
|
21
|
-
fi
|
22
|
-
|
23
|
-
# Generate the connector
|
24
|
-
node ../build/openapi-to-connector.mjs generate \
|
25
|
-
--name "$CONNECTOR_NAME" \
|
26
|
-
--spec "$OPENAPI_FILE" \
|
27
|
-
--out "$OUTPUT_FILE"
|
28
|
-
|
29
|
-
echo ""
|
30
|
-
echo "✅ Success! Generated connector controller: $OUTPUT_FILE"
|
31
|
-
echo ""
|
32
|
-
echo "Next steps:"
|
33
|
-
echo "1. Review the generated controller"
|
34
|
-
echo "2. Implement the actual API calls in each method"
|
35
|
-
echo "3. Add the controller to your Aloma connector project"
|
@@ -1,81 +0,0 @@
|
|
1
|
-
import {AbstractController} from '@aloma.io/integration-sdk';
|
2
|
-
|
3
|
-
export default class Controller extends AbstractController {
|
4
|
-
|
5
|
-
/**
|
6
|
-
* List all users
|
7
|
-
* Retrieve a paginated list of all users in the system
|
8
|
-
*
|
9
|
-
* @param args - Request arguments
|
10
|
-
* @param args.page - Page number for pagination
|
11
|
-
* @param args.limit - Number of users per page
|
12
|
-
* @returns Response data
|
13
|
-
*/
|
14
|
-
async listUsers(args: any) {
|
15
|
-
// TODO: Implement GET /users
|
16
|
-
throw new Error('Method not implemented');
|
17
|
-
}
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Create a new user
|
21
|
-
* Create a new user account in the system
|
22
|
-
*
|
23
|
-
* @param args.body - Request body
|
24
|
-
* @returns Response data
|
25
|
-
*/
|
26
|
-
async createUser(args: any) {
|
27
|
-
// TODO: Implement POST /users
|
28
|
-
throw new Error('Method not implemented');
|
29
|
-
}
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Get user by ID
|
33
|
-
* Retrieve a specific user by their unique identifier
|
34
|
-
*
|
35
|
-
* @param args - Request arguments
|
36
|
-
* @param args.id - Unique identifier of the user
|
37
|
-
* @returns Response data
|
38
|
-
*/
|
39
|
-
async getUserById(args: any) {
|
40
|
-
// TODO: Implement GET /users/{id}
|
41
|
-
throw new Error('Method not implemented');
|
42
|
-
}
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Update user
|
46
|
-
* Update an existing user's information
|
47
|
-
*
|
48
|
-
* @param args - Request arguments
|
49
|
-
* @param args.id - Unique identifier of the user
|
50
|
-
*
|
51
|
-
* @param args.body - Request body
|
52
|
-
* @returns Response data
|
53
|
-
*/
|
54
|
-
async updateUser(args: any) {
|
55
|
-
// TODO: Implement PUT /users/{id}
|
56
|
-
throw new Error('Method not implemented');
|
57
|
-
}
|
58
|
-
|
59
|
-
/**
|
60
|
-
* Delete user
|
61
|
-
* Permanently delete a user from the system
|
62
|
-
*
|
63
|
-
* @param args - Request arguments
|
64
|
-
* @param args.id - Unique identifier of the user
|
65
|
-
* @returns Response data
|
66
|
-
*/
|
67
|
-
async deleteUser(args: any) {
|
68
|
-
// TODO: Implement DELETE /users/{id}
|
69
|
-
throw new Error('Method not implemented');
|
70
|
-
}
|
71
|
-
|
72
|
-
/**
|
73
|
-
* Health check
|
74
|
-
* Check the health status of the API
|
75
|
-
* @returns Response data
|
76
|
-
*/
|
77
|
-
async healthCheck(args: any) {
|
78
|
-
// TODO: Implement GET /health
|
79
|
-
throw new Error('Method not implemented');
|
80
|
-
}
|
81
|
-
}
|