@prisma/composer-prisma-cloud 0.2.0-dev.10 → 0.2.0-dev.12
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/dist/control.mjs +33 -19
- package/dist/control.mjs.map +1 -1
- package/dist/storage/storage-entrypoint.mjs +4 -21
- package/dist/storage/storage-entrypoint.mjs.map +1 -1
- package/dist/storage/testing.d.mts +7 -6
- package/dist/storage/testing.d.mts.map +1 -1
- package/dist/storage/testing.mjs +4 -21
- package/dist/storage/testing.mjs.map +1 -1
- package/package.json +15 -14
package/dist/control.mjs
CHANGED
|
@@ -1403,6 +1403,32 @@ const prismaStateLayer = (ids) => {
|
|
|
1403
1403
|
})).pipe(Layer.orDie);
|
|
1404
1404
|
};
|
|
1405
1405
|
//#endregion
|
|
1406
|
+
//#region ../../1-prisma-cloud/0-lowering/s3-protocol/dist/index.mjs
|
|
1407
|
+
/**
|
|
1408
|
+
* AWS SigV4 verification for the S3 wire protocol (spec § 2 auth). The payload
|
|
1409
|
+
* hash comes from the client — `x-amz-content-sha256` (a real hash or
|
|
1410
|
+
* `UNSIGNED-PAYLOAD`) for header auth, `UNSIGNED-PAYLOAD` for presign — and is
|
|
1411
|
+
* never re-hashed; the verifier trusts what was signed, like a real S3 endpoint.
|
|
1412
|
+
* Runtime engine code (`node:crypto`); not re-exported from the authoring barrel.
|
|
1413
|
+
*
|
|
1414
|
+
* Also owns `mintKeyPair` (local-dev spec § 1) — the one key-pair generator
|
|
1415
|
+
* both the deploy-time `S3Credentials` resource and the local dev bucket
|
|
1416
|
+
* emulator's credential provisioning use.
|
|
1417
|
+
*/
|
|
1418
|
+
function randomBytes(n) {
|
|
1419
|
+
return crypto.getRandomValues(new Uint8Array(n));
|
|
1420
|
+
}
|
|
1421
|
+
function toHexUpper(bytes) {
|
|
1422
|
+
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
1423
|
+
}
|
|
1424
|
+
/** A fresh SigV4 key pair: an AKIA-prefixed id and a 40-char base64 secret. */
|
|
1425
|
+
function mintKeyPair() {
|
|
1426
|
+
return {
|
|
1427
|
+
accessKeyId: `AKIA${toHexUpper(randomBytes(8))}`,
|
|
1428
|
+
secretAccessKey: btoa(String.fromCharCode(...randomBytes(30)))
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
//#endregion
|
|
1406
1432
|
//#region ../../1-prisma-cloud/1-extensions/target/dist/control.mjs
|
|
1407
1433
|
const PRISMA_CLOUD_EXTENSION_ID = "@prisma/composer-prisma-cloud";
|
|
1408
1434
|
var PrismaCloudContainer = class {
|
|
@@ -2093,31 +2119,19 @@ function prismaNextDescriptor(o) {
|
|
|
2093
2119
|
/**
|
|
2094
2120
|
* The `S3Credentials` Alchemy resource (S5) — mints a random SigV4 key pair
|
|
2095
2121
|
* ONCE at create and keeps it STABLE across deploys, so an unchanged module
|
|
2096
|
-
* no-ops on redeploy. The pair is generated
|
|
2097
|
-
*
|
|
2098
|
-
*
|
|
2099
|
-
* apply the provider returns the persisted attributes
|
|
2100
|
-
* unchanged — the same way the postgres resource
|
|
2101
|
-
* Rotation is destroy/recreate (a platform ask,
|
|
2122
|
+
* no-ops on redeploy. The pair is generated by `@internal/s3-protocol`'s
|
|
2123
|
+
* `mintKeyPair` (moved there per the local-dev spec § 1, so deploy and local
|
|
2124
|
+
* dev credential minting share one implementation) and persisted in Alchemy
|
|
2125
|
+
* state; on every later apply the provider returns the persisted attributes
|
|
2126
|
+
* (`reconcile`'s `output`) unchanged — the same way the postgres resource
|
|
2127
|
+
* keeps a Connection stable. Rotation is destroy/recreate (a platform ask,
|
|
2128
|
+
* not solved here).
|
|
2102
2129
|
*
|
|
2103
2130
|
* Deploy-time only: imports `alchemy`. Imported by `control.ts` and tests,
|
|
2104
2131
|
* never by `index.ts` / the authoring entry.
|
|
2105
2132
|
*/
|
|
2106
2133
|
/** The `S3Credentials` resource constructor — `yield* S3Credentials(id, {})` in the lowering. */
|
|
2107
2134
|
const S3Credentials = Resource("PrismaCloud.S3Credentials");
|
|
2108
|
-
function randomBytes(n) {
|
|
2109
|
-
return crypto.getRandomValues(new Uint8Array(n));
|
|
2110
|
-
}
|
|
2111
|
-
function toHexUpper(bytes) {
|
|
2112
|
-
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
2113
|
-
}
|
|
2114
|
-
/** A fresh SigV4 key pair: an AKIA-prefixed id and a 40-char base64 secret. */
|
|
2115
|
-
function mintKeyPair() {
|
|
2116
|
-
return {
|
|
2117
|
-
accessKeyId: `AKIA${toHexUpper(randomBytes(8))}`,
|
|
2118
|
-
secretAccessKey: btoa(String.fromCharCode(...randomBytes(30)))
|
|
2119
|
-
};
|
|
2120
|
-
}
|
|
2121
2135
|
/**
|
|
2122
2136
|
* The `S3Credentials` provider service. `reconcile` runs for create and update;
|
|
2123
2137
|
* it returns the persisted `output` when present (a redeploy reuses the stored
|