@ngx-grpc/common
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -385,6 +385,10 @@ (function (global, factory) { | ||
* Converts Uint8Array to string as prescribed by protobuf bytes toJSON definition | ||
* Requires TextDecoder, if you need to support old browsers consider using polyfill, e.g. https://github.com/anonyco/FastestSmallestTextEncoderDecoder | ||
* Inspired by https://stackoverflow.com/a/9458996/1990451 | ||
*/ | ||
function uint8ArrayToBase64(array) { | ||
return btoa(new TextDecoder('utf-8').decode(array)); | ||
var res = ''; | ||
for (var i = 0; i < array.byteLength; i++) { | ||
res += String.fromCharCode(array[i]); | ||
} | ||
return window.btoa(res); | ||
} | ||
@@ -391,0 +395,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("@ngx-grpc/common",["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["ngx-grpc"]=t["ngx-grpc"]||{},t["ngx-grpc"].common={}))}(this,(function(t){"use strict";var e;(e=t.GrpcCallType||(t.GrpcCallType={}))[e.unary=0]="unary",e[e.serverStream=1]="serverStream";var n=function(t){this.data=t},r=function(t,e,n){this.statusCode=t,this.statusMessage=e,this.metadata=n},o=function(){function t(t){this.index=new Map,this.add(t)}return t.prototype.add=function(t){var e=this;t.forEach((function(t){return e.index.set(t.id,t)}))},t.prototype.get=function(t){return this.index.get(t)},t}();Object.create;function a(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}Object.create;var i=function(){function t(t){t=t||{},this.map=Object.keys(t).reduce((function(e,n){return e.set(n,t[n])}),new Map)}return t.prototype.set=function(t,e){this.map.set(t,e)},t.prototype.get=function(t){return this.map.get(t)},t.prototype.has=function(t){return this.map.has(t)},t.prototype.clone=function(){return new t(this.toObject())},t.prototype.toObject=function(){var t=this;return function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t}(this.map.keys()).reduce((function(e,n){var r;return Object.assign(Object.assign({},e),((r={})[n]=t.map.get(n),r))}),{})},t}();t.GrpcDataEvent=n,t.GrpcMessagePool=o,t.GrpcMetadata=i,t.GrpcStatusEvent=r,t.uint8ArrayToBase64=function(t){return btoa(new TextDecoder("utf-8").decode(t))},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("@ngx-grpc/common",["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["ngx-grpc"]=t["ngx-grpc"]||{},t["ngx-grpc"].common={}))}(this,(function(t){"use strict";var e;(e=t.GrpcCallType||(t.GrpcCallType={}))[e.unary=0]="unary",e[e.serverStream=1]="serverStream";var n=function(t){this.data=t},r=function(t,e,n){this.statusCode=t,this.statusMessage=e,this.metadata=n},o=function(){function t(t){this.index=new Map,this.add(t)}return t.prototype.add=function(t){var e=this;t.forEach((function(t){return e.index.set(t.id,t)}))},t.prototype.get=function(t){return this.index.get(t)},t}();Object.create;function a(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}Object.create;var i=function(){function t(t){t=t||{},this.map=Object.keys(t).reduce((function(e,n){return e.set(n,t[n])}),new Map)}return t.prototype.set=function(t,e){this.map.set(t,e)},t.prototype.get=function(t){return this.map.get(t)},t.prototype.has=function(t){return this.map.has(t)},t.prototype.clone=function(){return new t(this.toObject())},t.prototype.toObject=function(){var t=this;return function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t}(this.map.keys()).reduce((function(e,n){var r;return Object.assign(Object.assign({},e),((r={})[n]=t.map.get(n),r))}),{})},t}();t.GrpcDataEvent=n,t.GrpcMessagePool=o,t.GrpcMetadata=i,t.GrpcStatusEvent=r,t.uint8ArrayToBase64=function(t){for(var e="",n=0;n<t.byteLength;n++)e+=String.fromCharCode(t[n]);return window.btoa(e)},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ngx-grpc-common.umd.min.js.map |
/** | ||
* Converts Uint8Array to string as prescribed by protobuf bytes toJSON definition | ||
* Requires TextDecoder, if you need to support old browsers consider using polyfill, e.g. https://github.com/anonyco/FastestSmallestTextEncoderDecoder | ||
* Inspired by https://stackoverflow.com/a/9458996/1990451 | ||
*/ | ||
export function uint8ArrayToBase64(array) { | ||
return btoa(new TextDecoder('utf-8').decode(array)); | ||
let res = ''; | ||
for (let i = 0; i < array.byteLength; i++) { | ||
res += String.fromCharCode(array[i]); | ||
} | ||
return window.btoa(res); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiLi4vLi4vLi4vcGFja2FnZXMvY29tbW9uL3NyYy8iLCJzb3VyY2VzIjpbImxpYi91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0dBR0c7QUFDSCxNQUFNLFVBQVUsa0JBQWtCLENBQUMsS0FBaUI7SUFDbEQsT0FBTyxJQUFJLENBQUMsSUFBSSxXQUFXLENBQUMsT0FBTyxDQUFDLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUM7QUFDdEQsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29udmVydHMgVWludDhBcnJheSB0byBzdHJpbmcgYXMgcHJlc2NyaWJlZCBieSBwcm90b2J1ZiBieXRlcyB0b0pTT04gZGVmaW5pdGlvblxuICogUmVxdWlyZXMgVGV4dERlY29kZXIsIGlmIHlvdSB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YnkgaHR0cHM6Ly9zdGFja292ZXJmbG93LmNvbS9hLzk0NTg5OTYvMTk5MDQ1MVxuICovXG5leHBvcnQgZnVuY3Rpb24gdWludDhBcnJheVRvQmFzZTY0KGFycmF5OiBVaW50OEFycmF5KTogc3RyaW5nIHtcbiAgbGV0IHJlcyA9ICcnO1xuXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyYXkuYnl0ZUxlbmd0aDsgaSsrKSB7XG4gICAgcmVzICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYXJyYXlbaV0pO1xuICB9XG5cbiAgcmV0dXJuIHdpbmRvdy5idG9hKHJlcyk7XG59XG4iXX0= |
@@ -70,6 +70,10 @@ /** | ||
* Converts Uint8Array to string as prescribed by protobuf bytes toJSON definition | ||
* Requires TextDecoder, if you need to support old browsers consider using polyfill, e.g. https://github.com/anonyco/FastestSmallestTextEncoderDecoder | ||
* Inspired by https://stackoverflow.com/a/9458996/1990451 | ||
*/ | ||
function uint8ArrayToBase64(array) { | ||
return btoa(new TextDecoder('utf-8').decode(array)); | ||
let res = ''; | ||
for (let i = 0; i < array.byteLength; i++) { | ||
res += String.fromCharCode(array[i]); | ||
} | ||
return window.btoa(res); | ||
} | ||
@@ -76,0 +80,0 @@ |
/** | ||
* Converts Uint8Array to string as prescribed by protobuf bytes toJSON definition | ||
* Requires TextDecoder, if you need to support old browsers consider using polyfill, e.g. https://github.com/anonyco/FastestSmallestTextEncoderDecoder | ||
* Inspired by https://stackoverflow.com/a/9458996/1990451 | ||
*/ | ||
export declare function uint8ArrayToBase64(array: Uint8Array): string; |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"GrpcClientFactory":{"__symbolic":"interface"},"GrpcClient":{"__symbolic":"interface"},"GrpcCallType":{"unary":0,"serverStream":1},"GrpcRequest":{"__symbolic":"interface"},"GrpcDataEvent":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":8,"character":17,"context":{"typeName":"T"},"module":"./lib/grpc-event"}]}]}},"GrpcStatusEvent":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"GrpcMetadata"}]}]}},"GrpcEvent":{"__symbolic":"interface"},"GrpcMessage":{"__symbolic":"interface"},"ToProtobufJSONOptions":{"__symbolic":"interface"},"GrpcMessageClass":{"__symbolic":"interface"},"GrpcMessagePool":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"GrpcMessageClass"}]}]}],"add":[{"__symbolic":"method"}],"get":[{"__symbolic":"method"}]}},"GrpcMetadata":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":4,"character":24,"module":"./lib/grpc-metadata"}]}],"set":[{"__symbolic":"method"}],"get":[{"__symbolic":"method"}],"has":[{"__symbolic":"method"}],"clone":[{"__symbolic":"method"}],"toObject":[{"__symbolic":"method"}]}},"RecursivePartial":{"__symbolic":"interface"},"uint8ArrayToBase64":{"__symbolic":"function","parameters":["array"],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"btoa"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"TextDecoder"},"arguments":["utf-8"]},"member":"decode"},"arguments":[{"__symbolic":"reference","name":"array"}]}]}}},"origins":{"GrpcClientFactory":"./lib/grpc-client","GrpcClient":"./lib/grpc-client","GrpcCallType":"./lib/grpc-client","GrpcRequest":"./lib/grpc-client","GrpcDataEvent":"./lib/grpc-event","GrpcStatusEvent":"./lib/grpc-event","GrpcEvent":"./lib/grpc-event","GrpcMessage":"./lib/grpc-message","ToProtobufJSONOptions":"./lib/grpc-message","GrpcMessageClass":"./lib/grpc-message-class","GrpcMessagePool":"./lib/grpc-message-pool","GrpcMetadata":"./lib/grpc-metadata","RecursivePartial":"./lib/recursive-partial","uint8ArrayToBase64":"./lib/utils"},"importAs":"@ngx-grpc/common"} | ||
{"__symbolic":"module","version":4,"metadata":{"GrpcClientFactory":{"__symbolic":"interface"},"GrpcClient":{"__symbolic":"interface"},"GrpcCallType":{"unary":0,"serverStream":1},"GrpcRequest":{"__symbolic":"interface"},"GrpcDataEvent":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":8,"character":17,"context":{"typeName":"T"},"module":"./lib/grpc-event"}]}]}},"GrpcStatusEvent":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"GrpcMetadata"}]}]}},"GrpcEvent":{"__symbolic":"interface"},"GrpcMessage":{"__symbolic":"interface"},"ToProtobufJSONOptions":{"__symbolic":"interface"},"GrpcMessageClass":{"__symbolic":"interface"},"GrpcMessagePool":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"GrpcMessageClass"}]}]}],"add":[{"__symbolic":"method"}],"get":[{"__symbolic":"method"}]}},"GrpcMetadata":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":4,"character":24,"module":"./lib/grpc-metadata"}]}],"set":[{"__symbolic":"method"}],"get":[{"__symbolic":"method"}],"has":[{"__symbolic":"method"}],"clone":[{"__symbolic":"method"}],"toObject":[{"__symbolic":"method"}]}},"RecursivePartial":{"__symbolic":"interface"},"uint8ArrayToBase64":{"__symbolic":"function"}},"origins":{"GrpcClientFactory":"./lib/grpc-client","GrpcClient":"./lib/grpc-client","GrpcCallType":"./lib/grpc-client","GrpcRequest":"./lib/grpc-client","GrpcDataEvent":"./lib/grpc-event","GrpcStatusEvent":"./lib/grpc-event","GrpcEvent":"./lib/grpc-event","GrpcMessage":"./lib/grpc-message","ToProtobufJSONOptions":"./lib/grpc-message","GrpcMessageClass":"./lib/grpc-message-class","GrpcMessagePool":"./lib/grpc-message-pool","GrpcMetadata":"./lib/grpc-metadata","RecursivePartial":"./lib/recursive-partial","uint8ArrayToBase64":"./lib/utils"},"importAs":"@ngx-grpc/common"} |
@@ -25,3 +25,3 @@ { | ||
"sideEffects": false, | ||
"version": "2.0.1" | ||
"version": "2.0.2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109855
756