@kensio/yulin 1.20.5 → 1.20.6

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 (106) hide show
  1. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.d.ts +83 -0
  2. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.d.ts.map +1 -0
  3. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.js +87 -0
  4. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.js.map +1 -0
  5. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.d.ts +24 -0
  6. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.d.ts.map +1 -0
  7. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.js +42 -0
  8. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.js.map +1 -0
  9. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-selection.d.ts +24 -0
  10. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-selection.d.ts.map +1 -0
  11. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-selection.js +51 -0
  12. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-selection.js.map +1 -0
  13. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.d.ts +38 -0
  14. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.d.ts.map +1 -0
  15. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.js +66 -0
  16. package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.js.map +1 -0
  17. package/dist/service/s3/bucket/sim-s3-bucket.d.ts +34 -0
  18. package/dist/service/s3/bucket/sim-s3-bucket.d.ts.map +1 -1
  19. package/dist/service/s3/bucket/sim-s3-bucket.js +43 -4
  20. package/dist/service/s3/bucket/sim-s3-bucket.js.map +1 -1
  21. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.d.ts +31 -0
  22. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.d.ts.map +1 -0
  23. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.js +69 -0
  24. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.js.map +1 -0
  25. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-fields.d.ts +31 -0
  26. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-fields.d.ts.map +1 -0
  27. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-fields.js +50 -0
  28. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-fields.js.map +1 -0
  29. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-transitions.d.ts +19 -0
  30. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-transitions.d.ts.map +1 -0
  31. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-transitions.js +28 -0
  32. package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-transitions.js.map +1 -0
  33. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-configurator.d.ts +1 -0
  34. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-configurator.d.ts.map +1 -1
  35. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-configurator.js +11 -0
  36. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-configurator.js.map +1 -1
  37. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-property-names.d.ts.map +1 -1
  38. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-property-names.js +1 -4
  39. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-property-names.js.map +1 -1
  40. package/dist/service/s3/command/create-bucket/create-bucket.handler.js +1 -1
  41. package/dist/service/s3/command/create-bucket/create-bucket.handler.js.map +1 -1
  42. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.command.d.ts +20 -0
  43. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.command.d.ts.map +1 -0
  44. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.command.js +2 -0
  45. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.command.js.map +1 -0
  46. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.handler.d.ts +29 -0
  47. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.handler.d.ts.map +1 -0
  48. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.handler.js +37 -0
  49. package/dist/service/s3/command/delete-bucket-lifecycle/delete-bucket-lifecycle.handler.js.map +1 -0
  50. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.command.d.ts +26 -0
  51. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.command.d.ts.map +1 -0
  52. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.command.js +2 -0
  53. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.command.js.map +1 -0
  54. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.handler.d.ts +30 -0
  55. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.handler.d.ts.map +1 -0
  56. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.handler.js +43 -0
  57. package/dist/service/s3/command/get-bucket-lifecycle-configuration/get-bucket-lifecycle-configuration.handler.js.map +1 -0
  58. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-authorizer.d.ts +32 -0
  59. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-authorizer.d.ts.map +1 -0
  60. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-authorizer.js +51 -0
  61. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-authorizer.js.map +1 -0
  62. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-commands.d.ts +23 -0
  63. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-commands.d.ts.map +1 -0
  64. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-commands.js +31 -0
  65. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-commands.js.map +1 -0
  66. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-rules-validation.d.ts +12 -0
  67. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-rules-validation.d.ts.map +1 -0
  68. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-rules-validation.js +53 -0
  69. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-rules-validation.js.map +1 -0
  70. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.d.ts +111 -0
  71. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.d.ts.map +1 -0
  72. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.js +2 -0
  73. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.js.map +1 -0
  74. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.handler.d.ts +30 -0
  75. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.handler.d.ts.map +1 -0
  76. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.handler.js +43 -0
  77. package/dist/service/s3/command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.handler.js.map +1 -0
  78. package/dist/service/s3/command/sim-s3-command.types.d.ts +3 -0
  79. package/dist/service/s3/command/sim-s3-command.types.d.ts.map +1 -1
  80. package/dist/service/s3/error/sim-s3.error.d.ts +11 -0
  81. package/dist/service/s3/error/sim-s3.error.d.ts.map +1 -1
  82. package/dist/service/s3/error/sim-s3.error.js +13 -0
  83. package/dist/service/s3/error/sim-s3.error.js.map +1 -1
  84. package/dist/service/s3/sdk/sim-s3-sdk-command-router.d.ts.map +1 -1
  85. package/dist/service/s3/sdk/sim-s3-sdk-command-router.js +12 -0
  86. package/dist/service/s3/sdk/sim-s3-sdk-command-router.js.map +1 -1
  87. package/dist/service/s3/sim-s3-commands.d.ts +2 -0
  88. package/dist/service/s3/sim-s3-commands.d.ts.map +1 -1
  89. package/dist/service/s3/sim-s3-commands.js +3 -0
  90. package/dist/service/s3/sim-s3-commands.js.map +1 -1
  91. package/dist/service/s3/sim-s3-operations.d.ts +6 -0
  92. package/dist/service/s3/sim-s3-operations.d.ts.map +1 -1
  93. package/dist/service/s3/sim-s3-operations.js +12 -0
  94. package/dist/service/s3/sim-s3-operations.js.map +1 -1
  95. package/dist/service/s3/upload/sim-s3-multipart-uploads.d.ts +9 -0
  96. package/dist/service/s3/upload/sim-s3-multipart-uploads.d.ts.map +1 -1
  97. package/dist/service/s3/upload/sim-s3-multipart-uploads.js +15 -0
  98. package/dist/service/s3/upload/sim-s3-multipart-uploads.js.map +1 -1
  99. package/dist/terraform/map/sim-tf-map-s3-lifecycle.d.ts.map +1 -1
  100. package/dist/terraform/map/sim-tf-map-s3-lifecycle.js +4 -5
  101. package/dist/terraform/map/sim-tf-map-s3-lifecycle.js.map +1 -1
  102. package/dist/util/clock/sim-clock-control.d.ts +8 -0
  103. package/dist/util/clock/sim-clock-control.d.ts.map +1 -1
  104. package/dist/util/clock/sim-clock-control.js +10 -0
  105. package/dist/util/clock/sim-clock-control.js.map +1 -1
  106. package/package.json +1 -1
@@ -0,0 +1,83 @@
1
+ import type { SimS3LifecycleConfiguration as SimS3LifecycleConfigurationInput, SimS3LifecycleRule } from "../../command/put-bucket-lifecycle-configuration/put-bucket-lifecycle-configuration.command.js";
2
+ interface SimS3LifecycleConfigurationProperties {
3
+ readonly rules?: readonly SimS3LifecycleRule[];
4
+ }
5
+ /**
6
+ * An Object as a lifecycle rule reads it.
7
+ */
8
+ export interface SimS3LifecycleObject {
9
+ readonly key: string;
10
+ readonly size: number;
11
+ readonly lastModified: Date;
12
+ }
13
+ /**
14
+ * A multipart upload in progress as a lifecycle rule reads it.
15
+ */
16
+ export interface SimS3LifecycleUpload {
17
+ readonly key: string;
18
+ readonly initiated: Date;
19
+ }
20
+ /**
21
+ * The lifecycle configuration of one simulated S3 Bucket.
22
+ *
23
+ * A Bucket has one configuration rather than a list of them, which is why
24
+ * PutBucketLifecycleConfiguration replaces the whole thing. Real S3 has no way
25
+ * to add one rule without restating the others.
26
+ *
27
+ * The configuration also answers what its rules have expired. An Object goes
28
+ * once the clock passes the boundary of a rule that selects it, and a Bucket
29
+ * asks on the way to its storage. Nothing sweeps a Bucket on a schedule. See
30
+ * `simS3ObjectExpiryInstant` for why the boundary is a pure function of the
31
+ * current time.
32
+ */
33
+ export declare class SimS3LifecycleConfiguration {
34
+ private readonly storedRules;
35
+ constructor(properties?: SimS3LifecycleConfigurationProperties);
36
+ /**
37
+ * The configuration a Bucket nobody has configured has.
38
+ */
39
+ static empty(): SimS3LifecycleConfiguration;
40
+ /**
41
+ * The configuration a PutBucketLifecycleConfiguration request asks for.
42
+ */
43
+ static fromConfiguration(configuration: SimS3LifecycleConfigurationInput): SimS3LifecycleConfiguration;
44
+ /**
45
+ * The rules this Bucket carries.
46
+ *
47
+ * Cloned on the way out as they were on the way in. A caller holding the
48
+ * objects it put, or the ones a read gave it, could otherwise change what
49
+ * the Bucket is configured with by mutating them.
50
+ */
51
+ get rules(): readonly SimS3LifecycleRule[];
52
+ /**
53
+ * Whether the Bucket carries any rule at all.
54
+ *
55
+ * Real S3 distinguishes a Bucket with no configuration from one with an
56
+ * empty list of rules only in that it refuses to store the latter, so an
57
+ * unconfigured Bucket and a Bucket whose rules were all removed read alike.
58
+ */
59
+ get isEmpty(): boolean;
60
+ /**
61
+ * Whether an enabled rule has expired an Object by the given instant.
62
+ *
63
+ * One rule is enough. Real S3 applies the shortest expiry among the rules
64
+ * selecting a key, and an Object past any of the boundaries is past the
65
+ * shortest one.
66
+ */
67
+ expires(object: SimS3LifecycleObject, now: Date): boolean;
68
+ /**
69
+ * Whether an enabled rule has abandoned a multipart upload by the given
70
+ * instant.
71
+ */
72
+ abandons(upload: SimS3LifecycleUpload, now: Date): boolean;
73
+ /**
74
+ * The rules that act, which are the ones whose `Status` is `Enabled`.
75
+ *
76
+ * Read from the stored rules rather than from `rules`, because every read of
77
+ * a Bucket asks and cloning the whole configuration each time would be the
78
+ * cost of having one.
79
+ */
80
+ private enabledRules;
81
+ }
82
+ export {};
83
+ //# sourceMappingURL=sim-s3-lifecycle-configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-s3-lifecycle-configuration.d.ts","sourceRoot":"","sources":["../../../../../src/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,IAAI,gCAAgC,EAC/D,kBAAkB,EACnB,MAAM,gGAAgG,CAAC;AAQxG,UAAU,qCAAqC;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,2BAA2B;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;IAE5D,YAAY,UAAU,GAAE,qCAA0C,EAEjE;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,IAAI,2BAA2B,CAE1C;IAED;;OAEG;IACH,MAAM,CAAC,iBAAiB,CACtB,aAAa,EAAE,gCAAgC,GAC9C,2BAA2B,CAI7B;IAED;;;;;;OAMG;IACH,IAAI,KAAK,IAAI,SAAS,kBAAkB,EAAE,CAEzC;IAED;;;;;;OAMG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAUxD;IAED;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAazD;IAED;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;CAGrB"}
@@ -0,0 +1,87 @@
1
+ import { simS3LifecycleReached, simS3ObjectExpiryInstant, simS3UploadAbortInstant, } from "./sim-s3-lifecycle-expiry.js";
2
+ import { simS3LifecycleRuleSelects } from "./sim-s3-lifecycle-selection.js";
3
+ /**
4
+ * The lifecycle configuration of one simulated S3 Bucket.
5
+ *
6
+ * A Bucket has one configuration rather than a list of them, which is why
7
+ * PutBucketLifecycleConfiguration replaces the whole thing. Real S3 has no way
8
+ * to add one rule without restating the others.
9
+ *
10
+ * The configuration also answers what its rules have expired. An Object goes
11
+ * once the clock passes the boundary of a rule that selects it, and a Bucket
12
+ * asks on the way to its storage. Nothing sweeps a Bucket on a schedule. See
13
+ * `simS3ObjectExpiryInstant` for why the boundary is a pure function of the
14
+ * current time.
15
+ */
16
+ export class SimS3LifecycleConfiguration {
17
+ storedRules;
18
+ constructor(properties = {}) {
19
+ this.storedRules = structuredClone(properties.rules ?? []);
20
+ }
21
+ /**
22
+ * The configuration a Bucket nobody has configured has.
23
+ */
24
+ static empty() {
25
+ return new SimS3LifecycleConfiguration();
26
+ }
27
+ /**
28
+ * The configuration a PutBucketLifecycleConfiguration request asks for.
29
+ */
30
+ static fromConfiguration(configuration) {
31
+ return new SimS3LifecycleConfiguration({
32
+ rules: [...(configuration.Rules ?? [])],
33
+ });
34
+ }
35
+ /**
36
+ * The rules this Bucket carries.
37
+ *
38
+ * Cloned on the way out as they were on the way in. A caller holding the
39
+ * objects it put, or the ones a read gave it, could otherwise change what
40
+ * the Bucket is configured with by mutating them.
41
+ */
42
+ get rules() {
43
+ return structuredClone(this.storedRules);
44
+ }
45
+ /**
46
+ * Whether the Bucket carries any rule at all.
47
+ *
48
+ * Real S3 distinguishes a Bucket with no configuration from one with an
49
+ * empty list of rules only in that it refuses to store the latter, so an
50
+ * unconfigured Bucket and a Bucket whose rules were all removed read alike.
51
+ */
52
+ get isEmpty() {
53
+ return this.storedRules.length === 0;
54
+ }
55
+ /**
56
+ * Whether an enabled rule has expired an Object by the given instant.
57
+ *
58
+ * One rule is enough. Real S3 applies the shortest expiry among the rules
59
+ * selecting a key, and an Object past any of the boundaries is past the
60
+ * shortest one.
61
+ */
62
+ expires(object, now) {
63
+ return this.enabledRules().some((rule) => rule.Expiration !== undefined &&
64
+ simS3LifecycleRuleSelects(rule, object) &&
65
+ simS3LifecycleReached(simS3ObjectExpiryInstant(rule.Expiration, object.lastModified), now));
66
+ }
67
+ /**
68
+ * Whether an enabled rule has abandoned a multipart upload by the given
69
+ * instant.
70
+ */
71
+ abandons(upload, now) {
72
+ return this.enabledRules().some((rule) => rule.AbortIncompleteMultipartUpload !== undefined &&
73
+ simS3LifecycleRuleSelects(rule, { key: upload.key }) &&
74
+ simS3LifecycleReached(simS3UploadAbortInstant(rule.AbortIncompleteMultipartUpload, upload.initiated), now));
75
+ }
76
+ /**
77
+ * The rules that act, which are the ones whose `Status` is `Enabled`.
78
+ *
79
+ * Read from the stored rules rather than from `rules`, because every read of
80
+ * a Bucket asks and cloning the whole configuration each time would be the
81
+ * cost of having one.
82
+ */
83
+ enabledRules() {
84
+ return this.storedRules.filter((rule) => rule.Status === "Enabled");
85
+ }
86
+ }
87
+ //# sourceMappingURL=sim-s3-lifecycle-configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-s3-lifecycle-configuration.js","sourceRoot":"","sources":["../../../../../src/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAuB5E;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,2BAA2B;IACrB,WAAW,CAAgC;IAE5D,YAAY,UAAU,GAA0C,EAAE;QAChE,IAAI,CAAC,WAAW,GAAG,eAAe,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,2BAA2B,EAAE,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,iBAAiB,CACtB,aAA+C;QAE/C,OAAO,IAAI,2BAA2B,CAAC;YACrC,KAAK,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,IAAI,KAAK;QACP,OAAO,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;OAMG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,MAA4B,EAAE,GAAS;QAC7C,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,CAC7B,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,UAAU,KAAK,SAAS;YAC7B,yBAAyB,CAAC,IAAI,EAAE,MAAM,CAAC;YACvC,qBAAqB,CACnB,wBAAwB,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,YAAY,CAAC,EAC9D,GAAG,CACJ,CACJ,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,MAA4B,EAAE,GAAS;QAC9C,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,CAC7B,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,8BAA8B,KAAK,SAAS;YACjD,yBAAyB,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;YACpD,qBAAqB,CACnB,uBAAuB,CACrB,IAAI,CAAC,8BAA8B,EACnC,MAAM,CAAC,SAAS,CACjB,EACD,GAAG,CACJ,CACJ,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACK,YAAY;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;IACtE,CAAC;CACF"}
@@ -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,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAI/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAE/D,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,UAAU,EA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