@@ -16,23 +16,213 @@ export interface UseFmeServiceInputs {
16
16
* @required
17
17
*/
18
18
path :
19
+ | "automations"
20
+ | "automations/workflows"
21
+ | "automations/workflows/tags"
22
+ | "automations/workflows/tags/{tag}"
23
+ | "automations/workflows/{id}"
24
+ | "automations/workflows/{id}/enabled"
25
+ | "automations/workflows/{id}/log"
26
+ | "automations/workflows/{id}/status"
27
+ | "automations/workflows/{id}/trigger"
28
+ | "cleanup/configuration"
29
+ | "cleanup/configuration/reset"
30
+ | "cleanup/tasks"
31
+ | "cleanup/tasks/automationLogs"
32
+ | "cleanup/tasks/clientsessions"
33
+ | "cleanup/tasks/details/{category}/{name}"
34
+ | "cleanup/tasks/details/{category}/{name}/enabled"
35
+ | "cleanup/tasks/files"
36
+ | "cleanup/tasks/files/"
37
+ | "cleanup/tasks/jobs"
38
+ | "cleanup/tasks/systemEvent"
39
+ | "cleanup/tasks/tokens"
19
40
| "healthcheck"
20
41
| "info"
42
+ | "licensing/license"
43
+ | "licensing/license/capabilities"
44
+ | "licensing/license/status"
45
+ | "licensing/machinekey"
46
+ | "licensing/refresh"
47
+ | "licensing/refresh/status"
48
+ | "licensing/request"
49
+ | "licensing/request/status"
50
+ | "licensing/requestfile"
51
+ | "licensing/systemcode"
52
+ | "metrics"
53
+ | "migration/backup/download"
54
+ | "migration/backup/resource"
55
+ | "migration/restore/resource"
56
+ | "migration/restore/upload"
57
+ | "migration/tasks"
58
+ | "migration/tasks/id/{id}"
59
+ | "migration/tasks/id/{id}/log"
21
60
| "notifications/publications"
61
+ | "notifications/publications/{publication}"
62
+ | "notifications/publications/{publication}/failuretopics"
63
+ | "notifications/publications/{publication}/failuretopics/{topic}"
64
+ | "notifications/publications/{publication}/properties"
65
+ | "notifications/publications/{publication}/properties/{property}"
66
+ | "notifications/publications/{publication}/successtopics"
67
+ | "notifications/publications/{publication}/successtopics/{topic}"
68
+ | "notifications/publications/{publication}/topics"
69
+ | "notifications/publications/{publication}/topics/{topic}"
22
70
| "notifications/publishers"
71
+ | "notifications/publishers/{publisher}"
23
72
| "notifications/subscribers"
73
+ | "notifications/subscribers/{subscribers}"
24
74
| "notifications/subscriptions"
75
+ | "notifications/subscriptions/{subscription}"
76
+ | "notifications/subscriptions/{subscription}/failuretopics"
77
+ | "notifications/subscriptions/{subscription}/failuretopics/{topic}"
78
+ | "notifications/subscriptions/{subscription}/properties"
79
+ | "notifications/subscriptions/{subscription}/properties/{property}"
80
+ | "notifications/subscriptions/{subscription}/successtopics"
81
+ | "notifications/subscriptions/{subscription}/successtopics/{topic}"
82
+ | "notifications/subscriptions/{subscription}/topics"
83
+ | "notifications/subscriptions/{subscription}/topics/{topic}"
84
+ | "notifications/test/publications"
85
+ | "notifications/test/publications/{publication}"
86
+ | "notifications/test/subscriptions"
87
+ | "notifications/test/subscriptions/{subscription}"
25
88
| "notifications/topics"
89
+ | "notifications/topics/{topic}"
90
+ | "notifications/topics/{topic}/message"
91
+ | "notifications/topics/{topic}/message/subscribercontent"
92
+ | "projects/import/resource"
93
+ | "projects/import/upload"
94
+ | "projects/itemtypes"
95
+ | "projects/projects"
96
+ | "projects/projects/{project}"
97
+ | "projects/projects/{project}/deleteall"
98
+ | "projects/projects/{project}/export/download"
99
+ | "projects/projects/{project}/export/resource"
100
+ | "projects/projects/{project}/icon"
101
+ | "projects/projects/{project}/items"
102
+ | "projects/projects/{project}/items/resourcepaths/{resource}/{path}"
103
+ | "projects/projects/{project}/items/{type}/{item}"
104
+ | "projects/projects/{project}/items/{type}/{scope}/{item}"
105
+ | "projects/test/projects"
26
106
| "repositories"
107
+ | "repositories/{repository}"
108
+ | "repositories/{repository}/items"
109
+ | "repositories/{repository}/items/{item}"
110
+ | "repositories/{repository}/items/{item}/datasets/{dtype}"
111
+ | "repositories/{repository}/items/{item}/datasets/{dtype}/{dataset}"
112
+ | "repositories/{repository}/items/{item}/datasets/{dtype}/{dataset}/featuretypes"
113
+ | "repositories/{repository}/items/{item}/datasets/{dtype}/{dataset}/featuretypes/{feature}"
114
+ | "repositories/{repository}/items/{item}/datasets/{dtype}/{dataset}/featuretypes/{feature}/attributes"
115
+ | "repositories/{repository}/items/{item}/datasets/{dtype}/{dataset}/featuretypes/{feature}/attributes/{attribute}"
116
+ | "repositories/{repository}/items/{item}/detailedservices"
117
+ | "repositories/{repository}/items/{item}/metrics"
118
+ | "repositories/{repository}/items/{item}/parameters"
119
+ | "repositories/{repository}/items/{item}/parameters/{pubparam}"
120
+ | "repositories/{repository}/items/{item}/resources"
121
+ | "repositories/{repository}/items/{item}/resources/{resource}"
122
+ | "repositories/{repository}/items/{item}/services"
123
+ | "repositories/{repository}/items/{item}/services/{service}"
27
124
| "resources/connections"
125
+ | "resources/connections/{resource}"
126
+ | "resources/connections/{resource}/copy/{path}"
127
+ | "resources/connections/{resource}/directdownloadurl/{path}"
128
+ | "resources/connections/{resource}/directuploadurl/{path}"
129
+ | "resources/connections/{resource}/downloadzip/{directory}"
130
+ | "resources/connections/{resource}/download/{path}"
131
+ | "resources/connections/{resource}/filesys/{path}"
132
+ | "resources/connections/{resource}/move/{path}"
133
+ | "resources/directdownloadurlparameters"
134
+ | "resources/directuploadurlparameters"
135
+ | "resources/test/connections"
136
+ | "resources/test/connections/{resource}"
28
137
| "resources/types"
29
138
| "schedules"
30
139
| "schedules/categories"
140
+ | "schedules/{category}/{name}"
141
+ | "schedules/{category}/{name}/metrics"
142
+ | "schedules/{category}/{name}/trigger"
143
+ | "security/accounts"
144
+ | "security/accounts/{account}"
145
+ | "security/accounts/{account}/email"
146
+ | "security/accounts/{account}/enabled"
147
+ | "security/accounts/{account}/ldap"
148
+ | "security/accounts/{account}/password"
149
+ | "security/accounts/{account}/passwordChangeNeeded"
150
+ | "security/accounts/{account}/roles"
151
+ | "security/accounts/{account}/roles/{role}"
152
+ | "security/categories"
153
+ | "security/categories/{category}"
154
+ | "security/categories/{category}/resources"
155
+ | "security/categories/{category}/resources/{resource}"
156
+ | "security/categories/{category}/resources/{resource}/roles"
157
+ | "security/categories/{category}/resources/{resource}/roles/{role}"
158
+ | "security/categories/{category}/resources/{resource}/roles/{role}/permissions/{permission}"
159
+ | "security/categories/{category}/roles"
160
+ | "security/categories/{category}/roles/{role}"
161
+ | "security/categories/{category}/roles/{role}/permissions/{permission}"
162
+ | "security/ldap/servers"
163
+ | "security/ldap/servers/{server}"
164
+ | "security/ldap/servers/{server}/importrole"
165
+ | "security/ldap/servers/{server}/importuser"
166
+ | "security/ldap/servers/{server}/role"
167
+ | "security/ldap/servers/{server}/roles"
168
+ | "security/ldap/servers/{server}/synchronize"
169
+ | "security/ldap/servers/{server}/user"
170
+ | "security/ldap/servers/{server}/users"
171
+ | "security/roles"
172
+ | "security/roles/{role}"
173
+ | "security/roles/{role}/accounts"
174
+ | "security/roles/{role}/accounts/{account}"
175
+ | "security/roles/{role}/ldap"
176
+ | "systemevents/configurations"
177
+ | "systemevents/configurations/{configuration}"
178
+ | "systemevents/configurations/{configuration}/enabled"
179
+ | "systemevents/events/completed"
180
+ | "systemevents/schema/events"
181
+ | "systemevents/schema/events/{configuration}"
182
+ | "systemevents/schema/parameters"
183
+ | "systemevents/schema/parameters/{configuration}"
184
+ | "tokens"
185
+ | "tokens/{user}/{name}"
186
+ | "tokens/{user}/{name}/categories"
187
+ | "tokens/{user}/{name}/categories/{category}"
188
+ | "tokens/{user}/{name}/enabled"
189
+ | "tokens/{user}/{name}/resources"
190
+ | "tokens/{user}/{name}/resources/{category}/{resource}"
191
+ | "transformations/engines"
192
+ | "transformations/jobroutes/defaulttag"
193
+ | "transformations/jobroutes/tags"
194
+ | "transformations/jobroutes/tags/{tag}"
195
+ | "transformations/jobroutes/tags/{tag}/engines"
196
+ | "transformations/jobroutes/tags/{tag}/engines/{engine}"
197
+ | "transformations/jobroutes/tags/{tag}/repositories"
198
+ | "transformations/jobroutes/tags/{tag}/repositories/{repository}"
199
+ | "transformations/jobs/active"
200
+ | "transformations/jobs/active/{jobid}"
201
+ | "transformations/jobs/completed"
202
+ | "transformations/jobs/completed/{jobid}"
203
+ | "transformations/jobs/id/{jobid}"
204
+ | "transformations/jobs/id/{jobid}/log"
205
+ | "transformations/jobs/id/{jobid}/request"
206
+ | "transformations/jobs/id/{jobid}/result"
207
+ | "transformations/jobs/queued"
208
+ | "transformations/jobs/queued/{jobid}"
209
+ | "transformations/jobs/running"
210
+ | "transformations/jobs/running/{jobid}"
211
+ | "transformations/submit/{repository}/{workspace}"
212
+ | "transformations/transact/{repository}/{workspace}"
213
+ | "transformations/transactdata/{repository}/{workspace}"
214
+ | "user/favorites/workspaces"
215
+ | "user/favorites/workspaces/{repository}/{workspace}"
216
+ | "user/recent/automations"
217
+ | "user/recent/projects"
218
+ | "user/recent/workspaces"
219
+ | "user/security/categories"
220
+ | "user/security/resources"
31
221
| string ;
32
222
/**
33
223
* @description The HTTP method to use to make the request. The default is GET.
34
224
*/
35
- method ?: "GET" | "POST" | "PUSH " | "DELETE" ;
225
+ method ?: "GET" | "POST" | "PUT " | "DELETE" ;
36
226
/**
37
227
* @description The content type of the request. This is required when the method is POST or PUT.
38
228
*/
@@ -41,9 +231,16 @@ export interface UseFmeServiceInputs {
41
231
| "application/json"
42
232
| "multipart/form-data" ;
43
233
/**
44
- * @description The body parameters to pass to the service operation when the method is POST or PUT.
234
+ * @description The body parameters or object to pass to the service operation when the method is POST or PUT.
45
235
*/
46
236
parameters ?: string | Record < string , any > ;
237
+ /**
238
+ * @description Parameters used to substitute {token} values in the path. For example, use an object like { repository: "my-repo" } to replace the {repository} token in the path "repositories/{repository}/items".
239
+ */
240
+ pathParameters ?: Record <
241
+ string ,
242
+ string | number | boolean | null | undefined
243
+ > ;
47
244
}
48
245
49
246
/** An interface that defines the outputs of the activity. */
@@ -64,14 +261,23 @@ export interface UseFmeServiceOutputs {
64
261
*/
65
262
export class UseFmeService implements IActivityHandler {
66
263
async execute ( inputs : UseFmeServiceInputs ) : Promise < UseFmeServiceOutputs > {
67
- const { contentType, method, parameters, path, service } = inputs ;
264
+ const {
265
+ contentType,
266
+ method,
267
+ parameters,
268
+ path,
269
+ pathParameters,
270
+ service,
271
+ } = inputs ;
68
272
if ( ! service ) {
69
273
throw new Error ( "service is required" ) ;
70
274
}
71
275
if ( ! path ) {
72
276
throw new Error ( "path is required" ) ;
73
277
}
74
278
279
+ const finalPath = replacePathParameters ( path , pathParameters ) ;
280
+
75
281
let params : string | FormData | undefined ;
76
282
if ( typeof parameters === "object" ) {
77
283
if ( contentType === "application/json" ) {
@@ -92,7 +298,7 @@ export class UseFmeService implements IActivityHandler {
92
298
/* eslint-disable @typescript-eslint/no-non-null-assertion */
93
299
return new Promise ( ( resolve ) => {
94
300
service . server . customRequest (
95
- `${ service . url } /fmerest/v3/${ path } ` ,
301
+ `${ service . url } /fmerest/v3/${ finalPath } ` ,
96
302
method || "GET" ,
97
303
( result ) => {
98
304
return resolve ( {
@@ -106,3 +312,18 @@ export class UseFmeService implements IActivityHandler {
106
312
/* eslint-enable @typescript-eslint/no-non-null-assertion */
107
313
}
108
314
}
315
+
316
+ function replacePathParameters (
317
+ path : string ,
318
+ pathParameters : UseFmeServiceInputs [ "pathParameters" ]
319
+ ) {
320
+ if ( pathParameters ) {
321
+ for ( const key in pathParameters ) {
322
+ const value = pathParameters [ key ] ;
323
+ const valueToEncode =
324
+ value === undefined || value === null ? "" : value ;
325
+ path = path . replace ( `{${ key } }` , encodeURIComponent ( valueToEncode ) ) ;
326
+ }
327
+ }
328
+ return path ;
329
+ }
0 commit comments