@constructive-io/bucket-provisioner 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -196,11 +196,6 @@ belongs to one database at one scope, and there is no global bucket namespace to
196
196
  prefix into. Each readable component has its own budget, so a long scope cannot
197
197
  crowd out the database label, and the digest covers the untruncated identity.
198
198
 
199
- #### `mintPhysicalBucketName(prefix, databaseId, bucketKey)`
200
-
201
- The prefixed policy — `{prefix}-{bucketKey}-{digest}` — for a deployment that
202
- names its own bucket namespace.
203
-
204
199
  ### Policy Builders
205
200
 
206
201
  Standalone functions for generating S3 policy documents.
package/esm/index.d.ts CHANGED
@@ -29,7 +29,7 @@
29
29
  export type { BucketProvisionerOptions } from './provisioner';
30
30
  export { BucketProvisioner } from './provisioner';
31
31
  export type { PhysicalBucketIdentity } from './naming';
32
- export { mintPhysicalBucketName, physicalBucketName } from './naming';
32
+ export { physicalBucketName } from './naming';
33
33
  export { createS3Client } from './client';
34
34
  export type { BucketPolicyDocument, BucketPolicyStatement, PublicAccessBlockConfig, } from './policies';
35
35
  export { buildCloudFrontOacPolicy, buildPresignedUrlIamPolicy, buildPublicReadPolicy, getPublicAccessBlock, } from './policies';
package/esm/index.js CHANGED
@@ -27,7 +27,7 @@
27
27
  * ```
28
28
  */
29
29
  export { BucketProvisioner } from './provisioner';
30
- export { mintPhysicalBucketName, physicalBucketName } from './naming';
30
+ export { physicalBucketName } from './naming';
31
31
  // S3 client factory
32
32
  export { createS3Client } from './client';
33
33
  export { buildCloudFrontOacPolicy, buildPresignedUrlIamPolicy, buildPublicReadPolicy, getPublicAccessBlock, } from './policies';
package/esm/naming.d.ts CHANGED
@@ -14,24 +14,13 @@ export interface PhysicalBucketIdentity {
14
14
  *
15
15
  * This is the policy for a platform-provisioned bucket, and it takes no prefix
16
16
  * because there is no global bucket namespace to prefix into: a bucket belongs
17
- * to one database at one scope, and that is what its name should say. Callers
18
- * derive names from here rather than composing a prefix of their own, so the
19
- * policy can change in one place — and an already-provisioned bucket never
20
- * consults it at all, since the row's recorded `physical_name` is authoritative.
17
+ * to one database at one scope, and that is what its name should say. The
18
+ * reconciler derives names from here rather than composing a prefix of its own,
19
+ * and consumers of a bucket row never consult this policy: the recorded
20
+ * `physical_name` is authoritative.
21
21
  *
22
22
  * The scope is part of the digested identity untruncated, so two scopes of one
23
23
  * database that declare the same bucket key stay distinct even when their
24
24
  * readable labels truncate to the same thing.
25
25
  */
26
26
  export declare function physicalBucketName(identity: PhysicalBucketIdentity): string;
27
- /**
28
- * The prefixed physical-bucket naming policy:
29
- * `{prefix}-{bucketKey}-{digest}` (e.g. `myapp-public-3f9c1a2b7e04`).
30
- *
31
- * For a deployment that names its own bucket namespace — a single-app
32
- * installation, or the presigned-upload (lazy) path meeting a bucket an app
33
- * configured. A platform-provisioned bucket uses {@link physicalBucketName}
34
- * instead, whose components come from the bucket row rather than from
35
- * deployment config.
36
- */
37
- export declare function mintPhysicalBucketName(prefix: string, databaseId: string, bucketKey: string): string;
package/esm/naming.js CHANGED
@@ -5,9 +5,6 @@ const MAX_BUCKET_NAME_LENGTH = 63;
5
5
  const MIN_BUCKET_NAME_LENGTH = 3;
6
6
  /** Hex characters of the identity digest kept as the uniqueness tail. */
7
7
  const IDENTITY_DIGEST_LENGTH = 12;
8
- /** Readable budget: how much of the name the prefix and key may each occupy. */
9
- const PREFIX_BUDGET = 20;
10
- const BUCKET_KEY_BUDGET = 63 - IDENTITY_DIGEST_LENGTH - PREFIX_BUDGET - 3;
11
8
  /**
12
9
  * Readable budgets for a name minted from a bucket's own identity.
13
10
  *
@@ -74,10 +71,10 @@ function assembleBucketName(readable, identity, describeIdentity) {
74
71
  *
75
72
  * This is the policy for a platform-provisioned bucket, and it takes no prefix
76
73
  * because there is no global bucket namespace to prefix into: a bucket belongs
77
- * to one database at one scope, and that is what its name should say. Callers
78
- * derive names from here rather than composing a prefix of their own, so the
79
- * policy can change in one place — and an already-provisioned bucket never
80
- * consults it at all, since the row's recorded `physical_name` is authoritative.
74
+ * to one database at one scope, and that is what its name should say. The
75
+ * reconciler derives names from here rather than composing a prefix of its own,
76
+ * and consumers of a bucket row never consult this policy: the recorded
77
+ * `physical_name` is authoritative.
81
78
  *
82
79
  * The scope is part of the digested identity untruncated, so two scopes of one
83
80
  * database that declare the same bucket key stay distinct even when their
@@ -91,19 +88,3 @@ export function physicalBucketName(identity) {
91
88
  readableComponent(bucketKey, IDENTITY_KEY_BUDGET),
92
89
  ], `${scope}/${databaseId}/${bucketKey}`, `key "${bucketKey}" at scope "${scope}"`);
93
90
  }
94
- /**
95
- * The prefixed physical-bucket naming policy:
96
- * `{prefix}-{bucketKey}-{digest}` (e.g. `myapp-public-3f9c1a2b7e04`).
97
- *
98
- * For a deployment that names its own bucket namespace — a single-app
99
- * installation, or the presigned-upload (lazy) path meeting a bucket an app
100
- * configured. A platform-provisioned bucket uses {@link physicalBucketName}
101
- * instead, whose components come from the bucket row rather than from
102
- * deployment config.
103
- */
104
- export function mintPhysicalBucketName(prefix, databaseId, bucketKey) {
105
- return assembleBucketName([
106
- readableComponent(prefix, PREFIX_BUDGET),
107
- readableComponent(bucketKey, BUCKET_KEY_BUDGET),
108
- ], `${prefix}/${databaseId}/${bucketKey}`, `key "${bucketKey}"`);
109
- }
package/index.d.ts CHANGED
@@ -29,7 +29,7 @@
29
29
  export type { BucketProvisionerOptions } from './provisioner';
30
30
  export { BucketProvisioner } from './provisioner';
31
31
  export type { PhysicalBucketIdentity } from './naming';
32
- export { mintPhysicalBucketName, physicalBucketName } from './naming';
32
+ export { physicalBucketName } from './naming';
33
33
  export { createS3Client } from './client';
34
34
  export type { BucketPolicyDocument, BucketPolicyStatement, PublicAccessBlockConfig, } from './policies';
35
35
  export { buildCloudFrontOacPolicy, buildPresignedUrlIamPolicy, buildPublicReadPolicy, getPublicAccessBlock, } from './policies';
package/index.js CHANGED
@@ -28,11 +28,10 @@
28
28
  * ```
29
29
  */
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.ProvisionerError = exports.buildTempCleanupRule = exports.buildAbortIncompleteMultipartRule = exports.buildUploadCorsRules = exports.buildPrivateCorsRules = exports.getPublicAccessBlock = exports.buildPublicReadPolicy = exports.buildPresignedUrlIamPolicy = exports.buildCloudFrontOacPolicy = exports.createS3Client = exports.physicalBucketName = exports.mintPhysicalBucketName = exports.BucketProvisioner = void 0;
31
+ exports.ProvisionerError = exports.buildTempCleanupRule = exports.buildAbortIncompleteMultipartRule = exports.buildUploadCorsRules = exports.buildPrivateCorsRules = exports.getPublicAccessBlock = exports.buildPublicReadPolicy = exports.buildPresignedUrlIamPolicy = exports.buildCloudFrontOacPolicy = exports.createS3Client = exports.physicalBucketName = exports.BucketProvisioner = void 0;
32
32
  var provisioner_1 = require("./provisioner");
33
33
  Object.defineProperty(exports, "BucketProvisioner", { enumerable: true, get: function () { return provisioner_1.BucketProvisioner; } });
34
34
  var naming_1 = require("./naming");
35
- Object.defineProperty(exports, "mintPhysicalBucketName", { enumerable: true, get: function () { return naming_1.mintPhysicalBucketName; } });
36
35
  Object.defineProperty(exports, "physicalBucketName", { enumerable: true, get: function () { return naming_1.physicalBucketName; } });
37
36
  // S3 client factory
38
37
  var client_1 = require("./client");
package/naming.d.ts CHANGED
@@ -14,24 +14,13 @@ export interface PhysicalBucketIdentity {
14
14
  *
15
15
  * This is the policy for a platform-provisioned bucket, and it takes no prefix
16
16
  * because there is no global bucket namespace to prefix into: a bucket belongs
17
- * to one database at one scope, and that is what its name should say. Callers
18
- * derive names from here rather than composing a prefix of their own, so the
19
- * policy can change in one place — and an already-provisioned bucket never
20
- * consults it at all, since the row's recorded `physical_name` is authoritative.
17
+ * to one database at one scope, and that is what its name should say. The
18
+ * reconciler derives names from here rather than composing a prefix of its own,
19
+ * and consumers of a bucket row never consult this policy: the recorded
20
+ * `physical_name` is authoritative.
21
21
  *
22
22
  * The scope is part of the digested identity untruncated, so two scopes of one
23
23
  * database that declare the same bucket key stay distinct even when their
24
24
  * readable labels truncate to the same thing.
25
25
  */
26
26
  export declare function physicalBucketName(identity: PhysicalBucketIdentity): string;
27
- /**
28
- * The prefixed physical-bucket naming policy:
29
- * `{prefix}-{bucketKey}-{digest}` (e.g. `myapp-public-3f9c1a2b7e04`).
30
- *
31
- * For a deployment that names its own bucket namespace — a single-app
32
- * installation, or the presigned-upload (lazy) path meeting a bucket an app
33
- * configured. A platform-provisioned bucket uses {@link physicalBucketName}
34
- * instead, whose components come from the bucket row rather than from
35
- * deployment config.
36
- */
37
- export declare function mintPhysicalBucketName(prefix: string, databaseId: string, bucketKey: string): string;
package/naming.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.physicalBucketName = physicalBucketName;
4
- exports.mintPhysicalBucketName = mintPhysicalBucketName;
5
4
  const crypto_1 = require("crypto");
6
5
  /** S3's hard ceiling on a bucket name. */
7
6
  const MAX_BUCKET_NAME_LENGTH = 63;
@@ -9,9 +8,6 @@ const MAX_BUCKET_NAME_LENGTH = 63;
9
8
  const MIN_BUCKET_NAME_LENGTH = 3;
10
9
  /** Hex characters of the identity digest kept as the uniqueness tail. */
11
10
  const IDENTITY_DIGEST_LENGTH = 12;
12
- /** Readable budget: how much of the name the prefix and key may each occupy. */
13
- const PREFIX_BUDGET = 20;
14
- const BUCKET_KEY_BUDGET = 63 - IDENTITY_DIGEST_LENGTH - PREFIX_BUDGET - 3;
15
11
  /**
16
12
  * Readable budgets for a name minted from a bucket's own identity.
17
13
  *
@@ -78,10 +74,10 @@ function assembleBucketName(readable, identity, describeIdentity) {
78
74
  *
79
75
  * This is the policy for a platform-provisioned bucket, and it takes no prefix
80
76
  * because there is no global bucket namespace to prefix into: a bucket belongs
81
- * to one database at one scope, and that is what its name should say. Callers
82
- * derive names from here rather than composing a prefix of their own, so the
83
- * policy can change in one place — and an already-provisioned bucket never
84
- * consults it at all, since the row's recorded `physical_name` is authoritative.
77
+ * to one database at one scope, and that is what its name should say. The
78
+ * reconciler derives names from here rather than composing a prefix of its own,
79
+ * and consumers of a bucket row never consult this policy: the recorded
80
+ * `physical_name` is authoritative.
85
81
  *
86
82
  * The scope is part of the digested identity untruncated, so two scopes of one
87
83
  * database that declare the same bucket key stay distinct even when their
@@ -95,19 +91,3 @@ function physicalBucketName(identity) {
95
91
  readableComponent(bucketKey, IDENTITY_KEY_BUDGET),
96
92
  ], `${scope}/${databaseId}/${bucketKey}`, `key "${bucketKey}" at scope "${scope}"`);
97
93
  }
98
- /**
99
- * The prefixed physical-bucket naming policy:
100
- * `{prefix}-{bucketKey}-{digest}` (e.g. `myapp-public-3f9c1a2b7e04`).
101
- *
102
- * For a deployment that names its own bucket namespace — a single-app
103
- * installation, or the presigned-upload (lazy) path meeting a bucket an app
104
- * configured. A platform-provisioned bucket uses {@link physicalBucketName}
105
- * instead, whose components come from the bucket row rather than from
106
- * deployment config.
107
- */
108
- function mintPhysicalBucketName(prefix, databaseId, bucketKey) {
109
- return assembleBucketName([
110
- readableComponent(prefix, PREFIX_BUDGET),
111
- readableComponent(bucketKey, BUCKET_KEY_BUDGET),
112
- ], `${prefix}/${databaseId}/${bucketKey}`, `key "${bucketKey}"`);
113
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/bucket-provisioner",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "S3-compatible bucket provisioning library — create buckets, configure privacy policies, CORS, and access controls",
6
6
  "main": "index.js",
@@ -44,5 +44,5 @@
44
44
  "storage",
45
45
  "constructive"
46
46
  ],
47
- "gitHead": "ec6638bb4a06080919cee7e9ebf48306a2535f2f"
47
+ "gitHead": "77d58bb93796be91d4e00156bb6847392584d3bc"
48
48
  }