@kensio/yulin 1.20.5 → 1.20.7

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 (129) hide show
  1. package/dist/service/aws/factory/sim-aws-logs-collaborators.d.ts +6 -0
  2. package/dist/service/aws/factory/sim-aws-logs-collaborators.d.ts.map +1 -1
  3. package/dist/service/aws/factory/sim-aws-logs-collaborators.js +9 -0
  4. package/dist/service/aws/factory/sim-aws-logs-collaborators.js.map +1 -1
  5. package/dist/service/cloudformation/resource/sim-cfn-resource-record.d.ts.map +1 -1
  6. package/dist/service/cloudformation/resource/sim-cfn-resource-record.js +9 -0
  7. package/dist/service/cloudformation/resource/sim-cfn-resource-record.js.map +1 -1
  8. package/dist/service/logs/command/delivery/sim-logs-delivery-source-commands.d.ts +5 -1
  9. package/dist/service/logs/command/delivery/sim-logs-delivery-source-commands.d.ts.map +1 -1
  10. package/dist/service/logs/command/delivery/sim-logs-delivery-source-commands.js +10 -1
  11. package/dist/service/logs/command/delivery/sim-logs-delivery-source-commands.js.map +1 -1
  12. package/dist/service/logs/delivery/cloudfront/sim-aws-logs-delivery-distributions.d.ts +34 -0
  13. package/dist/service/logs/delivery/cloudfront/sim-aws-logs-delivery-distributions.d.ts.map +1 -0
  14. package/dist/service/logs/delivery/cloudfront/sim-aws-logs-delivery-distributions.js +54 -0
  15. package/dist/service/logs/delivery/cloudfront/sim-aws-logs-delivery-distributions.js.map +1 -0
  16. package/dist/service/logs/delivery/sim-logs-delivery-source-resources.d.ts +28 -0
  17. package/dist/service/logs/delivery/sim-logs-delivery-source-resources.d.ts.map +1 -0
  18. package/dist/service/logs/delivery/sim-logs-delivery-source-resources.js +14 -0
  19. package/dist/service/logs/delivery/sim-logs-delivery-source-resources.js.map +1 -0
  20. package/dist/service/logs/sim-logs-commands.d.ts +7 -0
  21. package/dist/service/logs/sim-logs-commands.d.ts.map +1 -1
  22. package/dist/service/logs/sim-logs-commands.js +3 -1
  23. package/dist/service/logs/sim-logs-commands.js.map +1 -1
  24. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.d.ts +83 -0
  25. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.d.ts.map +1 -0
  26. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.js +87 -0
  27. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.js.map +1 -0
  28. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.d.ts +24 -0
  29. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.d.ts.map +1 -0
  30. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.js +42 -0
  31. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.js.map +1 -0
  32. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-selection.d.ts +24 -0
  33. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-selection.d.ts.map +1 -0
  34. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-selection.js +51 -0
  35. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-selection.js.map +1 -0
  36. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.d.ts +38 -0
  37. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.d.ts.map +1 -0
  38. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.js +66 -0
  39. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.js.map +1 -0
  40. package/dist/service/s3/bucket/sim-s3-bucket.d.ts +34 -0
  41. package/dist/service/s3/bucket/sim-s3-bucket.d.ts.map +1 -1
  42. package/dist/service/s3/bucket/sim-s3-bucket.js +43 -4
  43. package/dist/service/s3/bucket/sim-s3-bucket.js.map +1 -1
  44. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.d.ts +31 -0
  45. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.d.ts.map +1 -0
  46. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.js +69 -0
  47. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.js.map +1 -0
  48. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-fields.d.ts +31 -0
  49. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-fields.d.ts.map +1 -0
  50. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-fields.js +50 -0
  51. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-fields.js.map +1 -0
  52. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-transitions.d.ts +19 -0
  53. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-transitions.d.ts.map +1 -0
  54. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-transitions.js +28 -0
  55. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-transitions.js.map +1 -0
  56. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-configurator.d.ts +1 -0
  57. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-configurator.d.ts.map +1 -1
  58. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-configurator.js +11 -0
  59. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-configurator.js.map +1 -1
  60. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-property-names.d.ts.map +1 -1
  61. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-property-names.js +1 -4
  62. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-property-names.js.map +1 -1
  63. package/dist/service/s3/command/create-bucket/create-bucket.handler.js +1 -1
  64. package/dist/service/s3/command/create-bucket/create-bucket.handler.js.map +1 -1
  65. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.command.d.ts +20 -0
  66. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.command.d.ts.map +1 -0
  67. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.command.js +2 -0
  68. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.command.js.map +1 -0
  69. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.handler.d.ts +29 -0
  70. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.handler.d.ts.map +1 -0
  71. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.handler.js +37 -0
  72. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.handler.js.map +1 -0
  73. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.command.d.ts +26 -0
  74. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.command.d.ts.map +1 -0
  75. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.command.js +2 -0
  76. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.command.js.map +1 -0
  77. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.handler.d.ts +30 -0
  78. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.handler.d.ts.map +1 -0
  79. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.handler.js +43 -0
  80. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.handler.js.map +1 -0
  81. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-authorizer.d.ts +32 -0
  82. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-authorizer.d.ts.map +1 -0
  83. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-authorizer.js +51 -0
  84. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-authorizer.js.map +1 -0
  85. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-commands.d.ts +23 -0
  86. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-commands.d.ts.map +1 -0
  87. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-commands.js +31 -0
  88. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-commands.js.map +1 -0
  89. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-rules-validation.d.ts +12 -0
  90. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-rules-validation.d.ts.map +1 -0
  91. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-rules-validation.js +53 -0
  92. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-rules-validation.js.map +1 -0
  93. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.d.ts +111 -0
  94. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.d.ts.map +1 -0
  95. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.js +2 -0
  96. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.js.map +1 -0
  97. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.handler.d.ts +30 -0
  98. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.handler.d.ts.map +1 -0
  99. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.handler.js +43 -0
  100. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.handler.js.map +1 -0
  101. package/dist/service/s3/command/sim-s3-command.types.d.ts +3 -0
  102. package/dist/service/s3/command/sim-s3-command.types.d.ts.map +1 -1
  103. package/dist/service/s3/error/sim-s3.error.d.ts +11 -0
  104. package/dist/service/s3/error/sim-s3.error.d.ts.map +1 -1
  105. package/dist/service/s3/error/sim-s3.error.js +13 -0
  106. package/dist/service/s3/error/sim-s3.error.js.map +1 -1
  107. package/dist/service/s3/sdk/sim-s3-sdk-command-router.d.ts.map +1 -1
  108. package/dist/service/s3/sdk/sim-s3-sdk-command-router.js +12 -0
  109. package/dist/service/s3/sdk/sim-s3-sdk-command-router.js.map +1 -1
  110. package/dist/service/s3/sim-s3-commands.d.ts +2 -0
  111. package/dist/service/s3/sim-s3-commands.d.ts.map +1 -1
  112. package/dist/service/s3/sim-s3-commands.js +3 -0
  113. package/dist/service/s3/sim-s3-commands.js.map +1 -1
  114. package/dist/service/s3/sim-s3-operations.d.ts +6 -0
  115. package/dist/service/s3/sim-s3-operations.d.ts.map +1 -1
  116. package/dist/service/s3/sim-s3-operations.js +12 -0
  117. package/dist/service/s3/sim-s3-operations.js.map +1 -1
  118. package/dist/service/s3/upload/sim-s3-multipart-uploads.d.ts +9 -0
  119. package/dist/service/s3/upload/sim-s3-multipart-uploads.d.ts.map +1 -1
  120. package/dist/service/s3/upload/sim-s3-multipart-uploads.js +15 -0
  121. package/dist/service/s3/upload/sim-s3-multipart-uploads.js.map +1 -1
  122. package/dist/terraform/map/sim-tf-map-s3-lifecycle.d.ts.map +1 -1
  123. package/dist/terraform/map/sim-tf-map-s3-lifecycle.js +4 -5
  124. package/dist/terraform/map/sim-tf-map-s3-lifecycle.js.map +1 -1
  125. package/dist/util/clock/sim-clock-control.d.ts +8 -0
  126. package/dist/util/clock/sim-clock-control.d.ts.map +1 -1
  127. package/dist/util/clock/sim-clock-control.js +10 -0
  128. package/dist/util/clock/sim-clock-control.js.map +1 -1
  129. package/package.json +1 -1
@@ -0,0 +1,24 @@
1
+ import type { SimS3LifecycleAbortIncompleteMultipartUpload, SimS3LifecycleExpiration } from "../../command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.js";
2
+ /**
3
+ * The instant an `Expiration` puts an Object written at a given time past.
4
+ *
5
+ * Simulated S3 expires an Object the moment the boundary arrives. Real S3
6
+ * removes one some time after it and bills up to the removal, which a test
7
+ * would have to wait out. Exactly on the boundary is the answer a test can
8
+ * use.
9
+ *
10
+ * `Days` wins over `Date` when a rule carries both, though real S3 refuses to
11
+ * store such a rule. An `Expiration` carrying only `ExpiredObjectDeleteMarker`
12
+ * has no boundary at all, since Object versions are left out.
13
+ */
14
+ export declare function simS3ObjectExpiryInstant(expiration: SimS3LifecycleExpiration, writtenAt: Date): Date | undefined;
15
+ /**
16
+ * The instant an `AbortIncompleteMultipartUpload` abandons an upload started
17
+ * at a given time.
18
+ */
19
+ export declare function simS3UploadAbortInstant(abort: SimS3LifecycleAbortIncompleteMultipartUpload, initiated: Date): Date | undefined;
20
+ /**
21
+ * Whether simulated time has reached a boundary.
22
+ */
23
+ export declare function simS3LifecycleReached(boundary: Date | undefined, now: Date): boolean;
24
+ //# sourceMappingURL=sim-s3-lifecycle-expiry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-s3-lifecycle-expiry.d.ts","sourceRoot":"","sources":["../../../../../src/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4CAA4C,EAC5C,wBAAwB,EACzB,MAAM,gGAAgG,CAAC;AAIxG;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,wBAAwB,EACpC,SAAS,EAAE,IAAI,GACd,IAAI,GAAG,SAAS,CAUlB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,4CAA4C,EACnD,SAAS,EAAE,IAAI,GACd,IAAI,GAAG,SAAS,CAMlB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,IAAI,GAAG,SAAS,EAC1B,GAAG,EAAE,IAAI,GACR,OAAO,CAET"}
@@ -0,0 +1,42 @@
1
+ const millisecondsPerDay = 24 * 60 * 60 * 1000;
2
+ /**
3
+ * The instant an `Expiration` puts an Object written at a given time past.
4
+ *
5
+ * Simulated S3 expires an Object the moment the boundary arrives. Real S3
6
+ * removes one some time after it and bills up to the removal, which a test
7
+ * would have to wait out. Exactly on the boundary is the answer a test can
8
+ * use.
9
+ *
10
+ * `Days` wins over `Date` when a rule carries both, though real S3 refuses to
11
+ * store such a rule. An `Expiration` carrying only `ExpiredObjectDeleteMarker`
12
+ * has no boundary at all, since Object versions are left out.
13
+ */
14
+ export function simS3ObjectExpiryInstant(expiration, writtenAt) {
15
+ if (expiration.Days !== undefined) {
16
+ return afterDays(writtenAt, expiration.Days);
17
+ }
18
+ if (expiration.Date !== undefined) {
19
+ return new Date(expiration.Date);
20
+ }
21
+ return undefined;
22
+ }
23
+ /**
24
+ * The instant an `AbortIncompleteMultipartUpload` abandons an upload started
25
+ * at a given time.
26
+ */
27
+ export function simS3UploadAbortInstant(abort, initiated) {
28
+ if (abort.DaysAfterInitiation === undefined) {
29
+ return undefined;
30
+ }
31
+ return afterDays(initiated, abort.DaysAfterInitiation);
32
+ }
33
+ /**
34
+ * Whether simulated time has reached a boundary.
35
+ */
36
+ export function simS3LifecycleReached(boundary, now) {
37
+ return boundary !== undefined && now.getTime() >= boundary.getTime();
38
+ }
39
+ function afterDays(from, days) {
40
+ return new Date(from.getTime() + days * millisecondsPerDay);
41
+ }
42
+ //# sourceMappingURL=sim-s3-lifecycle-expiry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-s3-lifecycle-expiry.js","sourceRoot":"","sources":["../../../../../src/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.ts"],"names":[],"mappings":"AAKA,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,wBAAwB,CACtC,UAAoC,EACpC,SAAe;IAEf,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAmD,EACnD,SAAe;IAEf,IAAI,KAAK,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;QAC5C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAA0B,EAC1B,GAAS;IAET,OAAO,QAAQ,KAAK,SAAS,IAAI,GAAG,CAAC,OAAO,EAAE,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;AACvE,CAAC;AAED,SAAS,SAAS,CAAC,IAAU,EAAE,IAAY;IACzC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,kBAAkB,CAAC,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { SimS3LifecycleRule } from "../../command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.js";
2
+ /**
3
+ * What a lifecycle rule looks at to decide whether it selects something.
4
+ *
5
+ * An Object states its size and a multipart upload leaves it out. Half an
6
+ * upload has no size for a rule to measure, and real S3 has no size to
7
+ * measure either until the parts are joined.
8
+ */
9
+ export interface SimS3LifecycleSubject {
10
+ readonly key: string;
11
+ readonly size?: number | undefined;
12
+ }
13
+ /**
14
+ * Whether a rule selects the Object or upload a key names.
15
+ *
16
+ * A rule states its scope either as the older top-level `Prefix` or as a
17
+ * `Filter`. A rule with no scope at all covers every key in the Bucket. Real
18
+ * S3 refuses a rule stating both.
19
+ *
20
+ * Simulated S3 has no Object tags. A `Tag` or a `TagFilters` entry names a
21
+ * condition the simulator has no answer for, and selects no key.
22
+ */
23
+ export declare function simS3LifecycleRuleSelects(rule: SimS3LifecycleRule, subject: SimS3LifecycleSubject): boolean;
24
+ //# sourceMappingURL=sim-s3-lifecycle-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-s3-lifecycle-selection.d.ts","sourceRoot":"","sources":["../../../../../src/service/s3/bucket/lifecycle/sim-s3-lifecycle-selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,gGAAgG,CAAC;AAExG;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAUD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAMT"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Whether a rule selects the Object or upload a key names.
3
+ *
4
+ * A rule states its scope either as the older top-level `Prefix` or as a
5
+ * `Filter`. A rule with no scope at all covers every key in the Bucket. Real
6
+ * S3 refuses a rule stating both.
7
+ *
8
+ * Simulated S3 has no Object tags. A `Tag` or a `TagFilters` entry names a
9
+ * condition the simulator has no answer for, and selects no key.
10
+ */
11
+ export function simS3LifecycleRuleSelects(rule, subject) {
12
+ if (rule.Filter === undefined) {
13
+ return subject.key.startsWith(rule.Prefix ?? "");
14
+ }
15
+ return filterSelects(rule.Filter, subject);
16
+ }
17
+ function filterSelects(filter, subject) {
18
+ if (filter.And !== undefined) {
19
+ return conjunctionSelects(filter.And, subject);
20
+ }
21
+ if (filter.Tag !== undefined) {
22
+ return false;
23
+ }
24
+ return (subject.key.startsWith(filter.Prefix ?? "") && sizeWithin(filter, subject));
25
+ }
26
+ function conjunctionSelects(operator, subject) {
27
+ if ((operator.Tags ?? []).length > 0) {
28
+ return false;
29
+ }
30
+ return (subject.key.startsWith(operator.Prefix ?? "") &&
31
+ sizeWithin(operator, subject));
32
+ }
33
+ /**
34
+ * Whether the subject's size falls inside the bounds a filter states.
35
+ *
36
+ * A subject with no size, meaning an upload still in progress, falls outside
37
+ * any stated bound. A rule narrowed to Objects of a certain size says nothing
38
+ * about parts on their way to becoming one.
39
+ */
40
+ function sizeWithin(bounds, subject) {
41
+ const { ObjectSizeGreaterThan: greaterThan, ObjectSizeLessThan: lessThan } = bounds;
42
+ if (greaterThan === undefined && lessThan === undefined) {
43
+ return true;
44
+ }
45
+ if (subject.size === undefined) {
46
+ return false;
47
+ }
48
+ return ((greaterThan === undefined || subject.size > greaterThan) &&
49
+ (lessThan === undefined || subject.size < lessThan));
50
+ }
51
+ //# sourceMappingURL=sim-s3-lifecycle-selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-s3-lifecycle-selection.js","sourceRoot":"","sources":["../../../../../src/service/s3/bucket/lifecycle/sim-s3-lifecycle-selection.ts"],"names":[],"mappings":"AA0BA;;;;;;;;;GASG;AACH,MAAM,UAAU,yBAAyB,CACvC,IAAwB,EACxB,OAA8B;IAE9B,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,aAAa,CACpB,MAAgC,EAChC,OAA8B;IAE9B,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,kBAAkB,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAC3E,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CACzB,QAAuC,EACvC,OAA8B;IAE9B,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;QAC7C,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAC9B,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,UAAU,CACjB,MAAgC,EAChC,OAA8B;IAE9B,MAAM,EAAE,qBAAqB,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,GACxE,MAAM,CAAC;IAET,IAAI,WAAW,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,CAAC,WAAW,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;QACzD,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC,CACpD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { SimS3Object } from "../../object/s3-object.js";
2
+ import type { SimS3BucketStorage } from "../../storage/s3-bucket-storage.js";
3
+ import type { SimS3LifecycleConfiguration } from "./sim-s3-lifecycle-configuration.js";
4
+ /**
5
+ * One pass over what a Bucket's lifecycle rules have expired.
6
+ *
7
+ * A Bucket makes one of these per read and throws it away, because both halves
8
+ * of it can be replaced while the Bucket is running. `configureSimStorage`
9
+ * swaps the storage, and PutBucketLifecycleConfiguration replaces the rules.
10
+ *
11
+ * Expiry happens here rather than on a schedule, which leaves a Bucket
12
+ * carrying no rules paying one comparison for the check. See
13
+ * `simS3ObjectExpiryInstant` for why the boundary is a pure function of the
14
+ * current time.
15
+ *
16
+ * Nothing is announced. Real S3 raises `s3:LifecycleExpiration:Delete` for an
17
+ * expiry, and that event family is among the ones simulated S3 leaves out.
18
+ */
19
+ export declare class SimS3LifecycleSweep {
20
+ private readonly storage;
21
+ private readonly lifecycle;
22
+ private readonly now;
23
+ constructor(storage: SimS3BucketStorage, lifecycle: SimS3LifecycleConfiguration, now: Date);
24
+ /**
25
+ * Remove one Object if the rules have expired it.
26
+ *
27
+ * The Object is answered when it survives and nothing is when it does not,
28
+ * so a read hands on whatever it gets. A key holding nothing stays nothing.
29
+ */
30
+ object(object: SimS3Object | undefined): Promise<SimS3Object | undefined>;
31
+ /**
32
+ * Remove the Objects among these the rules have expired, and answer with the
33
+ * ones still there.
34
+ */
35
+ objects(objects: readonly SimS3Object[]): Promise<SimS3Object[]>;
36
+ private expires;
37
+ }
38
+ //# sourceMappingURL=sim-s3-lifecycle-sweep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-s3-lifecycle-sweep.d.ts","sourceRoot":"","sources":["../../../../../src/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,KAAK,EACV,2BAA2B,EAE5B,MAAM,qCAAqC,CAAC;AAE7C;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG;IAHtB,YACmB,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,2BAA2B,EACtC,GAAG,EAAE,IAAI,EACxB;IAEJ;;;;;OAKG;IACG,MAAM,CACV,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAQlC;IAED;;;OAGG;IACG,OAAO,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAcrE;IAED,OAAO,CAAC,OAAO;CAMhB"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * One pass over what a Bucket's lifecycle rules have expired.
3
+ *
4
+ * A Bucket makes one of these per read and throws it away, because both halves
5
+ * of it can be replaced while the Bucket is running. `configureSimStorage`
6
+ * swaps the storage, and PutBucketLifecycleConfiguration replaces the rules.
7
+ *
8
+ * Expiry happens here rather than on a schedule, which leaves a Bucket
9
+ * carrying no rules paying one comparison for the check. See
10
+ * `simS3ObjectExpiryInstant` for why the boundary is a pure function of the
11
+ * current time.
12
+ *
13
+ * Nothing is announced. Real S3 raises `s3:LifecycleExpiration:Delete` for an
14
+ * expiry, and that event family is among the ones simulated S3 leaves out.
15
+ */
16
+ export class SimS3LifecycleSweep {
17
+ storage;
18
+ lifecycle;
19
+ now;
20
+ constructor(storage, lifecycle, now) {
21
+ this.storage = storage;
22
+ this.lifecycle = lifecycle;
23
+ this.now = now;
24
+ }
25
+ /**
26
+ * Remove one Object if the rules have expired it.
27
+ *
28
+ * The Object is answered when it survives and nothing is when it does not,
29
+ * so a read hands on whatever it gets. A key holding nothing stays nothing.
30
+ */
31
+ async object(object) {
32
+ if (object === undefined || !this.expires(object)) {
33
+ return object;
34
+ }
35
+ await this.storage.deleteObject(object.key);
36
+ return undefined;
37
+ }
38
+ /**
39
+ * Remove the Objects among these the rules have expired, and answer with the
40
+ * ones still there.
41
+ */
42
+ async objects(objects) {
43
+ if (this.lifecycle.isEmpty) {
44
+ return [...objects];
45
+ }
46
+ const expiredKeys = new Set(objects.filter((object) => this.expires(object)).map(({ key }) => key));
47
+ await Promise.all(expiredKeys.values().map(async (key) => this.storage.deleteObject(key)));
48
+ return objects.filter((object) => !expiredKeys.has(object.key));
49
+ }
50
+ expires(object) {
51
+ return (!this.lifecycle.isEmpty &&
52
+ this.lifecycle.expires(lifecycleObject(object), this.now));
53
+ }
54
+ }
55
+ /**
56
+ * An Object as a rule reads it. The size is the length of the bytes the
57
+ * Bucket holds, which is what `ContentLength` reports for the same Object.
58
+ */
59
+ function lifecycleObject(object) {
60
+ return {
61
+ key: object.key,
62
+ size: object.body.length,
63
+ lastModified: object.lastModified,
64
+ };
65
+ }
66
+ //# sourceMappingURL=sim-s3-lifecycle-sweep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-s3-lifecycle-sweep.js","sourceRoot":"","sources":["../../../../../src/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,mBAAmB;IAEX,OAAO;IACP,SAAS;IACT,GAAG;IAHtB,YACmB,OAA2B,EAC3B,SAAsC,EACtC,GAAS;uBAFT,OAAO;yBACP,SAAS;mBACT,GAAG;IACnB,CAAC;IAEJ;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,MAA+B;QAE/B,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAE5C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,OAA+B;QAC3C,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;QACtB,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,GAAG,CACzB,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CACvE,CAAC;QAEF,MAAM,OAAO,CAAC,GAAG,CACf,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CACxE,CAAC;QAEF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAClE,CAAC;IAEO,OAAO,CAAC,MAAmB;QACjC,OAAO,CACL,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO;YACvB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAC1D,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,MAAmB;IAC1C,OAAO;QACL,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;QACxB,YAAY,EAAE,MAAM,CAAC,YAAY;KAClC,CAAC;AACJ,CAAC"}
@@ -1,9 +1,11 @@
1
1
  import type { Brand } from "../../../util/brand.type.js";
2
+ import { type SimClock } from "../../../util/clock/sim-clock.js";
2
3
  import type { SimS3BucketStorage } from "../storage/s3-bucket-storage.js";
3
4
  import type { SimS3Object } from "../object/s3-object.js";
4
5
  import { SimS3BucketWebsite } from "./website/sim-s3-bucket-website.js";
5
6
  import { SimS3PublicAccessBlock } from "./public-access/sim-s3-public-access-block.js";
6
7
  import { SimS3NotificationConfiguration } from "./notification/sim-s3-notification-configuration.js";
8
+ import { SimS3LifecycleConfiguration } from "./lifecycle/sim-s3-lifecycle-configuration.js";
7
9
  import type { SimAwsAccountRegionScope } from "../../aws/sim-aws-account-region-scope.js";
8
10
  import type { SimIamPolicyDocument } from "../../iam/policy/sim-iam-policy.js";
9
11
  import { SimS3BucketSystemMetadata } from "./sim-s3-bucket-system-metadata.js";
@@ -17,6 +19,13 @@ interface SimS3BucketProperties {
17
19
  readonly policy?: SimIamPolicyDocument | undefined;
18
20
  readonly publicAccessBlock?: SimS3PublicAccessBlock;
19
21
  readonly notifications?: SimS3NotificationConfiguration;
22
+ readonly lifecycle?: SimS3LifecycleConfiguration;
23
+ /**
24
+ * The simulation's sense of time, which is what a lifecycle rule is measured
25
+ * against. A Bucket made outside a simulated environment has none to be
26
+ * given, and runs on the host clock.
27
+ */
28
+ readonly clock?: SimClock;
20
29
  /**
21
30
  * When the Bucket came into being, in simulated time.
22
31
  *
@@ -32,6 +41,7 @@ export declare class SimS3Bucket {
32
41
  readonly bucketName: SimS3BucketName;
33
42
  readonly creationDate: Date;
34
43
  private readonly accountRegionScope;
44
+ private readonly clock;
35
45
  private readonly systemMetadata;
36
46
  private readonly multipartUploads;
37
47
  private storage;
@@ -39,6 +49,7 @@ export declare class SimS3Bucket {
39
49
  private policy;
40
50
  private publicAccessBlock;
41
51
  private notifications;
52
+ private lifecycle;
42
53
  constructor(properties: SimS3BucketProperties);
43
54
  /**
44
55
  * Put a simulated S3 Object into storage.
@@ -46,6 +57,9 @@ export declare class SimS3Bucket {
46
57
  putObject(object: SimS3Object): Promise<void>;
47
58
  /**
48
59
  * Get a simulated S3 Object from storage.
60
+ *
61
+ * An Object a lifecycle rule has expired goes on the way past. Every read of
62
+ * it then finds the key empty.
49
63
  */
50
64
  getObject(key: string): Promise<SimS3Object | undefined>;
51
65
  /**
@@ -132,6 +146,24 @@ export declare class SimS3Bucket {
132
146
  * Get this Bucket's event notification configuration.
133
147
  */
134
148
  getNotifications(): SimS3NotificationConfiguration;
149
+ /**
150
+ * Replace this Bucket's lifecycle configuration.
151
+ *
152
+ * Real S3 holds one configuration per Bucket rather than a list of them, so
153
+ * this replaces what was there instead of adding to it.
154
+ */
155
+ configureLifecycle(lifecycle: SimS3LifecycleConfiguration): void;
156
+ /**
157
+ * Get this Bucket's lifecycle configuration.
158
+ */
159
+ getLifecycle(): SimS3LifecycleConfiguration;
160
+ /**
161
+ * Remove this Bucket's lifecycle configuration.
162
+ *
163
+ * Real S3 DeleteBucketLifecycle is idempotent, so this reports nothing about
164
+ * whether there were rules to remove.
165
+ */
166
+ deleteLifecycle(): void;
135
167
  /**
136
168
  * Get the simulated AWS account Region scope for this Bucket.
137
169
  */
@@ -140,6 +172,8 @@ export declare class SimS3Bucket {
140
172
  * Get the simulated S3 static website URL for this Bucket.
141
173
  */
142
174
  getWebsiteUrl(): URL;
175
+ /** What this Bucket's rules have expired, as they stand at this moment. */
176
+ private sweep;
143
177
  }
144
178
  export {};
145
179
  //# sourceMappingURL=sim-s3-bucket.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-s3-bucket.d.ts","sourceRoot":"","sources":["../../../../src/service/s3/bucket/sim-s3-bucket.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,8BAA8B,EAAE,MAAM,qDAAqD,CAAC;AACrG,OAAO,K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AyB,CAErD;IAED;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAElD;IAED;;OAEG;IACH,UAAU,IAAI,kBAAkB,CAE/B;IAED;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAElD;IAED;;OAEG;IACH,SAAS,IAAI,oBAAoB,GAAG,SAAS,CAE5C;IAED;;;;;OAKG;IACH,YAAY,IAAI,IAAI,CAEnB;IAED;;OAEG;IACH,0BAA0B,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,IAAI,CAE1E;IAED;;OAEG;IACH,oBAAoB,IAAI,sBAAsB,CAE7C;IAED;;;;;OAKG;IACH,uBAAuB,IAAI,IAAI,CAE9B;IAED;;;;;OAKG;IACH,sBAAsB,CAAC,aAAa,EAAE,8BAA8B,GAAG,IAAI,CAE1E;IAED;;OAEG;IACH,gBAAgB,IAAI,8BAA8B,CAEjD;IAED;;;;;OAKG;IACH,kBAAkB,CAAC,SAAS,EAAE,2BAA2B,GAAG,IAAI,CAE/D;IAED;;OAEG;IACH,YAAY,IAAI,2BAA2B,CAE1C;IAED;;;;;OAKG;IACH,eAAe,IAAI,IAAI,CAEtB;IAED;;OAEG;IACH,qBAAqB,IAAI,wBAAwB,CAEhD;IAED;;OAEG;IACH,aAAa,IAAI,GAAG,CAMnB;IAED,2EAA2E;IAC3E,OAAO,CAAC,KAAK;CAOd"}
@@ -1,8 +1,10 @@
1
- import { BackgroundTasks } from "../../../util/background/background.js";
1
+ import { SimRealClock } from "../../../util/clock/sim-clock.js";
2
2
  import { MemoryS3BucketStorage } from "../storage/s3-memory-storage.js";
3
3
  import { SimS3BucketWebsite } from "./website/sim-s3-bucket-website.js";
4
4
  import { SimS3PublicAccessBlock } from "./public-access/sim-s3-public-access-block.js";
5
5
  import { SimS3NotificationConfiguration } from "./notification/sim-s3-notification-configuration.js";
6
+ import { SimS3LifecycleConfiguration } from "./lifecycle/sim-s3-lifecycle-configuration.js";
7
+ import { SimS3LifecycleSweep } from "./lifecycle/sim-s3-lifecycle-sweep.js";
6
8
  import { simS3BucketWebsiteUrl } from "./website/sim-s3-bucket-website-url.js";
7
9
  import { validateS3BucketName } from "./validate/validate-s3-bucket-name.js";
8
10
  import { simAwsAccountRegionScopeFactory } from "../../aws/sim-aws-account-region-scope.factory.js";
@@ -15,6 +17,7 @@ export class SimS3Bucket {
15
17
  bucketName;
16
18
  creationDate;
17
19
  accountRegionScope;
20
+ clock;
18
21
  systemMetadata = new SimS3BucketSystemMetadata();
19
22
  multipartUploads = new SimS3MultipartUploads();
20
23
  storage;
@@ -22,16 +25,19 @@ export class SimS3Bucket {
22
25
  policy;
23
26
  publicAccessBlock;
24
27
  notifications;
28
+ lifecycle;
25
29
  constructor(properties) {
26
- const { bucketName, accountRegionScope = simAwsAccountRegionScopeFactory.make(), storage = new MemoryS3BucketStorage(), website = new SimS3BucketWebsite(), policy, publicAccessBlock = SimS3PublicAccessBlock.blockingAll(), notifications = SimS3NotificationConfiguration.empty(), creationDate = new BackgroundTasks().now(), } = properties;
30
+ const { bucketName, accountRegionScope = simAwsAccountRegionScopeFactory.make(), storage = new MemoryS3BucketStorage(), website = new SimS3BucketWebsite(), policy, publicAccessBlock = SimS3PublicAccessBlock.blockingAll(), notifications = SimS3NotificationConfiguration.empty(), lifecycle = SimS3LifecycleConfiguration.empty(), clock = new SimRealClock(), creationDate = clock.now(), } = properties;
27
31
  validateS3BucketName(bucketName);
28
32
  this.bucketName = bucketName;
29
33
  this.accountRegionScope = accountRegionScope;
34
+ this.clock = clock;
30
35
  this.storage = storage;
31
36
  this.website = website;
32
37
  this.policy = policy;
33
38
  this.publicAccessBlock = publicAccessBlock;
34
39
  this.notifications = notifications;
40
+ this.lifecycle = lifecycle;
35
41
  this.creationDate = creationDate;
36
42
  }
37
43
  /**
@@ -42,15 +48,18 @@ export class SimS3Bucket {
42
48
  }
43
49
  /**
44
50
  * Get a simulated S3 Object from storage.
51
+ *
52
+ * An Object a lifecycle rule has expired goes on the way past. Every read of
53
+ * it then finds the key empty.
45
54
  */
46
55
  async getObject(key) {
47
- return await this.storage.getObject(key);
56
+ return await this.sweep().object(await this.storage.getObject(key));
48
57
  }
49
58
  /**
50
59
  * List simulated S3 Objects from storage.
51
60
  */
52
61
  async listObjects(prefix) {
53
- return await this.storage.listObjects(prefix);
62
+ return await this.sweep().objects(await this.storage.listObjects(prefix));
54
63
  }
55
64
  /**
56
65
  * Remove a simulated S3 Object from storage.
@@ -72,6 +81,8 @@ export class SimS3Bucket {
72
81
  * completing the upload puts anything under a key.
73
82
  */
74
83
  getMultipartUploads() {
84
+ const now = this.clock.now();
85
+ this.multipartUploads.discardAbandoned((upload) => this.lifecycle.abandons(upload, now));
75
86
  return this.multipartUploads;
76
87
  }
77
88
  /**
@@ -160,6 +171,30 @@ export class SimS3Bucket {
160
171
  getNotifications() {
161
172
  return this.notifications;
162
173
  }
174
+ /**
175
+ * Replace this Bucket's lifecycle configuration.
176
+ *
177
+ * Real S3 holds one configuration per Bucket rather than a list of them, so
178
+ * this replaces what was there instead of adding to it.
179
+ */
180
+ configureLifecycle(lifecycle) {
181
+ this.lifecycle = lifecycle;
182
+ }
183
+ /**
184
+ * Get this Bucket's lifecycle configuration.
185
+ */
186
+ getLifecycle() {
187
+ return this.lifecycle;
188
+ }
189
+ /**
190
+ * Remove this Bucket's lifecycle configuration.
191
+ *
192
+ * Real S3 DeleteBucketLifecycle is idempotent, so this reports nothing about
193
+ * whether there were rules to remove.
194
+ */
195
+ deleteLifecycle() {
196
+ this.lifecycle = SimS3LifecycleConfiguration.empty();
197
+ }
163
198
  /**
164
199
  * Get the simulated AWS account Region scope for this Bucket.
165
200
  */
@@ -172,5 +207,9 @@ export class SimS3Bucket {
172
207
  getWebsiteUrl() {
173
208
  return simS3BucketWebsiteUrl(this.bucketName, this.accountRegionScope, this.website);
174
209
  }
210
+ /** What this Bucket's rules have expired, as they stand at this moment. */
211
+ sweep() {
212
+ return new SimS3LifecycleSweep(this.storage, this.lifecycle, this.clock.now());
213
+ }
175
214
  }
176
215
  //# sourceMappingURL=sim-s3-bucket.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-s3-bucket.js","sourceRoot":"","sources":["../../../../src/service/s3/bucket/sim-s3-bucket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAIzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,8BAA8B,EAAE,MAAM,qDAAqD,CAAC;AAGrG,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAqB9E;;GAEG;AACH,MAAM,OAAO,WAAW;IACN,UAAU,CAAkB;IAC5B,YAAY,CAAO;IAElB,kBAAkB,CAA2B;IAC7C,cAAc,GAAG,IAAI,yBAAyB,EAAE,CAAC;IACjD,gBAAgB,GAAG,IAAI,qBAAqB,EAAE,CAAC;IACxD,OAAO,CAAqB;IAC5B,OAAO,CAAqB;IAC5B,MAAM,CAAmC;IACzC,iBAAiB,CAAyB;IAC1C,aAAa,CAAiC;IAEtD,YAAY,UAAiC;QAC3C,MAAM,EACJ,UAAU,EACV,kBAAkB,GAAG,+BAA+B,CAAC,IAAI,EAAE,EAC3D,OAAO,GAAG,IAAI,qBAAqB,EAAE,EACrC,OAAO,GAAG,IAAI,kBAAkB,EAAE,EAClC,MAAM,EACN,iBAAiB,GAAG,sBAAsB,CAAC,WAAW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E,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACH,sBAAsB,CAAC,aAA6C;QAClE,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,kBAAkB,CAAC,SAAsC;QACvD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACH,eAAe;QACb,IAAI,CAAC,SAAS,GAAG,2BAA2B,CAAC,KAAK,EAAE,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,qBAAqB,CAC1B,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,OAAO,CACb,CAAC;IACJ,CAAC;IAED,2EAA2E;IACnE,KAAK;QACX,OAAO,IAAI,mBAAmB,CAC5B,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CACjB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,31 @@
1
+ import type { SimCfnTemplateValueRecord } from "../../../../cloudformation/template/value/sim-cfn-template-value.js";
2
+ import type { SimS3LifecycleConfiguration } from "../../../command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.js";
3
+ /**
4
+ * Reads the `LifecycleConfiguration` property of an AWS::S3::Bucket Resource
5
+ * into a PutBucketLifecycleConfiguration request.
6
+ *
7
+ * A rule field this reader has no translation for is carried across unchanged
8
+ * rather than dropped or refused. Dropping it would deploy a Bucket whose
9
+ * rules read back shorter than the template asked for, and refusing it would
10
+ * fail a Stack over a field nothing in the simulation acts on anyway.
11
+ */
12
+ export declare class SimCfnS3BucketLifecycleConfiguration {
13
+ private readonly properties;
14
+ private readonly shape;
15
+ constructor(logicalId: string, properties: SimCfnTemplateValueRecord);
16
+ /**
17
+ * The configuration to apply, or nothing when the Resource declares none.
18
+ *
19
+ * A configuration that is there but is not the shape it should be fails the
20
+ * Resource. Read as nothing, it would deploy a Bucket whose rules a test
21
+ * then finds missing without being told why.
22
+ */
23
+ read(): SimS3LifecycleConfiguration | undefined;
24
+ private readRule;
25
+ /**
26
+ * The three flattened expiry fields, gathered under the one the request
27
+ * carries. A rule stating none of them keeps no `Expiration` at all.
28
+ */
29
+ private expiration;
30
+ }
31
+ //# sourceMappingURL=sim-cfn-s3-bucket-lifecycle-configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cfn-s3-bucket-lifecycle-configuration.d.ts","sourceRoot":"","sources":["../../../../../../src/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,yBAAyB,EAC1B,MAAM,qEAAqE,CAAC;AAE7E,OAAO,KAAK,EACV,2BAA2B,EAE5B,MAAM,mGAAmG,CAAC;AAS3G;;;;;;;;GAQG;AACH,qBAAa,oCAAoC;IAC/C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA4B;IACvD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IAEzC,YAAY,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAKnE;IAED;;;;;;OAMG;IACH,IAAI,IAAI,2BAA2B,GAAG,SAAS,CAgB9C;IAED,OAAO,CAAC,QAAQ;IAsBhB;;;OAGG;IACH,OAAO,CAAC,UAAU;CAWnB"}
@@ -0,0 +1,69 @@
1
+ import { SimCfnValueShape } from "../../../../cloudformation/template/value/sim-cfn-value-shape.js";
2
+ import { s3BucketResourceError } from "../error/sim-cfn-s3-bucket-error.js";
3
+ import { simCfnS3CarriedRuleFields, simCfnS3LifecycleDate, simCfnS3StatedFields, } from "./sim-cfn-s3-bucket-lifecycle-fields.js";
4
+ import { readSimCfnS3LifecycleTransitions } from "./sim-cfn-s3-bucket-lifecycle-transitions.js";
5
+ /**
6
+ * Reads the `LifecycleConfiguration` property of an AWS::S3::Bucket Resource
7
+ * into a PutBucketLifecycleConfiguration request.
8
+ *
9
+ * A rule field this reader has no translation for is carried across unchanged
10
+ * rather than dropped or refused. Dropping it would deploy a Bucket whose
11
+ * rules read back shorter than the template asked for, and refusing it would
12
+ * fail a Stack over a field nothing in the simulation acts on anyway.
13
+ */
14
+ export class SimCfnS3BucketLifecycleConfiguration {
15
+ properties;
16
+ shape;
17
+ constructor(logicalId, properties) {
18
+ this.properties = properties;
19
+ this.shape = new SimCfnValueShape((reason) => s3BucketResourceError(logicalId, reason));
20
+ }
21
+ /**
22
+ * The configuration to apply, or nothing when the Resource declares none.
23
+ *
24
+ * A configuration that is there but is not the shape it should be fails the
25
+ * Resource. Read as nothing, it would deploy a Bucket whose rules a test
26
+ * then finds missing without being told why.
27
+ */
28
+ read() {
29
+ const declared = this.properties["LifecycleConfiguration"];
30
+ if (declared === undefined) {
31
+ return undefined;
32
+ }
33
+ const configuration = this.shape.record(declared, "LifecycleConfiguration");
34
+ const rules = this.shape.list(configuration["Rules"] ?? [], "LifecycleConfiguration Rules");
35
+ return {
36
+ Rules: rules.map((rule, index) => this.readRule(rule, index)),
37
+ };
38
+ }
39
+ readRule(declared, index) {
40
+ const path = `LifecycleConfiguration Rules[${index}]`;
41
+ const rule = this.shape.record(declared, path);
42
+ return {
43
+ ...simCfnS3CarriedRuleFields(rule),
44
+ ...simCfnS3StatedFields({
45
+ ID: rule["Id"],
46
+ Expiration: this.expiration(rule),
47
+ Transitions: readSimCfnS3LifecycleTransitions({
48
+ shape: this.shape,
49
+ listed: rule["Transitions"],
50
+ singular: rule["Transition"],
51
+ path,
52
+ }),
53
+ }),
54
+ };
55
+ }
56
+ /**
57
+ * The three flattened expiry fields, gathered under the one the request
58
+ * carries. A rule stating none of them keeps no `Expiration` at all.
59
+ */
60
+ expiration(rule) {
61
+ const expiration = {
62
+ Date: simCfnS3LifecycleDate(rule["ExpirationDate"]),
63
+ Days: rule["ExpirationInDays"],
64
+ ExpiredObjectDeleteMarker: rule["ExpiredObjectDeleteMarker"],
65
+ };
66
+ return simCfnS3StatedFields(expiration);
67
+ }
68
+ }
69
+ //# sourceMappingURL=sim-cfn-s3-bucket-lifecycle-configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cfn-s3-bucket-lifecycle-configuration.js","sourceRoot":"","sources":["../../../../../../src/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kEAAkE,CAAC;AAKpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAEhG;;;;;;;;GAQG;AACH,MAAM,OAAO,oCAAoC;IAC9B,UAAU,CAA4B;IACtC,KAAK,CAAmB;IAEzC,YAAY,SAAiB,EAAE,UAAqC;QAClE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,EAAE,CAC3C,qBAAqB,CAAC,SAAS,EAAE,MAAM,CAAC,CACzC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,IAAI;QACF,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;QAE3D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC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