@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.
Files changed (68) hide show
  1. package/LICENSE +166 -0
  2. package/README.md +248 -2
  3. package/lib/auth.d.ts +36 -0
  4. package/lib/auth.d.ts.map +1 -0
  5. package/lib/auth.js +70 -0
  6. package/lib/auth.js.map +1 -0
  7. package/lib/deployers/arm.service.d.ts +177 -0
  8. package/lib/deployers/arm.service.d.ts.map +1 -0
  9. package/lib/deployers/arm.service.js +307 -0
  10. package/lib/deployers/arm.service.js.map +1 -0
  11. package/lib/deployers/containerapps.service.d.ts +186 -0
  12. package/lib/deployers/containerapps.service.d.ts.map +1 -0
  13. package/lib/deployers/containerapps.service.js +482 -0
  14. package/lib/deployers/containerapps.service.js.map +1 -0
  15. package/lib/deployers/functions-entrypoint.d.ts +60 -0
  16. package/lib/deployers/functions-entrypoint.d.ts.map +1 -0
  17. package/lib/deployers/functions-entrypoint.js +78 -0
  18. package/lib/deployers/functions-entrypoint.js.map +1 -0
  19. package/lib/deployers/functions.service.d.ts +96 -0
  20. package/lib/deployers/functions.service.d.ts.map +1 -0
  21. package/lib/deployers/functions.service.js +340 -0
  22. package/lib/deployers/functions.service.js.map +1 -0
  23. package/lib/deployers/functionspackager.service.d.ts +82 -0
  24. package/lib/deployers/functionspackager.service.d.ts.map +1 -0
  25. package/lib/deployers/functionspackager.service.js +157 -0
  26. package/lib/deployers/functionspackager.service.js.map +1 -0
  27. package/lib/index.d.ts +15 -0
  28. package/lib/index.d.ts.map +1 -0
  29. package/lib/index.js +18 -0
  30. package/lib/index.js.map +1 -0
  31. package/lib/services/azure-parameters.d.ts +56 -0
  32. package/lib/services/azure-parameters.d.ts.map +1 -0
  33. package/lib/services/azure-parameters.js +43 -0
  34. package/lib/services/azure-parameters.js.map +1 -0
  35. package/lib/services/blob.service.d.ts +196 -0
  36. package/lib/services/blob.service.d.ts.map +1 -0
  37. package/lib/services/blob.service.js +450 -0
  38. package/lib/services/blob.service.js.map +1 -0
  39. package/lib/services/contributors.d.ts +50 -0
  40. package/lib/services/contributors.d.ts.map +1 -0
  41. package/lib/services/contributors.js +2 -0
  42. package/lib/services/contributors.js.map +1 -0
  43. package/lib/services/cosmos.service.d.ts +253 -0
  44. package/lib/services/cosmos.service.d.ts.map +1 -0
  45. package/lib/services/cosmos.service.js +566 -0
  46. package/lib/services/cosmos.service.js.map +1 -0
  47. package/lib/services/functionserver.service.d.ts +51 -0
  48. package/lib/services/functionserver.service.d.ts.map +1 -0
  49. package/lib/services/functionserver.service.js +232 -0
  50. package/lib/services/functionserver.service.js.map +1 -0
  51. package/lib/services/keyvault.service.d.ts +106 -0
  52. package/lib/services/keyvault.service.d.ts.map +1 -0
  53. package/lib/services/keyvault.service.js +228 -0
  54. package/lib/services/keyvault.service.js.map +1 -0
  55. package/lib/services/monitorlogger.service.d.ts +117 -0
  56. package/lib/services/monitorlogger.service.d.ts.map +1 -0
  57. package/lib/services/monitorlogger.service.js +149 -0
  58. package/lib/services/monitorlogger.service.js.map +1 -0
  59. package/lib/services/servicebus.service.d.ts +224 -0
  60. package/lib/services/servicebus.service.d.ts.map +1 -0
  61. package/lib/services/servicebus.service.js +351 -0
  62. package/lib/services/servicebus.service.js.map +1 -0
  63. package/lib/template.d.ts +68 -0
  64. package/lib/template.d.ts.map +1 -0
  65. package/lib/template.js +74 -0
  66. package/lib/template.js.map +1 -0
  67. package/package.json +77 -3
  68. package/webda.module.json +1891 -0
@@ -0,0 +1,450 @@
1
+ import { BlobSASPermissions, BlobServiceClient, generateBlobSASQueryParameters, newPipeline, StorageSharedKeyCredential } from "@azure/storage-blob";
2
+ import { CloudBinary, CloudBinaryParameters, SecretString, useModelId, WebdaError, normalizeHashes, normalizeHash } from "@webda/core";
3
+ import { ContentExistsError, ContentNotFoundError, parseContentUrl, toReadable } from "@webda/utils";
4
+ import { createHash, randomUUID } from "node:crypto";
5
+ import { posix } from "node:path";
6
+ import { getAzureCredential, loadAzureParameters } from "./azure-parameters.js";
7
+ /** Blob storage settings. Shared keys are optional; managed identity is preferred. */
8
+ export class AzureBlobBinaryParameters extends CloudBinaryParameters {
9
+ constructor() {
10
+ super(...arguments);
11
+ /**
12
+ * Create container
13
+ */
14
+ this.createContainer = false;
15
+ /**
16
+ * Pending timeout
17
+ */
18
+ this.pendingTimeout = 3600;
19
+ }
20
+ /**
21
+ * Perform load.
22
+ * @override
23
+ */
24
+ load(params = {}) {
25
+ super.load(params);
26
+ return loadAzureParameters(this);
27
+ }
28
+ }
29
+ /** Blob-backed binaries with verified direct uploads and exact ownership markers.
30
+ * @WebdaModda
31
+ */
32
+ export class AzureBlobBinary extends CloudBinary {
33
+ constructor() {
34
+ super(...arguments);
35
+ /**
36
+ * Schemes
37
+ */
38
+ this.schemes = ["azure", "azblob"];
39
+ }
40
+ /**
41
+ * Perform init.
42
+ * @override
43
+ */
44
+ async init() {
45
+ const p = this.parameters;
46
+ if (p.connectionString !== undefined) {
47
+ this.client = BlobServiceClient.fromConnectionString(SecretString.from(p.connectionString, "connectionString"));
48
+ if (p.endpoint)
49
+ this.client = new BlobServiceClient(p.endpoint, this.client.credential);
50
+ }
51
+ else {
52
+ if (!p.account)
53
+ throw new WebdaError.BadRequest("Azure Blob storage requires account or connectionString");
54
+ this.client = new BlobServiceClient(p.endpoint ?? `https://${p.account}.blob.core.windows.net`, getAzureCredential(p));
55
+ }
56
+ if (p.serviceVersion) {
57
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(p.serviceVersion))
58
+ throw new WebdaError.BadRequest("Invalid Azure Blob serviceVersion");
59
+ const pipeline = newPipeline(this.client.credential);
60
+ pipeline.factories.push({
61
+ /**
62
+ * Create operation
63
+ * @param next - the next
64
+ * @returns the result
65
+ */
66
+ create(next) {
67
+ return {
68
+ /**
69
+ * Send request
70
+ * @param request - the request
71
+ * @returns the result
72
+ */
73
+ sendRequest(request) {
74
+ request.headers.set("x-ms-version", p.serviceVersion);
75
+ return next.sendRequest(request);
76
+ }
77
+ };
78
+ }
79
+ });
80
+ this.client = new BlobServiceClient(this.client.url, pipeline);
81
+ }
82
+ if (p.createContainer)
83
+ await this.client.getContainerClient(p.container).createIfNotExists();
84
+ await super.init();
85
+ return this;
86
+ }
87
+ /**
88
+ * Perform get content bucket.
89
+ * @override
90
+ */
91
+ getContentBucket() {
92
+ return this.parameters.container;
93
+ }
94
+ /**
95
+ * Resolve a content URL to a configured Blob SDK client.
96
+ * @param url - Content URL
97
+ * @returns The blob result
98
+ */
99
+ blob(url) {
100
+ const target = parseContentUrl(url, this.parameters.container);
101
+ // A content URL cannot redirect this client's credentials to another endpoint.
102
+ if (target.endpoint || target.credential)
103
+ throw new WebdaError.BadRequest("Use configured Azure Blob endpoint and credentials");
104
+ return this.client.getContainerClient(target.bucket ?? this.parameters.container).getBlockBlobClient(target.key);
105
+ }
106
+ /**
107
+ * Perform get content.
108
+ * @override
109
+ */
110
+ async getContent(url, options) {
111
+ try {
112
+ const range = options?.range;
113
+ const response = await this.blob(url).download(range?.start, range?.end === undefined ? undefined : range.end - (range?.start ?? 0) + 1);
114
+ return response.readableStreamBody;
115
+ }
116
+ catch (error) {
117
+ if (error.statusCode === 404)
118
+ throw new ContentNotFoundError(url);
119
+ throw error;
120
+ }
121
+ }
122
+ /**
123
+ * Perform put content.
124
+ * @override
125
+ */
126
+ async putContent(url, body, options) {
127
+ try {
128
+ const result = await this.blob(url).uploadStream(toReadable(body), undefined, undefined, {
129
+ blobHTTPHeaders: { blobContentType: options?.contentType ?? "application/octet-stream" },
130
+ metadata: options?.metadata,
131
+ conditions: options?.ifNotExists ? { ifNoneMatch: "*" } : undefined
132
+ });
133
+ return {
134
+ url,
135
+ size: options?.contentLength,
136
+ etag: result.etag,
137
+ contentType: options?.contentType,
138
+ metadata: options?.metadata,
139
+ lastModified: result.lastModified
140
+ };
141
+ }
142
+ catch (error) {
143
+ if (options?.ifNotExists && [409, 412].includes(error.statusCode))
144
+ throw new ContentExistsError(url);
145
+ throw error;
146
+ }
147
+ }
148
+ /**
149
+ * Perform head content.
150
+ * @override
151
+ */
152
+ async headContent(url) {
153
+ try {
154
+ const info = await this.blob(url).getProperties();
155
+ return {
156
+ url,
157
+ size: info.contentLength,
158
+ contentType: info.contentType,
159
+ etag: info.etag,
160
+ metadata: info.metadata,
161
+ lastModified: info.lastModified
162
+ };
163
+ }
164
+ catch (error) {
165
+ if (error.statusCode === 404)
166
+ return undefined;
167
+ throw error;
168
+ }
169
+ }
170
+ /**
171
+ * Perform delete content.
172
+ * @override
173
+ */
174
+ async deleteContent(url) {
175
+ await this.blob(url).deleteIfExists();
176
+ }
177
+ /**
178
+ * Perform _get.
179
+ * @override
180
+ */
181
+ async _get(info) {
182
+ this.checkHash(info.hash);
183
+ return this.getContent(this.getContentUrl(this._getKey(info.hash)));
184
+ }
185
+ /**
186
+ * Perform get signed url from map.
187
+ * @override
188
+ */
189
+ async getSignedUrlFromMap(map, expires, _context) {
190
+ this.checkHash(map.hash);
191
+ return this.getSignedUrl(this._getKey(map.hash), "r", expires);
192
+ }
193
+ /**
194
+ * Issue narrowly scoped SAS credentials. Direct uploads only create isolated staging blobs.
195
+ * @param key - Object key within the container
196
+ * @param permissions - Permissions granted by the SAS
197
+ * @param expires - SAS lifetime in seconds
198
+ * @returns The signed url result
199
+ */
200
+ async getSignedUrl(key, permissions = "r", expires = this.parameters.urlExpiry) {
201
+ if (!Number.isFinite(expires) || expires <= 0 || expires > 7 * 86400 - 600)
202
+ throw new WebdaError.BadRequest("SAS expiry must be positive and less than seven days");
203
+ const startsOn = new Date(Date.now() - 300000), expiresOn = new Date(Date.now() + expires * 1000);
204
+ const values = {
205
+ containerName: this.parameters.container,
206
+ blobName: key,
207
+ permissions: BlobSASPermissions.parse(permissions),
208
+ startsOn,
209
+ expiresOn,
210
+ version: this.parameters.serviceVersion
211
+ };
212
+ const credential = this.client.credential;
213
+ const sas = credential instanceof StorageSharedKeyCredential
214
+ ? generateBlobSASQueryParameters(values, credential)
215
+ : generateBlobSASQueryParameters(values, await this.client.getUserDelegationKey(startsOn, expiresOn), this.client.accountName);
216
+ return `${this.client.getContainerClient(this.parameters.container).getBlobClient(key).url}?${sas.toString()}`;
217
+ }
218
+ /**
219
+ * Validate a hash before using it in a storage key.
220
+ * @param hash - Normalized content hash
221
+ * @returns The check hash result
222
+ */
223
+ checkHash(hash) {
224
+ if (!hash || !/^[0-9a-f]{32}$/.test(hash))
225
+ throw new WebdaError.BadRequest("Invalid binary hash");
226
+ }
227
+ /**
228
+ * Build an injective ownership marker from the model, attribute and key.
229
+ * @param model - Model class or model identifier
230
+ * @param property - Binary or model attribute
231
+ * @param uuid - Owner primary key
232
+ * @returns The marker result
233
+ */
234
+ marker(model, property, uuid) {
235
+ return ("@" +
236
+ [model, property, uuid]
237
+ .map(part => [...Buffer.from(part)]
238
+ .map(byte => {
239
+ const character = String.fromCharCode(byte);
240
+ return /[A-Za-z0-9.:@-]/.test(character)
241
+ ? character
242
+ : `~${byte.toString(16).toUpperCase().padStart(2, "0")}`;
243
+ })
244
+ .join(""))
245
+ .join("_"));
246
+ }
247
+ /**
248
+ * Build the private pending-upload record key.
249
+ * @param object - Model owning the binary
250
+ * @param property - Binary or model attribute
251
+ * @param hash - Normalized content hash
252
+ * @returns The pending key result
253
+ */
254
+ pendingKey(object, property, hash) {
255
+ return posix.join(this.parameters.prefix ?? "", "_pending", hash, this.marker(useModelId(object.constructor), property, object.getUUID()));
256
+ }
257
+ /**
258
+ * Persist an exact ownership marker and attach the verified file.
259
+ * @param object - Model owning the binary
260
+ * @param property - Binary or model attribute
261
+ * @param info - Binary metadata or increment specification
262
+ */
263
+ async attach(object, property, info) {
264
+ const model = useModelId(object.constructor);
265
+ await this.putContent(this.getContentUrl(this._getKey(info.hash, this.marker(model, property, object.getUUID()))), "", { metadata: { webdamodel: model } });
266
+ await this.uploadSuccess(object, property, info);
267
+ }
268
+ /**
269
+ * Perform store.
270
+ * @override
271
+ */
272
+ async store(object, property, file) {
273
+ this.checkMap(object, property);
274
+ const computed = await this.verifiedHashes(file);
275
+ const url = this.getContentUrl(this._getKey(computed.hash));
276
+ try {
277
+ await this.putContent(url, await file.get(), {
278
+ ifNotExists: true,
279
+ metadata: { ...file.metadata, webdaproof: computed.challenge },
280
+ contentType: file.mimetype,
281
+ contentLength: file.size
282
+ });
283
+ }
284
+ catch (error) {
285
+ if (!(error instanceof ContentExistsError))
286
+ throw error;
287
+ }
288
+ const stored = await this.headContent(url);
289
+ if (stored?.metadata?.webdaproof !== computed.challenge)
290
+ throw new WebdaError.Conflict("Stored binary proof does not match");
291
+ await this.attach(object, property, { ...file.toBinaryFileInfo(), size: stored.size });
292
+ }
293
+ /**
294
+ * Perform put redirect url.
295
+ * @override
296
+ */
297
+ async putRedirectUrl(object, property, info, context) {
298
+ info = normalizeHashes(info ?? (await context?.getInput()));
299
+ this.checkHash(info?.hash);
300
+ if (!info?.challenge || !/^[0-9a-f]{32}$/.test(info.challenge))
301
+ throw new WebdaError.BadRequest("Upload challenge is required");
302
+ this.checkMap(object, property);
303
+ const stored = await this.headContent(this.getContentUrl(this._getKey(info.hash)));
304
+ if (stored?.metadata?.webdaproof === info.challenge) {
305
+ if (this.parameters.maxUploadSize !== undefined && stored.size > this.parameters.maxUploadSize)
306
+ throw new WebdaError.BadRequest("File too big");
307
+ await this.attach(object, property, { ...info, size: stored.size });
308
+ return undefined;
309
+ }
310
+ const stagingKey = posix.join(this.parameters.prefix ?? "", "_staging", randomUUID());
311
+ const pending = { info, stagingKey, created: Date.now() };
312
+ await this.putContent(this.getContentUrl(this.pendingKey(object, property, info.hash)), JSON.stringify(pending), {
313
+ contentType: "application/json"
314
+ });
315
+ return {
316
+ url: await this.getSignedUrl(stagingKey, "c"),
317
+ method: "PUT",
318
+ headers: {
319
+ "x-ms-blob-type": "BlockBlob",
320
+ "Content-Type": "application/octet-stream",
321
+ "Content-MD5": Buffer.from(info.hash, "hex").toString("base64")
322
+ }
323
+ };
324
+ }
325
+ /**
326
+ * Verify the bytes before copying them to the content hash and attaching them to the owner.
327
+ * @override
328
+ */
329
+ async completeUpload(object, property, hash) {
330
+ hash = normalizeHash(hash);
331
+ this.checkHash(hash);
332
+ this.checkMap(object, property);
333
+ if (this.isLinked(object, property, hash, await this.getStoredValue(object, property)))
334
+ return;
335
+ const pendingUrl = this.getContentUrl(this.pendingKey(object, property, hash));
336
+ const pendingBlob = this.blob(pendingUrl);
337
+ let response;
338
+ try {
339
+ response = await pendingBlob.download();
340
+ }
341
+ catch (error) {
342
+ if (error.statusCode === 404)
343
+ throw new WebdaError.NotFound("No pending upload");
344
+ throw error;
345
+ }
346
+ const chunks = [];
347
+ for await (const chunk of response.readableStreamBody)
348
+ chunks.push(Buffer.from(chunk));
349
+ const pending = JSON.parse(Buffer.concat(chunks).toString());
350
+ if (Date.now() - pending.created > this.parameters.pendingTimeout * 1000)
351
+ throw new WebdaError.PreconditionFailed("Pending upload expired");
352
+ const stagingUrl = this.getContentUrl(pending.stagingKey);
353
+ const head = await this.headContent(stagingUrl);
354
+ if (!head)
355
+ throw new WebdaError.PreconditionFailed("Upload not found");
356
+ const max = this.parameters.maxUploadSize;
357
+ if ((pending.info.size !== undefined && pending.info.size !== head.size) || (max !== undefined && head.size > max))
358
+ throw new WebdaError.BadRequest("Uploaded size does not match");
359
+ const md5 = createHash("md5"), proof = createHash("md5").update("WEBDA");
360
+ const stagingBlob = this.blob(stagingUrl);
361
+ const read = async () => (await stagingBlob.download(0, undefined, { conditions: { ifMatch: head.etag } })).readableStreamBody;
362
+ for await (const chunk of await read()) {
363
+ md5.update(chunk);
364
+ proof.update(chunk);
365
+ }
366
+ const challenge = proof.digest("hex");
367
+ if (md5.digest("hex") !== hash || challenge !== pending.info.challenge)
368
+ throw new WebdaError.BadRequest("Uploaded content does not match the challenge");
369
+ const url = this.getContentUrl(this._getKey(hash));
370
+ try {
371
+ await this.putContent(url, await read(), {
372
+ ifNotExists: true,
373
+ metadata: { ...pending.info.metadata, webdaproof: challenge },
374
+ contentType: pending.info.mimetype,
375
+ contentLength: head.size
376
+ });
377
+ }
378
+ catch (error) {
379
+ if (!(error instanceof ContentExistsError))
380
+ throw error;
381
+ }
382
+ if ((await this.headContent(url))?.metadata?.webdaproof !== challenge)
383
+ throw new WebdaError.Conflict("Stored binary proof does not match");
384
+ await this.attach(object, property, { ...pending.info, hash, size: head.size });
385
+ await pendingBlob.delete({ conditions: { ifMatch: response.etag } });
386
+ await this.deleteContent(stagingUrl);
387
+ }
388
+ /**
389
+ * Perform get usage count.
390
+ * @override
391
+ */
392
+ async getUsageCount(hash) {
393
+ let count = 0;
394
+ for await (const blob of this.client
395
+ .getContainerClient(this.parameters.container)
396
+ .listBlobsFlat({ prefix: this._getKey(hash, "") + "/" })) {
397
+ if (blob.name !== this._getKey(hash))
398
+ count++;
399
+ }
400
+ return count;
401
+ }
402
+ /**
403
+ * Perform _clean usage.
404
+ * @override
405
+ */
406
+ async _cleanUsage(hash, uuid, attribute, model) {
407
+ if (!attribute || !model)
408
+ return;
409
+ await this.deleteContent(this.getContentUrl(this._getKey(hash, this.marker(model, attribute, uuid))));
410
+ if ((await this.getUsageCount(hash)) === 0)
411
+ await this.deleteContent(this.getContentUrl(this._getKey(hash)));
412
+ }
413
+ /**
414
+ * Describe the Azure resources and identity permissions required by this service.
415
+ * @param deployer - Deployment scope and identity helpers
416
+ * @returns The azure resources result
417
+ */
418
+ getAzureResources(deployer) {
419
+ if (!this.parameters.account)
420
+ return {};
421
+ const name = `${this.parameters.account}/default/${this.parameters.container}`;
422
+ const scope = `/subscriptions/${deployer.resources.subscriptionId}/resourceGroups/${deployer.resources.resourceGroup}/providers/Microsoft.Storage/storageAccounts/${this.parameters.account}/blobServices/default/containers/${this.parameters.container}`;
423
+ return {
424
+ resources: [
425
+ {
426
+ type: "Microsoft.Storage/storageAccounts/blobServices/containers",
427
+ apiVersion: "2023-05-01",
428
+ name,
429
+ properties: { publicAccess: "None" }
430
+ }
431
+ ],
432
+ roleAssignments: [
433
+ {
434
+ scope,
435
+ roleDefinitionId: `/subscriptions/${deployer.resources.subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe`
436
+ },
437
+ {
438
+ scope: scope.split("/blobServices/")[0],
439
+ roleDefinitionId: `/subscriptions/${deployer.resources.subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/db58b8e5-c6ad-4a2a-8342-4190687cbf4a`
440
+ }
441
+ ],
442
+ env: { AZURE_STORAGE_ACCOUNT: this.parameters.account }
443
+ };
444
+ }
445
+ }
446
+ /**
447
+ * Parameters
448
+ */
449
+ AzureBlobBinary.Parameters = AzureBlobBinaryParameters;
450
+ //# sourceMappingURL=blob.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blob.service.js","sources":["../../src/services/blob.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,8BAA8B,EAC9B,WAAW,EACX,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIL,WAAW,EACX,qBAAqB,EAGrB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,eAAe,EACf,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,kBAAkB,EAGlB,oBAAoB,EAEpB,eAAe,EACf,UAAU,EACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAA0B,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGxG,sFAAsF;AACtF,MAAM,OAAO,yBAA0B,SAAQ,qBAAqB;IAApE;;QAiCE;;WAEG;QACH,oBAAe,GAAG,KAAK,CAAC;QAGxB;;WAEG;QACH,mBAAc,GAAG,IAAI,CAAC;IAUxB,CAAC;IARC;;;OAGG;IACH,IAAI,CAAC,MAAM,GAAQ,EA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AAU,CAAC,SAAS,EAAE,CAAC;QAC/E,MAAM,KAAK,GAAG,kBAAkB,QAAQ,CAAC,SAAS,CAAC,cAAc,mBAAmB,QAAQ,CAAC,SAAS,CAAC,aAAa,gDAAgD,IAAI,CAAC,UAAU,CAAC,OAAO,oCAAoC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;QAC3P,OAAO;YACL,SAAS,EAAE;gBACT;oBACE,IAAI,EAAE,2DAA2D;oBACjE,UAAU,EAAE,YAAY;oBACxB,IAAI;oBACJ,UAAU,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE;iBACrC;aACF;YACD,eAAe,EAAE;gBACf;oBACE,KAAK;oBACL,gBAAgB,EAAE,kBAAkB,QAAQ,CAAC,SAAS,CAAC,cAAc,yFAAyF;iBAC/J;gBACD;oBACE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;oBACvC,gBAAgB,EAAE,kBAAkB,QAAQ,CAAC,SAAS,CAAC,cAAc,yFAAyF;iBAC/J;aACF;YACD,GAAG,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;SACxD,CAAC;IACJ,CAAC;CACF;AA9bC;;GAEG;AACI,0BAAU,GAAG,yBAAyB,AAA5B,CAA6B"}
@@ -0,0 +1,50 @@
1
+ /** Minimal deployer contract given to contributors, without importing a concrete Azure deployer. */
2
+ export interface AzureDeployerInfo {
3
+ /** Resolved deployment scope and location; other deployer parameters can coexist. */
4
+ resources: {
5
+ resourceGroup: string;
6
+ location: string;
7
+ subscriptionId: string;
8
+ };
9
+ /**
10
+ * Merge deployment tags and resource-specific tags.
11
+ * @param tags - resource-specific tags
12
+ * @returns merged resource tags
13
+ */
14
+ getDefaultTags(tags?: Record<string, string>): Record<string, string>;
15
+ /**
16
+ * Get aRM expression identifying the application's managed identity principal
17
+ * @returns ARM expression identifying the application's managed identity principal
18
+ */
19
+ getAppPrincipalId(): string;
20
+ }
21
+ /** A role that the deployer must grant to the application's managed identity, at the given resource scope. */
22
+ export interface AzureRoleAssignment {
23
+ /** Role definition resource identifier or ARM expression. */
24
+ roleDefinitionId: string;
25
+ /** Resource scope identifier or ARM expression. */
26
+ scope: string;
27
+ }
28
+ /** ARM resources and runtime settings contributed by one application service. */
29
+ export interface AzureResourceContribution {
30
+ /** ARM resource declarations. */
31
+ resources?: Record<string, unknown>[];
32
+ /** Variables for the application and jobs; secret values are references, rather than inline secrets. */
33
+ env?: Record<string, string | {
34
+ secretRef: string;
35
+ }>;
36
+ /** ARM template outputs. */
37
+ outputs?: Record<string, unknown>;
38
+ /** Roles granted to the application's managed identity by the deployer. */
39
+ roleAssignments?: AzureRoleAssignment[];
40
+ }
41
+ /** Allow a service to contribute to an Azure deployment template without depending on its implementation. */
42
+ export interface AzureContributor {
43
+ /**
44
+ * Describe resources, settings and managed-identity roles, without deploying them.
45
+ * @param deployer - current deployment scope and template helpers
46
+ * @returns contribution merged by the deployer
47
+ */
48
+ getAzureResources(deployer: AzureDeployerInfo): AzureResourceContribution;
49
+ }
50
+ //# sourceMappingURL=contributors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contributors.d.ts","sources":["../../src/services/contributors.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,SAAS,EAAE;QACT,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF;;;;OAIG;IACH,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtE;;;OAGG;IACH,iBAAiB,IAAI,MAAM,CAAC;CAC7B;AAED,8GAA8G;AAC9G,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,gBAAgB,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,iFAAiF;AACjF,MAAM,WAAW,yBAAyB;IACxC,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACtC,wGAAwG;IACxG,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,2EAA2E;IAC3E,eAAe,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACzC;AAED,6GAA6G;AAC7G,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,yBAAyB,CAAC;CAC3E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contributors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contributors.js","sources":["../../src/services/contributors.ts"],"names":[],"mappings":""}