@bitsness/grapuco-cli 0.1.11 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +20 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -138,10 +138,11 @@ var init_config = __esm({
138
138
  });
139
139
 
140
140
  // src/lib/api-client.ts
141
- var ApiClient;
141
+ var import_node_zlib, ApiClient;
142
142
  var init_api_client = __esm({
143
143
  "src/lib/api-client.ts"() {
144
144
  "use strict";
145
+ import_node_zlib = require("zlib");
145
146
  init_config();
146
147
  ApiClient = class {
147
148
  server;
@@ -160,11 +161,22 @@ var init_api_client = __esm({
160
161
  "X-Api-Key": this.apiKey,
161
162
  "Content-Type": "application/json"
162
163
  };
164
+ let requestBody;
165
+ if (body) {
166
+ const json = JSON.stringify(body);
167
+ if (json.length > 1e6) {
168
+ const compressed = (0, import_node_zlib.gzipSync)(Buffer.from(json));
169
+ requestBody = new Blob([compressed]);
170
+ headers["Content-Encoding"] = "gzip";
171
+ } else {
172
+ requestBody = json;
173
+ }
174
+ }
163
175
  try {
164
176
  const res = await fetch(url, {
165
177
  method,
166
178
  headers,
167
- body: body ? JSON.stringify(body) : void 0
179
+ body: requestBody
168
180
  });
169
181
  let data;
170
182
  const contentType = res.headers.get("content-type") || "";
@@ -6568,6 +6580,11 @@ async function ingestCommand(opts) {
6568
6580
  console.log(import_chalk3.default.gray(" Hash cache updated for future delta detection.\n"));
6569
6581
  return;
6570
6582
  }
6583
+ const payloadEst = JSON.stringify(parseResult).length;
6584
+ const payloadMB = (payloadEst / 1e6).toFixed(1);
6585
+ if (payloadEst > 1e6) {
6586
+ console.log(import_chalk3.default.gray(` Payload: ~${payloadMB}MB raw \u2192 will be gzip compressed for upload`));
6587
+ }
6571
6588
  const pushSpinner = (0, import_ora.default)("Uploading architecture map to server...").start();
6572
6589
  const client = new ApiClient({ server: creds.server, apiKey: creds.apiKey });
6573
6590
  const result = await client.cliIngest(config.repoId, {
@@ -6712,7 +6729,7 @@ var require_package = __commonJS({
6712
6729
  "package.json"(exports2, module2) {
6713
6730
  module2.exports = {
6714
6731
  name: "@bitsness/grapuco-cli",
6715
- version: "0.1.11",
6732
+ version: "0.1.12",
6716
6733
  description: "Grapuco CLI \u2014 Parse your code locally, sync architecture to cloud. Zero source code upload.",
6717
6734
  type: "commonjs",
6718
6735
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitsness/grapuco-cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Grapuco CLI — Parse your code locally, sync architecture to cloud. Zero source code upload.",
5
5
  "type": "commonjs",
6
6
  "bin": {