@mochabug/adaptkit 0.12.14 → 0.12.16

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/bin/index.js CHANGED
@@ -1851,12 +1851,7 @@ async function sendPlugin(manifest, client, metadata) {
1851
1851
  await send(vertex.config);
1852
1852
  }
1853
1853
  await stream.requests.complete();
1854
- const status = await stream.status;
1855
- console.error(chalk.green(`Status Code: ${status.code}`));
1856
- console.error(chalk.green(`Details: ${status.detail}`));
1857
- const result = await stream.response;
1858
- console.log(result);
1859
- console.log(chalk.bgGreen('SUCCESS'));
1854
+ printRpcSuccess(await stream.status, await stream.headers, await stream.trailers);
1860
1855
  }
1861
1856
  async function emulate(manifest, host) {
1862
1857
  const transport = new GrpcTransport({
@@ -1903,34 +1898,66 @@ async function publish(manifest, host, accessToken, insecure) {
1903
1898
  console.log(`For more information, use: ${chalk.blue('adaptkit help publish')}`);
1904
1899
  }
1905
1900
  }
1901
+ function printRpcSuccess(status, headers, trailers) {
1902
+ const line = chalk.green('==================================================');
1903
+ const title = chalk.bgGreen.black.bold(' RPC Success Details ');
1904
+ const statusCode = chalk.bold.white('Status Code: ') + chalk.greenBright.bold(status.code);
1905
+ const statusDetail = status.detail
1906
+ ? chalk.bold.white('Details: ') + chalk.greenBright(status.detail)
1907
+ : chalk.gray('No Details Provided');
1908
+ const headerInfo = chalk.bold.white('Headers:\n') +
1909
+ (headers && headers.meta
1910
+ ? chalk.blue(JSON.stringify(headers.meta, null, 2))
1911
+ : chalk.gray(' No Metadata'));
1912
+ const trailerInfo = chalk.bold.white('Trailers:\n') +
1913
+ (trailers && trailers.meta
1914
+ ? chalk.blue(JSON.stringify(trailers.meta, null, 2))
1915
+ : chalk.gray(' No Trailers'));
1916
+ console.log(line);
1917
+ console.log(title);
1918
+ console.log(line);
1919
+ console.log(statusCode);
1920
+ console.log(statusDetail);
1921
+ console.log(line);
1922
+ console.log(headerInfo);
1923
+ console.log(line);
1924
+ console.log(trailerInfo);
1925
+ console.log(line);
1926
+ console.log(chalk.bgGreen.black.bold(' SUCCESS '));
1927
+ console.log(line);
1928
+ }
1906
1929
  function printRpcError(error) {
1907
- const line = chalk.red('--------------------------------------------------');
1908
- const title = chalk.bold.red('RPC Error Details');
1909
- const name = chalk.bold.white('Name: ') + chalk.redBright(error.name);
1930
+ const line = chalk.red('==================================================');
1931
+ const title = chalk.bgRed.white.bold(' RPC Error Details ');
1932
+ const name = chalk.bold.white('Name: ') + chalk.redBright.bold(error.name);
1910
1933
  const message = chalk.bold.white('Message: ') + chalk.redBright(error.message);
1911
- const code = chalk.bold.white('Code: ') + chalk.redBright(error.code);
1934
+ const code = chalk.bold.white('Code: ') + chalk.redBright.bold(error.code);
1912
1935
  const methodName = error.methodName
1913
1936
  ? chalk.bold.white('Method Name: ') + chalk.yellowBright(error.methodName)
1914
- : '';
1937
+ : chalk.gray('No Method Name');
1915
1938
  const serviceName = error.serviceName
1916
1939
  ? chalk.bold.white('Service Name: ') + chalk.yellowBright(error.serviceName)
1917
- : '';
1918
- const meta = chalk.bold.white('Metadata: ') +
1940
+ : chalk.gray('No Service Name');
1941
+ const meta = chalk.bold.white('Metadata:\n') +
1919
1942
  (error.meta
1920
1943
  ? chalk.blue(JSON.stringify(error.meta, null, 2))
1921
- : chalk.gray('No Metadata'));
1944
+ : chalk.gray(' No Metadata'));
1922
1945
  console.error(line);
1923
1946
  console.error(title);
1924
1947
  console.error(line);
1925
1948
  console.error(name);
1926
1949
  console.error(message);
1927
1950
  console.error(code);
1951
+ console.error(line);
1928
1952
  if (methodName)
1929
1953
  console.error(methodName);
1930
1954
  if (serviceName)
1931
1955
  console.error(serviceName);
1956
+ console.error(line);
1932
1957
  console.error(meta);
1933
1958
  console.error(line);
1959
+ console.error(chalk.bgRed.white.bold(' ERROR '));
1960
+ console.error(line);
1934
1961
  }
1935
1962
 
1936
1963
  // Copyright 2023, mochabug AB
@@ -2082,7 +2109,7 @@ function handleVersion(bump, cmd) {
2082
2109
  }
2083
2110
  async function main() {
2084
2111
  const notifier = updateNotifier({
2085
- pkg: JSON.parse('{"name":"@mochabug/adaptkit","version":"0.12.14"}')
2112
+ pkg: JSON.parse('{"name":"@mochabug/adaptkit","version":"0.12.16"}')
2086
2113
  });
2087
2114
  notifier.notify({ isGlobal: true, defer: false });
2088
2115
  program
@@ -1 +1 @@
1
- {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,QAAQ,EAET,MAAM,kDAAkD,CAAC;AAiM1D,wBAAsB,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,iBAkB7D;AAED,wBAAsB,OAAO,CAC3B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,OAAO,iBA0BlB"}
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,QAAQ,EAET,MAAM,kDAAkD,CAAC;AAgM1D,wBAAsB,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,iBAkB7D;AAED,wBAAsB,OAAO,CAC3B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,OAAO,iBA0BlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mochabug/adaptkit",
3
- "version": "0.12.14",
3
+ "version": "0.12.16",
4
4
  "description": "A cmd to create, emulate and publish Mochabug Adapt plugins",
5
5
  "main": "bin/index.js",
6
6
  "type": "module",