@webda/aws 4.0.0-beta.2 → 4.0.0-beta.3

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 (151) hide show
  1. package/README.md +64 -7
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js.map +1 -1
  4. package/lib/services/aws-parameters.d.ts +33 -0
  5. package/lib/services/aws-parameters.d.ts.map +1 -0
  6. package/lib/services/aws-parameters.js +18 -0
  7. package/lib/services/aws-parameters.js.map +1 -0
  8. package/lib/services/awscommands.service.d.ts +39 -0
  9. package/lib/services/awscommands.service.d.ts.map +1 -0
  10. package/lib/services/awscommands.service.js +127 -0
  11. package/lib/services/awscommands.service.js.map +1 -0
  12. package/lib/services/cloudwatchlogger.service.d.ts +131 -0
  13. package/lib/services/cloudwatchlogger.service.d.ts.map +1 -0
  14. package/lib/services/{cloudwatchlogger.js → cloudwatchlogger.service.js} +60 -28
  15. package/lib/services/cloudwatchlogger.service.js.map +1 -0
  16. package/lib/services/contributors.d.ts +37 -0
  17. package/lib/services/contributors.d.ts.map +1 -0
  18. package/lib/services/contributors.js +2 -0
  19. package/lib/services/contributors.js.map +1 -0
  20. package/lib/services/dynamodb.service.d.ts +297 -0
  21. package/lib/services/dynamodb.service.d.ts.map +1 -0
  22. package/lib/services/dynamodb.service.js +985 -0
  23. package/lib/services/dynamodb.service.js.map +1 -0
  24. package/lib/services/index.d.ts +11 -31
  25. package/lib/services/index.d.ts.map +1 -1
  26. package/lib/services/index.js +11 -8
  27. package/lib/services/index.js.map +1 -1
  28. package/lib/services/lambdacaller.service.d.ts +81 -0
  29. package/lib/services/lambdacaller.service.d.ts.map +1 -0
  30. package/lib/services/lambdacaller.service.js +75 -0
  31. package/lib/services/lambdacaller.service.js.map +1 -0
  32. package/lib/services/lambdaserver.service.d.ts +127 -0
  33. package/lib/services/lambdaserver.service.d.ts.map +1 -0
  34. package/lib/services/lambdaserver.service.js +294 -0
  35. package/lib/services/lambdaserver.service.js.map +1 -0
  36. package/lib/services/{route53.d.ts → route53.service.d.ts} +21 -12
  37. package/lib/services/route53.service.d.ts.map +1 -0
  38. package/lib/services/{route53.js → route53.service.js} +25 -28
  39. package/lib/services/route53.service.js.map +1 -0
  40. package/lib/services/s3binary.service.d.ts +215 -0
  41. package/lib/services/s3binary.service.d.ts.map +1 -0
  42. package/lib/services/{s3binary.js → s3binary.service.js} +93 -55
  43. package/lib/services/s3binary.service.js.map +1 -0
  44. package/lib/services/secretsmanager.service.d.ts +102 -0
  45. package/lib/services/secretsmanager.service.d.ts.map +1 -0
  46. package/lib/services/{secretsmanager.js → secretsmanager.service.js} +40 -22
  47. package/lib/services/secretsmanager.service.js.map +1 -0
  48. package/lib/services/{sqsqueue.d.ts → sqsqueue.service.d.ts} +60 -35
  49. package/lib/services/sqsqueue.service.d.ts.map +1 -0
  50. package/lib/services/{sqsqueue.js → sqsqueue.service.js} +53 -28
  51. package/lib/services/sqsqueue.service.js.map +1 -0
  52. package/package.json +58 -63
  53. package/webda.module.json +743 -280
  54. package/lib/deployers/cloudformation.d.ts +0 -317
  55. package/lib/deployers/cloudformation.d.ts.map +0 -1
  56. package/lib/deployers/cloudformation.js +0 -837
  57. package/lib/deployers/cloudformation.js.map +0 -1
  58. package/lib/deployers/cloudformation.spec.d.ts +0 -2
  59. package/lib/deployers/cloudformation.spec.d.ts.map +0 -1
  60. package/lib/deployers/cloudformation.spec.js +0 -530
  61. package/lib/deployers/cloudformation.spec.js.map +0 -1
  62. package/lib/deployers/index.d.ts +0 -255
  63. package/lib/deployers/index.d.ts.map +0 -1
  64. package/lib/deployers/index.js +0 -543
  65. package/lib/deployers/index.js.map +0 -1
  66. package/lib/deployers/index.spec.d.ts +0 -9
  67. package/lib/deployers/index.spec.d.ts.map +0 -1
  68. package/lib/deployers/index.spec.js +0 -595
  69. package/lib/deployers/index.spec.js.map +0 -1
  70. package/lib/deployers/lambda-entrypoint.d.ts +0 -2
  71. package/lib/deployers/lambda-entrypoint.d.ts.map +0 -1
  72. package/lib/deployers/lambda-entrypoint.js +0 -13
  73. package/lib/deployers/lambda-entrypoint.js.map +0 -1
  74. package/lib/deployers/lambdapackager.d.ts +0 -28
  75. package/lib/deployers/lambdapackager.d.ts.map +0 -1
  76. package/lib/deployers/lambdapackager.js +0 -26
  77. package/lib/deployers/lambdapackager.js.map +0 -1
  78. package/lib/deployers/lambdapackager.spec.d.ts +0 -2
  79. package/lib/deployers/lambdapackager.spec.d.ts.map +0 -1
  80. package/lib/deployers/lambdapackager.spec.js +0 -44
  81. package/lib/deployers/lambdapackager.spec.js.map +0 -1
  82. package/lib/index.spec.d.ts +0 -11
  83. package/lib/index.spec.d.ts.map +0 -1
  84. package/lib/index.spec.js +0 -42
  85. package/lib/index.spec.js.map +0 -1
  86. package/lib/services/aws-mixin.d.ts +0 -25
  87. package/lib/services/aws-mixin.d.ts.map +0 -1
  88. package/lib/services/aws-mixin.js +0 -18
  89. package/lib/services/aws-mixin.js.map +0 -1
  90. package/lib/services/cloudwatchlogger.d.ts +0 -82
  91. package/lib/services/cloudwatchlogger.d.ts.map +0 -1
  92. package/lib/services/cloudwatchlogger.js.map +0 -1
  93. package/lib/services/cloudwatchlogger.spec.d.ts +0 -2
  94. package/lib/services/cloudwatchlogger.spec.d.ts.map +0 -1
  95. package/lib/services/cloudwatchlogger.spec.js +0 -104
  96. package/lib/services/cloudwatchlogger.spec.js.map +0 -1
  97. package/lib/services/dynamodb.d.ts +0 -174
  98. package/lib/services/dynamodb.d.ts.map +0 -1
  99. package/lib/services/dynamodb.js +0 -711
  100. package/lib/services/dynamodb.js.map +0 -1
  101. package/lib/services/dynamodb.spec.d.ts +0 -24
  102. package/lib/services/dynamodb.spec.d.ts.map +0 -1
  103. package/lib/services/dynamodb.spec.js +0 -344
  104. package/lib/services/dynamodb.spec.js.map +0 -1
  105. package/lib/services/lambdacaller.d.ts +0 -69
  106. package/lib/services/lambdacaller.d.ts.map +0 -1
  107. package/lib/services/lambdacaller.js +0 -63
  108. package/lib/services/lambdacaller.js.map +0 -1
  109. package/lib/services/lambdacaller.spec.d.ts +0 -2
  110. package/lib/services/lambdacaller.spec.d.ts.map +0 -1
  111. package/lib/services/lambdacaller.spec.js +0 -70
  112. package/lib/services/lambdacaller.spec.js.map +0 -1
  113. package/lib/services/lambdaserver.d.ts +0 -87
  114. package/lib/services/lambdaserver.d.ts.map +0 -1
  115. package/lib/services/lambdaserver.js +0 -263
  116. package/lib/services/lambdaserver.js.map +0 -1
  117. package/lib/services/lambdaserver.spec.d.ts +0 -2
  118. package/lib/services/lambdaserver.spec.d.ts.map +0 -1
  119. package/lib/services/lambdaserver.spec.js +0 -417
  120. package/lib/services/lambdaserver.spec.js.map +0 -1
  121. package/lib/services/route53.d.ts.map +0 -1
  122. package/lib/services/route53.js.map +0 -1
  123. package/lib/services/route53.spec.d.ts +0 -2
  124. package/lib/services/route53.spec.d.ts.map +0 -1
  125. package/lib/services/route53.spec.js +0 -102
  126. package/lib/services/route53.spec.js.map +0 -1
  127. package/lib/services/s3binary.d.ts +0 -163
  128. package/lib/services/s3binary.d.ts.map +0 -1
  129. package/lib/services/s3binary.js.map +0 -1
  130. package/lib/services/s3binary.spec.d.ts +0 -2
  131. package/lib/services/s3binary.spec.d.ts.map +0 -1
  132. package/lib/services/s3binary.spec.js +0 -284
  133. package/lib/services/s3binary.spec.js.map +0 -1
  134. package/lib/services/secretsmanager.d.ts +0 -81
  135. package/lib/services/secretsmanager.d.ts.map +0 -1
  136. package/lib/services/secretsmanager.js.map +0 -1
  137. package/lib/services/secretsmanager.spec.d.ts +0 -2
  138. package/lib/services/secretsmanager.spec.d.ts.map +0 -1
  139. package/lib/services/secretsmanager.spec.js +0 -66
  140. package/lib/services/secretsmanager.spec.js.map +0 -1
  141. package/lib/services/sqsqueue.d.ts.map +0 -1
  142. package/lib/services/sqsqueue.js.map +0 -1
  143. package/lib/services/sqsqueue.spec.d.ts +0 -2
  144. package/lib/services/sqsqueue.spec.d.ts.map +0 -1
  145. package/lib/services/sqsqueue.spec.js +0 -157
  146. package/lib/services/sqsqueue.spec.js.map +0 -1
  147. package/lib/shell.d.ts +0 -13
  148. package/lib/shell.d.ts.map +0 -1
  149. package/lib/shell.js +0 -42
  150. package/lib/shell.js.map +0 -1
  151. package/webda.shell.json +0 -11
package/README.md CHANGED
@@ -13,13 +13,70 @@ This module is part of Webda Application Framework that allows you to quickly de
13
13
 
14
14
  <!-- README_HEADER -->
15
15
 
16
- ## Summary
17
-
18
- This module allows you to use DynamoDB Store, SQS, CloudWatchLogger and SecretsManager
19
-
20
- ## Lambda Entrypoint
21
-
22
- You can add the request id to the http header response by specifying `parameters.lambdaRequestHeader`
16
+ # @webda/aws
17
+
18
+ > AWS integration bundle for Webda — DynamoDB Store, S3 Binary, SQS Queue, CloudWatch Logger, Secrets Manager, Lambda server, Route53, and Lambda/CloudFormation deployers in one package.
19
+
20
+ ## When to use it
21
+
22
+ - You are deploying a Webda application on AWS (Lambda or EC2/ECS) and need cloud-native backing services.
23
+ - You want to swap out `MemoryStore` / `MemoryQueue` / `FileBinary` with AWS-managed equivalents for production.
24
+ - You need to deploy your application as a Lambda function or manage infrastructure via CloudFormation.
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ pnpm add @webda/aws
30
+ ```
31
+
32
+ ## What's inside
33
+
34
+ ### Runtime services
35
+
36
+ - `DynamoStore` — DynamoDB-backed Store for any Webda model ([source](./src/services/dynamodb.ts))
37
+ - `S3Binary` — S3-backed Binary service for file uploads and downloads ([source](./src/services/s3binary.ts))
38
+ - `SQSQueue` — SQS-backed Queue for durable task queuing ([source](./src/services/sqsqueue.ts))
39
+ - `CloudWatchLogger` — Streams application logs to CloudWatch Logs ([source](./src/services/cloudwatchlogger.ts))
40
+ - `SecretsManager` — Resolves configuration parameters from AWS Secrets Manager ([source](./src/services/secretsmanager.ts))
41
+ - `Route53` — DNS record management via Route53 ([source](./src/services/route53.ts))
42
+ - `LambdaServer` — Adapts incoming Lambda events to Webda's HTTP context ([source](./src/services/lambdaserver.ts))
43
+ - `LambdaCaller` — Invokes other Lambda functions as service calls ([source](./src/services/lambdacaller.ts))
44
+
45
+ ### Deployers (shell/build-time)
46
+
47
+ - `LambdaDeployer` — Packages and deploys the application as an AWS Lambda function ([source](./src/deployers/lambda-entrypoint.ts))
48
+ - `CloudFormationDeployer` — Full infrastructure deployment via AWS CloudFormation ([source](./src/deployers/cloudformation.ts))
49
+ - `LambdaPackager` — Bundles the application for Lambda deployment ([source](./src/deployers/lambdapackager.ts))
50
+
51
+ ## Quick config example
52
+
53
+ ```json
54
+ {
55
+ "services": {
56
+ "userStore": {
57
+ "type": "DynamoStore",
58
+ "model": "MyApp/User",
59
+ "table": "my-app-users",
60
+ "region": "us-east-1"
61
+ },
62
+ "uploadBucket": {
63
+ "type": "S3Binary",
64
+ "bucket": "my-app-uploads",
65
+ "region": "us-east-1"
66
+ },
67
+ "taskQueue": {
68
+ "type": "SQSQueue",
69
+ "queue": "https://sqs.us-east-1.amazonaws.com/123456789/my-tasks"
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ ## Reference
76
+
77
+ - API reference: see the auto-generated typedoc at `docs/pages/Modules/aws/`.
78
+ - Source: [`packages/aws`](https://github.com/loopingz/webda.io/tree/main/packages/aws)
79
+ - Related: [`@webda/core`](../core) for Store, Queue, and Binary base classes; [`@webda/async`](../async) for job orchestration using SQSQueue.
23
80
 
24
81
  <!-- README_FOOTER -->
25
82
  ## Sponsors
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * AWS client parameters shared by the AWS services
3
+ *
4
+ * Each service parameters class declares these fields and calls
5
+ * {@link loadAWSParameters} from its `load()` override
6
+ */
7
+ export interface AWSServiceParameters {
8
+ /**
9
+ * Custom endpoint (localstack, minio, ...)
10
+ */
11
+ endpoint?: string;
12
+ /**
13
+ * Static credentials, default to the AWS environment variables
14
+ */
15
+ credentials?: {
16
+ accessKeyId: string;
17
+ secretAccessKey: string;
18
+ sessionToken?: string;
19
+ };
20
+ /**
21
+ * AWS region
22
+ * @default "us-east-1"
23
+ */
24
+ region?: string;
25
+ }
26
+ /**
27
+ * Default the region and credentials from the AWS environment variables
28
+ *
29
+ * @param params - the parameters to complete
30
+ * @returns the parameters
31
+ */
32
+ export declare function loadAWSParameters<T extends AWSServiceParameters>(params: T): T;
33
+ //# sourceMappingURL=aws-parameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-parameters.d.ts","sourceRoot":"","sources":["../../src/services/aws-parameters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,oBAAoB,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAU9E"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Default the region and credentials from the AWS environment variables
3
+ *
4
+ * @param params - the parameters to complete
5
+ * @returns the parameters
6
+ */
7
+ export function loadAWSParameters(params) {
8
+ params.region ?? (params.region = process.env["AWS_DEFAULT_REGION"] || "us-east-1");
9
+ if (process.env["AWS_ACCESS_KEY_ID"] && process.env["AWS_SECRET_ACCESS_KEY"] && !process.env["ECS_CLUSTER"]) {
10
+ params.credentials ?? (params.credentials = {
11
+ accessKeyId: process.env["AWS_ACCESS_KEY_ID"],
12
+ secretAccessKey: process.env["AWS_SECRET_ACCESS_KEY"],
13
+ sessionToken: process.env["AWS_SESSION_TOKEN"]
14
+ });
15
+ }
16
+ return params;
17
+ }
18
+ //# sourceMappingURL=aws-parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-parameters.js","sourceRoot":"","sources":["../../src/services/aws-parameters.ts"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAiC,MAAS;IACzE,MAAM,CAAC,MAAM,KAAb,MAAM,CAAC,MAAM,GAAK,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,WAAW,EAAC;IACnE,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;QAC5G,MAAM,CAAC,WAAW,KAAlB,MAAM,CAAC,WAAW,GAAK;YACrB,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;YAC7C,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;YACrD,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;SAC/C,EAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { Service } from "@webda/core";
2
+ /**
3
+ * AWS command line utilities
4
+ *
5
+ * Exposes the `webda aws route53 export|import|sync` and `webda aws copyTable` commands
6
+ *
7
+ * @WebdaModda
8
+ */
9
+ export declare class AWSCommands extends Service {
10
+ /**
11
+ * Export a Route53 domain to a file
12
+ *
13
+ * @param domain - the domain to export
14
+ * @param file - the file to export to (.json or .yml)
15
+ */
16
+ route53Export(domain: string, file: string): Promise<void>;
17
+ /**
18
+ * Import a Route53 exported file to Route53
19
+ *
20
+ * @param file - the exported file
21
+ */
22
+ route53Import(file: string): Promise<void>;
23
+ /**
24
+ * Sync a Route53 exported file to Route53, removing any other entries
25
+ *
26
+ * @param file - the exported file
27
+ * @param pretend - only display the entries that would be removed
28
+ */
29
+ route53Sync(file: string, pretend?: boolean): Promise<void>;
30
+ /**
31
+ * Copy all items of a DynamoDB table into another one
32
+ *
33
+ * @param sourceTable - the table to copy from
34
+ * @param targetTable - the table to copy to
35
+ */
36
+ copyTable(sourceTable: string, targetTable: string): Promise<void>;
37
+ }
38
+ export default AWSCommands;
39
+ //# sourceMappingURL=awscommands.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awscommands.service.d.ts","sourceRoot":"","sources":["../../src/services/awscommands.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,OAAO,EAAE,MAAM,aAAa,CAAC;AAK/C;;;;;;GAMG;AACH,qBAAa,WAAY,SAAQ,OAAO;IACtC;;;;;OAKG;IAMG,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;IAED;;;;OAIG;IAMG,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;IAED;;;;;OAKG;IAMG,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE;IAED;;;;;OAKG;IAMG,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE;CACF;eAEc,WAAW"}
@@ -0,0 +1,127 @@
1
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
2
+ var useValue = arguments.length > 2;
3
+ for (var i = 0; i < initializers.length; i++) {
4
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
5
+ }
6
+ return useValue ? value : void 0;
7
+ };
8
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
9
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
10
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
11
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
12
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13
+ var _, done = false;
14
+ for (var i = decorators.length - 1; i >= 0; i--) {
15
+ var context = {};
16
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
17
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
18
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
19
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
20
+ if (kind === "accessor") {
21
+ if (result === void 0) continue;
22
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
23
+ if (_ = accept(result.get)) descriptor.get = _;
24
+ if (_ = accept(result.set)) descriptor.set = _;
25
+ if (_ = accept(result.init)) initializers.unshift(_);
26
+ }
27
+ else if (_ = accept(result)) {
28
+ if (kind === "field") initializers.unshift(_);
29
+ else descriptor[key] = _;
30
+ }
31
+ }
32
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
33
+ done = true;
34
+ };
35
+ import { Command, Service } from "@webda/core";
36
+ import { useWorkerOutput } from "@webda/workout";
37
+ import { DynamoStore } from "./dynamodb.service.js";
38
+ import { Route53Service } from "./route53.service.js";
39
+ /**
40
+ * AWS command line utilities
41
+ *
42
+ * Exposes the `webda aws route53 export|import|sync` and `webda aws copyTable` commands
43
+ *
44
+ * @WebdaModda
45
+ */
46
+ let AWSCommands = (() => {
47
+ var _a;
48
+ let _classSuper = Service;
49
+ let _instanceExtraInitializers = [];
50
+ let _route53Export_decorators;
51
+ let _route53Import_decorators;
52
+ let _route53Sync_decorators;
53
+ let _copyTable_decorators;
54
+ return _a = class AWSCommands extends _classSuper {
55
+ /**
56
+ * Export a Route53 domain to a file
57
+ *
58
+ * @param domain - the domain to export
59
+ * @param file - the file to export to (.json or .yml)
60
+ */
61
+ async route53Export(domain, file) {
62
+ await Route53Service.export(domain, file);
63
+ }
64
+ /**
65
+ * Import a Route53 exported file to Route53
66
+ *
67
+ * @param file - the exported file
68
+ */
69
+ async route53Import(file) {
70
+ await Route53Service.import({ file }, this.log.bind(this));
71
+ }
72
+ /**
73
+ * Sync a Route53 exported file to Route53, removing any other entries
74
+ *
75
+ * @param file - the exported file
76
+ * @param pretend - only display the entries that would be removed
77
+ */
78
+ async route53Sync(file, pretend = false) {
79
+ await Route53Service.import({ file, pretend, sync: true }, this.log.bind(this));
80
+ }
81
+ /**
82
+ * Copy all items of a DynamoDB table into another one
83
+ *
84
+ * @param sourceTable - the table to copy from
85
+ * @param targetTable - the table to copy to
86
+ */
87
+ async copyTable(sourceTable, targetTable) {
88
+ await DynamoStore.copyTable(useWorkerOutput(), sourceTable, targetTable);
89
+ }
90
+ constructor() {
91
+ super(...arguments);
92
+ __runInitializers(this, _instanceExtraInitializers);
93
+ }
94
+ },
95
+ (() => {
96
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
97
+ _route53Export_decorators = [Command("aws route53 export", {
98
+ description: "Export a Route53 domain to a json file",
99
+ requires: ["aws-commands"],
100
+ phase: "resolved"
101
+ })];
102
+ _route53Import_decorators = [Command("aws route53 import", {
103
+ description: "Import a Route53 exported format to Route53",
104
+ requires: ["aws-commands"],
105
+ phase: "resolved"
106
+ })];
107
+ _route53Sync_decorators = [Command("aws route53 sync", {
108
+ description: "Sync a Route53 exported format to Route53 (remove all others entries)",
109
+ requires: ["aws-commands"],
110
+ phase: "resolved"
111
+ })];
112
+ _copyTable_decorators = [Command("aws copyTable", {
113
+ description: "Copy a DynamoDB table content to another table",
114
+ requires: ["aws-commands"],
115
+ phase: "resolved"
116
+ })];
117
+ __esDecorate(_a, null, _route53Export_decorators, { kind: "method", name: "route53Export", static: false, private: false, access: { has: obj => "route53Export" in obj, get: obj => obj.route53Export }, metadata: _metadata }, null, _instanceExtraInitializers);
118
+ __esDecorate(_a, null, _route53Import_decorators, { kind: "method", name: "route53Import", static: false, private: false, access: { has: obj => "route53Import" in obj, get: obj => obj.route53Import }, metadata: _metadata }, null, _instanceExtraInitializers);
119
+ __esDecorate(_a, null, _route53Sync_decorators, { kind: "method", name: "route53Sync", static: false, private: false, access: { has: obj => "route53Sync" in obj, get: obj => obj.route53Sync }, metadata: _metadata }, null, _instanceExtraInitializers);
120
+ __esDecorate(_a, null, _copyTable_decorators, { kind: "method", name: "copyTable", static: false, private: false, access: { has: obj => "copyTable" in obj, get: obj => obj.copyTable }, metadata: _metadata }, null, _instanceExtraInitializers);
121
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
122
+ })(),
123
+ _a;
124
+ })();
125
+ export { AWSCommands };
126
+ export default AWSCommands;
127
+ //# sourceMappingURL=awscommands.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awscommands.service.js","sourceRoot":"","sources":["../../src/services/awscommands.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAA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AE,uEAAuE;oBACpF,QAAQ,EAAE,CAAC,cAAc,CAAC;oBAC1B,KAAK,EAAE,UAAU;iBAClB,CAAC;qCAWD,OAAO,CAAC,eAAe,EAAE;oBACxB,WAAW,EAAE,gDAAgD;oBAC7D,QAAQ,EAAE,CAAC,cAAc,CAAC;oBAC1B,KAAK,EAAE,UAAU;iBAClB,CAAC;YA3CF,wLAAM,aAAa,6DAElB;YAYD,wLAAM,aAAa,6DAElB;YAaD,kLAAM,WAAW,6DAEhB;YAaD,4KAAM,SAAS,6DAEd;;;;;SA1DU,WAAW;AA6DxB,eAAe,WAAW,CAAC"}
@@ -0,0 +1,131 @@
1
+ import { CloudWatchLogs } from "@aws-sdk/client-cloudwatch-logs";
2
+ import { Service, ServiceParameters } from "@webda/core";
3
+ import { WorkerLogLevel, WorkerMessage } from "@webda/workout";
4
+ import { AWSServiceParameters } from "./aws-parameters.js";
5
+ import type { CloudFormationContributor } from "./contributors.js";
6
+ /**
7
+ * Send webda log to CloudWatch
8
+ */
9
+ export declare class CloudWatchLoggerParameters extends ServiceParameters implements AWSServiceParameters {
10
+ /**
11
+ * Custom endpoint (localstack, minio, ...)
12
+ */
13
+ endpoint?: string;
14
+ /**
15
+ * Static credentials, default to the AWS environment variables
16
+ */
17
+ credentials?: {
18
+ accessKeyId: string;
19
+ secretAccessKey: string;
20
+ sessionToken?: string;
21
+ };
22
+ /**
23
+ * AWS region
24
+ * @default "us-east-1"
25
+ */
26
+ region?: string;
27
+ /**
28
+ * logGroupName to send logStream to
29
+ */
30
+ logGroupName: string;
31
+ /**
32
+ * Prefix of the log stream name, a random uuid is appended
33
+ */
34
+ logStreamNamePrefix?: string;
35
+ /**
36
+ * KMS key to use when creating the log group
37
+ */
38
+ kmsKeyId?: string;
39
+ /**
40
+ * Tags to add when creating the log group
41
+ */
42
+ tags?: any;
43
+ /**
44
+ * Minimum level of logs to send
45
+ * @default "INFO"
46
+ */
47
+ logLevel?: WorkerLogLevel;
48
+ /**
49
+ * Send each log line as soon as it is produced
50
+ */
51
+ singlePush?: boolean;
52
+ /**
53
+ * CloudFormation customization
54
+ */
55
+ CloudFormation?: any;
56
+ /**
57
+ * Skip CloudFormation on deploy
58
+ */
59
+ CloudFormationSkip?: boolean;
60
+ /**
61
+ * @override
62
+ * @param params - raw parameters
63
+ * @returns this
64
+ */
65
+ load(params?: any): this;
66
+ }
67
+ /**
68
+ * Output log to a CloudWatch Stream
69
+ *
70
+ * @WebdaModda
71
+ */
72
+ export declare class CloudWatchLogger<T extends CloudWatchLoggerParameters = CloudWatchLoggerParameters> extends Service<T> implements CloudFormationContributor {
73
+ _logGroupName: string;
74
+ _logStreamName: string;
75
+ _seqToken: string;
76
+ _logStream: any;
77
+ _cloudwatch: CloudWatchLogs;
78
+ _bufferedLogs: any[];
79
+ /**
80
+ * Listener on the worker output
81
+ */
82
+ protected messageListener: (msg: WorkerMessage) => void;
83
+ /**
84
+ * Unsubscribe from the Webda.Result core event
85
+ */
86
+ protected resultListenerOff: () => void;
87
+ /**
88
+ * Create the log group and stream, then forward the logs
89
+ * @returns this
90
+ */
91
+ init(): Promise<this>;
92
+ /**
93
+ * Remove the log and result listeners
94
+ */
95
+ protected removeListeners(): void;
96
+ /**
97
+ * Flush the logs and stop forwarding
98
+ * @override
99
+ */
100
+ stop(): Promise<void>;
101
+ /**
102
+ * Send logs to CloudWatch
103
+ *
104
+ * @param copy - send a copy of the buffer and reset it before sending
105
+ */
106
+ sendLogs(copy?: boolean): Promise<void>;
107
+ /**
108
+ * Buffer a log line
109
+ * @param level - log level
110
+ * @param args - log arguments
111
+ */
112
+ _log(level: WorkerLogLevel, ...args: any[]): void;
113
+ /**
114
+ * IAM policy required by the service
115
+ * @param accountId - AWS account id
116
+ * @returns the policy statement
117
+ */
118
+ getARNPolicy(accountId: string): {
119
+ Sid: string;
120
+ Effect: string;
121
+ Action: string[];
122
+ Resource: string[];
123
+ };
124
+ /**
125
+ * CloudFormation resources for the log group
126
+ * @returns the resources
127
+ */
128
+ getCloudFormation(): {};
129
+ }
130
+ export default CloudWatchLogger;
131
+ //# sourceMappingURL=cloudwatchlogger.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudwatchlogger.service.d.ts","sourceRoot":"","sources":["../../src/services/cloudwatchlogger.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAiB,MAAM,aAAa,CAAC;AACxE,OAAO,EAA8B,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE3F,OAAO,EAAE,oBAAoB,EAAqB,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,iBAAkB,YAAW,oBAAoB;IAC/F;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtF;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC;IACX;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAE,GAAQ,GAAG,IAAI,CAK3B;CACF;AAED;;;;GAIG;AACH,qBAAa,gBAAgB,CAAC,CAAC,SAAS,0BAA0B,GAAG,0BAA0B,CAC7F,SAAQ,OAAO,CAAC,CAAC,CACjB,YAAW,yBAAyB;IAEpC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,GAAG,CAAC;IAChB,WAAW,EAAE,cAAc,CAAC;IAC5B,aAAa,EAAE,GAAG,EAAE,CAAM;IAC1B;;OAEG;IACH,SAAS,CAAC,eAAe,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;IACxD;;OAEG;IACH,SAAS,CAAC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAExC;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAkC1B;IAED;;OAEG;IACH,SAAS,CAAC,eAAe,SAOxB;IAED;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAI1B;IAED;;;;OAIG;IACG,QAAQ,CAAC,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBnD;IAED;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAUhD;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM;QAG1B,GAAG;QACH,MAAM;QACN,MAAM;QACN,QAAQ;MAKX;IAED;;;OAGG;IACH,iBAAiB,OAehB;CACF;eAEc,gBAAgB"}
@@ -1,33 +1,37 @@
1
1
  import { CloudWatchLogs } from "@aws-sdk/client-cloudwatch-logs";
2
- import { Service, ServiceParameters } from "@webda/core";
3
- import { LogFilter } from "@webda/workout";
4
- import { AWSServiceParameters } from "./aws-mixin.js";
5
- import { randomUUID } from "crypto";
2
+ import { Service, ServiceParameters, useCoreEvents } from "@webda/core";
3
+ import { LogFilter, useWorkerOutput } from "@webda/workout";
4
+ import { randomUUID } from "node:crypto";
5
+ import { loadAWSParameters } from "./aws-parameters.js";
6
6
  /**
7
7
  * Send webda log to CloudWatch
8
8
  */
9
- export class CloudWatchLoggerParameters extends AWSServiceParameters(ServiceParameters) {
9
+ export class CloudWatchLoggerParameters extends ServiceParameters {
10
+ /**
11
+ * @override
12
+ * @param params - raw parameters
13
+ * @returns this
14
+ */
15
+ load(params = {}) {
16
+ super.load(params);
17
+ loadAWSParameters(this);
18
+ this.logLevel ?? (this.logLevel = "INFO");
19
+ return this;
20
+ }
10
21
  }
11
22
  /**
12
23
  * Output log to a CloudWatch Stream
13
24
  *
14
25
  * @WebdaModda
15
26
  */
16
- export default class CloudWatchLogger extends Service {
27
+ export class CloudWatchLogger extends Service {
17
28
  constructor() {
18
29
  super(...arguments);
19
30
  this._bufferedLogs = [];
20
31
  }
21
32
  /**
22
- * Load the parameters
23
- *
24
- * @param params
25
- */
26
- loadParameters(params) {
27
- return new CloudWatchLoggerParameters(params);
28
- }
29
- /**
30
- * @inheritdoc
33
+ * Create the log group and stream, then forward the logs
34
+ * @returns this
31
35
  */
32
36
  async init() {
33
37
  await super.init();
@@ -51,22 +55,43 @@ export default class CloudWatchLogger extends Service {
51
55
  logGroupName: this._logGroupName,
52
56
  logStreamName: this._logStreamName
53
57
  });
54
- this._webda.getWorkerOutput().on("message", (msg) => {
58
+ this.removeListeners();
59
+ this.messageListener = (msg) => {
55
60
  if (msg.type !== "log") {
56
61
  return;
57
62
  }
58
63
  if (LogFilter(msg.log.level, this.parameters.logLevel)) {
59
64
  this._log(msg.log.level, ...msg.log.args);
60
65
  }
61
- });
62
- this._webda.on("Webda.Result", this.sendLogs.bind(this));
66
+ };
67
+ useWorkerOutput().on("message", this.messageListener);
68
+ this.resultListenerOff = useCoreEvents("Webda.Result", () => this.sendLogs());
63
69
  return this;
64
70
  }
71
+ /**
72
+ * Remove the log and result listeners
73
+ */
74
+ removeListeners() {
75
+ if (this.messageListener) {
76
+ useWorkerOutput().off("message", this.messageListener);
77
+ this.messageListener = undefined;
78
+ }
79
+ this.resultListenerOff?.();
80
+ this.resultListenerOff = undefined;
81
+ }
82
+ /**
83
+ * Flush the logs and stop forwarding
84
+ * @override
85
+ */
86
+ async stop() {
87
+ this.removeListeners();
88
+ await this.sendLogs();
89
+ await super.stop();
90
+ }
65
91
  /**
66
92
  * Send logs to CloudWatch
67
93
  *
68
- * @param copy
69
- * @returns
94
+ * @param copy - send a copy of the buffer and reset it before sending
70
95
  */
71
96
  async sendLogs(copy = false) {
72
97
  if (!this._bufferedLogs.length) {
@@ -93,7 +118,9 @@ export default class CloudWatchLogger extends Service {
93
118
  }
94
119
  }
95
120
  /**
96
- * @inheritdoc
121
+ * Buffer a log line
122
+ * @param level - log level
123
+ * @param args - log arguments
97
124
  */
98
125
  _log(level, ...args) {
99
126
  this._bufferedLogs.push({
@@ -101,16 +128,20 @@ export default class CloudWatchLogger extends Service {
101
128
  timestamp: new Date().getTime()
102
129
  });
103
130
  if (this.parameters.singlePush) {
104
- this.sendLogs(true);
131
+ this.sendLogs(true).catch(() => {
132
+ // Ignore send errors to avoid logging loops
133
+ });
105
134
  }
106
135
  }
107
136
  /**
108
- * @inheritdoc
137
+ * IAM policy required by the service
138
+ * @param accountId - AWS account id
139
+ * @returns the policy statement
109
140
  */
110
141
  getARNPolicy(accountId) {
111
142
  const region = this.parameters.region || "us-east-1";
112
143
  return {
113
- Sid: this.constructor.name + this._name,
144
+ Sid: this.constructor.name + this.getName(),
114
145
  Effect: "Allow",
115
146
  Action: ["logs:*"],
116
147
  Resource: [
@@ -120,7 +151,8 @@ export default class CloudWatchLogger extends Service {
120
151
  };
121
152
  }
122
153
  /**
123
- * @inheritdoc
154
+ * CloudFormation resources for the log group
155
+ * @returns the resources
124
156
  */
125
157
  getCloudFormation() {
126
158
  if (this.parameters.CloudFormationSkip) {
@@ -128,7 +160,7 @@ export default class CloudWatchLogger extends Service {
128
160
  }
129
161
  const resources = {};
130
162
  this.parameters.CloudFormation = this.parameters.CloudFormation || {};
131
- resources[this._name + "LogGroup"] = {
163
+ resources[this.getName() + "LogGroup"] = {
132
164
  Type: "AWS::Logs::LogGroup",
133
165
  Properties: {
134
166
  ...this.parameters.CloudFormation.LogGroup,
@@ -139,5 +171,5 @@ export default class CloudWatchLogger extends Service {
139
171
  return resources;
140
172
  }
141
173
  }
142
- export { CloudWatchLogger };
143
- //# sourceMappingURL=cloudwatchlogger.js.map
174
+ export default CloudWatchLogger;
175
+ //# sourceMappingURL=cloudwatchlogger.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudwatchlogger.service.js","sourceRoot":"","sources":["../../src/services/cloudwatchlogger.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAiC,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAwB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG9E;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAiD/D;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAQ,EAAE;QACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,QAAQ,KAAb,IAAI,CAAC,QAAQ,GAAK,MAAM,EAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,gBACX,SAAQ,OAAU;IADpB;;QASE,kBAAa,GAAU,EAAE,CAAC;IA4J5B,CAAC;IAlJC;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,KAAK,CAAC,IAAI,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