@webda/azure 0.0.0-stage → 4.0.0-beta.14
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/LICENSE +166 -0
- package/README.md +248 -2
- package/lib/auth.d.ts +36 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +70 -0
- package/lib/auth.js.map +1 -0
- package/lib/deployers/arm.service.d.ts +177 -0
- package/lib/deployers/arm.service.d.ts.map +1 -0
- package/lib/deployers/arm.service.js +307 -0
- package/lib/deployers/arm.service.js.map +1 -0
- package/lib/deployers/containerapps.service.d.ts +186 -0
- package/lib/deployers/containerapps.service.d.ts.map +1 -0
- package/lib/deployers/containerapps.service.js +482 -0
- package/lib/deployers/containerapps.service.js.map +1 -0
- package/lib/deployers/functions-entrypoint.d.ts +60 -0
- package/lib/deployers/functions-entrypoint.d.ts.map +1 -0
- package/lib/deployers/functions-entrypoint.js +78 -0
- package/lib/deployers/functions-entrypoint.js.map +1 -0
- package/lib/deployers/functions.service.d.ts +96 -0
- package/lib/deployers/functions.service.d.ts.map +1 -0
- package/lib/deployers/functions.service.js +340 -0
- package/lib/deployers/functions.service.js.map +1 -0
- package/lib/deployers/functionspackager.service.d.ts +82 -0
- package/lib/deployers/functionspackager.service.d.ts.map +1 -0
- package/lib/deployers/functionspackager.service.js +157 -0
- package/lib/deployers/functionspackager.service.js.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/services/azure-parameters.d.ts +56 -0
- package/lib/services/azure-parameters.d.ts.map +1 -0
- package/lib/services/azure-parameters.js +43 -0
- package/lib/services/azure-parameters.js.map +1 -0
- package/lib/services/blob.service.d.ts +196 -0
- package/lib/services/blob.service.d.ts.map +1 -0
- package/lib/services/blob.service.js +450 -0
- package/lib/services/blob.service.js.map +1 -0
- package/lib/services/contributors.d.ts +50 -0
- package/lib/services/contributors.d.ts.map +1 -0
- package/lib/services/contributors.js +2 -0
- package/lib/services/contributors.js.map +1 -0
- package/lib/services/cosmos.service.d.ts +253 -0
- package/lib/services/cosmos.service.d.ts.map +1 -0
- package/lib/services/cosmos.service.js +566 -0
- package/lib/services/cosmos.service.js.map +1 -0
- package/lib/services/functionserver.service.d.ts +51 -0
- package/lib/services/functionserver.service.d.ts.map +1 -0
- package/lib/services/functionserver.service.js +232 -0
- package/lib/services/functionserver.service.js.map +1 -0
- package/lib/services/keyvault.service.d.ts +106 -0
- package/lib/services/keyvault.service.d.ts.map +1 -0
- package/lib/services/keyvault.service.js +228 -0
- package/lib/services/keyvault.service.js.map +1 -0
- package/lib/services/monitorlogger.service.d.ts +117 -0
- package/lib/services/monitorlogger.service.d.ts.map +1 -0
- package/lib/services/monitorlogger.service.js +149 -0
- package/lib/services/monitorlogger.service.js.map +1 -0
- package/lib/services/servicebus.service.d.ts +224 -0
- package/lib/services/servicebus.service.d.ts.map +1 -0
- package/lib/services/servicebus.service.js +351 -0
- package/lib/services/servicebus.service.js.map +1 -0
- package/lib/template.d.ts +68 -0
- package/lib/template.d.ts.map +1 -0
- package/lib/template.js +74 -0
- package/lib/template.js.map +1 -0
- package/package.json +77 -3
- package/webda.module.json +1891 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { ServiceBusAdministrationClient, ServiceBusClient } from "@azure/service-bus";
|
|
2
|
+
import { PubSubService, Queue, QueueParameters, SecretString, WebdaError } from "@webda/core";
|
|
3
|
+
import { CancelablePromise, JSONUtils } from "@webda/utils";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import { AzureParameters, getAzureCredential, loadAzureParameters } from "./azure-parameters.js";
|
|
6
|
+
/**
|
|
7
|
+
* Construct SDK clients without performing network I/O.
|
|
8
|
+
* @param params - Raw configuration parameters
|
|
9
|
+
* @returns The clients result
|
|
10
|
+
*/
|
|
11
|
+
function createClients(params) {
|
|
12
|
+
if (params.connectionString !== undefined) {
|
|
13
|
+
const connection = SecretString.from(params.connectionString, "connectionString");
|
|
14
|
+
return { client: new ServiceBusClient(connection), admin: new ServiceBusAdministrationClient(connection) };
|
|
15
|
+
}
|
|
16
|
+
const credential = getAzureCredential(params);
|
|
17
|
+
return {
|
|
18
|
+
client: new ServiceBusClient(params.namespace, credential),
|
|
19
|
+
admin: new ServiceBusAdministrationClient(params.namespace, credential)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Describe an existing namespace's messaging entities and managed identity permissions.
|
|
24
|
+
* @param params - Raw configuration parameters
|
|
25
|
+
* @param deployer - Deployment scope and identity helpers
|
|
26
|
+
* @param entity - Queue or topic name
|
|
27
|
+
* @param topic - Whether the entity is a topic
|
|
28
|
+
* @param subscription - Configured subscription name, if any
|
|
29
|
+
* @returns The contribute result
|
|
30
|
+
*/
|
|
31
|
+
function contribute(params, deployer, entity, topic, subscription) {
|
|
32
|
+
const namespace = params.namespace.split(".")[0];
|
|
33
|
+
const entityType = topic ? "topics" : "queues";
|
|
34
|
+
const name = `${namespace}/${entity}`;
|
|
35
|
+
const scope = `/subscriptions/${deployer.resources.subscriptionId}/resourceGroups/${deployer.resources.resourceGroup}/providers/Microsoft.ServiceBus/namespaces/${name.replace("/", `/${entityType}/`)}`;
|
|
36
|
+
const resources = [
|
|
37
|
+
{ type: `Microsoft.ServiceBus/namespaces/${entityType}`, apiVersion: "2024-01-01", name, properties: {} }
|
|
38
|
+
];
|
|
39
|
+
if (topic && subscription)
|
|
40
|
+
resources.push({
|
|
41
|
+
type: "Microsoft.ServiceBus/namespaces/topics/subscriptions",
|
|
42
|
+
apiVersion: "2024-01-01",
|
|
43
|
+
name: `${name}/${subscription}`,
|
|
44
|
+
dependsOn: [scope],
|
|
45
|
+
properties: {}
|
|
46
|
+
});
|
|
47
|
+
const roles = ["69a216fc-b8fb-44d8-bc22-1f3c2cd27a39", "4f6d3b9b-027b-4f4c-9142-0e5a2a2247e0"];
|
|
48
|
+
// Temporary subscriptions need management rights on the topic, in addition to data-plane access.
|
|
49
|
+
if (topic && !subscription)
|
|
50
|
+
roles.push("090c5cfd-751d-490a-894a-3ce6f1109419");
|
|
51
|
+
return {
|
|
52
|
+
resources,
|
|
53
|
+
roleAssignments: roles.map(role => ({
|
|
54
|
+
scope,
|
|
55
|
+
roleDefinitionId: `/subscriptions/${deployer.resources.subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/${role}`
|
|
56
|
+
}))
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Service Bus work queue settings. */
|
|
60
|
+
export class ServiceBusQueueParameters extends QueueParameters {
|
|
61
|
+
constructor() {
|
|
62
|
+
super(...arguments);
|
|
63
|
+
/**
|
|
64
|
+
* Create if not exists
|
|
65
|
+
*/
|
|
66
|
+
this.createIfNotExists = false;
|
|
67
|
+
/**
|
|
68
|
+
* Max messages
|
|
69
|
+
*/
|
|
70
|
+
this.maxMessages = 10;
|
|
71
|
+
/**
|
|
72
|
+
* Max wait time in ms
|
|
73
|
+
*/
|
|
74
|
+
this.maxWaitTimeInMs = 1000;
|
|
75
|
+
/**
|
|
76
|
+
* Max pending messages
|
|
77
|
+
*/
|
|
78
|
+
this.maxPendingMessages = 1000;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Perform load.
|
|
82
|
+
* @override
|
|
83
|
+
*/
|
|
84
|
+
load(params = {}) {
|
|
85
|
+
super.load(params);
|
|
86
|
+
return loadAzureParameters(this);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Service Bus peek-lock queue. Receipts retain their exact SDK message until completion or expiry.
|
|
90
|
+
* @WebdaModda
|
|
91
|
+
*/
|
|
92
|
+
export class ServiceBusQueue extends Queue {
|
|
93
|
+
constructor() {
|
|
94
|
+
super(...arguments);
|
|
95
|
+
/**
|
|
96
|
+
* Pending
|
|
97
|
+
*/
|
|
98
|
+
this.pending = new Map();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Perform init.
|
|
102
|
+
* @override
|
|
103
|
+
*/
|
|
104
|
+
async init() {
|
|
105
|
+
await super.init();
|
|
106
|
+
const p = this.parameters;
|
|
107
|
+
if (!Number.isInteger(p.maxMessages) ||
|
|
108
|
+
p.maxMessages < 1 ||
|
|
109
|
+
!Number.isInteger(p.maxPendingMessages) ||
|
|
110
|
+
p.maxPendingMessages < p.maxMessages) {
|
|
111
|
+
throw new WebdaError.BadRequest("Service Bus requires positive message limits");
|
|
112
|
+
}
|
|
113
|
+
({ client: this.client, admin: this.admin } = createClients(p));
|
|
114
|
+
if (p.createIfNotExists && !(await this.admin.queueExists(p.queue)))
|
|
115
|
+
await this.admin.createQueue(p.queue);
|
|
116
|
+
this.sender = this.client.createSender(p.queue);
|
|
117
|
+
this.receiver = this.client.createReceiver(p.queue, { receiveMode: "peekLock" });
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Perform send message.
|
|
122
|
+
* @override
|
|
123
|
+
*/
|
|
124
|
+
async sendMessage(event) {
|
|
125
|
+
await this.sender.sendMessages({ body: JSONUtils.stringify(event), contentType: "application/json" });
|
|
126
|
+
this.metrics.messages_sent.inc();
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Perform receive message.
|
|
130
|
+
* @override
|
|
131
|
+
*/
|
|
132
|
+
async receiveMessage(proto) {
|
|
133
|
+
for (const [handle, message] of this.pending) {
|
|
134
|
+
if (!message.lockedUntilUtc || message.lockedUntilUtc.getTime() <= Date.now())
|
|
135
|
+
this.pending.delete(handle);
|
|
136
|
+
}
|
|
137
|
+
const count = Math.min(this.parameters.maxMessages, this.parameters.maxPendingMessages - this.pending.size);
|
|
138
|
+
if (!count)
|
|
139
|
+
return [];
|
|
140
|
+
const messages = await this.receiver.receiveMessages(count, { maxWaitTimeInMs: this.parameters.maxWaitTimeInMs });
|
|
141
|
+
const receipts = [];
|
|
142
|
+
for (const message of messages) {
|
|
143
|
+
try {
|
|
144
|
+
const value = this.unserialize(typeof message.body === "string" ? message.body : JSONUtils.stringify(message.body), proto);
|
|
145
|
+
const handle = randomUUID();
|
|
146
|
+
this.pending.set(handle, message);
|
|
147
|
+
receipts.push({ Message: value, ReceiptHandle: handle });
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
this.metrics.errors.inc();
|
|
151
|
+
await this.receiver.abandonMessage(message);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return receipts;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Perform delete message.
|
|
158
|
+
* @override
|
|
159
|
+
*/
|
|
160
|
+
async deleteMessage(handle) {
|
|
161
|
+
const message = this.pending.get(handle);
|
|
162
|
+
if (!message)
|
|
163
|
+
throw new WebdaError.NotFound("Service Bus receipt is unknown or expired");
|
|
164
|
+
await this.receiver.completeMessage(message);
|
|
165
|
+
this.pending.delete(handle);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Perform size.
|
|
169
|
+
* @override
|
|
170
|
+
*/
|
|
171
|
+
async size() {
|
|
172
|
+
return (await this.admin.getQueueRuntimeProperties(this.parameters.queue)).activeMessageCount;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Perform stop.
|
|
176
|
+
* @override
|
|
177
|
+
*/
|
|
178
|
+
async stop() {
|
|
179
|
+
try {
|
|
180
|
+
await this.receiver?.close();
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
this.pending.clear();
|
|
184
|
+
try {
|
|
185
|
+
await this.sender?.close();
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
await this.client?.close();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
await super.stop();
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Describe the Azure resources and identity permissions required by this service.
|
|
195
|
+
* @param deployer - Deployment scope and identity helpers
|
|
196
|
+
* @returns The azure resources result
|
|
197
|
+
*/
|
|
198
|
+
getAzureResources(deployer) {
|
|
199
|
+
return contribute(this.parameters, deployer, this.parameters.queue, false);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Parameters
|
|
204
|
+
*/
|
|
205
|
+
ServiceBusQueue.Parameters = ServiceBusQueueParameters;
|
|
206
|
+
/** Service Bus pub/sub settings. Omit subscription to create one temporary subscription per consumer. */
|
|
207
|
+
export class ServiceBusPubSubParameters extends AzureParameters {
|
|
208
|
+
constructor() {
|
|
209
|
+
super(...arguments);
|
|
210
|
+
/**
|
|
211
|
+
* Create if not exists
|
|
212
|
+
*/
|
|
213
|
+
this.createIfNotExists = false;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/** Service Bus topic with explicit completion after successful processing.
|
|
217
|
+
* @WebdaModda
|
|
218
|
+
*/
|
|
219
|
+
export class ServiceBusPubSub extends PubSubService {
|
|
220
|
+
constructor() {
|
|
221
|
+
super(...arguments);
|
|
222
|
+
/**
|
|
223
|
+
* Consumers
|
|
224
|
+
*/
|
|
225
|
+
this.consumers = new Set();
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Perform init.
|
|
229
|
+
* @override
|
|
230
|
+
*/
|
|
231
|
+
async init() {
|
|
232
|
+
await super.init();
|
|
233
|
+
({ client: this.client, admin: this.admin } = createClients(this.parameters));
|
|
234
|
+
if (this.parameters.createIfNotExists && !(await this.admin.topicExists(this.parameters.topic)))
|
|
235
|
+
await this.admin.createTopic(this.parameters.topic);
|
|
236
|
+
this.sender = this.client.createSender(this.parameters.topic);
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Perform send message.
|
|
241
|
+
* @override
|
|
242
|
+
*/
|
|
243
|
+
async sendMessage(event) {
|
|
244
|
+
await this.sender.sendMessages({ body: JSONUtils.stringify(event), contentType: "application/json" });
|
|
245
|
+
this.metrics.messages_sent.inc();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Perform size.
|
|
249
|
+
* @override
|
|
250
|
+
*/
|
|
251
|
+
async size() {
|
|
252
|
+
return this.parameters.subscription
|
|
253
|
+
? (await this.admin.getSubscriptionRuntimeProperties(this.parameters.topic, this.parameters.subscription))
|
|
254
|
+
.activeMessageCount
|
|
255
|
+
: 0;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Perform consume.
|
|
259
|
+
* @override
|
|
260
|
+
*/
|
|
261
|
+
consume(callback, proto, onBind) {
|
|
262
|
+
const topic = this.parameters.topic;
|
|
263
|
+
const temporary = !this.parameters.subscription;
|
|
264
|
+
const subscription = this.parameters.subscription ?? `webda-${randomUUID()}`;
|
|
265
|
+
let receiver;
|
|
266
|
+
let created = false;
|
|
267
|
+
let closing;
|
|
268
|
+
const cleanup = () => (closing ?? (closing = (async () => {
|
|
269
|
+
try {
|
|
270
|
+
await receiver?.close();
|
|
271
|
+
}
|
|
272
|
+
finally {
|
|
273
|
+
if (created)
|
|
274
|
+
await this.admin.deleteSubscription(topic, subscription);
|
|
275
|
+
}
|
|
276
|
+
})()));
|
|
277
|
+
const binding = (async () => {
|
|
278
|
+
if (temporary ||
|
|
279
|
+
(this.parameters.createIfNotExists && !(await this.admin.subscriptionExists(topic, subscription)))) {
|
|
280
|
+
await this.admin.createSubscription(topic, subscription, temporary ? { autoDeleteOnIdle: "PT5M" } : {});
|
|
281
|
+
created = temporary;
|
|
282
|
+
}
|
|
283
|
+
receiver = this.client.createReceiver(topic, subscription, { receiveMode: "peekLock" });
|
|
284
|
+
receiver.subscribe({
|
|
285
|
+
processMessage: async (message) => {
|
|
286
|
+
this.metrics.messages_received.inc();
|
|
287
|
+
const end = this.metrics.processing_duration.startTimer();
|
|
288
|
+
try {
|
|
289
|
+
await callback(this.unserialize(typeof message.body === "string" ? message.body : JSONUtils.stringify(message.body), proto));
|
|
290
|
+
await receiver.completeMessage(message);
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
this.metrics.errors.inc();
|
|
294
|
+
await receiver.abandonMessage(message);
|
|
295
|
+
}
|
|
296
|
+
finally {
|
|
297
|
+
end();
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
processError: async () => {
|
|
301
|
+
this.metrics.errors.inc();
|
|
302
|
+
}
|
|
303
|
+
}, { autoCompleteMessages: false });
|
|
304
|
+
onBind?.();
|
|
305
|
+
})();
|
|
306
|
+
const consumer = new CancelablePromise((_resolve, reject) => {
|
|
307
|
+
void binding.catch(async (error) => {
|
|
308
|
+
await cleanup().catch(() => { });
|
|
309
|
+
reject(error);
|
|
310
|
+
});
|
|
311
|
+
}, async () => {
|
|
312
|
+
await binding.catch(() => { });
|
|
313
|
+
await cleanup();
|
|
314
|
+
});
|
|
315
|
+
this.consumers.add(consumer);
|
|
316
|
+
// The consumer remains pending until cancellation or failure; observe its rejection during shutdown.
|
|
317
|
+
void consumer.catch(() => this.consumers.delete(consumer));
|
|
318
|
+
return consumer;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Perform stop.
|
|
322
|
+
* @override
|
|
323
|
+
*/
|
|
324
|
+
async stop() {
|
|
325
|
+
try {
|
|
326
|
+
await Promise.all([...this.consumers].map(consumer => consumer.cancel()));
|
|
327
|
+
}
|
|
328
|
+
finally {
|
|
329
|
+
try {
|
|
330
|
+
await this.sender?.close();
|
|
331
|
+
}
|
|
332
|
+
finally {
|
|
333
|
+
await this.client?.close();
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
await super.stop();
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Describe the Azure resources and identity permissions required by this service.
|
|
340
|
+
* @param deployer - Deployment scope and identity helpers
|
|
341
|
+
* @returns The azure resources result
|
|
342
|
+
*/
|
|
343
|
+
getAzureResources(deployer) {
|
|
344
|
+
return contribute(this.parameters, deployer, this.parameters.topic, true, this.parameters.subscription);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Parameters
|
|
349
|
+
*/
|
|
350
|
+
ServiceBusPubSub.Parameters = ServiceBusPubSubParameters;
|
|
351
|
+
//# sourceMappingURL=servicebus.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"servicebus.service.js","sources":["../../src/services/servicebus.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,gBAAgB,EAIjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAkB,aAAa,EAAE,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9G,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,eAAe,EAEf,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAqB/B;;;;GAIG;AACH,SAAS,aAAa,CAAC,MAA0B;IAC/C,IAAI,MAAM,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;QAClF,OAAO,EAAE,MAAM,EAAE,IAAI,gBAAgB,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,8BAA8B,CAAC,UAAU,CAAC,EAAE,CAAC;IAC7G,CAAC;IACD,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC9C,OAAO;QACL,MAAM,EAAE,IAAI,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC;QAC1D,KAAK,EAAE,IAAI,8BAA8B,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC;KACxE,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,UAAU,CACjB,MAA0B,EAC1B,QAA2B,EAC3B,MAAc,EACd,KAAc,EACd,YAAqB;IAErB,MAAM,SAAS,GAAG,MAAM,CAA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QAAQ,CAAC,CAAC,CAAC;QAC3D,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC5E,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;YAC7B,CAAC;oBAAS,CAAC;gBACT,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;YAC7B,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,QAA2B;QAC3C,OAAO,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAC1G,CAAC;CACF;AAzJC;;GAEG;AACI,2BAAU,GAAG,0BAA0B,AAA7B,CAA8B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** ARM template shape shared by Azure deployers and contributors. */
|
|
2
|
+
export interface AzureTemplate {
|
|
3
|
+
/**
|
|
4
|
+
* $schema
|
|
5
|
+
*/
|
|
6
|
+
$schema: string;
|
|
7
|
+
/**
|
|
8
|
+
* Content version
|
|
9
|
+
*/
|
|
10
|
+
contentVersion: string;
|
|
11
|
+
/**
|
|
12
|
+
* Parameters
|
|
13
|
+
*/
|
|
14
|
+
parameters: Record<string, {
|
|
15
|
+
type: string;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Resources
|
|
19
|
+
*/
|
|
20
|
+
resources: Record<string, any>[];
|
|
21
|
+
/**
|
|
22
|
+
* Outputs
|
|
23
|
+
*/
|
|
24
|
+
outputs: Record<string, any>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create an empty ARM deployment template.
|
|
28
|
+
* @returns The azure template result
|
|
29
|
+
*/
|
|
30
|
+
export declare function createAzureTemplate(): AzureTemplate;
|
|
31
|
+
/**
|
|
32
|
+
* Quote a literal embedded inside an ARM expression.
|
|
33
|
+
* @param value - Value to convert or protect
|
|
34
|
+
* @returns The arm literal result
|
|
35
|
+
*/
|
|
36
|
+
export declare function armLiteral(value: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Strip the brackets of an expression, or quote a literal for a larger expression.
|
|
39
|
+
* @param value - Value to convert or protect
|
|
40
|
+
* @returns The arm value result
|
|
41
|
+
*/
|
|
42
|
+
export declare function armValue(value: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Construct a resource identifier without interpolating unescaped names.
|
|
45
|
+
* @param type - ARM resource type
|
|
46
|
+
* @param names - Resource name segments
|
|
47
|
+
* @returns The resource id result
|
|
48
|
+
*/
|
|
49
|
+
export declare function resourceId(type: string, ...names: string[]): string;
|
|
50
|
+
/**
|
|
51
|
+
* Resource identifier for a role assignment at a resource scope.
|
|
52
|
+
* @param resource - ARM resource declaration
|
|
53
|
+
* @returns The role assignment id result
|
|
54
|
+
*/
|
|
55
|
+
export declare function roleAssignmentId(resource: Record<string, any>): string;
|
|
56
|
+
/**
|
|
57
|
+
* Azure Container Apps uses five cron fields; sub-minute schedules cannot be represented.
|
|
58
|
+
* @param cron - Cron expression
|
|
59
|
+
* @returns The container apps schedule result
|
|
60
|
+
*/
|
|
61
|
+
export declare function containerAppsSchedule(cron: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Functions timers use six-field NCRONTAB with seconds first.
|
|
64
|
+
* @param cron - Cron expression
|
|
65
|
+
* @returns The functions schedule result
|
|
66
|
+
*/
|
|
67
|
+
export declare function functionsSchedule(cron: string): string;
|
|
68
|
+
//# sourceMappingURL=template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.d.ts","sources":["../src/template.ts"],"names":[],"mappings":"AAEA,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7C;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IACjC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAQnD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AACD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C;AACD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKtD"}
|
package/lib/template.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { WebdaError } from "@webda/core";
|
|
2
|
+
/**
|
|
3
|
+
* Create an empty ARM deployment template.
|
|
4
|
+
* @returns The azure template result
|
|
5
|
+
*/
|
|
6
|
+
export function createAzureTemplate() {
|
|
7
|
+
return {
|
|
8
|
+
$schema: "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
|
9
|
+
contentVersion: "1.0.0.0",
|
|
10
|
+
parameters: {},
|
|
11
|
+
resources: [],
|
|
12
|
+
outputs: {}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Quote a literal embedded inside an ARM expression.
|
|
17
|
+
* @param value - Value to convert or protect
|
|
18
|
+
* @returns The arm literal result
|
|
19
|
+
*/
|
|
20
|
+
export function armLiteral(value) {
|
|
21
|
+
return `'${value.replace(/'/g, "''")}'`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Strip the brackets of an expression, or quote a literal for a larger expression.
|
|
25
|
+
* @param value - Value to convert or protect
|
|
26
|
+
* @returns The arm value result
|
|
27
|
+
*/
|
|
28
|
+
export function armValue(value) {
|
|
29
|
+
return value.startsWith("[") && value.endsWith("]") ? value.slice(1, -1) : armLiteral(value);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Construct a resource identifier without interpolating unescaped names.
|
|
33
|
+
* @param type - ARM resource type
|
|
34
|
+
* @param names - Resource name segments
|
|
35
|
+
* @returns The resource id result
|
|
36
|
+
*/
|
|
37
|
+
export function resourceId(type, ...names) {
|
|
38
|
+
return `[resourceId(${[type, ...names].map(armLiteral).join(", ")})]`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resource identifier for a role assignment at a resource scope.
|
|
42
|
+
* @param resource - ARM resource declaration
|
|
43
|
+
* @returns The role assignment id result
|
|
44
|
+
*/
|
|
45
|
+
export function roleAssignmentId(resource) {
|
|
46
|
+
return `[extensionResourceId(${armValue(resource.scope)}, 'Microsoft.Authorization/roleAssignments', ${armValue(resource.name)})]`;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Azure Container Apps uses five cron fields; sub-minute schedules cannot be represented.
|
|
50
|
+
* @param cron - Cron expression
|
|
51
|
+
* @returns The container apps schedule result
|
|
52
|
+
*/
|
|
53
|
+
export function containerAppsSchedule(cron) {
|
|
54
|
+
const fields = cron.trim().split(/\s+/);
|
|
55
|
+
if (fields.length === 6 && fields[0] === "0")
|
|
56
|
+
fields.shift();
|
|
57
|
+
if (fields.length !== 5)
|
|
58
|
+
throw new WebdaError.BadRequest("Container Apps cron must use five fields, or six with seconds set to 0");
|
|
59
|
+
return fields.join(" ");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Functions timers use six-field NCRONTAB with seconds first.
|
|
63
|
+
* @param cron - Cron expression
|
|
64
|
+
* @returns The functions schedule result
|
|
65
|
+
*/
|
|
66
|
+
export function functionsSchedule(cron) {
|
|
67
|
+
const fields = cron.trim().split(/\s+/);
|
|
68
|
+
if (fields.length === 5)
|
|
69
|
+
fields.unshift("0");
|
|
70
|
+
if (fields.length !== 6)
|
|
71
|
+
throw new WebdaError.BadRequest("Functions cron requires five or six fields");
|
|
72
|
+
return fields.join(" ");
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sources":["../src/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA0BzC;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,OAAO,EAAE,iFAAiF;QAC1F,cAAc,EAAE,SAAS;QACzB,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,EAAE;KACZ,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;AAC1C,CAAC;AACD;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACp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M,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,4CAA4C,CAAC,CAAC;IACvG,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webda/azure",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "4.0.0-beta.14",
|
|
4
|
+
"description": "Azure services and deployers for Webda",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/loopingz/webda.io.git",
|
|
9
|
+
"directory": "packages/azure"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"webda",
|
|
13
|
+
"modda"
|
|
14
|
+
],
|
|
15
|
+
"files": [
|
|
16
|
+
"lib",
|
|
17
|
+
"webda.module.json",
|
|
18
|
+
"package.json"
|
|
19
|
+
],
|
|
20
|
+
"author": "loopingz",
|
|
21
|
+
"license": "LGPL-3.0-only",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/loopingz/webda.io/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/loopingz/webda.io#readme",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@azure/arm-resources": "^8.0.0",
|
|
28
|
+
"@azure/arm-resourcesdeployments": "^2.0.0",
|
|
29
|
+
"@azure/core-auth": "^1.11.0",
|
|
30
|
+
"@azure/cosmos": "^4.10.1",
|
|
31
|
+
"@azure/functions": "^4.17.0",
|
|
32
|
+
"@azure/identity": "^4.14.1",
|
|
33
|
+
"@azure/keyvault-keys": "^4.10.2",
|
|
34
|
+
"@azure/keyvault-secrets": "^4.12.0",
|
|
35
|
+
"@azure/monitor-ingestion": "^1.2.0",
|
|
36
|
+
"@azure/service-bus": "^7.10.0",
|
|
37
|
+
"@azure/storage-blob": "^12.34.0",
|
|
38
|
+
"@webda/core": "4.0.0-beta.14",
|
|
39
|
+
"@webda/oci": "4.0.0-beta.14",
|
|
40
|
+
"@webda/ql": "4.0.0-beta.11",
|
|
41
|
+
"@webda/models": "4.0.0-beta.14",
|
|
42
|
+
"@webda/utils": "4.0.0-beta.13",
|
|
43
|
+
"@webda/workout": "4.0.0-beta.7"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "26.6.6",
|
|
50
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
51
|
+
"typescript": "7.1.0-dev.20261102.1",
|
|
52
|
+
"vite": "^7.3.7",
|
|
53
|
+
"vitest": "^5.1.0",
|
|
54
|
+
"@webda/compiler": "^4.0.0-beta.14",
|
|
55
|
+
"@webda/test": "4.0.0-beta.9"
|
|
56
|
+
},
|
|
57
|
+
"type": "module",
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=22.0.0"
|
|
60
|
+
},
|
|
61
|
+
"nx": {
|
|
62
|
+
"implicitDependencies": [
|
|
63
|
+
"@webda/core"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"typings": "lib/index.d.ts",
|
|
67
|
+
"webda": {
|
|
68
|
+
"namespace": "Webda"
|
|
69
|
+
},
|
|
70
|
+
"scripts": {
|
|
71
|
+
"build": "webdac build",
|
|
72
|
+
"build:watch": "webdac build --watch",
|
|
73
|
+
"pretest": "npm run build",
|
|
74
|
+
"lint": "eslint",
|
|
75
|
+
"lint:fix": "eslint --fix",
|
|
76
|
+
"test": "vitest run",
|
|
77
|
+
"format": "prettier --check src/**/*",
|
|
78
|
+
"format:fix": "prettier --write src/**/*"
|
|
79
|
+
}
|
|
6
80
|
}
|