@hypequery/deployment 0.6.0 → 0.7.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.
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAQA,OAAO,EAKL,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAChC,MAAM,qBAAqB,CAAC;AAE7B,eAAO,MAAM,0BAA0B,gBAAgB,CAAC;AACxD,eAAO,MAAM,0BAA0B,oBAAoB,CAAC;AAE5D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,gCAAgC,CAAC;IACpD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;CAC/C;AAoKD,wBAAsB,sBAAsB,CAC1C,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,wBAAwB,CAAC,CA2DnC"}
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAQA,OAAO,EAKL,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAChC,MAAM,qBAAqB,CAAC;AAE7B,eAAO,MAAM,0BAA0B,gBAAgB,CAAC;AACxD,eAAO,MAAM,0BAA0B,oBAAoB,CAAC;AAE5D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,gCAAgC,CAAC;IACpD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;CAC/C;AAsKD,wBAAsB,sBAAsB,CAC1C,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,wBAAwB,CAAC,CAwEnC"}
package/dist/bundle.js CHANGED
@@ -14,7 +14,7 @@ function errorCode(error) {
14
14
  function sha256(bytes) {
15
15
  return createHash('sha256').update(bytes).digest('hex');
16
16
  }
17
- async function readBoundedRegularFile(root, relativePath, maximum) {
17
+ async function readBoundedRegularFile(root, relativePath, maximum, allowEmpty = false) {
18
18
  const absolutePath = path.join(root, ...relativePath.split('/'));
19
19
  let handle;
20
20
  try {
@@ -25,14 +25,14 @@ async function readBoundedRegularFile(root, relativePath, maximum) {
25
25
  if (!initialStat.isFile()) {
26
26
  throw new Error(`Bundle entry is not a regular file: ${relativePath}`);
27
27
  }
28
- if (initialStat.size < 1 || initialStat.size > maximum) {
28
+ if (initialStat.size < (allowEmpty ? 0 : 1) || initialStat.size > maximum) {
29
29
  throw new Error(`Bundle entry exceeds its byte limit: ${relativePath}`);
30
30
  }
31
31
  handle = await open(absolutePath, constants.O_RDONLY | constants.O_NOFOLLOW);
32
32
  const stat = await handle.stat();
33
33
  if (!stat.isFile())
34
34
  throw new Error(`Bundle entry is not a regular file: ${relativePath}`);
35
- if (stat.size < 1 || stat.size > maximum) {
35
+ if (stat.size < (allowEmpty ? 0 : 1) || stat.size > maximum) {
36
36
  throw new Error(`Bundle entry exceeds its byte limit: ${relativePath}`);
37
37
  }
38
38
  return await handle.readFile();
@@ -62,6 +62,7 @@ async function verifyExactEntries(root, manifest) {
62
62
  DEPLOYMENT_BUNDLE_MANIFEST,
63
63
  manifest.deployment.path,
64
64
  ...manifest.artifacts.map(artifact => artifact.path),
65
+ ...(manifest.source?.files.map(file => `${manifest.source.root}/${file.path}`) ?? []),
65
66
  ]);
66
67
  const expectedDirectoryPaths = expectedDirectories([...expectedFiles]);
67
68
  const seenFiles = new Set();
@@ -183,6 +184,14 @@ export async function verifyDeploymentBundle(bundleDirectory) {
183
184
  const bytes = await readBoundedRegularFile(root, artifact.path, DEFAULT_PROTOCOL_DEPLOYMENT_BUNDLE_LIMITS.maxArtifactBytes);
184
185
  verifyFile(bytes, artifact);
185
186
  }
187
+ const source = preparedManifest.manifest.source;
188
+ if (source) {
189
+ for (const file of source.files) {
190
+ const bundlePath = `${source.root}/${file.path}`;
191
+ const bytes = await readBoundedRegularFile(root, bundlePath, DEFAULT_PROTOCOL_DEPLOYMENT_BUNDLE_LIMITS.maxSourceFileBytes, true);
192
+ verifyFile(bytes, { ...file, path: bundlePath });
193
+ }
194
+ }
186
195
  verifyRuntimeReferences(preparedContract.contract, preparedManifest.manifest.artifacts);
187
196
  return Object.freeze({
188
197
  directory: root,
@@ -1 +1 @@
1
- {"version":3,"file":"intake.d.ts","sourceRoot":"","sources":["../src/intake.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EAIxB,MAAM,YAAY,CAAC;AAoSpB,wBAAgB,sBAAsB,CAAC,SAAS,EAC9C,OAAO,EAAE,uBAAuB,CAAC,SAAS,CAAC,GAC1C,gBAAgB,CA6HlB"}
1
+ {"version":3,"file":"intake.d.ts","sourceRoot":"","sources":["../src/intake.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EAIxB,MAAM,YAAY,CAAC;AAuSpB,wBAAgB,sBAAsB,CAAC,SAAS,EAC9C,OAAO,EAAE,uBAAuB,CAAC,SAAS,CAAC,GAC1C,gBAAgB,CAiIlB"}
package/dist/intake.js CHANGED
@@ -88,6 +88,7 @@ function requireReconstructablePaths(manifest) {
88
88
  const files = [
89
89
  manifest.manifest.deployment.path,
90
90
  ...manifest.manifest.artifacts.map(artifact => artifact.path),
91
+ ...(manifest.manifest.source?.files.map(file => `${manifest.manifest.source.root}/${file.path}`) ?? []),
91
92
  ];
92
93
  const fileSet = new Set(files);
93
94
  if (fileSet.has(DEPLOYMENT_BUNDLE_MANIFEST)) {
@@ -284,6 +285,10 @@ export function createDeploymentIntake(options) {
284
285
  const files = [
285
286
  manifest.prepared.manifest.deployment,
286
287
  ...manifest.prepared.manifest.artifacts,
288
+ ...(manifest.prepared.manifest.source?.files.map(file => ({
289
+ ...file,
290
+ path: `${manifest.prepared.manifest.source.root}/${file.path}`,
291
+ })) ?? []),
287
292
  ];
288
293
  for (let index = 0; index < files.length; index += 1) {
289
294
  await receiveBundleFile(reader, bundleRoot, files[index], index === 0 ? 'application/json' : 'application/octet-stream', index === files.length - 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypequery/deployment",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Provider-neutral deployment verification and intake for Hypequery",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  "README.md"
19
19
  ],
20
20
  "dependencies": {
21
- "@hypequery/protocol": "0.9.0"
21
+ "@hypequery/protocol": "0.10.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.5.0",