@mochabug/adaptkit 0.12.14 → 0.12.15

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
@@ -1852,11 +1852,9 @@ async function sendPlugin(manifest, client, metadata) {
1852
1852
  }
1853
1853
  await stream.requests.complete();
1854
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'));
1855
+ const trailers = await stream.trailers;
1856
+ const headers = await stream.trailers;
1857
+ printRpcSuccess(status, headers, trailers);
1860
1858
  }
1861
1859
  async function emulate(manifest, host) {
1862
1860
  const transport = new GrpcTransport({
@@ -1903,34 +1901,66 @@ async function publish(manifest, host, accessToken, insecure) {
1903
1901
  console.log(`For more information, use: ${chalk.blue('adaptkit help publish')}`);
1904
1902
  }
1905
1903
  }
1904
+ function printRpcSuccess(status, headers, trailers) {
1905
+ const line = chalk.green('==================================================');
1906
+ const title = chalk.bgGreen.black.bold(' RPC Success Details ');
1907
+ const statusCode = chalk.bold.white('Status Code: ') + chalk.greenBright.bold(status.code);
1908
+ const statusDetail = status.detail
1909
+ ? chalk.bold.white('Details: ') + chalk.greenBright(status.detail)
1910
+ : chalk.gray('No Details Provided');
1911
+ const headerInfo = chalk.bold.white('Headers:\n') +
1912
+ (headers && headers.meta
1913
+ ? chalk.blue(JSON.stringify(headers.meta, null, 2))
1914
+ : chalk.gray(' No Metadata'));
1915
+ const trailerInfo = chalk.bold.white('Trailers:\n') +
1916
+ (trailers && trailers.meta
1917
+ ? chalk.blue(JSON.stringify(trailers.meta, null, 2))
1918
+ : chalk.gray(' No Trailers'));
1919
+ console.log(line);
1920
+ console.log(title);
1921
+ console.log(line);
1922
+ console.log(statusCode);
1923
+ console.log(statusDetail);
1924
+ console.log(line);
1925
+ console.log(headerInfo);
1926
+ console.log(line);
1927
+ console.log(trailerInfo);
1928
+ console.log(line);
1929
+ console.log(chalk.bgGreen.black.bold(' SUCCESS '));
1930
+ console.log(line);
1931
+ }
1906
1932
  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);
1933
+ const line = chalk.red('==================================================');
1934
+ const title = chalk.bgRed.white.bold(' RPC Error Details ');
1935
+ const name = chalk.bold.white('Name: ') + chalk.redBright.bold(error.name);
1910
1936
  const message = chalk.bold.white('Message: ') + chalk.redBright(error.message);
1911
- const code = chalk.bold.white('Code: ') + chalk.redBright(error.code);
1937
+ const code = chalk.bold.white('Code: ') + chalk.redBright.bold(error.code);
1912
1938
  const methodName = error.methodName
1913
1939
  ? chalk.bold.white('Method Name: ') + chalk.yellowBright(error.methodName)
1914
- : '';
1940
+ : chalk.gray('No Method Name');
1915
1941
  const serviceName = error.serviceName
1916
1942
  ? chalk.bold.white('Service Name: ') + chalk.yellowBright(error.serviceName)
1917
- : '';
1918
- const meta = chalk.bold.white('Metadata: ') +
1943
+ : chalk.gray('No Service Name');
1944
+ const meta = chalk.bold.white('Metadata:\n') +
1919
1945
  (error.meta
1920
1946
  ? chalk.blue(JSON.stringify(error.meta, null, 2))
1921
- : chalk.gray('No Metadata'));
1947
+ : chalk.gray(' No Metadata'));
1922
1948
  console.error(line);
1923
1949
  console.error(title);
1924
1950
  console.error(line);
1925
1951
  console.error(name);
1926
1952
  console.error(message);
1927
1953
  console.error(code);
1954
+ console.error(line);
1928
1955
  if (methodName)
1929
1956
  console.error(methodName);
1930
1957
  if (serviceName)
1931
1958
  console.error(serviceName);
1959
+ console.error(line);
1932
1960
  console.error(meta);
1933
1961
  console.error(line);
1962
+ console.error(chalk.bgRed.white.bold(' ERROR '));
1963
+ console.error(line);
1934
1964
  }
1935
1965
 
1936
1966
  // Copyright 2023, mochabug AB
@@ -2082,7 +2112,7 @@ function handleVersion(bump, cmd) {
2082
2112
  }
2083
2113
  async function main() {
2084
2114
  const notifier = updateNotifier({
2085
- pkg: JSON.parse('{"name":"@mochabug/adaptkit","version":"0.12.14"}')
2115
+ pkg: JSON.parse('{"name":"@mochabug/adaptkit","version":"0.12.15"}')
2086
2116
  });
2087
2117
  notifier.notify({ isGlobal: true, defer: false });
2088
2118
  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;AA+L1D,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.15",
4
4
  "description": "A cmd to create, emulate and publish Mochabug Adapt plugins",
5
5
  "main": "bin/index.js",
6
6
  "type": "module",