@prismatic-io/components-azureservicebus 0.0.0-stage → 0.1.0
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 +64 -2
- package/dist/icon.png +0 -0
- package/dist/index.js +504 -0
- package/npm-dist/icon.png +0 -0
- package/npm-dist/index.cjs +2907 -0
- package/npm-dist/index.d.cts +2049 -0
- package/package.json +51 -4
|
@@ -0,0 +1,2907 @@
|
|
|
1
|
+
let _prismatic_io_spectral = require("@prismatic-io/spectral");
|
|
2
|
+
let _prismatic_io_spectral_http = require("@prismatic-io/spectral/http");
|
|
3
|
+
let _azure_identity = require("@azure/identity");
|
|
4
|
+
let _azure_service_bus = require("@azure/service-bus");
|
|
5
|
+
//#region src/connections.ts
|
|
6
|
+
const oauth = (0, _prismatic_io_spectral.oauth2Connection)({
|
|
7
|
+
key: "oauth",
|
|
8
|
+
display: {
|
|
9
|
+
description: "OAuth 2.0",
|
|
10
|
+
label: "OAuth 2.0"
|
|
11
|
+
},
|
|
12
|
+
oauth2Type: _prismatic_io_spectral.OAuth2Type.AuthorizationCode,
|
|
13
|
+
inputs: {
|
|
14
|
+
authorizeUrl: {
|
|
15
|
+
label: "Authorize URL",
|
|
16
|
+
placeholder: "Authorize URL",
|
|
17
|
+
type: "string",
|
|
18
|
+
required: true,
|
|
19
|
+
shown: true,
|
|
20
|
+
comments: "The OAuth 2.0 Authorization URL for Azure Service Bus",
|
|
21
|
+
default: "https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize"
|
|
22
|
+
},
|
|
23
|
+
tokenUrl: {
|
|
24
|
+
label: "Token URL",
|
|
25
|
+
placeholder: "Token URL",
|
|
26
|
+
type: "string",
|
|
27
|
+
required: true,
|
|
28
|
+
shown: true,
|
|
29
|
+
comments: "The OAuth 2.0 Token URL for Azure Service Bus",
|
|
30
|
+
default: "https://login.microsoftonline.com/organizations/oauth2/v2.0/token"
|
|
31
|
+
},
|
|
32
|
+
scopes: {
|
|
33
|
+
label: "Scopes",
|
|
34
|
+
placeholder: "Scopes",
|
|
35
|
+
type: "string",
|
|
36
|
+
required: true,
|
|
37
|
+
shown: true,
|
|
38
|
+
default: "https://management.azure.com/.default"
|
|
39
|
+
},
|
|
40
|
+
clientId: {
|
|
41
|
+
label: "Client ID",
|
|
42
|
+
placeholder: "Client ID",
|
|
43
|
+
type: "string",
|
|
44
|
+
required: true,
|
|
45
|
+
shown: true,
|
|
46
|
+
comments: "Generate this value when you create your Active Directory App"
|
|
47
|
+
},
|
|
48
|
+
clientSecret: {
|
|
49
|
+
label: "Client Secret",
|
|
50
|
+
placeholder: "Client Secret",
|
|
51
|
+
type: "password",
|
|
52
|
+
required: true,
|
|
53
|
+
shown: true,
|
|
54
|
+
comments: "Generate this value when you create your Active Directory App"
|
|
55
|
+
},
|
|
56
|
+
tenantId: {
|
|
57
|
+
label: "Tenant ID",
|
|
58
|
+
placeholder: "Tenant ID",
|
|
59
|
+
type: "string",
|
|
60
|
+
required: true,
|
|
61
|
+
shown: true,
|
|
62
|
+
comments: "Generate this value when you create your Active Directory App"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const connectionString = (0, _prismatic_io_spectral.connection)({
|
|
67
|
+
key: "connection-string",
|
|
68
|
+
display: {
|
|
69
|
+
description: "Connection String",
|
|
70
|
+
label: "Connection String"
|
|
71
|
+
},
|
|
72
|
+
inputs: { connectionString: {
|
|
73
|
+
label: "Connection String",
|
|
74
|
+
type: "password",
|
|
75
|
+
required: true,
|
|
76
|
+
shown: true,
|
|
77
|
+
comments: "The connection string for your Azure Service Bus namespace. You can find this in the Azure Portal under the 'Shared access policies' tab."
|
|
78
|
+
} }
|
|
79
|
+
});
|
|
80
|
+
var connections_default = [oauth, connectionString];
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/client.ts
|
|
83
|
+
const validateConnection = (connection) => {
|
|
84
|
+
if (connection.key !== oauth.key) throw new _prismatic_io_spectral.ConnectionError(connection, "Unknown Connection type provided. Only 'OAuth 2.0' authentication method is supported for this action.");
|
|
85
|
+
};
|
|
86
|
+
const validateConnectionLibrary = (connection) => {
|
|
87
|
+
if (connection.key !== connectionString.key) throw new _prismatic_io_spectral.ConnectionError(connection, "Unknown Connection type provided. Only 'Connection String' authentication method is supported for this action.");
|
|
88
|
+
};
|
|
89
|
+
const generateOAuthCredentials = (connection, namespace) => {
|
|
90
|
+
const { clientId, clientSecret, tenantId } = connection.fields;
|
|
91
|
+
const credential = new _azure_identity.ClientSecretCredential(_prismatic_io_spectral.util.types.toString(tenantId), _prismatic_io_spectral.util.types.toString(clientId), _prismatic_io_spectral.util.types.toString(clientSecret));
|
|
92
|
+
return new _azure_service_bus.ServiceBusClient(`${namespace}.servicebus.windows.net`, credential);
|
|
93
|
+
};
|
|
94
|
+
const generateConnectionStringCredentials = (connection) => {
|
|
95
|
+
const { connectionString } = connection.fields;
|
|
96
|
+
return new _azure_service_bus.ServiceBusClient(_prismatic_io_spectral.util.types.toString(connectionString));
|
|
97
|
+
};
|
|
98
|
+
const generateClient = (connection, namespace) => {
|
|
99
|
+
switch (connection.key) {
|
|
100
|
+
case oauth.key: return generateOAuthCredentials(connection, namespace);
|
|
101
|
+
case connectionString.key: return generateConnectionStringCredentials(connection);
|
|
102
|
+
default: throw new _prismatic_io_spectral.ConnectionError(connection, "Unknown Connection type provided.");
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const getAzureServiceBusClient = (connection, debug) => {
|
|
106
|
+
validateConnection(connection);
|
|
107
|
+
return (0, _prismatic_io_spectral_http.createClient)({
|
|
108
|
+
baseUrl: "https://management.azure.com/subscriptions",
|
|
109
|
+
headers: { Authorization: `Bearer ${_prismatic_io_spectral.util.types.toString(connection?.token?.access_token)}` },
|
|
110
|
+
debug
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const azureServiceBusClientLibrary = (connection, namespace) => {
|
|
114
|
+
validateConnectionLibrary(connection);
|
|
115
|
+
return generateClient(connection, namespace);
|
|
116
|
+
};
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/examplePayloads/serviceBus.ts
|
|
119
|
+
const getNamespacesExamplePayload = { data: {
|
|
120
|
+
sku: {
|
|
121
|
+
name: "Standard",
|
|
122
|
+
tier: "Standard"
|
|
123
|
+
},
|
|
124
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-2924",
|
|
125
|
+
name: "sdk-Namespace-2924",
|
|
126
|
+
type: "Microsoft.ServiceBus/Namespaces",
|
|
127
|
+
location: "South Central US",
|
|
128
|
+
tags: {
|
|
129
|
+
tag1: "value1",
|
|
130
|
+
tag2: "value2"
|
|
131
|
+
},
|
|
132
|
+
properties: {
|
|
133
|
+
provisioningState: "Succeeded",
|
|
134
|
+
metricId: "5f750a97-50d9-4e36-8081-c9ee4c0210d4:sdk-namespace-2924",
|
|
135
|
+
createdAt: "2017-05-25T22:26:36.76Z",
|
|
136
|
+
updatedAt: "2017-05-25T22:26:59.35Z",
|
|
137
|
+
serviceBusEndpoint: "https://sdk-Namespace-2924.servicebus.windows-int.net:443/",
|
|
138
|
+
disableLocalAuth: false
|
|
139
|
+
}
|
|
140
|
+
} };
|
|
141
|
+
const createOrUpdateNamespacesExamplePayload = { data: {
|
|
142
|
+
sku: {
|
|
143
|
+
name: "Standard",
|
|
144
|
+
tier: "Standard"
|
|
145
|
+
},
|
|
146
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-2924",
|
|
147
|
+
name: "sdk-Namespace-2924",
|
|
148
|
+
type: "Microsoft.ServiceBus/Namespaces",
|
|
149
|
+
location: "South Central US",
|
|
150
|
+
tags: {
|
|
151
|
+
tag1: "value1",
|
|
152
|
+
tag2: "value2"
|
|
153
|
+
},
|
|
154
|
+
properties: {
|
|
155
|
+
provisioningState: "Succeeded",
|
|
156
|
+
metricId: "5f750a97-50d9-4e36-8081-c9ee4c0210d4:sdk-namespace-2924",
|
|
157
|
+
createdAt: "2017-05-25T22:26:36.76Z",
|
|
158
|
+
updatedAt: "2017-05-25T22:26:59.35Z",
|
|
159
|
+
serviceBusEndpoint: "https://sdk-Namespace-2924.servicebus.windows-int.net:443/",
|
|
160
|
+
disableLocalAuth: false
|
|
161
|
+
}
|
|
162
|
+
} };
|
|
163
|
+
const listNamespacesExamplePayload = { data: { value: [{
|
|
164
|
+
sku: {
|
|
165
|
+
name: "Standard",
|
|
166
|
+
tier: "Standard"
|
|
167
|
+
},
|
|
168
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-2924",
|
|
169
|
+
name: "sdk-Namespace-2924",
|
|
170
|
+
type: "Microsoft.ServiceBus/Namespaces",
|
|
171
|
+
location: "South Central US",
|
|
172
|
+
tags: {
|
|
173
|
+
tag1: "value1",
|
|
174
|
+
tag2: "value2"
|
|
175
|
+
},
|
|
176
|
+
properties: {
|
|
177
|
+
provisioningState: "Succeeded",
|
|
178
|
+
metricId: "5f750a97-50d9-4e36-8081-c9ee4c0210d4:sdk-namespace-2924",
|
|
179
|
+
createdAt: "2017-05-25T22:26:36.76Z",
|
|
180
|
+
updatedAt: "2017-05-25T22:26:59.35Z",
|
|
181
|
+
serviceBusEndpoint: "https://sdk-Namespace-2924.servicebus.windows-int.net:443/",
|
|
182
|
+
disableLocalAuth: false
|
|
183
|
+
}
|
|
184
|
+
}] } };
|
|
185
|
+
const listNamespacesByResourceGroupExamplePayload = { data: { value: [{
|
|
186
|
+
sku: {
|
|
187
|
+
name: "Standard",
|
|
188
|
+
tier: "Standard"
|
|
189
|
+
},
|
|
190
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-2924",
|
|
191
|
+
name: "sdk-Namespace-2924",
|
|
192
|
+
type: "Microsoft.ServiceBus/Namespaces",
|
|
193
|
+
location: "South Central US",
|
|
194
|
+
tags: {
|
|
195
|
+
tag1: "value1",
|
|
196
|
+
tag2: "value2"
|
|
197
|
+
},
|
|
198
|
+
properties: {
|
|
199
|
+
provisioningState: "Succeeded",
|
|
200
|
+
metricId: "5f750a97-50d9-4e36-8081-c9ee4c0210d4:sdk-namespace-2924",
|
|
201
|
+
createdAt: "2017-05-25T22:26:36.76Z",
|
|
202
|
+
updatedAt: "2017-05-25T22:26:59.35Z",
|
|
203
|
+
serviceBusEndpoint: "https://sdk-Namespace-2924.servicebus.windows-int.net:443/",
|
|
204
|
+
disableLocalAuth: false
|
|
205
|
+
}
|
|
206
|
+
}] } };
|
|
207
|
+
const deleteNamespaceExamplePayload = { data: null };
|
|
208
|
+
const getQueueExamplePayload = { data: {
|
|
209
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-3174/queues/sdk-Queues-5647",
|
|
210
|
+
name: "sdk-Queues-5647",
|
|
211
|
+
type: "Microsoft.ServiceBus/Namespaces/Queues",
|
|
212
|
+
properties: {
|
|
213
|
+
lockDuration: "PT1M",
|
|
214
|
+
maxSizeInMegabytes: 163840,
|
|
215
|
+
maxMessageSizeInKilobytes: 10240,
|
|
216
|
+
requiresDuplicateDetection: false,
|
|
217
|
+
requiresSession: false,
|
|
218
|
+
defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
|
|
219
|
+
duplicateDetectionHistoryTimeWindow: "PT10M",
|
|
220
|
+
maxDeliveryCount: 10,
|
|
221
|
+
sizeInBytes: 0,
|
|
222
|
+
messageCount: 0,
|
|
223
|
+
status: "Active",
|
|
224
|
+
autoDeleteOnIdle: "P10675199DT2H48M5.4775807S",
|
|
225
|
+
enablePartitioning: true,
|
|
226
|
+
enableExpress: false,
|
|
227
|
+
createdAt: "2017-05-26T18:07:32.4592931Z",
|
|
228
|
+
updatedAt: "2017-05-26T18:07:34.6243761Z",
|
|
229
|
+
accessedAt: "0001-01-01T00:00:00Z"
|
|
230
|
+
}
|
|
231
|
+
} };
|
|
232
|
+
const createOrUpdateQueueExamplePayload = { data: {
|
|
233
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-3174/queues/sdk-Queues-5647",
|
|
234
|
+
name: "sdk-Queues-5647",
|
|
235
|
+
type: "Microsoft.ServiceBus/Namespaces/Queues",
|
|
236
|
+
properties: {
|
|
237
|
+
lockDuration: "PT1M",
|
|
238
|
+
maxSizeInMegabytes: 163840,
|
|
239
|
+
maxMessageSizeInKilobytes: 10240,
|
|
240
|
+
requiresDuplicateDetection: false,
|
|
241
|
+
requiresSession: false,
|
|
242
|
+
defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
|
|
243
|
+
duplicateDetectionHistoryTimeWindow: "PT10M",
|
|
244
|
+
maxDeliveryCount: 10,
|
|
245
|
+
sizeInBytes: 0,
|
|
246
|
+
messageCount: 0,
|
|
247
|
+
status: "Active",
|
|
248
|
+
autoDeleteOnIdle: "P10675199DT2H48M5.4775807S",
|
|
249
|
+
enablePartitioning: true,
|
|
250
|
+
enableExpress: false,
|
|
251
|
+
createdAt: "2017-05-26T18:07:32.4592931Z",
|
|
252
|
+
updatedAt: "2017-05-26T18:07:34.6243761Z",
|
|
253
|
+
accessedAt: "0001-01-01T00:00:00Z"
|
|
254
|
+
}
|
|
255
|
+
} };
|
|
256
|
+
const listQueuesExamplePayload = { data: { value: [{
|
|
257
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-3174/queues/sdk-queues-5647",
|
|
258
|
+
name: "sdk-queues-5647",
|
|
259
|
+
type: "Microsoft.ServiceBus/Namespaces/Queues",
|
|
260
|
+
properties: {
|
|
261
|
+
lockDuration: "PT1M",
|
|
262
|
+
maxSizeInMegabytes: 163840,
|
|
263
|
+
maxMessageSizeInKilobytes: 10240,
|
|
264
|
+
requiresDuplicateDetection: false,
|
|
265
|
+
requiresSession: false,
|
|
266
|
+
defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
|
|
267
|
+
duplicateDetectionHistoryTimeWindow: "PT10M",
|
|
268
|
+
maxDeliveryCount: 10,
|
|
269
|
+
sizeInBytes: 0,
|
|
270
|
+
messageCount: 0,
|
|
271
|
+
status: "Active",
|
|
272
|
+
autoDeleteOnIdle: "P10675199DT2H48M5.4775807S",
|
|
273
|
+
enablePartitioning: true,
|
|
274
|
+
enableExpress: false,
|
|
275
|
+
createdAt: "2017-05-26T18:07:32.4592931Z",
|
|
276
|
+
updatedAt: "2017-05-26T18:07:34.6243761Z",
|
|
277
|
+
accessedAt: "0001-01-01T00:00:00Z"
|
|
278
|
+
}
|
|
279
|
+
}] } };
|
|
280
|
+
const deleteQueueExamplePayload = { data: null };
|
|
281
|
+
const getTopicExamplePayload = { data: {
|
|
282
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1617/topics/sdk-Topics-5488",
|
|
283
|
+
name: "sdk-Topics-5488",
|
|
284
|
+
type: "Microsoft.ServiceBus/Namespaces/Topics",
|
|
285
|
+
properties: {
|
|
286
|
+
defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
|
|
287
|
+
maxSizeInMegabytes: 10240,
|
|
288
|
+
maxMessageSizeInKilobytes: 10240,
|
|
289
|
+
requiresDuplicateDetection: false,
|
|
290
|
+
duplicateDetectionHistoryTimeWindow: "PT10M",
|
|
291
|
+
enableBatchedOperations: true,
|
|
292
|
+
sizeInBytes: 0,
|
|
293
|
+
status: "Active",
|
|
294
|
+
supportOrdering: true,
|
|
295
|
+
autoDeleteOnIdle: "P10675199DT2H48M5.4775807S",
|
|
296
|
+
enablePartitioning: false,
|
|
297
|
+
enableExpress: true,
|
|
298
|
+
createdAt: "2017-05-26T20:50:31.4442694Z",
|
|
299
|
+
updatedAt: "2017-05-26T20:52:32.2092264Z",
|
|
300
|
+
accessedAt: "0001-01-01T00:00:00Z",
|
|
301
|
+
subscriptionCount: 0
|
|
302
|
+
}
|
|
303
|
+
} };
|
|
304
|
+
const createOrUpdateTopicExamplePayload = { data: {
|
|
305
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1617/topics/sdk-Topics-5488",
|
|
306
|
+
name: "sdk-Topics-5488",
|
|
307
|
+
type: "Microsoft.ServiceBus/Namespaces/Topics",
|
|
308
|
+
properties: {
|
|
309
|
+
defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
|
|
310
|
+
maxSizeInMegabytes: 10240,
|
|
311
|
+
maxMessageSizeInKilobytes: 10240,
|
|
312
|
+
requiresDuplicateDetection: false,
|
|
313
|
+
duplicateDetectionHistoryTimeWindow: "PT10M",
|
|
314
|
+
enableBatchedOperations: true,
|
|
315
|
+
sizeInBytes: 0,
|
|
316
|
+
status: "Active",
|
|
317
|
+
supportOrdering: true,
|
|
318
|
+
autoDeleteOnIdle: "P10675199DT2H48M5.4775807S",
|
|
319
|
+
enablePartitioning: false,
|
|
320
|
+
enableExpress: true,
|
|
321
|
+
createdAt: "2017-05-26T20:50:31.4442694Z",
|
|
322
|
+
updatedAt: "2017-05-26T20:52:32.2092264Z",
|
|
323
|
+
accessedAt: "0001-01-01T00:00:00Z",
|
|
324
|
+
subscriptionCount: 0
|
|
325
|
+
}
|
|
326
|
+
} };
|
|
327
|
+
const listTopicsByNamespaceExamplePayload = { data: { value: [{
|
|
328
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1617/topics/sdk-Topics-5488",
|
|
329
|
+
name: "sdk-Topics-5488",
|
|
330
|
+
type: "Microsoft.ServiceBus/Namespaces/Topics",
|
|
331
|
+
properties: {
|
|
332
|
+
defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
|
|
333
|
+
maxSizeInMegabytes: 10240,
|
|
334
|
+
maxMessageSizeInKilobytes: 10240,
|
|
335
|
+
requiresDuplicateDetection: false,
|
|
336
|
+
duplicateDetectionHistoryTimeWindow: "PT10M",
|
|
337
|
+
enableBatchedOperations: true,
|
|
338
|
+
sizeInBytes: 0,
|
|
339
|
+
status: "Active",
|
|
340
|
+
supportOrdering: true,
|
|
341
|
+
autoDeleteOnIdle: "P10675199DT2H48M5.4775807S",
|
|
342
|
+
enablePartitioning: false,
|
|
343
|
+
enableExpress: true,
|
|
344
|
+
createdAt: "2017-05-26T20:50:31.4442694Z",
|
|
345
|
+
updatedAt: "2017-05-26T20:52:32.2092264Z",
|
|
346
|
+
accessedAt: "0001-01-01T00:00:00Z",
|
|
347
|
+
subscriptionCount: 0
|
|
348
|
+
}
|
|
349
|
+
}] } };
|
|
350
|
+
const deleteTopicExamplePayload = { data: null };
|
|
351
|
+
const getSubscriptionsExamplePayload = { data: {
|
|
352
|
+
id: "/subscriptions/Subscriptionid/resourceGroups/ResourceGroup/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1349/topics/sdk-Topics-8740/subscriptions/sdk-Subscriptions-2178",
|
|
353
|
+
name: "sdk-Subscriptions-2178",
|
|
354
|
+
type: "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions",
|
|
355
|
+
properties: {
|
|
356
|
+
lockDuration: "PT1M",
|
|
357
|
+
requiresSession: false,
|
|
358
|
+
defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
|
|
359
|
+
deadLetteringOnMessageExpiration: true,
|
|
360
|
+
deadLetteringOnFilterEvaluationExceptions: true,
|
|
361
|
+
messageCount: 0,
|
|
362
|
+
maxDeliveryCount: 10,
|
|
363
|
+
status: "Active",
|
|
364
|
+
enableBatchedOperations: true,
|
|
365
|
+
createdAt: "2021-01-04T18:02:20.5992764Z",
|
|
366
|
+
updatedAt: "2021-01-04T18:02:20.5992764Z",
|
|
367
|
+
accessedAt: "2021-01-04T18:02:20.5992764Z",
|
|
368
|
+
countDetails: {
|
|
369
|
+
activeMessageCount: 0,
|
|
370
|
+
deadLetterMessageCount: 0,
|
|
371
|
+
scheduledMessageCount: 0,
|
|
372
|
+
transferMessageCount: 0,
|
|
373
|
+
transferDeadLetterMessageCount: 0
|
|
374
|
+
},
|
|
375
|
+
autoDeleteOnIdle: "P10675199DT2H48M5.4775807S",
|
|
376
|
+
forwardTo: "sdk-Topics-3065",
|
|
377
|
+
forwardDeadLetteredMessagesTo: "sdk-Topics-3065"
|
|
378
|
+
}
|
|
379
|
+
} };
|
|
380
|
+
const createOrUpdateSubscriptionExamplePayload = { data: {
|
|
381
|
+
id: "/subscriptions/Subscriptionid/resourceGroups/ResourceGroup/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1349/topics/sdk-Topics-8740/subscriptions/sdk-Subscriptions-2178",
|
|
382
|
+
name: "sdk-Subscriptions-2178",
|
|
383
|
+
type: "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions",
|
|
384
|
+
properties: {
|
|
385
|
+
lockDuration: "PT1M",
|
|
386
|
+
requiresSession: false,
|
|
387
|
+
defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
|
|
388
|
+
deadLetteringOnMessageExpiration: true,
|
|
389
|
+
deadLetteringOnFilterEvaluationExceptions: true,
|
|
390
|
+
messageCount: 0,
|
|
391
|
+
maxDeliveryCount: 10,
|
|
392
|
+
status: "Active",
|
|
393
|
+
enableBatchedOperations: true,
|
|
394
|
+
createdAt: "2021-01-04T18:02:20.5992764Z",
|
|
395
|
+
updatedAt: "2021-01-04T18:02:20.5992764Z",
|
|
396
|
+
accessedAt: "2021-01-04T18:02:20.5992764Z",
|
|
397
|
+
countDetails: {
|
|
398
|
+
activeMessageCount: 0,
|
|
399
|
+
deadLetterMessageCount: 0,
|
|
400
|
+
scheduledMessageCount: 0,
|
|
401
|
+
transferMessageCount: 0,
|
|
402
|
+
transferDeadLetterMessageCount: 0
|
|
403
|
+
},
|
|
404
|
+
autoDeleteOnIdle: "P10675199DT2H48M5.4775807S"
|
|
405
|
+
}
|
|
406
|
+
} };
|
|
407
|
+
const listSubscriptionsByTopicExamplePayload = { data: { value: [{
|
|
408
|
+
id: "/subscriptions/Subscriptionid/resourceGroups/ResourceGroup/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1349/topics/sdk-Topics-8740/subscriptions/sdk-Subscriptions-2178",
|
|
409
|
+
name: "sdk-Subscriptions-2178",
|
|
410
|
+
type: "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions",
|
|
411
|
+
properties: {
|
|
412
|
+
lockDuration: "PT1M",
|
|
413
|
+
requiresSession: false,
|
|
414
|
+
defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
|
|
415
|
+
deadLetteringOnMessageExpiration: true,
|
|
416
|
+
deadLetteringOnFilterEvaluationExceptions: true,
|
|
417
|
+
messageCount: 0,
|
|
418
|
+
maxDeliveryCount: 10,
|
|
419
|
+
status: "Active",
|
|
420
|
+
enableBatchedOperations: true,
|
|
421
|
+
createdAt: "2021-01-04T18:02:20.5992764Z",
|
|
422
|
+
updatedAt: "2021-01-04T18:02:20.5992764Z",
|
|
423
|
+
accessedAt: "2021-01-04T18:02:20.5992764Z",
|
|
424
|
+
countDetails: {
|
|
425
|
+
activeMessageCount: 0,
|
|
426
|
+
deadLetterMessageCount: 0,
|
|
427
|
+
scheduledMessageCount: 0,
|
|
428
|
+
transferMessageCount: 0,
|
|
429
|
+
transferDeadLetterMessageCount: 0
|
|
430
|
+
},
|
|
431
|
+
autoDeleteOnIdle: "P10675199DT2H48M5.4775807S"
|
|
432
|
+
}
|
|
433
|
+
}] } };
|
|
434
|
+
const deleteSubscriptionsExamplePayload = { data: null };
|
|
435
|
+
const getRuleExamplePayload = { data: {
|
|
436
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1319/topics/sdk-Topics-2081/subscriptions/sdk-Subscriptions-8691/rules/sdk-Rules-6571",
|
|
437
|
+
name: "sdk-Rules-6571",
|
|
438
|
+
type: "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions/Rules",
|
|
439
|
+
properties: {
|
|
440
|
+
action: {},
|
|
441
|
+
filterType: "SqlFilter",
|
|
442
|
+
sqlFilter: {
|
|
443
|
+
sqlExpression: "1=1",
|
|
444
|
+
compatibilityLevel: 20
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
} };
|
|
448
|
+
const createOrUpdateRulesExamplePayload = { data: {
|
|
449
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1319/topics/sdk-Topics-2081/subscriptions/sdk-Subscriptions-8691/rules/sdk-Rules-6571",
|
|
450
|
+
name: "sdk-Rules-6571",
|
|
451
|
+
type: "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions/Rules",
|
|
452
|
+
properties: {
|
|
453
|
+
action: {},
|
|
454
|
+
filterType: "SqlFilter",
|
|
455
|
+
sqlFilter: {
|
|
456
|
+
sqlExpression: "1=1",
|
|
457
|
+
compatibilityLevel: 20
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
} };
|
|
461
|
+
const listRulesExamplePayload = { data: { value: [{
|
|
462
|
+
id: "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1319/topics/sdk-Topics-2081/subscriptions/sdk-Subscriptions-8691/rules/sdk-Rules-6571",
|
|
463
|
+
name: "sdk-Rules-6571",
|
|
464
|
+
type: "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions/Rules",
|
|
465
|
+
properties: {
|
|
466
|
+
action: {},
|
|
467
|
+
filterType: "SqlFilter",
|
|
468
|
+
sqlFilter: {
|
|
469
|
+
sqlExpression: "1=1",
|
|
470
|
+
compatibilityLevel: 20
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}] } };
|
|
474
|
+
const deleteRuleExamplePayload = { data: null };
|
|
475
|
+
const sendMessageToQueueExamplePayload = { data: {
|
|
476
|
+
body: "Hello, Service Bus!",
|
|
477
|
+
contentType: "application/json",
|
|
478
|
+
messageId: "msg-abc123-def456",
|
|
479
|
+
subject: "order-notification",
|
|
480
|
+
to: "order-processor"
|
|
481
|
+
} };
|
|
482
|
+
const sendMessagesToQueueExamplePayload = { data: [{ body: "First message" }, { body: "Second message" }] };
|
|
483
|
+
const receiveMessagesFromQueueExamplePayload = { data: ["First message body", "Second message body"] };
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region src/inputs.ts
|
|
486
|
+
const fetchAll = (0, _prismatic_io_spectral.input)({
|
|
487
|
+
label: "Fetch All",
|
|
488
|
+
type: "boolean",
|
|
489
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
490
|
+
comments: "When enabled, automatically fetches all pages of results by following nextLink pagination. Skip and Top inputs are ignored when this is enabled.",
|
|
491
|
+
required: false,
|
|
492
|
+
default: "false"
|
|
493
|
+
});
|
|
494
|
+
const subscriptionId$6 = (0, _prismatic_io_spectral.input)({
|
|
495
|
+
label: "Subscription ID",
|
|
496
|
+
comments: "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
|
|
497
|
+
type: "string",
|
|
498
|
+
required: true,
|
|
499
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
500
|
+
dataSource: "selectSubscription"
|
|
501
|
+
});
|
|
502
|
+
const resourceGroupName$5 = (0, _prismatic_io_spectral.input)({
|
|
503
|
+
label: "Resource Group Name",
|
|
504
|
+
comments: "Name of the Resource group within the Azure subscription.",
|
|
505
|
+
type: "string",
|
|
506
|
+
required: true,
|
|
507
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
508
|
+
});
|
|
509
|
+
const namespaceName$4 = (0, _prismatic_io_spectral.input)({
|
|
510
|
+
label: "Namespace Name",
|
|
511
|
+
comments: "The namespace name",
|
|
512
|
+
type: "string",
|
|
513
|
+
required: true,
|
|
514
|
+
clean: (value) => {
|
|
515
|
+
return _prismatic_io_spectral.util.types.toString(value).replace(/\s/g, "-");
|
|
516
|
+
},
|
|
517
|
+
dataSource: "selectNamespaceByResourceGroup"
|
|
518
|
+
});
|
|
519
|
+
const queueName = (0, _prismatic_io_spectral.input)({
|
|
520
|
+
label: "Queue Name",
|
|
521
|
+
comments: "The queue name.",
|
|
522
|
+
type: "string",
|
|
523
|
+
required: true,
|
|
524
|
+
clean: (value) => {
|
|
525
|
+
return _prismatic_io_spectral.util.types.toString(value).replace(/\s/g, "-");
|
|
526
|
+
},
|
|
527
|
+
dataSource: "selectQueue"
|
|
528
|
+
});
|
|
529
|
+
const topicName$2 = (0, _prismatic_io_spectral.input)({
|
|
530
|
+
label: "Topic Name",
|
|
531
|
+
comments: "The topic name.",
|
|
532
|
+
type: "string",
|
|
533
|
+
required: true,
|
|
534
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
535
|
+
dataSource: "selectTopic"
|
|
536
|
+
});
|
|
537
|
+
const subscriptionName$1 = (0, _prismatic_io_spectral.input)({
|
|
538
|
+
label: "Subscription Name",
|
|
539
|
+
comments: "The subscription name.",
|
|
540
|
+
type: "string",
|
|
541
|
+
required: true,
|
|
542
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
543
|
+
dataSource: "selectSubscriptionByTopic"
|
|
544
|
+
});
|
|
545
|
+
const ruleName = (0, _prismatic_io_spectral.input)({
|
|
546
|
+
label: "Rule Name",
|
|
547
|
+
comments: "The rule name.",
|
|
548
|
+
type: "string",
|
|
549
|
+
required: true,
|
|
550
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
551
|
+
dataSource: "selectRule"
|
|
552
|
+
});
|
|
553
|
+
const $skip = (0, _prismatic_io_spectral.input)({
|
|
554
|
+
label: "Skip",
|
|
555
|
+
comments: "Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls.",
|
|
556
|
+
type: "string",
|
|
557
|
+
required: false,
|
|
558
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
559
|
+
});
|
|
560
|
+
const $top = (0, _prismatic_io_spectral.input)({
|
|
561
|
+
label: "Top",
|
|
562
|
+
comments: "May be used to limit the number of results to the most recent N usageDetails.",
|
|
563
|
+
type: "string",
|
|
564
|
+
required: false,
|
|
565
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
566
|
+
});
|
|
567
|
+
const connection = (0, _prismatic_io_spectral.input)({
|
|
568
|
+
label: "Connection",
|
|
569
|
+
type: "connection",
|
|
570
|
+
required: true
|
|
571
|
+
});
|
|
572
|
+
const autoDeleteOnIdle = (0, _prismatic_io_spectral.input)({
|
|
573
|
+
label: "Auto Delete On Idle",
|
|
574
|
+
comments: "ISO 8601 timespan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes.",
|
|
575
|
+
type: "string",
|
|
576
|
+
required: false,
|
|
577
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
578
|
+
});
|
|
579
|
+
const defaultMessageTimeToLive = (0, _prismatic_io_spectral.input)({
|
|
580
|
+
label: "Default Message Time To Live",
|
|
581
|
+
comments: "ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.",
|
|
582
|
+
type: "string",
|
|
583
|
+
required: false,
|
|
584
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
585
|
+
});
|
|
586
|
+
const duplicateDetectionHistoryTimeWindow = (0, _prismatic_io_spectral.input)({
|
|
587
|
+
label: "Duplicate Detection History Time Window",
|
|
588
|
+
comments: "ISO8601 timespan structure that defines the duration of the duplicate detection history. The default value is 10 minutes.",
|
|
589
|
+
type: "string",
|
|
590
|
+
required: false,
|
|
591
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
592
|
+
});
|
|
593
|
+
const enableBatchedOperations = (0, _prismatic_io_spectral.input)({
|
|
594
|
+
label: "Enable Batched Operations",
|
|
595
|
+
comments: "Value that indicates whether server-side batched operations are enabled.",
|
|
596
|
+
type: "boolean",
|
|
597
|
+
required: false,
|
|
598
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
599
|
+
});
|
|
600
|
+
const enableExpress = (0, _prismatic_io_spectral.input)({
|
|
601
|
+
label: "Enable Express",
|
|
602
|
+
comments: "Value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage.",
|
|
603
|
+
type: "boolean",
|
|
604
|
+
required: false,
|
|
605
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
606
|
+
});
|
|
607
|
+
const enablePartitioning = (0, _prismatic_io_spectral.input)({
|
|
608
|
+
label: "Enable Partitioning",
|
|
609
|
+
comments: "Value that indicates whether the topic to be partitioned across multiple message brokers is enabled.",
|
|
610
|
+
type: "boolean",
|
|
611
|
+
required: false,
|
|
612
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
613
|
+
});
|
|
614
|
+
const maxMessageSizeInKilobytes = (0, _prismatic_io_spectral.input)({
|
|
615
|
+
label: "Max Message Size in Kilobytes",
|
|
616
|
+
comments: "Maximum size (in KB) of the message payload that can be accepted by the topic. This property is only used in Premium today, and the default is 1024.",
|
|
617
|
+
type: "string",
|
|
618
|
+
required: false,
|
|
619
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
620
|
+
});
|
|
621
|
+
const maxSizeInMegabytes = (0, _prismatic_io_spectral.input)({
|
|
622
|
+
label: "Max Size in Megabytes",
|
|
623
|
+
comments: "Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. Default is 1024.",
|
|
624
|
+
type: "string",
|
|
625
|
+
required: false,
|
|
626
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
627
|
+
});
|
|
628
|
+
const requiresDuplicateDetection = (0, _prismatic_io_spectral.input)({
|
|
629
|
+
label: "Requires Duplicate Detection",
|
|
630
|
+
comments: "Value indicating if this topic requires duplicate detection.",
|
|
631
|
+
type: "boolean",
|
|
632
|
+
required: false,
|
|
633
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
634
|
+
});
|
|
635
|
+
const status = (0, _prismatic_io_spectral.input)({
|
|
636
|
+
label: "Status",
|
|
637
|
+
comments: "Status of the messaging entity.",
|
|
638
|
+
type: "string",
|
|
639
|
+
required: false,
|
|
640
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
641
|
+
example: "Use one: Active, Disabled, Restoring, SendDisabled, ReceiveDisabled, Creating, Deleting, Renaming ,Unknown"
|
|
642
|
+
});
|
|
643
|
+
const supportOrdering = (0, _prismatic_io_spectral.input)({
|
|
644
|
+
label: "Support Ordering",
|
|
645
|
+
comments: "Value that indicates whether the topic supports ordering.",
|
|
646
|
+
type: "boolean",
|
|
647
|
+
required: false,
|
|
648
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
649
|
+
});
|
|
650
|
+
const clientId = (0, _prismatic_io_spectral.input)({
|
|
651
|
+
label: "Client ID",
|
|
652
|
+
comments: "Indicates the Client ID of the application that created the client-affine subscription.",
|
|
653
|
+
type: "string",
|
|
654
|
+
required: false,
|
|
655
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
656
|
+
});
|
|
657
|
+
const isDurable = (0, _prismatic_io_spectral.input)({
|
|
658
|
+
label: "Is Durable",
|
|
659
|
+
comments: "For client-affine subscriptions, this value indicates whether the subscription is durable or not.",
|
|
660
|
+
type: "boolean",
|
|
661
|
+
required: false,
|
|
662
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
663
|
+
});
|
|
664
|
+
const isShared = (0, _prismatic_io_spectral.input)({
|
|
665
|
+
label: "Is Shared",
|
|
666
|
+
comments: "For client-affine subscriptions, this value indicates whether the subscription is shared or not.",
|
|
667
|
+
type: "boolean",
|
|
668
|
+
required: false,
|
|
669
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
670
|
+
});
|
|
671
|
+
const deadLetteringOnFilterEvaluationExceptions = (0, _prismatic_io_spectral.input)({
|
|
672
|
+
label: "Dead Lettering On Filter Evaluation Exceptions",
|
|
673
|
+
comments: "Value that indicates whether a subscription has dead letter support on filter evaluation exceptions.",
|
|
674
|
+
type: "boolean",
|
|
675
|
+
required: false,
|
|
676
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
677
|
+
});
|
|
678
|
+
const deadLetteringOnMessageExpiration = (0, _prismatic_io_spectral.input)({
|
|
679
|
+
label: "Dead Lettering On Message Expiration",
|
|
680
|
+
comments: "Value that indicates whether a subscription has dead letter support when a message expires.",
|
|
681
|
+
type: "boolean",
|
|
682
|
+
required: false,
|
|
683
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
684
|
+
});
|
|
685
|
+
const forwardDeadLetteredMessagesTo = (0, _prismatic_io_spectral.input)({
|
|
686
|
+
label: "Forward Dead Lettered Messages To",
|
|
687
|
+
comments: "Queue/Topic name to forward the Dead Letter message.",
|
|
688
|
+
type: "string",
|
|
689
|
+
required: false,
|
|
690
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
691
|
+
});
|
|
692
|
+
const forwardTo = (0, _prismatic_io_spectral.input)({
|
|
693
|
+
label: "Forward To",
|
|
694
|
+
comments: "Queue/Topic name to forward the messages.",
|
|
695
|
+
type: "string",
|
|
696
|
+
required: false,
|
|
697
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
698
|
+
});
|
|
699
|
+
const isClientAffine = (0, _prismatic_io_spectral.input)({
|
|
700
|
+
label: "Is Client Affine",
|
|
701
|
+
comments: "Value that indicates whether the subscription has an affinity to the client id.",
|
|
702
|
+
type: "boolean",
|
|
703
|
+
required: false,
|
|
704
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
705
|
+
});
|
|
706
|
+
const lockDuration = (0, _prismatic_io_spectral.input)({
|
|
707
|
+
label: "Lock Duration",
|
|
708
|
+
comments: "ISO 8601 lock duration timespan for the subscription. The default value is 1 minute.",
|
|
709
|
+
type: "string",
|
|
710
|
+
required: false,
|
|
711
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
712
|
+
});
|
|
713
|
+
const maxDeliveryCount = (0, _prismatic_io_spectral.input)({
|
|
714
|
+
label: "Max Delivery Count",
|
|
715
|
+
comments: "Number of maximum deliveries.",
|
|
716
|
+
type: "string",
|
|
717
|
+
required: false,
|
|
718
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
719
|
+
});
|
|
720
|
+
const requiresSession = (0, _prismatic_io_spectral.input)({
|
|
721
|
+
label: "Requires Session",
|
|
722
|
+
comments: "Value indicating if a subscription supports the concept of sessions.",
|
|
723
|
+
type: "boolean",
|
|
724
|
+
required: false,
|
|
725
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
726
|
+
});
|
|
727
|
+
const location = (0, _prismatic_io_spectral.input)({
|
|
728
|
+
label: "Location",
|
|
729
|
+
comments: "The geo-location where the resource lives",
|
|
730
|
+
type: "string",
|
|
731
|
+
required: true,
|
|
732
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
733
|
+
});
|
|
734
|
+
const identityType = (0, _prismatic_io_spectral.input)({
|
|
735
|
+
label: "Identity Type",
|
|
736
|
+
comments: "Type of managed service identity.",
|
|
737
|
+
type: "string",
|
|
738
|
+
required: true,
|
|
739
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
740
|
+
model: [
|
|
741
|
+
{
|
|
742
|
+
label: "None",
|
|
743
|
+
value: "None"
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
label: "SystemAssigned",
|
|
747
|
+
value: "SystemAssigned"
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
label: "UserAssigned",
|
|
751
|
+
value: "UserAssigned"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
label: "SystemAssigned",
|
|
755
|
+
value: "SystemAssigned"
|
|
756
|
+
}
|
|
757
|
+
]
|
|
758
|
+
});
|
|
759
|
+
const userAssignedIdentities = (0, _prismatic_io_spectral.input)({
|
|
760
|
+
label: "Identity User Assigned Identities",
|
|
761
|
+
type: "code",
|
|
762
|
+
language: "json",
|
|
763
|
+
comments: "Properties for User Assigned Identities",
|
|
764
|
+
example: `{
|
|
765
|
+
"<identityId1>": {
|
|
766
|
+
"clientId": "<clientId1>",
|
|
767
|
+
"principalId": "<principalId1>"
|
|
768
|
+
},
|
|
769
|
+
"<identityId2>": {
|
|
770
|
+
"clientId": "<clientId2>",
|
|
771
|
+
"principalId": "<principalId2>"
|
|
772
|
+
}
|
|
773
|
+
}`,
|
|
774
|
+
required: false,
|
|
775
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
776
|
+
});
|
|
777
|
+
const alternateName = (0, _prismatic_io_spectral.input)({
|
|
778
|
+
label: "Alternate Name",
|
|
779
|
+
comments: "Alternate name for the namespace.",
|
|
780
|
+
type: "string",
|
|
781
|
+
required: false,
|
|
782
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
783
|
+
});
|
|
784
|
+
const filterType = (0, _prismatic_io_spectral.input)({
|
|
785
|
+
label: "Filter Type",
|
|
786
|
+
comments: "Filter type that is evaluated against a BrokeredMessage.",
|
|
787
|
+
example: "SqlFilter, CorrelationFilter",
|
|
788
|
+
type: "string",
|
|
789
|
+
required: false,
|
|
790
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
791
|
+
});
|
|
792
|
+
const disableLocalAuth = (0, _prismatic_io_spectral.input)({
|
|
793
|
+
label: "Disable Local Auth",
|
|
794
|
+
comments: "This property disables SAS authentication for the Service Bus namespace.",
|
|
795
|
+
type: "boolean",
|
|
796
|
+
required: false,
|
|
797
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
798
|
+
});
|
|
799
|
+
const requireInfrastructureEncryption = (0, _prismatic_io_spectral.input)({
|
|
800
|
+
label: "Require Infrastructure Encryption",
|
|
801
|
+
comments: "Enable Infrastructure Encryption (Double Encryption)",
|
|
802
|
+
type: "boolean",
|
|
803
|
+
required: false,
|
|
804
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
805
|
+
});
|
|
806
|
+
const zoneRedundant = (0, _prismatic_io_spectral.input)({
|
|
807
|
+
label: "Zone Redundant",
|
|
808
|
+
comments: "Enabling this property creates a Premium Service Bus Namespace in regions supported availability zones.",
|
|
809
|
+
type: "boolean",
|
|
810
|
+
required: false,
|
|
811
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
812
|
+
});
|
|
813
|
+
const keySource = (0, _prismatic_io_spectral.input)({
|
|
814
|
+
label: "Key Source",
|
|
815
|
+
comments: "Enumerates the possible value of keySource for Encryption",
|
|
816
|
+
type: "string",
|
|
817
|
+
required: false,
|
|
818
|
+
example: "Microsoft.KeyVault",
|
|
819
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
820
|
+
});
|
|
821
|
+
const keyVaultProperties = (0, _prismatic_io_spectral.input)({
|
|
822
|
+
label: "Key Vault Properties",
|
|
823
|
+
type: "code",
|
|
824
|
+
language: "json",
|
|
825
|
+
comments: "Properties of the Key Vault",
|
|
826
|
+
example: `[{
|
|
827
|
+
"identity": {
|
|
828
|
+
"userAssignedIdentity": "<userAssignedIdentityId>"
|
|
829
|
+
},
|
|
830
|
+
"keyName": "<keyName>",
|
|
831
|
+
"keyVaultUri": "<keyVaultUri>",
|
|
832
|
+
"keyVersion": "<keyVersion>"
|
|
833
|
+
}]`,
|
|
834
|
+
required: false,
|
|
835
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
836
|
+
});
|
|
837
|
+
const privateEndpointConnections = (0, _prismatic_io_spectral.input)({
|
|
838
|
+
label: "Private Endpoint Connections",
|
|
839
|
+
type: "code",
|
|
840
|
+
language: "json",
|
|
841
|
+
comments: "List of private endpoint connections.",
|
|
842
|
+
example: `[{
|
|
843
|
+
"id": "<resourceId>",
|
|
844
|
+
"location": "<location>",
|
|
845
|
+
"name": "<resourceName>",
|
|
846
|
+
"properties": {
|
|
847
|
+
"privateEndpoint": {
|
|
848
|
+
// PrivateEndpoint properties
|
|
849
|
+
},
|
|
850
|
+
"privateLinkServiceConnectionState": {
|
|
851
|
+
// ConnectionState properties
|
|
852
|
+
},
|
|
853
|
+
"provisioningState": "<provisioningState>"
|
|
854
|
+
},
|
|
855
|
+
"systemData": {
|
|
856
|
+
// systemData properties
|
|
857
|
+
},
|
|
858
|
+
"type": "<resourceType>"
|
|
859
|
+
}]`,
|
|
860
|
+
required: false,
|
|
861
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
862
|
+
});
|
|
863
|
+
const sku = (0, _prismatic_io_spectral.input)({
|
|
864
|
+
label: "SKU",
|
|
865
|
+
type: "code",
|
|
866
|
+
language: "json",
|
|
867
|
+
comments: "SKU of the namespace.",
|
|
868
|
+
example: `{
|
|
869
|
+
"capacity": 2,
|
|
870
|
+
"name": "<name>",
|
|
871
|
+
"tier": "<tier>"
|
|
872
|
+
}
|
|
873
|
+
`,
|
|
874
|
+
required: false,
|
|
875
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
876
|
+
});
|
|
877
|
+
const tags = (0, _prismatic_io_spectral.input)({
|
|
878
|
+
label: "Tags",
|
|
879
|
+
type: "code",
|
|
880
|
+
language: "json",
|
|
881
|
+
comments: "Resource tags.",
|
|
882
|
+
required: false,
|
|
883
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
884
|
+
});
|
|
885
|
+
const action$25 = (0, _prismatic_io_spectral.input)({
|
|
886
|
+
label: "Action",
|
|
887
|
+
type: "code",
|
|
888
|
+
language: "json",
|
|
889
|
+
comments: "Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression.",
|
|
890
|
+
example: `{
|
|
891
|
+
"compatibilityLevel": 20,
|
|
892
|
+
"requiresPreprocessing": true,
|
|
893
|
+
"sqlExpression": "MyProperty='ABC'"
|
|
894
|
+
}`,
|
|
895
|
+
required: false,
|
|
896
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
897
|
+
});
|
|
898
|
+
const correlationFilter = (0, _prismatic_io_spectral.input)({
|
|
899
|
+
label: "Correlation Filter",
|
|
900
|
+
type: "code",
|
|
901
|
+
language: "json",
|
|
902
|
+
comments: "Represents the correlation filter expression.",
|
|
903
|
+
example: `{
|
|
904
|
+
"contentType": "application/json",
|
|
905
|
+
"correlationId": "123456",
|
|
906
|
+
"label": "Important Message",
|
|
907
|
+
"messageId": "7890",
|
|
908
|
+
"properties": {},
|
|
909
|
+
"replyTo": "my-reply-queue",
|
|
910
|
+
"replyToSessionId": "session-1",
|
|
911
|
+
"requiresPreprocessing": true,
|
|
912
|
+
"sessionId": "session-123",
|
|
913
|
+
"to": "my-destination"
|
|
914
|
+
}
|
|
915
|
+
`,
|
|
916
|
+
required: false,
|
|
917
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
918
|
+
});
|
|
919
|
+
const version = (0, _prismatic_io_spectral.input)({
|
|
920
|
+
label: "Version",
|
|
921
|
+
type: "string",
|
|
922
|
+
comments: "Version of the API.",
|
|
923
|
+
example: `2016-06-01`,
|
|
924
|
+
default: "2016-06-01",
|
|
925
|
+
required: false,
|
|
926
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
927
|
+
});
|
|
928
|
+
const sqlFilter = (0, _prismatic_io_spectral.input)({
|
|
929
|
+
label: "SQL Filter",
|
|
930
|
+
type: "code",
|
|
931
|
+
language: "json",
|
|
932
|
+
comments: "Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline.",
|
|
933
|
+
example: `{
|
|
934
|
+
"compatibilityLevel": 20,
|
|
935
|
+
"requiresPreprocessing": true,
|
|
936
|
+
"sqlExpression": "MyProperty='ABC'"
|
|
937
|
+
}
|
|
938
|
+
`,
|
|
939
|
+
required: false,
|
|
940
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
941
|
+
});
|
|
942
|
+
const messages = (0, _prismatic_io_spectral.input)({
|
|
943
|
+
label: "Messages",
|
|
944
|
+
type: "string",
|
|
945
|
+
collection: "valuelist",
|
|
946
|
+
comments: "List of messages to send to the queue.",
|
|
947
|
+
required: true,
|
|
948
|
+
clean: (value) => {
|
|
949
|
+
if (Array.isArray(value)) return value;
|
|
950
|
+
return [_prismatic_io_spectral.util.types.toString(value)];
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
const amountOfMessages = (0, _prismatic_io_spectral.input)({
|
|
954
|
+
label: "Amount of Messages",
|
|
955
|
+
comments: "Amount of messages to receive from the queue.",
|
|
956
|
+
type: "string",
|
|
957
|
+
required: true,
|
|
958
|
+
clean: (value) => _prismatic_io_spectral.util.types.toInt(value, 20)
|
|
959
|
+
});
|
|
960
|
+
const maxTimeToWait = (0, _prismatic_io_spectral.input)({
|
|
961
|
+
label: "Max Time To Wait",
|
|
962
|
+
comments: "Max time to wait (in seconds) for messages to receive from the queue. Default is 60 seconds.",
|
|
963
|
+
type: "string",
|
|
964
|
+
required: true,
|
|
965
|
+
default: "60",
|
|
966
|
+
clean: (value) => _prismatic_io_spectral.util.types.toNumber(value, 60)
|
|
967
|
+
});
|
|
968
|
+
//#endregion
|
|
969
|
+
//#region src/actions/createOrUpdateNamespaces.ts
|
|
970
|
+
const createOrUpdateNamespaces = (0, _prismatic_io_spectral.action)({
|
|
971
|
+
display: {
|
|
972
|
+
label: "Create or Update Namespaces",
|
|
973
|
+
description: "Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent."
|
|
974
|
+
},
|
|
975
|
+
examplePayload: createOrUpdateNamespacesExamplePayload,
|
|
976
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, location, identityType, userAssignedIdentities, alternateName, disableLocalAuth, keySource, keyVaultProperties, requireInfrastructureEncryption, privateEndpointConnections, zoneRedundant, sku, tags }) => {
|
|
977
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
978
|
+
try {
|
|
979
|
+
const body = {
|
|
980
|
+
location,
|
|
981
|
+
identity: {
|
|
982
|
+
...identityType.length && { type: identityType },
|
|
983
|
+
...userAssignedIdentities.length && { userAssignedIdentities: JSON.parse(userAssignedIdentities) }
|
|
984
|
+
},
|
|
985
|
+
properties: {
|
|
986
|
+
...alternateName.length && { alternateName },
|
|
987
|
+
disableLocalAuth,
|
|
988
|
+
...keySource.length && keyVaultProperties.length && { encryption: {
|
|
989
|
+
...keySource.length && { keySource },
|
|
990
|
+
...keyVaultProperties.length && { keyVaultProperties: JSON.parse(keyVaultProperties) },
|
|
991
|
+
requireInfrastructureEncryption
|
|
992
|
+
} },
|
|
993
|
+
...privateEndpointConnections.length && { privateEndpointConnections: JSON.parse(privateEndpointConnections) },
|
|
994
|
+
zoneRedundant
|
|
995
|
+
},
|
|
996
|
+
...sku.length && { sku: JSON.parse(sku) },
|
|
997
|
+
...tags.length && { tags: JSON.parse(tags) }
|
|
998
|
+
};
|
|
999
|
+
const { data } = await client.put(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}?api-version=2021-11-01`, body);
|
|
1000
|
+
return { data };
|
|
1001
|
+
} catch (error) {
|
|
1002
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1003
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1004
|
+
throw new Error(serialized);
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
inputs: {
|
|
1008
|
+
connection,
|
|
1009
|
+
namespaceName: namespaceName$4,
|
|
1010
|
+
resourceGroupName: resourceGroupName$5,
|
|
1011
|
+
subscriptionId: subscriptionId$6,
|
|
1012
|
+
location,
|
|
1013
|
+
identityType,
|
|
1014
|
+
userAssignedIdentities,
|
|
1015
|
+
alternateName,
|
|
1016
|
+
disableLocalAuth,
|
|
1017
|
+
keySource,
|
|
1018
|
+
keyVaultProperties,
|
|
1019
|
+
requireInfrastructureEncryption,
|
|
1020
|
+
privateEndpointConnections,
|
|
1021
|
+
zoneRedundant,
|
|
1022
|
+
sku,
|
|
1023
|
+
tags
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
//#endregion
|
|
1027
|
+
//#region src/actions/createOrUpdateQueue.ts
|
|
1028
|
+
const createOrUpdateQueue = (0, _prismatic_io_spectral.action)({
|
|
1029
|
+
display: {
|
|
1030
|
+
label: "Create or Update Queue",
|
|
1031
|
+
description: "Creates or updates a Service Bus queue. This operation is idempotent."
|
|
1032
|
+
},
|
|
1033
|
+
examplePayload: createOrUpdateQueueExamplePayload,
|
|
1034
|
+
perform: async (context, { connection, namespaceName, queueName, resourceGroupName, subscriptionId, autoDeleteOnIdle, deadLetteringOnMessageExpiration, defaultMessageTimeToLive, duplicateDetectionHistoryTimeWindow, enableBatchedOperations, enableExpress, enablePartitioning, forwardDeadLetteredMessagesTo, forwardTo, lockDuration, maxDeliveryCount, maxMessageSizeInKilobytes, maxSizeInMegabytes, requiresDuplicateDetection, requiresSession, status }) => {
|
|
1035
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1036
|
+
try {
|
|
1037
|
+
const body = { properties: {
|
|
1038
|
+
...autoDeleteOnIdle.length && { autoDeleteOnIdle },
|
|
1039
|
+
deadLetteringOnMessageExpiration,
|
|
1040
|
+
...defaultMessageTimeToLive.length && { defaultMessageTimeToLive },
|
|
1041
|
+
...duplicateDetectionHistoryTimeWindow.length && { duplicateDetectionHistoryTimeWindow },
|
|
1042
|
+
enableBatchedOperations,
|
|
1043
|
+
enableExpress,
|
|
1044
|
+
enablePartitioning,
|
|
1045
|
+
...forwardDeadLetteredMessagesTo.length && { forwardDeadLetteredMessagesTo },
|
|
1046
|
+
...forwardTo.length && { forwardTo },
|
|
1047
|
+
...lockDuration.length && { lockDuration },
|
|
1048
|
+
...maxDeliveryCount.length && { maxDeliveryCount: _prismatic_io_spectral.util.types.toNumber(maxDeliveryCount) },
|
|
1049
|
+
...maxMessageSizeInKilobytes.length && { maxMessageSizeInKilobytes: _prismatic_io_spectral.util.types.toNumber(maxMessageSizeInKilobytes) },
|
|
1050
|
+
...maxSizeInMegabytes.length && { maxSizeInMegabytes: _prismatic_io_spectral.util.types.toNumber(maxSizeInMegabytes) },
|
|
1051
|
+
requiresDuplicateDetection,
|
|
1052
|
+
requiresSession,
|
|
1053
|
+
...status.length && { status }
|
|
1054
|
+
} };
|
|
1055
|
+
const { data } = await client.put(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/queues/${queueName}?api-version=2021-11-01`, body);
|
|
1056
|
+
return { data };
|
|
1057
|
+
} catch (error) {
|
|
1058
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1059
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1060
|
+
throw new Error(serialized);
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
inputs: {
|
|
1064
|
+
connection,
|
|
1065
|
+
namespaceName: namespaceName$4,
|
|
1066
|
+
queueName,
|
|
1067
|
+
resourceGroupName: resourceGroupName$5,
|
|
1068
|
+
subscriptionId: subscriptionId$6,
|
|
1069
|
+
autoDeleteOnIdle,
|
|
1070
|
+
deadLetteringOnMessageExpiration,
|
|
1071
|
+
defaultMessageTimeToLive,
|
|
1072
|
+
duplicateDetectionHistoryTimeWindow,
|
|
1073
|
+
enableBatchedOperations,
|
|
1074
|
+
enableExpress,
|
|
1075
|
+
enablePartitioning,
|
|
1076
|
+
forwardDeadLetteredMessagesTo,
|
|
1077
|
+
forwardTo,
|
|
1078
|
+
lockDuration,
|
|
1079
|
+
maxDeliveryCount,
|
|
1080
|
+
maxMessageSizeInKilobytes,
|
|
1081
|
+
maxSizeInMegabytes,
|
|
1082
|
+
requiresDuplicateDetection,
|
|
1083
|
+
requiresSession,
|
|
1084
|
+
status
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
//#endregion
|
|
1088
|
+
//#region src/actions/createOrUpdateRules.ts
|
|
1089
|
+
const createOrUpdateRules = (0, _prismatic_io_spectral.action)({
|
|
1090
|
+
display: {
|
|
1091
|
+
label: "Create or Update Rules",
|
|
1092
|
+
description: "Creates a new rule and updates an existing rule"
|
|
1093
|
+
},
|
|
1094
|
+
examplePayload: createOrUpdateRulesExamplePayload,
|
|
1095
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, topicName, subscriptionName, ruleName, actionInput, correlationFilter, filterType, sqlFilter }) => {
|
|
1096
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1097
|
+
try {
|
|
1098
|
+
const body = { properties: {
|
|
1099
|
+
...actionInput.length && { action: JSON.parse(actionInput) },
|
|
1100
|
+
...correlationFilter.length && { correlationFilter: JSON.parse(correlationFilter) },
|
|
1101
|
+
...filterType.length && { filterType },
|
|
1102
|
+
...sqlFilter.length && { sqlFilter: JSON.parse(sqlFilter) }
|
|
1103
|
+
} };
|
|
1104
|
+
const { data } = await client.put(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}/subscriptions/${subscriptionName}/rules/${ruleName}?api-version=2021-11-01`, body);
|
|
1105
|
+
return { data };
|
|
1106
|
+
} catch (error) {
|
|
1107
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1108
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1109
|
+
throw new Error(serialized);
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
inputs: {
|
|
1113
|
+
connection,
|
|
1114
|
+
namespaceName: namespaceName$4,
|
|
1115
|
+
resourceGroupName: resourceGroupName$5,
|
|
1116
|
+
subscriptionId: subscriptionId$6,
|
|
1117
|
+
topicName: topicName$2,
|
|
1118
|
+
subscriptionName: subscriptionName$1,
|
|
1119
|
+
ruleName,
|
|
1120
|
+
actionInput: action$25,
|
|
1121
|
+
correlationFilter,
|
|
1122
|
+
filterType,
|
|
1123
|
+
sqlFilter
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
//#endregion
|
|
1127
|
+
//#region src/actions/createOrUpdateSubscription.ts
|
|
1128
|
+
const createOrUpdateSubscription = (0, _prismatic_io_spectral.action)({
|
|
1129
|
+
display: {
|
|
1130
|
+
label: "Create or Update Subscription",
|
|
1131
|
+
description: "Creates a topic subscription."
|
|
1132
|
+
},
|
|
1133
|
+
examplePayload: createOrUpdateSubscriptionExamplePayload,
|
|
1134
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, topicName, subscriptionName, autoDeleteOnIdle, deadLetteringOnFilterEvaluationExceptions, deadLetteringOnMessageExpiration, defaultMessageTimeToLive, duplicateDetectionHistoryTimeWindow, enableBatchedOperations, forwardDeadLetteredMessagesTo, forwardTo, isClientAffine, lockDuration, maxDeliveryCount, requiresSession, status, clientId, isDurable, isShared }) => {
|
|
1135
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1136
|
+
const body = { properties: {
|
|
1137
|
+
...autoDeleteOnIdle.length && { autoDeleteOnIdle },
|
|
1138
|
+
clientAffineProperties: {
|
|
1139
|
+
...clientId.length && { clientId },
|
|
1140
|
+
isDurable,
|
|
1141
|
+
isShared
|
|
1142
|
+
},
|
|
1143
|
+
deadLetteringOnFilterEvaluationExceptions,
|
|
1144
|
+
deadLetteringOnMessageExpiration,
|
|
1145
|
+
...defaultMessageTimeToLive.length && { defaultMessageTimeToLive },
|
|
1146
|
+
...duplicateDetectionHistoryTimeWindow.length && { duplicateDetectionHistoryTimeWindow },
|
|
1147
|
+
enableBatchedOperations,
|
|
1148
|
+
...forwardDeadLetteredMessagesTo.length && { forwardDeadLetteredMessagesTo },
|
|
1149
|
+
...forwardTo.length && { forwardTo },
|
|
1150
|
+
isClientAffine,
|
|
1151
|
+
...lockDuration.length && { lockDuration },
|
|
1152
|
+
...maxDeliveryCount && { maxDeliveryCount: _prismatic_io_spectral.util.types.toNumber(maxDeliveryCount) },
|
|
1153
|
+
requiresSession,
|
|
1154
|
+
...status.length && { status }
|
|
1155
|
+
} };
|
|
1156
|
+
try {
|
|
1157
|
+
const { data } = await client.put(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}/subscriptions/${subscriptionName}?api-version=2021-11-01`, body);
|
|
1158
|
+
return { data };
|
|
1159
|
+
} catch (error) {
|
|
1160
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1161
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1162
|
+
throw new Error(serialized);
|
|
1163
|
+
}
|
|
1164
|
+
},
|
|
1165
|
+
inputs: {
|
|
1166
|
+
connection,
|
|
1167
|
+
namespaceName: namespaceName$4,
|
|
1168
|
+
resourceGroupName: resourceGroupName$5,
|
|
1169
|
+
subscriptionId: subscriptionId$6,
|
|
1170
|
+
topicName: topicName$2,
|
|
1171
|
+
subscriptionName: subscriptionName$1,
|
|
1172
|
+
autoDeleteOnIdle,
|
|
1173
|
+
deadLetteringOnFilterEvaluationExceptions,
|
|
1174
|
+
deadLetteringOnMessageExpiration,
|
|
1175
|
+
defaultMessageTimeToLive,
|
|
1176
|
+
duplicateDetectionHistoryTimeWindow,
|
|
1177
|
+
enableBatchedOperations,
|
|
1178
|
+
forwardDeadLetteredMessagesTo,
|
|
1179
|
+
forwardTo,
|
|
1180
|
+
isClientAffine,
|
|
1181
|
+
lockDuration,
|
|
1182
|
+
maxDeliveryCount,
|
|
1183
|
+
requiresSession,
|
|
1184
|
+
status,
|
|
1185
|
+
clientId,
|
|
1186
|
+
isDurable,
|
|
1187
|
+
isShared
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region src/actions/createOrUpdateTopic.ts
|
|
1192
|
+
const createOrUpdateTopic = (0, _prismatic_io_spectral.action)({
|
|
1193
|
+
display: {
|
|
1194
|
+
label: "Create or Update Topic",
|
|
1195
|
+
description: "Creates or updates a topic in the specified namespace."
|
|
1196
|
+
},
|
|
1197
|
+
examplePayload: createOrUpdateTopicExamplePayload,
|
|
1198
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, topicName, autoDeleteOnIdle, defaultMessageTimeToLive, duplicateDetectionHistoryTimeWindow, enableBatchedOperations, enableExpress, enablePartitioning, maxMessageSizeInKilobytes, maxSizeInMegabytes, requiresDuplicateDetection, status, supportOrdering }) => {
|
|
1199
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1200
|
+
try {
|
|
1201
|
+
const body = { properties: {
|
|
1202
|
+
...autoDeleteOnIdle.length && { autoDeleteOnIdle },
|
|
1203
|
+
...defaultMessageTimeToLive.length && { defaultMessageTimeToLive },
|
|
1204
|
+
...duplicateDetectionHistoryTimeWindow.length && { duplicateDetectionHistoryTimeWindow },
|
|
1205
|
+
enableBatchedOperations,
|
|
1206
|
+
enableExpress,
|
|
1207
|
+
enablePartitioning,
|
|
1208
|
+
...maxMessageSizeInKilobytes.length && { maxMessageSizeInKilobytes: _prismatic_io_spectral.util.types.toNumber(maxMessageSizeInKilobytes) },
|
|
1209
|
+
...maxSizeInMegabytes.length && { maxSizeInMegabytes: _prismatic_io_spectral.util.types.toNumber(maxSizeInMegabytes) },
|
|
1210
|
+
requiresDuplicateDetection,
|
|
1211
|
+
...status.length && { status },
|
|
1212
|
+
supportOrdering
|
|
1213
|
+
} };
|
|
1214
|
+
const { data } = await client.put(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}?api-version=2021-11-01`, body);
|
|
1215
|
+
return { data };
|
|
1216
|
+
} catch (error) {
|
|
1217
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1218
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1219
|
+
throw new Error(serialized);
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
inputs: {
|
|
1223
|
+
connection,
|
|
1224
|
+
namespaceName: namespaceName$4,
|
|
1225
|
+
resourceGroupName: resourceGroupName$5,
|
|
1226
|
+
subscriptionId: subscriptionId$6,
|
|
1227
|
+
topicName: topicName$2,
|
|
1228
|
+
autoDeleteOnIdle,
|
|
1229
|
+
defaultMessageTimeToLive,
|
|
1230
|
+
duplicateDetectionHistoryTimeWindow,
|
|
1231
|
+
enableBatchedOperations,
|
|
1232
|
+
enableExpress,
|
|
1233
|
+
enablePartitioning,
|
|
1234
|
+
maxMessageSizeInKilobytes,
|
|
1235
|
+
maxSizeInMegabytes,
|
|
1236
|
+
requiresDuplicateDetection,
|
|
1237
|
+
status,
|
|
1238
|
+
supportOrdering
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
//#endregion
|
|
1242
|
+
//#region src/actions/deleteNamespace.ts
|
|
1243
|
+
const deleteNamespace = (0, _prismatic_io_spectral.action)({
|
|
1244
|
+
display: {
|
|
1245
|
+
label: "Delete Namespace",
|
|
1246
|
+
description: "Deletes an existing namespace. This operation also removes all associated resources under the namespace."
|
|
1247
|
+
},
|
|
1248
|
+
examplePayload: deleteNamespaceExamplePayload,
|
|
1249
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId }) => {
|
|
1250
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1251
|
+
try {
|
|
1252
|
+
const { data } = await client.delete(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}?api-version=2021-11-01`);
|
|
1253
|
+
return { data };
|
|
1254
|
+
} catch (error) {
|
|
1255
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1256
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1257
|
+
throw new Error(serialized);
|
|
1258
|
+
}
|
|
1259
|
+
},
|
|
1260
|
+
inputs: {
|
|
1261
|
+
connection,
|
|
1262
|
+
namespaceName: namespaceName$4,
|
|
1263
|
+
resourceGroupName: resourceGroupName$5,
|
|
1264
|
+
subscriptionId: subscriptionId$6
|
|
1265
|
+
}
|
|
1266
|
+
});
|
|
1267
|
+
//#endregion
|
|
1268
|
+
//#region src/actions/deleteQueue.ts
|
|
1269
|
+
const deleteQueue = (0, _prismatic_io_spectral.action)({
|
|
1270
|
+
display: {
|
|
1271
|
+
label: "Delete Queue",
|
|
1272
|
+
description: "Deletes a queue from the specified namespace in a resource group."
|
|
1273
|
+
},
|
|
1274
|
+
examplePayload: deleteQueueExamplePayload,
|
|
1275
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, queueName }) => {
|
|
1276
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1277
|
+
try {
|
|
1278
|
+
const { data } = await client.delete(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/queues/${queueName}?api-version=2021-11-01`);
|
|
1279
|
+
return { data };
|
|
1280
|
+
} catch (error) {
|
|
1281
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1282
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1283
|
+
throw new Error(serialized);
|
|
1284
|
+
}
|
|
1285
|
+
},
|
|
1286
|
+
inputs: {
|
|
1287
|
+
connection,
|
|
1288
|
+
namespaceName: namespaceName$4,
|
|
1289
|
+
resourceGroupName: resourceGroupName$5,
|
|
1290
|
+
subscriptionId: subscriptionId$6,
|
|
1291
|
+
queueName
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
1294
|
+
//#endregion
|
|
1295
|
+
//#region src/actions/deleteRule.ts
|
|
1296
|
+
const deleteRule = (0, _prismatic_io_spectral.action)({
|
|
1297
|
+
display: {
|
|
1298
|
+
label: "Delete Rule",
|
|
1299
|
+
description: "Deletes an existing rule."
|
|
1300
|
+
},
|
|
1301
|
+
examplePayload: deleteRuleExamplePayload,
|
|
1302
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, topicName, subscriptionName, ruleName }) => {
|
|
1303
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1304
|
+
try {
|
|
1305
|
+
const { data } = await client.delete(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}/subscriptions/${subscriptionName}/rules/${ruleName}?api-version=2021-11-01`);
|
|
1306
|
+
return { data };
|
|
1307
|
+
} catch (error) {
|
|
1308
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1309
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1310
|
+
throw new Error(serialized);
|
|
1311
|
+
}
|
|
1312
|
+
},
|
|
1313
|
+
inputs: {
|
|
1314
|
+
connection,
|
|
1315
|
+
namespaceName: namespaceName$4,
|
|
1316
|
+
resourceGroupName: resourceGroupName$5,
|
|
1317
|
+
subscriptionId: subscriptionId$6,
|
|
1318
|
+
topicName: topicName$2,
|
|
1319
|
+
subscriptionName: subscriptionName$1,
|
|
1320
|
+
ruleName
|
|
1321
|
+
}
|
|
1322
|
+
});
|
|
1323
|
+
//#endregion
|
|
1324
|
+
//#region src/actions/deleteSubscriptions.ts
|
|
1325
|
+
const deleteSubscriptions = (0, _prismatic_io_spectral.action)({
|
|
1326
|
+
display: {
|
|
1327
|
+
label: "Delete Subscriptions",
|
|
1328
|
+
description: "Deletes a subscription from the specified topic."
|
|
1329
|
+
},
|
|
1330
|
+
examplePayload: deleteSubscriptionsExamplePayload,
|
|
1331
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, topicName, subscriptionName }) => {
|
|
1332
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1333
|
+
try {
|
|
1334
|
+
const { data } = await client.delete(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}/subscriptions/${subscriptionName}?api-version=2021-11-01`);
|
|
1335
|
+
return { data };
|
|
1336
|
+
} catch (error) {
|
|
1337
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1338
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1339
|
+
throw new Error(serialized);
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
inputs: {
|
|
1343
|
+
connection,
|
|
1344
|
+
namespaceName: namespaceName$4,
|
|
1345
|
+
resourceGroupName: resourceGroupName$5,
|
|
1346
|
+
subscriptionId: subscriptionId$6,
|
|
1347
|
+
topicName: topicName$2,
|
|
1348
|
+
subscriptionName: subscriptionName$1
|
|
1349
|
+
}
|
|
1350
|
+
});
|
|
1351
|
+
//#endregion
|
|
1352
|
+
//#region src/actions/deleteTopic.ts
|
|
1353
|
+
const deleteTopic = (0, _prismatic_io_spectral.action)({
|
|
1354
|
+
display: {
|
|
1355
|
+
label: "Delete Topic",
|
|
1356
|
+
description: "Deletes a topic from the specified namespace and resource group."
|
|
1357
|
+
},
|
|
1358
|
+
examplePayload: deleteTopicExamplePayload,
|
|
1359
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, topicName }) => {
|
|
1360
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1361
|
+
try {
|
|
1362
|
+
const { data } = await client.delete(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}?api-version=2021-11-01`);
|
|
1363
|
+
return { data };
|
|
1364
|
+
} catch (error) {
|
|
1365
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1366
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1367
|
+
throw new Error(serialized);
|
|
1368
|
+
}
|
|
1369
|
+
},
|
|
1370
|
+
inputs: {
|
|
1371
|
+
connection,
|
|
1372
|
+
namespaceName: namespaceName$4,
|
|
1373
|
+
resourceGroupName: resourceGroupName$5,
|
|
1374
|
+
subscriptionId: subscriptionId$6,
|
|
1375
|
+
topicName: topicName$2
|
|
1376
|
+
}
|
|
1377
|
+
});
|
|
1378
|
+
//#endregion
|
|
1379
|
+
//#region src/actions/getNamespaces.ts
|
|
1380
|
+
const getNamespaces = (0, _prismatic_io_spectral.action)({
|
|
1381
|
+
display: {
|
|
1382
|
+
label: "Get Namespaces",
|
|
1383
|
+
description: "Gets a description for the specified namespace."
|
|
1384
|
+
},
|
|
1385
|
+
examplePayload: getNamespacesExamplePayload,
|
|
1386
|
+
perform: async (context, { connection, subscriptionId, resourceGroupName, namespaceName }) => {
|
|
1387
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1388
|
+
try {
|
|
1389
|
+
const { data } = await client.get(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}?api-version=2021-11-01`);
|
|
1390
|
+
return { data };
|
|
1391
|
+
} catch (error) {
|
|
1392
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1393
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1394
|
+
throw new Error(serialized);
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
inputs: {
|
|
1398
|
+
connection,
|
|
1399
|
+
subscriptionId: subscriptionId$6,
|
|
1400
|
+
resourceGroupName: resourceGroupName$5,
|
|
1401
|
+
namespaceName: namespaceName$4
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
//#endregion
|
|
1405
|
+
//#region src/actions/getQueue.ts
|
|
1406
|
+
const getQueue = (0, _prismatic_io_spectral.action)({
|
|
1407
|
+
display: {
|
|
1408
|
+
label: "Get Queue",
|
|
1409
|
+
description: "Returns a description for the specified queue."
|
|
1410
|
+
},
|
|
1411
|
+
examplePayload: getQueueExamplePayload,
|
|
1412
|
+
perform: async (context, { connection, subscriptionId, resourceGroupName, namespaceName, queueName }) => {
|
|
1413
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1414
|
+
try {
|
|
1415
|
+
const { data } = await client.get(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/queues/${queueName}?api-version=2021-11-01`);
|
|
1416
|
+
return { data };
|
|
1417
|
+
} catch (error) {
|
|
1418
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1419
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1420
|
+
throw new Error(serialized);
|
|
1421
|
+
}
|
|
1422
|
+
},
|
|
1423
|
+
inputs: {
|
|
1424
|
+
connection,
|
|
1425
|
+
subscriptionId: subscriptionId$6,
|
|
1426
|
+
resourceGroupName: resourceGroupName$5,
|
|
1427
|
+
namespaceName: namespaceName$4,
|
|
1428
|
+
queueName
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
//#endregion
|
|
1432
|
+
//#region src/actions/getRule.ts
|
|
1433
|
+
const getRule = (0, _prismatic_io_spectral.action)({
|
|
1434
|
+
display: {
|
|
1435
|
+
label: "Get Rule",
|
|
1436
|
+
description: "Retrieves the description for the specified rule."
|
|
1437
|
+
},
|
|
1438
|
+
examplePayload: getRuleExamplePayload,
|
|
1439
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, topicName, subscriptionName, ruleName }) => {
|
|
1440
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1441
|
+
try {
|
|
1442
|
+
const { data } = await client.get(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}/subscriptions/${subscriptionName}/rules/${ruleName}?api-version=2021-11-01`);
|
|
1443
|
+
return { data };
|
|
1444
|
+
} catch (error) {
|
|
1445
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1446
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1447
|
+
throw new Error(serialized);
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1450
|
+
inputs: {
|
|
1451
|
+
connection,
|
|
1452
|
+
namespaceName: namespaceName$4,
|
|
1453
|
+
resourceGroupName: resourceGroupName$5,
|
|
1454
|
+
subscriptionId: subscriptionId$6,
|
|
1455
|
+
topicName: topicName$2,
|
|
1456
|
+
subscriptionName: subscriptionName$1,
|
|
1457
|
+
ruleName
|
|
1458
|
+
}
|
|
1459
|
+
});
|
|
1460
|
+
//#endregion
|
|
1461
|
+
//#region src/actions/getSubscriptions.ts
|
|
1462
|
+
const getSubscriptions = (0, _prismatic_io_spectral.action)({
|
|
1463
|
+
display: {
|
|
1464
|
+
label: "Get Subscriptions",
|
|
1465
|
+
description: "Returns a subscription description for the specified topic."
|
|
1466
|
+
},
|
|
1467
|
+
examplePayload: getSubscriptionsExamplePayload,
|
|
1468
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, topicName, subscriptionName }) => {
|
|
1469
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1470
|
+
try {
|
|
1471
|
+
const { data } = await client.get(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}/subscriptions/${subscriptionName}?api-version=2021-11-01`);
|
|
1472
|
+
return { data };
|
|
1473
|
+
} catch (error) {
|
|
1474
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1475
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1476
|
+
throw new Error(serialized);
|
|
1477
|
+
}
|
|
1478
|
+
},
|
|
1479
|
+
inputs: {
|
|
1480
|
+
connection,
|
|
1481
|
+
namespaceName: namespaceName$4,
|
|
1482
|
+
resourceGroupName: resourceGroupName$5,
|
|
1483
|
+
subscriptionId: subscriptionId$6,
|
|
1484
|
+
topicName: topicName$2,
|
|
1485
|
+
subscriptionName: subscriptionName$1
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
//#endregion
|
|
1489
|
+
//#region src/actions/getTopic.ts
|
|
1490
|
+
const getTopic = (0, _prismatic_io_spectral.action)({
|
|
1491
|
+
display: {
|
|
1492
|
+
label: "Get Topic",
|
|
1493
|
+
description: "Gets all the topics in a namespace"
|
|
1494
|
+
},
|
|
1495
|
+
examplePayload: getTopicExamplePayload,
|
|
1496
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, topicName }) => {
|
|
1497
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1498
|
+
try {
|
|
1499
|
+
const { data } = await client.get(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}?api-version=2021-11-01`);
|
|
1500
|
+
return { data };
|
|
1501
|
+
} catch (error) {
|
|
1502
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1503
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1504
|
+
throw new Error(serialized);
|
|
1505
|
+
}
|
|
1506
|
+
},
|
|
1507
|
+
inputs: {
|
|
1508
|
+
connection,
|
|
1509
|
+
namespaceName: namespaceName$4,
|
|
1510
|
+
resourceGroupName: resourceGroupName$5,
|
|
1511
|
+
subscriptionId: subscriptionId$6,
|
|
1512
|
+
topicName: topicName$2
|
|
1513
|
+
}
|
|
1514
|
+
});
|
|
1515
|
+
//#endregion
|
|
1516
|
+
//#region src/helpers/pagination.ts
|
|
1517
|
+
const paginateResults = async ({ client, endpoint, params = {}, fetchAll }) => {
|
|
1518
|
+
if (fetchAll) {
|
|
1519
|
+
const allResults = [];
|
|
1520
|
+
let nextLink;
|
|
1521
|
+
let pages = 0;
|
|
1522
|
+
const { data: firstPage } = await client.get(endpoint, { params });
|
|
1523
|
+
allResults.push(...firstPage.value || []);
|
|
1524
|
+
nextLink = firstPage.nextLink || void 0;
|
|
1525
|
+
pages++;
|
|
1526
|
+
while (nextLink && pages < 100) {
|
|
1527
|
+
const { data: page } = await client.get(nextLink);
|
|
1528
|
+
allResults.push(...page.value || []);
|
|
1529
|
+
nextLink = page.nextLink || void 0;
|
|
1530
|
+
pages++;
|
|
1531
|
+
}
|
|
1532
|
+
return { data: allResults };
|
|
1533
|
+
}
|
|
1534
|
+
const { data } = await client.get(endpoint, { params: Object.keys(params).length > 0 ? params : void 0 });
|
|
1535
|
+
return { data };
|
|
1536
|
+
};
|
|
1537
|
+
//#endregion
|
|
1538
|
+
//#region src/actions/listNamespaces.ts
|
|
1539
|
+
const listNamespaces = (0, _prismatic_io_spectral.action)({
|
|
1540
|
+
display: {
|
|
1541
|
+
label: "List Namespaces",
|
|
1542
|
+
description: "Gets all the available namespaces within the subscription, irrespective of the resource groups."
|
|
1543
|
+
},
|
|
1544
|
+
examplePayload: listNamespacesExamplePayload,
|
|
1545
|
+
perform: async (context, { connection, subscriptionId, fetchAll }) => {
|
|
1546
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1547
|
+
const endpoint = `/${subscriptionId}/providers/Microsoft.ServiceBus/namespaces?api-version=2021-11-01`;
|
|
1548
|
+
try {
|
|
1549
|
+
return await paginateResults({
|
|
1550
|
+
client,
|
|
1551
|
+
endpoint,
|
|
1552
|
+
fetchAll
|
|
1553
|
+
});
|
|
1554
|
+
} catch (error) {
|
|
1555
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1556
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1557
|
+
throw new Error(serialized);
|
|
1558
|
+
}
|
|
1559
|
+
},
|
|
1560
|
+
inputs: {
|
|
1561
|
+
connection,
|
|
1562
|
+
subscriptionId: subscriptionId$6,
|
|
1563
|
+
fetchAll
|
|
1564
|
+
}
|
|
1565
|
+
});
|
|
1566
|
+
//#endregion
|
|
1567
|
+
//#region src/actions/listNamespacesByResourceGroup.ts
|
|
1568
|
+
const listNamespacesByResourceGroup = (0, _prismatic_io_spectral.action)({
|
|
1569
|
+
display: {
|
|
1570
|
+
label: "List Namespaces By Resource Group",
|
|
1571
|
+
description: "Gets the available namespaces within a resource group."
|
|
1572
|
+
},
|
|
1573
|
+
examplePayload: listNamespacesByResourceGroupExamplePayload,
|
|
1574
|
+
perform: async (context, { connection, resourceGroupName, subscriptionId, fetchAll }) => {
|
|
1575
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1576
|
+
const endpoint = `/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces?api-version=2021-11-01`;
|
|
1577
|
+
try {
|
|
1578
|
+
return await paginateResults({
|
|
1579
|
+
client,
|
|
1580
|
+
endpoint,
|
|
1581
|
+
fetchAll
|
|
1582
|
+
});
|
|
1583
|
+
} catch (error) {
|
|
1584
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1585
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1586
|
+
throw new Error(serialized);
|
|
1587
|
+
}
|
|
1588
|
+
},
|
|
1589
|
+
inputs: {
|
|
1590
|
+
connection,
|
|
1591
|
+
resourceGroupName: resourceGroupName$5,
|
|
1592
|
+
subscriptionId: subscriptionId$6,
|
|
1593
|
+
fetchAll
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
//#endregion
|
|
1597
|
+
//#region src/actions/listQueues.ts
|
|
1598
|
+
const listQueues = (0, _prismatic_io_spectral.action)({
|
|
1599
|
+
display: {
|
|
1600
|
+
label: "List Queues",
|
|
1601
|
+
description: "Gets the queues within a namespace."
|
|
1602
|
+
},
|
|
1603
|
+
examplePayload: listQueuesExamplePayload,
|
|
1604
|
+
perform: async (context, { connection, subscriptionId, resourceGroupName, namespaceName, fetchAll, $skip, $top }) => {
|
|
1605
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1606
|
+
const endpoint = `/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/queues?api-version=2021-11-01`;
|
|
1607
|
+
try {
|
|
1608
|
+
return await paginateResults({
|
|
1609
|
+
client,
|
|
1610
|
+
endpoint,
|
|
1611
|
+
params: {
|
|
1612
|
+
$skip: $skip || void 0,
|
|
1613
|
+
$top: $top || void 0
|
|
1614
|
+
},
|
|
1615
|
+
fetchAll
|
|
1616
|
+
});
|
|
1617
|
+
} catch (error) {
|
|
1618
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1619
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1620
|
+
throw new Error(serialized);
|
|
1621
|
+
}
|
|
1622
|
+
},
|
|
1623
|
+
inputs: {
|
|
1624
|
+
connection,
|
|
1625
|
+
subscriptionId: subscriptionId$6,
|
|
1626
|
+
resourceGroupName: resourceGroupName$5,
|
|
1627
|
+
namespaceName: namespaceName$4,
|
|
1628
|
+
fetchAll,
|
|
1629
|
+
$skip,
|
|
1630
|
+
$top
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1633
|
+
//#endregion
|
|
1634
|
+
//#region src/actions/listRules.ts
|
|
1635
|
+
const listRules = (0, _prismatic_io_spectral.action)({
|
|
1636
|
+
display: {
|
|
1637
|
+
label: "List Rules",
|
|
1638
|
+
description: "List all the rules within given topic-subscription"
|
|
1639
|
+
},
|
|
1640
|
+
examplePayload: listRulesExamplePayload,
|
|
1641
|
+
perform: async (context, { connection, subscriptionId, resourceGroupName, namespaceName, topicName, subscriptionName, fetchAll, $skip, $top }) => {
|
|
1642
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1643
|
+
const endpoint = `/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}/subscriptions/${subscriptionName}/rules?api-version=2021-11-01`;
|
|
1644
|
+
try {
|
|
1645
|
+
return await paginateResults({
|
|
1646
|
+
client,
|
|
1647
|
+
endpoint,
|
|
1648
|
+
params: {
|
|
1649
|
+
$skip: $skip || void 0,
|
|
1650
|
+
$top: $top || void 0
|
|
1651
|
+
},
|
|
1652
|
+
fetchAll
|
|
1653
|
+
});
|
|
1654
|
+
} catch (error) {
|
|
1655
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1656
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1657
|
+
throw new Error(serialized);
|
|
1658
|
+
}
|
|
1659
|
+
},
|
|
1660
|
+
inputs: {
|
|
1661
|
+
connection,
|
|
1662
|
+
subscriptionId: subscriptionId$6,
|
|
1663
|
+
resourceGroupName: resourceGroupName$5,
|
|
1664
|
+
namespaceName: namespaceName$4,
|
|
1665
|
+
topicName: topicName$2,
|
|
1666
|
+
subscriptionName: subscriptionName$1,
|
|
1667
|
+
fetchAll,
|
|
1668
|
+
$skip,
|
|
1669
|
+
$top
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
//#endregion
|
|
1673
|
+
//#region src/actions/listSubscriptions.ts
|
|
1674
|
+
const listSubscriptions = (0, _prismatic_io_spectral.action)({
|
|
1675
|
+
display: {
|
|
1676
|
+
label: "List Subscriptions",
|
|
1677
|
+
description: "List all the subscriptions"
|
|
1678
|
+
},
|
|
1679
|
+
perform: async (context, { connection, version }) => {
|
|
1680
|
+
const { data } = await getAzureServiceBusClient(connection, context.debug.enabled).get("", { params: { "api-version": version } });
|
|
1681
|
+
return { data };
|
|
1682
|
+
},
|
|
1683
|
+
inputs: {
|
|
1684
|
+
connection,
|
|
1685
|
+
version
|
|
1686
|
+
}
|
|
1687
|
+
});
|
|
1688
|
+
//#endregion
|
|
1689
|
+
//#region src/actions/listSubscriptionsByTopic.ts
|
|
1690
|
+
const listSubscriptionsByTopic = (0, _prismatic_io_spectral.action)({
|
|
1691
|
+
display: {
|
|
1692
|
+
label: "List Subscriptions By Topic",
|
|
1693
|
+
description: "List all the subscriptions under a specified topic."
|
|
1694
|
+
},
|
|
1695
|
+
examplePayload: listSubscriptionsByTopicExamplePayload,
|
|
1696
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, fetchAll, $skip, $top, topicName }) => {
|
|
1697
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1698
|
+
const endpoint = `/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}/subscriptions?api-version=2021-11-01`;
|
|
1699
|
+
try {
|
|
1700
|
+
return await paginateResults({
|
|
1701
|
+
client,
|
|
1702
|
+
endpoint,
|
|
1703
|
+
params: {
|
|
1704
|
+
$skip: $skip || void 0,
|
|
1705
|
+
$top: $top || void 0
|
|
1706
|
+
},
|
|
1707
|
+
fetchAll
|
|
1708
|
+
});
|
|
1709
|
+
} catch (error) {
|
|
1710
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1711
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1712
|
+
throw new Error(serialized);
|
|
1713
|
+
}
|
|
1714
|
+
},
|
|
1715
|
+
inputs: {
|
|
1716
|
+
connection,
|
|
1717
|
+
namespaceName: namespaceName$4,
|
|
1718
|
+
queueName,
|
|
1719
|
+
resourceGroupName: resourceGroupName$5,
|
|
1720
|
+
subscriptionId: subscriptionId$6,
|
|
1721
|
+
fetchAll,
|
|
1722
|
+
$skip,
|
|
1723
|
+
$top,
|
|
1724
|
+
topicName: topicName$2
|
|
1725
|
+
}
|
|
1726
|
+
});
|
|
1727
|
+
//#endregion
|
|
1728
|
+
//#region src/actions/listTopicsByNamespace.ts
|
|
1729
|
+
const listTopicsByNamespace = (0, _prismatic_io_spectral.action)({
|
|
1730
|
+
display: {
|
|
1731
|
+
label: "List Topics By Namespace",
|
|
1732
|
+
description: "Gets all the topics in a namespace"
|
|
1733
|
+
},
|
|
1734
|
+
examplePayload: listTopicsByNamespaceExamplePayload,
|
|
1735
|
+
perform: async (context, { connection, namespaceName, resourceGroupName, subscriptionId, fetchAll, $skip, $top }) => {
|
|
1736
|
+
const client = getAzureServiceBusClient(connection, context.debug.enabled);
|
|
1737
|
+
const endpoint = `/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics?api-version=2021-11-01`;
|
|
1738
|
+
try {
|
|
1739
|
+
return await paginateResults({
|
|
1740
|
+
client,
|
|
1741
|
+
endpoint,
|
|
1742
|
+
params: {
|
|
1743
|
+
$skip: $skip || void 0,
|
|
1744
|
+
$top: $top || void 0
|
|
1745
|
+
},
|
|
1746
|
+
fetchAll
|
|
1747
|
+
});
|
|
1748
|
+
} catch (error) {
|
|
1749
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
1750
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
1751
|
+
throw new Error(serialized);
|
|
1752
|
+
}
|
|
1753
|
+
},
|
|
1754
|
+
inputs: {
|
|
1755
|
+
connection,
|
|
1756
|
+
namespaceName: namespaceName$4,
|
|
1757
|
+
queueName,
|
|
1758
|
+
resourceGroupName: resourceGroupName$5,
|
|
1759
|
+
subscriptionId: subscriptionId$6,
|
|
1760
|
+
fetchAll,
|
|
1761
|
+
$skip,
|
|
1762
|
+
$top
|
|
1763
|
+
}
|
|
1764
|
+
});
|
|
1765
|
+
//#endregion
|
|
1766
|
+
//#region node_modules/safe-stable-stringify/index.js
|
|
1767
|
+
const { hasOwnProperty } = Object.prototype;
|
|
1768
|
+
/** @typedef {{toJSON: (key: string) => unknown}} ToJSON */
|
|
1769
|
+
const strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
|
|
1770
|
+
const nodeVersion = typeof process === "object" ? process?.versions?.node : void 0;
|
|
1771
|
+
const strEscapeLength = Number(nodeVersion?.slice(0, nodeVersion.indexOf("."))) >= 22 ? 128 : 5e3;
|
|
1772
|
+
function strEscape(str) {
|
|
1773
|
+
if (str.length < strEscapeLength && !strEscapeSequencesRegExp.test(str)) return `"${str}"`;
|
|
1774
|
+
return JSON.stringify(str);
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* @param {string[]} array
|
|
1778
|
+
* @param {(a: string, b: string) => number} [comparator]
|
|
1779
|
+
*/
|
|
1780
|
+
function sort(array, comparator) {
|
|
1781
|
+
if (array.length > 200 || comparator) return array.sort(comparator);
|
|
1782
|
+
let moves = 0;
|
|
1783
|
+
if (array.length > 1 && array[0] > array[1]) {
|
|
1784
|
+
const currentValue = array[1];
|
|
1785
|
+
if (array.length > 32 && currentValue > array[array.length - 1]) return array.sort();
|
|
1786
|
+
array[1] = array[0];
|
|
1787
|
+
array[0] = currentValue;
|
|
1788
|
+
moves = 1;
|
|
1789
|
+
}
|
|
1790
|
+
for (let i = 2; i < array.length; i++) {
|
|
1791
|
+
const currentValue = array[i];
|
|
1792
|
+
if (array[i - 1] <= currentValue) continue;
|
|
1793
|
+
let position = i;
|
|
1794
|
+
do {
|
|
1795
|
+
array[position] = array[position - 1];
|
|
1796
|
+
position--;
|
|
1797
|
+
} while (position !== 0 && array[position - 1] > currentValue);
|
|
1798
|
+
array[position] = currentValue;
|
|
1799
|
+
moves += i - position;
|
|
1800
|
+
if (moves > array.length && moves > 32) return array.sort();
|
|
1801
|
+
}
|
|
1802
|
+
return array;
|
|
1803
|
+
}
|
|
1804
|
+
const typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(/* @__PURE__ */ new Int8Array())), Symbol.toStringTag).get;
|
|
1805
|
+
/** @param {object & {length?: unknown}} value */
|
|
1806
|
+
function getTypedArrayType(value) {
|
|
1807
|
+
const type = typedArrayPrototypeGetSymbolToStringTag.call(value);
|
|
1808
|
+
return type !== void 0 && value.length !== 0 ? type : void 0;
|
|
1809
|
+
}
|
|
1810
|
+
/** @param {number | bigint} value */
|
|
1811
|
+
function wrapInQuotes(value) {
|
|
1812
|
+
return `"${value}"`;
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* @param {ArrayLike<number | bigint>} array
|
|
1816
|
+
* @param {string} separator
|
|
1817
|
+
* @param {number} maximumBreadth
|
|
1818
|
+
* @param {boolean | 'string'} bigint
|
|
1819
|
+
* @param {((value: number | bigint) => never) | undefined} fail
|
|
1820
|
+
* @param {string} type
|
|
1821
|
+
*/
|
|
1822
|
+
function stringifyTypedArray(array, separator, maximumBreadth, bigint, fail, type) {
|
|
1823
|
+
if (array.length < maximumBreadth) maximumBreadth = array.length;
|
|
1824
|
+
const whitespace = separator === "," ? "" : " ";
|
|
1825
|
+
if (type[0] === "F") {
|
|
1826
|
+
let value = array[0];
|
|
1827
|
+
let res = `"0":${whitespace}${Number.isFinite(value) ? value : fail ? fail(value) : "null"}`;
|
|
1828
|
+
for (let i = 1; i < maximumBreadth; i++) {
|
|
1829
|
+
value = array[i];
|
|
1830
|
+
res += `${separator}"${i}":${whitespace}${Number.isFinite(value) ? value : fail ? fail(value) : "null"}`;
|
|
1831
|
+
}
|
|
1832
|
+
return res;
|
|
1833
|
+
}
|
|
1834
|
+
const method = bigint === "string" && array.length > 0 && typeof array[0] === "bigint" ? wrapInQuotes : String;
|
|
1835
|
+
let res = `"0":${whitespace}${method(array[0])}`;
|
|
1836
|
+
for (let i = 1; i < maximumBreadth; i++) res += `${separator}"${i}":${whitespace}${method(array[i])}`;
|
|
1837
|
+
return res;
|
|
1838
|
+
}
|
|
1839
|
+
/** @param {number} index */
|
|
1840
|
+
function stringifyCircularDepth(index) {
|
|
1841
|
+
return `"[Circular: ${index}]"`;
|
|
1842
|
+
}
|
|
1843
|
+
/** @param {Record<string, unknown>} options */
|
|
1844
|
+
function getCircularValueOption(options) {
|
|
1845
|
+
if (hasOwnProperty.call(options, "circularValue")) {
|
|
1846
|
+
const circularValue = options.circularValue;
|
|
1847
|
+
if (typeof circularValue === "string") return `"${circularValue}"`;
|
|
1848
|
+
if (circularValue == null) return circularValue;
|
|
1849
|
+
if (circularValue === Error || circularValue === TypeError) return { toString() {
|
|
1850
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
1851
|
+
} };
|
|
1852
|
+
throw new TypeError("The \"circularValue\" argument must be of type string or the value null or undefined");
|
|
1853
|
+
}
|
|
1854
|
+
return stringifyCircularDepth;
|
|
1855
|
+
}
|
|
1856
|
+
function getDeterministicOption(options) {
|
|
1857
|
+
let value;
|
|
1858
|
+
if (hasOwnProperty.call(options, "deterministic")) {
|
|
1859
|
+
value = options.deterministic;
|
|
1860
|
+
if (typeof value !== "boolean" && typeof value !== "function") throw new TypeError("The \"deterministic\" argument must be of type boolean or comparator function");
|
|
1861
|
+
}
|
|
1862
|
+
return value === void 0 ? true : value;
|
|
1863
|
+
}
|
|
1864
|
+
function getBigIntOption(options) {
|
|
1865
|
+
let value;
|
|
1866
|
+
if (hasOwnProperty.call(options, "bigint")) {
|
|
1867
|
+
value = options.bigint;
|
|
1868
|
+
if (typeof value === "string") {
|
|
1869
|
+
if (value !== "string") throw new TypeError("The \"bigint\" argument must be of type boolean or the string \"string\"");
|
|
1870
|
+
} else if (typeof value !== "boolean") throw new TypeError("The \"bigint\" argument must be of type boolean or the string \"string\"");
|
|
1871
|
+
}
|
|
1872
|
+
return value === void 0 ? true : value;
|
|
1873
|
+
}
|
|
1874
|
+
function getBooleanOption(options, key, defaultValue) {
|
|
1875
|
+
let value;
|
|
1876
|
+
if (hasOwnProperty.call(options, key)) {
|
|
1877
|
+
value = options[key];
|
|
1878
|
+
if (typeof value !== "boolean") throw new TypeError(`The "${key}" argument must be of type boolean`);
|
|
1879
|
+
}
|
|
1880
|
+
return value === void 0 ? defaultValue : value;
|
|
1881
|
+
}
|
|
1882
|
+
function getPositiveIntegerOption(options, key) {
|
|
1883
|
+
let value;
|
|
1884
|
+
if (hasOwnProperty.call(options, key)) {
|
|
1885
|
+
value = options[key];
|
|
1886
|
+
if (typeof value !== "number") throw new TypeError(`The "${key}" argument must be of type number`);
|
|
1887
|
+
if (!Number.isInteger(value)) throw new TypeError(`The "${key}" argument must be an integer`);
|
|
1888
|
+
if (value < 1) throw new RangeError(`The "${key}" argument must be >= 1`);
|
|
1889
|
+
}
|
|
1890
|
+
return value === void 0 ? Infinity : value;
|
|
1891
|
+
}
|
|
1892
|
+
function getItemCount(number) {
|
|
1893
|
+
if (number === 1) return "1 item";
|
|
1894
|
+
return `${number} items`;
|
|
1895
|
+
}
|
|
1896
|
+
function getUniqueReplacerSet(replacerArray) {
|
|
1897
|
+
const replacerSet = /* @__PURE__ */ new Set();
|
|
1898
|
+
for (const value of replacerArray) if (typeof value === "string" || typeof value === "number") replacerSet.add(String(value));
|
|
1899
|
+
return replacerSet;
|
|
1900
|
+
}
|
|
1901
|
+
function getStrictOption(options) {
|
|
1902
|
+
if (hasOwnProperty.call(options, "strict")) {
|
|
1903
|
+
const value = options.strict;
|
|
1904
|
+
if (typeof value !== "boolean") throw new TypeError("The \"strict\" argument must be of type boolean");
|
|
1905
|
+
if (value) return (value) => {
|
|
1906
|
+
let message = `Object can not safely be stringified. Received type ${typeof value}`;
|
|
1907
|
+
if (typeof value !== "function") message += ` (${safeErrorMessage(value)})`;
|
|
1908
|
+
throw new Error(message);
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
function safeErrorMessage(error) {
|
|
1913
|
+
try {
|
|
1914
|
+
return String(error);
|
|
1915
|
+
} catch {
|
|
1916
|
+
return "Failed";
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
function getErrorMessage(error, name) {
|
|
1920
|
+
const message = typeof error?.message === "string" ? error.message : safeErrorMessage(error);
|
|
1921
|
+
if (name) return `Error: Stringification failed with ${name} (${message})`;
|
|
1922
|
+
return `Error: Stringification failed (${message})`;
|
|
1923
|
+
}
|
|
1924
|
+
function callSafe(method, thisArg, input) {
|
|
1925
|
+
try {
|
|
1926
|
+
return method.call(thisArg, input);
|
|
1927
|
+
} catch (error) {
|
|
1928
|
+
return getErrorMessage(error, method.name);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
function makeSafe(method, name) {
|
|
1932
|
+
const safeMethod = function(...input) {
|
|
1933
|
+
try {
|
|
1934
|
+
return method(...input);
|
|
1935
|
+
} catch (error) {
|
|
1936
|
+
if (name !== void 0) return getErrorMessage(error, name);
|
|
1937
|
+
return `"${getErrorMessage(error, name)}"`;
|
|
1938
|
+
}
|
|
1939
|
+
};
|
|
1940
|
+
Object.defineProperty(safeMethod, "name", { value: `safe_${method.name}` });
|
|
1941
|
+
return safeMethod;
|
|
1942
|
+
}
|
|
1943
|
+
function configure$1(options) {
|
|
1944
|
+
options = { ...options };
|
|
1945
|
+
const fail = getStrictOption(options);
|
|
1946
|
+
if (fail) {
|
|
1947
|
+
if (options.bigint === void 0) options.bigint = false;
|
|
1948
|
+
if (!("circularValue" in options)) options.circularValue = Error;
|
|
1949
|
+
}
|
|
1950
|
+
const circularValue = getCircularValueOption(options);
|
|
1951
|
+
const bigint = getBigIntOption(options);
|
|
1952
|
+
const deterministic = getDeterministicOption(options);
|
|
1953
|
+
const comparator = typeof deterministic === "function" ? deterministic : void 0;
|
|
1954
|
+
const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
|
|
1955
|
+
const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
|
|
1956
|
+
const safe = getBooleanOption(options, "safe", false);
|
|
1957
|
+
let stringifyFnReplacer = function(key, parent, stack, replacer, spacer, indentation) {
|
|
1958
|
+
let value = parent[key];
|
|
1959
|
+
if (typeof value === "object" && value !== null && typeof value.toJSON === "function") value = safe ? callSafe(value.toJSON, value, key) : value.toJSON(key);
|
|
1960
|
+
value = replacer.call(parent, key, value);
|
|
1961
|
+
if (typeof value === "object") {
|
|
1962
|
+
if (value === null) return "null";
|
|
1963
|
+
const circularIndex = stack.indexOf(value);
|
|
1964
|
+
if (circularIndex !== -1) return typeof circularValue === "function" ? circularValue(circularIndex) : circularValue;
|
|
1965
|
+
let res = "";
|
|
1966
|
+
let join = ",";
|
|
1967
|
+
const originalIndentation = indentation;
|
|
1968
|
+
if (Array.isArray(value)) {
|
|
1969
|
+
if (value.length === 0) return "[]";
|
|
1970
|
+
if (maximumDepth < stack.length + 1) return "\"[Array]\"";
|
|
1971
|
+
stack.push(value);
|
|
1972
|
+
if (spacer !== "") {
|
|
1973
|
+
indentation += spacer;
|
|
1974
|
+
res += `\n${indentation}`;
|
|
1975
|
+
join = `,\n${indentation}`;
|
|
1976
|
+
}
|
|
1977
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
1978
|
+
let i = 0;
|
|
1979
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
1980
|
+
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
1981
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
1982
|
+
res += join;
|
|
1983
|
+
}
|
|
1984
|
+
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
1985
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
1986
|
+
if (value.length > maximumBreadth) {
|
|
1987
|
+
const removedKeys = value.length - maximumBreadth;
|
|
1988
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
1989
|
+
}
|
|
1990
|
+
if (spacer !== "") res += `\n${originalIndentation}`;
|
|
1991
|
+
stack.pop();
|
|
1992
|
+
return `[${res}]`;
|
|
1993
|
+
}
|
|
1994
|
+
let keys = Object.keys(value);
|
|
1995
|
+
const keyLength = keys.length;
|
|
1996
|
+
if (keyLength === 0) return "{}";
|
|
1997
|
+
if (maximumDepth < stack.length + 1) return "\"[Object]\"";
|
|
1998
|
+
let whitespace = "";
|
|
1999
|
+
let separator = "";
|
|
2000
|
+
if (spacer !== "") {
|
|
2001
|
+
indentation += spacer;
|
|
2002
|
+
join = `,\n${indentation}`;
|
|
2003
|
+
whitespace = " ";
|
|
2004
|
+
}
|
|
2005
|
+
const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
2006
|
+
if (deterministic && getTypedArrayType(value) === void 0) keys = sort(keys, comparator);
|
|
2007
|
+
stack.push(value);
|
|
2008
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
2009
|
+
const key = keys[i];
|
|
2010
|
+
const tmp = stringifyFnReplacer(key, value, stack, replacer, spacer, indentation);
|
|
2011
|
+
if (tmp !== void 0) {
|
|
2012
|
+
res += `${separator}${strEscape(key)}:${whitespace}${tmp}`;
|
|
2013
|
+
separator = join;
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
if (keyLength > maximumBreadth) {
|
|
2017
|
+
const removedKeys = keyLength - maximumBreadth;
|
|
2018
|
+
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
2019
|
+
separator = join;
|
|
2020
|
+
}
|
|
2021
|
+
if (spacer !== "" && separator.length > 1) res = `\n${indentation}${res}\n${originalIndentation}`;
|
|
2022
|
+
stack.pop();
|
|
2023
|
+
return `{${res}}`;
|
|
2024
|
+
}
|
|
2025
|
+
return stringifyFnPrimitive(value);
|
|
2026
|
+
};
|
|
2027
|
+
/**
|
|
2028
|
+
* @param {string | number} key
|
|
2029
|
+
* @param {object | null} value
|
|
2030
|
+
* @param {object[]} stack
|
|
2031
|
+
* @param {Set<string>} replacer
|
|
2032
|
+
* @param {string} spacer
|
|
2033
|
+
* @param {string} indentation
|
|
2034
|
+
*/
|
|
2035
|
+
let stringifyArrayReplacer = function(key, value, stack, replacer, spacer, indentation) {
|
|
2036
|
+
if (value === null) return "null";
|
|
2037
|
+
if (typeof value.toJSON === "function") {
|
|
2038
|
+
if (typeof key === "number") key = String(key);
|
|
2039
|
+
const jsonValue = safe ? callSafe(
|
|
2040
|
+
/** @type {ToJSON} */
|
|
2041
|
+
value.toJSON,
|
|
2042
|
+
value,
|
|
2043
|
+
key
|
|
2044
|
+
) : /** @type {ToJSON} */ value.toJSON(key);
|
|
2045
|
+
if (typeof jsonValue !== "object") return stringifyPrimitive(jsonValue);
|
|
2046
|
+
if (jsonValue === null) return "null";
|
|
2047
|
+
value = jsonValue;
|
|
2048
|
+
}
|
|
2049
|
+
const circularIndex = stack.indexOf(value);
|
|
2050
|
+
if (circularIndex !== -1) return typeof circularValue === "function" ? circularValue(circularIndex) : circularValue;
|
|
2051
|
+
const originalIndentation = indentation;
|
|
2052
|
+
let res = "";
|
|
2053
|
+
let join = ",";
|
|
2054
|
+
if (Array.isArray(value)) {
|
|
2055
|
+
if (value.length === 0) return "[]";
|
|
2056
|
+
if (maximumDepth < stack.length + 1) return "\"[Array]\"";
|
|
2057
|
+
stack.push(value);
|
|
2058
|
+
if (spacer !== "") {
|
|
2059
|
+
indentation += spacer;
|
|
2060
|
+
res += `\n${indentation}`;
|
|
2061
|
+
join = `,\n${indentation}`;
|
|
2062
|
+
}
|
|
2063
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
2064
|
+
let i = 0;
|
|
2065
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
2066
|
+
const item = value[i];
|
|
2067
|
+
const tmp = typeof item === "object" ? stringifyArrayReplacer(i, item, stack, replacer, spacer, indentation) : stringifyPrimitive(item);
|
|
2068
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2069
|
+
res += join;
|
|
2070
|
+
}
|
|
2071
|
+
const item = value[i];
|
|
2072
|
+
const tmp = typeof item === "object" ? stringifyArrayReplacer(i, item, stack, replacer, spacer, indentation) : stringifyPrimitive(item);
|
|
2073
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2074
|
+
if (value.length > maximumBreadth) {
|
|
2075
|
+
const removedKeys = value.length - maximumBreadth;
|
|
2076
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
2077
|
+
}
|
|
2078
|
+
if (spacer !== "") res += `\n${originalIndentation}`;
|
|
2079
|
+
stack.pop();
|
|
2080
|
+
return `[${res}]`;
|
|
2081
|
+
}
|
|
2082
|
+
if (maximumDepth < stack.length + 1) return "\"[Object]\"";
|
|
2083
|
+
stack.push(value);
|
|
2084
|
+
let whitespace = "";
|
|
2085
|
+
if (spacer !== "") {
|
|
2086
|
+
indentation += spacer;
|
|
2087
|
+
join = `,\n${indentation}`;
|
|
2088
|
+
whitespace = " ";
|
|
2089
|
+
}
|
|
2090
|
+
let separator = "";
|
|
2091
|
+
for (const key of replacer) {
|
|
2092
|
+
const item = value[key];
|
|
2093
|
+
const tmp = typeof item === "object" ? stringifyArrayReplacer(key, item, stack, replacer, spacer, indentation) : stringifyPrimitive(item);
|
|
2094
|
+
if (tmp !== void 0) {
|
|
2095
|
+
res += `${separator}${strEscape(key)}:${whitespace}${tmp}`;
|
|
2096
|
+
separator = join;
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
if (spacer !== "" && separator.length > 1) res = `\n${indentation}${res}\n${originalIndentation}`;
|
|
2100
|
+
stack.pop();
|
|
2101
|
+
return `{${res}}`;
|
|
2102
|
+
};
|
|
2103
|
+
/**
|
|
2104
|
+
* @param {string | number} key
|
|
2105
|
+
* @param {object | null} value
|
|
2106
|
+
* @param {object[]} stack
|
|
2107
|
+
* @param {string} spacer
|
|
2108
|
+
* @param {string} indentation
|
|
2109
|
+
*/
|
|
2110
|
+
let stringifyIndent = function(key, value, stack, spacer, indentation) {
|
|
2111
|
+
if (value === null) return "null";
|
|
2112
|
+
if (typeof value.toJSON === "function") {
|
|
2113
|
+
if (typeof key === "number") key = String(key);
|
|
2114
|
+
const jsonValue = safe ? callSafe(
|
|
2115
|
+
/** @type {ToJSON} */
|
|
2116
|
+
value.toJSON,
|
|
2117
|
+
value,
|
|
2118
|
+
key
|
|
2119
|
+
) : /** @type {ToJSON} */ value.toJSON(key);
|
|
2120
|
+
if (typeof jsonValue !== "object") return stringifyPrimitive(jsonValue);
|
|
2121
|
+
if (jsonValue === null) return "null";
|
|
2122
|
+
value = jsonValue;
|
|
2123
|
+
}
|
|
2124
|
+
const circularIndex = stack.indexOf(value);
|
|
2125
|
+
if (circularIndex !== -1) return typeof circularValue === "function" ? circularValue(circularIndex) : circularValue;
|
|
2126
|
+
const originalIndentation = indentation;
|
|
2127
|
+
if (Array.isArray(value)) {
|
|
2128
|
+
if (value.length === 0) return "[]";
|
|
2129
|
+
if (maximumDepth < stack.length + 1) return "\"[Array]\"";
|
|
2130
|
+
stack.push(value);
|
|
2131
|
+
indentation += spacer;
|
|
2132
|
+
let res = `\n${indentation}`;
|
|
2133
|
+
const join = `,\n${indentation}`;
|
|
2134
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
2135
|
+
let i = 0;
|
|
2136
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
2137
|
+
const item = value[i];
|
|
2138
|
+
const tmp = typeof item === "object" ? stringifyIndent(i, item, stack, spacer, indentation) : stringifyPrimitive(item);
|
|
2139
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2140
|
+
res += join;
|
|
2141
|
+
}
|
|
2142
|
+
const item = value[i];
|
|
2143
|
+
const tmp = typeof item === "object" ? stringifyIndent(i, item, stack, spacer, indentation) : stringifyPrimitive(item);
|
|
2144
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2145
|
+
if (value.length > maximumBreadth) {
|
|
2146
|
+
const removedKeys = value.length - maximumBreadth;
|
|
2147
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
2148
|
+
}
|
|
2149
|
+
res += `\n${originalIndentation}`;
|
|
2150
|
+
stack.pop();
|
|
2151
|
+
return `[${res}]`;
|
|
2152
|
+
}
|
|
2153
|
+
let keys = Object.keys(value);
|
|
2154
|
+
const keyLength = keys.length;
|
|
2155
|
+
if (keyLength === 0) return "{}";
|
|
2156
|
+
if (maximumDepth < stack.length + 1) return "\"[Object]\"";
|
|
2157
|
+
indentation += spacer;
|
|
2158
|
+
const join = `,\n${indentation}`;
|
|
2159
|
+
let res = "";
|
|
2160
|
+
let separator = "";
|
|
2161
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
2162
|
+
const typedArrayType = getTypedArrayType(value);
|
|
2163
|
+
if (typedArrayType !== void 0) {
|
|
2164
|
+
res += stringifyTypedArray(value, join, maximumBreadth, bigint, fail, typedArrayType);
|
|
2165
|
+
keys = keys.slice(
|
|
2166
|
+
/** @type {{length: number}} */
|
|
2167
|
+
value.length
|
|
2168
|
+
);
|
|
2169
|
+
maximumPropertiesToStringify -= value.length;
|
|
2170
|
+
separator = join;
|
|
2171
|
+
}
|
|
2172
|
+
if (deterministic) keys = sort(keys, comparator);
|
|
2173
|
+
stack.push(value);
|
|
2174
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
2175
|
+
const key = keys[i];
|
|
2176
|
+
const item = value[key];
|
|
2177
|
+
const tmp = typeof item === "object" ? stringifyIndent(key, item, stack, spacer, indentation) : stringifyPrimitive(item);
|
|
2178
|
+
if (tmp !== void 0) {
|
|
2179
|
+
res += `${separator}${strEscape(key)}: ${tmp}`;
|
|
2180
|
+
separator = join;
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
if (keyLength > maximumBreadth) {
|
|
2184
|
+
const removedKeys = keyLength - maximumBreadth;
|
|
2185
|
+
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
2186
|
+
separator = join;
|
|
2187
|
+
}
|
|
2188
|
+
if (separator !== "") res = `\n${indentation}${res}\n${originalIndentation}`;
|
|
2189
|
+
stack.pop();
|
|
2190
|
+
return `{${res}}`;
|
|
2191
|
+
};
|
|
2192
|
+
let stringifyPrimitive = function(value) {
|
|
2193
|
+
switch (typeof value) {
|
|
2194
|
+
case "string": return strEscape(value);
|
|
2195
|
+
case "number": return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
|
2196
|
+
case "boolean": return value === true ? "true" : "false";
|
|
2197
|
+
case "undefined": return;
|
|
2198
|
+
case "bigint": if (bigint) return bigint === "string" ? `"${value}"` : String(value);
|
|
2199
|
+
default: return fail ? fail(value) : void 0;
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
let stringifyObject = function(key, value, stack) {
|
|
2203
|
+
if (value === null) return "null";
|
|
2204
|
+
if (typeof value.toJSON === "function") {
|
|
2205
|
+
if (typeof key === "number") key = String(key);
|
|
2206
|
+
const jsonValue = safe ? callSafe(
|
|
2207
|
+
/** @type {ToJSON} */
|
|
2208
|
+
value.toJSON,
|
|
2209
|
+
value,
|
|
2210
|
+
key
|
|
2211
|
+
) : /** @type {ToJSON} */ value.toJSON(key);
|
|
2212
|
+
if (typeof jsonValue !== "object") return stringifyPrimitive(jsonValue);
|
|
2213
|
+
if (jsonValue === null) return "null";
|
|
2214
|
+
value = jsonValue;
|
|
2215
|
+
}
|
|
2216
|
+
const circularIndex = stack.indexOf(value);
|
|
2217
|
+
if (circularIndex !== -1) return typeof circularValue === "function" ? circularValue(circularIndex) : circularValue;
|
|
2218
|
+
let res = "";
|
|
2219
|
+
const hasLength = value.length !== void 0;
|
|
2220
|
+
if (hasLength && Array.isArray(value)) {
|
|
2221
|
+
if (value.length === 0) return "[]";
|
|
2222
|
+
if (maximumDepth < stack.length + 1) return "\"[Array]\"";
|
|
2223
|
+
stack.push(value);
|
|
2224
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
2225
|
+
let i = 0;
|
|
2226
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
2227
|
+
const item = value[i];
|
|
2228
|
+
const tmp = typeof item === "object" ? stringifyObject(i, item, stack) : stringifyPrimitive(item);
|
|
2229
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2230
|
+
res += ",";
|
|
2231
|
+
}
|
|
2232
|
+
const item = value[i];
|
|
2233
|
+
const tmp = typeof item === "object" ? stringifyObject(i, item, stack) : stringifyPrimitive(item);
|
|
2234
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2235
|
+
if (value.length > maximumBreadth) {
|
|
2236
|
+
const removedKeys = value.length - maximumBreadth;
|
|
2237
|
+
res += `,"... ${getItemCount(removedKeys)} not stringified"`;
|
|
2238
|
+
}
|
|
2239
|
+
stack.pop();
|
|
2240
|
+
return `[${res}]`;
|
|
2241
|
+
}
|
|
2242
|
+
let keys = Object.keys(value);
|
|
2243
|
+
const keyLength = keys.length;
|
|
2244
|
+
if (keyLength === 0) return "{}";
|
|
2245
|
+
if (maximumDepth < stack.length + 1) return "\"[Object]\"";
|
|
2246
|
+
let separator = "";
|
|
2247
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
2248
|
+
const typedArrayType = hasLength ? getTypedArrayType(value) : void 0;
|
|
2249
|
+
if (typedArrayType !== void 0) {
|
|
2250
|
+
res += stringifyTypedArray(value, ",", maximumBreadth, bigint, fail, typedArrayType);
|
|
2251
|
+
keys = keys.slice(
|
|
2252
|
+
/** @type {{length: number}} */
|
|
2253
|
+
value.length
|
|
2254
|
+
);
|
|
2255
|
+
maximumPropertiesToStringify -= value.length;
|
|
2256
|
+
separator = ",";
|
|
2257
|
+
}
|
|
2258
|
+
if (deterministic) keys = sort(keys, comparator);
|
|
2259
|
+
stack.push(value);
|
|
2260
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
2261
|
+
const key = keys[i];
|
|
2262
|
+
const item = value[key];
|
|
2263
|
+
const tmp = typeof item === "object" ? stringifyObject(key, item, stack) : stringifyPrimitive(item);
|
|
2264
|
+
if (tmp !== void 0) {
|
|
2265
|
+
res += `${separator}${strEscape(key)}:${tmp}`;
|
|
2266
|
+
separator = ",";
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
if (keyLength > maximumBreadth) {
|
|
2270
|
+
const removedKeys = keyLength - maximumBreadth;
|
|
2271
|
+
res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`;
|
|
2272
|
+
}
|
|
2273
|
+
stack.pop();
|
|
2274
|
+
return `{${res}}`;
|
|
2275
|
+
};
|
|
2276
|
+
const stringifyFnPrimitive = stringifyPrimitive;
|
|
2277
|
+
if (safe) {
|
|
2278
|
+
stringifyFnReplacer = makeSafe(stringifyFnReplacer);
|
|
2279
|
+
stringifyArrayReplacer = makeSafe(stringifyArrayReplacer);
|
|
2280
|
+
stringifyIndent = makeSafe(stringifyIndent);
|
|
2281
|
+
stringifyObject = makeSafe(stringifyObject);
|
|
2282
|
+
stringifyPrimitive = makeSafe(stringifyPrimitive);
|
|
2283
|
+
}
|
|
2284
|
+
function stringify(value, replacer, space) {
|
|
2285
|
+
if (arguments.length > 1) {
|
|
2286
|
+
let spacer = "";
|
|
2287
|
+
if (typeof space === "number") spacer = " ".repeat(Math.max(0, Math.min(space, 10)));
|
|
2288
|
+
else if (typeof space === "string") spacer = space.slice(0, 10);
|
|
2289
|
+
if (replacer != null) {
|
|
2290
|
+
if (typeof replacer === "function") {
|
|
2291
|
+
if (safe) replacer = makeSafe(replacer, replacer.name);
|
|
2292
|
+
return stringifyFnReplacer("", { "": value }, [], replacer, spacer, "");
|
|
2293
|
+
}
|
|
2294
|
+
if (Array.isArray(replacer)) return typeof value === "object" ? stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, "") : stringifyPrimitive(value);
|
|
2295
|
+
}
|
|
2296
|
+
if (spacer.length !== 0) return typeof value === "object" ? stringifyIndent("", value, [], spacer, "") : stringifyPrimitive(value);
|
|
2297
|
+
}
|
|
2298
|
+
return typeof value === "object" ? stringifyObject("", value, []) : stringifyPrimitive(value);
|
|
2299
|
+
}
|
|
2300
|
+
return stringify;
|
|
2301
|
+
}
|
|
2302
|
+
const sharedGlobal$1 = globalThis;
|
|
2303
|
+
const exportSymbol = Symbol.for("safe-stable-stringify@3.0.0");
|
|
2304
|
+
if (sharedGlobal$1[exportSymbol] === void 0) {
|
|
2305
|
+
const stringify = configure$1();
|
|
2306
|
+
stringify.configure = configure$1;
|
|
2307
|
+
stringify.stringify = stringify;
|
|
2308
|
+
stringify.default = stringify;
|
|
2309
|
+
Object.defineProperty(sharedGlobal$1, exportSymbol, {
|
|
2310
|
+
configurable: true,
|
|
2311
|
+
enumerable: false,
|
|
2312
|
+
value: stringify,
|
|
2313
|
+
writable: true
|
|
2314
|
+
});
|
|
2315
|
+
}
|
|
2316
|
+
const stringify = globalThis[Symbol.for("safe-stable-stringify@3.0.0")];
|
|
2317
|
+
stringify.configure;
|
|
2318
|
+
//#endregion
|
|
2319
|
+
//#region src/actions/messages/receiveFromQueue.ts
|
|
2320
|
+
const receiveMessagesFromQueue = (0, _prismatic_io_spectral.action)({
|
|
2321
|
+
display: {
|
|
2322
|
+
label: "Receive Messages from Queue",
|
|
2323
|
+
description: "Receive messages from a queue. Receive messages from a queue will remove the message from the queue."
|
|
2324
|
+
},
|
|
2325
|
+
examplePayload: receiveMessagesFromQueueExamplePayload,
|
|
2326
|
+
perform: async (context, { connection, queueName, amountOfMessages, namespaceName, maxTimeToWait, returnFullMessages, peek }) => {
|
|
2327
|
+
const client = azureServiceBusClientLibrary(connection, namespaceName);
|
|
2328
|
+
const queueReceiver = client.createReceiver(queueName);
|
|
2329
|
+
const allMessages = [];
|
|
2330
|
+
try {
|
|
2331
|
+
const messages = peek ? await queueReceiver.peekMessages(amountOfMessages) : await queueReceiver.receiveMessages(amountOfMessages, { maxWaitTimeInMs: maxTimeToWait * 1e3 });
|
|
2332
|
+
for (const message of messages) {
|
|
2333
|
+
allMessages.push(returnFullMessages ? JSON.parse(stringify(message)) : message.body);
|
|
2334
|
+
if (!peek) await queueReceiver.completeMessage(message);
|
|
2335
|
+
}
|
|
2336
|
+
await queueReceiver.close();
|
|
2337
|
+
} finally {
|
|
2338
|
+
await client.close();
|
|
2339
|
+
}
|
|
2340
|
+
return { data: allMessages };
|
|
2341
|
+
},
|
|
2342
|
+
inputs: {
|
|
2343
|
+
connection,
|
|
2344
|
+
subscriptionId: {
|
|
2345
|
+
...subscriptionId$6,
|
|
2346
|
+
required: false
|
|
2347
|
+
},
|
|
2348
|
+
resourceGroupName: {
|
|
2349
|
+
...resourceGroupName$5,
|
|
2350
|
+
required: false
|
|
2351
|
+
},
|
|
2352
|
+
namespaceName: namespaceName$4,
|
|
2353
|
+
queueName,
|
|
2354
|
+
amountOfMessages,
|
|
2355
|
+
maxTimeToWait,
|
|
2356
|
+
returnFullMessages: (0, _prismatic_io_spectral.input)({
|
|
2357
|
+
label: "Return Full Messages",
|
|
2358
|
+
type: "boolean",
|
|
2359
|
+
required: false,
|
|
2360
|
+
default: "false",
|
|
2361
|
+
comments: "If true, the full message objects will be returned including message ID, sequence number, delivery metadata, etc. If false, only the messages bodies will be returned.",
|
|
2362
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
2363
|
+
}),
|
|
2364
|
+
peek: (0, _prismatic_io_spectral.input)({
|
|
2365
|
+
label: "Peek",
|
|
2366
|
+
type: "boolean",
|
|
2367
|
+
required: false,
|
|
2368
|
+
default: "false",
|
|
2369
|
+
comments: "If true, the messages will be peeked from the queue, which doesn't alter the visibility of the message. If false, the messages will be received from the queue. https://learn.microsoft.com/en-us/rest/api/storageservices/peek-messages",
|
|
2370
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
2371
|
+
})
|
|
2372
|
+
}
|
|
2373
|
+
});
|
|
2374
|
+
//#endregion
|
|
2375
|
+
//#region src/actions/messages/index.ts
|
|
2376
|
+
var messages_default = {
|
|
2377
|
+
sendMessagesToQueue: (0, _prismatic_io_spectral.action)({
|
|
2378
|
+
display: {
|
|
2379
|
+
label: "Send Multiple Messages to Queue",
|
|
2380
|
+
description: "Send multiple plain text messages to a queue."
|
|
2381
|
+
},
|
|
2382
|
+
examplePayload: sendMessagesToQueueExamplePayload,
|
|
2383
|
+
perform: async (context, { connection, messages, queueName, namespaceName }) => {
|
|
2384
|
+
const sender = azureServiceBusClientLibrary(connection, namespaceName).createSender(queueName);
|
|
2385
|
+
const mappedMessages = messages.map((message) => ({ body: message }));
|
|
2386
|
+
await sender.sendMessages(mappedMessages);
|
|
2387
|
+
return { data: mappedMessages };
|
|
2388
|
+
},
|
|
2389
|
+
inputs: {
|
|
2390
|
+
connection,
|
|
2391
|
+
subscriptionId: {
|
|
2392
|
+
...subscriptionId$6,
|
|
2393
|
+
required: false
|
|
2394
|
+
},
|
|
2395
|
+
resourceGroupName: {
|
|
2396
|
+
...resourceGroupName$5,
|
|
2397
|
+
required: false
|
|
2398
|
+
},
|
|
2399
|
+
namespaceName: namespaceName$4,
|
|
2400
|
+
queueName,
|
|
2401
|
+
messages
|
|
2402
|
+
}
|
|
2403
|
+
}),
|
|
2404
|
+
sendMessageToQueue: (0, _prismatic_io_spectral.action)({
|
|
2405
|
+
display: {
|
|
2406
|
+
label: "Send Message to Queue",
|
|
2407
|
+
description: "Send a single message to a queue."
|
|
2408
|
+
},
|
|
2409
|
+
examplePayload: sendMessageToQueueExamplePayload,
|
|
2410
|
+
perform: async (context, params) => {
|
|
2411
|
+
const sender = azureServiceBusClientLibrary(params.connection, params.namespaceName).createSender(params.queueName);
|
|
2412
|
+
const message = {
|
|
2413
|
+
body: params.body,
|
|
2414
|
+
contentType: params.contentType,
|
|
2415
|
+
messageId: params.messageId,
|
|
2416
|
+
partitionKey: params.partitionKey,
|
|
2417
|
+
replyTo: params.replyTo,
|
|
2418
|
+
scheduledEnqueueTimeUtc: params.scheduledEnqueueTimeUtc,
|
|
2419
|
+
subject: params.subject,
|
|
2420
|
+
to: params.to
|
|
2421
|
+
};
|
|
2422
|
+
await sender.sendMessages(message);
|
|
2423
|
+
return { data: message };
|
|
2424
|
+
},
|
|
2425
|
+
inputs: {
|
|
2426
|
+
connection,
|
|
2427
|
+
subscriptionId: {
|
|
2428
|
+
...subscriptionId$6,
|
|
2429
|
+
required: false
|
|
2430
|
+
},
|
|
2431
|
+
resourceGroupName: {
|
|
2432
|
+
...resourceGroupName$5,
|
|
2433
|
+
required: false
|
|
2434
|
+
},
|
|
2435
|
+
namespaceName: namespaceName$4,
|
|
2436
|
+
queueName,
|
|
2437
|
+
body: (0, _prismatic_io_spectral.input)({
|
|
2438
|
+
label: "Body",
|
|
2439
|
+
type: "string",
|
|
2440
|
+
required: true,
|
|
2441
|
+
comments: "The body of the message."
|
|
2442
|
+
}),
|
|
2443
|
+
contentType: (0, _prismatic_io_spectral.input)({
|
|
2444
|
+
label: "Content Type",
|
|
2445
|
+
type: "string",
|
|
2446
|
+
comments: "The content type of the message.",
|
|
2447
|
+
example: "application/json",
|
|
2448
|
+
required: false,
|
|
2449
|
+
clean: (val) => _prismatic_io_spectral.util.types.toString(val) || void 0
|
|
2450
|
+
}),
|
|
2451
|
+
messageId: (0, _prismatic_io_spectral.input)({
|
|
2452
|
+
label: "Message ID",
|
|
2453
|
+
type: "string",
|
|
2454
|
+
comments: "An optional unique ID of the message to be used for deduplication. If omitted, a unique ID will be generated by Microsoft.",
|
|
2455
|
+
required: false,
|
|
2456
|
+
clean: (val) => _prismatic_io_spectral.util.types.toString(val) || void 0
|
|
2457
|
+
}),
|
|
2458
|
+
partitionKey: (0, _prismatic_io_spectral.input)({
|
|
2459
|
+
label: "Partition Key",
|
|
2460
|
+
type: "string",
|
|
2461
|
+
comments: "An optional partition key https://learn.microsoft.com/en-us/dotnet/api/azure.messaging.servicebus.servicebusmessage.partitionkey",
|
|
2462
|
+
required: false,
|
|
2463
|
+
clean: (val) => _prismatic_io_spectral.util.types.toString(val) || void 0
|
|
2464
|
+
}),
|
|
2465
|
+
replyTo: (0, _prismatic_io_spectral.input)({
|
|
2466
|
+
label: "Reply To",
|
|
2467
|
+
type: "string",
|
|
2468
|
+
comments: "An optional address that the receiver can use to reply to the message. https://learn.microsoft.com/en-us/dotnet/api/azure.messaging.servicebus.servicebusmessage.replyto",
|
|
2469
|
+
required: false,
|
|
2470
|
+
clean: (val) => _prismatic_io_spectral.util.types.toString(val) || void 0
|
|
2471
|
+
}),
|
|
2472
|
+
scheduledEnqueueTimeUtc: (0, _prismatic_io_spectral.input)({
|
|
2473
|
+
label: "Scheduled Enqueue Time UTC",
|
|
2474
|
+
type: "string",
|
|
2475
|
+
comments: "An optional time at which the message should be enqueued. If omitted, the message will be enqueued immediately.",
|
|
2476
|
+
required: false,
|
|
2477
|
+
clean: (val) => val ? _prismatic_io_spectral.util.types.toDate(val) : void 0
|
|
2478
|
+
}),
|
|
2479
|
+
subject: (0, _prismatic_io_spectral.input)({
|
|
2480
|
+
label: "Subject",
|
|
2481
|
+
type: "string",
|
|
2482
|
+
comments: "An optional subject for the message.",
|
|
2483
|
+
required: false,
|
|
2484
|
+
clean: (val) => _prismatic_io_spectral.util.types.toString(val) || void 0
|
|
2485
|
+
}),
|
|
2486
|
+
to: (0, _prismatic_io_spectral.input)({
|
|
2487
|
+
label: "To",
|
|
2488
|
+
type: "string",
|
|
2489
|
+
comments: "An optional address that specifies the intended recipient of the message. https://learn.microsoft.com/en-us/dotnet/api/azure.messaging.servicebus.servicebusmessage.to",
|
|
2490
|
+
required: false,
|
|
2491
|
+
clean: (val) => _prismatic_io_spectral.util.types.toString(val) || void 0
|
|
2492
|
+
})
|
|
2493
|
+
}
|
|
2494
|
+
}),
|
|
2495
|
+
receiveMessagesFromQueue
|
|
2496
|
+
};
|
|
2497
|
+
//#endregion
|
|
2498
|
+
//#region src/actions/rawRequest.ts
|
|
2499
|
+
const { debugRequest: _, ...rawRequestInputs } = _prismatic_io_spectral_http.inputs;
|
|
2500
|
+
//#endregion
|
|
2501
|
+
//#region src/actions/index.ts
|
|
2502
|
+
var actions_default = {
|
|
2503
|
+
createOrUpdateNamespaces,
|
|
2504
|
+
createOrUpdateQueue,
|
|
2505
|
+
createOrUpdateRules,
|
|
2506
|
+
createOrUpdateSubscription,
|
|
2507
|
+
createOrUpdateTopic,
|
|
2508
|
+
deleteNamespace,
|
|
2509
|
+
deleteQueue,
|
|
2510
|
+
deleteRule,
|
|
2511
|
+
deleteSubscriptions,
|
|
2512
|
+
deleteTopic,
|
|
2513
|
+
getNamespaces,
|
|
2514
|
+
getQueue,
|
|
2515
|
+
getRule,
|
|
2516
|
+
getSubscriptions,
|
|
2517
|
+
getTopic,
|
|
2518
|
+
listNamespaces,
|
|
2519
|
+
listNamespacesByResourceGroup,
|
|
2520
|
+
listQueues,
|
|
2521
|
+
listRules,
|
|
2522
|
+
listSubscriptions,
|
|
2523
|
+
listSubscriptionsByTopic,
|
|
2524
|
+
listTopicsByNamespace,
|
|
2525
|
+
rawRequest: (0, _prismatic_io_spectral.action)({
|
|
2526
|
+
display: {
|
|
2527
|
+
label: "Raw Request",
|
|
2528
|
+
description: "Send raw HTTP request to Azure Service Bus"
|
|
2529
|
+
},
|
|
2530
|
+
perform: async (context, { connection, ...rawRequestInputs }) => {
|
|
2531
|
+
const baseUrl = "https://management.azure.com/subscriptions";
|
|
2532
|
+
const headers = { Authorization: `Bearer ${connection?.token?.access_token}` };
|
|
2533
|
+
try {
|
|
2534
|
+
const { data } = await (0, _prismatic_io_spectral_http.sendRawRequest)(baseUrl, {
|
|
2535
|
+
...rawRequestInputs,
|
|
2536
|
+
debugRequest: context.debug.enabled
|
|
2537
|
+
}, headers);
|
|
2538
|
+
return { data };
|
|
2539
|
+
} catch (error) {
|
|
2540
|
+
const handled = (0, _prismatic_io_spectral_http.handleErrors)(error);
|
|
2541
|
+
const serialized = _prismatic_io_spectral.util.types.toJSON(handled);
|
|
2542
|
+
throw new Error(serialized);
|
|
2543
|
+
}
|
|
2544
|
+
},
|
|
2545
|
+
inputs: {
|
|
2546
|
+
connection,
|
|
2547
|
+
...rawRequestInputs,
|
|
2548
|
+
url: {
|
|
2549
|
+
...rawRequestInputs.url,
|
|
2550
|
+
comments: "Input the path only (/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces?api-version=2021-11-01), The base URL is already included (https://management.azure.com/subscriptions). For example, to connect to https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces?api-version=2021-11-01, only /{subscriptionId}/providers/Microsoft.ServiceBus/namespaces?api-version=2021-11-01 is entered in this field.",
|
|
2551
|
+
example: "/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces?api-version=2021-11-01"
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
}),
|
|
2555
|
+
...messages_default
|
|
2556
|
+
};
|
|
2557
|
+
//#endregion
|
|
2558
|
+
//#region src/dataSources/helpers.ts
|
|
2559
|
+
const toSortedPicklist = (items, mapper) => items.map(mapper).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1);
|
|
2560
|
+
//#endregion
|
|
2561
|
+
//#region src/dataSources/selectNamespace.ts
|
|
2562
|
+
const subscriptionId$5 = (0, _prismatic_io_spectral.input)({
|
|
2563
|
+
label: "Subscription ID",
|
|
2564
|
+
comments: "The Azure subscription ID.",
|
|
2565
|
+
type: "string",
|
|
2566
|
+
required: true,
|
|
2567
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2568
|
+
});
|
|
2569
|
+
const selectNamespace = (0, _prismatic_io_spectral.dataSource)({
|
|
2570
|
+
display: {
|
|
2571
|
+
label: "Select Namespace",
|
|
2572
|
+
description: "A picklist of Service Bus namespaces within a subscription."
|
|
2573
|
+
},
|
|
2574
|
+
inputs: {
|
|
2575
|
+
connection,
|
|
2576
|
+
subscriptionId: subscriptionId$5
|
|
2577
|
+
},
|
|
2578
|
+
perform: async (_context, { connection, subscriptionId }) => {
|
|
2579
|
+
const { data } = await getAzureServiceBusClient(connection, false).get(`/${subscriptionId}/providers/Microsoft.ServiceBus/namespaces?api-version=2021-11-01`);
|
|
2580
|
+
return { result: toSortedPicklist(data.value ?? [], (item) => ({
|
|
2581
|
+
key: item.name,
|
|
2582
|
+
label: item.name
|
|
2583
|
+
})) };
|
|
2584
|
+
},
|
|
2585
|
+
dataSourceType: "picklist",
|
|
2586
|
+
examplePayload: { result: [{
|
|
2587
|
+
label: "my-namespace",
|
|
2588
|
+
key: "my-namespace"
|
|
2589
|
+
}] }
|
|
2590
|
+
});
|
|
2591
|
+
//#endregion
|
|
2592
|
+
//#region src/dataSources/selectNamespaceByResourceGroup.ts
|
|
2593
|
+
const subscriptionId$4 = (0, _prismatic_io_spectral.input)({
|
|
2594
|
+
label: "Subscription ID",
|
|
2595
|
+
comments: "The Azure subscription ID.",
|
|
2596
|
+
type: "string",
|
|
2597
|
+
required: true,
|
|
2598
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2599
|
+
});
|
|
2600
|
+
const resourceGroupName$4 = (0, _prismatic_io_spectral.input)({
|
|
2601
|
+
label: "Resource Group Name",
|
|
2602
|
+
comments: "Name of the Resource group within the Azure subscription.",
|
|
2603
|
+
type: "string",
|
|
2604
|
+
required: true,
|
|
2605
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2606
|
+
});
|
|
2607
|
+
const selectNamespaceByResourceGroup = (0, _prismatic_io_spectral.dataSource)({
|
|
2608
|
+
display: {
|
|
2609
|
+
label: "Select Namespace by Resource Group",
|
|
2610
|
+
description: "A picklist of Service Bus namespaces within a resource group."
|
|
2611
|
+
},
|
|
2612
|
+
inputs: {
|
|
2613
|
+
connection,
|
|
2614
|
+
subscriptionId: subscriptionId$4,
|
|
2615
|
+
resourceGroupName: resourceGroupName$4
|
|
2616
|
+
},
|
|
2617
|
+
perform: async (_context, { connection, subscriptionId, resourceGroupName }) => {
|
|
2618
|
+
const { data } = await getAzureServiceBusClient(connection, false).get(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces?api-version=2021-11-01`);
|
|
2619
|
+
return { result: toSortedPicklist(data.value ?? [], (item) => ({
|
|
2620
|
+
key: item.name,
|
|
2621
|
+
label: item.name
|
|
2622
|
+
})) };
|
|
2623
|
+
},
|
|
2624
|
+
dataSourceType: "picklist",
|
|
2625
|
+
examplePayload: { result: [{
|
|
2626
|
+
label: "my-namespace",
|
|
2627
|
+
key: "my-namespace"
|
|
2628
|
+
}] }
|
|
2629
|
+
});
|
|
2630
|
+
//#endregion
|
|
2631
|
+
//#region src/dataSources/selectQueue.ts
|
|
2632
|
+
const subscriptionId$3 = (0, _prismatic_io_spectral.input)({
|
|
2633
|
+
label: "Subscription ID",
|
|
2634
|
+
comments: "The Azure subscription ID.",
|
|
2635
|
+
type: "string",
|
|
2636
|
+
required: true,
|
|
2637
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2638
|
+
});
|
|
2639
|
+
const resourceGroupName$3 = (0, _prismatic_io_spectral.input)({
|
|
2640
|
+
label: "Resource Group Name",
|
|
2641
|
+
comments: "Name of the Resource group within the Azure subscription.",
|
|
2642
|
+
type: "string",
|
|
2643
|
+
required: true,
|
|
2644
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2645
|
+
});
|
|
2646
|
+
const namespaceName$3 = (0, _prismatic_io_spectral.input)({
|
|
2647
|
+
label: "Namespace Name",
|
|
2648
|
+
comments: "The namespace name.",
|
|
2649
|
+
type: "string",
|
|
2650
|
+
required: true,
|
|
2651
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2652
|
+
});
|
|
2653
|
+
const selectQueue = (0, _prismatic_io_spectral.dataSource)({
|
|
2654
|
+
display: {
|
|
2655
|
+
label: "Select Queue",
|
|
2656
|
+
description: "A picklist of queues within a namespace."
|
|
2657
|
+
},
|
|
2658
|
+
inputs: {
|
|
2659
|
+
connection,
|
|
2660
|
+
subscriptionId: subscriptionId$3,
|
|
2661
|
+
resourceGroupName: resourceGroupName$3,
|
|
2662
|
+
namespaceName: namespaceName$3
|
|
2663
|
+
},
|
|
2664
|
+
perform: async (_context, { connection, subscriptionId, resourceGroupName, namespaceName }) => {
|
|
2665
|
+
const { data } = await getAzureServiceBusClient(connection, false).get(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/queues?api-version=2021-11-01`);
|
|
2666
|
+
return { result: toSortedPicklist(data.value ?? [], (item) => ({
|
|
2667
|
+
key: item.name,
|
|
2668
|
+
label: item.name
|
|
2669
|
+
})) };
|
|
2670
|
+
},
|
|
2671
|
+
dataSourceType: "picklist",
|
|
2672
|
+
examplePayload: { result: [{
|
|
2673
|
+
label: "my-queue",
|
|
2674
|
+
key: "my-queue"
|
|
2675
|
+
}] }
|
|
2676
|
+
});
|
|
2677
|
+
//#endregion
|
|
2678
|
+
//#region src/dataSources/selectRule.ts
|
|
2679
|
+
const subscriptionId$2 = (0, _prismatic_io_spectral.input)({
|
|
2680
|
+
label: "Subscription ID",
|
|
2681
|
+
comments: "The Azure subscription ID.",
|
|
2682
|
+
type: "string",
|
|
2683
|
+
required: true,
|
|
2684
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2685
|
+
});
|
|
2686
|
+
const resourceGroupName$2 = (0, _prismatic_io_spectral.input)({
|
|
2687
|
+
label: "Resource Group Name",
|
|
2688
|
+
comments: "Name of the Resource group within the Azure subscription.",
|
|
2689
|
+
type: "string",
|
|
2690
|
+
required: true,
|
|
2691
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2692
|
+
});
|
|
2693
|
+
const namespaceName$2 = (0, _prismatic_io_spectral.input)({
|
|
2694
|
+
label: "Namespace Name",
|
|
2695
|
+
comments: "The namespace name.",
|
|
2696
|
+
type: "string",
|
|
2697
|
+
required: true,
|
|
2698
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2699
|
+
});
|
|
2700
|
+
const topicName$1 = (0, _prismatic_io_spectral.input)({
|
|
2701
|
+
label: "Topic Name",
|
|
2702
|
+
comments: "The topic name.",
|
|
2703
|
+
type: "string",
|
|
2704
|
+
required: true,
|
|
2705
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2706
|
+
});
|
|
2707
|
+
const subscriptionName = (0, _prismatic_io_spectral.input)({
|
|
2708
|
+
label: "Subscription Name",
|
|
2709
|
+
comments: "The subscription name.",
|
|
2710
|
+
type: "string",
|
|
2711
|
+
required: true,
|
|
2712
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2713
|
+
});
|
|
2714
|
+
const selectRule = (0, _prismatic_io_spectral.dataSource)({
|
|
2715
|
+
display: {
|
|
2716
|
+
label: "Select Rule",
|
|
2717
|
+
description: "A picklist of rules within a topic subscription."
|
|
2718
|
+
},
|
|
2719
|
+
inputs: {
|
|
2720
|
+
connection,
|
|
2721
|
+
subscriptionId: subscriptionId$2,
|
|
2722
|
+
resourceGroupName: resourceGroupName$2,
|
|
2723
|
+
namespaceName: namespaceName$2,
|
|
2724
|
+
topicName: topicName$1,
|
|
2725
|
+
subscriptionName
|
|
2726
|
+
},
|
|
2727
|
+
perform: async (_context, { connection, subscriptionId, resourceGroupName, namespaceName, topicName, subscriptionName }) => {
|
|
2728
|
+
const { data } = await getAzureServiceBusClient(connection, false).get(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}/subscriptions/${subscriptionName}/rules?api-version=2021-11-01`);
|
|
2729
|
+
return { result: toSortedPicklist(data.value ?? [], (item) => ({
|
|
2730
|
+
key: item.name,
|
|
2731
|
+
label: item.name
|
|
2732
|
+
})) };
|
|
2733
|
+
},
|
|
2734
|
+
dataSourceType: "picklist",
|
|
2735
|
+
examplePayload: { result: [{
|
|
2736
|
+
label: "my-rule",
|
|
2737
|
+
key: "my-rule"
|
|
2738
|
+
}] }
|
|
2739
|
+
});
|
|
2740
|
+
//#endregion
|
|
2741
|
+
//#region src/dataSources/selectSubscription.ts
|
|
2742
|
+
const selectSubscription = (0, _prismatic_io_spectral.dataSource)({
|
|
2743
|
+
display: {
|
|
2744
|
+
label: "Select Subscription",
|
|
2745
|
+
description: "A picklist of Azure subscriptions."
|
|
2746
|
+
},
|
|
2747
|
+
inputs: { connection },
|
|
2748
|
+
perform: async (_context, { connection }) => {
|
|
2749
|
+
const { data } = await getAzureServiceBusClient(connection, false).get("?api-version=2022-12-01");
|
|
2750
|
+
return { result: toSortedPicklist(data.value ?? [], (item) => ({
|
|
2751
|
+
key: item.subscriptionId,
|
|
2752
|
+
label: item.displayName
|
|
2753
|
+
})) };
|
|
2754
|
+
},
|
|
2755
|
+
dataSourceType: "picklist",
|
|
2756
|
+
examplePayload: { result: [{
|
|
2757
|
+
label: "My Subscription",
|
|
2758
|
+
key: "00000000-0000-0000-0000-000000000000"
|
|
2759
|
+
}] }
|
|
2760
|
+
});
|
|
2761
|
+
//#endregion
|
|
2762
|
+
//#region src/dataSources/selectSubscriptionByTopic.ts
|
|
2763
|
+
const subscriptionId$1 = (0, _prismatic_io_spectral.input)({
|
|
2764
|
+
label: "Subscription ID",
|
|
2765
|
+
comments: "The Azure subscription ID.",
|
|
2766
|
+
type: "string",
|
|
2767
|
+
required: true,
|
|
2768
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2769
|
+
});
|
|
2770
|
+
const resourceGroupName$1 = (0, _prismatic_io_spectral.input)({
|
|
2771
|
+
label: "Resource Group Name",
|
|
2772
|
+
comments: "Name of the Resource group within the Azure subscription.",
|
|
2773
|
+
type: "string",
|
|
2774
|
+
required: true,
|
|
2775
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2776
|
+
});
|
|
2777
|
+
const namespaceName$1 = (0, _prismatic_io_spectral.input)({
|
|
2778
|
+
label: "Namespace Name",
|
|
2779
|
+
comments: "The namespace name.",
|
|
2780
|
+
type: "string",
|
|
2781
|
+
required: true,
|
|
2782
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2783
|
+
});
|
|
2784
|
+
const topicName = (0, _prismatic_io_spectral.input)({
|
|
2785
|
+
label: "Topic Name",
|
|
2786
|
+
comments: "The topic name.",
|
|
2787
|
+
type: "string",
|
|
2788
|
+
required: true,
|
|
2789
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2790
|
+
});
|
|
2791
|
+
const selectSubscriptionByTopic = (0, _prismatic_io_spectral.dataSource)({
|
|
2792
|
+
display: {
|
|
2793
|
+
label: "Select Subscription by Topic",
|
|
2794
|
+
description: "A picklist of subscriptions under a specified topic."
|
|
2795
|
+
},
|
|
2796
|
+
inputs: {
|
|
2797
|
+
connection,
|
|
2798
|
+
subscriptionId: subscriptionId$1,
|
|
2799
|
+
resourceGroupName: resourceGroupName$1,
|
|
2800
|
+
namespaceName: namespaceName$1,
|
|
2801
|
+
topicName
|
|
2802
|
+
},
|
|
2803
|
+
perform: async (_context, { connection, subscriptionId, resourceGroupName, namespaceName, topicName }) => {
|
|
2804
|
+
const { data } = await getAzureServiceBusClient(connection, false).get(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics/${topicName}/subscriptions?api-version=2021-11-01`);
|
|
2805
|
+
return { result: toSortedPicklist(data.value ?? [], (item) => ({
|
|
2806
|
+
key: item.name,
|
|
2807
|
+
label: item.name
|
|
2808
|
+
})) };
|
|
2809
|
+
},
|
|
2810
|
+
dataSourceType: "picklist",
|
|
2811
|
+
examplePayload: { result: [{
|
|
2812
|
+
label: "my-subscription",
|
|
2813
|
+
key: "my-subscription"
|
|
2814
|
+
}] }
|
|
2815
|
+
});
|
|
2816
|
+
//#endregion
|
|
2817
|
+
//#region src/dataSources/selectTopic.ts
|
|
2818
|
+
const subscriptionId = (0, _prismatic_io_spectral.input)({
|
|
2819
|
+
label: "Subscription ID",
|
|
2820
|
+
comments: "The Azure subscription ID.",
|
|
2821
|
+
type: "string",
|
|
2822
|
+
required: true,
|
|
2823
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2824
|
+
});
|
|
2825
|
+
const resourceGroupName = (0, _prismatic_io_spectral.input)({
|
|
2826
|
+
label: "Resource Group Name",
|
|
2827
|
+
comments: "Name of the Resource group within the Azure subscription.",
|
|
2828
|
+
type: "string",
|
|
2829
|
+
required: true,
|
|
2830
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2831
|
+
});
|
|
2832
|
+
const namespaceName = (0, _prismatic_io_spectral.input)({
|
|
2833
|
+
label: "Namespace Name",
|
|
2834
|
+
comments: "The namespace name.",
|
|
2835
|
+
type: "string",
|
|
2836
|
+
required: true,
|
|
2837
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
2838
|
+
});
|
|
2839
|
+
//#endregion
|
|
2840
|
+
//#region src/dataSources/index.ts
|
|
2841
|
+
var dataSources_default = {
|
|
2842
|
+
selectSubscription,
|
|
2843
|
+
selectNamespace,
|
|
2844
|
+
selectNamespaceByResourceGroup,
|
|
2845
|
+
selectQueue,
|
|
2846
|
+
selectTopic: (0, _prismatic_io_spectral.dataSource)({
|
|
2847
|
+
display: {
|
|
2848
|
+
label: "Select Topic",
|
|
2849
|
+
description: "A picklist of topics within a namespace."
|
|
2850
|
+
},
|
|
2851
|
+
inputs: {
|
|
2852
|
+
connection,
|
|
2853
|
+
subscriptionId,
|
|
2854
|
+
resourceGroupName,
|
|
2855
|
+
namespaceName
|
|
2856
|
+
},
|
|
2857
|
+
perform: async (_context, { connection, subscriptionId, resourceGroupName, namespaceName }) => {
|
|
2858
|
+
const { data } = await getAzureServiceBusClient(connection, false).get(`/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/${namespaceName}/topics?api-version=2021-11-01`);
|
|
2859
|
+
return { result: toSortedPicklist(data.value ?? [], (item) => ({
|
|
2860
|
+
key: item.name,
|
|
2861
|
+
label: item.name
|
|
2862
|
+
})) };
|
|
2863
|
+
},
|
|
2864
|
+
dataSourceType: "picklist",
|
|
2865
|
+
examplePayload: { result: [{
|
|
2866
|
+
label: "my-topic",
|
|
2867
|
+
key: "my-topic"
|
|
2868
|
+
}] }
|
|
2869
|
+
}),
|
|
2870
|
+
selectSubscriptionByTopic,
|
|
2871
|
+
selectRule
|
|
2872
|
+
};
|
|
2873
|
+
var triggers_default = { subscriptionMessageWebhook: (0, _prismatic_io_spectral.trigger)({
|
|
2874
|
+
display: {
|
|
2875
|
+
label: "Webhook",
|
|
2876
|
+
description: "Receive and validate webhook requests from Azure Service Bus for webhooks you configure."
|
|
2877
|
+
},
|
|
2878
|
+
perform: async (_context, payload) => {
|
|
2879
|
+
return Promise.resolve({ payload });
|
|
2880
|
+
},
|
|
2881
|
+
inputs: {},
|
|
2882
|
+
synchronousResponseSupport: "invalid",
|
|
2883
|
+
scheduleSupport: "invalid"
|
|
2884
|
+
}) };
|
|
2885
|
+
//#endregion
|
|
2886
|
+
//#region src/index.ts
|
|
2887
|
+
var src_default = (0, _prismatic_io_spectral.component)({
|
|
2888
|
+
key: "azureServiceBus",
|
|
2889
|
+
documentationUrl: "https://prismatic.io/docs/components/azureServiceBus/",
|
|
2890
|
+
public: true,
|
|
2891
|
+
display: {
|
|
2892
|
+
label: "Azure Service Bus",
|
|
2893
|
+
description: "Interact with message queues and publish-subscribe topics (in a namespace)",
|
|
2894
|
+
iconPath: "icon.png",
|
|
2895
|
+
category: "Data Platforms"
|
|
2896
|
+
},
|
|
2897
|
+
actions: actions_default,
|
|
2898
|
+
connections: connections_default,
|
|
2899
|
+
dataSources: dataSources_default,
|
|
2900
|
+
triggers: triggers_default,
|
|
2901
|
+
hooks: { error: _prismatic_io_spectral_http.handleErrors }
|
|
2902
|
+
});
|
|
2903
|
+
//#endregion
|
|
2904
|
+
//#region npm-dist/.entry.ts
|
|
2905
|
+
var _entry_default = (0, _prismatic_io_spectral.callableComponent)(src_default);
|
|
2906
|
+
//#endregion
|
|
2907
|
+
module.exports = _entry_default;
|