Skip to content

Commit 09e9dca

Browse files
intel352claude
andcommitted
feat: add scenario 57-salesforce-integration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6f8fb3c commit 09e9dca

5 files changed

Lines changed: 724 additions & 0 deletions

File tree

Lines changed: 295 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
# ============================================================
2+
# Scenario 57 — Salesforce Integration
3+
#
4+
# Tests workflow-plugin-salesforce step types against a mock
5+
# Salesforce REST API server running as a sidecar on :19057.
6+
#
7+
# The salesforce.provider module is configured with an
8+
# instanceUrl that redirects all REST calls to the local mock.
9+
#
10+
# Endpoints:
11+
# GET /healthz — health check
12+
# POST /api/v1/sf/records/{type} — create record
13+
# GET /api/v1/sf/records/{type}/{id} — get record
14+
# PATCH /api/v1/sf/records/{type}/{id} — update record
15+
# DELETE /api/v1/sf/records/{type}/{id} — delete record
16+
# GET /api/v1/sf/query — SOQL query
17+
# GET /api/v1/sf/describe — describe global
18+
# GET /api/v1/sf/describe/{type} — describe object
19+
# GET /api/v1/sf/limits — org limits
20+
# GET /api/v1/sf/identity — current user info
21+
# ============================================================
22+
23+
modules:
24+
- name: server
25+
type: http.server
26+
config:
27+
address: ":8080"
28+
- name: router
29+
type: http.router
30+
dependsOn: [server]
31+
- name: salesforce
32+
type: salesforce.provider
33+
config:
34+
accessToken: "mock-access-token-for-testing"
35+
instanceUrl: "http://localhost:19057"
36+
apiVersion: "v63.0"
37+
38+
workflows:
39+
http:
40+
router: router
41+
server: server
42+
routes: []
43+
44+
pipelines:
45+
# ----------------------------------------------------------------
46+
# Health
47+
# ----------------------------------------------------------------
48+
health:
49+
trigger:
50+
type: http
51+
config:
52+
path: /healthz
53+
method: GET
54+
steps:
55+
- name: respond
56+
type: step.json_response
57+
config:
58+
status: 200
59+
body:
60+
status: ok
61+
scenario: "57-salesforce-integration"
62+
63+
# ----------------------------------------------------------------
64+
# Create Record
65+
# POST /api/v1/sf/records/{type}
66+
# Body: { "fields": { "Name": "Acme", ... } }
67+
# ----------------------------------------------------------------
68+
create_record:
69+
trigger:
70+
type: http
71+
config:
72+
path: /api/v1/sf/records/{type}
73+
method: POST
74+
steps:
75+
- name: parse
76+
type: step.request_parse
77+
config:
78+
parse_body: true
79+
- name: prepare
80+
type: step.set
81+
config:
82+
values:
83+
sobject_type: "{{ .type }}"
84+
fields: "{{ .body.fields }}"
85+
- name: create
86+
type: step.salesforce_record_create
87+
config:
88+
module: salesforce
89+
- name: respond
90+
type: step.json_response
91+
config:
92+
status: 201
93+
body_from: "steps.create"
94+
95+
# ----------------------------------------------------------------
96+
# Get Record
97+
# GET /api/v1/sf/records/{type}/{id}
98+
# ----------------------------------------------------------------
99+
get_record:
100+
trigger:
101+
type: http
102+
config:
103+
path: /api/v1/sf/records/{type}/{id}
104+
method: GET
105+
steps:
106+
- name: prepare
107+
type: step.set
108+
config:
109+
values:
110+
sobject_type: "{{ .type }}"
111+
record_id: "{{ .id }}"
112+
- name: get
113+
type: step.salesforce_record_get
114+
config:
115+
module: salesforce
116+
- name: respond
117+
type: step.json_response
118+
config:
119+
status: 200
120+
body_from: "steps.get"
121+
122+
# ----------------------------------------------------------------
123+
# Update Record
124+
# PATCH /api/v1/sf/records/{type}/{id}
125+
# Body: { "fields": { "Name": "Updated" } }
126+
# ----------------------------------------------------------------
127+
update_record:
128+
trigger:
129+
type: http
130+
config:
131+
path: /api/v1/sf/records/{type}/{id}
132+
method: PATCH
133+
steps:
134+
- name: parse
135+
type: step.request_parse
136+
config:
137+
parse_body: true
138+
- name: prepare
139+
type: step.set
140+
config:
141+
values:
142+
sobject_type: "{{ .type }}"
143+
record_id: "{{ .id }}"
144+
fields: "{{ .body.fields }}"
145+
- name: update
146+
type: step.salesforce_record_update
147+
config:
148+
module: salesforce
149+
- name: respond
150+
type: step.json_response
151+
config:
152+
status: 200
153+
body_from: "steps.update"
154+
155+
# ----------------------------------------------------------------
156+
# Delete Record
157+
# DELETE /api/v1/sf/records/{type}/{id}
158+
# ----------------------------------------------------------------
159+
delete_record:
160+
trigger:
161+
type: http
162+
config:
163+
path: /api/v1/sf/records/{type}/{id}
164+
method: DELETE
165+
steps:
166+
- name: prepare
167+
type: step.set
168+
config:
169+
values:
170+
sobject_type: "{{ .type }}"
171+
record_id: "{{ .id }}"
172+
- name: delete
173+
type: step.salesforce_record_delete
174+
config:
175+
module: salesforce
176+
- name: respond
177+
type: step.json_response
178+
config:
179+
status: 200
180+
body_from: "steps.delete"
181+
182+
# ----------------------------------------------------------------
183+
# SOQL Query
184+
# GET /api/v1/sf/query?soql=SELECT+Id,Name+FROM+Account
185+
# ----------------------------------------------------------------
186+
query:
187+
trigger:
188+
type: http
189+
config:
190+
path: /api/v1/sf/query
191+
method: GET
192+
steps:
193+
- name: prepare
194+
type: step.set
195+
config:
196+
values:
197+
soql: "{{ .soql }}"
198+
- name: query
199+
type: step.salesforce_query
200+
config:
201+
module: salesforce
202+
- name: respond
203+
type: step.json_response
204+
config:
205+
status: 200
206+
body_from: "steps.query"
207+
208+
# ----------------------------------------------------------------
209+
# Describe Global
210+
# GET /api/v1/sf/describe
211+
# ----------------------------------------------------------------
212+
describe_global:
213+
trigger:
214+
type: http
215+
config:
216+
path: /api/v1/sf/describe
217+
method: GET
218+
steps:
219+
- name: describe
220+
type: step.salesforce_describe_global
221+
config:
222+
module: salesforce
223+
- name: respond
224+
type: step.json_response
225+
config:
226+
status: 200
227+
body_from: "steps.describe"
228+
229+
# ----------------------------------------------------------------
230+
# Describe Object
231+
# GET /api/v1/sf/describe/{type}
232+
# ----------------------------------------------------------------
233+
describe_object:
234+
trigger:
235+
type: http
236+
config:
237+
path: /api/v1/sf/describe/{type}
238+
method: GET
239+
steps:
240+
- name: prepare
241+
type: step.set
242+
config:
243+
values:
244+
sobject_type: "{{ .type }}"
245+
- name: describe
246+
type: step.salesforce_record_describe
247+
config:
248+
module: salesforce
249+
- name: respond
250+
type: step.json_response
251+
config:
252+
status: 200
253+
body_from: "steps.describe"
254+
255+
# ----------------------------------------------------------------
256+
# Org Limits
257+
# GET /api/v1/sf/limits
258+
# ----------------------------------------------------------------
259+
org_limits:
260+
trigger:
261+
type: http
262+
config:
263+
path: /api/v1/sf/limits
264+
method: GET
265+
steps:
266+
- name: limits
267+
type: step.salesforce_org_limits
268+
config:
269+
module: salesforce
270+
- name: respond
271+
type: step.json_response
272+
config:
273+
status: 200
274+
body_from: "steps.limits"
275+
276+
# ----------------------------------------------------------------
277+
# Identity / Current User
278+
# GET /api/v1/sf/identity
279+
# ----------------------------------------------------------------
280+
identity:
281+
trigger:
282+
type: http
283+
config:
284+
path: /api/v1/sf/identity
285+
method: GET
286+
steps:
287+
- name: identity
288+
type: step.salesforce_identity_get
289+
config:
290+
module: salesforce
291+
- name: respond
292+
type: step.json_response
293+
config:
294+
status: 200
295+
body_from: "steps.identity"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/GoCodeAlone/workflow-scenarios/scenarios/57-salesforce-integration/mock
2+
3+
go 1.22.0

0 commit comments

Comments
 (0)